@mithrandirii/qr-code-styling
Advanced tools
Comparing version 1.3.2 to 1.3.3
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.QRCodeStyling=e():t.QRCodeStyling=e()}(window,function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=1)}([function(t,e,r){var n,i,o,a=function(){var t=function(t,e){var r=t,n=h[e],i=null,o=0,a=null,s=[],u={},c=function(t,e){i=function(t){for(var e=new Array(t),r=0;r<t;r+=1){e[r]=new Array(t);for(var n=0;n<t;n+=1)e[r][n]=null}return e}(o=4*r+17),l(0,0),l(o-7,0),l(0,o-7),d(),f(),p(t,e),r>=7&&g(t),null==a&&(a=m(r,n,s)),_(a,e)},l=function(t,e){for(var r=-1;r<=7;r+=1)if(!(t+r<=-1||o<=t+r))for(var n=-1;n<=7;n+=1)e+n<=-1||o<=e+n||(i[t+r][e+n]=0<=r&&r<=6&&(0==n||6==n)||0<=n&&n<=6&&(0==r||6==r)||2<=r&&r<=4&&2<=n&&n<=4)},f=function(){for(var t=8;t<o-8;t+=1)null==i[t][6]&&(i[t][6]=t%2==0);for(var e=8;e<o-8;e+=1)null==i[6][e]&&(i[6][e]=e%2==0)},d=function(){for(var t=v.getPatternPosition(r),e=0;e<t.length;e+=1)for(var n=0;n<t.length;n+=1){var o=t[e],a=t[n];if(null==i[o][a])for(var s=-2;s<=2;s+=1)for(var h=-2;h<=2;h+=1)i[o+s][a+h]=-2==s||2==s||-2==h||2==h||0==s&&0==h}},g=function(t){for(var e=v.getBCHTypeNumber(r),n=0;n<18;n+=1){var a=!t&&1==(e>>n&1);i[Math.floor(n/3)][n%3+o-8-3]=a}for(n=0;n<18;n+=1){a=!t&&1==(e>>n&1);i[n%3+o-8-3][Math.floor(n/3)]=a}},p=function(t,e){for(var r=n<<3|e,a=v.getBCHTypeInfo(r),s=0;s<15;s+=1){var h=!t&&1==(a>>s&1);s<6?i[s][8]=h:s<8?i[s+1][8]=h:i[o-15+s][8]=h}for(s=0;s<15;s+=1){h=!t&&1==(a>>s&1);s<8?i[8][o-s-1]=h:s<9?i[8][15-s-1+1]=h:i[8][15-s-1]=h}i[o-8][8]=!t},_=function(t,e){for(var r=-1,n=o-1,a=7,s=0,h=v.getMaskFunction(e),u=o-1;u>0;u-=2)for(6==u&&(u-=1);;){for(var c=0;c<2;c+=1)if(null==i[n][u-c]){var l=!1;s<t.length&&(l=1==(t[s]>>>a&1)),h(n,u-c)&&(l=!l),i[n][u-c]=l,-1==(a-=1)&&(s+=1,a=7)}if((n+=r)<0||o<=n){n-=r,r=-r;break}}},m=function(t,e,r){for(var n=w.getRSBlocks(t,e),i=b(),o=0;o<r.length;o+=1){var a=r[o];i.put(a.getMode(),4),i.put(a.getLength(),v.getLengthInBits(a.getMode(),t)),a.write(i)}var s=0;for(o=0;o<n.length;o+=1)s+=n[o].dataCount;if(i.getLengthInBits()>8*s)throw"code length overflow. ("+i.getLengthInBits()+">"+8*s+")";for(i.getLengthInBits()+4<=8*s&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(!1);for(;!(i.getLengthInBits()>=8*s||(i.put(236,8),i.getLengthInBits()>=8*s));)i.put(17,8);return function(t,e){for(var r=0,n=0,i=0,o=new Array(e.length),a=new Array(e.length),s=0;s<e.length;s+=1){var h=e[s].dataCount,u=e[s].totalCount-h;n=Math.max(n,h),i=Math.max(i,u),o[s]=new Array(h);for(var c=0;c<o[s].length;c+=1)o[s][c]=255&t.getBuffer()[c+r];r+=h;var l=v.getErrorCorrectPolynomial(u),f=y(o[s],l.getLength()-1).mod(l);a[s]=new Array(l.getLength()-1);for(c=0;c<a[s].length;c+=1){var d=c+f.getLength()-a[s].length;a[s][c]=d>=0?f.getAt(d):0}}var g=0;for(c=0;c<e.length;c+=1)g+=e[c].totalCount;var p=new Array(g),_=0;for(c=0;c<n;c+=1)for(s=0;s<e.length;s+=1)c<o[s].length&&(p[_]=o[s][c],_+=1);for(c=0;c<i;c+=1)for(s=0;s<e.length;s+=1)c<a[s].length&&(p[_]=a[s][c],_+=1);return p}(i,n)};u.addData=function(t,e){var r=null;switch(e=e||"Byte"){case"Numeric":r=x(t);break;case"Alphanumeric":r=A(t);break;case"Byte":r=C(t);break;case"Kanji":r=k(t);break;default:throw"mode:"+e}s.push(r),a=null},u.isDark=function(t,e){if(t<0||o<=t||e<0||o<=e)throw t+","+e;return i[t][e]},u.getModuleCount=function(){return o},u.make=function(){if(r<1){for(var t=1;t<40;t++){for(var e=w.getRSBlocks(t,n),i=b(),o=0;o<s.length;o++){var a=s[o];i.put(a.getMode(),4),i.put(a.getLength(),v.getLengthInBits(a.getMode(),t)),a.write(i)}var h=0;for(o=0;o<e.length;o++)h+=e[o].dataCount;if(i.getLengthInBits()<=8*h)break}r=t}c(!1,function(){for(var t=0,e=0,r=0;r<8;r+=1){c(!0,r);var n=v.getLostPoint(u);(0==r||t>n)&&(t=n,e=r)}return e}())},u.createTableTag=function(t,e){t=t||2;var r="";r+='<table style="',r+=" border-width: 0px; border-style: none;",r+=" border-collapse: collapse;",r+=" padding: 0px; margin: "+(e=void 0===e?4*t:e)+"px;",r+='">',r+="<tbody>";for(var n=0;n<u.getModuleCount();n+=1){r+="<tr>";for(var i=0;i<u.getModuleCount();i+=1)r+='<td style="',r+=" border-width: 0px; border-style: none;",r+=" border-collapse: collapse;",r+=" padding: 0px; margin: 0px;",r+=" width: "+t+"px;",r+=" height: "+t+"px;",r+=" background-color: ",r+=u.isDark(n,i)?"#000000":"#ffffff",r+=";",r+='"/>';r+="</tr>"}return r+="</tbody>",r+="</table>"},u.createSvgTag=function(t,e){var r={};"object"==typeof arguments[0]&&(t=(r=arguments[0]).cellSize,e=r.margin),t=t||2,e=void 0===e?4*t:e;var n,i,o,a,s=u.getModuleCount()*t+2*e,h="";for(a="l"+t+",0 0,"+t+" -"+t+",0 0,-"+t+"z ",h+='<svg version="1.1" xmlns="http://www.w3.org/2000/svg"',h+=r.scalable?"":' width="'+s+'px" height="'+s+'px"',h+=' viewBox="0 0 '+s+" "+s+'" ',h+=' preserveAspectRatio="xMinYMin meet">',h+='<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>',h+='<path d="',i=0;i<u.getModuleCount();i+=1)for(o=i*t+e,n=0;n<u.getModuleCount();n+=1)u.isDark(i,n)&&(h+="M"+(n*t+e)+","+o+a);return h+='" stroke="transparent" fill="black"/>',h+="</svg>"},u.createDataURL=function(t,e){t=t||2,e=void 0===e?4*t:e;var r=u.getModuleCount()*t+2*e,n=e,i=r-e;return E(r,r,function(e,r){if(n<=e&&e<i&&n<=r&&r<i){var o=Math.floor((e-n)/t),a=Math.floor((r-n)/t);return u.isDark(a,o)?0:1}return 1})},u.createImgTag=function(t,e,r){t=t||2,e=void 0===e?4*t:e;var n=u.getModuleCount()*t+2*e,i="";return i+="<img",i+=' src="',i+=u.createDataURL(t,e),i+='"',i+=' width="',i+=n,i+='"',i+=' height="',i+=n,i+='"',r&&(i+=' alt="',i+=r,i+='"'),i+="/>"};return u.createASCII=function(t,e){if((t=t||1)<2)return function(t){t=void 0===t?2:t;var e,r,n,i,o,a=1*u.getModuleCount()+2*t,s=t,h=a-t,c={"██":"█","█ ":"▀"," █":"▄"," ":" "},l={"██":"▀","█ ":"▀"," █":" "," ":" "},f="";for(e=0;e<a;e+=2){for(n=Math.floor((e-s)/1),i=Math.floor((e+1-s)/1),r=0;r<a;r+=1)o="█",s<=r&&r<h&&s<=e&&e<h&&u.isDark(n,Math.floor((r-s)/1))&&(o=" "),s<=r&&r<h&&s<=e+1&&e+1<h&&u.isDark(i,Math.floor((r-s)/1))?o+=" ":o+="█",f+=t<1&&e+1>=h?l[o]:c[o];f+="\n"}return a%2&&t>0?f.substring(0,f.length-a-1)+Array(a+1).join("▀"):f.substring(0,f.length-1)}(e);t-=1,e=void 0===e?2*t:e;var r,n,i,o,a=u.getModuleCount()*t+2*e,s=e,h=a-e,c=Array(t+1).join("██"),l=Array(t+1).join(" "),f="",d="";for(r=0;r<a;r+=1){for(i=Math.floor((r-s)/t),d="",n=0;n<a;n+=1)o=1,s<=n&&n<h&&s<=r&&r<h&&u.isDark(i,Math.floor((n-s)/t))&&(o=0),d+=o?c:l;for(i=0;i<t;i+=1)f+=d+"\n"}return f.substring(0,f.length-1)},u.renderTo2dContext=function(t,e){e=e||2;for(var r=u.getModuleCount(),n=0;n<r;n++)for(var i=0;i<r;i++)t.fillStyle=u.isDark(n,i)?"black":"white",t.fillRect(n*e,i*e,e,e)},u};t.stringToBytes=(t.stringToBytesFuncs={default:function(t){for(var e=[],r=0;r<t.length;r+=1){var n=t.charCodeAt(r);e.push(255&n)}return e}}).default,t.createStringToBytes=function(t,e){var r=function(){for(var r=M(t),n=function(){var t=r.read();if(-1==t)throw"eof";return t},i=0,o={};;){var a=r.read();if(-1==a)break;var s=n(),h=n()<<8|n();o[String.fromCharCode(a<<8|s)]=h,i+=1}if(i!=e)throw i+" != "+e;return o}(),n="?".charCodeAt(0);return function(t){for(var e=[],i=0;i<t.length;i+=1){var o=t.charCodeAt(i);if(o<128)e.push(o);else{var a=r[t.charAt(i)];"number"==typeof a?(255&a)==a?e.push(a):(e.push(a>>>8),e.push(255&a)):e.push(n)}}return e}};var e,r,n,i=1,o=2,a=4,s=8,h={L:1,M:0,Q:3,H:2},u=0,c=1,l=2,f=3,d=4,g=5,p=6,_=7,v=(e=[[],[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]],n=function(t){for(var e=0;0!=t;)e+=1,t>>>=1;return e},(r={}).getBCHTypeInfo=function(t){for(var e=t<<10;n(e)-n(1335)>=0;)e^=1335<<n(e)-n(1335);return 21522^(t<<10|e)},r.getBCHTypeNumber=function(t){for(var e=t<<12;n(e)-n(7973)>=0;)e^=7973<<n(e)-n(7973);return t<<12|e},r.getPatternPosition=function(t){return e[t-1]},r.getMaskFunction=function(t){switch(t){case u:return function(t,e){return(t+e)%2==0};case c:return function(t,e){return t%2==0};case l:return function(t,e){return e%3==0};case f:return function(t,e){return(t+e)%3==0};case d:return function(t,e){return(Math.floor(t/2)+Math.floor(e/3))%2==0};case g:return function(t,e){return t*e%2+t*e%3==0};case p:return function(t,e){return(t*e%2+t*e%3)%2==0};case _:return function(t,e){return(t*e%3+(t+e)%2)%2==0};default:throw"bad maskPattern:"+t}},r.getErrorCorrectPolynomial=function(t){for(var e=y([1],0),r=0;r<t;r+=1)e=e.multiply(y([1,m.gexp(r)],0));return e},r.getLengthInBits=function(t,e){if(1<=e&&e<10)switch(t){case i:return 10;case o:return 9;case a:case s:return 8;default:throw"mode:"+t}else if(e<27)switch(t){case i:return 12;case o:return 11;case a:return 16;case s:return 10;default:throw"mode:"+t}else{if(!(e<41))throw"type:"+e;switch(t){case i:return 14;case o:return 13;case a:return 16;case s:return 12;default:throw"mode:"+t}}},r.getLostPoint=function(t){for(var e=t.getModuleCount(),r=0,n=0;n<e;n+=1)for(var i=0;i<e;i+=1){for(var o=0,a=t.isDark(n,i),s=-1;s<=1;s+=1)if(!(n+s<0||e<=n+s))for(var h=-1;h<=1;h+=1)i+h<0||e<=i+h||0==s&&0==h||a==t.isDark(n+s,i+h)&&(o+=1);o>5&&(r+=3+o-5)}for(n=0;n<e-1;n+=1)for(i=0;i<e-1;i+=1){var u=0;t.isDark(n,i)&&(u+=1),t.isDark(n+1,i)&&(u+=1),t.isDark(n,i+1)&&(u+=1),t.isDark(n+1,i+1)&&(u+=1),0!=u&&4!=u||(r+=3)}for(n=0;n<e;n+=1)for(i=0;i<e-6;i+=1)t.isDark(n,i)&&!t.isDark(n,i+1)&&t.isDark(n,i+2)&&t.isDark(n,i+3)&&t.isDark(n,i+4)&&!t.isDark(n,i+5)&&t.isDark(n,i+6)&&(r+=40);for(i=0;i<e;i+=1)for(n=0;n<e-6;n+=1)t.isDark(n,i)&&!t.isDark(n+1,i)&&t.isDark(n+2,i)&&t.isDark(n+3,i)&&t.isDark(n+4,i)&&!t.isDark(n+5,i)&&t.isDark(n+6,i)&&(r+=40);var c=0;for(i=0;i<e;i+=1)for(n=0;n<e;n+=1)t.isDark(n,i)&&(c+=1);return r+=Math.abs(100*c/e/e-50)/5*10},r),m=function(){for(var t=new Array(256),e=new Array(256),r=0;r<8;r+=1)t[r]=1<<r;for(r=8;r<256;r+=1)t[r]=t[r-4]^t[r-5]^t[r-6]^t[r-8];for(r=0;r<255;r+=1)e[t[r]]=r;var n={glog:function(t){if(t<1)throw"glog("+t+")";return e[t]},gexp:function(e){for(;e<0;)e+=255;for(;e>=256;)e-=255;return t[e]}};return n}();function y(t,e){if(void 0===t.length)throw t.length+"/"+e;var r=function(){for(var r=0;r<t.length&&0==t[r];)r+=1;for(var n=new Array(t.length-r+e),i=0;i<t.length-r;i+=1)n[i]=t[i+r];return n}(),n={getAt:function(t){return r[t]},getLength:function(){return r.length},multiply:function(t){for(var e=new Array(n.getLength()+t.getLength()-1),r=0;r<n.getLength();r+=1)for(var i=0;i<t.getLength();i+=1)e[r+i]^=m.gexp(m.glog(n.getAt(r))+m.glog(t.getAt(i)));return y(e,0)},mod:function(t){if(n.getLength()-t.getLength()<0)return n;for(var e=m.glog(n.getAt(0))-m.glog(t.getAt(0)),r=new Array(n.getLength()),i=0;i<n.getLength();i+=1)r[i]=n.getAt(i);for(i=0;i<t.getLength();i+=1)r[i]^=m.gexp(m.glog(t.getAt(i))+e);return y(r,0).mod(t)}};return n}var w=function(){var t=[[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]],e=function(t,e){var r={};return r.totalCount=t,r.dataCount=e,r},r={};return r.getRSBlocks=function(r,n){var i=function(e,r){switch(r){case h.L:return t[4*(e-1)+0];case h.M:return t[4*(e-1)+1];case h.Q:return t[4*(e-1)+2];case h.H:return t[4*(e-1)+3];default:return}}(r,n);if(void 0===i)throw"bad rs block @ typeNumber:"+r+"/errorCorrectionLevel:"+n;for(var o=i.length/3,a=[],s=0;s<o;s+=1)for(var u=i[3*s+0],c=i[3*s+1],l=i[3*s+2],f=0;f<u;f+=1)a.push(e(c,l));return a},r}(),b=function(){var t=[],e=0,r={getBuffer:function(){return t},getAt:function(e){var r=Math.floor(e/8);return 1==(t[r]>>>7-e%8&1)},put:function(t,e){for(var n=0;n<e;n+=1)r.putBit(1==(t>>>e-n-1&1))},getLengthInBits:function(){return e},putBit:function(r){var n=Math.floor(e/8);t.length<=n&&t.push(0),r&&(t[n]|=128>>>e%8),e+=1}};return r},x=function(t){var e=i,r=t,n={getMode:function(){return e},getLength:function(t){return r.length},write:function(t){for(var e=r,n=0;n+2<e.length;)t.put(o(e.substring(n,n+3)),10),n+=3;n<e.length&&(e.length-n==1?t.put(o(e.substring(n,n+1)),4):e.length-n==2&&t.put(o(e.substring(n,n+2)),7))}},o=function(t){for(var e=0,r=0;r<t.length;r+=1)e=10*e+a(t.charAt(r));return e},a=function(t){if("0"<=t&&t<="9")return t.charCodeAt(0)-"0".charCodeAt(0);throw"illegal char :"+t};return n},A=function(t){var e=o,r=t,n={getMode:function(){return e},getLength:function(t){return r.length},write:function(t){for(var e=r,n=0;n+1<e.length;)t.put(45*i(e.charAt(n))+i(e.charAt(n+1)),11),n+=2;n<e.length&&t.put(i(e.charAt(n)),6)}},i=function(t){if("0"<=t&&t<="9")return t.charCodeAt(0)-"0".charCodeAt(0);if("A"<=t&&t<="Z")return t.charCodeAt(0)-"A".charCodeAt(0)+10;switch(t){case" ":return 36;case"$":return 37;case"%":return 38;case"*":return 39;case"+":return 40;case"-":return 41;case".":return 42;case"/":return 43;case":":return 44;default:throw"illegal char :"+t}};return n},C=function(e){var r=a,n=t.stringToBytes(e),i={getMode:function(){return r},getLength:function(t){return n.length},write:function(t){for(var e=0;e<n.length;e+=1)t.put(n[e],8)}};return i},k=function(e){var r=s,n=t.stringToBytesFuncs.SJIS;if(!n)throw"sjis not supported.";!function(t,e){var r=n("友");if(2!=r.length||38726!=(r[0]<<8|r[1]))throw"sjis not supported."}();var i=n(e),o={getMode:function(){return r},getLength:function(t){return~~(i.length/2)},write:function(t){for(var e=i,r=0;r+1<e.length;){var n=(255&e[r])<<8|255&e[r+1];if(33088<=n&&n<=40956)n-=33088;else{if(!(57408<=n&&n<=60351))throw"illegal char at "+(r+1)+"/"+n;n-=49472}n=192*(n>>>8&255)+(255&n),t.put(n,13),r+=2}if(r<e.length)throw"illegal char at "+(r+1)}};return o},S=function(){var t=[],e={writeByte:function(e){t.push(255&e)},writeShort:function(t){e.writeByte(t),e.writeByte(t>>>8)},writeBytes:function(t,r,n){r=r||0,n=n||t.length;for(var i=0;i<n;i+=1)e.writeByte(t[i+r])},writeString:function(t){for(var r=0;r<t.length;r+=1)e.writeByte(t.charCodeAt(r))},toByteArray:function(){return t},toString:function(){var e="";e+="[";for(var r=0;r<t.length;r+=1)r>0&&(e+=","),e+=t[r];return e+="]"}};return e},M=function(t){var e=t,r=0,n=0,i=0,o={read:function(){for(;i<8;){if(r>=e.length){if(0==i)return-1;throw"unexpected end of file./"+i}var t=e.charAt(r);if(r+=1,"="==t)return i=0,-1;t.match(/^\s$/)||(n=n<<6|a(t.charCodeAt(0)),i+=6)}var o=n>>>i-8&255;return i-=8,o}},a=function(t){if(65<=t&&t<=90)return t-65;if(97<=t&&t<=122)return t-97+26;if(48<=t&&t<=57)return t-48+52;if(43==t)return 62;if(47==t)return 63;throw"c:"+t};return o},E=function(t,e,r){for(var n=function(t,e){var r=t,n=e,i=new Array(t*e),o={setPixel:function(t,e,n){i[e*r+t]=n},write:function(t){t.writeString("GIF87a"),t.writeShort(r),t.writeShort(n),t.writeByte(128),t.writeByte(0),t.writeByte(0),t.writeByte(0),t.writeByte(0),t.writeByte(0),t.writeByte(255),t.writeByte(255),t.writeByte(255),t.writeString(","),t.writeShort(0),t.writeShort(0),t.writeShort(r),t.writeShort(n),t.writeByte(0);var e=a(2);t.writeByte(2);for(var i=0;e.length-i>255;)t.writeByte(255),t.writeBytes(e,i,255),i+=255;t.writeByte(e.length-i),t.writeBytes(e,i,e.length-i),t.writeByte(0),t.writeString(";")}},a=function(t){for(var e=1<<t,r=1+(1<<t),n=t+1,o=s(),a=0;a<e;a+=1)o.add(String.fromCharCode(a));o.add(String.fromCharCode(e)),o.add(String.fromCharCode(r));var h=S(),u=function(t){var e=t,r=0,n=0,i={write:function(t,i){if(t>>>i!=0)throw"length over";for(;r+i>=8;)e.writeByte(255&(t<<r|n)),i-=8-r,t>>>=8-r,n=0,r=0;n|=t<<r,r+=i},flush:function(){r>0&&e.writeByte(n)}};return i}(h);u.write(e,n);var c=0,l=String.fromCharCode(i[c]);for(c+=1;c<i.length;){var f=String.fromCharCode(i[c]);c+=1,o.contains(l+f)?l+=f:(u.write(o.indexOf(l),n),o.size()<4095&&(o.size()==1<<n&&(n+=1),o.add(l+f)),l=f)}return u.write(o.indexOf(l),n),u.write(r,n),u.flush(),h.toByteArray()},s=function(){var t={},e=0,r={add:function(n){if(r.contains(n))throw"dup key:"+n;t[n]=e,e+=1},size:function(){return e},indexOf:function(e){return t[e]},contains:function(e){return void 0!==t[e]}};return r};return o}(t,e),i=0;i<e;i+=1)for(var o=0;o<t;o+=1)n.setPixel(o,i,r(o,i));var a=S();n.write(a);for(var s=function(){var t=0,e=0,r=0,n="",i={},o=function(t){n+=String.fromCharCode(a(63&t))},a=function(t){if(t<0);else{if(t<26)return 65+t;if(t<52)return t-26+97;if(t<62)return t-52+48;if(62==t)return 43;if(63==t)return 47}throw"n:"+t};return i.writeByte=function(n){for(t=t<<8|255&n,e+=8,r+=1;e>=6;)o(t>>>e-6),e-=6},i.flush=function(){if(e>0&&(o(t<<6-e),t=0,e=0),r%3!=0)for(var i=3-r%3,a=0;a<i;a+=1)n+="="},i.toString=function(){return n},i}(),h=a.toByteArray(),u=0;u<h.length;u+=1)s.writeByte(h[u]);return s.flush(),"data:image/gif;base64,"+s};return t}();a.stringToBytesFuncs["UTF-8"]=function(t){return function(t){for(var e=[],r=0;r<t.length;r++){var n=t.charCodeAt(r);n<128?e.push(n):n<2048?e.push(192|n>>6,128|63&n):n<55296||n>=57344?e.push(224|n>>12,128|n>>6&63,128|63&n):(r++,n=65536+((1023&n)<<10|1023&t.charCodeAt(r)),e.push(240|n>>18,128|n>>12&63,128|n>>6&63,128|63&n))}return e}(t)},i=[],void 0===(o="function"==typeof(n=function(){return a})?n.apply(e,i):n)||(t.exports=o)},function(t,e,r){"use strict";r.r(e);var n={numeric:"Numeric",alphanumeric:"Alphanumeric",byte:"Byte",kanji:"Kanji"};var i=function(){return(i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},o=function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;var n=Array(t),i=0;for(e=0;e<r;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,i++)n[i]=o[a];return n},a=function(t){return!!t&&"object"==typeof t&&!Array.isArray(t)};function s(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];if(!e.length)return t;var n=e.shift();return void 0!==n&&a(t)&&a(n)?(t=i({},t),Object.keys(n).forEach(function(e){var r=t[e],i=n[e];Array.isArray(r)&&Array.isArray(i)?t[e]=r.concat(i):a(r)&&a(i)?t[e]=s(Object.assign({},r),i):t[e]=i}),s.apply(void 0,o([t],e))):t}var h,u,c,l,f,d={L:.07,M:.15,Q:.25,H:.3},g=function(){function t(t){var e=t.context,r=t.type;this._context=e,this._type=r}return t.prototype.draw=function(t,e,r,n){var i,o=this._context;switch(this._type){case"dots":i=this._drawDots;break;case"rounded":i=this._drawRounded;break;case"square":default:i=this._drawSquare}i({x:t,y:e,size:r,context:o,getNeighbor:n})},t.prototype._drawDots=function(t){var e=t.x,r=t.y,n=t.size,i=t.context;i.beginPath(),i.arc(e+n/2,r+n/2,n/2,0,2*Math.PI),i.fill()},t.prototype._drawSquare=function(t){var e=t.x,r=t.y,n=t.size;t.context.fillRect(e,r,n,n)},t.prototype._drawRounded=function(t){var e=t.x,r=t.y,n=t.size,i=t.context,o=t.getNeighbor;i.beginPath(),i.moveTo(e,r+n/2),o(-1,0)||o(0,-1)?(i.lineTo(e,r),i.lineTo(e+n/2,r)):i.arc(e+n/2,r+n/2,n/2,-Math.PI,-Math.PI/2),o(0,-1)||o(1,0)?(i.lineTo(e+n,r),i.lineTo(e+n,r+n/2)):i.arc(e+n/2,r+n/2,n/2,-Math.PI/2,0),o(1,0)||o(0,1)?(i.lineTo(e+n,r+n),i.lineTo(e+n/2,r+n)):i.arc(e+n/2,r+n/2,n/2,0,Math.PI/2),o(0,1)||o(-1,0)?(i.lineTo(e,r+n),i.lineTo(e,r+n/2)):i.arc(e+n/2,r+n/2,n/2,Math.PI/2,Math.PI),i.fill()},t}();function p(t,e){var r,n=Object.keys(e);for(r=0;r<n.length;r++)t=t.replace(new RegExp("\\{"+n[r]+"\\}","gi"),e[n[r]]);return t}function _(t){var e,r,n;if(!t)throw new Error("cannot create a random attribute name for an undefined object");e="ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz",r="";do{for(r="",n=0;n<12;n++)r+=e[Math.floor(Math.random()*e.length)]}while(t[r]);return r}function v(t){var e={alphabetic:"alphabetic",hanging:"hanging",top:"text-before-edge",bottom:"text-after-edge",middle:"central"};return e[t]||e.alphabetic}f=function(t,e){var r,n,i,o={};for(t=t.split(","),e=e||10,r=0;r<t.length;r+=2)n="&"+t[r+1]+";",i=parseInt(t[r],e),o[n]="&#"+i+";";return o["\\xa0"]=" ",o}("50,nbsp,51,iexcl,52,cent,53,pound,54,curren,55,yen,56,brvbar,57,sect,58,uml,59,copy,5a,ordf,5b,laquo,5c,not,5d,shy,5e,reg,5f,macr,5g,deg,5h,plusmn,5i,sup2,5j,sup3,5k,acute,5l,micro,5m,para,5n,middot,5o,cedil,5p,sup1,5q,ordm,5r,raquo,5s,frac14,5t,frac12,5u,frac34,5v,iquest,60,Agrave,61,Aacute,62,Acirc,63,Atilde,64,Auml,65,Aring,66,AElig,67,Ccedil,68,Egrave,69,Eacute,6a,Ecirc,6b,Euml,6c,Igrave,6d,Iacute,6e,Icirc,6f,Iuml,6g,ETH,6h,Ntilde,6i,Ograve,6j,Oacute,6k,Ocirc,6l,Otilde,6m,Ouml,6n,times,6o,Oslash,6p,Ugrave,6q,Uacute,6r,Ucirc,6s,Uuml,6t,Yacute,6u,THORN,6v,szlig,70,agrave,71,aacute,72,acirc,73,atilde,74,auml,75,aring,76,aelig,77,ccedil,78,egrave,79,eacute,7a,ecirc,7b,euml,7c,igrave,7d,iacute,7e,icirc,7f,iuml,7g,eth,7h,ntilde,7i,ograve,7j,oacute,7k,ocirc,7l,otilde,7m,ouml,7n,divide,7o,oslash,7p,ugrave,7q,uacute,7r,ucirc,7s,uuml,7t,yacute,7u,thorn,7v,yuml,ci,fnof,sh,Alpha,si,Beta,sj,Gamma,sk,Delta,sl,Epsilon,sm,Zeta,sn,Eta,so,Theta,sp,Iota,sq,Kappa,sr,Lambda,ss,Mu,st,Nu,su,Xi,sv,Omicron,t0,Pi,t1,Rho,t3,Sigma,t4,Tau,t5,Upsilon,t6,Phi,t7,Chi,t8,Psi,t9,Omega,th,alpha,ti,beta,tj,gamma,tk,delta,tl,epsilon,tm,zeta,tn,eta,to,theta,tp,iota,tq,kappa,tr,lambda,ts,mu,tt,nu,tu,xi,tv,omicron,u0,pi,u1,rho,u2,sigmaf,u3,sigma,u4,tau,u5,upsilon,u6,phi,u7,chi,u8,psi,u9,omega,uh,thetasym,ui,upsih,um,piv,812,bull,816,hellip,81i,prime,81j,Prime,81u,oline,824,frasl,88o,weierp,88h,image,88s,real,892,trade,89l,alefsym,8cg,larr,8ch,uarr,8ci,rarr,8cj,darr,8ck,harr,8dl,crarr,8eg,lArr,8eh,uArr,8ei,rArr,8ej,dArr,8ek,hArr,8g0,forall,8g2,part,8g3,exist,8g5,empty,8g7,nabla,8g8,isin,8g9,notin,8gb,ni,8gf,prod,8gh,sum,8gi,minus,8gn,lowast,8gq,radic,8gt,prop,8gu,infin,8h0,ang,8h7,and,8h8,or,8h9,cap,8ha,cup,8hb,int,8hk,there4,8hs,sim,8i5,cong,8i8,asymp,8j0,ne,8j1,equiv,8j4,le,8j5,ge,8k2,sub,8k3,sup,8k4,nsub,8k6,sube,8k7,supe,8kl,oplus,8kn,otimes,8l5,perp,8m5,sdot,8o8,lceil,8o9,rceil,8oa,lfloor,8ob,rfloor,8p9,lang,8pa,rang,9ea,loz,9j0,spades,9j3,clubs,9j5,hearts,9j6,diams,ai,OElig,aj,oelig,b0,Scaron,b1,scaron,bo,Yuml,m6,circ,ms,tilde,802,ensp,803,emsp,809,thinsp,80c,zwnj,80d,zwj,80e,lrm,80f,rlm,80j,ndash,80k,mdash,80o,lsquo,80p,rsquo,80q,sbquo,80s,ldquo,80t,rdquo,80u,bdquo,810,dagger,811,Dagger,81g,permil,81p,lsaquo,81q,rsaquo,85c,euro",32),h={strokeStyle:{svgAttr:"stroke",canvas:"#000000",svg:"none",apply:"stroke"},fillStyle:{svgAttr:"fill",canvas:"#000000",svg:null,apply:"fill"},lineCap:{svgAttr:"stroke-linecap",canvas:"butt",svg:"butt",apply:"stroke"},lineJoin:{svgAttr:"stroke-linejoin",canvas:"miter",svg:"miter",apply:"stroke"},miterLimit:{svgAttr:"stroke-miterlimit",canvas:10,svg:4,apply:"stroke"},lineWidth:{svgAttr:"stroke-width",canvas:1,svg:1,apply:"stroke"},globalAlpha:{svgAttr:"opacity",canvas:1,svg:1,apply:"fill stroke"},font:{canvas:"10px sans-serif"},shadowColor:{canvas:"#000000"},shadowOffsetX:{canvas:0},shadowOffsetY:{canvas:0},shadowBlur:{canvas:0},textAlign:{canvas:"start"},textBaseline:{canvas:"alphabetic"},lineDash:{svgAttr:"stroke-dasharray",canvas:[],svg:null,apply:"stroke"}},(c=function(t,e){this.__root=t,this.__ctx=e}).prototype.addColorStop=function(t,e){var r,n=this.__ctx.__createElement("stop");n.setAttribute("offset",t),-1!==e.indexOf("rgba")?(r=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?\.?\d*)\s*\)/gi.exec(e),n.setAttribute("stop-color",p("rgb({r},{g},{b})",{r:r[1],g:r[2],b:r[3]})),n.setAttribute("stop-opacity",r[4])):n.setAttribute("stop-color",e),this.__root.appendChild(n)},l=function(t,e){this.__root=t,this.__ctx=e},(u=function(t){var e,r={width:500,height:500,enableMirroring:!1};if(arguments.length>1?((e=r).width=arguments[0],e.height=arguments[1]):e=t||r,!(this instanceof u))return new u(e);this.width=e.width||r.width,this.height=e.height||r.height,this.enableMirroring=void 0!==e.enableMirroring?e.enableMirroring:r.enableMirroring,this.canvas=this,this.__document=e.document||document,e.ctx?this.__ctx=e.ctx:(this.__canvas=this.__document.createElement("canvas"),this.__ctx=this.__canvas.getContext("2d")),this.__setDefaultStyles(),this.__stack=[this.__getStyleState()],this.__groupStack=[],this.__root=this.__document.createElementNS("http://www.w3.org/2000/svg","svg"),this.__root.setAttribute("version",1.1),this.__root.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.__root.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink"),this.__root.setAttribute("width",this.width),this.__root.setAttribute("height",this.height),this.__ids={},this.__defs=this.__document.createElementNS("http://www.w3.org/2000/svg","defs"),this.__root.appendChild(this.__defs),this.__currentElement=this.__document.createElementNS("http://www.w3.org/2000/svg","g"),this.__root.appendChild(this.__currentElement)}).prototype.__createElement=function(t,e,r){void 0===e&&(e={});var n,i,o=this.__document.createElementNS("http://www.w3.org/2000/svg",t),a=Object.keys(e);for(r&&(o.setAttribute("fill","none"),o.setAttribute("stroke","none")),n=0;n<a.length;n++)i=a[n],o.setAttribute(i,e[i]);return o},u.prototype.__setDefaultStyles=function(){var t,e,r=Object.keys(h);for(t=0;t<r.length;t++)this[e=r[t]]=h[e].canvas},u.prototype.__applyStyleState=function(t){var e,r,n=Object.keys(t);for(e=0;e<n.length;e++)this[r=n[e]]=t[r]},u.prototype.__getStyleState=function(){var t,e,r={},n=Object.keys(h);for(t=0;t<n.length;t++)r[e=n[t]]=this[e];return r},u.prototype.__applyStyleToCurrentElement=function(t){var e=this.__currentElement,r=this.__currentElementsToStyle;r&&(e.setAttribute(t,""),e=r.element,r.children.forEach(function(e){e.setAttribute(t,"")}));var n,i,o,a,s,u=Object.keys(h);for(n=0;n<u.length;n++)if(i=h[u[n]],o=this[u[n]],i.apply)if(o instanceof l){if(o.__ctx)for(;o.__ctx.__defs.childNodes.length;)a=o.__ctx.__defs.childNodes[0].getAttribute("id"),this.__ids[a]=a,this.__defs.appendChild(o.__ctx.__defs.childNodes[0]);e.setAttribute(i.apply,p("url(#{id})",{id:o.__root.getAttribute("id")}))}else if(o instanceof c)e.setAttribute(i.apply,p("url(#{id})",{id:o.__root.getAttribute("id")}));else if(-1!==i.apply.indexOf(t)&&i.svg!==o)if("stroke"!==i.svgAttr&&"fill"!==i.svgAttr||-1===o.indexOf("rgba")){var f=i.svgAttr;if("globalAlpha"===u[n]&&(f=t+"-"+i.svgAttr,e.getAttribute(f)))continue;e.setAttribute(f,o)}else{s=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?\.?\d*)\s*\)/gi.exec(o),e.setAttribute(i.svgAttr,p("rgb({r},{g},{b})",{r:s[1],g:s[2],b:s[3]}));var d=s[4],g=this.globalAlpha;null!=g&&(d*=g),e.setAttribute(i.svgAttr+"-opacity",d)}},u.prototype.__closestGroupOrSvg=function(t){return"g"===(t=t||this.__currentElement).nodeName||"svg"===t.nodeName?t:this.__closestGroupOrSvg(t.parentNode)},u.prototype.getSerializedSvg=function(t){var e,r,n,i,o,a=(new XMLSerializer).serializeToString(this.__root);if(/xmlns="http:\/\/www\.w3\.org\/2000\/svg".+xmlns="http:\/\/www\.w3\.org\/2000\/svg/gi.test(a)&&(a=a.replace('xmlns="http://www.w3.org/2000/svg','xmlns:xlink="http://www.w3.org/1999/xlink')),t)for(e=Object.keys(f),r=0;r<e.length;r++)n=e[r],i=f[n],(o=new RegExp(n,"gi")).test(a)&&(a=a.replace(o,i));return a},u.prototype.getSvg=function(){return this.__root},u.prototype.save=function(){var t=this.__createElement("g"),e=this.__closestGroupOrSvg();this.__groupStack.push(e),e.appendChild(t),this.__currentElement=t,this.__stack.push(this.__getStyleState())},u.prototype.restore=function(){this.__currentElement=this.__groupStack.pop(),this.__currentElementsToStyle=null,this.__currentElement||(this.__currentElement=this.__root.childNodes[1]);var t=this.__stack.pop();this.__applyStyleState(t)},u.prototype.__addTransform=function(t){var e=this.__closestGroupOrSvg();if(e.childNodes.length>0){"path"===this.__currentElement.nodeName&&(this.__currentElementsToStyle||(this.__currentElementsToStyle={element:e,children:[]}),this.__currentElementsToStyle.children.push(this.__currentElement),this.__applyCurrentDefaultPath());var r=this.__createElement("g");e.appendChild(r),this.__currentElement=r}var n=this.__currentElement.getAttribute("transform");n?n+=" ":n="",n+=t,this.__currentElement.setAttribute("transform",n)},u.prototype.scale=function(t,e){void 0===e&&(e=t),this.__addTransform(p("scale({x},{y})",{x:t,y:e}))},u.prototype.rotate=function(t){var e=180*t/Math.PI;this.__addTransform(p("rotate({angle},{cx},{cy})",{angle:e,cx:0,cy:0}))},u.prototype.translate=function(t,e){this.__addTransform(p("translate({x},{y})",{x:t,y:e}))},u.prototype.transform=function(t,e,r,n,i,o){this.__addTransform(p("matrix({a},{b},{c},{d},{e},{f})",{a:t,b:e,c:r,d:n,e:i,f:o}))},u.prototype.beginPath=function(){var t;this.__currentDefaultPath="",this.__currentPosition={},t=this.__createElement("path",{},!0),this.__closestGroupOrSvg().appendChild(t),this.__currentElement=t},u.prototype.__applyCurrentDefaultPath=function(){var t=this.__currentElement;"path"===t.nodeName?t.setAttribute("d",this.__currentDefaultPath):console.error("Attempted to apply path command to node",t.nodeName)},u.prototype.__addPathCommand=function(t){this.__currentDefaultPath+=" ",this.__currentDefaultPath+=t},u.prototype.moveTo=function(t,e){"path"!==this.__currentElement.nodeName&&this.beginPath(),this.__currentPosition={x:t,y:e},this.__addPathCommand(p("M {x} {y}",{x:t,y:e}))},u.prototype.closePath=function(){this.__currentDefaultPath&&this.__addPathCommand("Z")},u.prototype.lineTo=function(t,e){this.__currentPosition={x:t,y:e},this.__currentDefaultPath.indexOf("M")>-1?this.__addPathCommand(p("L {x} {y}",{x:t,y:e})):this.__addPathCommand(p("M {x} {y}",{x:t,y:e}))},u.prototype.bezierCurveTo=function(t,e,r,n,i,o){this.__currentPosition={x:i,y:o},this.__addPathCommand(p("C {cp1x} {cp1y} {cp2x} {cp2y} {x} {y}",{cp1x:t,cp1y:e,cp2x:r,cp2y:n,x:i,y:o}))},u.prototype.quadraticCurveTo=function(t,e,r,n){this.__currentPosition={x:r,y:n},this.__addPathCommand(p("Q {cpx} {cpy} {x} {y}",{cpx:t,cpy:e,x:r,y:n}))};var m=function(t){var e=Math.sqrt(t[0]*t[0]+t[1]*t[1]);return[t[0]/e,t[1]/e]};u.prototype.arcTo=function(t,e,r,n,i){var o=this.__currentPosition&&this.__currentPosition.x,a=this.__currentPosition&&this.__currentPosition.y;if(void 0!==o&&void 0!==a){if(i<0)throw new Error("IndexSizeError: The radius provided ("+i+") is negative.");if(o===t&&a===e||t===r&&e===n||0===i)this.lineTo(t,e);else{var s=m([o-t,a-e]),h=m([r-t,n-e]);if(s[0]*h[1]!=s[1]*h[0]){var u=s[0]*h[0]+s[1]*h[1],c=Math.acos(Math.abs(u)),l=m([s[0]+h[0],s[1]+h[1]]),f=i/Math.sin(c/2),d=t+f*l[0],g=e+f*l[1],p=[-s[1],s[0]],_=[h[1],-h[0]],v=function(t){var e=t[0];return t[1]>=0?Math.acos(e):-Math.acos(e)},y=v(p),w=v(_);this.lineTo(d+p[0]*i,g+p[1]*i),this.arc(d,g,i,y,w)}else this.lineTo(t,e)}}},u.prototype.stroke=function(){"path"===this.__currentElement.nodeName&&this.__currentElement.setAttribute("paint-order","fill stroke markers"),this.__applyCurrentDefaultPath(),this.__applyStyleToCurrentElement("stroke")},u.prototype.fill=function(){"path"===this.__currentElement.nodeName&&this.__currentElement.setAttribute("paint-order","stroke fill markers"),this.__applyCurrentDefaultPath(),this.__applyStyleToCurrentElement("fill")},u.prototype.rect=function(t,e,r,n){"path"!==this.__currentElement.nodeName&&this.beginPath(),this.moveTo(t,e),this.lineTo(t+r,e),this.lineTo(t+r,e+n),this.lineTo(t,e+n),this.lineTo(t,e),this.closePath()},u.prototype.fillRect=function(t,e,r,n){var i;i=this.__createElement("rect",{x:t,y:e,width:r,height:n},!0),this.__closestGroupOrSvg().appendChild(i),this.__currentElement=i,this.__applyStyleToCurrentElement("fill")},u.prototype.strokeRect=function(t,e,r,n){var i;i=this.__createElement("rect",{x:t,y:e,width:r,height:n},!0),this.__closestGroupOrSvg().appendChild(i),this.__currentElement=i,this.__applyStyleToCurrentElement("stroke")},u.prototype.__clearCanvas=function(){for(var t=this.__closestGroupOrSvg().getAttribute("transform"),e=this.__root.childNodes[1],r=e.childNodes,n=r.length-1;n>=0;n--)r[n]&&e.removeChild(r[n]);this.__currentElement=e,this.__groupStack=[],t&&this.__addTransform(t)},u.prototype.clearRect=function(t,e,r,n){if(0!==t||0!==e||r!==this.width||n!==this.height){var i,o=this.__closestGroupOrSvg();i=this.__createElement("rect",{x:t,y:e,width:r,height:n,fill:"#FFFFFF"},!0),o.appendChild(i)}else this.__clearCanvas()},u.prototype.createLinearGradient=function(t,e,r,n){var i=this.__createElement("linearGradient",{id:_(this.__ids),x1:t+"px",x2:r+"px",y1:e+"px",y2:n+"px",gradientUnits:"userSpaceOnUse"},!1);return this.__defs.appendChild(i),new c(i,this)},u.prototype.createRadialGradient=function(t,e,r,n,i,o){var a=this.__createElement("radialGradient",{id:_(this.__ids),cx:n+"px",cy:i+"px",r:o+"px",fx:t+"px",fy:e+"px",gradientUnits:"userSpaceOnUse"},!1);return this.__defs.appendChild(a),new c(a,this)},u.prototype.__parseFont=function(){var t=/^\s*(?=(?:(?:[-a-z]+\s*){0,2}(italic|oblique))?)(?=(?:(?:[-a-z]+\s*){0,2}(small-caps))?)(?=(?:(?:[-a-z]+\s*){0,2}(bold(?:er)?|lighter|[1-9]00))?)(?:(?:normal|\1|\2|\3)\s*){0,3}((?:xx?-)?(?:small|large)|medium|smaller|larger|[.\d]+(?:\%|in|[cem]m|ex|p[ctx]))(?:\s*\/\s*(normal|[.\d]+(?:\%|in|[cem]m|ex|p[ctx])))?\s*([-,\'\"\sa-z0-9]+?)\s*$/i.exec(this.font),e={style:t[1]||"normal",size:t[4]||"10px",family:t[6]||"sans-serif",weight:t[3]||"normal",decoration:t[2]||"normal",href:null};return"underline"===this.__fontUnderline&&(e.decoration="underline"),this.__fontHref&&(e.href=this.__fontHref),e},u.prototype.__wrapTextLink=function(t,e){if(t.href){var r=this.__createElement("a");return r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",t.href),r.appendChild(e),r}return e},u.prototype.__applyText=function(t,e,r,n){var i,o,a=this.__parseFont(),s=this.__closestGroupOrSvg(),h=this.__createElement("text",{"font-family":a.family,"font-size":a.size,"font-style":a.style,"font-weight":a.weight,"text-decoration":a.decoration,x:e,y:r,"text-anchor":(i=this.textAlign,o={left:"start",right:"end",center:"middle",start:"start",end:"end"},o[i]||o.start),"dominant-baseline":v(this.textBaseline)},!0);h.appendChild(this.__document.createTextNode(t)),this.__currentElement=h,this.__applyStyleToCurrentElement(n),s.appendChild(this.__wrapTextLink(a,h))},u.prototype.fillText=function(t,e,r){this.__applyText(t,e,r,"fill")},u.prototype.strokeText=function(t,e,r){this.__applyText(t,e,r,"stroke")},u.prototype.measureText=function(t){return this.__ctx.font=this.font,this.__ctx.measureText(t)},u.prototype.arc=function(t,e,r,n,i,o){if(n!==i){(n%=2*Math.PI)===(i%=2*Math.PI)&&(i=(i+2*Math.PI-.001*(o?-1:1))%(2*Math.PI));var a=t+r*Math.cos(i),s=e+r*Math.sin(i),h=t+r*Math.cos(n),u=e+r*Math.sin(n),c=o?0:1,l=0,f=i-n;f<0&&(f+=2*Math.PI),l=o?f>Math.PI?0:1:f>Math.PI?1:0,this.lineTo(h,u),this.__addPathCommand(p("A {rx} {ry} {xAxisRotation} {largeArcFlag} {sweepFlag} {endX} {endY}",{rx:r,ry:r,xAxisRotation:0,largeArcFlag:l,sweepFlag:c,endX:a,endY:s})),this.__currentPosition={x:a,y:s}}},u.prototype.clip=function(){var t=this.__closestGroupOrSvg(),e=this.__createElement("clipPath"),r=_(this.__ids),n=this.__createElement("g");this.__applyCurrentDefaultPath(),t.removeChild(this.__currentElement),e.setAttribute("id",r),e.appendChild(this.__currentElement),this.__defs.appendChild(e),t.setAttribute("clip-path",p("url(#{id})",{id:r})),t.appendChild(n),this.__currentElement=n},u.prototype.drawImage=function(){var t,e,r,n,i,o,a,s,h,c,l,f,d,g,p=Array.prototype.slice.call(arguments),_=p[0],v=0,m=0;if(3===p.length)t=p[1],e=p[2],r=i=_.width,n=o=_.height;else if(5===p.length)t=p[1],e=p[2],r=p[3],n=p[4],i=_.width,o=_.height;else{if(9!==p.length)throw new Error("Inavlid number of arguments passed to drawImage: "+arguments.length);v=p[1],m=p[2],i=p[3],o=p[4],t=p[5],e=p[6],r=p[7],n=p[8]}a=this.__closestGroupOrSvg(),this.__currentElement;var y="translate("+t+", "+e+")";if(_ instanceof u){if((s=_.getSvg().cloneNode(!0)).childNodes&&s.childNodes.length>1){for(h=s.childNodes[0];h.childNodes.length;)g=h.childNodes[0].getAttribute("id"),this.__ids[g]=g,this.__defs.appendChild(h.childNodes[0]);if(c=s.childNodes[1]){var w,b=c.getAttribute("transform");w=b?b+" "+y:y,c.setAttribute("transform",w),a.appendChild(c)}}}else"IMG"===_.nodeName?((l=this.__createElement("image")).setAttribute("width",r),l.setAttribute("height",n),l.setAttribute("preserveAspectRatio","none"),(v||m||i!==_.width||o!==_.height)&&((f=this.__document.createElement("canvas")).width=r,f.height=n,(d=f.getContext("2d")).drawImage(_,v,m,i,o,0,0,r,n),_=f),l.setAttribute("transform",y),l.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href","CANVAS"===_.nodeName?_.toDataURL():_.getAttribute("src")),a.appendChild(l)):"CANVAS"===_.nodeName&&((l=this.__createElement("image")).setAttribute("width",r),l.setAttribute("height",n),l.setAttribute("preserveAspectRatio","none"),(f=this.__document.createElement("canvas")).width=r,f.height=n,(d=f.getContext("2d")).imageSmoothingEnabled=!1,d.mozImageSmoothingEnabled=!1,d.oImageSmoothingEnabled=!1,d.webkitImageSmoothingEnabled=!1,d.drawImage(_,v,m,i,o,0,0,r,n),_=f,l.setAttribute("transform",y),l.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",_.toDataURL()),a.appendChild(l))},u.prototype.drawImageSvg=function(){var t,e,r,n,i,o,a,s,h=Array.prototype.slice.call(arguments),u=h[0];if(3===h.length)t=h[1],e=h[2],r=u.width,n=u.height;else if(5===h.length)t=h[1],e=h[2],r=h[3],n=h[4],u.width,u.height;else{if(9!==h.length)throw new Error("Inavlid number of arguments passed to drawImage: "+arguments.length);h[1],h[2],h[3],h[4],t=h[5],e=h[6],r=h[7],n=h[8]}i=this.__closestGroupOrSvg(),this.__currentElement;var c="translate("+t+", "+e+")";if(u instanceof SVGSVGElement&&u.childNodes&&u.childNodes.length>1){var l=parseFloat(u.getAttribute("width")),f=parseFloat(u.getAttribute("height"));u.setAttribute("width",r),u.setAttribute("height",n);var d=r/l,g=n/f;for(o=u.childNodes[0];o.childNodes.length;)s=o.childNodes[0].getAttribute("id"),this.__ids[s]=s,this.__defs.appendChild(o.childNodes[0]);if(a=u.childNodes[1]){var p,_=a.getAttribute("transform");p=_?_+" "+c:c,a.setAttribute("transform",p+" scale("+d+", "+g+")"),i.appendChild(a)}}},u.prototype.createPattern=function(t,e){var r,n=this.__document.createElementNS("http://www.w3.org/2000/svg","pattern"),i=_(this.__ids);return n.setAttribute("id",i),n.setAttribute("width",t.width),n.setAttribute("height",t.height),"CANVAS"===t.nodeName||"IMG"===t.nodeName?((r=this.__document.createElementNS("http://www.w3.org/2000/svg","image")).setAttribute("width",t.width),r.setAttribute("height",t.height),r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href","CANVAS"===t.nodeName?t.toDataURL():t.getAttribute("src")),n.appendChild(r),this.__defs.appendChild(n)):t instanceof u&&(n.appendChild(t.__root.childNodes[1]),this.__defs.appendChild(n)),new l(n,this)},u.prototype.setLineDash=function(t){t&&t.length>0?this.lineDash=t.join(","):this.lineDash=null},u.prototype.drawFocusRing=function(){},u.prototype.createImageData=function(){},u.prototype.getImageData=function(){},u.prototype.putImageData=function(){},u.prototype.globalCompositeOperation=function(){},u.prototype.setTransform=function(){};for(var y=u,w=function(){function t(t){this._ctx=new y({width:t.width,height:t.height}),this._options=t}return Object.defineProperty(t.prototype,"context",{get:function(){return this._ctx},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this._options.width},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this._options.height},enumerable:!0,configurable:!0}),t.prototype.clear=function(){var t=this.context;t&&t.clearRect(0,0,this._options.width,this._options.height)},t.prototype.drawQR=function(t){return this.clear(),this.drawBackground(),this._qr=t,this._options.image?this.drawImageAndDots():(this.drawDots(),Promise.resolve())},t.prototype.drawBackground=function(){var t=this.context,e=this._options;t&&(t.fillStyle=e.backgroundOptions.color,t.fillRect(0,0,this._options.width,this._options.height))},t.prototype.drawDots=function(t){var e=this;if(!this._qr)throw"QR code is not defined";var r=this.context;if(!r)throw"QR code is not defined";var n=this._options,i=this._qr.getModuleCount();if(i>n.width||i>n.height)throw"The canvas is too small.";for(var o=Math.min(n.width,n.height),a=Math.floor(o/i),s=Math.floor((n.width-i*a)/2),h=Math.floor((n.height-i*a)/2),u=new g({context:r,type:n.dotsOptions.type}),c=function(o){for(var c=function(c){return t&&!t(o,c)?"continue":l._qr.isDark(o,c)?(r.fillStyle=n.dotsOptions.color,void u.draw(s+o*a,h+c*a,a,function(r,n){return!(o+r<0||c+n<0||o+r>=i||c+n>=i)&&(!(t&&!t(o+r,c+n))&&(!!e._qr&&e._qr.isDark(o+r,c+n)))})):"continue"},f=0;f<i;f++)c(f)},l=this,f=0;f<i;f++)c(f)},t.prototype.drawImageAndDots=function(){var t=this;return new Promise(function(e,r){if(!t._qr)return r("QR code is not defined");var n=t.context;if(!n)return r("QR code is not defined");var i=t._options,o=t._qr.getModuleCount(),a=Math.min(i.width,i.height),s=Math.floor(a/o),h=Math.floor((i.width-o*s)/2),u=Math.floor((i.height-o*s)/2),c=i.imageOptions.imageSize*d[i.qrOptions.errorCorrectionLevel];return i.image?fetch(i.image).then(function(t){return t.text()}).then(function(e){var r=(new DOMParser).parseFromString(e,"image/svg+xml").querySelector("svg");if(!r)throw"no svg found on given src";var a=Math.floor(c*o*o),l=function(t){var e=t.originalHeight,r=t.originalWidth,n=t.maxHiddenDots,i=t.maxHiddenAxisDots,o=t.dotSize,a={x:0,y:0},s={x:0,y:0};if(e<=0||r<=0||n<=0||o<=0)return{height:0,width:0,hideYDots:0,hideXDots:0};var h=e/r;return a.x=Math.floor(Math.sqrt(n/h)),a.x<=0&&(a.x=1),i&&i<a.x&&(a.x=i),a.x%2==0&&a.x--,s.x=a.x*o,a.y=1+2*Math.ceil((a.x*h-1)/2),s.y=Math.round(s.x*h),(a.y*a.x>n||i&&i<a.y)&&(i&&i<a.y?(a.y=i,a.y%2==0&&a.x--):a.y-=2,s.y=a.y*o,a.x=1+2*Math.ceil((a.y/h-1)/2),s.x=Math.round(s.y/h)),{height:s.y,width:s.x,hideYDots:a.y,hideXDots:a.x}}({originalWidth:parseFloat(r.getAttribute("width")||"64"),originalHeight:parseFloat(r.getAttribute("height")||"64"),maxHiddenDots:a,maxHiddenAxisDots:o-14,dotSize:s}),f=l.width,d=l.height,g=l.hideXDots,p=l.hideYDots;t.drawDots(function(t,e){return!i.imageOptions.hideBackgroundDots||(t<(o-g)/2||t>=(o+g)/2||e<(o-p)/2||e>=(o+p)/2)}),n.drawImageSvg(r,h+(o*s-f)/2,u+(o*s-d)/2,f,d)}).then(function(){e()}):r("Image is not defined")})},t}(),b={},x=0;x<=40;x++)b[x]=x;var A=b,C={L:"L",M:"M",Q:"Q",H:"H"},k={width:300,height:300,data:void 0,image:void 0,qrOptions:{typeNumber:A[0],mode:void 0,errorCorrectionLevel:C.Q},imageOptions:{hideBackgroundDots:!0,imageSize:.4,crossOrigin:void 0},dotsOptions:{type:"square",color:"#000"},backgroundOptions:{color:"#fff"}},S=r(0),M=r.n(S),E=function(){function t(t){this._options=t?s(k,t):k,this.update()}return t._clearContainer=function(t){t&&(t.innerHTML="")},t.prototype.update=function(e){t._clearContainer(this._container),this._options=e?s(this._options,e):this._options,this._options.data&&(this._qr=M()(this._options.qrOptions.typeNumber,this._options.qrOptions.errorCorrectionLevel),this._qr.addData(this._options.data,this._options.qrOptions.mode||function(t){switch(!0){case/^[0-9]*$/.test(t):return n.numeric;case/^[0-9A-Z $%*+\-./:]*$/.test(t):return n.alphanumeric;default:return n.byte}}(this._options.data)),this._qr.make(),this._canvas=new w(this._options),this._drawingPromise=this._canvas.drawQR(this._qr))},t.prototype.append=function(t){var e=this;if(t){if("function"!=typeof t.appendChild)throw"Container should be a single DOM node";this._drawingPromise&&this._drawingPromise.then(function(){e._canvas&&e._canvas.context&&(t.innerHTML=e._canvas.context.getSerializedSvg(!1)),e._container=t})}},t.prototype.getSerializedSvg=function(){var t=this;if(this._drawingPromise)return this._drawingPromise.then(function(){return t._canvas&&t._canvas.context?t._canvas.context.getSerializedSvg(!1):""})},t}(),P={dots:"dots",rounded:"rounded",square:"square"};r.d(e,"dotTypes",function(){return P}),r.d(e,"errorCorrectionLevels",function(){return C}),r.d(e,"errorCorrectionPercents",function(){return d}),r.d(e,"modes",function(){return n}),r.d(e,"qrTypes",function(){return A});e.default=E}]).default}); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.QRCodeStyling=e():t.QRCodeStyling=e()}(window,function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=1)}([function(t,e,r){var n,i,o,a=function(){var t=function(t,e){var r=t,n=h[e],i=null,o=0,a=null,s=[],u={},l=function(t,e){i=function(t){for(var e=new Array(t),r=0;r<t;r+=1){e[r]=new Array(t);for(var n=0;n<t;n+=1)e[r][n]=null}return e}(o=4*r+17),c(0,0),c(o-7,0),c(0,o-7),d(),f(),p(t,e),r>=7&&g(t),null==a&&(a=m(r,n,s)),_(a,e)},c=function(t,e){for(var r=-1;r<=7;r+=1)if(!(t+r<=-1||o<=t+r))for(var n=-1;n<=7;n+=1)e+n<=-1||o<=e+n||(i[t+r][e+n]=0<=r&&r<=6&&(0==n||6==n)||0<=n&&n<=6&&(0==r||6==r)||2<=r&&r<=4&&2<=n&&n<=4)},f=function(){for(var t=8;t<o-8;t+=1)null==i[t][6]&&(i[t][6]=t%2==0);for(var e=8;e<o-8;e+=1)null==i[6][e]&&(i[6][e]=e%2==0)},d=function(){for(var t=v.getPatternPosition(r),e=0;e<t.length;e+=1)for(var n=0;n<t.length;n+=1){var o=t[e],a=t[n];if(null==i[o][a])for(var s=-2;s<=2;s+=1)for(var h=-2;h<=2;h+=1)i[o+s][a+h]=-2==s||2==s||-2==h||2==h||0==s&&0==h}},g=function(t){for(var e=v.getBCHTypeNumber(r),n=0;n<18;n+=1){var a=!t&&1==(e>>n&1);i[Math.floor(n/3)][n%3+o-8-3]=a}for(n=0;n<18;n+=1){a=!t&&1==(e>>n&1);i[n%3+o-8-3][Math.floor(n/3)]=a}},p=function(t,e){for(var r=n<<3|e,a=v.getBCHTypeInfo(r),s=0;s<15;s+=1){var h=!t&&1==(a>>s&1);s<6?i[s][8]=h:s<8?i[s+1][8]=h:i[o-15+s][8]=h}for(s=0;s<15;s+=1){h=!t&&1==(a>>s&1);s<8?i[8][o-s-1]=h:s<9?i[8][15-s-1+1]=h:i[8][15-s-1]=h}i[o-8][8]=!t},_=function(t,e){for(var r=-1,n=o-1,a=7,s=0,h=v.getMaskFunction(e),u=o-1;u>0;u-=2)for(6==u&&(u-=1);;){for(var l=0;l<2;l+=1)if(null==i[n][u-l]){var c=!1;s<t.length&&(c=1==(t[s]>>>a&1)),h(n,u-l)&&(c=!c),i[n][u-l]=c,-1==(a-=1)&&(s+=1,a=7)}if((n+=r)<0||o<=n){n-=r,r=-r;break}}},m=function(t,e,r){for(var n=w.getRSBlocks(t,e),i=b(),o=0;o<r.length;o+=1){var a=r[o];i.put(a.getMode(),4),i.put(a.getLength(),v.getLengthInBits(a.getMode(),t)),a.write(i)}var s=0;for(o=0;o<n.length;o+=1)s+=n[o].dataCount;if(i.getLengthInBits()>8*s)throw"code length overflow. ("+i.getLengthInBits()+">"+8*s+")";for(i.getLengthInBits()+4<=8*s&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(!1);for(;!(i.getLengthInBits()>=8*s||(i.put(236,8),i.getLengthInBits()>=8*s));)i.put(17,8);return function(t,e){for(var r=0,n=0,i=0,o=new Array(e.length),a=new Array(e.length),s=0;s<e.length;s+=1){var h=e[s].dataCount,u=e[s].totalCount-h;n=Math.max(n,h),i=Math.max(i,u),o[s]=new Array(h);for(var l=0;l<o[s].length;l+=1)o[s][l]=255&t.getBuffer()[l+r];r+=h;var c=v.getErrorCorrectPolynomial(u),f=y(o[s],c.getLength()-1).mod(c);a[s]=new Array(c.getLength()-1);for(l=0;l<a[s].length;l+=1){var d=l+f.getLength()-a[s].length;a[s][l]=d>=0?f.getAt(d):0}}var g=0;for(l=0;l<e.length;l+=1)g+=e[l].totalCount;var p=new Array(g),_=0;for(l=0;l<n;l+=1)for(s=0;s<e.length;s+=1)l<o[s].length&&(p[_]=o[s][l],_+=1);for(l=0;l<i;l+=1)for(s=0;s<e.length;s+=1)l<a[s].length&&(p[_]=a[s][l],_+=1);return p}(i,n)};u.addData=function(t,e){var r=null;switch(e=e||"Byte"){case"Numeric":r=x(t);break;case"Alphanumeric":r=A(t);break;case"Byte":r=C(t);break;case"Kanji":r=k(t);break;default:throw"mode:"+e}s.push(r),a=null},u.isDark=function(t,e){if(t<0||o<=t||e<0||o<=e)throw t+","+e;return i[t][e]},u.getModuleCount=function(){return o},u.make=function(){if(r<1){for(var t=1;t<40;t++){for(var e=w.getRSBlocks(t,n),i=b(),o=0;o<s.length;o++){var a=s[o];i.put(a.getMode(),4),i.put(a.getLength(),v.getLengthInBits(a.getMode(),t)),a.write(i)}var h=0;for(o=0;o<e.length;o++)h+=e[o].dataCount;if(i.getLengthInBits()<=8*h)break}r=t}l(!1,function(){for(var t=0,e=0,r=0;r<8;r+=1){l(!0,r);var n=v.getLostPoint(u);(0==r||t>n)&&(t=n,e=r)}return e}())},u.createTableTag=function(t,e){t=t||2;var r="";r+='<table style="',r+=" border-width: 0px; border-style: none;",r+=" border-collapse: collapse;",r+=" padding: 0px; margin: "+(e=void 0===e?4*t:e)+"px;",r+='">',r+="<tbody>";for(var n=0;n<u.getModuleCount();n+=1){r+="<tr>";for(var i=0;i<u.getModuleCount();i+=1)r+='<td style="',r+=" border-width: 0px; border-style: none;",r+=" border-collapse: collapse;",r+=" padding: 0px; margin: 0px;",r+=" width: "+t+"px;",r+=" height: "+t+"px;",r+=" background-color: ",r+=u.isDark(n,i)?"#000000":"#ffffff",r+=";",r+='"/>';r+="</tr>"}return r+="</tbody>",r+="</table>"},u.createSvgTag=function(t,e){var r={};"object"==typeof arguments[0]&&(t=(r=arguments[0]).cellSize,e=r.margin),t=t||2,e=void 0===e?4*t:e;var n,i,o,a,s=u.getModuleCount()*t+2*e,h="";for(a="l"+t+",0 0,"+t+" -"+t+",0 0,-"+t+"z ",h+='<svg version="1.1" xmlns="http://www.w3.org/2000/svg"',h+=r.scalable?"":' width="'+s+'px" height="'+s+'px"',h+=' viewBox="0 0 '+s+" "+s+'" ',h+=' preserveAspectRatio="xMinYMin meet">',h+='<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>',h+='<path d="',i=0;i<u.getModuleCount();i+=1)for(o=i*t+e,n=0;n<u.getModuleCount();n+=1)u.isDark(i,n)&&(h+="M"+(n*t+e)+","+o+a);return h+='" stroke="transparent" fill="black"/>',h+="</svg>"},u.createDataURL=function(t,e){t=t||2,e=void 0===e?4*t:e;var r=u.getModuleCount()*t+2*e,n=e,i=r-e;return E(r,r,function(e,r){if(n<=e&&e<i&&n<=r&&r<i){var o=Math.floor((e-n)/t),a=Math.floor((r-n)/t);return u.isDark(a,o)?0:1}return 1})},u.createImgTag=function(t,e,r){t=t||2,e=void 0===e?4*t:e;var n=u.getModuleCount()*t+2*e,i="";return i+="<img",i+=' src="',i+=u.createDataURL(t,e),i+='"',i+=' width="',i+=n,i+='"',i+=' height="',i+=n,i+='"',r&&(i+=' alt="',i+=r,i+='"'),i+="/>"};return u.createASCII=function(t,e){if((t=t||1)<2)return function(t){t=void 0===t?2:t;var e,r,n,i,o,a=1*u.getModuleCount()+2*t,s=t,h=a-t,l={"██":"█","█ ":"▀"," █":"▄"," ":" "},c={"██":"▀","█ ":"▀"," █":" "," ":" "},f="";for(e=0;e<a;e+=2){for(n=Math.floor((e-s)/1),i=Math.floor((e+1-s)/1),r=0;r<a;r+=1)o="█",s<=r&&r<h&&s<=e&&e<h&&u.isDark(n,Math.floor((r-s)/1))&&(o=" "),s<=r&&r<h&&s<=e+1&&e+1<h&&u.isDark(i,Math.floor((r-s)/1))?o+=" ":o+="█",f+=t<1&&e+1>=h?c[o]:l[o];f+="\n"}return a%2&&t>0?f.substring(0,f.length-a-1)+Array(a+1).join("▀"):f.substring(0,f.length-1)}(e);t-=1,e=void 0===e?2*t:e;var r,n,i,o,a=u.getModuleCount()*t+2*e,s=e,h=a-e,l=Array(t+1).join("██"),c=Array(t+1).join(" "),f="",d="";for(r=0;r<a;r+=1){for(i=Math.floor((r-s)/t),d="",n=0;n<a;n+=1)o=1,s<=n&&n<h&&s<=r&&r<h&&u.isDark(i,Math.floor((n-s)/t))&&(o=0),d+=o?l:c;for(i=0;i<t;i+=1)f+=d+"\n"}return f.substring(0,f.length-1)},u.renderTo2dContext=function(t,e){e=e||2;for(var r=u.getModuleCount(),n=0;n<r;n++)for(var i=0;i<r;i++)t.fillStyle=u.isDark(n,i)?"black":"white",t.fillRect(n*e,i*e,e,e)},u};t.stringToBytes=(t.stringToBytesFuncs={default:function(t){for(var e=[],r=0;r<t.length;r+=1){var n=t.charCodeAt(r);e.push(255&n)}return e}}).default,t.createStringToBytes=function(t,e){var r=function(){for(var r=M(t),n=function(){var t=r.read();if(-1==t)throw"eof";return t},i=0,o={};;){var a=r.read();if(-1==a)break;var s=n(),h=n()<<8|n();o[String.fromCharCode(a<<8|s)]=h,i+=1}if(i!=e)throw i+" != "+e;return o}(),n="?".charCodeAt(0);return function(t){for(var e=[],i=0;i<t.length;i+=1){var o=t.charCodeAt(i);if(o<128)e.push(o);else{var a=r[t.charAt(i)];"number"==typeof a?(255&a)==a?e.push(a):(e.push(a>>>8),e.push(255&a)):e.push(n)}}return e}};var e,r,n,i=1,o=2,a=4,s=8,h={L:1,M:0,Q:3,H:2},u=0,l=1,c=2,f=3,d=4,g=5,p=6,_=7,v=(e=[[],[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]],n=function(t){for(var e=0;0!=t;)e+=1,t>>>=1;return e},(r={}).getBCHTypeInfo=function(t){for(var e=t<<10;n(e)-n(1335)>=0;)e^=1335<<n(e)-n(1335);return 21522^(t<<10|e)},r.getBCHTypeNumber=function(t){for(var e=t<<12;n(e)-n(7973)>=0;)e^=7973<<n(e)-n(7973);return t<<12|e},r.getPatternPosition=function(t){return e[t-1]},r.getMaskFunction=function(t){switch(t){case u:return function(t,e){return(t+e)%2==0};case l:return function(t,e){return t%2==0};case c:return function(t,e){return e%3==0};case f:return function(t,e){return(t+e)%3==0};case d:return function(t,e){return(Math.floor(t/2)+Math.floor(e/3))%2==0};case g:return function(t,e){return t*e%2+t*e%3==0};case p:return function(t,e){return(t*e%2+t*e%3)%2==0};case _:return function(t,e){return(t*e%3+(t+e)%2)%2==0};default:throw"bad maskPattern:"+t}},r.getErrorCorrectPolynomial=function(t){for(var e=y([1],0),r=0;r<t;r+=1)e=e.multiply(y([1,m.gexp(r)],0));return e},r.getLengthInBits=function(t,e){if(1<=e&&e<10)switch(t){case i:return 10;case o:return 9;case a:case s:return 8;default:throw"mode:"+t}else if(e<27)switch(t){case i:return 12;case o:return 11;case a:return 16;case s:return 10;default:throw"mode:"+t}else{if(!(e<41))throw"type:"+e;switch(t){case i:return 14;case o:return 13;case a:return 16;case s:return 12;default:throw"mode:"+t}}},r.getLostPoint=function(t){for(var e=t.getModuleCount(),r=0,n=0;n<e;n+=1)for(var i=0;i<e;i+=1){for(var o=0,a=t.isDark(n,i),s=-1;s<=1;s+=1)if(!(n+s<0||e<=n+s))for(var h=-1;h<=1;h+=1)i+h<0||e<=i+h||0==s&&0==h||a==t.isDark(n+s,i+h)&&(o+=1);o>5&&(r+=3+o-5)}for(n=0;n<e-1;n+=1)for(i=0;i<e-1;i+=1){var u=0;t.isDark(n,i)&&(u+=1),t.isDark(n+1,i)&&(u+=1),t.isDark(n,i+1)&&(u+=1),t.isDark(n+1,i+1)&&(u+=1),0!=u&&4!=u||(r+=3)}for(n=0;n<e;n+=1)for(i=0;i<e-6;i+=1)t.isDark(n,i)&&!t.isDark(n,i+1)&&t.isDark(n,i+2)&&t.isDark(n,i+3)&&t.isDark(n,i+4)&&!t.isDark(n,i+5)&&t.isDark(n,i+6)&&(r+=40);for(i=0;i<e;i+=1)for(n=0;n<e-6;n+=1)t.isDark(n,i)&&!t.isDark(n+1,i)&&t.isDark(n+2,i)&&t.isDark(n+3,i)&&t.isDark(n+4,i)&&!t.isDark(n+5,i)&&t.isDark(n+6,i)&&(r+=40);var l=0;for(i=0;i<e;i+=1)for(n=0;n<e;n+=1)t.isDark(n,i)&&(l+=1);return r+=Math.abs(100*l/e/e-50)/5*10},r),m=function(){for(var t=new Array(256),e=new Array(256),r=0;r<8;r+=1)t[r]=1<<r;for(r=8;r<256;r+=1)t[r]=t[r-4]^t[r-5]^t[r-6]^t[r-8];for(r=0;r<255;r+=1)e[t[r]]=r;var n={glog:function(t){if(t<1)throw"glog("+t+")";return e[t]},gexp:function(e){for(;e<0;)e+=255;for(;e>=256;)e-=255;return t[e]}};return n}();function y(t,e){if(void 0===t.length)throw t.length+"/"+e;var r=function(){for(var r=0;r<t.length&&0==t[r];)r+=1;for(var n=new Array(t.length-r+e),i=0;i<t.length-r;i+=1)n[i]=t[i+r];return n}(),n={getAt:function(t){return r[t]},getLength:function(){return r.length},multiply:function(t){for(var e=new Array(n.getLength()+t.getLength()-1),r=0;r<n.getLength();r+=1)for(var i=0;i<t.getLength();i+=1)e[r+i]^=m.gexp(m.glog(n.getAt(r))+m.glog(t.getAt(i)));return y(e,0)},mod:function(t){if(n.getLength()-t.getLength()<0)return n;for(var e=m.glog(n.getAt(0))-m.glog(t.getAt(0)),r=new Array(n.getLength()),i=0;i<n.getLength();i+=1)r[i]=n.getAt(i);for(i=0;i<t.getLength();i+=1)r[i]^=m.gexp(m.glog(t.getAt(i))+e);return y(r,0).mod(t)}};return n}var w=function(){var t=[[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]],e=function(t,e){var r={};return r.totalCount=t,r.dataCount=e,r},r={};return r.getRSBlocks=function(r,n){var i=function(e,r){switch(r){case h.L:return t[4*(e-1)+0];case h.M:return t[4*(e-1)+1];case h.Q:return t[4*(e-1)+2];case h.H:return t[4*(e-1)+3];default:return}}(r,n);if(void 0===i)throw"bad rs block @ typeNumber:"+r+"/errorCorrectionLevel:"+n;for(var o=i.length/3,a=[],s=0;s<o;s+=1)for(var u=i[3*s+0],l=i[3*s+1],c=i[3*s+2],f=0;f<u;f+=1)a.push(e(l,c));return a},r}(),b=function(){var t=[],e=0,r={getBuffer:function(){return t},getAt:function(e){var r=Math.floor(e/8);return 1==(t[r]>>>7-e%8&1)},put:function(t,e){for(var n=0;n<e;n+=1)r.putBit(1==(t>>>e-n-1&1))},getLengthInBits:function(){return e},putBit:function(r){var n=Math.floor(e/8);t.length<=n&&t.push(0),r&&(t[n]|=128>>>e%8),e+=1}};return r},x=function(t){var e=i,r=t,n={getMode:function(){return e},getLength:function(t){return r.length},write:function(t){for(var e=r,n=0;n+2<e.length;)t.put(o(e.substring(n,n+3)),10),n+=3;n<e.length&&(e.length-n==1?t.put(o(e.substring(n,n+1)),4):e.length-n==2&&t.put(o(e.substring(n,n+2)),7))}},o=function(t){for(var e=0,r=0;r<t.length;r+=1)e=10*e+a(t.charAt(r));return e},a=function(t){if("0"<=t&&t<="9")return t.charCodeAt(0)-"0".charCodeAt(0);throw"illegal char :"+t};return n},A=function(t){var e=o,r=t,n={getMode:function(){return e},getLength:function(t){return r.length},write:function(t){for(var e=r,n=0;n+1<e.length;)t.put(45*i(e.charAt(n))+i(e.charAt(n+1)),11),n+=2;n<e.length&&t.put(i(e.charAt(n)),6)}},i=function(t){if("0"<=t&&t<="9")return t.charCodeAt(0)-"0".charCodeAt(0);if("A"<=t&&t<="Z")return t.charCodeAt(0)-"A".charCodeAt(0)+10;switch(t){case" ":return 36;case"$":return 37;case"%":return 38;case"*":return 39;case"+":return 40;case"-":return 41;case".":return 42;case"/":return 43;case":":return 44;default:throw"illegal char :"+t}};return n},C=function(e){var r=a,n=t.stringToBytes(e),i={getMode:function(){return r},getLength:function(t){return n.length},write:function(t){for(var e=0;e<n.length;e+=1)t.put(n[e],8)}};return i},k=function(e){var r=s,n=t.stringToBytesFuncs.SJIS;if(!n)throw"sjis not supported.";!function(t,e){var r=n("友");if(2!=r.length||38726!=(r[0]<<8|r[1]))throw"sjis not supported."}();var i=n(e),o={getMode:function(){return r},getLength:function(t){return~~(i.length/2)},write:function(t){for(var e=i,r=0;r+1<e.length;){var n=(255&e[r])<<8|255&e[r+1];if(33088<=n&&n<=40956)n-=33088;else{if(!(57408<=n&&n<=60351))throw"illegal char at "+(r+1)+"/"+n;n-=49472}n=192*(n>>>8&255)+(255&n),t.put(n,13),r+=2}if(r<e.length)throw"illegal char at "+(r+1)}};return o},S=function(){var t=[],e={writeByte:function(e){t.push(255&e)},writeShort:function(t){e.writeByte(t),e.writeByte(t>>>8)},writeBytes:function(t,r,n){r=r||0,n=n||t.length;for(var i=0;i<n;i+=1)e.writeByte(t[i+r])},writeString:function(t){for(var r=0;r<t.length;r+=1)e.writeByte(t.charCodeAt(r))},toByteArray:function(){return t},toString:function(){var e="";e+="[";for(var r=0;r<t.length;r+=1)r>0&&(e+=","),e+=t[r];return e+="]"}};return e},M=function(t){var e=t,r=0,n=0,i=0,o={read:function(){for(;i<8;){if(r>=e.length){if(0==i)return-1;throw"unexpected end of file./"+i}var t=e.charAt(r);if(r+=1,"="==t)return i=0,-1;t.match(/^\s$/)||(n=n<<6|a(t.charCodeAt(0)),i+=6)}var o=n>>>i-8&255;return i-=8,o}},a=function(t){if(65<=t&&t<=90)return t-65;if(97<=t&&t<=122)return t-97+26;if(48<=t&&t<=57)return t-48+52;if(43==t)return 62;if(47==t)return 63;throw"c:"+t};return o},E=function(t,e,r){for(var n=function(t,e){var r=t,n=e,i=new Array(t*e),o={setPixel:function(t,e,n){i[e*r+t]=n},write:function(t){t.writeString("GIF87a"),t.writeShort(r),t.writeShort(n),t.writeByte(128),t.writeByte(0),t.writeByte(0),t.writeByte(0),t.writeByte(0),t.writeByte(0),t.writeByte(255),t.writeByte(255),t.writeByte(255),t.writeString(","),t.writeShort(0),t.writeShort(0),t.writeShort(r),t.writeShort(n),t.writeByte(0);var e=a(2);t.writeByte(2);for(var i=0;e.length-i>255;)t.writeByte(255),t.writeBytes(e,i,255),i+=255;t.writeByte(e.length-i),t.writeBytes(e,i,e.length-i),t.writeByte(0),t.writeString(";")}},a=function(t){for(var e=1<<t,r=1+(1<<t),n=t+1,o=s(),a=0;a<e;a+=1)o.add(String.fromCharCode(a));o.add(String.fromCharCode(e)),o.add(String.fromCharCode(r));var h=S(),u=function(t){var e=t,r=0,n=0,i={write:function(t,i){if(t>>>i!=0)throw"length over";for(;r+i>=8;)e.writeByte(255&(t<<r|n)),i-=8-r,t>>>=8-r,n=0,r=0;n|=t<<r,r+=i},flush:function(){r>0&&e.writeByte(n)}};return i}(h);u.write(e,n);var l=0,c=String.fromCharCode(i[l]);for(l+=1;l<i.length;){var f=String.fromCharCode(i[l]);l+=1,o.contains(c+f)?c+=f:(u.write(o.indexOf(c),n),o.size()<4095&&(o.size()==1<<n&&(n+=1),o.add(c+f)),c=f)}return u.write(o.indexOf(c),n),u.write(r,n),u.flush(),h.toByteArray()},s=function(){var t={},e=0,r={add:function(n){if(r.contains(n))throw"dup key:"+n;t[n]=e,e+=1},size:function(){return e},indexOf:function(e){return t[e]},contains:function(e){return void 0!==t[e]}};return r};return o}(t,e),i=0;i<e;i+=1)for(var o=0;o<t;o+=1)n.setPixel(o,i,r(o,i));var a=S();n.write(a);for(var s=function(){var t=0,e=0,r=0,n="",i={},o=function(t){n+=String.fromCharCode(a(63&t))},a=function(t){if(t<0);else{if(t<26)return 65+t;if(t<52)return t-26+97;if(t<62)return t-52+48;if(62==t)return 43;if(63==t)return 47}throw"n:"+t};return i.writeByte=function(n){for(t=t<<8|255&n,e+=8,r+=1;e>=6;)o(t>>>e-6),e-=6},i.flush=function(){if(e>0&&(o(t<<6-e),t=0,e=0),r%3!=0)for(var i=3-r%3,a=0;a<i;a+=1)n+="="},i.toString=function(){return n},i}(),h=a.toByteArray(),u=0;u<h.length;u+=1)s.writeByte(h[u]);return s.flush(),"data:image/gif;base64,"+s};return t}();a.stringToBytesFuncs["UTF-8"]=function(t){return function(t){for(var e=[],r=0;r<t.length;r++){var n=t.charCodeAt(r);n<128?e.push(n):n<2048?e.push(192|n>>6,128|63&n):n<55296||n>=57344?e.push(224|n>>12,128|n>>6&63,128|63&n):(r++,n=65536+((1023&n)<<10|1023&t.charCodeAt(r)),e.push(240|n>>18,128|n>>12&63,128|n>>6&63,128|63&n))}return e}(t)},i=[],void 0===(o="function"==typeof(n=function(){return a})?n.apply(e,i):n)||(t.exports=o)},function(t,e,r){"use strict";r.r(e);var n={numeric:"Numeric",alphanumeric:"Alphanumeric",byte:"Byte",kanji:"Kanji"};var i=function(){return(i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},o=function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;var n=Array(t),i=0;for(e=0;e<r;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,i++)n[i]=o[a];return n},a=function(t){return!!t&&"object"==typeof t&&!Array.isArray(t)};function s(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];if(!e.length)return t;var n=e.shift();return void 0!==n&&a(t)&&a(n)?(t=i({},t),Object.keys(n).forEach(function(e){var r=t[e],i=n[e];Array.isArray(r)&&Array.isArray(i)?t[e]=r.concat(i):a(r)&&a(i)?t[e]=s(Object.assign({},r),i):t[e]=i}),s.apply(void 0,o([t],e))):t}var h,u,l,c,f,d={L:.07,M:.15,Q:.25,H:.3},g=function(){function t(t){var e=t.context,r=t.type;this._context=e,this._type=r}return t.prototype.draw=function(t,e,r,n){var i,o=this._context;switch(this._type){case"dots":i=this._drawDots;break;case"rounded":i=this._drawRounded;break;case"square":default:i=this._drawSquare}i({x:t,y:e,size:r,context:o,getNeighbor:n})},t.prototype._drawDots=function(t){var e=t.x,r=t.y,n=t.size,i=t.context;i.beginPath(),i.arc(e+n/2,r+n/2,n/2,0,2*Math.PI),i.fill()},t.prototype._drawSquare=function(t){var e=t.x,r=t.y,n=t.size;t.context.fillRect(e,r,n,n)},t.prototype._drawRounded=function(t){var e=t.x,r=t.y,n=t.size,i=t.context,o=t.getNeighbor;i.beginPath(),i.moveTo(e,r+n/2),o(-1,0)||o(0,-1)?(i.lineTo(e,r),i.lineTo(e+n/2,r)):i.arc(e+n/2,r+n/2,n/2,-Math.PI,-Math.PI/2),o(0,-1)||o(1,0)?(i.lineTo(e+n,r),i.lineTo(e+n,r+n/2)):i.arc(e+n/2,r+n/2,n/2,-Math.PI/2,0),o(1,0)||o(0,1)?(i.lineTo(e+n,r+n),i.lineTo(e+n/2,r+n)):i.arc(e+n/2,r+n/2,n/2,0,Math.PI/2),o(0,1)||o(-1,0)?(i.lineTo(e,r+n),i.lineTo(e,r+n/2)):i.arc(e+n/2,r+n/2,n/2,Math.PI/2,Math.PI),i.fill()},t}();function p(t,e){var r,n=Object.keys(e);for(r=0;r<n.length;r++)t=t.replace(new RegExp("\\{"+n[r]+"\\}","gi"),e[n[r]]);return t}function _(t){var e,r,n;if(!t)throw new Error("cannot create a random attribute name for an undefined object");e="ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz",r="";do{for(r="",n=0;n<12;n++)r+=e[Math.floor(Math.random()*e.length)]}while(t[r]);return r}function v(t){var e={alphabetic:"alphabetic",hanging:"hanging",top:"text-before-edge",bottom:"text-after-edge",middle:"central"};return e[t]||e.alphabetic}f=function(t,e){var r,n,i,o={};for(t=t.split(","),e=e||10,r=0;r<t.length;r+=2)n="&"+t[r+1]+";",i=parseInt(t[r],e),o[n]="&#"+i+";";return o["\\xa0"]=" ",o}("50,nbsp,51,iexcl,52,cent,53,pound,54,curren,55,yen,56,brvbar,57,sect,58,uml,59,copy,5a,ordf,5b,laquo,5c,not,5d,shy,5e,reg,5f,macr,5g,deg,5h,plusmn,5i,sup2,5j,sup3,5k,acute,5l,micro,5m,para,5n,middot,5o,cedil,5p,sup1,5q,ordm,5r,raquo,5s,frac14,5t,frac12,5u,frac34,5v,iquest,60,Agrave,61,Aacute,62,Acirc,63,Atilde,64,Auml,65,Aring,66,AElig,67,Ccedil,68,Egrave,69,Eacute,6a,Ecirc,6b,Euml,6c,Igrave,6d,Iacute,6e,Icirc,6f,Iuml,6g,ETH,6h,Ntilde,6i,Ograve,6j,Oacute,6k,Ocirc,6l,Otilde,6m,Ouml,6n,times,6o,Oslash,6p,Ugrave,6q,Uacute,6r,Ucirc,6s,Uuml,6t,Yacute,6u,THORN,6v,szlig,70,agrave,71,aacute,72,acirc,73,atilde,74,auml,75,aring,76,aelig,77,ccedil,78,egrave,79,eacute,7a,ecirc,7b,euml,7c,igrave,7d,iacute,7e,icirc,7f,iuml,7g,eth,7h,ntilde,7i,ograve,7j,oacute,7k,ocirc,7l,otilde,7m,ouml,7n,divide,7o,oslash,7p,ugrave,7q,uacute,7r,ucirc,7s,uuml,7t,yacute,7u,thorn,7v,yuml,ci,fnof,sh,Alpha,si,Beta,sj,Gamma,sk,Delta,sl,Epsilon,sm,Zeta,sn,Eta,so,Theta,sp,Iota,sq,Kappa,sr,Lambda,ss,Mu,st,Nu,su,Xi,sv,Omicron,t0,Pi,t1,Rho,t3,Sigma,t4,Tau,t5,Upsilon,t6,Phi,t7,Chi,t8,Psi,t9,Omega,th,alpha,ti,beta,tj,gamma,tk,delta,tl,epsilon,tm,zeta,tn,eta,to,theta,tp,iota,tq,kappa,tr,lambda,ts,mu,tt,nu,tu,xi,tv,omicron,u0,pi,u1,rho,u2,sigmaf,u3,sigma,u4,tau,u5,upsilon,u6,phi,u7,chi,u8,psi,u9,omega,uh,thetasym,ui,upsih,um,piv,812,bull,816,hellip,81i,prime,81j,Prime,81u,oline,824,frasl,88o,weierp,88h,image,88s,real,892,trade,89l,alefsym,8cg,larr,8ch,uarr,8ci,rarr,8cj,darr,8ck,harr,8dl,crarr,8eg,lArr,8eh,uArr,8ei,rArr,8ej,dArr,8ek,hArr,8g0,forall,8g2,part,8g3,exist,8g5,empty,8g7,nabla,8g8,isin,8g9,notin,8gb,ni,8gf,prod,8gh,sum,8gi,minus,8gn,lowast,8gq,radic,8gt,prop,8gu,infin,8h0,ang,8h7,and,8h8,or,8h9,cap,8ha,cup,8hb,int,8hk,there4,8hs,sim,8i5,cong,8i8,asymp,8j0,ne,8j1,equiv,8j4,le,8j5,ge,8k2,sub,8k3,sup,8k4,nsub,8k6,sube,8k7,supe,8kl,oplus,8kn,otimes,8l5,perp,8m5,sdot,8o8,lceil,8o9,rceil,8oa,lfloor,8ob,rfloor,8p9,lang,8pa,rang,9ea,loz,9j0,spades,9j3,clubs,9j5,hearts,9j6,diams,ai,OElig,aj,oelig,b0,Scaron,b1,scaron,bo,Yuml,m6,circ,ms,tilde,802,ensp,803,emsp,809,thinsp,80c,zwnj,80d,zwj,80e,lrm,80f,rlm,80j,ndash,80k,mdash,80o,lsquo,80p,rsquo,80q,sbquo,80s,ldquo,80t,rdquo,80u,bdquo,810,dagger,811,Dagger,81g,permil,81p,lsaquo,81q,rsaquo,85c,euro",32),h={strokeStyle:{svgAttr:"stroke",canvas:"#000000",svg:"none",apply:"stroke"},fillStyle:{svgAttr:"fill",canvas:"#000000",svg:null,apply:"fill"},lineCap:{svgAttr:"stroke-linecap",canvas:"butt",svg:"butt",apply:"stroke"},lineJoin:{svgAttr:"stroke-linejoin",canvas:"miter",svg:"miter",apply:"stroke"},miterLimit:{svgAttr:"stroke-miterlimit",canvas:10,svg:4,apply:"stroke"},lineWidth:{svgAttr:"stroke-width",canvas:1,svg:1,apply:"stroke"},globalAlpha:{svgAttr:"opacity",canvas:1,svg:1,apply:"fill stroke"},font:{canvas:"10px sans-serif"},shadowColor:{canvas:"#000000"},shadowOffsetX:{canvas:0},shadowOffsetY:{canvas:0},shadowBlur:{canvas:0},textAlign:{canvas:"start"},textBaseline:{canvas:"alphabetic"},lineDash:{svgAttr:"stroke-dasharray",canvas:[],svg:null,apply:"stroke"}},(l=function(t,e){this.__root=t,this.__ctx=e}).prototype.addColorStop=function(t,e){var r,n=this.__ctx.__createElement("stop");n.setAttribute("offset",t),-1!==e.indexOf("rgba")?(r=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?\.?\d*)\s*\)/gi.exec(e),n.setAttribute("stop-color",p("rgb({r},{g},{b})",{r:r[1],g:r[2],b:r[3]})),n.setAttribute("stop-opacity",r[4])):n.setAttribute("stop-color",e),this.__root.appendChild(n)},c=function(t,e){this.__root=t,this.__ctx=e},(u=function(t){var e,r={width:500,height:500,enableMirroring:!1};if(arguments.length>1?((e=r).width=arguments[0],e.height=arguments[1]):e=t||r,!(this instanceof u))return new u(e);this.width=e.width||r.width,this.height=e.height||r.height,this.enableMirroring=void 0!==e.enableMirroring?e.enableMirroring:r.enableMirroring,this.canvas=this,this.__document=e.document||document,e.ctx?this.__ctx=e.ctx:(this.__canvas=this.__document.createElement("canvas"),this.__ctx=this.__canvas.getContext("2d")),this.__setDefaultStyles(),this.__stack=[this.__getStyleState()],this.__groupStack=[],this.__root=this.__document.createElementNS("http://www.w3.org/2000/svg","svg"),this.__root.setAttribute("version",1.1),this.__root.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.__root.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink"),this.__root.setAttribute("width",this.width),this.__root.setAttribute("height",this.height),this.__ids={},this.__defs=this.__document.createElementNS("http://www.w3.org/2000/svg","defs"),this.__root.appendChild(this.__defs),this.__currentElement=this.__document.createElementNS("http://www.w3.org/2000/svg","g"),this.__root.appendChild(this.__currentElement)}).prototype.__createElement=function(t,e,r){void 0===e&&(e={});var n,i,o=this.__document.createElementNS("http://www.w3.org/2000/svg",t),a=Object.keys(e);for(r&&(o.setAttribute("fill","none"),o.setAttribute("stroke","none")),n=0;n<a.length;n++)i=a[n],o.setAttribute(i,e[i]);return o},u.prototype.__setDefaultStyles=function(){var t,e,r=Object.keys(h);for(t=0;t<r.length;t++)this[e=r[t]]=h[e].canvas},u.prototype.__applyStyleState=function(t){var e,r,n=Object.keys(t);for(e=0;e<n.length;e++)this[r=n[e]]=t[r]},u.prototype.__getStyleState=function(){var t,e,r={},n=Object.keys(h);for(t=0;t<n.length;t++)r[e=n[t]]=this[e];return r},u.prototype.__applyStyleToCurrentElement=function(t){var e=this.__currentElement,r=this.__currentElementsToStyle;r&&(e.setAttribute(t,""),e=r.element,r.children.forEach(function(e){e.setAttribute(t,"")}));var n,i,o,a,s,u=Object.keys(h);for(n=0;n<u.length;n++)if(i=h[u[n]],o=this[u[n]],i.apply)if(o instanceof c){if(o.__ctx)for(;o.__ctx.__defs.childNodes.length;)a=o.__ctx.__defs.childNodes[0].getAttribute("id"),this.__ids[a]=a,this.__defs.appendChild(o.__ctx.__defs.childNodes[0]);e.setAttribute(i.apply,p("url(#{id})",{id:o.__root.getAttribute("id")}))}else if(o instanceof l)e.setAttribute(i.apply,p("url(#{id})",{id:o.__root.getAttribute("id")}));else if(-1!==i.apply.indexOf(t)&&i.svg!==o)if("stroke"!==i.svgAttr&&"fill"!==i.svgAttr||-1===o.indexOf("rgba")){var f=i.svgAttr;if("globalAlpha"===u[n]&&(f=t+"-"+i.svgAttr,e.getAttribute(f)))continue;e.setAttribute(f,o)}else{s=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?\.?\d*)\s*\)/gi.exec(o),e.setAttribute(i.svgAttr,p("rgb({r},{g},{b})",{r:s[1],g:s[2],b:s[3]}));var d=s[4],g=this.globalAlpha;null!=g&&(d*=g),e.setAttribute(i.svgAttr+"-opacity",d)}},u.prototype.__closestGroupOrSvg=function(t){return"g"===(t=t||this.__currentElement).nodeName||"svg"===t.nodeName?t:this.__closestGroupOrSvg(t.parentNode)},u.prototype.getSerializedSvg=function(t){var e,r,n,i,o,a=(new XMLSerializer).serializeToString(this.__root);if(/xmlns="http:\/\/www\.w3\.org\/2000\/svg".+xmlns="http:\/\/www\.w3\.org\/2000\/svg/gi.test(a)&&(a=a.replace('xmlns="http://www.w3.org/2000/svg','xmlns:xlink="http://www.w3.org/1999/xlink')),t)for(e=Object.keys(f),r=0;r<e.length;r++)n=e[r],i=f[n],(o=new RegExp(n,"gi")).test(a)&&(a=a.replace(o,i));return a},u.prototype.getSvg=function(){return this.__root},u.prototype.save=function(){var t=this.__createElement("g"),e=this.__closestGroupOrSvg();this.__groupStack.push(e),e.appendChild(t),this.__currentElement=t,this.__stack.push(this.__getStyleState())},u.prototype.restore=function(){this.__currentElement=this.__groupStack.pop(),this.__currentElementsToStyle=null,this.__currentElement||(this.__currentElement=this.__root.childNodes[1]);var t=this.__stack.pop();this.__applyStyleState(t)},u.prototype.__addTransform=function(t){var e=this.__closestGroupOrSvg();if(e.childNodes.length>0){"path"===this.__currentElement.nodeName&&(this.__currentElementsToStyle||(this.__currentElementsToStyle={element:e,children:[]}),this.__currentElementsToStyle.children.push(this.__currentElement),this.__applyCurrentDefaultPath());var r=this.__createElement("g");e.appendChild(r),this.__currentElement=r}var n=this.__currentElement.getAttribute("transform");n?n+=" ":n="",n+=t,this.__currentElement.setAttribute("transform",n)},u.prototype.scale=function(t,e){void 0===e&&(e=t),this.__addTransform(p("scale({x},{y})",{x:t,y:e}))},u.prototype.rotate=function(t){var e=180*t/Math.PI;this.__addTransform(p("rotate({angle},{cx},{cy})",{angle:e,cx:0,cy:0}))},u.prototype.translate=function(t,e){this.__addTransform(p("translate({x},{y})",{x:t,y:e}))},u.prototype.transform=function(t,e,r,n,i,o){this.__addTransform(p("matrix({a},{b},{c},{d},{e},{f})",{a:t,b:e,c:r,d:n,e:i,f:o}))},u.prototype.beginPath=function(){var t;this.__currentDefaultPath="",this.__currentPosition={},t=this.__createElement("path",{},!0),this.__closestGroupOrSvg().appendChild(t),this.__currentElement=t},u.prototype.__applyCurrentDefaultPath=function(){var t=this.__currentElement;"path"===t.nodeName?t.setAttribute("d",this.__currentDefaultPath):console.error("Attempted to apply path command to node",t.nodeName)},u.prototype.__addPathCommand=function(t){this.__currentDefaultPath+=" ",this.__currentDefaultPath+=t},u.prototype.moveTo=function(t,e){"path"!==this.__currentElement.nodeName&&this.beginPath(),this.__currentPosition={x:t,y:e},this.__addPathCommand(p("M {x} {y}",{x:t,y:e}))},u.prototype.closePath=function(){this.__currentDefaultPath&&this.__addPathCommand("Z")},u.prototype.lineTo=function(t,e){this.__currentPosition={x:t,y:e},this.__currentDefaultPath.indexOf("M")>-1?this.__addPathCommand(p("L {x} {y}",{x:t,y:e})):this.__addPathCommand(p("M {x} {y}",{x:t,y:e}))},u.prototype.bezierCurveTo=function(t,e,r,n,i,o){this.__currentPosition={x:i,y:o},this.__addPathCommand(p("C {cp1x} {cp1y} {cp2x} {cp2y} {x} {y}",{cp1x:t,cp1y:e,cp2x:r,cp2y:n,x:i,y:o}))},u.prototype.quadraticCurveTo=function(t,e,r,n){this.__currentPosition={x:r,y:n},this.__addPathCommand(p("Q {cpx} {cpy} {x} {y}",{cpx:t,cpy:e,x:r,y:n}))};var m=function(t){var e=Math.sqrt(t[0]*t[0]+t[1]*t[1]);return[t[0]/e,t[1]/e]};u.prototype.arcTo=function(t,e,r,n,i){var o=this.__currentPosition&&this.__currentPosition.x,a=this.__currentPosition&&this.__currentPosition.y;if(void 0!==o&&void 0!==a){if(i<0)throw new Error("IndexSizeError: The radius provided ("+i+") is negative.");if(o===t&&a===e||t===r&&e===n||0===i)this.lineTo(t,e);else{var s=m([o-t,a-e]),h=m([r-t,n-e]);if(s[0]*h[1]!=s[1]*h[0]){var u=s[0]*h[0]+s[1]*h[1],l=Math.acos(Math.abs(u)),c=m([s[0]+h[0],s[1]+h[1]]),f=i/Math.sin(l/2),d=t+f*c[0],g=e+f*c[1],p=[-s[1],s[0]],_=[h[1],-h[0]],v=function(t){var e=t[0];return t[1]>=0?Math.acos(e):-Math.acos(e)},y=v(p),w=v(_);this.lineTo(d+p[0]*i,g+p[1]*i),this.arc(d,g,i,y,w)}else this.lineTo(t,e)}}},u.prototype.stroke=function(){"path"===this.__currentElement.nodeName&&this.__currentElement.setAttribute("paint-order","fill stroke markers"),this.__applyCurrentDefaultPath(),this.__applyStyleToCurrentElement("stroke")},u.prototype.fill=function(){"path"===this.__currentElement.nodeName&&this.__currentElement.setAttribute("paint-order","stroke fill markers"),this.__applyCurrentDefaultPath(),this.__applyStyleToCurrentElement("fill")},u.prototype.rect=function(t,e,r,n){"path"!==this.__currentElement.nodeName&&this.beginPath(),this.moveTo(t,e),this.lineTo(t+r,e),this.lineTo(t+r,e+n),this.lineTo(t,e+n),this.lineTo(t,e),this.closePath()},u.prototype.fillRect=function(t,e,r,n){var i;i=this.__createElement("rect",{x:t,y:e,width:r,height:n},!0),this.__closestGroupOrSvg().appendChild(i),this.__currentElement=i,this.__applyStyleToCurrentElement("fill")},u.prototype.strokeRect=function(t,e,r,n){var i;i=this.__createElement("rect",{x:t,y:e,width:r,height:n},!0),this.__closestGroupOrSvg().appendChild(i),this.__currentElement=i,this.__applyStyleToCurrentElement("stroke")},u.prototype.__clearCanvas=function(){for(var t=this.__closestGroupOrSvg().getAttribute("transform"),e=this.__root.childNodes[1],r=e.childNodes,n=r.length-1;n>=0;n--)r[n]&&e.removeChild(r[n]);this.__currentElement=e,this.__groupStack=[],t&&this.__addTransform(t)},u.prototype.clearRect=function(t,e,r,n){if(0!==t||0!==e||r!==this.width||n!==this.height){var i,o=this.__closestGroupOrSvg();i=this.__createElement("rect",{x:t,y:e,width:r,height:n,fill:"#FFFFFF"},!0),o.appendChild(i)}else this.__clearCanvas()},u.prototype.createLinearGradient=function(t,e,r,n){var i=this.__createElement("linearGradient",{id:_(this.__ids),x1:t+"px",x2:r+"px",y1:e+"px",y2:n+"px",gradientUnits:"userSpaceOnUse"},!1);return this.__defs.appendChild(i),new l(i,this)},u.prototype.createRadialGradient=function(t,e,r,n,i,o){var a=this.__createElement("radialGradient",{id:_(this.__ids),cx:n+"px",cy:i+"px",r:o+"px",fx:t+"px",fy:e+"px",gradientUnits:"userSpaceOnUse"},!1);return this.__defs.appendChild(a),new l(a,this)},u.prototype.__parseFont=function(){var t=/^\s*(?=(?:(?:[-a-z]+\s*){0,2}(italic|oblique))?)(?=(?:(?:[-a-z]+\s*){0,2}(small-caps))?)(?=(?:(?:[-a-z]+\s*){0,2}(bold(?:er)?|lighter|[1-9]00))?)(?:(?:normal|\1|\2|\3)\s*){0,3}((?:xx?-)?(?:small|large)|medium|smaller|larger|[.\d]+(?:\%|in|[cem]m|ex|p[ctx]))(?:\s*\/\s*(normal|[.\d]+(?:\%|in|[cem]m|ex|p[ctx])))?\s*([-,\'\"\sa-z0-9]+?)\s*$/i.exec(this.font),e={style:t[1]||"normal",size:t[4]||"10px",family:t[6]||"sans-serif",weight:t[3]||"normal",decoration:t[2]||"normal",href:null};return"underline"===this.__fontUnderline&&(e.decoration="underline"),this.__fontHref&&(e.href=this.__fontHref),e},u.prototype.__wrapTextLink=function(t,e){if(t.href){var r=this.__createElement("a");return r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",t.href),r.appendChild(e),r}return e},u.prototype.__applyText=function(t,e,r,n){var i,o,a=this.__parseFont(),s=this.__closestGroupOrSvg(),h=this.__createElement("text",{"font-family":a.family,"font-size":a.size,"font-style":a.style,"font-weight":a.weight,"text-decoration":a.decoration,x:e,y:r,"text-anchor":(i=this.textAlign,o={left:"start",right:"end",center:"middle",start:"start",end:"end"},o[i]||o.start),"dominant-baseline":v(this.textBaseline)},!0);h.appendChild(this.__document.createTextNode(t)),this.__currentElement=h,this.__applyStyleToCurrentElement(n),s.appendChild(this.__wrapTextLink(a,h))},u.prototype.fillText=function(t,e,r){this.__applyText(t,e,r,"fill")},u.prototype.strokeText=function(t,e,r){this.__applyText(t,e,r,"stroke")},u.prototype.measureText=function(t){return this.__ctx.font=this.font,this.__ctx.measureText(t)},u.prototype.arc=function(t,e,r,n,i,o){if(n!==i){(n%=2*Math.PI)===(i%=2*Math.PI)&&(i=(i+2*Math.PI-.001*(o?-1:1))%(2*Math.PI));var a=t+r*Math.cos(i),s=e+r*Math.sin(i),h=t+r*Math.cos(n),u=e+r*Math.sin(n),l=o?0:1,c=0,f=i-n;f<0&&(f+=2*Math.PI),c=o?f>Math.PI?0:1:f>Math.PI?1:0,this.lineTo(h,u),this.__addPathCommand(p("A {rx} {ry} {xAxisRotation} {largeArcFlag} {sweepFlag} {endX} {endY}",{rx:r,ry:r,xAxisRotation:0,largeArcFlag:c,sweepFlag:l,endX:a,endY:s})),this.__currentPosition={x:a,y:s}}},u.prototype.clip=function(){var t=this.__closestGroupOrSvg(),e=this.__createElement("clipPath"),r=_(this.__ids),n=this.__createElement("g");this.__applyCurrentDefaultPath(),t.removeChild(this.__currentElement),e.setAttribute("id",r),e.appendChild(this.__currentElement),this.__defs.appendChild(e),t.setAttribute("clip-path",p("url(#{id})",{id:r})),t.appendChild(n),this.__currentElement=n},u.prototype.drawImage=function(){var t,e,r,n,i,o,a,s,h,l,c,f,d,g,p=Array.prototype.slice.call(arguments),_=p[0],v=0,m=0;if(3===p.length)t=p[1],e=p[2],r=i=_.width,n=o=_.height;else if(5===p.length)t=p[1],e=p[2],r=p[3],n=p[4],i=_.width,o=_.height;else{if(9!==p.length)throw new Error("Inavlid number of arguments passed to drawImage: "+arguments.length);v=p[1],m=p[2],i=p[3],o=p[4],t=p[5],e=p[6],r=p[7],n=p[8]}a=this.__closestGroupOrSvg(),this.__currentElement;var y="translate("+t+", "+e+")";if(_ instanceof u){if((s=_.getSvg().cloneNode(!0)).childNodes&&s.childNodes.length>1){for(h=s.childNodes[0];h.childNodes.length;)g=h.childNodes[0].getAttribute("id"),this.__ids[g]=g,this.__defs.appendChild(h.childNodes[0]);if(l=s.childNodes[1]){var w,b=l.getAttribute("transform");w=b?b+" "+y:y,l.setAttribute("transform",w),a.appendChild(l)}}}else"IMG"===_.nodeName?((c=this.__createElement("image")).setAttribute("width",r),c.setAttribute("height",n),c.setAttribute("preserveAspectRatio","none"),(v||m||i!==_.width||o!==_.height)&&((f=this.__document.createElement("canvas")).width=r,f.height=n,(d=f.getContext("2d")).drawImage(_,v,m,i,o,0,0,r,n),_=f),c.setAttribute("transform",y),c.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href","CANVAS"===_.nodeName?_.toDataURL():_.getAttribute("src")),a.appendChild(c)):"CANVAS"===_.nodeName&&((c=this.__createElement("image")).setAttribute("width",r),c.setAttribute("height",n),c.setAttribute("preserveAspectRatio","none"),(f=this.__document.createElement("canvas")).width=r,f.height=n,(d=f.getContext("2d")).imageSmoothingEnabled=!1,d.mozImageSmoothingEnabled=!1,d.oImageSmoothingEnabled=!1,d.webkitImageSmoothingEnabled=!1,d.drawImage(_,v,m,i,o,0,0,r,n),_=f,c.setAttribute("transform",y),c.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",_.toDataURL()),a.appendChild(c))},u.prototype.drawImageSvg=function(){var t,e,r,n,i,o,a,s,h=Array.prototype.slice.call(arguments),u=h[0];if(3===h.length)t=h[1],e=h[2],r=u.width,n=u.height;else if(5===h.length)t=h[1],e=h[2],r=h[3],n=h[4],u.width,u.height;else{if(9!==h.length)throw new Error("Inavlid number of arguments passed to drawImage: "+arguments.length);h[1],h[2],h[3],h[4],t=h[5],e=h[6],r=h[7],n=h[8]}i=this.__closestGroupOrSvg(),this.__currentElement;var l="translate("+t+", "+e+")";if(u instanceof SVGSVGElement&&u.childNodes&&u.childNodes.length>1){var c=parseFloat(u.getAttribute("width")),f=parseFloat(u.getAttribute("height"));u.setAttribute("width",r),u.setAttribute("height",n);var d=r/c,g=n/f;for(o=u.childNodes[0];o.childNodes.length;)s=o.childNodes[0].getAttribute("id"),this.__ids[s]=s,this.__defs.appendChild(o.childNodes[0]);if(a=u.childNodes[1]){var p,_=a.getAttribute("transform");p=_?_+" "+l:l,a.setAttribute("transform",p+" scale("+d+", "+g+")"),i.appendChild(a)}}},u.prototype.createPattern=function(t,e){var r,n=this.__document.createElementNS("http://www.w3.org/2000/svg","pattern"),i=_(this.__ids);return n.setAttribute("id",i),n.setAttribute("width",t.width),n.setAttribute("height",t.height),"CANVAS"===t.nodeName||"IMG"===t.nodeName?((r=this.__document.createElementNS("http://www.w3.org/2000/svg","image")).setAttribute("width",t.width),r.setAttribute("height",t.height),r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href","CANVAS"===t.nodeName?t.toDataURL():t.getAttribute("src")),n.appendChild(r),this.__defs.appendChild(n)):t instanceof u&&(n.appendChild(t.__root.childNodes[1]),this.__defs.appendChild(n)),new c(n,this)},u.prototype.setLineDash=function(t){t&&t.length>0?this.lineDash=t.join(","):this.lineDash=null},u.prototype.drawFocusRing=function(){},u.prototype.createImageData=function(){},u.prototype.getImageData=function(){},u.prototype.putImageData=function(){},u.prototype.globalCompositeOperation=function(){},u.prototype.setTransform=function(){};for(var y=u,w=function(){function t(t){this._ctx=new y({width:t.width,height:t.height}),this._options=t}return Object.defineProperty(t.prototype,"context",{get:function(){return this._ctx},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this._options.width},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this._options.height},enumerable:!0,configurable:!0}),t.prototype.clear=function(){var t=this.context;t&&t.clearRect(0,0,this._options.width,this._options.height)},t.prototype.drawQR=function(t){return this.clear(),this.drawBackground(),this._qr=t,this._options.image?this.drawImageAndDots():(this.drawDots(),Promise.resolve())},t.prototype.drawBackground=function(){var t=this.context,e=this._options;t&&(t.fillStyle=e.backgroundOptions.color,t.fillRect(0,0,this._options.width,this._options.height))},t.prototype.drawDots=function(t){var e=this;if(!this._qr)throw"QR code is not defined";var r=this.context;if(!r)throw"QR code is not defined";var n=this._options,i=this._qr.getModuleCount();if(i>n.width||i>n.height)throw"The canvas is too small.";for(var o=Math.min(n.width,n.height),a=Math.floor(o/i),s=Math.floor((n.width-i*a)/2),h=Math.floor((n.height-i*a)/2),u=new g({context:r,type:n.dotsOptions.type}),l=function(o){for(var l=function(l){return t&&!t(o,l)?"continue":c._qr.isDark(o,l)?(r.fillStyle=n.dotsOptions.color,void u.draw(s+o*a,h+l*a,a,function(r,n){return!(o+r<0||l+n<0||o+r>=i||l+n>=i)&&(!(t&&!t(o+r,l+n))&&(!!e._qr&&e._qr.isDark(o+r,l+n)))})):"continue"},f=0;f<i;f++)l(f)},c=this,f=0;f<i;f++)l(f)},t.prototype.drawImageAndDots=function(){var t=this;return new Promise(function(e,r){if(!t._qr)return r("QR code is not defined");var n=t.context;if(!n)return r("QR code is not defined");var i=t._options,o=t._qr.getModuleCount(),a=Math.min(i.width,i.height),s=Math.floor(a/o),h=Math.floor((i.width-o*s)/2),u=Math.floor((i.height-o*s)/2),l=i.imageOptions.imageSize*d[i.qrOptions.errorCorrectionLevel];return i.image?fetch(i.image).then(function(t){return t.text()}).then(function(e){var r=(new DOMParser).parseFromString(e,"image/svg+xml").querySelector("svg");if(!r)throw"no svg found on given src";var a=Math.floor(l*o*o),c=function(t){var e=t.originalHeight,r=t.originalWidth,n=t.maxHiddenDots,i=t.maxHiddenAxisDots,o=t.dotSize,a={x:0,y:0},s={x:0,y:0};if(e<=0||r<=0||n<=0||o<=0)return{height:0,width:0,hideYDots:0,hideXDots:0};var h=e/r;return a.x=Math.floor(Math.sqrt(n/h)),a.x<=0&&(a.x=1),i&&i<a.x&&(a.x=i),a.x%2==0&&a.x--,s.x=a.x*o,a.y=1+2*Math.ceil((a.x*h-1)/2),s.y=Math.round(s.x*h),(a.y*a.x>n||i&&i<a.y)&&(i&&i<a.y?(a.y=i,a.y%2==0&&a.x--):a.y-=2,s.y=a.y*o,a.x=1+2*Math.ceil((a.y/h-1)/2),s.x=Math.round(s.y/h)),{height:s.y,width:s.x,hideYDots:a.y,hideXDots:a.x}}({originalWidth:parseFloat(r.getAttribute("width")||"64"),originalHeight:parseFloat(r.getAttribute("height")||"64"),maxHiddenDots:a,maxHiddenAxisDots:o-14,dotSize:s}),f=c.width,d=c.height,g=c.hideXDots,p=c.hideYDots;if(t.drawDots(function(t,e){return!i.imageOptions.hideBackgroundDots||(t<(o-g)/2||t>=(o+g)/2||e<(o-p)/2||e>=(o+p)/2)}),i.imageOptions.imageColor){var _=r.getElementsByTagName("path"),v=_[_.length-1];v&&v.setAttribute("fill",i.imageOptions.imageColor)}n.drawImageSvg(r,h+(o*s-f)/2,u+(o*s-d)/2,f,d)}).then(function(){e()}):r("Image is not defined")})},t}(),b={},x=0;x<=40;x++)b[x]=x;var A=b,C={L:"L",M:"M",Q:"Q",H:"H"},k={width:300,height:300,data:void 0,image:void 0,qrOptions:{typeNumber:A[0],mode:void 0,errorCorrectionLevel:C.Q},imageOptions:{hideBackgroundDots:!0,imageSize:.4,crossOrigin:void 0},dotsOptions:{type:"square",color:"#000"},backgroundOptions:{color:"#fff"}},S=r(0),M=r.n(S),E=function(){function t(t){this._options=t?s(k,t):k,this.update()}return t._clearContainer=function(t){t&&(t.innerHTML="")},t.prototype.update=function(e){t._clearContainer(this._container),this._options=e?s(this._options,e):this._options,this._options.data&&(this._qr=M()(this._options.qrOptions.typeNumber,this._options.qrOptions.errorCorrectionLevel),this._qr.addData(this._options.data,this._options.qrOptions.mode||function(t){switch(!0){case/^[0-9]*$/.test(t):return n.numeric;case/^[0-9A-Z $%*+\-./:]*$/.test(t):return n.alphanumeric;default:return n.byte}}(this._options.data)),this._qr.make(),this._canvas=new w(this._options),this._drawingPromise=this._canvas.drawQR(this._qr))},t.prototype.append=function(t){var e=this;if(t){if("function"!=typeof t.appendChild)throw"Container should be a single DOM node";this._drawingPromise&&this._drawingPromise.then(function(){e._canvas&&e._canvas.context&&(t.innerHTML=e._canvas.context.getSerializedSvg(!1)),e._container=t})}},t.prototype.getSerializedSvg=function(){var t=this;if(this._drawingPromise)return this._drawingPromise.then(function(){return t._canvas&&t._canvas.context?t._canvas.context.getSerializedSvg(!1):""})},t}(),P={dots:"dots",rounded:"rounded",square:"square"};r.d(e,"dotTypes",function(){return P}),r.d(e,"errorCorrectionLevels",function(){return C}),r.d(e,"errorCorrectionPercents",function(){return d}),r.d(e,"modes",function(){return n}),r.d(e,"qrTypes",function(){return A});e.default=E}]).default}); | ||
//# sourceMappingURL=qr-code-styling.js.map |
{ | ||
"name": "@mithrandirii/qr-code-styling", | ||
"version": "1.3.2", | ||
"version": "1.3.3", | ||
"description": "Add a style and an image to your QR code", | ||
@@ -5,0 +5,0 @@ "main": "lib/qr-code-styling.js", |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
252195
2