Socket
Socket
Sign inDemoInstall

qrcode

Package Overview
Dependencies
3
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.12 to 0.3.0

CONTRIBUTING.md

11

build/qrcode.js

@@ -184,3 +184,2 @@ ;(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){

text = args.shift(),
errorCorrectLevel = args.shift(),
options = args.shift() || {};

@@ -194,16 +193,8 @@

}
cb = arguments[arguments.length-1];
if(arguments.length > 2){
errorCorrectLevel = arguments[2];
}
//this interface kinda sucks - there is very small likelyhood of this ever being async
this.QRVersion(text,errorCorrectLevel,(options||{}).version,function(e,t,l,ec){
this.QRVersion(text,options.errorCorrectLevel,options.version,function(e,t,l,ec){
text = t,level = l,error = e,errorCorrectLevel = ec;
});
if(!level) {

@@ -210,0 +201,0 @@ //if we are unable to find an appropriate qr level error out

@@ -1,1 +0,1 @@

(function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var j=typeof require=="function"&&require;if(!h&&j)return j(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}var f=typeof require=="function"&&require;for(var g=0;g<d.length;g++)e(d[g]);return e})({1:[function(a,b,c){c.QRCapacityTable=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]]},{}],2:[function(a,b,c){function h(){}var d=a("bops"),e=a("./qrcode.js"),f=a("./qrcapacitytable.js").QRCapacityTable,g=e.QRCode;c.QRCodeDraw=h,c.QRVersionCapacityTable=f,c.QRErrorCorrectLevel=e.QRErrorCorrectLevel,c.QRCode=e.QRCode,h.prototype={scale:4,defaultMargin:20,marginScaleFactor:5,Array:typeof Uint32Array=="undefined"?Uint32Array:Array,errorBehavior:{length:"trim"},color:{dark:"black",light:"white"},defaultErrorCorrectLevel:e.QRErrorCorrectLevel.H,QRErrorCorrectLevel:e.QRErrorCorrectLevel,draw:function(a,b,c,d){var f,g,h,i=Array.prototype.slice.call(arguments);d=i.pop(),a=i.shift(),b=i.shift(),c=i.shift()||{};if(typeof d!="function")throw new Error("callback required");typeof c!="object"&&(c.errorCorrectLevel=c),this.QRVersion(b,c.errorCorrectLevel||this.QRErrorCorrectLevel.H,c.version,function(a,c,d,e){b=c,f=d,g=a,h=e}),this.scale=c.scale||this.scale,this.margin=typeof c.margin=="undefined"?this.defaultMargin:c.margin;if(!f){d(g,a);return}try{var j=new e.QRCode(f,h),k=this.scale||4,l=a.getContext("2d"),m=0;j.addData(b),j.make();var n=this.marginWidth(),o=n;m=this.dataWidth(j)+n*2,this.resetCanvas(a,l,m);for(var p=0,q=j.getModuleCount();p<q;p++){var r=n;for(var s=0,t=j.getModuleCount();s<t;s++)j.isDark(p,s)?(l.fillStyle=this.color.dark,l.fillRect(r,o,k,k)):this.color.light&&(l.fillStyle=this.color.light,l.fillRect(r,o,k,k)),r+=k;o+=k}}catch(u){g=u}d(g,a,m)},drawBitArray:function(a){var b=Array.prototype.slice.call(arguments),c=b.pop(),a=b.shift(),d=b.shift(),f=b.shift()||{};if(typeof c!="function")throw new Error("callback required as last argument");c=arguments[arguments.length-1],arguments.length>2&&(d=arguments[2]),this.QRVersion(a,d,(f||{}).version,function(b,c,e,f){a=c,level=e,error=b,d=f});if(!level){c(error,[],0);return}try{var g=new e.QRCode(level,d),h=this.scale||4,i=0,j,k=0,l=0;g.addData(a),g.make(),i=this.dataWidth(g,1),j=new this.Array(i*i);for(var m=0,n=g.getModuleCount();m<n;m++)for(var o=0,p=g.getModuleCount();o<p;o++)g.isDark(m,o)?j[k]=1:j[k]=0,k++}catch(q){error=q,console.log(q.stack)}c(error,j,i)},QRVersion:function(a,b,c,e){var g=d.from(a).length,h,b=this.QRErrorCorrectLevel[b]||this.defaultErrorCorrectLevel,i=[1,0,3,2],j=["L","M","Q","H"],k=0,l=!1;typeof c!="undefined"&&c!==null&&(l=!0);if(l)k=f[c][i[b]];else{for(var m=0,n=f.length;m<n;m++){k=f[m][i[b]];if(g<f[m][i[b]]){c=m+1;break}}c||(c=f.length-1)}return k<g&&(this.errorBehavior.length=="trim"?(a=a.substr(0,k),level=f.length):h=new Error("input string too long for error correction "+j[i[b]]+" max length "+k+" for qrcode version "+c)),e&&e(h,a,c,b),c},marginWidth:function(){var a=this.margin;return this.scale=this.scale||4,this.scale*this.marginScaleFactor>a&&a>0&&(a=this.scale*this.marginScaleFactor),a},dataWidth:function(a,b){return a.getModuleCount()*(b||this.scale||4)},resetCanvas:function(a,b,c){b.clearRect(0,0,a.width,a.height),a.style||(a.style={}),a.style.height=a.height=c,a.style.width=a.width=c,this.color.light?(b.fillStyle=this.color.light,b.fillRect(0,0,a.width,a.height)):b.clearRect(0,0,a.width,a.height)}}},{"./qrcapacitytable.js":1,"./qrcode.js":3,bops:4}],3:[function(a,b,c){function f(a,b){this.typeNumber=a,this.errorCorrectLevel=b,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=new e}function g(a){this.mode=h.MODE_8BIT_BYTE,this.data=a;var b=[];this.parsedData=d.from(a)}function n(a,b){if(a.length==undefined)throw new Error(a.length+"/"+b);var c=0;while(c<a.length&&a[c]==0)c++;this.num=new Array(a.length-c+b);for(var d=0;d<a.length-c;d++)this.num[d]=a[d+c]}function o(a,b){this.totalCount=a,this.dataCount=b}function p(){this.buffer=new Array,this.length=0}var d=a("bops");c.QRCode=f;var e=typeof Uint32Array=="undefined"?Uint32Array:Array;f.prototype={addData:function(a){var b=new g(a);this.dataList.push(b),this.dataCache=null},isDark:function(a,b){if(a<0||this.moduleCount<=a||b<0||this.moduleCount<=b)throw new Error(a+","+b);return this.modules[a][b]},getModuleCount:function(){return this.moduleCount},make:function(){this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(a,b){this.moduleCount=this.typeNumber*4+17,this.modules=new e(this.moduleCount);for(var c=0;c<this.moduleCount;c++){this.modules[c]=new e(this.moduleCount);for(var d=0;d<this.moduleCount;d++)this.modules[c][d]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(a,b),this.typeNumber>=7&&this.setupTypeNumber(a),this.dataCache==null&&(this.dataCache=f.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,b)},setupPositionProbePattern:function(a,b){for(var c=-1;c<=7;c++){if(a+c<=-1||this.moduleCount<=a+c)continue;for(var d=-1;d<=7;d++){if(b+d<=-1||this.moduleCount<=b+d)continue;0<=c&&c<=6&&(d==0||d==6)||0<=d&&d<=6&&(c==0||c==6)||2<=c&&c<=4&&2<=d&&d<=4?this.modules[a+c][b+d]=!0:this.modules[a+c][b+d]=!1}}},getBestMaskPattern:function(){var a=0,b=0;for(var c=0;c<8;c++){this.makeImpl(!0,c);var d=k.getLostPoint(this);if(c==0||a>d)a=d,b=c}return b},setupTimingPattern:function(){for(var a=8;a<this.moduleCount-8;a++){if(this.modules[a][6]!=null)continue;this.modules[a][6]=a%2==0}for(var b=8;b<this.moduleCount-8;b++){if(this.modules[6][b]!=null)continue;this.modules[6][b]=b%2==0}},setupPositionAdjustPattern:function(){var a=k.getPatternPosition(this.typeNumber);a=a||"";for(var b=0;b<a.length;b++)for(var c=0;c<a.length;c++){var d=a[b],e=a[c];if(this.modules[d][e]!=null)continue;for(var f=-2;f<=2;f++)for(var g=-2;g<=2;g++)f==-2||f==2||g==-2||g==2||f==0&&g==0?this.modules[d+f][e+g]=!0:this.modules[d+f][e+g]=!1}},setupTypeNumber:function(a){var b=k.getBCHTypeNumber(this.typeNumber);for(var c=0;c<18;c++){var d=!a&&(b>>c&1)==1;this.modules[Math.floor(c/3)][c%3+this.moduleCount-8-3]=d}for(var c=0;c<18;c++){var d=!a&&(b>>c&1)==1;this.modules[c%3+this.moduleCount-8-3][Math.floor(c/3)]=d}},setupTypeInfo:function(a,b){var c=this.errorCorrectLevel<<3|b,d=k.getBCHTypeInfo(c);for(var e=0;e<15;e++){var f=!a&&(d>>e&1)==1;e<6?this.modules[e][8]=f:e<8?this.modules[e+1][8]=f:this.modules[this.moduleCount-15+e][8]=f}for(var e=0;e<15;e++){var f=!a&&(d>>e&1)==1;e<8?this.modules[8][this.moduleCount-e-1]=f:e<9?this.modules[8][15-e-1+1]=f:this.modules[8][15-e-1]=f}this.modules[this.moduleCount-8][8]=!a},mapData:function(a,b){var c=-1,d=this.moduleCount-1,e=7,f=0;for(var g=this.moduleCount-1;g>0;g-=2){g==6&&g--;for(;;){for(var h=0;h<2;h++)if(this.modules[d][g-h]==null){var i=!1;f<a.length&&(i=(a[f]>>>e&1)==1);var j=k.getMask(b,d,g-h);j&&(i=!i),this.modules[d][g-h]=i,e--,e==-1&&(f++,e=7)}d+=c;if(d<0||this.moduleCount<=d){d-=c,c=-c;break}}}}},f.PAD0=236,f.PAD1=17,f.createData=function(a,b,c){var d=o.getRSBlocks(a,b),e=new p;for(var g=0;g<c.length;g++){var h=c[g];e.put(h.mode,4),e.put(h.getLength(),k.getLengthInBits(h.mode,a)),h.write(e)}var i=0;for(var g=0;g<d.length;g++)i+=d[g].dataCount;if(e.getLengthInBits()>i*8)throw new Error("code length overflow. ("+e.getLengthInBits()+">"+i*8+")");e.getLengthInBits()+4<=i*8&&e.put(0,4);while(e.getLengthInBits()%8!=0)e.putBit(!1);for(;;){if(e.getLengthInBits()>=i*8)break;e.put(f.PAD0,8);if(e.getLengthInBits()>=i*8)break;e.put(f.PAD1,8)}return f.createBytes(e,d)},f.createBytes=function(a,b){var c=0,d=0,f=0,g=new e(b.length),h=new e(b.length);for(var i=0;i<b.length;i++){var j=b[i].dataCount,l=b[i].totalCount-j;d=Math.max(d,j),f=Math.max(f,l),g[i]=new e(j);for(var m=0;m<g[i].length;m++)g[i][m]=255&a.buffer[m+c];c+=j;var o=k.getErrorCorrectPolynomial(l),p=new n(g[i],o.getLength()-1),q=p.mod(o);h[i]=new e(o.getLength()-1);for(var m=0;m<h[i].length;m++){var r=m+q.getLength()-h[i].length;h[i][m]=r>=0?q.get(r):0}}var s=0;for(var m=0;m<b.length;m++)s+=b[m].totalCount;var t=new e(s),u=0;for(var m=0;m<d;m++)for(var i=0;i<b.length;i++)m<g[i].length&&(t[u++]=g[i][m]);for(var m=0;m<f;m++)for(var i=0;i<b.length;i++)m<h[i].length&&(t[u++]=h[i][m]);return t},g.prototype={getLength:function(a){return this.parsedData.length},write:function(a){for(var b=0,c=this.parsedData.length;b<c;b++)a.put(this.parsedData[b],8)}};var h={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},i=c.QRErrorCorrectLevel={L:1,M:0,Q:3,H:2},j={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},k={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(a){var b=a<<10;while(k.getBCHDigit(b)-k.getBCHDigit(k.G15)>=0)b^=k.G15<<k.getBCHDigit(b)-k.getBCHDigit(k.G15);return(a<<10|b)^k.G15_MASK},getBCHTypeNumber:function(a){var b=a<<12;while(k.getBCHDigit(b)-k.getBCHDigit(k.G18)>=0)b^=k.G18<<k.getBCHDigit(b)-k.getBCHDigit(k.G18);return a<<12|b},getBCHDigit:function(a){var b=0;while(a!=0)b++,a>>>=1;return b},getPatternPosition:function(a){return k.PATTERN_POSITION_TABLE[a-1]},getMask:function(a,b,c){switch(a){case j.PATTERN000:return(b+c)%2==0;case j.PATTERN001:return b%2==0;case j.PATTERN010:return c%3==0;case j.PATTERN011:return(b+c)%3==0;case j.PATTERN100:return(Math.floor(b/2)+Math.floor(c/3))%2==0;case j.PATTERN101:return b*c%2+b*c%3==0;case j.PATTERN110:return(b*c%2+b*c%3)%2==0;case j.PATTERN111:return(b*c%3+(b+c)%2)%2==0;default:throw new Error("bad maskPattern:"+a)}},getErrorCorrectPolynomial:function(a){var b=new n([1],0);for(var c=0;c<a;c++)b=b.multiply(new n([1,l.gexp(c)],0));return b},getLengthInBits:function(a,b){if(1<=b&&b<10)switch(a){case h.MODE_NUMBER:return 10;case h.MODE_ALPHA_NUM:return 9;case h.MODE_8BIT_BYTE:return 8;case h.MODE_KANJI:return 8;default:throw new Error("mode:"+a)}else if(b<27)switch(a){case h.MODE_NUMBER:return 12;case h.MODE_ALPHA_NUM:return 11;case h.MODE_8BIT_BYTE:return 16;case h.MODE_KANJI:return 10;default:throw new Error("mode:"+a)}else{if(!(b<41))throw new Error("type:"+b);switch(a){case h.MODE_NUMBER:return 14;case h.MODE_ALPHA_NUM:return 13;case h.MODE_8BIT_BYTE:return 16;case h.MODE_KANJI:return 12;default:throw new Error("mode:"+a)}}},getLostPoint:function(a){var b=a.getModuleCount(),c=0;for(var d=0;d<b;d++)for(var e=0;e<b;e++){var f=0,g=a.isDark(d,e);for(var h=-1;h<=1;h++){if(d+h<0||b<=d+h)continue;for(var i=-1;i<=1;i++){if(e+i<0||b<=e+i)continue;if(h==0&&i==0)continue;g==a.isDark(d+h,e+i)&&f++}}f>5&&(c+=3+f-5)}for(var d=0;d<b-1;d++)for(var e=0;e<b-1;e++){var j=0;a.isDark(d,e)&&j++,a.isDark(d+1,e)&&j++,a.isDark(d,e+1)&&j++,a.isDark(d+1,e+1)&&j++;if(j==0||j==4)c+=3}for(var d=0;d<b;d++)for(var e=0;e<b-6;e++)a.isDark(d,e)&&!a.isDark(d,e+1)&&a.isDark(d,e+2)&&a.isDark(d,e+3)&&a.isDark(d,e+4)&&!a.isDark(d,e+5)&&a.isDark(d,e+6)&&(c+=40);for(var e=0;e<b;e++)for(var d=0;d<b-6;d++)a.isDark(d,e)&&!a.isDark(d+1,e)&&a.isDark(d+2,e)&&a.isDark(d+3,e)&&a.isDark(d+4,e)&&!a.isDark(d+5,e)&&a.isDark(d+6,e)&&(c+=40);var k=0;for(var e=0;e<b;e++)for(var d=0;d<b;d++)a.isDark(d,e)&&k++;var l=Math.abs(100*k/b/b-50)/5;return c+=l*10,c}},l={glog:function(a){if(a<1)throw new Error("glog("+a+")");return l.LOG_TABLE[a]},gexp:function(a){while(a<0)a+=255;while(a>=256)a-=255;return l.EXP_TABLE[a]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(var m=0;m<8;m++)l.EXP_TABLE[m]=1<<m;for(var m=8;m<256;m++)l.EXP_TABLE[m]=l.EXP_TABLE[m-4]^l.EXP_TABLE[m-5]^l.EXP_TABLE[m-6]^l.EXP_TABLE[m-8];for(var m=0;m<255;m++)l.LOG_TABLE[l.EXP_TABLE[m]]=m;n.prototype={get:function(a){return this.num[a]},getLength:function(){return this.num.length},multiply:function(a){var b=new Array(this.getLength()+a.getLength()-1);for(var c=0;c<this.getLength();c++)for(var d=0;d<a.getLength();d++)b[c+d]^=l.gexp(l.glog(this.get(c))+l.glog(a.get(d)));return new n(b,0)},mod:function(a){if(this.getLength()-a.getLength()<0)return this;var b=l.glog(this.get(0))-l.glog(a.get(0)),c=new Array(this.getLength());for(var d=0;d<this.getLength();d++)c[d]=this.get(d);for(var d=0;d<a.getLength();d++)c[d]^=l.gexp(l.glog(a.get(d))+b);return(new n(c,0)).mod(a)}},o.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12,7,37,13],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],o.getRSBlocks=function(a,b){var c=o.getRsBlockTable(a,b);if(c==undefined)throw new Error("bad rs block @ typeNumber:"+a+"/errorCorrectLevel:"+b);var d=c.length/3,e=new Array;for(var f=0;f<d;f++){var g=c[f*3+0],h=c[f*3+1],i=c[f*3+2];for(var j=0;j<g;j++)e.push(new o(h,i))}return e},o.getRsBlockTable=function(a,b){switch(b){case i.L:return o.RS_BLOCK_TABLE[(a-1)*4+0];case i.M:return o.RS_BLOCK_TABLE[(a-1)*4+1];case i.Q:return o.RS_BLOCK_TABLE[(a-1)*4+2];case i.H:return o.RS_BLOCK_TABLE[(a-1)*4+3];default:return undefined}},p.prototype={get:function(a){var b=Math.floor(a/8);return(this.buffer[b]>>>7-a%8&1)==1},put:function(a,b){for(var c=0;c<b;c++)this.putBit((a>>>b-c-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(a){var b=Math.floor(this.length/8);this.buffer.length<=b&&this.buffer.push(0),a&&(this.buffer[b]|=128>>>this.length%8),this.length++}}},{bops:4}],4:[function(a,b,c){function e(a,b){for(var c in a)b[c]=a[c]}var d={};b.exports=d,d.from=a("./from.js"),d.to=a("./to.js"),d.is=a("./is.js"),d.subarray=a("./subarray.js"),d.join=a("./join.js"),d.copy=a("./copy.js"),d.create=a("./create.js"),e(a("./read.js"),d),e(a("./write.js"),d)},{"./copy.js":7,"./create.js":8,"./from.js":9,"./is.js":10,"./join.js":11,"./read.js":13,"./subarray.js":14,"./to.js":15,"./write.js":16}],5:[function(a,b,c){(function(a){function d(a){var b,d,e,f,g,h;if(a.length%4>0)throw"Invalid string. Length must be a multiple of 4";g=a.indexOf("="),g=g>0?a.length-g:0,h=[],e=g>0?a.length-4:a.length;for(b=0,d=0;b<e;b+=4,d+=3)f=c.indexOf(a[b])<<18|c.indexOf(a[b+1])<<12|c.indexOf(a[b+2])<<6|c.indexOf(a[b+3]),h.push((f&16711680)>>16),h.push((f&65280)>>8),h.push(f&255);return g===2?(f=c.indexOf(a[b])<<2|c.indexOf(a[b+1])>>4,h.push(f&255)):g===1&&(f=c.indexOf(a[b])<<10|c.indexOf(a[b+1])<<4|c.indexOf(a[b+2])>>2,h.push(f>>8&255),h.push(f&255)),h}function e(a){function h(a){return c[a>>18&63]+c[a>>12&63]+c[a>>6&63]+c[a&63]}var b,d=a.length%3,e="",f,g;for(b=0,g=a.length-d;b<g;b+=3)f=(a[b]<<16)+(a[b+1]<<8)+a[b+2],e+=h(f);switch(d){case 1:f=a[a.length-1],e+=c[f>>2],e+=c[f<<4&63],e+="==";break;case 2:f=(a[a.length-2]<<8)+a[a.length-1],e+=c[f>>10],e+=c[f>>4&63],e+=c[f<<2&63],e+="="}return e}"use strict";var c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";b.exports.toByteArray=d,b.exports.fromByteArray=e})()},{}],6:[function(a,b,c){function i(a,b,c){b=b===undefined?0:b,c=c===undefined?a.length:c;var g=0,i=128,l=0,m,n;e.length=d.length=0;while(g<a.length)n=a[g],!l&&n&i?(m=j(n),l+=m,m<8&&(e[e.length]=n&h[6-m])):l?(e[e.length]=n&h[6],--l,!l&&e.length&&(d[d.length]=f(k(e,m)),e.length=0)):d[d.length]=f(n),++g;return e.length&&!l&&(d[d.length]=f(k(e,m)),e.length=0),d.join("")}function j(a){for(var b=0;b<7;++b)if(!(a&g[b]))break;return b}function k(a){var b=0;for(var c=0,d=a.length;c<d;++c)b|=a[c]<<(d-c-1)*6;return b}b.exports=i;var d=[],e=[],f=String.fromCharCode,g=[64,32,16,8,4,2,1],h=[0,1,3,7,15,31,63,127]},{}],7:[function(a,b,c){function e(a,b,c,d,e){c=arguments.length<3?0:c,d=arguments.length<4?0:d,e=arguments.length<5?a.length:e;if(e===d)return;if(b.length===0||a.length===0)return;return e>a.length&&(e=a.length),b.length-c<e-d&&(e=b.length-c+start),a.buffer!==b.buffer?f(a,b,c,d,e):g(a,b,c,d,e)}function f(a,b,c,d,e){var f=e-d+c;for(var g=c,h=d;g<f;++g,++h)b[g]=a[h]}function g(a,b,c,e,f){var g=f+e,h=new Uint8Array(d.call(a,e,g)),i=0;for(;e<g;++e,++i)b[c++]=h[i]}b.exports=e;var d=[].slice},{}],8:[function(a,b,c){b.exports=function(a){return new Uint8Array(a)}},{}],9:[function(a,b,c){function f(a,b){return Array.isArray(a)?new Uint8Array(a):e[b||"utf8"](a)}function g(a){var b=a.length/2,c=new Uint8Array(b),d="";for(var e=0,f=a.length;e<f;++e)d+=a.charAt(e),e>0&&e%2===1&&(c[e>>>1]=parseInt(d,16),d="");return c}function h(a){var b=[],c,d;for(var e=0,f=a.length;e<f;++e){d=a.charCodeAt(e);if(d&128){c=encodeURIComponent(a.charAt(e)).substr(1).split("%");for(var g=0,h=c.length;g<h;++g)b[b.length]=parseInt(c[g],16)}else b[b.length]=d}return new Uint8Array(b)}function i(a){return new Uint8Array(d.toByteArray(a))}b.exports=f;var d=a("base64-js"),e={hex:g,utf8:h,base64:i}},{"base64-js":5}],10:[function(a,b,c){b.exports=function(a){return a instanceof Uint8Array}},{}],11:[function(a,b,c){function d(a,b){if(!a.length)return new Uint8Array(0);var c=b!==undefined?b:e(a),d=new Uint8Array(c),f=a[0],g=f.length,h=0,i=0,j=0;while(j<c){if(i===g){i=0,++h,f=a[h],g=f&&f.length;continue}d[j++]=f[i++]}return d}function e(a){var b=0;for(var c=0,d=a.length;c<d;++c)b+=a[c].byteLength;return b}b.exports=d},{}],12:[function(a,b,c){function f(a){return new DataView(a.buffer,0)}function g(a){var b=e.get(a.buffer);return b||e.set(a.buffer,b=new DataView(a.buffer,0)),b}var d,e;b.exports=d={},e=typeof WeakMap=="undefined"?null:new WeakMap,d.get=e?g:f},{}],13:[function(a,b,c){function e(a,b){return a[b]}function f(a,b){var c=a[b];return c<128?c:c-256}function g(a,b){var c=d.get(a);return c.getUint16(b+a.byteOffset,!0)}function h(a,b){var c=d.get(a);return c.getUint32(b+a.byteOffset,!0)}function i(a,b){var c=d.get(a);return c.getInt16(b+a.byteOffset,!0)}function j(a,b){var c=d.get(a);return c.getInt32(b+a.byteOffset,!0)}function k(a,b){var c=d.get(a);return c.getFloat32(b+a.byteOffset,!0)}function l(a,b){var c=d.get(a);return c.getFloat64(b+a.byteOffset,!0)}function m(a,b){var c=d.get(a);return c.getUint16(b+a.byteOffset,!1)}function n(a,b){var c=d.get(a);return c.getUint32(b+a.byteOffset,!1)}function o(a,b){var c=d.get(a);return c.getInt16(b+a.byteOffset,!1)}function p(a,b){var c=d.get(a);return c.getInt32(b+a.byteOffset,!1)}function q(a,b){var c=d.get(a);return c.getFloat32(b+a.byteOffset,!1)}function r(a,b){var c=d.get(a);return c.getFloat64(b+a.byteOffset,!1)}b.exports={readUInt8:e,readInt8:f,readUInt16LE:g,readUInt32LE:h,readInt16LE:i,readInt32LE:j,readFloatLE:k,readDoubleLE:l,readUInt16BE:m,readUInt32BE:n,readInt16BE:o,readInt32BE:p,readFloatBE:q,readDoubleBE:r};var d=a("./mapped.js")},{"./mapped.js":12}],14:[function(a,b,c){function d(a,b,c){return a.subarray(b||0,c||a.length)}b.exports=d},{}],15:[function(a,b,c){function g(a,b){return f[b||"utf8"](a)}function h(a){var b="",c;for(var d=0,e=a.length;d<e;++d)c=a[d],b+=((c&240)>>>4).toString(16),b+=(c&15).toString(16);return b}function i(a){return e(a)}function j(a){return d.fromByteArray(a)}b.exports=g;var d=a("base64-js"),e=a("to-utf8"),f={hex:h,utf8:i,base64:j}},{"base64-js":5,"to-utf8":6}],16:[function(a,b,c){function e(a,b,c){return a[c]=b}function f(a,b,c){return a[c]=b<0?b+256:b}function g(a,b,c){var e=d.get(a);return e.setUint16(c+a.byteOffset,b,!0)}function h(a,b,c){var e=d.get(a);return e.setUint32(c+a.byteOffset,b,!0)}function i(a,b,c){var e=d.get(a);return e.setInt16(c+a.byteOffset,b,!0)}function j(a,b,c){var e=d.get(a);return e.setInt32(c+a.byteOffset,b,!0)}function k(a,b,c){var e=d.get(a);return e.setFloat32(c+a.byteOffset,b,!0)}function l(a,b,c){var e=d.get(a);return e.setFloat64(c+a.byteOffset,b,!0)}function m(a,b,c){var e=d.get(a);return e.setUint16(c+a.byteOffset,b,!1)}function n(a,b,c){var e=d.get(a);return e.setUint32(c+a.byteOffset,b,!1)}function o(a,b,c){var e=d.get(a);return e.setInt16(c+a.byteOffset,b,!1)}function p(a,b,c){var e=d.get(a);return e.setInt32(c+a.byteOffset,b,!1)}function q(a,b,c){var e=d.get(a);return e.setFloat32(c+a.byteOffset,b,!1)}function r(a,b,c){var e=d.get(a);return e.setFloat64(c+a.byteOffset,b,!1)}b.exports={writeUInt8:e,writeInt8:f,writeUInt16LE:g,writeUInt32LE:h,writeInt16LE:i,writeInt32LE:j,writeFloatLE:k,writeDoubleLE:l,writeUInt16BE:m,writeUInt32BE:n,writeInt16BE:o,writeInt32BE:p,writeFloatBE:q,writeDoubleBE:r};var d=a("./mapped.js")},{"./mapped.js":12}],17:[function(a,b,c){var d=a("./lib/qrcode-draw.js");typeof window!="undefined"&&(window.qrcodelib=window.QRCodeLib=d,d.qrcodedraw=d.QRCodeDraw)},{"./lib/qrcode-draw.js":2}]},{},[17]);
(function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var j=typeof require=="function"&&require;if(!h&&j)return j(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}var f=typeof require=="function"&&require;for(var g=0;g<d.length;g++)e(d[g]);return e})({1:[function(a,b,c){c.QRCapacityTable=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]]},{}],2:[function(a,b,c){function h(){}var d=a("bops"),e=a("./qrcode.js"),f=a("./qrcapacitytable.js").QRCapacityTable,g=e.QRCode;c.QRCodeDraw=h,c.QRVersionCapacityTable=f,c.QRErrorCorrectLevel=e.QRErrorCorrectLevel,c.QRCode=e.QRCode,h.prototype={scale:4,defaultMargin:20,marginScaleFactor:5,Array:typeof Uint32Array=="undefined"?Uint32Array:Array,errorBehavior:{length:"trim"},color:{dark:"black",light:"white"},defaultErrorCorrectLevel:e.QRErrorCorrectLevel.H,QRErrorCorrectLevel:e.QRErrorCorrectLevel,draw:function(a,b,c,d){var f,g,h,i=Array.prototype.slice.call(arguments);d=i.pop(),a=i.shift(),b=i.shift(),c=i.shift()||{};if(typeof d!="function")throw new Error("callback required");typeof c!="object"&&(c.errorCorrectLevel=c),this.QRVersion(b,c.errorCorrectLevel||this.QRErrorCorrectLevel.H,c.version,function(a,c,d,e){b=c,f=d,g=a,h=e}),this.scale=c.scale||this.scale,this.margin=typeof c.margin=="undefined"?this.defaultMargin:c.margin;if(!f){d(g,a);return}try{var j=new e.QRCode(f,h),k=this.scale||4,l=a.getContext("2d"),m=0;j.addData(b),j.make();var n=this.marginWidth(),o=n;m=this.dataWidth(j)+n*2,this.resetCanvas(a,l,m);for(var p=0,q=j.getModuleCount();p<q;p++){var r=n;for(var s=0,t=j.getModuleCount();s<t;s++)j.isDark(p,s)?(l.fillStyle=this.color.dark,l.fillRect(r,o,k,k)):this.color.light&&(l.fillStyle=this.color.light,l.fillRect(r,o,k,k)),r+=k;o+=k}}catch(u){g=u}d(g,a,m)},drawBitArray:function(a){var b=Array.prototype.slice.call(arguments),c=b.pop(),a=b.shift(),d=b.shift()||{};if(typeof c!="function")throw new Error("callback required as last argument");this.QRVersion(a,d.errorCorrectLevel,d.version,function(b,c,d,e){a=c,level=d,error=b,errorCorrectLevel=e});if(!level){c(error,[],0);return}try{var f=new e.QRCode(level,errorCorrectLevel),g=this.scale||4,h=0,i,j=0,k=0;f.addData(a),f.make(),h=this.dataWidth(f,1),i=new this.Array(h*h);for(var l=0,m=f.getModuleCount();l<m;l++)for(var n=0,o=f.getModuleCount();n<o;n++)f.isDark(l,n)?i[j]=1:i[j]=0,j++}catch(p){error=p,console.log(p.stack)}c(error,i,h)},QRVersion:function(a,b,c,e){var g=d.from(a).length,h,b=this.QRErrorCorrectLevel[b]||this.defaultErrorCorrectLevel,i=[1,0,3,2],j=["L","M","Q","H"],k=0,l=!1;typeof c!="undefined"&&c!==null&&(l=!0);if(l)k=f[c][i[b]];else{for(var m=0,n=f.length;m<n;m++){k=f[m][i[b]];if(g<f[m][i[b]]){c=m+1;break}}c||(c=f.length-1)}return k<g&&(this.errorBehavior.length=="trim"?(a=a.substr(0,k),level=f.length):h=new Error("input string too long for error correction "+j[i[b]]+" max length "+k+" for qrcode version "+c)),e&&e(h,a,c,b),c},marginWidth:function(){var a=this.margin;return this.scale=this.scale||4,this.scale*this.marginScaleFactor>a&&a>0&&(a=this.scale*this.marginScaleFactor),a},dataWidth:function(a,b){return a.getModuleCount()*(b||this.scale||4)},resetCanvas:function(a,b,c){b.clearRect(0,0,a.width,a.height),a.style||(a.style={}),a.style.height=a.height=c,a.style.width=a.width=c,this.color.light?(b.fillStyle=this.color.light,b.fillRect(0,0,a.width,a.height)):b.clearRect(0,0,a.width,a.height)}}},{"./qrcapacitytable.js":1,"./qrcode.js":3,bops:4}],3:[function(a,b,c){function f(a,b){this.typeNumber=a,this.errorCorrectLevel=b,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=new e}function g(a){this.mode=h.MODE_8BIT_BYTE,this.data=a;var b=[];this.parsedData=d.from(a)}function n(a,b){if(a.length==undefined)throw new Error(a.length+"/"+b);var c=0;while(c<a.length&&a[c]==0)c++;this.num=new Array(a.length-c+b);for(var d=0;d<a.length-c;d++)this.num[d]=a[d+c]}function o(a,b){this.totalCount=a,this.dataCount=b}function p(){this.buffer=new Array,this.length=0}var d=a("bops");c.QRCode=f;var e=typeof Uint32Array=="undefined"?Uint32Array:Array;f.prototype={addData:function(a){var b=new g(a);this.dataList.push(b),this.dataCache=null},isDark:function(a,b){if(a<0||this.moduleCount<=a||b<0||this.moduleCount<=b)throw new Error(a+","+b);return this.modules[a][b]},getModuleCount:function(){return this.moduleCount},make:function(){this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(a,b){this.moduleCount=this.typeNumber*4+17,this.modules=new e(this.moduleCount);for(var c=0;c<this.moduleCount;c++){this.modules[c]=new e(this.moduleCount);for(var d=0;d<this.moduleCount;d++)this.modules[c][d]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(a,b),this.typeNumber>=7&&this.setupTypeNumber(a),this.dataCache==null&&(this.dataCache=f.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,b)},setupPositionProbePattern:function(a,b){for(var c=-1;c<=7;c++){if(a+c<=-1||this.moduleCount<=a+c)continue;for(var d=-1;d<=7;d++){if(b+d<=-1||this.moduleCount<=b+d)continue;0<=c&&c<=6&&(d==0||d==6)||0<=d&&d<=6&&(c==0||c==6)||2<=c&&c<=4&&2<=d&&d<=4?this.modules[a+c][b+d]=!0:this.modules[a+c][b+d]=!1}}},getBestMaskPattern:function(){var a=0,b=0;for(var c=0;c<8;c++){this.makeImpl(!0,c);var d=k.getLostPoint(this);if(c==0||a>d)a=d,b=c}return b},setupTimingPattern:function(){for(var a=8;a<this.moduleCount-8;a++){if(this.modules[a][6]!=null)continue;this.modules[a][6]=a%2==0}for(var b=8;b<this.moduleCount-8;b++){if(this.modules[6][b]!=null)continue;this.modules[6][b]=b%2==0}},setupPositionAdjustPattern:function(){var a=k.getPatternPosition(this.typeNumber);a=a||"";for(var b=0;b<a.length;b++)for(var c=0;c<a.length;c++){var d=a[b],e=a[c];if(this.modules[d][e]!=null)continue;for(var f=-2;f<=2;f++)for(var g=-2;g<=2;g++)f==-2||f==2||g==-2||g==2||f==0&&g==0?this.modules[d+f][e+g]=!0:this.modules[d+f][e+g]=!1}},setupTypeNumber:function(a){var b=k.getBCHTypeNumber(this.typeNumber);for(var c=0;c<18;c++){var d=!a&&(b>>c&1)==1;this.modules[Math.floor(c/3)][c%3+this.moduleCount-8-3]=d}for(var c=0;c<18;c++){var d=!a&&(b>>c&1)==1;this.modules[c%3+this.moduleCount-8-3][Math.floor(c/3)]=d}},setupTypeInfo:function(a,b){var c=this.errorCorrectLevel<<3|b,d=k.getBCHTypeInfo(c);for(var e=0;e<15;e++){var f=!a&&(d>>e&1)==1;e<6?this.modules[e][8]=f:e<8?this.modules[e+1][8]=f:this.modules[this.moduleCount-15+e][8]=f}for(var e=0;e<15;e++){var f=!a&&(d>>e&1)==1;e<8?this.modules[8][this.moduleCount-e-1]=f:e<9?this.modules[8][15-e-1+1]=f:this.modules[8][15-e-1]=f}this.modules[this.moduleCount-8][8]=!a},mapData:function(a,b){var c=-1,d=this.moduleCount-1,e=7,f=0;for(var g=this.moduleCount-1;g>0;g-=2){g==6&&g--;for(;;){for(var h=0;h<2;h++)if(this.modules[d][g-h]==null){var i=!1;f<a.length&&(i=(a[f]>>>e&1)==1);var j=k.getMask(b,d,g-h);j&&(i=!i),this.modules[d][g-h]=i,e--,e==-1&&(f++,e=7)}d+=c;if(d<0||this.moduleCount<=d){d-=c,c=-c;break}}}}},f.PAD0=236,f.PAD1=17,f.createData=function(a,b,c){var d=o.getRSBlocks(a,b),e=new p;for(var g=0;g<c.length;g++){var h=c[g];e.put(h.mode,4),e.put(h.getLength(),k.getLengthInBits(h.mode,a)),h.write(e)}var i=0;for(var g=0;g<d.length;g++)i+=d[g].dataCount;if(e.getLengthInBits()>i*8)throw new Error("code length overflow. ("+e.getLengthInBits()+">"+i*8+")");e.getLengthInBits()+4<=i*8&&e.put(0,4);while(e.getLengthInBits()%8!=0)e.putBit(!1);for(;;){if(e.getLengthInBits()>=i*8)break;e.put(f.PAD0,8);if(e.getLengthInBits()>=i*8)break;e.put(f.PAD1,8)}return f.createBytes(e,d)},f.createBytes=function(a,b){var c=0,d=0,f=0,g=new e(b.length),h=new e(b.length);for(var i=0;i<b.length;i++){var j=b[i].dataCount,l=b[i].totalCount-j;d=Math.max(d,j),f=Math.max(f,l),g[i]=new e(j);for(var m=0;m<g[i].length;m++)g[i][m]=255&a.buffer[m+c];c+=j;var o=k.getErrorCorrectPolynomial(l),p=new n(g[i],o.getLength()-1),q=p.mod(o);h[i]=new e(o.getLength()-1);for(var m=0;m<h[i].length;m++){var r=m+q.getLength()-h[i].length;h[i][m]=r>=0?q.get(r):0}}var s=0;for(var m=0;m<b.length;m++)s+=b[m].totalCount;var t=new e(s),u=0;for(var m=0;m<d;m++)for(var i=0;i<b.length;i++)m<g[i].length&&(t[u++]=g[i][m]);for(var m=0;m<f;m++)for(var i=0;i<b.length;i++)m<h[i].length&&(t[u++]=h[i][m]);return t},g.prototype={getLength:function(a){return this.parsedData.length},write:function(a){for(var b=0,c=this.parsedData.length;b<c;b++)a.put(this.parsedData[b],8)}};var h={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},i=c.QRErrorCorrectLevel={L:1,M:0,Q:3,H:2},j={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},k={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(a){var b=a<<10;while(k.getBCHDigit(b)-k.getBCHDigit(k.G15)>=0)b^=k.G15<<k.getBCHDigit(b)-k.getBCHDigit(k.G15);return(a<<10|b)^k.G15_MASK},getBCHTypeNumber:function(a){var b=a<<12;while(k.getBCHDigit(b)-k.getBCHDigit(k.G18)>=0)b^=k.G18<<k.getBCHDigit(b)-k.getBCHDigit(k.G18);return a<<12|b},getBCHDigit:function(a){var b=0;while(a!=0)b++,a>>>=1;return b},getPatternPosition:function(a){return k.PATTERN_POSITION_TABLE[a-1]},getMask:function(a,b,c){switch(a){case j.PATTERN000:return(b+c)%2==0;case j.PATTERN001:return b%2==0;case j.PATTERN010:return c%3==0;case j.PATTERN011:return(b+c)%3==0;case j.PATTERN100:return(Math.floor(b/2)+Math.floor(c/3))%2==0;case j.PATTERN101:return b*c%2+b*c%3==0;case j.PATTERN110:return(b*c%2+b*c%3)%2==0;case j.PATTERN111:return(b*c%3+(b+c)%2)%2==0;default:throw new Error("bad maskPattern:"+a)}},getErrorCorrectPolynomial:function(a){var b=new n([1],0);for(var c=0;c<a;c++)b=b.multiply(new n([1,l.gexp(c)],0));return b},getLengthInBits:function(a,b){if(1<=b&&b<10)switch(a){case h.MODE_NUMBER:return 10;case h.MODE_ALPHA_NUM:return 9;case h.MODE_8BIT_BYTE:return 8;case h.MODE_KANJI:return 8;default:throw new Error("mode:"+a)}else if(b<27)switch(a){case h.MODE_NUMBER:return 12;case h.MODE_ALPHA_NUM:return 11;case h.MODE_8BIT_BYTE:return 16;case h.MODE_KANJI:return 10;default:throw new Error("mode:"+a)}else{if(!(b<41))throw new Error("type:"+b);switch(a){case h.MODE_NUMBER:return 14;case h.MODE_ALPHA_NUM:return 13;case h.MODE_8BIT_BYTE:return 16;case h.MODE_KANJI:return 12;default:throw new Error("mode:"+a)}}},getLostPoint:function(a){var b=a.getModuleCount(),c=0;for(var d=0;d<b;d++)for(var e=0;e<b;e++){var f=0,g=a.isDark(d,e);for(var h=-1;h<=1;h++){if(d+h<0||b<=d+h)continue;for(var i=-1;i<=1;i++){if(e+i<0||b<=e+i)continue;if(h==0&&i==0)continue;g==a.isDark(d+h,e+i)&&f++}}f>5&&(c+=3+f-5)}for(var d=0;d<b-1;d++)for(var e=0;e<b-1;e++){var j=0;a.isDark(d,e)&&j++,a.isDark(d+1,e)&&j++,a.isDark(d,e+1)&&j++,a.isDark(d+1,e+1)&&j++;if(j==0||j==4)c+=3}for(var d=0;d<b;d++)for(var e=0;e<b-6;e++)a.isDark(d,e)&&!a.isDark(d,e+1)&&a.isDark(d,e+2)&&a.isDark(d,e+3)&&a.isDark(d,e+4)&&!a.isDark(d,e+5)&&a.isDark(d,e+6)&&(c+=40);for(var e=0;e<b;e++)for(var d=0;d<b-6;d++)a.isDark(d,e)&&!a.isDark(d+1,e)&&a.isDark(d+2,e)&&a.isDark(d+3,e)&&a.isDark(d+4,e)&&!a.isDark(d+5,e)&&a.isDark(d+6,e)&&(c+=40);var k=0;for(var e=0;e<b;e++)for(var d=0;d<b;d++)a.isDark(d,e)&&k++;var l=Math.abs(100*k/b/b-50)/5;return c+=l*10,c}},l={glog:function(a){if(a<1)throw new Error("glog("+a+")");return l.LOG_TABLE[a]},gexp:function(a){while(a<0)a+=255;while(a>=256)a-=255;return l.EXP_TABLE[a]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(var m=0;m<8;m++)l.EXP_TABLE[m]=1<<m;for(var m=8;m<256;m++)l.EXP_TABLE[m]=l.EXP_TABLE[m-4]^l.EXP_TABLE[m-5]^l.EXP_TABLE[m-6]^l.EXP_TABLE[m-8];for(var m=0;m<255;m++)l.LOG_TABLE[l.EXP_TABLE[m]]=m;n.prototype={get:function(a){return this.num[a]},getLength:function(){return this.num.length},multiply:function(a){var b=new Array(this.getLength()+a.getLength()-1);for(var c=0;c<this.getLength();c++)for(var d=0;d<a.getLength();d++)b[c+d]^=l.gexp(l.glog(this.get(c))+l.glog(a.get(d)));return new n(b,0)},mod:function(a){if(this.getLength()-a.getLength()<0)return this;var b=l.glog(this.get(0))-l.glog(a.get(0)),c=new Array(this.getLength());for(var d=0;d<this.getLength();d++)c[d]=this.get(d);for(var d=0;d<a.getLength();d++)c[d]^=l.gexp(l.glog(a.get(d))+b);return(new n(c,0)).mod(a)}},o.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12,7,37,13],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],o.getRSBlocks=function(a,b){var c=o.getRsBlockTable(a,b);if(c==undefined)throw new Error("bad rs block @ typeNumber:"+a+"/errorCorrectLevel:"+b);var d=c.length/3,e=new Array;for(var f=0;f<d;f++){var g=c[f*3+0],h=c[f*3+1],i=c[f*3+2];for(var j=0;j<g;j++)e.push(new o(h,i))}return e},o.getRsBlockTable=function(a,b){switch(b){case i.L:return o.RS_BLOCK_TABLE[(a-1)*4+0];case i.M:return o.RS_BLOCK_TABLE[(a-1)*4+1];case i.Q:return o.RS_BLOCK_TABLE[(a-1)*4+2];case i.H:return o.RS_BLOCK_TABLE[(a-1)*4+3];default:return undefined}},p.prototype={get:function(a){var b=Math.floor(a/8);return(this.buffer[b]>>>7-a%8&1)==1},put:function(a,b){for(var c=0;c<b;c++)this.putBit((a>>>b-c-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(a){var b=Math.floor(this.length/8);this.buffer.length<=b&&this.buffer.push(0),a&&(this.buffer[b]|=128>>>this.length%8),this.length++}}},{bops:4}],4:[function(a,b,c){function e(a,b){for(var c in a)b[c]=a[c]}var d={};b.exports=d,d.from=a("./from.js"),d.to=a("./to.js"),d.is=a("./is.js"),d.subarray=a("./subarray.js"),d.join=a("./join.js"),d.copy=a("./copy.js"),d.create=a("./create.js"),e(a("./read.js"),d),e(a("./write.js"),d)},{"./copy.js":7,"./create.js":8,"./from.js":9,"./is.js":10,"./join.js":11,"./read.js":13,"./subarray.js":14,"./to.js":15,"./write.js":16}],5:[function(a,b,c){(function(a){function d(a){var b,d,e,f,g,h;if(a.length%4>0)throw"Invalid string. Length must be a multiple of 4";g=a.indexOf("="),g=g>0?a.length-g:0,h=[],e=g>0?a.length-4:a.length;for(b=0,d=0;b<e;b+=4,d+=3)f=c.indexOf(a[b])<<18|c.indexOf(a[b+1])<<12|c.indexOf(a[b+2])<<6|c.indexOf(a[b+3]),h.push((f&16711680)>>16),h.push((f&65280)>>8),h.push(f&255);return g===2?(f=c.indexOf(a[b])<<2|c.indexOf(a[b+1])>>4,h.push(f&255)):g===1&&(f=c.indexOf(a[b])<<10|c.indexOf(a[b+1])<<4|c.indexOf(a[b+2])>>2,h.push(f>>8&255),h.push(f&255)),h}function e(a){function h(a){return c[a>>18&63]+c[a>>12&63]+c[a>>6&63]+c[a&63]}var b,d=a.length%3,e="",f,g;for(b=0,g=a.length-d;b<g;b+=3)f=(a[b]<<16)+(a[b+1]<<8)+a[b+2],e+=h(f);switch(d){case 1:f=a[a.length-1],e+=c[f>>2],e+=c[f<<4&63],e+="==";break;case 2:f=(a[a.length-2]<<8)+a[a.length-1],e+=c[f>>10],e+=c[f>>4&63],e+=c[f<<2&63],e+="="}return e}"use strict";var c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";b.exports.toByteArray=d,b.exports.fromByteArray=e})()},{}],6:[function(a,b,c){function i(a,b,c){b=b===undefined?0:b,c=c===undefined?a.length:c;var g=0,i=128,l=0,m,n;e.length=d.length=0;while(g<a.length)n=a[g],!l&&n&i?(m=j(n),l+=m,m<8&&(e[e.length]=n&h[6-m])):l?(e[e.length]=n&h[6],--l,!l&&e.length&&(d[d.length]=f(k(e,m)),e.length=0)):d[d.length]=f(n),++g;return e.length&&!l&&(d[d.length]=f(k(e,m)),e.length=0),d.join("")}function j(a){for(var b=0;b<7;++b)if(!(a&g[b]))break;return b}function k(a){var b=0;for(var c=0,d=a.length;c<d;++c)b|=a[c]<<(d-c-1)*6;return b}b.exports=i;var d=[],e=[],f=String.fromCharCode,g=[64,32,16,8,4,2,1],h=[0,1,3,7,15,31,63,127]},{}],7:[function(a,b,c){function e(a,b,c,d,e){c=arguments.length<3?0:c,d=arguments.length<4?0:d,e=arguments.length<5?a.length:e;if(e===d)return;if(b.length===0||a.length===0)return;return e>a.length&&(e=a.length),b.length-c<e-d&&(e=b.length-c+start),a.buffer!==b.buffer?f(a,b,c,d,e):g(a,b,c,d,e)}function f(a,b,c,d,e){var f=e-d+c;for(var g=c,h=d;g<f;++g,++h)b[g]=a[h]}function g(a,b,c,e,f){var g=f+e,h=new Uint8Array(d.call(a,e,g)),i=0;for(;e<g;++e,++i)b[c++]=h[i]}b.exports=e;var d=[].slice},{}],8:[function(a,b,c){b.exports=function(a){return new Uint8Array(a)}},{}],9:[function(a,b,c){function f(a,b){return Array.isArray(a)?new Uint8Array(a):e[b||"utf8"](a)}function g(a){var b=a.length/2,c=new Uint8Array(b),d="";for(var e=0,f=a.length;e<f;++e)d+=a.charAt(e),e>0&&e%2===1&&(c[e>>>1]=parseInt(d,16),d="");return c}function h(a){var b=[],c,d;for(var e=0,f=a.length;e<f;++e){d=a.charCodeAt(e);if(d&128){c=encodeURIComponent(a.charAt(e)).substr(1).split("%");for(var g=0,h=c.length;g<h;++g)b[b.length]=parseInt(c[g],16)}else b[b.length]=d}return new Uint8Array(b)}function i(a){return new Uint8Array(d.toByteArray(a))}b.exports=f;var d=a("base64-js"),e={hex:g,utf8:h,base64:i}},{"base64-js":5}],10:[function(a,b,c){b.exports=function(a){return a instanceof Uint8Array}},{}],11:[function(a,b,c){function d(a,b){if(!a.length)return new Uint8Array(0);var c=b!==undefined?b:e(a),d=new Uint8Array(c),f=a[0],g=f.length,h=0,i=0,j=0;while(j<c){if(i===g){i=0,++h,f=a[h],g=f&&f.length;continue}d[j++]=f[i++]}return d}function e(a){var b=0;for(var c=0,d=a.length;c<d;++c)b+=a[c].byteLength;return b}b.exports=d},{}],12:[function(a,b,c){function f(a){return new DataView(a.buffer,0)}function g(a){var b=e.get(a.buffer);return b||e.set(a.buffer,b=new DataView(a.buffer,0)),b}var d,e;b.exports=d={},e=typeof WeakMap=="undefined"?null:new WeakMap,d.get=e?g:f},{}],13:[function(a,b,c){function e(a,b){return a[b]}function f(a,b){var c=a[b];return c<128?c:c-256}function g(a,b){var c=d.get(a);return c.getUint16(b+a.byteOffset,!0)}function h(a,b){var c=d.get(a);return c.getUint32(b+a.byteOffset,!0)}function i(a,b){var c=d.get(a);return c.getInt16(b+a.byteOffset,!0)}function j(a,b){var c=d.get(a);return c.getInt32(b+a.byteOffset,!0)}function k(a,b){var c=d.get(a);return c.getFloat32(b+a.byteOffset,!0)}function l(a,b){var c=d.get(a);return c.getFloat64(b+a.byteOffset,!0)}function m(a,b){var c=d.get(a);return c.getUint16(b+a.byteOffset,!1)}function n(a,b){var c=d.get(a);return c.getUint32(b+a.byteOffset,!1)}function o(a,b){var c=d.get(a);return c.getInt16(b+a.byteOffset,!1)}function p(a,b){var c=d.get(a);return c.getInt32(b+a.byteOffset,!1)}function q(a,b){var c=d.get(a);return c.getFloat32(b+a.byteOffset,!1)}function r(a,b){var c=d.get(a);return c.getFloat64(b+a.byteOffset,!1)}b.exports={readUInt8:e,readInt8:f,readUInt16LE:g,readUInt32LE:h,readInt16LE:i,readInt32LE:j,readFloatLE:k,readDoubleLE:l,readUInt16BE:m,readUInt32BE:n,readInt16BE:o,readInt32BE:p,readFloatBE:q,readDoubleBE:r};var d=a("./mapped.js")},{"./mapped.js":12}],14:[function(a,b,c){function d(a,b,c){return a.subarray(b||0,c||a.length)}b.exports=d},{}],15:[function(a,b,c){function g(a,b){return f[b||"utf8"](a)}function h(a){var b="",c;for(var d=0,e=a.length;d<e;++d)c=a[d],b+=((c&240)>>>4).toString(16),b+=(c&15).toString(16);return b}function i(a){return e(a)}function j(a){return d.fromByteArray(a)}b.exports=g;var d=a("base64-js"),e=a("to-utf8"),f={hex:h,utf8:i,base64:j}},{"base64-js":5,"to-utf8":6}],16:[function(a,b,c){function e(a,b,c){return a[c]=b}function f(a,b,c){return a[c]=b<0?b+256:b}function g(a,b,c){var e=d.get(a);return e.setUint16(c+a.byteOffset,b,!0)}function h(a,b,c){var e=d.get(a);return e.setUint32(c+a.byteOffset,b,!0)}function i(a,b,c){var e=d.get(a);return e.setInt16(c+a.byteOffset,b,!0)}function j(a,b,c){var e=d.get(a);return e.setInt32(c+a.byteOffset,b,!0)}function k(a,b,c){var e=d.get(a);return e.setFloat32(c+a.byteOffset,b,!0)}function l(a,b,c){var e=d.get(a);return e.setFloat64(c+a.byteOffset,b,!0)}function m(a,b,c){var e=d.get(a);return e.setUint16(c+a.byteOffset,b,!1)}function n(a,b,c){var e=d.get(a);return e.setUint32(c+a.byteOffset,b,!1)}function o(a,b,c){var e=d.get(a);return e.setInt16(c+a.byteOffset,b,!1)}function p(a,b,c){var e=d.get(a);return e.setInt32(c+a.byteOffset,b,!1)}function q(a,b,c){var e=d.get(a);return e.setFloat32(c+a.byteOffset,b,!1)}function r(a,b,c){var e=d.get(a);return e.setFloat64(c+a.byteOffset,b,!1)}b.exports={writeUInt8:e,writeInt8:f,writeUInt16LE:g,writeUInt32LE:h,writeInt16LE:i,writeInt32LE:j,writeFloatLE:k,writeDoubleLE:l,writeUInt16BE:m,writeUInt32BE:n,writeInt16BE:o,writeInt32BE:p,writeFloatBE:q,writeDoubleBE:r};var d=a("./mapped.js")},{"./mapped.js":12}],17:[function(a,b,c){var d=a("./lib/qrcode-draw.js");typeof window!="undefined"&&(window.qrcodelib=window.QRCodeLib=d,d.qrcodedraw=d.QRCodeDraw)},{"./lib/qrcode-draw.js":2}]},{},[17]);

@@ -130,3 +130,2 @@ /*

text = args.shift(),
errorCorrectLevel = args.shift(),
options = args.shift() || {};

@@ -140,16 +139,8 @@

}
cb = arguments[arguments.length-1];
if(arguments.length > 2){
errorCorrectLevel = arguments[2];
}
//this interface kinda sucks - there is very small likelyhood of this ever being async
this.QRVersion(text,errorCorrectLevel,(options||{}).version,function(e,t,l,ec){
this.QRVersion(text,options.errorCorrectLevel,options.version,function(e,t,l,ec){
text = t,level = l,error = e,errorCorrectLevel = ec;
});
if(!level) {

@@ -156,0 +147,0 @@ //if we are unable to find an appropriate qr level error out

{
"name": "qrcode",
"description": "QRCode / 2d Barcode api with both server side and client side support using canvas",
"version": "0.2.12",
"version": "0.3.0",
"author": "Ryan Day <soldair@gmail.com>",

@@ -12,2 +12,3 @@ "keywords": [

"main": "./qrcode.js",
"browser":"./lib/qrcode-draw.js",
"homepage": "http://github.com/soldair/node-qrcode",

@@ -14,0 +15,0 @@ "scripts": {

@@ -47,2 +47,12 @@ /*

var parseOptions = function(options) {
var textKeys = {'minimum':"L",'medium':"M",'high':"Q",'max':"H"}
if(options.errorCorrectLevel) {
var ec = options.errorCorrectLevel;
if(textKeys[ec]){
options.errorCorrectLevel = textKeys[ec];
}
}
return options;
};

@@ -63,12 +73,4 @@ // returns Canvas Object with qr code drawn on it

options = args.shift()||{};
var textKeys = {'minimum':"L",'medium':"M",'high':"Q",'max':"H"}
if(options.errorCorrectLevel) {
var ec = options.errorCorrectLevel;
if(textKeys[ec]){
options.errorCorrectLevel = textKeys[ec];
}
}
options=parseOptions(options);
//-------------^^^^^^^^^
//NOTE the width and height are determined from within the qr code lib and are not configurable from the outside yet

@@ -173,5 +175,6 @@

}
options = parseOptions(options);
var drawInstance = new QRCodeDraw();
drawInstance.drawBitArray(text,function(error,bits,width){
drawInstance.drawBitArray(text,options,function(error,bits,width){
cb(error,bits,width);

@@ -178,0 +181,0 @@ });

@@ -18,36 +18,36 @@ [![Build Status](https://secure.travis-ci.org/soldair/node-qrcode.png)](http://travis-ci.org/soldair/node-qrcode)

A simple server side test...
var QRCode = require('qrcode');
```javascript
var QRCode = require('qrcode');
QRCode.toDataURL('i am a pony!',function(err,url){
console.log(url);
});
QRCode.toDataURL('i am a pony!',function(err,url){
console.log(url);
});
```
In your terminal if you install globally...
```shell
qrcode "hi i want a qrcode"
qrcode "hi i want a qrcode"
qrcode "i like to save qrs to file" qr.png
qrcode "i like to save qrs to file" qr.png
```
In client side HTML...
```html
<!--[if ie]><script type="text/javascript" src="/vendors/excanvas/excanvas.js"></script><![endif]-->
<script src="/build/qrcode.js"></script>
<canvas id="test"></canvas>
<script>
<!--[if ie]><script type="text/javascript" src="/vendors/excanvas/excanvas.js"></script><![endif]-->
<script src="/build/qrcode.js"></script>
<canvas id="test"></canvas>
<script>
var qrcodedraw = new QRCodeLib.QRCodeDraw();
qrcodedraw.draw(document.getElementById('test'),"this text will be in the code!", function(error,canvas){
if(error){
return console.log('Error =( ',error);
}
console.log('success!');
});
</script>
var qrcodedraw = new QRCodeLib.QRCodeDraw();
qrcodedraw.draw(document.getElementById('test'),"this text will be in the code!", function(error,canvas){
if(error){
return console.log('Error =( ',error);
}
console.log('success!');
});
</script>
```

@@ -58,16 +58,21 @@ Remember to put `excanvas.js` and `qrcode.js` somewhere where your browser can find them.

---
QRCode.draw(text, [optional options], cb(error,canvas));
```javascript
QRCode.draw(text, [optional options], cb(error,canvas));
```
Returns a node canvas object see https://github.com/LearnBoost/node-canvas for all of the cool node things you can do. Look up the canvas api for the other cool things.
QRCode.toDataURL(text, [optional options], cb(error,dataURL));
```javascript
QRCode.toDataURL(text, [optional options], cb(error,dataURL));
```
Returns mime image/png data url for the 2d barcode.
QRCode.save(path, text, [optional options] , cb(error,written));
```javascript
QRCode.save(path, text, [optional options] , cb(error,written));
```
Saves png to the path specified returns bytes written.
QRCode.drawText(text, [optional options],cb)
```javascript
QRCode.drawText(text, [optional options],cb)
```
Returns an ascii representation of the qrcode using unicode characters and ansi control codes for background control.
QRCode.drawBitArray(text, [optional options], cb(error,bits,width));
```javascript
QRCode.drawBitArray(text, [optional options], cb(error,bits,width));
```
Returns an array with each value being either 0 light or 1 dark and the width of each row.

@@ -79,5 +84,5 @@ This is enough info to render a qrcode any way you want. =)

---------
errorCorrectLevel
```javascript
errorCorrectLevel
```
Can be one of the values in `qrcode.errorCorrectLevel`.

@@ -90,16 +95,16 @@ Can be a string. one of `"minimum","medium","high","max"`.

---------------
window.qrcodelib
```javascript
window.qrcodelib
```
`qrcodelib.qrcodedraw()` Constructor
```javascript
qrcode = new qrcodelib.qrcodedraw()
qrcode.draw(canvasElement,text,[optional options],cb);
```
qrcode = new qrcodelib.qrcodedraw()
qrcode.draw(canvasElement,text,[optional options],cb);
For quick client side use...
node test/clientsideserver.js
open http://localhost:3031
```shell
node test/clientsideserver.js
open http://localhost:3031
```
The JavaScript is in `test/clientside.html`.

@@ -121,3 +126,3 @@

```js
```javascript
// so use the byte length

@@ -135,12 +140,15 @@ (new Buffer(str)).length

--
npm install qrcode
```shell
npm install qrcode
```
To use qrcode from the command line to save qrcode images or generate ones you can view in your terminal...
npm install -g qrcode
```shell
npm install -g qrcode
```
`node-canvas` is a native module and requires dev packages of `cairo` and `pixman` to compile.
On ubuntu you can install them with `apt-get` and `npm install` will work great.
sudo apt-get install libpixman-1-dev libcairo2-dev
```shell
sudo apt-get install libpixman-1-dev libcairo2-dev
```
It is my higest priority for this module to use an all `js` png encoder and remove this dep.

@@ -152,5 +160,5 @@

These should be taken care of for you by npm but you should...
npm install canvas
```shell
npm install canvas
```
If `cairo` gives you trouble and you cannot install `canvas`, checkout the canvas site. I know @tjholowaychuk has setup a way to download and install a version of cairo/pixman for testing.

@@ -157,0 +165,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc