/*
* Solo - A small and beautiful blogging system written in Java.
* Copyright (c) 2010-2019, b3log.org & hacpai.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
!function(c){c.fn.qrcode=function(h){var r;function e(t){this.mode=r,this.data=t}function l(t,e){this.typeNumber=t,this.errorCorrectLevel=e,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}function g(t,e){if(null==t.length)throw Error(t.length+"/"+e);for(var r=0;r>r&1);this.modules[Math.floor(r/3)][r%3+this.moduleCount-8-3]=o}for(r=0;r<18;r++)o=!t&&1==(e>>r&1),this.modules[r%3+this.moduleCount-8-3][Math.floor(r/3)]=o},setupTypeInfo:function(t,e){for(var r=d.getBCHTypeInfo(this.errorCorrectLevel<<3|e),o=0;o<15;o++){var n=!t&&1==(r>>o&1);o<6?this.modules[o][8]=n:o<8?this.modules[o+1][8]=n:this.modules[this.moduleCount-15+o][8]=n}for(o=0;o<15;o++)n=!t&&1==(r>>o&1),o<8?this.modules[8][this.moduleCount-o-1]=n:o<9?this.modules[8][15-o-1+1]=n:this.modules[8][15-o-1]=n;this.modules[this.moduleCount-8][8]=!t},mapData:function(t,e){for(var r=-1,o=this.moduleCount-1,n=7,i=0,s=this.moduleCount-1;0>>n&1)),d.getMask(e,o,s-u)&&(a=!a),this.modules[o][s-u]=a,-1==--n&&(i++,n=7)}if((o+=r)<0||this.moduleCount<=o){o-=r,r=-r;break}}}},l.PAD0=236,l.PAD1=17,l.createData=function(t,e,r){e=f.getRSBlocks(t,e);for(var o=new s,n=0;n8*t)throw Error("code length overflow. ("+o.getLengthInBits()+">"+8*t+")");for(o.getLengthInBits()+4<=8*t&&o.put(0,4);0!=o.getLengthInBits()%8;)o.putBit(!1);for(;!(o.getLengthInBits()>=8*t)&&(o.put(l.PAD0,8),!(o.getLengthInBits()>=8*t));)o.put(l.PAD1,8);return l.createBytes(o,e)},l.createBytes=function(t,e){for(var r=0,o=0,n=0,i=Array(e.length),s=Array(e.length),u=0;u>>=1;return e},getPatternPosition:function(t){return d.PATTERN_POSITION_TABLE[t-1]},getMask:function(t,e,r){switch(t){case 0:return 0==(e+r)%2;case 1:return 0==e%2;case 2:return 0==r%3;case 3:return 0==(e+r)%3;case 4:return 0==(Math.floor(e/2)+Math.floor(r/3))%2;case 5:return 0==e*r%2+e*r%3;case 6:return 0==(e*r%2+e*r%3)%2;case 7:return 0==(e*r%3+(e+r)%2)%2;default:throw Error("bad maskPattern:"+t)}},getErrorCorrectPolynomial:function(t){for(var e=new g([1],0),r=0;r>>7-t%8&1)},put:function(t,e){for(var r=0;r>>e-r-1&1))},getLengthInBits:function(){return this.length},putBit:function(t){var e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}},"string"==typeof h&&(h={text:h}),h=c.extend({},{render:"canvas",width:256,height:256,typeNumber:-1,correctLevel:2,background:"#ffffff",foreground:"#000000"},h),this.each(function(){var t;if("canvas"==h.render){(t=new l(h.typeNumber,h.correctLevel)).addData(h.text),t.make();var e=document.createElement("canvas");e.width=h.width,e.height=h.height;for(var r=e.getContext("2d"),o=h.width/t.getModuleCount(),n=h.height/t.getModuleCount(),i=0;i").css("width",h.width+"px").css("height",h.height+"px").css("border","0px").css("border-collapse","collapse").css("background-color",h.background),r=h.width/t.getModuleCount(),o=h.height/t.getModuleCount(),n=0;n").css("height",o+"px").appendTo(e),s=0;s").css("width",r+"px").css("background-color",t.isDark(n,s)?h.foreground:h.background).appendTo(i);t=e,jQuery(t).appendTo(this)})}}(jQuery);