// @ts-nocheck const t=[.2,3/8,5/9,2/3],o=(o,e)=>r=>{const n=4*o+r-4,s="*-04-39?2$%%$%%'$%''%'''%')(%'))%(++'(++'(+.'+-.',/3',33)-/5)-43).36)058*18<+37<+4:<,4:E,5C/8@F/:EH/8?s:1,c=e/f|0,i=e%f,l=f-i,a=n>8?c*t[r]+(o>5)&-2:s,u=c-a;return{t:8*(l*u+i*(u+1)),o:i?[[l,u],[i,u+1]]:[[l,u]],i:a}},e={min:0,L:0,M:1,Q:2,H:3,max:3},r=t=>new Uint8Array(t),n=t=>{const o=new Error(`lean-qr error ${t}`);throw o.code=t,o},s=t=>"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:".indexOf(t),f=t=>t.charCodeAt(0),c=(...t)=>(o,e)=>t.forEach((t=>t(o,e))),i=t=>o=>{o.eci!==t&&(o.push(7,4),o.push(t,8),o.eci=t)},l=t=>(o,e)=>{o.push(4,4),o.push(t.length,8+8*(e>9)),t.forEach((t=>o.push(t,8)))},a=(t,o,e,r,n=((t,o)=>e(t.length,o)),s=(r?o=>c(i(r),t(o)):t))=>(s.test=o,s.l=e,s.est=n,s.eci=r&&[r],s),u=a((t=>(o,e)=>{o.push(1,4),o.push(t.length,10+2*(e>26)+2*(e>9));let r=0;for(;r14+2*(o>26)+2*(o>9)+10*t/3)),_=a((t=>(o,e)=>{o.push(2,4),o.push(t.length,9+2*(e>26)+2*(e>9));let r=0;for(;rs(t)>=0),((t,o)=>13+2*(o>26)+2*(o>9)+5.5*t)),d=a((t=>l([...t].map(f))),(t=>f(t)<128),((t,o)=>12+8*(o>9)+8*t));d.u=!0;const m=a(d,(t=>f(t)<256),d.l,3);m.u=!0;const p=new TextEncoder,h=a((t=>l(p.encode(t))),(()=>1),0,26,((t,o)=>12+8*(o>9)+8*p.encode(t).length));h.u=!0;let w=()=>{const t=new Map,o=new TextDecoder("sjis"),e=r(2);for(let r=0;r<7973;++r)e[0]=r/192+129+64*(r>5951),e[1]=r%192+64,t.set(o.decode(e),r);return t.delete("\ufffd"),w=()=>t,t};const g=a((t=>(o,e)=>{o.push(8,4),o.push(t.length,8+2*(e>26)+2*(e>9));for(const e of t)o.push(w().get(e),13)}),(t=>w().has(t)),((t,o)=>12+2*(o>26)+2*(o>9)+13*t));g.u=!0;const y=[u,_,d,m,g,h],x={auto:(t,{modes:o=y}={})=>(e,r)=>{let s=1;for(const e of o){const o=new Map;e._=s<<=1,e.m=e.est("",r),e.h=e.l?(t,n)=>{const s=n-t,f=o.get(s)??e.l(s,r);return o.set(s,f),f}:(n,s)=>{const f=t.slice(n,s),c=o.get(f)??e.est(f,r);return o.set(f,c),c}}let f=[{S:0}],c=0,i=0,l=-1;for(const e of[...t,""]){let t=0;if(e)for(const r of o)r.test(e)&&(t|=r._);if(!e||t!==l){if(-1!==l){const t=new Set(f.map((t=>t.v))),e=[];for(const r of o.filter((t=>l&t._))){const o=r.h(c,i);for(const n of r.eci??t){if(r===d&&n)continue;let t;for(const e of f)if(e.v===n||r.eci){const s=e.C===r&&e.v===n,f=s?e.D:e,l=s?e.V:c;let a;a=r.u&&s?e.S+o-r.m:f.S+12*(f.v!==n)+(l===c?o:r.h(l,i)),(!t||ao.St(e,r)))},multi:c,eci:i,numeric:u,alphaNumeric:_,bytes:l,ascii:d,iso8859_1:m,shift_jis:g,utf8:h},z=()=>({A:r(2956),F:0,push(t,o){for(let e=o,r=8-(7&this.F);e>0;e-=r,r=8)this.A[this.F>>3]|=t<>e,this.F+=e({size:t,I:e,get:(o,r)=>o>=0&&o!(1&(t^o)),(t,o)=>!(1&o),t=>!(t%3),(t,o)=>!((t+o)%3),(t,o)=>!(1&(t/3^o>>1)),(t,o)=>!((t&o&1)+t*o%3),(t,o)=>!((t&o&1)+t*o%3&1),(t,o)=>!((1&(t^o))+t*o%3&1)],S=r(512);S[0]=1;for(let t=0,o=1;t<255;S[++t]=o)S[o+256]=t,o*=2,256&o&&(o^=285);const v=t=>S[t%255],C=t=>S[t+256],D=(t,o)=>{const e=r(t.length+o.length-1);for(let r=0;r{const e=r(t.length+o.length-1);e.set(t,0);for(let r=0;r{const e=[[],[]];let n=0,s=0;for(const[r,f]of o.o)for(let c=0;c{let r=t<>=1)r&t&&(r^=o*(t>>e-1));return r},A=({size:t,I:o,K:e},r)=>{const n=(e,r,n,s,f)=>{for(;s-- >0;){const c=(r+s)*t+e;o.fill(f,c,c+n)}},s=(t,o)=>{n(t-3,o-3,7,7,3),n(t-2,o-2,5,5,2),n(t-1,o-1,3,3,3)},f=(t,o)=>{n(t-2,o-2,5,5,3),n(t-1,o-1,3,3,2),e(t,o,3)};n(7,0,2,9,2),n(t-8,0,8,9,2);for(let o=0;o1){const o=1+(r/7|0),e=2*((t-13)/o/2+.75|0);for(let r=0;r6)for(let o=r<<12|b(r,7973,13),n=0;n<6;++n)for(let r=12;r-- >9;o>>=1)e(t-r,n,2|1&o);for(let e=0;e{const e=[];for(let r=t-2,n=t,s=-1;r>=0;r-=2){for(5===r&&(r=4);n+=s,-1!==n&&n!==t;){const s=n*t+r;o[s+1]<2&&e.push(s+1),o[s]<2&&e.push(s)}s*=-1}return e},H=({I:t},o,e)=>o.forEach(((o,r)=>t[o]=e[r>>3]>>7-(7&r)&1)),I=({size:t,I:o,K:e},r,n,s)=>{for(let e=0;e>1^1)}const f=(1^s)<<3|n;let c=21522^(f<<10|b(f,1335,11));for(let o=8;o-- >0;c>>=1)e(8,(o>1?7:8)-o,c),e(t-8+o,8,c);for(let o=7;o-- >0;c>>=1)e(o>5?7:o,8,c),e(8,t-o-1,c)},K=({size:t,I:o},e=0,r=0)=>{for(let n=0;n>1|2098176)&(3047517^a-1),2049&i&&(e+=40),a!==f?(l=1,f=a):++l>4&&(e+=l<6?3:1)}if(n)for(let r=1,s=1&o[n-1],f=(1&o[n])===s;r{s>3);if(c(r).t=r;--t){const o=c(t);if(o.t{const n=E(e.size,e.I);return I(n,o,i??r,t),n.s=K(n),n})).reduce(((t,o)=>o.s(o,e)=>P(o,{modes:[...y,...t],...e});export{e as correction,P as generate,x as mode};