UNPKG

@zxing/library

Version:

TypeScript port of ZXing multi-format 1D/2D barcode image processing library.

1 lines 202 kB
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("ZXing",[],e):"object"==typeof exports?exports.ZXing=e():t.ZXing=e()}(window,function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=71)}([function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0});var a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e}(r(6).default);e.default=a},function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0});var a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e}(r(6).default);e.default=a},function(t,e,r){"use strict";var n,o;Object.defineProperty(e,"__esModule",{value:!0}),(o=n||(n={}))[o.AZTEC=0]="AZTEC",o[o.CODABAR=1]="CODABAR",o[o.CODE_39=2]="CODE_39",o[o.CODE_93=3]="CODE_93",o[o.CODE_128=4]="CODE_128",o[o.DATA_MATRIX=5]="DATA_MATRIX",o[o.EAN_8=6]="EAN_8",o[o.EAN_13=7]="EAN_13",o[o.ITF=8]="ITF",o[o.MAXICODE=9]="MAXICODE",o[o.PDF_417=10]="PDF_417",o[o.QR_CODE=11]="QR_CODE",o[o.RSS_14=12]="RSS_14",o[o.RSS_EXPANDED=13]="RSS_EXPANDED",o[o.UPC_A=14]="UPC_A",o[o.UPC_E=15]="UPC_E",o[o.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION",e.default=n},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(13),o=r(74),a=function(){function t(t,e){this.x=t,this.y=e}return t.prototype.getX=function(){return this.x},t.prototype.getY=function(){return this.y},t.prototype.equals=function(e){if(e instanceof t){var r=e;return this.x===r.x&&this.y===r.y}return!1},t.prototype.hashCode=function(){return 31*o.default.floatToIntBits(this.x)+o.default.floatToIntBits(this.y)},t.prototype.toString=function(){return"("+this.x+","+this.y+")"},t.orderBestPatterns=function(t){var e,r,n,o=this.distance(t[0],t[1]),a=this.distance(t[1],t[2]),i=this.distance(t[0],t[2]);if(n=o<=a&&i<=a?(r=t[0],e=t[1],t[2]):a<=i&&o<=i?(r=t[1],e=t[0],t[2]):(r=t[2],e=t[0],t[1]),this.crossProductZ(e,r,n)<0){var u=e;e=n,n=u}t[0]=e,t[1]=r,t[2]=n},t.distance=function(t,e){return n.default.distance(t.x,t.y,e.x,e.y)},t.crossProductZ=function(t,e,r){var n=e.x,o=e.y;return(r.x-n)*(t.y-o)-(r.y-o)*(t.x-n)},t}();e.default=a},function(t,e,r){"use strict";var n,o;Object.defineProperty(e,"__esModule",{value:!0}),(o=n||(n={}))[o.OTHER=0]="OTHER",o[o.PURE_BARCODE=1]="PURE_BARCODE",o[o.POSSIBLE_FORMATS=2]="POSSIBLE_FORMATS",o[o.TRY_HARDER=3]="TRY_HARDER",o[o.CHARACTER_SET=4]="CHARACTER_SET",o[o.ALLOWED_LENGTHS=5]="ALLOWED_LENGTHS",o[o.ASSUME_CODE_39_CHECK_DIGIT=6]="ASSUME_CODE_39_CHECK_DIGIT",o[o.ASSUME_GS1=7]="ASSUME_GS1",o[o.RETURN_CODABAR_START_END=8]="RETURN_CODABAR_START_END",o[o.NEED_RESULT_POINT_CALLBACK=9]="NEED_RESULT_POINT_CALLBACK",o[o.ALLOWED_EAN_EXTENSIONS=10]="ALLOWED_EAN_EXTENSIONS",e.default=n},function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0});var a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e}(r(6).default);e.default=a},function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0});var a=function(t){function e(e){void 0===e&&(e=void 0);var r=t.call(this,e)||this;return r.message=e,r}return o(e,t),e}(r(73).CustomError);e.default=a},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(){}return t.arraycopy=function(t,e,r,n,o){for(;o--;)r[n++]=t[e++]},t.currentTimeMillis=function(){return Date.now()},t}();e.default=n},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(15),o=r(7),a=r(28),i=r(11),u=r(1),f=function(){function t(t,e,r,n){if(this.width=t,this.height=e,this.rowSize=r,this.bits=n,null==e&&(e=t),this.height=e,t<1||e<1)throw new u.default("Both dimensions must be greater than 0");null==r&&(r=Math.floor((t+31)/32)),this.rowSize=r,null==n&&(this.bits=new Int32Array(this.rowSize*this.height))}return t.parseFromBooleanArray=function(e){for(var r=e.length,n=e[0].length,o=new t(n,r),a=0;a<r;a++)for(var i=e[a],u=0;u<n;u++)i[u]&&o.set(u,a);return o},t.parseFromString=function(e,r,n){if(null===e)throw new u.default("stringRepresentation cannot be null");for(var o=new Array(e.length),a=0,i=0,f=-1,s=0,d=0;d<e.length;)if("\n"===e.charAt(d)||"\r"===e.charAt(d)){if(i<a){if(-1===f)f=a-i;else if(a-i!==f)throw new u.default("row lengths do not match");i=a,s++}d++}else if(e.substring(d,d+r.length)===r)d+=r.length,o[a]=!0,a++;else{if(e.substring(d,d+n.length)!==n)throw new u.default("illegal character encountered: "+e.substring(d));d+=n.length,o[a]=!1,a++}if(i<a){if(-1===f)f=a-i;else if(a-i!==f)throw new u.default("row lengths do not match");s++}for(var l=new t(f,s),c=0;c<a;c++)o[c]&&l.set(Math.floor(c%f),Math.floor(c/f));return l},t.prototype.get=function(t,e){var r=e*this.rowSize+Math.floor(t/32);return 0!=(this.bits[r]>>>(31&t)&1)},t.prototype.set=function(t,e){var r=e*this.rowSize+Math.floor(t/32);this.bits[r]|=1<<(31&t)&4294967295},t.prototype.unset=function(t,e){var r=e*this.rowSize+Math.floor(t/32);this.bits[r]&=~(1<<(31&t)&4294967295)},t.prototype.flip=function(t,e){var r=e*this.rowSize+Math.floor(t/32);this.bits[r]^=1<<(31&t)&4294967295},t.prototype.xor=function(t){if(this.width!==t.getWidth()||this.height!==t.getHeight()||this.rowSize!==t.getRowSize())throw new u.default("input matrix dimensions do not match");for(var e=new n.default(Math.floor(this.width/32)+1),r=this.rowSize,o=this.bits,a=0,i=this.height;a<i;a++)for(var f=a*r,s=t.getRow(a,e).getBitArray(),d=0;d<r;d++)o[f+d]^=s[d]},t.prototype.clear=function(){for(var t=this.bits,e=t.length,r=0;r<e;r++)t[r]=0},t.prototype.setRegion=function(t,e,r,n){if(e<0||t<0)throw new u.default("Left and top must be nonnegative");if(n<1||r<1)throw new u.default("Height and width must be at least 1");var o=t+r,a=e+n;if(a>this.height||o>this.width)throw new u.default("The region must fit inside the matrix");for(var i=this.rowSize,f=this.bits,s=e;s<a;s++)for(var d=s*i,l=t;l<o;l++)f[d+Math.floor(l/32)]|=1<<(31&l)&4294967295},t.prototype.getRow=function(t,e){null==e||e.getSize()<this.width?e=new n.default(this.width):e.clear();for(var r=this.rowSize,o=this.bits,a=t*r,i=0;i<r;i++)e.setBulk(32*i,o[a+i]);return e},t.prototype.setRow=function(t,e){o.default.arraycopy(e.getBitArray(),0,this.bits,t*this.rowSize,this.rowSize)},t.prototype.rotate180=function(){for(var t=this.getWidth(),e=this.getHeight(),r=new n.default(t),o=new n.default(t),a=0,i=Math.floor((e+1)/2);a<i;a++)r=this.getRow(a,r),o=this.getRow(e-1-a,o),r.reverse(),o.reverse(),this.setRow(a,o),this.setRow(e-1-a,r)},t.prototype.getEnclosingRectangle=function(){for(var t=this.width,e=this.height,r=this.rowSize,n=this.bits,o=t,a=e,i=-1,u=-1,f=0;f<e;f++)for(var s=0;s<r;s++){var d=n[f*r+s];if(0!==d){if(f<a&&(a=f),u<f&&(u=f),32*s<o){for(var l=0;0==(d<<31-l&4294967295);)l++;32*s+l<o&&(o=32*s+l)}if(i<32*s+31){for(l=31;d>>>l==0;)l--;i<32*s+l&&(i=32*s+l)}}}return i<o||u<a?null:Int32Array.from([o,a,i-o+1,u-a+1])},t.prototype.getTopLeftOnBit=function(){for(var t=this.rowSize,e=this.bits,r=0;r<e.length&&0===e[r];)r++;if(r===e.length)return null;for(var n=r/t,o=r%t*32,a=e[r],i=0;0==(a<<31-i&4294967295);)i++;return o+=i,Int32Array.from([o,n])},t.prototype.getBottomRightOnBit=function(){for(var t=this.rowSize,e=this.bits,r=e.length-1;0<=r&&0===e[r];)r--;if(r<0)return null;for(var n=Math.floor(r/t),o=32*Math.floor(r%t),a=e[r],i=31;a>>>i==0;)i--;return o+=i,Int32Array.from([o,n])},t.prototype.getWidth=function(){return this.width},t.prototype.getHeight=function(){return this.height},t.prototype.getRowSize=function(){return this.rowSize},t.prototype.equals=function(e){if(!(e instanceof t))return!1;var r=e;return this.width===r.width&&this.height===r.height&&this.rowSize===r.rowSize&&a.default.equals(this.bits,r.bits)},t.prototype.hashCode=function(){var t=this.width;return 31*(t=31*(t=31*(t=31*t+this.width)+this.height)+this.rowSize)+a.default.hashCode(this.bits)},t.prototype.toString=function(t,e,r){return void 0===t&&(t="x"),void 0===e&&(e=" "),void 0===r&&(r="\n"),this.buildToString(t,e,r)},t.prototype.buildToString=function(t,e,r){var n=new i.default;n.append(r);for(var o=0,a=this.height;o<a;o++){for(var u=0,f=this.width;u<f;u++)n.append(this.get(u,o)?t:e);n.append(r)}return n.toString()},t.prototype.clone=function(){return new t(this.width,this.height,this.rowSize,this.bits.slice())},t}();e.default=f},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(3),o=r(7),a=function(){function t(t,e,r,n,a,i){this.text=t,this.rawBytes=e,this.numBits=r,this.resultPoints=n,this.format=a,this.timestamp=i,this.text=t,this.rawBytes=e,this.numBits=null==r?null==e?0:8*e.length:r,this.resultPoints=n,this.format=a,this.resultMetadata=null,this.timestamp=null==i?o.default.currentTimeMillis():i}return t.prototype.getText=function(){return this.text},t.prototype.getRawBytes=function(){return this.rawBytes},t.prototype.getNumBits=function(){return this.numBits},t.prototype.getResultPoints=function(){return this.resultPoints},t.prototype.getBarcodeFormat=function(){return this.format},t.prototype.getResultMetadata=function(){return this.resultMetadata},t.prototype.putMetadata=function(t,e){null===this.resultMetadata&&(this.resultMetadata=new Map),this.resultMetadata.set(t,e)},t.prototype.putAllMetadata=function(t){null!==t&&(null===this.resultMetadata?this.resultMetadata=t:this.resultMetadata=new Map(t))},t.prototype.addResultPoints=function(t){var e=this.resultPoints;if(null===e)this.resultPoints=t;else if(null!==t&&0<t.length){var r=new n.default[e.length+t.length];o.default.arraycopy(e,0,r,0,e.length),o.default.arraycopy(t,0,r,e.length,t.length),this.resultPoints=r}},t.prototype.getTimestamp=function(){return this.timestamp},t.prototype.toString=function(){return this.text},t}();e.default=a},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(15),o=r(4),a=r(14),i=r(3),u=r(0),f=function(){function t(){}return t.prototype.decode=function(t,e){try{return this.doDecode(t,e)}catch(h){if(e&&!0===e.get(o.default.TRY_HARDER)&&t.isRotateSupported()){var r=t.rotateCounterClockwise(),n=this.doDecode(r,e),f=n.getResultMetadata(),s=270;null!==f&&!0===f.get(a.default.ORIENTATION)&&(s+=f.get(a.default.ORIENTATION)%360),n.putMetadata(a.default.ORIENTATION,s);var d=n.getResultPoints();if(null!==d)for(var l=r.getHeight(),c=0;c<d.length;c++)d[c]=new i.default(l-d[c].getY()-1,d[c].getX());return n}throw new u.default}},t.prototype.reset=function(){},t.prototype.doDecode=function(t,e){var r,f=t.getWidth(),s=t.getHeight(),d=new n.default(f),l=e&&!0===e.get(o.default.TRY_HARDER),c=Math.max(1,s>>(l?8:5));r=l?s:15;for(var h=Math.trunc(s/2),p=0;p<r;p++){var w=Math.trunc((p+1)/2),g=h+c*(0==(1&p)?w:-w);if(g<0||s<=g)break;try{d=t.getBlackRow(g,d)}catch(t){continue}for(var _=function(t){if(1===t&&(d.reverse(),e&&!0===e.get(o.default.NEED_RESULT_POINT_CALLBACK))){var r=new Map;e.forEach(function(t,e){return r.set(e,t)}),r.delete(o.default.NEED_RESULT_POINT_CALLBACK),e=r}try{var n=v.decodeRow(g,d,e);if(1===t){n.putMetadata(a.default.ORIENTATION,180);var u=n.getResultPoints();null!==u&&(u[0]=new i.default(f-u[0].getX()-1,u[0].getY()),u[1]=new i.default(f-u[1].getX()-1,u[1].getY()))}return{value:n}}catch(t){}},v=this,y=0;y<2;y++){var E=_(y);if("object"==typeof E)return E.value}}throw new u.default},t.recordPattern=function(t,e,r){for(var n=r.length,o=0;o<n;o++)r[o]=0;var a=t.getSize();if(a<=e)throw new u.default;for(var i=!t.get(e),f=0,s=e;s<a;){if(t.get(s)!==i)r[f]++;else{if(++f===n)break;r[f]=1,i=!i}s++}if(f!==n&&(f!==n-1||s!==a))throw new u.default},t.recordPatternInReverse=function(e,r,n){for(var o=n.length,a=e.get(r);0<r&&0<=o;)e.get(--r)!==a&&(o--,a=!a);if(0<=o)throw new u.default;t.recordPattern(e,r+1,n)},t.patternMatchVariance=function(t,e,r){for(var n=t.length,o=0,a=0,i=0;i<n;i++)o+=t[i],a+=e[i];if(o<a)return Number.POSITIVE_INFINITY;var u=o/a;r*=u;for(var f=0,s=0;s<n;s++){var d=t[s],l=e[s]*u,c=l<d?d-l:l-d;if(r<c)return Number.POSITIVE_INFINITY;f+=c}return f/o},t}();e.default=f},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t){void 0===t&&(t=""),this.value=t}return t.prototype.append=function(t){return this.value+="string"==typeof t?t.toString():String.fromCharCode(t),this},t.prototype.length=function(){return this.value.length},t.prototype.charAt=function(t){return this.value.charAt(t)},t.prototype.deleteCharAt=function(t){this.value=this.value.substr(0,t)+this.value.substring(t+1)},t.prototype.setCharAt=function(t,e){this.value=this.value.substr(0,t)+e+this.value.substr(t+1)},t.prototype.toString=function(){return this.value},t.prototype.insert=function(t,e){this.value=this.value.substr(0,t)+e+this.value.substr(t+e.length)},t}();e.default=n},function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0});var a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e}(r(6).default);e.default=a},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(){}return t.prototype.MathUtils=function(){},t.round=function(t){return NaN===t?0:t<=Number.MIN_SAFE_INTEGER?Number.MIN_SAFE_INTEGER:t>=Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:t+(t<0?-.5:.5)|0},t.distance=function(t,e,r,n){var o=t-r,a=e-n;return Math.sqrt(o*o+a*a)},t.sum=function(t){for(var e=0,r=0,n=t.length;r!==n;r++)e+=t[r];return e},t}();e.default=n},function(t,e,r){"use strict";var n,o;Object.defineProperty(e,"__esModule",{value:!0}),(o=n||(n={}))[o.OTHER=0]="OTHER",o[o.ORIENTATION=1]="ORIENTATION",o[o.BYTE_SEGMENTS=2]="BYTE_SEGMENTS",o[o.ERROR_CORRECTION_LEVEL=3]="ERROR_CORRECTION_LEVEL",o[o.ISSUE_NUMBER=4]="ISSUE_NUMBER",o[o.SUGGESTED_PRICE=5]="SUGGESTED_PRICE",o[o.POSSIBLE_COUNTRY=6]="POSSIBLE_COUNTRY",o[o.UPC_EAN_EXTENSION=7]="UPC_EAN_EXTENSION",o[o.PDF417_EXTRA_METADATA=8]="PDF417_EXTRA_METADATA",o[o.STRUCTURED_APPEND_SEQUENCE=9]="STRUCTURED_APPEND_SEQUENCE",o[o.STRUCTURED_APPEND_PARITY=10]="STRUCTURED_APPEND_PARITY",e.default=n},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(7),o=r(23),a=r(28),i=r(1),u=function(){function t(e,r){this.bits=void 0===e?(this.size=0,new Int32Array(1)):(this.size=e,null==r?t.makeArray(e):r)}return t.prototype.getSize=function(){return this.size},t.prototype.getSizeInBytes=function(){return Math.floor((this.size+7)/8)},t.prototype.ensureCapacity=function(e){if(e>32*this.bits.length){var r=t.makeArray(e);n.default.arraycopy(this.bits,0,r,0,this.bits.length),this.bits=r}},t.prototype.get=function(t){return 0!=(this.bits[Math.floor(t/32)]&1<<(31&t))},t.prototype.set=function(t){this.bits[Math.floor(t/32)]|=1<<(31&t)},t.prototype.flip=function(t){this.bits[Math.floor(t/32)]^=1<<(31&t)},t.prototype.getNextSet=function(t){var e=this.size;if(e<=t)return e;var r=this.bits,n=Math.floor(t/32),a=r[n];a&=~((1<<(31&t))-1);for(var i=r.length;0===a;){if(++n===i)return e;a=r[n]}var u=32*n+o.default.numberOfTrailingZeros(a);return e<u?e:u},t.prototype.getNextUnset=function(t){var e=this.size;if(e<=t)return e;var r=this.bits,n=Math.floor(t/32),a=~r[n];a&=~((1<<(31&t))-1);for(var i=r.length;0===a;){if(++n===i)return e;a=~r[n]}var u=32*n+o.default.numberOfTrailingZeros(a);return e<u?e:u},t.prototype.setBulk=function(t,e){this.bits[Math.floor(t/32)]=e},t.prototype.setRange=function(t,e){if(e<t||t<0||e>this.size)throw new i.default;if(e!==t){e--;for(var r=Math.floor(t/32),n=Math.floor(e/32),o=this.bits,a=r;a<=n;a++){var u=(2<<(a<n?31:31&e))-(1<<(r<a?0:31&t));o[a]|=u}}},t.prototype.clear=function(){for(var t=this.bits.length,e=this.bits,r=0;r<t;r++)e[r]=0},t.prototype.isRange=function(t,e,r){if(e<t||t<0||e>this.size)throw new i.default;if(e===t)return!0;e--;for(var n=Math.floor(t/32),o=Math.floor(e/32),a=this.bits,u=n;u<=o;u++){var f=(2<<(u<o?31:31&e))-(1<<(n<u?0:31&t))&4294967295;if((a[u]&f)!==(r?f:0))return!1}return!0},t.prototype.appendBit=function(t){this.ensureCapacity(this.size+1),t&&(this.bits[Math.floor(this.size/32)]|=1<<(31&this.size)),this.size++},t.prototype.appendBits=function(t,e){if(e<0||32<e)throw new i.default("Num bits must be between 0 and 32");this.ensureCapacity(this.size+e),this.appendBit;for(var r=e;0<r;r--)this.appendBit(1==(t>>r-1&1))},t.prototype.appendBitArray=function(t){var e=t.size;this.ensureCapacity(this.size+e),this.appendBit;for(var r=0;r<e;r++)this.appendBit(t.get(r))},t.prototype.xor=function(t){if(this.size!==t.size)throw new i.default("Sizes don't match");for(var e=this.bits,r=0,n=e.length;r<n;r++)e[r]^=t.bits[r]},t.prototype.toBytes=function(t,e,r,n){for(var o=0;o<n;o++){for(var a=0,i=0;i<8;i++)this.get(t)&&(a|=1<<7-i),t++;e[r+o]=a}},t.prototype.getBitArray=function(){return this.bits},t.prototype.reverse=function(){for(var t=new Int32Array(this.bits.length),e=Math.floor((this.size-1)/32),r=e+1,n=this.bits,o=0;o<r;o++){var a=n[o];a=(a=(a=(a=(a=a>>1&1431655765|(1431655765&a)<<1)>>2&858993459|(858993459&a)<<2)>>4&252645135|(252645135&a)<<4)>>8&16711935|(16711935&a)<<8)>>16&65535|(65535&a)<<16,t[e-o]=a}if(this.size!==32*r){var i=32*r-this.size,u=t[0]>>>i;for(o=1;o<r;o++){var f=t[o];u|=f<<32-i,t[o-1]=u,u=f>>>i}t[r-1]=u}this.bits=t},t.makeArray=function(t){return new Int32Array(Math.floor((t+31)/32))},t.prototype.equals=function(e){if(!(e instanceof t))return!1;var r=e;return this.size===r.size&&a.default.equals(this.bits,r.bits)},t.prototype.hashCode=function(){return 31*this.size+a.default.hashCode(this.bits)},t.prototype.toString=function(){for(var t="",e=0,r=this.size;e<r;e++)0==(7&e)&&(t+=" "),t+=this.get(e)?"X":".";return t},t.prototype.clone=function(){return new t(this.size,this.bits.slice())},t}();e.default=u},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(24),o=r(23),a=r(1),i=r(51),u=function(){function t(t,e,r){this.primitive=t,this.size=e,this.generatorBase=r;for(var o=new Int32Array(e),a=1,i=0;i<e;i++)o[i]=a,e<=(a*=2)&&(a^=t,a&=e-1);this.expTable=o;var u=new Int32Array(e);for(i=0;i<e-1;i++)u[o[i]]=i;this.logTable=u,this.zero=new n.default(this,Int32Array.from([0])),this.one=new n.default(this,Int32Array.from([1]))}return t.prototype.getZero=function(){return this.zero},t.prototype.getOne=function(){return this.one},t.prototype.buildMonomial=function(t,e){if(t<0)throw new a.default;if(0===e)return this.zero;var r=new Int32Array(t+1);return r[0]=e,new n.default(this,r)},t.addOrSubtract=function(t,e){return t^e},t.prototype.exp=function(t){return this.expTable[t]},t.prototype.log=function(t){if(0===t)throw new a.default;return this.logTable[t]},t.prototype.inverse=function(t){if(0===t)throw new i.default;return this.expTable[this.size-this.logTable[t]-1]},t.prototype.multiply=function(t,e){return 0===t||0===e?0:this.expTable[(this.logTable[t]+this.logTable[e])%(this.size-1)]},t.prototype.getSize=function(){return this.size},t.prototype.getGeneratorBase=function(){return this.generatorBase},t.prototype.toString=function(){return"GF(0x"+o.default.toHexString(this.primitive)+","+this.size+")"},t.prototype.equals=function(t){return t===this},t.AZTEC_DATA_12=new t(4201,4096,1),t.AZTEC_DATA_10=new t(1033,1024,1),t.AZTEC_DATA_6=new t(67,64,1),t.AZTEC_PARAM=new t(19,16,1),t.QR_CODE_FIELD_256=new t(285,256,0),t.DATA_MATRIX_FIELD_256=new t(301,256,1),t.AZTEC_DATA_8=t.DATA_MATRIX_FIELD_256,t.MAXICODE_FIELD_64=t.AZTEC_DATA_6,t}();e.default=u},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(45),o=r(46),a=r(47),i=r(48),u=r(0),f=r(29),s=r(12),d=r(5),l=function(){function t(t,e,r){void 0===e&&(e=500),this.reader=t,this.timeBetweenScansMillis=e,this.hints=r}return t.prototype.getVideoInputDevices=function(){return new Promise(function(t,e){navigator.mediaDevices.enumerateDevices().then(function(e){for(var r=new Array,n=0,a=0,i=e.length;a!==i;a++){var u=e[a];"videoinput"===u.kind&&(r.push(new o.VideoInputDevice(u.deviceId,u.label||"Video source "+n)),n++)}t(r)}).catch(function(t){e(t)})})},t.prototype.decodeFromInputVideoDevice=function(t,e){var r,n=this;return this.reset(),this.prepareVideoElement(e),r=void 0===t?{video:{facingMode:"environment"}}:{video:{deviceId:{exact:t}}},new Promise(function(t,e){var o=function(){n.decodeOnceWithDelay(t,e)};navigator.mediaDevices.getUserMedia(r).then(function(t){return n.startDecodeFromStream(t,o)}).catch(function(t){return e(t)})})},t.prototype.startDecodeFromStream=function(t,e){this.stream=t,this.bindVideoSrc(this.videoElement,t),this.bindEvents(this.videoElement,e)},t.prototype.bindEvents=function(t,e){this.videoPlayingEventListener=e,t.addEventListener("playing",this.videoPlayingEventListener),this.videoLoadedMetadataEventListener=function(){return t.play()},t.addEventListener("loadedmetadata",this.videoLoadedMetadataEventListener)},t.prototype.decodeFromVideoSource=function(t,e){var r=this;return this.reset(),this.prepareVideoElement(e),new Promise(function(e,n){r.videoPlayEndedEventListener=function(){r.stopStreams(),n(new u.default)},r.videoElement.addEventListener("ended",r.videoPlayEndedEventListener),r.videoPlayingEventListener=function(){r.decodeOnceWithDelay(e,n)},r.videoElement.addEventListener("playing",r.videoPlayingEventListener),r.videoElement.setAttribute("autoplay","true"),r.videoElement.setAttribute("src",t)})},t.prototype.prepareVideoElement=function(t){t||"undefined"==typeof document||((t=document.createElement("video")).width=200,t.height=200),"string"==typeof t&&(t=this.getMediaElement(t,"video")),t.setAttribute("autoplay","true"),t.setAttribute("muted","true"),t.setAttribute("playsinline","true"),t.setAttribute("autofocus","true"),this.videoElement=t},t.prototype.getMediaElement=function(t,e){var r=document.getElementById(t);if(null===r)throw new f.default("element with id '"+t+"' not found");if(r.nodeName.toLowerCase()!==e.toLowerCase())throw new f.default("element with id '"+t+"' must be an "+e+" element");return r},t.prototype.decodeFromImage=function(t,e){var r=this;if(this.reset(),void 0===t&&void 0===e)throw new f.default("either imageElement with a src set or an url must be provided");return this.prepareImageElement(t),new Promise(function(t,n){if(void 0!==e)r.imageLoadedEventListener=function(){r.decodeOnce(t,n,!1,!0)},r.imageElement.addEventListener("load",r.imageLoadedEventListener),r.imageElement.src=e;else{if(!r.isImageLoaded(r.imageElement))throw new f.default("either src or a loaded img should be provided");r.decodeOnce(t,n,!1,!0)}})},t.prototype.isImageLoaded=function(t){return!!t.complete&&0!==t.naturalWidth},t.prototype.prepareImageElement=function(t){void 0===t&&((t=document.createElement("img")).width=200,t.height=200),"string"==typeof t&&(t=this.getMediaElement(t,"img")),this.imageElement=t},t.prototype.decodeOnceWithDelay=function(t,e){this.timeoutHandler=window.setTimeout(this.decodeOnce.bind(this,t,e),this.timeBetweenScansMillis)},t.prototype.decodeOnce=function(t,e,r,n){void 0===r&&(r=!0),void 0===n&&(n=!0);try{t(this.decode())}catch(o){r&&o instanceof u.default?this.decodeOnceWithDelay(t,e):n&&(o instanceof s.default||o instanceof d.default)?this.decodeOnceWithDelay(t,e):e(o)}},t.prototype.decode=function(){var t=this.createBinaryBitmap(this.videoElement||this.imageElement);return this.decodeBitmap(t)},t.prototype.createBinaryBitmap=function(t){void 0===this.canvasElementContext&&this.prepareCaptureCanvas(),this.drawImageOnCanvas(this.canvasElementContext,t);var e=new n.HTMLCanvasElementLuminanceSource(this.canvasElement),r=new i.default(e);return new a.default(r)},t.prototype.drawImageOnCanvas=function(t,e){t.drawImage(e,0,0)},t.prototype.decodeBitmap=function(t){return this.reader.decode(t,this.hints)},t.prototype.prepareCaptureCanvas=function(){if("undefined"==typeof document)return this.canvasElement=void 0,void(this.canvasElementContext=void 0);var t,e,r=document.createElement("canvas");void 0!==this.videoElement&&(t=this.videoElement.videoWidth,e=this.videoElement.videoHeight),t||e||void 0===this.imageElement||(t=this.imageElement.naturalWidth||this.imageElement.width,e=this.imageElement.naturalHeight||this.imageElement.height),r.style.width=t+"px",r.style.height=e+"px",r.width=t,r.height=e,this.canvasElement=r,this.canvasElementContext=r.getContext("2d")},t.prototype.stopStreams=function(){this.stream&&(this.stream.getVideoTracks().forEach(function(t){return t.stop()}),this.stream=void 0)},t.prototype.reset=function(){window.clearTimeout(this.timeoutHandler),this.stopStreams(),void 0!==this.videoPlayEndedEventListener&&void 0!==this.videoElement&&this.videoElement.removeEventListener("ended",this.videoPlayEndedEventListener),void 0!==this.videoPlayingEventListener&&void 0!==this.videoElement&&this.videoElement.removeEventListener("playing",this.videoPlayingEventListener),void 0!==this.videoElement&&(this.unbindVideoSrc(this.videoElement),this.videoElement=void 0),void 0!==this.videoPlayEndedEventListener&&void 0!==this.imageElement&&this.imageElement.removeEventListener("load",this.imageLoadedEventListener),void 0!==this.imageElement&&(this.imageElement.src=void 0,this.imageElement.removeAttribute("src"),this.imageElement=void 0),this.canvasElementContext=void 0,this.canvasElement=void 0},t.prototype.bindVideoSrc=function(t,e){try{t.srcObject=e}catch(r){t.src=window.URL.createObjectURL(e)}},t.prototype.unbindVideoSrc=function(t){try{t.srcObject=null}catch(e){t.src=""}},t}();e.BrowserCodeReader=l},function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0});var a=function(t){function e(e){var r=t.call(this,e.getWidth(),e.getHeight())||this;return r.delegate=e,r}return o(e,t),e.prototype.getRow=function(t,e){for(var r=this.delegate.getRow(t,e),n=this.getWidth(),o=0;o<n;o++)r[o]=255-(255&r[o]);return r},e.prototype.getMatrix=function(){for(var t=this.delegate.getMatrix(),e=this.getWidth()*this.getHeight(),r=new Uint8ClampedArray(e),n=0;n<e;n++)r[n]=255-(255&t[n]);return r},e.prototype.isCropSupported=function(){return this.delegate.isCropSupported()},e.prototype.crop=function(t,r,n,o){return new e(this.delegate.crop(t,r,n,o))},e.prototype.isRotateSupported=function(){return this.delegate.isRotateSupported()},e.prototype.invert=function(){return this.delegate},e.prototype.rotateCounterClockwise=function(){return new e(this.delegate.rotateCounterClockwise())},e.prototype.rotateCounterClockwise45=function(){return new e(this.delegate.rotateCounterClockwise45())},e}(r(19).default);e.default=a},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(11),o=r(27),a=function(){function t(t,e){this.width=t,this.height=e}return t.prototype.getWidth=function(){return this.width},t.prototype.getHeight=function(){return this.height},t.prototype.isCropSupported=function(){return!1},t.prototype.crop=function(t,e,r,n){throw new o.default("This luminance source does not support cropping.")},t.prototype.isRotateSupported=function(){return!1},t.prototype.rotateCounterClockwise=function(){throw new o.default("This luminance source does not support rotation by 90 degrees.")},t.prototype.rotateCounterClockwise45=function(){throw new o.default("This luminance source does not support rotation by 45 degrees.")},t.prototype.toString=function(){for(var t=new Uint8ClampedArray(this.width),e=new n.default,r=0;r<this.height;r++){for(var o=this.getRow(r,t),a=0;a<this.width;a++){var i,u=255&o[a];i=u<64?"#":u<128?"+":u<192?".":" ",e.append(i)}e.append("\n")}return e.toString()},t}();e.default=a},function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0});var a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e}(r(6).default);e.default=a},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n,o,a=r(5);(o=n=e.CharacterSetValueIdentifiers||(e.CharacterSetValueIdentifiers={}))[o.Cp437=0]="Cp437",o[o.ISO8859_1=1]="ISO8859_1",o[o.ISO8859_2=2]="ISO8859_2",o[o.ISO8859_3=3]="ISO8859_3",o[o.ISO8859_4=4]="ISO8859_4",o[o.ISO8859_5=5]="ISO8859_5",o[o.ISO8859_6=6]="ISO8859_6",o[o.ISO8859_7=7]="ISO8859_7",o[o.ISO8859_8=8]="ISO8859_8",o[o.ISO8859_9=9]="ISO8859_9",o[o.ISO8859_10=10]="ISO8859_10",o[o.ISO8859_11=11]="ISO8859_11",o[o.ISO8859_13=12]="ISO8859_13",o[o.ISO8859_14=13]="ISO8859_14",o[o.ISO8859_15=14]="ISO8859_15",o[o.ISO8859_16=15]="ISO8859_16",o[o.SJIS=16]="SJIS",o[o.Cp1250=17]="Cp1250",o[o.Cp1251=18]="Cp1251",o[o.Cp1252=19]="Cp1252",o[o.Cp1256=20]="Cp1256",o[o.UnicodeBigUnmarked=21]="UnicodeBigUnmarked",o[o.UTF8=22]="UTF8",o[o.ASCII=23]="ASCII",o[o.Big5=24]="Big5",o[o.GB18030=25]="GB18030",o[o.EUC_KR=26]="EUC_KR";var i=function(){function t(e,r,n){for(var o=[],a=3;a<arguments.length;a++)o[a-3]=arguments[a];this.valueIdentifier=e,this.name=n,this.values="number"==typeof r?Int32Array.from([r]):r,this.otherEncodingNames=o,t.VALUE_IDENTIFIER_TO_ECI.set(e,this),t.NAME_TO_ECI.set(n,this);for(var i=this.values,u=0,f=i.length;u!==f;u++){var s=i[u];t.VALUES_TO_ECI.set(s,this)}for(var d=0,l=o;d<l.length;d++){var c=l[d];t.NAME_TO_ECI.set(c,this)}}return t.prototype.getValueIdentifier=function(){return this.valueIdentifier},t.prototype.getName=function(){return this.name},t.prototype.getValue=function(){return this.values[0]},t.getCharacterSetECIByValue=function(e){if(e<0||900<=e)throw new a.default("incorect value");var r=t.VALUES_TO_ECI.get(e);if(void 0===r)throw new a.default("incorect value");return r},t.getCharacterSetECIByName=function(e){var r=t.NAME_TO_ECI.get(e);if(void 0===r)throw new a.default("incorect value");return r},t.prototype.equals=function(e){if(!(e instanceof t))return!1;var r=e;return this.getName()===r.getName()},t.VALUE_IDENTIFIER_TO_ECI=new Map,t.VALUES_TO_ECI=new Map,t.NAME_TO_ECI=new Map,t.Cp437=new t(n.Cp437,Int32Array.from([0,2]),"Cp437"),t.ISO8859_1=new t(n.ISO8859_1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),t.ISO8859_2=new t(n.ISO8859_2,4,"ISO-8859-2","ISO88592","ISO8859_2"),t.ISO8859_3=new t(n.ISO8859_3,5,"ISO-8859-3","ISO88593","ISO8859_3"),t.ISO8859_4=new t(n.ISO8859_4,6,"ISO-8859-4","ISO88594","ISO8859_4"),t.ISO8859_5=new t(n.ISO8859_5,7,"ISO-8859-5","ISO88595","ISO8859_5"),t.ISO8859_6=new t(n.ISO8859_6,8,"ISO-8859-6","ISO88596","ISO8859_6"),t.ISO8859_7=new t(n.ISO8859_7,9,"ISO-8859-7","ISO88597","ISO8859_7"),t.ISO8859_8=new t(n.ISO8859_8,10,"ISO-8859-8","ISO88598","ISO8859_8"),t.ISO8859_9=new t(n.ISO8859_9,11,"ISO-8859-9","ISO88599","ISO8859_9"),t.ISO8859_10=new t(n.ISO8859_10,12,"ISO-8859-10","ISO885910","ISO8859_10"),t.ISO8859_11=new t(n.ISO8859_11,13,"ISO-8859-11","ISO885911","ISO8859_11"),t.ISO8859_13=new t(n.ISO8859_13,15,"ISO-8859-13","ISO885913","ISO8859_13"),t.ISO8859_14=new t(n.ISO8859_14,16,"ISO-8859-14","ISO885914","ISO8859_14"),t.ISO8859_15=new t(n.ISO8859_15,17,"ISO-8859-15","ISO885915","ISO8859_15"),t.ISO8859_16=new t(n.ISO8859_16,18,"ISO-8859-16","ISO885916","ISO8859_16"),t.SJIS=new t(n.SJIS,20,"SJIS","Shift_JIS"),t.Cp1250=new t(n.Cp1250,21,"Cp1250","windows-1250"),t.Cp1251=new t(n.Cp1251,22,"Cp1251","windows-1251"),t.Cp1252=new t(n.Cp1252,23,"Cp1252","windows-1252"),t.Cp1256=new t(n.Cp1256,24,"Cp1256","windows-1256"),t.UnicodeBigUnmarked=new t(n.UnicodeBigUnmarked,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),t.UTF8=new t(n.UTF8,26,"UTF8","UTF-8"),t.ASCII=new t(n.ASCII,Int32Array.from([27,170]),"ASCII","US-ASCII"),t.Big5=new t(n.Big5,28,"Big5"),t.GB18030=new t(n.GB18030,29,"GB18030","GB2312","EUC_CN","GBK"),t.EUC_KR=new t(n.EUC_KR,30,"EUC_KR","EUC-KR"),t}();e.default=i},function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0});var a=r(2),i=r(4),u=r(9),f=r(14),s=r(3),d=r(10),l=r(105),c=r(0),h=r(5),p=r(12),w=function(t){function e(){var r=t.call(this)||this;r.decodeRowStringBuffer="",r.decodeRowStringBuffer="",e.L_AND_G_PATTERNS=e.L_PATTERNS.map(function(t){return t.slice()});for(var n=10;n<20;n++){for(var o=e.L_PATTERNS[n-10],a=new Array(o.length),i=0;i<o.length;i++)a[i]=o[o.length-i-1];e.L_AND_G_PATTERNS[n]=a}return r}return o(e,t),e.findStartGuardPattern=function(t){for(var r=!1,n=null,o=0,a=[0,0,0];!r;){var i=(n=e.findGuardPattern(t,o,!(a=[0,0,0]),this.START_END_PATTERN,a))[0],u=i-((o=n[1])-i);0<=u&&(r=t.isRange(u,i,!1))}return n},e.prototype.decodeRow=function(t,r,n){var o=e.findStartGuardPattern(r),d=null==n?null:n.get(i.default.NEED_RESULT_POINT_CALLBACK);if(null!=d){var w=new s.default((o[0]+o[1])/2,t);d.foundPossibleResultPoint(w)}var g=this.decodeMiddle(r,o,this.decodeRowStringBuffer),_=g.rowOffset,v=g.resultString;if(null!=d){var y=new s.default(_,t);d.foundPossibleResultPoint(y)}var E=e.decodeEnd(r,_);if(null!=d){var A=new s.default((E[0]+E[1])/2,t);d.foundPossibleResultPoint(A)}var C=E[1],m=C+(C-E[0]);if(m>=r.getSize()||!r.isRange(C,m,!1))throw new c.default;var S=v.toString();if(S.length<8)throw new h.default;if(!e.checkChecksum(S))throw new p.default;var I=(o[1]+o[0])/2,O=(E[1]+E[0])/2,T=this.getBarcodeFormat(),M=[new s.default(I,t),new s.default(O,t)],b=new u.default(S,null,0,M,T,(new Date).getTime()),N=0;try{var R=l.default.decodeRow(t,r,E[1]);b.putMetadata(f.default.UPC_EAN_EXTENSION,R.getText()),b.putAllMetadata(R.getResultMetadata()),b.addResultPoints(R.getResultPoints()),N=R.getText().length}catch(t){}var P=null==n?null:n.get(i.default.ALLOWED_EAN_EXTENSIONS);if(null!=P){var D=!1;for(var B in P)if(N.toString()===B){D=!0;break}if(!D)throw new c.default}return T===a.default.EAN_13||a.default.UPC_A,b},e.checkChecksum=function(t){return e.checkStandardUPCEANChecksum(t)},e.checkStandardUPCEANChecksum=function(t){var r=t.length;if(0===r)return!1;var n=parseInt(t.charAt(r-1),10);return e.getStandardUPCEANChecksum(t.substring(0,r-1))===n},e.getStandardUPCEANChecksum=function(t){for(var e=t.length,r=0,n=e-1;0<=n;n-=2){if((o=t.charAt(n).charCodeAt(0)-"0".charCodeAt(0))<0||9<o)throw new h.default;r+=o}for(r*=3,n=e-2;0<=n;n-=2){var o;if((o=t.charAt(n).charCodeAt(0)-"0".charCodeAt(0))<0||9<o)throw new h.default;r+=o}return(1e3-r)%10},e.decodeEnd=function(t,r){return e.findGuardPattern(t,r,!1,e.START_END_PATTERN,new Array(e.START_END_PATTERN.length).fill(0))},e.findGuardPattern=function(t,r,n,o,a){for(var i=t.getSize(),u=0,f=r=n?t.getNextUnset(r):t.getNextSet(r),s=o.length,l=n,h=r;h<i;h++)if(t.get(h)!==l)a[u]++;else{if(u===s-1){if(d.default.patternMatchVariance(a,o,e.MAX_INDIVIDUAL_VARIANCE)<e.MAX_AVG_VARIANCE)return[f,h];f+=a[0]+a[1];for(var p=a.slice(2,a.length),w=0;w<u-1;w++)a[w]=p[w];a[u-1]=0,a[u]=0,u--}else u++;a[u]=1,l=!l}throw new c.default},e.decodeDigit=function(t,r,n,o){this.recordPattern(t,n,r);for(var a=this.MAX_AVG_VARIANCE,i=-1,u=o.length,f=0;f<u;f++){var s=o[f],l=d.default.patternMatchVariance(r,s,e.MAX_INDIVIDUAL_VARIANCE);l<a&&(a=l,i=f)}if(0<=i)return i;throw new c.default},e.MAX_AVG_VARIANCE=.48,e.MAX_INDIVIDUAL_VARIANCE=.7,e.START_END_PATTERN=[1,1,1],e.MIDDLE_PATTERN=[1,1,1,1,1],e.END_PATTERN=[1,1,1,1,1,1],e.L_PATTERNS=[[3,2,1,1],[2,2,2,1],[2,1,2,2],[1,4,1,1],[1,1,3,2],[1,2,3,1],[1,1,1,4],[1,3,1,2],[1,2,1,3],[3,1,1,2]],e}(d.default);e.default=w},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(){}return t.numberOfTrailingZeros=function(t){var e;if(0===t)return 32;var r=31;return 0!=(e=t<<16)&&(r-=16,t=e),0!=(e=t<<8)&&(r-=8,t=e),0!=(e=t<<4)&&(r-=4,t=e),0!=(e=t<<2)&&(r-=2,t=e),r-(t<<1>>>31)},t.numberOfLeadingZeros=function(t){if(0===t)return 32;var e=1;return t>>>16==0&&(e+=16,t<<=16),t>>>24==0&&(e+=8,t<<=8),t>>>28==0&&(e+=4,t<<=4),t>>>30==0&&(e+=2,t<<=2),e-(t>>>31)},t.toHexString=function(t){return t.toString(16)},t.bitCount=function(t){return t=(t=(858993459&(t-=t>>>1&1431655765))+(t>>>2&858993459))+(t>>>4)&252645135,63&(t+=t>>>8)+(t>>>16)},t.MIN_VALUE_32_BITS=-2147483648,t}();e.default=n},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(16),o=r(7),a=r(1),i=function(){function t(t,e){if(0===e.length)throw new a.default;this.field=t;var r=e.length;if(1<r&&0===e[0]){for(var n=1;n<r&&0===e[n];)n++;n===r?this.coefficients=Int32Array.from([0]):(this.coefficients=new Int32Array(r-n),o.default.arraycopy(e,n,this.coefficients,0,this.coefficients.length))}else this.coefficients=e}return t.prototype.getCoefficients=function(){return this.coefficients},t.prototype.getDegree=function(){return this.coefficients.length-1},t.prototype.isZero=function(){return 0===this.coefficients[0]},t.prototype.getCoefficient=function(t){return this.coefficients[this.coefficients.length-1-t]},t.prototype.evaluateAt=function(t){if(0===t)return this.getCoefficient(0);var e,r=this.coefficients;if(1===t){for(var o=e=0,a=r.length;o!==a;o++){var i=r[o];e=n.default.addOrSubtract(e,i)}return e}e=r[0];var u=r.length,f=this.field;for(o=1;o<u;o++)e=n.default.addOrSubtract(f.multiply(t,e),r[o]);return e},t.prototype.addOrSubtract=function(e){if(!this.field.equals(e.field))throw new a.default("GenericGFPolys do not have same GenericGF field");if(this.isZero())return e;if(e.isZero())return this;var r=this.coefficients,i=e.coefficients;if(r.length>i.length){var u=r;r=i,i=u}var f=new Int32Array(i.length),s=i.length-r.length;o.default.arraycopy(i,0,f,0,s);for(var d=s;d<i.length;d++)f[d]=n.default.addOrSubtract(r[d-s],i[d]);return new t(this.field,f)},t.prototype.multiply=function(e){if(!this.field.equals(e.field))throw new a.default("GenericGFPolys do not have same GenericGF field");if(this.isZero()||e.isZero())return this.field.getZero();for(var r=this.coefficients,o=r.length,i=e.coefficients,u=i.length,f=new Int32Array(o+u-1),s=this.field,d=0;d<o;d++)for(var l=r[d],c=0;c<u;c++)f[d+c]=n.default.addOrSubtract(f[d+c],s.multiply(l,i[c]));return new t(s,f)},t.prototype.multiplyScalar=function(e){if(0===e)return this.field.getZero();if(1===e)return this;for(var r=this.coefficients.length,n=this.field,o=new Int32Array(r),a=this.coefficients,i=0;i<r;i++)o[i]=n.multiply(a[i],e);return new t(n,o)},t.prototype.multiplyByMonomial=function(e,r){if(e<0)throw new a.default;if(0===r)return this.field.getZero();for(var n=this.coefficients,o=n.length,i=new Int32Array(o+e),u=this.field,f=0;f<o;f++)i[f]=u.multiply(n[f],r);return new t(u,i)},t.prototype.divide=function(t){if(!this.field.equals(t.field))throw new a.default("GenericGFPolys do not have same GenericGF field");if(t.isZero())throw new a.default("Divide by 0");for(var e=this.field,r=e.getZero(),n=this,o=t.getCoefficient(t.getDegree()),i=e.inverse(o);n.getDegree()>=t.getDegree()&&!n.isZero();){var u=n.getDegree()-t.getDegree(),f=e.multiply(n.getCoefficient(n.getDegree()),i),s=t.multiplyByMonomial(u,f),d=e.buildMonomial(u,f);r=r.addOrSubtract(d),n=n.addOrSubtract(s)}return[r,n]},t.prototype.toString=function(){for(var t="",e=this.getDegree();0<=e;e--){var r=this.getCoefficient(e);if(0!==r){if(r<0?(t+=" - ",r=-r):0<t.length&&(t+=" + "),0===e||1!==r){var n=this.field.log(r);0===n?t+="1":1===n?t+="a":(t+="a^",t+=n)}0!==e&&(1===e?t+="x":(t+="x^",t+=e))}}return t},t}();e.default=i},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n,o,a=r(29),i=r(1);(o=n=e.ErrorCorrectionLevelValues||(e.ErrorCorrectionLevelValues={}))[o.L=0]="L",o[o.M=1]="M",o[o.Q=2]="Q",o[o.H=3]="H";var u=function(){function t(e,r,n){this.value=e,this.stringValue=r,this.bits=n,t.FOR_BITS.set(n,this),t.FOR_VALUE.set(e,this)}return t.prototype.getValue=function(){return this.value},t.prototype.getBits=function(){return this.bits},t.fromString=function(e){switch(e){case"L":return t.L;case"M":return t.M;case"Q":return t.Q;case"H":return t.H;default:throw new a.default(e+"not available")}},t.prototype.toString=function(){return this.stringValue},t.prototype.equals=function(e){if(!(e instanceof t))return!1;var r=e;return this.value===r.value},t.forBits=function(e){if(e<0||e>=t.FOR_BITS.size)throw new i.default;return t.FOR_BITS.get(e)},t.FOR_BITS=new Map,t.FOR_VALUE=new Map,t.L=new t(n.L,"L",1),t.M=new t(n.M,"M",0),t.Q=new t(n.Q,"Q",3),t.H=new t(n.H,"H",2),t}();e.default=u},function(t,e,r){"use strict";var n,o;Object.defineProperty(e,"__esModule",{value:!0}),(o=n||(n={}))[o.ERROR_CORRECTION=0]="ERROR_CORRECTION",o[o.CHARACTER_SET=1]="CHARACTER_SET",o[o.DATA_MATRIX_SHAPE=2]="DATA_MATRIX_SHAPE",o[o.MIN_SIZE=3]="MIN_SIZE",o[o.MAX_SIZE=4]="MAX_SIZE",o[o.MARGIN=5]="MARGIN",o[o.PDF417_COMPACT=6]="PDF417_COMPACT",o[o.PDF417_COMPACTION=7]="PDF417_COMPACTION",o[o.PDF417_DIMENSIONS=8]="PDF417_DIMENSIONS",o[o.AZTEC_LAYERS=9]="AZTEC_LAYERS",o[o.QR_VERSION=10]="QR_VERSION",e.default=n},function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0});var a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e}(r(6).default);e.default=a},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(7),o=function(){function t(){}return t.equals=function(t,e){if(!t)return!1;if(!e)return!1;if(!t.length)return!1;if(!e.length)return!1;if(t.length!==e.length)return!1;for(var r=0,n=t.length;r<n;r++)if(t[r]!==e[r])return!1;return!0},t.hashCode=function(t){if(null===t)return 0;for(var e=1,r=0,n=t;r<n.length;r++)e=31*e+n[r];return e},t.fillUint8Array=function(t,e){for(var r=0;r!==t.length;r++)t[r]=e},t.copyOf=function(t,e){var r=new Int32Array(e);return n.default.arraycopy(t,0,r,0,Math.min(t.length,e)),r},t.binarySearch=function(e,r,n){void 0===n&&(n=t.numberComparator);for(var o=0,a=e.length-1;o<=a;){var i=a+o>>1,u=n(r,e[i]);if(0<u)o=i+1;else{if(!(u<0))return i;a=i-1}}return-o-1},t.numberComparator=function(t,e){return t-e},t}();e.default=o},function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0});var a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e}(r(6).default);e.default=a},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(2),o=r(4),a=r(9),i=r(14),u=r(8),f=r(75),s=r(54),d=r(82),l=r(0),c=function(){function t(){this.decoder=new f.default}return t.prototype.getDecoder=function(){return this.decoder},t.prototype.decode=function(e,r){var u,f;if(null!=r&&void 0!==r.get(o.default.PURE_BARCODE)){var l=t.extractPureBits(e.getBlackMatrix());u=this.decoder.decodeBitMatrix(l,r),f=t.NO_POINTS}else{var c=new d.default(e.getBlackMatrix()).detect(r);u=this.decoder.decodeBitMatrix(c.getBits(),r),f=c.getPoints()}u.getOther()instanceof s.default&&u.getOther().applyMirroredCorrection(f);var h=new a.default(u.getText(),u.getRawBytes(),void 0,f,n.default.QR_CODE,void 0),p=u.getByteSegments();null!==p&&h.putMetadata(i.default.BYTE_SEGMENTS,p);var w=u.getECLevel();return null!==w&&h.putMetadata(i.default.ERROR_CORRECTION_LEVEL,w),u.hasStructuredAppend()&&(h.putMetadata(i.default.STRUCTURED_APPEND_SEQUENCE,u.getStructuredAppendSequenceNumber()),h.putMetadata(i.default.STRUCTURED_APPEND_PARITY,u.getStructuredAppendParity())),h},t.prototype.reset=function(){},t.extractPureBits=function(t){var e=t.getTopLeftOnBit(),r=t.getBottomRightOnBit();if(null===e||null===r)throw new l.default;var n=this.moduleSize(e,t),o=e[1],a=r[1],i=e[0],f=r[0];if(f<=i||a<=o)throw new l.default;if(a-o!=f-i&&(f=i+(a-o))>=t.getWidth())throw new l.default;var s=Math.round((f-i+1)/n),d=Math.round((a-o+1)/n);if(s<=0||d<=0)throw new l.default;if(d!==s)throw new l.default;var c=Math.floor(n/2);o+=c;var h=(i+=c)+Math.floor((s-1)*n)-f;if(0<h){if(c<h)throw new l.default;i-=h}var p=o+Math.floor((d-1)*n)-a;if(0<p){if(c<p)throw new l.default;o-=p}for(var w=new u.default(s,d),g=0;g<d;g++)for(var _=o+Math.floor(g*n),v=0;v<s;v++)t.get(i+Math.floor(v*n),_)&&w.set(v,g);return w},t.moduleSize=function(t,e){for(var r=e.getHeight(),n=e.getWidth(),o=t[0],a=t[1],i=!0,u=0;o<n&&a<r;){if(i!==e.get(o,a)){if(5==++u)break;i=!i}o++,a++}if(o===n||a===r)throw new l.default;return(o-t[0])/7},t.NO_POINTS=new Array,t}();e.default=c},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(16),o=r(24),a=r(52),i=r(20),u=function(){function t(t){this.field=t}return t.prototype.decode=function(t,e){for(var r=this.field,i=new o.default(r,t),u=new Int32Array(e),f=!0,s=0;s<e;s++){var d=i.evaluateAt(r.exp(s+r.getGeneratorBase()));0!==(u[u.length-1-s]=d)&&(f=!1)}if(!f){var l=new o.default(r,u),c=this.runEuclideanAlgorithm(r.buildMonomial(e,1),l,e),h=c[0],p=c[1],w=this.findErrorLocations(h),g=this.findErrorMagnitudes(p,w);for(s=0;s<w.length;s++){var _=t.length-1-r.log(w[s]);if(_<0)throw new a.default("Bad error location");t[_]=n.default.addOrSubtract(t[_],g[s])}}},t.prototype.runEuclideanAlgorithm=function(t,e,r){if(t.getDegree()<e.getDegree()){var n=t;t=e,e=n}for(var o=this.field,u=t,f=e,s=o.getZero(),d=o.getOne();f.getDegree()>=(r/2|0);){var l=u,c=s;if(s=d,(u=f).isZero())throw new a.default("r_{i-1} was zero");f=l;for(var h=o.getZero(),p=u.getCoefficient(u.getDegree()),w=o.inverse(p);f.getDegree()>=u.getDegree()&&!f.isZero();){var g=f.getDegree()-u.getDegree(),_=o.multiply(f.getCoefficient(f.getDegree()),w);h=h.addOrSubtract(o.buildMonomial(g,_)),f=f.addOrSubtract(u.multiplyByMonomial(g,_))}if(d=h.multiply(s).addOrSubtract(c),f.getDegree()>=u.getDegree())throw new i.default("Division algorithm failed to reduce polynomial?")}var v=d.getCoefficient(0);if(0===v)throw new a.default("sigmaTilde(0) was zero");var y=o.inverse(v);return[d.multiplyScalar(y),f.multiplyScalar(y)]},t.prototype.findErrorLocations=function(t){var e=t.getDegree();if(1===e)return Int32Array.from([t.getCoefficient(1)]);for(var r=new Int32Array(e),n=0,o=this.field,i=1;i<o.getSize()&&n<e;i++)0===t.evaluateAt(i)&&(r[n]=o.inverse(i),n++);if(n!==e)throw new a.default("Error locator degree does not match number of roots");return r},t.prototype.findErrorMagnitudes=function(t,e){for(var r=e.length,n=new Int32Array(r),o=this.field,a=0;a<r;a++){for(var i=o.inverse(e[a]),u=1,f=0;f<r;f++)if(a!==f){var s=o.multiply(e[f],i),d=0==(1&s)?1|s:-2&s;u=o.multiply(u,d)}n[a]=o.multiply(t.evaluateAt(i),o.inverse(u)),0!==o.getGeneratorBase()&&(n[a]=o.multiply(n[a],i))}return n},t}();e.default=u},function(t,e,r){"use strict";Object