"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),N=require("@ant-design/icons-vue"),S=require("../_util/type.js");require("../button/index.js");const m=require("../config-provider/hooks/useConfigInject.js"),b=require("../locale/LocaleReceiver.js");require("../spin/index.js");const $=require("../theme/internal.js"),d=require("./QRCode.js"),y=require("./interface.js"),k=require("./style/index.js"),p=require("../spin/Spin.js"),Q=require("../button/button.js"),z=e.defineComponent({name:"AQrcode",inheritAttrs:!1,props:y.qrcodeProps(),emits:["refresh"],setup(t,{emit:v,attrs:s,expose:f}){const[n]=b.useLocaleReceiver("QRCode"),{prefixCls:c}=m.default("qrcode",t),[q,C]=k.default(c),[,a]=$.useToken(),i=e.ref();f({toDataURL:(r,o)=>i.value?.toDataURL(r,o)});const l=e.computed(()=>{const{value:r,icon:o="",size:g=160,iconSize:u=40,color:h=a.value.colorText,bgColor:V="transparent",errorLevel:x="M"}=t,R={src:o,x:void 0,y:void 0,height:u,width:u,excavate:!0};return{value:r,size:g-(a.value.paddingSM+a.value.lineWidth)*2,level:x,bgColor:V,fgColor:h,imageSettings:o?R:void 0}});return()=>{const r=c.value;return q(e.createVNode("div",{...s,style:[s.style,{width:`${t.size}px`,height:`${t.size}px`,backgroundColor:l.value.bgColor}],class:[C.value,r,{[`${r}-borderless`]:!t.bordered}]},[t.status!=="active"&&e.createVNode("div",{class:`${r}-mask`},[t.status==="loading"&&e.createVNode(p.default,null,null),t.status==="expired"&&e.createVNode(e.Fragment,null,[e.createVNode("p",{class:`${r}-expired`},[n.value.expired]),e.createVNode(Q.default,{type:"link",onClick:o=>v("refresh",o)},{default:()=>[n.value.refresh],icon:()=>e.createVNode(N.ReloadOutlined,null,null)})]),t.status==="scanned"&&e.createVNode("p",{class:`${r}-scanned`},[n.value.scanned])]),t.type==="canvas"?e.createVNode(d.QRCodeCanvas,{ref:i,...l.value},null):e.createVNode(d.QRCodeSVG,l.value,null)]))}}}),L=S.withInstall(z);exports.default=L;
