1import{o as e,t}from"./rolldown-runtime-CMxvf4Ktp1.js";import{Fi as n}from"./src-D9GYhO4rRw.js";var r={numeric:`Numeric`,alphanumeric:`Alphanumeric`,byte:`Byte`,kanji:`Kanji`};function i(e){switch(!0){case/^[0-9]*$/.test(e):return r.numeric;case/^[0-9A-Z $%*+\-./:]*$/.test(e):return r.alphanumeric;default:return r.byte}}var a=e=>!!e&&typeof e==`object`&&!Array.isArray(e);function o(e,...t){if(!t.length)return e;let n=t.shift();return n===void 0||!a(e)||!a(n)?e:(e={...e},Object.keys(n).forEach(t=>{let r=e[t],i=n[t];Array.isArray(r)&&Array.isArray(i)?e[t]=i:a(r)&&a(i)?e[t]=o(Object.assign({},r),i):e[t]=i}),o(e,...t))}function s(e,t){let n=document.createElement(`a`);n.download=t,n.href=e,document.body.appendChild(n),n.click(),document.body.removeChild(n)}function c({originalHeight:e,originalWidth:t,maxHiddenDots:n,maxHiddenAxisDots:r,dotSize:i}){let a={x:0,y:0},o={x:0,y:0};if(e<=0||t<=0||n<=0||i<=0)return{height:0,width:0,hideYDots:0,hideXDots:0};let s=e/t;return a.x=Math.floor(Math.sqrt(n/s)),a.x<=0&&(a.x=1),r&&r<a.x&&(a.x=r),a.x%2==0&&a.x--,o.x=a.x*i,a.y=1+2*Math.ceil((a.x*s-1)/2),o.y=Math.round(o.x*s),(a.y*a.x>n||r&&r<a.y)&&(r&&r<a.y?(a.y=r,a.y%2==0&&a.x--):a.y-=2,o.y=a.y*i,a.x=1+2*Math.ceil((a.y/s-1)/2),o.x=Math.round(o.y/s)),{height:o.y,width:o.x,hideYDots:a.y,hideXDots:a.x}}var l={L:.07,M:.15,Q:.25,H:.3},u={dots:`dots`,rounded:`rounded`,classy:`classy`,classyRounded:`classy-rounded`,square:`square`,extraRounded:`extra-rounded`},d=class{constructor({context:e,type:t}){n(this,`_context`,void 0),n(this,`_type`,void 0),this._context=e,this._type=t}draw(e,t,n,r){let i=this._context,a=this._type,o;switch(a){case u.dots:o=this._drawDot;break;case u.classy:o=this._drawClassy;break;case u.classyRounded:o=this._drawClassyRounded;break;case u.rounded:o=this._drawRounded;break;case u.extraRounded:o=this._drawExtraRounded;break;case u.square:default:o=this._drawSquare}o.call(this,{x:e,y:t,size:n,context:i,getNeighbor:r})}_rotateFigure({x:e,y:t,size:n,context:r,rotation:i=0,draw:a}){let o=e+n/2,s=t+n/2;r.translate(o,s),i&&r.rotate(i),a(),r.closePath(),i&&r.rotate(-i),r.translate(-o,-s)}_basicDot(e){let{size:t,context:n}=e;this._rotateFigure({...e,draw:()=>{n.save(),n.beginPath(),n.arc(0,0,t/2,0,Math.PI*2),n.closePath(),n.fill(`evenodd`),n.restore()}})}_basicDot2(e){let{size:t,context:n}=e;this._rotateFigure({...e,draw:()=>{n.arc(0,0,t/2,0,Math.PI*2)}})}_basicSquare(e){let{size:t,context:n}=e;this._rotateFigure({...e,draw:()=>{n.rect(-t/2,-t/2,t,t)}})}_basicSideRounded(e){let{size:t,context:n}=e;this._rotateFigure({...e,draw:()=>{n.arc(0,0,t/2,-Math.PI/2,Math.PI/2),n.lineTo(-t/2,t/2),n.lineTo(-t/2,-t/2),n.lineTo(0,-t/2)}})}_basicCornerRounded(e){let{size:t,context:n}=e;this._rotateFigure({...e,draw:()=>{n.arc(0,0,t/2,-Math.PI/2,0),n.lineTo(t/2,t/2),n.lineTo(-t/2,t/2),n.lineTo(-t/2,-t/2),n.lineTo(0,-t/2)}})}_basicCornerExtraRounded(e){let{size:t,context:n}=e;this._rotateFigure({...e,draw:()=>{n.arc(-t/2,t/2,t,-Math.PI/2,0),n.lineTo(-t/2,t/2),n.lineTo(-t/2,-t/2)}})}_basicCornersRounded(e){let{size:t,context:n}=e;this._rotateFigure({...e,draw:()=>{n.arc(0,0,t/2,-Math.PI/2,0),n.lineTo(t/2,t/2),n.lineTo(0,t/2),n.arc(0,0,t/2,Math.PI/2,Math.PI),n.lineTo(-t/2,-t/2),n.lineTo(0,-t/2)}})}_basicCornersExtraRounded(e){let{size:t,context:n}=e;this._rotateFigure({...e,draw:()=>{n.arc(-t/2,t/2,t,-Math.PI/2,0),n.arc(t/2,-t/2,t,Math.PI/2,Math.PI)}})}_drawDot({x:e,y:t,size:n,context:r}){this._basicDot({x:e,y:t,size:n,context:r,rotation:0})}_drawSquare({x:e,y:t,size:n,context:r}){this._basicSquare({x:e,y:t,size:n,context:r,rotation:0})}_drawRounded({x:e,y:t,size:n,context:r,getNeighbor:i}){let a=i?+i(-1,0):0,o=i?+i(1,0):0,s=i?+i(0,-1):0,c=i?+i(0,1):0,l=a+o+s+c;if(l===0){this._basicDot2({x:e,y:t,size:n,context:r,rotation:0});return}if(l>2||a&&o||s&&c){this._basicSquare({x:e,y:t,size:n,context:r,rotation:0});return}if(l===2){let i=0;a&&s?i=Math.PI/2:s&&o?i=Math.PI:o&&c&&(i=-Math.PI/2),this._basicCornerRounded({x:e,y:t,size:n,context:r,rotation:i});return}if(l===1){let i=0;s?i=Math.PI/2:o?i=Math.PI:c&&(i=-Math.PI/2),this._basicSideRounded({x:e,y:t,size:n,context:r,rotation:i});return}}_drawExtraRounded({x:e,y:t,size:n,context:r,getNeighbor:i}){let a=i?+i(-1,0):0,o=i?+i(1,0):0,s=i?+i(0,-1):0,c=i?+i(0,1):0,l=a+o+s+c;if(l===0){this._basicDot2({x:e,y:t,size:n,context:r,rotation:0});return}if(l>2||a&&o||s&&c){this._basicSquare({x:e,y:t,size:n,context:r,rotation:0});return}if(l===2){let i=0;a&&s?i=Math.PI/2:s&&o?i=Math.PI:o&&c&&(i=-Math.PI/2),this._basicCornerExtraRounded({x:e,y:t,size:n,context:r,rotation:i});return}if(l===1){let i=0;s?i=Math.PI/2:o?i=Math.PI:c&&(i=-Math.PI/2),this._basicSideRounded({x:e,y:t,size:n,context:r,rotation:i});return}}_drawClassy({x:e,y:t,size:n,context:r,getNeighbor:i}){let a=i?+i(-1,0):0,o=i?+i(1,0):0,s=i?+i(0,-1):0,c=i?+i(0,1):0;if(a+o+s+c===0){this._basicCornersRounded({x:e,y:t,size:n,context:r,rotation:Math.PI/2});return}if(!a&&!s){this._basicCornerRounded({x:e,y:t,size:n,context:r,rotation:-Math.PI/2});return}if(!o&&!c){this._basicCornerRounded({x:e,y:t,size:n,context:r,rotation:Math.PI/2});return}this._basicSquare({x:e,y:t,size:n,context:r,rotation:0})}_drawClassyRounded({x:e,y:t,size:n,context:r,getNeighbor:i}){let a=i?+i(-1,0):0,o=i?+i(1,0):0,s=i?+i(0,-1):0,c=i?+i(0,1):0;if(a+o+s+c===0){this._basicCornersRounded({x:e,y:t,size:n,context:r,rotation:Math.PI/2});return}if(!a&&!s){this._basicCornerExtraRounded({x:e,y:t,size:n,context:r,rotation:-Math.PI/2});return}if(!o&&!c){this._basicCornerExtraRounded({x:e,y:t,size:n,context:r,rotation:Math.PI/2});return}this._basicSquare({x:e,y:t,size:n,context:r,rotation:0})}},f={dot:`dot`,square:`square`,extraRounded:`extra-rounded`},p=class{constructor({context:e,type:t}){n(this,`_context`,void 0),n(this,`_type`,void 0),this._context=e,this._type=t}draw(e,t,n,r){let i=this._context,a=this._type,o;switch(a){case f.square:o=this._drawSquare;break;case f.extraRounded:o=this._drawExtraRounded;break;case f.dot:default:o=this._drawDot}o.call(this,{x:e,y:t,size:n,context:i,rotation:r})}_rotateFigure({x:e,y:t,size:n,context:r,rotation:i=0,draw:a}){let o=e+n/2,s=t+n/2;r.translate(o,s),i&&r.rotate(i),a(),r.closePath(),i&&r.rotate(-i),r.translate(-o,-s)}_basicDot(e){let{size:t,context:n}=e,r=t/7;this._rotateFigure({...e,draw:()=>{n.arc(0,0,t/2,0,Math.PI*2),n.arc(0,0,t/2-r,0,Math.PI*2)}})}_basicSquare(e){let{size:t,context:n}=e,r=t/7;this._rotateFigure({...e,draw:()=>{n.rect(-t/2,-t/2,t,t),n.rect(-t/2+r,-t/2+r,t-2*r,t-2*r)}})}_basicExtraRounded(e){let{size:t,context:n}=e,r=t/7;this._rotateFigure({...e,draw:()=>{n.arc(-r,-r,2.5*r,Math.PI,-Math.PI/2),n.lineTo(r,-3.5*r),n.arc(r,-r,2.5*r,-Math.PI/2,0),n.lineTo(3.5*r,-r),n.arc(r,r,2.5*r,0,Math.PI/2),n.lineTo(-r,3.5*r),n.arc(-r,r,2.5*r,Math.PI/2,Math.PI),n.lineTo(-3.5*r,-r),n.arc(-r,-r,1.5*r,Math.PI,-Math.PI/2),n.lineTo(r,-2.5*r),n.arc(r,-r,1.5*r,-Math.PI/2,0),n.lineTo(2.5*r,-r),n.arc(r,r,1.5*r,0,Math.PI/2),n.lineTo(-r,2.5*r),n.arc(-r,r,1.5*r,Math.PI/2,Math.PI),n.lineTo(-2.5*r,-r)}})}_drawDot({x:e,y:t,size:n,context:r,rotation:i}){this._basicDot({x:e,y:t,size:n,context:r,rotation:i})}_drawSquare({x:e,y:t,size:n,context:r,rotation:i}){this._basicSquare({x:e,y:t,size:n,context:r,rotation:i})}_drawExtraRounded({x:e,y:t,size:n,context:r,rotation:i}){this._basicExtraRounded({x:e,y:t,size:n,context:r,rotation:i})}},m={dot:`dot`,square:`square`},h=class{constructor({context:e,type:t}){n(this,`_context`,void 0),n(this,`_type`,void 0),this._context=e,this._type=t}draw(e,t,n,r){let i=this._context,a=this._type,o;switch(a){case m.square:o=this._drawSquare;break;case m.dot:default:o=this._drawDot}o.call(this,{x:e,y:t,size:n,context:i,rotation:r})}_rotateFigure({x:e,y:t,size:n,context:r,rotation:i=0,draw:a}){let o=e+n/2,s=t+n/2;r.translate(o,s),i&&r.rotate(i),a(),r.closePath(),i&&r.rotate(-i),r.translate(-o,-s)}_basicDot(e){let{size:t,context:n}=e;this._rotateFigure({...e,draw:()=>{n.arc(0,0,t/2,0,Math.PI*2)}})}_basicSquare(e){let{size:t,context:n}=e;this._rotateFigure({...e,draw:()=>{n.rect(-t/2,-t/2,t,t)}})}_drawDot({x:e,y:t,size:n,context:r,rotation:i}){this._basicDot({x:e,y:t,size:n,context:r,rotation:i})}_drawSquare({x:e,y:t,size:n,context:r,rotation:i}){this._basicSquare({x:e,y:t,size:n,context:r,rotation:i})}},g={radial:`radial`,linear:`linear`},_=[[1,1,1,1,1,1,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,1,1,1,1,1,1]],v=[[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,1,1,1,0,0],[0,0,1,1,1,0,0],[0,0,1,1,1,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]],y=class{constructor(e){n(this,`_canvas`,void 0),n(this,`_options`,void 0),n(this,`_qr`,void 0),n(this,`_image`,void 0),this._canvas=document.createElement(`canvas`),this._canvas.width=e.width,this._canvas.height=e.height,this._options=e}get context(){return this._canvas.getContext(`2d`)}get width(){return this._canvas.width}get height(){return this._canvas.height}getCanvas(){return this._canvas}clear(){let e=this.context;e&&e.clearRect(0,0,this._canvas.width,this._canvas.height)}async drawQR(e){let t=e.getModuleCount(),n=Math.min(this._options.width,this._options.height)-this._options.margin*2,r=Math.floor(n/t),i={hideXDots:0,hideYDots:0,width:0,height:0};if(this._qr=e,this._options.image){if(await this.loadImage(),!this._image)return;let{imageOptions:e,qrOptions:n}=this._options,a=e.imageSize*l[n.errorCorrectionLevel],o=Math.floor(a*t*t);i=c({originalWidth:this._image.width,originalHeight:this._image.height,maxHiddenDots:o,maxHiddenAxisDots:t-14,dotSize:r})}
1this.clear(),this.drawBackground(),this.drawDots((e,n)=>{var r,a,o,s,c,l;return!(this._options.imageOptions.hideBackgroundDots&&e>=(t-i.hideXDots)/2&&e<(t+i.hideXDots)/2&&n>=(t-i.hideYDots)/2&&n<(t+i.hideYDots)/2||(r=_[e])!=null&&r[n]||(a=_[e-t+7])!=null&&a[n]||(o=_[e])!=null&&o[n-t+7]||(s=v[e])!=null&&s[n]||(c=v[e-t+7])!=null&&c[n]||(l=v[e])!=null&&l[n-t+7])}),this.drawCorners(),this._options.image&&this.drawImage({width:i.width,height:i.height,count:t,dotSize:r})}drawBackground(){let e=this.context,t=this._options;if(e){if(t.backgroundOptions.gradient){let n=t.backgroundOptions.gradient,r=this._createGradient({context:e,options:n,additionalRotation:0,x:0,y:0,size:this._canvas.width>this._canvas.height?this._canvas.width:this._canvas.height});n.colorStops.forEach(({offset:e,color:t})=>{r.addColorStop(e,t)}),e.fillStyle=r}else t.backgroundOptions.color&&(e.fillStyle=t.backgroundOptions.color);e.fillRect(0,0,this._canvas.width,this._canvas.height)}}drawDots(e){if(!this._qr)throw`QR code is not defined`;let t=this.context;if(!t)throw`QR code is not defined`;let n=this._options,r=this._qr.getModuleCount();if(r>n.width||r>n.height)throw`The canvas is too small.`;let i=Math.min(n.width,n.height)-n.margin*2,a=Math.floor(i/r),o=Math.floor((n.width-r*a)/2),s=Math.floor((n.height-r*a)/2),c=new d({context:t,type:n.dotsOptions.type});if(n.dotsOptions.gradient){let e=n.dotsOptions.gradient,i=this._createGradient({context:t,options:e,additionalRotation:0,x:o,y:s,size:r*a});e.colorStops.forEach(({offset:e,color:t})=>{i.addColorStop(e,t)}),t.fillStyle=t.strokeStyle=i}else n.dotsOptions.color&&(t.fillStyle=t.strokeStyle=n.dotsOptions.color);t.beginPath();for(let t=0;t<r;t++)for(let n=0;n<r;n++)e&&!e(t,n)||this._qr.isDark(t,n)&&c.draw(o+t*a,s+n*a,a,(i,a)=>t+i<0||n+a<0||t+i>=r||n+a>=r||e&&!e(t+i,n+a)?!1:!!this._qr&&this._qr.isDark(t+i,n+a));t.fill(`evenodd`)}drawCorners(e){if(!this._qr)throw`QR code is not defined`;let t=this.context;if(!t)throw`QR code is not defined`;let n=this._options,r=this._qr.getModuleCount(),i=Math.min(n.width,n.height)-n.margin*2,a=Math.floor(i/r),o=a*7,s=a*3,c=Math.floor((n.width-r*a)/2),l=Math.floor((n.height-r*a)/2);[[0,0,0],[1,0,Math.PI/2],[0,1,-Math.PI/2]].forEach(([i,u,f])=>{var m,g,y,b,x,S;if(e&&!e(i,u))return;let C=c+i*a*(r-7),w=l+u*a*(r-7);if((m=n.cornersSquareOptions)!=null&&m.type){var T;let e=new p({context:t,type:(T=n.cornersSquareOptions)==null?void 0:T.type});t.beginPath(),e.draw(C,w,o,f)}else{let e=new d({context:t,type:n.dotsOptions.type});t.beginPath();for(let t=0;t<_.length;t++)for(let n=0;n<_[t].length;n++){var E;(E=_[t])!=null&&E[n]&&e.draw(C+t*a,w+n*a,a,(e,r)=>{var i;return!!((i=_[t+e])!=null&&i[n+r])})}}if((g=n.cornersSquareOptions)!=null&&g.gradient){let e=n.cornersSquareOptions.gradient,r=this._createGradient({context:t,options:e,additionalRotation:f,x:C,y:w,size:o});e.colorStops.forEach(({offset:e,color:t})=>{r.addColorStop(e,t)}),t.fillStyle=t.strokeStyle=r}else (y=n.cornersSquareOptions)!=null&&y.color&&(t.fillStyle=t.strokeStyle=n.cornersSquareOptions.color);if(t.fill(`evenodd`),(b=n.cornersDotOptions)!=null&&b.type){var D;let e=new h({context:t,type:(D=n.cornersDotOptions)==null?void 0:D.type});t.beginPath(),e.draw(C+a*2,w+a*2,s,f)}else{let e=new d({context:t,type:n.dotsOptions.type});t.beginPath();for(let t=0;t<v.length;t++)for(let n=0;n<v[t].length;n++){var O;(O=v[t])!=null&&O[n]&&e.draw(C+t*a,w+n*a,a,(e,r)=>{var i;return!!((i=v[t+e])!=null&&i[n+r])})}}if((x=n.cornersDotOptions)!=null&&x.gradient){let e=n.cornersDotOptions.gradient,r=this._createGradient({context:t,options:e,additionalRotation:f,x:C+a*2,y:w+a*2,size:s});e.colorStops.forEach(({offset:e,color:t})=>{r.addColorStop(e,t)}),t.fillStyle=t.strokeStyle=r}else (S=n.cornersDotOptions)!=null&&S.color&&(t.fillStyle=t.strokeStyle=n.cornersDotOptions.color);t.fill(`evenodd`)})}loadImage(){return new Promise((e,t)=>{let n=this._options,r=new Image;if(!n.image)return t(`Image is not defined`);typeof n.imageOptions.crossOrigin==`string`&&(r.crossOrigin=n.imageOptions.crossOrigin),this._image=r,r.onload=()=>{e()},r.src=n.image})}drawImage({width:e,height:t,count:n,dotSize:r}){let i=this.context;if(!i)throw`canvasContext is not defined`;if(!this._image)throw`image is not defined`;let a=this._options,o=Math.floor((a.width-n*r)/2),s=Math.floor((a.height-n*r)/2),c=o+a.imageOptions.margin+(n*r-e)/2,l=s+a.imageOptions.margin+(n*r-t)/2,u=e-a.imageOptions.margin*2,d=t-a.imageOptions.margin*2;i.drawImage(this._image,c,l,u<0?0:u,d<0?0:d)}_createGradient({context:e,options:t,additionalRotation:n,x:r,y:i,size:a}){let o;if(t.type===g.radial)o=e.createRadialGradient(r+a/2,i+a/2,0,r+a/2,i+a/2,a/2);else{let s=((t.rotation||0)+n)%(2*Math.PI),c=(s+2*Math.PI)%(2*Math.PI),l=r+a/2,u=i+a/2,d=r+a/2,f=i+a/2;c>=0&&c<=.25*Math.PI||c>1.75*Math.PI&&c<=2*Math.PI?(l-=a/2,u-=a/2*Math.tan(s),d+=a/2,f+=a/2*Math.tan(s)):c>.25*Math.PI&&c<=.75*Math.PI?(u-=a/2,l-=a/2/Math.tan(s),f+=a/2,d+=a/2/Math.tan(s)):c>.75*Math.PI&&c<=1.25*Math.PI?(l+=a/2,u+=a/2*Math.tan(s),d-=a/2,f-=a/2*Math.tan(s)):c>1.25*Math.PI&&c<=1.75*Math.PI&&(u+=a/2,l+=a/2/Math.tan(s),f-=a/2,d-=a/2/Math.tan(s)),o=e.createLinearGradient(Math.round(l),Math.round(u),Math.round(d),Math.round(f))}return o}},b=class{constructor({svg:e,type:t}){n(this,`_element`,void 0),n(this,`_svg`,void 0),n(this,`_type`,void 0),n(this,`pathObj`,{path:``,clipRule:``}),this._svg=e,this._type=t}draw(e,t,n,r){let i=this._type,a;switch(this.pathObj={path:``,clipRule:``},i){case u.dots:a=this._drawDot;break;case u.classy:a=this._drawClassy;break;case u.classyRounded:a=this._drawClassyRounded;break;case u.rounded:a=this._drawRounded;break;case u.extraRounded:a=this._drawExtraRounded;break;case u.square:default:a=this._drawSquare}return a.call(this,{x:e,y:t,size:n,getNeighbor:r}),this.pathObj}_rotateFigure({x:e,y:t,size:n,rotation:r=0,draw:i}){var a;let o=e+n/2,s=t+n/2;i(),(a=this._element)==null||a.setAttribute(`transform`,`rotate(${180*r/Math.PI},${o},${s})`)}_basicDot(e){let{size:t,x:n,y:r,rotation:i}=e;this._rotateFigure({...e,draw:()=>{this._element=document.createElementNS(`http://www.w3.org/2000/svg`,`circle`),this._element.setAttribute(`cx`,String(n+t/2)),this._element.setAttribute(`cy`,String(r+t/2)),this._element.setAttribute(`r`,String(t/2))}})}_basicSquare(e){let{size:t,x:n,y:r,rotation:i=0}=e;this._rotateFigure({...e,draw:()=>
1{if(this._type===`extra-rounded`){this._element=document.createElementNS(`http://www.w3.org/2000/svg`,`path`),this._element.setAttribute(`d`,`M ${n} ${r}v ${t}h ${t}v ${-t}h ${-t}Z`);return}this.pathObj.path=`M ${n} ${r} v ${t} h ${t}v ${-t}h ${-t}Z`}})}_basicSideRounded(e){let{size:t,x:n,y:r,rotation:i=0}=e;this._rotateFigure({...e,draw:()=>{if(this._type===`extra-rounded`){this._element=document.createElementNS(`http://www.w3.org/2000/svg`,`path`),this._element.setAttribute(`d`,`M ${n} ${r}v ${t}h ${t/2}a ${t/2} ${t/2}, 0, 0, 0, 0 ${-t}`);return}this.pathObj.path=`M ${n} ${r} v ${t} h ${t/2}a ${t/2} ${t/2}, 0, 0, 0, 0 ${-t}`}})}_basicCornerRounded(e){let{size:t,x:n,y:r,rotation:i=0}=e;this._rotateFigure({...e,draw:()=>{if(this._type===`extra-rounded`){this._element=document.createElementNS(`http://www.w3.org/2000/svg`,`path`),this._element.setAttribute(`d`,`M ${n} ${r}v ${t}h ${t}v ${-t/2}a ${t/2} ${t/2}, 0, 0, 0, ${-t/2} ${-t/2}`);return}this.pathObj.path=`M ${n} ${r} v ${t} h ${t}v ${-t/2}a ${t/2} ${t/2}, 0, 0, 0, ${-t/2} ${-t/2}`}})}_basicCornerExtraRounded(e){let{size:t,x:n,y:r,rotation:i=0}=e;this._rotateFigure({...e,draw:()=>{this._type===`extra-rounded`&&(this._element=document.createElementNS(`http://www.w3.org/2000/svg`,`path`),this._element.setAttribute(`d`,`M ${n} ${r}v ${t}h ${t}a ${t} ${t}, 0, 0, 0, ${-t} ${-t}`)),this.pathObj.path=`M ${n} ${r} v ${t} h ${t}a ${t} ${t}, 0, 0, 0, ${-t} ${-t}`}})}_basicCornersRounded(e){let{size:t,x:n,y:r,rotation:i=0}=e;this._rotateFigure({...e,draw:()=>{if(this._type===`extra-rounded`){this._element=document.createElementNS(`http://www.w3.org/2000/svg`,`path`),this._element.setAttribute(`d`,`M ${n} ${r}v ${t/2}a ${t/2} ${t/2}, 0, 0, 0, ${t/2} ${t/2}h ${t/2}v ${-t/2}a ${t/2} ${t/2}, 0, 0, 0, ${-t/2} ${-t/2}`);return}this.pathObj.path=`M ${n} ${r} v ${t/2}a ${t/2} ${t/2}, 0, 0, 0, ${t/2} ${t/2}h ${t/2}v ${-t/2}a ${t/2} ${t/2}, 0, 0, 0, ${-t/2} ${-t/2}`}})}_drawDot({x:e,y:t,size:n}){this._basicDot({x:e,y:t,size:n,rotation:0})}_drawSquare({x:e,y:t,size:n}){this._basicSquare({x:e,y:t,size:n,rotation:0})}_drawRounded({x:e,y:t,size:n,getNeighbor:r}){let i=r?+r(-1,0):0,a=r?+r(1,0):0,o=r?+r(0,-1):0,s=r?+r(0,1):0,c=i+a+o+s;if(c===0){this._basicDot({x:e,y:t,size:n,rotation:0});return}if(c>2||i&&a||o&&s){this._basicSquare({x:e,y:t,size:n,rotation:0});return}if(c===2){let r=0;i&&o?r=Math.PI/2:o&&a?r=Math.PI:a&&s&&(r=-Math.PI/2),this._basicCornerRounded({x:e,y:t,size:n,rotation:r});return}if(c===1){let r=0;o?r=Math.PI/2:a?r=Math.PI:s&&(r=-Math.PI/2),this._basicSideRounded({x:e,y:t,size:n,rotation:r});return}}_drawExtraRounded({x:e,y:t,size:n,getNeighbor:r}){let i=r?+r(-1,0):0,a=r?+r(1,0):0,o=r?+r(0,-1):0,s=r?+r(0,1):0,c=i+a+o+s;if(c===0){this._basicDot({x:e,y:t,size:n,rotation:0});return}if(c>2||i&&a||o&&s){this._basicSquare({x:e,y:t,size:n,rotation:0});return}if(c===2){let r=0;i&&o?r=Math.PI/2:o&&a?r=Math.PI:a&&s&&(r=-Math.PI/2),this._basicCornerExtraRounded({x:e,y:t,size:n,rotation:r});return}if(c===1){let r=0;o?r=Math.PI/2:a?r=Math.PI:s&&(r=-Math.PI/2),this._basicSideRounded({x:e,y:t,size:n,rotation:r});return}}_drawClassy({x:e,y:t,size:n,getNeighbor:r}){let i=r?+r(-1,0):0,a=r?+r(1,0):0,o=r?+r(0,-1):0,s=r?+r(0,1):0;if(i+a+o+s===0){this._basicCornersRounded({x:e,y:t,size:n,rotation:Math.PI/2});return}if(!i&&!o){this._basicCornerRounded({x:e,y:t,size:n,rotation:-Math.PI/2});return}if(!a&&!s){this._basicCornerRounded({x:e,y:t,size:n,rotation:Math.PI/2});return}this._basicSquare({x:e,y:t,size:n,rotation:0})}_drawClassyRounded({x:e,y:t,size:n,getNeighbor:r}){let i=r?+r(-1,0):0,a=r?+r(1,0):0,o=r?+r(0,-1):0,s=r?+r(0,1):0;if(i+a+o+s===0){this._basicCornersRounded({x:e,y:t,size:n,rotation:Math.PI/2});return}if(!i&&!o){this._basicCornerExtraRounded({x:e,y:t,size:n,rotation:-Math.PI/2});return}if(!a&&!s){this._basicCornerExtraRounded({x:e,y:t,size:n,rotation:Math.PI/2});return}this._basicSquare({x:e,y:t,size:n,rotation:0})}},x=class{constructor({svg:e,type:t}){n(this,`_element`,void 0),n(this,`_svg`,void 0),n(this,`_type`,void 0),n(this,`pathObj`,{path:``,clipRule:``}),this._svg=e,this._type=t}draw(e,t,n,r){let i=this._type,a;switch(this.pathObj={path:``,clipRule:``},i){case f.square:a=this._drawSquare;break;case f.extraRounded:a=this._drawExtraRounded;break;case f.dot:default:a=this._drawDot}return a.call(this,{x:e,y:t,size:n,rotation:r}),this.pathObj}_rotateFigure({x:e,y:t,size:n,rotation:r=0,draw:i}){var a;let o=e+n/2,s=t+n/2;i(),(a=this._element)==null||a.setAttribute(`transform`,`rotate(${180*r/Math.PI},${o},${s})`)}_basicDot(e){let{size:t,x:n,y:r,rotation:i=0}=e,a=t/7;this._rotateFigure({...e,draw:()=>
1{if(this._type===`extra-rounded`){this._element=document.createElementNS(`http://www.w3.org/2000/svg`,`path`),this._element.setAttribute(`clip-rule`,`evenodd`),this._element.setAttribute(`d`,`M ${n+t/2} ${r}a ${t/2} ${t/2} 0 1 0 0.1 0zm 0 ${a}a ${t/2-a} ${t/2-a} 0 1 1 -0.1 0Z`);return}this.pathObj.path=`M ${n+t/2} ${r} a ${t/2} ${t/2} 0 1 0 0.1 0 z m 0 ${a} a ${t/2-a} ${t/2-a} 0 1 1 -0.1 0 Z`,this.pathObj.clipRule=`evenodd`}})}_basicSquare(e){let{size:t,x:n,y:r,rotation:i=0}=e,a=t/7;this._rotateFigure({...e,draw:()=>{if(this._type===`extra-rounded`){this._element=document.createElementNS(`http://www.w3.org/2000/svg`,`path`),this._element.setAttribute(`clip-rule`,`evenodd`),this._element.setAttribute(`d`,`M ${n} ${r}v ${t}h ${t}v ${-t}zM ${n+a} ${r+a}h ${t-2*a}v ${t-2*a}h ${-t+2*a}z`);return}this.pathObj.path=`M ${n} ${r} v ${t} h ${t} v ${-t} z M ${n+a} ${r+a} h ${t-2*a} v ${t-2*a} h ${-t+2*a} z`}})}_basicExtraRounded(e){let{size:t,x:n,y:r,rotation:i=0}=e,a=t/7;this._rotateFigure({...e,draw:()=>{if(this._type===`extra-rounded`){this._element=document.createElementNS(`http://www.w3.org/2000/svg`,`path`),this._element.setAttribute(`clip-rule`,`evenodd`),this._element.setAttribute(`d`,`M ${n} ${r+2.5*a}v ${2*a}a ${2.5*a} ${2.5*a}, 0, 0, 0, ${a*2.5} ${a*2.5}h ${2*a}a ${2.5*a} ${2.5*a}, 0, 0, 0, ${a*2.5} ${-a*2.5}v ${-2*a}a ${2.5*a} ${2.5*a}, 0, 0, 0, ${-a*2.5} ${-a*2.5}h ${-2*a}a ${2.5*a} ${2.5*a}, 0, 0, 0, ${-a*2.5} ${a*2.5}M ${n+2.5*a} ${r+a}h ${2*a}a ${1.5*a} ${1.5*a}, 0, 0, 1, ${a*1.5} ${a*1.5}v ${2*a}a ${1.5*a} ${1.5*a}, 0, 0, 1, ${-a*1.5} ${a*1.5}h ${-2*a}a ${1.5*a} ${1.5*a}, 0, 0, 1, ${-a*1.5} ${-a*1.5}v ${-2*a}a ${1.5*a} ${1.5*a}, 0, 0, 1, ${a*1.5} ${-a*1.5}`);return}this.pathObj.path=`M ${n} ${r+2.5*a} v ${2*a} a ${2.5*a} ${2.5*a}, 0, 0, 0, ${a*2.5} ${a*2.5} h ${2*a} a ${2.5*a} ${2.5*a}, 0, 0, 0, ${a*2.5} ${-a*2.5} v ${-2*a} a ${2.5*a} ${2.5*a}, 0, 0, 0, ${-a*2.5} ${-a*2.5} h ${-2*a} a ${2.5*a} ${2.5*a}, 0, 0, 0, ${-a*2.5} ${a*2.5} M ${n+2.5*a} ${r+a} h ${2*a} a ${1.5*a} ${1.5*a}, 0, 0, 1, ${a*1.5} ${a*1.5} v ${2*a} a ${1.5*a} ${1.5*a}, 0, 0, 1, ${-a*1.5} ${a*1.5} h ${-2*a} a ${1.5*a} ${1.5*a}, 0, 0, 1, ${-a*1.5} ${-a*1.5} v ${-2*a} a ${1.5*a} ${1.5*a}, 0, 0, 1, ${a*1.5} ${-a*1.5}`,this.pathObj.clipRule=`evenodd`}})}_drawDot({x:e,y:t,size:n,rotation:r}){this._basicDot({x:e,y:t,size:n,rotation:r})}_drawSquare({x:e,y:t,size:n,rotation:r}){this._basicSquare({x:e,y:t,size:n,rotation:r})}_drawExtraRounded({x:e,y:t,size:n,rotation:r}){this._basicExtraRounded({x:e,y:t,size:n,rotation:r})}},S=class{constructor({svg:e,type:t}){n(this,`_element`,void 0),n(this,`_svg`,void 0),n(this,`_type`,void 0),n(this,`pathObj`,{path:``,clipRule:``}),this._svg=e,this._type=t}draw(e,t,n,r){let i=this._type,a;switch(this.pathObj={path:``,clipRule:``},i){case m.square:a=this._drawSquare;break;case m.dot:default:a=this._drawDot}return a.call(this,{x:e,y:t,size:n,rotation:r}),this.pathObj}_rotateFigure({x:e,y:t,size:n,rotation:r=0,draw:i}){var a;let o=e+n/2,s=t+n/2;i(),(a=this._element)==null||a.setAttribute(`transform`,`rotate(${180*r/Math.PI},${o},${s})`)}_basicDot(e){let{size:t,x:n,y:r}=e;this._rotateFigure({...e,draw:()=>{this._element=document.createElementNS(`http://www.w3.org/2000/svg`,`circle`),this._element.setAttribute(`cx`,String(n+t/2)),this._element.setAttribute(`cy`,String(r+t/2)),this._element.setAttribute(`r`,String(t/2))}})}_basicSquare(e){let{size:t,x:n,y:r,rotation:i=0}=e;this._rotateFigure({...e,draw:()=>{this._element=document.createElementNS(`http://www.w3.org/2000/svg`,`path`),this._element.setAttribute(`d`,`M ${n} ${r} v ${t} h ${t}v ${-t}h ${-t}Z`)}})}_drawDot({x:e,y:t,size:n,rotation:r}){this._basicDot({x:e,y:t,size:n,rotation:r})}_drawSquare({x:e,y:t,size:n,rotation:r}){this._basicSquare({x:e,y:t,size:n,rotation:r})}},C=[[1,1,1,1,1,1,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,1,1,1,1,1,1]],w=[[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,1,1,1,0,0],[0,0,1,1,1,0,0],[0,0,1,1,1,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]],T=class{constructor(e){n(this,`_element`,void 0),n(this,`_defs`,void 0),n(this,`_dotsClipPath`,void 0),n(this,`_cornersSquareClipPath`,void 0),n(this,`_cornersDotClipPath`,void 0),n(this,`_options`,void 0),n(this,`_qr`,void 0),n(this,`_image`,void 0),this._element=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`),this._element.setAttribute(`width`,String(e.width)),this._element.setAttribute(`height`,String(e.height)),this._element.setAttribute(`viewBox`,`0 0 ${e.width} ${e.height}`),this._defs=document.createElementNS(`http://www.w3.org/2000/svg`,`defs`),this._element.appendChild(this._defs),this._options=e}get width(){return this._options.width}get height(){return this._options.height}getElement(){return this._element}clear(){var e;let t=this._element;this._element=t.cloneNode(!1),t==null||(e=t.parentNode)==null||e.replaceChild(this._element,t),this._defs=document.createElementNS(`http://www.w3.org/2000/svg`,`defs`),this._element.appendChild(this._defs)}async drawQR(e){let t=e.getModuleCount(),n=Math.min(this._options.width,this._options.height)-this._options.margin*2,r=Math.floor(n/t),i={hideXDots:0,hideYDots:0,width:0,height:0};if(this._qr=e,this._options.image){if(await this.loadImage(),!this._image)return;let{imageOptions:e,qrOptions:n}=this._options,a=e.imageSize*l[n.errorCorrectionLevel],o=Math.floor(a*t*t);i=c({originalWidth:this._image.width,originalHeight:this._image.height,maxHiddenDots:o,maxHiddenAxisDots:t-14,dotSize:r})}
1this.clear(),this.drawBackground(),this.drawDots((e,n)=>{var r,a,o,s,c,l;return!(this._options.imageOptions.hideBackgroundDots&&e>=(t-i.hideXDots)/2&&e<(t+i.hideXDots)/2&&n>=(t-i.hideYDots)/2&&n<(t+i.hideYDots)/2||(r=C[e])!=null&&r[n]||(a=C[e-t+7])!=null&&a[n]||(o=C[e])!=null&&o[n-t+7]||(s=w[e])!=null&&s[n]||(c=w[e-t+7])!=null&&c[n]||(l=w[e])!=null&&l[n-t+7])}),this.drawCorners(),this._options.image&&this.drawImage({width:i.width,height:i.height,count:t,dotSize:r})}drawBackground(){let e=this._element,t=this._options;if(e){var n,r;let e=(n=t.backgroundOptions)==null?void 0:n.gradient,i=(r=t.backgroundOptions)==null?void 0:r.color;(e||i)&&this._createColor({options:e,color:i,additionalRotation:0,x:0,y:0,height:t.height,width:t.width,name:`background-color`})}}drawDots(e){var t,n;if(!this._qr)throw`QR code is not defined`;let r=this._options,i=this._qr.getModuleCount();if(i>r.width||i>r.height)throw`The canvas is too small.`;let a=Math.min(r.width,r.height)-r.margin*2,o=Math.floor(a/i),s=Math.floor((r.width-i*o)/2),c=Math.floor((r.height-i*o)/2),l=new b({svg:this._element,type:r.dotsOptions.type});this._dotsClipPath=document.createElementNS(`http://www.w3.org/2000/svg`,`clipPath`),this._dotsClipPath.setAttribute(`id`,`clip-path-dot-color`),this._defs.appendChild(this._dotsClipPath),this._createColor({options:(t=r.dotsOptions)==null?void 0:t.gradient,color:r.dotsOptions.color,additionalRotation:0,x:s,y:c,height:i*o,width:i*o,name:`dot-color`});let u=document.createElementNS(`http://www.w3.org/2000/svg`,`path`),d=``,f=``;for(let t=0;t<i;t++)for(let n=0;n<i;n++){var p;if(e&&!e(t,n)||!((p=this._qr)!=null&&p.isDark(t,n)))continue;let{path:r,clipRule:a}=l.draw(s+t*o,c+n*o,o,(r,a)=>t+r<0||n+a<0||t+r>=i||n+a>=i||e&&!e(t+r,n+a)?!1:!!this._qr&&this._qr.isDark(t+r,n+a));d+=r,f=a,l._element&&this._dotsClipPath&&this._dotsClipPath.appendChild(l._element)}u.setAttribute(`d`,d),f&&u.setAttribute(`clip-rule`,f),d&&this._dotsClipPath&&((n=this._options.dotsOptions)==null?void 0:n.type)!==`extra-rounded`&&this._dotsClipPath.appendChild(u)}drawCorners(){if(!this._qr)throw`QR code is not defined`;let e=this._element,t=this._options;if(!e)throw`Element code is not defined`;let n=this._qr.getModuleCount(),r=Math.min(t.width,t.height)-t.margin*2,i=Math.floor(r/n),a=i*7,o=i*3,s=Math.floor((t.width-n*i)/2),c=Math.floor((t.height-n*i)/2);[[0,0,0],[1,0,Math.PI/2],[0,1,-Math.PI/2]].forEach(([e,r,l])=>{var u,d,f,p,m,h;let g=s+e*i*(n-7),_=c+r*i*(n-7),v=this._dotsClipPath,y=this._dotsClipPath;if((u=t.cornersSquareOptions)!=null&&u.gradient||(d=t.cornersSquareOptions)!=null&&d.color){var T,E;v=document.createElementNS(`http://www.w3.org/2000/svg`,`clipPath`),v.setAttribute(`id`,`clip-path-corners-square-color-${e}-${r}`),this._defs.appendChild(v),this._cornersSquareClipPath=this._cornersDotClipPath=y=v,this._createColor({options:(T=t.cornersSquareOptions)==null?void 0:T.gradient,color:(E=t.cornersSquareOptions)==null?void 0:E.color,additionalRotation:l,x:g,y:_,height:a,width:a,name:`corners-square-color-${e}-${r}`})}if((f=t.cornersSquareOptions)!=null&&f.type){let e=new x({svg:this._element,type:t.cornersSquareOptions.type}),{path:n,clipRule:r}=e.draw(g,_,a,l);if(e._element&&v)v.appendChild(e._element);else if(n&&v){let e=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);e.setAttribute(`d`,n),r&&e.setAttribute(`clip-rule`,r),v.appendChild(e)}}else{var D;let e=new b({svg:this._element,type:t.dotsOptions.type}),n=document.createElementNS(`http://www.w3.org/2000/svg`,`path`),r=``,a=``;for(let t=0;t<C.length;t++)for(let n=0;n<C[t].length;n++){var O;if(!((O=C[t])!=null&&O[n]))continue;let{path:o,clipRule:s}=e.draw(g+t*i,_+n*i,i,(e,r)=>{var i;return!!((i=C[t+e])!=null&&i[n+r])});r+=o,a=s,e._element&&v&&v.appendChild(e._element)}n.setAttribute(`d`,r),a&&n.setAttribute(`clip-rule`,a),r&&v&&((D=this._options.dotsOptions)==null?void 0:D.type)!==`extra-rounded`&&v.appendChild(n)}if((p=t.cornersDotOptions)!=null&&p.gradient||(m=t.cornersDotOptions)!=null&&m.color){var k,A;y=document.createElementNS(`http://www.w3.org/2000/svg`,`clipPath`),y.setAttribute(`id`,`clip-path-corners-dot-color-${e}-${r}`),this._defs.appendChild(y),this._cornersDotClipPath=y,this._createColor({options:(k=t.cornersDotOptions)==null?void 0:k.gradient,color:(A=t.cornersDotOptions)==null?void 0:A.color,additionalRotation:l,x:g+i*2,y:_+i*2,height:o,width:o,name:`corners-dot-color-${e}-${r}`})}if((h=t.cornersDotOptions)!=null&&h.type){let e=new S({svg:this._element,type:t.cornersDotOptions.type}),{path:n,clipRule:r}=e.draw(g+i*2,_+i*2,o,l);if(e._element&&y)y.appendChild(e._element);else if(n&&y){let e=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);e.setAttribute(`d`,n),r&&e.setAttribute(`clip-rule`,r),y.appendChild(e)}}else{var j;let e=new b({svg:this._element,type:t.dotsOptions.type}),n=document.createElementNS(`http://www.w3.org/2000/svg`,`path`),r=``,a=``;for(let t=0;t<w.length;t++)for(let n=0;n<w[t].length;n++){var M;if(!((M=w[t])!=null&&M[n]))continue;let{path:o,clipRule:s}=e.draw(g+t*i,_+n*i,i,(e,r)=>{var i;return!!((i=w[t+e])!=null&&i[n+r])});r+=o,a=s,e._element&&y&&y.appendChild(e._element)}n.setAttribute(`d`,r),a&&n.setAttribute(`clip-rule`,a),r&&y&&((j=this._options.dotsOptions)==null?void 0:j.type)!==`extra-rounded`&&y.appendChild(n)}})}loadImage(){return new Promise((e,t)=>
1{let n=this._options,r=new Image;if(!n.image)return t(`Image is not defined`);typeof n.imageOptions.crossOrigin==`string`&&(r.crossOrigin=n.imageOptions.crossOrigin),this._image=r,r.onload=()=>{e()},r.src=n.image})}drawImage({width:e,height:t,count:n,dotSize:r}){let i=this._options,a=Math.floor((i.width-n*r)/2),o=Math.floor((i.height-n*r)/2),s=a+i.imageOptions.margin+(n*r-e)/2,c=o+i.imageOptions.margin+(n*r-t)/2,l=e-i.imageOptions.margin*2,u=t-i.imageOptions.margin*2,d=document.createElementNS(`http://www.w3.org/2000/svg`,`image`);d.setAttribute(`href`,i.image||``),d.setAttribute(`x`,String(s)),d.setAttribute(`y`,String(c)),d.setAttribute(`width`,`${l}px`),d.setAttribute(`height`,`${u}px`),this._element.appendChild(d)}_createColor({options:e,color:t,additionalRotation:n,x:r,y:i,height:a,width:o,name:s}){let c=o>a?o:a,l=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);if(l.setAttribute(`d`,`M ${r} ${i} h ${o} v ${a} h ${-o} Z`),l.setAttribute(`clip-path`,`url('#clip-path-${s}')`),e){let t;if(e.type===g.radial)t=document.createElementNS(`http://www.w3.org/2000/svg`,`radialGradient`),t.setAttribute(`id`,s),t.setAttribute(`gradientUnits`,`userSpaceOnUse`),t.setAttribute(`fx`,String(r+o/2)),t.setAttribute(`fy`,String(i+a/2)),t.setAttribute(`cx`,String(r+o/2)),t.setAttribute(`cy`,String(i+a/2)),t.setAttribute(`r`,String(c/2));else{let c=((e.rotation||0)+n)%(2*Math.PI),l=(c+2*Math.PI)%(2*Math.PI),u=r+o/2,d=i+a/2,f=r+o/2,p=i+a/2;l>=0&&l<=.25*Math.PI||l>1.75*Math.PI&&l<=2*Math.PI?(u-=o/2,d-=a/2*Math.tan(c),f+=o/2,p+=a/2*Math.tan(c)):l>.25*Math.PI&&l<=.75*Math.PI?(d-=a/2,u-=o/2/Math.tan(c),p+=a/2,f+=o/2/Math.tan(c)):l>.75*Math.PI&&l<=1.25*Math.PI?(u+=o/2,d+=a/2*Math.tan(c),f-=o/2,p-=a/2*Math.tan(c)):l>1.25*Math.PI&&l<=1.75*Math.PI&&(d+=a/2,u+=o/2/Math.tan(c),p-=a/2,f-=o/2/Math.tan(c)),t=document.createElementNS(`http://www.w3.org/2000/svg`,`linearGradient`),t.setAttribute(`id`,s),t.setAttribute(`gradientUnits`,`userSpaceOnUse`),t.setAttribute(`x1`,String(Math.round(u))),t.setAttribute(`y1`,String(Math.round(d))),t.setAttribute(`x2`,String(Math.round(f))),t.setAttribute(`y2`,String(Math.round(p)))}e.colorStops.forEach(({offset:e,color:n})=>{let r=document.createElementNS(`http://www.w3.org/2000/svg`,`stop`);r.setAttribute(`offset`,`${100*e}%`),r.setAttribute(`stop-color`,n),t.appendChild(r)}),l.setAttribute(`fill`,`url('#${s}')`),this._defs.appendChild(t)}else t&&l.setAttribute(`fill`,t);this._element.appendChild(l)}},E={canvas:`canvas`,svg:`svg`},D={};for(let e=0;e<=40;e++)D[e]=e;var O={type:E.canvas,width:300,height:300,data:``,margin:0,qrOptions:{typeNumber:D[0],mode:void 0,errorCorrectionLevel:{L:`L`,M:`M`,Q:`Q`,H:`H`}.Q},imageOptions:{hideBackgroundDots:!0,imageSize:.4,crossOrigin:void 0,margin:0},dotsOptions:{type:`square`,color:`#000`},backgroundOptions:{color:`#fff`}};function k(e){let t={...e};if(!t.colorStops||!t.colorStops.length)throw`Field 'colorStops' is required in gradient`;return t.rotation?t.rotation=Number(t.rotation):t.rotation=0,t.colorStops=t.colorStops.map(e=>({...e,offset:Number(e.offset)})),t}function A(e){let t={...e};return t.width=Number(t.width),t.height=Number(t.height),t.margin=Number(t.margin),t.imageOptions={...t.imageOptions,hideBackgroundDots:!!t.imageOptions.hideBackgroundDots,imageSize:Number(t.imageOptions.imageSize),margin:Number(t.imageOptions.margin)},t.margin>Math.min(t.width,t.height)&&(t.margin=Math.min(t.width,t.height)),t.dotsOptions={...t.dotsOptions},t.dotsOptions.gradient&&(t.dotsOptions.gradient=k(t.dotsOptions.gradient)),t.cornersSquareOptions&&(t.cornersSquareOptions={...t.cornersSquareOptions},t.cornersSquareOptions.gradient&&(t.cornersSquareOptions.gradient=k(t.cornersSquareOptions.gradient))),t.cornersDotOptions&&(t.cornersDotOptions={...t.cornersDotOptions},t.cornersDotOptions.gradient&&(t.cornersDotOptions.gradient=k(t.cornersDotOptions.gradient))),t.backgroundOptions&&(t.backgroundOptions={...t.backgroundOptions},t.backgroundOptions.gradient&&(t.backgroundOptions.gradient=k(t.backgroundOptions.gradient))),t}var j=e(t(((e,t)=>{var n=function(){var e=function(e,t){var r=236,a=17,p=e,m=n[t],h=null,g=0,v=null,y=[],b={},x=function(e,t){g=p*4+17,h=function(e){for(var t=Array(e),n=0;n<e;n+=1){t[n]=Array(e);for(var r=0;r<e;r+=1)t[n][r]=null}return t}
1(g),S(0,0),S(g-7,0),S(0,g-7),T(),w(),D(e,t),p>=7&&E(e),v??(v=A(p,m,y)),O(v,t)},S=function(e,t){for(var n=-1;n<=7;n+=1)if(!(e+n<=-1||g<=e+n))for(var r=-1;r<=7;r+=1)t+r<=-1||g<=t+r||(0<=n&&n<=6&&(r==0||r==6)||0<=r&&r<=6&&(n==0||n==6)||2<=n&&n<=4&&2<=r&&r<=4?h[e+n][t+r]=!0:h[e+n][t+r]=!1)},C=function(){for(var e=0,t=0,n=0;n<8;n+=1){x(!0,n);var r=i.getLostPoint(b);(n==0||e>r)&&(e=r,t=n)}return t},w=function(){for(var e=8;e<g-8;e+=1)h[e][6]??(h[e][6]=e%2==0);for(var t=8;t<g-8;t+=1)h[6][t]??(h[6][t]=t%2==0)},T=function(){for(var e=i.getPatternPosition(p),t=0;t<e.length;t+=1)for(var n=0;n<e.length;n+=1){var r=e[t],a=e[n];if(h[r][a]==null)for(var o=-2;o<=2;o+=1)for(var s=-2;s<=2;s+=1)o==-2||o==2||s==-2||s==2||o==0&&s==0?h[r+o][a+s]=!0:h[r+o][a+s]=!1}},E=function(e){for(var t=i.getBCHTypeNumber(p),n=0;n<18;n+=1){var r=!e&&(t>>n&1)==1;h[Math.floor(n/3)][n%3+g-8-3]=r}for(var n=0;n<18;n+=1){var r=!e&&(t>>n&1)==1;h[n%3+g-8-3][Math.floor(n/3)]=r}},D=function(e,t){for(var n=m<<3|t,r=i.getBCHTypeInfo(n),a=0;a<15;a+=1){var o=!e&&(r>>a&1)==1;a<6?h[a][8]=o:a<8?h[a+1][8]=o:h[g-15+a][8]=o}for(var a=0;a<15;a+=1){var o=!e&&(r>>a&1)==1;a<8?h[8][g-a-1]=o:a<9?h[8][15-a-1+1]=o:h[8][15-a-1]=o}h[g-8][8]=!e},O=function(e,t){for(var n=-1,r=g-1,a=7,o=0,s=i.getMaskFunction(t),c=g-1;c>0;c-=2)for(c==6&&--c;;){for(var l=0;l<2;l+=1)if(h[r][c-l]==null){var u=!1;o<e.length&&(u=(e[o]>>>a&1)==1),s(r,c-l)&&(u=!u),h[r][c-l]=u,--a,a==-1&&(o+=1,a=7)}if(r+=n,r<0||g<=r){r-=n,n=-n;break}}},k=function(e,t){for(var n=0,r=0,a=0,s=Array(t.length),c=Array(t.length),l=0;l<t.length;l+=1){var u=t[l].dataCount,d=t[l].totalCount-u;r=Math.max(r,u),a=Math.max(a,d),s[l]=Array(u);for(var f=0;f<s[l].length;f+=1)s[l][f]=255&e.getBuffer()[f+n];n+=u;var p=i.getErrorCorrectPolynomial(d),m=o(s[l],p.getLength()-1).mod(p);c[l]=Array(p.getLength()-1);for(var f=0;f<c[l].length;f+=1){var h=f+m.getLength()-c[l].length;c[l][f]=h>=0?m.getAt(h):0}}for(var g=0,f=0;f<t.length;f+=1)g+=t[f].totalCount;for(var _=Array(g),v=0,f=0;f<r;f+=1)for(var l=0;l<t.length;l+=1)f<s[l].length&&(_[v]=s[l][f],v+=1);for(var f=0;f<a;f+=1)for(var l=0;l<t.length;l+=1)f<c[l].length&&(_[v]=c[l][f],v+=1);return _},A=function(e,t,n){for(var o=s.getRSBlocks(e,t),l=c(),u=0;u<n.length;u+=1){var d=n[u];l.put(d.getMode(),4),l.put(d.getLength(),i.getLengthInBits(d.getMode(),e)),d.write(l)}for(var f=0,u=0;u<o.length;u+=1)f+=o[u].dataCount;if(l.getLengthInBits()>f*8)throw`code length overflow. (`+l.getLengthInBits()+`>`+f*8+`)`;for(l.getLengthInBits()+4<=f*8&&l.put(0,4);l.getLengthInBits()%8!=0;)l.putBit(!1);for(;!(l.getLengthInBits()>=f*8||(l.put(r,8),l.getLengthInBits()>=f*8));)l.put(a,8);return k(l,o)};b.addData=function(e,t){t=t||`Byte`;var n=null;switch(t){case`Numeric`:n=l(e);break;case`Alphanumeric`:n=u(e);break;case`Byte`:n=d(e);break;case`Kanji`:n=f(e);break;default:throw`mode:`+t}y.push(n),v=null},b.isDark=function(e,t){if(e<0||g<=e||t<0||g<=t)throw e+`,`+t;return h[e][t]},b.getModuleCount=function(){return g},b.make=function(){if(p<1){for(var e=1;e<40;e++){for(var t=s.getRSBlocks(e,m),n=c(),r=0;r<y.length;r++){var a=y[r];n.put(a.getMode(),4),n.put(a.getLength(),i.getLengthInBits(a.getMode(),e)),a.write(n)}for(var o=0,r=0;r<t.length;r++)o+=t[r].dataCount;if(n.getLengthInBits()<=o*8)break}p=e}x(!1,C())},b.createTableTag=function(e,t){e=e||2,t=t===void 0?e*4:t;var n=``;n+=`<table style="`,n+=` border-width: 0px; border-style: none;`,n+=` border-collapse: collapse;`,n+=` padding: 0px; margin: `+t+`px;`,n+=`">`,n+=`<tbody>`;for(var r=0;r<b.getModuleCount();r+=1){n+=`<tr>`;for(var i=0;i<b.getModuleCount();i+=1)n+=`<td style="`,n+=` border-width: 0px; border-style: none;`,n+=` border-collapse: collapse;`,n+=` padding: 0px; margin: 0px;`,n+=` width: `+e+`px;`,n+=` height: `+e+`px;`,n+=` background-color: `,n+=b.isDark(r,i)?`#000000`:`#ffffff`,n+=`;`,n+=`"/>`;n+=`</tr>`}return n+=`</tbody>`,n+=`</table>`,n},b.createSvgTag=function(e,t){var n={};typeof arguments[0]==`object`&&(n=arguments[0],e=n.cellSize,t=n.margin),e=e||2,t=t===void 0?e*4:t;var r=b.getModuleCount()*e+t*2,i,a,o,s,c=``,l=`l`+e+`,0 0,`+e+` -`+e+`,0 0,-`+e+`z `;for(c+=`<svg version="1.1" xmlns="http://www.w3.org/2000/svg"`,c+=n.scalable?``:` width="`+r+`px" height="`+r+`px"`,c+=` viewBox="0 0 `+r+` `+r+`" `,c+=` preserveAspectRatio="xMinYMin meet">`,c+=`<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>`,c+=`<path d="`,o=0;o<b.getModuleCount();
1o+=1)for(s=o*e+t,i=0;i<b.getModuleCount();i+=1)b.isDark(o,i)&&(a=i*e+t,c+=`M`+a+`,`+s+l);return c+=`" stroke="transparent" fill="black"/>`,c+=`</svg>`,c},b.createDataURL=function(e,t){e=e||2,t=t===void 0?e*4:t;var n=b.getModuleCount()*e+t*2,r=t,i=n-t;return _(n,n,function(t,n){if(r<=t&&t<i&&r<=n&&n<i){var a=Math.floor((t-r)/e),o=Math.floor((n-r)/e);return+!b.isDark(o,a)}else return 1})},b.createImgTag=function(e,t,n){e=e||2,t=t===void 0?e*4:t;var r=b.getModuleCount()*e+t*2,i=``;return i+=`<img`,i+=` src="`,i+=b.createDataURL(e,t),i+=`"`,i+=` width="`,i+=r,i+=`"`,i+=` height="`,i+=r,i+=`"`,n&&(i+=` alt="`,i+=n,i+=`"`),i+=`/>`,i};var j=function(e){var t=1;e=e===void 0?t*2:e;var n=b.getModuleCount()*t+e*2,r=e,i=n-e,a,o,s,c,l,u={"ââ":`â`,"â ":`â`," â":`â`," ":` `},d={"ââ":`â`,"â ":`â`," â":` `," ":` `},f=``;for(a=0;a<n;a+=2){for(s=Math.floor((a-r)/t),c=Math.floor((a+1-r)/t),o=0;o<n;o+=1)l=`â`,r<=o&&o<i&&r<=a&&a<i&&b.isDark(s,Math.floor((o-r)/t))&&(l=` `),r<=o&&o<i&&r<=a+1&&a+1<i&&b.isDark(c,Math.floor((o-r)/t))?l+=` `:l+=`â`,f+=e<1&&a+1>=i?d[l]:u[l];f+=` 2`}return n%2&&e>0?f.substring(0,f.length-n-1)+Array(n+1).join(`â`):f.substring(0,f.length-1)};return b.createASCII=function(e,t){if(e=e||1,e<2)return j(t);--e,t=t===void 0?e*2:t;var n=b.getModuleCount()*e+t*2,r=t,i=n-t,a,o,s,c,l=Array(e+1).join(`ââ`),u=Array(e+1).join(` `),d=``,f=``;for(a=0;a<n;a+=1){for(s=Math.floor((a-r)/e),f=``,o=0;o<n;o+=1)c=1,r<=o&&o<i&&r<=a&&a<i&&b.isDark(s,Math.floor((o-r)/e))&&(c=0),f+=c?l:u;for(s=0;s<e;s+=1)d+=f+` 3`}return d.substring(0,d.length-1)},b.renderTo2dContext=function(e,t){t=t||2;for(var n=b.getModuleCount(),r=0;r<n;r++)for(var i=0;i<n;i++)e.fillStyle=b.isDark(r,i)?`black`:`white`,e.fillRect(r*t,i*t,t,t)},b};e.stringToBytesFuncs={default:function(e){for(var t=[],n=0;n<e.length;n+=1){var r=e.charCodeAt(n);t.push(r&255)}return t}},e.stringToBytes=e.stringToBytesFuncs.default,e.createStringToBytes=function(e,t){var n=function(){for(var n=h(e),r=function(){var e=n.read();if(e==-1)throw`eof`;return e},i=0,a={};;){var o=n.read();if(o==-1)break;var s=r(),c=r(),l=r(),u=String.fromCharCode(o<<8|s);a[u]=c<<8|l,i+=1}if(i!=t)throw i+` != `+t;return a}(),r=63;return function(e){for(var t=[],i=0;i<e.length;i+=1){var a=e.charCodeAt(i);if(a<128)t.push(a);else{var o=n[e.charAt(i)];typeof o==`number`?(o&255)==o?t.push(o):(t.push(o>>>8),t.push(o&255)):t.push(r)}}return t}};var t={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},n={L:1,M:0,Q:3,H:2},r={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},i=function(){var 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=1335,i=7973,s=21522,c={},l=function(e){for(var t=0;e!=0;)t+=1,e>>>=1;return t};return c.getBCHTypeInfo=function(e){for(var t=e<<10;l(t)-l(n)>=0;)t^=n<<l(t)-l(n);return(e<<10|t)^s},c.getBCHTypeNumber=function(e){for(var t=e<<12;l(t)-l(i)>=0;)t^=i<<l(t)-l(i);return e<<12|t},c.getPatternPosition=function(t){return e[t-1]},c.getMaskFunction=function(e){switch(e){case r.PATTERN000:return function(e,t){return(e+t)%2==0};case r.PATTERN001:return function(e,t){return e%2==0};case r.PATTERN010:return function(e,t){return t%3==0};case r.PATTERN011:return function(e,t){return(e+t)%3==0};case r.PATTERN100:return function(e,t){return(Math.floor(e/2)+Math.floor(t/3))%2==0};case r.PATTERN101:return function(e,t){return e*t%2+e*t%3==0};case r.PATTERN110:return function(e,t){return(e*t%2+e*t%3)%2==0};case r.PATTERN111:return function(e,t){return(e*t%3+(e+t)%2)%2==0};default:throw`bad maskPattern:`+e}},c.getErrorCorrectPolynomial=function(e){for(var t=o([1],0),n=0;n<e;n+=1)t=t.multiply(o([1,a.gexp(n)],0));return t},c.getLengthInBits=function(e,n){if(1<=n&&n<10)switch(e){case t.MODE_NUMBER:return 10;case t.MODE_ALPHA_NUM:return 9;
3case t.MODE_8BIT_BYTE:return 8;case t.MODE_KANJI:return 8;default:throw`mode:`+e}else if(n<27)switch(e){case t.MODE_NUMBER:return 12;case t.MODE_ALPHA_NUM:return 11;case t.MODE_8BIT_BYTE:return 16;case t.MODE_KANJI:return 10;default:throw`mode:`+e}else if(n<41)switch(e){case t.MODE_NUMBER:return 14;case t.MODE_ALPHA_NUM:return 13;case t.MODE_8BIT_BYTE:return 16;case t.MODE_KANJI:return 12;default:throw`mode:`+e}else throw`type:`+n},c.getLostPoint=function(e){for(var t=e.getModuleCount(),n=0,r=0;r<t;r+=1)for(var i=0;i<t;i+=1){for(var a=0,o=e.isDark(r,i),s=-1;s<=1;s+=1)if(!(r+s<0||t<=r+s))for(var c=-1;c<=1;c+=1)i+c<0||t<=i+c||s==0&&c==0||o==e.isDark(r+s,i+c)&&(a+=1);a>5&&(n+=3+a-5)}for(var r=0;r<t-1;r+=1)for(var i=0;i<t-1;i+=1){var l=0;e.isDark(r,i)&&(l+=1),e.isDark(r+1,i)&&(l+=1),e.isDark(r,i+1)&&(l+=1),e.isDark(r+1,i+1)&&(l+=1),(l==0||l==4)&&(n+=3)}for(var r=0;r<t;r+=1)for(var i=0;i<t-6;i+=1)e.isDark(r,i)&&!e.isDark(r,i+1)&&e.isDark(r,i+2)&&e.isDark(r,i+3)&&e.isDark(r,i+4)&&!e.isDark(r,i+5)&&e.isDark(r,i+6)&&(n+=40);for(var i=0;i<t;i+=1)for(var r=0;r<t-6;r+=1)e.isDark(r,i)&&!e.isDark(r+1,i)&&e.isDark(r+2,i)&&e.isDark(r+3,i)&&e.isDark(r+4,i)&&!e.isDark(r+5,i)&&e.isDark(r+6,i)&&(n+=40);for(var u=0,i=0;i<t;i+=1)for(var r=0;r<t;r+=1)e.isDark(r,i)&&(u+=1);var d=Math.abs(100*u/t/t-50)/5;return n+=d*10,n},c}(),a=function(){for(var e=Array(256),t=Array(256),n=0;n<8;n+=1)e[n]=1<<n;for(var n=8;n<256;n+=1)e[n]=e[n-4]^e[n-5]^e[n-6]^e[n-8];for(var n=0;n<255;n+=1)t[e[n]]=n;var r={};return r.glog=function(e){if(e<1)throw`glog(`+e+`)`;return t[e]},r.gexp=function(t){for(;t<0;)t+=255;for(;t>=256;)t-=255;return e[t]},r}();function o(e,t){if(e.length===void 0)throw e.length+`/`+t;var n=function(){for(var n=0;n<e.length&&e[n]==0;)n+=1;for(var r=Array(e.length-n+t),i=0;i<e.length-n;i+=1)r[i]=e[i+n];return r}(),r={};return r.getAt=function(e){return n[e]},r.getLength=function(){return n.length},r.multiply=function(e){for(var t=Array(r.getLength()+e.getLength()-1),n=0;n<r.getLength();n+=1)for(var i=0;i<e.getLength();i+=1)t[n+i]^=a.gexp(a.glog(r.getAt(n))+a.glog(e.getAt(i)));return o(t,0)},r.mod=function(e){if(r.getLength()-e.getLength()<0)return r;for(var t=a.glog(r.getAt(0))-a.glog(e.getAt(0)),n=Array(r.getLength()),i=0;i<r.getLength();i+=1)n[i]=r.getAt(i);for(var i=0;i<e.getLength();i+=1)n[i]^=a.gexp(a.glog(e.getAt(i))+t);return o(n,0).mod(e)},r}var s=function(){var e=[[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]],t=function(e,t){var n={};return n.totalCount=e,n.dataCount=t,n},r={},i=function(t,r){switch(r){case n.L:return e[(t-1)*4+0];case n.M:return e[(t-1)*4+1];case n.Q:return e[(t-1)*4+2];case n.H:return e[(t-1)*4+3];default:return}};return r.getRSBlocks=function(e,n){var r=i(e,n);if(r===void 0)throw`bad rs block @ typeNumber:`+e+`/errorCorrectionLevel:`+n;for(var a=r.length/3,o=[],s=0;s<a;s+=1)for(var c=r[s*3+0],l=r[s*3+1],u=r[s*3+2],d=0;d<c;d+=1)o.push(t(l,u));return o},r}(),c=function(){var e=[],t=0,n={};return n.getBuffer=function(){return e},n.getAt=function(t){return(e[Math.floor(t/8)]>>>7-t%8&1)==1},n.put=function(e,t){for(var r=0;r<t;r+=1)n.putBit((e>>>t-r-1&1)==1)},n.getLengthInBits=function(){return t},n.putBit=function(n){var r=Math.floor(t/8);e.length<=r&&e.push(0),n&&(e[r]|=128>>>t%8),t+=1},n},l=function(e){var n=t.MODE_NUMBER,r=e,i={};i.getMode=function(){return n},i.getLength=function(e){return r.length},i.write=function(e){for(var t=r,n=0;n+2<t.length;)e.put(a(t.substring(n,n+3)),10),n+=3;n<t.length&&(t.length-n==1?e.put(a(t.substring(n,n+1)),4):t.length-n==2&&e.put(a(t.substring(n,n+2)),7))};var a=function(e){for(var t=0,n=0;n<e.length;n+=1)t=t*10+o(e.charAt(n));return t},o=function(e){if(`0`<=e&&e<=`9`)return e.charCodeAt(0)-48;throw`illegal char :`+e};return i},u=function(e){var n=t.MODE_ALPHA_NUM,r=e,i={};i.getMode=function(){return n},i.getLength=function(e){return r.length},i.write=function(e){for(var t=r,n=0;n+1<t.length;)e.put(a(t.charAt(n))*45+a(t.charAt(n+1)),11),n+=2;n<t.length&&e.put(a(t.charAt(n)),6)};var a=function(e){if(`0`<=e&&e<=`9`)return e.charCodeAt(0)-48;if(`A`<=e&&e<=`Z`)return e.charCodeAt(0)-65+10;switch(e){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 :`+e}};return i},d=function(n){var r=t.MODE_8BIT_BYTE,i=e.stringToBytes(n),a={};return a.getMode=function(){return r},a.getLength=function(e){return i.length},a.write=function(e){for(var t=0;t<i.length;t+=1)e.put(i[t],8)},a},f=function(n){var r=t.MODE_KANJI,i=e.stringToBytesFuncs.SJIS;if(!i)throw`sjis not supported.`;(function(e,t){var n=i(e);if(n.length!=2||(n[0]<<8|n[1])!=t)throw`sjis not supported.`})(`å`,38726);var a=i(n),o={};return o.getMode=function(){return r},o.getLength=function(e){return~~(a.length/2)},o.write=function(e){for(var t=a,n=0;n+1<t.length;){var r=(255&t[n])<<8|255&t[n+1];if(33088<=r&&r<=40956)r-=33088;else if(57408<=r&&r<=60351)r-=49472;else throw`illegal char at `+(n+1)+`/`+r;r=(r>>>8&255)*192+(r&255),e.put(r,13),n+=2}if(n<t.length)throw`illegal char at `+(n+1)},o},p=function(){var e=[],t={};return t.writeByte=function(t){e.push(t&255)},t.writeShort=function(e){t.writeByte(e),t.writeByte(e>>>8)},t.writeBytes=function(e,n,r){n=n||0,r=r||e.length;for(var i=0;i<r;i+=1)t.writeByte(e[i+n])},t.writeString=function(e){for(var n=0;n<e.length;n+=1)t.writeByte(e.charCodeAt(n))},t.toByteArray=function(){return e},t.toString=function(){var t=``;t+=`[`;for(var n=0;n<e.length;n+=1)n>0&&(t+=`,`),t+=e[n];return t+=`]`,t},t},m=function(){var e=0,t=0,n=0,r=``,i={},a=function(e){r+=String.fromCharCode(o(e&63))},o=function(e){if(!(e<0)){if(e<26)return 65+e;if(e<52)return 97+(e-26);if(e<62)return 48+(e-52);if(e==62)return 43;if(e==63)return 47}throw`n:`+e};return i.writeByte=function(r){for(e=e<<8|r&255,t+=8,n+=1;t>=6;)a(e>>>t-6),t-=6},i.flush=function(){if(t>0&&(a(e<<6-t),e=0,t=0),n%3!=0)for(var i=3-n%3,o=0;o<i;o+=1)r+=`=`},i.toString=function(){return r},i},h=function(e){var t=e,n=0,r=0,i=0,a={};a.read=function(){for(;i<8;){if(n>=t.length){if(i==0)return-1;throw`unexpected end of file./`+i}var e=t.charAt(n);if(n+=1,e==`=`)return i=0,-1;e.match(/^\s$/)||(r=r<<6|o(e.charCodeAt(0)),i+=6)}var a=r>>>i-8&255;return i-=8,a};var o=function(e){if(65<=e&&e<=90)return e-65;if(97<=e&&e<=122)return e-97+26;if(48<=e&&e<=57)return e-48+52;if(e==43)return 62;if(e==47)return 63;throw`c:`+e};return a},g=function(e,t){var n=e,r=t,i=Array(e*t),a={};a.setPixel=function(e,t,r){i[t*n+e]=r},a.write=function(e){e.writeString(`GIF87a`),e.writeShort(n),e.writeShort(r),e.writeByte(128),e.writeByte(0),e.writeByte(0),e.writeByte(0),e.writeByte(0),e.writeByte(0),e.writeByte(255),e.writeByte(255),e.writeByte(255),e.writeString(`,`),e.writeShort(0),e.writeShort(0),e.writeShort(n),e.writeShort(r),e.writeByte(0);var t=2,i=s(t);e.writeByte(t);for(var a=0;i.length-a>255;)e.writeByte(255),e.writeBytes(i,a,255),a+=255;e.writeByte(i.length-a),e.writeBytes(i,a,i.length-a),e.writeByte(0),e.writeString(`;`)};var o=function(e){var t=e,n=0,r=0,i={};return i.write=function(e,i){if(e>>>i)throw`length over`;for(;n+i>=8;)t.writeByte(255&(e<<n|r)),i-=8-n,e>>>=8-n,r=0,n=0;r=e<<n|r,n+=i},i.flush=function(){n>0&&t.writeByte(r)},i},s=function(e){for(var t=1<<e,n=(1<<e)+1,r=e+1,a=c(),s=0;s<t;s+=1)a.add(String.fromCharCode(s));a.add(String.fromCharCode(t)),a.add(String.fromCharCode(n));var l=p(),u=o(l);u.write(t,r);var d=0,f=String.fromCharCode(i[d]);for(d+=1;d<i.length;){var m=String.fromCharCode(i[d]);d+=1,a.contains(f+m)?f+=m:(u.write(a.indexOf(f),r),a.size()<4095&&(a.size()==1<<r&&(r+=1),a.add(f+m)),f=m)}return u.write(a.indexOf(f),r),u.write(n,r),u.flush(),l.toByteArray()},c=function(){var e={},t=0,n={};return n.add=function(r){if(n.contains(r))throw`dup key:`+r;e[r]=t,t+=1},n.size=function(){return t},n.indexOf=function(t){return e[t]},n.contains=function(t){return e[t]!==void 0},n};return a},_=function(e,t,n){for(var r=g(e,t),i=0;i<t;i+=1)for(var a=0;a<e;
3a+=1)r.setPixel(a,i,n(a,i));var o=p();r.write(o);for(var s=m(),c=o.toByteArray(),l=0;l<c.length;l+=1)s.writeByte(c[l]);return s.flush(),`data:image/gif;base64,`+s};return e}();(function(){n.stringToBytesFuncs[`UTF-8`]=function(e){function t(e){for(var t=[],n=0;n<e.length;n++){var r=e.charCodeAt(n);r<128?t.push(r):r<2048?t.push(192|r>>6,128|r&63):r<55296||r>=57344?t.push(224|r>>12,128|r>>6&63,128|r&63):(n++,r=65536+((r&1023)<<10|e.charCodeAt(n)&1023),t.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|r&63))}return t}return t(e)}})(),(function(n){typeof define==`function`&&define.amd?define([],n):typeof e==`object`&&(t.exports=n())})(function(){return n})}))());function M(e){let t=``;function n(e){if(e.nodeType===Node.ELEMENT_NODE){let r=e.tagName;t+=`<${r}`;for(let n of e.attributes)t+=` ${n.name}="${n.value}"`;t+=`>`;for(let t of e.childNodes)n(t);t+=`</${r}>`}else e.nodeType===Node.TEXT_NODE?t+=e.textContent:e.nodeType===Node.COMMENT_NODE&&(t+=`<!--${e.textContent}-->`)}return n(e),t}var N=class e{constructor(e){n(this,`_options`,void 0),n(this,`_container`,void 0),n(this,`_canvas`,void 0),n(this,`_svg`,void 0),n(this,`_qr`,void 0),n(this,`_canvasDrawingPromise`,void 0),n(this,`_svgDrawingPromise`,void 0),this._options=e?A(o(O,e)):O,this.update()}static _clearContainer(e){e&&(e.innerHTML=``)}async _getQRStylingElement(e=`png`){if(!this._qr)throw`QR code is empty`;if(e.toLowerCase()===`svg`){let e,t;return this._svg&&this._svgDrawingPromise?(t=this._svg,e=this._svgDrawingPromise):(t=new T(this._options),e=t.drawQR(this._qr)),await e,t}else{let e,t;return this._canvas&&this._canvasDrawingPromise?(t=this._canvas,e=this._canvasDrawingPromise):(t=new y(this._options),e=t.drawQR(this._qr)),await e,t}}update(t){var n,r;this._options=t?A(o(this._options,t)):this._options,this._options.data&&(this._qr=(0,j.default)(this._options.qrOptions.typeNumber,this._options.qrOptions.errorCorrectionLevel),(n=this._qr)==null||n.addData(this._options.data,this._options.qrOptions.mode||i(this._options.data)),(r=this._qr)==null||r.make(),this._options.type===E.canvas?(this._canvas=new y(this._options),this._canvasDrawingPromise=this._canvas.drawQR(this._qr),this._svgDrawingPromise=void 0,this._svg=void 0):(this._svg=new T(this._options),this._svgDrawingPromise=this._svg.drawQR(this._qr),this._canvasDrawingPromise=void 0,this._canvas=void 0),e._clearContainer(this._container),this.append(this._container))}append(e){if(e){if(typeof e.appendChild!=`function`)throw`Container should be a single DOM node`;this._options.type===E.canvas?this._canvas&&e.appendChild(this._canvas.getCanvas()):this._svg&&e.appendChild(this._svg.getElement()),this._container=e}}async getRawData(e=`png`){if(!this._qr)throw`QR code is empty`;let t=await this._getQRStylingElement(e);if(e.toLowerCase()===`svg`){let e=new XMLSerializer().serializeToString(t.getElement());return new Blob([`<?xml version="1.0" standalone="no"?>\r 4`+e],{type:`image/svg+xml`})}else return new Promise(n=>t.getCanvas().toBlob(n,`image/${e}`,1))}async download(e){if(!this._qr)throw`QR code is empty`;let t=`png`,n=`qr`;typeof e==`string`?(t=e,console.warn(`Extension is deprecated as argument for 'download' method, please pass object { name: '...', extension: '...' } as argument`)):typeof e==`object`&&e&&(e.name&&(n=e.name),e.extension&&(t=e.extension));let r=await this._getQRStylingElement(t);if(t.toLowerCase()===`svg`){new XMLSerializer;let e=M(r.getElement());e=e.replace(`<svg`,`<svg xmlns="http://www.w3.org/2000/svg"`),e=`<?xml version="1.0" standalone="no"?>\r 5`+e,s(`data:image/svg+xml;charset=utf-8,`+encodeURIComponent(e),`${n}.svg`)}else s(r.getCanvas().toDataURL(`image/${t}`),`${n}.${t}`)}};function P(e,t){for(let n of e)if(!n.type||t.indexOf(n.type)===-1)return!1;else return!0}function F(e){let t,n,r;t=``;let i=e.length;for(n=0;n<i;n++)r=e.charCodeAt(n),r>=1&&r<=127?t+=e.charAt(n):r>2047?(t+=String.fromCharCode(224|r>>12&15),t+=String.fromCharCode(128|r>>6&63),t+=String.fromCharCode(128|r>>0&63)):(t+=String.fromCharCode(192|r>>6&31),t+=String.fromCharCode(128|r>>0&63));return t}function I(e){let t=/^((https?|ftp|file):\/\/)([\da-z.-]+)\.([a-z.]{2,6})([\/\w.-]*)*\/?(\?[=&\w.-]*)?$/,n=e.split(/(https?:\/\/|ftp:\/\/|file:\/\/)/).filter(
5Boolean),r=0;for(let e=0;e<n.length;e+=2){let i=n[e],a=n[e+1]||``;if(t.test(i+a)&&(r++,r>1))break}return r===1?(console.log(`å¹é
æå`),!0):(console.log(`å¹é
失败`),!1)}export{N as i,F as n,I as r,P as t};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.