12345678 |
- 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++)this.putBit((t>>>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<e-1;a++)s[a]=s[a-1]-i;return s.push(6),s.reverse()},t.getPositions=function(o){const e=[],r=t.getRowColCoords(o),i=r.length;for(let s=0;s<i;s++)for(let a=0;a<i;a++)s===0&&a===0||s===0&&a===i-1||s===i-1&&a===0||e.push([r[s],r[a]]);return e}})(gt);var dt={};const xt=v.getSymbolSize,pt=7;dt.getPositions=function(t){const n=xt(t);return[[0,0],[n-pt,0],[0,n-pt]]};var wt={};(function(t){t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const n={N1:3,N2:3,N3:40,N4:10};t.isValid=function(e){return e!=null&&e!==""&&!isNaN(e)&&e>=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<r;h++){s=a=0,u=l=null;for(let A=0;A<r;A++){let c=e.get(h,A);c===u?s++:(s>=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<r-1;s++)for(let a=0;a<r-1;a++){const u=e.get(s,a)+e.get(s,a+1)+e.get(s+1,a)+e.get(s+1,a+1);(u===4||u===0)&&i++}return i*n.N2},t.getPenaltyN3=function(e){const r=e.size;let i=0,s=0,a=0;for(let u=0;u<r;u++){s=a=0;for(let l=0;l<r;l++)s=s<<1&2047|e.get(u,l),l>=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<i;s++)r+=e.data[s];return Math.abs(Math.ceil(r*100/i/5)-10)*n.N4};function o(e,r,i){switch(e){case t.Patterns.PATTERN000:return(r+i)%2===0;case t.Patterns.PATTERN001:return r%2===0;case t.Patterns.PATTERN010:return i%3===0;case t.Patterns.PATTERN011:return(r+i)%3===0;case t.Patterns.PATTERN100:return(Math.floor(r/2)+Math.floor(i/3))%2===0;case t.Patterns.PATTERN101:return r*i%2+r*i%3===0;case t.Patterns.PATTERN110:return(r*i%2+r*i%3)%2===0;case t.Patterns.PATTERN111:return(r*i%3+(r+i)%2)%2===0;default:throw new Error("bad maskPattern:"+e)}}t.applyMask=function(e,r){const i=r.size;for(let s=0;s<i;s++)for(let a=0;a<i;a++)r.isReserved(a,s)||r.xor(a,s,o(e,a,s))},t.getBestMask=function(e,r){const i=Object.keys(t.Patterns).length;let s=0,a=1/0;for(let u=0;u<i;u++){r(u),t.applyMask(u,e);const l=t.getPenaltyN1(e)+t.getPenaltyN2(e)+t.getPenaltyN3(e)+t.getPenaltyN4(e);t.applyMask(u,e),l<a&&(a=l,s=u)}return s}})(wt);var Y={};const b=K,_=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],V=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];Y.getBlocksCount=function(t,n){switch(n){case b.L:return _[(t-1)*4+0];case b.M:return _[(t-1)*4+1];case b.Q:return _[(t-1)*4+2];case b.H:return _[(t-1)*4+3];default:return}},Y.getTotalCodewordsCount=function(t,n){switch(n){case b.L:return V[(t-1)*4+0];case b.M:return V[(t-1)*4+1];case b.Q:return V[(t-1)*4+2];case b.H:return V[(t-1)*4+3];default:return}};var mt={},j={};const D=new Uint8Array(512),O=new Uint8Array(256);(function(){let t=1;for(let n=0;n<255;n++)D[n]=t,O[t]=n,t<<=1,t&256&&(t^=285);for(let n=255;n<512;n++)D[n]=D[n-255]})(),j.log=function(t){if(t<1)throw new Error("log("+t+")");return O[t]},j.exp=function(t){return D[t]},j.mul=function(t,n){return t===0||n===0?0:D[O[t]+O[n]]},function(t){const n=j;t.mul=function(o,e){const r=new Uint8Array(o.length+e.length-1);for(let i=0;i<o.length;i++)for(let s=0;s<e.length;s++)r[i+s]^=n.mul(o[i],e[s]);return r},t.mod=function(o,e){let r=new Uint8Array(o);for(;r.length-e.length>=0;){const i=r[0];for(let a=0;a<e.length;a++)r[a]^=n.mul(e[a],i);let s=0;for(;s<r.length&&r[s]===0;)s++;r=r.slice(s)}return r},t.generateECPolynomial=function(o){let e=new Uint8Array([1]);for(let r=0;r<o;r++)e=t.mul(e,new Uint8Array([1,n.exp(r)]));return e}}(mt);const yt=mt;function X(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}X.prototype.initialize=function(t){this.degree=t,this.genPoly=yt.generateECPolynomial(this.degree)},X.prototype.encode=function(t){if(!this.genPoly)throw new Error("Encoder not initialized");const n=new Uint8Array(t.length+this.degree);n.set(t);const o=yt.mod(n,this.genPoly),e=this.degree-o.length;if(e>0){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<<n.getBCHDigit(m)-a;return c<<12|m}}(Et);var Ct={};const G=v,Bt=1<<10|1<<8|1<<5|1<<4|1<<2|1<<1|1<<0,Jt=1<<14|1<<12|1<<10|1<<4|1<<1,Nt=G.getBCHDigit(Bt);Ct.getEncodedBits=function(t,n){const o=t.bit<<3|n;let e=o<<10;for(;G.getBCHDigit(e)-Nt>=0;)e^=Bt<<G.getBCHDigit(e)-Nt;return(o<<10|e)^Jt};var vt={};const Kt=R;function L(t){this.mode=Kt.NUMERIC,this.data=t.toString()}L.getBitsLength=function(t){return 10*Math.floor(t/3)+(t%3?t%3*3+1:0)},L.prototype.getLength=function(){return this.data.length},L.prototype.getBitsLength=function(){return L.getBitsLength(this.data.length)},L.prototype.write=function(t){let n,o,e;for(n=0;n+3<=this.data.length;n+=3)o=this.data.substr(n,3),e=parseInt(o,10),t.put(e,10);const r=this.data.length-n;r>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<o;e++){var r=t.charCodeAt(e);if(r>=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<o;n++)t.put(this.data[n],8)};var Qt=x;const $t=R,Zt=v;function S(t){this.mode=$t.KANJI,this.data=t}S.getBitsLength=function(t){return t*13},S.prototype.getLength=function(){return this.data.length},S.prototype.getBitsLength=function(){return S.getBitsLength(this.data.length)},S.prototype.write=function(t){let n;for(n=0;n<this.data.length;n++){let o=Zt.toSJIS(this.data[n]);if(o>=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<f.length;g++){const d=f[g];switch(d.mode){case n.NUMERIC:w.push([d,{data:d.data,mode:n.ALPHANUMERIC,length:d.length},{data:d.data,mode:n.BYTE,length:d.length}]);break;case n.ALPHANUMERIC:w.push([d,{data:d.data,mode:n.BYTE,length:d.length}]);break;case n.KANJI:w.push([d,{data:d.data,mode:n.BYTE,length:l(d.data)}]);break;case n.BYTE:w.push([{data:d.data,mode:n.BYTE,length:l(d.data)}])}}return w}function C(f,w){const g={},d={start:{}};let y=["start"];for(let E=0;E<f.length;E++){const N=f[E],I=[];for(let J=0;J<N.length;J++){const M=N[J],k=""+E+J;I.push(k),g[k]={node:M,lastCount:0},d[k]={};for(let $=0;$<y.length;$++){const P=y[$];g[P]&&g[P].node.mode===M.mode?(d[P][k]=c(g[P].lastCount+M.length,M.mode)-c(g[P].lastCount,M.mode),g[P].lastCount+=M.length):(g[P]&&(g[P].lastCount=M.length),d[P][k]=c(M.length,M.mode)+4+n.getCharCountIndicator(M.mode,w))}}y=I}for(let E=0;E<y.length;E++)d[y[E]].end=0;return{map:d,table:g}}function B(f,w){let g;const d=n.getBestModeForData(f);if(g=n.from(w,d),g!==n.BYTE&&g.bit<d.bit)throw new Error('"'+f+'" cannot be encoded with mode '+n.toString(g)+`.
- Suggested mode is: `+n.toString(d));switch(g===n.KANJI&&!a.isKanjiModeEnabled()&&(g=n.BYTE),g){case n.NUMERIC:return new o(f);case n.ALPHANUMERIC:return new e(f);case n.KANJI:return new i(f);case n.BYTE:return new r(f)}}t.fromArray=function(f){return f.reduce(function(w,g){return typeof g=="string"?w.push(B(g,null)):g.data&&w.push(B(g.data,g.mode)),w},[])},t.fromString=function(f,w){const g=A(f,a.isKanjiModeEnabled()),d=p(g),y=C(d,w),E=u.find_path(y.map,"start","end"),N=[];for(let I=1;I<E.length-1;I++)N.push(y.table[E[I]].node);return t.fromArray(m(N))},t.rawSplit=function(f){return t.fromArray(A(f,a.isKanjiModeEnabled()))}}(vt);const q=v,nt=K,Gt=Lt,te=Ut,ee=gt,ne=dt,rt=wt,ot=Y,re=St,Q=Et,oe=Ct,ie=R,it=vt;function se(t,n){const o=t.size,e=ne.getPositions(n);for(let r=0;r<e.length;r++){const i=e[r][0],s=e[r][1];for(let a=-1;a<=7;a++)if(!(i+a<=-1||o<=i+a))for(let u=-1;u<=7;u++)s+u<=-1||o<=s+u||(a>=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<n-8;o++){const e=o%2===0;t.set(o,6,e,!0),t.set(6,o,e,!0)}}function ue(t,n){const o=ee.getPositions(n);for(let e=0;e<o.length;e++){const r=o[e][0],i=o[e][1];for(let s=-2;s<=2;s++)for(let a=-2;a<=2;a++)s===-2||s===2||a===-2||a===2||s===0&&a===0?t.set(r+s,i+a,!0,!0):t.set(r+s,i+a,!1,!0)}}function ce(t,n){const o=t.size,e=Q.getEncodedBits(n);let r,i,s;for(let a=0;a<18;a++)r=Math.floor(a/3),i=a%3+o-8-3,s=(e>>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<n.length&&(l=(n[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<a;u++)e.put(u%2?17:236,8);return he(e,t,n)}function he(t,n,o){const e=q.getSymbolTotalCodewords(n),r=ot.getTotalCodewordsCount(n,o),i=e-r,s=ot.getBlocksCount(n,o),a=e%s,u=s-a,l=Math.floor(e/s),h=Math.floor(i/s),A=h+1,c=l-h,m=new re(c);let p=0;const C=new Array(s),B=new Array(s);let f=0;const w=new Uint8Array(t.buffer);for(let N=0;N<s;N++){const I=N<u?h:A;C[N]=w.slice(p,p+I),B[N]=m.encode(C[N]),p+=I,f=Math.max(f,I)}const g=new Uint8Array(e);let d=0,y,E;for(y=0;y<f;y++)for(E=0;E<s;E++)y<C[E].length&&(g[d++]=C[E][y]);for(y=0;y<c;y++)for(E=0;E<s;E++)g[d++]=B[E][y];return g}function ge(t,n,o,e){let r;if(Array.isArray(t))r=it.fromArray(t);else if(typeof t=="string"){let l=n;if(!l){const h=it.rawSplit(t);l=Q.getBestVersionForData(h,o)}r=it.fromString(t,l||40)}else throw new Error("Invalid data");const i=Q.getBestVersionForData(r,o);if(!i)throw new Error("The amount of data is too big to be stored in a QR Code");if(!n)n=i;else if(n<i)throw new Error(`
- The chosen QR Code version cannot contain this amount of data.
- Minimum version required to store current data is: `+i+`.
- `);const s=fe(n,o,r),a=q.getSymbolSize(n),u=new te(a);return se(u,n),ae(u),ue(u,n),st(u,o,0),n>=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<u;A++)for(let c=0;c<u;c++){let m=(A*u+c)*4,p=r.color.light;if(A>=l&&c>=l&&A<u-l&&c<u-l){const C=Math.floor((A-l)/a),B=Math.floor((c-l)/a);p=h[s[C*i+B]?1:0]}o[m++]=p.r,o[m++]=p.g,o[m++]=p.b,o[m]=p.a}}})(at),function(t){const n=at;function o(r,i,s){r.clearRect(0,0,i.width,i.height),i.style||(i.style={}),i.height=s,i.width=s,i.style.height=s+"px",i.style.width=s+"px"}function e(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}t.render=function(r,i,s){let a=s,u=i;typeof 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;a<t.length;a++){const u=Math.floor(a%n),l=Math.floor(a/n);!u&&!i&&(i=!0),t[a]?(s++,a>0&&u>0&&t[a-1]||(e+=i?ut("M",u+o,.5+l+o):ut("m",r,0),r=0,i=!1),u+1<n&&t[a+1]||(e+=ut("h",s),s=0)):r++}return e}Mt.render=function(t,n,o){const e=de.getOptions(n),r=t.modules.size,i=t.modules.data,s=r+e.margin*2,a=e.color.light.a?"<path "+Tt(e.color.light,"fill")+' d="M0 0h'+s+"v"+s+'H0z"/>':"",u="<path "+Tt(e.color.dark,"stroke")+' d="'+pe(i,r,e.margin)+'"/>',l='viewBox="0 0 '+s+" "+s+'"',h='<svg xmlns="http://www.w3.org/2000/svg" '+(e.width?'width="'+e.width+'" height="'+e.width+'" ':"")+l+' shape-rendering="crispEdges">'+a+u+`</svg>
- `;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};
|