var F={},bt=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then},ft={},v={};let Z;const Rt=[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];v.getSymbolSize=function(t){if(!t)throw new Error('"version" cannot be null or undefined');if(t<1||t>40)throw new Error('"version" should be in range from 1 to 40');return t*4+17},v.getSymbolTotalCodewords=function(t){return Rt[t]},v.getBCHDigit=function(t){let n=0;for(;t!==0;)n++,t>>>=1;return n},v.setToSJISFunction=function(t){if(typeof t!="function")throw new Error('"toSJISFunc" is not a valid function.');Z=t},v.isKanjiModeEnabled=function(){return typeof Z<"u"},v.toSJIS=function(t){return Z(t)};var K={};(function(t){t.L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2};function n(o){if(typeof o!="string")throw new Error("Param is not a string");switch(o.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: "+o)}}t.isValid=function(o){return o&&typeof o.bit<"u"&&o.bit>=0&&o.bit<4},t.from=function(o,e){if(t.isValid(o))return o;try{return n(o)}catch{return e}}})(K);function ht(){this.buffer=[],this.length=0}ht.prototype={get:function(t){const n=Math.floor(t/8);return(this.buffer[n]>>>7-t%8&1)===1},put:function(t,n){for(let o=0;o>>n-o-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){const n=Math.floor(this.length/8);this.buffer.length<=n&&this.buffer.push(0),t&&(this.buffer[n]|=128>>>this.length%8),this.length++}};var Lt=ht;function z(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)}z.prototype.set=function(t,n,o,e){const r=t*this.size+n;this.data[r]=o,e&&(this.reservedBit[r]=!0)},z.prototype.get=function(t,n){return this.data[t*this.size+n]},z.prototype.xor=function(t,n,o){this.data[t*this.size+n]^=o},z.prototype.isReserved=function(t,n){return this.reservedBit[t*this.size+n]};var Ut=z,gt={};(function(t){const n=v.getSymbolSize;t.getRowColCoords=function(o){if(o===1)return[];const e=Math.floor(o/7)+2,r=n(o),i=r===145?26:Math.ceil((r-13)/(2*e-2))*2,s=[r-7];for(let a=1;a=0&&e<=7},t.from=function(e){return t.isValid(e)?parseInt(e,10):void 0},t.getPenaltyN1=function(e){const r=e.size;let i=0,s=0,a=0,u=null,l=null;for(let h=0;h=5&&(i+=n.N1+(s-5)),u=c,s=1),c=e.get(A,h),c===l?a++:(a>=5&&(i+=n.N1+(a-5)),l=c,a=1)}s>=5&&(i+=n.N1+(s-5)),a>=5&&(i+=n.N1+(a-5))}return i},t.getPenaltyN2=function(e){const r=e.size;let i=0;for(let s=0;s=10&&(s===1488||s===93)&&i++,a=a<<1&2047|e.get(l,u),l>=10&&(a===1488||a===93)&&i++}return i*n.N3},t.getPenaltyN4=function(e){let r=0;const i=e.data.length;for(let s=0;s=0;){const i=r[0];for(let a=0;a0){const r=new Uint8Array(this.degree);return r.set(o,e),r}return o};var St=X,Et={},R={},W={};W.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40};var T={};const At="[0-9]+",kt="[A-Z $%*+\\-./:]+";let H="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";H=H.replace(/u/g,"\\u");const Ft="(?:(?![A-Z0-9 $%*+\\-./:]|"+H+`)(?:.|[\r ]))+`;T.KANJI=new RegExp(H,"g"),T.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),T.BYTE=new RegExp(Ft,"g"),T.NUMERIC=new RegExp(At,"g"),T.ALPHANUMERIC=new RegExp(kt,"g");const zt=new RegExp("^"+H+"$"),Dt=new RegExp("^"+At+"$"),Ht=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");T.testKanji=function(t){return zt.test(t)},T.testNumeric=function(t){return Dt.test(t)},T.testAlphanumeric=function(t){return Ht.test(t)},function(t){const n=W,o=T;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(r,i){if(!r.ccBits)throw new Error("Invalid mode: "+r);if(!n.isValid(i))throw new Error("Invalid version: "+i);return i>=1&&i<10?r.ccBits[0]:i<27?r.ccBits[1]:r.ccBits[2]},t.getBestModeForData=function(r){return o.testNumeric(r)?t.NUMERIC:o.testAlphanumeric(r)?t.ALPHANUMERIC:o.testKanji(r)?t.KANJI:t.BYTE},t.toString=function(r){if(r&&r.id)return r.id;throw new Error("Invalid mode")},t.isValid=function(r){return r&&r.bit&&r.ccBits};function e(r){if(typeof r!="string")throw new Error("Param is not a string");switch(r.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: "+r)}}t.from=function(r,i){if(t.isValid(r))return r;try{return e(r)}catch{return i}}}(R),function(t){const n=v,o=Y,e=K,r=R,i=W,s=1<<12|1<<11|1<<10|1<<9|1<<8|1<<5|1<<2|1<<0,a=n.getBCHDigit(s);function u(c,m,p){for(let C=1;C<=40;C++)if(m<=t.getCapacity(C,p,c))return C}function l(c,m){return r.getCharCountIndicator(c,m)+4}function h(c,m){let p=0;return c.forEach(function(C){const B=l(C.mode,m);p+=B+C.getBitsLength()}),p}function A(c,m){for(let p=1;p<=40;p++)if(h(c,p)<=t.getCapacity(p,m,r.MIXED))return p}t.from=function(c,m){return i.isValid(c)?parseInt(c,10):m},t.getCapacity=function(c,m,p){if(!i.isValid(c))throw new Error("Invalid QR Code version");typeof p>"u"&&(p=r.BYTE);const C=n.getSymbolTotalCodewords(c),B=o.getTotalCodewordsCount(c,m),f=(C-B)*8;if(p===r.MIXED)return f;const w=f-l(p,c);switch(p){case r.NUMERIC:return Math.floor(w/10*3);case r.ALPHANUMERIC:return Math.floor(w/11*2);case r.KANJI:return Math.floor(w/13);case r.BYTE:default:return Math.floor(w/8)}},t.getBestVersionForData=function(c,m){let p;const C=e.from(m,e.M);if(Array.isArray(c)){if(c.length>1)return A(c,C);if(c.length===0)return 1;p=c[0]}else p=c;return u(p.mode,p.getLength(),C)},t.getEncodedBits=function(c){if(!i.isValid(c)||c<7)throw new Error("Invalid QR Code version");let m=c<<12;for(;n.getBCHDigit(m)-a>=0;)m^=s<=0;)e^=Bt<0&&(o=this.data.substr(n),e=parseInt(o,10),t.put(e,r*3+1))};var Yt=L;const _t=R,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=_t.ALPHANUMERIC,this.data=t}U.getBitsLength=function(t){return 11*Math.floor(t/2)+6*(t%2)},U.prototype.getLength=function(){return this.data.length},U.prototype.getBitsLength=function(){return U.getBitsLength(this.data.length)},U.prototype.write=function(t){let n;for(n=0;n+2<=this.data.length;n+=2){let o=tt.indexOf(this.data[n])*45;o+=tt.indexOf(this.data[n+1]),t.put(o,11)}this.data.length%2&&t.put(tt.indexOf(this.data[n]),6)};var Vt=U,jt=function(t){for(var n=[],o=t.length,e=0;e=55296&&r<=56319&&o>e+1){var i=t.charCodeAt(e+1);i>=56320&&i<=57343&&(r=(r-55296)*1024+i-56320+65536,e+=1)}if(r<128){n.push(r);continue}if(r<2048){n.push(r>>6|192),n.push(r&63|128);continue}if(r<55296||r>=57344&&r<65536){n.push(r>>12|224),n.push(r>>6&63|128),n.push(r&63|128);continue}if(r>=65536&&r<=1114111){n.push(r>>18|240),n.push(r>>12&63|128),n.push(r>>6&63|128),n.push(r&63|128);continue}n.push(239,191,189)}return new Uint8Array(n).buffer};const Ot=jt,qt=R;function x(t){this.mode=qt.BYTE,typeof t=="string"&&(t=Ot(t)),this.data=new Uint8Array(t)}x.getBitsLength=function(t){return t*8},x.prototype.getLength=function(){return this.data.length},x.prototype.getBitsLength=function(){return x.getBitsLength(this.data.length)},x.prototype.write=function(t){for(let n=0,o=this.data.length;n=33088&&o<=40956)o-=33088;else if(o>=57408&&o<=60351)o-=49472;else throw new Error("Invalid SJIS character: "+this.data[n]+` Make sure your charset is UTF-8`);o=(o>>>8&255)*192+(o&255),t.put(o,13)}};var Xt=S,et={},Wt={get exports(){return et},set exports(t){et=t}};(function(t){var n={single_source_shortest_paths:function(o,e,r){var i={},s={};s[e]=0;var a=n.PriorityQueue.make();a.push(e,0);for(var u,l,h,A,c,m,p,C,B;!a.empty();){u=a.pop(),l=u.value,A=u.cost,c=o[l]||{};for(h in c)c.hasOwnProperty(h)&&(m=c[h],p=A+m,C=s[h],B=typeof s[h]>"u",(B||C>p)&&(s[h]=p,a.push(h,p),i[h]=l))}if(typeof r<"u"&&typeof s[r]>"u"){var f=["Could not find a path from ",e," to ",r,"."].join("");throw new Error(f)}return i},extract_shortest_path_from_predecessor_list:function(o,e){for(var r=[],i=e;i;)r.push(i),o[i],i=o[i];return r.reverse(),r},find_path:function(o,e,r){var i=n.single_source_shortest_paths(o,e,r);return n.extract_shortest_path_from_predecessor_list(i,r)},PriorityQueue:{make:function(o){var e=n.PriorityQueue,r={},i;o=o||{};for(i in e)e.hasOwnProperty(i)&&(r[i]=e[i]);return r.queue=[],r.sorter=o.sorter||e.default_sorter,r},default_sorter:function(o,e){return o.cost-e.cost},push:function(o,e){var r={value:o,cost:e};this.queue.push(r),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};t.exports=n})(Wt),function(t){const n=R,o=Yt,e=Vt,r=Qt,i=Xt,s=T,a=v,u=et;function l(f){return unescape(encodeURIComponent(f)).length}function h(f,w,g){const d=[];let y;for(;(y=f.exec(g))!==null;)d.push({data:y[0],index:y.index,mode:w,length:y[0].length});return d}function A(f){const w=h(s.NUMERIC,n.NUMERIC,f),g=h(s.ALPHANUMERIC,n.ALPHANUMERIC,f);let d,y;return a.isKanjiModeEnabled()?(d=h(s.BYTE,n.BYTE,f),y=h(s.KANJI,n.KANJI,f)):(d=h(s.BYTE_KANJI,n.BYTE,f),y=[]),w.concat(g,d,y).sort(function(E,N){return E.index-N.index}).map(function(E){return{data:E.data,mode:E.mode,length:E.length}})}function c(f,w){switch(w){case n.NUMERIC:return o.getBitsLength(f);case n.ALPHANUMERIC:return e.getBitsLength(f);case n.KANJI:return i.getBitsLength(f);case n.BYTE:return r.getBitsLength(f)}}function m(f){return f.reduce(function(w,g){const d=w.length-1>=0?w[w.length-1]:null;return d&&d.mode===g.mode?(w[w.length-1].data+=g.data,w):(w.push(g),w)},[])}function p(f){const w=[];for(let g=0;g=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(i+a,s+u,!0,!0):t.set(i+a,s+u,!1,!0))}}function ae(t){const n=t.size;for(let o=8;o>a&1)===1,t.set(r,i,s,!0),t.set(i,r,s,!0)}function st(t,n,o){const e=t.size,r=oe.getEncodedBits(n,o);let i,s;for(i=0;i<15;i++)s=(r>>i&1)===1,i<6?t.set(i,8,s,!0):i<8?t.set(i+1,8,s,!0):t.set(e-15+i,8,s,!0),i<8?t.set(8,e-i-1,s,!0):i<9?t.set(8,15-i-1+1,s,!0):t.set(8,15-i-1,s,!0);t.set(e-8,8,1,!0)}function le(t,n){const o=t.size;let e=-1,r=o-1,i=7,s=0;for(let a=o-1;a>0;a-=2)for(a===6&&a--;;){for(let u=0;u<2;u++)if(!t.isReserved(r,a-u)){let l=!1;s>>i&1)===1),t.set(r,a-u,l),i--,i===-1&&(s++,i=7)}if(r+=e,r<0||o<=r){r-=e,e=-e;break}}}function fe(t,n,o){const e=new Gt;o.forEach(function(u){e.put(u.mode.bit,4),e.put(u.getLength(),ie.getCharCountIndicator(u.mode,t)),u.write(e)});const r=q.getSymbolTotalCodewords(t),i=ot.getTotalCodewordsCount(t,n),s=(r-i)*8;for(e.getLengthInBits()+4<=s&&e.put(0,4);e.getLengthInBits()%8!==0;)e.putBit(0);const a=(s-e.getLengthInBits())/8;for(let u=0;u=7&&ce(u,n),le(u,s),isNaN(e)&&(e=rt.getBestMask(u,st.bind(null,u,o))),rt.applyMask(e,u),st(u,o,e),{modules:u,version:n,errorCorrectionLevel:o,maskPattern:e,segments:r}}ft.create=function(t,n){if(typeof t>"u"||t==="")throw new Error("No input text");let o=nt.M,e,r;return typeof n<"u"&&(o=nt.from(n.errorCorrectionLevel,nt.M),e=Q.from(n.version),r=rt.from(n.maskPattern),n.toSJISFunc&&q.setToSJISFunction(n.toSJISFunc)),ge(t,e,o,r)};var It={},at={};(function(t){function n(o){if(typeof o=="number"&&(o=o.toString()),typeof o!="string")throw new Error("Color should be defined as hex string");let e=o.slice().replace("#","").split("");if(e.length<3||e.length===5||e.length>8)throw new Error("Invalid hex color: "+o);(e.length===3||e.length===4)&&(e=Array.prototype.concat.apply([],e.map(function(i){return[i,i]}))),e.length===6&&e.push("F","F");const r=parseInt(e.join(""),16);return{r:r>>24&255,g:r>>16&255,b:r>>8&255,a:r&255,hex:"#"+e.slice(0,6).join("")}}t.getOptions=function(o){o||(o={}),o.color||(o.color={});const e=typeof o.margin>"u"||o.margin===null||o.margin<0?4:o.margin,r=o.width&&o.width>=21?o.width:void 0,i=o.scale||4;return{width:r,scale:r?4:i,margin:e,color:{dark:n(o.color.dark||"#000000ff"),light:n(o.color.light||"#ffffffff")},type:o.type,rendererOpts:o.rendererOpts||{}}},t.getScale=function(o,e){return e.width&&e.width>=o+e.margin*2?e.width/(o+e.margin*2):e.scale},t.getImageWidth=function(o,e){const r=t.getScale(o,e);return Math.floor((o+e.margin*2)*r)},t.qrToImageData=function(o,e,r){const i=e.modules.size,s=e.modules.data,a=t.getScale(i,r),u=Math.floor((i+r.margin*2)*a),l=r.margin*a,h=[r.color.light,r.color.dark];for(let A=0;A=l&&c>=l&&A"u"&&(!i||!i.getContext)&&(a=i,i=void 0),i||(u=e()),a=n.getOptions(a);const l=n.getImageWidth(r.modules.size,a),h=u.getContext("2d"),A=h.createImageData(l,l);return n.qrToImageData(A.data,r,a),o(h,u,l),h.putImageData(A,0,0),u},t.renderToDataURL=function(r,i,s){let a=s;typeof a>"u"&&(!i||!i.getContext)&&(a=i,i=void 0),a||(a={});const u=t.render(r,i,a),l=a.type||"image/png",h=a.rendererOpts||{};return u.toDataURL(l,h.quality)}}(It);var Mt={};const de=at;function Tt(t,n){const o=t.a/255,e=n+'="'+t.hex+'"';return o<1?e+" "+n+'-opacity="'+o.toFixed(2).slice(1)+'"':e}function ut(t,n,o){let e=t+n;return typeof o<"u"&&(e+=" "+o),e}function pe(t,n,o){let e="",r=0,i=!1,s=0;for(let a=0;a0&&u>0&&t[a-1]||(e+=i?ut("M",u+o,.5+l+o):ut("m",r,0),r=0,i=!1),u+1':"",u="',l='viewBox="0 0 '+s+" "+s+'"',h=''+a+u+` `;return typeof o=="function"&&o(null,h),h};const we=bt,ct=ft,Pt=It,me=Mt;function lt(t,n,o,e,r){const i=[].slice.call(arguments,1),s=i.length,a=typeof i[s-1]=="function";if(!a&&!we())throw new Error("Callback required as last argument");if(a){if(s<2)throw new Error("Too few arguments provided");s===2?(r=o,o=n,n=e=void 0):s===3&&(n.getContext&&typeof r>"u"?(r=e,e=void 0):(r=e,e=o,o=n,n=void 0))}else{if(s<1)throw new Error("Too few arguments provided");return s===1?(o=n,n=e=void 0):s===2&&!n.getContext&&(e=o,o=n,n=void 0),new Promise(function(u,l){try{const h=ct.create(o,e);u(t(h,n,e))}catch(h){l(h)}})}try{const u=ct.create(o,e);r(null,t(u,n,e))}catch(u){r(u)}}F.create=ct.create,F.toCanvas=lt.bind(null,Pt.render),F.toDataURL=lt.bind(null,Pt.renderToDataURL),F.toString=lt.bind(null,function(t,n,o){return me.render(t,o)});export{F as b};