You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
84 KiB
JavaScript
1 line
84 KiB
JavaScript
var Quagga=function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(e.toString()).default:"object"==typeof exports?exports.Quagga=e(e.toString()).default:t.Quagga=e(e.toString()).default}(this,function(t){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.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 i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));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=30)}([function(t,e){t.exports=function(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}},function(t,e){function r(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}t.exports=function(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),t}},function(t,e){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},function(t,e){function r(e){return t.exports=r=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},r(e)}t.exports=r},function(t,e,r){var n=r(12),i=r(6);t.exports=function(t,e){return!e||"object"!==n(e)&&"function"!=typeof e?i(t):e}},function(t,e,r){var n=r(25);t.exports=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&n(t,e)}},function(t,e){t.exports=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}},function(t,e,r){t.exports=r(27)},function(t,e,r){r(3);var n=r(26);function i(e,r,a){return"undefined"!=typeof Reflect&&Reflect.get?t.exports=i=Reflect.get:t.exports=i=function(t,e,r){var i=n(t,e);if(i){var a=Object.getOwnPropertyDescriptor(i,e);return a.get?a.get.call(r):a.value}},i(e,r,a||e)}t.exports=i},function(t,e,r){"use strict";r.d(e,"a",function(){return h});var n=r(2),i=r.n(n),a=r(1),o=r.n(a),s=r(0),u=r.n(s),c=r(15),h=function(){function t(e,r,n,a){i()(this,t),u()(this,"data",void 0),u()(this,"size",void 0),r?this.data=r:(this.data=new(n||Uint8Array)(e.x*e.y),a&&this.data.fill(0)),this.size=e}return o()(t,[{key:"inImageWithBorder",value:function(t,e){return t.x>=e&&t.y>=e&&t.x<this.size.x-e&&t.y<this.size.y-e}},{key:"subImageAsCopy",value:function(t,e,r){for(var n=t.size.y,i=t.size.x,a=0;a<i;a++)for(var o=0;o<n;o++)t.data[o*i+a]=this.data[(r+o)*this.size.x+e+a]}},{key:"get",value:function(t,e){return this.data[e*this.size.x+t]}},{key:"set",value:function(t,e,r){return this.data[e*this.size.x+t]=r,this}},{key:"zeroBorder",value:function(){for(var t=this.size.x,e=this.size.y,r=this.data,n=0;n<t;n++)r[n]=r[(e-1)*t+n]=0;for(var i=1;i<e-1;i++)r[i*t]=r[i*t+(t-1)]=0}},{key:"invert",value:function(){for(var t=this.data,e=t.length;e--;)t[e]=t[e]?0:1}},{key:"moments",value:function(t){var e=this.size.y,r=this.size.x,n=new Array,i=new Array;if(t<=0)return i;for(var a=0;a<t;a++)n[a]={m00:0,m01:0,m10:0,m11:0,m02:0,m20:0,theta:0,rad:0};for(var o=0;o<e;o++)for(var s=o*o,u=0;u<r;u++){var c=this.data[o*r+u];if(c>0){var h=n[c-1];h.m00+=1,h.m01+=o,h.m10+=u,h.m11+=u*o,h.m02+=s,h.m20+=u*u}}for(var l=Math.PI,f=l/4,d=0;d<t;d++){var v=n[d];if(!isNaN(v.m00)&&0!==v.m00){var _=v.m10/v.m00,p=v.m01/v.m00,g=v.m11/v.m00-_*p,y=v.m02/v.m00-p*p,m=v.m20/v.m00-_*_,b=.5*Math.atan((y-m)/(2*g))+(g>=0?f:-f)+l;v.theta=(180*b/l+90)%180-90,v.theta<0&&(v.theta+=180),v.rad=b>l?b-l:b,v.x=Math.cos(b),v.y=Math.sin(b),i.push(v)}}return i}},{key:"show",value:function(t,e){var r=this.size.y,n=this.size.x,i=t.getImageData(0,0,n,r),a=i.data,o=0;e||(e=1);for(var s=0;s<r;s++)for(var u=0;u<n;u++){var c=s*n+u;o=this.get(u,s)*e,a[4*c+0]=o,a[4*c+1]=o,a[4*c+2]=o,a[4*c+3]=255}t.putImageData(i,0,0)}},{key:"overlay",value:function(t,e,r,n){var i=[0,1,1],a=[255,255,255],o=[0,0,0],s=t.getImageData(r,n,this.size.x,this.size.y),u=s.data;(!e||e<0||e>360)&&(e=360);for(var h=this.data.length;h--;){i[0]=this.data[h]*e;var l=i[0]<=0?a:i[0]>=360?o:Object(c.a)(i);u[4*h+0]=l[0],u[4*h+1]=l[1],u[4*h+2]=l[2],u[4*h+3]=255}t.putImageData(s,r,n)}}]),t}()},function(t,e){function r(t,e,r,n,i,a,o){try{var s=t[a](o),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,i)}t.exports=function(t){return function(){var e=this,n=arguments;return new Promise(function(i,a){var o=t.apply(e,n);function s(t){r(o,i,a,s,u,"next",t)}function u(t){r(o,i,a,s,u,"throw",t)}s(void 0)})}}},function(t,e,r){"use strict";r.d(e,"a",function(){return n});var n={drawPath:function(t,e,r,n){t&&t.length>1&&(e.strokeStyle=r,e.fillStyle=r,e.lineWidth=n,e.beginPath(),e.moveTo(t[0].x,t[0].y),t.slice(1).forEach(function(t){var r=t.x,n=t.y;return e.lineTo(r,n)}),e.closePath(),e.stroke())},drawImage:function(t,e,r,n){var i=n.getImageData(0,0,e,r),a=i.data,o=0|t.length,s=0|a.length;if(s/o!=4)return!1;for(;o--;){var u=t[o];a[--s]=255,a[--s]=u,a[--s]=u,a[--s]=u}return n.putImageData(i,0,0),!0}}},function(t,e){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function n(e){return"function"==typeof Symbol&&"symbol"===r(Symbol.iterator)?t.exports=n=function(t){return r(t)}:t.exports=n=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":r(t)},n(e)}t.exports=n},function(t,e,r){var n=r(22),i=r(23),a=r(24);t.exports=function(t){return n(t)||i(t)||a()}},function(t,e,r){"use strict";function n(t){var e=t[0],r=t[1],n=t[2],i=t[3],a=e*i-n*r;return a?new Float32Array([i/a,-r/a,-n/a,e/a]):null}function i(t,e){var r=t.x,n=t.y;return{x:e[0]*r+e[2]*n,y:e[1]*r+e[3]*n}}function a(t,e){e||(e=8);var r=8-e,n=function(t,e){e||(e=8);for(var r=t.data,n=8-e,i=new Int32Array(1<<e),a=r.length;a--;)i[r[a]>>n]++;return i}(t,e),i=[0],a=(1<<e)-1;function o(t,e){for(var r=0,i=t;i<=e;i++)r+=n[i];return r}function s(t,e){for(var r=0,i=t;i<=e;i++)r+=i*n[i];return r}for(var u=1;u<a;u++){var c=o(0,u),h=o(u+1,a),l=c*h||1,f=s(0,u)*h-s(u+1,a)*c;i[u]=f*f/l}return i.reduce(function(t,e,r,n){return e>n[t]?r:t},0)<<r}function o(t,e){var r=a(t),n=e.data;return t.data.forEach(function(t,e){n[e]=t<r?1:0}),r}function s(t,e){for(var r=t.data,n=t.size.x,i=e.data,a=r.length,o=n>>1,s=0,u=n,c=0;u<a;){for(var h=0;h<o;h++)i[c]=r[s]+r[s+1]+r[u]+r[u+1]>>2,c++,s+=2,u+=2;s+=n,u+=n}}r.d(e,"b",function(){return n}),r.d(e,"d",function(){return i}),r.d(e,"c",function(){return o}),r.d(e,"a",function(){return s})},function(t,e,r){"use strict";function n(t,e){var r=t[0],n=t[1],i=t[2],a=i*n,o=a*(1-Math.abs(r/60%2-1)),s=i-a,u=0,c=0,h=0;return r<60?(u=a,c=o):r<120?(u=o,c=a):r<180?(c=a,h=o):r<240?(c=o,h=a):r<300?(u=o,h=a):r<360&&(u=a,h=o),(e=e||[0,0,0])[0]=255*(u+s)|0,e[1]=255*(c+s)|0,e[2]=255*(h+s)|0,e}r.d(e,"a",function(){return n})},function(t,e,r){"use strict";function n(t){for(var e=new Array,r=new Array,n=1;n*n<=t;n++)t%n==0&&(e.push(n),n*n!==t&&r.unshift(t/n|0));return e.concat(r)}function i(t,e){var r=e.x,i=e.y,a=0|Math.max(0|r,0|i),o=[8,10,15,20,32,60,80],s={"x-small":5,small:4,medium:3,large:2,"x-large":1},u=s[t]||0|s.medium,c=0|o[u],h=a/c|0;function l(t){for(var e=0,r=0|t[t.length>>1];e<t.length-1&&t[e]<h;)e++;return e>0&&(r=Math.abs(t[e]-h)>Math.abs(t[e-1]-h)?0|t[e-1]:0|t[e]),h/r<o[u+1]/o[u]&&h/r>o[u-1]/o[u]?{x:r,y:r}:null}return l(function(t,e){if(t===e)return n(t);for(var r=t>e?t:e,i=t>e?e:t,a=new Array,o=new Array,s=1;s*s<=i;s++)if(r%s==0&&i%s==0){a.push(s);var u=i/s|0;s!==u&&r%u==0&&o.unshift()}return a.concat(o)}(r,i))||l(n(a))||l(n(h*c))}function a(t,e){var r=t.width,n=t.height,a=e.halfSample?1:0,s=t.config;if(s&&s.area){var u=function(t,e,r){var n={width:t,height:e},i=Object.keys(r).reduce(function(t,e){var i=r[e],a=function(t){return{value:parseFloat(t),unit:t.indexOf("%")===t.length-1?"%":t.indexOf("px")===t.length-2?"px":"%"}}(i),s=o[e](a,n);return t[e]=s,t},{});return{topLeft:{x:i.left,y:i.top},width:i.right-i.left,height:i.bottom-i.top}}(r,n,s.area);t.topLeft=u.topLeft,t.setCanvasSize(r,n),r=u.width,n=u.height}var c={x:r>>a,y:n>>a},h=i(e.patchSize,c);if(t.width=(c.x/h.x<<a)*h.x|0,t.height=(c.y/h.y<<a)*h.y|0,t.width%h.x==0&&t.height%h.y==0)return!0;throw new Error("Image dimensions do not comply with the current settings: width (".concat(r,") and height (").concat(n,") must be a multiple of ").concat(h.x))}r.d(e,"a",function(){return i}),r.d(e,"b",function(){return a});var o={bottom:function(t,e){var r=e.height;return"%"===t.unit?r-r*t.value/100|0:"px"===t.unit?r-t.value:r},left:function(t,e){var r=e.width;return"%"===t.unit?r*t.value/100|0:"px"===t.unit?t.value:0},right:function(t,e){var r=e.width;return"%"===t.unit?r-r*t.value/100|0:"px"===t.unit?r-t.value:r},top:function(t,e){var r=e.height;return"%"===t.unit?r*t.value/100|0:"px"===t.unit?t.value:0}}},function(t,e,r){"use strict";r.d(e,"a",function(){return c}),r.d(e,"b",function(){return h});var n=r(2),i=r.n(n),a=r(1),o=r.n(a),s=r(0),u=r.n(s),c=[[0,1],[1,1],[1,0],[1,-1],[0,-1],[-1,-1],[-1,0],[-1,1]],h=function(){function t(e,r){i()(this,t),u()(this,"_imageData",void 0),u()(this,"_labelData",void 0),u()(this,"_width",void 0),this._imageData=e.data,this._labelData=r.data,this._width=e.size.x}return o()(t,[{key:"trace",value:function(t,e,r,n){for(var i=0;i<7;i++){var a=t.cy+c[t.dir][0]|0,o=t.cx+c[t.dir][1]|0,s=a*this._width+o|0;if(this._imageData[s]===e&&(0===this._labelData[s]||this._labelData[s]===r))return this._labelData[s]=r,t.cx=o,t.cy=a,!0;0===this._labelData[s]&&(this._labelData[s]=n),t.dir=(t.dir+1)%8}return!1}},{key:"contourTracing",value:function(t,e,r,n,i){var a=null,o={cx:e,cy:t,dir:0};if(this.trace(o,n,r,i)){var s=a={x:e,y:t,dir:o.dir,next:null,prev:null},u=o.dir,c={x:o.cx,y:o.cy,dir:0,next:null,prev:s};s.next=c,s=c;do{o.dir=(o.dir+6)%8,this.trace(o,n,r,i),u!==o.dir?(s.dir=o.dir,c={x:o.cx,y:o.cy,dir:0,next:null,prev:s},s.next=c,s=c):(s.dir=u,s.x=o.cx,s.y=o.cy),u=o.dir}while(o.cx!==e||o.cy!==t);a.prev=s.prev,s.prev.next=a}return a}}]),t}()},function(t,e,r){"use strict";(function(t){r.d(e,"a",function(){return g});var n=r(2),i=r.n(n),a=r(1),o=r.n(a),s=r(0),u=r.n(s),c=r(19),h=(r(15),r(11)),l=r(9),f=r(16),d=r(14),v=r(20),_=r(21),p=r(17),g=function(){function e(t,r){i()(this,e),u()(this,"_config",void 0),u()(this,"_inputImageWrapper",void 0),u()(this,"_currentImageWrapper",void 0),u()(this,"_skelImageWrapper",void 0),u()(this,"_subImageWrapper",void 0),u()(this,"_labelImageWrapper",void 0),u()(this,"_binaryImageWrapper",void 0),u()(this,"_patchGrid",void 0),u()(this,"_patchLabelGrid",void 0),u()(this,"_imageToPatchGrid",void 0),u()(this,"_patchSize",void 0),u()(this,"_binaryContext",void 0),u()(this,"_numPatches",void 0),u()(this,"_skeletonizer",void 0),this._config=r,this._inputImageWrapper=t,this._numPatches={x:0,y:0},this._initBuffers(),this._initCanvas()}return o()(e,[{key:"locate",value:function(){this._config.halfSample&&Object(d.a)(this._inputImageWrapper,this._currentImageWrapper),this._binarizeImage();var t=this._findPatches();if(t.length<this._numPatches.x*this._numPatches.y*.05)return null;var e=this._rasterizeAngularSimilarity(t);if(e<1)return null;var r=this._findBiggestConnectedAreas(e);return 0===r.length?null:this._findBoxes(r,e)}},{key:"_initBuffers",value:function(){this._config.halfSample?this._currentImageWrapper=new l.a({x:this._inputImageWrapper.size.x/2|0,y:this._inputImageWrapper.size.y/2|0}):this._currentImageWrapper=this._inputImageWrapper,this._patchSize=Object(f.a)(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 l.a(this._currentImageWrapper.size,void 0,Uint8Array,!1),this._labelImageWrapper=new l.a(this._patchSize,void 0,Array,!0);var e=new ArrayBuffer(65536);this._subImageWrapper=new l.a(this._patchSize,new Uint8Array(e,0,this._patchSize.x*this._patchSize.y)),this._skelImageWrapper=new l.a(this._patchSize,new Uint8Array(e,this._patchSize.x*this._patchSize.y*3,this._patchSize.x*this._patchSize.y),void 0,!0),this._skeletonizer=Object(_.a)("undefined"!=typeof window?window:"undefined"!=typeof self?self:t,{size:this._patchSize.x},e);var r={x:this._currentImageWrapper.size.x/this._subImageWrapper.size.x|0,y:this._currentImageWrapper.size.y/this._subImageWrapper.size.y|0};this._patchLabelGrid=new l.a(r,void 0,Int32Array,!0),this._patchGrid=new l.a(r,void 0,void 0,!0),this._imageToPatchGrid=new Array(this._patchLabelGrid.data.length)}},{key:"_initCanvas",value:function(){if(!this._config.useWorker&&"undefined"!=typeof document){var t=document.createElement("canvas");t.className="binaryBuffer",t.width=this._binaryImageWrapper.size.x,t.height=this._binaryImageWrapper.size.y,this._binaryContext=t.getContext("2d")}}},{key:"_boxFromPatches",value:function(t){var e=t.reduce(function(t,e){e.pos;return t+e.rad},0)/t.length;(e=(180*e/Math.PI+90)%180-90)<0&&(e+=180),e=(180-e)*Math.PI/180;var r=Math.cos(e),n=Math.sin(e),i=new Float32Array([r,n,-n,r]),a=Object(d.b)(i);t.forEach(function(t){for(var e=t.box,r=0;r<4;r++)e[r]=Object(d.d)(e[r],i)});var o=this._binaryImageWrapper.size.x,s=this._binaryImageWrapper.size.y,u=-o,c=-s;t.forEach(function(t){t.box.forEach(function(t){var e=t.x,r=t.y;e<o&&(o=e),e>u&&(u=e),r<s&&(s=r),r>c&&(c=r)})});var h=[{x:o,y:s},{x:u,y:s},{x:u,y:c},{x:o,y:c}];return h=h.map(function(t){return Object(d.d)(t,a)}),this._config.halfSample&&(h=h.map(function(t){var e=t.x,r=t.y;return{x:2*e,y:r*=2}})),h}},{key:"_binarizeImage",value:function(){Object(d.c)(this._currentImageWrapper,this._binaryImageWrapper),this._binaryImageWrapper.zeroBorder()}},{key:"_findPatches",value:function(){for(var t=new Array,e=0;e<this._numPatches.x;e++)for(var r=0;r<this._numPatches.y;r++){var n=this._subImageWrapper.size.x*e,i=this._subImageWrapper.size.y*r;this._skeletonize(n,i),this._skelImageWrapper.zeroBorder(),this._labelImageWrapper.data.fill(0);var a=new v.a(this._skelImageWrapper,this._labelImageWrapper).rasterize(0);0;var o=this._labelImageWrapper.moments(a.count),s=this._describePatch(o,r*this._numPatches.x+e,n,i);s&&t.push(s)}return t}},{key:"_findBiggestConnectedAreas",value:function(t){var e=new Array(t).fill(0);return this._patchLabelGrid.data.forEach(function(t){t>0&&e[t-1]++}),e.map(function(t,e){return{value:t,index:e}}).filter(function(t){return t.value>=5}).sort(function(t,e){return e.value-t.value}).map(function(t){return t.index+1})}},{key:"_findBoxes",value:function(t,e){var r=this,n=new Array;return t.forEach(function(t){var e=new Array;r._patchLabelGrid.data.forEach(function(n,i){n===t&&e.push(r._imageToPatchGrid[i])});var i=r._boxFromPatches(e);i&&n.push(i)}),n}},{key:"_similarMoments",value:function(t){return c.a.clusterize(t,.9).reduce(function(t,e){var r=e.moments.length;return r>t.count?{item:e,count:r}:t},{item:{moments:[]},count:0}).item.moments}},{key:"_skeletonize",value:function(t,e){this._binaryImageWrapper.subImageAsCopy(this._subImageWrapper,t,e),this._skeletonizer.skeletonize()}},{key:"_describePatch",value:function(t,e,r,n){if(t.length>1){var i=Math.ceil(this._patchSize.x/3),a=t.filter(function(t){return t.m00>i});if(a.length>1){var o=this._similarMoments(a),s=0|o.length;if(s>1&&s<<2>=3*a.length&&s<<2>t.length){var u=o.reduce(function(t,e){return t+e.rad},0)/s;return{index:e,pos:{x:r,y:n},box:[{x:r,y:n},{x:r+this._subImageWrapper.size.x,y:n},{x:r+this._subImageWrapper.size.x,y:n+this._subImageWrapper.size.y},{x:r,y:n+this._subImageWrapper.size.y}],moments:o,rad:u,x:Math.cos(u),y:Math.sin(u)}}}}return null}},{key:"_notYetProcessed",value:function(){for(var t=0;t<this._patchLabelGrid.data.length;t++)if(0===this._patchLabelGrid.data[t]&&1===this._patchGrid.data[t])return t;return this._patchLabelGrid.data.length}},{key:"_trace",value:function(t,e){var r=this,n=t%this._patchLabelGrid.size.x,i=t/this._patchLabelGrid.size.x|0;if(t<this._patchLabelGrid.data.length){var a=this._imageToPatchGrid[t];this._patchLabelGrid.data[t]=e,p.a.forEach(function(t){var o=i+t[0],s=n+t[1],u=o*r._patchLabelGrid.size.x+s;if(0===r._patchGrid.data[u])r._patchLabelGrid.data[u]=Number.MAX_VALUE;else if(0===r._patchLabelGrid.data[u]){var c=r._imageToPatchGrid[u];Math.abs(c.x*a.x+c.y*a.y)>.95&&r._trace(u,e)}})}}},{key:"_rasterizeAngularSimilarity",value:function(t){var e=this,r=0;this._patchGrid.data.fill(0),this._patchLabelGrid.data.fill(0),this._imageToPatchGrid.fill(null),t.forEach(function(t){e._imageToPatchGrid[t.index]=t,e._patchGrid.data[t.index]=1}),this._patchGrid.zeroBorder();for(var n=0;(n=this._notYetProcessed())<this._patchLabelGrid.data.length;)r++,this._trace(n,r);return r}},{key:"_drawRect",value:function(t,e,r,n){var i=t.x,a=t.y;this._binaryContext.strokeStyle=r,this._binaryContext.fillStyle=r,this._binaryContext.lineWidth=n||1,this._binaryContext.strokeRect(i,a,e.x,e.y)}},{key:"_drawPath",value:function(t,e,r){h.a.drawPath(t,this._binaryContext,e,r)}}]),e}()}).call(this,r(29))},function(t,e,r){"use strict";r.d(e,"a",function(){return c});var n=r(2),i=r.n(n),a=r(1),o=r.n(a),s=r(0),u=r.n(s),c=function(){function t(e,r){i()(this,t),u()(this,"_threshold",void 0),u()(this,"_moments",void 0),u()(this,"_center",void 0),this._threshold=e,this._moments=new Array,this._center={rad:0,x:0,y:0},r&&this.add(r)}return o()(t,null,[{key:"clusterize",value:function(e,r){var n=new Array;return e.forEach(function(e){var i=n.find(function(t){return t.fits(e)});i?i.add(e):n.push(new t(r,e))}),n}}]),o()(t,[{key:"add",value:function(t){this._moments.push(t),this._center.rad=this._moments.reduce(function(t,e){return t+e.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(t){return Math.abs(t.x*this._center.x+t.y*this._center.y)>this._threshold}},{key:"moments",get:function(){return this._moments}}]),t}()},function(t,e,r){"use strict";r.d(e,"a",function(){return f});var n,i,a=r(2),o=r.n(a),s=r(1),u=r.n(s),c=r(0),h=r.n(c),l=r(17);!function(t){t[t.Outside=-32767]="Outside",t[t.Inside=-32766]="Inside"}(n||(n={})),function(t){t[t.CW=0]="CW",t[t.CCW=1]="CCW",t[t.Unknown=2]="Unknown"}(i||(i={}));var f=function(){function t(e,r){o()(this,t),h()(this,"_width",void 0),h()(this,"_height",void 0),h()(this,"_tracer",void 0),h()(this,"_imageData",void 0),h()(this,"_labelData",void 0),this._imageData=e.data,this._labelData=r.data,this._width=e.size.x,this._height=e.size.y,this._tracer=new l.b(e,r)}return u()(t,[{key:"rasterize",value:function(t){for(var e=new Array,r=0;r<400;r++)e[r]=0;e[0]=this._imageData[0];for(var a,o=null,s=0,u=1;u<this._height-1;u++)for(var c=0,h=e[0],l=1;l<this._width-1;l++){var f=u*this._width+l;if(0===this._labelData[f]){var d=this._imageData[f];if(d!==h)if(0===c){var v=s+1;e[v]=d,h=d;var _=this._tracer.contourTracing(u,l,v,d,n.Outside);if(null!==_){s++,c=v;var p={dir:i.CW,index:c,firstVertex:_,nextPeer:o,insideContours:null};null!==o&&(o.previousPeer=p),o=p}}else{var g=this._tracer.contourTracing(u,l,n.Inside,d,c);if(null!==g){var y={dir:0===t?i.CCW:i.CW,firstVertex:g,index:t,insideContours:null};for(a=o;null!==a&&a.index!==c;)a=a.nextPeer;null!==a&&(y.nextPeer=a.insideContours,null!==a.insideContours&&(a.insideContours.previousPeer=y),a.insideContours=y)}}else this._labelData[f]=c}else this._labelData[f]===n.Inside?(c=0,h=this._imageData[f]):this._labelData[f]===n.Outside?(c=0,h=e[0]):h=e[c=this._labelData[f]]}for(a=o;null!==a;)a.index=t,a=a.nextPeer;return{cc:o,count:s}}},{key:"drawContour",value:function(t,e){var r=t.getContext("2d");r.strokeStyle="red",r.fillStyle="red",r.lineWidth=1;for(var n=e,a=n&&n.insideContours;null!==n;){var o=a||n;switch(a=null!==a?a.nextPeer:(n=n.nextPeer)&&n.insideContours,o.dir){case i.CW:r.strokeStyle="red";break;case i.CCW:r.strokeStyle="blue";break;case i.Unknown:r.strokeStyle="green"}var s=o.firstVertex;r.beginPath(),r.moveTo(s.x,s.y);do{s=s.next,r.lineTo(s.x,s.y)}while(s!==o.firstVertex);r.stroke()}}}]),t}()},function(t,e,r){"use strict";e.a=function(t,e,r){"use asm";var n=new t.Uint8Array(r),i=e.size|0,a=t.Math.imul;function o(t,e){t=t|0;e=e|0;var r=0,a=0,o=0,s=0,u=0,c=0,h=0,l=0;for(r=1;(r|0)<(i-1|0);r=r+1|0){l=l+i|0;for(a=1;(a|0)<(i-1|0);a=a+1|0){s=l-i|0;u=l+i|0;c=a-1|0;h=a+1|0;o=(n[t+s+c|0]|0)+(n[t+s+h|0]|0)+(n[t+l+a|0]|0)+(n[t+u+c|0]|0)+(n[t+u+h|0]|0)|0;if((o|0)==(5|0)){n[e+l+a|0]=1}else{n[e+l+a|0]=0}}}return}function s(t,e,r){t=t|0;e=e|0;r=r|0;var o=0;o=a(i,i)|0;while((o|0)>0){o=o-1|0;n[r+o|0]=(n[t+o|0]|0)-(n[e+o|0]|0)|0}}function u(t,e,r){t=t|0;e=e|0;r=r|0;var o=0;o=a(i,i)|0;while((o|0)>0){o=o-1|0;n[r+o|0]=n[t+o|0]|0|(n[e+o|0]|0)|0}}function c(t){t=t|0;var e=0,r=0;r=a(i,i)|0;while((r|0)>0){r=r-1|0;e=(e|0)+(n[t+r|0]|0)|0}return e|0}function h(t,e){t=t|0;e=e|0;var r=0;r=a(i,i)|0;while((r|0)>0){r=r-1|0;n[t+r|0]=e}}function l(t,e){t=t|0;e=e|0;var r=0,a=0,o=0,s=0,u=0,c=0,h=0,l=0;for(r=1;(r|0)<(i-1|0);r=r+1|0){l=l+i|0;for(a=1;(a|0)<(i-1|0);a=a+1|0){s=l-i|0;u=l+i|0;c=a-1|0;h=a+1|0;o=(n[t+s+c|0]|0)+(n[t+s+h|0]|0)+(n[t+l+a|0]|0)+(n[t+u+c|0]|0)+(n[t+u+h|0]|0)|0;if((o|0)>(0|0)){n[e+l+a|0]=1}else{n[e+l+a|0]=0}}}return}function f(t,e){t=t|0;e=e|0;var r=0;r=a(i,i)|0;while((r|0)>0){r=r-1|0;n[e+r|0]=n[t+r|0]|0}}function d(t){t=t|0;var e=0,r=0;for(e=0;(e|0)<(i-1|0);e=e+1|0){n[t+e|0]=0;n[t+r|0]=0;r=r+i-1|0;n[t+r|0]=0;r=r+1|0}for(e=0;(e|0)<(i|0);e=e+1|0){n[t+r|0]=0;r=r+1|0}}function v(){var t=0,e=0,r=0,n=0,v=0,_=0;e=a(i,i)|0;r=e+e|0;n=r+e|0;h(n,0);d(t);do{o(t,e);l(e,r);s(t,r,r);u(n,r,n);f(e,t);v=c(t)|0;_=(v|0)==0|0}while(!_)}return{skeletonize:v}}},function(t,e){t.exports=function(t){if(Array.isArray(t)){for(var e=0,r=new Array(t.length);e<t.length;e++)r[e]=t[e];return r}}},function(t,e){t.exports=function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}},function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}},function(t,e){function r(e,n){return t.exports=r=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},r(e,n)}t.exports=r},function(t,e,r){var n=r(3);t.exports=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=n(t)););return t}},function(t,e,r){var n=function(){return this||"object"==typeof self&&self}()||Function("return this")(),i=n.regeneratorRuntime&&Object.getOwnPropertyNames(n).indexOf("regeneratorRuntime")>=0,a=i&&n.regeneratorRuntime;if(n.regeneratorRuntime=void 0,t.exports=r(28),i)n.regeneratorRuntime=a;else try{delete n.regeneratorRuntime}catch(t){n.regeneratorRuntime=void 0}},function(t,e){!function(e){"use strict";var r,n=Object.prototype,i=n.hasOwnProperty,a="function"==typeof Symbol?Symbol:{},o=a.iterator||"@@iterator",s=a.asyncIterator||"@@asyncIterator",u=a.toStringTag||"@@toStringTag",c="object"==typeof t,h=e.regeneratorRuntime;if(h)c&&(t.exports=h);else{(h=e.regeneratorRuntime=c?t.exports:{}).wrap=b;var l="suspendedStart",f="suspendedYield",d="executing",v="completed",_={},p={};p[o]=function(){return this};var g=Object.getPrototypeOf,y=g&&g(g(I([])));y&&y!==n&&i.call(y,o)&&(p=y);var m=C.prototype=x.prototype=Object.create(p);k.prototype=m.constructor=C,C.constructor=k,C[u]=k.displayName="GeneratorFunction",h.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===k||"GeneratorFunction"===(e.displayName||e.name))},h.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,C):(t.__proto__=C,u in t||(t[u]="GeneratorFunction")),t.prototype=Object.create(m),t},h.awrap=function(t){return{__await:t}},E(S.prototype),S.prototype[s]=function(){return this},h.AsyncIterator=S,h.async=function(t,e,r,n){var i=new S(b(t,e,r,n));return h.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},E(m),m[u]="Generator",m[o]=function(){return this},m.toString=function(){return"[object Generator]"},h.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},h.values=I,R.prototype={constructor:R,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(P),!t)for(var e in this)"t"===e.charAt(0)&&i.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=r)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(n,i){return s.type="throw",s.arg=t,e.next=n,i&&(e.method="next",e.arg=r),!!i}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],s=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var u=i.call(o,"catchLoc"),c=i.call(o,"finallyLoc");if(u&&c){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(u){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var a=n;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=t,o.arg=e,a?(this.method="next",this.next=a.finallyLoc,_):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),_},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),P(r),_}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;P(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:I(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=r),_}}}function b(t,e,r,n){var i=e&&e.prototype instanceof x?e:x,a=Object.create(i.prototype),o=new R(n||[]);return a._invoke=function(t,e,r){var n=l;return function(i,a){if(n===d)throw new Error("Generator is already running");if(n===v){if("throw"===i)throw a;return z()}for(r.method=i,r.arg=a;;){var o=r.delegate;if(o){var s=A(o,r);if(s){if(s===_)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===l)throw n=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=d;var u=w(t,e,r);if("normal"===u.type){if(n=r.done?v:f,u.arg===_)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n=v,r.method="throw",r.arg=u.arg)}}}(t,r,o),a}function w(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}function x(){}function k(){}function C(){}function E(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function S(t){var e;this._invoke=function(r,n){function a(){return new Promise(function(e,a){!function e(r,n,a,o){var s=w(t[r],t,n);if("throw"!==s.type){var u=s.arg,c=u.value;return c&&"object"==typeof c&&i.call(c,"__await")?Promise.resolve(c.__await).then(function(t){e("next",t,a,o)},function(t){e("throw",t,a,o)}):Promise.resolve(c).then(function(t){u.value=t,a(u)},function(t){return e("throw",t,a,o)})}o(s.arg)}(r,n,e,a)})}return e=e?e.then(a,a):a()}}function A(t,e){var n=t.iterator[e.method];if(n===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=r,A(t,e),"throw"===e.method))return _;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return _}var i=w(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,_;var a=i.arg;return a?a.done?(e[t.resultName]=a.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=r),e.delegate=null,_):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,_)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function R(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function I(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,a=function e(){for(;++n<t.length;)if(i.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=r,e.done=!0,e};return a.next=a}}return{next:z}}function z(){return{value:r,done:!0}}}(function(){return this||"object"==typeof self&&self}()||Function("return this")())},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(e,r,n){"use strict";n.r(r);var i=n(2),a=n.n(i),o=n(1),s=n.n(o),u=n(0),c=n.n(u),h=n(11),l=function(){function t(e){a()(this,t),c()(this,"_canvas",void 0),c()(this,"_context",void 0),c()(this,"_config",void 0),c()(this,"_capacity",void 0),c()(this,"_capture",void 0),c()(this,"_results",void 0),this._results=new Array,this._config=e,this._capacity=e.capacity||20,this._capture=!0===e.capture,this._capture&&(this._canvas=document.createElement("canvas"),this._context=this._canvas.getContext("2d"))}return s()(t,[{key:"addResult",value:function(t,e,r,n){if(n&&this._capacity&&!this._contains(n)&&this._passesFilter(n)){var i={codeResult:n};this._capacity--,this._capture&&(this._canvas.width=e,this._canvas.height=r,h.a.drawImage(t,e,r,this._context),i.frame=this._canvas.toDataURL()),this._results.push(i)}}},{key:"getResults",value:function(){return this._results}},{key:"_contains",value:function(t){return this._config.blacklist&&this._config.blacklist.some(function(e){return Object.keys(e).every(function(r){return e[r]===t[r]})})}},{key:"_passesFilter",value:function(t){return"function"!=typeof this._config.filter||this._config.filter(t)}}]),t}(),f={},d=function(){function t(){a()(this,t)}return s()(t,null,[{key:"subscribe",value:function(t,e,r){var n;if("function"==typeof e)n={callback:e,async:r};else if(!(n=e).callback)throw"Callback was not specified on options";v(t).subscriptions.push(n)}},{key:"publish",value:function(t,e){var r=v(t),n=r.subscriptions;n.filter(function(t){return!!t.once}).forEach(function(t){return _(t,e)}),r.subscriptions=n.filter(function(t){return!t.once}),r.subscriptions.forEach(function(t){return _(t,e)})}},{key:"once",value:function(e,r,n){t.subscribe(e,{callback:r,async:n,once:!0})}},{key:"unsubscribe",value:function(t,e){if(t){var r=v(t);r.subscriptions=r&&e?r.subscriptions.filter(function(t){return t.callback!==e}):[]}else f={}}}]),t}();function v(t){return f[t]||(f[t]={subscriptions:[]}),f[t]}function _(t,e){t.async?setTimeout(function(){t.callback(e)},4):t.callback(e)}var p=n(9),g=n(12),y=n.n(g);function m(){for(var t=function(t){return t&&"object"===y()(t)},e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return r.reduce(function(e,r){return r&&Object.keys(r).forEach(function(n){var i=e[n],a=r[n];Array.isArray(i)&&Array.isArray(a)?e[n]=a:t(i)&&t(a)?e[n]=m(i,a):e[n]=a}),e},{})}var b,w={inputStream:{name:"Live",type:"LiveStream",constraints:{width:640,height:480,facingMode:"environment"},area:{top:"0%",right:"0%",left:"0%",bottom:"0%"},singleChannel:!1},locate:!0,numOfWorkers:4,decoder:{readers:["code_128_reader"]},locator:{halfSample:!0,patchSize:"medium"}},x=n(13),k=n.n(x),C=n(4),E=n.n(C),S=n(3),A=n.n(S),O=n(5),P=n.n(O);!function(t){t[t.Forward=1]="Forward",t[t.Reverse=-1]="Reverse"}(b||(b={}));var R=function(){function t(e,r){a()(this,t),c()(this,"_singleCodeError",void 0),c()(this,"_averageCodeError",void 0),c()(this,"_format",void 0),c()(this,"_row",void 0),c()(this,"config",void 0),c()(this,"supplements",void 0),this._format="unknown",this._row=[],this.config=e||{},this.supplements=r}return s()(t,[{key:"SINGLE_CODE_ERROR",get:function(){return this._singleCodeError}},{key:"AVERAGE_CODE_ERROR",get:function(){return this._averageCodeError}},{key:"FORMAT",get:function(){return this._format}}],[{key:"Exception",get:function(){return{StartNotFoundException:"Start-Info was not found!",CodeNotFoundException:"Code could not be found!",PatternNotFoundException:"Pattern could not be found!"}}}]),s()(t,[{key:"_findPattern",value:function(t,e,r,n){var i=new Array(t.length),a={error:Number.MAX_VALUE,code:-1,start:0,end:0},o=this.AVERAGE_CODE_ERROR,s=0;e||(e=this._nextSet(this._row)),i.fill(0);for(var u=e;u<this._row.length;u++)if(this._row[u]^r)i[s]++;else{if(s===i.length-1){var c=this._matchPattern(i,t);if(c<o)return a.error=c,a.start=u-i.reduce(function(t,e){return t+e},0),a.end=u,a;if(!n)return null;for(var h=0;h<i.length-2;h++)i[h]=i[h+2];i[i.length-2]=0,i[i.length-1]=0,s--}else s++;i[s]=1,r=r?0:1}return null}},{key:"_nextUnset",value:function(t,e){for(var r=e||0;r<t.length;r++)if(!t[r])return r;return t.length}},{key:"_nextSet",value:function(t,e){for(var r=e||0;r<t.length;r++)if(t[r])return r;return t.length}},{key:"_matchRange",value:function(t,e,r){for(var n=t<0?0:t;n<e;n++)if(this._row[n]!==r)return!1;return!0}},{key:"_matchPattern",value:function(t,e,r){var n=0,i=0,a=0;r=r||this.SINGLE_CODE_ERROR||1;for(var o=0;o<t.length;o++)i+=t[o],a+=e[o];if(i<a)return Number.MAX_VALUE;var s=i/a;r*=s;for(var u=0;u<t.length;u++){var c=t[u],h=e[u]*s,l=Math.abs(c-h)/h;if(l>r)return Number.MAX_VALUE;n+=l}return n/a}},{key:"_correctBars",value:function(t,e,r){for(var n=r.length,i=0;n--;)(i=t[r[n]]*(1-(1-e)/2))>1&&(t[r[n]]=i)}},{key:"decodePattern",value:function(t){this._row=t;var e=this.decode();return null===e?(this._row.reverse(),(e=this.decode())&&(e.direction=b.Reverse,e.start=this._row.length-e.start,e.end=this._row.length-e.end)):e.direction=b.Forward,e&&(e.format=this.FORMAT),e}},{key:"_fillCounters",value:function(t,e,r){var n=new Array,i=0;n[i]=0;for(var a=t;a<e;a++)this._row[a]^r?n[i]++:(n[++i]=1,r=r?0:1);return n}},{key:"_toCounters",value:function(t,e){var r=e.length,n=this._row.length,i=this._row[t]?0:1,a=0;e.fill(0);for(var o=t;o<n;o++)if(this._row[o]^i)e[a]++;else{if(++a===r)break;e[a]=1,i=i?0:1}return e}}]),t}(),I=[[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]],z=[0,2,4],D=[1,3,5],W=function(t){function e(){var t;return a()(this,e),(t=E()(this,A()(e).call(this)))._format="code_128",t._singleCodeError=.64,t._averageCodeError=.3,t}return P()(e,t),s()(e,[{key:"_decodeCode",value:function(t,e){for(var r=[0,0,0,0,0,0],n=t,i={error:Number.MAX_VALUE,code:-1,start:t,end:t,correction:{bar:1,space:1}},a=this.AVERAGE_CODE_ERROR,o=this._row[n]?0:1,s=0,u=n;u<this._row.length;u++)if(this._row[u]^o)r[s]++;else{if(s===r.length-1){e&&this._correct(r,e);for(var c=0;c<I.length;c++){var h=this._matchPattern(r,I[c]);h<i.error&&(i.code=c,i.error=h)}if(i.end=u,-1===i.code||i.error>a)return null;var l=I[i.code];return l&&(i.correction.bar=this._calculateCorrection(l,r,z),i.correction.space=this._calculateCorrection(l,r,D)),i}r[++s]=1,o=o?0:1}return null}},{key:"_correct",value:function(t,e){this._correctBars(t,e.bar,z),this._correctBars(t,e.space,D)}},{key:"_findStart",value:function(){for(var t,e=[0,0,0,0,0,0],r=this._nextSet(this._row),n={error:Number.MAX_VALUE,code:-1,start:0,end:0,correction:{bar:1,space:1}},i=this.AVERAGE_CODE_ERROR,a=0,o=0,s=r;s<this._row.length;s++)if(this._row[s]^a)e[o]++;else{if(o===e.length-1){t=0;for(var u=0;u<e.length;u++)t+=e[u];for(var c=103;c<=105;c++){var h=this._matchPattern(e,I[c]);h<n.error&&(n.code=c,n.error=h)}if(n.error<i)return n.start=s-t,n.end=s,n.correction.bar=this._calculateCorrection(I[n.code],e,z),n.correction.space=this._calculateCorrection(I[n.code],e,D),n;for(var l=0;l<4;l++)e[l]=e[l+2];e[4]=0,e[5]=0,o--}else o++;e[o]=1,a=a?0:1}return null}},{key:"decode",value:function(){var t,e,r=new Array,n=this._findStart(),i=null,a=!1,o=0,s=0,u=new Array,c=new Array,h=!1,l=!0;if(null===n)return null;switch(i={code:n.code,start:n.start,end:n.end,correction:{bar:n.correction.bar,space:n.correction.space}},c.push(i),s=i.code,i.code){case 103:t=101;break;case 104:t=100;break;case 105:t=99;break;default:return null}for(;!a;){if(e=h,h=!1,null!==(i=this._decodeCode(i.end,i.correction)))switch(106!==i.code&&(l=!0),106!==i.code&&(u.push(i.code),s+=++o*i.code),c.push(i),t){case 101:if(i.code<64)r.push(String.fromCharCode(32+i.code));else if(i.code<96)r.push(String.fromCharCode(i.code-64));else switch(106!==i.code&&(l=!1),i.code){case 98:h=!0,t=100;break;case 100:t=100;break;case 99:t=99;break;case 106:a=!0}break;case 100:if(i.code<96)r.push(String.fromCharCode(32+i.code));else switch(106!==i.code&&(l=!1),i.code){case 98:h=!0,t=101;break;case 101:t=101;break;case 99:t=99;break;case 106:a=!0}break;case 99:if(i.code<100)r.push(i.code<10?"0"+i.code:i.code);else switch(106!==i.code&&(l=!1),i.code){case 101:t=101;break;case 100:t=100;break;case 106:a=!0}}else a=!0;e&&(t=101===t?100:101)}return null===i?null:(i.end=this._nextUnset(this._row,i.end),this._verifyTrailingWhitespace(i)?(s-=o*u[u.length-1])%103!==u[u.length-1]?null:r.length?(l&&r.splice(r.length-1,1),{code:r.join(""),start:n.start,end:i.end,codeset:t,startInfo:n,decodedCodes:c,endInfo:i}):null:null)}},{key:"_verifyTrailingWhitespace",value:function(t){var e=t.end+(t.end-t.start)/2;return e<this._row.length&&this._matchRange(t.end,e,0)?t:null}},{key:"_calculateCorrection",value:function(t,e,r){for(var n=0,i=0,a=r.length;a--;)i+=t[r[a]],n+=e[r[a]];return i/n}}]),e}(R),j=new Uint16Array(k()("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. *$/+%").map(function(t){return t.charCodeAt(0)})),T=new Uint16Array([52,289,97,352,49,304,112,37,292,100,265,73,328,25,280,88,13,268,76,28,259,67,322,19,274,82,7,262,70,22,385,193,448,145,400,208,133,388,196,148,168,162,138,42]),L=function(t){function e(){var t;return a()(this,e),(t=E()(this,A()(e).call(this)))._format="code_39",t}return P()(e,t),s()(e,[{key:"decode",value:function(){var t=this._findStart();if(!t)return null;var e,r,n=new Array,i=new Uint16Array(9),a=this._nextSet(this._row,t.end);do{this._toCounters(a,i);var o=this._toPattern(i);if(o<0)return null;if(null===(e=this._patternToChar(o)))return null;n.push(e),r=a,a+=i.reduce(function(t,e){return t+e},0),a=this._nextSet(this._row,a)}while("*"!==e);return n.pop(),n.length&&this._verifyTrailingWhitespace(r,a,i)?{code:n.join(""),start:t.start,end:a,startInfo:t,decodedCodes:n}:null}},{key:"_patternToChar",value:function(t){for(var e=0;e<T.length;e++)if(T[e]===t)return String.fromCharCode(j[e]);return null}},{key:"_verifyTrailingWhitespace",value:function(t,e,r){var n=r.reduce(function(t,e){return t+e},0);return 3*(e-t-n)>=n}},{key:"_findNextWidth",value:function(t,e){for(var r=Number.MAX_VALUE,n=0;n<t.length;n++)t[n]<r&&t[n]>e&&(r=t[n]);return r}},{key:"_toPattern",value:function(t){for(var e,r=t.length,n=0,i=r,a=0;i>3;){n=this._findNextWidth(t,n),i=0,e=0;for(var o=0;o<r;o++)t[o]>n&&(e|=1<<r-1-o,i++,a+=t[o]);if(3===i){for(var s=0;s<r&&i>0;s++)if(t[s]>n&&(i--,2*t[s]>=a))return-1;return e}}return-1}},{key:"_findStart",value:function(){for(var t,e=this._nextSet(this._row),r=e,n=new Uint16Array(9),i=0,a=0,o=e;o<this._row.length;o++)if(this._row[o]^a)n[i]++;else{if(i===n.length-1){if(148===this._toPattern(n)&&(t=0|Math.max(0,r-(o-r)/4),this._matchRange(t,r,0)))return{start:r,end:o};r+=n[0]+n[1];for(var s=0;s<7;s++)n[s]=n[s+2];n[7]=0,n[8]=0,i--}else i++;n[i]=1,a=a?0:1}return null}}]),e}(R),M=n(8),U=n.n(M),G=function(t){function e(){var t;return a()(this,e),(t=E()(this,A()(e).call(this)))._format="code_39_vin",t}return P()(e,t),s()(e,[{key:"decode",value:function(){var t=U()(A()(e.prototype),"decode",this).call(this);if(!t)return null;var r=t.code;return r?(r=r.replace(/[IOQ]/g,""),/[A-Z0-9]{17}/.test(r)&&this._checkChecksum(r)?(t.code=r,t):null):null}},{key:"_checkChecksum",value:function(t){return!!t}}]),e}(L),N=n(6),H=n.n(N),B=k()("0123456789-$:/.+ABCD").map(function(t){return t.charCodeAt(0)}),F=[3,6,9,96,18,66,33,36,48,72,12,24,69,81,84,21,26,41,11,14],V=[26,41,11,14],q=function(t){function e(){var t;return a()(this,e),t=E()(this,A()(e).call(this)),c()(H()(t),"_counters",void 0),t._format="codabar",t._counters=[],t}return P()(e,t),s()(e,[{key:"decode",value:function(){this._counters=this._fillCounters(this._nextUnset(this._row),this._row.length,1);var t=this._findStart();if(!t)return null;var e,r=new Array,n=t.startCounter;do{if((e=this._toPattern(n))<0)return null;var i=this._patternToChar(e);if(null===i)return null;if(r.push(i),n+=8,r.length>1&&V.some(function(t){return t===e}))break}while(n<this._counters.length);if(r.length-2<4||!V.some(function(t){return t===e}))return null;if(!this._verifyWhitespace(t.startCounter,n-8))return null;if(!this._validateResult(r,t.startCounter))return null;n=n>this._counters.length?this._counters.length:n;var a=t.start+this._sumCounters(t.startCounter,n-8);return{code:r.join(""),start:t.start,end:a,startInfo:t,decodedCodes:r}}},{key:"_verifyWhitespace",value:function(t,e){return(t-1<=0||this._counters[t-1]>=this._calculatePatternLength(t)/2)&&(e+8>=this._counters.length||this._counters[e+7]>=this._calculatePatternLength(e)/2)}},{key:"_calculatePatternLength",value:function(t){for(var e=0,r=t;r<t+7;r++)e+=this._counters[r];return e}},{key:"_thresholdResultPattern",value:function(t,e){for(var r={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}}},n=e,i=0;i<t.length;i++){for(var a=this._charToPattern(t[i]),o=6;o>=0;o--){var s=2==(1&o)?r.bar:r.space,u=1==(1&a)?s.wide:s.narrow;u.size+=this._counters[n+o],u.counts++,a>>=1}n+=8}return["space","bar"].forEach(function(t){var e=r[t];e.wide.min=Math.floor((e.narrow.size/e.narrow.counts+e.wide.size/e.wide.counts)/2),e.narrow.max=Math.ceil(e.wide.min),e.wide.max=Math.ceil((2*e.wide.size+1.5)/e.wide.counts)}),r}},{key:"_charToPattern",value:function(t){for(var e=t.charCodeAt(0),r=0;r<B.length;r++)if(B[r]===e)return F[r];return 0}},{key:"_validateResult",value:function(t,e){for(var r=this._thresholdResultPattern(t,e),n=e,i=0;i<t.length;i++){for(var a=this._charToPattern(t[i]),o=6;o>=0;o--){var s=0==(1&o)?r.bar:r.space,u=1==(1&a)?s.wide:s.narrow,c=this._counters[n+o];if(c<u.min||c>u.max)return!1;a>>=1}n+=8}return!0}},{key:"_patternToChar",value:function(t){for(var e=0;e<F.length;e++)if(F[e]===t)return String.fromCharCode(B[e]);return null}},{key:"_computeAlternatingThreshold",value:function(t,e){for(var r=Number.MAX_VALUE,n=0,i=t;i<e;i+=2){var a=this._counters[i];a>n&&(n=a),a<r&&(r=a)}return(r+n)/2|0}},{key:"_toPattern",value:function(t){var e=t+7;if(e>this._counters.length)return-1;for(var r=this._computeAlternatingThreshold(t,e),n=this._computeAlternatingThreshold(t+1,e),i=64,a=0,o=0;o<7;o++){var s=0==(1&o)?r:n;this._counters[t+o]>s&&(a|=i),i>>=1}return a}},{key:"_sumCounters",value:function(t,e){for(var r=0,n=t;n<e;n++)r+=this._counters[n];return r}},{key:"_findStart",value:function(){for(var t=this,e=this._nextUnset(this._row),r=function(r){var n=t._toPattern(r);if(-1!==n&&V.some(function(t){return t===n})){var i=(e+=t._sumCounters(0,r))+t._sumCounters(r,r+8);return{v:{start:e,end:i,startCounter:r,endCounter:r+8}}}},n=1;n<this._counters.length;n++){var i=r(n);if("object"===y()(i))return i.v}return null}}]),e}(R);function X(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}var Q,Z=[1,1,2],Y=[[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]],K=[0,11,13,14,19,25,28,21,22,26],J=function(t){function e(t,r){var n;return a()(this,e),(n=E()(this,A()(e).call(this,m({supplements:[]},t),r)))._format="ean_13",n._singleCodeError=.7,n._averageCodeError=.48,n}return P()(e,t),s()(e,[{key:"CODE_L_START",get:function(){return 0}},{key:"CODE_G_START",get:function(){return 10}},{key:"START_PATTERN",get:function(){return[1,1,1]}},{key:"STOP_PATTERN",get:function(){return[1,1,1]}},{key:"MIDDLE_PATTERN",get:function(){return[1,1,1,1,1]}}]),s()(e,[{key:"_decodeCode",value:function(t,e){var r=[0,0,0,0],n=t,i={error:Number.MAX_VALUE,code:-1,start:t,end:t},a=this.AVERAGE_CODE_ERROR,o=this._row[n]?0:1,s=0;e||(e=Y.length);for(var u=n;u<this._row.length;u++)if(this._row[u]^o)r[s]++;else{if(s===r.length-1){for(var c=0;c<e;c++){var h=this._matchPattern(r,Y[c]);h<i.error&&(i.code=c,i.error=h)}return i.end=u,i.error>a?null:i}r[++s]=1,o=o?0:1}return null}},{key:"_findStart",value:function(){for(var t,e=this._nextSet(this._row);!t;){if(!(t=this._findPattern(this.START_PATTERN,e,0,!0)))return null;var r=t.start-(t.end-t.start);if(r>=0&&this._matchRange(r,t.start,0))return t;e=t.end,t=null}return null}},{key:"_verifyTrailingWhitespace",value:function(t){var e=t.end+(t.end-t.start);return e<this._row.length&&this._matchRange(t.end,e,0)?t:null}},{key:"_findEnd",value:function(t,e){var r=this._findPattern(this.STOP_PATTERN,t,e,!1);return null!==r?this._verifyTrailingWhitespace(r):null}},{key:"_calculateFirstDigit",value:function(t){for(var e=0;e<K.length;e++)if(t===K[e])return e;return null}},{key:"_decodePayload",value:function(t,e,r){for(var n=0,i=0;i<6;i++){if(!(t=this._decodeCode(t.end)))return null;t.code>=this.CODE_G_START?(t.code-=this.CODE_G_START,n|=1<<5-i):n|=0<<5-i,e.push(t.code),r.push(t)}var a=this._calculateFirstDigit(n);if(null===a)return null;if(e.unshift(a),null===(t=this._findPattern(this.MIDDLE_PATTERN,t.end,1,!1)))return null;r.push(t);for(var o=0;o<6;o++){if(!(t=this._decodeCode(t.end,this.CODE_G_START)))return null;r.push(t),e.push(t.code)}return t}},{key:"decode",value:function(){var t=new Array,e=new Array,r={},n=this._findStart();if(!n)return null;var i={code:n.code,start:n.start,end:n.end};if(e.push(i),!(i=this._decodePayload(i,t,e)))return null;if(!(i=this._findEnd(i.end,0)))return null;if(e.push(i),!this._checksum(t))return null;if(this.supplements.length>0){var a=this._decodeExtensions(i.end);if(!a)return null;var o=a.decodedCodes[a.decodedCodes.length-1],s={start:o.start+((o.end-o.start)/2|0),end:o.end};if(!this._verifyTrailingWhitespace(s))return null;r={supplement:a,code:t.join("")+a.code}}return function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?X(r,!0).forEach(function(e){c()(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):X(r).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}({code:t.join(""),start:n.start,end:i.end,startInfo:n,decodedCodes:e},r)}},{key:"_decodeExtensions",value:function(t){var e=this._nextSet(this._row,t),r=this._findPattern(Z,e,0,!1);if(null===r)return null;for(var n=0;n<this.supplements.length;n++){var i=this.supplements[n].decode(this._row,r.end);if(null!==i)return{code:i.code,start:e,startInfo:r,end:i.end,decodedCodes:i.decodedCodes}}return null}},{key:"_checksum",value:function(t){for(var e=0,r=t.length-2;r>=0;r-=2)e+=t[r];e*=3;for(var n=t.length-1;n>=0;n-=2)e+=t[n];return e%10==0}}]),e}(R),$=function(t){function e(t,r){var n;return a()(this,e),(n=E()(this,A()(e).call(this,t,r)))._format="ean_8",n}return P()(e,t),s()(e,[{key:"_decodePayload",value:function(t,e,r){for(var n=0;n<4;n++){if(!(t=this._decodeCode(t.end,this.CODE_G_START)))return null;e.push(t.code),r.push(t)}if(null===(t=this._findPattern(this.MIDDLE_PATTERN,t.end,1,!1)))return null;r.push(t);for(var i=0;i<4;i++){if(!(t=this._decodeCode(t.end,this.CODE_G_START)))return null;r.push(t),e.push(t.code)}return t}}]),e}(J),tt=function(t){function e(t,r){var n;return a()(this,e),(n=E()(this,A()(e).call(this,t,r)))._format="ean_2",n}return P()(e,t),s()(e,[{key:"decode",value:function(t,e){var r,n=t.length,i=new Array,a=new Array,o=e,s=0;this._row=t;for(var u=0;u<2&&o<n;u++){if(!(r=this._decodeCode(o)))return null;a.push(r),i.push(r.code%10),r.code>=this.CODE_G_START&&(s|=1<<1-u),1!==u&&(o=this._nextSet(this._row,r.end),o=this._nextUnset(this._row,o))}return 2!==i.length||parseInt(i.join(""))%4!==s?null:{code:i.join(""),decodedCodes:a,end:r.end}}}]),e}(J),et=function(t){function e(t,r){var n;return a()(this,e),(n=E()(this,A()(e).call(this,t,r)))._format="ean_5",n}return P()(e,t),s()(e,[{key:"CHECK_DIGIT_ENCODINGS",get:function(){return[24,20,18,17,12,6,3,10,9,5]}}]),s()(e,[{key:"decode",value:function(t,e){var r,n=t.length,i=new Array,a=new Array,o=0,s=e;this._row=t;for(var u=0;u<5&&s<n;u++){if(!(r=this._decodeCode(s)))return null;a.push(r),i.push(r.code%10),r.code>=this.CODE_G_START&&(o|=1<<4-u),4!==u&&(s=this._nextSet(this._row,r.end),s=this._nextUnset(this._row,s))}return 5!==i.length?null:this._extensionChecksum(i)!==this._determineCheckDigit(o)?null:{code:i.join(""),decodedCodes:a,end:r.end}}},{key:"_determineCheckDigit",value:function(t){for(var e=0;e<10;e++)if(t===this.CHECK_DIGIT_ENCODINGS[e])return e;return null}},{key:"_extensionChecksum",value:function(t){for(var e=t.length,r=0,n=e-2;n>=0;n-=2)r+=t[n];r*=3;for(var i=e-1;i>=0;i-=2)r+=t[i];return(r*=3)%10}}]),e}(J),rt=function(t){function e(t,r){var n;return a()(this,e),(n=E()(this,A()(e).call(this,t,r)))._format="upc_a",n}return P()(e,t),s()(e,[{key:"decode",value:function(){var t=U()(A()(e.prototype),"decode",this).call(this);return t&&t.code&&13===t.code.length&&"0"===t.code.charAt(0)?(t.code=t.code.substring(1),t):null}}]),e}(J),nt=[[56,52,50,49,44,38,35,42,41,37],[7,11,13,14,19,25,28,21,22,26]],it=function(t){function e(t,r){var n;return a()(this,e),(n=E()(this,A()(e).call(this,t,r)))._format="upc_e",n}return P()(e,t),s()(e,[{key:"STOP_PATTERN",get:function(){return[1/6*7,1/6*7,1/6*7,1/6*7,1/6*7,1/6*7]}}]),s()(e,[{key:"_decodePayload",value:function(t,e,r){for(var n=0,i=0;i<6;i++){if(!(t=this._decodeCode(t.end)))return null;t.code>=this.CODE_G_START&&(t.code=t.code-this.CODE_G_START,n|=1<<5-i),e.push(t.code),r.push(t)}return this._determineParity(n,e)?t:null}},{key:"_determineParity",value:function(t,e){for(var r=0;r<nt.length;r++)for(var n=0;n<nt[r].length;n++)if(t===nt[r][n])return e.unshift(r),e.push(n),!0;return!1}},{key:"_convertToUPCA",value:function(t){var e=t[t.length-2],r=[t[0]];return(r=e<=2?r.concat(t.slice(1,3)).concat([e,0,0,0,0]).concat(t.slice(3,6)):3===e?r.concat(t.slice(1,4)).concat([0,0,0,0,0]).concat(t.slice(4,6)):4===e?r.concat(t.slice(1,5)).concat([0,0,0,0,0,t[5]]):r.concat(t.slice(1,6)).concat([0,0,0,0,e])).push(t[t.length-1]),r}},{key:"_checksum",value:function(t){return U()(A()(e.prototype),"_checksum",this).call(this,this._convertToUPCA(t))}},{key:"_findEnd",value:function(t,r){return 1,U()(A()(e.prototype),"_findEnd",this).call(this,t,1)}},{key:"_verifyTrailingWhitespace",value:function(t){var e=t.end+(t.end-t.start)/2;return e<this._row.length&&this._matchRange(t.end,e,0)?t:null}}]),e}(J),at=[1,1,1,1],ot=[1,1,3],st=[[1,1,3,3,1],[3,1,1,1,3],[1,3,1,1,3],[3,3,1,1,1],[1,1,3,1,3],[3,1,3,1,1],[1,3,3,1,1],[1,1,1,3,3],[3,1,1,3,1],[1,3,1,3,1]],ut=function(t){function e(t){var r;return a()(this,e),r=E()(this,A()(e).call(this,m({normalizeBarSpaceWidth:!1},t))),c()(H()(r),"_barSpaceRatio",void 0),r._barSpaceRatio=[1,1],r._format="i2of5",r.config.normalizeBarSpaceWidth?(r._singleCodeError=.38,r._averageCodeError=.09):(r._singleCodeError=.78,r._averageCodeError=.38),r}return P()(e,t),s()(e,[{key:"decode",value:function(){var t=this._findStart();if(!t)return null;var e=this._findEnd();if(!e)return null;var r=this._fillCounters(t.end,e.start,0);if(r.length%10!=0)return null;var n=new Array,i=new Array;return i.push(t),!this._decodePayload(r,n,i)||n.length%2!=0||n.length<6?null:(i.push(e),{code:n.join(""),start:t.start,end:e.end,startInfo:t,decodedCodes:i})}},{key:"_matchPattern",value:function(t,r){if(this.config.normalizeBarSpaceWidth){for(var n=[0,0],i=[0,0],a=[0,0],o=0;o<t.length;o++)n[o%2]+=t[o],i[o%2]+=r[o];a[0]=i[0]/n[0],a[1]=i[1]/n[1],a[0]=Math.max(Math.min(a[0],5),.2),a[1]=Math.max(Math.min(a[1],5),.2),this._barSpaceRatio=a;for(var s=0;s<t.length;s++)t[s]*=this._barSpaceRatio[s%2]}return U()(A()(e.prototype),"_matchPattern",this).call(this,t,r)}},{key:"_findStart",value:function(){for(var t,e=this._nextSet(this._row);!t;){if(!(t=this._findPattern(at,e,0,!0)))return null;var r=t.end-t.start>>2,n=t.start-10*r;if(n>=0&&this._matchRange(n,t.start,0))return t;e=t.end,t=null}return null}},{key:"_verifyTrailingWhitespace",value:function(t){var e=t.end+(t.end-t.start)/2;return e<this._row.length&&this._matchRange(t.end,e,0)?t:null}},{key:"_findEnd",value:function(){this._row.reverse();var t=this._findPattern(ot,void 0,0,!1);if(this._row.reverse(),null===t)return null;var e=t.start;return t.start=this._row.length-t.end,t.end=this._row.length-e,null!==t?this._verifyTrailingWhitespace(t):null}},{key:"_decodeCode",value:function(t){for(var e={error:Number.MAX_VALUE,code:-1,start:0,end:0},r=0;r<st.length;r++){var n=this._matchPattern(t,st[r]);n<e.error&&(e.code=r,e.error=n)}return e.error<this.AVERAGE_CODE_ERROR?e:null}},{key:"_decodePayload",value:function(t,e,r){for(var n,i,a=t.length,o=[0,0,0,0,0],s=[0,0,0,0,0],u=0;u<a;){for(var c=0;c<5;c++)o[c]=t[u]*this._barSpaceRatio[0],s[c]=t[u+1]*this._barSpaceRatio[1],u+=2;if(!(n=this._decodeCode(o)))return null;if(!(i=this._decodeCode(s)))return null;e.push(n.code,i.code),r.push(n,i)}return[n,i]}}]),e}(R),ct=[3,1,3,1,1,1],ht=[3,1,1,1,3],lt=[[1,1,3,3,1],[3,1,1,1,3],[1,3,1,1,3],[3,3,1,1,1],[1,1,3,1,3],[3,1,3,1,1],[1,3,3,1,1],[1,1,1,3,3],[3,1,1,3,1],[1,3,1,3,1]],ft=ct.reduce(function(t,e){return t+e},0),dt=function(t){function e(t){var r;return a()(this,e),r=E()(this,A()(e).call(this,t)),c()(H()(r),"_barSpaceRatio",void 0),r._barSpaceRatio=[1,1],r._format="2of5",r._singleCodeError=.78,r._averageCodeError=.3,r}return P()(e,t),s()(e,[{key:"decode",value:function(){var t=this._findStart();if(!t)return null;var e=this._findEnd();if(!e)return null;var r=this._fillCounters(t.end,e.start,0);if(r.length%10!=0)return null;var n=new Array,i=new Array;return i.push(t),!this._decodePayload(r,n,i)||n.length<5?null:(i.push(e),{code:n.join(""),start:t.start,end:e.end,startInfo:t,decodedCodes:i})}},{key:"_findStart",value:function(){for(var t,e=this._nextSet(this._row),r=1;!t;){if(!(t=this._findPattern(ct,e,0,!0)))return null;r=(t.end-t.start)/ft|0;var n=t.start-5*r;if(n>=0&&this._matchRange(n,t.start,0))return t;e=t.end,t=null}return null}},{key:"_verifyTrailingWhitespace",value:function(t){var e=t.end+(t.end-t.start)/2;return e<this._row.length&&this._matchRange(t.end,e,0)?t:null}},{key:"_findEnd",value:function(){this._row.reverse();var t=this._nextSet(this._row),e=this._findPattern(ht,t,0,!0);if(this._row.reverse(),null===e)return null;var r=e.start;return e.start=this._row.length-e.end,e.end=this._row.length-r,null!==e?this._verifyTrailingWhitespace(e):null}},{key:"_decodeCode",value:function(t){for(var e={error:Number.MAX_VALUE,code:-1,start:0,end:0},r=0;r<lt.length;r++){var n=this._matchPattern(t,lt[r]);n<e.error&&(e.code=r,e.error=n)}return e.error<this.AVERAGE_CODE_ERROR?e:null}},{key:"_decodePayload",value:function(t,e,r){for(var n,i=t.length,a=[0,0,0,0,0],o=0;o<i;){for(var s=0;s<5;s++)a[s]=t[o]*this._barSpaceRatio[0],o+=2;if(!(n=this._decodeCode(a)))return null;e.push(n.code),r.push(n)}return n}}]),e}(R),vt=new Uint16Array(k()("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%abcd*").map(function(t){return t.charCodeAt(0)})),_t=new Uint16Array([276,328,324,322,296,292,290,336,274,266,424,420,418,404,402,394,360,356,354,308,282,344,332,326,300,278,436,434,428,422,406,410,364,358,310,314,302,468,466,458,366,374,430,294,474,470,306,350]),pt={code_128_reader:W,ean_reader:J,ean_5_reader:et,ean_2_reader:tt,ean_8_reader:$,code_39_reader:L,code_39_vin_reader:G,codabar_reader:q,upc_reader:rt,upc_e_reader:it,i2of5_reader:ut,"2of5_reader":dt,code_93_reader:function(t){function e(){var t;return a()(this,e),(t=E()(this,A()(e).call(this)))._format="code_93",t}return P()(e,t),s()(e,[{key:"decode",value:function(){var t=this._findStart();if(!t)return null;var e,r,n=new Array,i=new Uint16Array(6),a=this._nextSet(this._row,t.end);do{this._toCounters(a,i);var o=this._toPattern(i);if(o<0)return null;if(null===(e=this._patternToChar(o)))return null;n.push(e),r=a,a+=i.reduce(function(t,e){return t+e},0),a=this._nextSet(this._row,a)}while("*"!==e);return n.pop(),n.length&&this._verifyEnd(r,a)&&this._verifyChecksums(n)?(n=n.slice(0,n.length-2),null===(n=this._decodeExtended(n))?null:{code:n.join(""),start:t.start,end:a,startInfo:t,decodedCodes:n}):null}},{key:"_patternToChar",value:function(t){for(var e=0;e<_t.length;e++)if(_t[e]===t)return String.fromCharCode(vt[e]);return null}},{key:"_verifyEnd",value:function(t,e){return!(t===e||!this._row[e])}},{key:"_toPattern",value:function(t){for(var e=t.length,r=0,n=0,i=0;i<e;i++)n+=t[i];for(var a=0;a<e;a++){var o=Math.round(9*t[a]/n);if(o<1||o>4)return-1;if(0==(1&a))for(var s=0;s<o;s++)r=r<<1|1;else r<<=o}return r}},{key:"_findStart",value:function(){for(var t,e=new Uint16Array(6),r=this._nextSet(this._row),n=r,i=0,a=0,o=r;o<this._row.length;o++)if(this._row[o]^a)e[i]++;else{if(i===e.length-1){if(350===this._toPattern(e)&&(t=0|Math.max(0,n-(o-n)/4),this._matchRange(t,n,0)))return{start:n,end:o};n+=e[0]+e[1];for(var s=0;s<4;s++)e[s]=e[s+2];e[4]=0,e[5]=0,i--}else i++;e[i]=1,a=a?0:1}return null}},{key:"_decodeExtended",value:function(t){for(var e=t.length,r=new Array,n=0;n<e;n++){var i=t[n];if(i>="a"&&i<="d"){if(n>e-2)return null;var a=t[++n],o=a.charCodeAt(0),s=void 0;switch(i){case"a":if(!(a>="A"&&a<="Z"))return null;s=String.fromCharCode(o-64);break;case"b":if(a>="A"&&a<="E")s=String.fromCharCode(o-38);else if(a>="F"&&a<="J")s=String.fromCharCode(o-11);else if(a>="K"&&a<="O")s=String.fromCharCode(o+16);else if(a>="P"&&a<="S")s=String.fromCharCode(o+43);else{if(!(a>="T"&&a<="Z"))return null;s=String.fromCharCode(127)}break;case"c":if(a>="A"&&a<="O")s=String.fromCharCode(o-32);else{if("Z"!==a)return null;s=":"}break;case"d":if(!(a>="A"&&a<="Z"))return null;s=String.fromCharCode(o+32)}r.push(s)}else r.push(i)}return r}},{key:"_verifyChecksums",value:function(t){return this._matchCheckChar(t,t.length-2,20)&&this._matchCheckChar(t,t.length-1,15)}},{key:"_matchCheckChar",value:function(t,e,r){var n=t.slice(0,e),i=n.length,a=n.reduce(function(t,e,n){return t+((-1*n+(i-1))%r+1)*vt.indexOf(e.charCodeAt(0))},0);return vt[a%47]===t[e].charCodeAt(0)}}]),e}(R)};function gt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}!function(t){t[t.Up=1]="Up",t[t.Down=-1]="Down"}(Q||(Q={}));var yt,mt=function(t,e,r){var n,i,a=0|e.x,o=0|e.y,s=0|r.x,u=0|r.y,c=Math.abs(u-o)>Math.abs(s-a),h=[],l=t.data,f=t.size.x,d=255,v=0;function _(t,e){i=l[e*f+t],d=i<d?i:d,v=i>v?i:v,h.push(i)}c&&(n=a,a=o,o=n,n=s,s=u,u=n),a>s&&(n=a,a=s,s=n,n=o,o=u,u=n);for(var p=s-a,g=Math.abs(u-o),y=p/2|0,m=o,b=o<u?1:-1,w=a;w<s;w++)c?_(m,w):_(w,m),(y-=g)<0&&(m+=b,y+=p);return{line:h,min:d,max:v}},bt=function(t){var e=t.min,r=t.max,n=t.line,i=e+(r-e)/2,a=new Array,o=(r-e)/12,s=-o,u=n[0]>i?Q.Up:Q.Down;a.push({pos:0,val:n[0]});for(var h=0;h<n.length-2;h++){var l=n[h+1]-n[h],f=n[h+2]-n[h+1],d=void 0;u!==(d=l+f<s&&n[h+1]<1.5*i?Q.Down:l+f>o&&n[h+1]>.5*i?Q.Up:u)&&(a.push({pos:h,val:n[h]}),u=d)}a.push({pos:n.length,val:n[n.length-1]});for(var v=a[0].pos;v<a[1].pos;v++)n[v]=n[v]>i?0:1;for(var _=1;_<a.length-1;_++){o=a[_+1].val>a[_].val?a[_].val+(a[_+1].val-a[_].val)/3*2|0:a[_+1].val+(a[_].val-a[_+1].val)/3|0;for(var p=a[_].pos;p<a[_+1].pos;p++)n[p]=n[p]>o?0:1}return function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?gt(r,!0).forEach(function(e){c()(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):gt(r).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}({},t,{threshold:o})},wt=function(){function t(e,r){a()(this,t),c()(this,"_config",void 0),c()(this,"_inputImageWrapper",void 0),c()(this,"_frequencyCanvas",void 0),c()(this,"_patternCanvas",void 0),c()(this,"_overlayContext",void 0),c()(this,"_barcodeReaders",void 0),this._config=e,this._inputImageWrapper=r,this._barcodeReaders=[],this._initReaders()}return s()(t,[{key:"decodeFromBoundingBoxes",value:function(t){var e=this,r=null;if(t){if(this._config.multiple)return{barcodes:t.map(function(t){return e.decodeFromBoundingBox(t)}),boxes:t};t.some(function(t){return!!(r=e.decodeFromBoundingBox(t))})&&(r.boxes=t)}return r}},{key:"decodeFromBoundingBox",value:function(t){var e=this._getLine(t);if(null===e)return null;var r=Math.atan2(e[1].y-e[0].y,e[1].x-e[0].x);e=this._getExtendedLine(e,r);var n=this._tryDecode(e);return null===n&&(n=this._tryDecodeBruteForce(t,e,r)),null===n?null:{angle:r,box:t,codeResult:n.codeResult,line:e,pattern:n.barcodeLine.line,threshold:n.barcodeLine.threshold}}},{key:"setReaders",value:function(t){this._config.readers=t,this._barcodeReaders.length=0,this._initReaders()}},{key:"_initReaders",value:function(){var t=this;this._config.readers.forEach(function(e){var r,n={},i=[];"object"===y()(e)?(r=e.format,n=e.config||{}):"string"==typeof e&&(r=e),n.supplements&&(i=n.supplements.map(function(t){return new pt[t]})),t._barcodeReaders.push(new pt[r](n,i))})}},{key:"_getExtendedLine",value:function(t,e){function r(r){var n=r*Math.sin(e),i=r*Math.cos(e);t[0].y-=n,t[0].x-=i,t[1].y+=n,t[1].x+=i}var n=.1*Math.sqrt(Math.pow(t[1].y-t[0].y,2)+Math.pow(t[1].x-t[0].x,2))|0;for(r(n);n>1&&(!this._inputImageWrapper.inImageWithBorder(t[0],0)||!this._inputImageWrapper.inImageWithBorder(t[1],0));)r(-(n>>=1));return t}},{key:"_getLine",value:function(t){return[{x:(t[1].x+t[0].x)/2,y:(t[1].y+t[0].y)/2},{x:(t[3].x+t[2].x)/2,y:(t[3].y+t[2].y)/2}]}},{key:"_tryDecode",value:function(t){var e=mt(this._inputImageWrapper,t[0],t[1]);e=bt(e);var r=null;return this._barcodeReaders.some(function(t){return!!(r=t.decodePattern(e.line))}),r?{codeResult:r,barcodeLine:e}:null}},{key:"_tryDecodeBruteForce",value:function(t,e,r){for(var n=Math.sqrt(Math.pow(t[1].x-t[0].x,2)+Math.pow(t[1].y-t[0].y,2)),i=Math.sin(r),a=Math.cos(r),o=1;o<16;o++){var s=n/16*o*(o%2==0?-1:1);e[0].y+=s*i,e[0].x-=s*a,e[1].y+=s*i,e[1].x-=s*a;var u=this._tryDecode(e);if(u)return u}return null}},{key:"_printFrequency",value:function(t){var e=this._frequencyCanvas.getContext("2d");this._frequencyCanvas.width=t.length,this._frequencyCanvas.height=256,e.beginPath(),e.strokeStyle="blue";for(var r=0;r<t.length;r++)e.moveTo(r,255),e.lineTo(r,255-t[r]);e.closePath(),e.stroke()}},{key:"_printPattern",value:function(t){var e=this._patternCanvas.getContext("2d");this._patternCanvas.width=t.length,e.fillStyle="black";for(var r=0;r<t.length;r++)1===t[r]&&e.fillRect(r,0,1,100)}},{key:"_drawPath",value:function(t,e,r){h.a.drawPath(t,this._overlayContext,e,r)}}]),t}(),xt=n(7),kt=n.n(xt),Ct=n(10),Et=n.n(Ct);var St,At,Ot={request:(At=Et()(kt.a.mark(function t(e,r){var n;return kt.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=Ot.pickConstraints(r),t.next=3,i=n,navigator.mediaDevices&&"function"==typeof navigator.mediaDevices.getUserMedia?navigator.mediaDevices.getUserMedia(i):Promise.reject(new Error("getUserMedia is not defined"));case 3:return yt=t.sent,e.srcObject=yt,e.setAttribute("autoplay",""),e.setAttribute("muted",""),e.setAttribute("playsinline",""),t.abrupt("return",new Promise(function(t){return e.addEventListener("loadedmetadata",function(){e.play(),t()})}).then(Pt.bind(null,e)));case 9:case"end":return t.stop()}var i},t)})),function(t,e){return At.apply(this,arguments)}),release:function(){var t=yt&&yt.getVideoTracks();t&&t.length&&t[0].stop(),yt=null},enumerateVideoDevices:(St=Et()(kt.a.mark(function t(){var e;return kt.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,navigator.mediaDevices&&"function"==typeof navigator.mediaDevices.enumerateDevices?navigator.mediaDevices.enumerateDevices():Promise.reject(new Error("enumerateDevices is not defined"));case 2:return e=t.sent,t.abrupt("return",e.filter(function(t){return"videoinput"===t.kind}));case 4:case"end":return t.stop()}},t)})),function(){return St.apply(this,arguments)}),getActiveStreamLabel:function(){var t=Ot.getActiveTrack();return t?t.label:""},getActiveTrack:function(){var t=yt&&yt.getVideoTracks();return t&&t.length?t[0]:null},pickConstraints:function(t){var e=t.width,r=t.height,n=t.facingMode,i=t.aspectRatio,a=t.deviceId,o=t,s=o.minAspectRatio,u=o.facing;return void 0!==s&&s>0&&(i=s,console.log("WARNING: Constraint 'minAspectRatio' is deprecated; Use 'aspectRatio' instead")),void 0!==u&&(n=u,console.log("WARNING: Constraint 'facing' is deprecated. Use 'facingMode' instead'")),{audio:!1,video:a&&n?{width:e,height:r,aspectRatio:i,deviceId:a}:{width:e,height:r,facingMode:n,aspectRatio:i,deviceId:a}}}};function Pt(t){var e=t.videoWidth,r=t.videoHeight;return new Promise(function(t,n){var i=10;!function a(){i>0?e>10&&r>10?t():window.setTimeout(a,500):n("Unable to play video stream. Is webcam working?"),i--}()})}var Rt=Math.PI/2,It=function(){function t(e,r){a()(this,t),c()(this,"_inputStream",void 0),c()(this,"_streamConfig",void 0),c()(this,"_canvas",void 0),c()(this,"_context",void 0),c()(this,"_data",void 0),c()(this,"_canvasHeight",void 0),c()(this,"_canvasWidth",void 0),c()(this,"_height",void 0),c()(this,"_width",void 0),c()(this,"_topLeft",void 0),this._inputStream=e,this._streamConfig=e.config,this._canvasWidth=e.canvasWidth,this._canvasHeight=e.canvasHeight,this._width=e.width,this._height=e.height,this._topLeft=e.topLeft,this._canvas=r||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)}return s()(t,[{key:"grab",value:function(t){this._data=t;var e=this._inputStream.getFrame();if(e){var r;this._adjustCanvasSize();var n=0;if(e instanceof HTMLVideoElement)r=e;else if(r=e.image,e.tags)switch(e.tags.orientation){case 6:n=Rt;break;case 8:n=-Rt}if(0!==n){var i=this._canvasWidth>>1,a=this._canvasHeight>>1;this._context.translate(i,a),this._context.rotate(n),this._context.drawImage(r,-a,-i,this._canvasHeight,this._canvasWidth),this._context.rotate(-n),this._context.translate(-i,-a)}else this._context.drawImage(r,0,0,this._canvasWidth,this._canvasHeight);var o=this._context.getImageData(this._topLeft.x,this._topLeft.y,this._width,this._height).data;return this._streamConfig.halfSample?this._grayAndHalfSampleFromCanvasData(o):this._computeGray(o),!0}return!1}},{key:"_adjustCanvasSize",value:function(){this._canvas.height===this._canvasHeight&&this._canvas.width===this._canvasWidth||(this._canvas.height=this._canvasHeight,this._canvas.width=this._canvasWidth)}},{key:"_grayAndHalfSampleFromCanvasData",value:function(t){for(var e=t.length>>2,r=this._width>>1,n=0,i=this._width,a=0;i<e;){for(var o=0;o<r;o++){var s=n<<2,u=i<<2;this._data[a]=(.299*t[s+0]+.587*t[s+1]+.114*t[s+2]+(.299*t[s+4]+.587*t[s+5]+.114*t[s+6])+(.299*t[u+0]+.587*t[u+1]+.114*t[u+2])+(.299*t[u+4]+.587*t[u+5]+.114*t[u+6]))/4|0,a++,n+=2,i+=2}n+=this._width,i+=this._width}}},{key:"_computeGray",value:function(t){var e=t.length;if(this._streamConfig&&this._streamConfig.singleChannel)for(var r=0,n=0;r<e;r+=4,n++)this._data[n]=t[r];else for(var i=0,a=0;i<e;i+=4,a++)this._data[a]=.299*t[i]+.587*t[i+1]+.114*t[i+2]|0}}]),t}(),zt={274:"orientation"},Dt=Object.keys(zt).map(function(t){return zt[t]});function Wt(t){return jt.apply(this,arguments)}function jt(){return(jt=Et()(kt.a.mark(function t(e){var r,n,i=arguments;return kt.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(r=i.length>1&&void 0!==i[1]?i[1]:Dt,!/^blob:/i.test(e)){t.next=6;break}return t.next=4,Lt(e);case 4:return n=t.sent,t.abrupt("return",Tt(n,r));case 6:return t.abrupt("return",Promise.resolve(null));case 7:case"end":return t.stop()}},t)}))).apply(this,arguments)}function Tt(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Dt,r=new DataView(t),n=t.byteLength,i=e.reduce(function(t,e){var r=Object.keys(zt).find(function(t){return zt[t]===e});return r&&(t[r]=e),t},{}),a=2;if(255!==r.getUint8(0)||216!==r.getUint8(1))return null;for(;a<n;){if(255!==r.getUint8(a))return null;if(225===r.getUint8(a+1))return Ut(r,a+4,i);a+=2+r.getUint16(a+2)}return null}function Lt(t){return Mt.apply(this,arguments)}function Mt(){return(Mt=Et()(kt.a.mark(function t(e){var r;return kt.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch(e);case 2:if(!(r=t.sent).ok){t.next=5;break}return t.abrupt("return",r.arrayBuffer());case 5:throw new Error("HTTP Error "+r.status);case 6:case"end":return t.stop()}},t)}))).apply(this,arguments)}function Ut(t,e,r){if("Exif".split("").some(function(r,n){return t.getUint8(e+n)!==r.charCodeAt(0)}))return null;var n,i=e+6;if(18761===t.getUint16(i))n=!1;else{if(19789!==t.getUint16(i))return null;n=!0}if(42!==t.getUint16(i+2,!n))return null;var a=t.getUint32(i+4,!n);return a<8?null:function(t,e,r,n){for(var i=t.getUint16(e,!n),a={},o=0;o<i;o++){var s=e+12*o+2,u=r[t.getUint16(s,!n)];u&&(a[u]=Gt(t,s,n))}return a}(t,i+a,r,n)}function Gt(t,e,r){var n=t.getUint16(e+2,!r),i=t.getUint32(e+4,!r);return 3===n&&1===i?t.getUint16(e+8,!r):void 0}var Nt=function(){function t(){a()(this,t)}var e;return s()(t,null,[{key:"load",value:(e=Et()(kt.a.mark(function t(e,r,n,i,a){var o,s,u,c,h,l;return kt.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(l=function(){return(l=Et()(kt.a.mark(function t(n){var i,c,h,l;return kt.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:i=0;case 1:if(!(i<u.length)){t.next=17;break}if(u[i]!==n){t.next=14;break}u.splice(i,1),c=0;case 5:if(!(c<o.length)){t.next=13;break}if(h=o[c].substr(o[c].lastIndexOf("/")),-1===n.src.lastIndexOf(h)){t.next=10;break}return s[c]={image:n},t.abrupt("break",13);case 10:c++,t.next=5;break;case 13:return t.abrupt("break",17);case 14:i++,t.next=1;break;case 17:if(0!==u.length){t.next=33;break}if(t.prev=19,!1!==a){t.next=25;break}return l=s[0],t.next=24,Wt(e);case 24:l.tags=t.sent;case 25:t.next=30;break;case 27:t.prev=27,t.t0=t.catch(19),console.log(t.t0);case 30:return t.prev=30,r(s),t.finish(30);case 33:case"end":return t.stop()}},t,null,[[19,27,30,33]])}))).apply(this,arguments)},h=function(t){return l.apply(this,arguments)},o=new Array(i),s=new Array(i),u=new Array,!1===a)o[0]=e;else for(c=0;c<i;c++)o[c]="".concat(e,"image-").concat(("00"+(n+c)).slice(-3),".jpg");o.forEach(function(t){var e=new Image;u.push(e),e.onload=function(){return h(e)},e.src=t});case 7:case"end":return t.stop()}},t)})),function(t,r,n,i,a){return e.apply(this,arguments)})}]),t}();function Ht(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}var Bt=function(){function t(){a()(this,t),c()(this,"_calculatedHeight",void 0),c()(this,"_calculatedWidth",void 0),c()(this,"_canvasHeight",void 0),c()(this,"_canvasWidth",void 0),c()(this,"_config",void 0),c()(this,"_eventNames",void 0),c()(this,"_eventHandlers",void 0),c()(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}}return s()(t,[{key:"setCanvasSize",value:function(t,e){this._canvasWidth=t,this._canvasHeight=e}},{key:"addEventListener",value:function(t,e,r){-1!==this._eventNames.indexOf(t)&&(this._eventHandlers.has(t)||this._eventHandlers.set(t,new Array),this._eventHandlers.get(t).push(e))}},{key:"clearEventHandlers",value:function(){this._eventHandlers.clear()}},{key:"trigger",value:function(t,e){var r=this,n=this._eventHandlers.get(t);n&&n.forEach(function(t){return t.apply(r,e)})}},{key:"height",get:function(){return this._calculatedHeight},set:function(t){this._calculatedHeight=t}},{key:"width",get:function(){return this._calculatedWidth},set:function(t){this._calculatedWidth=t}},{key:"topLeft",get:function(){return function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Ht(r,!0).forEach(function(e){c()(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ht(r).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}({},this._topLeft)},set:function(t){this._topLeft.x=t.x,this._topLeft.y=t.y}},{key:"canvasHeight",get:function(){return this._canvasHeight}},{key:"canvasWidth",get:function(){return this._canvasWidth}}]),t}();function Ft(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}var Vt=function(t){function e(){var t;return a()(this,e),t=E()(this,A()(e).call(this)),c()(H()(t),"_baseUrl",void 0),c()(H()(t),"_ended",void 0),c()(H()(t),"_frameIndex",void 0),c()(H()(t),"_height",void 0),c()(H()(t),"_images",void 0),c()(H()(t),"_loaded",void 0),c()(H()(t),"_offset",void 0),c()(H()(t),"_paused",void 0),c()(H()(t),"_size",void 0),c()(H()(t),"_width",void 0),t._canvasHeight=0,t._canvasWidth=0,t._baseUrl=null,t._ended=!1,t._frameIndex=0,t._height=0,t._images=null,t._loaded=!1,t._offset=1,t._paused=!0,t._size=0,t._width=0,t}return P()(e,t),s()(e,[{key:"setAttribute",value:function(){}},{key:"pause",value:function(){this._paused=!0}},{key:"play",value:function(){this._paused=!1}},{key:"getFrame",value:function(){var t=this,e=null;return this._loaded&&!this._paused&&(e=this._images[this._frameIndex],this._frameIndex<this._size-1?this._frameIndex++:setTimeout(function(){t._ended=!0,t.trigger("ended",[])},0)),e}},{key:"_loadImages",value:function(){var t=this;this._loaded=!1,Nt.load(this._baseUrl,function(e){switch(t._images=e,e[0].tags&&e[0].tags.orientation){case 6:case 8:t._width=e[0].image.height,t._height=e[0].image.width;break;default:t._width=e[0].image.width,t._height=e[0].image.height}t._canvasWidth=t._calculatedWidth=t._config.size?t._width>t._height?t._config.size:t._width*t._config.size/t._height|0:t._width,t._canvasHeight=t._calculatedHeight=t._config.size?t._width>t._height?t._height*t._config.size/t._width|0:t._config.size:t._height,t._loaded=!0,t._frameIndex=0,setTimeout(function(){return t.trigger("canrecord",[])},0)},this._offset,this._size,this._config.sequence)}},{key:"realHeight",get:function(){return this._height}},{key:"realWidth",get:function(){return this._width}},{key:"config",get:function(){return this._config},set:function(t){this._config=function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Ft(r,!0).forEach(function(e){c()(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ft(r).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}({},t),this._baseUrl=t.src,this._size=t.sequence&&t.length?t.length:1,this._loadImages()}},{key:"ended",get:function(){return this._ended}},{key:"currentTime",set:function(t){this._frameIndex=t}}]),e}(Bt);function qt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}var Xt,Qt,Zt,Yt,Kt,Jt,$t,te,ee,re,ne=function(t){function e(t){var r;return a()(this,e),r=E()(this,A()(e).call(this)),c()(H()(r),"_video",void 0),r._video=t,r}return P()(e,t),s()(e,[{key:"setAttribute",value:function(t,e){this._video.setAttribute(t,e)}},{key:"pause",value:function(){this._video.pause()}},{key:"play",value:function(){this._video.play()}},{key:"addEventListener",value:function(t,r,n){U()(A()(e.prototype),"addEventListener",this).call(this,t,r,n),-1===this._eventNames.indexOf(t)&&this._video.addEventListener(t,r,n)}},{key:"clearEventHandlers",value:function(){U()(A()(e.prototype),"clearEventHandlers",this).call(this)}},{key:"trigger",value:function(t,r){"canrecord"===t&&this._initSize(),U()(A()(e.prototype),"trigger",this).call(this,t,r)}},{key:"getFrame",value:function(){return this._video}},{key:"_initSize",value:function(){var t=this._video.videoWidth,e=this._video.videoHeight;this._canvasWidth=this._calculatedWidth=this._config.size?t>e?this._config.size:t*this._config.size/e|0:t,this._canvasHeight=this._calculatedHeight=this._config.size?t>e?e*this._config.size/t|0:this._config.size:e}},{key:"realHeight",get:function(){return this._video.videoHeight}},{key:"realWidth",get:function(){return this._video.videoWidth}},{key:"config",get:function(){return this._config},set:function(t){this._config=function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?qt(r,!0).forEach(function(e){c()(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):qt(r).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}({},t),this._video.src=t.src||""}},{key:"ended",get:function(){return this._video.ended}},{key:"currentTime",set:function(t){"LiveStream"!==this._config.type&&(this._video.currentTime=t)}}]),e}(Bt),ie=function(t){function e(t){return a()(this,e),t.setAttribute("autoplay",""),E()(this,A()(e).call(this,t))}return P()(e,t),s()(e,[{key:"ended",get:function(){return!1}}]),e}(ne),ae=n(16),oe=n(18),se={ctx:{image:null,overlay:null},dom:{image:null,overlay:null}},ue=new Array;r.default={init:function(t,e,r){te=!0,re=m(w,t),r?(te=!1,ce(r),e()):function(t){var e;if("VideoStream"===re.inputStream.type)e=document.createElement("video"),Xt=new ne(e);else if("ImageStream"===re.inputStream.type)Xt=new Vt;else if("LiveStream"===re.inputStream.type){var r=he();r&&((e=r.querySelector("video"))||(e=document.createElement("video"),r.appendChild(e))),Xt=new ie(e),Ot.request(e,re.inputStream.constraints).then(function(){return Xt.trigger("canrecord")},function(e){return t(e)})}Xt.setAttribute("preload","auto"),Xt.config=re.inputStream,Xt.addEventListener("canrecord",function(t){Object(ae.b)(Xt,re.locator),function(){if("undefined"!=typeof document){var t=he();if(se.dom.image=document.querySelector("canvas.imgBuffer"),se.dom.image||(se.dom.image=document.createElement("canvas"),se.dom.image.className="imgBuffer",t&&"ImageStream"===re.inputStream.type&&t.appendChild(se.dom.image)),se.ctx.image=se.dom.image.getContext("2d"),se.dom.image.width=Xt.canvasWidth,se.dom.image.height=Xt.canvasHeight,se.dom.overlay=document.querySelector("canvas.drawingBuffer"),!se.dom.overlay){se.dom.overlay=document.createElement("canvas"),se.dom.overlay.className="drawingBuffer",t&&t.appendChild(se.dom.overlay);var e=document.createElement("br");e.setAttribute("clear","all"),t&&t.appendChild(e)}se.ctx.overlay=se.dom.overlay.getContext("2d"),se.dom.overlay.width=Xt.canvasWidth,se.dom.overlay.height=Xt.canvasHeight}}(),Qt=new It(Xt,se.dom.image),ge(re.numOfWorkers,function(){0===re.numOfWorkers&&ce(),Xt.play(),t()})}.bind(this,t))}(e)},CameraAccess:Ot,ImageDebug:h.a,ImageWrapper:p.a,ResultCollector:l,get canvas(){return se},start:function(){var t,e;te&&"LiveStream"===re.inputStream.type?(t=1e3/(re.frequency||60),e=null,Zt=!1,function r(n){e=e||n,Zt||(n>=e&&(e+=t,ve()),window.requestAnimationFrame(r))}(performance.now())):ve()},stop:function(){Zt=!0,ge(0),"LiveStream"===re.inputStream.type&&(Ot.release(),Xt.clearEventHandlers())},decodeSingle:function(t,e){var r=this;t=m({inputStream:{type:"ImageStream",sequence:!1,size:800,src:t.src},numOfWorkers:1,locator:{halfSample:!1}},t),this.init(t,function(){d.once("processed",function(t){r.stop(),e.call(null,t)},!0),r.start()})},pause:function(){Zt=!0},onDetected:function(t){d.subscribe("detected",t)},offDetected:function(t){d.unsubscribe("detected",t)},onProcessed:function(t){d.subscribe("processed",t)},offProcessed:function(t){d.unsubscribe("processed",t)},setReaders:function(t){$t?$t.setReaders(t):te&&ue.length>0&&ue.forEach(function(e){return e.worker.postMessage({cmd:"setReaders",readers:t})})},registerResultCollector:function(t){t&&"function"==typeof t.addResult&&(ee=t)}};function ce(t){!function(t){Yt=t||new p.a({x:Xt.width,y:Xt.height});0;Jt=[{x:0,y:0},{x:0,y:Yt.size.y},{x:Yt.size.x,y:Yt.size.y},{x:Yt.size.x,y:0}],Kt=new oe.a(Yt,re.locator)}(t),$t=new wt(re.decoder,Yt)}function he(){var t=re.inputStream.target;if(t instanceof HTMLElement)return t;var e="string"==typeof t?t:"#interactive.viewport";return document.querySelector(e)}function le(t,e){t.forEach(function(t){t.x+=e.x,t.y+=e.y})}function fe(t,e){var r=t;if(t&&te){var n=Xt.topLeft;0===n.x&&0===n.y||function t(e,r){e.barcodes&&e.barcodes.forEach(function(e){return t(e,r)}),e.line&&le(e.line,r),e.box&&le(e.box,r),e.boxes&&e.boxes.forEach(function(t){return le(t,r)})}(t,n),function(t,e,r,n){e&&ee&&(t.barcodes?t.barcodes.forEach(function(t){var i=t.codeResult;i&&ee.addResult(e,r,n,i)}):t.codeResult&&ee.addResult(e,r,n,t.codeResult))}(t,e,Xt.canvasWidth,Xt.canvasHeight),r=t.barcodes||t}d.publish("processed",r),function(t){return t&&(!!t.codeResult||t.barcodes&&t.barcodes.some(function(t){return!!t.codeResult}))}(t)&&d.publish("detected",r)}function de(){var t=re.locate?Kt.locate():[Jt];fe($t.decodeFromBoundingBoxes(t),Yt.data)}function ve(){if(te)if(ue.length>0){var t=ue.find(function(t){return!t.busy});if(!t)return;var e=t.imageData;Qt.grab(e)&&(t.busy=!0,t.worker.postMessage({cmd:"process",imageData:e},[e.buffer]))}else Qt.grab(Yt.data)&&de();else de()}function _e(e){var r,n,i=(r=t||"",n=new Blob(["(".concat(pe.toString(),")(").concat(r,");")],{type:"text/javascript"}),window.URL.createObjectURL(n)),a={worker:new Worker(i),imageData:new Uint8Array(Xt.width*Xt.height),busy:!0};a.worker.onmessage=function(t){var r=t.data;"initialized"===r.event?(URL.revokeObjectURL(i),a.busy=!1,a.imageData=new Uint8Array(r.imageData),e(a)):"processed"===r.event?(a.busy=!1,a.imageData=new Uint8Array(r.imageData),fe(r.result,a.imageData)):r.event},a.worker.postMessage({cmd:"init",size:{x:Xt.width,y:Xt.height},imageData:a.imageData,config:m(re,{inputStream:{target:null}})},[a.imageData.buffer])}function pe(t){var e,r,n=self;!t||(e=t().default)?self.onmessage=function(t){var i=t.data;if("init"===i.cmd){var a=i.config;a.numOfWorkers=0,r=new e.ImageWrapper({x:i.size.x,y:i.size.y},new Uint8Array(i.imageData)),e.init(a,function(){return n.postMessage({event:"initialized",imageData:r.data},[r.data.buffer])},r),e.onProcessed(function(t){return n.postMessage({event:"processed",imageData:r.data,result:t},[r.data.buffer])})}else"process"===i.cmd?(r.data=new Uint8Array(i.imageData),e.start()):"setReaders"===i.cmd&&e.setReaders(i.readers)}:n.postMessage({event:"error",message:"Quagga could not be created"})}function ge(t,e){var r=t-ue.length;if(!(r>0))return r<0&&(ue.slice(r).forEach(function(t){t.worker.terminate()}),ue=ue.slice(0,r)),e&&e();for(var n=0;n<r;n++)_e(function(r){ue.push(r),ue.length>=t&&e&&e()})}}])}); |