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