-
Notifications
You must be signed in to change notification settings - Fork 103
/
Copy pathqrcode.js.map
executable file
·1 lines (1 loc) · 143 KB
/
qrcode.js.map
1
{"version":3,"sources":["grid.js","version.js","detector.js","formatinf.js","errorlevel.js","bitmat.js","datablock.js","bmparser.js","datamask.js","rsdecoder.js","gf256poly.js","gf256.js","decoder.js","qrcode.js","findpat.js","alignpat.js","databr.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACxJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACtRA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC5ZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC9GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AChEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACvHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC1HA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC1MA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC/MA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACjLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC7OA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC3HA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC/FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACrUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC7oBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACjSA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"qrcode.js","sourcesContent":["/*\n Ported to JavaScript by Lazar Laszlo 2011\n\n [email protected], www.lazarsoft.info\n\n*/\n\n/*\n*\n* Copyright 2007 ZXing authors\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n\nGridSampler = {};\n\nGridSampler.checkAndNudgePoints=function( image, points)\n\t\t{\n\t\t\tvar width = qrcode.width;\n\t\t\tvar height = qrcode.height;\n\t\t\t// Check and nudge points from start until we see some that are OK:\n\t\t\tvar nudged = true;\n\t\t\tfor (var offset = 0; offset < points.length && nudged; offset += 2)\n\t\t\t{\n\t\t\t\tvar x = Math.floor (points[offset]);\n\t\t\t\tvar y = Math.floor( points[offset + 1]);\n\t\t\t\tif (x < - 1 || x > width || y < - 1 || y > height)\n\t\t\t\t{\n\t\t\t\t\tthrow \"Error.checkAndNudgePoints \";\n\t\t\t\t}\n\t\t\t\tnudged = false;\n\t\t\t\tif (x == - 1)\n\t\t\t\t{\n\t\t\t\t\tpoints[offset] = 0.0;\n\t\t\t\t\tnudged = true;\n\t\t\t\t}\n\t\t\t\telse if (x == width)\n\t\t\t\t{\n\t\t\t\t\tpoints[offset] = width - 1;\n\t\t\t\t\tnudged = true;\n\t\t\t\t}\n\t\t\t\tif (y == - 1)\n\t\t\t\t{\n\t\t\t\t\tpoints[offset + 1] = 0.0;\n\t\t\t\t\tnudged = true;\n\t\t\t\t}\n\t\t\t\telse if (y == height)\n\t\t\t\t{\n\t\t\t\t\tpoints[offset + 1] = height - 1;\n\t\t\t\t\tnudged = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Check and nudge points from end:\n\t\t\tnudged = true;\n\t\t\tfor (var offset = points.length - 2; offset >= 0 && nudged; offset -= 2)\n\t\t\t{\n\t\t\t\tvar x = Math.floor( points[offset]);\n\t\t\t\tvar y = Math.floor( points[offset + 1]);\n\t\t\t\tif (x < - 1 || x > width || y < - 1 || y > height)\n\t\t\t\t{\n\t\t\t\t\tthrow \"Error.checkAndNudgePoints \";\n\t\t\t\t}\n\t\t\t\tnudged = false;\n\t\t\t\tif (x == - 1)\n\t\t\t\t{\n\t\t\t\t\tpoints[offset] = 0.0;\n\t\t\t\t\tnudged = true;\n\t\t\t\t}\n\t\t\t\telse if (x == width)\n\t\t\t\t{\n\t\t\t\t\tpoints[offset] = width - 1;\n\t\t\t\t\tnudged = true;\n\t\t\t\t}\n\t\t\t\tif (y == - 1)\n\t\t\t\t{\n\t\t\t\t\tpoints[offset + 1] = 0.0;\n\t\t\t\t\tnudged = true;\n\t\t\t\t}\n\t\t\t\telse if (y == height)\n\t\t\t\t{\n\t\t\t\t\tpoints[offset + 1] = height - 1;\n\t\t\t\t\tnudged = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\n\nGridSampler.sampleGrid3=function( image, dimension, transform)\n\t\t{\n\t\t\tvar bits = new BitMatrix(dimension);\n\t\t\tvar points = new Array(dimension << 1);\n\t\t\tfor (var y = 0; y < dimension; y++)\n\t\t\t{\n\t\t\t\tvar max = points.length;\n\t\t\t\tvar iValue = y + 0.5;\n\t\t\t\tfor (var x = 0; x < max; x += 2)\n\t\t\t\t{\n\t\t\t\t\tpoints[x] = (x >> 1) + 0.5;\n\t\t\t\t\tpoints[x + 1] = iValue;\n\t\t\t\t}\n\t\t\t\ttransform.transformPoints1(points);\n\t\t\t\t// Quick check to see if points transformed to something inside the image;\n\t\t\t\t// sufficient to check the endpoints\n\t\t\t\tGridSampler.checkAndNudgePoints(image, points);\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\tfor (var x = 0; x < max; x += 2)\n\t\t\t\t\t{\n\t\t\t\t\t\tvar xpoint = (Math.floor( points[x]) * 4) + (Math.floor( points[x + 1]) * qrcode.width * 4);\n var bit = image[Math.floor( points[x])+ qrcode.width* Math.floor( points[x + 1])];\n\t\t\t\t\t\tqrcode.imagedata.data[xpoint] = bit?255:0;\n\t\t\t\t\t\tqrcode.imagedata.data[xpoint+1] = bit?255:0;\n\t\t\t\t\t\tqrcode.imagedata.data[xpoint+2] = 0;\n\t\t\t\t\t\tqrcode.imagedata.data[xpoint+3] = 255;\n\t\t\t\t\t\t//bits[x >> 1][ y]=bit;\n\t\t\t\t\t\tif(bit)\n\t\t\t\t\t\t\tbits.set_Renamed(x >> 1, y);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch ( aioobe)\n\t\t\t\t{\n\t\t\t\t\t// This feels wrong, but, sometimes if the finder patterns are misidentified, the resulting\n\t\t\t\t\t// transform gets \"twisted\" such that it maps a straight line of points to a set of points\n\t\t\t\t\t// whose endpoints are in bounds, but others are not. There is probably some mathematical\n\t\t\t\t\t// way to detect this about the transformation that I don't know yet.\n\t\t\t\t\t// This results in an ugly runtime exception despite our clever checks above -- can't have\n\t\t\t\t\t// that. We could check each point's coordinates but that feels duplicative. We settle for\n\t\t\t\t\t// catching and wrapping ArrayIndexOutOfBoundsException.\n\t\t\t\t\tthrow \"Error.checkAndNudgePoints\";\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn bits;\n\t\t}\n\nGridSampler.sampleGridx=function( image, dimension, p1ToX, p1ToY, p2ToX, p2ToY, p3ToX, p3ToY, p4ToX, p4ToY, p1FromX, p1FromY, p2FromX, p2FromY, p3FromX, p3FromY, p4FromX, p4FromY)\n{\n\tvar transform = PerspectiveTransform.quadrilateralToQuadrilateral(p1ToX, p1ToY, p2ToX, p2ToY, p3ToX, p3ToY, p4ToX, p4ToY, p1FromX, p1FromY, p2FromX, p2FromY, p3FromX, p3FromY, p4FromX, p4FromY);\n\n\treturn GridSampler.sampleGrid3(image, dimension, transform);\n}\n","/*\n Ported to JavaScript by Lazar Laszlo 2011\n\n [email protected], www.lazarsoft.info\n\n*/\n\n/*\n*\n* Copyright 2007 ZXing authors\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n\n\nfunction ECB(count, dataCodewords)\n{\n\tthis.count = count;\n\tthis.dataCodewords = dataCodewords;\n\n Object.defineProperties(this, {\n 'Count': {\n get: function () {\n return this.count;\n }\n },\n\n 'DataCodewords': {\n get: function () {\n return this.dataCodewords;\n }\n }\n });\n}\n\nfunction ECBlocks( ecCodewordsPerBlock, ecBlocks1, ecBlocks2)\n{\n\tthis.ecCodewordsPerBlock = ecCodewordsPerBlock;\n\n\tif (ecBlocks2)\n\t\tthis.ecBlocks = new Array(ecBlocks1, ecBlocks2);\n\telse\n\t\tthis.ecBlocks = new Array(ecBlocks1);\n\n Object.defineProperties(this, {\n \t\"ECCodewordsPerBlock\": {\n get: function () {\n \t\treturn this.ecCodewordsPerBlock;\n\n }\n \t},\n\n \t\"TotalECCodewords\": {\n get: function () {\n \t\treturn this.ecCodewordsPerBlock * this.NumBlocks;\n }\n \t},\n\n \t\"NumBlocks\": {\n get: function () {\n \t\tvar total = 0;\n\n \t\tfor (var i = 0; i < this.ecBlocks.length; i++)\n \t\t\ttotal += this.ecBlocks[i].length;\n\n \t\treturn total;\n }\n }\n });\n\n\tthis.getECBlocks = function() {\n\t\treturn this.ecBlocks;\n\t};\n}\n\nfunction Version( versionNumber, alignmentPatternCenters, ecBlocks1, ecBlocks2, ecBlocks3, ecBlocks4)\n{\n\tthis.versionNumber = versionNumber;\n\tthis.alignmentPatternCenters = alignmentPatternCenters;\n\tthis.ecBlocks = new Array(ecBlocks1, ecBlocks2, ecBlocks3, ecBlocks4);\n\n\tvar total = 0;\n\tvar ecCodewords = ecBlocks1.ECCodewordsPerBlock;\n\tvar ecbArray = ecBlocks1.getECBlocks();\n\tfor (var i = 0; i < ecbArray.length; i++)\n\t{\n\t\tvar ecBlock = ecbArray[i];\n\t\ttotal += ecBlock.Count * (ecBlock.DataCodewords + ecCodewords);\n\t}\n\tthis.totalCodewords = total;\n\n Object.defineProperties(this, {\n \t\"VersionNumber\": {\n \t\tget: function () {\n return this.versionNumber;\n }\n },\n\n \t\"AlignmentPatternCenters\": {\n \t\tget: function () {\n return this.alignmentPatternCenters;\n }\n },\n \t\"TotalCodewords\": {\n \t\tget: function () {\n return this.totalCodewords;\n }\n },\n \t\"DimensionForVersion\": {\n \t\tget: function () {\n return 17 + 4 * this.versionNumber;\n }\n }\n });\n\n\tthis.buildFunctionPattern=function()\n\t\t{\n\t\t\tvar dimension = this.DimensionForVersion;\n\t\t\tvar bitMatrix = new BitMatrix(dimension);\n\n\t\t\t// Top left finder pattern + separator + format\n\t\t\tbitMatrix.setRegion(0, 0, 9, 9);\n\t\t\t// Top right finder pattern + separator + format\n\t\t\tbitMatrix.setRegion(dimension - 8, 0, 8, 9);\n\t\t\t// Bottom left finder pattern + separator + format\n\t\t\tbitMatrix.setRegion(0, dimension - 8, 9, 8);\n\n\t\t\t// Alignment patterns\n\t\t\tvar max = this.alignmentPatternCenters.length;\n\t\t\tfor (var x = 0; x < max; x++)\n\t\t\t{\n\t\t\t\tvar i = this.alignmentPatternCenters[x] - 2;\n\t\t\t\tfor (var y = 0; y < max; y++)\n\t\t\t\t{\n\t\t\t\t\tif ((x == 0 && (y == 0 || y == max - 1)) || (x == max - 1 && y == 0))\n\t\t\t\t\t{\n\t\t\t\t\t\t// No alignment patterns near the three finder paterns\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tbitMatrix.setRegion(this.alignmentPatternCenters[y] - 2, i, 5, 5);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Vertical timing pattern\n\t\t\tbitMatrix.setRegion(6, 9, 1, dimension - 17);\n\t\t\t// Horizontal timing pattern\n\t\t\tbitMatrix.setRegion(9, 6, dimension - 17, 1);\n\n\t\t\tif (this.versionNumber > 6)\n\t\t\t{\n\t\t\t\t// Version info, top right\n\t\t\t\tbitMatrix.setRegion(dimension - 11, 0, 3, 6);\n\t\t\t\t// Version info, bottom left\n\t\t\t\tbitMatrix.setRegion(0, dimension - 11, 6, 3);\n\t\t\t}\n\n\t\t\treturn bitMatrix;\n\t\t}\n\tthis.getECBlocksForLevel=function( ecLevel)\n\t{\n\t\treturn this.ecBlocks[ecLevel.ordinal()];\n\t}\n}\n\nVersion.VERSION_DECODE_INFO = new Array(0x07C94, 0x085BC, 0x09A99, 0x0A4D3, 0x0BBF6, 0x0C762, 0x0D847, 0x0E60D, 0x0F928, 0x10B78, 0x1145D, 0x12A17, 0x13532, 0x149A6, 0x15683, 0x168C9, 0x177EC, 0x18EC4, 0x191E1, 0x1AFAB, 0x1B08E, 0x1CC1A, 0x1D33F, 0x1ED75, 0x1F250, 0x209D5, 0x216F0, 0x228BA, 0x2379F, 0x24B0B, 0x2542E, 0x26A64, 0x27541, 0x28C69);\n\nVersion.VERSIONS = buildVersions();\n\nVersion.getVersionForNumber=function( versionNumber)\n{\n\tif (versionNumber < 1 || versionNumber > 40)\n\t{\n\t\tthrow \"ArgumentException\";\n\t}\n\treturn Version.VERSIONS[versionNumber - 1];\n}\n\nVersion.getProvisionalVersionForDimension=function(dimension)\n{\n\tif (dimension % 4 != 1)\n\t{\n\t\tthrow \"Error getProvisionalVersionForDimension\";\n\t}\n\ttry\n\t{\n\t\treturn Version.getVersionForNumber((dimension - 17) >> 2);\n\t}\n\tcatch ( iae)\n\t{\n\t\tthrow \"Error getVersionForNumber\";\n\t}\n}\n\nVersion.decodeVersionInformation=function( versionBits)\n{\n\tvar bestDifference = 0xffffffff;\n\tvar bestVersion = 0;\n\tfor (var i = 0; i < Version.VERSION_DECODE_INFO.length; i++)\n\t{\n\t\tvar targetVersion = Version.VERSION_DECODE_INFO[i];\n\t\t// Do the version info bits match exactly? done.\n\t\tif (targetVersion == versionBits)\n\t\t{\n\t\t\treturn this.getVersionForNumber(i + 7);\n\t\t}\n\t\t// Otherwise see if this is the closest to a real version info bit string\n\t\t// we have seen so far\n\t\tvar bitsDifference = FormatInformation.numBitsDiffering(versionBits, targetVersion);\n\t\tif (bitsDifference < bestDifference)\n\t\t{\n\t\t\tbestVersion = i + 7;\n\t\t\tbestDifference = bitsDifference;\n\t\t}\n\t}\n\t// We can tolerate up to 3 bits of error since no two version info codewords will\n\t// differ in less than 4 bits.\n\tif (bestDifference <= 3)\n\t{\n\t\treturn this.getVersionForNumber(bestVersion);\n\t}\n\t// If we didn't find a close enough match, fail\n\treturn null;\n}\n\nfunction buildVersions()\n{\n\treturn new Array(new Version(1, new Array(), new ECBlocks(7, new ECB(1, 19)), new ECBlocks(10, new ECB(1, 16)), new ECBlocks(13, new ECB(1, 13)), new ECBlocks(17, new ECB(1, 9))),\n\tnew Version(2, new Array(6, 18), new ECBlocks(10, new ECB(1, 34)), new ECBlocks(16, new ECB(1, 28)), new ECBlocks(22, new ECB(1, 22)), new ECBlocks(28, new ECB(1, 16))),\n\tnew Version(3, new Array(6, 22), new ECBlocks(15, new ECB(1, 55)), new ECBlocks(26, new ECB(1, 44)), new ECBlocks(18, new ECB(2, 17)), new ECBlocks(22, new ECB(2, 13))),\n\tnew Version(4, new Array(6, 26), new ECBlocks(20, new ECB(1, 80)), new ECBlocks(18, new ECB(2, 32)), new ECBlocks(26, new ECB(2, 24)), new ECBlocks(16, new ECB(4, 9))),\n\tnew Version(5, new Array(6, 30), new ECBlocks(26, new ECB(1, 108)), new ECBlocks(24, new ECB(2, 43)), new ECBlocks(18, new ECB(2, 15), new ECB(2, 16)), new ECBlocks(22, new ECB(2, 11), new ECB(2, 12))),\n\tnew Version(6, new Array(6, 34), new ECBlocks(18, new ECB(2, 68)), new ECBlocks(16, new ECB(4, 27)), new ECBlocks(24, new ECB(4, 19)), new ECBlocks(28, new ECB(4, 15))),\n\tnew Version(7, new Array(6, 22, 38), new ECBlocks(20, new ECB(2, 78)), new ECBlocks(18, new ECB(4, 31)), new ECBlocks(18, new ECB(2, 14), new ECB(4, 15)), new ECBlocks(26, new ECB(4, 13), new ECB(1, 14))),\n\tnew Version(8, new Array(6, 24, 42), new ECBlocks(24, new ECB(2, 97)), new ECBlocks(22, new ECB(2, 38), new ECB(2, 39)), new ECBlocks(22, new ECB(4, 18), new ECB(2, 19)), new ECBlocks(26, new ECB(4, 14), new ECB(2, 15))),\n\tnew Version(9, new Array(6, 26, 46), new ECBlocks(30, new ECB(2, 116)), new ECBlocks(22, new ECB(3, 36), new ECB(2, 37)), new ECBlocks(20, new ECB(4, 16), new ECB(4, 17)), new ECBlocks(24, new ECB(4, 12), new ECB(4, 13))),\n\tnew Version(10, new Array(6, 28, 50), new ECBlocks(18, new ECB(2, 68), new ECB(2, 69)), new ECBlocks(26, new ECB(4, 43), new ECB(1, 44)), new ECBlocks(24, new ECB(6, 19), new ECB(2, 20)), new ECBlocks(28, new ECB(6, 15), new ECB(2, 16))),\n\tnew Version(11, new Array(6, 30, 54), new ECBlocks(20, new ECB(4, 81)), new ECBlocks(30, new ECB(1, 50), new ECB(4, 51)), new ECBlocks(28, new ECB(4, 22), new ECB(4, 23)), new ECBlocks(24, new ECB(3, 12), new ECB(8, 13))),\n\tnew Version(12, new Array(6, 32, 58), new ECBlocks(24, new ECB(2, 92), new ECB(2, 93)), new ECBlocks(22, new ECB(6, 36), new ECB(2, 37)), new ECBlocks(26, new ECB(4, 20), new ECB(6, 21)), new ECBlocks(28, new ECB(7, 14), new ECB(4, 15))),\n\tnew Version(13, new Array(6, 34, 62), new ECBlocks(26, new ECB(4, 107)), new ECBlocks(22, new ECB(8, 37), new ECB(1, 38)), new ECBlocks(24, new ECB(8, 20), new ECB(4, 21)), new ECBlocks(22, new ECB(12, 11), new ECB(4, 12))),\n\tnew Version(14, new Array(6, 26, 46, 66), new ECBlocks(30, new ECB(3, 115), new ECB(1, 116)), new ECBlocks(24, new ECB(4, 40), new ECB(5, 41)), new ECBlocks(20, new ECB(11, 16), new ECB(5, 17)), new ECBlocks(24, new ECB(11, 12), new ECB(5, 13))),\n\tnew Version(15, new Array(6, 26, 48, 70), new ECBlocks(22, new ECB(5, 87), new ECB(1, 88)), new ECBlocks(24, new ECB(5, 41), new ECB(5, 42)), new ECBlocks(30, new ECB(5, 24), new ECB(7, 25)), new ECBlocks(24, new ECB(11, 12), new ECB(7, 13))),\n\tnew Version(16, new Array(6, 26, 50, 74), new ECBlocks(24, new ECB(5, 98), new ECB(1, 99)), new ECBlocks(28, new ECB(7, 45), new ECB(3, 46)), new ECBlocks(24, new ECB(15, 19), new ECB(2, 20)), new ECBlocks(30, new ECB(3, 15), new ECB(13, 16))),\n\tnew Version(17, new Array(6, 30, 54, 78), new ECBlocks(28, new ECB(1, 107), new ECB(5, 108)), new ECBlocks(28, new ECB(10, 46), new ECB(1, 47)), new ECBlocks(28, new ECB(1, 22), new ECB(15, 23)), new ECBlocks(28, new ECB(2, 14), new ECB(17, 15))),\n\tnew Version(18, new Array(6, 30, 56, 82), new ECBlocks(30, new ECB(5, 120), new ECB(1, 121)), new ECBlocks(26, new ECB(9, 43), new ECB(4, 44)), new ECBlocks(28, new ECB(17, 22), new ECB(1, 23)), new ECBlocks(28, new ECB(2, 14), new ECB(19, 15))),\n\tnew Version(19, new Array(6, 30, 58, 86), new ECBlocks(28, new ECB(3, 113), new ECB(4, 114)), new ECBlocks(26, new ECB(3, 44), new ECB(11, 45)), new ECBlocks(26, new ECB(17, 21), new ECB(4, 22)), new ECBlocks(26, new ECB(9, 13), new ECB(16, 14))),\n\tnew Version(20, new Array(6, 34, 62, 90), new ECBlocks(28, new ECB(3, 107), new ECB(5, 108)), new ECBlocks(26, new ECB(3, 41), new ECB(13, 42)), new ECBlocks(30, new ECB(15, 24), new ECB(5, 25)), new ECBlocks(28, new ECB(15, 15), new ECB(10, 16))),\n\tnew Version(21, new Array(6, 28, 50, 72, 94), new ECBlocks(28, new ECB(4, 116), new ECB(4, 117)), new ECBlocks(26, new ECB(17, 42)), new ECBlocks(28, new ECB(17, 22), new ECB(6, 23)), new ECBlocks(30, new ECB(19, 16), new ECB(6, 17))),\n\tnew Version(22, new Array(6, 26, 50, 74, 98), new ECBlocks(28, new ECB(2, 111), new ECB(7, 112)), new ECBlocks(28, new ECB(17, 46)), new ECBlocks(30, new ECB(7, 24), new ECB(16, 25)), new ECBlocks(24, new ECB(34, 13))),\n\tnew Version(23, new Array(6, 30, 54, 74, 102), new ECBlocks(30, new ECB(4, 121), new ECB(5, 122)), new ECBlocks(28, new ECB(4, 47), new ECB(14, 48)), new ECBlocks(30, new ECB(11, 24), new ECB(14, 25)), new ECBlocks(30, new ECB(16, 15), new ECB(14, 16))),\n\tnew Version(24, new Array(6, 28, 54, 80, 106), new ECBlocks(30, new ECB(6, 117), new ECB(4, 118)), new ECBlocks(28, new ECB(6, 45), new ECB(14, 46)), new ECBlocks(30, new ECB(11, 24), new ECB(16, 25)), new ECBlocks(30, new ECB(30, 16), new ECB(2, 17))),\n\tnew Version(25, new Array(6, 32, 58, 84, 110), new ECBlocks(26, new ECB(8, 106), new ECB(4, 107)), new ECBlocks(28, new ECB(8, 47), new ECB(13, 48)), new ECBlocks(30, new ECB(7, 24), new ECB(22, 25)), new ECBlocks(30, new ECB(22, 15), new ECB(13, 16))),\n\tnew Version(26, new Array(6, 30, 58, 86, 114), new ECBlocks(28, new ECB(10, 114), new ECB(2, 115)), new ECBlocks(28, new ECB(19, 46), new ECB(4, 47)), new ECBlocks(28, new ECB(28, 22), new ECB(6, 23)), new ECBlocks(30, new ECB(33, 16), new ECB(4, 17))),\n\tnew Version(27, new Array(6, 34, 62, 90, 118), new ECBlocks(30, new ECB(8, 122), new ECB(4, 123)), new ECBlocks(28, new ECB(22, 45), new ECB(3, 46)), new ECBlocks(30, new ECB(8, 23), new ECB(26, 24)), new ECBlocks(30, new ECB(12, 15), \t\tnew ECB(28, 16))),\n\tnew Version(28, new Array(6, 26, 50, 74, 98, 122), new ECBlocks(30, new ECB(3, 117), new ECB(10, 118)), new ECBlocks(28, new ECB(3, 45), new ECB(23, 46)), new ECBlocks(30, new ECB(4, 24), new ECB(31, 25)), new ECBlocks(30, new ECB(11, 15), new ECB(31, 16))),\n\tnew Version(29, new Array(6, 30, 54, 78, 102, 126), new ECBlocks(30, new ECB(7, 116), new ECB(7, 117)), new ECBlocks(28, new ECB(21, 45), new ECB(7, 46)), new ECBlocks(30, new ECB(1, 23), new ECB(37, 24)), new ECBlocks(30, new ECB(19, 15), new ECB(26, 16))),\n\tnew Version(30, new Array(6, 26, 52, 78, 104, 130), new ECBlocks(30, new ECB(5, 115), new ECB(10, 116)), new ECBlocks(28, new ECB(19, 47), new ECB(10, 48)), new ECBlocks(30, new ECB(15, 24), new ECB(25, 25)), new ECBlocks(30, new ECB(23, 15), new ECB(25, 16))),\n\tnew Version(31, new Array(6, 30, 56, 82, 108, 134), new ECBlocks(30, new ECB(13, 115), new ECB(3, 116)), new ECBlocks(28, new ECB(2, 46), new ECB(29, 47)), new ECBlocks(30, new ECB(42, 24), new ECB(1, 25)), new ECBlocks(30, new ECB(23, 15), new ECB(28, 16))),\n\tnew Version(32, new Array(6, 34, 60, 86, 112, 138), new ECBlocks(30, new ECB(17, 115)), new ECBlocks(28, new ECB(10, 46), new ECB(23, 47)), new ECBlocks(30, new ECB(10, 24), new ECB(35, 25)), new ECBlocks(30, new ECB(19, 15), new ECB(35, 16))),\n\tnew Version(33, new Array(6, 30, 58, 86, 114, 142), new ECBlocks(30, new ECB(17, 115), new ECB(1, 116)), new ECBlocks(28, new ECB(14, 46), new ECB(21, 47)), new ECBlocks(30, new ECB(29, 24), new ECB(19, 25)), new ECBlocks(30, new ECB(11, 15), new ECB(46, 16))),\n\tnew Version(34, new Array(6, 34, 62, 90, 118, 146), new ECBlocks(30, new ECB(13, 115), new ECB(6, 116)), new ECBlocks(28, new ECB(14, 46), new ECB(23, 47)), new ECBlocks(30, new ECB(44, 24), new ECB(7, 25)), new ECBlocks(30, new ECB(59, 16), new ECB(1, 17))),\n\tnew Version(35, new Array(6, 30, 54, 78, 102, 126, 150), new ECBlocks(30, new ECB(12, 121), new ECB(7, 122)), new ECBlocks(28, new ECB(12, 47), new ECB(26, 48)), new ECBlocks(30, new ECB(39, 24), new ECB(14, 25)),new ECBlocks(30, new ECB(22, 15), new ECB(41, 16))),\n\tnew Version(36, new Array(6, 24, 50, 76, 102, 128, 154), new ECBlocks(30, new ECB(6, 121), new ECB(14, 122)), new ECBlocks(28, new ECB(6, 47), new ECB(34, 48)), new ECBlocks(30, new ECB(46, 24), new ECB(10, 25)), new ECBlocks(30, new ECB(2, 15), new ECB(64, 16))),\n\tnew Version(37, new Array(6, 28, 54, 80, 106, 132, 158), new ECBlocks(30, new ECB(17, 122), new ECB(4, 123)), new ECBlocks(28, new ECB(29, 46), new ECB(14, 47)), new ECBlocks(30, new ECB(49, 24), new ECB(10, 25)), new ECBlocks(30, new ECB(24, 15), new ECB(46, 16))),\n\tnew Version(38, new Array(6, 32, 58, 84, 110, 136, 162), new ECBlocks(30, new ECB(4, 122), new ECB(18, 123)), new ECBlocks(28, new ECB(13, 46), new ECB(32, 47)), new ECBlocks(30, new ECB(48, 24), new ECB(14, 25)), new ECBlocks(30, new ECB(42, 15), new ECB(32, 16))),\n\tnew Version(39, new Array(6, 26, 54, 82, 110, 138, 166), new ECBlocks(30, new ECB(20, 117), new ECB(4, 118)), new ECBlocks(28, new ECB(40, 47), new ECB(7, 48)), new ECBlocks(30, new ECB(43, 24), new ECB(22, 25)), new ECBlocks(30, new ECB(10, 15), new ECB(67, 16))),\n\tnew Version(40, new Array(6, 30, 58, 86, 114, 142, 170), new ECBlocks(30, new ECB(19, 118), new ECB(6, 119)), new ECBlocks(28, new ECB(18, 47), new ECB(31, 48)), new ECBlocks(30, new ECB(34, 24), new ECB(34, 25)), new ECBlocks(30, new ECB(20, 15), new ECB(61, 16))));\n}\n","/*\r\n Ported to JavaScript by Lazar Laszlo 2011 \r\n \r\n [email protected], www.lazarsoft.info\r\n \r\n*/\r\n\r\n/*\r\n*\r\n* Copyright 2007 ZXing authors\r\n*\r\n* Licensed under the Apache License, Version 2.0 (the \"License\");\r\n* you may not use this file except in compliance with the License.\r\n* You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing, software\r\n* distributed under the License is distributed on an \"AS IS\" BASIS,\r\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n* See the License for the specific language governing permissions and\r\n* limitations under the License.\r\n*/\r\n\r\n\r\nfunction PerspectiveTransform( a11, a21, a31, a12, a22, a32, a13, a23, a33)\r\n{\r\n\tthis.a11 = a11;\r\n\tthis.a12 = a12;\r\n\tthis.a13 = a13;\r\n\tthis.a21 = a21;\r\n\tthis.a22 = a22;\r\n\tthis.a23 = a23;\r\n\tthis.a31 = a31;\r\n\tthis.a32 = a32;\r\n\tthis.a33 = a33;\r\n\tthis.transformPoints1=function( points)\r\n\t\t{\r\n\t\t\tvar max = points.length;\r\n\t\t\tvar a11 = this.a11;\r\n\t\t\tvar a12 = this.a12;\r\n\t\t\tvar a13 = this.a13;\r\n\t\t\tvar a21 = this.a21;\r\n\t\t\tvar a22 = this.a22;\r\n\t\t\tvar a23 = this.a23;\r\n\t\t\tvar a31 = this.a31;\r\n\t\t\tvar a32 = this.a32;\r\n\t\t\tvar a33 = this.a33;\r\n\t\t\tfor (var i = 0; i < max; i += 2)\r\n\t\t\t{\r\n\t\t\t\tvar x = points[i];\r\n\t\t\t\tvar y = points[i + 1];\r\n\t\t\t\tvar denominator = a13 * x + a23 * y + a33;\r\n\t\t\t\tpoints[i] = (a11 * x + a21 * y + a31) / denominator;\r\n\t\t\t\tpoints[i + 1] = (a12 * x + a22 * y + a32) / denominator;\r\n\t\t\t}\r\n\t\t}\r\n\tthis. transformPoints2=function(xValues, yValues)\r\n\t\t{\r\n\t\t\tvar n = xValues.length;\r\n\t\t\tfor (var i = 0; i < n; i++)\r\n\t\t\t{\r\n\t\t\t\tvar x = xValues[i];\r\n\t\t\t\tvar y = yValues[i];\r\n\t\t\t\tvar denominator = this.a13 * x + this.a23 * y + this.a33;\r\n\t\t\t\txValues[i] = (this.a11 * x + this.a21 * y + this.a31) / denominator;\r\n\t\t\t\tyValues[i] = (this.a12 * x + this.a22 * y + this.a32) / denominator;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\tthis.buildAdjoint=function()\r\n\t\t{\r\n\t\t\t// Adjoint is the transpose of the cofactor matrix:\r\n\t\t\treturn new PerspectiveTransform(this.a22 * this.a33 - this.a23 * this.a32, this.a23 * this.a31 - this.a21 * this.a33, this.a21 * this.a32 - this.a22 * this.a31, this.a13 * this.a32 - this.a12 * this.a33, this.a11 * this.a33 - this.a13 * this.a31, this.a12 * this.a31 - this.a11 * this.a32, this.a12 * this.a23 - this.a13 * this.a22, this.a13 * this.a21 - this.a11 * this.a23, this.a11 * this.a22 - this.a12 * this.a21);\r\n\t\t}\r\n\tthis.times=function( other)\r\n\t\t{\r\n\t\t\treturn new PerspectiveTransform(this.a11 * other.a11 + this.a21 * other.a12 + this.a31 * other.a13, this.a11 * other.a21 + this.a21 * other.a22 + this.a31 * other.a23, this.a11 * other.a31 + this.a21 * other.a32 + this.a31 * other.a33, this.a12 * other.a11 + this.a22 * other.a12 + this.a32 * other.a13, this.a12 * other.a21 + this.a22 * other.a22 + this.a32 * other.a23, this.a12 * other.a31 + this.a22 * other.a32 + this.a32 * other.a33, this.a13 * other.a11 + this.a23 * other.a12 +this.a33 * other.a13, this.a13 * other.a21 + this.a23 * other.a22 + this.a33 * other.a23, this.a13 * other.a31 + this.a23 * other.a32 + this.a33 * other.a33);\r\n\t\t}\r\n\r\n}\r\n\r\nPerspectiveTransform.quadrilateralToQuadrilateral=function( x0, y0, x1, y1, x2, y2, x3, y3, x0p, y0p, x1p, y1p, x2p, y2p, x3p, y3p)\r\n{\r\n\t\r\n\tvar qToS = this.quadrilateralToSquare(x0, y0, x1, y1, x2, y2, x3, y3);\r\n\tvar sToQ = this.squareToQuadrilateral(x0p, y0p, x1p, y1p, x2p, y2p, x3p, y3p);\r\n\treturn sToQ.times(qToS);\r\n}\r\n\r\nPerspectiveTransform.squareToQuadrilateral=function( x0, y0, x1, y1, x2, y2, x3, y3)\r\n{\r\n\t dy2 = y3 - y2;\r\n\t dy3 = y0 - y1 + y2 - y3;\r\n\tif (dy2 == 0.0 && dy3 == 0.0)\r\n\t{\r\n\t\treturn new PerspectiveTransform(x1 - x0, x2 - x1, x0, y1 - y0, y2 - y1, y0, 0.0, 0.0, 1.0);\r\n\t}\r\n\telse\r\n\t{\r\n\t\t dx1 = x1 - x2;\r\n\t\t dx2 = x3 - x2;\r\n\t\t dx3 = x0 - x1 + x2 - x3;\r\n\t\t dy1 = y1 - y2;\r\n\t\t denominator = dx1 * dy2 - dx2 * dy1;\r\n\t\t a13 = (dx3 * dy2 - dx2 * dy3) / denominator;\r\n\t\t a23 = (dx1 * dy3 - dx3 * dy1) / denominator;\r\n\t\treturn new PerspectiveTransform(x1 - x0 + a13 * x1, x3 - x0 + a23 * x3, x0, y1 - y0 + a13 * y1, y3 - y0 + a23 * y3, y0, a13, a23, 1.0);\r\n\t}\r\n}\r\n\r\nPerspectiveTransform.quadrilateralToSquare=function( x0, y0, x1, y1, x2, y2, x3, y3)\r\n{\r\n\t// Here, the adjoint serves as the inverse:\r\n\treturn this.squareToQuadrilateral(x0, y0, x1, y1, x2, y2, x3, y3).buildAdjoint();\r\n}\r\n\r\nfunction DetectorResult(bits, points)\r\n{\r\n\tthis.bits = bits;\r\n\tthis.points = points;\r\n}\r\n\r\n\r\nfunction Detector(image)\r\n{\r\n\tthis.image=image;\r\n\tthis.resultPointCallback = null;\r\n\t\r\n\tthis.sizeOfBlackWhiteBlackRun=function( fromX, fromY, toX, toY)\r\n\t\t{\r\n\t\t\t// Mild variant of Bresenham's algorithm;\r\n\t\t\t// see http://en.wikipedia.org/wiki/Bresenham's_line_algorithm\r\n\t\t\tvar steep = Math.abs(toY - fromY) > Math.abs(toX - fromX);\r\n\t\t\tif (steep)\r\n\t\t\t{\r\n\t\t\t\tvar temp = fromX;\r\n\t\t\t\tfromX = fromY;\r\n\t\t\t\tfromY = temp;\r\n\t\t\t\ttemp = toX;\r\n\t\t\t\ttoX = toY;\r\n\t\t\t\ttoY = temp;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tvar dx = Math.abs(toX - fromX);\r\n\t\t\tvar dy = Math.abs(toY - fromY);\r\n\t\t\tvar error = - dx >> 1;\r\n\t\t\tvar ystep = fromY < toY?1:- 1;\r\n\t\t\tvar xstep = fromX < toX?1:- 1;\r\n\t\t\tvar state = 0; // In black pixels, looking for white, first or second time\r\n\t\t\tfor (var x = fromX, y = fromY; x != toX; x += xstep)\r\n\t\t\t{\r\n\t\t\t\t\r\n\t\t\t\tvar realX = steep?y:x;\r\n\t\t\t\tvar realY = steep?x:y;\r\n\t\t\t\tif (state == 1)\r\n\t\t\t\t{\r\n\t\t\t\t\t// In white pixels, looking for black\r\n\t\t\t\t\tif (this.image[realX + realY*qrcode.width])\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tstate++;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tif (!this.image[realX + realY*qrcode.width])\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tstate++;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tif (state == 3)\r\n\t\t\t\t{\r\n\t\t\t\t\t// Found black, white, black, and stumbled back onto white; done\r\n\t\t\t\t\tvar diffX = x - fromX;\r\n\t\t\t\t\tvar diffY = y - fromY;\r\n\t\t\t\t\treturn Math.sqrt( (diffX * diffX + diffY * diffY));\r\n\t\t\t\t}\r\n\t\t\t\terror += dy;\r\n\t\t\t\tif (error > 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tif (y == toY)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t\ty += ystep;\r\n\t\t\t\t\terror -= dx;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tvar diffX2 = toX - fromX;\r\n\t\t\tvar diffY2 = toY - fromY;\r\n\t\t\treturn Math.sqrt( (diffX2 * diffX2 + diffY2 * diffY2));\r\n\t\t}\r\n\r\n\t\r\n\tthis.sizeOfBlackWhiteBlackRunBothWays=function( fromX, fromY, toX, toY)\r\n\t\t{\r\n\t\t\t\r\n\t\t\tvar result = this.sizeOfBlackWhiteBlackRun(fromX, fromY, toX, toY);\r\n\t\t\t\r\n\t\t\t// Now count other way -- don't run off image though of course\r\n\t\t\tvar scale = 1.0;\r\n\t\t\tvar otherToX = fromX - (toX - fromX);\r\n\t\t\tif (otherToX < 0)\r\n\t\t\t{\r\n\t\t\t\tscale = fromX / (fromX - otherToX);\r\n\t\t\t\totherToX = 0;\r\n\t\t\t}\r\n\t\t\telse if (otherToX >= qrcode.width)\r\n\t\t\t{\r\n\t\t\t\tscale = (qrcode.width - 1 - fromX) / (otherToX - fromX);\r\n\t\t\t\totherToX = qrcode.width - 1;\r\n\t\t\t}\r\n\t\t\tvar otherToY = Math.floor (fromY - (toY - fromY) * scale);\r\n\t\t\t\r\n\t\t\tscale = 1.0;\r\n\t\t\tif (otherToY < 0)\r\n\t\t\t{\r\n\t\t\t\tscale = fromY / (fromY - otherToY);\r\n\t\t\t\totherToY = 0;\r\n\t\t\t}\r\n\t\t\telse if (otherToY >= qrcode.height)\r\n\t\t\t{\r\n\t\t\t\tscale = (qrcode.height - 1 - fromY) / (otherToY - fromY);\r\n\t\t\t\totherToY = qrcode.height - 1;\r\n\t\t\t}\r\n\t\t\totherToX = Math.floor (fromX + (otherToX - fromX) * scale);\r\n\t\t\t\r\n\t\t\tresult += this.sizeOfBlackWhiteBlackRun(fromX, fromY, otherToX, otherToY);\r\n\t\t\treturn result - 1.0; // -1 because we counted the middle pixel twice\r\n\t\t}\r\n\t\t\r\n\r\n\t\r\n\tthis.calculateModuleSizeOneWay=function( pattern, otherPattern)\r\n\t\t{\r\n\t\t\tvar moduleSizeEst1 = this.sizeOfBlackWhiteBlackRunBothWays(Math.floor( pattern.X), Math.floor( pattern.Y), Math.floor( otherPattern.X), Math.floor(otherPattern.Y));\r\n\t\t\tvar moduleSizeEst2 = this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(otherPattern.X), Math.floor(otherPattern.Y), Math.floor( pattern.X), Math.floor(pattern.Y));\r\n\t\t\tif (isNaN(moduleSizeEst1))\r\n\t\t\t{\r\n\t\t\t\treturn moduleSizeEst2 / 7.0;\r\n\t\t\t}\r\n\t\t\tif (isNaN(moduleSizeEst2))\r\n\t\t\t{\r\n\t\t\t\treturn moduleSizeEst1 / 7.0;\r\n\t\t\t}\r\n\t\t\t// Average them, and divide by 7 since we've counted the width of 3 black modules,\r\n\t\t\t// and 1 white and 1 black module on either side. Ergo, divide sum by 14.\r\n\t\t\treturn (moduleSizeEst1 + moduleSizeEst2) / 14.0;\r\n\t\t}\r\n\r\n\t\r\n\tthis.calculateModuleSize=function( topLeft, topRight, bottomLeft)\r\n\t\t{\r\n\t\t\t// Take the average\r\n\t\t\treturn (this.calculateModuleSizeOneWay(topLeft, topRight) + this.calculateModuleSizeOneWay(topLeft, bottomLeft)) / 2.0;\r\n\t\t}\r\n\r\n\tthis.distance=function( pattern1, pattern2)\r\n\t{\r\n\t\txDiff = pattern1.X - pattern2.X;\r\n\t\tyDiff = pattern1.Y - pattern2.Y;\r\n\t\treturn Math.sqrt( (xDiff * xDiff + yDiff * yDiff));\r\n\t}\r\n\tthis.computeDimension=function( topLeft, topRight, bottomLeft, moduleSize)\r\n\t\t{\r\n\t\t\t\r\n\t\t\tvar tltrCentersDimension = Math.round(this.distance(topLeft, topRight) / moduleSize);\r\n\t\t\tvar tlblCentersDimension = Math.round(this.distance(topLeft, bottomLeft) / moduleSize);\r\n\t\t\tvar dimension = ((tltrCentersDimension + tlblCentersDimension) >> 1) + 7;\r\n\t\t\tswitch (dimension & 0x03)\r\n\t\t\t{\r\n\t\t\t\t\r\n\t\t\t\t// mod 4\r\n\t\t\t\tcase 0: \r\n\t\t\t\t\tdimension++;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t\t// 1? do nothing\r\n\t\t\t\t\r\n\t\t\t\tcase 2: \r\n\t\t\t\t\tdimension--;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t\r\n\t\t\t\tcase 3: \r\n\t\t\t\t\tthrow \"Error\";\r\n\t\t\t\t}\r\n\t\t\treturn dimension;\r\n\t\t}\r\n\r\n\tthis.findAlignmentInRegion=function( overallEstModuleSize, estAlignmentX, estAlignmentY, allowanceFactor)\r\n\t\t{\r\n\t\t\t// Look for an alignment pattern (3 modules in size) around where it\r\n\t\t\t// should be\r\n\t\t\tvar allowance = Math.floor (allowanceFactor * overallEstModuleSize);\r\n\t\t\tvar alignmentAreaLeftX = Math.max(0, estAlignmentX - allowance);\r\n\t\t\tvar alignmentAreaRightX = Math.min(qrcode.width - 1, estAlignmentX + allowance);\r\n\t\t\tif (alignmentAreaRightX - alignmentAreaLeftX < overallEstModuleSize * 3)\r\n\t\t\t{\r\n\t\t\t\tthrow \"Error\";\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tvar alignmentAreaTopY = Math.max(0, estAlignmentY - allowance);\r\n\t\t\tvar alignmentAreaBottomY = Math.min(qrcode.height - 1, estAlignmentY + allowance);\r\n\t\t\t\r\n\t\t\tvar alignmentFinder = new AlignmentPatternFinder(this.image, alignmentAreaLeftX, alignmentAreaTopY, alignmentAreaRightX - alignmentAreaLeftX, alignmentAreaBottomY - alignmentAreaTopY, overallEstModuleSize, this.resultPointCallback);\r\n\t\t\treturn alignmentFinder.find();\r\n\t\t}\r\n\t\t\r\n\tthis.createTransform=function( topLeft, topRight, bottomLeft, alignmentPattern, dimension)\r\n\t\t{\r\n\t\t\tvar dimMinusThree = dimension - 3.5;\r\n\t\t\tvar bottomRightX;\r\n\t\t\tvar bottomRightY;\r\n\t\t\tvar sourceBottomRightX;\r\n\t\t\tvar sourceBottomRightY;\r\n\t\t\tif (alignmentPattern != null)\r\n\t\t\t{\r\n\t\t\t\tbottomRightX = alignmentPattern.X;\r\n\t\t\t\tbottomRightY = alignmentPattern.Y;\r\n\t\t\t\tsourceBottomRightX = sourceBottomRightY = dimMinusThree - 3.0;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t// Don't have an alignment pattern, just make up the bottom-right point\r\n\t\t\t\tbottomRightX = (topRight.X - topLeft.X) + bottomLeft.X;\r\n\t\t\t\tbottomRightY = (topRight.Y - topLeft.Y) + bottomLeft.Y;\r\n\t\t\t\tsourceBottomRightX = sourceBottomRightY = dimMinusThree;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tvar transform = PerspectiveTransform.quadrilateralToQuadrilateral(3.5, 3.5, dimMinusThree, 3.5, sourceBottomRightX, sourceBottomRightY, 3.5, dimMinusThree, topLeft.X, topLeft.Y, topRight.X, topRight.Y, bottomRightX, bottomRightY, bottomLeft.X, bottomLeft.Y);\r\n\t\t\t\r\n\t\t\treturn transform;\r\n\t\t}\t\t\r\n\t\r\n\tthis.sampleGrid=function( image, transform, dimension)\r\n\t\t{\r\n\t\t\t\r\n\t\t\tvar sampler = GridSampler;\r\n\t\t\treturn sampler.sampleGrid3(image, dimension, transform);\r\n\t\t}\r\n\t\r\n\tthis.processFinderPatternInfo = function( info)\r\n\t\t{\r\n\t\t\t\r\n\t\t\tvar topLeft = info.TopLeft;\r\n\t\t\tvar topRight = info.TopRight;\r\n\t\t\tvar bottomLeft = info.BottomLeft;\r\n\t\t\t\r\n\t\t\tvar moduleSize = this.calculateModuleSize(topLeft, topRight, bottomLeft);\r\n\t\t\tif (moduleSize < 1.0)\r\n\t\t\t{\r\n\t\t\t\tthrow \"Error\";\r\n\t\t\t}\r\n\t\t\tvar dimension = this.computeDimension(topLeft, topRight, bottomLeft, moduleSize);\r\n\t\t\tvar provisionalVersion = Version.getProvisionalVersionForDimension(dimension);\r\n\t\t\tvar modulesBetweenFPCenters = provisionalVersion.DimensionForVersion - 7;\r\n\t\t\t\r\n\t\t\tvar alignmentPattern = null;\r\n\t\t\t// Anything above version 1 has an alignment pattern\r\n\t\t\tif (provisionalVersion.AlignmentPatternCenters.length > 0)\r\n\t\t\t{\r\n\t\t\t\t\r\n\t\t\t\t// Guess where a \"bottom right\" finder pattern would have been\r\n\t\t\t\tvar bottomRightX = topRight.X - topLeft.X + bottomLeft.X;\r\n\t\t\t\tvar bottomRightY = topRight.Y - topLeft.Y + bottomLeft.Y;\r\n\t\t\t\t\r\n\t\t\t\t// Estimate that alignment pattern is closer by 3 modules\r\n\t\t\t\t// from \"bottom right\" to known top left location\r\n\t\t\t\tvar correctionToTopLeft = 1.0 - 3.0 / modulesBetweenFPCenters;\r\n\t\t\t\tvar estAlignmentX = Math.floor (topLeft.X + correctionToTopLeft * (bottomRightX - topLeft.X));\r\n\t\t\t\tvar estAlignmentY = Math.floor (topLeft.Y + correctionToTopLeft * (bottomRightY - topLeft.Y));\r\n\t\t\t\t\r\n\t\t\t\t// Kind of arbitrary -- expand search radius before giving up\r\n\t\t\t\tfor (var i = 4; i <= 16; i <<= 1)\r\n\t\t\t\t{\r\n\t\t\t\t\t//try\r\n\t\t\t\t\t//{\r\n\t\t\t\t\t\talignmentPattern = this.findAlignmentInRegion(moduleSize, estAlignmentX, estAlignmentY, i);\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t//}\r\n\t\t\t\t\t//catch (re)\r\n\t\t\t\t\t//{\r\n\t\t\t\t\t\t// try next round\r\n\t\t\t\t\t//}\r\n\t\t\t\t}\r\n\t\t\t\t// If we didn't find alignment pattern... well try anyway without it\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tvar transform = this.createTransform(topLeft, topRight, bottomLeft, alignmentPattern, dimension);\r\n\t\t\t\r\n\t\t\tvar bits = this.sampleGrid(this.image, transform, dimension);\r\n\t\t\t\r\n\t\t\tvar points;\r\n\t\t\tif (alignmentPattern == null)\r\n\t\t\t{\r\n\t\t\t\tpoints = new Array(bottomLeft, topLeft, topRight);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tpoints = new Array(bottomLeft, topLeft, topRight, alignmentPattern);\r\n\t\t\t}\r\n\t\t\treturn new DetectorResult(bits, points);\r\n\t\t}\r\n\t\t\r\n\r\n\t\r\n\tthis.detect=function()\r\n\t{\r\n\t\tvar info = new FinderPatternFinder().findFinderPattern(this.image);\r\n\t\t\t\r\n\t\treturn this.processFinderPatternInfo(info); \r\n\t}\r\n}","/*\n Ported to JavaScript by Lazar Laszlo 2011\n\n [email protected], www.lazarsoft.info\n\n*/\n\n/*\n*\n* Copyright 2007 ZXing authors\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n\nvar FORMAT_INFO_MASK_QR = 0x5412;\nvar FORMAT_INFO_DECODE_LOOKUP = new Array(new Array(0x5412, 0x00), new Array(0x5125, 0x01), new Array(0x5E7C, 0x02), new Array(0x5B4B, 0x03), new Array(0x45F9, 0x04), new Array(0x40CE, 0x05), new Array(0x4F97, 0x06), new Array(0x4AA0, 0x07), new Array(0x77C4, 0x08), new Array(0x72F3, 0x09), new Array(0x7DAA, 0x0A), new Array(0x789D, 0x0B), new Array(0x662F, 0x0C), new Array(0x6318, 0x0D), new Array(0x6C41, 0x0E), new Array(0x6976, 0x0F), new Array(0x1689, 0x10), new Array(0x13BE, 0x11), new Array(0x1CE7, 0x12), new Array(0x19D0, 0x13), new Array(0x0762, 0x14), new Array(0x0255, 0x15), new Array(0x0D0C, 0x16), new Array(0x083B, 0x17), new Array(0x355F, 0x18), new Array(0x3068, 0x19), new Array(0x3F31, 0x1A), new Array(0x3A06, 0x1B), new Array(0x24B4, 0x1C), new Array(0x2183, 0x1D), new Array(0x2EDA, 0x1E), new Array(0x2BED, 0x1F));\nvar BITS_SET_IN_HALF_BYTE = new Array(0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4);\n\n\nfunction FormatInformation(formatInfo)\n{\n\tthis.errorCorrectionLevel = ErrorCorrectionLevel.forBits((formatInfo >> 3) & 0x03);\n\tthis.dataMask = (formatInfo & 0x07);\n\n Object.defineProperties(this, {\n 'ErrorCorrectionLevel': {\n get: function () {\n return this.errorCorrectionLevel;\n }\n },\n\n 'DataMask': {\n get: function () {\n return this.dataMask;\n }\n }\n });\n\n\tthis.GetHashCode=function()\n\t{\n\t\treturn (this.errorCorrectionLevel.ordinal() << 3) | dataMask;\n\t}\n\tthis.Equals=function( o)\n\t{\n\t\tvar other = o;\n\t\treturn this.errorCorrectionLevel == other.errorCorrectionLevel && this.dataMask == other.dataMask;\n\t}\n}\n\nFormatInformation.numBitsDiffering=function( a, b)\n{\n\ta ^= b; // a now has a 1 bit exactly where its bit differs with b's\n\t// Count bits set quickly with a series of lookups:\n\treturn BITS_SET_IN_HALF_BYTE[a & 0x0F] + BITS_SET_IN_HALF_BYTE[(URShift(a, 4) & 0x0F)] + BITS_SET_IN_HALF_BYTE[(URShift(a, 8) & 0x0F)] + BITS_SET_IN_HALF_BYTE[(URShift(a, 12) & 0x0F)] + BITS_SET_IN_HALF_BYTE[(URShift(a, 16) & 0x0F)] + BITS_SET_IN_HALF_BYTE[(URShift(a, 20) & 0x0F)] + BITS_SET_IN_HALF_BYTE[(URShift(a, 24) & 0x0F)] + BITS_SET_IN_HALF_BYTE[(URShift(a, 28) & 0x0F)];\n}\n\nFormatInformation.decodeFormatInformation=function( maskedFormatInfo)\n{\n\tvar formatInfo = FormatInformation.doDecodeFormatInformation(maskedFormatInfo);\n\tif (formatInfo != null)\n\t{\n\t\treturn formatInfo;\n\t}\n\t// Should return null, but, some QR codes apparently\n\t// do not mask this info. Try again by actually masking the pattern\n\t// first\n\treturn FormatInformation.doDecodeFormatInformation(maskedFormatInfo ^ FORMAT_INFO_MASK_QR);\n}\nFormatInformation.doDecodeFormatInformation=function( maskedFormatInfo)\n{\n\t// Find the int in FORMAT_INFO_DECODE_LOOKUP with fewest bits differing\n\tvar bestDifference = 0xffffffff;\n\tvar bestFormatInfo = 0;\n\tfor (var i = 0; i < FORMAT_INFO_DECODE_LOOKUP.length; i++)\n\t{\n\t\tvar decodeInfo = FORMAT_INFO_DECODE_LOOKUP[i];\n\t\tvar targetInfo = decodeInfo[0];\n\t\tif (targetInfo == maskedFormatInfo)\n\t\t{\n\t\t\t// Found an exact match\n\t\t\treturn new FormatInformation(decodeInfo[1]);\n\t\t}\n\t\tvar bitsDifference = this.numBitsDiffering(maskedFormatInfo, targetInfo);\n\t\tif (bitsDifference < bestDifference)\n\t\t{\n\t\t\tbestFormatInfo = decodeInfo[1];\n\t\t\tbestDifference = bitsDifference;\n\t\t}\n\t}\n\t// Hamming distance of the 32 masked codes is 7, by construction, so <= 3 bits\n\t// differing means we found a match\n\tif (bestDifference <= 3)\n\t{\n\t\treturn new FormatInformation(bestFormatInfo);\n\t}\n\treturn null;\n}\n\n\n","/*\n Ported to JavaScript by Lazar Laszlo 2011\n\n [email protected], www.lazarsoft.info\n\n*/\n\n/*\n*\n* Copyright 2007 ZXing authors\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n\nfunction ErrorCorrectionLevel(ordinal, bits, name)\n{\n\tthis.ordinal_Renamed_Field = ordinal;\n\tthis.bits = bits;\n\tthis.name = name;\n\n Object.defineProperties(this, {\n 'Bits': {\n get: function () {\n return this.bits;\n }\n },\n\n 'Name': {\n get: function () {\n return this.name;\n }\n }\n });\n\n\tthis.ordinal=function() {\n\t\treturn this.ordinal_Renamed_Field;\n\t}\n}\n\nErrorCorrectionLevel.forBits=function( bits)\n{\n\tif (bits < 0 || bits >= FOR_BITS.length) {\n\t\tthrow \"ArgumentException\";\n\t}\n\n\treturn FOR_BITS[bits];\n}\n\nvar L = new ErrorCorrectionLevel(0, 0x01, \"L\");\nvar M = new ErrorCorrectionLevel(1, 0x00, \"M\");\nvar Q = new ErrorCorrectionLevel(2, 0x03, \"Q\");\nvar H = new ErrorCorrectionLevel(3, 0x02, \"H\");\nvar FOR_BITS = new Array( M, L, H, Q);\n","/*\n Ported to JavaScript by Lazar Laszlo 2011\n\n [email protected], www.lazarsoft.info\n\n*/\n\n/*\n*\n* Copyright 2007 ZXing authors\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n\nfunction BitMatrix( width, height)\n{\n\tif(!height)\n\t\theight=width;\n\tif (width < 1 || height < 1)\n\t{\n\t\tthrow \"Both dimensions must be greater than 0\";\n\t}\n\tthis.width = width;\n\tthis.height = height;\n\tvar rowSize = width >> 5;\n\tif ((width & 0x1f) != 0) {\n\t\trowSize++;\n\t}\n\n\tthis.rowSize = rowSize;\n\tthis.bits = new Array(rowSize * height);\n\n\tfor(var i=0;i<this.bits.length;i++)\n\t\tthis.bits[i]=0;\n\n Object.defineProperties(this, {\n 'Width': {\n get: function () {\n return this.width;\n }\n },\n\n 'Height': {\n get: function () {\n return this.height;\n }\n },\n\n 'Dimension': {\n get: function () {\n if (this.width != this.height) {\n throw \"Can't call getDimension() on a non-square matrix\";\n }\n\n return this.width;\n }\n }\n });\n\n\tthis.get_Renamed=function( x, y)\n\t\t{\n\t\t\tvar offset = y * this.rowSize + (x >> 5);\n\t\t\treturn ((URShift(this.bits[offset], (x & 0x1f))) & 1) != 0;\n\t\t}\n\tthis.set_Renamed=function( x, y)\n\t\t{\n\t\t\tvar offset = y * this.rowSize + (x >> 5);\n\t\t\tthis.bits[offset] |= 1 << (x & 0x1f);\n\t\t}\n\tthis.flip=function( x, y)\n\t\t{\n\t\t\tvar offset = y * this.rowSize + (x >> 5);\n\t\t\tthis.bits[offset] ^= 1 << (x & 0x1f);\n\t\t}\n\tthis.clear=function()\n\t\t{\n\t\t\tvar max = this.bits.length;\n\t\t\tfor (var i = 0; i < max; i++)\n\t\t\t{\n\t\t\t\tthis.bits[i] = 0;\n\t\t\t}\n\t\t}\n\tthis.setRegion=function( left, top, width, height)\n\t\t{\n\t\t\tif (top < 0 || left < 0)\n\t\t\t{\n\t\t\t\tthrow \"Left and top must be nonnegative\";\n\t\t\t}\n\t\t\tif (height < 1 || width < 1)\n\t\t\t{\n\t\t\t\tthrow \"Height and width must be at least 1\";\n\t\t\t}\n\t\t\tvar right = left + width;\n\t\t\tvar bottom = top + height;\n\t\t\tif (bottom > this.height || right > this.width)\n\t\t\t{\n\t\t\t\tthrow \"The region must fit inside the matrix\";\n\t\t\t}\n\t\t\tfor (var y = top; y < bottom; y++)\n\t\t\t{\n\t\t\t\tvar offset = y * this.rowSize;\n\t\t\t\tfor (var x = left; x < right; x++)\n\t\t\t\t{\n\t\t\t\t\tthis.bits[offset + (x >> 5)] |= 1 << (x & 0x1f);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n}\n","/*\n Ported to JavaScript by Lazar Laszlo 2011\n\n [email protected], www.lazarsoft.info\n\n*/\n\n/*\n*\n* Copyright 2007 ZXing authors\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n\nfunction DataBlock(numDataCodewords, codewords)\n{\n\tthis.numDataCodewords = numDataCodewords;\n\tthis.codewords = codewords;\n\n Object.defineProperties(this, {\n 'NumDataCodewords': {\n get: function () {\n return this.numDataCodewords;\n }\n },\n\n 'Codewords': {\n get: function () {\n return this.codewords;\n }\n }\n });\n}\n\nDataBlock.getDataBlocks=function(rawCodewords, version, ecLevel)\n{\n\n\tif (rawCodewords.length != version.TotalCodewords)\n\t{\n\t\tthrow \"ArgumentException\";\n\t}\n\n\t// Figure out the number and size of data blocks used by this version and\n\t// error correction level\n\tvar ecBlocks = version.getECBlocksForLevel(ecLevel);\n\n\t// First count the total number of data blocks\n\tvar totalBlocks = 0;\n\tvar ecBlockArray = ecBlocks.getECBlocks();\n\tfor (var i = 0; i < ecBlockArray.length; i++)\n\t{\n\t\ttotalBlocks += ecBlockArray[i].Count;\n\t}\n\n\t// Now establish DataBlocks of the appropriate size and number of data codewords\n\tvar result = new Array(totalBlocks);\n\tvar numResultBlocks = 0;\n\tfor (var j = 0; j < ecBlockArray.length; j++)\n\t{\n\t\tvar ecBlock = ecBlockArray[j];\n\t\tfor (var i = 0; i < ecBlock.Count; i++)\n\t\t{\n\t\t\tvar numDataCodewords = ecBlock.DataCodewords;\n\t\t\tvar numBlockCodewords = ecBlocks.ECCodewordsPerBlock + numDataCodewords;\n\t\t\tresult[numResultBlocks++] = new DataBlock(numDataCodewords, new Array(numBlockCodewords));\n\t\t}\n\t}\n\n\t// All blocks have the same amount of data, except that the last n\n\t// (where n may be 0) have 1 more byte. Figure out where these start.\n\tvar shorterBlocksTotalCodewords = result[0].codewords.length;\n\tvar longerBlocksStartAt = result.length - 1;\n\twhile (longerBlocksStartAt >= 0)\n\t{\n\t\tvar numCodewords = result[longerBlocksStartAt].codewords.length;\n\t\tif (numCodewords == shorterBlocksTotalCodewords)\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\tlongerBlocksStartAt--;\n\t}\n\tlongerBlocksStartAt++;\n\n\tvar shorterBlocksNumDataCodewords = shorterBlocksTotalCodewords - ecBlocks.ECCodewordsPerBlock;\n\t// The last elements of result may be 1 element longer;\n\t// first fill out as many elements as all of them have\n\tvar rawCodewordsOffset = 0;\n\tfor (var i = 0; i < shorterBlocksNumDataCodewords; i++)\n\t{\n\t\tfor (var j = 0; j < numResultBlocks; j++)\n\t\t{\n\t\t\tresult[j].codewords[i] = rawCodewords[rawCodewordsOffset++];\n\t\t}\n\t}\n\t// Fill out the last data block in the longer ones\n\tfor (var j = longerBlocksStartAt; j < numResultBlocks; j++)\n\t{\n\t\tresult[j].codewords[shorterBlocksNumDataCodewords] = rawCodewords[rawCodewordsOffset++];\n\t}\n\t// Now add in error correction blocks\n\tvar max = result[0].codewords.length;\n\tfor (var i = shorterBlocksNumDataCodewords; i < max; i++)\n\t{\n\t\tfor (var j = 0; j < numResultBlocks; j++)\n\t\t{\n\t\t\tvar iOffset = j < longerBlocksStartAt?i:i + 1;\n\t\t\tresult[j].codewords[iOffset] = rawCodewords[rawCodewordsOffset++];\n\t\t}\n\t}\n\treturn result;\n}\n","/*\r\n Ported to JavaScript by Lazar Laszlo 2011 \r\n \r\n [email protected], www.lazarsoft.info\r\n \r\n*/\r\n\r\n/*\r\n*\r\n* Copyright 2007 ZXing authors\r\n*\r\n* Licensed under the Apache License, Version 2.0 (the \"License\");\r\n* you may not use this file except in compliance with the License.\r\n* You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing, software\r\n* distributed under the License is distributed on an \"AS IS\" BASIS,\r\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n* See the License for the specific language governing permissions and\r\n* limitations under the License.\r\n*/\r\n\r\n\r\nfunction BitMatrixParser(bitMatrix)\r\n{\r\n\tvar dimension = bitMatrix.Dimension;\r\n\tif (dimension < 21 || (dimension & 0x03) != 1)\r\n\t{\r\n\t\tthrow \"Error BitMatrixParser\";\r\n\t}\r\n\tthis.bitMatrix = bitMatrix;\r\n\tthis.parsedVersion = null;\r\n\tthis.parsedFormatInfo = null;\r\n\t\r\n\tthis.copyBit=function( i, j, versionBits)\r\n\t{\r\n\t\treturn this.bitMatrix.get_Renamed(i, j)?(versionBits << 1) | 0x1:versionBits << 1;\r\n\t}\r\n\t\r\n\tthis.readFormatInformation=function()\r\n\t{\r\n\t\t\tif (this.parsedFormatInfo != null)\r\n\t\t\t{\r\n\t\t\t\treturn this.parsedFormatInfo;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Read top-left format info bits\r\n\t\t\tvar formatInfoBits = 0;\r\n\t\t\tfor (var i = 0; i < 6; i++)\r\n\t\t\t{\r\n\t\t\t\tformatInfoBits = this.copyBit(i, 8, formatInfoBits);\r\n\t\t\t}\r\n\t\t\t// .. and skip a bit in the timing pattern ...\r\n\t\t\tformatInfoBits = this.copyBit(7, 8, formatInfoBits);\r\n\t\t\tformatInfoBits = this.copyBit(8, 8, formatInfoBits);\r\n\t\t\tformatInfoBits = this.copyBit(8, 7, formatInfoBits);\r\n\t\t\t// .. and skip a bit in the timing pattern ...\r\n\t\t\tfor (var j = 5; j >= 0; j--)\r\n\t\t\t{\r\n\t\t\t\tformatInfoBits = this.copyBit(8, j, formatInfoBits);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tthis.parsedFormatInfo = FormatInformation.decodeFormatInformation(formatInfoBits);\r\n\t\t\tif (this.parsedFormatInfo != null)\r\n\t\t\t{\r\n\t\t\t\treturn this.parsedFormatInfo;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Hmm, failed. Try the top-right/bottom-left pattern\r\n\t\t\tvar dimension = this.bitMatrix.Dimension;\r\n\t\t\tformatInfoBits = 0;\r\n\t\t\tvar iMin = dimension - 8;\r\n\t\t\tfor (var i = dimension - 1; i >= iMin; i--)\r\n\t\t\t{\r\n\t\t\t\tformatInfoBits = this.copyBit(i, 8, formatInfoBits);\r\n\t\t\t}\r\n\t\t\tfor (var j = dimension - 7; j < dimension; j++)\r\n\t\t\t{\r\n\t\t\t\tformatInfoBits = this.copyBit(8, j, formatInfoBits);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tthis.parsedFormatInfo = FormatInformation.decodeFormatInformation(formatInfoBits);\r\n\t\t\tif (this.parsedFormatInfo != null)\r\n\t\t\t{\r\n\t\t\t\treturn this.parsedFormatInfo;\r\n\t\t\t}\r\n\t\t\tthrow \"Error readFormatInformation\";\t\r\n\t}\r\n\tthis.readVersion=function()\r\n\t\t{\r\n\t\t\t\r\n\t\t\tif (this.parsedVersion != null)\r\n\t\t\t{\r\n\t\t\t\treturn this.parsedVersion;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tvar dimension = this.bitMatrix.Dimension;\r\n\t\t\t\r\n\t\t\tvar provisionalVersion = (dimension - 17) >> 2;\r\n\t\t\tif (provisionalVersion <= 6)\r\n\t\t\t{\r\n\t\t\t\treturn Version.getVersionForNumber(provisionalVersion);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Read top-right version info: 3 wide by 6 tall\r\n\t\t\tvar versionBits = 0;\r\n\t\t\tvar ijMin = dimension - 11;\r\n\t\t\tfor (var j = 5; j >= 0; j--)\r\n\t\t\t{\r\n\t\t\t\tfor (var i = dimension - 9; i >= ijMin; i--)\r\n\t\t\t\t{\r\n\t\t\t\t\tversionBits = this.copyBit(i, j, versionBits);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tthis.parsedVersion = Version.decodeVersionInformation(versionBits);\r\n\t\t\tif (this.parsedVersion != null && this.parsedVersion.DimensionForVersion == dimension)\r\n\t\t\t{\r\n\t\t\t\treturn this.parsedVersion;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Hmm, failed. Try bottom left: 6 wide by 3 tall\r\n\t\t\tversionBits = 0;\r\n\t\t\tfor (var i = 5; i >= 0; i--)\r\n\t\t\t{\r\n\t\t\t\tfor (var j = dimension - 9; j >= ijMin; j--)\r\n\t\t\t\t{\r\n\t\t\t\t\tversionBits = this.copyBit(i, j, versionBits);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tthis.parsedVersion = Version.decodeVersionInformation(versionBits);\r\n\t\t\tif (this.parsedVersion != null && this.parsedVersion.DimensionForVersion == dimension)\r\n\t\t\t{\r\n\t\t\t\treturn this.parsedVersion;\r\n\t\t\t}\r\n\t\t\tthrow \"Error readVersion\";\r\n\t\t}\r\n\tthis.readCodewords=function()\r\n\t\t{\r\n\t\t\t\r\n\t\t\tvar formatInfo = this.readFormatInformation();\r\n\t\t\tvar version = this.readVersion();\r\n\t\t\t\r\n\t\t\t// Get the data mask for the format used in this QR Code. This will exclude\r\n\t\t\t// some bits from reading as we wind through the bit matrix.\r\n\t\t\tvar dataMask = DataMask.forReference( formatInfo.DataMask);\r\n\t\t\tvar dimension = this.bitMatrix.Dimension;\r\n\t\t\tdataMask.unmaskBitMatrix(this.bitMatrix, dimension);\r\n\t\t\t\r\n\t\t\tvar functionPattern = version.buildFunctionPattern();\r\n\t\t\t\r\n\t\t\tvar readingUp = true;\r\n\t\t\tvar result = new Array(version.TotalCodewords);\r\n\t\t\tvar resultOffset = 0;\r\n\t\t\tvar currentByte = 0;\r\n\t\t\tvar bitsRead = 0;\r\n\t\t\t// Read columns in pairs, from right to left\r\n\t\t\tfor (var j = dimension - 1; j > 0; j -= 2)\r\n\t\t\t{\r\n\t\t\t\tif (j == 6)\r\n\t\t\t\t{\r\n\t\t\t\t\t// Skip whole column with vertical alignment pattern;\r\n\t\t\t\t\t// saves time and makes the other code proceed more cleanly\r\n\t\t\t\t\tj--;\r\n\t\t\t\t}\r\n\t\t\t\t// Read alternatingly from bottom to top then top to bottom\r\n\t\t\t\tfor (var count = 0; count < dimension; count++)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar i = readingUp?dimension - 1 - count:count;\r\n\t\t\t\t\tfor (var col = 0; col < 2; col++)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t// Ignore bits covered by the function pattern\r\n\t\t\t\t\t\tif (!functionPattern.get_Renamed(j - col, i))\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t// Read a bit\r\n\t\t\t\t\t\t\tbitsRead++;\r\n\t\t\t\t\t\t\tcurrentByte <<= 1;\r\n\t\t\t\t\t\t\tif (this.bitMatrix.get_Renamed(j - col, i))\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tcurrentByte |= 1;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t// If we've made a whole byte, save it off\r\n\t\t\t\t\t\t\tif (bitsRead == 8)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tresult[resultOffset++] = currentByte;\r\n\t\t\t\t\t\t\t\tbitsRead = 0;\r\n\t\t\t\t\t\t\t\tcurrentByte = 0;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\treadingUp ^= true; // readingUp = !readingUp; // switch directions\r\n\t\t\t}\r\n\t\t\tif (resultOffset != version.TotalCodewords)\r\n\t\t\t{\r\n\t\t\t\tthrow \"Error readCodewords\";\r\n\t\t\t}\r\n\t\t\treturn result;\r\n\t\t}\r\n}","/*\r\n Ported to JavaScript by Lazar Laszlo 2011 \r\n \r\n [email protected], www.lazarsoft.info\r\n \r\n*/\r\n\r\n/*\r\n*\r\n* Copyright 2007 ZXing authors\r\n*\r\n* Licensed under the Apache License, Version 2.0 (the \"License\");\r\n* you may not use this file except in compliance with the License.\r\n* You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing, software\r\n* distributed under the License is distributed on an \"AS IS\" BASIS,\r\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n* See the License for the specific language governing permissions and\r\n* limitations under the License.\r\n*/\r\n\r\n\r\nDataMask = {};\r\n\r\nDataMask.forReference = function(reference)\r\n{\r\n\tif (reference < 0 || reference > 7)\r\n\t{\r\n\t\tthrow \"System.ArgumentException\";\r\n\t}\r\n\treturn DataMask.DATA_MASKS[reference];\r\n}\r\n\r\nfunction DataMask000()\r\n{\r\n\tthis.unmaskBitMatrix=function(bits, dimension)\r\n\t{\r\n\t\tfor (var i = 0; i < dimension; i++)\r\n\t\t{\r\n\t\t\tfor (var j = 0; j < dimension; j++)\r\n\t\t\t{\r\n\t\t\t\tif (this.isMasked(i, j))\r\n\t\t\t\t{\r\n\t\t\t\t\tbits.flip(j, i);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tthis.isMasked=function( i, j)\r\n\t{\r\n\t\treturn ((i + j) & 0x01) == 0;\r\n\t}\r\n}\r\n\r\nfunction DataMask001()\r\n{\r\n\tthis.unmaskBitMatrix=function(bits, dimension)\r\n\t{\r\n\t\tfor (var i = 0; i < dimension; i++)\r\n\t\t{\r\n\t\t\tfor (var j = 0; j < dimension; j++)\r\n\t\t\t{\r\n\t\t\t\tif (this.isMasked(i, j))\r\n\t\t\t\t{\r\n\t\t\t\t\tbits.flip(j, i);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tthis.isMasked=function( i, j)\r\n\t{\r\n\t\treturn (i & 0x01) == 0;\r\n\t}\r\n}\r\n\r\nfunction DataMask010()\r\n{\r\n\tthis.unmaskBitMatrix=function(bits, dimension)\r\n\t{\r\n\t\tfor (var i = 0; i < dimension; i++)\r\n\t\t{\r\n\t\t\tfor (var j = 0; j < dimension; j++)\r\n\t\t\t{\r\n\t\t\t\tif (this.isMasked(i, j))\r\n\t\t\t\t{\r\n\t\t\t\t\tbits.flip(j, i);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tthis.isMasked=function( i, j)\r\n\t{\r\n\t\treturn j % 3 == 0;\r\n\t}\r\n}\r\n\r\nfunction DataMask011()\r\n{\r\n\tthis.unmaskBitMatrix=function(bits, dimension)\r\n\t{\r\n\t\tfor (var i = 0; i < dimension; i++)\r\n\t\t{\r\n\t\t\tfor (var j = 0; j < dimension; j++)\r\n\t\t\t{\r\n\t\t\t\tif (this.isMasked(i, j))\r\n\t\t\t\t{\r\n\t\t\t\t\tbits.flip(j, i);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tthis.isMasked=function( i, j)\r\n\t{\r\n\t\treturn (i + j) % 3 == 0;\r\n\t}\r\n}\r\n\r\nfunction DataMask100()\r\n{\r\n\tthis.unmaskBitMatrix=function(bits, dimension)\r\n\t{\r\n\t\tfor (var i = 0; i < dimension; i++)\r\n\t\t{\r\n\t\t\tfor (var j = 0; j < dimension; j++)\r\n\t\t\t{\r\n\t\t\t\tif (this.isMasked(i, j))\r\n\t\t\t\t{\r\n\t\t\t\t\tbits.flip(j, i);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tthis.isMasked=function( i, j)\r\n\t{\r\n\t\treturn (((URShift(i, 1)) + (j / 3)) & 0x01) == 0;\r\n\t}\r\n}\r\n\r\nfunction DataMask101()\r\n{\r\n\tthis.unmaskBitMatrix=function(bits, dimension)\r\n\t{\r\n\t\tfor (var i = 0; i < dimension; i++)\r\n\t\t{\r\n\t\t\tfor (var j = 0; j < dimension; j++)\r\n\t\t\t{\r\n\t\t\t\tif (this.isMasked(i, j))\r\n\t\t\t\t{\r\n\t\t\t\t\tbits.flip(j, i);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tthis.isMasked=function( i, j)\r\n\t{\r\n\t\tvar temp = i * j;\r\n\t\treturn (temp & 0x01) + (temp % 3) == 0;\r\n\t}\r\n}\r\n\r\nfunction DataMask110()\r\n{\r\n\tthis.unmaskBitMatrix=function(bits, dimension)\r\n\t{\r\n\t\tfor (var i = 0; i < dimension; i++)\r\n\t\t{\r\n\t\t\tfor (var j = 0; j < dimension; j++)\r\n\t\t\t{\r\n\t\t\t\tif (this.isMasked(i, j))\r\n\t\t\t\t{\r\n\t\t\t\t\tbits.flip(j, i);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tthis.isMasked=function( i, j)\r\n\t{\r\n\t\tvar temp = i * j;\r\n\t\treturn (((temp & 0x01) + (temp % 3)) & 0x01) == 0;\r\n\t}\r\n}\r\nfunction DataMask111()\r\n{\r\n\tthis.unmaskBitMatrix=function(bits, dimension)\r\n\t{\r\n\t\tfor (var i = 0; i < dimension; i++)\r\n\t\t{\r\n\t\t\tfor (var j = 0; j < dimension; j++)\r\n\t\t\t{\r\n\t\t\t\tif (this.isMasked(i, j))\r\n\t\t\t\t{\r\n\t\t\t\t\tbits.flip(j, i);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tthis.isMasked=function( i, j)\r\n\t{\r\n\t\treturn ((((i + j) & 0x01) + ((i * j) % 3)) & 0x01) == 0;\r\n\t}\r\n}\r\n\r\nDataMask.DATA_MASKS = new Array(new DataMask000(), new DataMask001(), new DataMask010(), new DataMask011(), new DataMask100(), new DataMask101(), new DataMask110(), new DataMask111());\r\n\r\n","/*\r\n Ported to JavaScript by Lazar Laszlo 2011 \r\n \r\n [email protected], www.lazarsoft.info\r\n \r\n*/\r\n\r\n/*\r\n*\r\n* Copyright 2007 ZXing authors\r\n*\r\n* Licensed under the Apache License, Version 2.0 (the \"License\");\r\n* you may not use this file except in compliance with the License.\r\n* You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing, software\r\n* distributed under the License is distributed on an \"AS IS\" BASIS,\r\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n* See the License for the specific language governing permissions and\r\n* limitations under the License.\r\n*/\r\n\r\n\r\nfunction ReedSolomonDecoder(field)\r\n{\r\n\tthis.field = field;\r\n\tthis.decode=function(received, twoS)\r\n\t{\r\n\t\t\tvar poly = new GF256Poly(this.field, received);\r\n\t\t\tvar syndromeCoefficients = new Array(twoS);\r\n\t\t\tfor(var i=0;i<syndromeCoefficients.length;i++)syndromeCoefficients[i]=0;\r\n\t\t\tvar dataMatrix = false;//this.field.Equals(GF256.DATA_MATRIX_FIELD);\r\n\t\t\tvar noError = true;\r\n\t\t\tfor (var i = 0; i < twoS; i++)\r\n\t\t\t{\r\n\t\t\t\t// Thanks to sanfordsquires for this fix:\r\n\t\t\t\tvar eval = poly.evaluateAt(this.field.exp(dataMatrix?i + 1:i));\r\n\t\t\t\tsyndromeCoefficients[syndromeCoefficients.length - 1 - i] = eval;\r\n\t\t\t\tif (eval != 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tnoError = false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif (noError)\r\n\t\t\t{\r\n\t\t\t\treturn ;\r\n\t\t\t}\r\n\t\t\tvar syndrome = new GF256Poly(this.field, syndromeCoefficients);\r\n\t\t\tvar sigmaOmega = this.runEuclideanAlgorithm(this.field.buildMonomial(twoS, 1), syndrome, twoS);\r\n\t\t\tvar sigma = sigmaOmega[0];\r\n\t\t\tvar omega = sigmaOmega[1];\r\n\t\t\tvar errorLocations = this.findErrorLocations(sigma);\r\n\t\t\tvar errorMagnitudes = this.findErrorMagnitudes(omega, errorLocations, dataMatrix);\r\n\t\t\tfor (var i = 0; i < errorLocations.length; i++)\r\n\t\t\t{\r\n\t\t\t\tvar position = received.length - 1 - this.field.log(errorLocations[i]);\r\n\t\t\t\tif (position < 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tthrow \"ReedSolomonException Bad error location\";\r\n\t\t\t\t}\r\n\t\t\t\treceived[position] = GF256.addOrSubtract(received[position], errorMagnitudes[i]);\r\n\t\t\t}\r\n\t}\r\n\t\r\n\tthis.runEuclideanAlgorithm=function( a, b, R)\r\n\t\t{\r\n\t\t\t// Assume a's degree is >= b's\r\n\t\t\tif (a.Degree < b.Degree)\r\n\t\t\t{\r\n\t\t\t\tvar temp = a;\r\n\t\t\t\ta = b;\r\n\t\t\t\tb = temp;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tvar rLast = a;\r\n\t\t\tvar r = b;\r\n\t\t\tvar sLast = this.field.One;\r\n\t\t\tvar s = this.field.Zero;\r\n\t\t\tvar tLast = this.field.Zero;\r\n\t\t\tvar t = this.field.One;\r\n\t\t\t\r\n\t\t\t// Run Euclidean algorithm until r's degree is less than R/2\r\n\t\t\twhile (r.Degree >= Math.floor(R / 2))\r\n\t\t\t{\r\n\t\t\t\tvar rLastLast = rLast;\r\n\t\t\t\tvar sLastLast = sLast;\r\n\t\t\t\tvar tLastLast = tLast;\r\n\t\t\t\trLast = r;\r\n\t\t\t\tsLast = s;\r\n\t\t\t\ttLast = t;\r\n\t\t\t\t\r\n\t\t\t\t// Divide rLastLast by rLast, with quotient in q and remainder in r\r\n\t\t\t\tif (rLast.Zero)\r\n\t\t\t\t{\r\n\t\t\t\t\t// Oops, Euclidean algorithm already terminated?\r\n\t\t\t\t\tthrow \"r_{i-1} was zero\";\r\n\t\t\t\t}\r\n\t\t\t\tr = rLastLast;\r\n\t\t\t\tvar q = this.field.Zero;\r\n\t\t\t\tvar denominatorLeadingTerm = rLast.getCoefficient(rLast.Degree);\r\n\t\t\t\tvar dltInverse = this.field.inverse(denominatorLeadingTerm);\r\n\t\t\t\twhile (r.Degree >= rLast.Degree && !r.Zero)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar degreeDiff = r.Degree - rLast.Degree;\r\n\t\t\t\t\tvar scale = this.field.multiply(r.getCoefficient(r.Degree), dltInverse);\r\n\t\t\t\t\tq = q.addOrSubtract(this.field.buildMonomial(degreeDiff, scale));\r\n\t\t\t\t\tr = r.addOrSubtract(rLast.multiplyByMonomial(degreeDiff, scale));\r\n\t\t\t\t\t//r.EXE();\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\ts = q.multiply1(sLast).addOrSubtract(sLastLast);\r\n\t\t\t\tt = q.multiply1(tLast).addOrSubtract(tLastLast);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tvar sigmaTildeAtZero = t.getCoefficient(0);\r\n\t\t\tif (sigmaTildeAtZero == 0)\r\n\t\t\t{\r\n\t\t\t\tthrow \"ReedSolomonException sigmaTilde(0) was zero\";\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tvar inverse = this.field.inverse(sigmaTildeAtZero);\r\n\t\t\tvar sigma = t.multiply2(inverse);\r\n\t\t\tvar omega = r.multiply2(inverse);\r\n\t\t\treturn new Array(sigma, omega);\r\n\t\t}\r\n\tthis.findErrorLocations=function( errorLocator)\r\n\t\t{\r\n\t\t\t// This is a direct application of Chien's search\r\n\t\t\tvar numErrors = errorLocator.Degree;\r\n\t\t\tif (numErrors == 1)\r\n\t\t\t{\r\n\t\t\t\t// shortcut\r\n\t\t\t\treturn new Array(errorLocator.getCoefficient(1));\r\n\t\t\t}\r\n\t\t\tvar result = new Array(numErrors);\r\n\t\t\tvar e = 0;\r\n\t\t\tfor (var i = 1; i < 256 && e < numErrors; i++)\r\n\t\t\t{\r\n\t\t\t\tif (errorLocator.evaluateAt(i) == 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tresult[e] = this.field.inverse(i);\r\n\t\t\t\t\te++;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif (e != numErrors)\r\n\t\t\t{\r\n\t\t\t\tthrow \"Error locator degree does not match number of roots\";\r\n\t\t\t}\r\n\t\t\treturn result;\r\n\t\t}\r\n\tthis.findErrorMagnitudes=function( errorEvaluator, errorLocations, dataMatrix)\r\n\t\t{\r\n\t\t\t// This is directly applying Forney's Formula\r\n\t\t\tvar s = errorLocations.length;\r\n\t\t\tvar result = new Array(s);\r\n\t\t\tfor (var i = 0; i < s; i++)\r\n\t\t\t{\r\n\t\t\t\tvar xiInverse = this.field.inverse(errorLocations[i]);\r\n\t\t\t\tvar denominator = 1;\r\n\t\t\t\tfor (var j = 0; j < s; j++)\r\n\t\t\t\t{\r\n\t\t\t\t\tif (i != j)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tdenominator = this.field.multiply(denominator, GF256.addOrSubtract(1, this.field.multiply(errorLocations[j], xiInverse)));\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tresult[i] = this.field.multiply(errorEvaluator.evaluateAt(xiInverse), this.field.inverse(denominator));\r\n\t\t\t\t// Thanks to sanfordsquires for this fix:\r\n\t\t\t\tif (dataMatrix)\r\n\t\t\t\t{\r\n\t\t\t\t\tresult[i] = this.field.multiply(result[i], xiInverse);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn result;\r\n\t\t}\r\n}","/*\n Ported to JavaScript by Lazar Laszlo 2011\n\n [email protected], www.lazarsoft.info\n\n*/\n\n/*\n*\n* Copyright 2007 ZXing authors\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n\nfunction GF256Poly(field, coefficients)\n{\n\tif (coefficients == null || coefficients.length == 0)\n\t{\n\t\tthrow \"System.ArgumentException\";\n\t}\n\tthis.field = field;\n\tvar coefficientsLength = coefficients.length;\n\tif (coefficientsLength > 1 && coefficients[0] == 0)\n\t{\n\t\t// Leading term must be non-zero for anything except the constant polynomial \"0\"\n\t\tvar firstNonZero = 1;\n\t\twhile (firstNonZero < coefficientsLength && coefficients[firstNonZero] == 0)\n\t\t{\n\t\t\tfirstNonZero++;\n\t\t}\n\t\tif (firstNonZero == coefficientsLength)\n\t\t{\n\t\t\tthis.coefficients = field.Zero.coefficients;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tthis.coefficients = new Array(coefficientsLength - firstNonZero);\n\t\t\tfor(var i=0;i<this.coefficients.length;i++)this.coefficients[i]=0;\n\t\t\t//Array.Copy(coefficients, firstNonZero, this.coefficients, 0, this.coefficients.length);\n\t\t\tfor(var ci=0;ci<this.coefficients.length;ci++)this.coefficients[ci]=coefficients[firstNonZero+ci];\n\t\t}\n\t}\n\telse\n\t{\n\t\tthis.coefficients = coefficients;\n\t}\n\n Object.defineProperties(this, {\n \t\"Zero\": {\n get: function () {\n \t\treturn this.coefficients[0] == 0;\n }\n \t},\n\n \t\"Degree\": {\n get: function () {\n \t\treturn this.coefficients.length - 1;\n }\n \t},\n\n \t\"Coefficients\": {\n get: function () {\n \t\treturn this.coefficients;\n }\n \t}\n });\n\n\tthis.getCoefficient=function( degree)\n\t{\n\t\treturn this.coefficients[this.coefficients.length - 1 - degree];\n\t}\n\n\tthis.evaluateAt=function( a)\n\t{\n\t\tif (a == 0)\n\t\t{\n\t\t\t// Just return the x^0 coefficient\n\t\t\treturn this.getCoefficient(0);\n\t\t}\n\t\tvar size = this.coefficients.length;\n\t\tif (a == 1)\n\t\t{\n\t\t\t// Just the sum of the coefficients\n\t\t\tvar result = 0;\n\t\t\tfor (var i = 0; i < size; i++)\n\t\t\t{\n\t\t\t\tresult = GF256.addOrSubtract(result, this.coefficients[i]);\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\t\tvar result2 = this.coefficients[0];\n\t\tfor (var i = 1; i < size; i++)\n\t\t{\n\t\t\tresult2 = GF256.addOrSubtract(this.field.multiply(a, result2), this.coefficients[i]);\n\t\t}\n\t\treturn result2;\n\t}\n\n\tthis.addOrSubtract=function( other)\n\t\t{\n\t\t\tif (this.field != other.field)\n\t\t\t{\n\t\t\t\tthrow \"GF256Polys do not have same GF256 field\";\n\t\t\t}\n\t\t\tif (this.Zero)\n\t\t\t{\n\t\t\t\treturn other;\n\t\t\t}\n\t\t\tif (other.Zero)\n\t\t\t{\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tvar smallerCoefficients = this.coefficients;\n\t\t\tvar largerCoefficients = other.coefficients;\n\t\t\tif (smallerCoefficients.length > largerCoefficients.length)\n\t\t\t{\n\t\t\t\tvar temp = smallerCoefficients;\n\t\t\t\tsmallerCoefficients = largerCoefficients;\n\t\t\t\tlargerCoefficients = temp;\n\t\t\t}\n\t\t\tvar sumDiff = new Array(largerCoefficients.length);\n\t\t\tvar lengthDiff = largerCoefficients.length - smallerCoefficients.length;\n\t\t\t// Copy high-order terms only found in higher-degree polynomial's coefficients\n\t\t\t//Array.Copy(largerCoefficients, 0, sumDiff, 0, lengthDiff);\n\t\t\tfor(var ci=0;ci<lengthDiff;ci++)sumDiff[ci]=largerCoefficients[ci];\n\n\t\t\tfor (var i = lengthDiff; i < largerCoefficients.length; i++)\n\t\t\t{\n\t\t\t\tsumDiff[i] = GF256.addOrSubtract(smallerCoefficients[i - lengthDiff], largerCoefficients[i]);\n\t\t\t}\n\n\t\t\treturn new GF256Poly(field, sumDiff);\n\t}\n\tthis.multiply1=function( other)\n\t\t{\n\t\t\tif (this.field!=other.field)\n\t\t\t{\n\t\t\t\tthrow \"GF256Polys do not have same GF256 field\";\n\t\t\t}\n\t\t\tif (this.Zero || other.Zero)\n\t\t\t{\n\t\t\t\treturn this.field.Zero;\n\t\t\t}\n\t\t\tvar aCoefficients = this.coefficients;\n\t\t\tvar aLength = aCoefficients.length;\n\t\t\tvar bCoefficients = other.coefficients;\n\t\t\tvar bLength = bCoefficients.length;\n\t\t\tvar product = new Array(aLength + bLength - 1);\n\t\t\tfor (var i = 0; i < aLength; i++)\n\t\t\t{\n\t\t\t\tvar aCoeff = aCoefficients[i];\n\t\t\t\tfor (var j = 0; j < bLength; j++)\n\t\t\t\t{\n\t\t\t\t\tproduct[i + j] = GF256.addOrSubtract(product[i + j], this.field.multiply(aCoeff, bCoefficients[j]));\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn new GF256Poly(this.field, product);\n\t\t}\n\tthis.multiply2=function( scalar)\n\t\t{\n\t\t\tif (scalar == 0)\n\t\t\t{\n\t\t\t\treturn this.field.Zero;\n\t\t\t}\n\t\t\tif (scalar == 1)\n\t\t\t{\n\t\t\t\treturn this;\n\t\t\t}\n\t\t\tvar size = this.coefficients.length;\n\t\t\tvar product = new Array(size);\n\t\t\tfor (var i = 0; i < size; i++)\n\t\t\t{\n\t\t\t\tproduct[i] = this.field.multiply(this.coefficients[i], scalar);\n\t\t\t}\n\t\t\treturn new GF256Poly(this.field, product);\n\t\t}\n\tthis.multiplyByMonomial=function( degree, coefficient)\n\t\t{\n\t\t\tif (degree < 0)\n\t\t\t{\n\t\t\t\tthrow \"System.ArgumentException\";\n\t\t\t}\n\t\t\tif (coefficient == 0)\n\t\t\t{\n\t\t\t\treturn this.field.Zero;\n\t\t\t}\n\t\t\tvar size = this.coefficients.length;\n\t\t\tvar product = new Array(size + degree);\n\t\t\tfor(var i=0;i<product.length;i++)product[i]=0;\n\t\t\tfor (var i = 0; i < size; i++)\n\t\t\t{\n\t\t\t\tproduct[i] = this.field.multiply(this.coefficients[i], coefficient);\n\t\t\t}\n\t\t\treturn new GF256Poly(this.field, product);\n\t\t}\n\tthis.divide=function( other)\n\t\t{\n\t\t\tif (this.field!=other.field)\n\t\t\t{\n\t\t\t\tthrow \"GF256Polys do not have same GF256 field\";\n\t\t\t}\n\t\t\tif (other.Zero)\n\t\t\t{\n\t\t\t\tthrow \"Divide by 0\";\n\t\t\t}\n\n\t\t\tvar quotient = this.field.Zero;\n\t\t\tvar remainder = this;\n\n\t\t\tvar denominatorLeadingTerm = other.getCoefficient(other.Degree);\n\t\t\tvar inverseDenominatorLeadingTerm = this.field.inverse(denominatorLeadingTerm);\n\n\t\t\twhile (remainder.Degree >= other.Degree && !remainder.Zero)\n\t\t\t{\n\t\t\t\tvar degreeDifference = remainder.Degree - other.Degree;\n\t\t\t\tvar scale = this.field.multiply(remainder.getCoefficient(remainder.Degree), inverseDenominatorLeadingTerm);\n\t\t\t\tvar term = other.multiplyByMonomial(degreeDifference, scale);\n\t\t\t\tvar iterationQuotient = this.field.buildMonomial(degreeDifference, scale);\n\t\t\t\tquotient = quotient.addOrSubtract(iterationQuotient);\n\t\t\t\tremainder = remainder.addOrSubtract(term);\n\t\t\t}\n\n\t\t\treturn new Array(quotient, remainder);\n\t\t}\n}\n","/*\n Ported to JavaScript by Lazar Laszlo 2011\n\n [email protected], www.lazarsoft.info\n\n*/\n\n/*\n*\n* Copyright 2007 ZXing authors\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n\nfunction GF256( primitive)\n{\n\tthis.expTable = new Array(256);\n\tthis.logTable = new Array(256);\n\tvar x = 1;\n\tfor (var i = 0; i < 256; i++)\n\t{\n\t\tthis.expTable[i] = x;\n\t\tx <<= 1; // x = x * 2; we're assuming the generator alpha is 2\n\t\tif (x >= 0x100)\n\t\t{\n\t\t\tx ^= primitive;\n\t\t}\n\t}\n\tfor (var i = 0; i < 255; i++)\n\t{\n\t\tthis.logTable[this.expTable[i]] = i;\n\t}\n\t// logTable[0] == 0 but this should never be used\n\tvar at0=new Array(1);at0[0]=0;\n\tthis.zero = new GF256Poly(this, new Array(at0));\n\tvar at1=new Array(1);at1[0]=1;\n\tthis.one = new GF256Poly(this, new Array(at1));\n\n Object.defineProperties(this, {\n 'Zero': {\n get: function () {\n return this.zero;\n }\n },\n\n 'One': {\n get: function () {\n return this.one;\n }\n }\n });\n\n\tthis.buildMonomial=function( degree, coefficient)\n\t\t{\n\t\t\tif (degree < 0)\n\t\t\t{\n\t\t\t\tthrow \"System.ArgumentException\";\n\t\t\t}\n\t\t\tif (coefficient == 0)\n\t\t\t{\n\t\t\t\treturn zero;\n\t\t\t}\n\t\t\tvar coefficients = new Array(degree + 1);\n\t\t\tfor(var i=0;i<coefficients.length;i++)coefficients[i]=0;\n\t\t\tcoefficients[0] = coefficient;\n\t\t\treturn new GF256Poly(this, coefficients);\n\t\t}\n\tthis.exp=function( a)\n\t\t{\n\t\t\treturn this.expTable[a];\n\t\t}\n\tthis.log=function( a)\n\t\t{\n\t\t\tif (a == 0)\n\t\t\t{\n\t\t\t\tthrow \"System.ArgumentException\";\n\t\t\t}\n\t\t\treturn this.logTable[a];\n\t\t}\n\tthis.inverse=function( a)\n\t\t{\n\t\t\tif (a == 0)\n\t\t\t{\n\t\t\t\tthrow \"System.ArithmeticException\";\n\t\t\t}\n\t\t\treturn this.expTable[255 - this.logTable[a]];\n\t\t}\n\tthis.multiply=function( a, b)\n\t\t{\n\t\t\tif (a == 0 || b == 0)\n\t\t\t{\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\tif (a == 1)\n\t\t\t{\n\t\t\t\treturn b;\n\t\t\t}\n\t\t\tif (b == 1)\n\t\t\t{\n\t\t\t\treturn a;\n\t\t\t}\n\t\t\treturn this.expTable[(this.logTable[a] + this.logTable[b]) % 255];\n\t\t}\n}\n\nGF256.QR_CODE_FIELD = new GF256(0x011D);\nGF256.DATA_MATRIX_FIELD = new GF256(0x012D);\n\nGF256.addOrSubtract=function( a, b)\n{\n\treturn a ^ b;\n}\n","/*\r\n Ported to JavaScript by Lazar Laszlo 2011 \r\n \r\n [email protected], www.lazarsoft.info\r\n \r\n*/\r\n\r\n/*\r\n*\r\n* Copyright 2007 ZXing authors\r\n*\r\n* Licensed under the Apache License, Version 2.0 (the \"License\");\r\n* you may not use this file except in compliance with the License.\r\n* You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing, software\r\n* distributed under the License is distributed on an \"AS IS\" BASIS,\r\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n* See the License for the specific language governing permissions and\r\n* limitations under the License.\r\n*/\r\n\r\n\r\nDecoder={};\r\nDecoder.rsDecoder = new ReedSolomonDecoder(GF256.QR_CODE_FIELD);\r\n\r\nDecoder.correctErrors=function( codewordBytes, numDataCodewords)\r\n{\r\n\tvar numCodewords = codewordBytes.length;\r\n\t// First read into an array of ints\r\n\tvar codewordsInts = new Array(numCodewords);\r\n\tfor (var i = 0; i < numCodewords; i++)\r\n\t{\r\n\t\tcodewordsInts[i] = codewordBytes[i] & 0xFF;\r\n\t}\r\n\tvar numECCodewords = codewordBytes.length - numDataCodewords;\r\n\ttry\r\n\t{\r\n\t\tDecoder.rsDecoder.decode(codewordsInts, numECCodewords);\r\n\t\t//var corrector = new ReedSolomon(codewordsInts, numECCodewords);\r\n\t\t//corrector.correct();\r\n\t}\r\n\tcatch ( rse)\r\n\t{\r\n\t\tthrow rse;\r\n\t}\r\n\t// Copy back into array of bytes -- only need to worry about the bytes that were data\r\n\t// We don't care about errors in the error-correction codewords\r\n\tfor (var i = 0; i < numDataCodewords; i++)\r\n\t{\r\n\t\tcodewordBytes[i] = codewordsInts[i];\r\n\t}\r\n}\r\n\r\nDecoder.decode=function(bits)\r\n{\r\n\tvar parser = new BitMatrixParser(bits);\r\n\tvar version = parser.readVersion();\r\n\tvar ecLevel = parser.readFormatInformation().ErrorCorrectionLevel;\r\n\t\r\n\t// Read codewords\r\n\tvar codewords = parser.readCodewords();\r\n\r\n\t// Separate into data blocks\r\n\tvar dataBlocks = DataBlock.getDataBlocks(codewords, version, ecLevel);\r\n\t\r\n\t// Count total number of data bytes\r\n\tvar totalBytes = 0;\r\n\tfor (var i = 0; i < dataBlocks.length; i++)\r\n\t{\r\n\t\ttotalBytes += dataBlocks[i].NumDataCodewords;\r\n\t}\r\n\tvar resultBytes = new Array(totalBytes);\r\n\tvar resultOffset = 0;\r\n\t\r\n\t// Error-correct and copy data blocks together into a stream of bytes\r\n\tfor (var j = 0; j < dataBlocks.length; j++)\r\n\t{\r\n\t\tvar dataBlock = dataBlocks[j];\r\n\t\tvar codewordBytes = dataBlock.Codewords;\r\n\t\tvar numDataCodewords = dataBlock.NumDataCodewords;\r\n\t\tDecoder.correctErrors(codewordBytes, numDataCodewords);\r\n\t\tfor (var i = 0; i < numDataCodewords; i++)\r\n\t\t{\r\n\t\t\tresultBytes[resultOffset++] = codewordBytes[i];\r\n\t\t}\r\n\t}\r\n\t\r\n\t// Decode the contents of that stream of bytes\r\n\tvar reader = new QRCodeDataBlockReader(resultBytes, version.VersionNumber, ecLevel.Bits);\r\n\treturn reader;\r\n\t//return DecodedBitStreamParser.decode(resultBytes, version, ecLevel);\r\n}\r\n","/*\n Copyright 2011 Lazar Laszlo ([email protected], www.lazarsoft.info)\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*/\n\n\nqrcode = {};\nqrcode.imagedata = null;\nqrcode.width = 0;\nqrcode.height = 0;\nqrcode.qrCodeSymbol = null;\nqrcode.debug = false;\nqrcode.maxImgSize = 1024*1024;\nqrcode.canvasElement = null;\n\nqrcode.sizeOfDataLengthInfo = [ [ 10, 9, 8, 8 ], [ 12, 11, 16, 10 ], [ 14, 13, 16, 12 ] ];\n\nqrcode.callback = null;\n\nqrcode.setCanvasElement = function (element) {\n qrcode.canvasElement = element;\n}\n\nqrcode.decode = function(src, cb){\n\n if(arguments.length==0)\n {\n var canvas_qr = qrcode.canvasElement;\n var context = canvas_qr.getContext('2d');\n qrcode.width = canvas_qr.width;\n qrcode.height = canvas_qr.height;\n qrcode.imagedata = context.getImageData(0, 0, qrcode.width, qrcode.height);\n qrcode.result = qrcode.process(context);\n if(qrcode.callback!=null)\n qrcode.callback(qrcode.result);\n return qrcode.result;\n }\n else\n {\n var image = new Image();\n image.onload=function(){\n var canvas_qr = document.createElement('canvas');\n var context = canvas_qr.getContext('2d');\n var nheight = image.height;\n var nwidth = image.width;\n if(image.width*image.height>qrcode.maxImgSize)\n {\n var ir = image.width / image.height;\n nheight = Math.sqrt(qrcode.maxImgSize/ir);\n nwidth=ir*nheight;\n }\n\n canvas_qr.width = nwidth;\n canvas_qr.height = nheight;\n\n context.drawImage(image, 0, 0, canvas_qr.width, canvas_qr.height );\n qrcode.width = canvas_qr.width;\n qrcode.height = canvas_qr.height;\n try{\n qrcode.imagedata = context.getImageData(0, 0, canvas_qr.width, canvas_qr.height);\n }catch(e){\n qrcode.result = \"Cross domain Error\";\n if(qrcode.callback!=null)\n qrcode.callback(qrcode.result);\n return;\n }\n\n try\n {\n qrcode.result = qrcode.process(context);\n cb(null, qrcode.result);\n }\n catch(e)\n {\n // console.log(e);\n qrcode.result = \"Error decoding QR Code from Image\";\n cb(new Error(\"Error decoding QR Code from Image\"));\n }\n if(qrcode.callback!=null)\n qrcode.callback(qrcode.result);\n }\n image.src = src;\n }\n}\n\nqrcode.isUrl = function(s)\n{\n var regexp = /(ftp|http|https):\\/\\/(\\w+:{0,1}\\w*@)?(\\S+)(:[0-9]+)?(\\/|\\/([\\w#!:.?+=&%@!\\-\\/]))?/;\n return regexp.test(s);\n}\n\nqrcode.decode_url = function (s)\n{\n var escaped = \"\";\n try{\n escaped = escape( s );\n }\n catch(e)\n {\n // console.log(e);\n escaped = s;\n }\n var ret = \"\";\n try{\n ret = decodeURIComponent( escaped );\n }\n catch(e)\n {\n // console.log(e);\n ret = escaped;\n }\n return ret;\n}\n\nqrcode.decode_utf8 = function ( s )\n{\n if(qrcode.isUrl(s))\n return qrcode.decode_url(s);\n else\n return s;\n}\n\nqrcode.process = function(ctx){\n\n var start = new Date().getTime();\n\n var image = qrcode.grayScaleToBitmap(qrcode.grayscale());\n //var image = qrcode.binarize(128);\n\n if(qrcode.debug)\n {\n for (var y = 0; y < qrcode.height; y++)\n {\n for (var x = 0; x < qrcode.width; x++)\n {\n var point = (x * 4) + (y * qrcode.width * 4);\n qrcode.imagedata.data[point] = image[x+y*qrcode.width]?0:0;\n qrcode.imagedata.data[point+1] = image[x+y*qrcode.width]?0:0;\n qrcode.imagedata.data[point+2] = image[x+y*qrcode.width]?255:0;\n }\n }\n ctx.putImageData(qrcode.imagedata, 0, 0);\n }\n\n //var finderPatternInfo = new FinderPatternFinder().findFinderPattern(image);\n\n var detector = new Detector(image);\n\n var qRCodeMatrix = detector.detect();\n\n /*for (var y = 0; y < qRCodeMatrix.bits.Height; y++)\n {\n for (var x = 0; x < qRCodeMatrix.bits.Width; x++)\n {\n var point = (x * 4*2) + (y*2 * qrcode.width * 4);\n qrcode.imagedata.data[point] = qRCodeMatrix.bits.get_Renamed(x,y)?0:0;\n qrcode.imagedata.data[point+1] = qRCodeMatrix.bits.get_Renamed(x,y)?0:0;\n qrcode.imagedata.data[point+2] = qRCodeMatrix.bits.get_Renamed(x,y)?255:0;\n }\n }*/\n if(qrcode.debug)\n ctx.putImageData(qrcode.imagedata, 0, 0);\n\n var reader = Decoder.decode(qRCodeMatrix.bits);\n var data = reader.DataByte;\n var str=\"\";\n for(var i=0;i<data.length;i++)\n {\n for(var j=0;j<data[i].length;j++)\n str+=String.fromCharCode(data[i][j]);\n }\n\n var end = new Date().getTime();\n var time = end - start;\n // console.log(time);\n\n return qrcode.decode_utf8(str);\n //alert(\"Time:\" + time + \" Code: \"+str);\n}\n\nqrcode.getPixel = function(x,y){\n if (qrcode.width < x) {\n throw \"point error\";\n }\n if (qrcode.height < y) {\n throw \"point error\";\n }\n point = (x * 4) + (y * qrcode.width * 4);\n p = (qrcode.imagedata.data[point]*33 + qrcode.imagedata.data[point + 1]*34 + qrcode.imagedata.data[point + 2]*33)/100;\n return p;\n}\n\nqrcode.binarize = function(th){\n var ret = new Array(qrcode.width*qrcode.height);\n for (var y = 0; y < qrcode.height; y++)\n {\n for (var x = 0; x < qrcode.width; x++)\n {\n var gray = qrcode.getPixel(x, y);\n\n ret[x+y*qrcode.width] = gray<=th?true:false;\n }\n }\n return ret;\n}\n\nqrcode.getMiddleBrightnessPerArea=function(image)\n{\n var numSqrtArea = 4;\n //obtain middle brightness((min + max) / 2) per area\n var areaWidth = Math.floor(qrcode.width / numSqrtArea);\n var areaHeight = Math.floor(qrcode.height / numSqrtArea);\n var minmax = new Array(numSqrtArea);\n for (var i = 0; i < numSqrtArea; i++)\n {\n minmax[i] = new Array(numSqrtArea);\n for (var i2 = 0; i2 < numSqrtArea; i2++)\n {\n minmax[i][i2] = new Array(0,0);\n }\n }\n for (var ay = 0; ay < numSqrtArea; ay++)\n {\n for (var ax = 0; ax < numSqrtArea; ax++)\n {\n minmax[ax][ay][0] = 0xFF;\n for (var dy = 0; dy < areaHeight; dy++)\n {\n for (var dx = 0; dx < areaWidth; dx++)\n {\n var target = image[areaWidth * ax + dx+(areaHeight * ay + dy)*qrcode.width];\n if (target < minmax[ax][ay][0])\n minmax[ax][ay][0] = target;\n if (target > minmax[ax][ay][1])\n minmax[ax][ay][1] = target;\n }\n }\n //minmax[ax][ay][0] = (minmax[ax][ay][0] + minmax[ax][ay][1]) / 2;\n }\n }\n var middle = new Array(numSqrtArea);\n for (var i3 = 0; i3 < numSqrtArea; i3++)\n {\n middle[i3] = new Array(numSqrtArea);\n }\n for (var ay = 0; ay < numSqrtArea; ay++)\n {\n for (var ax = 0; ax < numSqrtArea; ax++)\n {\n middle[ax][ay] = Math.floor((minmax[ax][ay][0] + minmax[ax][ay][1]) / 2);\n //Console.out.print(middle[ax][ay] + \",\");\n }\n //Console.out.println(\"\");\n }\n //Console.out.println(\"\");\n\n return middle;\n}\n\nqrcode.grayScaleToBitmap=function(grayScale)\n{\n var middle = qrcode.getMiddleBrightnessPerArea(grayScale);\n var sqrtNumArea = middle.length;\n var areaWidth = Math.floor(qrcode.width / sqrtNumArea);\n var areaHeight = Math.floor(qrcode.height / sqrtNumArea);\n var bitmap = new Array(qrcode.height*qrcode.width);\n\n for (var ay = 0; ay < sqrtNumArea; ay++)\n {\n for (var ax = 0; ax < sqrtNumArea; ax++)\n {\n for (var dy = 0; dy < areaHeight; dy++)\n {\n for (var dx = 0; dx < areaWidth; dx++)\n {\n bitmap[areaWidth * ax + dx+ (areaHeight * ay + dy)*qrcode.width] = (grayScale[areaWidth * ax + dx+ (areaHeight * ay + dy)*qrcode.width] < middle[ax][ay])?true:false;\n }\n }\n }\n }\n return bitmap;\n}\n\nqrcode.grayscale = function(){\n var ret = new Array(qrcode.width*qrcode.height);\n for (var y = 0; y < qrcode.height; y++)\n {\n for (var x = 0; x < qrcode.width; x++)\n {\n var gray = qrcode.getPixel(x, y);\n\n ret[x+y*qrcode.width] = gray;\n }\n }\n return ret;\n}\n\n\n\n\nfunction URShift( number, bits)\n{\n if (number >= 0)\n return number >> bits;\n else\n return (number >> bits) + (2 << ~bits);\n}\n\n\nArray.prototype.remove = function(from, to) {\n var rest = this.slice((to || from) + 1 || this.length);\n this.length = from < 0 ? this.length + from : from;\n return this.push.apply(this, rest);\n};\n","/*\n Ported to JavaScript by Lazar Laszlo 2011\n\n [email protected], www.lazarsoft.info\n\n*/\n\n/*\n*\n* Copyright 2007 ZXing authors\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n\nvar MIN_SKIP = 3;\nvar MAX_MODULES = 57;\nvar INTEGER_MATH_SHIFT = 8;\nvar CENTER_QUORUM = 2;\n\nqrcode.orderBestPatterns = function (patterns) {\n\tfunction distance( pattern1, pattern2) {\n\t\txDiff = pattern1.X - pattern2.X;\n\t\tyDiff = pattern1.Y - pattern2.Y;\n\t\treturn Math.sqrt( (xDiff * xDiff + yDiff * yDiff));\n\t}\n\n\t/// <summary> Returns the z component of the cross product between vectors BC and BA.</summary>\n\tfunction crossProductZ( pointA, pointB, pointC) {\n\t\tvar bX = pointB.x;\n\t\tvar bY = pointB.y;\n\t\treturn ((pointC.x - bX) * (pointA.y - bY)) - ((pointC.y - bY) * (pointA.x - bX));\n\t}\n\n\t// Find distances between pattern centers\n\tvar zeroOneDistance = distance(patterns[0], patterns[1]);\n\tvar oneTwoDistance = distance(patterns[1], patterns[2]);\n\tvar zeroTwoDistance = distance(patterns[0], patterns[2]);\n\n\tvar pointA, pointB, pointC;\n\t// Assume one closest to other two is B; A and C will just be guesses at first\n\tif (oneTwoDistance >= zeroOneDistance && oneTwoDistance >= zeroTwoDistance) {\n\t\tpointB = patterns[0];\n\t\tpointA = patterns[1];\n\t\tpointC = patterns[2];\n\t} else if (zeroTwoDistance >= oneTwoDistance && zeroTwoDistance >= zeroOneDistance) {\n\t\tpointB = patterns[1];\n\t\tpointA = patterns[0];\n\t\tpointC = patterns[2];\n\t} else {\n\t\tpointB = patterns[2];\n\t\tpointA = patterns[0];\n\t\tpointC = patterns[1];\n\t}\n\n\t// Use cross product to figure out whether A and C are correct or flipped.\n\t// This asks whether BC x BA has a positive z component, which is the arrangement\n\t// we want for A, B, C. If it's negative, then we've got it flipped around and\n\t// should swap A and C.\n\tif (crossProductZ(pointA, pointB, pointC) < 0.0) {\n\t\tvar temp = pointA;\n\n\t\tpointA = pointC;\n\t\tpointC = temp;\n\t}\n\n\tpatterns[0] = pointA;\n\tpatterns[1] = pointB;\n\tpatterns[2] = pointC;\n};\n\nfunction FinderPattern (posX, posY, estimatedModuleSize) {\n\tthis.x=posX;\n\tthis.y=posY;\n\tthis.count = 1;\n\tthis.estimatedModuleSize = estimatedModuleSize;\n\n Object.defineProperties(this, {\n \t\"EstimatedModuleSize\": {\n get: function () {\n \t\treturn this.estimatedModuleSize;\n }\n \t},\n\n \t\"Count\": {\n get: function () {\n \t\treturn this.count;\n }\n \t},\n\n \t\"X\": {\n get: function () {\n \t\treturn this.x;\n }\n \t},\n\n \t\"Y\": {\n get: function () {\n \t\treturn this.y;\n }\n \t}\n });\n\n\tthis.incrementCount = function() {\n\t\tthis.count++;\n\t};\n\n\tthis.aboutEquals = function (moduleSize, i, j) {\n\t\tif (Math.abs(i - this.y) <= moduleSize && Math.abs(j - this.x) <= moduleSize) {\n\t\t\tvar moduleSizeDiff = Math.abs(moduleSize - this.estimatedModuleSize);\n\n\t\t\treturn moduleSizeDiff <= 1.0 || moduleSizeDiff / this.estimatedModuleSize <= 1.0;\n\t\t}\n\n\t\treturn false;\n\t}\n};\n\nfunction FinderPatternInfo(patternCenters) {\n\tthis.bottomLeft = patternCenters[0];\n\tthis.topLeft = patternCenters[1];\n\tthis.topRight = patternCenters[2];\n\n Object.defineProperties(this, {\n \t\"BottomLeft\": {\n get: function () {\n \t\treturn this.bottomLeft;\n }\n \t},\n \t\"TopLeft\": {\n get: function () {\n \t\treturn this.topLeft;\n }\n \t},\n \t\"TopRight\": {\n get: function () {\n \t\treturn this.topRight;\n }\n \t}\n });\n}\n\nfunction FinderPatternFinder()\n{\n\tthis.image=null;\n\tthis.possibleCenters = [];\n\tthis.hasSkipped = false;\n\tthis.crossCheckStateCount = new Array(0,0,0,0,0);\n\tthis.resultPointCallback = null;\n\n Object.defineProperty(this, 'CrossCheckStateCount', {\n get: function () {\n \t\tthis.crossCheckStateCount[0] = 0;\n \t\tthis.crossCheckStateCount[1] = 0;\n \t\tthis.crossCheckStateCount[2] = 0;\n \t\tthis.crossCheckStateCount[3] = 0;\n \t\tthis.crossCheckStateCount[4] = 0;\n\n \t\treturn this.crossCheckStateCount;\n }\n });\n\n\tthis.foundPatternCross=function( stateCount)\n\t\t{\n\t\t\tvar totalModuleSize = 0;\n\t\t\tfor (var i = 0; i < 5; i++)\n\t\t\t{\n\t\t\t\tvar count = stateCount[i];\n\t\t\t\tif (count == 0)\n\t\t\t\t{\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\ttotalModuleSize += count;\n\t\t\t}\n\t\t\tif (totalModuleSize < 7)\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tvar moduleSize = Math.floor((totalModuleSize << INTEGER_MATH_SHIFT) / 7);\n\t\t\tvar maxVariance = Math.floor(moduleSize / 2);\n\t\t\t// Allow less than 50% variance from 1-1-3-1-1 proportions\n\t\t\treturn Math.abs(moduleSize - (stateCount[0] << INTEGER_MATH_SHIFT)) < maxVariance && Math.abs(moduleSize - (stateCount[1] << INTEGER_MATH_SHIFT)) < maxVariance && Math.abs(3 * moduleSize - (stateCount[2] << INTEGER_MATH_SHIFT)) < 3 * maxVariance && Math.abs(moduleSize - (stateCount[3] << INTEGER_MATH_SHIFT)) < maxVariance && Math.abs(moduleSize - (stateCount[4] << INTEGER_MATH_SHIFT)) < maxVariance;\n\t\t}\n\tthis.centerFromEnd=function( stateCount, end)\n\t\t{\n\t\t\treturn (end - stateCount[4] - stateCount[3]) - stateCount[2] / 2.0;\n\t\t}\n\tthis.crossCheckVertical=function( startI, centerJ, maxCount, originalStateCountTotal)\n\t\t{\n\t\t\tvar image = this.image;\n\n\t\t\tvar maxI = qrcode.height;\n\t\t\tvar stateCount = this.CrossCheckStateCount;\n\n\t\t\t// Start counting up from center\n\t\t\tvar i = startI;\n\t\t\twhile (i >= 0 && image[centerJ + i*qrcode.width])\n\t\t\t{\n\t\t\t\tstateCount[2]++;\n\t\t\t\ti--;\n\t\t\t}\n\t\t\tif (i < 0)\n\t\t\t{\n\t\t\t\treturn NaN;\n\t\t\t}\n\t\t\twhile (i >= 0 && !image[centerJ +i*qrcode.width] && stateCount[1] <= maxCount)\n\t\t\t{\n\t\t\t\tstateCount[1]++;\n\t\t\t\ti--;\n\t\t\t}\n\t\t\t// If already too many modules in this state or ran off the edge:\n\t\t\tif (i < 0 || stateCount[1] > maxCount)\n\t\t\t{\n\t\t\t\treturn NaN;\n\t\t\t}\n\t\t\twhile (i >= 0 && image[centerJ + i*qrcode.width] && stateCount[0] <= maxCount)\n\t\t\t{\n\t\t\t\tstateCount[0]++;\n\t\t\t\ti--;\n\t\t\t}\n\t\t\tif (stateCount[0] > maxCount)\n\t\t\t{\n\t\t\t\treturn NaN;\n\t\t\t}\n\n\t\t\t// Now also count down from center\n\t\t\ti = startI + 1;\n\t\t\twhile (i < maxI && image[centerJ +i*qrcode.width])\n\t\t\t{\n\t\t\t\tstateCount[2]++;\n\t\t\t\ti++;\n\t\t\t}\n\t\t\tif (i == maxI)\n\t\t\t{\n\t\t\t\treturn NaN;\n\t\t\t}\n\t\t\twhile (i < maxI && !image[centerJ + i*qrcode.width] && stateCount[3] < maxCount)\n\t\t\t{\n\t\t\t\tstateCount[3]++;\n\t\t\t\ti++;\n\t\t\t}\n\t\t\tif (i == maxI || stateCount[3] >= maxCount)\n\t\t\t{\n\t\t\t\treturn NaN;\n\t\t\t}\n\t\t\twhile (i < maxI && image[centerJ + i*qrcode.width] && stateCount[4] < maxCount)\n\t\t\t{\n\t\t\t\tstateCount[4]++;\n\t\t\t\ti++;\n\t\t\t}\n\t\t\tif (stateCount[4] >= maxCount)\n\t\t\t{\n\t\t\t\treturn NaN;\n\t\t\t}\n\n\t\t\t// If we found a finder-pattern-like section, but its size is more than 40% different than\n\t\t\t// the original, assume it's a false positive\n\t\t\tvar stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2] + stateCount[3] + stateCount[4];\n\t\t\tif (5 * Math.abs(stateCountTotal - originalStateCountTotal) >= 2 * originalStateCountTotal)\n\t\t\t{\n\t\t\t\treturn NaN;\n\t\t\t}\n\n\t\t\treturn this.foundPatternCross(stateCount)?this.centerFromEnd(stateCount, i):NaN;\n\t\t}\n\tthis.crossCheckHorizontal=function( startJ, centerI, maxCount, originalStateCountTotal)\n\t\t{\n\t\t\tvar image = this.image;\n\n\t\t\tvar maxJ = qrcode.width;\n\t\t\tvar stateCount = this.CrossCheckStateCount;\n\n\t\t\tvar j = startJ;\n\t\t\twhile (j >= 0 && image[j+ centerI*qrcode.width])\n\t\t\t{\n\t\t\t\tstateCount[2]++;\n\t\t\t\tj--;\n\t\t\t}\n\t\t\tif (j < 0)\n\t\t\t{\n\t\t\t\treturn NaN;\n\t\t\t}\n\t\t\twhile (j >= 0 && !image[j+ centerI*qrcode.width] && stateCount[1] <= maxCount)\n\t\t\t{\n\t\t\t\tstateCount[1]++;\n\t\t\t\tj--;\n\t\t\t}\n\t\t\tif (j < 0 || stateCount[1] > maxCount)\n\t\t\t{\n\t\t\t\treturn NaN;\n\t\t\t}\n\t\t\twhile (j >= 0 && image[j+ centerI*qrcode.width] && stateCount[0] <= maxCount)\n\t\t\t{\n\t\t\t\tstateCount[0]++;\n\t\t\t\tj--;\n\t\t\t}\n\t\t\tif (stateCount[0] > maxCount)\n\t\t\t{\n\t\t\t\treturn NaN;\n\t\t\t}\n\n\t\t\tj = startJ + 1;\n\t\t\twhile (j < maxJ && image[j+ centerI*qrcode.width])\n\t\t\t{\n\t\t\t\tstateCount[2]++;\n\t\t\t\tj++;\n\t\t\t}\n\t\t\tif (j == maxJ)\n\t\t\t{\n\t\t\t\treturn NaN;\n\t\t\t}\n\t\t\twhile (j < maxJ && !image[j+ centerI*qrcode.width] && stateCount[3] < maxCount)\n\t\t\t{\n\t\t\t\tstateCount[3]++;\n\t\t\t\tj++;\n\t\t\t}\n\t\t\tif (j == maxJ || stateCount[3] >= maxCount)\n\t\t\t{\n\t\t\t\treturn NaN;\n\t\t\t}\n\t\t\twhile (j < maxJ && image[j+ centerI*qrcode.width] && stateCount[4] < maxCount)\n\t\t\t{\n\t\t\t\tstateCount[4]++;\n\t\t\t\tj++;\n\t\t\t}\n\t\t\tif (stateCount[4] >= maxCount)\n\t\t\t{\n\t\t\t\treturn NaN;\n\t\t\t}\n\n\t\t\t// If we found a finder-pattern-like section, but its size is significantly different than\n\t\t\t// the original, assume it's a false positive\n\t\t\tvar stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2] + stateCount[3] + stateCount[4];\n\t\t\tif (5 * Math.abs(stateCountTotal - originalStateCountTotal) >= originalStateCountTotal)\n\t\t\t{\n\t\t\t\treturn NaN;\n\t\t\t}\n\n\t\t\treturn this.foundPatternCross(stateCount)?this.centerFromEnd(stateCount, j):NaN;\n\t\t}\n\tthis.handlePossibleCenter=function( stateCount, i, j)\n\t\t{\n\t\t\tvar stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2] + stateCount[3] + stateCount[4];\n\t\t\tvar centerJ = this.centerFromEnd(stateCount, j); //float\n\t\t\tvar centerI = this.crossCheckVertical(i, Math.floor( centerJ), stateCount[2], stateCountTotal); //float\n\t\t\tif (!isNaN(centerI))\n\t\t\t{\n\t\t\t\t// Re-cross check\n\t\t\t\tcenterJ = this.crossCheckHorizontal(Math.floor( centerJ), Math.floor( centerI), stateCount[2], stateCountTotal);\n\t\t\t\tif (!isNaN(centerJ))\n\t\t\t\t{\n\t\t\t\t\tvar estimatedModuleSize = stateCountTotal / 7.0;\n\t\t\t\t\tvar found = false;\n\t\t\t\t\tvar max = this.possibleCenters.length;\n\t\t\t\t\tfor (var index = 0; index < max; index++)\n\t\t\t\t\t{\n\t\t\t\t\t\tvar center = this.possibleCenters[index];\n\t\t\t\t\t\t// Look for about the same center and module size:\n\t\t\t\t\t\tif (center.aboutEquals(estimatedModuleSize, centerI, centerJ))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcenter.incrementCount();\n\t\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (!found)\n\t\t\t\t\t{\n\t\t\t\t\t\tvar point = new FinderPattern(centerJ, centerI, estimatedModuleSize);\n\t\t\t\t\t\tthis.possibleCenters.push(point);\n\t\t\t\t\t\tif (this.resultPointCallback != null)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tthis.resultPointCallback.foundPossibleResultPoint(point);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\n\tthis.selectBestPatterns=function()\n\t\t{\n\n\t\t\tvar startSize = this.possibleCenters.length;\n\t\t\tif (startSize < 3)\n\t\t\t{\n\t\t\t\t// Couldn't find enough finder patterns\n\t\t\t\tthrow \"Couldn't find enough finder patterns\";\n\t\t\t}\n\n\t\t\t// Filter outlier possibilities whose module size is too different\n\t\t\tif (startSize > 3)\n\t\t\t{\n\t\t\t\t// But we can only afford to do so if we have at least 4 possibilities to choose from\n\t\t\t\tvar totalModuleSize = 0.0;\n var square = 0.0;\n\t\t\t\tfor (var i = 0; i < startSize; i++)\n\t\t\t\t{\n\t\t\t\t\t//totalModuleSize += this.possibleCenters[i].EstimatedModuleSize;\n var\tcenterValue=this.possibleCenters[i].EstimatedModuleSize;\n\t\t\t\t\ttotalModuleSize += centerValue;\n\t\t\t\t\tsquare += (centerValue * centerValue);\n\t\t\t\t}\n\t\t\t\tvar average = totalModuleSize / startSize;\n this.possibleCenters.sort(function(center1,center2) {\n\t\t\t\t var dA=Math.abs(center2.EstimatedModuleSize - average);\n\t\t\t\t var dB=Math.abs(center1.EstimatedModuleSize - average);\n\t\t\t\t if (dA < dB) {\n\t\t\t\t \t return (-1);\n\t\t\t\t } else if (dA == dB) {\n\t\t\t\t \t return 0;\n\t\t\t\t } else {\n\t\t\t\t \t return 1;\n\t\t\t\t }\n\t\t\t\t\t});\n\n\t\t\t\tvar stdDev = Math.sqrt(square / startSize - average * average);\n\t\t\t\tvar limit = Math.max(0.2 * average, stdDev);\n\t\t\t\tfor (var i = 0; i < this.possibleCenters.length && this.possibleCenters.length > 3; i++)\n\t\t\t\t{\n\t\t\t\t\tvar pattern = this.possibleCenters[i];\n\t\t\t\t\t//if (Math.abs(pattern.EstimatedModuleSize - average) > 0.2 * average)\n if (Math.abs(pattern.EstimatedModuleSize - average) > limit)\n\t\t\t\t\t{\n\t\t\t\t\t\tthis.possibleCenters.remove(i);\n\t\t\t\t\t\ti--;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this.possibleCenters.length > 3)\n\t\t\t{\n\t\t\t\t// Throw away all but those first size candidate points we found.\n\t\t\t\tthis.possibleCenters.sort(function(a, b){\n\t\t\t\t\tif (a.count > b.count){return -1;}\n\t\t\t\t\tif (a.count < b.count){return 1;}\n\t\t\t\t\treturn 0;\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn new Array( this.possibleCenters[0], this.possibleCenters[1], this.possibleCenters[2]);\n\t\t}\n\n\tthis.findRowSkip=function()\n\t\t{\n\t\t\tvar max = this.possibleCenters.length;\n\t\t\tif (max <= 1)\n\t\t\t{\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\tvar firstConfirmedCenter = null;\n\t\t\tfor (var i = 0; i < max; i++)\n\t\t\t{\n\t\t\t\tvar center = this.possibleCenters[i];\n\t\t\t\tif (center.Count >= CENTER_QUORUM)\n\t\t\t\t{\n\t\t\t\t\tif (firstConfirmedCenter == null)\n\t\t\t\t\t{\n\t\t\t\t\t\tfirstConfirmedCenter = center;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t// We have two confirmed centers\n\t\t\t\t\t\t// How far down can we skip before resuming looking for the next\n\t\t\t\t\t\t// pattern? In the worst case, only the difference between the\n\t\t\t\t\t\t// difference in the x / y coordinates of the two centers.\n\t\t\t\t\t\t// This is the case where you find top left last.\n\t\t\t\t\t\tthis.hasSkipped = true;\n\t\t\t\t\t\treturn Math.floor ((Math.abs(firstConfirmedCenter.X - center.X) - Math.abs(firstConfirmedCenter.Y - center.Y)) / 2);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn 0;\n\t\t}\n\n\tthis.haveMultiplyConfirmedCenters=function()\n\t\t{\n\t\t\tvar confirmedCount = 0;\n\t\t\tvar totalModuleSize = 0.0;\n\t\t\tvar max = this.possibleCenters.length;\n\t\t\tfor (var i = 0; i < max; i++)\n\t\t\t{\n\t\t\t\tvar pattern = this.possibleCenters[i];\n\t\t\t\tif (pattern.Count >= CENTER_QUORUM)\n\t\t\t\t{\n\t\t\t\t\tconfirmedCount++;\n\t\t\t\t\ttotalModuleSize += pattern.EstimatedModuleSize;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (confirmedCount < 3)\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t// OK, we have at least 3 confirmed centers, but, it's possible that one is a \"false positive\"\n\t\t\t// and that we need to keep looking. We detect this by asking if the estimated module sizes\n\t\t\t// vary too much. We arbitrarily say that when the total deviation from average exceeds\n\t\t\t// 5% of the total module size estimates, it's too much.\n\t\t\tvar average = totalModuleSize / max;\n\t\t\tvar totalDeviation = 0.0;\n\t\t\tfor (var i = 0; i < max; i++)\n\t\t\t{\n\t\t\t\tpattern = this.possibleCenters[i];\n\t\t\t\ttotalDeviation += Math.abs(pattern.EstimatedModuleSize - average);\n\t\t\t}\n\t\t\treturn totalDeviation <= 0.05 * totalModuleSize;\n\t\t}\n\n\tthis.findFinderPattern = function(image){\n\t\tvar tryHarder = false;\n\t\tthis.image=image;\n\t\tvar maxI = qrcode.height;\n\t\tvar maxJ = qrcode.width;\n\t\tvar iSkip = Math.floor((3 * maxI) / (4 * MAX_MODULES));\n\t\tif (iSkip < MIN_SKIP || tryHarder)\n\t\t{\n\t\t\t\tiSkip = MIN_SKIP;\n\t\t}\n\n\t\tvar done = false;\n\t\tvar stateCount = new Array(5);\n\t\tfor (var i = iSkip - 1; i < maxI && !done; i += iSkip)\n\t\t{\n\t\t\t// Get a row of black/white values\n\t\t\tstateCount[0] = 0;\n\t\t\tstateCount[1] = 0;\n\t\t\tstateCount[2] = 0;\n\t\t\tstateCount[3] = 0;\n\t\t\tstateCount[4] = 0;\n\t\t\tvar currentState = 0;\n\t\t\tfor (var j = 0; j < maxJ; j++)\n\t\t\t{\n\t\t\t\tif (image[j+i*qrcode.width] )\n\t\t\t\t{\n\t\t\t\t\t// Black pixel\n\t\t\t\t\tif ((currentState & 1) == 1)\n\t\t\t\t\t{\n\t\t\t\t\t\t// Counting white pixels\n\t\t\t\t\t\tcurrentState++;\n\t\t\t\t\t}\n\t\t\t\t\tstateCount[currentState]++;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t// White pixel\n\t\t\t\t\tif ((currentState & 1) == 0)\n\t\t\t\t\t{\n\t\t\t\t\t\t// Counting black pixels\n\t\t\t\t\t\tif (currentState == 4)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// A winner?\n\t\t\t\t\t\t\tif (this.foundPatternCross(stateCount))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t// Yes\n\t\t\t\t\t\t\t\tvar confirmed = this.handlePossibleCenter(stateCount, i, j);\n\t\t\t\t\t\t\t\tif (confirmed)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t// Start examining every other line. Checking each line turned out to be too\n\t\t\t\t\t\t\t\t\t// expensive and didn't improve performance.\n\t\t\t\t\t\t\t\t\tiSkip = 2;\n\t\t\t\t\t\t\t\t\tif (this.hasSkipped)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tdone = this.haveMultiplyConfirmedCenters();\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tvar rowSkip = this.findRowSkip();\n\t\t\t\t\t\t\t\t\t\tif (rowSkip > stateCount[2])\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t// Skip rows between row of lower confirmed center\n\t\t\t\t\t\t\t\t\t\t\t// and top of presumed third confirmed center\n\t\t\t\t\t\t\t\t\t\t\t// but back up a bit to get a full chance of detecting\n\t\t\t\t\t\t\t\t\t\t\t// it, entire width of center of finder pattern\n\n\t\t\t\t\t\t\t\t\t\t\t// Skip by rowSkip, but back off by stateCount[2] (size of last center\n\t\t\t\t\t\t\t\t\t\t\t// of pattern we saw) to be conservative, and also back off by iSkip which\n\t\t\t\t\t\t\t\t\t\t\t// is about to be re-added\n\t\t\t\t\t\t\t\t\t\t\ti += rowSkip - stateCount[2] - iSkip;\n\t\t\t\t\t\t\t\t\t\t\tj = maxJ - 1;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t// Advance to next black pixel\n\t\t\t\t\t\t\t\t\tdo\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tj++;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\twhile (j < maxJ && !image[j + i*qrcode.width]);\n\t\t\t\t\t\t\t\t\tj--; // back up to that last white pixel\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t// Clear state to start looking again\n\t\t\t\t\t\t\t\tcurrentState = 0;\n\t\t\t\t\t\t\t\tstateCount[0] = 0;\n\t\t\t\t\t\t\t\tstateCount[1] = 0;\n\t\t\t\t\t\t\t\tstateCount[2] = 0;\n\t\t\t\t\t\t\t\tstateCount[3] = 0;\n\t\t\t\t\t\t\t\tstateCount[4] = 0;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t// No, shift counts back by two\n\t\t\t\t\t\t\t\tstateCount[0] = stateCount[2];\n\t\t\t\t\t\t\t\tstateCount[1] = stateCount[3];\n\t\t\t\t\t\t\t\tstateCount[2] = stateCount[4];\n\t\t\t\t\t\t\t\tstateCount[3] = 1;\n\t\t\t\t\t\t\t\tstateCount[4] = 0;\n\t\t\t\t\t\t\t\tcurrentState = 3;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tstateCount[++currentState]++;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t// Counting white pixels\n\t\t\t\t\t\tstateCount[currentState]++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (this.foundPatternCross(stateCount))\n\t\t\t{\n\t\t\t\tvar confirmed = this.handlePossibleCenter(stateCount, i, maxJ);\n\t\t\t\tif (confirmed)\n\t\t\t\t{\n\t\t\t\t\tiSkip = stateCount[0];\n\t\t\t\t\tif (this.hasSkipped)\n\t\t\t\t\t{\n\t\t\t\t\t\t// Found a third one\n\t\t\t\t\t\tdone = haveMultiplyConfirmedCenters();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tvar patternInfo = this.selectBestPatterns();\n\t\tqrcode.orderBestPatterns(patternInfo);\n\n\t\treturn new FinderPatternInfo(patternInfo);\n\t};\n}\n","/*\n Ported to JavaScript by Lazar Laszlo 2011\n\n [email protected], www.lazarsoft.info\n\n*/\n\n/*\n*\n* Copyright 2007 ZXing authors\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n\nfunction AlignmentPattern(posX, posY, estimatedModuleSize)\n{\n\tthis.x=posX;\n\tthis.y=posY;\n\tthis.count = 1;\n\tthis.estimatedModuleSize = estimatedModuleSize;\n\n Object.defineProperties(this, {\n 'EstimatedModuleSize': {\n get: function () {\n return this.estimatedModuleSize;\n }\n },\n\n \t\"Count\": {\n get: function() {\n \t\treturn this.count;\n }\n \t},\n\n \t\"X\": {\n get: function() {\n \t\treturn Math.floor(this.x);\n }\n \t},\n\n \t\"Y\": {\n get: function() {\n \t\treturn Math.floor(this.y);\n }\n \t}\n });\n\n\tthis.incrementCount = function()\n\t{\n\t\tthis.count++;\n\t}\n\tthis.aboutEquals=function( moduleSize, i, j)\n\t\t{\n\t\t\tif (Math.abs(i - this.y) <= moduleSize && Math.abs(j - this.x) <= moduleSize)\n\t\t\t{\n\t\t\t\tvar moduleSizeDiff = Math.abs(moduleSize - this.estimatedModuleSize);\n\t\t\t\treturn moduleSizeDiff <= 1.0 || moduleSizeDiff / this.estimatedModuleSize <= 1.0;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\n}\n\nfunction AlignmentPatternFinder( image, startX, startY, width, height, moduleSize, resultPointCallback)\n{\n\tthis.image = image;\n\tthis.possibleCenters = new Array();\n\tthis.startX = startX;\n\tthis.startY = startY;\n\tthis.width = width;\n\tthis.height = height;\n\tthis.moduleSize = moduleSize;\n\tthis.crossCheckStateCount = new Array(0,0,0);\n\tthis.resultPointCallback = resultPointCallback;\n\n\tthis.centerFromEnd=function(stateCount, end)\n\t\t{\n\t\t\treturn (end - stateCount[2]) - stateCount[1] / 2.0;\n\t\t}\n\tthis.foundPatternCross = function(stateCount)\n\t\t{\n\t\t\tvar moduleSize = this.moduleSize;\n\t\t\tvar maxVariance = moduleSize / 2.0;\n\t\t\tfor (var i = 0; i < 3; i++)\n\t\t\t{\n\t\t\t\tif (Math.abs(moduleSize - stateCount[i]) >= maxVariance)\n\t\t\t\t{\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\n\tthis.crossCheckVertical=function( startI, centerJ, maxCount, originalStateCountTotal)\n\t\t{\n\t\t\tvar image = this.image;\n\n\t\t\tvar maxI = qrcode.height;\n\t\t\tvar stateCount = this.crossCheckStateCount;\n\t\t\tstateCount[0] = 0;\n\t\t\tstateCount[1] = 0;\n\t\t\tstateCount[2] = 0;\n\n\t\t\t// Start counting up from center\n\t\t\tvar i = startI;\n\t\t\twhile (i >= 0 && image[centerJ + i*qrcode.width] && stateCount[1] <= maxCount)\n\t\t\t{\n\t\t\t\tstateCount[1]++;\n\t\t\t\ti--;\n\t\t\t}\n\t\t\t// If already too many modules in this state or ran off the edge:\n\t\t\tif (i < 0 || stateCount[1] > maxCount)\n\t\t\t{\n\t\t\t\treturn NaN;\n\t\t\t}\n\t\t\twhile (i >= 0 && !image[centerJ + i*qrcode.width] && stateCount[0] <= maxCount)\n\t\t\t{\n\t\t\t\tstateCount[0]++;\n\t\t\t\ti--;\n\t\t\t}\n\t\t\tif (stateCount[0] > maxCount)\n\t\t\t{\n\t\t\t\treturn NaN;\n\t\t\t}\n\n\t\t\t// Now also count down from center\n\t\t\ti = startI + 1;\n\t\t\twhile (i < maxI && image[centerJ + i*qrcode.width] && stateCount[1] <= maxCount)\n\t\t\t{\n\t\t\t\tstateCount[1]++;\n\t\t\t\ti++;\n\t\t\t}\n\t\t\tif (i == maxI || stateCount[1] > maxCount)\n\t\t\t{\n\t\t\t\treturn NaN;\n\t\t\t}\n\t\t\twhile (i < maxI && !image[centerJ + i*qrcode.width] && stateCount[2] <= maxCount)\n\t\t\t{\n\t\t\t\tstateCount[2]++;\n\t\t\t\ti++;\n\t\t\t}\n\t\t\tif (stateCount[2] > maxCount)\n\t\t\t{\n\t\t\t\treturn NaN;\n\t\t\t}\n\n\t\t\tvar stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2];\n\t\t\tif (5 * Math.abs(stateCountTotal - originalStateCountTotal) >= 2 * originalStateCountTotal)\n\t\t\t{\n\t\t\t\treturn NaN;\n\t\t\t}\n\n\t\t\treturn this.foundPatternCross(stateCount)?this.centerFromEnd(stateCount, i):NaN;\n\t\t}\n\n\tthis.handlePossibleCenter=function( stateCount, i, j)\n\t\t{\n\t\t\tvar stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2];\n\t\t\tvar centerJ = this.centerFromEnd(stateCount, j);\n\t\t\tvar centerI = this.crossCheckVertical(i, Math.floor (centerJ), 2 * stateCount[1], stateCountTotal);\n\t\t\tif (!isNaN(centerI))\n\t\t\t{\n\t\t\t\tvar estimatedModuleSize = (stateCount[0] + stateCount[1] + stateCount[2]) / 3.0;\n\t\t\t\tvar max = this.possibleCenters.length;\n\t\t\t\tfor (var index = 0; index < max; index++)\n\t\t\t\t{\n\t\t\t\t\tvar center = this.possibleCenters[index];\n\t\t\t\t\t// Look for about the same center and module size:\n\t\t\t\t\tif (center.aboutEquals(estimatedModuleSize, centerI, centerJ))\n\t\t\t\t\t{\n\t\t\t\t\t\treturn new AlignmentPattern(centerJ, centerI, estimatedModuleSize);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// Hadn't found this before; save it\n\t\t\t\tvar point = new AlignmentPattern(centerJ, centerI, estimatedModuleSize);\n\t\t\t\tthis.possibleCenters.push(point);\n\t\t\t\tif (this.resultPointCallback != null)\n\t\t\t\t{\n\t\t\t\t\tthis.resultPointCallback.foundPossibleResultPoint(point);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn null;\n\t\t}\n\n\tthis.find = function()\n\t{\n\t\t\tvar startX = this.startX;\n\t\t\tvar height = this.height;\n\t\t\tvar maxJ = startX + width;\n\t\t\tvar middleI = startY + (height >> 1);\n\t\t\t// We are looking for black/white/black modules in 1:1:1 ratio;\n\t\t\t// this tracks the number of black/white/black modules seen so far\n\t\t\tvar stateCount = new Array(0,0,0);\n\t\t\tfor (var iGen = 0; iGen < height; iGen++)\n\t\t\t{\n\t\t\t\t// Search from middle outwards\n\t\t\t\tvar i = middleI + ((iGen & 0x01) == 0?((iGen + 1) >> 1):- ((iGen + 1) >> 1));\n\t\t\t\tstateCount[0] = 0;\n\t\t\t\tstateCount[1] = 0;\n\t\t\t\tstateCount[2] = 0;\n\t\t\t\tvar j = startX;\n\t\t\t\t// Burn off leading white pixels before anything else; if we start in the middle of\n\t\t\t\t// a white run, it doesn't make sense to count its length, since we don't know if the\n\t\t\t\t// white run continued to the left of the start point\n\t\t\t\twhile (j < maxJ && !image[j + qrcode.width* i])\n\t\t\t\t{\n\t\t\t\t\tj++;\n\t\t\t\t}\n\t\t\t\tvar currentState = 0;\n\t\t\t\twhile (j < maxJ)\n\t\t\t\t{\n\t\t\t\t\tif (image[j + i*qrcode.width])\n\t\t\t\t\t{\n\t\t\t\t\t\t// Black pixel\n\t\t\t\t\t\tif (currentState == 1)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// Counting black pixels\n\t\t\t\t\t\t\tstateCount[currentState]++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// Counting white pixels\n\t\t\t\t\t\t\tif (currentState == 2)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t// A winner?\n\t\t\t\t\t\t\t\tif (this.foundPatternCross(stateCount))\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t// Yes\n\t\t\t\t\t\t\t\t\tvar confirmed = this.handlePossibleCenter(stateCount, i, j);\n\t\t\t\t\t\t\t\t\tif (confirmed != null)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\treturn confirmed;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tstateCount[0] = stateCount[2];\n\t\t\t\t\t\t\t\tstateCount[1] = 1;\n\t\t\t\t\t\t\t\tstateCount[2] = 0;\n\t\t\t\t\t\t\t\tcurrentState = 1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tstateCount[++currentState]++;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t// White pixel\n\t\t\t\t\t\tif (currentState == 1)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// Counting black pixels\n\t\t\t\t\t\t\tcurrentState++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstateCount[currentState]++;\n\t\t\t\t\t}\n\t\t\t\t\tj++;\n\t\t\t\t}\n\t\t\t\tif (this.foundPatternCross(stateCount))\n\t\t\t\t{\n\t\t\t\t\tvar confirmed = this.handlePossibleCenter(stateCount, i, maxJ);\n\t\t\t\t\tif (confirmed != null)\n\t\t\t\t\t{\n\t\t\t\t\t\treturn confirmed;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Hmm, nothing we saw was observed and confirmed twice. If we had\n\t\t\t// any guess at all, return it.\n\t\t\tif (!(this.possibleCenters.length == 0))\n\t\t\t{\n\t\t\t\treturn this.possibleCenters[0];\n\t\t\t}\n\n\t\t\tthrow \"Couldn't find enough alignment patterns\";\n\t\t}\n\n}\n","/*\n Ported to JavaScript by Lazar Laszlo 2011\n\n [email protected], www.lazarsoft.info\n\n*/\n\n/*\n*\n* Copyright 2007 ZXing authors\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n\nfunction QRCodeDataBlockReader (blocks, version, numErrorCorrectionCode) {\n\tthis.blockPointer = 0;\n\tthis.bitPointer = 7;\n\tthis.dataLength = 0;\n\tthis.blocks = blocks;\n\tthis.numErrorCorrectionCode = numErrorCorrectionCode;\n\tif (version <= 9)\n\t\tthis.dataLengthMode = 0;\n\telse if (version >= 10 && version <= 26)\n\t\tthis.dataLengthMode = 1;\n\telse if (version >= 27 && version <= 40)\n\t\tthis.dataLengthMode = 2;\n\n\tthis.getNextBits = function (numBits) {\n\t\tvar bits = 0;\n\n\t\tif (numBits < this.bitPointer + 1) {\n\t\t\t// next word fits into current data block\n\t\t\tvar mask = 0;\n\t\t\tfor (var i = 0; i < numBits; i++) {\n\t\t\t\tmask += (1 << i);\n\t\t\t}\n\t\t\tmask <<= (this.bitPointer - numBits + 1);\n\n\t\t\tbits = (this.blocks[this.blockPointer] & mask) >> (this.bitPointer - numBits + 1);\n\t\t\tthis.bitPointer -= numBits;\n\t\t\treturn bits;\n\t\t} else if (numBits < this.bitPointer + 1 + 8) {\n\t\t\t// next word crosses 2 data blocks\n\t\t\tvar mask1 = 0;\n\t\t\tfor (var i = 0; i < this.bitPointer + 1; i++)\n\t\t\t{\n\t\t\t\tmask1 += (1 << i);\n\t\t\t}\n\t\t\tbits = (this.blocks[this.blockPointer] & mask1) << (numBits - (this.bitPointer + 1));\n this.blockPointer++;\n\t\t\tbits += ((this.blocks[this.blockPointer]) >> (8 - (numBits - (this.bitPointer + 1))));\n\n\t\t\tthis.bitPointer = this.bitPointer - numBits % 8;\n\t\t\tif (this.bitPointer < 0)\n\t\t\t{\n\t\t\t\tthis.bitPointer = 8 + this.bitPointer;\n\t\t\t}\n\t\t\treturn bits;\n\t\t} else if (numBits < this.bitPointer + 1 + 16) {\n\t\t\t// next word crosses 3 data blocks\n\t\t\tvar mask1 = 0; // mask of first block\n\t\t\tvar mask3 = 0; // mask of 3rd block\n\t\t\t//bitPointer + 1 : number of bits of the 1st block\n\t\t\t//8 : number of the 2nd block (note that use already 8bits because next word uses 3 data blocks)\n\t\t\t//numBits - (bitPointer + 1 + 8) : number of bits of the 3rd block\n\t\t\tfor (var i = 0; i < this.bitPointer + 1; i++)\n\t\t\t{\n\t\t\t\tmask1 += (1 << i);\n\t\t\t}\n\t\t\tvar bitsFirstBlock = (this.blocks[this.blockPointer] & mask1) << (numBits - (this.bitPointer + 1));\n\t\t\tthis.blockPointer++;\n\n\t\t\tvar bitsSecondBlock = this.blocks[this.blockPointer] << (numBits - (this.bitPointer + 1 + 8));\n\t\t\tthis.blockPointer++;\n\n\t\t\tfor (var i = 0; i < numBits - (this.bitPointer + 1 + 8); i++) {\n\t\t\t\tmask3 += (1 << i);\n\t\t\t}\n\n mask3 <<= 8 - (numBits - (this.bitPointer + 1 + 8));\n\t\t\tvar bitsThirdBlock = (this.blocks[this.blockPointer] & mask3) >> (8 - (numBits - (this.bitPointer + 1 + 8)));\n\n\t\t\tbits = bitsFirstBlock + bitsSecondBlock + bitsThirdBlock;\n\t\t\tthis.bitPointer = this.bitPointer - (numBits - 8) % 8;\n\t\t\tif (this.bitPointer < 0) {\n\t\t\t\tthis.bitPointer = 8 + this.bitPointer;\n\t\t\t}\n\n\t\t\treturn bits;\n\t\t} else {\n\t\t\treturn 0;\n\t\t}\n\t};\n\n\tthis.NextMode = function () {\n\t\tif ((this.blockPointer > this.blocks.length - this.numErrorCorrectionCode - 2))\n\t\t\treturn 0;\n\t\telse\n\t\t\treturn this.getNextBits(4);\n\t};\n\n\tthis.getDataLength=function( modeIndicator) {\n\t\tvar index = 0;\n\t\twhile (true)\n\t\t{\n\t\t\tif ((modeIndicator >> index) == 1)\n\t\t\t\tbreak;\n\t\t\tindex++;\n\t\t}\n\n\t\treturn this.getNextBits(qrcode.sizeOfDataLengthInfo[this.dataLengthMode][index]);\n\t};\n\n\tthis.getRomanAndFigureString = function (dataLength) {\n\t\t\tvar length = dataLength;\n\t\t\tvar intData = 0;\n\t\t\tvar strData = \"\";\n\t\t\tvar tableRomanAndFigure = new Array('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', ' ', '$', '%', '*', '+', '-', '.', '/', ':');\n\n\t\t\tdo {\n\t\t\t\tif (length > 1) {\n\t\t\t\t\tintData = this.getNextBits(11);\n\t\t\t\t\tvar firstLetter = Math.floor(intData / 45);\n\t\t\t\t\tvar secondLetter = intData % 45;\n\t\t\t\t\tstrData += tableRomanAndFigure[firstLetter];\n\t\t\t\t\tstrData += tableRomanAndFigure[secondLetter];\n\t\t\t\t\tlength -= 2;\n\t\t\t\t} else if (length == 1) {\n\t\t\t\t\tintData = this.getNextBits(6);\n\t\t\t\t\tstrData += tableRomanAndFigure[intData];\n\t\t\t\t\tlength -= 1;\n\t\t\t\t}\n\t\t\t} while (length > 0);\n\n\t\t\treturn strData;\n\t};\n\n\tthis.getFigureString=function( dataLength) {\n\t\tvar length = dataLength;\n\t\tvar intData = 0;\n\t\tvar strData = \"\";\n\t\tdo\n\t\t{\n\t\t\tif (length >= 3)\n\t\t\t{\n\t\t\t\tintData = this.getNextBits(10);\n\t\t\t\tif (intData < 100)\n\t\t\t\t\tstrData += \"0\";\n\t\t\t\tif (intData < 10)\n\t\t\t\t\tstrData += \"0\";\n\t\t\t\tlength -= 3;\n\t\t\t}\n\t\t\telse if (length == 2)\n\t\t\t{\n\t\t\t\tintData = this.getNextBits(7);\n\t\t\t\tif (intData < 10)\n\t\t\t\t\tstrData += \"0\";\n\t\t\t\tlength -= 2;\n\t\t\t}\n\t\t\telse if (length == 1)\n\t\t\t{\n\t\t\t\tintData = this.getNextBits(4);\n\t\t\t\tlength -= 1;\n\t\t\t}\n\t\t\tstrData += intData;\n\t\t}\n\t\twhile (length > 0);\n\n\t\treturn strData;\n\t};\n\n\tthis.get8bitByteArray=function( dataLength) {\n\t\tvar length = dataLength;\n\t\tvar intData = 0;\n\t\tvar output = new Array();\n\n\t\tdo {\n\t\t\tintData = this.getNextBits(8);\n\t\t\toutput.push( intData);\n\t\t\tlength--;\n\t\t} while (length > 0);\n\n\t\treturn output;\n\t};\n\n this.getKanjiString = function (dataLength) {\n\t\tvar length = dataLength;\n\t\tvar intData = 0;\n\t\tvar unicodeString = \"\";\n\t\tdo {\n\t\t\tintData = getNextBits(13);\n\t\t\tvar lowerByte = intData % 0xC0;\n\t\t\tvar higherByte = intData / 0xC0;\n\n\t\t\tvar tempWord = (higherByte << 8) + lowerByte;\n\t\t\tvar shiftjisWord = 0;\n\t\t\tif (tempWord + 0x8140 <= 0x9FFC) {\n\t\t\t\t// between 8140 - 9FFC on Shift_JIS character set\n\t\t\t\tshiftjisWord = tempWord + 0x8140;\n\t\t\t} else {\n\t\t\t\t// between E040 - EBBF on Shift_JIS character set\n\t\t\t\tshiftjisWord = tempWord + 0xC140;\n\t\t\t}\n\n unicodeString += String.fromCharCode(shiftjisWord);\n\t\t\tlength--;\n\t\t} while (length > 0);\n\n\t\treturn unicodeString;\n\t};\n\n Object.defineProperty(this, 'DataByte', {\n get: function () {\n var output = new Array();\n var MODE_NUMBER = 1;\n var MODE_ROMAN_AND_NUMBER = 2;\n var MODE_8BIT_BYTE = 4;\n var MODE_KANJI = 8;\n do {\n var mode = this.NextMode();\n if (mode == 0) {\n if (output.length > 0)\n break;\n else\n throw \"Empty data block\";\n }\n\n if (mode != MODE_NUMBER &&\n mode != MODE_ROMAN_AND_NUMBER &&\n mode != MODE_8BIT_BYTE &&\n mode != MODE_KANJI) {\n\n mode = guessMode(mode);\n throw \"Invalid mode: \" + mode + \" in (block:\" + this.blockPointer + \" bit:\" + this.bitPointer + \")\";\n }\n\n dataLength = this.getDataLength(mode);\n\n if (dataLength < 1)\n throw \"Invalid data length: \" + dataLength;\n switch (mode) {\n case MODE_NUMBER:\n var temp_str = this.getFigureString(dataLength);\n var ta = new Array(temp_str.length);\n for(var j=0;j<temp_str.length;j++)\n ta[j]=temp_str.charCodeAt(j);\n output.push(ta);\n break;\n\n case MODE_ROMAN_AND_NUMBER:\n var temp_str = this.getRomanAndFigureString(dataLength);\n var ta = new Array(temp_str.length);\n for(var j=0;j<temp_str.length;j++)\n ta[j]=temp_str.charCodeAt(j);\n output.push(ta );\n break;\n\n case MODE_8BIT_BYTE:\n var temp_sbyteArray3 = this.get8bitByteArray(dataLength);\n output.push(temp_sbyteArray3);\n break;\n\n case MODE_KANJI:\n var temp_str = this.getKanjiString(dataLength);\n output.push(temp_str);\n break;\n }\n } while (true);\n return output;\n\n }\n });\n}\n"],"sourceRoot":"/source/"}