import{ap as ye,aC as Ce,a_ as xe,f as Lt,N as Se,W as Wt,S as je,o as nt,c as pt,R as _t,a2 as W,k as I,_ as Pe,a5 as Ae,ab as Ge,r as zt,O as Ue,C as He,bg as Ke,y as it,j as Xe,n as Pt,a as xt,a4 as ae,m as kt,w as jt,a1 as Ze,B as Gt,b as le,aw as Ve,bh as We,t as Ut,d as ce,ar as Je,as as Ye}from"./entry.b59333b6.js";import{u as qe}from"./index.712aa735.js";import{_ as Qe}from"./_plugin-vue_export-helper.c27b6911.js";const tr=ye({space:{type:[Number,String],default:""},active:{type:Number,default:0},direction:{type:String,default:"horizontal",values:["horizontal","vertical"]},alignCenter:{type:Boolean},simple:{type:Boolean},finishStatus:{type:String,values:["wait","process","finish","error","success"],default:"finish"},processStatus:{type:String,values:["wait","process","finish","error","success"],default:"process"}}),er={[Ce]:(o,t)=>[o,t].every(xe)},rr=Lt({name:"ElSteps"}),nr=Lt({...rr,props:tr,emits:er,setup(o,{emit:t}){const e=o,r=Se("steps"),{children:n,addChild:i,removeChild:s}=qe(Ae(),"ElStep");return Wt(n,()=>{n.value.forEach((a,l)=>{a.setIndex(l)})}),je("ElSteps",{props:e,steps:n,addStep:i,removeStep:s}),Wt(()=>e.active,(a,l)=>{t(Ce,a,l)}),(a,l)=>(nt(),pt("div",{class:W([I(r).b(),I(r).m(a.simple?"simple":a.direction)])},[_t(a.$slots,"default")],2))}});var ir=Pe(nr,[["__file","steps.vue"]]);const or=ye({title:{type:String,default:""},icon:{type:Ge},description:{type:String,default:""},status:{type:String,values:["","wait","process","finish","error","success"],default:""}}),sr=Lt({name:"ElStep"}),ar=Lt({...sr,props:or,setup(o){const t=o,e=Se("step"),r=zt(-1),n=zt({}),i=zt(""),s=Ue("ElSteps"),a=Ae();He(()=>{Wt([()=>s.props.active,()=>s.props.processStatus,()=>s.props.finishStatus],([h])=>{g(h)},{immediate:!0})}),Ke(()=>{s.removeStep(w.uid)});const l=it(()=>t.status||i.value),c=it(()=>{const h=s.steps.value[r.value-1];return h?h.currentStatus:"wait"}),f=it(()=>s.props.alignCenter),d=it(()=>s.props.direction==="vertical"),m=it(()=>s.props.simple),x=it(()=>s.steps.value.length),B=it(()=>{var h;return((h=s.steps.value[x.value-1])==null?void 0:h.uid)===(a==null?void 0:a.uid)}),k=it(()=>m.value?"":s.props.space),$=it(()=>[e.b(),e.is(m.value?"simple":s.props.direction),e.is("flex",B.value&&!k.value&&!f.value),e.is("center",f.value&&!d.value&&!m.value)]),p=it(()=>{const h={flexBasis:xe(k.value)?`${k.value}px`:k.value?k.value:`${100/(x.value-(f.value?0:1))}%`};return d.value||B.value&&(h.maxWidth=`${100/x.value}%`),h}),v=h=>{r.value=h},P=h=>{const b=h==="wait",S={transitionDelay:`${b?"-":""}${150*r.value}ms`},E=h===s.props.processStatus||b?0:100;S.borderWidth=E&&!m.value?"1px":0,S[s.props.direction==="vertical"?"height":"width"]=`${E}%`,n.value=S},g=h=>{h>r.value?i.value=s.props.finishStatus:h===r.value&&c.value!=="error"?i.value=s.props.processStatus:i.value="wait";const b=s.steps.value[r.value-1];b&&b.calcProgress(i.value)},w=Xe({uid:a.uid,currentStatus:l,setIndex:v,calcProgress:P});return s.addStep(w),(h,b)=>(nt(),pt("div",{style:ae(I(p)),class:W(I($))},[Pt(" icon & line "),xt("div",{class:W([I(e).e("head"),I(e).is(I(l))])},[I(m)?Pt("v-if",!0):(nt(),pt("div",{key:0,class:W(I(e).e("line"))},[xt("i",{class:W(I(e).e("line-inner")),style:ae(n.value)},null,6)],2)),xt("div",{class:W([I(e).e("icon"),I(e).is(h.icon||h.$slots.icon?"icon":"text")])},[_t(h.$slots,"icon",{},()=>[h.icon?(nt(),kt(I(Gt),{key:0,class:W(I(e).e("icon-inner"))},{default:jt(()=>[(nt(),kt(Ze(h.icon)))]),_:1},8,["class"])):I(l)==="success"?(nt(),kt(I(Gt),{key:1,class:W([I(e).e("icon-inner"),I(e).is("status")])},{default:jt(()=>[le(I(Ve))]),_:1},8,["class"])):I(l)==="error"?(nt(),kt(I(Gt),{key:2,class:W([I(e).e("icon-inner"),I(e).is("status")])},{default:jt(()=>[le(I(We))]),_:1},8,["class"])):I(m)?Pt("v-if",!0):(nt(),pt("div",{key:3,class:W(I(e).e("icon-inner"))},Ut(r.value+1),3))])],2)],2),Pt(" title & description "),xt("div",{class:W(I(e).e("main"))},[xt("div",{class:W([I(e).e("title"),I(e).is(I(l))])},[_t(h.$slots,"title",{},()=>[ce(Ut(h.title),1)])],2),I(m)?(nt(),pt("div",{key:0,class:W(I(e).e("arrow"))},null,2)):(nt(),pt("div",{key:1,class:W([I(e).e("description"),I(e).is(I(l))])},[_t(h.$slots,"description",{},()=>[ce(Ut(h.description),1)])],2))],2)],6))}});var Be=Pe(ar,[["__file","item.vue"]]);const vn=Je(ir,{Step:Be}),mn=Ye(Be);function Ht(o){return o===""?o:o==="true"||o=="1"}function lr(o,t){return new Promise((e,r)=>{var n=new XMLHttpRequest;n.responseType="blob",n.onload=function(){var i=new FileReader;i.onloadend=function(){e(i.result)},i.readAsArrayBuffer(n.response)},n.open("GET",o),n.send()})}function ot(o){if(typeof o!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(o))}function ue(o,t){for(var e="",r=0,n=-1,i=0,s,a=0;a<=o.length;++a){if(a2){var l=e.lastIndexOf("/");if(l!==e.length-1){l===-1?(e="",r=0):(e=e.slice(0,l),r=e.length-1-e.lastIndexOf("/")),n=a,i=0;continue}}else if(e.length===2||e.length===1){e="",r=0,n=a,i=0;continue}}t&&(e.length>0?e+="/..":e="..",r=2)}else e.length>0?e+="/"+o.slice(n+1,a):e=o.slice(n+1,a),r=a-n-1;n=a,i=0}else s===46&&i!==-1?++i:i=-1}return e}function cr(o,t){var e=t.dir||t.root,r=t.base||(t.name||"")+(t.ext||"");return e?e===t.root?e+r:e+o+r:r}var mt={resolve:function(){for(var t="",e=!1,r,n=arguments.length-1;n>=-1&&!e;n--){var i;n>=0?i=arguments[n]:(r===void 0&&(r=process.cwd()),i=r),ot(i),i.length!==0&&(t=i+"/"+t,e=i.charCodeAt(0)===47)}return t=ue(t,!e),e?t.length>0?"/"+t:"/":t.length>0?t:"."},normalize:function(t){if(ot(t),t.length===0)return".";var e=t.charCodeAt(0)===47,r=t.charCodeAt(t.length-1)===47;return t=ue(t,!e),t.length===0&&!e&&(t="."),t.length>0&&r&&(t+="/"),e?"/"+t:t},isAbsolute:function(t){return ot(t),t.length>0&&t.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var t,e=0;e0&&(t===void 0?t=r:t+="/"+r)}return t===void 0?".":mt.normalize(t)},relative:function(t,e){if(ot(t),ot(e),t===e||(t=mt.resolve(t),e=mt.resolve(e),t===e))return"";for(var r=1;rc){if(e.charCodeAt(s+d)===47)return e.slice(s+d+1);if(d===0)return e.slice(s+d)}else i>c&&(t.charCodeAt(r+d)===47?f=d:d===0&&(f=0));break}var m=t.charCodeAt(r+d),x=e.charCodeAt(s+d);if(m!==x)break;m===47&&(f=d)}var B="";for(d=r+f+1;d<=n;++d)(d===n||t.charCodeAt(d)===47)&&(B.length===0?B+="..":B+="/..");return B.length>0?B+e.slice(s+f):(s+=f,e.charCodeAt(s)===47&&++s,e.slice(s))},_makeLong:function(t){return t},dirname:function(t){if(ot(t),t.length===0)return".";for(var e=t.charCodeAt(0),r=e===47,n=-1,i=!0,s=t.length-1;s>=1;--s)if(e=t.charCodeAt(s),e===47){if(!i){n=s;break}}else i=!1;return n===-1?r?"/":".":r&&n===1?"//":t.slice(0,n)},basename:function(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');ot(t);var r=0,n=-1,i=!0,s;if(e!==void 0&&e.length>0&&e.length<=t.length){if(e.length===t.length&&e===t)return"";var a=e.length-1,l=-1;for(s=t.length-1;s>=0;--s){var c=t.charCodeAt(s);if(c===47){if(!i){r=s+1;break}}else l===-1&&(i=!1,l=s+1),a>=0&&(c===e.charCodeAt(a)?--a===-1&&(n=s):(a=-1,n=l))}return r===n?n=l:n===-1&&(n=t.length),t.slice(r,n)}else{for(s=t.length-1;s>=0;--s)if(t.charCodeAt(s)===47){if(!i){r=s+1;break}}else n===-1&&(i=!1,n=s+1);return n===-1?"":t.slice(r,n)}},extname:function(t){ot(t);for(var e=-1,r=0,n=-1,i=!0,s=0,a=t.length-1;a>=0;--a){var l=t.charCodeAt(a);if(l===47){if(!i){r=a+1;break}continue}n===-1&&(i=!1,n=a+1),l===46?e===-1?e=a:s!==1&&(s=1):e!==-1&&(s=-1)}return e===-1||n===-1||s===0||s===1&&e===n-1&&e===r+1?"":t.slice(e,n)},format:function(t){if(t===null||typeof t!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof t);return cr("/",t)},parse:function(t){ot(t);var e={root:"",dir:"",base:"",ext:"",name:""};if(t.length===0)return e;var r=t.charCodeAt(0),n=r===47,i;n?(e.root="/",i=1):i=0;for(var s=-1,a=0,l=-1,c=!0,f=t.length-1,d=0;f>=i;--f){if(r=t.charCodeAt(f),r===47){if(!c){a=f+1;break}continue}l===-1&&(c=!1,l=f+1),r===46?s===-1?s=f:d!==1&&(d=1):s!==-1&&(d=-1)}return s===-1||l===-1||d===0||d===1&&s===l-1&&s===a+1?l!==-1&&(a===0&&n?e.base=e.name=t.slice(1,l):e.base=e.name=t.slice(a,l)):(a===0&&n?(e.name=t.slice(1,s),e.base=t.slice(1,l)):(e.name=t.slice(a,s),e.base=t.slice(a,l)),e.ext=t.slice(s,l)),a>0?e.dir=t.slice(0,a-1):n&&(e.dir="/"),e},sep:"/",delimiter:":",win32:null,posix:null};mt.posix=mt;const ur=mt.extname,ke=mt.basename;class fr{constructor(){let t=(()=>typeof global>"u")(),e="image/png",r="image/jpeg",n="image/jpeg",i="image/webp",s="application/pdf",a="image/svg+xml";Object.assign(this,{toMime:this.toMime.bind(this),fromMime:this.fromMime.bind(this),expected:t?'"png", "jpg", or "webp"':'"png", "jpg", "pdf", or "svg"',formats:t?{png:e,jpg:r,jpeg:n,webp:i}:{png:e,jpg:r,jpeg:n,pdf:s,svg:a},mimes:t?{[e]:"png",[r]:"jpg",[i]:"webp"}:{[e]:"png",[r]:"jpg",[s]:"pdf",[a]:"svg"}})}toMime(t){return this.formats[(t||"").replace(/^\./,"").toLowerCase()]}fromMime(t){return this.mimes[t]}}function hr(o,{filename:t="",extension:e="",format:k,page:n,quality:i,matte:s,density:a,outline:l,archive:x}={}){var{fromMime:f,toMime:d,expected:m}=new fr,x=x||"canvas",B=k||e.replace(/@\d+x$/i,"")||ur(t),k=f(d(B)||B),$=d(k),p=o.length;if(!B)throw new Error("Cannot determine image format (use a filename extension or 'format' argument)");if(!k)throw new Error(`Unsupported file format "${B}" (expected ${m})`);if(!p)throw new RangeError("Canvas has no associated contexts (try calling getContext or newPage first)");let v,P,g=t.replace(/{(\d*)}/g,(h,b)=>(P=!0,b=parseInt(b,10),v=isFinite(b)?b:isFinite(v)?v:-1,"{}")),w=n>0?n-1:n<0?p+n:void 0;if(isFinite(w)&&w<0||w>=p)throw new RangeError(p==1?`Canvas only has a ‘page 1’ (${w} is out of bounds)`:`Canvas has pages 1–${p} (${w} is out of bounds)`);if(o=isFinite(w)?[o[w]]:P||k=="pdf"?o:o.slice(-1),i===void 0)i=.92;else if(typeof i!="number"||!isFinite(i)||i<0||i>1)throw new TypeError("The quality option must be an number in the 0.0–1.0 range");if(a===void 0){let h=(e||ke(t,B)).match(/@(\d+)x$/i);a=h?parseInt(h[1],10):1}else if(typeof a!="number"||!Number.isInteger(a)||a<1)throw new TypeError("The density option must be a non-negative integer");return l===void 0?l=!0:k=="svg"&&(l=!!l),{filename:t,pattern:g,format:k,mime:$,pages:o,padding:v,quality:i,matte:s,density:a,outline:l,archive:x}}class Mt{static for(t){return new Mt().append(t).get()}constructor(){this.crc=-1}get(){return~this.crc}append(t){for(var e=this.crc|0,r=this.table,n=0,i=t.length|0;n>>8^r[(e^t[n])&255];return this.crc=e,this}}Mt.prototype.table=(()=>{var o,t,e,r=[];for(o=0;o<256;o++){for(e=o,t=0;t<8;t++)e=e&1?e>>>1^3988292384:e>>>1;r[o]=e}return r})();function Kt(o){let t=new Uint8Array(o),e=new DataView(t.buffer),r={array:t,view:e,size:o,set8(n,i){return e.setUint8(n,i),r},set16(n,i){return e.setUint16(n,i,!0),r},set32(n,i){return e.setUint32(n,i,!0),r},bytes(n,i){return t.set(i,n),r}};return r}class Ft{constructor(t){let e=new Date;Object.assign(this,{directory:t,offset:0,files:[],time:(e.getHours()<<6|e.getMinutes())<<5|e.getSeconds()/2,date:(e.getFullYear()-1980<<4|e.getMonth()+1)<<5|e.getDate()}),this.add(t)}async add(t,e){let r=!e,n=Ft.encoder.encode(`${this.directory}/${r?"":t}`),i=new Uint8Array(r?0:await e.arrayBuffer()),s=30+n.length,a=s+i.length,l=16,{offset:c}=this,f=Kt(26).set32(0,134742036).set16(6,this.time).set16(8,this.date).set32(10,Mt.for(i)).set32(14,i.length).set32(18,i.length).set16(22,n.length);c+=s;let d=Kt(s+i.length+l).set32(0,67324752).bytes(4,f.array).bytes(30,n).bytes(s,i);c+=i.length,d.set32(a,134695760).bytes(a+4,f.array.slice(10,22)),c+=l,this.files.push({offset:c,folder:r,name:n,header:f,payload:d}),this.offset=c}toBuffer(){let t=this.files.reduce((d,{name:m})=>46+m.length+d,0),e=Kt(t+22),r=0;for(var{offset:n,name:i,header:s,folder:a}of this.files)e.set32(r,33639248).set16(r+4,20).bytes(r+6,s.array).set8(r+38,a?16:0).set32(r+42,n).bytes(r+46,i),r+=46+i.length;e.set32(r,101010256).set16(r+8,this.files.length).set16(r+10,this.files.length).set32(r+12,t).set32(r+16,this.offset);let l=new Uint8Array(this.offset+e.size),c=0;for(var{payload:f}of this.files)l.set(f.array,c),c+=f.size;return l.set(e.array,c),l}get blob(){return new Blob([this.toBuffer()],{type:"application/zip"})}}Ft.encoder=new TextEncoder;const qt=(o,t,e,r)=>{if(r){let{width:n,height:i}=o,s=Object.assign(document.createElement("canvas"),{width:n,height:i}),a=s.getContext("2d");a.fillStyle=r,a.fillRect(0,0,n,i),a.drawImage(o,0,0),o=s}return new Promise((n,i)=>o.toBlob(n,t,e))},dr=(...o)=>qt(...o).then(t=>t.arrayBuffer()),gr=async(o,t,e,r,n)=>{De(n,await qt(o,t,e,r))},pr=async(o,t,e,r,n,i,s)=>{let a=f=>i.replace("{}",String(f+1).padStart(s,"0")),l=ke(n,".zip")||"archive",c=new Ft(l);await Promise.all(o.map(async(f,d)=>{let m=a(d);await c.add(m,await qt(f,t,e,r))})),De(`${l}.zip`,c.blob)},De=(o,t)=>{const e=window.URL.createObjectURL(t),r=document.createElement("a");r.style.display="none",r.href=e,r.setAttribute("download",o),typeof r.download>"u"&&r.setAttribute("target","_blank"),document.body.appendChild(r),r.click(),document.body.removeChild(r),setTimeout(()=>window.URL.revokeObjectURL(e),100)},vr=(o,t,e)=>o.map(r=>{if(t==1&&!e)return r.canvas;let n=document.createElement("canvas"),i=n.getContext("2d"),s=r.canvas?r.canvas:r;return n.width=s.width*t,n.height=s.height*t,e&&(i.fillStyle=e,i.fillRect(0,0,n.width,n.height)),i.scale(t,t),i.drawImage(s,0,0),n}),mr={asBuffer:dr,asDownload:gr,asZipDownload:pr,atScale:vr,options:hr},{asBuffer:Xt,asDownload:br,asZipDownload:wr,atScale:Zt,options:Vt}=mr,fe=Symbol.for("toDataURL"),yr=o=>new Promise((t,e)=>Object.assign(new Ee,{crossOrigin:"Anonymous",onload:t,onerror:e,src:o}));let Cr=class{constructor(t,e){let r=document.createElement("canvas"),n=[];Object.defineProperty(r,"async",{value:!0,writable:!1,enumerable:!0});for(var[i,s]of Object.entries({png:()=>Xt(r,"image/png"),jpg:()=>Xt(r,"image/jpeg"),pages:()=>n.concat(r).map(a=>a.getContext("2d"))}))Object.defineProperty(r,i,{get:s});return Object.assign(r,{width:t,height:e,newPage(...a){var{width:c,height:f}=r,l=Object.assign(document.createElement("canvas"),{width:c,height:f});l.getContext("2d").drawImage(r,0,0),n.push(l);var[c,f]=a.length?a:[c,f];return Object.assign(r,{width:c,height:f}).getContext("2d")},saveAs(a,l){l=typeof l=="number"?{quality:l}:l;let c=Vt(this.pages,{filename:a,...l}),{pattern:f,padding:d,mime:m,quality:x,matte:B,density:k,archive:$}=c,p=Zt(c.pages,k);return d==null?br(p[0],m,x,B,a):wr(p,m,x,B,$,f,d)},toBuffer(a="png",l={}){l=typeof l=="number"?{quality:l}:l;let c=Vt(this.pages,{extension:a,...l}),{mime:f,quality:d,matte:m,pages:x,density:B}=c,k=Zt(x,B,m)[0];return Xt(k,f,d,m)},[fe]:r.toDataURL.bind(r),toDataURL(a="png",l={}){l=typeof l=="number"?{quality:l}:l;let c=Vt(this.pages,{extension:a,...l}),{mime:f,quality:d,matte:m,pages:x,density:B}=c,k=Zt(x,B,m)[0],$=k[k===r?fe:"toDataURL"](f,d);return Promise.resolve($)}})}};const{CanvasRenderingContext2D:xr,CanvasGradient:Sr,CanvasPattern:Pr,Image:Ee,ImageData:Ar,Path2D:Br,DOMMatrix:kr,DOMRect:Dr,DOMPoint:Er}=window,Tr={Canvas:Cr,loadImage:yr,CanvasRenderingContext2D:xr,CanvasGradient:Sr,CanvasPattern:Pr,Image:Ee,ImageData:Ar,Path2D:Br,DOMMatrix:kr,DOMRect:Dr,DOMPoint:Er},At=(o,t,e={},r=e)=>{if(Array.isArray(t))t.forEach(n=>At(o,n,e,r));else if(typeof t=="function")t(o,e,r,At);else{const n=Object.keys(t)[0];Array.isArray(t[n])?(r[n]={},At(o,t[n],e,r[n])):r[n]=t[n](o,e,r,At)}return e},bt=(o,t)=>(e,r,n,i)=>{t(e,r,n)&&i(e,o,r,n)},Ir=(o,t)=>(e,r,n,i)=>{const s=[];let a=e.pos;for(;t(e,r,n);){const l={};if(i(e,o,r,l),e.pos===a)break;a=e.pos,s.push(l)}return s},_r=o=>({data:o,pos:0}),Q=()=>o=>o.data[o.pos++],Te=(o=0)=>t=>t.data[t.pos+o],at=o=>t=>t.data.subarray(t.pos,t.pos+=o),Nt=o=>t=>t.data.subarray(t.pos,t.pos+o),Jt=o=>t=>Array.from(at(o)(t)).map(e=>String.fromCharCode(e)).join(""),vt=o=>t=>{const e=at(2)(t);return o?(e[1]<<8)+e[0]:(e[0]<<8)+e[1]},Ie=(o,t)=>(e,r,n)=>{const i=typeof t=="function"?t(e,r,n):t,s=at(o),a=new Array(i);for(var l=0;l{for(var r=0,n=0;nt=>{const e=Q()(t),r=new Array(8);for(var n=0;n<8;n++)r[7-n]=!!(e&1<{const a=o[s];return a.length?i[s]=Lr(r,a.index,a.length):i[s]=r[a.index],i},{})};var Ot={blocks:o=>{const e=[],r=o.data.length;for(var n=0,i=Q()(o);i!==0&&i;i=Q()(o)){if(o.pos+i>=r){const c=r-o.pos;e.push(at(c)(o)),n+=c;break}e.push(at(i)(o)),n+=i}const s=new Uint8Array(n);for(var a=0,l=0;l{var t=Nt(2)(o);return t[0]===33&&t[1]===249}),Fr=bt({image:[{code:Q()},{descriptor:[{left:vt(!0)},{top:vt(!0)},{width:vt(!0)},{height:vt(!0)},{lct:Qt({exists:{index:0},interlaced:{index:1},sort:{index:2},future:{index:3,length:2},size:{index:5,length:3}})}]},bt({lct:Ie(3,(o,t,e)=>Math.pow(2,e.descriptor.lct.size+1))},(o,t,e)=>e.descriptor.lct.exists),{data:[{minCodeSize:Q()},Ot]}]},o=>Te()(o)===44),Nr=bt({text:[{codes:at(2)},{blockSize:Q()},{preData:(o,t,e)=>at(e.text.blockSize)(o)},Ot]},o=>{var t=Nt(2)(o);return t[0]===33&&t[1]===1}),Or=bt({application:[{codes:at(2)},{blockSize:Q()},{id:(o,t,e)=>Jt(e.blockSize)(o)},Ot]},o=>{var t=Nt(2)(o);return t[0]===33&&t[1]===255}),Rr=bt({comment:[{codes:at(2)},Ot]},o=>{var t=Nt(2)(o);return t[0]===33&&t[1]===254}),$r=[{header:[{signature:Jt(3)},{version:Jt(3)}]},{lsd:[{width:vt(!0)},{height:vt(!0)},{gct:Qt({exists:{index:0},resolution:{index:1,length:3},sort:{index:4},size:{index:5,length:3}})},{backgroundColorIndex:Q()},{pixelAspectRatio:Q()}]},bt({gct:Ie(3,(o,t)=>Math.pow(2,t.lsd.gct.size+1))},(o,t)=>t.lsd.gct.exists),{frames:Ir([Mr,Or,Rr,Fr,Nr],o=>{var t=Te()(o);return t===33||t===44})}],zr=(o,t)=>{const e=new Array(o.length),r=o.length/t,n=function(f,d){const m=o.slice(d*t,(d+1)*t);e.splice.apply(e,[f*t,t].concat(m))},i=[0,4,2,1],s=[8,8,4,2];for(var a=0,l=0;l<4;l++)for(var c=i[l];c{const i=e;var s,a,l,c,f,d,m,w,x,B,g,k,h,b,E,S;const $=new Array(e),p=new Array(4096),v=new Array(4096),P=new Array(4096+1);for(k=o,a=1<>=c,w-=c,x>s||x==f)break;if(x==a){c=k+1,l=(1<a;)P[b++]=v[x],x=p[x];h=v[x]&255,P[b++]=h,s<4096&&(p[s]=m,v[s]=h,s++,!(s&l)&&s<4096&&(c++,l+=s)),m=d}b--,$[S++]=P[b],B++}for(B=S;B{const t=new Uint8Array(o);return At(_r(t),$r)},Ur=o=>{const t=o.pixels.length,e=new Uint8ClampedArray(t*4);for(var r=0;r{if(!o.image){console.warn("gif frame does not have associated image.");return}const{image:r}=o,n=r.descriptor.width*r.descriptor.height;var i=jr(r.data.minCodeSize,r.data.blocks,n);r.descriptor.lct.interlaced&&(i=zr(i,r.descriptor.width));const s={pixels:i,dims:{top:o.image.descriptor.top,left:o.image.descriptor.left,width:o.image.descriptor.width,height:o.image.descriptor.height}};return r.descriptor.lct&&r.descriptor.lct.exists?s.colorTable=r.lct:s.colorTable=t,o.gce&&(s.delay=(o.gce.delay||10)*10,s.disposalType=o.gce.extras.disposal,o.gce.extras.transparentColorGiven&&(s.transparentIndex=o.gce.transparentColorIndex)),e&&(s.patch=Ur(s)),s},Kr=(o,t)=>o.frames.filter(e=>e.image).map(e=>Hr(e,o.gct,t));function Xr(o,t,e){const r=_e(t),n=o-1;let i=0;switch(e){case V.L:i=st[n][0];break;case V.M:i=st[n][1];break;case V.Q:i=st[n][2];break;case V.H:i=st[n][3];break}return r<=i}function Zr(o,t){for(var e=1,r=_e(o),n=0,i=st.length;nst.length)throw new Error("Too long data");return e}function _e(o){var t=encodeURI(o).toString().replace(/\%[0-9a-fA-F]{2}/g,"a");return t.length+(t.length!=Number(o)?3:0)}class Vr{constructor(t){this.mode=Y.MODE_8BIT_BYTE,this.parsedData=[],this.data=t;const e=[];for(let r=0,n=this.data.length;r65536?(i[0]=240|(s&1835008)>>>18,i[1]=128|(s&258048)>>>12,i[2]=128|(s&4032)>>>6,i[3]=128|s&63):s>2048?(i[0]=224|(s&61440)>>>12,i[1]=128|(s&4032)>>>6,i[2]=128|s&63):s>128?(i[0]=192|(s&1984)>>>6,i[1]=128|s&63):i[0]=s,e.push(i)}this.parsedData=Array.prototype.concat.apply([],e),this.parsedData.length!=this.data.length&&(this.parsedData.unshift(191),this.parsedData.unshift(187),this.parsedData.unshift(239))}getLength(){return this.parsedData.length}write(t){for(let e=0,r=this.parsedData.length;e40)throw new Error(`Invalid QR version: ${this.typeNumber}`);if(!Xr(this.typeNumber,t,this.errorCorrectLevel))throw new Error(`Data is too long for QR version: ${this.typeNumber}`)}const e=new Vr(t);this.dataList.push(e),this.dataCache=void 0}isDark(t,e){if(t<0||this.moduleCount<=t||e<0||this.moduleCount<=e)throw new Error(`${t},${e}`);return this.modules[t][e]}getModuleCount(){return this.moduleCount}make(){this.makeImpl(!1,this.getBestMaskPattern())}makeImpl(t,e){this.moduleCount=this.typeNumber*4+17,this.modules=new Array(this.moduleCount);for(let r=0;r=7&&this.setupTypeNumber(t),this.dataCache==null&&(this.dataCache=dt.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,e)}setupPositionProbePattern(t,e){for(let r=-1;r<=7;r++)if(!(t+r<=-1||this.moduleCount<=t+r))for(let n=-1;n<=7;n++)e+n<=-1||this.moduleCount<=e+n||(0<=r&&r<=6&&(n==0||n==6)||0<=n&&n<=6&&(r==0||r==6)||2<=r&&r<=4&&2<=n&&n<=4?this.modules[t+r][e+n]=!0:this.modules[t+r][e+n]=!1)}getBestMaskPattern(){if(Number.isInteger(this.maskPattern)&&Object.values(ct).includes(this.maskPattern))return this.maskPattern;let t=0,e=0;for(let r=0;r<8;r++){this.makeImpl(!0,r);const n=M.getLostPoint(this);(r==0||t>n)&&(t=n,e=r)}return e}setupTimingPattern(){for(let t=8;t>r&1)==1;this.modules[Math.floor(r/3)][r%3+this.moduleCount-8-3]=n}for(var r=0;r<18;r++){var n=!t&&(e>>r&1)==1;this.modules[r%3+this.moduleCount-8-3][Math.floor(r/3)]=n}}setupTypeInfo(t,e){const r=this.errorCorrectLevel<<3|e,n=M.getBCHTypeInfo(r);for(var i=0;i<15;i++){var s=!t&&(n>>i&1)==1;i<6?this.modules[i][8]=s:i<8?this.modules[i+1][8]=s:this.modules[this.moduleCount-15+i][8]=s}for(var i=0;i<15;i++){var s=!t&&(n>>i&1)==1;i<8?this.modules[8][this.moduleCount-i-1]=s:i<9?this.modules[8][15-i-1+1]=s:this.modules[8][15-i-1]=s}this.modules[this.moduleCount-8][8]=!t}mapData(t,e){let r=-1,n=this.moduleCount-1,i=7,s=0;for(let a=this.moduleCount-1;a>0;a-=2)for(a==6&&a--;;){for(let l=0;l<2;l++)if(this.modules[n][a-l]==null){let c=!1;s>>i&1)==1),M.getMask(e,n,a-l)&&(c=!c),this.modules[n][a-l]=c,i--,i==-1&&(s++,i=7)}if(n+=r,n<0||this.moduleCount<=n){n-=r,r=-r;break}}}static createData(t,e,r){const n=ut.getRSBlocks(t,e),i=new Wr;for(var s=0;sa*8)throw new Error(`code length overflow. (${i.getLengthInBits()}>${a*8})`);for(i.getLengthInBits()+4<=a*8&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(!1);for(;!(i.getLengthInBits()>=a*8||(i.put(dt.PAD0,8),i.getLengthInBits()>=a*8));)i.put(dt.PAD1,8);return dt.createBytes(i,n)}static createBytes(t,e){let r=0,n=0,i=0;const s=new Array(e.length),a=new Array(e.length);for(var l=0;l=0?p.get(P):0}}let f=0;for(var c=0;c=0;)e^=M.G15<=0;)e^=M.G18<>>=1;return e}static getPatternPosition(t){return M.PATTERN_POSITION_TABLE[t-1]}static getMask(t,e,r){switch(t){case ct.PATTERN000:return(e+r)%2==0;case ct.PATTERN001:return e%2==0;case ct.PATTERN010:return r%3==0;case ct.PATTERN011:return(e+r)%3==0;case ct.PATTERN100:return(Math.floor(e/2)+Math.floor(r/3))%2==0;case ct.PATTERN101:return e*r%2+e*r%3==0;case ct.PATTERN110:return(e*r%2+e*r%3)%2==0;case ct.PATTERN111:return(e*r%3+(e+r)%2)%2==0;default:throw new Error(`bad maskPattern:${t}`)}}static getErrorCorrectPolynomial(t){let e=new yt([1],0);for(let r=0;r5&&(r+=3+l-5)}for(var n=0;n=256;)t-=255;return U.EXP_TABLE[t]}}U.EXP_TABLE=new Array(256);U.LOG_TABLE=new Array(256);U._constructor=function(){for(var o=0;o<8;o++)U.EXP_TABLE[o]=1<>>7-t%8&1)==1}put(t,e){for(let r=0;r>>e-r-1&1)==1)}getLengthInBits(){return this.length}putBit(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++}}const st=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]];var Jr=100,X=256,he=X-1,ht=4,Le=16,te=1<>ee,qr=te<>3,Yt=6,tn=1<>3);var p,v;for(p=0;p>=ht,e[p][1]>>=ht,e[p][2]>>=ht,e[p][3]=p}function c(p,v,P,g,w){e[v][0]-=p*(e[v][0]-P)/Dt,e[v][1]-=p*(e[v][1]-g)/Dt,e[v][2]-=p*(e[v][2]-w)/Dt}function f(p,v,P,g,w){for(var h=Math.abs(v-p),b=Math.min(v+p,X),S=v+1,E=v-1,F=1,u,N;Sh;)N=s[F++],Sh&&(u=e[E--],u[0]-=N*(u[0]-P)/wt,u[1]-=N*(u[1]-g)/wt,u[2]-=N*(u[2]-w)/wt)}function d(p,v,P){var g=2147483647,w=g,h=-1,b=h,S,E,F,u,N;for(S=0;S>Le-ht),u>ee,i[S]-=N,n[S]+=N<>1,v=b+1;v>1,v=b+1;v<256;v++)r[v]=he}function x(p,v,P){for(var g,w,h,b=1e3,S=-1,E=r[v],F=E-1;E=0;)E=b?E=X:(E++,h<0&&(h=-h),g=w[0]-p,g<0&&(g=-g),h+=g,h=0&&(w=e[F],h=v-w[1],h>=b?F=-1:(F--,h<0&&(h=-h),g=w[0]-p,g<0&&(g=-g),h+=g,h>Yt;for(S<=1&&(S=0),p=0;p=v&&(O-=v),p++,w===0&&(w=1),p%w===0)for(h-=h/P,b-=b/rn,S=b>>Yt,S<=1&&(S=0),C=0;C=254&&E(O)}function w(C){h(St),d=k+2,x=!0,N(k,C)}function h(C){for(var O=0;O=0){ft=H-G,G===0&&(ft=1);do if((G-=ft)<0&&(G+=H),s[G]===y){tt=a[G];continue t}while(s[G]>=0)}N(tt,O),tt=gt,d<1<0&&(C.writeByte(f),C.writeBytes(i,0,f),f=0)}function F(C){return(1<0?l|=C<=8;)g(l&255,O),l>>=8,c-=8;if((d>m||x)&&(x?(m=F(P=B),x=!1):(++P,P==Et?m=1<0;)g(l&255,O),l>>=8,c-=8;E(O)}}this.encode=S}function J(){this.page=-1,this.pages=[],this.newPage()}J.pageSize=4096;J.charMap={};for(var Tt=0;Tt<256;Tt++)J.charMap[Tt]=String.fromCharCode(Tt);J.prototype.newPage=function(){this.pages[++this.page]=new Uint8Array(J.pageSize),this.cursor=0};J.prototype.getData=function(){for(var o="",t=0;tr+n.length,0));return o.reduce((r,n)=>(e.set(n,r),r+n.length),0),e};J.prototype.writeByte=function(o){this.cursor>=J.pageSize&&this.newPage(),this.pages[this.page][this.cursor++]=o};J.prototype.writeUTFBytes=function(o){for(var t=o.length,e=0;e=0&&(this.dispose=o)};R.prototype.setRepeat=function(o){this.repeat=o};R.prototype.setTransparent=function(o){this.transparent=o};R.prototype.addFrame=function(o){this.image=o,this.colorTab=this.globalPalette&&this.globalPalette.slice?this.globalPalette:null,this.getImagePixels(),this.analyzePixels(),this.globalPalette===!0&&(this.globalPalette=this.colorTab),this.firstFrame&&(this.writeHeader(),this.writeLSD(),this.writePalette(),this.repeat>=0&&this.writeNetscapeExt()),this.writeGraphicCtrlExt(),this.writeImageDesc(),!this.firstFrame&&!this.globalPalette&&this.writePalette(),this.writePixels(),this.firstFrame=!1};R.prototype.finish=function(){this.out.writeByte(59)};R.prototype.setQuality=function(o){o<1&&(o=1),this.sample=o};R.prototype.setDither=function(o){o===!0&&(o="FloydSteinberg"),this.dither=o};R.prototype.setGlobalPalette=function(o){this.globalPalette=o};R.prototype.getGlobalPalette=function(){return this.globalPalette&&this.globalPalette.slice&&this.globalPalette.slice(0)||this.globalPalette};R.prototype.writeHeader=function(){this.out.writeUTFBytes("GIF89a")};R.prototype.analyzePixels=function(){this.colorTab||(this.neuQuant=new sn(this.pixels,this.sample),this.neuQuant.buildColormap(),this.colorTab=this.neuQuant.getColormap()),this.dither?this.ditherPixels(this.dither.replace("-serpentine",""),this.dither.match(/-serpentine/)!==null):this.indexPixels(),this.pixels=null,this.colorDepth=8,this.palSize=7,this.transparent!==null&&(this.transIndex=this.findClosest(this.transparent,!0))};R.prototype.indexPixels=function(o){var t=this.pixels.length/3;this.indexedPixels=new Uint8Array(t);for(var e=0,r=0;r=0&&S+f=0&&E+c>16,(o&65280)>>8,o&255,t)};R.prototype.findClosestRGB=function(o,t,e,r){if(this.colorTab===null)return-1;if(this.neuQuant&&!r)return this.neuQuant.lookupRGB(o,t,e);for(var n=0,i=256*256*256,s=this.colorTab.length,a=0,l=0;a=0&&(t=this.dispose&7),t<<=2,this.out.writeByte(0|t|0|o),this.writeShort(this.delay),this.out.writeByte(this.transIndex),this.out.writeByte(0)};R.prototype.writeImageDesc=function(){this.out.writeByte(44),this.writeShort(0),this.writeShort(0),this.writeShort(this.width),this.writeShort(this.height),this.firstFrame||this.globalPalette?this.out.writeByte(0):this.out.writeByte(128|this.palSize)};R.prototype.writeLSD=function(){this.writeShort(this.width),this.writeShort(this.height),this.out.writeByte(240|this.palSize),this.out.writeByte(0),this.out.writeByte(0)};R.prototype.writeNetscapeExt=function(){this.out.writeByte(33),this.out.writeByte(255),this.out.writeByte(11),this.out.writeUTFBytes("NETSCAPE2.0"),this.out.writeByte(3),this.out.writeByte(1),this.writeShort(this.repeat),this.out.writeByte(0)};R.prototype.writePalette=function(){this.out.writeBytes(this.colorTab);for(var o=3*256-this.colorTab.length,t=0;t>8&255)};R.prototype.writePixels=function(){var o=new ln(this.width,this.height,this.indexedPixels,this.colorDepth);o.encode(this.out)};R.prototype.stream=function(){return this.out};var cn=globalThis&&globalThis.__awaiter||function(o,t,e,r){function n(i){return i instanceof e?i:new e(function(s){s(i)})}return new(e||(e=Promise))(function(i,s){function a(f){try{c(r.next(f))}catch(d){s(d)}}function l(f){try{c(r.throw(f))}catch(d){s(d)}}function c(f){f.done?i(f.value):n(f.value).then(a,l)}c((r=r.apply(o,t||[])).next())})};const{Canvas:lt}=Tr,It=.4;function be(o){if(!o)return;function t(e){e.onload=null,e.onerror=null}return new Promise(function(e,r){if(o.slice(0,4)=="data"){let i=new Image;i.onload=function(){e(i),t(i)},i.onerror=function(){r("Image load error"),t(i)},i.src=o;return}let n=new Image;n.setAttribute("crossOrigin","Anonymous"),n.onload=function(){e(n)},n.onerror=function(){r("Image load error")},n.src=o})}class L{constructor(t){const e=Object.assign({},t);if(Object.keys(L.defaultOptions).forEach(r=>{r in e||Object.defineProperty(e,r,{value:L.defaultOptions[r],enumerable:!0,writable:!0})}),e.components?typeof e.components=="object"&&Object.keys(L.defaultComponentOptions).forEach(r=>{r in e.components?Object.defineProperty(e.components,r,{value:Object.assign(Object.assign({},L.defaultComponentOptions[r]),e.components[r]),enumerable:!0,writable:!0}):Object.defineProperty(e.components,r,{value:L.defaultComponentOptions[r],enumerable:!0,writable:!0})}):e.components=L.defaultComponentOptions,e.dotScale!==null&&e.dotScale!==void 0){if(e.dotScale<=0||e.dotScale>1)throw new Error("dotScale should be in range (0, 1].");e.components.data.scale=e.dotScale,e.components.timing.scale=e.dotScale,e.components.alignment.scale=e.dotScale}this.options=e,this.canvas=new lt(t.size,t.size),this.canvasContext=this.canvas.getContext("2d"),this.qrCode=new dt(-1,this.options.correctLevel),Number.isInteger(this.options.maskPattern)&&(this.qrCode.maskPattern=this.options.maskPattern),Number.isInteger(this.options.version)&&(this.qrCode.typeNumber=this.options.version),this.qrCode.addData(this.options.text),this.qrCode.make()}draw(){return new Promise(t=>this._draw().then(t))}_clear(){this.canvasContext.clearRect(0,0,this.canvas.width,this.canvas.height)}static _prepareRoundedCornerClip(t,e,r,n,i,s){t.beginPath(),t.moveTo(e,r),t.arcTo(e+n,r,e+n,r+i,s),t.arcTo(e+n,r+i,e,r+i,s),t.arcTo(e,r+i,e,r,s),t.arcTo(e,r,e+n,r,s),t.closePath()}static _getAverageRGB(t){const r={r:0,g:0,b:0};let n,i,s=-4;const a={r:0,g:0,b:0};let l=0;i=t.naturalHeight||t.height,n=t.naturalWidth||t.width;const f=new lt(n,i).getContext("2d");if(!f)return r;f.drawImage(t,0,0);let d;try{d=f.getImageData(0,0,n,i)}catch{return r}for(;(s+=5*4)200||d.data[s+1]>200||d.data[s+2]>200||(++l,a.r+=d.data[s],a.g+=d.data[s+1],a.b+=d.data[s+2]);return a.r=~~(a.r/l),a.g=~~(a.g/l),a.b=~~(a.b/l),a}static _drawDot(t,e,r,n,i=0,s=1){t.fillRect((e+i)*n,(r+i)*n,s*n,s*n)}static _drawAlignProtector(t,e,r,n){t.clearRect((e-2)*n,(r-2)*n,5*n,5*n),t.fillRect((e-2)*n,(r-2)*n,5*n,5*n)}static _drawAlign(t,e,r,n,i=0,s=1,a,l){const c=t.fillStyle;t.fillStyle=a,new Array(4).fill(0).map((f,d)=>{L._drawDot(t,e-2+d,r-2,n,i,s),L._drawDot(t,e+2,r-2+d,n,i,s),L._drawDot(t,e+2-d,r+2,n,i,s),L._drawDot(t,e-2,r+2-d,n,i,s)}),L._drawDot(t,e,r,n,i,s),l||(t.fillStyle="rgba(255, 255, 255, 0.6)",new Array(2).fill(0).map((f,d)=>{L._drawDot(t,e-1+d,r-1,n,i,s),L._drawDot(t,e+1,r-1+d,n,i,s),L._drawDot(t,e+1-d,r+1,n,i,s),L._drawDot(t,e-1,r+1-d,n,i,s)})),t.fillStyle=c}_draw(){var t,e,r,n,i,s,a,l,c,f,d,m,x,B,k,$,p,v,P;return cn(this,void 0,void 0,function*(){const g=(t=this.qrCode)===null||t===void 0?void 0:t.moduleCount,w=this.options.size;let h=this.options.margin;(h<0||h*2>=w)&&(h=0);const b=Math.ceil(h),S=w-2*h,E=this.options.whiteMargin,F=this.options.backgroundDimming,u=Math.ceil(S/g),N=u*g,C=N+2*b,O=new lt(C,C),y=O.getContext("2d");this._clear(),y.save(),y.translate(b,b);const gt=new lt(C,C),G=gt.getContext("2d");let tt=null,ft=[];if(this.options.gifBackground){const A=Gr(this.options.gifBackground);if(tt=A,ft=Kr(A,!0),this.options.autoColor){let D=0,T=0,_=0,K=0;for(let z=0;z200||j[1]>200||j[2]>200||j[0]===0&&j[1]===0&&j[2]===0||(K++,D+=j[0],T+=j[1],_+=j[2])}D=~~(D/K),T=~~(T/K),_=~~(_/K),this.options.colorDark=`rgb(${D},${T},${_})`}}else if(this.options.backgroundImage){const A=yield be(this.options.backgroundImage);if(this.options.autoColor){const D=L._getAverageRGB(A);this.options.colorDark=`rgb(${D.r},${D.g},${D.b})`}G.drawImage(A,0,0,A.width,A.height,0,0,C,C),G.rect(0,0,C,C),G.fillStyle=F,G.fill()}else G.rect(0,0,C,C),G.fillStyle=this.options.colorLight,G.fill();const H=M.getPatternPosition(this.qrCode.typeNumber),et=((r=(e=this.options.components)===null||e===void 0?void 0:e.data)===null||r===void 0?void 0:r.scale)||It,re=(1-et)*.5;for(let A=0;A=g-8)||D>=g-8&&A<8,K=A==6&&D>=8&&D<=g-8||D==6&&A>=8&&A<=g-8;let z=_||K;for(let Z=1;Z=H[Z]-2&&A<=H[Z]+2&&D>=H[Z]-2&&D<=H[Z]+2;const j=D*u+(z?0:re*u),rt=A*u+(z?0:re*u);if(y.strokeStyle=T?this.options.colorDark:this.options.colorLight,y.lineWidth=.5,y.fillStyle=T?this.options.colorDark:this.options.colorLight,H.length===0)z||y.fillRect(j,rt,(z?1:et)*u,(z?1:et)*u);else{const Z=D=g-4-5&&A=g-4-5;!z&&!Z&&y.fillRect(j,rt,(z?1:et)*u,(z?1:et)*u)}}const q=H[H.length-1],Re=this.options.colorLight;if(y.fillStyle=Re,y.fillRect(0,0,8*u,8*u),y.fillRect(0,(g-8)*u,8*u,8*u),y.fillRect((g-8)*u,0,8*u,8*u),!((i=(n=this.options.components)===null||n===void 0?void 0:n.timing)===null||i===void 0)&&i.protectors&&(y.fillRect(8*u,6*u,(g-8-8)*u,u),y.fillRect(6*u,8*u,u,(g-8-8)*u)),!((a=(s=this.options.components)===null||s===void 0?void 0:s.cornerAlignment)===null||a===void 0)&&a.protectors&&L._drawAlignProtector(y,q,q,u),!((c=(l=this.options.components)===null||l===void 0?void 0:l.alignment)===null||c===void 0)&&c.protectors)for(let A=0;A=1)&&(D=.2),T<0&&(T=0),_<0&&(_=0);const K=N*D,z=.5*(C-K),j=z;y.restore(),y.fillStyle=this.options.logoBackgroundColor,y.save(),L._prepareRoundedCornerClip(y,z-T,j-T,K+2*T,K+2*T,_+T),y.clip();const rt=y.globalCompositeOperation;y.globalCompositeOperation="destination-out",y.fill(),y.globalCompositeOperation=rt,y.restore(),y.save(),L._prepareRoundedCornerClip(y,z,j,K,K,_),y.clip(),y.drawImage(A,z,j,K,K),y.restore(),y.save(),y.translate(b,b)}if(tt){let A,D,T,_,K,z;if(ft.forEach(function(j){A||(A=new R(w,w),A.setDelay(j.delay),A.setRepeat(0));const{width:rt,height:Z}=j.dims;D||(D=new lt(rt,Z),T=D.getContext("2d"),T.rect(0,0,D.width,D.height),T.fillStyle="#ffffff",T.fill()),(!_||!z||rt!==_.width||Z!==_.height)&&(_=new lt(rt,Z),K=_.getContext("2d"),z=K.createImageData(rt,Z)),z.data.set(j.patch),K.putImageData(z,0,0),T.drawImage(_.getContext("2d").canvas,j.dims.left,j.dims.top);const Bt=new lt(C,C),Ct=Bt.getContext("2d");Ct.drawImage(D.getContext("2d").canvas,0,0,C,C),Ct.rect(0,0,C,C),Ct.fillStyle=F,Ct.fill(),Ct.drawImage(O.getContext("2d").canvas,0,0,C,C);const $t=new lt(w,w),se=$t.getContext("2d");se.drawImage(Bt.getContext("2d").canvas,0,0,w,w),A.addFrame(se.getImageData(0,0,$t.width,$t.height).data)}),!A)throw new Error("No frames.");if(A.finish(),we(this.canvas)){const rt=A.stream().toFlattenUint8Array().reduce((Z,Bt)=>Z+String.fromCharCode(Bt),"");return Promise.resolve(`data:image/gif;base64,${window.btoa(rt)}`)}return Promise.resolve(Buffer.from(A.stream().toFlattenUint8Array()))}else{G.drawImage(O.getContext("2d").canvas,0,0,C,C),y.drawImage(gt.getContext("2d").canvas,-b,-b,C,C);const A=new lt(w,w);A.getContext("2d").drawImage(O.getContext("2d").canvas,0,0,w,w),this.canvas=A;const T=this.options.gifBackground?"gif":"png";return we(this.canvas)?Promise.resolve(this.canvas.toDataURL(T)):Promise.resolve(this.canvas.toBuffer(T))}})}}L.CorrectLevel=V;L.defaultComponentOptions={data:{scale:.4},timing:{scale:.5,protectors:!1},alignment:{scale:.5,protectors:!1},cornerAlignment:{scale:.5,protectors:!0}};L.defaultOptions={text:"",size:400,margin:20,colorDark:"#000000",colorLight:"rgba(255, 255, 255, 0.6)",correctLevel:V.M,backgroundImage:void 0,backgroundDimming:"rgba(0,0,0,0)",logoImage:void 0,logoScale:.2,logoMargin:4,logoCornerRadius:8,whiteMargin:!0,components:L.defaultComponentOptions,autoColor:!0,logoBackgroundColor:"#ffffff",backgroundColor:"#ffffff"};function we(o){try{return o instanceof HTMLElement}catch{return typeof o=="object"&&o.nodeType===1&&typeof o.style=="object"&&typeof o.ownerDocument=="object"}}const un={props:{text:{type:String,required:!0},qid:{type:String},correctLevel:{type:Number,default:1},size:{type:Number,default:200},margin:{type:Number,default:20},colorDark:{type:String,default:"#000000"},colorLight:{type:String,default:"#FFFFFF"},bgSrc:{type:String,default:void 0},background:{type:String,default:"rgba(0,0,0,0)"},backgroundDimming:{type:String,default:"rgba(0,0,0,0)"},logoSrc:{type:String,default:void 0},logoBackgroundColor:{type:String,default:"rgba(255,255,255,1)"},gifBgSrc:{type:String,default:void 0},logoScale:{type:Number,default:.2},logoMargin:{type:Number,default:0},logoCornerRadius:{type:Number,default:8},whiteMargin:{type:[Boolean,String],default:!0},dotScale:{type:Number,default:1},autoColor:{type:[Boolean,String],default:!0},binarize:{type:[Boolean,String],default:!1},binarizeThreshold:{type:Number,default:128},callback:{type:Function,default:function(){}},bindElement:{type:Boolean,default:!0},backgroundColor:{type:String,default:"#FFFFFF"},components:{default:function(){return{data:{scale:1},timing:{scale:1,protectors:!1},alignment:{scale:1,protectors:!1},cornerAlignment:{scale:1,protectors:!0}}}}},name:"vue-qr",data(){return{imgUrl:""}},watch:{$props:{deep:!0,handler(){this.main()}}},mounted(){this.main()},methods:{async main(){if(this.gifBgSrc){const e=await lr(this.gifBgSrc),r=this.logoSrc;this.render(void 0,r,e);return}const o=this.bgSrc,t=this.logoSrc;this.render(o,t)},async render(o,t,e){const r=this;new L({gifBackground:e,text:r.text,size:r.size,margin:r.margin,colorDark:r.colorDark,colorLight:r.colorLight,backgroundColor:r.backgroundColor,backgroundImage:o,backgroundDimming:r.backgroundDimming,logoImage:t,logoScale:r.logoScale,logoBackgroundColor:r.logoBackgroundColor,correctLevel:r.correctLevel,logoMargin:r.logoMargin,logoCornerRadius:r.logoCornerRadius,whiteMargin:Ht(r.whiteMargin),dotScale:r.dotScale,autoColor:Ht(r.autoColor),binarize:Ht(r.binarize),binarizeThreshold:r.binarizeThreshold,components:r.components}).draw().then(n=>{this.imgUrl=n,r.callback&&r.callback(n,r.qid)})}}},fn=["src"];function hn(o,t,e,r,n,i){return e.bindElement?(nt(),pt("img",{key:0,style:{display:"inline-block"},src:n.imgUrl},null,8,fn)):Pt("",!0)}const wn=Qe(un,[["render",hn]]);export{mn as E,vn as a,wn as v};