"use strict";(self.__LOADABLE_LOADED_CHUNKS__=self.__LOADABLE_LOADED_CHUNKS__||[]).push([[5979],{27008:function(t,o,r){var e,i=this&&this.__extends||(e=function(t,o){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,o){t.__proto__=o}||function(t,o){for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(t[r]=o[r])},e(t,o)},function(t,o){if("function"!=typeof o&&null!==o)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function r(){this.constructor=t}e(t,o),t.prototype=null===o?Object.create(o):(r.prototype=o.prototype,new r)}),n=this&&this.__assign||function(){return n=Object.assign||function(t){for(var o,r=1,e=arguments.length;r=1&&r<=127?e+=t.charAt(o):r>2047?(e+=String.fromCharCode(224|r>>12&15),e+=String.fromCharCode(128|r>>6&63),e+=String.fromCharCode(128|63&r)):(e+=String.fromCharCode(192|r>>6&31),e+=String.fromCharCode(128|63&r));return e},o.prototype.drawRoundedSquare=function(t,o,r,e,i,n,a,l){l.lineWidth=t,l.fillStyle=i,l.strokeStyle=i,r+=t/2,o+=t/2,e-=t,Array.isArray(n)||(n=[n,n,n,n]);var s=(n=n.map((function(t){return(t=Math.min(t,e/2))<0?0:t})))[0]||0,h=n[1]||0,u=n[2]||0,f=n[3]||0;l.beginPath(),l.moveTo(o+s,r),l.lineTo(o+e-h,r),h&&l.quadraticCurveTo(o+e,r,o+e,r+h),l.lineTo(o+e,r+e-u),u&&l.quadraticCurveTo(o+e,r+e,o+e-u,r+e),l.lineTo(o+f,r+e),f&&l.quadraticCurveTo(o,r+e,o,r+e-f),l.lineTo(o,r+s),s&&l.quadraticCurveTo(o,r,o+s,r),l.closePath(),l.stroke(),a&&l.fill()},o.prototype.drawPositioningPattern=function(t,o,r,e,i,n,a){void 0===a&&(a=[0,0,0,0]);var l,s,h,u,f=Math.ceil(o);"number"==typeof a||Array.isArray(a)?s=l=a:(l=a.outer||0,s=a.inner||0),"string"!=typeof n?(h=n.outer,u=n.inner):(h=n,u=n);var c=e*o+r,p=i*o+r,d=7*o;this.drawRoundedSquare(f,p,c,d,h,l,!1,t),d=3*o,c+=2*o,p+=2*o,this.drawRoundedSquare(f,p,c,d,u,s,!0,t)},o.prototype.isInPositioninZone=function(t,o,r){return r.some((function(r){return o>=r.row&&o<=r.row+7&&t>=r.col&&t<=r.col+7}))},o.prototype.transformPixelLengthIntoNumberOfCells=function(t,o){return t/o},o.prototype.isCoordinateInImage=function(t,o,r,e,i,n,a,l){if(l){var s=this.transformPixelLengthIntoNumberOfCells(i,a),h=this.transformPixelLengthIntoNumberOfCells(n,a),u=this.transformPixelLengthIntoNumberOfCells(r,a)-1,f=this.transformPixelLengthIntoNumberOfCells(e,a)-1;return o>=s-2&&o<=s+u+2&&t>=h-2&&t<=h+f+2}return!1},o.prototype.shouldComponentUpdate=function(t){return!a(this.props,t)},o.prototype.componentDidMount=function(){this.update()},o.prototype.componentDidUpdate=function(){this.update()},o.prototype.update=function(){var t,o=this.props,r=o.value,e=o.ecLevel,i=o.enableCORS,n=o.bgColor,a=o.fgColor,s=o.logoImage,h=o.logoOpacity,u=o.logoOnLoad,f=o.removeQrCodeBehindLogo,c=o.qrStyle,p=o.eyeRadius,d=o.eyeColor,g=o.logoPaddingStyle,y=+this.props.size,v=+this.props.quietZone,m=this.props.logoWidth?+this.props.logoWidth:0,C=this.props.logoHeight?+this.props.logoHeight:0,M=this.props.logoPadding?+this.props.logoPadding:0,P=l(0,e);P.addData(this.utf16to8(r)),P.make();var w=null===(t=this.canvasRef)||void 0===t?void 0:t.current,b=w.getContext("2d"),S=y+2*v,_=P.getModuleCount(),O=y/_,R=window.devicePixelRatio||1;w.height=w.width=S*R,b.scale(R,R),b.fillStyle=n,b.fillRect(0,0,S,S);var D=v,k=[{row:0,col:0},{row:0,col:_-7},{row:_-7,col:0}];if(b.strokeStyle=a,"dots"===c){b.fillStyle=a;for(var A=O/2,I=0;I<_;I++)for(var q=0;q<_;q++)P.isDark(I,q)&&!this.isInPositioninZone(I,q,k)&&(b.beginPath(),b.arc(Math.round(q*O)+A+D,Math.round(I*O)+A+D,A/100*75,0,2*Math.PI,!1),b.closePath(),b.fill())}else if("fluid"===c){for(A=Math.ceil(O/2),I=0;I<_;I++)for(q=0;q<_;q++)if(P.isDark(I,q)&&!this.isInPositioninZone(I,q,k)){var L=[!1,!1,!1,!1];I>0&&!P.isDark(I-1,q)&&q>0&&!P.isDark(I,q-1)&&(L[0]=!0),I>0&&!P.isDark(I-1,q)&&q<_-1&&!P.isDark(I,q+1)&&(L[1]=!0),I<_-1&&!P.isDark(I+1,q)&&q<_-1&&!P.isDark(I,q+1)&&(L[2]=!0),I<_-1&&!P.isDark(I+1,q)&&q>0&&!P.isDark(I,q-1)&&(L[3]=!0);var x=Math.ceil((q+1)*O)-Math.floor(q*O),T=Math.ceil((I+1)*O)-Math.floor(I*O);b.fillStyle=a,b.beginPath(),b.arc(Math.round(q*O)+A+D,Math.round(I*O)+A+D,A,0,2*Math.PI,!1),b.closePath(),b.fill(),L[0]||b.fillRect(Math.round(q*O)+D,Math.round(I*O)+D,x/2,T/2),L[1]||b.fillRect(Math.round(q*O)+D+Math.floor(x/2),Math.round(I*O)+D,x/2,T/2),L[2]||b.fillRect(Math.round(q*O)+D+Math.floor(x/2),Math.round(I*O)+D+Math.floor(T/2),x/2,T/2),L[3]||b.fillRect(Math.round(q*O)+D,Math.round(I*O)+D+Math.floor(T/2),x/2,T/2)}}else for(I=0;I<_;I++)for(q=0;q<_;q++)P.isDark(I,q)&&!this.isInPositioninZone(I,q,k)&&(b.fillStyle=a,x=Math.ceil((q+1)*O)-Math.floor(q*O),T=Math.ceil((I+1)*O)-Math.floor(I*O),b.fillRect(Math.round(q*O)+D,Math.round(I*O)+D,x,T));for(var j=0;j<3;j++){var E,N=k[j],Z=(I=N.row,q=N.col,p);Array.isArray(Z)&&(Z=Z[j]),"number"==typeof Z&&(Z=[Z,Z,Z,Z]),E=d?Array.isArray(d)?d[j]:d:a,this.drawPositioningPattern(b,O,D,I,q,E,Z)}if(s){var F=new Image;i&&(F.crossOrigin="Anonymous"),F.onload=function(t){b.save();var o=m||.2*y,r=C||o,e=(y-o)/2,i=(y-r)/2;if(f||M){b.beginPath(),b.strokeStyle=n,b.fillStyle=n;var a=o+2*M,l=r+2*M,s=e+D-M,c=i+D-M;if("circle"===g){var p=s+a/2,d=c+l/2;b.ellipse(p,d,a/2,l/2,0,0,2*Math.PI),b.stroke(),b.fill()}else b.fillRect(s,c,a,l)}b.globalAlpha=h,b.drawImage(F,e+D,i+D,o,r),b.restore(),u&&u(t)},F.src=s}},o.prototype.render=function(){var t,o=+this.props.size+2*+this.props.quietZone;return s.createElement("canvas",{id:null!==(t=this.props.id)&&void 0!==t?t:"react-qrcode-logo",height:o,width:o,style:n({height:o+"px",width:o+"px"},this.props.style),ref:this.canvasRef})},o.defaultProps={value:"https://reactjs.org/",ecLevel:"M",enableCORS:!1,size:150,quietZone:10,bgColor:"#FFFFFF",fgColor:"#000000",logoOpacity:1,qrStyle:"squares",eyeRadius:[0,0,0],logoPaddingStyle:"square"},o}(s.Component);o.QRCode=h}}]);