var e=256,t=285,n=178,r=77,i=n+r,a=new Uint8Array(e*2),o=new Uint8Array(e);(function(){let e=1;for(let n=0;n<255;n++)a[n]=e,o[e]=n,e<<=1,e&256&&(e^=t);for(let e=255;e<512;e++)a[e]=a[e-255]})();function s(e,t){return e===0||t===0?0:a[o[e]+o[t]]}function c(e,t){if(t===0)throw Error(`rs: divide by zero`);return e===0?0:a[(o[e]+255-o[t])%255]}function l(e,t){return e===0?0:a[o[e]*t%255]}function u(e){if(e===0)throw Error(`rs: inverse of zero`);return a[(255-o[e])%255]}function d(e,t){let n=new Uint8Array(e.length);for(let r=0;rn.length){let e=d(r,t);r=d(n,u(t)),n=e}n=f(n,d(r,t))}}let i=0;for(;it?null:n}function x(e,t){let n=e.length-1,r=[];for(let n=0;n<255;n++)if(m(e,l(2,n))===0){let e=(n-1+255)%255;ee.length-1-t),i=(()=>{let e=new Uint8Array([1]);for(let t of r)e=p(e,f(new Uint8Array([1]),new Uint8Array([l(2,t),0])));return e})(),a=new Uint8Array(t.length-1);for(let e=0;e{let e=new Uint8Array(n);return e.set(s),e})(),r);o.set(c,t*i)}return o}function T(e,t,a){if(t===0)return new Uint8Array;if(e.length%i!==0)throw Error(`rs: received length ${e.length} not a multiple of ${i}`);let o=e.length/i,s=new Uint8Array(o*n);for(let t=0;t128?k(e):0;if(t-729-r-i>=n)return e}return 600}function k(e){return Math.floor((e-4)/32)*(e-4)*2}function A(e,t,n,r,i){for(let a=0;a=0&&i=0&&o=r-2||t<2||t>=r-2?!0:e>=n-13&&e<=n+13&&t>=n-13&&t<=n+13||r>128&&(e>=2&&e=2&&t65535)throw Error(`Mayan payload too large: ${e.length} bytes (max ${D})`);let n=O(e.length),r=Math.floor(n/2),i=new Uint8Array(4);i[0]=77,i[1]=1,i[2]=e.length&255,i[3]=e.length>>8&255;let a=new Uint8Array(i.length+e.length);a.set(i),a.set(e,i.length);let o=w(a),s=[];for(let e of o)for(let t=7;t>=0;t--)s.push((e>>t&1)==1);let c=Array.from({length:n},()=>Array(n).fill(!1));if(n>128)for(let e=2;e65535)return null;let o=4+a,s=Math.ceil(o/178)*255*8,c=U(e,n,t,s);if(c.lengthArray(n).fill(!1)),a=new Float64Array((n+1)*(r+1));for(let e=0;e=t)break;let a=i;for(;i=2&&u>=2&&Math.abs(o-u)<=o*.5&&c>o*1.5){let e=Math.floor((a+i)/2),t=i-a;r.push({cx:e,cy:n,size:t})}}}if(r.length<3)return null;let o=r.reduce((e,t)=>e.size>t.size?e:t),s=o.cy;for(;s>0&&e[s][o.cx];)s--;let c=o.cy;for(;c0&&e[c][o.cx-1]||o.cx=n);a++)if(e[r][a]&&(a===0||!e[r][a-1])){let o=0,s=a;for(;s1&&oe+t,0)/i.length/3}function V(e,t,n){let r=[{angle:0,dr:-10,dc:10},{angle:90,dr:10,dc:10},{angle:180,dr:10,dc:-10},{angle:270,dr:-10,dc:-10}],i=0,a=-1;for(let{angle:o,dr:s,dc:c}of r){let r=Math.round(t.cy+s*n),l=Math.round(t.cx+c*n),u=0;for(let t=-1;t<=1;t++)for(let i=-1;i<=1;i++){let a=r+Math.round(t*n),o=l+Math.round(i*n);a>=0&&a=0&&oa&&(a=u,i=o)}return i}function H(e,t,n,r,i){let a=Math.floor(r/2),o=Array.from({length:r},()=>Array(r).fill(!1));for(let s=0;s=0&&d=0&&u