var de=Object.defineProperty;var It=Object.getOwnPropertySymbols;var ge=Object.prototype.hasOwnProperty,he=Object.prototype.propertyIsEnumerable;var Pt=(r,o,i)=>o in r?de(r,o,{enumerable:!0,configurable:!0,writable:!0,value:i}):r[o]=i,Mt=(r,o)=>{for(var i in o||(o={}))ge.call(o,i)&&Pt(r,i,o[i]);if(It)for(var i of It(o))he.call(o,i)&&Pt(r,i,o[i]);return r};var tt=(r,o,i)=>new Promise((n,t)=>{var e=u=>{try{a(i.next(u))}catch(c){t(c)}},s=u=>{try{a(i.throw(u))}catch(c){t(c)}},a=u=>u.done?n(u.value):Promise.resolve(u.value).then(e,s);a((i=i.apply(r,o)).next())});import{p as W}from"./propTypes-B9jTUFW5.js";import{S as me,d as we,a as Nt,p as vt,n as Ce,f as U,z as ye,A as Ee,u as V,h as Be,F as pe,x as Re,ag as Ae,ax as Lt,V as Te}from"./index-CT5luEdk.js";import{R as be}from"./refresh-right-DtrVVLHj.js";var j={},et,Dt;function Se(){return Dt||(Dt=1,et=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),et}var nt={},_={},qt;function H(){if(qt)return _;qt=1;let r;const o=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return _.getSymbolSize=function(n){if(!n)throw new Error('"version" cannot be null or undefined');if(n<1||n>40)throw new Error('"version" should be in range from 1 to 40');return n*4+17},_.getSymbolTotalCodewords=function(n){return o[n]},_.getBCHDigit=function(i){let n=0;for(;i!==0;)n++,i>>>=1;return n},_.setToSJISFunction=function(n){if(typeof n!="function")throw new Error('"toSJISFunc" is not a valid function.');r=n},_.isKanjiModeEnabled=function(){return typeof r!="undefined"},_.toSJIS=function(n){return r(n)},_}var rt={},Ut;function Tt(){return Ut||(Ut=1,function(r){r.L={bit:1},r.M={bit:0},r.Q={bit:3},r.H={bit:2};function o(i){if(typeof i!="string")throw new Error("Param is not a string");switch(i.toLowerCase()){case"l":case"low":return r.L;case"m":case"medium":return r.M;case"q":case"quartile":return r.Q;case"h":case"high":return r.H;default:throw new Error("Unknown EC Level: "+i)}}r.isValid=function(n){return n&&typeof n.bit!="undefined"&&n.bit>=0&&n.bit<4},r.from=function(n,t){if(r.isValid(n))return n;try{return o(n)}catch(e){return t}}}(rt)),rt}var ot,_t;function Ie(){if(_t)return ot;_t=1;function r(){this.buffer=[],this.length=0}return r.prototype={get:function(o){const i=Math.floor(o/8);return(this.buffer[i]>>>7-o%8&1)===1},put:function(o,i){for(let n=0;n>>i-n-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(o){const i=Math.floor(this.length/8);this.buffer.length<=i&&this.buffer.push(0),o&&(this.buffer[i]|=128>>>this.length%8),this.length++}},ot=r,ot}var it,kt;function Pe(){if(kt)return it;kt=1;function r(o){if(!o||o<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=o,this.data=new Uint8Array(o*o),this.reservedBit=new Uint8Array(o*o)}return r.prototype.set=function(o,i,n,t){const e=o*this.size+i;this.data[e]=n,t&&(this.reservedBit[e]=!0)},r.prototype.get=function(o,i){return this.data[o*this.size+i]},r.prototype.xor=function(o,i,n){this.data[o*this.size+i]^=n},r.prototype.isReserved=function(o,i){return this.reservedBit[o*this.size+i]},it=r,it}var st={},Ft;function Me(){return Ft||(Ft=1,function(r){const o=H().getSymbolSize;r.getRowColCoords=function(n){if(n===1)return[];const t=Math.floor(n/7)+2,e=o(n),s=e===145?26:Math.ceil((e-13)/(2*t-2))*2,a=[e-7];for(let u=1;u=0&&t<=7},r.from=function(t){return r.isValid(t)?parseInt(t,10):void 0},r.getPenaltyN1=function(t){const e=t.size;let s=0,a=0,u=0,c=null,m=null;for(let S=0;S=5&&(s+=o.N1+(a-5)),c=g,a=1),g=t.get(E,S),g===m?u++:(u>=5&&(s+=o.N1+(u-5)),m=g,u=1)}a>=5&&(s+=o.N1+(a-5)),u>=5&&(s+=o.N1+(u-5))}return s},r.getPenaltyN2=function(t){const e=t.size;let s=0;for(let a=0;a=10&&(a===1488||a===93)&&s++,u=u<<1&2047|t.get(m,c),m>=10&&(u===1488||u===93)&&s++}return s*o.N3},r.getPenaltyN4=function(t){let e=0;const s=t.data.length;for(let u=0;u=0;){const s=e[0];for(let u=0;u0){const a=new Uint8Array(this.degree);return a.set(e,s),a}return e},lt=o,lt}var ft={},dt={},gt={},jt;function ae(){return jt||(jt=1,gt.isValid=function(o){return!isNaN(o)&&o>=1&&o<=40}),gt}var L={},Yt;function ce(){if(Yt)return L;Yt=1;const r="[0-9]+",o="[A-Z $%*+\\-./:]+";let i="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";i=i.replace(/u/g,"\\u");const n="(?:(?![A-Z0-9 $%*+\\-./:]|"+i+`)(?:.|[\r ]))+`;L.KANJI=new RegExp(i,"g"),L.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),L.BYTE=new RegExp(n,"g"),L.NUMERIC=new RegExp(r,"g"),L.ALPHANUMERIC=new RegExp(o,"g");const t=new RegExp("^"+i+"$"),e=new RegExp("^"+r+"$"),s=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return L.testKanji=function(u){return t.test(u)},L.testNumeric=function(u){return e.test(u)},L.testAlphanumeric=function(u){return s.test(u)},L}var Qt;function K(){return Qt||(Qt=1,function(r){const o=ae(),i=ce();r.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},r.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},r.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},r.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},r.MIXED={bit:-1},r.getCharCountIndicator=function(e,s){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!o.isValid(s))throw new Error("Invalid version: "+s);return s>=1&&s<10?e.ccBits[0]:s<27?e.ccBits[1]:e.ccBits[2]},r.getBestModeForData=function(e){return i.testNumeric(e)?r.NUMERIC:i.testAlphanumeric(e)?r.ALPHANUMERIC:i.testKanji(e)?r.KANJI:r.BYTE},r.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")},r.isValid=function(e){return e&&e.bit&&e.ccBits};function n(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return r.NUMERIC;case"alphanumeric":return r.ALPHANUMERIC;case"kanji":return r.KANJI;case"byte":return r.BYTE;default:throw new Error("Unknown mode: "+t)}}r.from=function(e,s){if(r.isValid(e))return e;try{return n(e)}catch(a){return s}}}(dt)),dt}var Gt;function Ue(){return Gt||(Gt=1,function(r){const o=H(),i=ue(),n=Tt(),t=K(),e=ae(),s=7973,a=o.getBCHDigit(s);function u(E,g,P){for(let f=1;f<=40;f++)if(g<=r.getCapacity(f,P,E))return f}function c(E,g){return t.getCharCountIndicator(E,g)+4}function m(E,g){let P=0;return E.forEach(function(f){const M=c(f.mode,g);P+=M+f.getBitsLength()}),P}function S(E,g){for(let P=1;P<=40;P++)if(m(E,P)<=r.getCapacity(P,g,t.MIXED))return P}r.from=function(g,P){return e.isValid(g)?parseInt(g,10):P},r.getCapacity=function(g,P,f){if(!e.isValid(g))throw new Error("Invalid QR Code version");typeof f=="undefined"&&(f=t.BYTE);const M=o.getSymbolTotalCodewords(g),h=i.getTotalCodewordsCount(g,P),b=(M-h)*8;if(f===t.MIXED)return b;const R=b-c(f,g);switch(f){case t.NUMERIC:return Math.floor(R/10*3);case t.ALPHANUMERIC:return Math.floor(R/11*2);case t.KANJI:return Math.floor(R/13);case t.BYTE:default:return Math.floor(R/8)}},r.getBestVersionForData=function(g,P){let f;const M=n.from(P,n.M);if(Array.isArray(g)){if(g.length>1)return S(g,M);if(g.length===0)return 1;f=g[0]}else f=g;return u(f.mode,f.getLength(),M)},r.getEncodedBits=function(g){if(!e.isValid(g)||g<7)throw new Error("Invalid QR Code version");let P=g<<12;for(;o.getBCHDigit(P)-a>=0;)P^=s<=0;)u^=o<0&&(e=this.data.substr(t),s=parseInt(e,10),n.put(s,a*3+1))},wt=o,wt}var Ct,Xt;function Fe(){if(Xt)return Ct;Xt=1;const r=K(),o=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function i(n){this.mode=r.ALPHANUMERIC,this.data=n}return i.getBitsLength=function(t){return 11*Math.floor(t/2)+6*(t%2)},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(t){let e;for(e=0;e+2<=this.data.length;e+=2){let s=o.indexOf(this.data[e])*45;s+=o.indexOf(this.data[e+1]),t.put(s,11)}this.data.length%2&&t.put(o.indexOf(this.data[e]),6)},Ct=i,Ct}var yt,Zt;function ze(){if(Zt)return yt;Zt=1;const r=K();function o(i){this.mode=r.BYTE,typeof i=="string"?this.data=new TextEncoder().encode(i):this.data=new Uint8Array(i)}return o.getBitsLength=function(n){return n*8},o.prototype.getLength=function(){return this.data.length},o.prototype.getBitsLength=function(){return o.getBitsLength(this.data.length)},o.prototype.write=function(i){for(let n=0,t=this.data.length;n=33088&&e<=40956)e-=33088;else if(e>=57408&&e<=60351)e-=49472;else throw new Error("Invalid SJIS character: "+this.data[t]+` Make sure your charset is UTF-8`);e=(e>>>8&255)*192+(e&255),n.put(e,13)}},Et=i,Et}var Bt={exports:{}},te;function He(){return te||(te=1,function(r){var o={single_source_shortest_paths:function(i,n,t){var e={},s={};s[n]=0;var a=o.PriorityQueue.make();a.push(n,0);for(var u,c,m,S,E,g,P,f,M;!a.empty();){u=a.pop(),c=u.value,S=u.cost,E=i[c]||{};for(m in E)E.hasOwnProperty(m)&&(g=E[m],P=S+g,f=s[m],M=typeof s[m]=="undefined",(M||f>P)&&(s[m]=P,a.push(m,P),e[m]=c))}if(typeof t!="undefined"&&typeof s[t]=="undefined"){var h=["Could not find a path from ",n," to ",t,"."].join("");throw new Error(h)}return e},extract_shortest_path_from_predecessor_list:function(i,n){for(var t=[],e=n;e;)t.push(e),i[e],e=i[e];return t.reverse(),t},find_path:function(i,n,t){var e=o.single_source_shortest_paths(i,n,t);return o.extract_shortest_path_from_predecessor_list(e,t)},PriorityQueue:{make:function(i){var n=o.PriorityQueue,t={},e;i=i||{};for(e in n)n.hasOwnProperty(e)&&(t[e]=n[e]);return t.queue=[],t.sorter=i.sorter||n.default_sorter,t},default_sorter:function(i,n){return i.cost-n.cost},push:function(i,n){var t={value:i,cost:n};this.queue.push(t),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};r.exports=o}(Bt)),Bt.exports}var ee;function Ke(){return ee||(ee=1,function(r){const o=K(),i=ke(),n=Fe(),t=ze(),e=Ve(),s=ce(),a=H(),u=He();function c(h){return unescape(encodeURIComponent(h)).length}function m(h,b,R){const C=[];let N;for(;(N=h.exec(R))!==null;)C.push({data:N[0],index:N.index,mode:b,length:N[0].length});return C}function S(h){const b=m(s.NUMERIC,o.NUMERIC,h),R=m(s.ALPHANUMERIC,o.ALPHANUMERIC,h);let C,N;return a.isKanjiModeEnabled()?(C=m(s.BYTE,o.BYTE,h),N=m(s.KANJI,o.KANJI,h)):(C=m(s.BYTE_KANJI,o.BYTE,h),N=[]),b.concat(R,C,N).sort(function(p,A){return p.index-A.index}).map(function(p){return{data:p.data,mode:p.mode,length:p.length}})}function E(h,b){switch(b){case o.NUMERIC:return i.getBitsLength(h);case o.ALPHANUMERIC:return n.getBitsLength(h);case o.KANJI:return e.getBitsLength(h);case o.BYTE:return t.getBitsLength(h)}}function g(h){return h.reduce(function(b,R){const C=b.length-1>=0?b[b.length-1]:null;return C&&C.mode===R.mode?(b[b.length-1].data+=R.data,b):(b.push(R),b)},[])}function P(h){const b=[];for(let R=0;R=0&&d<=6&&(I===0||I===6)||I>=0&&I<=6&&(d===0||d===6)||d>=2&&d<=4&&I>=2&&I<=4?w.set(B+d,T+I,!0,!0):w.set(B+d,T+I,!1,!0))}}function P(w){const p=w.size;for(let A=8;A>d&1)===1,w.set(y,B,T,!0),w.set(B,y,T,!0)}function h(w,p,A){const l=w.size,y=m.getEncodedBits(p,A);let B,T;for(B=0;B<15;B++)T=(y>>B&1)===1,B<6?w.set(B,8,T,!0):B<8?w.set(B+1,8,T,!0):w.set(l-15+B,8,T,!0),B<8?w.set(8,l-B-1,T,!0):B<9?w.set(8,15-B-1+1,T,!0):w.set(8,15-B-1,T,!0);w.set(l-8,8,1,!0)}function b(w,p){const A=w.size;let l=-1,y=A-1,B=7,T=0;for(let d=A-1;d>0;d-=2)for(d===6&&d--;;){for(let I=0;I<2;I++)if(!w.isReserved(y,d-I)){let v=!1;T>>B&1)===1),w.set(y,d-I,v),B--,B===-1&&(T++,B=7)}if(y+=l,y<0||A<=y){y-=l,l=-l;break}}}function R(w,p,A){const l=new i;A.forEach(function(I){l.put(I.mode.bit,4),l.put(I.getLength(),S.getCharCountIndicator(I.mode,w)),I.write(l)});const y=r.getSymbolTotalCodewords(w),B=a.getTotalCodewordsCount(w,p),T=(y-B)*8;for(l.getLengthInBits()+4<=T&&l.put(0,4);l.getLengthInBits()%8!==0;)l.putBit(0);const d=(T-l.getLengthInBits())/8;for(let I=0;I=7&&M(I,p),b(I,T),isNaN(l)&&(l=s.getBestMask(I,h.bind(null,I,A))),s.applyMask(l,I),h(I,A,l),{modules:I,version:p,errorCorrectionLevel:A,maskPattern:l,segments:y}}return nt.create=function(p,A){if(typeof p=="undefined"||p==="")throw new Error("No input text");let l=o.M,y,B;return typeof A!="undefined"&&(l=o.from(A.errorCorrectionLevel,o.M),y=c.from(A.version),B=s.from(A.maskPattern),A.toSJISFunc&&r.setToSJISFunction(A.toSJISFunc)),N(p,y,l,B)},nt}var pt={},Rt={},re;function le(){return re||(re=1,function(r){function o(i){if(typeof i=="number"&&(i=i.toString()),typeof i!="string")throw new Error("Color should be defined as hex string");let n=i.slice().replace("#","").split("");if(n.length<3||n.length===5||n.length>8)throw new Error("Invalid hex color: "+i);(n.length===3||n.length===4)&&(n=Array.prototype.concat.apply([],n.map(function(e){return[e,e]}))),n.length===6&&n.push("F","F");const t=parseInt(n.join(""),16);return{r:t>>24&255,g:t>>16&255,b:t>>8&255,a:t&255,hex:"#"+n.slice(0,6).join("")}}r.getOptions=function(n){n||(n={}),n.color||(n.color={});const t=typeof n.margin=="undefined"||n.margin===null||n.margin<0?4:n.margin,e=n.width&&n.width>=21?n.width:void 0,s=n.scale||4;return{width:e,scale:e?4:s,margin:t,color:{dark:o(n.color.dark||"#000000ff"),light:o(n.color.light||"#ffffffff")},type:n.type,rendererOpts:n.rendererOpts||{}}},r.getScale=function(n,t){return t.width&&t.width>=n+t.margin*2?t.width/(n+t.margin*2):t.scale},r.getImageWidth=function(n,t){const e=r.getScale(n,t);return Math.floor((n+t.margin*2)*e)},r.qrToImageData=function(n,t,e){const s=t.modules.size,a=t.modules.data,u=r.getScale(s,e),c=Math.floor((s+e.margin*2)*u),m=e.margin*u,S=[e.color.light,e.color.dark];for(let E=0;E=m&&g>=m&&E0&&E>0&&t[S-1]||(a+=c?i("M",E+s,.5+g+s):i("m",u,0),u=0,c=!1),E+1':"",g="',P='viewBox="0 0 '+S+" "+S+'"',M=''+E+g+` `;return typeof a=="function"&&a(null,M),M},At}var se;function Ye(){if(se)return j;se=1;const r=Se(),o=Oe(),i=Je(),n=je();function t(e,s,a,u,c){const m=[].slice.call(arguments,1),S=m.length,E=typeof m[S-1]=="function";if(!E&&!r())throw new Error("Callback required as last argument");if(E){if(S<2)throw new Error("Too few arguments provided");S===2?(c=a,a=s,s=u=void 0):S===3&&(s.getContext&&typeof c=="undefined"?(c=u,u=void 0):(c=u,u=a,a=s,s=void 0))}else{if(S<1)throw new Error("Too few arguments provided");return S===1?(a=s,s=u=void 0):S===2&&!s.getContext&&(u=a,a=s,s=void 0),new Promise(function(g,P){try{const f=o.create(a,u);g(e(f,s,u))}catch(f){P(f)}})}try{const g=o.create(a,u);c(null,e(g,s,u))}catch(g){c(g)}}return j.create=o.create,j.toCanvas=t.bind(null,i.render),j.toDataURL=t.bind(null,i.renderToDataURL),j.toString=t.bind(null,function(e,s,a){return n.render(e,a)}),j}var Qe=Ye();const Ge=me(Qe),We={tag:W.string.validate(r=>["canvas","img"].includes(r)).def("canvas"),text:{type:[String,Array],default:null},options:{type:Object,default:()=>({})},width:W.number.def(200),logo:{type:[String,Object],default:()=>""},disabled:W.bool.def(!1),disabledText:W.string.def("")},$e=we({name:"ReQrcode",props:We,emits:["done","click","disabled-click"],setup(r,{emit:o}){const{toCanvas:i,toDataURL:n}=Ge,t=Nt(!0),e=Nt(null),s=vt(()=>String(r.text)),a=vt(()=>({width:r.width+"px",height:r.width+"px"})),u=()=>tt(this,null,function*(){yield Re();const f=Ae(r.options||{});if(r.tag==="canvas"){f.errorCorrectionLevel=f.errorCorrectionLevel||S(V(s));const M=yield m(V(s),f);f.scale=r.width===0?void 0:r.width/M*4;const h=yield i(V(e),V(s),f);if(r.logo){const b=yield c(h);o("done",b),t.value=!1}else o("done",h.toDataURL()),t.value=!1}else{const M=yield n(s.value,Mt({errorCorrectionLevel:"H",width:r.width},f));V(e).src=M,o("done",M),t.value=!1}});Ce(()=>s.value,f=>{f&&u()},{deep:!0,immediate:!0});const c=f=>{const M=f.width,h=Object.assign({logoSize:.15,bgColor:"#ffffff",borderSize:.05,crossOrigin:"anonymous",borderRadius:8,logoRadius:0},Lt(r.logo)?{}:r.logo),{logoSize:b=.15,bgColor:R="#ffffff",borderSize:C=.05,crossOrigin:N="anonymous",borderRadius:w=8,logoRadius:p=0}=h,A=Lt(r.logo)?r.logo:r.logo.src,l=M*b,y=M*(1-b)/2,B=M*(b+C),T=M*(1-b-C)/2,d=f.getContext("2d");if(!d)return;E(d)(T,T,B,B,w),d.fillStyle=R,d.fill();const I=new Image;(N||p)&&I.setAttribute("crossOrigin",N),I.src=A;const v=F=>{d.drawImage(F,y,y,l,l)},k=F=>{const z=document.createElement("canvas");z.width=y+l,z.height=y+l;const Q=z.getContext("2d");if(!Q||!d||(Q.drawImage(F,y,y,l,l),E(d)(y,y,l,l,p),!d))return;const O=d.createPattern(z,"no-repeat");O&&(d.fillStyle=O,d.fill())};return new Promise(F=>{I.onload=()=>{p?k(I):v(I),F(f.toDataURL())}})},m=(f,M)=>tt(this,null,function*(){const h=document.createElement("canvas");return yield i(h,f,M),h.width}),S=f=>f.length>36?"M":f.length>16?"Q":"H",E=f=>(M,h,b,R,C)=>{const N=Math.min(b,R);return C>N/2&&(C=N/2),f.beginPath(),f.moveTo(M+C,h),f.arcTo(M+b,h,M+b,h+R,C),f.arcTo(M+b,h+R,M,h+R,C),f.arcTo(M,h+R,M,h,C),f.arcTo(M,h,M+b,h,C),f.closePath(),f},g=()=>{o("click")},P=()=>{o("disabled-click")};return()=>U(pe,null,[ye(U("div",{class:"qrcode relative inline-block",style:V(a)},[r.tag==="canvas"?U("canvas",{ref:e,onClick:g},null):U("img",{ref:e,onClick:g},null),r.disabled&&U("div",{class:"qrcode--disabled absolute top-0 left-0 flex w-full h-full items-center justify-center",onClick:P},[U("div",{class:"absolute top-[50%] left-[50%] font-bold"},[U(Be("iconify-icon-offline"),{class:"cursor-pointer",icon:be,width:"30",color:"var(--el-color-primary)"},null),U("div",null,[r.disabledText])])])]),[[Ee("loading"),V(t)]])])}}),en=Te($e);export{en as R};