code.js 60 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607
  1. var _aa = {};
  2. _aa._ab = function(f, e) {
  3. var d = qrcode.width;
  4. var b = qrcode.height;
  5. var c = true;
  6. for (var g = 0; g < e.length && c; g += 2) {
  7. var a = Math.floor(e[g]);
  8. var h = Math.floor(e[g + 1]);
  9. if (a < -1 || a > d || h < -1 || h > b) {
  10. throw "Error._ab "
  11. }
  12. c = false;
  13. if (a == -1) {
  14. e[g] = 0;
  15. c = true
  16. } else {
  17. if (a == d) {
  18. e[g] = d - 1;
  19. c = true
  20. }
  21. }
  22. if (h == -1) {
  23. e[g + 1] = 0;
  24. c = true
  25. } else {
  26. if (h == b) {
  27. e[g + 1] = b - 1;
  28. c = true
  29. }
  30. }
  31. }
  32. c = true;
  33. for (var g = e.length - 2; g >= 0 && c; g -= 2) {
  34. var a = Math.floor(e[g]);
  35. var h = Math.floor(e[g + 1]);
  36. if (a < -1 || a > d || h < -1 || h > b) {
  37. throw "Error._ab "
  38. }
  39. c = false;
  40. if (a == -1) {
  41. e[g] = 0;
  42. c = true
  43. } else {
  44. if (a == d) {
  45. e[g] = d - 1;
  46. c = true
  47. }
  48. }
  49. if (h == -1) {
  50. e[g + 1] = 0;
  51. c = true
  52. } else {
  53. if (h == b) {
  54. e[g + 1] = b - 1;
  55. c = true
  56. }
  57. }
  58. }
  59. };
  60. _aa._af = function(b, d, a) {
  61. var k = new _ac(d);
  62. var j = new Array(d << 1);
  63. for (var f = 0; f < d; f++) {
  64. var g = j.length;
  65. var i = f + 0.5;
  66. for (var h = 0; h < g; h += 2) {
  67. j[h] = (h >> 1) + 0.5;
  68. j[h + 1] = i
  69. }
  70. a._ad(j);
  71. _aa._ab(b, j);
  72. try {
  73. for (var h = 0; h < g; h += 2) {
  74. var e = b[Math.floor(j[h]) + qrcode.width * Math.floor(j[h + 1])];
  75. if (e) {
  76. k._dq(h >> 1, f)
  77. }
  78. }
  79. } catch (c) {
  80. throw "Error._ab"
  81. }
  82. }
  83. return k
  84. };
  85. _aa._ah = function(h, o, l, k, q, p, b, a, f, e, n, m, s, r, d, c, j, i) {
  86. var g = _ae._ag(l, k, q, p, b, a, f, e, n, m, s, r, d, c, j, i);
  87. return _aa._af(h, o, g)
  88. };
  89. function _a1(b, a) {
  90. this.count = b;
  91. this._fc = a;
  92. this.__defineGetter__("Count", function() {
  93. return this.count
  94. });
  95. this.__defineGetter__("_dm", function() {
  96. return this._fc
  97. })
  98. }
  99. function _a2(a, c, b) {
  100. this._bm = a;
  101. if (b) {
  102. this._do = new Array(c, b)
  103. } else {
  104. this._do = new Array(c)
  105. }
  106. this.__defineGetter__("_bo", function() {
  107. return this._bm
  108. });
  109. this.__defineGetter__("_dn", function() {
  110. return this._bm * this._fo
  111. });
  112. this.__defineGetter__("_fo", function() {
  113. var e = 0;
  114. for (var d = 0; d < this._do.length; d++) {
  115. e += this._do[d].length
  116. }
  117. return e
  118. });
  119. this._fb = function() {
  120. return this._do
  121. }
  122. }
  123. function _a3(k, l, h, g, f, e) {
  124. this._bs = k;
  125. this._ar = l;
  126. this._do = new Array(h, g, f, e);
  127. var j = 0;
  128. var b = h._bo;
  129. var a = h._fb();
  130. for (var d = 0; d < a.length; d++) {
  131. var c = a[d];
  132. j += c.Count * (c._dm + b)
  133. }
  134. this._br = j;
  135. this.__defineGetter__("_fd", function() {
  136. return this._bs
  137. });
  138. this.__defineGetter__("_as", function() {
  139. return this._ar
  140. });
  141. this.__defineGetter__("_dp", function() {
  142. return this._br
  143. });
  144. this.__defineGetter__("_cr", function() {
  145. return 17 + 4 * this._bs
  146. });
  147. this._aq = function() {
  148. var q = this._cr;
  149. var o = new _ac(q);
  150. o._bq(0, 0, 9, 9);
  151. o._bq(q - 8, 0, 8, 9);
  152. o._bq(0, q - 8, 9, 8);
  153. var n = this._ar.length;
  154. for (var m = 0; m < n; m++) {
  155. var p = this._ar[m] - 2;
  156. for (var r = 0; r < n; r++) {
  157. if ((m == 0 && (r == 0 || r == n - 1)) || (m == n - 1 && r == 0)) {
  158. continue
  159. }
  160. o._bq(this._ar[r] - 2, p, 5, 5)
  161. }
  162. }
  163. o._bq(6, 9, 1, q - 17);
  164. o._bq(9, 6, q - 17, 1);
  165. if (this._bs > 6) {
  166. o._bq(q - 11, 0, 3, 6);
  167. o._bq(0, q - 11, 6, 3)
  168. }
  169. return o
  170. };
  171. this._bu = function(i) {
  172. return this._do[i.ordinal()]
  173. }
  174. }
  175. _a3._bv = new Array(31892, 34236, 39577, 42195, 48118, 51042, 55367, 58893, 63784, 68472, 70749, 76311, 79154, 84390,
  176. 87683, 92361, 96236, 102084, 102881, 110507, 110734, 117786, 119615, 126325, 127568, 133589, 136944, 141498,
  177. 145311, 150283, 152622, 158308, 161089, 167017);
  178. _a3.VERSIONS = _ay();
  179. _a3._av = function(a) {
  180. if (a < 1 || a > 40) {
  181. throw "bad arguments"
  182. }
  183. return _a3.VERSIONS[a - 1]
  184. };
  185. _a3._at = function(b) {
  186. if (b % 4 != 1) {
  187. throw "Error _at"
  188. }
  189. try {
  190. return _a3._av((b - 17) >> 2)
  191. } catch (a) {
  192. throw "Error _av"
  193. }
  194. };
  195. _a3._aw = function(d) {
  196. var b = 4294967295;
  197. var f = 0;
  198. for (var c = 0; c < _a3._bv.length; c++) {
  199. var a = _a3._bv[c];
  200. if (a == d) {
  201. return this._av(c + 7)
  202. }
  203. var e = _ax._gj(d, a);
  204. if (e < b) {
  205. f = c + 7;
  206. b = e
  207. }
  208. }
  209. if (b <= 3) {
  210. return this._av(f)
  211. }
  212. return null
  213. };
  214. function _ay() {
  215. return new Array(new _a3(1, new Array(), new _a2(7, new _a1(1, 19)), new _a2(10, new _a1(1, 16)), new _a2(13,
  216. new _a1(1, 13)), new _a2(17, new _a1(1, 9))), new _a3(2, new Array(6, 18), new _a2(10, new _a1(1, 34)),
  217. new _a2(16, new _a1(1, 28)), new _a2(22, new _a1(1, 22)), new _a2(28, new _a1(1, 16))), new _a3(3,
  218. new Array(6, 22), new _a2(15, new _a1(1, 55)), new _a2(26, new _a1(1, 44)), new _a2(18, new _a1(2, 17)),
  219. new _a2(22, new _a1(2, 13))), new _a3(4, new Array(6, 26), new _a2(20, new _a1(1, 80)), new _a2(18,
  220. new _a1(2, 32)), new _a2(26, new _a1(2, 24)), new _a2(16, new _a1(4, 9))), new _a3(5, new Array(6, 30),
  221. new _a2(26, new _a1(1, 108)), new _a2(24, new _a1(2, 43)), new _a2(18, new _a1(2, 15), new _a1(2, 16)),
  222. new _a2(22, new _a1(2, 11), new _a1(2, 12))), new _a3(6, new Array(6, 34), new _a2(18, new _a1(2, 68)),
  223. new _a2(16, new _a1(4, 27)), new _a2(24, new _a1(4, 19)), new _a2(28, new _a1(4, 15))), new _a3(7,
  224. new Array(6, 22, 38), new _a2(20, new _a1(2, 78)), new _a2(18, new _a1(4, 31)), new _a2(18, new _a1(2,
  225. 14), new _a1(4, 15)), new _a2(26, new _a1(4, 13), new _a1(1, 14))), new _a3(8, new Array(6, 24, 42),
  226. new _a2(24, new _a1(2, 97)), new _a2(22, new _a1(2, 38), new _a1(2, 39)), new _a2(22, new _a1(4, 18),
  227. new _a1(2, 19)), new _a2(26, new _a1(4, 14), new _a1(2, 15))), new _a3(9, new Array(6, 26, 46),
  228. new _a2(30, new _a1(2, 116)), new _a2(22, new _a1(3, 36), new _a1(2, 37)), new _a2(20, new _a1(4, 16),
  229. new _a1(4, 17)), new _a2(24, new _a1(4, 12), new _a1(4, 13))), new _a3(10, new Array(6, 28, 50),
  230. new _a2(18, new _a1(2, 68), new _a1(2, 69)), new _a2(26, new _a1(4, 43), new _a1(1, 44)), new _a2(24,
  231. new _a1(6, 19), new _a1(2, 20)), new _a2(28, new _a1(6, 15), new _a1(2, 16))), new _a3(11,
  232. new Array(6, 30, 54), new _a2(20, new _a1(4, 81)), new _a2(30, new _a1(1, 50), new _a1(4, 51)), new _a2(
  233. 28, new _a1(4, 22), new _a1(4, 23)), new _a2(24, new _a1(3, 12), new _a1(8, 13))), new _a3(12,
  234. new Array(6, 32, 58), new _a2(24, new _a1(2, 92), new _a1(2, 93)), new _a2(22, new _a1(6, 36), new _a1(
  235. 2, 37)), new _a2(26, new _a1(4, 20), new _a1(6, 21)), new _a2(28, new _a1(7, 14), new _a1(4, 15))),
  236. new _a3(13, new Array(6, 34, 62), new _a2(26, new _a1(4, 107)), new _a2(22, new _a1(8, 37), new _a1(1, 38)),
  237. new _a2(24, new _a1(8, 20), new _a1(4, 21)), new _a2(22, new _a1(12, 11), new _a1(4, 12))), new _a3(14,
  238. new Array(6, 26, 46, 66), new _a2(30, new _a1(3, 115), new _a1(1, 116)), new _a2(24, new _a1(4, 40),
  239. new _a1(5, 41)), new _a2(20, new _a1(11, 16), new _a1(5, 17)), new _a2(24, new _a1(11, 12), new _a1(
  240. 5, 13))), new _a3(15, new Array(6, 26, 48, 70), new _a2(22, new _a1(5, 87), new _a1(1, 88)),
  241. new _a2(24, new _a1(5, 41), new _a1(5, 42)), new _a2(30, new _a1(5, 24), new _a1(7, 25)), new _a2(24,
  242. new _a1(11, 12), new _a1(7, 13))), new _a3(16, new Array(6, 26, 50, 74), new _a2(24, new _a1(5, 98),
  243. new _a1(1, 99)), new _a2(28, new _a1(7, 45), new _a1(3, 46)), new _a2(24, new _a1(15, 19), new _a1(
  244. 2, 20)), new _a2(30, new _a1(3, 15), new _a1(13, 16))), new _a3(17, new Array(6, 30, 54, 78), new _a2(
  245. 28, new _a1(1, 107), new _a1(5, 108)), new _a2(28, new _a1(10, 46), new _a1(1, 47)), new _a2(28,
  246. new _a1(1, 22), new _a1(15, 23)), new _a2(28, new _a1(2, 14), new _a1(17, 15))), new _a3(18, new Array(
  247. 6, 30, 56, 82), new _a2(30, new _a1(5, 120), new _a1(1, 121)), new _a2(26, new _a1(9, 43), new _a1(
  248. 4, 44)), new _a2(28, new _a1(17, 22), new _a1(1, 23)), new _a2(28, new _a1(2, 14), new _a1(19, 15))),
  249. new _a3(19, new Array(6, 30, 58, 86), new _a2(28, new _a1(3, 113), new _a1(4, 114)), new _a2(26, new _a1(3,
  250. 44), new _a1(11, 45)), new _a2(26, new _a1(17, 21), new _a1(4, 22)), new _a2(26, new _a1(9, 13),
  251. new _a1(16, 14))), new _a3(20, new Array(6, 34, 62, 90), new _a2(28, new _a1(3, 107), new _a1(5, 108)),
  252. new _a2(26, new _a1(3, 41), new _a1(13, 42)), new _a2(30, new _a1(15, 24), new _a1(5, 25)), new _a2(28,
  253. new _a1(15, 15), new _a1(10, 16))), new _a3(21, new Array(6, 28, 50, 72, 94), new _a2(28, new _a1(4,
  254. 116), new _a1(4, 117)), new _a2(26, new _a1(17, 42)), new _a2(28, new _a1(17, 22), new _a1(6, 23)),
  255. new _a2(30, new _a1(19, 16), new _a1(6, 17))), new _a3(22, new Array(6, 26, 50, 74, 98), new _a2(28,
  256. new _a1(2, 111), new _a1(7, 112)), new _a2(28, new _a1(17, 46)), new _a2(30, new _a1(7, 24),
  257. new _a1(16, 25)), new _a2(24, new _a1(34, 13))), new _a3(23, new Array(6, 30, 54, 74, 102), new _a2(30,
  258. new _a1(4, 121), new _a1(5, 122)), new _a2(28, new _a1(4, 47), new _a1(14, 48)), new _a2(30,
  259. new _a1(11, 24), new _a1(14, 25)), new _a2(30, new _a1(16, 15), new _a1(14, 16))), new _a3(24,
  260. new Array(6, 28, 54, 80, 106), new _a2(30, new _a1(6, 117), new _a1(4, 118)), new _a2(28, new _a1(6,
  261. 45), new _a1(14, 46)), new _a2(30, new _a1(11, 24), new _a1(16, 25)), new _a2(30, new _a1(30, 16),
  262. new _a1(2, 17))), new _a3(25, new Array(6, 32, 58, 84, 110), new _a2(26, new _a1(8, 106), new _a1(4,
  263. 107)), new _a2(28, new _a1(8, 47), new _a1(13, 48)), new _a2(30, new _a1(7, 24), new _a1(22, 25)),
  264. new _a2(30, new _a1(22, 15), new _a1(13, 16))), new _a3(26, new Array(6, 30, 58, 86, 114), new _a2(28,
  265. new _a1(10, 114), new _a1(2, 115)), new _a2(28, new _a1(19, 46), new _a1(4, 47)), new _a2(28,
  266. new _a1(28, 22), new _a1(6, 23)), new _a2(30, new _a1(33, 16), new _a1(4, 17))), new _a3(27, new Array(
  267. 6, 34, 62, 90, 118), new _a2(30, new _a1(8, 122), new _a1(4, 123)), new _a2(28, new _a1(22, 45),
  268. new _a1(3, 46)), new _a2(30, new _a1(8, 23), new _a1(26, 24)), new _a2(30, new _a1(12, 15), new _a1(
  269. 28, 16))), new _a3(28, new Array(6, 26, 50, 74, 98, 122), new _a2(30, new _a1(3, 117), new _a1(10,
  270. 118)), new _a2(28, new _a1(3, 45), new _a1(23, 46)), new _a2(30, new _a1(4, 24), new _a1(31, 25)),
  271. new _a2(30, new _a1(11, 15), new _a1(31, 16))), new _a3(29, new Array(6, 30, 54, 78, 102, 126), new _a2(
  272. 30, new _a1(7, 116), new _a1(7, 117)), new _a2(28, new _a1(21, 45), new _a1(7, 46)), new _a2(30,
  273. new _a1(1, 23), new _a1(37, 24)), new _a2(30, new _a1(19, 15), new _a1(26, 16))), new _a3(30, new Array(
  274. 6, 26, 52, 78, 104, 130), new _a2(30, new _a1(5, 115), new _a1(10, 116)), new _a2(28, new _a1(19,
  275. 47), new _a1(10, 48)), new _a2(30, new _a1(15, 24), new _a1(25, 25)), new _a2(30, new _a1(23, 15),
  276. new _a1(25, 16))), new _a3(31, new Array(6, 30, 56, 82, 108, 134), new _a2(30, new _a1(13, 115),
  277. new _a1(3, 116)), new _a2(28, new _a1(2, 46), new _a1(29, 47)), new _a2(30, new _a1(42, 24),
  278. new _a1(1, 25)), new _a2(30, new _a1(23, 15), new _a1(28, 16))), new _a3(32, new Array(6, 34, 60, 86,
  279. 112, 138), new _a2(30, new _a1(17, 115)), new _a2(28, new _a1(10, 46), new _a1(23, 47)), new _a2(30,
  280. new _a1(10, 24), new _a1(35, 25)), new _a2(30, new _a1(19, 15), new _a1(35, 16))), new _a3(33,
  281. new Array(6, 30, 58, 86, 114, 142), new _a2(30, new _a1(17, 115), new _a1(1, 116)), new _a2(28, new _a1(
  282. 14, 46), new _a1(21, 47)), new _a2(30, new _a1(29, 24), new _a1(19, 25)), new _a2(30, new _a1(11,
  283. 15), new _a1(46, 16))), new _a3(34, new Array(6, 34, 62, 90, 118, 146), new _a2(30, new _a1(13,
  284. 115), new _a1(6, 116)), new _a2(28, new _a1(14, 46), new _a1(23, 47)), new _a2(30, new _a1(44, 24),
  285. new _a1(7, 25)), new _a2(30, new _a1(59, 16), new _a1(1, 17))), new _a3(35, new Array(6, 30, 54, 78,
  286. 102, 126, 150), new _a2(30, new _a1(12, 121), new _a1(7, 122)), new _a2(28, new _a1(12, 47),
  287. new _a1(26, 48)), new _a2(30, new _a1(39, 24), new _a1(14, 25)), new _a2(30, new _a1(22, 15),
  288. new _a1(41, 16))), new _a3(36, new Array(6, 24, 50, 76, 102, 128, 154), new _a2(30, new _a1(6, 121),
  289. new _a1(14, 122)), new _a2(28, new _a1(6, 47), new _a1(34, 48)), new _a2(30, new _a1(46, 24),
  290. new _a1(10, 25)), new _a2(30, new _a1(2, 15), new _a1(64, 16))), new _a3(37, new Array(6, 28, 54, 80,
  291. 106, 132, 158), new _a2(30, new _a1(17, 122), new _a1(4, 123)), new _a2(28, new _a1(29, 46),
  292. new _a1(14, 47)), new _a2(30, new _a1(49, 24), new _a1(10, 25)), new _a2(30, new _a1(24, 15),
  293. new _a1(46, 16))), new _a3(38, new Array(6, 32, 58, 84, 110, 136, 162), new _a2(30, new _a1(4, 122),
  294. new _a1(18, 123)), new _a2(28, new _a1(13, 46), new _a1(32, 47)), new _a2(30, new _a1(48, 24),
  295. new _a1(14, 25)), new _a2(30, new _a1(42, 15), new _a1(32, 16))), new _a3(39, new Array(6, 26, 54, 82,
  296. 110, 138, 166), new _a2(30, new _a1(20, 117), new _a1(4, 118)), new _a2(28, new _a1(40, 47),
  297. new _a1(7, 48)), new _a2(30, new _a1(43, 24), new _a1(22, 25)), new _a2(30, new _a1(10, 15),
  298. new _a1(67, 16))), new _a3(40, new Array(6, 30, 58, 86, 114, 142, 170), new _a2(30, new _a1(19, 118),
  299. new _a1(6, 119)), new _a2(28, new _a1(18, 47), new _a1(31, 48)), new _a2(30, new _a1(34, 24),
  300. new _a1(34, 25)), new _a2(30, new _a1(20, 15), new _a1(61, 16))))
  301. }
  302. function _ae(i, f, c, h, e, b, g, d, a) {
  303. this.a11 = i;
  304. this.a12 = h;
  305. this.a13 = g;
  306. this.a21 = f;
  307. this.a22 = e;
  308. this.a23 = d;
  309. this.a31 = c;
  310. this.a32 = b;
  311. this.a33 = a;
  312. this._ad = function(v) {
  313. var s = v.length;
  314. var z = this.a11;
  315. var w = this.a12;
  316. var u = this.a13;
  317. var q = this.a21;
  318. var p = this.a22;
  319. var o = this.a23;
  320. var m = this.a31;
  321. var k = this.a32;
  322. var j = this.a33;
  323. for (var n = 0; n < s; n += 2) {
  324. var t = v[n];
  325. var r = v[n + 1];
  326. var l = u * t + o * r + j;
  327. v[n] = (z * t + q * r + m) / l;
  328. v[n + 1] = (w * t + p * r + k) / l
  329. }
  330. };
  331. this._fp = function(m, k) {
  332. var q = m.length;
  333. for (var l = 0; l < q; l++) {
  334. var j = m[l];
  335. var p = k[l];
  336. var o = this.a13 * j + this.a23 * p + this.a33;
  337. m[l] = (this.a11 * j + this.a21 * p + this.a31) / o;
  338. k[l] = (this.a12 * j + this.a22 * p + this.a32) / o
  339. }
  340. };
  341. this._fr = function() {
  342. return new _ae(this.a22 * this.a33 - this.a23 * this.a32, this.a23 * this.a31 - this.a21 * this.a33, this
  343. .a21 * this.a32 - this.a22 * this.a31, this.a13 * this.a32 - this.a12 * this.a33, this.a11 * this
  344. .a33 - this.a13 * this.a31, this.a12 * this.a31 - this.a11 * this.a32, this.a12 * this.a23 - this
  345. .a13 * this.a22, this.a13 * this.a21 - this.a11 * this.a23, this.a11 * this.a22 - this.a12 * this
  346. .a21)
  347. };
  348. this.times = function(j) {
  349. return new _ae(this.a11 * j.a11 + this.a21 * j.a12 + this.a31 * j.a13, this.a11 * j.a21 + this.a21 * j.a22 +
  350. this.a31 * j.a23, this.a11 * j.a31 + this.a21 * j.a32 + this.a31 * j.a33, this.a12 * j.a11 + this
  351. .a22 * j.a12 + this.a32 * j.a13, this.a12 * j.a21 + this.a22 * j.a22 + this.a32 * j.a23, this.a12 *
  352. j.a31 + this.a22 * j.a32 + this.a32 * j.a33, this.a13 * j.a11 + this.a23 * j.a12 + this.a33 * j.a13,
  353. this.a13 * j.a21 + this.a23 * j.a22 + this.a33 * j.a23, this.a13 * j.a31 + this.a23 * j.a32 + this
  354. .a33 * j.a33)
  355. }
  356. }
  357. _ae._ag = function(p, e, o, d, n, c, m, b, h, q, l, f, a, j, i, r) {
  358. var g = this._be(p, e, o, d, n, c, m, b);
  359. var k = this._bf(h, q, l, f, a, j, i, r);
  360. return k.times(g)
  361. };
  362. _ae._bf = function(d, p, c, m, b, k, a, j) {
  363. var h = j - k;
  364. var f = p - m + k - j;
  365. if (h == 0 && f == 0) {
  366. return new _ae(c - d, b - c, d, m - p, k - m, p, 0, 0, 1)
  367. } else {
  368. var q = c - b;
  369. var o = a - b;
  370. var l = d - c + b - a;
  371. var i = m - k;
  372. var e = q * h - o * i;
  373. var n = (l * h - o * f) / e;
  374. var g = (q * f - l * i) / e;
  375. return new _ae(c - d + n * c, a - d + g * a, d, m - p + n * m, j - p + g * j, p, n, g, 1)
  376. }
  377. };
  378. _ae._be = function(f, h, d, g, b, e, a, c) {
  379. return this._bf(f, h, d, g, b, e, a, c)._fr()
  380. };
  381. function _bg(b, a) {
  382. this.bits = b;
  383. this.points = a
  384. }
  385. function Detector(a) {
  386. this.image = a;
  387. this._am = null;
  388. this._bi = function(m, l, c, b) {
  389. var d = Math.abs(b - l) > Math.abs(c - m);
  390. if (d) {
  391. var r = m;
  392. m = l;
  393. l = r;
  394. r = c;
  395. c = b;
  396. b = r
  397. }
  398. var j = Math.abs(c - m);
  399. var i = Math.abs(b - l);
  400. var p = -j >> 1;
  401. var u = l < b ? 1 : -1;
  402. var f = m < c ? 1 : -1;
  403. var e = 0;
  404. for (var h = m, g = l; h != c; h += f) {
  405. var t = d ? g : h;
  406. var s = d ? h : g;
  407. if (e == 1) {
  408. if (this.image[t + s * qrcode.width]) {
  409. e++
  410. }
  411. } else {
  412. if (!this.image[t + s * qrcode.width]) {
  413. e++
  414. }
  415. }
  416. if (e == 3) {
  417. var o = h - m;
  418. var n = g - l;
  419. return Math.sqrt((o * o + n * n))
  420. }
  421. p += i;
  422. if (p > 0) {
  423. if (g == b) {
  424. break
  425. }
  426. g += u;
  427. p -= j
  428. }
  429. }
  430. var k = c - m;
  431. var q = b - l;
  432. return Math.sqrt((k * k + q * q))
  433. };
  434. this._bh = function(i, g, h, f) {
  435. var b = this._bi(i, g, h, f);
  436. var e = 1;
  437. var d = i - (h - i);
  438. if (d < 0) {
  439. e = i / (i - d);
  440. d = 0
  441. } else {
  442. if (d >= qrcode.width) {
  443. e = (qrcode.width - 1 - i) / (d - i);
  444. d = qrcode.width - 1
  445. }
  446. }
  447. var c = Math.floor(g - (f - g) * e);
  448. e = 1;
  449. if (c < 0) {
  450. e = g / (g - c);
  451. c = 0
  452. } else {
  453. if (c >= qrcode.height) {
  454. e = (qrcode.height - 1 - g) / (c - g);
  455. c = qrcode.height - 1
  456. }
  457. }
  458. d = Math.floor(i + (d - i) * e);
  459. b += this._bi(i, g, d, c);
  460. return b - 1
  461. };
  462. this._bj = function(c, d) {
  463. var b = this._bh(Math.floor(c.X), Math.floor(c.Y), Math.floor(d.X), Math.floor(d.Y));
  464. var e = this._bh(Math.floor(d.X), Math.floor(d.Y), Math.floor(c.X), Math.floor(c.Y));
  465. if (isNaN(b)) {
  466. return e / 7
  467. }
  468. if (isNaN(e)) {
  469. return b / 7
  470. }
  471. return (b + e) / 14
  472. };
  473. this._bk = function(d, c, b) {
  474. return (this._bj(d, c) + this._bj(d, b)) / 2
  475. };
  476. this.distance = function(d, b) {
  477. var e = d.X - b.X;
  478. var c = d.Y - b.Y;
  479. return Math.sqrt((e * e + c * c))
  480. };
  481. this._bx = function(g, f, d, e) {
  482. var b = Math.round(this.distance(g, f) / e);
  483. var c = Math.round(this.distance(g, d) / e);
  484. var h = ((b + c) >> 1) + 7;
  485. switch (h & 3) {
  486. case 0:
  487. h++;
  488. break;
  489. case 2:
  490. h--;
  491. break;
  492. case 3:
  493. throw "Error"
  494. }
  495. return h
  496. };
  497. this._bl = function(g, f, d, j) {
  498. var k = Math.floor(j * g);
  499. var h = Math.max(0, f - k);
  500. var i = Math.min(qrcode.width - 1, f + k);
  501. if (i - h < g * 3) {
  502. throw "Error"
  503. }
  504. var b = Math.max(0, d - k);
  505. var c = Math.min(qrcode.height - 1, d + k);
  506. var e = new _ak(this.image, h, b, i - h, c - b, g, this._am);
  507. return e.find()
  508. };
  509. this.createTransform = function(l, h, k, b, g) {
  510. var j = g - 3.5;
  511. var i;
  512. var f;
  513. var e;
  514. var c;
  515. if (b != null) {
  516. i = b.X;
  517. f = b.Y;
  518. e = c = j - 3
  519. } else {
  520. i = (h.X - l.X) + k.X;
  521. f = (h.Y - l.Y) + k.Y;
  522. e = c = j
  523. }
  524. var d = _ae._ag(3.5, 3.5, j, 3.5, e, c, 3.5, j, l.X, l.Y, h.X, h.Y, i, f, k.X, k.Y);
  525. return d
  526. };
  527. this._bz = function(e, b, d) {
  528. var c = _aa;
  529. return c._af(e, d, b)
  530. };
  531. this._cd = function(q) {
  532. var j = q._gq;
  533. var h = q._gs;
  534. var n = q._gp;
  535. var d = this._bk(j, h, n);
  536. if (d < 1) {
  537. throw "Error"
  538. }
  539. var r = this._bx(j, h, n, d);
  540. var b = _a3._at(r);
  541. var k = b._cr - 7;
  542. var l = null;
  543. if (b._as.length > 0) {
  544. var f = h.X - j.X + n.X;
  545. var e = h.Y - j.Y + n.Y;
  546. var c = 1 - 3 / k;
  547. var t = Math.floor(j.X + c * (f - j.X));
  548. var s = Math.floor(j.Y + c * (e - j.Y));
  549. for (var p = 4; p <= 16; p <<= 1) {
  550. l = this._bl(d, t, s, p);
  551. break
  552. }
  553. }
  554. var g = this.createTransform(j, h, n, l, r);
  555. var m = this._bz(this.image, g, r);
  556. var o;
  557. if (l == null) {
  558. o = new Array(n, j, h)
  559. } else {
  560. o = new Array(n, j, h, l)
  561. }
  562. return new _bg(m, o)
  563. };
  564. this.detect = function() {
  565. var b = new _cc()._ce(this.image);
  566. return this._cd(b)
  567. }
  568. }
  569. var _ca = 21522;
  570. var _cb = new Array(new Array(21522, 0), new Array(20773, 1), new Array(24188, 2), new Array(23371, 3), new Array(17913,
  571. 4), new Array(16590, 5), new Array(20375, 6), new Array(19104, 7), new Array(30660, 8), new Array(29427, 9),
  572. new Array(32170, 10), new Array(30877, 11), new Array(26159, 12), new Array(25368, 13), new Array(27713, 14),
  573. new Array(26998, 15), new Array(5769, 16), new Array(5054, 17), new Array(7399, 18), new Array(6608, 19),
  574. new Array(1890, 20), new Array(597, 21), new Array(3340, 22), new Array(2107, 23), new Array(13663, 24),
  575. new Array(12392, 25), new Array(16177, 26), new Array(14854, 27), new Array(9396, 28), new Array(8579, 29),
  576. new Array(11994, 30), new Array(11245, 31));
  577. var _ch = new Array(0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4);
  578. function _ax(a) {
  579. this._cf = _cg.forBits((a >> 3) & 3);
  580. this._fe = (a & 7);
  581. this.__defineGetter__("_cg", function() {
  582. return this._cf
  583. });
  584. this.__defineGetter__("_dx", function() {
  585. return this._fe
  586. });
  587. this.GetHashCode = function() {
  588. return (this._cf.ordinal() << 3) | _fe
  589. };
  590. this.Equals = function(c) {
  591. var b = c;
  592. return this._cf == b._cf && this._fe == b._fe
  593. }
  594. }
  595. _ax._gj = function(d, c) {
  596. d ^= c;
  597. return _ch[d & 15] + _ch[(_ew(d, 4) & 15)] + _ch[(_ew(d, 8) & 15)] + _ch[(_ew(d, 12) & 15)] + _ch[(_ew(d, 16) &
  598. 15)] + _ch[(_ew(d, 20) & 15)] + _ch[(_ew(d, 24) & 15)] + _ch[(_ew(d, 28) & 15)]
  599. };
  600. _ax._ci = function(a) {
  601. var b = _ax._cj(a);
  602. if (b != null) {
  603. return b
  604. }
  605. return _ax._cj(a ^ _ca)
  606. };
  607. _ax._cj = function(d) {
  608. var b = 4294967295;
  609. var a = 0;
  610. for (var c = 0; c < _cb.length; c++) {
  611. var g = _cb[c];
  612. var f = g[0];
  613. if (f == d) {
  614. return new _ax(g[1])
  615. }
  616. var e = this._gj(d, f);
  617. if (e < b) {
  618. a = g[1];
  619. b = e
  620. }
  621. }
  622. if (b <= 3) {
  623. return new _ax(a)
  624. }
  625. return null
  626. };
  627. function _cg(a, c, b) {
  628. this._ff = a;
  629. this.bits = c;
  630. this.name = b;
  631. this.__defineGetter__("Bits", function() {
  632. return this.bits
  633. });
  634. this.__defineGetter__("Name", function() {
  635. return this.name
  636. });
  637. this.ordinal = function() {
  638. return this._ff
  639. }
  640. }
  641. _cg.forBits = function(a) {
  642. if (a < 0 || a >= FOR_BITS.length) {
  643. throw "bad arguments"
  644. }
  645. return FOR_BITS[a]
  646. };
  647. var L = new _cg(0, 1, "L");
  648. var M = new _cg(1, 0, "M");
  649. var Q = new _cg(2, 3, "Q");
  650. var H = new _cg(3, 2, "H");
  651. var FOR_BITS = new Array(M, L, H, Q);
  652. function _ac(d, a) {
  653. if (!a) {
  654. a = d
  655. }
  656. if (d < 1 || a < 1) {
  657. throw "Both dimensions must be greater than 0"
  658. }
  659. this.width = d;
  660. this.height = a;
  661. var c = d >> 5;
  662. if ((d & 31) != 0) {
  663. c++
  664. }
  665. this.rowSize = c;
  666. this.bits = new Array(c * a);
  667. for (var b = 0; b < this.bits.length; b++) {
  668. this.bits[b] = 0
  669. }
  670. this.__defineGetter__("Width", function() {
  671. return this.width
  672. });
  673. this.__defineGetter__("Height", function() {
  674. return this.height
  675. });
  676. this.__defineGetter__("Dimension", function() {
  677. if (this.width != this.height) {
  678. throw "Can't call getDimension() on a non-square matrix"
  679. }
  680. return this.width
  681. });
  682. this._ds = function(e, g) {
  683. var f = g * this.rowSize + (e >> 5);
  684. return ((_ew(this.bits[f], (e & 31))) & 1) != 0
  685. };
  686. this._dq = function(e, g) {
  687. var f = g * this.rowSize + (e >> 5);
  688. this.bits[f] |= 1 << (e & 31)
  689. };
  690. this.flip = function(e, g) {
  691. var f = g * this.rowSize + (e >> 5);
  692. this.bits[f] ^= 1 << (e & 31)
  693. };
  694. this.clear = function() {
  695. var e = this.bits.length;
  696. for (var f = 0; f < e; f++) {
  697. this.bits[f] = 0
  698. }
  699. };
  700. this._bq = function(g, j, f, m) {
  701. if (j < 0 || g < 0) {
  702. throw "Left and top must be nonnegative"
  703. }
  704. if (m < 1 || f < 1) {
  705. throw "Height and width must be at least 1"
  706. }
  707. var l = g + f;
  708. var e = j + m;
  709. if (e > this.height || l > this.width) {
  710. throw "The region must fit inside the matrix"
  711. }
  712. for (var i = j; i < e; i++) {
  713. var h = i * this.rowSize;
  714. for (var k = g; k < l; k++) {
  715. this.bits[h + (k >> 5)] |= 1 << (k & 31)
  716. }
  717. }
  718. }
  719. }
  720. function _dl(a, b) {
  721. this._dv = a;
  722. this._dw = b;
  723. this.__defineGetter__("_du", function() {
  724. return this._dv
  725. });
  726. this.__defineGetter__("Codewords", function() {
  727. return this._dw
  728. })
  729. }
  730. _dl._gn = function(c, h, r) {
  731. if (c.length != h._dp) {
  732. throw "bad arguments"
  733. }
  734. var k = h._bu(r);
  735. var e = 0;
  736. var d = k._fb();
  737. for (var q = 0; q < d.length; q++) {
  738. e += d[q].Count
  739. }
  740. var l = new Array(e);
  741. var n = 0;
  742. for (var o = 0; o < d.length; o++) {
  743. var f = d[o];
  744. for (var q = 0; q < f.Count; q++) {
  745. var m = f._dm;
  746. var s = k._bo + m;
  747. l[n++] = new _dl(m, new Array(s))
  748. }
  749. }
  750. var t = l[0]._dw.length;
  751. var b = l.length - 1;
  752. while (b >= 0) {
  753. var v = l[b]._dw.length;
  754. if (v == t) {
  755. break
  756. }
  757. b--
  758. }
  759. b++;
  760. var g = t - k._bo;
  761. var a = 0;
  762. for (var q = 0; q < g; q++) {
  763. for (var o = 0; o < n; o++) {
  764. l[o]._dw[q] = c[a++]
  765. }
  766. }
  767. for (var o = b; o < n; o++) {
  768. l[o]._dw[g] = c[a++]
  769. }
  770. var p = l[0]._dw.length;
  771. for (var q = g; q < p; q++) {
  772. for (var o = 0; o < n; o++) {
  773. var u = o < b ? q : q + 1;
  774. l[o]._dw[u] = c[a++]
  775. }
  776. }
  777. return l
  778. };
  779. function _cl(a) {
  780. var b = a.Dimension;
  781. if (b < 21 || (b & 3) != 1) {
  782. throw "Error _cl"
  783. }
  784. this._au = a;
  785. this._cp = null;
  786. this._co = null;
  787. this._dk = function(d, c, e) {
  788. return this._au._ds(d, c) ? (e << 1) | 1 : e << 1
  789. };
  790. this._cm = function() {
  791. if (this._co != null) {
  792. return this._co
  793. }
  794. var g = 0;
  795. for (var e = 0; e < 6; e++) {
  796. g = this._dk(e, 8, g)
  797. }
  798. g = this._dk(7, 8, g);
  799. g = this._dk(8, 8, g);
  800. g = this._dk(8, 7, g);
  801. for (var c = 5; c >= 0; c--) {
  802. g = this._dk(8, c, g)
  803. }
  804. this._co = _ax._ci(g);
  805. if (this._co != null) {
  806. return this._co
  807. }
  808. var f = this._au.Dimension;
  809. g = 0;
  810. var d = f - 8;
  811. for (var e = f - 1; e >= d; e--) {
  812. g = this._dk(e, 8, g)
  813. }
  814. for (var c = f - 7; c < f; c++) {
  815. g = this._dk(8, c, g)
  816. }
  817. this._co = _ax._ci(g);
  818. if (this._co != null) {
  819. return this._co
  820. }
  821. throw "Error _cm"
  822. };
  823. this._cq = function() {
  824. if (this._cp != null) {
  825. return this._cp
  826. }
  827. var h = this._au.Dimension;
  828. var f = (h - 17) >> 2;
  829. if (f <= 6) {
  830. return _a3._av(f)
  831. }
  832. var g = 0;
  833. var e = h - 11;
  834. for (var c = 5; c >= 0; c--) {
  835. for (var d = h - 9; d >= e; d--) {
  836. g = this._dk(d, c, g)
  837. }
  838. }
  839. this._cp = _a3._aw(g);
  840. if (this._cp != null && this._cp._cr == h) {
  841. return this._cp
  842. }
  843. g = 0;
  844. for (var d = 5; d >= 0; d--) {
  845. for (var c = h - 9; c >= e; c--) {
  846. g = this._dk(d, c, g)
  847. }
  848. }
  849. this._cp = _a3._aw(g);
  850. if (this._cp != null && this._cp._cr == h) {
  851. return this._cp
  852. }
  853. throw "Error _cq"
  854. };
  855. this._gk = function() {
  856. var q = this._cm();
  857. var o = this._cq();
  858. var c = _dx._gl(q._dx);
  859. var f = this._au.Dimension;
  860. c._dj(this._au, f);
  861. var k = o._aq();
  862. var n = true;
  863. var r = new Array(o._dp);
  864. var m = 0;
  865. var p = 0;
  866. var h = 0;
  867. for (var e = f - 1; e > 0; e -= 2) {
  868. if (e == 6) {
  869. e--
  870. }
  871. for (var l = 0; l < f; l++) {
  872. var g = n ? f - 1 - l : l;
  873. for (var d = 0; d < 2; d++) {
  874. if (!k._ds(e - d, g)) {
  875. h++;
  876. p <<= 1;
  877. if (this._au._ds(e - d, g)) {
  878. p |= 1
  879. }
  880. if (h == 8) {
  881. r[m++] = p;
  882. h = 0;
  883. p = 0
  884. }
  885. }
  886. }
  887. }
  888. n ^= true
  889. }
  890. if (m != o._dp) {
  891. throw "Error _gk"
  892. }
  893. return r
  894. }
  895. }
  896. var _dx = {};
  897. _dx._gl = function(a) {
  898. if (a < 0 || a > 7) {
  899. throw "bad arguments"
  900. }
  901. return _dx._dy[a]
  902. };
  903. function _fg() {
  904. this._dj = function(c, d) {
  905. for (var b = 0; b < d; b++) {
  906. for (var a = 0; a < d; a++) {
  907. if (this._fw(b, a)) {
  908. c.flip(a, b)
  909. }
  910. }
  911. }
  912. };
  913. this._fw = function(b, a) {
  914. return ((b + a) & 1) == 0
  915. }
  916. }
  917. function _fh() {
  918. this._dj = function(c, d) {
  919. for (var b = 0; b < d; b++) {
  920. for (var a = 0; a < d; a++) {
  921. if (this._fw(b, a)) {
  922. c.flip(a, b)
  923. }
  924. }
  925. }
  926. };
  927. this._fw = function(b, a) {
  928. return (b & 1) == 0
  929. }
  930. }
  931. function _fi() {
  932. this._dj = function(c, d) {
  933. for (var b = 0; b < d; b++) {
  934. for (var a = 0; a < d; a++) {
  935. if (this._fw(b, a)) {
  936. c.flip(a, b)
  937. }
  938. }
  939. }
  940. };
  941. this._fw = function(b, a) {
  942. return a % 3 == 0
  943. }
  944. }
  945. function _fj() {
  946. this._dj = function(c, d) {
  947. for (var b = 0; b < d; b++) {
  948. for (var a = 0; a < d; a++) {
  949. if (this._fw(b, a)) {
  950. c.flip(a, b)
  951. }
  952. }
  953. }
  954. };
  955. this._fw = function(b, a) {
  956. return (b + a) % 3 == 0
  957. }
  958. }
  959. function _fk() {
  960. this._dj = function(c, d) {
  961. for (var b = 0; b < d; b++) {
  962. for (var a = 0; a < d; a++) {
  963. if (this._fw(b, a)) {
  964. c.flip(a, b)
  965. }
  966. }
  967. }
  968. };
  969. this._fw = function(b, a) {
  970. return (((_ew(b, 1)) + (a / 3)) & 1) == 0
  971. }
  972. }
  973. function _fl() {
  974. this._dj = function(c, d) {
  975. for (var b = 0; b < d; b++) {
  976. for (var a = 0; a < d; a++) {
  977. if (this._fw(b, a)) {
  978. c.flip(a, b)
  979. }
  980. }
  981. }
  982. };
  983. this._fw = function(c, b) {
  984. var a = c * b;
  985. return (a & 1) + (a % 3) == 0
  986. }
  987. }
  988. function _fm() {
  989. this._dj = function(c, d) {
  990. for (var b = 0; b < d; b++) {
  991. for (var a = 0; a < d; a++) {
  992. if (this._fw(b, a)) {
  993. c.flip(a, b)
  994. }
  995. }
  996. }
  997. };
  998. this._fw = function(c, b) {
  999. var a = c * b;
  1000. return (((a & 1) + (a % 3)) & 1) == 0
  1001. }
  1002. }
  1003. function _fn() {
  1004. this._dj = function(c, d) {
  1005. for (var b = 0; b < d; b++) {
  1006. for (var a = 0; a < d; a++) {
  1007. if (this._fw(b, a)) {
  1008. c.flip(a, b)
  1009. }
  1010. }
  1011. }
  1012. };
  1013. this._fw = function(b, a) {
  1014. return ((((b + a) & 1) + ((b * a) % 3)) & 1) == 0
  1015. }
  1016. }
  1017. _dx._dy = new Array(new _fg(), new _fh(), new _fi(), new _fj(), new _fk(), new _fl(), new _fm(), new _fn());
  1018. function _db(a) {
  1019. this._fa = a;
  1020. this.decode = function(j, f) {
  1021. var c = new _bp(this._fa, j);
  1022. var p = new Array(f);
  1023. for (var g = 0; g < p.length; g++) {
  1024. p[g] = 0
  1025. }
  1026. var m = false;
  1027. var d = true;
  1028. for (var g = 0; g < f; g++) {
  1029. var q = c.evaluateAt(this._fa.exp(m ? g + 1 : g));
  1030. p[p.length - 1 - g] = q;
  1031. if (q != 0) {
  1032. d = false
  1033. }
  1034. }
  1035. if (d) {
  1036. return
  1037. }
  1038. var b = new _bp(this._fa, p);
  1039. var l = this._eb(this._fa._ba(f, 1), b, f);
  1040. var o = l[0];
  1041. var n = l[1];
  1042. var k = this._ey(o);
  1043. var e = this._di(n, k, m);
  1044. for (var g = 0; g < k.length; g++) {
  1045. var h = j.length - 1 - this._fa.log(k[g]);
  1046. if (h < 0) {
  1047. throw "ReedSolomonException Bad error location"
  1048. }
  1049. j[h] = _az._bd(j[h], e[g])
  1050. }
  1051. };
  1052. this._eb = function(z, y, f) {
  1053. if (z._ec < y._ec) {
  1054. var w = z;
  1055. z = y;
  1056. y = w
  1057. }
  1058. var B = z;
  1059. var k = y;
  1060. var o = this._fa.One;
  1061. var j = this._fa.Zero;
  1062. var e = this._fa.Zero;
  1063. var i = this._fa.One;
  1064. while (k._ec >= Math.floor(f / 2)) {
  1065. var x = B;
  1066. var g = o;
  1067. var v = e;
  1068. B = k;
  1069. o = j;
  1070. e = i;
  1071. if (B.Zero) {
  1072. throw "r_{i-1} was zero"
  1073. }
  1074. k = x;
  1075. var m = this._fa.Zero;
  1076. var p = B._ex(B._ec);
  1077. var h = this._fa.inverse(p);
  1078. while (k._ec >= B._ec && !k.Zero) {
  1079. var c = k._ec - B._ec;
  1080. var A = this._fa.multiply(k._ex(k._ec), h);
  1081. m = m._bd(this._fa._ba(c, A));
  1082. k = k._bd(B._dc(c, A))
  1083. }
  1084. j = m.multiply1(o)._bd(g);
  1085. i = m.multiply1(e)._bd(v)
  1086. }
  1087. var u = i._ex(0);
  1088. if (u == 0) {
  1089. throw "ReedSolomonException sigmaTilde(0) was zero"
  1090. }
  1091. var d = this._fa.inverse(u);
  1092. var n = i.multiply2(d);
  1093. var l = k.multiply2(d);
  1094. return new Array(n, l)
  1095. };
  1096. this._ey = function(f) {
  1097. var g = f._ec;
  1098. if (g == 1) {
  1099. return new Array(f._ex(1))
  1100. }
  1101. var b = new Array(g);
  1102. var d = 0;
  1103. for (var c = 1; c < 256 && d < g; c++) {
  1104. if (f.evaluateAt(c) == 0) {
  1105. b[d] = this._fa.inverse(c);
  1106. d++
  1107. }
  1108. }
  1109. if (d != g) {
  1110. throw "Error locator degree does not match number of roots"
  1111. }
  1112. return b
  1113. };
  1114. this._di = function(f, h, g) {
  1115. var k = h.length;
  1116. var l = new Array(k);
  1117. for (var e = 0; e < k; e++) {
  1118. var b = this._fa.inverse(h[e]);
  1119. var c = 1;
  1120. for (var d = 0; d < k; d++) {
  1121. if (e != d) {
  1122. c = this._fa.multiply(c, _az._bd(1, this._fa.multiply(h[d], b)))
  1123. }
  1124. }
  1125. l[e] = this._fa.multiply(f.evaluateAt(b), this._fa.inverse(c));
  1126. if (g) {
  1127. l[e] = this._fa.multiply(l[e], b)
  1128. }
  1129. }
  1130. return l
  1131. }
  1132. }
  1133. function _bp(f, e) {
  1134. if (e == null || e.length == 0) {
  1135. throw "bad arguments"
  1136. }
  1137. this._fa = f;
  1138. var c = e.length;
  1139. if (c > 1 && e[0] == 0) {
  1140. var d = 1;
  1141. while (d < c && e[d] == 0) {
  1142. d++
  1143. }
  1144. if (d == c) {
  1145. this._dd = f.Zero._dd
  1146. } else {
  1147. this._dd = new Array(c - d);
  1148. for (var b = 0; b < this._dd.length; b++) {
  1149. this._dd[b] = 0
  1150. }
  1151. for (var a = 0; a < this._dd.length; a++) {
  1152. this._dd[a] = e[d + a]
  1153. }
  1154. }
  1155. } else {
  1156. this._dd = e
  1157. }
  1158. this.__defineGetter__("Zero", function() {
  1159. return this._dd[0] == 0
  1160. });
  1161. this.__defineGetter__("_ec", function() {
  1162. return this._dd.length - 1
  1163. });
  1164. this.__defineGetter__("Coefficients", function() {
  1165. return this._dd
  1166. });
  1167. this._ex = function(g) {
  1168. return this._dd[this._dd.length - 1 - g]
  1169. };
  1170. this.evaluateAt = function(h) {
  1171. if (h == 0) {
  1172. return this._ex(0)
  1173. }
  1174. var l = this._dd.length;
  1175. if (h == 1) {
  1176. var g = 0;
  1177. for (var k = 0; k < l; k++) {
  1178. g = _az._bd(g, this._dd[k])
  1179. }
  1180. return g
  1181. }
  1182. var j = this._dd[0];
  1183. for (var k = 1; k < l; k++) {
  1184. j = _az._bd(this._fa.multiply(h, j), this._dd[k])
  1185. }
  1186. return j
  1187. };
  1188. this._bd = function(g) {
  1189. if (this._fa != g._fa) {
  1190. throw "GF256Polys do not have same _az _fa"
  1191. }
  1192. if (this.Zero) {
  1193. return g
  1194. }
  1195. if (g.Zero) {
  1196. return this
  1197. }
  1198. var o = this._dd;
  1199. var n = g._dd;
  1200. if (o.length > n.length) {
  1201. var j = o;
  1202. o = n;
  1203. n = j
  1204. }
  1205. var h = new Array(n.length);
  1206. var k = n.length - o.length;
  1207. for (var m = 0; m < k; m++) {
  1208. h[m] = n[m]
  1209. }
  1210. for (var l = k; l < n.length; l++) {
  1211. h[l] = _az._bd(o[l - k], n[l])
  1212. }
  1213. return new _bp(f, h)
  1214. };
  1215. this.multiply1 = function(o) {
  1216. if (this._fa != o._fa) {
  1217. throw "GF256Polys do not have same _az _fa"
  1218. }
  1219. if (this.Zero || o.Zero) {
  1220. return this._fa.Zero
  1221. }
  1222. var q = this._dd;
  1223. var g = q.length;
  1224. var l = o._dd;
  1225. var n = l.length;
  1226. var p = new Array(g + n - 1);
  1227. for (var m = 0; m < g; m++) {
  1228. var h = q[m];
  1229. for (var k = 0; k < n; k++) {
  1230. p[m + k] = _az._bd(p[m + k], this._fa.multiply(h, l[k]))
  1231. }
  1232. }
  1233. return new _bp(this._fa, p)
  1234. };
  1235. this.multiply2 = function(g) {
  1236. if (g == 0) {
  1237. return this._fa.Zero
  1238. }
  1239. if (g == 1) {
  1240. return this
  1241. }
  1242. var j = this._dd.length;
  1243. var k = new Array(j);
  1244. for (var h = 0; h < j; h++) {
  1245. k[h] = this._fa.multiply(this._dd[h], g)
  1246. }
  1247. return new _bp(this._fa, k)
  1248. };
  1249. this._dc = function(l, g) {
  1250. if (l < 0) {
  1251. throw "bad arguments"
  1252. }
  1253. if (g == 0) {
  1254. return this._fa.Zero
  1255. }
  1256. var j = this._dd.length;
  1257. var k = new Array(j + l);
  1258. for (var h = 0; h < k.length; h++) {
  1259. k[h] = 0
  1260. }
  1261. for (var h = 0; h < j; h++) {
  1262. k[h] = this._fa.multiply(this._dd[h], g)
  1263. }
  1264. return new _bp(this._fa, k)
  1265. };
  1266. this.divide = function(l) {
  1267. if (this._fa != l._fa) {
  1268. throw "GF256Polys do not have same _az _fa"
  1269. }
  1270. if (l.Zero) {
  1271. throw "Divide by 0"
  1272. }
  1273. var j = this._fa.Zero;
  1274. var o = this;
  1275. var g = l._ex(l._ec);
  1276. var n = this._fa.inverse(g);
  1277. while (o._ec >= l._ec && !o.Zero) {
  1278. var m = o._ec - l._ec;
  1279. var h = this._fa.multiply(o._ex(o._ec), n);
  1280. var i = l._dc(m, h);
  1281. var k = this._fa._ba(m, h);
  1282. j = j._bd(k);
  1283. o = o._bd(i)
  1284. }
  1285. return new Array(j, o)
  1286. }
  1287. }
  1288. function _az(b) {
  1289. this._gh = new Array(256);
  1290. this._gi = new Array(256);
  1291. var a = 1;
  1292. for (var e = 0; e < 256; e++) {
  1293. this._gh[e] = a;
  1294. a <<= 1;
  1295. if (a >= 256) {
  1296. a ^= b
  1297. }
  1298. }
  1299. for (var e = 0; e < 255; e++) {
  1300. this._gi[this._gh[e]] = e
  1301. }
  1302. var d = new Array(1);
  1303. d[0] = 0;
  1304. this.zero = new _bp(this, new Array(d));
  1305. var c = new Array(1);
  1306. c[0] = 1;
  1307. this.one = new _bp(this, new Array(c));
  1308. this.__defineGetter__("Zero", function() {
  1309. return this.zero
  1310. });
  1311. this.__defineGetter__("One", function() {
  1312. return this.one
  1313. });
  1314. this._ba = function(j, f) {
  1315. if (j < 0) {
  1316. throw "bad arguments"
  1317. }
  1318. if (f == 0) {
  1319. return zero
  1320. }
  1321. var h = new Array(j + 1);
  1322. for (var g = 0; g < h.length; g++) {
  1323. h[g] = 0
  1324. }
  1325. h[0] = f;
  1326. return new _bp(this, h)
  1327. };
  1328. this.exp = function(f) {
  1329. return this._gh[f]
  1330. };
  1331. this.log = function(f) {
  1332. if (f == 0) {
  1333. throw "bad arguments"
  1334. }
  1335. return this._gi[f]
  1336. };
  1337. this.inverse = function(f) {
  1338. if (f == 0) {
  1339. throw "System.ArithmeticException"
  1340. }
  1341. return this._gh[255 - this._gi[f]]
  1342. };
  1343. this.multiply = function(g, f) {
  1344. if (g == 0 || f == 0) {
  1345. return 0
  1346. }
  1347. if (g == 1) {
  1348. return f
  1349. }
  1350. if (f == 1) {
  1351. return g
  1352. }
  1353. return this._gh[(this._gi[g] + this._gi[f]) % 255]
  1354. }
  1355. }
  1356. _az._bb = new _az(285);
  1357. _az._bc = new _az(301);
  1358. _az._bd = function(d, c) {
  1359. return d ^ c
  1360. };
  1361. var Decoder = {};
  1362. Decoder.rsDecoder = new _db(_az._bb);
  1363. Decoder.correctErrors = function(g, b) {
  1364. var d = g.length;
  1365. var f = new Array(d);
  1366. for (var e = 0; e < d; e++) {
  1367. f[e] = g[e] & 255
  1368. }
  1369. var a = g.length - b;
  1370. try {
  1371. Decoder.rsDecoder.decode(f, a)
  1372. } catch (c) {
  1373. throw c
  1374. }
  1375. for (var e = 0; e < b; e++) {
  1376. g[e] = f[e]
  1377. }
  1378. };
  1379. Decoder.decode = function(q) {
  1380. var b = new _cl(q);
  1381. var o = b._cq();
  1382. var c = b._cm()._cg;
  1383. var p = b._gk();
  1384. var a = _dl._gn(p, o, c);
  1385. var f = 0;
  1386. for (var k = 0; k < a.length; k++) {
  1387. f += a[k]._du
  1388. }
  1389. var e = new Array(f);
  1390. var n = 0;
  1391. for (var h = 0; h < a.length; h++) {
  1392. var m = a[h];
  1393. var d = m.Codewords;
  1394. var g = m._du;
  1395. Decoder.correctErrors(d, g);
  1396. for (var k = 0; k < g; k++) {
  1397. e[n++] = d[k]
  1398. }
  1399. }
  1400. var l = new QRCodeDataBlockReader(e, o._fd, c.Bits);
  1401. return l
  1402. };
  1403. var qrcode = {};
  1404. qrcode.imagedata = null;
  1405. qrcode.width = 0;
  1406. qrcode.height = 0;
  1407. qrcode.qrCodeSymbol = null;
  1408. qrcode.debug = false;
  1409. qrcode.maxImgSize = 1024 * 1024;
  1410. qrcode._eo = [
  1411. [10, 9, 8, 8],
  1412. [12, 11, 16, 10],
  1413. [14, 13, 16, 12]
  1414. ];
  1415. qrcode.callback = null;
  1416. qrcode.vidSuccess = function(a) {
  1417. qrcode.localstream = a;
  1418. if (qrcode.webkit) {
  1419. qrcode.video.src = window.webkitURL.createObjectURL(a)
  1420. } else {
  1421. if (qrcode.moz) {
  1422. qrcode.video.mozSrcObject = a;
  1423. qrcode.video.play()
  1424. } else {
  1425. qrcode.video.src = a
  1426. }
  1427. }
  1428. qrcode.gUM = true;
  1429. qrcode.canvas_qr2 = document.createElement("canvas");
  1430. qrcode.canvas_qr2.id = "qr-canvas";
  1431. qrcode.qrcontext2 = qrcode.canvas_qr2.getContext("2d");
  1432. qrcode.canvas_qr2.width = qrcode.video.videoWidth;
  1433. qrcode.canvas_qr2.height = qrcode.video.videoHeight;
  1434. setTimeout(qrcode.captureToCanvas, 500)
  1435. };
  1436. qrcode.vidError = function(a) {
  1437. qrcode.gUM = false;
  1438. return
  1439. };
  1440. qrcode.captureToCanvas = function() {
  1441. if (qrcode.gUM) {
  1442. try {
  1443. if (qrcode.video.videoWidth == 0) {
  1444. setTimeout(qrcode.captureToCanvas, 500);
  1445. return
  1446. } else {
  1447. qrcode.canvas_qr2.width = qrcode.video.videoWidth;
  1448. qrcode.canvas_qr2.height = qrcode.video.videoHeight
  1449. }
  1450. qrcode.qrcontext2.drawImage(qrcode.video, 0, 0);
  1451. try {
  1452. qrcode.decode()
  1453. } catch (a) {
  1454. console.log(a);
  1455. setTimeout(qrcode.captureToCanvas, 500)
  1456. }
  1457. } catch (a) {
  1458. console.log(a);
  1459. setTimeout(qrcode.captureToCanvas, 500)
  1460. }
  1461. }
  1462. };
  1463. qrcode.setWebcam = function(c) {
  1464. var d = navigator;
  1465. qrcode.video = document.getElementById(c);
  1466. var a = true;
  1467. if (navigator.mediaDevices && navigator.mediaDevices.enumerateDevices) {
  1468. try {
  1469. navigator.mediaDevices.enumerateDevices().then(function(e) {
  1470. e.forEach(function(f) {
  1471. console.log("deb1");
  1472. if (f.kind === "videoinput") {
  1473. if (f.label.toLowerCase().search("back") > -1) {
  1474. a = [{
  1475. sourceId: f.deviceId
  1476. }]
  1477. }
  1478. }
  1479. console.log(f.kind + ": " + f.label + " id = " + f.deviceId)
  1480. })
  1481. })
  1482. } catch (b) {
  1483. console.log(b)
  1484. }
  1485. } else {
  1486. console.log("no navigator.mediaDevices.enumerateDevices")
  1487. }
  1488. if (d.getUserMedia) {
  1489. d.getUserMedia({
  1490. video: a,
  1491. audio: false
  1492. }, qrcode.vidSuccess, qrcode.vidError)
  1493. } else {
  1494. if (d.webkitGetUserMedia) {
  1495. qrcode.webkit = true;
  1496. d.webkitGetUserMedia({
  1497. video: a,
  1498. audio: false
  1499. }, qrcode.vidSuccess, qrcode.vidError)
  1500. } else {
  1501. if (d.mozGetUserMedia) {
  1502. qrcode.moz = true;
  1503. d.mozGetUserMedia({
  1504. video: a,
  1505. audio: false
  1506. }, qrcode.vidSuccess, qrcode.vidError)
  1507. }
  1508. }
  1509. }
  1510. };
  1511. qrcode.decode = function(d) {
  1512. if (arguments.length == 0) {
  1513. if (qrcode.canvas_qr2) {
  1514. var b = qrcode.canvas_qr2;
  1515. var a = qrcode.qrcontext2
  1516. } else {
  1517. var b = document.getElementById("qr-canvas");
  1518. var a = b.getContext("2d")
  1519. }
  1520. qrcode.width = b.width;
  1521. qrcode.height = b.height;
  1522. qrcode.imagedata = a.getImageData(0, 0, qrcode.width, qrcode.height);
  1523. qrcode.result = qrcode.process(a);
  1524. if (qrcode.callback != null) {
  1525. qrcode.callback(qrcode.result)
  1526. }
  1527. return qrcode.result
  1528. } else {
  1529. var c = new Image();
  1530. c.crossOrigin = "Anonymous";
  1531. c.onload = function() {
  1532. var g = document.getElementById("out-canvas");
  1533. if (g != null) {
  1534. var j = g.getContext("2d");
  1535. j.clearRect(0, 0, 320, 240);
  1536. j.drawImage(c, 0, 0, 320, 240)
  1537. }
  1538. var i = document.createElement("canvas");
  1539. var h = i.getContext("2d");
  1540. var f = c.height;
  1541. var l = c.width;
  1542. if (c.width * c.height > qrcode.maxImgSize) {
  1543. var k = c.width / c.height;
  1544. f = Math.sqrt(qrcode.maxImgSize / k);
  1545. l = k * f
  1546. }
  1547. i.width = l;
  1548. i.height = f;
  1549. h.drawImage(c, 0, 0, i.width, i.height);
  1550. qrcode.width = i.width;
  1551. qrcode.height = i.height;
  1552. try {
  1553. qrcode.imagedata = h.getImageData(0, 0, i.width, i.height)
  1554. } catch (m) {
  1555. qrcode.result =
  1556. "Cross domain image reading not supported in your browser! Save it to your computer then drag and drop the file!";
  1557. if (qrcode.callback != null) {
  1558. qrcode.callback(qrcode.result)
  1559. }
  1560. return
  1561. }
  1562. try {
  1563. qrcode.result = qrcode.process(h)
  1564. } catch (m) {
  1565. console.log(m);
  1566. qrcode.result = "error decoding QR Code"
  1567. }
  1568. if (qrcode.callback != null) {
  1569. qrcode.callback(qrcode.result)
  1570. }
  1571. };
  1572. c.onerror = function() {
  1573. if (qrcode.callback != null) {
  1574. qrcode.callback("Failed to load the image")
  1575. }
  1576. };
  1577. c.src = d
  1578. }
  1579. };
  1580. qrcode.isUrl = function(a) {
  1581. var b = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;
  1582. return b.test(a)
  1583. };
  1584. qrcode.decode_url = function(b) {
  1585. var d = "";
  1586. try {
  1587. d = escape(b)
  1588. } catch (c) {
  1589. console.log(c);
  1590. d = b
  1591. }
  1592. var a = "";
  1593. try {
  1594. a = decodeURIComponent(d)
  1595. } catch (c) {
  1596. console.log(c);
  1597. a = d
  1598. }
  1599. return a
  1600. };
  1601. qrcode.decode_utf8 = function(a) {
  1602. if (qrcode.isUrl(a)) {
  1603. return qrcode.decode_url(a)
  1604. } else {
  1605. return a
  1606. }
  1607. };
  1608. qrcode.process = function(q) {
  1609. var a = new Date().getTime();
  1610. var c = qrcode.grayScaleToBitmap(qrcode.grayscale());
  1611. if (qrcode.debug) {
  1612. for (var m = 0; m < qrcode.height; m++) {
  1613. for (var n = 0; n < qrcode.width; n++) {
  1614. var o = (n * 4) + (m * qrcode.width * 4);
  1615. qrcode.imagedata.data[o] = c[n + m * qrcode.width] ? 0 : 0;
  1616. qrcode.imagedata.data[o + 1] = c[n + m * qrcode.width] ? 0 : 0;
  1617. qrcode.imagedata.data[o + 2] = c[n + m * qrcode.width] ? 255 : 0
  1618. }
  1619. }
  1620. q.putImageData(qrcode.imagedata, 0, 0)
  1621. }
  1622. var h = new Detector(c);
  1623. var p = h.detect();
  1624. if (qrcode.debug) {
  1625. for (var m = 0; m < p.bits.Height; m++) {
  1626. for (var n = 0; n < p.bits.Width; n++) {
  1627. var o = (n * 4 * 2) + (m * 2 * qrcode.width * 4);
  1628. qrcode.imagedata.data[o] = p.bits._ds(n, m) ? 0 : 0;
  1629. qrcode.imagedata.data[o + 1] = p.bits._ds(n, m) ? 0 : 0;
  1630. qrcode.imagedata.data[o + 2] = p.bits._ds(n, m) ? 255 : 0
  1631. }
  1632. }
  1633. q.putImageData(qrcode.imagedata, 0, 0)
  1634. }
  1635. var k = Decoder.decode(p.bits);
  1636. var g = k.DataByte;
  1637. var l = "";
  1638. for (var f = 0; f < g.length; f++) {
  1639. for (var e = 0; e < g[f].length; e++) {
  1640. l += String.fromCharCode(g[f][e])
  1641. }
  1642. }
  1643. var d = new Date().getTime();
  1644. var b = d - a;
  1645. console.log(b);
  1646. return qrcode.decode_utf8(l)
  1647. };
  1648. qrcode.getPixel = function(b, d) {
  1649. if (qrcode.width < b) {
  1650. throw "point error"
  1651. }
  1652. if (qrcode.height < d) {
  1653. throw "point error"
  1654. }
  1655. var a = (b * 4) + (d * qrcode.width * 4);
  1656. var c = (qrcode.imagedata.data[a] * 33 + qrcode.imagedata.data[a + 1] * 34 + qrcode.imagedata.data[a + 2] *
  1657. 33) / 100;
  1658. return c
  1659. };
  1660. qrcode.binarize = function(d) {
  1661. var c = new Array(qrcode.width * qrcode.height);
  1662. for (var e = 0; e < qrcode.height; e++) {
  1663. for (var b = 0; b < qrcode.width; b++) {
  1664. var a = qrcode.getPixel(b, e);
  1665. c[b + e * qrcode.width] = a <= d ? true : false
  1666. }
  1667. }
  1668. return c
  1669. };
  1670. qrcode._em = function(d) {
  1671. var c = 4;
  1672. var k = Math.floor(qrcode.width / c);
  1673. var j = Math.floor(qrcode.height / c);
  1674. var f = new Array(c);
  1675. for (var g = 0; g < c; g++) {
  1676. f[g] = new Array(c);
  1677. for (var e = 0; e < c; e++) {
  1678. f[g][e] = new Array(0, 0)
  1679. }
  1680. }
  1681. for (var o = 0; o < c; o++) {
  1682. for (var a = 0; a < c; a++) {
  1683. f[a][o][0] = 255;
  1684. for (var l = 0; l < j; l++) {
  1685. for (var n = 0; n < k; n++) {
  1686. var h = d[k * a + n + (j * o + l) * qrcode.width];
  1687. if (h < f[a][o][0]) {
  1688. f[a][o][0] = h
  1689. }
  1690. if (h > f[a][o][1]) {
  1691. f[a][o][1] = h
  1692. }
  1693. }
  1694. }
  1695. }
  1696. }
  1697. var m = new Array(c);
  1698. for (var b = 0; b < c; b++) {
  1699. m[b] = new Array(c)
  1700. }
  1701. for (var o = 0; o < c; o++) {
  1702. for (var a = 0; a < c; a++) {
  1703. m[a][o] = Math.floor((f[a][o][0] + f[a][o][1]) / 2)
  1704. }
  1705. }
  1706. return m
  1707. };
  1708. qrcode.grayScaleToBitmap = function(f) {
  1709. var k = qrcode._em(f);
  1710. var b = k.length;
  1711. var e = Math.floor(qrcode.width / b);
  1712. var d = Math.floor(qrcode.height / b);
  1713. var h = new ArrayBuffer(qrcode.width * qrcode.height);
  1714. var c = new Uint8Array(h);
  1715. for (var j = 0; j < b; j++) {
  1716. for (var a = 0; a < b; a++) {
  1717. for (var g = 0; g < d; g++) {
  1718. for (var i = 0; i < e; i++) {
  1719. c[e * a + i + (d * j + g) * qrcode.width] = (f[e * a + i + (d * j + g) * qrcode.width] < k[a][
  1720. j
  1721. ]) ? true : false
  1722. }
  1723. }
  1724. }
  1725. }
  1726. return c
  1727. };
  1728. qrcode.grayscale = function() {
  1729. var e = new ArrayBuffer(qrcode.width * qrcode.height);
  1730. var c = new Uint8Array(e);
  1731. for (var d = 0; d < qrcode.height; d++) {
  1732. for (var b = 0; b < qrcode.width; b++) {
  1733. var a = qrcode.getPixel(b, d);
  1734. c[b + d * qrcode.width] = a
  1735. }
  1736. }
  1737. return c
  1738. };
  1739. function _ew(a, b) {
  1740. if (a >= 0) {
  1741. return a >> b
  1742. } else {
  1743. return (a >> b) + (2 << ~b)
  1744. }
  1745. }
  1746. var _gf = 3;
  1747. var _eh = 57;
  1748. var _el = 8;
  1749. var _eg = 2;
  1750. qrcode._er = function(c) {
  1751. function b(m, k) {
  1752. var n = m.X - k.X;
  1753. var l = m.Y - k.Y;
  1754. return Math.sqrt((n * n + l * l))
  1755. }
  1756. function d(k, o, n) {
  1757. var m = o.x;
  1758. var l = o.y;
  1759. return ((n.x - m) * (k.y - l)) - ((n.y - l) * (k.x - m))
  1760. }
  1761. var i = b(c[0], c[1]);
  1762. var f = b(c[1], c[2]);
  1763. var e = b(c[0], c[2]);
  1764. var a, j, h;
  1765. if (f >= i && f >= e) {
  1766. j = c[0];
  1767. a = c[1];
  1768. h = c[2]
  1769. } else {
  1770. if (e >= f && e >= i) {
  1771. j = c[1];
  1772. a = c[0];
  1773. h = c[2]
  1774. } else {
  1775. j = c[2];
  1776. a = c[0];
  1777. h = c[1]
  1778. }
  1779. }
  1780. if (d(a, j, h) < 0) {
  1781. var g = a;
  1782. a = h;
  1783. h = g
  1784. }
  1785. c[0] = a;
  1786. c[1] = j;
  1787. c[2] = h
  1788. };
  1789. function _cz(c, a, b) {
  1790. this.x = c;
  1791. this.y = a;
  1792. this.count = 1;
  1793. this._aj = b;
  1794. this.__defineGetter__("_ei", function() {
  1795. return this._aj
  1796. });
  1797. this.__defineGetter__("Count", function() {
  1798. return this.count
  1799. });
  1800. this.__defineGetter__("X", function() {
  1801. return this.x
  1802. });
  1803. this.__defineGetter__("Y", function() {
  1804. return this.y
  1805. });
  1806. this._ek = function() {
  1807. this.count++
  1808. };
  1809. this._ev = function(f, e, d) {
  1810. if (Math.abs(e - this.y) <= f && Math.abs(d - this.x) <= f) {
  1811. var g = Math.abs(f - this._aj);
  1812. return g <= 1 || g / this._aj <= 1
  1813. }
  1814. return false
  1815. }
  1816. }
  1817. function _es(a) {
  1818. this._go = a[0];
  1819. this._gu = a[1];
  1820. this._gr = a[2];
  1821. this.__defineGetter__("_gp", function() {
  1822. return this._go
  1823. });
  1824. this.__defineGetter__("_gq", function() {
  1825. return this._gu
  1826. });
  1827. this.__defineGetter__("_gs", function() {
  1828. return this._gr
  1829. })
  1830. }
  1831. function _cc() {
  1832. this.image = null;
  1833. this._cv = [];
  1834. this._ge = false;
  1835. this._al = new Array(0, 0, 0, 0, 0);
  1836. this._am = null;
  1837. this.__defineGetter__("_da", function() {
  1838. this._al[0] = 0;
  1839. this._al[1] = 0;
  1840. this._al[2] = 0;
  1841. this._al[3] = 0;
  1842. this._al[4] = 0;
  1843. return this._al
  1844. });
  1845. this._ao = function(f) {
  1846. var b = 0;
  1847. for (var d = 0; d < 5; d++) {
  1848. var e = f[d];
  1849. if (e == 0) {
  1850. return false
  1851. }
  1852. b += e
  1853. }
  1854. if (b < 7) {
  1855. return false
  1856. }
  1857. var c = Math.floor((b << _el) / 7);
  1858. var a = Math.floor(c / 2);
  1859. return Math.abs(c - (f[0] << _el)) < a && Math.abs(c - (f[1] << _el)) < a && Math.abs(3 * c - (f[2] <<
  1860. _el)) < 3 * a && Math.abs(c - (f[3] << _el)) < a && Math.abs(c - (f[4] << _el)) < a
  1861. };
  1862. this._an = function(b, a) {
  1863. return (a - b[4] - b[3]) - b[2] / 2
  1864. };
  1865. this._ap = function(a, j, d, g) {
  1866. var c = this.image;
  1867. var h = qrcode.height;
  1868. var b = this._da;
  1869. var f = a;
  1870. while (f >= 0 && c[j + f * qrcode.width]) {
  1871. b[2]++;
  1872. f--
  1873. }
  1874. if (f < 0) {
  1875. return NaN
  1876. }
  1877. while (f >= 0 && !c[j + f * qrcode.width] && b[1] <= d) {
  1878. b[1]++;
  1879. f--
  1880. }
  1881. if (f < 0 || b[1] > d) {
  1882. return NaN
  1883. }
  1884. while (f >= 0 && c[j + f * qrcode.width] && b[0] <= d) {
  1885. b[0]++;
  1886. f--
  1887. }
  1888. if (b[0] > d) {
  1889. return NaN
  1890. }
  1891. f = a + 1;
  1892. while (f < h && c[j + f * qrcode.width]) {
  1893. b[2]++;
  1894. f++
  1895. }
  1896. if (f == h) {
  1897. return NaN
  1898. }
  1899. while (f < h && !c[j + f * qrcode.width] && b[3] < d) {
  1900. b[3]++;
  1901. f++
  1902. }
  1903. if (f == h || b[3] >= d) {
  1904. return NaN
  1905. }
  1906. while (f < h && c[j + f * qrcode.width] && b[4] < d) {
  1907. b[4]++;
  1908. f++
  1909. }
  1910. if (b[4] >= d) {
  1911. return NaN
  1912. }
  1913. var e = b[0] + b[1] + b[2] + b[3] + b[4];
  1914. if (5 * Math.abs(e - g) >= 2 * g) {
  1915. return NaN
  1916. }
  1917. return this._ao(b) ? this._an(b, f) : NaN
  1918. };
  1919. this._ej = function(b, a, e, h) {
  1920. var d = this.image;
  1921. var i = qrcode.width;
  1922. var c = this._da;
  1923. var g = b;
  1924. while (g >= 0 && d[g + a * qrcode.width]) {
  1925. c[2]++;
  1926. g--
  1927. }
  1928. if (g < 0) {
  1929. return NaN
  1930. }
  1931. while (g >= 0 && !d[g + a * qrcode.width] && c[1] <= e) {
  1932. c[1]++;
  1933. g--
  1934. }
  1935. if (g < 0 || c[1] > e) {
  1936. return NaN
  1937. }
  1938. while (g >= 0 && d[g + a * qrcode.width] && c[0] <= e) {
  1939. c[0]++;
  1940. g--
  1941. }
  1942. if (c[0] > e) {
  1943. return NaN
  1944. }
  1945. g = b + 1;
  1946. while (g < i && d[g + a * qrcode.width]) {
  1947. c[2]++;
  1948. g++
  1949. }
  1950. if (g == i) {
  1951. return NaN
  1952. }
  1953. while (g < i && !d[g + a * qrcode.width] && c[3] < e) {
  1954. c[3]++;
  1955. g++
  1956. }
  1957. if (g == i || c[3] >= e) {
  1958. return NaN
  1959. }
  1960. while (g < i && d[g + a * qrcode.width] && c[4] < e) {
  1961. c[4]++;
  1962. g++
  1963. }
  1964. if (c[4] >= e) {
  1965. return NaN
  1966. }
  1967. var f = c[0] + c[1] + c[2] + c[3] + c[4];
  1968. if (5 * Math.abs(f - h) >= h) {
  1969. return NaN
  1970. }
  1971. return this._ao(c) ? this._an(c, g) : NaN
  1972. };
  1973. this._cu = function(c, f, e) {
  1974. var d = c[0] + c[1] + c[2] + c[3] + c[4];
  1975. var n = this._an(c, e);
  1976. var b = this._ap(f, Math.floor(n), c[2], d);
  1977. if (!isNaN(b)) {
  1978. n = this._ej(Math.floor(n), Math.floor(b), c[2], d);
  1979. if (!isNaN(n)) {
  1980. var l = d / 7;
  1981. var m = false;
  1982. var h = this._cv.length;
  1983. for (var g = 0; g < h; g++) {
  1984. var a = this._cv[g];
  1985. if (a._ev(l, b, n)) {
  1986. a._ek();
  1987. m = true;
  1988. break
  1989. }
  1990. }
  1991. if (!m) {
  1992. var k = new _cz(n, b, l);
  1993. this._cv.push(k);
  1994. if (this._am != null) {
  1995. this._am._ep(k)
  1996. }
  1997. }
  1998. return true
  1999. }
  2000. }
  2001. return false
  2002. };
  2003. this._ee = function() {
  2004. var h = this._cv.length;
  2005. if (h < 3) {
  2006. throw "Couldn't find enough finder patterns (found " + h + ")"
  2007. }
  2008. if (h > 3) {
  2009. var b = 0;
  2010. var j = 0;
  2011. for (var d = 0; d < h; d++) {
  2012. var g = this._cv[d]._ei;
  2013. b += g;
  2014. j += (g * g)
  2015. }
  2016. var a = b / h;
  2017. this._cv.sort(function(m, l) {
  2018. var k = Math.abs(l._ei - a);
  2019. var i = Math.abs(m._ei - a);
  2020. if (k < i) {
  2021. return (-1)
  2022. } else {
  2023. if (k == i) {
  2024. return 0
  2025. } else {
  2026. return 1
  2027. }
  2028. }
  2029. });
  2030. var e = Math.sqrt(j / h - a * a);
  2031. var c = Math.max(0.2 * a, e);
  2032. for (var d = this._cv.length - 1; d >= 0; d--) {
  2033. var f = this._cv[d];
  2034. if (Math.abs(f._ei - a) > c) {
  2035. this._cv.splice(d, 1)
  2036. }
  2037. }
  2038. }
  2039. if (this._cv.length > 3) {
  2040. this._cv.sort(function(k, i) {
  2041. if (k.count > i.count) {
  2042. return -1
  2043. }
  2044. if (k.count < i.count) {
  2045. return 1
  2046. }
  2047. return 0
  2048. })
  2049. }
  2050. return new Array(this._cv[0], this._cv[1], this._cv[2])
  2051. };
  2052. this._eq = function() {
  2053. var b = this._cv.length;
  2054. if (b <= 1) {
  2055. return 0
  2056. }
  2057. var c = null;
  2058. for (var d = 0; d < b; d++) {
  2059. var a = this._cv[d];
  2060. if (a.Count >= _eg) {
  2061. if (c == null) {
  2062. c = a
  2063. } else {
  2064. this._ge = true;
  2065. return Math.floor((Math.abs(c.X - a.X) - Math.abs(c.Y - a.Y)) / 2)
  2066. }
  2067. }
  2068. }
  2069. return 0
  2070. };
  2071. this._cx = function() {
  2072. var g = 0;
  2073. var c = 0;
  2074. var a = this._cv.length;
  2075. for (var d = 0; d < a; d++) {
  2076. var f = this._cv[d];
  2077. if (f.Count >= _eg) {
  2078. g++;
  2079. c += f._ei
  2080. }
  2081. }
  2082. if (g < 3) {
  2083. return false
  2084. }
  2085. var e = c / a;
  2086. var b = 0;
  2087. for (var d = 0; d < a; d++) {
  2088. f = this._cv[d];
  2089. b += Math.abs(f._ei - e)
  2090. }
  2091. return b <= 0.05 * c
  2092. };
  2093. this._ce = function(e) {
  2094. var o = false;
  2095. this.image = e;
  2096. var n = qrcode.height;
  2097. var k = qrcode.width;
  2098. var a = Math.floor((3 * n) / (4 * _eh));
  2099. if (a < _gf || o) {
  2100. a = _gf
  2101. }
  2102. var g = false;
  2103. var d = new Array(5);
  2104. for (var h = a - 1; h < n && !g; h += a) {
  2105. d[0] = 0;
  2106. d[1] = 0;
  2107. d[2] = 0;
  2108. d[3] = 0;
  2109. d[4] = 0;
  2110. var b = 0;
  2111. for (var f = 0; f < k; f++) {
  2112. if (e[f + h * qrcode.width]) {
  2113. if ((b & 1) == 1) {
  2114. b++
  2115. }
  2116. d[b]++
  2117. } else {
  2118. if ((b & 1) == 0) {
  2119. if (b == 4) {
  2120. if (this._ao(d)) {
  2121. var c = this._cu(d, h, f);
  2122. if (c) {
  2123. a = 2;
  2124. if (this._ge) {
  2125. g = this._cx()
  2126. } else {
  2127. var m = this._eq();
  2128. if (m > d[2]) {
  2129. h += m - d[2] - a;
  2130. f = k - 1
  2131. }
  2132. }
  2133. } else {
  2134. do {
  2135. f++
  2136. } while (f < k && !e[f + h * qrcode.width]);
  2137. f--
  2138. }
  2139. b = 0;
  2140. d[0] = 0;
  2141. d[1] = 0;
  2142. d[2] = 0;
  2143. d[3] = 0;
  2144. d[4] = 0
  2145. } else {
  2146. d[0] = d[2];
  2147. d[1] = d[3];
  2148. d[2] = d[4];
  2149. d[3] = 1;
  2150. d[4] = 0;
  2151. b = 3
  2152. }
  2153. } else {
  2154. d[++b]++
  2155. }
  2156. } else {
  2157. d[b]++
  2158. }
  2159. }
  2160. }
  2161. if (this._ao(d)) {
  2162. var c = this._cu(d, h, k);
  2163. if (c) {
  2164. a = d[0];
  2165. if (this._ge) {
  2166. g = _cx()
  2167. }
  2168. }
  2169. }
  2170. }
  2171. var l = this._ee();
  2172. qrcode._er(l);
  2173. return new _es(l)
  2174. }
  2175. }
  2176. function _ai(c, a, b) {
  2177. this.x = c;
  2178. this.y = a;
  2179. this.count = 1;
  2180. this._aj = b;
  2181. this.__defineGetter__("_ei", function() {
  2182. return this._aj
  2183. });
  2184. this.__defineGetter__("Count", function() {
  2185. return this.count
  2186. });
  2187. this.__defineGetter__("X", function() {
  2188. return Math.floor(this.x)
  2189. });
  2190. this.__defineGetter__("Y", function() {
  2191. return Math.floor(this.y)
  2192. });
  2193. this._ek = function() {
  2194. this.count++
  2195. };
  2196. this._ev = function(f, e, d) {
  2197. if (Math.abs(e - this.y) <= f && Math.abs(d - this.x) <= f) {
  2198. var g = Math.abs(f - this._aj);
  2199. return g <= 1 || g / this._aj <= 1
  2200. }
  2201. return false
  2202. }
  2203. }
  2204. function _ak(g, c, b, f, a, e, d) {
  2205. this.image = g;
  2206. this._cv = new Array();
  2207. this.startX = c;
  2208. this.startY = b;
  2209. this.width = f;
  2210. this.height = a;
  2211. this._ef = e;
  2212. this._al = new Array(0, 0, 0);
  2213. this._am = d;
  2214. this._an = function(i, h) {
  2215. return (h - i[2]) - i[1] / 2
  2216. };
  2217. this._ao = function(l) {
  2218. var k = this._ef;
  2219. var h = k / 2;
  2220. for (var j = 0; j < 3; j++) {
  2221. if (Math.abs(k - l[j]) >= h) {
  2222. return false
  2223. }
  2224. }
  2225. return true
  2226. };
  2227. this._ap = function(h, q, l, o) {
  2228. var k = this.image;
  2229. var p = qrcode.height;
  2230. var j = this._al;
  2231. j[0] = 0;
  2232. j[1] = 0;
  2233. j[2] = 0;
  2234. var n = h;
  2235. while (n >= 0 && k[q + n * qrcode.width] && j[1] <= l) {
  2236. j[1]++;
  2237. n--
  2238. }
  2239. if (n < 0 || j[1] > l) {
  2240. return NaN
  2241. }
  2242. while (n >= 0 && !k[q + n * qrcode.width] && j[0] <= l) {
  2243. j[0]++;
  2244. n--
  2245. }
  2246. if (j[0] > l) {
  2247. return NaN
  2248. }
  2249. n = h + 1;
  2250. while (n < p && k[q + n * qrcode.width] && j[1] <= l) {
  2251. j[1]++;
  2252. n++
  2253. }
  2254. if (n == p || j[1] > l) {
  2255. return NaN
  2256. }
  2257. while (n < p && !k[q + n * qrcode.width] && j[2] <= l) {
  2258. j[2]++;
  2259. n++
  2260. }
  2261. if (j[2] > l) {
  2262. return NaN
  2263. }
  2264. var m = j[0] + j[1] + j[2];
  2265. if (5 * Math.abs(m - o) >= 2 * o) {
  2266. return NaN
  2267. }
  2268. return this._ao(j) ? this._an(j, n) : NaN
  2269. };
  2270. this._cu = function(l, o, n) {
  2271. var m = l[0] + l[1] + l[2];
  2272. var t = this._an(l, n);
  2273. var k = this._ap(o, Math.floor(t), 2 * l[1], m);
  2274. if (!isNaN(k)) {
  2275. var s = (l[0] + l[1] + l[2]) / 3;
  2276. var q = this._cv.length;
  2277. for (var p = 0; p < q; p++) {
  2278. var h = this._cv[p];
  2279. if (h._ev(s, k, t)) {
  2280. return new _ai(t, k, s)
  2281. }
  2282. }
  2283. var r = new _ai(t, k, s);
  2284. this._cv.push(r);
  2285. if (this._am != null) {
  2286. this._am._ep(r)
  2287. }
  2288. }
  2289. return null
  2290. };
  2291. this.find = function() {
  2292. var p = this.startX;
  2293. var s = this.height;
  2294. var q = p + f;
  2295. var r = b + (s >> 1);
  2296. var m = new Array(0, 0, 0);
  2297. for (var k = 0; k < s; k++) {
  2298. var o = r + ((k & 1) == 0 ? ((k + 1) >> 1) : -((k + 1) >> 1));
  2299. m[0] = 0;
  2300. m[1] = 0;
  2301. m[2] = 0;
  2302. var n = p;
  2303. while (n < q && !g[n + qrcode.width * o]) {
  2304. n++
  2305. }
  2306. var h = 0;
  2307. while (n < q) {
  2308. if (g[n + o * qrcode.width]) {
  2309. if (h == 1) {
  2310. m[h]++
  2311. } else {
  2312. if (h == 2) {
  2313. if (this._ao(m)) {
  2314. var l = this._cu(m, o, n);
  2315. if (l != null) {
  2316. return l
  2317. }
  2318. }
  2319. m[0] = m[2];
  2320. m[1] = 1;
  2321. m[2] = 0;
  2322. h = 1
  2323. } else {
  2324. m[++h]++
  2325. }
  2326. }
  2327. } else {
  2328. if (h == 1) {
  2329. h++
  2330. }
  2331. m[h]++
  2332. }
  2333. n++
  2334. }
  2335. if (this._ao(m)) {
  2336. var l = this._cu(m, o, q);
  2337. if (l != null) {
  2338. return l
  2339. }
  2340. }
  2341. }
  2342. if (!(this._cv.length == 0)) {
  2343. return this._cv[0]
  2344. }
  2345. throw "Couldn't find enough alignment patterns"
  2346. }
  2347. }
  2348. function QRCodeDataBlockReader(c, a, b) {
  2349. this._ed = 0;
  2350. this._cw = 7;
  2351. this.dataLength = 0;
  2352. this.blocks = c;
  2353. this._en = b;
  2354. if (a <= 9) {
  2355. this.dataLengthMode = 0
  2356. } else {
  2357. if (a >= 10 && a <= 26) {
  2358. this.dataLengthMode = 1
  2359. } else {
  2360. if (a >= 27 && a <= 40) {
  2361. this.dataLengthMode = 2
  2362. }
  2363. }
  2364. }
  2365. this._gd = function(f) {
  2366. var k = 0;
  2367. if (f < this._cw + 1) {
  2368. var m = 0;
  2369. for (var e = 0; e < f; e++) {
  2370. m += (1 << e)
  2371. }
  2372. m <<= (this._cw - f + 1);
  2373. k = (this.blocks[this._ed] & m) >> (this._cw - f + 1);
  2374. this._cw -= f;
  2375. return k
  2376. } else {
  2377. if (f < this._cw + 1 + 8) {
  2378. var j = 0;
  2379. for (var e = 0; e < this._cw + 1; e++) {
  2380. j += (1 << e)
  2381. }
  2382. k = (this.blocks[this._ed] & j) << (f - (this._cw + 1));
  2383. this._ed++;
  2384. k += ((this.blocks[this._ed]) >> (8 - (f - (this._cw + 1))));
  2385. this._cw = this._cw - f % 8;
  2386. if (this._cw < 0) {
  2387. this._cw = 8 + this._cw
  2388. }
  2389. return k
  2390. } else {
  2391. if (f < this._cw + 1 + 16) {
  2392. var j = 0;
  2393. var h = 0;
  2394. for (var e = 0; e < this._cw + 1; e++) {
  2395. j += (1 << e)
  2396. }
  2397. var g = (this.blocks[this._ed] & j) << (f - (this._cw + 1));
  2398. this._ed++;
  2399. var d = this.blocks[this._ed] << (f - (this._cw + 1 + 8));
  2400. this._ed++;
  2401. for (var e = 0; e < f - (this._cw + 1 + 8); e++) {
  2402. h += (1 << e)
  2403. }
  2404. h <<= 8 - (f - (this._cw + 1 + 8));
  2405. var l = (this.blocks[this._ed] & h) >> (8 - (f - (this._cw + 1 + 8)));
  2406. k = g + d + l;
  2407. this._cw = this._cw - (f - 8) % 8;
  2408. if (this._cw < 0) {
  2409. this._cw = 8 + this._cw
  2410. }
  2411. return k
  2412. } else {
  2413. return 0
  2414. }
  2415. }
  2416. }
  2417. };
  2418. this.NextMode = function() {
  2419. if ((this._ed > this.blocks.length - this._en - 2)) {
  2420. return 0
  2421. } else {
  2422. return this._gd(4)
  2423. }
  2424. };
  2425. this.getDataLength = function(d) {
  2426. var e = 0;
  2427. while (true) {
  2428. if ((d >> e) == 1) {
  2429. break
  2430. }
  2431. e++
  2432. }
  2433. return this._gd(qrcode._eo[this.dataLengthMode][e])
  2434. };
  2435. this.getRomanAndFigureString = function(h) {
  2436. var f = h;
  2437. var g = 0;
  2438. var j = "";
  2439. var d = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H",
  2440. "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", " ", "$",
  2441. "%", "*", "+", "-", ".", "/", ":");
  2442. do {
  2443. if (f > 1) {
  2444. g = this._gd(11);
  2445. var i = Math.floor(g / 45);
  2446. var e = g % 45;
  2447. j += d[i];
  2448. j += d[e];
  2449. f -= 2
  2450. } else {
  2451. if (f == 1) {
  2452. g = this._gd(6);
  2453. j += d[g];
  2454. f -= 1
  2455. }
  2456. }
  2457. } while (f > 0);
  2458. return j
  2459. };
  2460. this.getFigureString = function(f) {
  2461. var d = f;
  2462. var e = 0;
  2463. var g = "";
  2464. do {
  2465. if (d >= 3) {
  2466. e = this._gd(10);
  2467. if (e < 100) {
  2468. g += "0"
  2469. }
  2470. if (e < 10) {
  2471. g += "0"
  2472. }
  2473. d -= 3
  2474. } else {
  2475. if (d == 2) {
  2476. e = this._gd(7);
  2477. if (e < 10) {
  2478. g += "0"
  2479. }
  2480. d -= 2
  2481. } else {
  2482. if (d == 1) {
  2483. e = this._gd(4);
  2484. d -= 1
  2485. }
  2486. }
  2487. }
  2488. g += e
  2489. } while (d > 0);
  2490. return g
  2491. };
  2492. this.get8bitByteArray = function(g) {
  2493. var e = g;
  2494. var f = 0;
  2495. var d = new Array();
  2496. do {
  2497. f = this._gd(8);
  2498. d.push(f);
  2499. e--
  2500. } while (e > 0);
  2501. return d
  2502. };
  2503. this.getKanjiString = function(j) {
  2504. var g = j;
  2505. var i = 0;
  2506. var h = "";
  2507. do {
  2508. i = _gd(13);
  2509. var e = i % 192;
  2510. var f = i / 192;
  2511. var k = (f << 8) + e;
  2512. var d = 0;
  2513. if (k + 33088 <= 40956) {
  2514. d = k + 33088
  2515. } else {
  2516. d = k + 49472
  2517. }
  2518. h += String.fromCharCode(d);
  2519. g--
  2520. } while (g > 0);
  2521. return h
  2522. };
  2523. this.__defineGetter__("DataByte", function() {
  2524. var h = new Array();
  2525. var e = 1;
  2526. var f = 2;
  2527. var d = 4;
  2528. var o = 8;
  2529. do {
  2530. var l = this.NextMode();
  2531. if (l == 0) {
  2532. if (h.length > 0) {
  2533. break
  2534. } else {
  2535. throw "Empty data block"
  2536. }
  2537. }
  2538. if (l != e && l != f && l != d && l != o) {
  2539. throw "Invalid mode: " + l + " in (block:" + this._ed + " bit:" + this._cw + ")"
  2540. }
  2541. var g = this.getDataLength(l);
  2542. if (g < 1) {
  2543. throw "Invalid data length: " + g
  2544. }
  2545. switch (l) {
  2546. case e:
  2547. var m = this.getFigureString(g);
  2548. var k = new Array(m.length);
  2549. for (var i = 0; i < m.length; i++) {
  2550. k[i] = m.charCodeAt(i)
  2551. }
  2552. h.push(k);
  2553. break;
  2554. case f:
  2555. var m = this.getRomanAndFigureString(g);
  2556. var k = new Array(m.length);
  2557. for (var i = 0; i < m.length; i++) {
  2558. k[i] = m.charCodeAt(i)
  2559. }
  2560. h.push(k);
  2561. break;
  2562. case d:
  2563. var n = this.get8bitByteArray(g);
  2564. h.push(n);
  2565. break;
  2566. case o:
  2567. var m = this.getKanjiString(g);
  2568. h.push(m);
  2569. break
  2570. }
  2571. } while (true);
  2572. return h
  2573. })
  2574. };
  2575. module.exports = qrcode