filesbox/web/dist/js/reqrcode.js
2024-07-26 14:10:54 +08:00

2 lines
42 KiB
JavaScript

var _aa={};_aa._ab=function(h,t){for(var n=qrcode.width,r=qrcode.height,i=!0,s=0;s<t.length&&i;s+=2){var e=Math.floor(t[s]),a=Math.floor(t[s+1]);if(e<-1||e>n||a<-1||a>r)throw"Error._ab ";i=!1,e==-1?(t[s]=0,i=!0):e==n&&(t[s]=n-1,i=!0),a==-1?(t[s+1]=0,i=!0):a==r&&(t[s+1]=r-1,i=!0)}i=!0;for(var s=t.length-2;s>=0&&i;s-=2){var e=Math.floor(t[s]),a=Math.floor(t[s+1]);if(e<-1||e>n||a<-1||a>r)throw"Error._ab ";i=!1,e==-1?(t[s]=0,i=!0):e==n&&(t[s]=n-1,i=!0),a==-1?(t[s+1]=0,i=!0):a==r&&(t[s+1]=r-1,i=!0)}},_aa._af=function(h,t,n){for(var r=new _ac(t),i=new Array(t<<1),s=0;s<t;s++){for(var e=i.length,a=s+.5,o=0;o<e;o+=2)i[o]=(o>>1)+.5,i[o+1]=a;n._ad(i),_aa._ab(h,i);try{for(var o=0;o<e;o+=2){var w=h[Math.floor(i[o])+qrcode.width*Math.floor(i[o+1])];w&&r._dq(o>>1,s)}}catch(_){throw"Error._ab"}}return r},_aa._ah=function(h,t,n,r,i,s,e,a,o,w,_,f,v,u,c,d,l,g){var y=_ae._ag(n,r,i,s,e,a,o,w,_,f,v,u,c,d,l,g);return _aa._af(h,t,y)};function _a1(h,t){this.count=h,this._fc=t,this.__defineGetter__("Count",function(){return this.count}),this.__defineGetter__("_dm",function(){return this._fc})}function _a2(h,t,n){this._bm=h,n?this._do=new Array(t,n):this._do=new Array(t),this.__defineGetter__("_bo",function(){return this._bm}),this.__defineGetter__("_dn",function(){return this._bm*this._fo}),this.__defineGetter__("_fo",function(){for(var r=0,i=0;i<this._do.length;i++)r+=this._do[i].length;return r}),this._fb=function(){return this._do}}function _a3(h,t,n,r,i,s){this._bs=h,this._ar=t,this._do=new Array(n,r,i,s);for(var e=0,a=n._bo,o=n._fb(),w=0;w<o.length;w++){var _=o[w];e+=_.Count*(_._dm+a)}this._br=e,this.__defineGetter__("_fd",function(){return this._bs}),this.__defineGetter__("_as",function(){return this._ar}),this.__defineGetter__("_dp",function(){return this._br}),this.__defineGetter__("_cr",function(){return 17+4*this._bs}),this._aq=function(){var f=this._cr,v=new _ac(f);v._bq(0,0,9,9),v._bq(f-8,0,8,9),v._bq(0,f-8,9,8);for(var u=this._ar.length,c=0;c<u;c++)for(var d=this._ar[c]-2,l=0;l<u;l++)c==0&&(l==0||l==u-1)||c==u-1&&l==0||v._bq(this._ar[l]-2,d,5,5);return v._bq(6,9,1,f-17),v._bq(9,6,f-17,1),this._bs>6&&(v._bq(f-11,0,3,6),v._bq(0,f-11,6,3)),v},this._bu=function(f){return this._do[f.ordinal()]}}_a3._bv=new Array(31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017),_a3.VERSIONS=_ay(),_a3._av=function(h){if(h<1||h>40)throw"bad arguments";return _a3.VERSIONS[h-1]},_a3._at=function(h){if(h%4!=1)throw"Error _at";try{return _a3._av(h-17>>2)}catch(t){throw"Error _av"}},_a3._aw=function(h){for(var t=4294967295,n=0,r=0;r<_a3._bv.length;r++){var i=_a3._bv[r];if(i==h)return this._av(r+7);var s=_ax._gj(h,i);s<t&&(n=r+7,t=s)}return t<=3?this._av(n):null};function _ay(){return new Array(new _a3(1,new Array,new _a2(7,new _a1(1,19)),new _a2(10,new _a1(1,16)),new _a2(13,new _a1(1,13)),new _a2(17,new _a1(1,9))),new _a3(2,new Array(6,18),new _a2(10,new _a1(1,34)),new _a2(16,new _a1(1,28)),new _a2(22,new _a1(1,22)),new _a2(28,new _a1(1,16))),new _a3(3,new Array(6,22),new _a2(15,new _a1(1,55)),new _a2(26,new _a1(1,44)),new _a2(18,new _a1(2,17)),new _a2(22,new _a1(2,13))),new _a3(4,new Array(6,26),new _a2(20,new _a1(1,80)),new _a2(18,new _a1(2,32)),new _a2(26,new _a1(2,24)),new _a2(16,new _a1(4,9))),new _a3(5,new Array(6,30),new _a2(26,new _a1(1,108)),new _a2(24,new _a1(2,43)),new _a2(18,new _a1(2,15),new _a1(2,16)),new _a2(22,new _a1(2,11),new _a1(2,12))),new _a3(6,new Array(6,34),new _a2(18,new _a1(2,68)),new _a2(16,new _a1(4,27)),new _a2(24,new _a1(4,19)),new _a2(28,new _a1(4,15))),new _a3(7,new Array(6,22,38),new _a2(20,new _a1(2,78)),new _a2(18,new _a1(4,31)),new _a2(18,new _a1(2,14),new _a1(4,15)),new _a2(26,new _a1(4,13),new _a1(1,14))),new _a3(8,new Array(6,24,42),new _a2(24,new _a1(2,97)),new _a2(22,new _a1(2,38),new _a1(2,39)),new _a2(22,new _a1(4,18),new _a1(2,19)),new _a2(26,new _a1(4,14),new _a1(2,15))),new _a3(9,new Array(6,26,46),new _a2(30,new _a1(2,116)),new _a2(22,new _a1(3,36),new _a1(2,37)),new _a2(20,new _a1(4,16),new _a1(4,17)),new _a2(24,new _a1(4,12),new _a1(4,13))),new _a3(10,new Array(6,28,50),new _a2(18,new _a1(2,68),new _a1(2,69)),new _a2(26,new _a1(4,43),new _a1(1,44)),new _a2(24,new _a1(6,19),new _a1(2,20)),new _a2(28,new _a1(6,15),new _a1(2,16))),new _a3(11,new Array(6,30,54),new _a2(20,new _a1(4,81)),new _a2(30,new _a1(1,50),new _a1(4,51)),new _a2(28,new _a1(4,22),new _a1(4,23)),new _a2(24,new _a1(3,12),new _a1(8,13))),new _a3(12,new Array(6,32,58),new _a2(24,new _a1(2,92),new _a1(2,93)),new _a2(22,new _a1(6,36),new _a1(2,37)),new _a2(26,new _a1(4,20),new _a1(6,21)),new _a2(28,new _a1(7,14),new _a1(4,15))),new _a3(13,new Array(6,34,62),new _a2(26,new _a1(4,107)),new _a2(22,new _a1(8,37),new _a1(1,38)),new _a2(24,new _a1(8,20),new _a1(4,21)),new _a2(22,new _a1(12,11),new _a1(4,12))),new _a3(14,new Array(6,26,46,66),new _a2(30,new _a1(3,115),new _a1(1,116)),new _a2(24,new _a1(4,40),new _a1(5,41)),new _a2(20,new _a1(11,16),new _a1(5,17)),new _a2(24,new _a1(11,12),new _a1(5,13))),new _a3(15,new Array(6,26,48,70),new _a2(22,new _a1(5,87),new _a1(1,88)),new _a2(24,new _a1(5,41),new _a1(5,42)),new _a2(30,new _a1(5,24),new _a1(7,25)),new _a2(24,new _a1(11,12),new _a1(7,13))),new _a3(16,new Array(6,26,50,74),new _a2(24,new _a1(5,98),new _a1(1,99)),new _a2(28,new _a1(7,45),new _a1(3,46)),new _a2(24,new _a1(15,19),new _a1(2,20)),new _a2(30,new _a1(3,15),new _a1(13,16))),new _a3(17,new Array(6,30,54,78),new _a2(28,new _a1(1,107),new _a1(5,108)),new _a2(28,new _a1(10,46),new _a1(1,47)),new _a2(28,new _a1(1,22),new _a1(15,23)),new _a2(28,new _a1(2,14),new _a1(17,15))),new _a3(18,new Array(6,30,56,82),new _a2(30,new _a1(5,120),new _a1(1,121)),new _a2(26,new _a1(9,43),new _a1(4,44)),new _a2(28,new _a1(17,22),new _a1(1,23)),new _a2(28,new _a1(2,14),new _a1(19,15))),new _a3(19,new Array(6,30,58,86),new _a2(28,new _a1(3,113),new _a1(4,114)),new _a2(26,new _a1(3,44),new _a1(11,45)),new _a2(26,new _a1(17,21),new _a1(4,22)),new _a2(26,new _a1(9,13),new _a1(16,14))),new _a3(20,new Array(6,34,62,90),new _a2(28,new _a1(3,107),new _a1(5,108)),new _a2(26,new _a1(3,41),new _a1(13,42)),new _a2(30,new _a1(15,24),new _a1(5,25)),new _a2(28,new _a1(15,15),new _a1(10,16))),new _a3(21,new Array(6,28,50,72,94),new _a2(28,new _a1(4,116),new _a1(4,117)),new _a2(26,new _a1(17,42)),new _a2(28,new _a1(17,22),new _a1(6,23)),new _a2(30,new _a1(19,16),new _a1(6,17))),new _a3(22,new Array(6,26,50,74,98),new _a2(28,new _a1(2,111),new _a1(7,112)),new _a2(28,new _a1(17,46)),new _a2(30,new _a1(7,24),new _a1(16,25)),new _a2(24,new _a1(34,13))),new _a3(23,new Array(6,30,54,74,102),new _a2(30,new _a1(4,121),new _a1(5,122)),new _a2(28,new _a1(4,47),new _a1(14,48)),new _a2(30,new _a1(11,24),new _a1(14,25)),new _a2(30,new _a1(16,15),new _a1(14,16))),new _a3(24,new Array(6,28,54,80,106),new _a2(30,new _a1(6,117),new _a1(4,118)),new _a2(28,new _a1(6,45),new _a1(14,46)),new _a2(30,new _a1(11,24),new _a1(16,25)),new _a2(30,new _a1(30,16),new _a1(2,17))),new _a3(25,new Array(6,32,58,84,110),new _a2(26,new _a1(8,106),new _a1(4,107)),new _a2(28,new _a1(8,47),new _a1(13,48)),new _a2(30,new _a1(7,24),new _a1(22,25)),new _a2(30,new _a1(22,15),new _a1(13,16))),new _a3(26,new Array(6,30,58,86,114),new _a2(28,new _a1(10,114),new _a1(2,115)),new _a2(28,new _a1(19,46),new _a1(4,47)),new _a2(28,new _a1(28,22),new _a1(6,23)),new _a2(30,new _a1(33,16),new _a1(4,17))),new _a3(27,new Array(6,34,62,90,118),new _a2(30,new _a1(8,122),new _a1(4,123)),new _a2(28,new _a1(22,45),new _a1(3,46)),new _a2(30,new _a1(8,23),new _a1(26,24)),new _a2(30,new _a1(12,15),new _a1(28,16))),new _a3(28,new Array(6,26,50,74,98,122),new _a2(30,new _a1(3,117),new _a1(10,118)),new _a2(28,new _a1(3,45),new _a1(23,46)),new _a2(30,new _a1(4,24),new _a1(31,25)),new _a2(30,new _a1(11,15),new _a1(31,16))),new _a3(29,new Array(6,30,54,78,102,126),new _a2(30,new _a1(7,116),new _a1(7,117)),new _a2(28,new _a1(21,45),new _a1(7,46)),new _a2(30,new _a1(1,23),new _a1(37,24)),new _a2(30,new _a1(19,15),new _a1(26,16))),new _a3(30,new Array(6,26,52,78,104,130),new _a2(30,new _a1(5,115),new _a1(10,116)),new _a2(28,new _a1(19,47),new _a1(10,48)),new _a2(30,new _a1(15,24),new _a1(25,25)),new _a2(30,new _a1(23,15),new _a1(25,16))),new _a3(31,new Array(6,30,56,82,108,134),new _a2(30,new _a1(13,115),new _a1(3,116)),new _a2(28,new _a1(2,46),new _a1(29,47)),new _a2(30,new _a1(42,24),new _a1(1,25)),new _a2(30,new _a1(23,15),new _a1(28,16))),new _a3(32,new Array(6,34,60,86,112,138),new _a2(30,new _a1(17,115)),new _a2(28,new _a1(10,46),new _a1(23,47)),new _a2(30,new _a1(10,24),new _a1(35,25)),new _a2(30,new _a1(19,15),new _a1(35,16))),new _a3(33,new Array(6,30,58,86,114,142),new _a2(30,new _a1(17,115),new _a1(1,116)),new _a2(28,new _a1(14,46),new _a1(21,47)),new _a2(30,new _a1(29,24),new _a1(19,25)),new _a2(30,new _a1(11,15),new _a1(46,16))),new _a3(34,new Array(6,34,62,90,118,146),new _a2(30,new _a1(13,115),new _a1(6,116)),new _a2(28,new _a1(14,46),new _a1(23,47)),new _a2(30,new _a1(44,24),new _a1(7,25)),new _a2(30,new _a1(59,16),new _a1(1,17))),new _a3(35,new Array(6,30,54,78,102,126,150),new _a2(30,new _a1(12,121),new _a1(7,122)),new _a2(28,new _a1(12,47),new _a1(26,48)),new _a2(30,new _a1(39,24),new _a1(14,25)),new _a2(30,new _a1(22,15),new _a1(41,16))),new _a3(36,new Array(6,24,50,76,102,128,154),new _a2(30,new _a1(6,121),new _a1(14,122)),new _a2(28,new _a1(6,47),new _a1(34,48)),new _a2(30,new _a1(46,24),new _a1(10,25)),new _a2(30,new _a1(2,15),new _a1(64,16))),new _a3(37,new Array(6,28,54,80,106,132,158),new _a2(30,new _a1(17,122),new _a1(4,123)),new _a2(28,new _a1(29,46),new _a1(14,47)),new _a2(30,new _a1(49,24),new _a1(10,25)),new _a2(30,new _a1(24,15),new _a1(46,16))),new _a3(38,new Array(6,32,58,84,110,136,162),new _a2(30,new _a1(4,122),new _a1(18,123)),new _a2(28,new _a1(13,46),new _a1(32,47)),new _a2(30,new _a1(48,24),new _a1(14,25)),new _a2(30,new _a1(42,15),new _a1(32,16))),new _a3(39,new Array(6,26,54,82,110,138,166),new _a2(30,new _a1(20,117),new _a1(4,118)),new _a2(28,new _a1(40,47),new _a1(7,48)),new _a2(30,new _a1(43,24),new _a1(22,25)),new _a2(30,new _a1(10,15),new _a1(67,16))),new _a3(40,new Array(6,30,58,86,114,142,170),new _a2(30,new _a1(19,118),new _a1(6,119)),new _a2(28,new _a1(18,47),new _a1(31,48)),new _a2(30,new _a1(34,24),new _a1(34,25)),new _a2(30,new _a1(20,15),new _a1(61,16))))}function _ae(h,t,n,r,i,s,e,a,o){this.a11=h,this.a12=r,this.a13=e,this.a21=t,this.a22=i,this.a23=a,this.a31=n,this.a32=s,this.a33=o,this._ad=function(w){for(var _=w.length,f=this.a11,v=this.a12,u=this.a13,c=this.a21,d=this.a22,l=this.a23,g=this.a31,y=this.a32,A=this.a33,b=0;b<_;b+=2){var m=w[b],p=w[b+1],N=u*m+l*p+A;w[b]=(f*m+c*p+g)/N,w[b+1]=(v*m+d*p+y)/N}},this._fp=function(w,_){for(var f=w.length,v=0;v<f;v++){var u=w[v],c=_[v],d=this.a13*u+this.a23*c+this.a33;w[v]=(this.a11*u+this.a21*c+this.a31)/d,_[v]=(this.a12*u+this.a22*c+this.a32)/d}},this._fr=function(){return new _ae(this.a22*this.a33-this.a23*this.a32,this.a23*this.a31-this.a21*this.a33,this.a21*this.a32-this.a22*this.a31,this.a13*this.a32-this.a12*this.a33,this.a11*this.a33-this.a13*this.a31,this.a12*this.a31-this.a11*this.a32,this.a12*this.a23-this.a13*this.a22,this.a13*this.a21-this.a11*this.a23,this.a11*this.a22-this.a12*this.a21)},this.times=function(w){return new _ae(this.a11*w.a11+this.a21*w.a12+this.a31*w.a13,this.a11*w.a21+this.a21*w.a22+this.a31*w.a23,this.a11*w.a31+this.a21*w.a32+this.a31*w.a33,this.a12*w.a11+this.a22*w.a12+this.a32*w.a13,this.a12*w.a21+this.a22*w.a22+this.a32*w.a23,this.a12*w.a31+this.a22*w.a32+this.a32*w.a33,this.a13*w.a11+this.a23*w.a12+this.a33*w.a13,this.a13*w.a21+this.a23*w.a22+this.a33*w.a23,this.a13*w.a31+this.a23*w.a32+this.a33*w.a33)}}_ae._ag=function(h,t,n,r,i,s,e,a,o,w,_,f,v,u,c,d){var l=this._be(h,t,n,r,i,s,e,a),g=this._bf(o,w,_,f,v,u,c,d);return g.times(l)},_ae._bf=function(h,t,n,r,i,s,e,a){var o=a-s,w=t-r+s-a;if(o==0&&w==0)return new _ae(n-h,i-n,h,r-t,s-r,t,0,0,1);var _=n-i,f=e-i,v=h-n+i-e,u=r-s,c=_*o-f*u,d=(v*o-f*w)/c,l=(_*w-v*u)/c;return new _ae(n-h+d*n,e-h+l*e,h,r-t+d*r,a-t+l*a,t,d,l,1)},_ae._be=function(h,t,n,r,i,s,e,a){return this._bf(h,t,n,r,i,s,e,a)._fr()};function _bg(h,t){this.bits=h,this.points=t}function Detector(h){this.image=h,this._am=null,this._bi=function(t,n,r,i){var s=Math.abs(i-n)>Math.abs(r-t);if(s){var e=t;t=n,n=e,e=r,r=i,i=e}for(var a=Math.abs(r-t),o=Math.abs(i-n),w=-a>>1,_=n<i?1:-1,f=t<r?1:-1,v=0,u=t,c=n;u!=r;u+=f){var d=s?c:u,l=s?u:c;if(v==1?this.image[d+l*qrcode.width]&&v++:this.image[d+l*qrcode.width]||v++,v==3){var g=u-t,y=c-n;return Math.sqrt(g*g+y*y)}if(w+=o,w>0){if(c==i)break;c+=_,w-=a}}var A=r-t,b=i-n;return Math.sqrt(A*A+b*b)},this._bh=function(t,n,r,i){var s=this._bi(t,n,r,i),e=1,a=t-(r-t);a<0?(e=t/(t-a),a=0):a>=qrcode.width&&(e=(qrcode.width-1-t)/(a-t),a=qrcode.width-1);var o=Math.floor(n-(i-n)*e);return e=1,o<0?(e=n/(n-o),o=0):o>=qrcode.height&&(e=(qrcode.height-1-n)/(o-n),o=qrcode.height-1),a=Math.floor(t+(a-t)*e),s+=this._bi(t,n,a,o),s-1},this._bj=function(t,n){var r=this._bh(Math.floor(t.X),Math.floor(t.Y),Math.floor(n.X),Math.floor(n.Y)),i=this._bh(Math.floor(n.X),Math.floor(n.Y),Math.floor(t.X),Math.floor(t.Y));return isNaN(r)?i/7:isNaN(i)?r/7:(r+i)/14},this._bk=function(t,n,r){return(this._bj(t,n)+this._bj(t,r))/2},this.distance=function(t,n){var r=t.X-n.X,i=t.Y-n.Y;return Math.sqrt(r*r+i*i)},this._bx=function(t,n,r,i){var s=Math.round(this.distance(t,n)/i),e=Math.round(this.distance(t,r)/i),a=(s+e>>1)+7;switch(a&3){case 0:a++;break;case 2:a--;break;case 3:throw"Error"}return a},this._bl=function(t,n,r,i){var s=Math.floor(i*t),e=Math.max(0,n-s),a=Math.min(qrcode.width-1,n+s);if(a-e<t*3)throw"Error";var o=Math.max(0,r-s),w=Math.min(qrcode.height-1,r+s),_=new _ak(this.image,e,o,a-e,w-o,t,this._am);return _.find()},this.createTransform=function(t,n,r,i,s){var e=s-3.5,a,o,w,_;i!=null?(a=i.X,o=i.Y,w=_=e-3):(a=n.X-t.X+r.X,o=n.Y-t.Y+r.Y,w=_=e);var f=_ae._ag(3.5,3.5,e,3.5,w,_,3.5,e,t.X,t.Y,n.X,n.Y,a,o,r.X,r.Y);return f},this._bz=function(t,n,r){var i=_aa;return i._af(t,r,n)},this._cd=function(t){var n=t._gq,r=t._gs,i=t._gp,s=this._bk(n,r,i);if(s<1)throw"Error";var e=this._bx(n,r,i,s),a=_a3._at(e),o=a._cr-7,w=null;if(a._as.length>0)for(var _=r.X-n.X+i.X,f=r.Y-n.Y+i.Y,v=1-3/o,u=Math.floor(n.X+v*(_-n.X)),c=Math.floor(n.Y+v*(f-n.Y)),d=4;d<=16;d<<=1){w=this._bl(s,u,c,d);break}var l=this.createTransform(n,r,i,w,e),g=this._bz(this.image,l,e),y;return w==null?y=new Array(i,n,r):y=new Array(i,n,r,w),new _bg(g,y)},this.detect=function(){var t=new _cc()._ce(this.image);return this._cd(t)}}var _ca=21522,_cb=new Array(new Array(21522,0),new Array(20773,1),new Array(24188,2),new Array(23371,3),new Array(17913,4),new Array(16590,5),new Array(20375,6),new Array(19104,7),new Array(30660,8),new Array(29427,9),new Array(32170,10),new Array(30877,11),new Array(26159,12),new Array(25368,13),new Array(27713,14),new Array(26998,15),new Array(5769,16),new Array(5054,17),new Array(7399,18),new Array(6608,19),new Array(1890,20),new Array(597,21),new Array(3340,22),new Array(2107,23),new Array(13663,24),new Array(12392,25),new Array(16177,26),new Array(14854,27),new Array(9396,28),new Array(8579,29),new Array(11994,30),new Array(11245,31)),_ch=new Array(0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4);function _ax(h){this._cf=_cg.forBits(h>>3&3),this._fe=h&7,this.__defineGetter__("_cg",function(){return this._cf}),this.__defineGetter__("_dx",function(){return this._fe}),this.GetHashCode=function(){return this._cf.ordinal()<<3|_fe},this.Equals=function(t){var n=t;return this._cf==n._cf&&this._fe==n._fe}}_ax._gj=function(h,t){return h^=t,_ch[h&15]+_ch[_ew(h,4)&15]+_ch[_ew(h,8)&15]+_ch[_ew(h,12)&15]+_ch[_ew(h,16)&15]+_ch[_ew(h,20)&15]+_ch[_ew(h,24)&15]+_ch[_ew(h,28)&15]},_ax._ci=function(h){var t=_ax._cj(h);return t!=null?t:_ax._cj(h^_ca)},_ax._cj=function(h){for(var t=4294967295,n=0,r=0;r<_cb.length;r++){var i=_cb[r],s=i[0];if(s==h)return new _ax(i[1]);var e=this._gj(h,s);e<t&&(n=i[1],t=e)}return t<=3?new _ax(n):null};function _cg(h,t,n){this._ff=h,this.bits=t,this.name=n,this.__defineGetter__("Bits",function(){return this.bits}),this.__defineGetter__("Name",function(){return this.name}),this.ordinal=function(){return this._ff}}_cg.forBits=function(h){if(h<0||h>=FOR_BITS.length)throw"bad arguments";return FOR_BITS[h]};var L=new _cg(0,1,"L"),M=new _cg(1,0,"M"),Q=new _cg(2,3,"Q"),H=new _cg(3,2,"H"),FOR_BITS=new Array(M,L,H,Q);function _ac(h,t){if(t||(t=h),h<1||t<1)throw"Both dimensions must be greater than 0";this.width=h,this.height=t;var n=h>>5;(h&31)!=0&&n++,this.rowSize=n,this.bits=new Array(n*t);for(var r=0;r<this.bits.length;r++)this.bits[r]=0;this.__defineGetter__("Width",function(){return this.width}),this.__defineGetter__("Height",function(){return this.height}),this.__defineGetter__("Dimension",function(){if(this.width!=this.height)throw"Can't call getDimension() on a non-square matrix";return this.width}),this._ds=function(i,s){var e=s*this.rowSize+(i>>5);return(_ew(this.bits[e],i&31)&1)!=0},this._dq=function(i,s){var e=s*this.rowSize+(i>>5);this.bits[e]|=1<<(i&31)},this.flip=function(i,s){var e=s*this.rowSize+(i>>5);this.bits[e]^=1<<(i&31)},this.clear=function(){for(var i=this.bits.length,s=0;s<i;s++)this.bits[s]=0},this._bq=function(i,s,e,a){if(s<0||i<0)throw"Left and top must be nonnegative";if(a<1||e<1)throw"Height and width must be at least 1";var o=i+e,w=s+a;if(w>this.height||o>this.width)throw"The region must fit inside the matrix";for(var _=s;_<w;_++)for(var f=_*this.rowSize,v=i;v<o;v++)this.bits[f+(v>>5)]|=1<<(v&31)}}function _dl(h,t){this._dv=h,this._dw=t,this.__defineGetter__("_du",function(){return this._dv}),this.__defineGetter__("Codewords",function(){return this._dw})}_dl._gn=function(h,t,n){if(h.length!=t._dp)throw"bad arguments";for(var r=t._bu(n),i=0,s=r._fb(),e=0;e<s.length;e++)i+=s[e].Count;for(var a=new Array(i),o=0,w=0;w<s.length;w++)for(var _=s[w],e=0;e<_.Count;e++){var f=_._dm,v=r._bo+f;a[o++]=new _dl(f,new Array(v))}for(var u=a[0]._dw.length,c=a.length-1;c>=0;){var d=a[c]._dw.length;if(d==u)break;c--}c++;for(var l=u-r._bo,g=0,e=0;e<l;e++)for(var w=0;w<o;w++)a[w]._dw[e]=h[g++];for(var w=c;w<o;w++)a[w]._dw[l]=h[g++];for(var y=a[0]._dw.length,e=l;e<y;e++)for(var w=0;w<o;w++){var A=w<c?e:e+1;a[w]._dw[A]=h[g++]}return a};function _cl(h){var t=h.Dimension;if(t<21||(t&3)!=1)throw"Error _cl";this._au=h,this._cp=null,this._co=null,this._dk=function(n,r,i){return this._au._ds(n,r)?i<<1|1:i<<1},this._cm=function(){if(this._co!=null)return this._co;for(var n=0,r=0;r<6;r++)n=this._dk(r,8,n);n=this._dk(7,8,n),n=this._dk(8,8,n),n=this._dk(8,7,n);for(var i=5;i>=0;i--)n=this._dk(8,i,n);if(this._co=_ax._ci(n),this._co!=null)return this._co;var s=this._au.Dimension;n=0;for(var e=s-8,r=s-1;r>=e;r--)n=this._dk(r,8,n);for(var i=s-7;i<s;i++)n=this._dk(8,i,n);if(this._co=_ax._ci(n),this._co!=null)return this._co;throw"Error _cm"},this._cq=function(){if(this._cp!=null)return this._cp;var n=this._au.Dimension,r=n-17>>2;if(r<=6)return _a3._av(r);for(var i=0,s=n-11,e=5;e>=0;e--)for(var a=n-9;a>=s;a--)i=this._dk(a,e,i);if(this._cp=_a3._aw(i),this._cp!=null&&this._cp._cr==n)return this._cp;i=0;for(var a=5;a>=0;a--)for(var e=n-9;e>=s;e--)i=this._dk(a,e,i);if(this._cp=_a3._aw(i),this._cp!=null&&this._cp._cr==n)return this._cp;throw"Error _cq"},this._gk=function(){var n=this._cm(),r=this._cq(),i=_dx._gl(n._dx),s=this._au.Dimension;i._dj(this._au,s);for(var e=r._aq(),a=!0,o=new Array(r._dp),w=0,_=0,f=0,v=s-1;v>0;v-=2){v==6&&v--;for(var u=0;u<s;u++)for(var c=a?s-1-u:u,d=0;d<2;d++)e._ds(v-d,c)||(f++,_<<=1,this._au._ds(v-d,c)&&(_|=1),f==8&&(o[w++]=_,f=0,_=0));a^=!0}if(w!=r._dp)throw"Error _gk";return o}}var _dx={};_dx._gl=function(h){if(h<0||h>7)throw"bad arguments";return _dx._dy[h]};function _fg(){this._dj=function(h,t){for(var n=0;n<t;n++)for(var r=0;r<t;r++)this._fw(n,r)&&h.flip(r,n)},this._fw=function(h,t){return(h+t&1)==0}}function _fh(){this._dj=function(h,t){for(var n=0;n<t;n++)for(var r=0;r<t;r++)this._fw(n,r)&&h.flip(r,n)},this._fw=function(h,t){return(h&1)==0}}function _fi(){this._dj=function(h,t){for(var n=0;n<t;n++)for(var r=0;r<t;r++)this._fw(n,r)&&h.flip(r,n)},this._fw=function(h,t){return t%3==0}}function _fj(){this._dj=function(h,t){for(var n=0;n<t;n++)for(var r=0;r<t;r++)this._fw(n,r)&&h.flip(r,n)},this._fw=function(h,t){return(h+t)%3==0}}function _fk(){this._dj=function(h,t){for(var n=0;n<t;n++)for(var r=0;r<t;r++)this._fw(n,r)&&h.flip(r,n)},this._fw=function(h,t){return(_ew(h,1)+t/3&1)==0}}function _fl(){this._dj=function(h,t){for(var n=0;n<t;n++)for(var r=0;r<t;r++)this._fw(n,r)&&h.flip(r,n)},this._fw=function(h,t){var n=h*t;return(n&1)+n%3==0}}function _fm(){this._dj=function(h,t){for(var n=0;n<t;n++)for(var r=0;r<t;r++)this._fw(n,r)&&h.flip(r,n)},this._fw=function(h,t){var n=h*t;return((n&1)+n%3&1)==0}}function _fn(){this._dj=function(h,t){for(var n=0;n<t;n++)for(var r=0;r<t;r++)this._fw(n,r)&&h.flip(r,n)},this._fw=function(h,t){return((h+t&1)+h*t%3&1)==0}}_dx._dy=new Array(new _fg,new _fh,new _fi,new _fj,new _fk,new _fl,new _fm,new _fn);function _db(h){this._fa=h,this.decode=function(t,n){for(var r=new _bp(this._fa,t),i=new Array(n),s=0;s<i.length;s++)i[s]=0;for(var e=!1,a=!0,s=0;s<n;s++){var o=r.evaluateAt(this._fa.exp(e?s+1:s));i[i.length-1-s]=o,o!=0&&(a=!1)}if(!a)for(var w=new _bp(this._fa,i),_=this._eb(this._fa._ba(n,1),w,n),f=_[0],v=_[1],u=this._ey(f),c=this._di(v,u,e),s=0;s<u.length;s++){var d=t.length-1-this._fa.log(u[s]);if(d<0)throw"ReedSolomonException Bad error location";t[d]=_az._bd(t[d],c[s])}},this._eb=function(t,n,r){if(t._ec<n._ec){var i=t;t=n,n=i}for(var s=t,e=n,a=this._fa.One,o=this._fa.Zero,w=this._fa.Zero,_=this._fa.One;e._ec>=Math.floor(r/2);){var f=s,v=a,u=w;if(s=e,a=o,w=_,s.Zero)throw"r_{i-1} was zero";e=f;for(var c=this._fa.Zero,d=s._ex(s._ec),l=this._fa.inverse(d);e._ec>=s._ec&&!e.Zero;){var g=e._ec-s._ec,y=this._fa.multiply(e._ex(e._ec),l);c=c._bd(this._fa._ba(g,y)),e=e._bd(s._dc(g,y))}o=c.multiply1(a)._bd(v),_=c.multiply1(w)._bd(u)}var A=_._ex(0);if(A==0)throw"ReedSolomonException sigmaTilde(0) was zero";var b=this._fa.inverse(A),m=_.multiply2(b),p=e.multiply2(b);return new Array(m,p)},this._ey=function(t){var n=t._ec;if(n==1)return new Array(t._ex(1));for(var r=new Array(n),i=0,s=1;s<256&&i<n;s++)t.evaluateAt(s)==0&&(r[i]=this._fa.inverse(s),i++);if(i!=n)throw"Error locator degree does not match number of roots";return r},this._di=function(t,n,r){for(var i=n.length,s=new Array(i),e=0;e<i;e++){for(var a=this._fa.inverse(n[e]),o=1,w=0;w<i;w++)e!=w&&(o=this._fa.multiply(o,_az._bd(1,this._fa.multiply(n[w],a))));s[e]=this._fa.multiply(t.evaluateAt(a),this._fa.inverse(o)),r&&(s[e]=this._fa.multiply(s[e],a))}return s}}function _bp(h,t){if(t==null||t.length==0)throw"bad arguments";this._fa=h;var n=t.length;if(n>1&&t[0]==0){for(var r=1;r<n&&t[r]==0;)r++;if(r==n)this._dd=h.Zero._dd;else{this._dd=new Array(n-r);for(var i=0;i<this._dd.length;i++)this._dd[i]=0;for(var s=0;s<this._dd.length;s++)this._dd[s]=t[r+s]}}else this._dd=t;this.__defineGetter__("Zero",function(){return this._dd[0]==0}),this.__defineGetter__("_ec",function(){return this._dd.length-1}),this.__defineGetter__("Coefficients",function(){return this._dd}),this._ex=function(e){return this._dd[this._dd.length-1-e]},this.evaluateAt=function(e){if(e==0)return this._ex(0);var a=this._dd.length;if(e==1){for(var o=0,w=0;w<a;w++)o=_az._bd(o,this._dd[w]);return o}for(var _=this._dd[0],w=1;w<a;w++)_=_az._bd(this._fa.multiply(e,_),this._dd[w]);return _},this._bd=function(e){if(this._fa!=e._fa)throw"GF256Polys do not have same _az _fa";if(this.Zero)return e;if(e.Zero)return this;var a=this._dd,o=e._dd;if(a.length>o.length){var w=a;a=o,o=w}for(var _=new Array(o.length),f=o.length-a.length,v=0;v<f;v++)_[v]=o[v];for(var u=f;u<o.length;u++)_[u]=_az._bd(a[u-f],o[u]);return new _bp(h,_)},this.multiply1=function(e){if(this._fa!=e._fa)throw"GF256Polys do not have same _az _fa";if(this.Zero||e.Zero)return this._fa.Zero;for(var a=this._dd,o=a.length,w=e._dd,_=w.length,f=new Array(o+_-1),v=0;v<o;v++)for(var u=a[v],c=0;c<_;c++)f[v+c]=_az._bd(f[v+c],this._fa.multiply(u,w[c]));return new _bp(this._fa,f)},this.multiply2=function(e){if(e==0)return this._fa.Zero;if(e==1)return this;for(var a=this._dd.length,o=new Array(a),w=0;w<a;w++)o[w]=this._fa.multiply(this._dd[w],e);return new _bp(this._fa,o)},this._dc=function(e,a){if(e<0)throw"bad arguments";if(a==0)return this._fa.Zero;for(var o=this._dd.length,w=new Array(o+e),_=0;_<w.length;_++)w[_]=0;for(var _=0;_<o;_++)w[_]=this._fa.multiply(this._dd[_],a);return new _bp(this._fa,w)},this.divide=function(e){if(this._fa!=e._fa)throw"GF256Polys do not have same _az _fa";if(e.Zero)throw"Divide by 0";for(var a=this._fa.Zero,o=this,w=e._ex(e._ec),_=this._fa.inverse(w);o._ec>=e._ec&&!o.Zero;){var f=o._ec-e._ec,v=this._fa.multiply(o._ex(o._ec),_),u=e._dc(f,v),c=this._fa._ba(f,v);a=a._bd(c),o=o._bd(u)}return new Array(a,o)}}function _az(h){this._gh=new Array(256),this._gi=new Array(256);for(var t=1,n=0;n<256;n++)this._gh[n]=t,t<<=1,t>=256&&(t^=h);for(var n=0;n<255;n++)this._gi[this._gh[n]]=n;var r=new Array(1);r[0]=0,this.zero=new _bp(this,new Array(r));var i=new Array(1);i[0]=1,this.one=new _bp(this,new Array(i)),this.__defineGetter__("Zero",function(){return this.zero}),this.__defineGetter__("One",function(){return this.one}),this._ba=function(s,e){if(s<0)throw"bad arguments";if(e==0)return zero;for(var a=new Array(s+1),o=0;o<a.length;o++)a[o]=0;return a[0]=e,new _bp(this,a)},this.exp=function(s){return this._gh[s]},this.log=function(s){if(s==0)throw"bad arguments";return this._gi[s]},this.inverse=function(s){if(s==0)throw"System.ArithmeticException";return this._gh[255-this._gi[s]]},this.multiply=function(s,e){return s==0||e==0?0:s==1?e:e==1?s:this._gh[(this._gi[s]+this._gi[e])%255]}}_az._bb=new _az(285),_az._bc=new _az(301),_az._bd=function(h,t){return h^t};var Decoder={};Decoder.rsDecoder=new _db(_az._bb),Decoder.correctErrors=function(h,t){for(var n=h.length,r=new Array(n),i=0;i<n;i++)r[i]=h[i]&255;var s=h.length-t;try{Decoder.rsDecoder.decode(r,s)}catch(e){throw e}for(var i=0;i<t;i++)h[i]=r[i]},Decoder.decode=function(h){for(var t=new _cl(h),n=t._cq(),r=t._cm()._cg,i=t._gk(),s=_dl._gn(i,n,r),e=0,a=0;a<s.length;a++)e+=s[a]._du;for(var o=new Array(e),w=0,_=0;_<s.length;_++){var f=s[_],v=f.Codewords,u=f._du;Decoder.correctErrors(v,u);for(var a=0;a<u;a++)o[w++]=v[a]}var c=new QRCodeDataBlockReader(o,n._fd,r.Bits);return c};var qrcode={};qrcode.imagedata=null,qrcode.width=0,qrcode.height=0,qrcode.qrCodeSymbol=null,qrcode.debug=!1,qrcode.maxImgSize=1024*1024,qrcode._eo=[[10,9,8,8],[12,11,16,10],[14,13,16,12]],qrcode.callback=null,qrcode.vidSuccess=function(h){qrcode.localstream=h,qrcode.webkit?qrcode.video.src=window.webkitURL.createObjectURL(h):qrcode.moz?(qrcode.video.mozSrcObject=h,qrcode.video.play()):qrcode.video.src=h,qrcode.gUM=!0,qrcode.canvas_qr2=document.createElement("canvas"),qrcode.canvas_qr2.id="qr-canvas",qrcode.qrcontext2=qrcode.canvas_qr2.getContext("2d"),qrcode.canvas_qr2.width=qrcode.video.videoWidth,qrcode.canvas_qr2.height=qrcode.video.videoHeight,setTimeout(qrcode.captureToCanvas,500)},qrcode.vidError=function(h){qrcode.gUM=!1},qrcode.captureToCanvas=function(){if(qrcode.gUM)try{if(qrcode.video.videoWidth==0){setTimeout(qrcode.captureToCanvas,500);return}else qrcode.canvas_qr2.width=qrcode.video.videoWidth,qrcode.canvas_qr2.height=qrcode.video.videoHeight;qrcode.qrcontext2.drawImage(qrcode.video,0,0);try{qrcode.decode()}catch(h){console.log(h),setTimeout(qrcode.captureToCanvas,500)}}catch(h){console.log(h),setTimeout(qrcode.captureToCanvas,500)}},qrcode.setWebcam=function(h){var t=navigator;qrcode.video=document.getElementById(h);var n=!0;if(navigator.mediaDevices&&navigator.mediaDevices.enumerateDevices)try{navigator.mediaDevices.enumerateDevices().then(function(r){r.forEach(function(i){console.log("deb1"),i.kind==="videoinput"&&i.label.toLowerCase().search("back")>-1&&(n=[{sourceId:i.deviceId}]),console.log(i.kind+": "+i.label+" id = "+i.deviceId)})})}catch(r){console.log(r)}else console.log("no navigator.mediaDevices.enumerateDevices");t.getUserMedia?t.getUserMedia({video:n,audio:!1},qrcode.vidSuccess,qrcode.vidError):t.webkitGetUserMedia?(qrcode.webkit=!0,t.webkitGetUserMedia({video:n,audio:!1},qrcode.vidSuccess,qrcode.vidError)):t.mozGetUserMedia&&(qrcode.moz=!0,t.mozGetUserMedia({video:n,audio:!1},qrcode.vidSuccess,qrcode.vidError))},qrcode.decode=function(h){if(arguments.length==0){if(qrcode.canvas_qr2)var t=qrcode.canvas_qr2,n=qrcode.qrcontext2;else var t=document.getElementById("qr-canvas"),n=t.getContext("2d");return qrcode.width=t.width,qrcode.height=t.height,qrcode.imagedata=n.getImageData(0,0,qrcode.width,qrcode.height),qrcode.result=qrcode.process(n),qrcode.callback!=null&&qrcode.callback(qrcode.result),qrcode.result}else{var r=new Image;r.crossOrigin="Anonymous",r.onload=function(){var i=document.getElementById("out-canvas");if(i!=null){var s=i.getContext("2d");s.clearRect(0,0,320,240),s.drawImage(r,0,0,320,240)}var e=document.createElement("canvas"),a=e.getContext("2d"),o=r.height,w=r.width;if(r.width*r.height>qrcode.maxImgSize){var _=r.width/r.height;o=Math.sqrt(qrcode.maxImgSize/_),w=_*o}e.width=w,e.height=o,a.drawImage(r,0,0,e.width,e.height),qrcode.width=e.width,qrcode.height=e.height;try{qrcode.imagedata=a.getImageData(0,0,e.width,e.height)}catch(f){qrcode.result="Cross domain image reading not supported in your browser! Save it to your computer then drag and drop the file!",qrcode.callback!=null&&qrcode.callback(qrcode.result);return}try{qrcode.result=qrcode.process(a)}catch(f){console.log(f),qrcode.result="error decoding QR Code"}qrcode.callback!=null&&qrcode.callback(qrcode.result)},r.onerror=function(){qrcode.callback!=null&&qrcode.callback("Failed to load the image")},r.src=h}},qrcode.isUrl=function(h){var t=/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;return t.test(h)},qrcode.decode_url=function(h){var t="";try{t=escape(h)}catch(r){console.log(r),t=h}var n="";try{n=decodeURIComponent(t)}catch(r){console.log(r),n=t}return n},qrcode.decode_utf8=function(h){return qrcode.isUrl(h)?qrcode.decode_url(h):h},qrcode.process=function(h){var t=new Date().getTime(),n=qrcode.grayScaleToBitmap(qrcode.grayscale());if(qrcode.debug){for(var r=0;r<qrcode.height;r++)for(var i=0;i<qrcode.width;i++){var s=i*4+r*qrcode.width*4;qrcode.imagedata.data[s]=(n[i+r*qrcode.width],0),qrcode.imagedata.data[s+1]=(n[i+r*qrcode.width],0),qrcode.imagedata.data[s+2]=n[i+r*qrcode.width]?255:0}h.putImageData(qrcode.imagedata,0,0)}var e=new Detector(n),a=e.detect();if(qrcode.debug){for(var r=0;r<a.bits.Height;r++)for(var i=0;i<a.bits.Width;i++){var s=i*4*2+r*2*qrcode.width*4;qrcode.imagedata.data[s]=(a.bits._ds(i,r),0),qrcode.imagedata.data[s+1]=(a.bits._ds(i,r),0),qrcode.imagedata.data[s+2]=a.bits._ds(i,r)?255:0}h.putImageData(qrcode.imagedata,0,0)}for(var o=Decoder.decode(a.bits),w=o.DataByte,_="",f=0;f<w.length;f++)for(var v=0;v<w[f].length;v++)_+=String.fromCharCode(w[f][v]);var u=new Date().getTime(),c=u-t;return console.log(c),qrcode.decode_utf8(_)},qrcode.getPixel=function(h,t){if(qrcode.width<h||qrcode.height<t)throw"point error";var n=h*4+t*qrcode.width*4,r=(qrcode.imagedata.data[n]*33+qrcode.imagedata.data[n+1]*34+qrcode.imagedata.data[n+2]*33)/100;return r},qrcode.binarize=function(h){for(var t=new Array(qrcode.width*qrcode.height),n=0;n<qrcode.height;n++)for(var r=0;r<qrcode.width;r++){var i=qrcode.getPixel(r,n);t[r+n*qrcode.width]=i<=h}return t},qrcode._em=function(h){for(var t=4,n=Math.floor(qrcode.width/t),r=Math.floor(qrcode.height/t),i=new Array(t),s=0;s<t;s++){i[s]=new Array(t);for(var e=0;e<t;e++)i[s][e]=new Array(0,0)}for(var a=0;a<t;a++)for(var o=0;o<t;o++){i[o][a][0]=255;for(var w=0;w<r;w++)for(var _=0;_<n;_++){var f=h[n*o+_+(r*a+w)*qrcode.width];f<i[o][a][0]&&(i[o][a][0]=f),f>i[o][a][1]&&(i[o][a][1]=f)}}for(var v=new Array(t),u=0;u<t;u++)v[u]=new Array(t);for(var a=0;a<t;a++)for(var o=0;o<t;o++)v[o][a]=Math.floor((i[o][a][0]+i[o][a][1])/2);return v},qrcode.grayScaleToBitmap=function(h){for(var t=qrcode._em(h),n=t.length,r=Math.floor(qrcode.width/n),i=Math.floor(qrcode.height/n),s=new ArrayBuffer(qrcode.width*qrcode.height),e=new Uint8Array(s),a=0;a<n;a++)for(var o=0;o<n;o++)for(var w=0;w<i;w++)for(var _=0;_<r;_++)e[r*o+_+(i*a+w)*qrcode.width]=h[r*o+_+(i*a+w)*qrcode.width]<t[o][a];return e},qrcode.grayscale=function(){for(var h=new ArrayBuffer(qrcode.width*qrcode.height),t=new Uint8Array(h),n=0;n<qrcode.height;n++)for(var r=0;r<qrcode.width;r++){var i=qrcode.getPixel(r,n);t[r+n*qrcode.width]=i}return t};function _ew(h,t){return h>=0?h>>t:(h>>t)+(2<<~t)}var _gf=3,_eh=57,_el=8,_eg=2;qrcode._er=function(h){function t(_,f){var v=_.X-f.X,u=_.Y-f.Y;return Math.sqrt(v*v+u*u)}function n(_,f,v){var u=f.x,c=f.y;return(v.x-u)*(_.y-c)-(v.y-c)*(_.x-u)}var r=t(h[0],h[1]),i=t(h[1],h[2]),s=t(h[0],h[2]),e,a,o;if(i>=r&&i>=s?(a=h[0],e=h[1],o=h[2]):s>=i&&s>=r?(a=h[1],e=h[0],o=h[2]):(a=h[2],e=h[0],o=h[1]),n(e,a,o)<0){var w=e;e=o,o=w}h[0]=e,h[1]=a,h[2]=o};function _cz(h,t,n){this.x=h,this.y=t,this.count=1,this._aj=n,this.__defineGetter__("_ei",function(){return this._aj}),this.__defineGetter__("Count",function(){return this.count}),this.__defineGetter__("X",function(){return this.x}),this.__defineGetter__("Y",function(){return this.y}),this._ek=function(){this.count++},this._ev=function(r,i,s){if(Math.abs(i-this.y)<=r&&Math.abs(s-this.x)<=r){var e=Math.abs(r-this._aj);return e<=1||e/this._aj<=1}return!1}}function _es(h){this._go=h[0],this._gu=h[1],this._gr=h[2],this.__defineGetter__("_gp",function(){return this._go}),this.__defineGetter__("_gq",function(){return this._gu}),this.__defineGetter__("_gs",function(){return this._gr})}function _cc(){this.image=null,this._cv=[],this._ge=!1,this._al=new Array(0,0,0,0,0),this._am=null,this.__defineGetter__("_da",function(){return this._al[0]=0,this._al[1]=0,this._al[2]=0,this._al[3]=0,this._al[4]=0,this._al}),this._ao=function(h){for(var t=0,n=0;n<5;n++){var r=h[n];if(r==0)return!1;t+=r}if(t<7)return!1;var i=Math.floor((t<<_el)/7),s=Math.floor(i/2);return Math.abs(i-(h[0]<<_el))<s&&Math.abs(i-(h[1]<<_el))<s&&Math.abs(3*i-(h[2]<<_el))<3*s&&Math.abs(i-(h[3]<<_el))<s&&Math.abs(i-(h[4]<<_el))<s},this._an=function(h,t){return t-h[4]-h[3]-h[2]/2},this._ap=function(h,t,n,r){for(var i=this.image,s=qrcode.height,e=this._da,a=h;a>=0&&i[t+a*qrcode.width];)e[2]++,a--;if(a<0)return NaN;for(;a>=0&&!i[t+a*qrcode.width]&&e[1]<=n;)e[1]++,a--;if(a<0||e[1]>n)return NaN;for(;a>=0&&i[t+a*qrcode.width]&&e[0]<=n;)e[0]++,a--;if(e[0]>n)return NaN;for(a=h+1;a<s&&i[t+a*qrcode.width];)e[2]++,a++;if(a==s)return NaN;for(;a<s&&!i[t+a*qrcode.width]&&e[3]<n;)e[3]++,a++;if(a==s||e[3]>=n)return NaN;for(;a<s&&i[t+a*qrcode.width]&&e[4]<n;)e[4]++,a++;if(e[4]>=n)return NaN;var o=e[0]+e[1]+e[2]+e[3]+e[4];return 5*Math.abs(o-r)>=2*r?NaN:this._ao(e)?this._an(e,a):NaN},this._ej=function(h,t,n,r){for(var i=this.image,s=qrcode.width,e=this._da,a=h;a>=0&&i[a+t*qrcode.width];)e[2]++,a--;if(a<0)return NaN;for(;a>=0&&!i[a+t*qrcode.width]&&e[1]<=n;)e[1]++,a--;if(a<0||e[1]>n)return NaN;for(;a>=0&&i[a+t*qrcode.width]&&e[0]<=n;)e[0]++,a--;if(e[0]>n)return NaN;for(a=h+1;a<s&&i[a+t*qrcode.width];)e[2]++,a++;if(a==s)return NaN;for(;a<s&&!i[a+t*qrcode.width]&&e[3]<n;)e[3]++,a++;if(a==s||e[3]>=n)return NaN;for(;a<s&&i[a+t*qrcode.width]&&e[4]<n;)e[4]++,a++;if(e[4]>=n)return NaN;var o=e[0]+e[1]+e[2]+e[3]+e[4];return 5*Math.abs(o-r)>=r?NaN:this._ao(e)?this._an(e,a):NaN},this._cu=function(h,t,n){var r=h[0]+h[1]+h[2]+h[3]+h[4],i=this._an(h,n),s=this._ap(t,Math.floor(i),h[2],r);if(!isNaN(s)&&(i=this._ej(Math.floor(i),Math.floor(s),h[2],r),!isNaN(i))){for(var e=r/7,a=!1,o=this._cv.length,w=0;w<o;w++){var _=this._cv[w];if(_._ev(e,s,i)){_._ek(),a=!0;break}}if(!a){var f=new _cz(i,s,e);this._cv.push(f),this._am!=null&&this._am._ep(f)}return!0}return!1},this._ee=function(){var h=this._cv.length;if(h<3)throw"Couldn't find enough finder patterns (found "+h+")";if(h>3){for(var t=0,n=0,r=0;r<h;r++){var i=this._cv[r]._ei;t+=i,n+=i*i}var s=t/h;this._cv.sort(function(w,_){var f=Math.abs(_._ei-s),v=Math.abs(w._ei-s);return f<v?-1:f==v?0:1});for(var e=Math.sqrt(n/h-s*s),a=Math.max(.2*s,e),r=this._cv.length-1;r>=0;r--){var o=this._cv[r];Math.abs(o._ei-s)>a&&this._cv.splice(r,1)}}return this._cv.length>3&&this._cv.sort(function(w,_){return w.count>_.count?-1:w.count<_.count?1:0}),new Array(this._cv[0],this._cv[1],this._cv[2])},this._eq=function(){var h=this._cv.length;if(h<=1)return 0;for(var t=null,n=0;n<h;n++){var r=this._cv[n];if(r.Count>=_eg)if(t==null)t=r;else return this._ge=!0,Math.floor((Math.abs(t.X-r.X)-Math.abs(t.Y-r.Y))/2)}return 0},this._cx=function(){for(var h=0,t=0,n=this._cv.length,r=0;r<n;r++){var i=this._cv[r];i.Count>=_eg&&(h++,t+=i._ei)}if(h<3)return!1;for(var s=t/n,e=0,r=0;r<n;r++)i=this._cv[r],e+=Math.abs(i._ei-s);return e<=.05*t},this._ce=function(h){var t=!1;this.image=h;var n=qrcode.height,r=qrcode.width,i=Math.floor(3*n/(4*_eh));(i<_gf||t)&&(i=_gf);for(var s=!1,e=new Array(5),a=i-1;a<n&&!s;a+=i){e[0]=0,e[1]=0,e[2]=0,e[3]=0,e[4]=0;for(var o=0,w=0;w<r;w++)if(h[w+a*qrcode.width])(o&1)==1&&o++,e[o]++;else if((o&1)==0)if(o==4)if(this._ao(e)){var _=this._cu(e,a,w);if(_)if(i=2,this._ge)s=this._cx();else{var f=this._eq();f>e[2]&&(a+=f-e[2]-i,w=r-1)}else{do w++;while(w<r&&!h[w+a*qrcode.width]);w--}o=0,e[0]=0,e[1]=0,e[2]=0,e[3]=0,e[4]=0}else e[0]=e[2],e[1]=e[3],e[2]=e[4],e[3]=1,e[4]=0,o=3;else e[++o]++;else e[o]++;if(this._ao(e)){var _=this._cu(e,a,r);_&&(i=e[0],this._ge&&(s=_cx()))}}var v=this._ee();return qrcode._er(v),new _es(v)}}function _ai(h,t,n){this.x=h,this.y=t,this.count=1,this._aj=n,this.__defineGetter__("_ei",function(){return this._aj}),this.__defineGetter__("Count",function(){return this.count}),this.__defineGetter__("X",function(){return Math.floor(this.x)}),this.__defineGetter__("Y",function(){return Math.floor(this.y)}),this._ek=function(){this.count++},this._ev=function(r,i,s){if(Math.abs(i-this.y)<=r&&Math.abs(s-this.x)<=r){var e=Math.abs(r-this._aj);return e<=1||e/this._aj<=1}return!1}}function _ak(h,t,n,r,i,s,e){this.image=h,this._cv=new Array,this.startX=t,this.startY=n,this.width=r,this.height=i,this._ef=s,this._al=new Array(0,0,0),this._am=e,this._an=function(a,o){return o-a[2]-a[1]/2},this._ao=function(a){for(var o=this._ef,w=o/2,_=0;_<3;_++)if(Math.abs(o-a[_])>=w)return!1;return!0},this._ap=function(a,o,w,_){var f=this.image,v=qrcode.height,u=this._al;u[0]=0,u[1]=0,u[2]=0;for(var c=a;c>=0&&f[o+c*qrcode.width]&&u[1]<=w;)u[1]++,c--;if(c<0||u[1]>w)return NaN;for(;c>=0&&!f[o+c*qrcode.width]&&u[0]<=w;)u[0]++,c--;if(u[0]>w)return NaN;for(c=a+1;c<v&&f[o+c*qrcode.width]&&u[1]<=w;)u[1]++,c++;if(c==v||u[1]>w)return NaN;for(;c<v&&!f[o+c*qrcode.width]&&u[2]<=w;)u[2]++,c++;if(u[2]>w)return NaN;var d=u[0]+u[1]+u[2];return 5*Math.abs(d-_)>=2*_?NaN:this._ao(u)?this._an(u,c):NaN},this._cu=function(a,o,w){var _=a[0]+a[1]+a[2],f=this._an(a,w),v=this._ap(o,Math.floor(f),2*a[1],_);if(!isNaN(v)){for(var u=(a[0]+a[1]+a[2])/3,c=this._cv.length,d=0;d<c;d++){var l=this._cv[d];if(l._ev(u,v,f))return new _ai(f,v,u)}var g=new _ai(f,v,u);this._cv.push(g),this._am!=null&&this._am._ep(g)}return null},this.find=function(){for(var a=this.startX,o=this.height,w=a+r,_=n+(o>>1),f=new Array(0,0,0),v=0;v<o;v++){var u=_+((v&1)==0?v+1>>1:-(v+1>>1));f[0]=0,f[1]=0,f[2]=0;for(var c=a;c<w&&!h[c+qrcode.width*u];)c++;for(var d=0;c<w;){if(h[c+u*qrcode.width])if(d==1)f[d]++;else if(d==2){if(this._ao(f)){var l=this._cu(f,u,c);if(l!=null)return l}f[0]=f[2],f[1]=1,f[2]=0,d=1}else f[++d]++;else d==1&&d++,f[d]++;c++}if(this._ao(f)){var l=this._cu(f,u,w);if(l!=null)return l}}if(this._cv.length!=0)return this._cv[0];throw"Couldn't find enough alignment patterns"}}function QRCodeDataBlockReader(h,t,n){this._ed=0,this._cw=7,this.dataLength=0,this.blocks=h,this._en=n,t<=9?this.dataLengthMode=0:t>=10&&t<=26?this.dataLengthMode=1:t>=27&&t<=40&&(this.dataLengthMode=2),this._gd=function(r){var i=0;if(r<this._cw+1){for(var s=0,e=0;e<r;e++)s+=1<<e;return s<<=this._cw-r+1,i=(this.blocks[this._ed]&s)>>this._cw-r+1,this._cw-=r,i}else if(r<this._cw+1+8){for(var a=0,e=0;e<this._cw+1;e++)a+=1<<e;return i=(this.blocks[this._ed]&a)<<r-(this._cw+1),this._ed++,i+=this.blocks[this._ed]>>8-(r-(this._cw+1)),this._cw=this._cw-r%8,this._cw<0&&(this._cw=8+this._cw),i}else if(r<this._cw+1+16){for(var a=0,o=0,e=0;e<this._cw+1;e++)a+=1<<e;var w=(this.blocks[this._ed]&a)<<r-(this._cw+1);this._ed++;var _=this.blocks[this._ed]<<r-(this._cw+1+8);this._ed++;for(var e=0;e<r-(this._cw+1+8);e++)o+=1<<e;o<<=8-(r-(this._cw+1+8));var f=(this.blocks[this._ed]&o)>>8-(r-(this._cw+1+8));return i=w+_+f,this._cw=this._cw-(r-8)%8,this._cw<0&&(this._cw=8+this._cw),i}else return 0},this.NextMode=function(){return this._ed>this.blocks.length-this._en-2?0:this._gd(4)},this.getDataLength=function(r){for(var i=0;r>>i!=1;)i++;return this._gd(qrcode._eo[this.dataLengthMode][i])},this.getRomanAndFigureString=function(r){var i=r,s=0,e="",a=new Array("0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":");do if(i>1){s=this._gd(11);var o=Math.floor(s/45),w=s%45;e+=a[o],e+=a[w],i-=2}else i==1&&(s=this._gd(6),e+=a[s],i-=1);while(i>0);return e},this.getFigureString=function(r){var i=r,s=0,e="";do i>=3?(s=this._gd(10),s<100&&(e+="0"),s<10&&(e+="0"),i-=3):i==2?(s=this._gd(7),s<10&&(e+="0"),i-=2):i==1&&(s=this._gd(4),i-=1),e+=s;while(i>0);return e},this.get8bitByteArray=function(r){var i=r,s=0,e=new Array;do s=this._gd(8),e.push(s),i--;while(i>0);return e},this.getKanjiString=function(r){var i=r,s=0,e="";do{s=_gd(13);var a=s%192,o=s/192,w=(o<<8)+a,_=0;w+33088<=40956?_=w+33088:_=w+49472,e+=String.fromCharCode(_),i--}while(i>0);return e},this.__defineGetter__("DataByte",function(){var r=new Array,i=1,s=2,e=4,a=8;do{var o=this.NextMode();if(o==0){if(r.length>0)break;throw"Empty data block"}if(o!=i&&o!=s&&o!=e&&o!=a)throw"Invalid mode: "+o+" in (block:"+this._ed+" bit:"+this._cw+")";var w=this.getDataLength(o);if(w<1)throw"Invalid data length: "+w;switch(o){case i:for(var _=this.getFigureString(w),f=new Array(_.length),v=0;v<_.length;v++)f[v]=_.charCodeAt(v);r.push(f);break;case s:for(var _=this.getRomanAndFigureString(w),f=new Array(_.length),v=0;v<_.length;v++)f[v]=_.charCodeAt(v);r.push(f);break;case e:var u=this.get8bitByteArray(w);r.push(u);break;case a:var _=this.getKanjiString(w);r.push(_);break}}while(!0);return r})}