import{e as x,r as b,N as O,q as D,o as W}from"./@vue-6996c4b6.js";/*! * qrcode.vue v3.3.4 * A Vue.js component to generate QRCode. * © 2017-2023 @scopewu(https://github.com/scopewu) * MIT License. */var y=function(){return y=Object.assign||function(e){for(var n,r=1,a=arguments.length;r>>7-t%8&1)==1},put:function(t,e){for(var n=0;n>>e-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(t){var e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};var tt=z,c={glog:function(t){if(t<1)throw new Error("glog("+t+")");return c.LOG_TABLE[t]},gexp:function(t){for(;t<0;)t+=255;for(;t>=256;)t-=255;return c.EXP_TABLE[t]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(var v=0;v<8;v++)c.EXP_TABLE[v]=1<=0;)e^=h.G15<=0;)e^=h.G18<>>=1;return e},getPatternPosition:function(t){return h.PATTERN_POSITION_TABLE[t-1]},getMask:function(t,e,n){switch(t){case P.PATTERN000:return(e+n)%2==0;case P.PATTERN001:return e%2==0;case P.PATTERN010:return n%3==0;case P.PATTERN011:return(e+n)%3==0;case P.PATTERN100:return(Math.floor(e/2)+Math.floor(n/3))%2==0;case P.PATTERN101:return e*n%2+e*n%3==0;case P.PATTERN110:return(e*n%2+e*n%3)%2==0;case P.PATTERN111:return(e*n%3+(e+n)%2)%2==0;default:throw new Error("bad maskPattern:"+t)}},getErrorCorrectPolynomial:function(t){for(var e=new I([1],0),n=0;n5&&(n+=3+i-5)}for(var r=0;r=7&&this.setupTypeNumber(t),this.dataCache==null&&(this.dataCache=T.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,e)};g.setupPositionProbePattern=function(t,e){for(var n=-1;n<=7;n++)if(!(t+n<=-1||this.moduleCount<=t+n))for(var r=-1;r<=7;r++)e+r<=-1||this.moduleCount<=e+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?this.modules[t+n][e+r]=!0:this.modules[t+n][e+r]=!1)};g.getBestMaskPattern=function(){for(var t=0,e=0,n=0;n<8;n++){this.makeImpl(!0,n);var r=A.getLostPoint(this);(n==0||t>r)&&(t=r,e=n)}return e};g.createMovieClip=function(t,e,n){var r=t.createEmptyMovieClip(e,n),a=1;this.make();for(var i=0;i>n&1)==1;this.modules[Math.floor(n/3)][n%3+this.moduleCount-8-3]=r}for(var n=0;n<18;n++){var r=!t&&(e>>n&1)==1;this.modules[n%3+this.moduleCount-8-3][Math.floor(n/3)]=r}};g.setupTypeInfo=function(t,e){for(var n=this.errorCorrectLevel<<3|e,r=A.getBCHTypeInfo(n),a=0;a<15;a++){var i=!t&&(r>>a&1)==1;a<6?this.modules[a][8]=i:a<8?this.modules[a+1][8]=i:this.modules[this.moduleCount-15+a][8]=i}for(var a=0;a<15;a++){var i=!t&&(r>>a&1)==1;a<8?this.modules[8][this.moduleCount-a-1]=i:a<9?this.modules[8][15-a-1+1]=i:this.modules[8][15-a-1]=i}this.modules[this.moduleCount-8][8]=!t};g.mapData=function(t,e){for(var n=-1,r=this.moduleCount-1,a=7,i=0,u=this.moduleCount-1;u>0;u-=2)for(u==6&&u--;;){for(var o=0;o<2;o++)if(this.modules[r][u-o]==null){var f=!1;i>>a&1)==1);var l=A.getMask(e,r,u-o);l&&(f=!f),this.modules[r][u-o]=f,a--,a==-1&&(i++,a=7)}if(r+=n,r<0||this.moduleCount<=r){r-=n,n=-n;break}}};T.PAD0=236;T.PAD1=17;T.createData=function(t,e,n){for(var r=K.getRSBlocks(t,e),a=new $,i=0;io*8)throw new Error("code length overflow. ("+a.getLengthInBits()+">"+o*8+")");for(a.getLengthInBits()+4<=o*8&&a.put(0,4);a.getLengthInBits()%8!=0;)a.putBit(!1);for(;!(a.getLengthInBits()>=o*8||(a.put(T.PAD0,8),a.getLengthInBits()>=o*8));)a.put(T.PAD1,8);return T.createBytes(a,r)};T.createBytes=function(t,e){for(var n=0,r=0,a=0,i=new Array(e.length),u=new Array(e.length),o=0;o=0?C.get(p):0}}for(var w=0,s=0;s>6),e+=String.fromCharCode(128|r&63)):r<55296||r>=57344?(e+=String.fromCharCode(224|r>>12),e+=String.fromCharCode(128|r>>6&63),e+=String.fromCharCode(128|r&63)):(n++,r=65536+((r&1023)<<10|t.charCodeAt(n)&1023),e+=String.fromCharCode(240|r>>18),e+=String.fromCharCode(128|r>>12&63),e+=String.fromCharCode(128|r>>6&63),e+=String.fromCharCode(128|r&63))}return e}function F(t,e){e===void 0&&(e=0);var n=[];return t.forEach(function(r,a){var i=null;r.forEach(function(u,o){if(!u&&i!==null){n.push("M".concat(i+e," ").concat(a+e,"h").concat(o-i,"v1H").concat(i+e,"z")),i=null;return}if(o===r.length-1){if(!u)return;i===null?n.push("M".concat(o+e,",").concat(a+e," h1v1H").concat(o+e,"z")):n.push("M".concat(i+e,",").concat(a+e," h").concat(o+1-i,"v1H").concat(i+e,"z"));return}u&&i===null&&(i=o)})}),n.join("")}var S={value:{type:String,required:!0,default:""},size:{type:Number,default:100},level:{type:String,default:X,validator:function(t){return J(t)}},background:{type:String,default:"#fff"},foreground:{type:String,default:"#000"},margin:{type:Number,required:!1,default:0}},st=y(y({},S),{renderAs:{type:String,required:!1,default:"canvas",validator:function(t){return["canvas","svg"].indexOf(t)>-1}}}),ft=x({name:"QRCodeSvg",props:S,setup:function(t){var e=b(0),n=b(""),r=function(){var a=t.value,i=t.level,u=t.margin,o=Y(a,i).modules;e.value=o.length+u*2,n.value=F(o,u)};return r(),O(r),function(){return D("svg",{width:t.size,height:t.size,"shape-rendering":"crispEdges",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 ".concat(e.value," ").concat(e.value)},[D("path",{fill:t.background,d:"M0,0 h".concat(e.value,"v").concat(e.value,"H0z")}),D("path",{fill:t.foreground,d:n.value})])}}}),lt=x({name:"QRCodeCanvas",props:S,setup:function(t){var e=b(null),n=function(){var r=t.value,a=t.level,i=t.size,u=t.margin,o=t.background,f=t.foreground,l=Y(r,a).modules,s=l.length+u*2,m=e.value;if(m){var B=m.getContext("2d");if(B){var C=window.devicePixelRatio||1,p=i/s*C;m.height=m.width=i*C,B.scale(p,p),B.fillStyle=o,B.fillRect(0,0,s,s),B.fillStyle=f,ot?B.fill(new Path2D(F(l,u))):l.forEach(function(w,_){w.forEach(function(R,V){R&&B.fillRect(V+u,_+u,1,1)})})}}};return W(n),O(n),function(){return D("canvas",{ref:e,style:{width:"".concat(t.size,"px"),height:"".concat(t.size,"px")}})}}}),vt=x({name:"Qrcode",render:function(){var t=this.$props,e=t.renderAs,n=t.value,r=t.size,a=t.margin,i=t.level,u=t.background,o=t.foreground,f=r>>>0,l=a>>>0,s=J(i)?i:X;return D(e==="svg"?ft:lt,{value:n,size:f,margin:l,level:s,background:u,foreground:o})},props:st});export{vt as Q};