1,l,l+n-1),l+=n-1;else for(var p=n-1;p>=0;--p)h[l++]=0!=(d&1<=8?t.readCode(e,r,8):t.readCode(e,r,n)<<8-n},t.convertBoolArrayToByteArray=function(e){for(var r=new Uint8Array((e.length+7)/8),n=0;n\",\"?\",\"[\",\"]\",\"{\",\"}\",\"CTRL_UL\"],t.DIGIT_TABLE=[\"CTRL_PS\",\" \",\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\",\",\".\",\"CTRL_UL\",\"CTRL_US\"],t}(),vt=function(){function t(){}return 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,i=e-n;return Math.sqrt(o*o+i*i)},t.sum=function(t){for(var e=0,r=0,n=t.length;r!==n;r++){e+=t[r]}return e},t}(),mt=function(){function t(){}return t.floatToIntBits=function(t){return t},t.MAX_VALUE=Number.MAX_SAFE_INTEGER,t}(),At=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*mt.floatToIntBits(this.x)+mt.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]),i=this.distance(t[1],t[2]),a=this.distance(t[0],t[2]);if(i>=o&&i>=a?(r=t[0],e=t[1],n=t[2]):a>=i&&a>=o?(r=t[1],e=t[0],n=t[2]):(r=t[2],e=t[0],n=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 vt.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}(),Et=function(){function t(t,e){this.bits=t,this.points=e}return t.prototype.getBits=function(){return this.bits},t.prototype.getPoints=function(){return this.points},t}(),Ct=function(){var t=function(e,r){return t=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,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),It=function(t){function e(e,r,n,o,i){var a=t.call(this,e,r)||this;return a.compact=n,a.nbDatablocks=o,a.nbLayers=i,a}return Ct(e,t),e.prototype.getNbLayers=function(){return this.nbLayers},e.prototype.getNbDatablocks=function(){return this.nbDatablocks},e.prototype.isCompact=function(){return this.compact},e}(Et),St=function(){function t(e,r,n,o){this.image=e,this.height=e.getHeight(),this.width=e.getWidth(),null==r&&(r=t.INIT_SIZE),null==n&&(n=e.getWidth()/2|0),null==o&&(o=e.getHeight()/2|0);var i=r/2|0;if(this.leftInit=n-i,this.rightInit=n+i,this.upInit=o-i,this.downInit=o+i,this.upInit<0||this.leftInit<0||this.downInit>=this.height||this.rightInit>=this.width)throw new U}return t.prototype.detect=function(){for(var t=this.leftInit,e=this.rightInit,r=this.upInit,n=this.downInit,o=!1,i=!0,a=!1,u=!1,s=!1,c=!1,f=!1,h=this.width,l=this.height;i;){i=!1;for(var d=!0;(d||!u)&&e=h){o=!0;break}for(var p=!0;(p||!s)&&n=l){o=!0;break}for(var g=!0;(g||!c)&&t>=0;)(g=this.containsBlackPoint(r,n,t,!1))?(t--,i=!0,c=!0):c||t--;if(t<0){o=!0;break}for(var y=!0;(y||!f)&&r>=0;)(y=this.containsBlackPoint(t,e,r,!0))?(r--,i=!0,f=!0):f||r--;if(r<0){o=!0;break}i&&(a=!0)}if(!o&&a){for(var w=e-t,_=null,v=1;null===_&&vr||u<-1||u>n)throw new U;o=!1,-1===a?(e[i]=0,o=!0):a===r&&(e[i]=r-1,o=!0),-1===u?(e[i+1]=0,o=!0):u===n&&(e[i+1]=n-1,o=!0)}o=!0;for(i=e.length-2;i>=0&&o;i-=2){a=Math.floor(e[i]),u=Math.floor(e[i+1]);if(a<-1||a>r||u<-1||u>n)throw new U;o=!1,-1===a?(e[i]=0,o=!0):a===r&&(e[i]=r-1,o=!0),-1===u?(e[i+1]=0,o=!0):u===n&&(e[i+1]=n-1,o=!0)}},t}(),Tt=function(){function t(t,e,r,n,o,i,a,u,s){this.a11=t,this.a21=e,this.a31=r,this.a12=n,this.a22=o,this.a32=i,this.a13=a,this.a23=u,this.a33=s}return t.quadrilateralToQuadrilateral=function(e,r,n,o,i,a,u,s,c,f,h,l,d,p,g,y){var w=t.quadrilateralToSquare(e,r,n,o,i,a,u,s);return t.squareToQuadrilateral(c,f,h,l,d,p,g,y).times(w)},t.prototype.transformPoints=function(t){for(var e=t.length,r=this.a11,n=this.a12,o=this.a13,i=this.a21,a=this.a22,u=this.a23,s=this.a31,c=this.a32,f=this.a33,h=0;h>1&127):(n<<=10,n+=(i>>2&992)+(i>>1&31))}var a=this.getCorrectedParameterData(n,this.compact);this.compact?(this.nbLayers=1+(a>>6),this.nbDataBlocks=1+(63&a)):(this.nbLayers=1+(a>>11),this.nbDataBlocks=1+(2047&a))},t.prototype.getRotation=function(t,e){var r=0;t.forEach((function(t,n,o){r=(r<<3)+((t>>e-2<<1)+(1&t))})),r=((1&r)<<11)+(r>>1);for(var n=0;n<4;n++)if(I.bitCount(r^this.EXPECTED_CORNER_BITS[n])<=2)return n;throw new U},t.prototype.getCorrectedParameterData=function(t,e){var r,n;e?(r=7,n=2):(r=10,n=4);for(var o=r-n,i=new Int32Array(r),a=r-1;a>=0;--a)i[a]=15&t,t>>=4;try{new wt(lt.AZTEC_PARAM).decode(i,o)}catch(t){throw new U}var u=0;for(a=0;a2){var f=this.distancePoint(c,a)*this.nbCenterLayers/(this.distancePoint(o,e)*(this.nbCenterLayers+2));if(f<.75||f>1.25||!this.isWhiteOrBlackRectangle(a,u,s,c))break}e=a,r=u,n=s,o=c,i=!i}if(5!==this.nbCenterLayers&&7!==this.nbCenterLayers)throw new U;this.compact=5===this.nbCenterLayers;var h=new At(e.getX()+.5,e.getY()-.5),l=new At(r.getX()+.5,r.getY()+.5),d=new At(n.getX()-.5,n.getY()+.5),p=new At(o.getX()-.5,o.getY()-.5);return this.expandSquare([h,l,d,p],2*this.nbCenterLayers-3,2*this.nbCenterLayers)},t.prototype.getMatrixCenter=function(){var t,e,r,n;try{t=(s=new St(this.image).detect())[0],e=s[1],r=s[2],n=s[3]}catch(a){var o=this.image.getWidth()/2,i=this.image.getHeight()/2;t=this.getFirstDifferent(new Dt(o+7,i-7),!1,1,-1).toResultPoint(),e=this.getFirstDifferent(new Dt(o+7,i+7),!1,1,1).toResultPoint(),r=this.getFirstDifferent(new Dt(o-7,i+7),!1,-1,1).toResultPoint(),n=this.getFirstDifferent(new Dt(o-7,i-7),!1,-1,-1).toResultPoint()}var a=vt.round((t.getX()+n.getX()+e.getX()+r.getX())/4),u=vt.round((t.getY()+n.getY()+e.getY()+r.getY())/4);try{var s;t=(s=new St(this.image,15,a,u).detect())[0],e=s[1],r=s[2],n=s[3]}catch(o){t=this.getFirstDifferent(new Dt(a+7,u-7),!1,1,-1).toResultPoint(),e=this.getFirstDifferent(new Dt(a+7,u+7),!1,1,1).toResultPoint(),r=this.getFirstDifferent(new Dt(a-7,u+7),!1,-1,1).toResultPoint(),n=this.getFirstDifferent(new Dt(a-7,u-7),!1,-1,-1).toResultPoint()}return a=vt.round((t.getX()+n.getX()+e.getX()+r.getX())/4),u=vt.round((t.getY()+n.getY()+e.getY()+r.getY())/4),new Dt(a,u)},t.prototype.getMatrixCornerPoints=function(t){return this.expandSquare(t,2*this.nbCenterLayers,this.getDimension())},t.prototype.sampleGrid=function(t,e,r,n,o){var i=Nt.getInstance(),a=this.getDimension(),u=a/2-this.nbCenterLayers,s=a/2+this.nbCenterLayers;return i.sampleGrid(t,a,a,u,u,s,u,s,s,u,s,e.getX(),e.getY(),r.getX(),r.getY(),n.getX(),n.getY(),o.getX(),o.getY())},t.prototype.sampleLine=function(t,e,r){for(var n=0,o=this.distanceResultPoint(t,e),i=o/r,a=t.getX(),u=t.getY(),s=i*(e.getX()-t.getX())/o,c=i*(e.getY()-t.getY())/o,f=0;f.1&&h<.9?0:h<=.1===s?1:-1},t.prototype.getFirstDifferent=function(t,e,r,n){for(var o=t.getX()+r,i=t.getY()+n;this.isValid(o,i)&&this.image.get(o,i)===e;)o+=r,i+=n;for(o-=r,i-=n;this.isValid(o,i)&&this.image.get(o,i)===e;)o+=r;for(o-=r;this.isValid(o,i)&&this.image.get(o,i)===e;)i+=n;return new Dt(o,i-=n)},t.prototype.expandSquare=function(t,e,r){var n=r/(2*e),o=t[0].getX()-t[2].getX(),i=t[0].getY()-t[2].getY(),a=(t[0].getX()+t[2].getX())/2,u=(t[0].getY()+t[2].getY())/2,s=new At(a+n*o,u+n*i),c=new At(a-n*o,u-n*i);return o=t[1].getX()-t[3].getX(),i=t[1].getY()-t[3].getY(),a=(t[1].getX()+t[3].getX())/2,u=(t[1].getY()+t[3].getY())/2,[s,new At(a+n*o,u+n*i),c,new At(a-n*o,u-n*i)]},t.prototype.isValid=function(t,e){return t>=0&&t0&&e>(a?8:5));r=a?o:15;for(var s=Math.trunc(o/2),c=0;c=o)break;try{i=t.getBlackRow(h,i)}catch(t){continue}for(var l=function(t){if(1===t&&(i.reverse(),e&&!0===e.get(T.NEED_RESULT_POINT_CALLBACK))){var r=new Map;e.forEach((function(t,e){return r.set(e,t)})),r.delete(T.NEED_RESULT_POINT_CALLBACK),e=r}try{var o=d.decodeRow(h,i,e);if(1===t){o.putMetadata(it.ORIENTATION,180);var a=o.getResultPoints();null!==a&&(a[0]=new At(n-a[0].getX()-1,a[0].getY()),a[1]=new At(n-a[1].getX()-1,a[1].getY()))}return{value:o}}catch(t){}},d=this,p=0;p<2;p++){var g=l(p);if(\"object\"==typeof g)return g.value}}throw new U},t.recordPattern=function(t,e,r){for(var n=r.length,o=0;o=i)throw new U;for(var a=!t.get(e),u=0,s=e;s0&&o>=0;)e.get(--r)!==i&&(o--,i=!i);if(o>=0)throw new U;t.recordPattern(e,r+1,n)},t.patternMatchVariance=function(t,e,r){for(var n=t.length,o=0,i=0,a=0;ah?f-h:h-f;if(l>r)return Number.POSITIVE_INFINITY;s+=l}return s/o},t}(),Ft=function(){var t=function(e,r){return t=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,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),kt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Ft(e,t),e.findStartPattern=function(t){for(var r=t.getSize(),n=t.getNextSet(0),o=0,i=Int32Array.from([0,0,0,0,0,0]),a=n,u=!1,s=n;s=0&&t.isRange(Math.max(0,a-(s-a)/2),a,!1))return Int32Array.from([a,s,f]);a+=i[0]+i[1],(i=i.slice(2,i.length-1))[o-1]=0,i[o]=0,o--}else o++;i[o]=1,u=!u}throw new U},e.decodeCode=function(t,r,n){Lt.recordPattern(t,n,r);for(var o=e.MAX_AVG_VARIANCE,i=-1,a=0;a