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