shadowsocks-manager
Version:
A shadowsocks manager tool for multi user and traffic control.
1 lines • 16.6 kB
JavaScript
!function(a){"object"==typeof exports?module.exports=a():"function"==typeof define&&define.amd?define(a):"undefined"!=typeof window?window.QRCode=a():"undefined"!=typeof global?global.QRCode=a():"undefined"!=typeof self&&(self.QRCode=a())}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b){function c(a){this.mode=d.MODE_ALPHA_NUM,this.data=a}var d=a("./QRMode.js");c.prototype.getCode=function(a){var b="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",c=b.indexOf(a);if(0>c)throw new Error("Invalid character: `"+a+"`");return c},c.prototype.getLength=function(){return this.data.length},c.prototype.write=function(a){for(var b=0;b<this.data.length;b++)this.data[b+1]?a.put(45*this.getCode(this.data[b])+this.getCode(this.data[b+1]),11):a.put(this.getCode(this.data[b]),6),b++},b.exports=c},{"./QRMode.js":9}],2:[function(a,b){function c(a){this.mode=d.MODE_NUMBER,this.data=a}var d=a("./QRMode.js");c.prototype.getCode=function(a){var b=parseInt(a,10);if(isNaN(b))throw new Error("Invalid character: `"+a+"`");return b},c.prototype.getBitLen=function(a){var b={3:10,2:7,1:4};return b[a]},c.prototype.getLength=function(){return this.data.length},c.prototype.write=function(a){for(var b=0;b<this.data.length;b++){var c=this.data[b];this.data[b+1]&&(c+=this.data[b+1]),this.data[b+2]&&(c+=this.data[b+2]);var d=this.getBitLen(c.length);a.put(this.getCode(c),d),b++,b++}},b.exports=c},{"./QRMode.js":9}],3:[function(a,b){function c(a){this.mode=d.MODE_8BIT_BYTE,this.data=a}var d=a("./QRMode.js");c.prototype.getCode=function(a){var b=a.charCodeAt(0);if(b>255)throw new Error("Invalid character: `"+a+"`");return b},c.prototype.getLength=function(){return this.data.length},c.prototype.write=function(a){for(var b=0;b<this.data.length;b++)a.put(this.getCode(this.data[b]),8)},b.exports=c},{"./QRMode.js":9}],4:[function(a,b){function c(){this.buffer=[],this.length=0}c.prototype.get=function(a){var b=Math.floor(a/8);return 1===(this.buffer[b]>>>7-a%8&1)},c.prototype.put=function(a,b){for(var c=0;b>c;c++)this.putBit(1===(a>>>b-c-1&1))},c.prototype.getLengthInBits=function(){return this.length},c.prototype.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++},b.exports=c},{}],5:[function(a,b){function c(a,b,c){this.typeNumber=a,this.errorCorrectLevel=b,this.inputMode=c,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}var d=a("./NUMBER.js"),e=a("./ALPHA_NUM.js"),f=a("./QR8bitByte.js"),g=a("./QRRSBlock.js"),h=a("./QRBitBuffer.js"),i=a("./QRUtil.js"),j=a("./QRPolynomial.js");c.prototype.addData=function(a){var b;b="NUMBER"===this.inputMode?new d(a):"ALPHA_NUM"===this.inputMode?new e(a):new f(a),this.dataList.push(b),this.dataCache=null},c.prototype.isDark=function(a,b){if(0>a||this.moduleCount<=a||0>b||this.moduleCount<=b)throw new Error(a+","+b);return this.modules[a][b]},c.prototype.getModuleCount=function(){return this.moduleCount},c.prototype.make=function(){var a;if(this.typeNumber<1){var b=1;for(b=1;40>b;b++){var c=g.getRSBlocks(b,this.errorCorrectLevel),d=new h,e=0;for(a=0;a<c.length;a++)e+=c[a].dataCount;for(a=0;a<this.dataList.length;a++){var f=this.dataList[a];d.put(f.mode,4),d.put(f.getLength(),i.getLengthInBits(f.mode,b)),f.write(d)}if(d.getLengthInBits()<=8*e)break}this.typeNumber=b}this.makeImpl(!1,this.getBestMaskPattern())},c.prototype.makeImpl=function(a,b){this.moduleCount=4*this.typeNumber+17,this.modules=new Array(this.moduleCount);for(var d=0;d<this.moduleCount;d++){this.modules[d]=new Array(this.moduleCount);for(var e=0;e<this.moduleCount;e++)this.modules[d][e]=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),null===this.dataCache&&(this.dataCache=c.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,b)},c.prototype.setupPositionProbePattern=function(a,b){for(var c=-1;7>=c;c++)if(!(-1>=a+c||this.moduleCount<=a+c))for(var d=-1;7>=d;d++)-1>=b+d||this.moduleCount<=b+d||(this.modules[a+c][b+d]=c>=0&&6>=c&&(0===d||6===d)||d>=0&&6>=d&&(0===c||6===c)||c>=2&&4>=c&&d>=2&&4>=d?!0:!1)},c.prototype.getBestMaskPattern=function(){for(var a=0,b=0,c=0;8>c;c++){this.makeImpl(!0,c);var d=i.getLostPoint(this);(0===c||a>d)&&(a=d,b=c)}return b},c.prototype.createMovieClip=function(a,b,c){var d=a.createEmptyMovieClip(b,c),e=1;this.make();for(var f=0;f<this.modules.length;f++)for(var g=f*e,h=0;h<this.modules[f].length;h++){var i=h*e,j=this.modules[f][h];j&&(d.beginFill(0,100),d.moveTo(i,g),d.lineTo(i+e,g),d.lineTo(i+e,g+e),d.lineTo(i,g+e),d.endFill())}return d},c.prototype.setupTimingPattern=function(){for(var a=8;a<this.moduleCount-8;a++)null===this.modules[a][6]&&(this.modules[a][6]=a%2===0);for(var b=8;b<this.moduleCount-8;b++)null===this.modules[6][b]&&(this.modules[6][b]=b%2===0)},c.prototype.setupPositionAdjustPattern=function(){for(var a=i.getPatternPosition(this.typeNumber),b=0;b<a.length;b++)for(var c=0;c<a.length;c++){var d=a[b],e=a[c];if(null===this.modules[d][e])for(var f=-2;2>=f;f++)for(var g=-2;2>=g;g++)this.modules[d+f][e+g]=-2===f||2===f||-2===g||2===g||0===f&&0===g?!0:!1}},c.prototype.setupTypeNumber=function(a){var b,c,d=i.getBCHTypeNumber(this.typeNumber);for(c=0;18>c;c++)b=!a&&1===(d>>c&1),this.modules[Math.floor(c/3)][c%3+this.moduleCount-8-3]=b;for(c=0;18>c;c++)b=!a&&1===(d>>c&1),this.modules[c%3+this.moduleCount-8-3][Math.floor(c/3)]=b},c.prototype.setupTypeInfo=function(a,b){var c,d,e=this.errorCorrectLevel<<3|b,f=i.getBCHTypeInfo(e);for(d=0;15>d;d++)c=!a&&1===(f>>d&1),6>d?this.modules[d][8]=c:8>d?this.modules[d+1][8]=c:this.modules[this.moduleCount-15+d][8]=c;for(d=0;15>d;d++)c=!a&&1===(f>>d&1),8>d?this.modules[8][this.moduleCount-d-1]=c:9>d?this.modules[8][15-d-1+1]=c:this.modules[8][15-d-1]=c;this.modules[this.moduleCount-8][8]=!a},c.prototype.mapData=function(a,b){for(var c=-1,d=this.moduleCount-1,e=7,f=0,g=this.moduleCount-1;g>0;g-=2)for(6===g&&g--;;){for(var h=0;2>h;h++)if(null===this.modules[d][g-h]){var j=!1;f<a.length&&(j=1===(a[f]>>>e&1));var k=i.getMask(b,d,g-h);k&&(j=!j),this.modules[d][g-h]=j,e--,-1===e&&(f++,e=7)}if(d+=c,0>d||this.moduleCount<=d){d-=c,c=-c;break}}},c.PAD0=236,c.PAD1=17,c.createData=function(a,b,d){var e,f=g.getRSBlocks(a,b),j=new h;for(e=0;e<d.length;e++){var k=d[e];j.put(k.mode,4),j.put(k.getLength(),i.getLengthInBits(k.mode,a)),k.write(j)}var l=0;for(e=0;e<f.length;e++)l+=f[e].dataCount;if(j.getLengthInBits()>8*l)throw new Error("code length overflow. ("+j.getLengthInBits()+">"+8*l+")");for(j.getLengthInBits()+4<=8*l&&j.put(0,4);j.getLengthInBits()%8!==0;)j.putBit(!1);for(;;){if(j.getLengthInBits()>=8*l)break;if(j.put(c.PAD0,8),j.getLengthInBits()>=8*l)break;j.put(c.PAD1,8)}return c.createBytes(j,f)},c.createBytes=function(a,b){var c,d,e=0,f=0,g=0,h=new Array(b.length),k=new Array(b.length);for(d=0;d<b.length;d++){var l=b[d].dataCount,m=b[d].totalCount-l;for(f=Math.max(f,l),g=Math.max(g,m),h[d]=new Array(l),c=0;c<h[d].length;c++)h[d][c]=255&a.buffer[c+e];e+=l;var n=i.getErrorCorrectPolynomial(m),o=new j(h[d],n.getLength()-1),p=o.mod(n);for(k[d]=new Array(n.getLength()-1),c=0;c<k[d].length;c++){var q=c+p.getLength()-k[d].length;k[d][c]=q>=0?p.get(q):0}}var r=0;for(c=0;c<b.length;c++)r+=b[c].totalCount;var s=new Array(r),t=0;for(c=0;f>c;c++)for(d=0;d<b.length;d++)c<h[d].length&&(s[t++]=h[d][c]);for(c=0;g>c;c++)for(d=0;d<b.length;d++)c<k[d].length&&(s[t++]=k[d][c]);return s},b.exports=c},{"./ALPHA_NUM.js":1,"./NUMBER.js":2,"./QR8bitByte.js":3,"./QRBitBuffer.js":4,"./QRPolynomial.js":10,"./QRRSBlock.js":11,"./QRUtil.js":12}],6:[function(a,b){var c={L:1,M:0,Q:3,H:2};b.exports=c},{}],7:[function(a,b){var c={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};b.exports=c},{}],8:[function(a,b){for(var c={glog:function(a){if(1>a)throw new Error("glog("+a+")");return c.LOG_TABLE[a]},gexp:function(a){for(;0>a;)a+=255;for(;a>=256;)a-=255;return c.EXP_TABLE[a]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},d=0;8>d;d++)c.EXP_TABLE[d]=1<<d;for(var d=8;256>d;d++)c.EXP_TABLE[d]=c.EXP_TABLE[d-4]^c.EXP_TABLE[d-5]^c.EXP_TABLE[d-6]^c.EXP_TABLE[d-8];for(var d=0;255>d;d++)c.LOG_TABLE[c.EXP_TABLE[d]]=d;b.exports=c},{}],9:[function(a,b){var c={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8};b.exports=c},{}],10:[function(a,b){function c(a,b){if(void 0===a.length)throw new Error(a.length+"/"+b);for(var c=0;c<a.length&&0===a[c];)c++;this.num=new Array(a.length-c+b);for(var d=0;d<a.length-c;d++)this.num[d]=a[d+c]}var d=a("./QRMath.js");c.prototype.get=function(a){return this.num[a]},c.prototype.getLength=function(){return this.num.length},c.prototype.multiply=function(a){for(var b=new Array(this.getLength()+a.getLength()-1),e=0;e<this.getLength();e++)for(var f=0;f<a.getLength();f++)b[e+f]^=d.gexp(d.glog(this.get(e))+d.glog(a.get(f)));return new c(b,0)},c.prototype.mod=function(a){if(this.getLength()-a.getLength()<0)return this;var b,e=d.glog(this.get(0))-d.glog(a.get(0)),f=new Array(this.getLength());for(b=0;b<this.getLength();b++)f[b]=this.get(b);for(b=0;b<a.getLength();b++)f[b]^=d.gexp(d.glog(a.get(b))+e);return new c(f,0).mod(a)},b.exports=c},{"./QRMath.js":8}],11:[function(a,b){function c(a,b){this.totalCount=a,this.dataCount=b}var d=a("./QRErrorCorrectLevel.js");c.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],[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]],c.getRSBlocks=function(a,b){var d=c.getRsBlockTable(a,b);if(void 0===d)throw new Error("bad rs block @ typeNumber:"+a+"/errorCorrectLevel:"+b);for(var e=d.length/3,f=[],g=0;e>g;g++)for(var h=d[3*g+0],i=d[3*g+1],j=d[3*g+2],k=0;h>k;k++)f.push(new c(i,j));return f},c.getRsBlockTable=function(a,b){switch(b){case d.L:return c.RS_BLOCK_TABLE[4*(a-1)+0];case d.M:return c.RS_BLOCK_TABLE[4*(a-1)+1];case d.Q:return c.RS_BLOCK_TABLE[4*(a-1)+2];case d.H:return c.RS_BLOCK_TABLE[4*(a-1)+3];default:return void 0}},b.exports=c},{"./QRErrorCorrectLevel.js":6}],12:[function(a,b){var c=a("./QRMaskPattern.js"),d=a("./QRPolynomial.js"),e=a("./QRMath.js"),f=a("./QRMode.js"),g={};g.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]],g.G15=1335,g.G18=7973,g.G15_MASK=21522,g.getBCHTypeInfo=function(a){for(var b=a<<10;g.getBCHDigit(b)-g.getBCHDigit(g.G15)>=0;)b^=g.G15<<g.getBCHDigit(b)-g.getBCHDigit(g.G15);return(a<<10|b)^g.G15_MASK},g.getBCHTypeNumber=function(a){for(var b=a<<12;g.getBCHDigit(b)-g.getBCHDigit(g.G18)>=0;)b^=g.G18<<g.getBCHDigit(b)-g.getBCHDigit(g.G18);return a<<12|b},g.getBCHDigit=function(a){for(var b=0;0!==a;)b++,a>>>=1;return b},g.getPatternPosition=function(a){return g.PATTERN_POSITION_TABLE[a-1]},g.getMask=function(a,b,d){switch(a){case c.PATTERN000:return(b+d)%2===0;case c.PATTERN001:return b%2===0;case c.PATTERN010:return d%3===0;case c.PATTERN011:return(b+d)%3===0;case c.PATTERN100:return(Math.floor(b/2)+Math.floor(d/3))%2===0;case c.PATTERN101:return b*d%2+b*d%3===0;case c.PATTERN110:return(b*d%2+b*d%3)%2===0;case c.PATTERN111:return(b*d%3+(b+d)%2)%2===0;default:throw new Error("bad maskPattern:"+a)}},g.getErrorCorrectPolynomial=function(a){for(var b=new d([1],0),c=0;a>c;c++)b=b.multiply(new d([1,e.gexp(c)],0));return b},g.getLengthInBits=function(a,b){if(b>=1&&10>b)switch(a){case f.MODE_NUMBER:return 10;case f.MODE_ALPHA_NUM:return 9;case f.MODE_8BIT_BYTE:return 8;case f.MODE_KANJI:return 8;default:throw new Error("mode:"+a)}else if(27>b)switch(a){case f.MODE_NUMBER:return 12;case f.MODE_ALPHA_NUM:return 11;case f.MODE_8BIT_BYTE:return 16;case f.MODE_KANJI:return 10;default:throw new Error("mode:"+a)}else{if(!(41>b))throw new Error("type:"+b);switch(a){case f.MODE_NUMBER:return 14;case f.MODE_ALPHA_NUM:return 13;case f.MODE_8BIT_BYTE:return 16;case f.MODE_KANJI:return 12;default:throw new Error("mode:"+a)}}},g.getLostPoint=function(a){var b,c,d=a.getModuleCount(),e=0;for(b=0;d>b;b++)for(c=0;d>c;c++){for(var f=0,g=a.isDark(b,c),h=-1;1>=h;h++)if(!(0>b+h||b+h>=d))for(var i=-1;1>=i;i++)0>c+i||c+i>=d||(0!==h||0!==i)&&g===a.isDark(b+h,c+i)&&f++;f>5&&(e+=3+f-5)}for(b=0;d-1>b;b++)for(c=0;d-1>c;c++){var j=0;a.isDark(b,c)&&j++,a.isDark(b+1,c)&&j++,a.isDark(b,c+1)&&j++,a.isDark(b+1,c+1)&&j++,(0===j||4===j)&&(e+=3)}for(b=0;d>b;b++)for(c=0;d-6>c;c++)a.isDark(b,c)&&!a.isDark(b,c+1)&&a.isDark(b,c+2)&&a.isDark(b,c+3)&&a.isDark(b,c+4)&&!a.isDark(b,c+5)&&a.isDark(b,c+6)&&(e+=40);for(c=0;d>c;c++)for(b=0;d-6>b;b++)a.isDark(b,c)&&!a.isDark(b+1,c)&&a.isDark(b+2,c)&&a.isDark(b+3,c)&&a.isDark(b+4,c)&&!a.isDark(b+5,c)&&a.isDark(b+6,c)&&(e+=40);var k=0;for(c=0;d>c;c++)for(b=0;d>b;b++)a.isDark(b,c)&&k++;var l=Math.abs(100*k/d/d-50)/5;return e+=10*l},b.exports=g},{"./QRMaskPattern.js":7,"./QRMath.js":8,"./QRMode.js":9,"./QRPolynomial.js":10}]},{},[5])(5)});