qrcode.min.js 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839
  1. // 20191029
  2. // 1. 修复安卓9及以上生成二维码失效问题(https://github.com/davidshimjs/qrcodejs/issues/175)
  3. // 2. 添加回调函数(https://github.com/davidshimjs/qrcodejs/blob/master/qrcode.js)
  4. var QRCode;
  5. ! function() {
  6. function a(a) {
  7. this.mode = c.MODE_8BIT_BYTE, this.data = a, this.parsedData = [];
  8. for (var b = [], d = 0, e = this.data.length; e > d; d++) {
  9. var f = this.data.charCodeAt(d);
  10. f > 65536 ? (b[0] = 240 | (1835008 & f) >>> 18, b[1] = 128 | (258048 & f) >>> 12, b[2] = 128 | (4032 & f) >>>
  11. 6, b[3] = 128 | 63 & f) : f > 2048 ? (b[0] = 224 | (61440 & f) >>> 12, b[1] = 128 | (4032 & f) >>>
  12. 6, b[2] = 128 | 63 & f) : f > 128 ? (b[0] = 192 | (1984 & f) >>> 6, b[1] = 128 | 63 & f) : b[0] = f,
  13. this.parsedData = this.parsedData.concat(b)
  14. }
  15. this.parsedData.length != this.data.length && (this.parsedData.unshift(191), this.parsedData.unshift(187), this
  16. .parsedData.unshift(239))
  17. }
  18. function b(a, b) {
  19. this.typeNumber = a, this.errorCorrectLevel = b, this.modules = null, this.moduleCount = 0, this.dataCache =
  20. null, this.dataList = []
  21. }
  22. function i(a, b) {
  23. if (void 0 == a.length) throw new Error(a.length + "/" + b);
  24. for (var c = 0; c < a.length && 0 == a[c];) c++;
  25. this.num = new Array(a.length - c + b);
  26. for (var d = 0; d < a.length - c; d++) this.num[d] = a[d + c]
  27. }
  28. function j(a, b) {
  29. this.totalCount = a, this.dataCount = b
  30. }
  31. function k() {
  32. this.buffer = [], this.length = 0
  33. }
  34. function m() {
  35. return "undefined" != typeof CanvasRenderingContext2D
  36. }
  37. function n() {
  38. var a = !1,
  39. b = navigator.userAgent;
  40. return /android/i.test(b) && (a = !0, aMat = b.toString().match(/android ([0-9]+\.?[0-9]?)/i), aMat && aMat[1] &&
  41. (a = parseFloat(aMat[1]))), a
  42. }
  43. function r(a, b) {
  44. for (var c = 1, e = s(a), f = 0, g = l.length; g >= f; f++) {
  45. var h = 0;
  46. switch (b) {
  47. case d.L:
  48. h = l[f][0];
  49. break;
  50. case d.M:
  51. h = l[f][1];
  52. break;
  53. case d.Q:
  54. h = l[f][2];
  55. break;
  56. case d.H:
  57. h = l[f][3]
  58. }
  59. if (h >= e) break;
  60. c++
  61. }
  62. if (c > l.length) throw new Error("Too long data");
  63. return c
  64. }
  65. function s(a) {
  66. var b = encodeURI(a).toString().replace(/\%[0-9a-fA-F]{2}/g, "a");
  67. return b.length + (b.length != a ? 3 : 0)
  68. }
  69. a.prototype = {
  70. getLength: function() {
  71. return this.parsedData.length
  72. },
  73. write: function(a) {
  74. for (var b = 0, c = this.parsedData.length; c > b; b++) a.put(this.parsedData[b], 8)
  75. }
  76. }, b.prototype = {
  77. addData: function(b) {
  78. var c = new a(b);
  79. this.dataList.push(c), this.dataCache = null
  80. },
  81. isDark: function(a, b) {
  82. if (0 > a || this.moduleCount <= a || 0 > b || this.moduleCount <= b) throw new Error(a + "," + b);
  83. return this.modules[a][b]
  84. },
  85. getModuleCount: function() {
  86. return this.moduleCount
  87. },
  88. make: function() {
  89. this.makeImpl(!1, this.getBestMaskPattern())
  90. },
  91. makeImpl: function(a, c) {
  92. this.moduleCount = 4 * this.typeNumber + 17, this.modules = new Array(this.moduleCount);
  93. for (var d = 0; d < this.moduleCount; d++) {
  94. this.modules[d] = new Array(this.moduleCount);
  95. for (var e = 0; e < this.moduleCount; e++) this.modules[d][e] = null
  96. }
  97. this.setupPositionProbePattern(0, 0), this.setupPositionProbePattern(this.moduleCount - 7, 0), this
  98. .setupPositionProbePattern(0, this.moduleCount - 7), this.setupPositionAdjustPattern(), this.setupTimingPattern(),
  99. this.setupTypeInfo(a, c), this.typeNumber >= 7 && this.setupTypeNumber(a), null == this.dataCache &&
  100. (this.dataCache = b.createData(this.typeNumber, this.errorCorrectLevel, this.dataList)), this.mapData(
  101. this.dataCache, c)
  102. },
  103. setupPositionProbePattern: function(a, b) {
  104. for (var c = -1; 7 >= c; c++)
  105. if (!(-1 >= a + c || this.moduleCount <= a + c))
  106. for (var d = -1; 7 >= d; d++) - 1 >= b + d || this.moduleCount <= b + d || (this.modules[a +
  107. c][b + d] = c >= 0 && 6 >= c && (0 == d || 6 == d) || d >= 0 && 6 >= d && (0 ==
  108. c || 6 == c) || c >= 2 && 4 >= c && d >= 2 && 4 >= d ? !0 : !1)
  109. },
  110. getBestMaskPattern: function() {
  111. for (var a = 0, b = 0, c = 0; 8 > c; c++) {
  112. this.makeImpl(!0, c);
  113. var d = f.getLostPoint(this);
  114. (0 == c || a > d) && (a = d, b = c)
  115. }
  116. return b
  117. },
  118. createMovieClip: function(a, b, c) {
  119. var d = a.createEmptyMovieClip(b, c),
  120. e = 1;
  121. this.make();
  122. for (var f = 0; f < this.modules.length; f++)
  123. for (var g = f * e, h = 0; h < this.modules[f].length; h++) {
  124. var i = h * e,
  125. j = this.modules[f][h];
  126. j && (d.beginFill(0, 100), d.moveTo(i, g), d.lineTo(i + e, g), d.lineTo(i + e, g + e), d.lineTo(
  127. i, g + e), d.endFill())
  128. }
  129. return d
  130. },
  131. setupTimingPattern: function() {
  132. for (var a = 8; a < this.moduleCount - 8; a++) null == this.modules[a][6] && (this.modules[a][6] =
  133. 0 == a % 2);
  134. for (var b = 8; b < this.moduleCount - 8; b++) null == this.modules[6][b] && (this.modules[6][b] =
  135. 0 == b % 2)
  136. },
  137. setupPositionAdjustPattern: function() {
  138. for (var a = f.getPatternPosition(this.typeNumber), b = 0; b < a.length; b++)
  139. for (var c = 0; c < a.length; c++) {
  140. var d = a[b],
  141. e = a[c];
  142. if (null == this.modules[d][e])
  143. for (var g = -2; 2 >= g; g++)
  144. for (var h = -2; 2 >= h; h++) this.modules[d + g][e + h] = -2 == g || 2 == g || -2 ==
  145. h || 2 == h || 0 == g && 0 == h ? !0 : !1
  146. }
  147. },
  148. setupTypeNumber: function(a) {
  149. for (var b = f.getBCHTypeNumber(this.typeNumber), c = 0; 18 > c; c++) {
  150. var d = !a && 1 == (1 & b >> c);
  151. this.modules[Math.floor(c / 3)][c % 3 + this.moduleCount - 8 - 3] = d
  152. }
  153. for (var c = 0; 18 > c; c++) {
  154. var d = !a && 1 == (1 & b >> c);
  155. this.modules[c % 3 + this.moduleCount - 8 - 3][Math.floor(c / 3)] = d
  156. }
  157. },
  158. setupTypeInfo: function(a, b) {
  159. for (var c = this.errorCorrectLevel << 3 | b, d = f.getBCHTypeInfo(c), e = 0; 15 > e; e++) {
  160. var g = !a && 1 == (1 & d >> e);
  161. 6 > e ? this.modules[e][8] = g : 8 > e ? this.modules[e + 1][8] = g : this.modules[this.moduleCount -
  162. 15 + e][8] = g
  163. }
  164. for (var e = 0; 15 > e; e++) {
  165. var g = !a && 1 == (1 & d >> e);
  166. 8 > e ? this.modules[8][this.moduleCount - e - 1] = g : 9 > e ? this.modules[8][15 - e - 1 + 1] =
  167. g : this.modules[8][15 - e - 1] = g
  168. }
  169. this.modules[this.moduleCount - 8][8] = !a
  170. },
  171. mapData: function(a, b) {
  172. for (var c = -1, d = this.moduleCount - 1, e = 7, g = 0, h = this.moduleCount - 1; h > 0; h -= 2)
  173. for (6 == h && h--;;) {
  174. for (var i = 0; 2 > i; i++)
  175. if (null == this.modules[d][h - i]) {
  176. var j = !1;
  177. g < a.length && (j = 1 == (1 & a[g] >>> e));
  178. var k = f.getMask(b, d, h - i);
  179. k && (j = !j), this.modules[d][h - i] = j, e--, -1 == e && (g++, e = 7)
  180. } if (d += c, 0 > d || this.moduleCount <= d) {
  181. d -= c, c = -c;
  182. break
  183. }
  184. }
  185. }
  186. }, b.PAD0 = 236, b.PAD1 = 17, b.createData = function(a, c, d) {
  187. for (var e = j.getRSBlocks(a, c), g = new k, h = 0; h < d.length; h++) {
  188. var i = d[h];
  189. g.put(i.mode, 4), g.put(i.getLength(), f.getLengthInBits(i.mode, a)), i.write(g)
  190. }
  191. for (var l = 0, h = 0; h < e.length; h++) l += e[h].dataCount;
  192. if (g.getLengthInBits() > 8 * l) throw new Error("code length overflow. (" + g.getLengthInBits() + ">" + 8 *
  193. l + ")");
  194. for (g.getLengthInBits() + 4 <= 8 * l && g.put(0, 4); 0 != g.getLengthInBits() % 8;) g.putBit(!1);
  195. for (;;) {
  196. if (g.getLengthInBits() >= 8 * l) break;
  197. if (g.put(b.PAD0, 8), g.getLengthInBits() >= 8 * l) break;
  198. g.put(b.PAD1, 8)
  199. }
  200. return b.createBytes(g, e)
  201. }, b.createBytes = function(a, b) {
  202. for (var c = 0, d = 0, e = 0, g = new Array(b.length), h = new Array(b.length), j = 0; j < b.length; j++) {
  203. var k = b[j].dataCount,
  204. l = b[j].totalCount - k;
  205. d = Math.max(d, k), e = Math.max(e, l), g[j] = new Array(k);
  206. for (var m = 0; m < g[j].length; m++) g[j][m] = 255 & a.buffer[m + c];
  207. c += k;
  208. var n = f.getErrorCorrectPolynomial(l),
  209. o = new i(g[j], n.getLength() - 1),
  210. p = o.mod(n);
  211. h[j] = new Array(n.getLength() - 1);
  212. for (var m = 0; m < h[j].length; m++) {
  213. var q = m + p.getLength() - h[j].length;
  214. h[j][m] = q >= 0 ? p.get(q) : 0
  215. }
  216. }
  217. for (var r = 0, m = 0; m < b.length; m++) r += b[m].totalCount;
  218. for (var s = new Array(r), t = 0, m = 0; d > m; m++)
  219. for (var j = 0; j < b.length; j++) m < g[j].length && (s[t++] = g[j][m]);
  220. for (var m = 0; e > m; m++)
  221. for (var j = 0; j < b.length; j++) m < h[j].length && (s[t++] = h[j][m]);
  222. return s
  223. };
  224. for (var c = {
  225. MODE_NUMBER: 1,
  226. MODE_ALPHA_NUM: 2,
  227. MODE_8BIT_BYTE: 4,
  228. MODE_KANJI: 8
  229. }, d = {
  230. L: 1,
  231. M: 0,
  232. Q: 3,
  233. H: 2
  234. }, e = {
  235. PATTERN000: 0,
  236. PATTERN001: 1,
  237. PATTERN010: 2,
  238. PATTERN011: 3,
  239. PATTERN100: 4,
  240. PATTERN101: 5,
  241. PATTERN110: 6,
  242. PATTERN111: 7
  243. }, f = {
  244. PATTERN_POSITION_TABLE: [
  245. [],
  246. [6, 18],
  247. [6, 22],
  248. [6, 26],
  249. [6, 30],
  250. [6, 34],
  251. [6, 22, 38],
  252. [6, 24, 42],
  253. [6, 26, 46],
  254. [6, 28, 50],
  255. [6, 30, 54],
  256. [6, 32, 58],
  257. [6, 34, 62],
  258. [6, 26, 46, 66],
  259. [6, 26, 48, 70],
  260. [6, 26, 50, 74],
  261. [6, 30, 54, 78],
  262. [6, 30, 56, 82],
  263. [6, 30, 58, 86],
  264. [6, 34, 62, 90],
  265. [6, 28, 50, 72, 94],
  266. [6, 26, 50, 74, 98],
  267. [6, 30, 54, 78, 102],
  268. [6, 28, 54, 80, 106],
  269. [6, 32, 58, 84, 110],
  270. [6, 30, 58, 86, 114],
  271. [6, 34, 62, 90, 118],
  272. [6, 26, 50, 74, 98, 122],
  273. [6, 30, 54, 78, 102, 126],
  274. [6, 26, 52, 78, 104, 130],
  275. [6, 30, 56, 82, 108, 134],
  276. [6, 34, 60, 86, 112, 138],
  277. [6, 30, 58, 86, 114, 142],
  278. [6, 34, 62, 90, 118, 146],
  279. [6, 30, 54, 78, 102, 126, 150],
  280. [6, 24, 50, 76, 102, 128, 154],
  281. [6, 28, 54, 80, 106, 132, 158],
  282. [6, 32, 58, 84, 110, 136, 162],
  283. [6, 26, 54, 82, 110, 138, 166],
  284. [6, 30, 58, 86, 114, 142, 170]
  285. ],
  286. G15: 1335,
  287. G18: 7973,
  288. G15_MASK: 21522,
  289. getBCHTypeInfo: function(a) {
  290. for (var b = a << 10; f.getBCHDigit(b) - f.getBCHDigit(f.G15) >= 0;) b ^= f.G15 << f.getBCHDigit(
  291. b) - f.getBCHDigit(f.G15);
  292. return (a << 10 | b) ^ f.G15_MASK
  293. },
  294. getBCHTypeNumber: function(a) {
  295. for (var b = a << 12; f.getBCHDigit(b) - f.getBCHDigit(f.G18) >= 0;) b ^= f.G18 << f.getBCHDigit(
  296. b) - f.getBCHDigit(f.G18);
  297. return a << 12 | b
  298. },
  299. getBCHDigit: function(a) {
  300. for (var b = 0; 0 != a;) b++, a >>>= 1;
  301. return b
  302. },
  303. getPatternPosition: function(a) {
  304. return f.PATTERN_POSITION_TABLE[a - 1]
  305. },
  306. getMask: function(a, b, c) {
  307. switch (a) {
  308. case e.PATTERN000:
  309. return 0 == (b + c) % 2;
  310. case e.PATTERN001:
  311. return 0 == b % 2;
  312. case e.PATTERN010:
  313. return 0 == c % 3;
  314. case e.PATTERN011:
  315. return 0 == (b + c) % 3;
  316. case e.PATTERN100:
  317. return 0 == (Math.floor(b / 2) + Math.floor(c / 3)) % 2;
  318. case e.PATTERN101:
  319. return 0 == b * c % 2 + b * c % 3;
  320. case e.PATTERN110:
  321. return 0 == (b * c % 2 + b * c % 3) % 2;
  322. case e.PATTERN111:
  323. return 0 == (b * c % 3 + (b + c) % 2) % 2;
  324. default:
  325. throw new Error("bad maskPattern:" + a)
  326. }
  327. },
  328. getErrorCorrectPolynomial: function(a) {
  329. for (var b = new i([1], 0), c = 0; a > c; c++) b = b.multiply(new i([1, g.gexp(c)], 0));
  330. return b
  331. },
  332. getLengthInBits: function(a, b) {
  333. if (b >= 1 && 10 > b) switch (a) {
  334. case c.MODE_NUMBER:
  335. return 10;
  336. case c.MODE_ALPHA_NUM:
  337. return 9;
  338. case c.MODE_8BIT_BYTE:
  339. return 8;
  340. case c.MODE_KANJI:
  341. return 8;
  342. default:
  343. throw new Error("mode:" + a)
  344. } else if (27 > b) switch (a) {
  345. case c.MODE_NUMBER:
  346. return 12;
  347. case c.MODE_ALPHA_NUM:
  348. return 11;
  349. case c.MODE_8BIT_BYTE:
  350. return 16;
  351. case c.MODE_KANJI:
  352. return 10;
  353. default:
  354. throw new Error("mode:" + a)
  355. } else {
  356. if (!(41 > b)) throw new Error("type:" + b);
  357. switch (a) {
  358. case c.MODE_NUMBER:
  359. return 14;
  360. case c.MODE_ALPHA_NUM:
  361. return 13;
  362. case c.MODE_8BIT_BYTE:
  363. return 16;
  364. case c.MODE_KANJI:
  365. return 12;
  366. default:
  367. throw new Error("mode:" + a)
  368. }
  369. }
  370. },
  371. getLostPoint: function(a) {
  372. for (var b = a.getModuleCount(), c = 0, d = 0; b > d; d++)
  373. for (var e = 0; b > e; e++) {
  374. for (var f = 0, g = a.isDark(d, e), h = -1; 1 >= h; h++)
  375. if (!(0 > d + h || d + h >= b))
  376. for (var i = -1; 1 >= i; i++) 0 > e + i || e + i >= b || (0 != h || 0 != i) &&
  377. g == a.isDark(d + h, e + i) && f++;
  378. f > 5 && (c += 3 + f - 5)
  379. }
  380. for (var d = 0; b - 1 > d; d++)
  381. for (var e = 0; b - 1 > e; e++) {
  382. var j = 0;
  383. a.isDark(d, e) && j++, a.isDark(d + 1, e) && j++, a.isDark(d, e + 1) && j++, a.isDark(d +
  384. 1, e + 1) && j++, (0 == j || 4 == j) && (c += 3)
  385. }
  386. for (var d = 0; b > d; d++)
  387. for (var e = 0; b - 6 > e; e++) a.isDark(d, e) && !a.isDark(d, e + 1) && a.isDark(d, e + 2) &&
  388. a.isDark(d, e + 3) && a.isDark(d, e + 4) && !a.isDark(d, e + 5) && a.isDark(d, e + 6) &&
  389. (c += 40);
  390. for (var e = 0; b > e; e++)
  391. for (var d = 0; b - 6 > d; d++) a.isDark(d, e) && !a.isDark(d + 1, e) && a.isDark(d + 2, e) &&
  392. a.isDark(d + 3, e) && a.isDark(d + 4, e) && !a.isDark(d + 5, e) && a.isDark(d + 6, e) &&
  393. (c += 40);
  394. for (var k = 0, e = 0; b > e; e++)
  395. for (var d = 0; b > d; d++) a.isDark(d, e) && k++;
  396. var l = Math.abs(100 * k / b / b - 50) / 5;
  397. return c += 10 * l
  398. }
  399. }, g = {
  400. glog: function(a) {
  401. if (1 > a) throw new Error("glog(" + a + ")");
  402. return g.LOG_TABLE[a]
  403. },
  404. gexp: function(a) {
  405. for (; 0 > a;) a += 255;
  406. for (; a >= 256;) a -= 255;
  407. return g.EXP_TABLE[a]
  408. },
  409. EXP_TABLE: new Array(256),
  410. LOG_TABLE: new Array(256)
  411. }, h = 0; 8 > h; h++) g.EXP_TABLE[h] = 1 << h;
  412. for (var h = 8; 256 > h; h++) g.EXP_TABLE[h] = g.EXP_TABLE[h - 4] ^ g.EXP_TABLE[h - 5] ^ g.EXP_TABLE[h - 6] ^ g.EXP_TABLE[
  413. h - 8];
  414. for (var h = 0; 255 > h; h++) g.LOG_TABLE[g.EXP_TABLE[h]] = h;
  415. i.prototype = {
  416. get: function(a) {
  417. return this.num[a]
  418. },
  419. getLength: function() {
  420. return this.num.length
  421. },
  422. multiply: function(a) {
  423. for (var b = new Array(this.getLength() + a.getLength() - 1), c = 0; c < this.getLength(); c++)
  424. for (var d = 0; d < a.getLength(); d++) b[c + d] ^= g.gexp(g.glog(this.get(c)) + g.glog(a.get(d)));
  425. return new i(b, 0)
  426. },
  427. mod: function(a) {
  428. if (this.getLength() - a.getLength() < 0) return this;
  429. for (var b = g.glog(this.get(0)) - g.glog(a.get(0)), c = new Array(this.getLength()), d = 0; d <
  430. this.getLength(); d++) c[d] = this.get(d);
  431. for (var d = 0; d < a.getLength(); d++) c[d] ^= g.gexp(g.glog(a.get(d)) + b);
  432. return new i(c, 0).mod(a)
  433. }
  434. }, j.RS_BLOCK_TABLE = [
  435. [1, 26, 19],
  436. [1, 26, 16],
  437. [1, 26, 13],
  438. [1, 26, 9],
  439. [1, 44, 34],
  440. [1, 44, 28],
  441. [1, 44, 22],
  442. [1, 44, 16],
  443. [1, 70, 55],
  444. [1, 70, 44],
  445. [2, 35, 17],
  446. [2, 35, 13],
  447. [1, 100, 80],
  448. [2, 50, 32],
  449. [2, 50, 24],
  450. [4, 25, 9],
  451. [1, 134, 108],
  452. [2, 67, 43],
  453. [2, 33, 15, 2, 34, 16],
  454. [2, 33, 11, 2, 34, 12],
  455. [2, 86, 68],
  456. [4, 43, 27],
  457. [4, 43, 19],
  458. [4, 43, 15],
  459. [2, 98, 78],
  460. [4, 49, 31],
  461. [2, 32, 14, 4, 33, 15],
  462. [4, 39, 13, 1, 40, 14],
  463. [2, 121, 97],
  464. [2, 60, 38, 2, 61, 39],
  465. [4, 40, 18, 2, 41, 19],
  466. [4, 40, 14, 2, 41, 15],
  467. [2, 146, 116],
  468. [3, 58, 36, 2, 59, 37],
  469. [4, 36, 16, 4, 37, 17],
  470. [4, 36, 12, 4, 37, 13],
  471. [2, 86, 68, 2, 87, 69],
  472. [4, 69, 43, 1, 70, 44],
  473. [6, 43, 19, 2, 44, 20],
  474. [6, 43, 15, 2, 44, 16],
  475. [4, 101, 81],
  476. [1, 80, 50, 4, 81, 51],
  477. [4, 50, 22, 4, 51, 23],
  478. [3, 36, 12, 8, 37, 13],
  479. [2, 116, 92, 2, 117, 93],
  480. [6, 58, 36, 2, 59, 37],
  481. [4, 46, 20, 6, 47, 21],
  482. [7, 42, 14, 4, 43, 15],
  483. [4, 133, 107],
  484. [8, 59, 37, 1, 60, 38],
  485. [8, 44, 20, 4, 45, 21],
  486. [12, 33, 11, 4, 34, 12],
  487. [3, 145, 115, 1, 146, 116],
  488. [4, 64, 40, 5, 65, 41],
  489. [11, 36, 16, 5, 37, 17],
  490. [11, 36, 12, 5, 37, 13],
  491. [5, 109, 87, 1, 110, 88],
  492. [5, 65, 41, 5, 66, 42],
  493. [5, 54, 24, 7, 55, 25],
  494. [11, 36, 12],
  495. [5, 122, 98, 1, 123, 99],
  496. [7, 73, 45, 3, 74, 46],
  497. [15, 43, 19, 2, 44, 20],
  498. [3, 45, 15, 13, 46, 16],
  499. [1, 135, 107, 5, 136, 108],
  500. [10, 74, 46, 1, 75, 47],
  501. [1, 50, 22, 15, 51, 23],
  502. [2, 42, 14, 17, 43, 15],
  503. [5, 150, 120, 1, 151, 121],
  504. [9, 69, 43, 4, 70, 44],
  505. [17, 50, 22, 1, 51, 23],
  506. [2, 42, 14, 19, 43, 15],
  507. [3, 141, 113, 4, 142, 114],
  508. [3, 70, 44, 11, 71, 45],
  509. [17, 47, 21, 4, 48, 22],
  510. [9, 39, 13, 16, 40, 14],
  511. [3, 135, 107, 5, 136, 108],
  512. [3, 67, 41, 13, 68, 42],
  513. [15, 54, 24, 5, 55, 25],
  514. [15, 43, 15, 10, 44, 16],
  515. [4, 144, 116, 4, 145, 117],
  516. [17, 68, 42],
  517. [17, 50, 22, 6, 51, 23],
  518. [19, 46, 16, 6, 47, 17],
  519. [2, 139, 111, 7, 140, 112],
  520. [17, 74, 46],
  521. [7, 54, 24, 16, 55, 25],
  522. [34, 37, 13],
  523. [4, 151, 121, 5, 152, 122],
  524. [4, 75, 47, 14, 76, 48],
  525. [11, 54, 24, 14, 55, 25],
  526. [16, 45, 15, 14, 46, 16],
  527. [6, 147, 117, 4, 148, 118],
  528. [6, 73, 45, 14, 74, 46],
  529. [11, 54, 24, 16, 55, 25],
  530. [30, 46, 16, 2, 47, 17],
  531. [8, 132, 106, 4, 133, 107],
  532. [8, 75, 47, 13, 76, 48],
  533. [7, 54, 24, 22, 55, 25],
  534. [22, 45, 15, 13, 46, 16],
  535. [10, 142, 114, 2, 143, 115],
  536. [19, 74, 46, 4, 75, 47],
  537. [28, 50, 22, 6, 51, 23],
  538. [33, 46, 16, 4, 47, 17],
  539. [8, 152, 122, 4, 153, 123],
  540. [22, 73, 45, 3, 74, 46],
  541. [8, 53, 23, 26, 54, 24],
  542. [12, 45, 15, 28, 46, 16],
  543. [3, 147, 117, 10, 148, 118],
  544. [3, 73, 45, 23, 74, 46],
  545. [4, 54, 24, 31, 55, 25],
  546. [11, 45, 15, 31, 46, 16],
  547. [7, 146, 116, 7, 147, 117],
  548. [21, 73, 45, 7, 74, 46],
  549. [1, 53, 23, 37, 54, 24],
  550. [19, 45, 15, 26, 46, 16],
  551. [5, 145, 115, 10, 146, 116],
  552. [19, 75, 47, 10, 76, 48],
  553. [15, 54, 24, 25, 55, 25],
  554. [23, 45, 15, 25, 46, 16],
  555. [13, 145, 115, 3, 146, 116],
  556. [2, 74, 46, 29, 75, 47],
  557. [42, 54, 24, 1, 55, 25],
  558. [23, 45, 15, 28, 46, 16],
  559. [17, 145, 115],
  560. [10, 74, 46, 23, 75, 47],
  561. [10, 54, 24, 35, 55, 25],
  562. [19, 45, 15, 35, 46, 16],
  563. [17, 145, 115, 1, 146, 116],
  564. [14, 74, 46, 21, 75, 47],
  565. [29, 54, 24, 19, 55, 25],
  566. [11, 45, 15, 46, 46, 16],
  567. [13, 145, 115, 6, 146, 116],
  568. [14, 74, 46, 23, 75, 47],
  569. [44, 54, 24, 7, 55, 25],
  570. [59, 46, 16, 1, 47, 17],
  571. [12, 151, 121, 7, 152, 122],
  572. [12, 75, 47, 26, 76, 48],
  573. [39, 54, 24, 14, 55, 25],
  574. [22, 45, 15, 41, 46, 16],
  575. [6, 151, 121, 14, 152, 122],
  576. [6, 75, 47, 34, 76, 48],
  577. [46, 54, 24, 10, 55, 25],
  578. [2, 45, 15, 64, 46, 16],
  579. [17, 152, 122, 4, 153, 123],
  580. [29, 74, 46, 14, 75, 47],
  581. [49, 54, 24, 10, 55, 25],
  582. [24, 45, 15, 46, 46, 16],
  583. [4, 152, 122, 18, 153, 123],
  584. [13, 74, 46, 32, 75, 47],
  585. [48, 54, 24, 14, 55, 25],
  586. [42, 45, 15, 32, 46, 16],
  587. [20, 147, 117, 4, 148, 118],
  588. [40, 75, 47, 7, 76, 48],
  589. [43, 54, 24, 22, 55, 25],
  590. [10, 45, 15, 67, 46, 16],
  591. [19, 148, 118, 6, 149, 119],
  592. [18, 75, 47, 31, 76, 48],
  593. [34, 54, 24, 34, 55, 25],
  594. [20, 45, 15, 61, 46, 16]
  595. ], j.getRSBlocks = function(a, b) {
  596. var c = j.getRsBlockTable(a, b);
  597. if (void 0 == c) throw new Error("bad rs block @ typeNumber:" + a + "/errorCorrectLevel:" + b);
  598. for (var d = c.length / 3, e = [], f = 0; d > f; f++)
  599. for (var g = c[3 * f + 0], h = c[3 * f + 1], i = c[3 * f + 2], k = 0; g > k; k++) e.push(new j(h, i));
  600. return e
  601. }, j.getRsBlockTable = function(a, b) {
  602. switch (b) {
  603. case d.L:
  604. return j.RS_BLOCK_TABLE[4 * (a - 1) + 0];
  605. case d.M:
  606. return j.RS_BLOCK_TABLE[4 * (a - 1) + 1];
  607. case d.Q:
  608. return j.RS_BLOCK_TABLE[4 * (a - 1) + 2];
  609. case d.H:
  610. return j.RS_BLOCK_TABLE[4 * (a - 1) + 3];
  611. default:
  612. return void 0
  613. }
  614. }, k.prototype = {
  615. get: function(a) {
  616. var b = Math.floor(a / 8);
  617. return 1 == (1 & this.buffer[b] >>> 7 - a % 8)
  618. },
  619. put: function(a, b) {
  620. for (var c = 0; b > c; c++) this.putBit(1 == (1 & a >>> b - c - 1))
  621. },
  622. getLengthInBits: function() {
  623. return this.length
  624. },
  625. putBit: function(a) {
  626. var b = Math.floor(this.length / 8);
  627. this.buffer.length <= b && this.buffer.push(0), a && (this.buffer[b] |= 128 >>> this.length % 8),
  628. this.length++
  629. }
  630. };
  631. var l = [
  632. [17, 14, 11, 7],
  633. [32, 26, 20, 14],
  634. [53, 42, 32, 24],
  635. [78, 62, 46, 34],
  636. [106, 84, 60, 44],
  637. [134, 106, 74, 58],
  638. [154, 122, 86, 64],
  639. [192, 152, 108, 84],
  640. [230, 180, 130, 98],
  641. [271, 213, 151, 119],
  642. [321, 251, 177, 137],
  643. [367, 287, 203, 155],
  644. [425, 331, 241, 177],
  645. [458, 362, 258, 194],
  646. [520, 412, 292, 220],
  647. [586, 450, 322, 250],
  648. [644, 504, 364, 280],
  649. [718, 560, 394, 310],
  650. [792, 624, 442, 338],
  651. [858, 666, 482, 382],
  652. [929, 711, 509, 403],
  653. [1003, 779, 565, 439],
  654. [1091, 857, 611, 461],
  655. [1171, 911, 661, 511],
  656. [1273, 997, 715, 535],
  657. [1367, 1059, 751, 593],
  658. [1465, 1125, 805, 625],
  659. [1528, 1190, 868, 658],
  660. [1628, 1264, 908, 698],
  661. [1732, 1370, 982, 742],
  662. [1840, 1452, 1030, 790],
  663. [1952, 1538, 1112, 842],
  664. [2068, 1628, 1168, 898],
  665. [2188, 1722, 1228, 958],
  666. [2303, 1809, 1283, 983],
  667. [2431, 1911, 1351, 1051],
  668. [2563, 1989, 1423, 1093],
  669. [2699, 2099, 1499, 1139],
  670. [2809, 2213, 1579, 1219],
  671. [2953, 2331, 1663, 1273]
  672. ],
  673. o = function() {
  674. var a = function(a, b) {
  675. this._el = a, this._htOption = b
  676. };
  677. return a.prototype.draw = function(a) {
  678. function g(a, b) {
  679. var c = document.createElementNS("http://www.w3.org/2000/svg", a);
  680. for (var d in b) b.hasOwnProperty(d) && c.setAttribute(d, b[d]);
  681. return c
  682. }
  683. var b = this._htOption,
  684. c = this._el,
  685. d = a.getModuleCount();
  686. Math.floor(b.width / d), Math.floor(b.height / d), this.clear();
  687. var h = g("svg", {
  688. viewBox: "0 0 " + String(d) + " " + String(d),
  689. width: "100%",
  690. height: "100%",
  691. fill: b.colorLight
  692. });
  693. h.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:xlink", "http://www.w3.org/1999/xlink"), c
  694. .appendChild(h), h.appendChild(g("rect", {
  695. fill: b.colorDark,
  696. width: "1",
  697. height: "1",
  698. id: "template"
  699. }));
  700. for (var i = 0; d > i; i++)
  701. for (var j = 0; d > j; j++)
  702. if (a.isDark(i, j)) {
  703. var k = g("use", {
  704. x: String(i),
  705. y: String(j)
  706. });
  707. k.setAttributeNS("http://www.w3.org/1999/xlink", "href", "#template"), h.appendChild(k)
  708. }
  709. }, a.prototype.clear = function() {
  710. for (; this._el.hasChildNodes();) this._el.removeChild(this._el.lastChild)
  711. }, a
  712. }(),
  713. p = "svg" === document.documentElement.tagName.toLowerCase(),
  714. q = p ? o : m() ? function() {
  715. function a() {
  716. this._elImage.src = this._elCanvas.toDataURL("image/png"), this._elImage.style.display = "block", this._elCanvas
  717. .style.display = "none", this._callback(this._elImage.src);
  718. }
  719. function d(a, b) {
  720. var c = this;
  721. if (c._fFail = b, c._fSuccess = a, null === c._bSupportDataURI) {
  722. var d = document.createElement("img"),
  723. e = function() {
  724. c._bSupportDataURI = !1, c._fFail && _fFail.call(c)
  725. },
  726. f = function() {
  727. c._bSupportDataURI = !0, c._fSuccess && c._fSuccess.call(c)
  728. };
  729. return d.onabort = e, d.onerror = e, d.onload = f, d.src =
  730. "data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==",
  731. void 0
  732. }
  733. c._bSupportDataURI === !0 && c._fSuccess ? c._fSuccess.call(c) : c._bSupportDataURI === !1 && c._fFail &&
  734. c._fFail.call(c)
  735. }
  736. if (this._android && this._android <= 2.1) {
  737. var b = 1 / window.devicePixelRatio,
  738. c = CanvasRenderingContext2D.prototype.drawImage;
  739. CanvasRenderingContext2D.prototype.drawImage = function(a, d, e, f, g, h, i, j) {
  740. if ("nodeName" in a && /img/i.test(a.nodeName))
  741. for (var l = arguments.length - 1; l >= 1; l--) arguments[l] = arguments[l] * b;
  742. else "undefined" == typeof j && (arguments[1] *= b, arguments[2] *= b, arguments[3] *= b,
  743. arguments[4] *= b);
  744. c.apply(this, arguments)
  745. }
  746. }
  747. var e = function(a, b, fn) {
  748. this._callback = fn, this._bIsPainted = !1, this._android = n(), this._htOption = b, this._elCanvas = document.createElement(
  749. "canvas"), this._elCanvas.width = b.width, this._elCanvas.height = b.height, a.appendChild(
  750. this._elCanvas), this._el = a, this._oContext = this._elCanvas.getContext("2d"), this._bIsPainted = !
  751. 1, this._elImage = document.createElement("img"), this._elImage.style.display = "none", this._el
  752. .appendChild(this._elImage), this._bSupportDataURI = null
  753. };
  754. return e.prototype.draw = function(a) {
  755. var b = this._elImage,
  756. c = this._oContext,
  757. d = this._htOption,
  758. e = a.getModuleCount(),
  759. f = d.width / e,
  760. g = d.height / e,
  761. h = Math.round(f),
  762. i = Math.round(g);
  763. b.style.display = "none", this.clear();
  764. for (var j = 0; e > j; j++)
  765. for (var k = 0; e > k; k++) {
  766. var l = a.isDark(j, k),
  767. m = k * f,
  768. n = j * g;
  769. c.strokeStyle = l ? d.colorDark : d.colorLight, c.lineWidth = 1, c.fillStyle = l ? d.colorDark :
  770. d.colorLight, c.fillRect(m, n, f, g), c.strokeRect(Math.floor(m) + .5, Math.floor(n) +
  771. .5, h, i), c.strokeRect(Math.ceil(m) - .5, Math.ceil(n) - .5, h, i)
  772. }
  773. this._bIsPainted = !0
  774. }, e.prototype.makeImage = function() {
  775. this._bIsPainted && d.call(this, a)
  776. }, e.prototype.isPainted = function() {
  777. return this._bIsPainted
  778. }, e.prototype.clear = function() {
  779. this._oContext.clearRect(0, 0, this._elCanvas.width, this._elCanvas.height), this._bIsPainted = !1
  780. }, e.prototype.round = function(a) {
  781. return a ? Math.floor(1e3 * a) / 1e3 : a
  782. }, e
  783. }() : function() {
  784. var a = function(a, b) {
  785. this._el = a, this._htOption = b
  786. };
  787. return a.prototype.draw = function(a) {
  788. for (var b = this._htOption, c = this._el, d = a.getModuleCount(), e = Math.floor(b.width / d), f =
  789. Math.floor(b.height / d), g = ['<table style="border:0;border-collapse:collapse;">'], h = 0; d >
  790. h; h++) {
  791. g.push("<tr>");
  792. for (var i = 0; d > i; i++) g.push(
  793. '<td style="border:0;border-collapse:collapse;padding:0;margin:0;width:' + e +
  794. "px;height:" + f + "px;background-color:" + (a.isDark(h, i) ? b.colorDark : b.colorLight) +
  795. ';"></td>');
  796. g.push("</tr>")
  797. }
  798. g.push("</table>"), c.innerHTML = g.join("");
  799. var j = c.childNodes[0],
  800. k = (b.width - j.offsetWidth) / 2,
  801. l = (b.height - j.offsetHeight) / 2;
  802. k > 0 && l > 0 && (j.style.margin = l + "px " + k + "px")
  803. }, a.prototype.clear = function() {
  804. this._el.innerHTML = ""
  805. }, a
  806. }();
  807. QRCode = function(a, b, fn) {
  808. if (this._htOption = {
  809. width: 256,
  810. height: 256,
  811. typeNumber: 4,
  812. colorDark: "#000000",
  813. colorLight: "#ffffff",
  814. correctLevel: d.H
  815. }, "string" == typeof b && (b = {
  816. text: b
  817. }), b)
  818. for (var c in b) this._htOption[c] = b[c];
  819. "string" == typeof a && (a = document.getElementById(a)), this._android = n(), this._el = a, this._oQRCode =
  820. null, this._oDrawing = new q(this._el, this._htOption, fn), this._htOption.text && this.makeCode(this._htOption
  821. .text)
  822. }, QRCode.prototype.makeCode = function(a) {
  823. this._oQRCode = new b(r(a, this._htOption.correctLevel), this._htOption.correctLevel), this._oQRCode.addData(
  824. a), this._oQRCode.make(), this._el.title = a, this._oDrawing.draw(this._oQRCode), this.makeImage()
  825. }, QRCode.prototype.makeImage = function() {
  826. "function" == typeof this._oDrawing.makeImage && (!this._android || this._android >= 3) && this._oDrawing.makeImage()
  827. }, QRCode.prototype.clear = function() {
  828. this._oDrawing.clear()
  829. }, QRCode.CorrectLevel = d
  830. }();