icve-sso-vue3 0.0.18 → 0.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -134,6 +134,682 @@ $({ target: 'Number', stat: true }, {
134
134
  });
135
135
 
136
136
 
137
+ /***/ },
138
+
139
+ /***/ 157
140
+ (__unused_webpack_module, exports, __webpack_require__) {
141
+
142
+ const Utils = __webpack_require__(6886)
143
+ const ECLevel = __webpack_require__(9953)
144
+ const BitBuffer = __webpack_require__(9899)
145
+ const BitMatrix = __webpack_require__(8820)
146
+ const AlignmentPattern = __webpack_require__(6421)
147
+ const FinderPattern = __webpack_require__(7756)
148
+ const MaskPattern = __webpack_require__(1332)
149
+ const ECCode = __webpack_require__(7518)
150
+ const ReedSolomonEncoder = __webpack_require__(4764)
151
+ const Version = __webpack_require__(1427)
152
+ const FormatInfo = __webpack_require__(4565)
153
+ const Mode = __webpack_require__(208)
154
+ const Segments = __webpack_require__(9801)
155
+
156
+ /**
157
+ * QRCode for JavaScript
158
+ *
159
+ * modified by Ryan Day for nodejs support
160
+ * Copyright (c) 2011 Ryan Day
161
+ *
162
+ * Licensed under the MIT license:
163
+ * http://www.opensource.org/licenses/mit-license.php
164
+ *
165
+ //---------------------------------------------------------------------
166
+ // QRCode for JavaScript
167
+ //
168
+ // Copyright (c) 2009 Kazuhiko Arase
169
+ //
170
+ // URL: http://www.d-project.com/
171
+ //
172
+ // Licensed under the MIT license:
173
+ // http://www.opensource.org/licenses/mit-license.php
174
+ //
175
+ // The word "QR Code" is registered trademark of
176
+ // DENSO WAVE INCORPORATED
177
+ // http://www.denso-wave.com/qrcode/faqpatent-e.html
178
+ //
179
+ //---------------------------------------------------------------------
180
+ */
181
+
182
+ /**
183
+ * Add finder patterns bits to matrix
184
+ *
185
+ * @param {BitMatrix} matrix Modules matrix
186
+ * @param {Number} version QR Code version
187
+ */
188
+ function setupFinderPattern (matrix, version) {
189
+ const size = matrix.size
190
+ const pos = FinderPattern.getPositions(version)
191
+
192
+ for (let i = 0; i < pos.length; i++) {
193
+ const row = pos[i][0]
194
+ const col = pos[i][1]
195
+
196
+ for (let r = -1; r <= 7; r++) {
197
+ if (row + r <= -1 || size <= row + r) continue
198
+
199
+ for (let c = -1; c <= 7; c++) {
200
+ if (col + c <= -1 || size <= col + c) continue
201
+
202
+ if ((r >= 0 && r <= 6 && (c === 0 || c === 6)) ||
203
+ (c >= 0 && c <= 6 && (r === 0 || r === 6)) ||
204
+ (r >= 2 && r <= 4 && c >= 2 && c <= 4)) {
205
+ matrix.set(row + r, col + c, true, true)
206
+ } else {
207
+ matrix.set(row + r, col + c, false, true)
208
+ }
209
+ }
210
+ }
211
+ }
212
+ }
213
+
214
+ /**
215
+ * Add timing pattern bits to matrix
216
+ *
217
+ * Note: this function must be called before {@link setupAlignmentPattern}
218
+ *
219
+ * @param {BitMatrix} matrix Modules matrix
220
+ */
221
+ function setupTimingPattern (matrix) {
222
+ const size = matrix.size
223
+
224
+ for (let r = 8; r < size - 8; r++) {
225
+ const value = r % 2 === 0
226
+ matrix.set(r, 6, value, true)
227
+ matrix.set(6, r, value, true)
228
+ }
229
+ }
230
+
231
+ /**
232
+ * Add alignment patterns bits to matrix
233
+ *
234
+ * Note: this function must be called after {@link setupTimingPattern}
235
+ *
236
+ * @param {BitMatrix} matrix Modules matrix
237
+ * @param {Number} version QR Code version
238
+ */
239
+ function setupAlignmentPattern (matrix, version) {
240
+ const pos = AlignmentPattern.getPositions(version)
241
+
242
+ for (let i = 0; i < pos.length; i++) {
243
+ const row = pos[i][0]
244
+ const col = pos[i][1]
245
+
246
+ for (let r = -2; r <= 2; r++) {
247
+ for (let c = -2; c <= 2; c++) {
248
+ if (r === -2 || r === 2 || c === -2 || c === 2 ||
249
+ (r === 0 && c === 0)) {
250
+ matrix.set(row + r, col + c, true, true)
251
+ } else {
252
+ matrix.set(row + r, col + c, false, true)
253
+ }
254
+ }
255
+ }
256
+ }
257
+ }
258
+
259
+ /**
260
+ * Add version info bits to matrix
261
+ *
262
+ * @param {BitMatrix} matrix Modules matrix
263
+ * @param {Number} version QR Code version
264
+ */
265
+ function setupVersionInfo (matrix, version) {
266
+ const size = matrix.size
267
+ const bits = Version.getEncodedBits(version)
268
+ let row, col, mod
269
+
270
+ for (let i = 0; i < 18; i++) {
271
+ row = Math.floor(i / 3)
272
+ col = i % 3 + size - 8 - 3
273
+ mod = ((bits >> i) & 1) === 1
274
+
275
+ matrix.set(row, col, mod, true)
276
+ matrix.set(col, row, mod, true)
277
+ }
278
+ }
279
+
280
+ /**
281
+ * Add format info bits to matrix
282
+ *
283
+ * @param {BitMatrix} matrix Modules matrix
284
+ * @param {ErrorCorrectionLevel} errorCorrectionLevel Error correction level
285
+ * @param {Number} maskPattern Mask pattern reference value
286
+ */
287
+ function setupFormatInfo (matrix, errorCorrectionLevel, maskPattern) {
288
+ const size = matrix.size
289
+ const bits = FormatInfo.getEncodedBits(errorCorrectionLevel, maskPattern)
290
+ let i, mod
291
+
292
+ for (i = 0; i < 15; i++) {
293
+ mod = ((bits >> i) & 1) === 1
294
+
295
+ // vertical
296
+ if (i < 6) {
297
+ matrix.set(i, 8, mod, true)
298
+ } else if (i < 8) {
299
+ matrix.set(i + 1, 8, mod, true)
300
+ } else {
301
+ matrix.set(size - 15 + i, 8, mod, true)
302
+ }
303
+
304
+ // horizontal
305
+ if (i < 8) {
306
+ matrix.set(8, size - i - 1, mod, true)
307
+ } else if (i < 9) {
308
+ matrix.set(8, 15 - i - 1 + 1, mod, true)
309
+ } else {
310
+ matrix.set(8, 15 - i - 1, mod, true)
311
+ }
312
+ }
313
+
314
+ // fixed module
315
+ matrix.set(size - 8, 8, 1, true)
316
+ }
317
+
318
+ /**
319
+ * Add encoded data bits to matrix
320
+ *
321
+ * @param {BitMatrix} matrix Modules matrix
322
+ * @param {Uint8Array} data Data codewords
323
+ */
324
+ function setupData (matrix, data) {
325
+ const size = matrix.size
326
+ let inc = -1
327
+ let row = size - 1
328
+ let bitIndex = 7
329
+ let byteIndex = 0
330
+
331
+ for (let col = size - 1; col > 0; col -= 2) {
332
+ if (col === 6) col--
333
+
334
+ while (true) {
335
+ for (let c = 0; c < 2; c++) {
336
+ if (!matrix.isReserved(row, col - c)) {
337
+ let dark = false
338
+
339
+ if (byteIndex < data.length) {
340
+ dark = (((data[byteIndex] >>> bitIndex) & 1) === 1)
341
+ }
342
+
343
+ matrix.set(row, col - c, dark)
344
+ bitIndex--
345
+
346
+ if (bitIndex === -1) {
347
+ byteIndex++
348
+ bitIndex = 7
349
+ }
350
+ }
351
+ }
352
+
353
+ row += inc
354
+
355
+ if (row < 0 || size <= row) {
356
+ row -= inc
357
+ inc = -inc
358
+ break
359
+ }
360
+ }
361
+ }
362
+ }
363
+
364
+ /**
365
+ * Create encoded codewords from data input
366
+ *
367
+ * @param {Number} version QR Code version
368
+ * @param {ErrorCorrectionLevel} errorCorrectionLevel Error correction level
369
+ * @param {ByteData} data Data input
370
+ * @return {Uint8Array} Buffer containing encoded codewords
371
+ */
372
+ function createData (version, errorCorrectionLevel, segments) {
373
+ // Prepare data buffer
374
+ const buffer = new BitBuffer()
375
+
376
+ segments.forEach(function (data) {
377
+ // prefix data with mode indicator (4 bits)
378
+ buffer.put(data.mode.bit, 4)
379
+
380
+ // Prefix data with character count indicator.
381
+ // The character count indicator is a string of bits that represents the
382
+ // number of characters that are being encoded.
383
+ // The character count indicator must be placed after the mode indicator
384
+ // and must be a certain number of bits long, depending on the QR version
385
+ // and data mode
386
+ // @see {@link Mode.getCharCountIndicator}.
387
+ buffer.put(data.getLength(), Mode.getCharCountIndicator(data.mode, version))
388
+
389
+ // add binary data sequence to buffer
390
+ data.write(buffer)
391
+ })
392
+
393
+ // Calculate required number of bits
394
+ const totalCodewords = Utils.getSymbolTotalCodewords(version)
395
+ const ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel)
396
+ const dataTotalCodewordsBits = (totalCodewords - ecTotalCodewords) * 8
397
+
398
+ // Add a terminator.
399
+ // If the bit string is shorter than the total number of required bits,
400
+ // a terminator of up to four 0s must be added to the right side of the string.
401
+ // If the bit string is more than four bits shorter than the required number of bits,
402
+ // add four 0s to the end.
403
+ if (buffer.getLengthInBits() + 4 <= dataTotalCodewordsBits) {
404
+ buffer.put(0, 4)
405
+ }
406
+
407
+ // If the bit string is fewer than four bits shorter, add only the number of 0s that
408
+ // are needed to reach the required number of bits.
409
+
410
+ // After adding the terminator, if the number of bits in the string is not a multiple of 8,
411
+ // pad the string on the right with 0s to make the string's length a multiple of 8.
412
+ while (buffer.getLengthInBits() % 8 !== 0) {
413
+ buffer.putBit(0)
414
+ }
415
+
416
+ // Add pad bytes if the string is still shorter than the total number of required bits.
417
+ // Extend the buffer to fill the data capacity of the symbol corresponding to
418
+ // the Version and Error Correction Level by adding the Pad Codewords 11101100 (0xEC)
419
+ // and 00010001 (0x11) alternately.
420
+ const remainingByte = (dataTotalCodewordsBits - buffer.getLengthInBits()) / 8
421
+ for (let i = 0; i < remainingByte; i++) {
422
+ buffer.put(i % 2 ? 0x11 : 0xEC, 8)
423
+ }
424
+
425
+ return createCodewords(buffer, version, errorCorrectionLevel)
426
+ }
427
+
428
+ /**
429
+ * Encode input data with Reed-Solomon and return codewords with
430
+ * relative error correction bits
431
+ *
432
+ * @param {BitBuffer} bitBuffer Data to encode
433
+ * @param {Number} version QR Code version
434
+ * @param {ErrorCorrectionLevel} errorCorrectionLevel Error correction level
435
+ * @return {Uint8Array} Buffer containing encoded codewords
436
+ */
437
+ function createCodewords (bitBuffer, version, errorCorrectionLevel) {
438
+ // Total codewords for this QR code version (Data + Error correction)
439
+ const totalCodewords = Utils.getSymbolTotalCodewords(version)
440
+
441
+ // Total number of error correction codewords
442
+ const ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel)
443
+
444
+ // Total number of data codewords
445
+ const dataTotalCodewords = totalCodewords - ecTotalCodewords
446
+
447
+ // Total number of blocks
448
+ const ecTotalBlocks = ECCode.getBlocksCount(version, errorCorrectionLevel)
449
+
450
+ // Calculate how many blocks each group should contain
451
+ const blocksInGroup2 = totalCodewords % ecTotalBlocks
452
+ const blocksInGroup1 = ecTotalBlocks - blocksInGroup2
453
+
454
+ const totalCodewordsInGroup1 = Math.floor(totalCodewords / ecTotalBlocks)
455
+
456
+ const dataCodewordsInGroup1 = Math.floor(dataTotalCodewords / ecTotalBlocks)
457
+ const dataCodewordsInGroup2 = dataCodewordsInGroup1 + 1
458
+
459
+ // Number of EC codewords is the same for both groups
460
+ const ecCount = totalCodewordsInGroup1 - dataCodewordsInGroup1
461
+
462
+ // Initialize a Reed-Solomon encoder with a generator polynomial of degree ecCount
463
+ const rs = new ReedSolomonEncoder(ecCount)
464
+
465
+ let offset = 0
466
+ const dcData = new Array(ecTotalBlocks)
467
+ const ecData = new Array(ecTotalBlocks)
468
+ let maxDataSize = 0
469
+ const buffer = new Uint8Array(bitBuffer.buffer)
470
+
471
+ // Divide the buffer into the required number of blocks
472
+ for (let b = 0; b < ecTotalBlocks; b++) {
473
+ const dataSize = b < blocksInGroup1 ? dataCodewordsInGroup1 : dataCodewordsInGroup2
474
+
475
+ // extract a block of data from buffer
476
+ dcData[b] = buffer.slice(offset, offset + dataSize)
477
+
478
+ // Calculate EC codewords for this data block
479
+ ecData[b] = rs.encode(dcData[b])
480
+
481
+ offset += dataSize
482
+ maxDataSize = Math.max(maxDataSize, dataSize)
483
+ }
484
+
485
+ // Create final data
486
+ // Interleave the data and error correction codewords from each block
487
+ const data = new Uint8Array(totalCodewords)
488
+ let index = 0
489
+ let i, r
490
+
491
+ // Add data codewords
492
+ for (i = 0; i < maxDataSize; i++) {
493
+ for (r = 0; r < ecTotalBlocks; r++) {
494
+ if (i < dcData[r].length) {
495
+ data[index++] = dcData[r][i]
496
+ }
497
+ }
498
+ }
499
+
500
+ // Apped EC codewords
501
+ for (i = 0; i < ecCount; i++) {
502
+ for (r = 0; r < ecTotalBlocks; r++) {
503
+ data[index++] = ecData[r][i]
504
+ }
505
+ }
506
+
507
+ return data
508
+ }
509
+
510
+ /**
511
+ * Build QR Code symbol
512
+ *
513
+ * @param {String} data Input string
514
+ * @param {Number} version QR Code version
515
+ * @param {ErrorCorretionLevel} errorCorrectionLevel Error level
516
+ * @param {MaskPattern} maskPattern Mask pattern
517
+ * @return {Object} Object containing symbol data
518
+ */
519
+ function createSymbol (data, version, errorCorrectionLevel, maskPattern) {
520
+ let segments
521
+
522
+ if (Array.isArray(data)) {
523
+ segments = Segments.fromArray(data)
524
+ } else if (typeof data === 'string') {
525
+ let estimatedVersion = version
526
+
527
+ if (!estimatedVersion) {
528
+ const rawSegments = Segments.rawSplit(data)
529
+
530
+ // Estimate best version that can contain raw splitted segments
531
+ estimatedVersion = Version.getBestVersionForData(rawSegments, errorCorrectionLevel)
532
+ }
533
+
534
+ // Build optimized segments
535
+ // If estimated version is undefined, try with the highest version
536
+ segments = Segments.fromString(data, estimatedVersion || 40)
537
+ } else {
538
+ throw new Error('Invalid data')
539
+ }
540
+
541
+ // Get the min version that can contain data
542
+ const bestVersion = Version.getBestVersionForData(segments, errorCorrectionLevel)
543
+
544
+ // If no version is found, data cannot be stored
545
+ if (!bestVersion) {
546
+ throw new Error('The amount of data is too big to be stored in a QR Code')
547
+ }
548
+
549
+ // If not specified, use min version as default
550
+ if (!version) {
551
+ version = bestVersion
552
+
553
+ // Check if the specified version can contain the data
554
+ } else if (version < bestVersion) {
555
+ throw new Error('\n' +
556
+ 'The chosen QR Code version cannot contain this amount of data.\n' +
557
+ 'Minimum version required to store current data is: ' + bestVersion + '.\n'
558
+ )
559
+ }
560
+
561
+ const dataBits = createData(version, errorCorrectionLevel, segments)
562
+
563
+ // Allocate matrix buffer
564
+ const moduleCount = Utils.getSymbolSize(version)
565
+ const modules = new BitMatrix(moduleCount)
566
+
567
+ // Add function modules
568
+ setupFinderPattern(modules, version)
569
+ setupTimingPattern(modules)
570
+ setupAlignmentPattern(modules, version)
571
+
572
+ // Add temporary dummy bits for format info just to set them as reserved.
573
+ // This is needed to prevent these bits from being masked by {@link MaskPattern.applyMask}
574
+ // since the masking operation must be performed only on the encoding region.
575
+ // These blocks will be replaced with correct values later in code.
576
+ setupFormatInfo(modules, errorCorrectionLevel, 0)
577
+
578
+ if (version >= 7) {
579
+ setupVersionInfo(modules, version)
580
+ }
581
+
582
+ // Add data codewords
583
+ setupData(modules, dataBits)
584
+
585
+ if (isNaN(maskPattern)) {
586
+ // Find best mask pattern
587
+ maskPattern = MaskPattern.getBestMask(modules,
588
+ setupFormatInfo.bind(null, modules, errorCorrectionLevel))
589
+ }
590
+
591
+ // Apply mask pattern
592
+ MaskPattern.applyMask(maskPattern, modules)
593
+
594
+ // Replace format info bits with correct values
595
+ setupFormatInfo(modules, errorCorrectionLevel, maskPattern)
596
+
597
+ return {
598
+ modules: modules,
599
+ version: version,
600
+ errorCorrectionLevel: errorCorrectionLevel,
601
+ maskPattern: maskPattern,
602
+ segments: segments
603
+ }
604
+ }
605
+
606
+ /**
607
+ * QR Code
608
+ *
609
+ * @param {String | Array} data Input data
610
+ * @param {Object} options Optional configurations
611
+ * @param {Number} options.version QR Code version
612
+ * @param {String} options.errorCorrectionLevel Error correction level
613
+ * @param {Function} options.toSJISFunc Helper func to convert utf8 to sjis
614
+ */
615
+ exports.create = function create (data, options) {
616
+ if (typeof data === 'undefined' || data === '') {
617
+ throw new Error('No input text')
618
+ }
619
+
620
+ let errorCorrectionLevel = ECLevel.M
621
+ let version
622
+ let mask
623
+
624
+ if (typeof options !== 'undefined') {
625
+ // Use higher error correction level as default
626
+ errorCorrectionLevel = ECLevel.from(options.errorCorrectionLevel, ECLevel.M)
627
+ version = Version.from(options.version)
628
+ mask = MaskPattern.from(options.maskPattern)
629
+
630
+ if (options.toSJISFunc) {
631
+ Utils.setToSJISFunction(options.toSJISFunc)
632
+ }
633
+ }
634
+
635
+ return createSymbol(data, version, errorCorrectionLevel, mask)
636
+ }
637
+
638
+
639
+ /***/ },
640
+
641
+ /***/ 208
642
+ (__unused_webpack_module, exports, __webpack_require__) {
643
+
644
+ const VersionCheck = __webpack_require__(1878)
645
+ const Regex = __webpack_require__(7044)
646
+
647
+ /**
648
+ * Numeric mode encodes data from the decimal digit set (0 - 9)
649
+ * (byte values 30HEX to 39HEX).
650
+ * Normally, 3 data characters are represented by 10 bits.
651
+ *
652
+ * @type {Object}
653
+ */
654
+ exports.NUMERIC = {
655
+ id: 'Numeric',
656
+ bit: 1 << 0,
657
+ ccBits: [10, 12, 14]
658
+ }
659
+
660
+ /**
661
+ * Alphanumeric mode encodes data from a set of 45 characters,
662
+ * i.e. 10 numeric digits (0 - 9),
663
+ * 26 alphabetic characters (A - Z),
664
+ * and 9 symbols (SP, $, %, *, +, -, ., /, :).
665
+ * Normally, two input characters are represented by 11 bits.
666
+ *
667
+ * @type {Object}
668
+ */
669
+ exports.ALPHANUMERIC = {
670
+ id: 'Alphanumeric',
671
+ bit: 1 << 1,
672
+ ccBits: [9, 11, 13]
673
+ }
674
+
675
+ /**
676
+ * In byte mode, data is encoded at 8 bits per character.
677
+ *
678
+ * @type {Object}
679
+ */
680
+ exports.BYTE = {
681
+ id: 'Byte',
682
+ bit: 1 << 2,
683
+ ccBits: [8, 16, 16]
684
+ }
685
+
686
+ /**
687
+ * The Kanji mode efficiently encodes Kanji characters in accordance with
688
+ * the Shift JIS system based on JIS X 0208.
689
+ * The Shift JIS values are shifted from the JIS X 0208 values.
690
+ * JIS X 0208 gives details of the shift coded representation.
691
+ * Each two-byte character value is compacted to a 13-bit binary codeword.
692
+ *
693
+ * @type {Object}
694
+ */
695
+ exports.KANJI = {
696
+ id: 'Kanji',
697
+ bit: 1 << 3,
698
+ ccBits: [8, 10, 12]
699
+ }
700
+
701
+ /**
702
+ * Mixed mode will contain a sequences of data in a combination of any of
703
+ * the modes described above
704
+ *
705
+ * @type {Object}
706
+ */
707
+ exports.MIXED = {
708
+ bit: -1
709
+ }
710
+
711
+ /**
712
+ * Returns the number of bits needed to store the data length
713
+ * according to QR Code specifications.
714
+ *
715
+ * @param {Mode} mode Data mode
716
+ * @param {Number} version QR Code version
717
+ * @return {Number} Number of bits
718
+ */
719
+ exports.getCharCountIndicator = function getCharCountIndicator (mode, version) {
720
+ if (!mode.ccBits) throw new Error('Invalid mode: ' + mode)
721
+
722
+ if (!VersionCheck.isValid(version)) {
723
+ throw new Error('Invalid version: ' + version)
724
+ }
725
+
726
+ if (version >= 1 && version < 10) return mode.ccBits[0]
727
+ else if (version < 27) return mode.ccBits[1]
728
+ return mode.ccBits[2]
729
+ }
730
+
731
+ /**
732
+ * Returns the most efficient mode to store the specified data
733
+ *
734
+ * @param {String} dataStr Input data string
735
+ * @return {Mode} Best mode
736
+ */
737
+ exports.getBestModeForData = function getBestModeForData (dataStr) {
738
+ if (Regex.testNumeric(dataStr)) return exports.NUMERIC
739
+ else if (Regex.testAlphanumeric(dataStr)) return exports.ALPHANUMERIC
740
+ else if (Regex.testKanji(dataStr)) return exports.KANJI
741
+ else return exports.BYTE
742
+ }
743
+
744
+ /**
745
+ * Return mode name as string
746
+ *
747
+ * @param {Mode} mode Mode object
748
+ * @returns {String} Mode name
749
+ */
750
+ exports.toString = function toString (mode) {
751
+ if (mode && mode.id) return mode.id
752
+ throw new Error('Invalid mode')
753
+ }
754
+
755
+ /**
756
+ * Check if input param is a valid mode object
757
+ *
758
+ * @param {Mode} mode Mode object
759
+ * @returns {Boolean} True if valid mode, false otherwise
760
+ */
761
+ exports.isValid = function isValid (mode) {
762
+ return mode && mode.bit && mode.ccBits
763
+ }
764
+
765
+ /**
766
+ * Get mode object from its name
767
+ *
768
+ * @param {String} string Mode name
769
+ * @returns {Mode} Mode object
770
+ */
771
+ function fromString (string) {
772
+ if (typeof string !== 'string') {
773
+ throw new Error('Param is not a string')
774
+ }
775
+
776
+ const lcStr = string.toLowerCase()
777
+
778
+ switch (lcStr) {
779
+ case 'numeric':
780
+ return exports.NUMERIC
781
+ case 'alphanumeric':
782
+ return exports.ALPHANUMERIC
783
+ case 'kanji':
784
+ return exports.KANJI
785
+ case 'byte':
786
+ return exports.BYTE
787
+ default:
788
+ throw new Error('Unknown mode: ' + string)
789
+ }
790
+ }
791
+
792
+ /**
793
+ * Returns mode from a value.
794
+ * If value is not a valid mode, returns defaultValue
795
+ *
796
+ * @param {Mode|String} value Encoding mode
797
+ * @param {Mode} defaultValue Fallback value
798
+ * @return {Mode} Encoding mode
799
+ */
800
+ exports.from = function from (value, defaultValue) {
801
+ if (exports.isValid(value)) {
802
+ return value
803
+ }
804
+
805
+ try {
806
+ return fromString(value)
807
+ } catch (e) {
808
+ return defaultValue
809
+ }
810
+ }
811
+
812
+
137
813
  /***/ },
138
814
 
139
815
  /***/ 235
@@ -1640,6 +2316,261 @@ var NATIVE_SYMBOL = __webpack_require__(4495);
1640
2316
  module.exports = NATIVE_SYMBOL && !!Symbol['for'] && !!Symbol.keyFor;
1641
2317
 
1642
2318
 
2319
+ /***/ },
2320
+
2321
+ /***/ 1332
2322
+ (__unused_webpack_module, exports) {
2323
+
2324
+ /**
2325
+ * Data mask pattern reference
2326
+ * @type {Object}
2327
+ */
2328
+ exports.Patterns = {
2329
+ PATTERN000: 0,
2330
+ PATTERN001: 1,
2331
+ PATTERN010: 2,
2332
+ PATTERN011: 3,
2333
+ PATTERN100: 4,
2334
+ PATTERN101: 5,
2335
+ PATTERN110: 6,
2336
+ PATTERN111: 7
2337
+ }
2338
+
2339
+ /**
2340
+ * Weighted penalty scores for the undesirable features
2341
+ * @type {Object}
2342
+ */
2343
+ const PenaltyScores = {
2344
+ N1: 3,
2345
+ N2: 3,
2346
+ N3: 40,
2347
+ N4: 10
2348
+ }
2349
+
2350
+ /**
2351
+ * Check if mask pattern value is valid
2352
+ *
2353
+ * @param {Number} mask Mask pattern
2354
+ * @return {Boolean} true if valid, false otherwise
2355
+ */
2356
+ exports.isValid = function isValid (mask) {
2357
+ return mask != null && mask !== '' && !isNaN(mask) && mask >= 0 && mask <= 7
2358
+ }
2359
+
2360
+ /**
2361
+ * Returns mask pattern from a value.
2362
+ * If value is not valid, returns undefined
2363
+ *
2364
+ * @param {Number|String} value Mask pattern value
2365
+ * @return {Number} Valid mask pattern or undefined
2366
+ */
2367
+ exports.from = function from (value) {
2368
+ return exports.isValid(value) ? parseInt(value, 10) : undefined
2369
+ }
2370
+
2371
+ /**
2372
+ * Find adjacent modules in row/column with the same color
2373
+ * and assign a penalty value.
2374
+ *
2375
+ * Points: N1 + i
2376
+ * i is the amount by which the number of adjacent modules of the same color exceeds 5
2377
+ */
2378
+ exports.getPenaltyN1 = function getPenaltyN1 (data) {
2379
+ const size = data.size
2380
+ let points = 0
2381
+ let sameCountCol = 0
2382
+ let sameCountRow = 0
2383
+ let lastCol = null
2384
+ let lastRow = null
2385
+
2386
+ for (let row = 0; row < size; row++) {
2387
+ sameCountCol = sameCountRow = 0
2388
+ lastCol = lastRow = null
2389
+
2390
+ for (let col = 0; col < size; col++) {
2391
+ let module = data.get(row, col)
2392
+ if (module === lastCol) {
2393
+ sameCountCol++
2394
+ } else {
2395
+ if (sameCountCol >= 5) points += PenaltyScores.N1 + (sameCountCol - 5)
2396
+ lastCol = module
2397
+ sameCountCol = 1
2398
+ }
2399
+
2400
+ module = data.get(col, row)
2401
+ if (module === lastRow) {
2402
+ sameCountRow++
2403
+ } else {
2404
+ if (sameCountRow >= 5) points += PenaltyScores.N1 + (sameCountRow - 5)
2405
+ lastRow = module
2406
+ sameCountRow = 1
2407
+ }
2408
+ }
2409
+
2410
+ if (sameCountCol >= 5) points += PenaltyScores.N1 + (sameCountCol - 5)
2411
+ if (sameCountRow >= 5) points += PenaltyScores.N1 + (sameCountRow - 5)
2412
+ }
2413
+
2414
+ return points
2415
+ }
2416
+
2417
+ /**
2418
+ * Find 2x2 blocks with the same color and assign a penalty value
2419
+ *
2420
+ * Points: N2 * (m - 1) * (n - 1)
2421
+ */
2422
+ exports.getPenaltyN2 = function getPenaltyN2 (data) {
2423
+ const size = data.size
2424
+ let points = 0
2425
+
2426
+ for (let row = 0; row < size - 1; row++) {
2427
+ for (let col = 0; col < size - 1; col++) {
2428
+ const last = data.get(row, col) +
2429
+ data.get(row, col + 1) +
2430
+ data.get(row + 1, col) +
2431
+ data.get(row + 1, col + 1)
2432
+
2433
+ if (last === 4 || last === 0) points++
2434
+ }
2435
+ }
2436
+
2437
+ return points * PenaltyScores.N2
2438
+ }
2439
+
2440
+ /**
2441
+ * Find 1:1:3:1:1 ratio (dark:light:dark:light:dark) pattern in row/column,
2442
+ * preceded or followed by light area 4 modules wide
2443
+ *
2444
+ * Points: N3 * number of pattern found
2445
+ */
2446
+ exports.getPenaltyN3 = function getPenaltyN3 (data) {
2447
+ const size = data.size
2448
+ let points = 0
2449
+ let bitsCol = 0
2450
+ let bitsRow = 0
2451
+
2452
+ for (let row = 0; row < size; row++) {
2453
+ bitsCol = bitsRow = 0
2454
+ for (let col = 0; col < size; col++) {
2455
+ bitsCol = ((bitsCol << 1) & 0x7FF) | data.get(row, col)
2456
+ if (col >= 10 && (bitsCol === 0x5D0 || bitsCol === 0x05D)) points++
2457
+
2458
+ bitsRow = ((bitsRow << 1) & 0x7FF) | data.get(col, row)
2459
+ if (col >= 10 && (bitsRow === 0x5D0 || bitsRow === 0x05D)) points++
2460
+ }
2461
+ }
2462
+
2463
+ return points * PenaltyScores.N3
2464
+ }
2465
+
2466
+ /**
2467
+ * Calculate proportion of dark modules in entire symbol
2468
+ *
2469
+ * Points: N4 * k
2470
+ *
2471
+ * k is the rating of the deviation of the proportion of dark modules
2472
+ * in the symbol from 50% in steps of 5%
2473
+ */
2474
+ exports.getPenaltyN4 = function getPenaltyN4 (data) {
2475
+ let darkCount = 0
2476
+ const modulesCount = data.data.length
2477
+
2478
+ for (let i = 0; i < modulesCount; i++) darkCount += data.data[i]
2479
+
2480
+ const k = Math.abs(Math.ceil((darkCount * 100 / modulesCount) / 5) - 10)
2481
+
2482
+ return k * PenaltyScores.N4
2483
+ }
2484
+
2485
+ /**
2486
+ * Return mask value at given position
2487
+ *
2488
+ * @param {Number} maskPattern Pattern reference value
2489
+ * @param {Number} i Row
2490
+ * @param {Number} j Column
2491
+ * @return {Boolean} Mask value
2492
+ */
2493
+ function getMaskAt (maskPattern, i, j) {
2494
+ switch (maskPattern) {
2495
+ case exports.Patterns.PATTERN000: return (i + j) % 2 === 0
2496
+ case exports.Patterns.PATTERN001: return i % 2 === 0
2497
+ case exports.Patterns.PATTERN010: return j % 3 === 0
2498
+ case exports.Patterns.PATTERN011: return (i + j) % 3 === 0
2499
+ case exports.Patterns.PATTERN100: return (Math.floor(i / 2) + Math.floor(j / 3)) % 2 === 0
2500
+ case exports.Patterns.PATTERN101: return (i * j) % 2 + (i * j) % 3 === 0
2501
+ case exports.Patterns.PATTERN110: return ((i * j) % 2 + (i * j) % 3) % 2 === 0
2502
+ case exports.Patterns.PATTERN111: return ((i * j) % 3 + (i + j) % 2) % 2 === 0
2503
+
2504
+ default: throw new Error('bad maskPattern:' + maskPattern)
2505
+ }
2506
+ }
2507
+
2508
+ /**
2509
+ * Apply a mask pattern to a BitMatrix
2510
+ *
2511
+ * @param {Number} pattern Pattern reference number
2512
+ * @param {BitMatrix} data BitMatrix data
2513
+ */
2514
+ exports.applyMask = function applyMask (pattern, data) {
2515
+ const size = data.size
2516
+
2517
+ for (let col = 0; col < size; col++) {
2518
+ for (let row = 0; row < size; row++) {
2519
+ if (data.isReserved(row, col)) continue
2520
+ data.xor(row, col, getMaskAt(pattern, row, col))
2521
+ }
2522
+ }
2523
+ }
2524
+
2525
+ /**
2526
+ * Returns the best mask pattern for data
2527
+ *
2528
+ * @param {BitMatrix} data
2529
+ * @return {Number} Mask pattern reference number
2530
+ */
2531
+ exports.getBestMask = function getBestMask (data, setupFormatFunc) {
2532
+ const numPatterns = Object.keys(exports.Patterns).length
2533
+ let bestPattern = 0
2534
+ let lowerPenalty = Infinity
2535
+
2536
+ for (let p = 0; p < numPatterns; p++) {
2537
+ setupFormatFunc(p)
2538
+ exports.applyMask(p, data)
2539
+
2540
+ // Calculate penalty
2541
+ const penalty =
2542
+ exports.getPenaltyN1(data) +
2543
+ exports.getPenaltyN2(data) +
2544
+ exports.getPenaltyN3(data) +
2545
+ exports.getPenaltyN4(data)
2546
+
2547
+ // Undo previously applied mask
2548
+ exports.applyMask(p, data)
2549
+
2550
+ if (penalty < lowerPenalty) {
2551
+ lowerPenalty = penalty
2552
+ bestPattern = p
2553
+ }
2554
+ }
2555
+
2556
+ return bestPattern
2557
+ }
2558
+
2559
+
2560
+ /***/ },
2561
+
2562
+ /***/ 1333
2563
+ (module) {
2564
+
2565
+ // can-promise has a crash in some versions of react native that dont have
2566
+ // standard global objects
2567
+ // https://github.com/soldair/node-qrcode/issues/157
2568
+
2569
+ module.exports = function () {
2570
+ return typeof Promise === 'function' && Promise.prototype && Promise.prototype.then
2571
+ }
2572
+
2573
+
1643
2574
  /***/ },
1644
2575
 
1645
2576
  /***/ 1385
@@ -1715,6 +2646,242 @@ $({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGE
1715
2646
  __webpack_require__(2405);
1716
2647
 
1717
2648
 
2649
+ /***/ },
2650
+
2651
+ /***/ 1427
2652
+ (__unused_webpack_module, exports, __webpack_require__) {
2653
+
2654
+ const Utils = __webpack_require__(6886)
2655
+ const ECCode = __webpack_require__(7518)
2656
+ const ECLevel = __webpack_require__(9953)
2657
+ const Mode = __webpack_require__(208)
2658
+ const VersionCheck = __webpack_require__(1878)
2659
+
2660
+ // Generator polynomial used to encode version information
2661
+ const G18 = (1 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (1 << 8) | (1 << 5) | (1 << 2) | (1 << 0)
2662
+ const G18_BCH = Utils.getBCHDigit(G18)
2663
+
2664
+ function getBestVersionForDataLength (mode, length, errorCorrectionLevel) {
2665
+ for (let currentVersion = 1; currentVersion <= 40; currentVersion++) {
2666
+ if (length <= exports.getCapacity(currentVersion, errorCorrectionLevel, mode)) {
2667
+ return currentVersion
2668
+ }
2669
+ }
2670
+
2671
+ return undefined
2672
+ }
2673
+
2674
+ function getReservedBitsCount (mode, version) {
2675
+ // Character count indicator + mode indicator bits
2676
+ return Mode.getCharCountIndicator(mode, version) + 4
2677
+ }
2678
+
2679
+ function getTotalBitsFromDataArray (segments, version) {
2680
+ let totalBits = 0
2681
+
2682
+ segments.forEach(function (data) {
2683
+ const reservedBits = getReservedBitsCount(data.mode, version)
2684
+ totalBits += reservedBits + data.getBitsLength()
2685
+ })
2686
+
2687
+ return totalBits
2688
+ }
2689
+
2690
+ function getBestVersionForMixedData (segments, errorCorrectionLevel) {
2691
+ for (let currentVersion = 1; currentVersion <= 40; currentVersion++) {
2692
+ const length = getTotalBitsFromDataArray(segments, currentVersion)
2693
+ if (length <= exports.getCapacity(currentVersion, errorCorrectionLevel, Mode.MIXED)) {
2694
+ return currentVersion
2695
+ }
2696
+ }
2697
+
2698
+ return undefined
2699
+ }
2700
+
2701
+ /**
2702
+ * Returns version number from a value.
2703
+ * If value is not a valid version, returns defaultValue
2704
+ *
2705
+ * @param {Number|String} value QR Code version
2706
+ * @param {Number} defaultValue Fallback value
2707
+ * @return {Number} QR Code version number
2708
+ */
2709
+ exports.from = function from (value, defaultValue) {
2710
+ if (VersionCheck.isValid(value)) {
2711
+ return parseInt(value, 10)
2712
+ }
2713
+
2714
+ return defaultValue
2715
+ }
2716
+
2717
+ /**
2718
+ * Returns how much data can be stored with the specified QR code version
2719
+ * and error correction level
2720
+ *
2721
+ * @param {Number} version QR Code version (1-40)
2722
+ * @param {Number} errorCorrectionLevel Error correction level
2723
+ * @param {Mode} mode Data mode
2724
+ * @return {Number} Quantity of storable data
2725
+ */
2726
+ exports.getCapacity = function getCapacity (version, errorCorrectionLevel, mode) {
2727
+ if (!VersionCheck.isValid(version)) {
2728
+ throw new Error('Invalid QR Code version')
2729
+ }
2730
+
2731
+ // Use Byte mode as default
2732
+ if (typeof mode === 'undefined') mode = Mode.BYTE
2733
+
2734
+ // Total codewords for this QR code version (Data + Error correction)
2735
+ const totalCodewords = Utils.getSymbolTotalCodewords(version)
2736
+
2737
+ // Total number of error correction codewords
2738
+ const ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel)
2739
+
2740
+ // Total number of data codewords
2741
+ const dataTotalCodewordsBits = (totalCodewords - ecTotalCodewords) * 8
2742
+
2743
+ if (mode === Mode.MIXED) return dataTotalCodewordsBits
2744
+
2745
+ const usableBits = dataTotalCodewordsBits - getReservedBitsCount(mode, version)
2746
+
2747
+ // Return max number of storable codewords
2748
+ switch (mode) {
2749
+ case Mode.NUMERIC:
2750
+ return Math.floor((usableBits / 10) * 3)
2751
+
2752
+ case Mode.ALPHANUMERIC:
2753
+ return Math.floor((usableBits / 11) * 2)
2754
+
2755
+ case Mode.KANJI:
2756
+ return Math.floor(usableBits / 13)
2757
+
2758
+ case Mode.BYTE:
2759
+ default:
2760
+ return Math.floor(usableBits / 8)
2761
+ }
2762
+ }
2763
+
2764
+ /**
2765
+ * Returns the minimum version needed to contain the amount of data
2766
+ *
2767
+ * @param {Segment} data Segment of data
2768
+ * @param {Number} [errorCorrectionLevel=H] Error correction level
2769
+ * @param {Mode} mode Data mode
2770
+ * @return {Number} QR Code version
2771
+ */
2772
+ exports.getBestVersionForData = function getBestVersionForData (data, errorCorrectionLevel) {
2773
+ let seg
2774
+
2775
+ const ecl = ECLevel.from(errorCorrectionLevel, ECLevel.M)
2776
+
2777
+ if (Array.isArray(data)) {
2778
+ if (data.length > 1) {
2779
+ return getBestVersionForMixedData(data, ecl)
2780
+ }
2781
+
2782
+ if (data.length === 0) {
2783
+ return 1
2784
+ }
2785
+
2786
+ seg = data[0]
2787
+ } else {
2788
+ seg = data
2789
+ }
2790
+
2791
+ return getBestVersionForDataLength(seg.mode, seg.getLength(), ecl)
2792
+ }
2793
+
2794
+ /**
2795
+ * Returns version information with relative error correction bits
2796
+ *
2797
+ * The version information is included in QR Code symbols of version 7 or larger.
2798
+ * It consists of an 18-bit sequence containing 6 data bits,
2799
+ * with 12 error correction bits calculated using the (18, 6) Golay code.
2800
+ *
2801
+ * @param {Number} version QR Code version
2802
+ * @return {Number} Encoded version info bits
2803
+ */
2804
+ exports.getEncodedBits = function getEncodedBits (version) {
2805
+ if (!VersionCheck.isValid(version) || version < 7) {
2806
+ throw new Error('Invalid QR Code version')
2807
+ }
2808
+
2809
+ let d = version << 12
2810
+
2811
+ while (Utils.getBCHDigit(d) - G18_BCH >= 0) {
2812
+ d ^= (G18 << (Utils.getBCHDigit(d) - G18_BCH))
2813
+ }
2814
+
2815
+ return (version << 12) | d
2816
+ }
2817
+
2818
+
2819
+ /***/ },
2820
+
2821
+ /***/ 1433
2822
+ (module, __unused_webpack_exports, __webpack_require__) {
2823
+
2824
+ const Mode = __webpack_require__(208)
2825
+
2826
+ /**
2827
+ * Array of characters available in alphanumeric mode
2828
+ *
2829
+ * As per QR Code specification, to each character
2830
+ * is assigned a value from 0 to 44 which in this case coincides
2831
+ * with the array index
2832
+ *
2833
+ * @type {Array}
2834
+ */
2835
+ const ALPHA_NUM_CHARS = [
2836
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
2837
+ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
2838
+ 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
2839
+ ' ', '$', '%', '*', '+', '-', '.', '/', ':'
2840
+ ]
2841
+
2842
+ function AlphanumericData (data) {
2843
+ this.mode = Mode.ALPHANUMERIC
2844
+ this.data = data
2845
+ }
2846
+
2847
+ AlphanumericData.getBitsLength = function getBitsLength (length) {
2848
+ return 11 * Math.floor(length / 2) + 6 * (length % 2)
2849
+ }
2850
+
2851
+ AlphanumericData.prototype.getLength = function getLength () {
2852
+ return this.data.length
2853
+ }
2854
+
2855
+ AlphanumericData.prototype.getBitsLength = function getBitsLength () {
2856
+ return AlphanumericData.getBitsLength(this.data.length)
2857
+ }
2858
+
2859
+ AlphanumericData.prototype.write = function write (bitBuffer) {
2860
+ let i
2861
+
2862
+ // Input data characters are divided into groups of two characters
2863
+ // and encoded as 11-bit binary codes.
2864
+ for (i = 0; i + 2 <= this.data.length; i += 2) {
2865
+ // The character value of the first character is multiplied by 45
2866
+ let value = ALPHA_NUM_CHARS.indexOf(this.data[i]) * 45
2867
+
2868
+ // The character value of the second digit is added to the product
2869
+ value += ALPHA_NUM_CHARS.indexOf(this.data[i + 1])
2870
+
2871
+ // The sum is then stored as 11-bit binary number
2872
+ bitBuffer.put(value, 11)
2873
+ }
2874
+
2875
+ // If the number of input data characters is not a multiple of two,
2876
+ // the character value of the final character is encoded as a 6-bit binary number.
2877
+ if (this.data.length % 2) {
2878
+ bitBuffer.put(ALPHA_NUM_CHARS.indexOf(this.data[i]), 6)
2879
+ }
2880
+ }
2881
+
2882
+ module.exports = AlphanumericData
2883
+
2884
+
1718
2885
  /***/ },
1719
2886
 
1720
2887
  /***/ 1436
@@ -1988,6 +3155,22 @@ module.exports = function (object, names) {
1988
3155
  };
1989
3156
 
1990
3157
 
3158
+ /***/ },
3159
+
3160
+ /***/ 1878
3161
+ (__unused_webpack_module, exports) {
3162
+
3163
+ /**
3164
+ * Check if QR Code version is valid
3165
+ *
3166
+ * @param {Number} version QR Code version
3167
+ * @return {Boolean} true if valid version, false otherwise
3168
+ */
3169
+ exports.isValid = function isValid (version) {
3170
+ return !isNaN(version) && version >= 1 && version <= 40
3171
+ }
3172
+
3173
+
1991
3174
  /***/ },
1992
3175
 
1993
3176
  /***/ 1928
@@ -2871,6 +4054,112 @@ __webpack_require__(3110);
2871
4054
  __webpack_require__(9773);
2872
4055
 
2873
4056
 
4057
+ /***/ },
4058
+
4059
+ /***/ 2726
4060
+ (__unused_webpack_module, exports) {
4061
+
4062
+ function hex2rgba (hex) {
4063
+ if (typeof hex === 'number') {
4064
+ hex = hex.toString()
4065
+ }
4066
+
4067
+ if (typeof hex !== 'string') {
4068
+ throw new Error('Color should be defined as hex string')
4069
+ }
4070
+
4071
+ let hexCode = hex.slice().replace('#', '').split('')
4072
+ if (hexCode.length < 3 || hexCode.length === 5 || hexCode.length > 8) {
4073
+ throw new Error('Invalid hex color: ' + hex)
4074
+ }
4075
+
4076
+ // Convert from short to long form (fff -> ffffff)
4077
+ if (hexCode.length === 3 || hexCode.length === 4) {
4078
+ hexCode = Array.prototype.concat.apply([], hexCode.map(function (c) {
4079
+ return [c, c]
4080
+ }))
4081
+ }
4082
+
4083
+ // Add default alpha value
4084
+ if (hexCode.length === 6) hexCode.push('F', 'F')
4085
+
4086
+ const hexValue = parseInt(hexCode.join(''), 16)
4087
+
4088
+ return {
4089
+ r: (hexValue >> 24) & 255,
4090
+ g: (hexValue >> 16) & 255,
4091
+ b: (hexValue >> 8) & 255,
4092
+ a: hexValue & 255,
4093
+ hex: '#' + hexCode.slice(0, 6).join('')
4094
+ }
4095
+ }
4096
+
4097
+ exports.getOptions = function getOptions (options) {
4098
+ if (!options) options = {}
4099
+ if (!options.color) options.color = {}
4100
+
4101
+ const margin = typeof options.margin === 'undefined' ||
4102
+ options.margin === null ||
4103
+ options.margin < 0
4104
+ ? 4
4105
+ : options.margin
4106
+
4107
+ const width = options.width && options.width >= 21 ? options.width : undefined
4108
+ const scale = options.scale || 4
4109
+
4110
+ return {
4111
+ width: width,
4112
+ scale: width ? 4 : scale,
4113
+ margin: margin,
4114
+ color: {
4115
+ dark: hex2rgba(options.color.dark || '#000000ff'),
4116
+ light: hex2rgba(options.color.light || '#ffffffff')
4117
+ },
4118
+ type: options.type,
4119
+ rendererOpts: options.rendererOpts || {}
4120
+ }
4121
+ }
4122
+
4123
+ exports.getScale = function getScale (qrSize, opts) {
4124
+ return opts.width && opts.width >= qrSize + opts.margin * 2
4125
+ ? opts.width / (qrSize + opts.margin * 2)
4126
+ : opts.scale
4127
+ }
4128
+
4129
+ exports.getImageWidth = function getImageWidth (qrSize, opts) {
4130
+ const scale = exports.getScale(qrSize, opts)
4131
+ return Math.floor((qrSize + opts.margin * 2) * scale)
4132
+ }
4133
+
4134
+ exports.qrToImageData = function qrToImageData (imgData, qr, opts) {
4135
+ const size = qr.modules.size
4136
+ const data = qr.modules.data
4137
+ const scale = exports.getScale(size, opts)
4138
+ const symbolSize = Math.floor((size + opts.margin * 2) * scale)
4139
+ const scaledMargin = opts.margin * scale
4140
+ const palette = [opts.color.light, opts.color.dark]
4141
+
4142
+ for (let i = 0; i < symbolSize; i++) {
4143
+ for (let j = 0; j < symbolSize; j++) {
4144
+ let posDst = (i * symbolSize + j) * 4
4145
+ let pxColor = opts.color.light
4146
+
4147
+ if (i >= scaledMargin && j >= scaledMargin &&
4148
+ i < symbolSize - scaledMargin && j < symbolSize - scaledMargin) {
4149
+ const iSrc = Math.floor((i - scaledMargin) / scale)
4150
+ const jSrc = Math.floor((j - scaledMargin) / scale)
4151
+ pxColor = palette[data[iSrc * size + jSrc] ? 1 : 0]
4152
+ }
4153
+
4154
+ imgData[posDst++] = pxColor.r
4155
+ imgData[posDst++] = pxColor.g
4156
+ imgData[posDst++] = pxColor.b
4157
+ imgData[posDst] = pxColor.a
4158
+ }
4159
+ }
4160
+ }
4161
+
4162
+
2874
4163
  /***/ },
2875
4164
 
2876
4165
  /***/ 2731
@@ -4925,6 +6214,56 @@ $({ target: 'Array', stat: true }, {
4925
6214
  });
4926
6215
 
4927
6216
 
6217
+ /***/ },
6218
+
6219
+ /***/ 4357
6220
+ (module, __unused_webpack_exports, __webpack_require__) {
6221
+
6222
+ const Mode = __webpack_require__(208)
6223
+
6224
+ function NumericData (data) {
6225
+ this.mode = Mode.NUMERIC
6226
+ this.data = data.toString()
6227
+ }
6228
+
6229
+ NumericData.getBitsLength = function getBitsLength (length) {
6230
+ return 10 * Math.floor(length / 3) + ((length % 3) ? ((length % 3) * 3 + 1) : 0)
6231
+ }
6232
+
6233
+ NumericData.prototype.getLength = function getLength () {
6234
+ return this.data.length
6235
+ }
6236
+
6237
+ NumericData.prototype.getBitsLength = function getBitsLength () {
6238
+ return NumericData.getBitsLength(this.data.length)
6239
+ }
6240
+
6241
+ NumericData.prototype.write = function write (bitBuffer) {
6242
+ let i, group, value
6243
+
6244
+ // The input data string is divided into groups of three digits,
6245
+ // and each group is converted to its 10-bit binary equivalent.
6246
+ for (i = 0; i + 3 <= this.data.length; i += 3) {
6247
+ group = this.data.substr(i, 3)
6248
+ value = parseInt(group, 10)
6249
+
6250
+ bitBuffer.put(value, 10)
6251
+ }
6252
+
6253
+ // If the number of input digits is not an exact multiple of three,
6254
+ // the final one or two digits are converted to 4 or 7 bits respectively.
6255
+ const remainingNum = this.data.length - i
6256
+ if (remainingNum > 0) {
6257
+ group = this.data.substr(i)
6258
+ value = parseInt(group, 10)
6259
+
6260
+ bitBuffer.put(value, remainingNum * 3 + 1)
6261
+ }
6262
+ }
6263
+
6264
+ module.exports = NumericData
6265
+
6266
+
4928
6267
  /***/ },
4929
6268
 
4930
6269
  /***/ 4376
@@ -5338,6 +6677,42 @@ $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
5338
6677
  });
5339
6678
 
5340
6679
 
6680
+ /***/ },
6681
+
6682
+ /***/ 4565
6683
+ (__unused_webpack_module, exports, __webpack_require__) {
6684
+
6685
+ const Utils = __webpack_require__(6886)
6686
+
6687
+ const G15 = (1 << 10) | (1 << 8) | (1 << 5) | (1 << 4) | (1 << 2) | (1 << 1) | (1 << 0)
6688
+ const G15_MASK = (1 << 14) | (1 << 12) | (1 << 10) | (1 << 4) | (1 << 1)
6689
+ const G15_BCH = Utils.getBCHDigit(G15)
6690
+
6691
+ /**
6692
+ * Returns format information with relative error correction bits
6693
+ *
6694
+ * The format information is a 15-bit sequence containing 5 data bits,
6695
+ * with 10 error correction bits calculated using the (15, 5) BCH code.
6696
+ *
6697
+ * @param {Number} errorCorrectionLevel Error correction level
6698
+ * @param {Number} mask Mask pattern
6699
+ * @return {Number} Encoded format information bits
6700
+ */
6701
+ exports.getEncodedBits = function getEncodedBits (errorCorrectionLevel, mask) {
6702
+ const data = ((errorCorrectionLevel.bit << 3) | mask)
6703
+ let d = data << 10
6704
+
6705
+ while (Utils.getBCHDigit(d) - G15_BCH >= 0) {
6706
+ d ^= (G15 << (Utils.getBCHDigit(d) - G15_BCH))
6707
+ }
6708
+
6709
+ // xor final data with mask pattern in order to ensure that
6710
+ // no combination of Error Correction Level and data mask pattern
6711
+ // will result in an all-zero data string
6712
+ return ((data << 10) | d) ^ G15_MASK
6713
+ }
6714
+
6715
+
5341
6716
  /***/ },
5342
6717
 
5343
6718
  /***/ 4576
@@ -5548,6 +6923,138 @@ module.exports = function combineURLs(baseURL, relativeURL) {
5548
6923
  };
5549
6924
 
5550
6925
 
6926
+ /***/ },
6927
+
6928
+ /***/ 4713
6929
+ (__unused_webpack_module, exports, __webpack_require__) {
6930
+
6931
+ const GF = __webpack_require__(5112)
6932
+
6933
+ /**
6934
+ * Multiplies two polynomials inside Galois Field
6935
+ *
6936
+ * @param {Uint8Array} p1 Polynomial
6937
+ * @param {Uint8Array} p2 Polynomial
6938
+ * @return {Uint8Array} Product of p1 and p2
6939
+ */
6940
+ exports.mul = function mul (p1, p2) {
6941
+ const coeff = new Uint8Array(p1.length + p2.length - 1)
6942
+
6943
+ for (let i = 0; i < p1.length; i++) {
6944
+ for (let j = 0; j < p2.length; j++) {
6945
+ coeff[i + j] ^= GF.mul(p1[i], p2[j])
6946
+ }
6947
+ }
6948
+
6949
+ return coeff
6950
+ }
6951
+
6952
+ /**
6953
+ * Calculate the remainder of polynomials division
6954
+ *
6955
+ * @param {Uint8Array} divident Polynomial
6956
+ * @param {Uint8Array} divisor Polynomial
6957
+ * @return {Uint8Array} Remainder
6958
+ */
6959
+ exports.mod = function mod (divident, divisor) {
6960
+ let result = new Uint8Array(divident)
6961
+
6962
+ while ((result.length - divisor.length) >= 0) {
6963
+ const coeff = result[0]
6964
+
6965
+ for (let i = 0; i < divisor.length; i++) {
6966
+ result[i] ^= GF.mul(divisor[i], coeff)
6967
+ }
6968
+
6969
+ // remove all zeros from buffer head
6970
+ let offset = 0
6971
+ while (offset < result.length && result[offset] === 0) offset++
6972
+ result = result.slice(offset)
6973
+ }
6974
+
6975
+ return result
6976
+ }
6977
+
6978
+ /**
6979
+ * Generate an irreducible generator polynomial of specified degree
6980
+ * (used by Reed-Solomon encoder)
6981
+ *
6982
+ * @param {Number} degree Degree of the generator polynomial
6983
+ * @return {Uint8Array} Buffer containing polynomial coefficients
6984
+ */
6985
+ exports.generateECPolynomial = function generateECPolynomial (degree) {
6986
+ let poly = new Uint8Array([1])
6987
+ for (let i = 0; i < degree; i++) {
6988
+ poly = exports.mul(poly, new Uint8Array([1, GF.exp(i)]))
6989
+ }
6990
+
6991
+ return poly
6992
+ }
6993
+
6994
+
6995
+ /***/ },
6996
+
6997
+ /***/ 4764
6998
+ (module, __unused_webpack_exports, __webpack_require__) {
6999
+
7000
+ const Polynomial = __webpack_require__(4713)
7001
+
7002
+ function ReedSolomonEncoder (degree) {
7003
+ this.genPoly = undefined
7004
+ this.degree = degree
7005
+
7006
+ if (this.degree) this.initialize(this.degree)
7007
+ }
7008
+
7009
+ /**
7010
+ * Initialize the encoder.
7011
+ * The input param should correspond to the number of error correction codewords.
7012
+ *
7013
+ * @param {Number} degree
7014
+ */
7015
+ ReedSolomonEncoder.prototype.initialize = function initialize (degree) {
7016
+ // create an irreducible generator polynomial
7017
+ this.degree = degree
7018
+ this.genPoly = Polynomial.generateECPolynomial(this.degree)
7019
+ }
7020
+
7021
+ /**
7022
+ * Encodes a chunk of data
7023
+ *
7024
+ * @param {Uint8Array} data Buffer containing input data
7025
+ * @return {Uint8Array} Buffer containing encoded data
7026
+ */
7027
+ ReedSolomonEncoder.prototype.encode = function encode (data) {
7028
+ if (!this.genPoly) {
7029
+ throw new Error('Encoder not initialized')
7030
+ }
7031
+
7032
+ // Calculate EC for this data block
7033
+ // extends data size to data+genPoly size
7034
+ const paddedData = new Uint8Array(data.length + this.degree)
7035
+ paddedData.set(data)
7036
+
7037
+ // The error correction codewords are the remainder after dividing the data codewords
7038
+ // by a generator polynomial
7039
+ const remainder = Polynomial.mod(paddedData, this.genPoly)
7040
+
7041
+ // return EC data blocks (last n byte, where n is the degree of genPoly)
7042
+ // If coefficients number in remainder are less than genPoly degree,
7043
+ // pad with 0s to the left to reach the needed number of coefficients
7044
+ const start = this.degree - remainder.length
7045
+ if (start > 0) {
7046
+ const buff = new Uint8Array(this.degree)
7047
+ buff.set(remainder, start)
7048
+
7049
+ return buff
7050
+ }
7051
+
7052
+ return remainder
7053
+ }
7054
+
7055
+ module.exports = ReedSolomonEncoder
7056
+
7057
+
5551
7058
  /***/ },
5552
7059
 
5553
7060
  /***/ 4782
@@ -5696,6 +7203,67 @@ module.exports = {
5696
7203
  };
5697
7204
 
5698
7205
 
7206
+ /***/ },
7207
+
7208
+ /***/ 4861
7209
+ (module, __unused_webpack_exports, __webpack_require__) {
7210
+
7211
+ const Mode = __webpack_require__(208)
7212
+ const Utils = __webpack_require__(6886)
7213
+
7214
+ function KanjiData (data) {
7215
+ this.mode = Mode.KANJI
7216
+ this.data = data
7217
+ }
7218
+
7219
+ KanjiData.getBitsLength = function getBitsLength (length) {
7220
+ return length * 13
7221
+ }
7222
+
7223
+ KanjiData.prototype.getLength = function getLength () {
7224
+ return this.data.length
7225
+ }
7226
+
7227
+ KanjiData.prototype.getBitsLength = function getBitsLength () {
7228
+ return KanjiData.getBitsLength(this.data.length)
7229
+ }
7230
+
7231
+ KanjiData.prototype.write = function (bitBuffer) {
7232
+ let i
7233
+
7234
+ // In the Shift JIS system, Kanji characters are represented by a two byte combination.
7235
+ // These byte values are shifted from the JIS X 0208 values.
7236
+ // JIS X 0208 gives details of the shift coded representation.
7237
+ for (i = 0; i < this.data.length; i++) {
7238
+ let value = Utils.toSJIS(this.data[i])
7239
+
7240
+ // For characters with Shift JIS values from 0x8140 to 0x9FFC:
7241
+ if (value >= 0x8140 && value <= 0x9FFC) {
7242
+ // Subtract 0x8140 from Shift JIS value
7243
+ value -= 0x8140
7244
+
7245
+ // For characters with Shift JIS values from 0xE040 to 0xEBBF
7246
+ } else if (value >= 0xE040 && value <= 0xEBBF) {
7247
+ // Subtract 0xC140 from Shift JIS value
7248
+ value -= 0xC140
7249
+ } else {
7250
+ throw new Error(
7251
+ 'Invalid SJIS character: ' + this.data[i] + '\n' +
7252
+ 'Make sure your charset is UTF-8')
7253
+ }
7254
+
7255
+ // Multiply most significant byte of result by 0xC0
7256
+ // and add least significant byte to product
7257
+ value = (((value >>> 8) & 0xff) * 0xC0) + (value & 0xff)
7258
+
7259
+ // Convert result to a 13-bit binary string
7260
+ bitBuffer.put(value, 13)
7261
+ }
7262
+ }
7263
+
7264
+ module.exports = KanjiData
7265
+
7266
+
5699
7267
  /***/ },
5700
7268
 
5701
7269
  /***/ 4864
@@ -6124,6 +7692,82 @@ $({ target: 'Array', proto: true, forced: !STRICT_METHOD }, {
6124
7692
  });
6125
7693
 
6126
7694
 
7695
+ /***/ },
7696
+
7697
+ /***/ 5112
7698
+ (__unused_webpack_module, exports) {
7699
+
7700
+ const EXP_TABLE = new Uint8Array(512)
7701
+ const LOG_TABLE = new Uint8Array(256)
7702
+ /**
7703
+ * Precompute the log and anti-log tables for faster computation later
7704
+ *
7705
+ * For each possible value in the galois field 2^8, we will pre-compute
7706
+ * the logarithm and anti-logarithm (exponential) of this value
7707
+ *
7708
+ * ref {@link https://en.wikiversity.org/wiki/Reed%E2%80%93Solomon_codes_for_coders#Introduction_to_mathematical_fields}
7709
+ */
7710
+ ;(function initTables () {
7711
+ let x = 1
7712
+ for (let i = 0; i < 255; i++) {
7713
+ EXP_TABLE[i] = x
7714
+ LOG_TABLE[x] = i
7715
+
7716
+ x <<= 1 // multiply by 2
7717
+
7718
+ // The QR code specification says to use byte-wise modulo 100011101 arithmetic.
7719
+ // This means that when a number is 256 or larger, it should be XORed with 0x11D.
7720
+ if (x & 0x100) { // similar to x >= 256, but a lot faster (because 0x100 == 256)
7721
+ x ^= 0x11D
7722
+ }
7723
+ }
7724
+
7725
+ // Optimization: double the size of the anti-log table so that we don't need to mod 255 to
7726
+ // stay inside the bounds (because we will mainly use this table for the multiplication of
7727
+ // two GF numbers, no more).
7728
+ // @see {@link mul}
7729
+ for (let i = 255; i < 512; i++) {
7730
+ EXP_TABLE[i] = EXP_TABLE[i - 255]
7731
+ }
7732
+ }())
7733
+
7734
+ /**
7735
+ * Returns log value of n inside Galois Field
7736
+ *
7737
+ * @param {Number} n
7738
+ * @return {Number}
7739
+ */
7740
+ exports.log = function log (n) {
7741
+ if (n < 1) throw new Error('log(' + n + ')')
7742
+ return LOG_TABLE[n]
7743
+ }
7744
+
7745
+ /**
7746
+ * Returns anti-log value of n inside Galois Field
7747
+ *
7748
+ * @param {Number} n
7749
+ * @return {Number}
7750
+ */
7751
+ exports.exp = function exp (n) {
7752
+ return EXP_TABLE[n]
7753
+ }
7754
+
7755
+ /**
7756
+ * Multiplies two number inside Galois Field
7757
+ *
7758
+ * @param {Number} x
7759
+ * @param {Number} y
7760
+ * @return {Number}
7761
+ */
7762
+ exports.mul = function mul (x, y) {
7763
+ if (x === 0 || y === 0) return 0
7764
+
7765
+ // should be EXP_TABLE[(LOG_TABLE[x] + LOG_TABLE[y]) % 255] if EXP_TABLE wasn't oversized
7766
+ // @see {@link initTables}
7767
+ return EXP_TABLE[LOG_TABLE[x] + LOG_TABLE[y]]
7768
+ }
7769
+
7770
+
6127
7771
  /***/ },
6128
7772
 
6129
7773
  /***/ 5155
@@ -7102,6 +8746,43 @@ module.exports = function isRawJSON(O) {
7102
8746
  };
7103
8747
 
7104
8748
 
8749
+ /***/ },
8750
+
8751
+ /***/ 5822
8752
+ (module, __unused_webpack_exports, __webpack_require__) {
8753
+
8754
+ const Mode = __webpack_require__(208)
8755
+
8756
+ function ByteData (data) {
8757
+ this.mode = Mode.BYTE
8758
+ if (typeof (data) === 'string') {
8759
+ this.data = new TextEncoder().encode(data)
8760
+ } else {
8761
+ this.data = new Uint8Array(data)
8762
+ }
8763
+ }
8764
+
8765
+ ByteData.getBitsLength = function getBitsLength (length) {
8766
+ return length * 8
8767
+ }
8768
+
8769
+ ByteData.prototype.getLength = function getLength () {
8770
+ return this.data.length
8771
+ }
8772
+
8773
+ ByteData.prototype.getBitsLength = function getBitsLength () {
8774
+ return ByteData.getBitsLength(this.data.length)
8775
+ }
8776
+
8777
+ ByteData.prototype.write = function (bitBuffer) {
8778
+ for (let i = 0, l = this.data.length; i < l; i++) {
8779
+ bitBuffer.put(this.data[i], 8)
8780
+ }
8781
+ }
8782
+
8783
+ module.exports = ByteData
8784
+
8785
+
7105
8786
  /***/ },
7106
8787
 
7107
8788
  /***/ 5876
@@ -7466,6 +9147,179 @@ module.exports = function (iterator, fn, value, ENTRIES) {
7466
9147
  };
7467
9148
 
7468
9149
 
9150
+ /***/ },
9151
+
9152
+ /***/ 6320
9153
+ (module) {
9154
+
9155
+ "use strict";
9156
+
9157
+
9158
+ /******************************************************************************
9159
+ * Created 2008-08-19.
9160
+ *
9161
+ * Dijkstra path-finding functions. Adapted from the Dijkstar Python project.
9162
+ *
9163
+ * Copyright (C) 2008
9164
+ * Wyatt Baldwin <self@wyattbaldwin.com>
9165
+ * All rights reserved
9166
+ *
9167
+ * Licensed under the MIT license.
9168
+ *
9169
+ * http://www.opensource.org/licenses/mit-license.php
9170
+ *
9171
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
9172
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
9173
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
9174
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
9175
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
9176
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
9177
+ * THE SOFTWARE.
9178
+ *****************************************************************************/
9179
+ var dijkstra = {
9180
+ single_source_shortest_paths: function(graph, s, d) {
9181
+ // Predecessor map for each node that has been encountered.
9182
+ // node ID => predecessor node ID
9183
+ var predecessors = {};
9184
+
9185
+ // Costs of shortest paths from s to all nodes encountered.
9186
+ // node ID => cost
9187
+ var costs = {};
9188
+ costs[s] = 0;
9189
+
9190
+ // Costs of shortest paths from s to all nodes encountered; differs from
9191
+ // `costs` in that it provides easy access to the node that currently has
9192
+ // the known shortest path from s.
9193
+ // XXX: Do we actually need both `costs` and `open`?
9194
+ var open = dijkstra.PriorityQueue.make();
9195
+ open.push(s, 0);
9196
+
9197
+ var closest,
9198
+ u, v,
9199
+ cost_of_s_to_u,
9200
+ adjacent_nodes,
9201
+ cost_of_e,
9202
+ cost_of_s_to_u_plus_cost_of_e,
9203
+ cost_of_s_to_v,
9204
+ first_visit;
9205
+ while (!open.empty()) {
9206
+ // In the nodes remaining in graph that have a known cost from s,
9207
+ // find the node, u, that currently has the shortest path from s.
9208
+ closest = open.pop();
9209
+ u = closest.value;
9210
+ cost_of_s_to_u = closest.cost;
9211
+
9212
+ // Get nodes adjacent to u...
9213
+ adjacent_nodes = graph[u] || {};
9214
+
9215
+ // ...and explore the edges that connect u to those nodes, updating
9216
+ // the cost of the shortest paths to any or all of those nodes as
9217
+ // necessary. v is the node across the current edge from u.
9218
+ for (v in adjacent_nodes) {
9219
+ if (adjacent_nodes.hasOwnProperty(v)) {
9220
+ // Get the cost of the edge running from u to v.
9221
+ cost_of_e = adjacent_nodes[v];
9222
+
9223
+ // Cost of s to u plus the cost of u to v across e--this is *a*
9224
+ // cost from s to v that may or may not be less than the current
9225
+ // known cost to v.
9226
+ cost_of_s_to_u_plus_cost_of_e = cost_of_s_to_u + cost_of_e;
9227
+
9228
+ // If we haven't visited v yet OR if the current known cost from s to
9229
+ // v is greater than the new cost we just found (cost of s to u plus
9230
+ // cost of u to v across e), update v's cost in the cost list and
9231
+ // update v's predecessor in the predecessor list (it's now u).
9232
+ cost_of_s_to_v = costs[v];
9233
+ first_visit = (typeof costs[v] === 'undefined');
9234
+ if (first_visit || cost_of_s_to_v > cost_of_s_to_u_plus_cost_of_e) {
9235
+ costs[v] = cost_of_s_to_u_plus_cost_of_e;
9236
+ open.push(v, cost_of_s_to_u_plus_cost_of_e);
9237
+ predecessors[v] = u;
9238
+ }
9239
+ }
9240
+ }
9241
+ }
9242
+
9243
+ if (typeof d !== 'undefined' && typeof costs[d] === 'undefined') {
9244
+ var msg = ['Could not find a path from ', s, ' to ', d, '.'].join('');
9245
+ throw new Error(msg);
9246
+ }
9247
+
9248
+ return predecessors;
9249
+ },
9250
+
9251
+ extract_shortest_path_from_predecessor_list: function(predecessors, d) {
9252
+ var nodes = [];
9253
+ var u = d;
9254
+ var predecessor;
9255
+ while (u) {
9256
+ nodes.push(u);
9257
+ predecessor = predecessors[u];
9258
+ u = predecessors[u];
9259
+ }
9260
+ nodes.reverse();
9261
+ return nodes;
9262
+ },
9263
+
9264
+ find_path: function(graph, s, d) {
9265
+ var predecessors = dijkstra.single_source_shortest_paths(graph, s, d);
9266
+ return dijkstra.extract_shortest_path_from_predecessor_list(
9267
+ predecessors, d);
9268
+ },
9269
+
9270
+ /**
9271
+ * A very naive priority queue implementation.
9272
+ */
9273
+ PriorityQueue: {
9274
+ make: function (opts) {
9275
+ var T = dijkstra.PriorityQueue,
9276
+ t = {},
9277
+ key;
9278
+ opts = opts || {};
9279
+ for (key in T) {
9280
+ if (T.hasOwnProperty(key)) {
9281
+ t[key] = T[key];
9282
+ }
9283
+ }
9284
+ t.queue = [];
9285
+ t.sorter = opts.sorter || T.default_sorter;
9286
+ return t;
9287
+ },
9288
+
9289
+ default_sorter: function (a, b) {
9290
+ return a.cost - b.cost;
9291
+ },
9292
+
9293
+ /**
9294
+ * Add a new item to the queue and ensure the highest priority element
9295
+ * is at the front of the queue.
9296
+ */
9297
+ push: function (value, cost) {
9298
+ var item = {value: value, cost: cost};
9299
+ this.queue.push(item);
9300
+ this.queue.sort(this.sorter);
9301
+ },
9302
+
9303
+ /**
9304
+ * Return the highest priority element in the queue.
9305
+ */
9306
+ pop: function () {
9307
+ return this.queue.shift();
9308
+ },
9309
+
9310
+ empty: function () {
9311
+ return this.queue.length === 0;
9312
+ }
9313
+ }
9314
+ };
9315
+
9316
+
9317
+ // node.js module exports
9318
+ if (true) {
9319
+ module.exports = dijkstra;
9320
+ }
9321
+
9322
+
7469
9323
  /***/ },
7470
9324
 
7471
9325
  /***/ 6395
@@ -7476,6 +9330,96 @@ module.exports = function (iterator, fn, value, ENTRIES) {
7476
9330
  module.exports = false;
7477
9331
 
7478
9332
 
9333
+ /***/ },
9334
+
9335
+ /***/ 6421
9336
+ (__unused_webpack_module, exports, __webpack_require__) {
9337
+
9338
+ /**
9339
+ * Alignment pattern are fixed reference pattern in defined positions
9340
+ * in a matrix symbology, which enables the decode software to re-synchronise
9341
+ * the coordinate mapping of the image modules in the event of moderate amounts
9342
+ * of distortion of the image.
9343
+ *
9344
+ * Alignment patterns are present only in QR Code symbols of version 2 or larger
9345
+ * and their number depends on the symbol version.
9346
+ */
9347
+
9348
+ const getSymbolSize = (__webpack_require__(6886).getSymbolSize)
9349
+
9350
+ /**
9351
+ * Calculate the row/column coordinates of the center module of each alignment pattern
9352
+ * for the specified QR Code version.
9353
+ *
9354
+ * The alignment patterns are positioned symmetrically on either side of the diagonal
9355
+ * running from the top left corner of the symbol to the bottom right corner.
9356
+ *
9357
+ * Since positions are simmetrical only half of the coordinates are returned.
9358
+ * Each item of the array will represent in turn the x and y coordinate.
9359
+ * @see {@link getPositions}
9360
+ *
9361
+ * @param {Number} version QR Code version
9362
+ * @return {Array} Array of coordinate
9363
+ */
9364
+ exports.getRowColCoords = function getRowColCoords (version) {
9365
+ if (version === 1) return []
9366
+
9367
+ const posCount = Math.floor(version / 7) + 2
9368
+ const size = getSymbolSize(version)
9369
+ const intervals = size === 145 ? 26 : Math.ceil((size - 13) / (2 * posCount - 2)) * 2
9370
+ const positions = [size - 7] // Last coord is always (size - 7)
9371
+
9372
+ for (let i = 1; i < posCount - 1; i++) {
9373
+ positions[i] = positions[i - 1] - intervals
9374
+ }
9375
+
9376
+ positions.push(6) // First coord is always 6
9377
+
9378
+ return positions.reverse()
9379
+ }
9380
+
9381
+ /**
9382
+ * Returns an array containing the positions of each alignment pattern.
9383
+ * Each array's element represent the center point of the pattern as (x, y) coordinates
9384
+ *
9385
+ * Coordinates are calculated expanding the row/column coordinates returned by {@link getRowColCoords}
9386
+ * and filtering out the items that overlaps with finder pattern
9387
+ *
9388
+ * @example
9389
+ * For a Version 7 symbol {@link getRowColCoords} returns values 6, 22 and 38.
9390
+ * The alignment patterns, therefore, are to be centered on (row, column)
9391
+ * positions (6,22), (22,6), (22,22), (22,38), (38,22), (38,38).
9392
+ * Note that the coordinates (6,6), (6,38), (38,6) are occupied by finder patterns
9393
+ * and are not therefore used for alignment patterns.
9394
+ *
9395
+ * let pos = getPositions(7)
9396
+ * // [[6,22], [22,6], [22,22], [22,38], [38,22], [38,38]]
9397
+ *
9398
+ * @param {Number} version QR Code version
9399
+ * @return {Array} Array of coordinates
9400
+ */
9401
+ exports.getPositions = function getPositions (version) {
9402
+ const coords = []
9403
+ const pos = exports.getRowColCoords(version)
9404
+ const posLength = pos.length
9405
+
9406
+ for (let i = 0; i < posLength; i++) {
9407
+ for (let j = 0; j < posLength; j++) {
9408
+ // Skip if position is occupied by finder patterns
9409
+ if ((i === 0 && j === 0) || // top-left
9410
+ (i === 0 && j === posLength - 1) || // bottom-left
9411
+ (i === posLength - 1 && j === 0)) { // top-right
9412
+ continue
9413
+ }
9414
+
9415
+ coords.push([pos[i], pos[j]])
9416
+ }
9417
+ }
9418
+
9419
+ return coords
9420
+ }
9421
+
9422
+
7479
9423
  /***/ },
7480
9424
 
7481
9425
  /***/ 6468
@@ -7795,6 +9739,94 @@ module.exports = function (object, key, method) {
7795
9739
  };
7796
9740
 
7797
9741
 
9742
+ /***/ },
9743
+
9744
+ /***/ 6756
9745
+ (__unused_webpack_module, exports, __webpack_require__) {
9746
+
9747
+ const Utils = __webpack_require__(2726)
9748
+
9749
+ function getColorAttrib (color, attrib) {
9750
+ const alpha = color.a / 255
9751
+ const str = attrib + '="' + color.hex + '"'
9752
+
9753
+ return alpha < 1
9754
+ ? str + ' ' + attrib + '-opacity="' + alpha.toFixed(2).slice(1) + '"'
9755
+ : str
9756
+ }
9757
+
9758
+ function svgCmd (cmd, x, y) {
9759
+ let str = cmd + x
9760
+ if (typeof y !== 'undefined') str += ' ' + y
9761
+
9762
+ return str
9763
+ }
9764
+
9765
+ function qrToPath (data, size, margin) {
9766
+ let path = ''
9767
+ let moveBy = 0
9768
+ let newRow = false
9769
+ let lineLength = 0
9770
+
9771
+ for (let i = 0; i < data.length; i++) {
9772
+ const col = Math.floor(i % size)
9773
+ const row = Math.floor(i / size)
9774
+
9775
+ if (!col && !newRow) newRow = true
9776
+
9777
+ if (data[i]) {
9778
+ lineLength++
9779
+
9780
+ if (!(i > 0 && col > 0 && data[i - 1])) {
9781
+ path += newRow
9782
+ ? svgCmd('M', col + margin, 0.5 + row + margin)
9783
+ : svgCmd('m', moveBy, 0)
9784
+
9785
+ moveBy = 0
9786
+ newRow = false
9787
+ }
9788
+
9789
+ if (!(col + 1 < size && data[i + 1])) {
9790
+ path += svgCmd('h', lineLength)
9791
+ lineLength = 0
9792
+ }
9793
+ } else {
9794
+ moveBy++
9795
+ }
9796
+ }
9797
+
9798
+ return path
9799
+ }
9800
+
9801
+ exports.render = function render (qrData, options, cb) {
9802
+ const opts = Utils.getOptions(options)
9803
+ const size = qrData.modules.size
9804
+ const data = qrData.modules.data
9805
+ const qrcodesize = size + opts.margin * 2
9806
+
9807
+ const bg = !opts.color.light.a
9808
+ ? ''
9809
+ : '<path ' + getColorAttrib(opts.color.light, 'fill') +
9810
+ ' d="M0 0h' + qrcodesize + 'v' + qrcodesize + 'H0z"/>'
9811
+
9812
+ const path =
9813
+ '<path ' + getColorAttrib(opts.color.dark, 'stroke') +
9814
+ ' d="' + qrToPath(data, size, opts.margin) + '"/>'
9815
+
9816
+ const viewBox = 'viewBox="' + '0 0 ' + qrcodesize + ' ' + qrcodesize + '"'
9817
+
9818
+ const width = !opts.width ? '' : 'width="' + opts.width + '" height="' + opts.width + '" '
9819
+
9820
+ const svgTag = '<svg xmlns="http://www.w3.org/2000/svg" ' + width + viewBox + ' shape-rendering="crispEdges">' + bg + path + '</svg>\n'
9821
+
9822
+ if (typeof cb === 'function') {
9823
+ cb(null, svgTag)
9824
+ }
9825
+
9826
+ return svgTag
9827
+ }
9828
+
9829
+
7798
9830
  /***/ },
7799
9831
 
7800
9832
  /***/ 6761
@@ -8165,6 +10197,76 @@ module.exports = function (O, key, value, options) {
8165
10197
  };
8166
10198
 
8167
10199
 
10200
+ /***/ },
10201
+
10202
+ /***/ 6886
10203
+ (__unused_webpack_module, exports) {
10204
+
10205
+ let toSJISFunction
10206
+ const CODEWORDS_COUNT = [
10207
+ 0, // Not used
10208
+ 26, 44, 70, 100, 134, 172, 196, 242, 292, 346,
10209
+ 404, 466, 532, 581, 655, 733, 815, 901, 991, 1085,
10210
+ 1156, 1258, 1364, 1474, 1588, 1706, 1828, 1921, 2051, 2185,
10211
+ 2323, 2465, 2611, 2761, 2876, 3034, 3196, 3362, 3532, 3706
10212
+ ]
10213
+
10214
+ /**
10215
+ * Returns the QR Code size for the specified version
10216
+ *
10217
+ * @param {Number} version QR Code version
10218
+ * @return {Number} size of QR code
10219
+ */
10220
+ exports.getSymbolSize = function getSymbolSize (version) {
10221
+ if (!version) throw new Error('"version" cannot be null or undefined')
10222
+ if (version < 1 || version > 40) throw new Error('"version" should be in range from 1 to 40')
10223
+ return version * 4 + 17
10224
+ }
10225
+
10226
+ /**
10227
+ * Returns the total number of codewords used to store data and EC information.
10228
+ *
10229
+ * @param {Number} version QR Code version
10230
+ * @return {Number} Data length in bits
10231
+ */
10232
+ exports.getSymbolTotalCodewords = function getSymbolTotalCodewords (version) {
10233
+ return CODEWORDS_COUNT[version]
10234
+ }
10235
+
10236
+ /**
10237
+ * Encode data with Bose-Chaudhuri-Hocquenghem
10238
+ *
10239
+ * @param {Number} data Value to encode
10240
+ * @return {Number} Encoded value
10241
+ */
10242
+ exports.getBCHDigit = function (data) {
10243
+ let digit = 0
10244
+
10245
+ while (data !== 0) {
10246
+ digit++
10247
+ data >>>= 1
10248
+ }
10249
+
10250
+ return digit
10251
+ }
10252
+
10253
+ exports.setToSJISFunction = function setToSJISFunction (f) {
10254
+ if (typeof f !== 'function') {
10255
+ throw new Error('"toSJISFunc" is not a valid function.')
10256
+ }
10257
+
10258
+ toSJISFunction = f
10259
+ }
10260
+
10261
+ exports.isKanjiModeEnabled = function () {
10262
+ return typeof toSJISFunction !== 'undefined'
10263
+ }
10264
+
10265
+ exports.toSJIS = function toSJIS (kanji) {
10266
+ return toSJISFunction(kanji)
10267
+ }
10268
+
10269
+
8168
10270
  /***/ },
8169
10271
 
8170
10272
  /***/ 6918
@@ -8659,6 +10761,44 @@ module.exports = NATIVE_SYMBOL &&
8659
10761
  typeof Symbol.iterator == 'symbol';
8660
10762
 
8661
10763
 
10764
+ /***/ },
10765
+
10766
+ /***/ 7044
10767
+ (__unused_webpack_module, exports) {
10768
+
10769
+ const numeric = '[0-9]+'
10770
+ const alphanumeric = '[A-Z $%*+\\-./:]+'
10771
+ let kanji = '(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|' +
10772
+ '[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|' +
10773
+ '[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|' +
10774
+ '[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+'
10775
+ kanji = kanji.replace(/u/g, '\\u')
10776
+
10777
+ const byte = '(?:(?![A-Z0-9 $%*+\\-./:]|' + kanji + ')(?:.|[\r\n]))+'
10778
+
10779
+ exports.KANJI = new RegExp(kanji, 'g')
10780
+ exports.BYTE_KANJI = new RegExp('[^A-Z0-9 $%*+\\-./:]+', 'g')
10781
+ exports.BYTE = new RegExp(byte, 'g')
10782
+ exports.NUMERIC = new RegExp(numeric, 'g')
10783
+ exports.ALPHANUMERIC = new RegExp(alphanumeric, 'g')
10784
+
10785
+ const TEST_KANJI = new RegExp('^' + kanji + '$')
10786
+ const TEST_NUMERIC = new RegExp('^' + numeric + '$')
10787
+ const TEST_ALPHANUMERIC = new RegExp('^[A-Z0-9 $%*+\\-./:]+$')
10788
+
10789
+ exports.testKanji = function testKanji (str) {
10790
+ return TEST_KANJI.test(str)
10791
+ }
10792
+
10793
+ exports.testNumeric = function testNumeric (str) {
10794
+ return TEST_NUMERIC.test(str)
10795
+ }
10796
+
10797
+ exports.testAlphanumeric = function testAlphanumeric (str) {
10798
+ return TEST_ALPHANUMERIC.test(str)
10799
+ }
10800
+
10801
+
8662
10802
  /***/ },
8663
10803
 
8664
10804
  /***/ 7055
@@ -9022,6 +11162,148 @@ $({ target: 'RegExp', proto: true, forced: /./.exec !== exec }, {
9022
11162
  });
9023
11163
 
9024
11164
 
11165
+ /***/ },
11166
+
11167
+ /***/ 7518
11168
+ (__unused_webpack_module, exports, __webpack_require__) {
11169
+
11170
+ const ECLevel = __webpack_require__(9953)
11171
+
11172
+ const EC_BLOCKS_TABLE = [
11173
+ // L M Q H
11174
+ 1, 1, 1, 1,
11175
+ 1, 1, 1, 1,
11176
+ 1, 1, 2, 2,
11177
+ 1, 2, 2, 4,
11178
+ 1, 2, 4, 4,
11179
+ 2, 4, 4, 4,
11180
+ 2, 4, 6, 5,
11181
+ 2, 4, 6, 6,
11182
+ 2, 5, 8, 8,
11183
+ 4, 5, 8, 8,
11184
+ 4, 5, 8, 11,
11185
+ 4, 8, 10, 11,
11186
+ 4, 9, 12, 16,
11187
+ 4, 9, 16, 16,
11188
+ 6, 10, 12, 18,
11189
+ 6, 10, 17, 16,
11190
+ 6, 11, 16, 19,
11191
+ 6, 13, 18, 21,
11192
+ 7, 14, 21, 25,
11193
+ 8, 16, 20, 25,
11194
+ 8, 17, 23, 25,
11195
+ 9, 17, 23, 34,
11196
+ 9, 18, 25, 30,
11197
+ 10, 20, 27, 32,
11198
+ 12, 21, 29, 35,
11199
+ 12, 23, 34, 37,
11200
+ 12, 25, 34, 40,
11201
+ 13, 26, 35, 42,
11202
+ 14, 28, 38, 45,
11203
+ 15, 29, 40, 48,
11204
+ 16, 31, 43, 51,
11205
+ 17, 33, 45, 54,
11206
+ 18, 35, 48, 57,
11207
+ 19, 37, 51, 60,
11208
+ 19, 38, 53, 63,
11209
+ 20, 40, 56, 66,
11210
+ 21, 43, 59, 70,
11211
+ 22, 45, 62, 74,
11212
+ 24, 47, 65, 77,
11213
+ 25, 49, 68, 81
11214
+ ]
11215
+
11216
+ const EC_CODEWORDS_TABLE = [
11217
+ // L M Q H
11218
+ 7, 10, 13, 17,
11219
+ 10, 16, 22, 28,
11220
+ 15, 26, 36, 44,
11221
+ 20, 36, 52, 64,
11222
+ 26, 48, 72, 88,
11223
+ 36, 64, 96, 112,
11224
+ 40, 72, 108, 130,
11225
+ 48, 88, 132, 156,
11226
+ 60, 110, 160, 192,
11227
+ 72, 130, 192, 224,
11228
+ 80, 150, 224, 264,
11229
+ 96, 176, 260, 308,
11230
+ 104, 198, 288, 352,
11231
+ 120, 216, 320, 384,
11232
+ 132, 240, 360, 432,
11233
+ 144, 280, 408, 480,
11234
+ 168, 308, 448, 532,
11235
+ 180, 338, 504, 588,
11236
+ 196, 364, 546, 650,
11237
+ 224, 416, 600, 700,
11238
+ 224, 442, 644, 750,
11239
+ 252, 476, 690, 816,
11240
+ 270, 504, 750, 900,
11241
+ 300, 560, 810, 960,
11242
+ 312, 588, 870, 1050,
11243
+ 336, 644, 952, 1110,
11244
+ 360, 700, 1020, 1200,
11245
+ 390, 728, 1050, 1260,
11246
+ 420, 784, 1140, 1350,
11247
+ 450, 812, 1200, 1440,
11248
+ 480, 868, 1290, 1530,
11249
+ 510, 924, 1350, 1620,
11250
+ 540, 980, 1440, 1710,
11251
+ 570, 1036, 1530, 1800,
11252
+ 570, 1064, 1590, 1890,
11253
+ 600, 1120, 1680, 1980,
11254
+ 630, 1204, 1770, 2100,
11255
+ 660, 1260, 1860, 2220,
11256
+ 720, 1316, 1950, 2310,
11257
+ 750, 1372, 2040, 2430
11258
+ ]
11259
+
11260
+ /**
11261
+ * Returns the number of error correction block that the QR Code should contain
11262
+ * for the specified version and error correction level.
11263
+ *
11264
+ * @param {Number} version QR Code version
11265
+ * @param {Number} errorCorrectionLevel Error correction level
11266
+ * @return {Number} Number of error correction blocks
11267
+ */
11268
+ exports.getBlocksCount = function getBlocksCount (version, errorCorrectionLevel) {
11269
+ switch (errorCorrectionLevel) {
11270
+ case ECLevel.L:
11271
+ return EC_BLOCKS_TABLE[(version - 1) * 4 + 0]
11272
+ case ECLevel.M:
11273
+ return EC_BLOCKS_TABLE[(version - 1) * 4 + 1]
11274
+ case ECLevel.Q:
11275
+ return EC_BLOCKS_TABLE[(version - 1) * 4 + 2]
11276
+ case ECLevel.H:
11277
+ return EC_BLOCKS_TABLE[(version - 1) * 4 + 3]
11278
+ default:
11279
+ return undefined
11280
+ }
11281
+ }
11282
+
11283
+ /**
11284
+ * Returns the number of error correction codewords to use for the specified
11285
+ * version and error correction level.
11286
+ *
11287
+ * @param {Number} version QR Code version
11288
+ * @param {Number} errorCorrectionLevel Error correction level
11289
+ * @return {Number} Number of error correction codewords
11290
+ */
11291
+ exports.getTotalCodewordsCount = function getTotalCodewordsCount (version, errorCorrectionLevel) {
11292
+ switch (errorCorrectionLevel) {
11293
+ case ECLevel.L:
11294
+ return EC_CODEWORDS_TABLE[(version - 1) * 4 + 0]
11295
+ case ECLevel.M:
11296
+ return EC_CODEWORDS_TABLE[(version - 1) * 4 + 1]
11297
+ case ECLevel.Q:
11298
+ return EC_CODEWORDS_TABLE[(version - 1) * 4 + 2]
11299
+ case ECLevel.H:
11300
+ return EC_CODEWORDS_TABLE[(version - 1) * 4 + 3]
11301
+ default:
11302
+ return undefined
11303
+ }
11304
+ }
11305
+
11306
+
9025
11307
  /***/ },
9026
11308
 
9027
11309
  /***/ 7522
@@ -9092,6 +11374,89 @@ module.exports = INCORRECT_TO_STRING ? function toString() {
9092
11374
  } : nativeErrorToString;
9093
11375
 
9094
11376
 
11377
+ /***/ },
11378
+
11379
+ /***/ 7583
11380
+ (__unused_webpack_module, exports, __webpack_require__) {
11381
+
11382
+
11383
+ const canPromise = __webpack_require__(1333)
11384
+
11385
+ const QRCode = __webpack_require__(157)
11386
+ const CanvasRenderer = __webpack_require__(7899)
11387
+ const SvgRenderer = __webpack_require__(6756)
11388
+
11389
+ function renderCanvas (renderFunc, canvas, text, opts, cb) {
11390
+ const args = [].slice.call(arguments, 1)
11391
+ const argsNum = args.length
11392
+ const isLastArgCb = typeof args[argsNum - 1] === 'function'
11393
+
11394
+ if (!isLastArgCb && !canPromise()) {
11395
+ throw new Error('Callback required as last argument')
11396
+ }
11397
+
11398
+ if (isLastArgCb) {
11399
+ if (argsNum < 2) {
11400
+ throw new Error('Too few arguments provided')
11401
+ }
11402
+
11403
+ if (argsNum === 2) {
11404
+ cb = text
11405
+ text = canvas
11406
+ canvas = opts = undefined
11407
+ } else if (argsNum === 3) {
11408
+ if (canvas.getContext && typeof cb === 'undefined') {
11409
+ cb = opts
11410
+ opts = undefined
11411
+ } else {
11412
+ cb = opts
11413
+ opts = text
11414
+ text = canvas
11415
+ canvas = undefined
11416
+ }
11417
+ }
11418
+ } else {
11419
+ if (argsNum < 1) {
11420
+ throw new Error('Too few arguments provided')
11421
+ }
11422
+
11423
+ if (argsNum === 1) {
11424
+ text = canvas
11425
+ canvas = opts = undefined
11426
+ } else if (argsNum === 2 && !canvas.getContext) {
11427
+ opts = text
11428
+ text = canvas
11429
+ canvas = undefined
11430
+ }
11431
+
11432
+ return new Promise(function (resolve, reject) {
11433
+ try {
11434
+ const data = QRCode.create(text, opts)
11435
+ resolve(renderFunc(data, canvas, opts))
11436
+ } catch (e) {
11437
+ reject(e)
11438
+ }
11439
+ })
11440
+ }
11441
+
11442
+ try {
11443
+ const data = QRCode.create(text, opts)
11444
+ cb(null, renderFunc(data, canvas, opts))
11445
+ } catch (e) {
11446
+ cb(e)
11447
+ }
11448
+ }
11449
+
11450
+ exports.create = QRCode.create
11451
+ exports.toCanvas = renderCanvas.bind(null, CanvasRenderer.render)
11452
+ exports.toDataURL = renderCanvas.bind(null, CanvasRenderer.renderToDataURL)
11453
+
11454
+ // only svg for now.
11455
+ exports.toString = renderCanvas.bind(null, function (data, _, opts) {
11456
+ return SvgRenderer.render(data, opts)
11457
+ })
11458
+
11459
+
9095
11460
  /***/ },
9096
11461
 
9097
11462
  /***/ 7584
@@ -9445,6 +11810,35 @@ module.exports = function (namespace, method) {
9445
11810
  };
9446
11811
 
9447
11812
 
11813
+ /***/ },
11814
+
11815
+ /***/ 7756
11816
+ (__unused_webpack_module, exports, __webpack_require__) {
11817
+
11818
+ const getSymbolSize = (__webpack_require__(6886).getSymbolSize)
11819
+ const FINDER_PATTERN_SIZE = 7
11820
+
11821
+ /**
11822
+ * Returns an array containing the positions of each finder pattern.
11823
+ * Each array's element represent the top-left point of the pattern as (x, y) coordinates
11824
+ *
11825
+ * @param {Number} version QR Code version
11826
+ * @return {Array} Array of coordinates
11827
+ */
11828
+ exports.getPositions = function getPositions (version) {
11829
+ const size = getSymbolSize(version)
11830
+
11831
+ return [
11832
+ // top-left
11833
+ [0, 0],
11834
+ // top-right
11835
+ [size - FINDER_PATTERN_SIZE, 0],
11836
+ // bottom-left
11837
+ [0, size - FINDER_PATTERN_SIZE]
11838
+ ]
11839
+ }
11840
+
11841
+
9448
11842
  /***/ },
9449
11843
 
9450
11844
  /***/ 7763
@@ -9583,6 +11977,76 @@ var userAgent = __webpack_require__(2839);
9583
11977
  module.exports = /web0s(?!.*chrome)/i.test(userAgent);
9584
11978
 
9585
11979
 
11980
+ /***/ },
11981
+
11982
+ /***/ 7899
11983
+ (__unused_webpack_module, exports, __webpack_require__) {
11984
+
11985
+ const Utils = __webpack_require__(2726)
11986
+
11987
+ function clearCanvas (ctx, canvas, size) {
11988
+ ctx.clearRect(0, 0, canvas.width, canvas.height)
11989
+
11990
+ if (!canvas.style) canvas.style = {}
11991
+ canvas.height = size
11992
+ canvas.width = size
11993
+ canvas.style.height = size + 'px'
11994
+ canvas.style.width = size + 'px'
11995
+ }
11996
+
11997
+ function getCanvasElement () {
11998
+ try {
11999
+ return document.createElement('canvas')
12000
+ } catch (e) {
12001
+ throw new Error('You need to specify a canvas element')
12002
+ }
12003
+ }
12004
+
12005
+ exports.render = function render (qrData, canvas, options) {
12006
+ let opts = options
12007
+ let canvasEl = canvas
12008
+
12009
+ if (typeof opts === 'undefined' && (!canvas || !canvas.getContext)) {
12010
+ opts = canvas
12011
+ canvas = undefined
12012
+ }
12013
+
12014
+ if (!canvas) {
12015
+ canvasEl = getCanvasElement()
12016
+ }
12017
+
12018
+ opts = Utils.getOptions(opts)
12019
+ const size = Utils.getImageWidth(qrData.modules.size, opts)
12020
+
12021
+ const ctx = canvasEl.getContext('2d')
12022
+ const image = ctx.createImageData(size, size)
12023
+ Utils.qrToImageData(image.data, qrData, opts)
12024
+
12025
+ clearCanvas(ctx, canvasEl, size)
12026
+ ctx.putImageData(image, 0, 0)
12027
+
12028
+ return canvasEl
12029
+ }
12030
+
12031
+ exports.renderToDataURL = function renderToDataURL (qrData, canvas, options) {
12032
+ let opts = options
12033
+
12034
+ if (typeof opts === 'undefined' && (!canvas || !canvas.getContext)) {
12035
+ opts = canvas
12036
+ canvas = undefined
12037
+ }
12038
+
12039
+ if (!opts) opts = {}
12040
+
12041
+ const canvasEl = exports.render(qrData, canvas, opts)
12042
+
12043
+ const type = opts.type || 'image/png'
12044
+ const rendererOpts = opts.rendererOpts || {}
12045
+
12046
+ return canvasEl.toDataURL(type, rendererOpts.quality)
12047
+ }
12048
+
12049
+
9586
12050
  /***/ },
9587
12051
 
9588
12052
  /***/ 7916
@@ -10706,6 +13170,78 @@ module.exports = fails(function () {
10706
13170
  });
10707
13171
 
10708
13172
 
13173
+ /***/ },
13174
+
13175
+ /***/ 8820
13176
+ (module) {
13177
+
13178
+ /**
13179
+ * Helper class to handle QR Code symbol modules
13180
+ *
13181
+ * @param {Number} size Symbol size
13182
+ */
13183
+ function BitMatrix (size) {
13184
+ if (!size || size < 1) {
13185
+ throw new Error('BitMatrix size must be defined and greater than 0')
13186
+ }
13187
+
13188
+ this.size = size
13189
+ this.data = new Uint8Array(size * size)
13190
+ this.reservedBit = new Uint8Array(size * size)
13191
+ }
13192
+
13193
+ /**
13194
+ * Set bit value at specified location
13195
+ * If reserved flag is set, this bit will be ignored during masking process
13196
+ *
13197
+ * @param {Number} row
13198
+ * @param {Number} col
13199
+ * @param {Boolean} value
13200
+ * @param {Boolean} reserved
13201
+ */
13202
+ BitMatrix.prototype.set = function (row, col, value, reserved) {
13203
+ const index = row * this.size + col
13204
+ this.data[index] = value
13205
+ if (reserved) this.reservedBit[index] = true
13206
+ }
13207
+
13208
+ /**
13209
+ * Returns bit value at specified location
13210
+ *
13211
+ * @param {Number} row
13212
+ * @param {Number} col
13213
+ * @return {Boolean}
13214
+ */
13215
+ BitMatrix.prototype.get = function (row, col) {
13216
+ return this.data[row * this.size + col]
13217
+ }
13218
+
13219
+ /**
13220
+ * Applies xor operator at specified location
13221
+ * (used during masking process)
13222
+ *
13223
+ * @param {Number} row
13224
+ * @param {Number} col
13225
+ * @param {Boolean} value
13226
+ */
13227
+ BitMatrix.prototype.xor = function (row, col, value) {
13228
+ this.data[row * this.size + col] ^= value
13229
+ }
13230
+
13231
+ /**
13232
+ * Check if bit at specified location is reserved
13233
+ *
13234
+ * @param {Number} row
13235
+ * @param {Number} col
13236
+ * @return {Boolean}
13237
+ */
13238
+ BitMatrix.prototype.isReserved = function (row, col) {
13239
+ return this.reservedBit[row * this.size + col]
13240
+ }
13241
+
13242
+ module.exports = BitMatrix
13243
+
13244
+
10709
13245
  /***/ },
10710
13246
 
10711
13247
  /***/ 8980
@@ -12453,6 +14989,343 @@ $({ target: 'Object', stat: true, forced: FORCED }, {
12453
14989
  });
12454
14990
 
12455
14991
 
14992
+ /***/ },
14993
+
14994
+ /***/ 9801
14995
+ (__unused_webpack_module, exports, __webpack_require__) {
14996
+
14997
+ const Mode = __webpack_require__(208)
14998
+ const NumericData = __webpack_require__(4357)
14999
+ const AlphanumericData = __webpack_require__(1433)
15000
+ const ByteData = __webpack_require__(5822)
15001
+ const KanjiData = __webpack_require__(4861)
15002
+ const Regex = __webpack_require__(7044)
15003
+ const Utils = __webpack_require__(6886)
15004
+ const dijkstra = __webpack_require__(6320)
15005
+
15006
+ /**
15007
+ * Returns UTF8 byte length
15008
+ *
15009
+ * @param {String} str Input string
15010
+ * @return {Number} Number of byte
15011
+ */
15012
+ function getStringByteLength (str) {
15013
+ return unescape(encodeURIComponent(str)).length
15014
+ }
15015
+
15016
+ /**
15017
+ * Get a list of segments of the specified mode
15018
+ * from a string
15019
+ *
15020
+ * @param {Mode} mode Segment mode
15021
+ * @param {String} str String to process
15022
+ * @return {Array} Array of object with segments data
15023
+ */
15024
+ function getSegments (regex, mode, str) {
15025
+ const segments = []
15026
+ let result
15027
+
15028
+ while ((result = regex.exec(str)) !== null) {
15029
+ segments.push({
15030
+ data: result[0],
15031
+ index: result.index,
15032
+ mode: mode,
15033
+ length: result[0].length
15034
+ })
15035
+ }
15036
+
15037
+ return segments
15038
+ }
15039
+
15040
+ /**
15041
+ * Extracts a series of segments with the appropriate
15042
+ * modes from a string
15043
+ *
15044
+ * @param {String} dataStr Input string
15045
+ * @return {Array} Array of object with segments data
15046
+ */
15047
+ function getSegmentsFromString (dataStr) {
15048
+ const numSegs = getSegments(Regex.NUMERIC, Mode.NUMERIC, dataStr)
15049
+ const alphaNumSegs = getSegments(Regex.ALPHANUMERIC, Mode.ALPHANUMERIC, dataStr)
15050
+ let byteSegs
15051
+ let kanjiSegs
15052
+
15053
+ if (Utils.isKanjiModeEnabled()) {
15054
+ byteSegs = getSegments(Regex.BYTE, Mode.BYTE, dataStr)
15055
+ kanjiSegs = getSegments(Regex.KANJI, Mode.KANJI, dataStr)
15056
+ } else {
15057
+ byteSegs = getSegments(Regex.BYTE_KANJI, Mode.BYTE, dataStr)
15058
+ kanjiSegs = []
15059
+ }
15060
+
15061
+ const segs = numSegs.concat(alphaNumSegs, byteSegs, kanjiSegs)
15062
+
15063
+ return segs
15064
+ .sort(function (s1, s2) {
15065
+ return s1.index - s2.index
15066
+ })
15067
+ .map(function (obj) {
15068
+ return {
15069
+ data: obj.data,
15070
+ mode: obj.mode,
15071
+ length: obj.length
15072
+ }
15073
+ })
15074
+ }
15075
+
15076
+ /**
15077
+ * Returns how many bits are needed to encode a string of
15078
+ * specified length with the specified mode
15079
+ *
15080
+ * @param {Number} length String length
15081
+ * @param {Mode} mode Segment mode
15082
+ * @return {Number} Bit length
15083
+ */
15084
+ function getSegmentBitsLength (length, mode) {
15085
+ switch (mode) {
15086
+ case Mode.NUMERIC:
15087
+ return NumericData.getBitsLength(length)
15088
+ case Mode.ALPHANUMERIC:
15089
+ return AlphanumericData.getBitsLength(length)
15090
+ case Mode.KANJI:
15091
+ return KanjiData.getBitsLength(length)
15092
+ case Mode.BYTE:
15093
+ return ByteData.getBitsLength(length)
15094
+ }
15095
+ }
15096
+
15097
+ /**
15098
+ * Merges adjacent segments which have the same mode
15099
+ *
15100
+ * @param {Array} segs Array of object with segments data
15101
+ * @return {Array} Array of object with segments data
15102
+ */
15103
+ function mergeSegments (segs) {
15104
+ return segs.reduce(function (acc, curr) {
15105
+ const prevSeg = acc.length - 1 >= 0 ? acc[acc.length - 1] : null
15106
+ if (prevSeg && prevSeg.mode === curr.mode) {
15107
+ acc[acc.length - 1].data += curr.data
15108
+ return acc
15109
+ }
15110
+
15111
+ acc.push(curr)
15112
+ return acc
15113
+ }, [])
15114
+ }
15115
+
15116
+ /**
15117
+ * Generates a list of all possible nodes combination which
15118
+ * will be used to build a segments graph.
15119
+ *
15120
+ * Nodes are divided by groups. Each group will contain a list of all the modes
15121
+ * in which is possible to encode the given text.
15122
+ *
15123
+ * For example the text '12345' can be encoded as Numeric, Alphanumeric or Byte.
15124
+ * The group for '12345' will contain then 3 objects, one for each
15125
+ * possible encoding mode.
15126
+ *
15127
+ * Each node represents a possible segment.
15128
+ *
15129
+ * @param {Array} segs Array of object with segments data
15130
+ * @return {Array} Array of object with segments data
15131
+ */
15132
+ function buildNodes (segs) {
15133
+ const nodes = []
15134
+ for (let i = 0; i < segs.length; i++) {
15135
+ const seg = segs[i]
15136
+
15137
+ switch (seg.mode) {
15138
+ case Mode.NUMERIC:
15139
+ nodes.push([seg,
15140
+ { data: seg.data, mode: Mode.ALPHANUMERIC, length: seg.length },
15141
+ { data: seg.data, mode: Mode.BYTE, length: seg.length }
15142
+ ])
15143
+ break
15144
+ case Mode.ALPHANUMERIC:
15145
+ nodes.push([seg,
15146
+ { data: seg.data, mode: Mode.BYTE, length: seg.length }
15147
+ ])
15148
+ break
15149
+ case Mode.KANJI:
15150
+ nodes.push([seg,
15151
+ { data: seg.data, mode: Mode.BYTE, length: getStringByteLength(seg.data) }
15152
+ ])
15153
+ break
15154
+ case Mode.BYTE:
15155
+ nodes.push([
15156
+ { data: seg.data, mode: Mode.BYTE, length: getStringByteLength(seg.data) }
15157
+ ])
15158
+ }
15159
+ }
15160
+
15161
+ return nodes
15162
+ }
15163
+
15164
+ /**
15165
+ * Builds a graph from a list of nodes.
15166
+ * All segments in each node group will be connected with all the segments of
15167
+ * the next group and so on.
15168
+ *
15169
+ * At each connection will be assigned a weight depending on the
15170
+ * segment's byte length.
15171
+ *
15172
+ * @param {Array} nodes Array of object with segments data
15173
+ * @param {Number} version QR Code version
15174
+ * @return {Object} Graph of all possible segments
15175
+ */
15176
+ function buildGraph (nodes, version) {
15177
+ const table = {}
15178
+ const graph = { start: {} }
15179
+ let prevNodeIds = ['start']
15180
+
15181
+ for (let i = 0; i < nodes.length; i++) {
15182
+ const nodeGroup = nodes[i]
15183
+ const currentNodeIds = []
15184
+
15185
+ for (let j = 0; j < nodeGroup.length; j++) {
15186
+ const node = nodeGroup[j]
15187
+ const key = '' + i + j
15188
+
15189
+ currentNodeIds.push(key)
15190
+ table[key] = { node: node, lastCount: 0 }
15191
+ graph[key] = {}
15192
+
15193
+ for (let n = 0; n < prevNodeIds.length; n++) {
15194
+ const prevNodeId = prevNodeIds[n]
15195
+
15196
+ if (table[prevNodeId] && table[prevNodeId].node.mode === node.mode) {
15197
+ graph[prevNodeId][key] =
15198
+ getSegmentBitsLength(table[prevNodeId].lastCount + node.length, node.mode) -
15199
+ getSegmentBitsLength(table[prevNodeId].lastCount, node.mode)
15200
+
15201
+ table[prevNodeId].lastCount += node.length
15202
+ } else {
15203
+ if (table[prevNodeId]) table[prevNodeId].lastCount = node.length
15204
+
15205
+ graph[prevNodeId][key] = getSegmentBitsLength(node.length, node.mode) +
15206
+ 4 + Mode.getCharCountIndicator(node.mode, version) // switch cost
15207
+ }
15208
+ }
15209
+ }
15210
+
15211
+ prevNodeIds = currentNodeIds
15212
+ }
15213
+
15214
+ for (let n = 0; n < prevNodeIds.length; n++) {
15215
+ graph[prevNodeIds[n]].end = 0
15216
+ }
15217
+
15218
+ return { map: graph, table: table }
15219
+ }
15220
+
15221
+ /**
15222
+ * Builds a segment from a specified data and mode.
15223
+ * If a mode is not specified, the more suitable will be used.
15224
+ *
15225
+ * @param {String} data Input data
15226
+ * @param {Mode | String} modesHint Data mode
15227
+ * @return {Segment} Segment
15228
+ */
15229
+ function buildSingleSegment (data, modesHint) {
15230
+ let mode
15231
+ const bestMode = Mode.getBestModeForData(data)
15232
+
15233
+ mode = Mode.from(modesHint, bestMode)
15234
+
15235
+ // Make sure data can be encoded
15236
+ if (mode !== Mode.BYTE && mode.bit < bestMode.bit) {
15237
+ throw new Error('"' + data + '"' +
15238
+ ' cannot be encoded with mode ' + Mode.toString(mode) +
15239
+ '.\n Suggested mode is: ' + Mode.toString(bestMode))
15240
+ }
15241
+
15242
+ // Use Mode.BYTE if Kanji support is disabled
15243
+ if (mode === Mode.KANJI && !Utils.isKanjiModeEnabled()) {
15244
+ mode = Mode.BYTE
15245
+ }
15246
+
15247
+ switch (mode) {
15248
+ case Mode.NUMERIC:
15249
+ return new NumericData(data)
15250
+
15251
+ case Mode.ALPHANUMERIC:
15252
+ return new AlphanumericData(data)
15253
+
15254
+ case Mode.KANJI:
15255
+ return new KanjiData(data)
15256
+
15257
+ case Mode.BYTE:
15258
+ return new ByteData(data)
15259
+ }
15260
+ }
15261
+
15262
+ /**
15263
+ * Builds a list of segments from an array.
15264
+ * Array can contain Strings or Objects with segment's info.
15265
+ *
15266
+ * For each item which is a string, will be generated a segment with the given
15267
+ * string and the more appropriate encoding mode.
15268
+ *
15269
+ * For each item which is an object, will be generated a segment with the given
15270
+ * data and mode.
15271
+ * Objects must contain at least the property "data".
15272
+ * If property "mode" is not present, the more suitable mode will be used.
15273
+ *
15274
+ * @param {Array} array Array of objects with segments data
15275
+ * @return {Array} Array of Segments
15276
+ */
15277
+ exports.fromArray = function fromArray (array) {
15278
+ return array.reduce(function (acc, seg) {
15279
+ if (typeof seg === 'string') {
15280
+ acc.push(buildSingleSegment(seg, null))
15281
+ } else if (seg.data) {
15282
+ acc.push(buildSingleSegment(seg.data, seg.mode))
15283
+ }
15284
+
15285
+ return acc
15286
+ }, [])
15287
+ }
15288
+
15289
+ /**
15290
+ * Builds an optimized sequence of segments from a string,
15291
+ * which will produce the shortest possible bitstream.
15292
+ *
15293
+ * @param {String} data Input string
15294
+ * @param {Number} version QR Code version
15295
+ * @return {Array} Array of segments
15296
+ */
15297
+ exports.fromString = function fromString (data, version) {
15298
+ const segs = getSegmentsFromString(data, Utils.isKanjiModeEnabled())
15299
+
15300
+ const nodes = buildNodes(segs)
15301
+ const graph = buildGraph(nodes, version)
15302
+ const path = dijkstra.find_path(graph.map, 'start', 'end')
15303
+
15304
+ const optimizedSegs = []
15305
+ for (let i = 1; i < path.length - 1; i++) {
15306
+ optimizedSegs.push(graph.table[path[i]].node)
15307
+ }
15308
+
15309
+ return exports.fromArray(mergeSegments(optimizedSegs))
15310
+ }
15311
+
15312
+ /**
15313
+ * Splits a string in various segments with the modes which
15314
+ * best represent their content.
15315
+ * The produced segments are far from being optimized.
15316
+ * The output of this function is only used to estimate a QR Code version
15317
+ * which may contain the data.
15318
+ *
15319
+ * @param {string} data Input string
15320
+ * @return {Array} Array of segments
15321
+ */
15322
+ exports.rawSplit = function rawSplit (data) {
15323
+ return exports.fromArray(
15324
+ getSegmentsFromString(data, Utils.isKanjiModeEnabled())
15325
+ )
15326
+ }
15327
+
15328
+
12456
15329
  /***/ },
12457
15330
 
12458
15331
  /***/ 9835
@@ -12491,6 +15364,50 @@ module.exports = function (METHOD_NAME) {
12491
15364
  };
12492
15365
 
12493
15366
 
15367
+ /***/ },
15368
+
15369
+ /***/ 9899
15370
+ (module) {
15371
+
15372
+ function BitBuffer () {
15373
+ this.buffer = []
15374
+ this.length = 0
15375
+ }
15376
+
15377
+ BitBuffer.prototype = {
15378
+
15379
+ get: function (index) {
15380
+ const bufIndex = Math.floor(index / 8)
15381
+ return ((this.buffer[bufIndex] >>> (7 - index % 8)) & 1) === 1
15382
+ },
15383
+
15384
+ put: function (num, length) {
15385
+ for (let i = 0; i < length; i++) {
15386
+ this.putBit(((num >>> (length - i - 1)) & 1) === 1)
15387
+ }
15388
+ },
15389
+
15390
+ getLengthInBits: function () {
15391
+ return this.length
15392
+ },
15393
+
15394
+ putBit: function (bit) {
15395
+ const bufIndex = Math.floor(this.length / 8)
15396
+ if (this.buffer.length <= bufIndex) {
15397
+ this.buffer.push(0)
15398
+ }
15399
+
15400
+ if (bit) {
15401
+ this.buffer[bufIndex] |= (0x80 >>> (this.length % 8))
15402
+ }
15403
+
15404
+ this.length++
15405
+ }
15406
+ }
15407
+
15408
+ module.exports = BitBuffer
15409
+
15410
+
12494
15411
  /***/ },
12495
15412
 
12496
15413
  /***/ 9904
@@ -12510,6 +15427,63 @@ $({ target: 'Object', stat: true, sham: !DESCRIPTORS }, {
12510
15427
  });
12511
15428
 
12512
15429
 
15430
+ /***/ },
15431
+
15432
+ /***/ 9953
15433
+ (__unused_webpack_module, exports) {
15434
+
15435
+ exports.L = { bit: 1 }
15436
+ exports.M = { bit: 0 }
15437
+ exports.Q = { bit: 3 }
15438
+ exports.H = { bit: 2 }
15439
+
15440
+ function fromString (string) {
15441
+ if (typeof string !== 'string') {
15442
+ throw new Error('Param is not a string')
15443
+ }
15444
+
15445
+ const lcStr = string.toLowerCase()
15446
+
15447
+ switch (lcStr) {
15448
+ case 'l':
15449
+ case 'low':
15450
+ return exports.L
15451
+
15452
+ case 'm':
15453
+ case 'medium':
15454
+ return exports.M
15455
+
15456
+ case 'q':
15457
+ case 'quartile':
15458
+ return exports.Q
15459
+
15460
+ case 'h':
15461
+ case 'high':
15462
+ return exports.H
15463
+
15464
+ default:
15465
+ throw new Error('Unknown EC Level: ' + string)
15466
+ }
15467
+ }
15468
+
15469
+ exports.isValid = function isValid (level) {
15470
+ return level && typeof level.bit !== 'undefined' &&
15471
+ level.bit >= 0 && level.bit < 4
15472
+ }
15473
+
15474
+ exports.from = function from (value, defaultValue) {
15475
+ if (exports.isValid(value)) {
15476
+ return value
15477
+ }
15478
+
15479
+ try {
15480
+ return fromString(value)
15481
+ } catch (e) {
15482
+ return defaultValue
15483
+ }
15484
+ }
15485
+
15486
+
12513
15487
  /***/ }
12514
15488
 
12515
15489
  /******/ });
@@ -34813,71 +37787,72 @@ const AliyunCaptchaModal_exports_ = /*#__PURE__*/(0,exportHelper/* default */.A)
34813
37787
  const verifyComponents_exports_ = /*#__PURE__*/(0,exportHelper/* default */.A)(verifyComponentsvue_type_script_lang_js, [['render',verifyComponentsvue_type_template_id_7d804fae_render]])
34814
37788
 
34815
37789
  /* harmony default export */ const verifyComponents = (verifyComponents_exports_);
34816
- ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/@vue/cli-service/node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/cli-service/node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/components/QRCodeLogin.vue?vue&type=template&id=2d48678a&scoped=true
37790
+ ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/@vue/cli-service/node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/cli-service/node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/components/QRCodeLogin.vue?vue&type=template&id=5b8744aa&scoped=true
34817
37791
 
34818
- var QRCodeLoginvue_type_template_id_2d48678a_scoped_true_hoisted_1 = {
37792
+ var QRCodeLoginvue_type_template_id_5b8744aa_scoped_true_hoisted_1 = {
34819
37793
  "class": "qr-code-wrapper"
34820
37794
  };
34821
- var QRCodeLoginvue_type_template_id_2d48678a_scoped_true_hoisted_2 = ["id"];
34822
- var QRCodeLoginvue_type_template_id_2d48678a_scoped_true_hoisted_3 = {
37795
+ var QRCodeLoginvue_type_template_id_5b8744aa_scoped_true_hoisted_2 = ["id"];
37796
+ var QRCodeLoginvue_type_template_id_5b8744aa_scoped_true_hoisted_3 = {
34823
37797
  key: 0,
34824
37798
  "class": "qr-login-overlay"
34825
37799
  };
34826
- var QRCodeLoginvue_type_template_id_2d48678a_scoped_true_hoisted_4 = {
37800
+ var QRCodeLoginvue_type_template_id_5b8744aa_scoped_true_hoisted_4 = {
34827
37801
  key: 0,
34828
37802
  "class": "overlay-content"
34829
37803
  };
34830
- var QRCodeLoginvue_type_template_id_2d48678a_scoped_true_hoisted_5 = {
37804
+ var QRCodeLoginvue_type_template_id_5b8744aa_scoped_true_hoisted_5 = {
34831
37805
  "class": "overlay-text"
34832
37806
  };
34833
- var QRCodeLoginvue_type_template_id_2d48678a_scoped_true_hoisted_6 = {
37807
+ var QRCodeLoginvue_type_template_id_5b8744aa_scoped_true_hoisted_6 = {
34834
37808
  "class": "overlay-tip"
34835
37809
  };
34836
- var QRCodeLoginvue_type_template_id_2d48678a_scoped_true_hoisted_7 = {
37810
+ var QRCodeLoginvue_type_template_id_5b8744aa_scoped_true_hoisted_7 = {
34837
37811
  key: 1,
34838
37812
  "class": "overlay-content"
34839
37813
  };
34840
- var QRCodeLoginvue_type_template_id_2d48678a_scoped_true_hoisted_8 = {
37814
+ var QRCodeLoginvue_type_template_id_5b8744aa_scoped_true_hoisted_8 = {
34841
37815
  "class": "overlay-text",
34842
37816
  style: {
34843
37817
  "color": "red"
34844
37818
  }
34845
37819
  };
34846
- var QRCodeLoginvue_type_template_id_2d48678a_scoped_true_hoisted_9 = {
37820
+ var QRCodeLoginvue_type_template_id_5b8744aa_scoped_true_hoisted_9 = {
34847
37821
  "class": "overlay-tip"
34848
37822
  };
34849
- var QRCodeLoginvue_type_template_id_2d48678a_scoped_true_hoisted_10 = {
37823
+ var QRCodeLoginvue_type_template_id_5b8744aa_scoped_true_hoisted_10 = {
34850
37824
  "class": "qr-tip"
34851
37825
  };
34852
- var QRCodeLoginvue_type_template_id_2d48678a_scoped_true_hoisted_11 = {
37826
+ var QRCodeLoginvue_type_template_id_5b8744aa_scoped_true_hoisted_11 = {
34853
37827
  key: 0,
34854
37828
  "class": "bind-tip"
34855
37829
  };
34856
- function QRCodeLoginvue_type_template_id_2d48678a_scoped_true_render(_ctx, _cache, $props, $setup, $data, $options) {
37830
+ function QRCodeLoginvue_type_template_id_5b8744aa_scoped_true_render(_ctx, _cache, $props, $setup, $data, $options) {
34857
37831
  return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.createElementBlock)("div", {
34858
37832
  "class": (0,external_commonjs_vue_commonjs2_vue_root_Vue_.normalizeClass)(["qr-login-container", {
34859
37833
  'qr-login-container1': $props.bdwxShow
34860
37834
  }])
34861
- }, [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.createElementVNode)("div", QRCodeLoginvue_type_template_id_2d48678a_scoped_true_hoisted_1, [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.createElementVNode)("div", {
37835
+ }, [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.createElementVNode)("div", QRCodeLoginvue_type_template_id_5b8744aa_scoped_true_hoisted_1, [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.createElementVNode)("div", {
34862
37836
  id: "qrcode-container-".concat(_ctx._uid)
34863
- }, null, 8, QRCodeLoginvue_type_template_id_2d48678a_scoped_true_hoisted_2), $data.loginStatus == 1 || $data.loginStatus == 3 ? ((0,external_commonjs_vue_commonjs2_vue_root_Vue_.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.createElementBlock)("div", QRCodeLoginvue_type_template_id_2d48678a_scoped_true_hoisted_3, [$data.loginStatus == 1 ? ((0,external_commonjs_vue_commonjs2_vue_root_Vue_.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.createElementBlock)("div", QRCodeLoginvue_type_template_id_2d48678a_scoped_true_hoisted_4, [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.createElementVNode)("p", QRCodeLoginvue_type_template_id_2d48678a_scoped_true_hoisted_5, (0,external_commonjs_vue_commonjs2_vue_root_Vue_.toDisplayString)($options.i18n('已扫码')), 1), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.createElementVNode)("p", QRCodeLoginvue_type_template_id_2d48678a_scoped_true_hoisted_6, (0,external_commonjs_vue_commonjs2_vue_root_Vue_.toDisplayString)($options.i18n('请在手机上确认')), 1), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.createElementVNode)("button", {
37837
+ }, null, 8, QRCodeLoginvue_type_template_id_5b8744aa_scoped_true_hoisted_2), $data.loginStatus == 1 || $data.loginStatus == 3 ? ((0,external_commonjs_vue_commonjs2_vue_root_Vue_.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.createElementBlock)("div", QRCodeLoginvue_type_template_id_5b8744aa_scoped_true_hoisted_3, [$data.loginStatus == 1 ? ((0,external_commonjs_vue_commonjs2_vue_root_Vue_.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.createElementBlock)("div", QRCodeLoginvue_type_template_id_5b8744aa_scoped_true_hoisted_4, [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.createElementVNode)("p", QRCodeLoginvue_type_template_id_5b8744aa_scoped_true_hoisted_5, (0,external_commonjs_vue_commonjs2_vue_root_Vue_.toDisplayString)($options.i18n('已扫码')), 1), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.createElementVNode)("p", QRCodeLoginvue_type_template_id_5b8744aa_scoped_true_hoisted_6, (0,external_commonjs_vue_commonjs2_vue_root_Vue_.toDisplayString)($options.i18n('请在手机上确认')), 1), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.createElementVNode)("button", {
34864
37838
  "class": "rescan-btn",
34865
37839
  onClick: _cache[0] || (_cache[0] = function () {
34866
37840
  return $options.handleRescanQrCode && $options.handleRescanQrCode.apply($options, arguments);
34867
37841
  })
34868
- }, (0,external_commonjs_vue_commonjs2_vue_root_Vue_.toDisplayString)($options.i18n('重新扫码')), 1)])) : $data.loginStatus == 3 ? ((0,external_commonjs_vue_commonjs2_vue_root_Vue_.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.createElementBlock)("div", QRCodeLoginvue_type_template_id_2d48678a_scoped_true_hoisted_7, [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.createElementVNode)("p", QRCodeLoginvue_type_template_id_2d48678a_scoped_true_hoisted_8, (0,external_commonjs_vue_commonjs2_vue_root_Vue_.toDisplayString)($options.i18n('二维码已过期')), 1), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.createElementVNode)("p", QRCodeLoginvue_type_template_id_2d48678a_scoped_true_hoisted_9, (0,external_commonjs_vue_commonjs2_vue_root_Vue_.toDisplayString)($options.i18n('请点击下方按钮刷新')), 1), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.createElementVNode)("button", {
37842
+ }, (0,external_commonjs_vue_commonjs2_vue_root_Vue_.toDisplayString)($options.i18n('重新扫码')), 1)])) : $data.loginStatus == 3 ? ((0,external_commonjs_vue_commonjs2_vue_root_Vue_.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.createElementBlock)("div", QRCodeLoginvue_type_template_id_5b8744aa_scoped_true_hoisted_7, [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.createElementVNode)("p", QRCodeLoginvue_type_template_id_5b8744aa_scoped_true_hoisted_8, (0,external_commonjs_vue_commonjs2_vue_root_Vue_.toDisplayString)($options.i18n('二维码已过期')), 1), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.createElementVNode)("p", QRCodeLoginvue_type_template_id_5b8744aa_scoped_true_hoisted_9, (0,external_commonjs_vue_commonjs2_vue_root_Vue_.toDisplayString)($options.i18n('请点击下方按钮刷新')), 1), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.createElementVNode)("button", {
34869
37843
  "class": "rescan-btn",
34870
37844
  onClick: _cache[1] || (_cache[1] = function () {
34871
37845
  return $options.handleRescanQrCode && $options.handleRescanQrCode.apply($options, arguments);
34872
37846
  })
34873
- }, (0,external_commonjs_vue_commonjs2_vue_root_Vue_.toDisplayString)($options.i18n('重新生成')), 1)])) : (0,external_commonjs_vue_commonjs2_vue_root_Vue_.createCommentVNode)("", true)])) : (0,external_commonjs_vue_commonjs2_vue_root_Vue_.createCommentVNode)("", true)]), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.createElementVNode)("p", QRCodeLoginvue_type_template_id_2d48678a_scoped_true_hoisted_10, (0,external_commonjs_vue_commonjs2_vue_root_Vue_.toDisplayString)($props.bdwxShow ? $options.i18n('微信扫码进行账号绑定') : $options.i18n('微信或App扫码均可登录')), 1), $data.wxRandom ? ((0,external_commonjs_vue_commonjs2_vue_root_Vue_.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.createElementBlock)("div", QRCodeLoginvue_type_template_id_2d48678a_scoped_true_hoisted_11, (0,external_commonjs_vue_commonjs2_vue_root_Vue_.toDisplayString)($options.i18n('你当前的微信暂未绑定账号或手机号,需先完成绑定,后续登录将无需重复验证,直接进入即可~')), 1)) : (0,external_commonjs_vue_commonjs2_vue_root_Vue_.createCommentVNode)("", true)], 2);
37847
+ }, (0,external_commonjs_vue_commonjs2_vue_root_Vue_.toDisplayString)($options.i18n('重新生成')), 1)])) : (0,external_commonjs_vue_commonjs2_vue_root_Vue_.createCommentVNode)("", true)])) : (0,external_commonjs_vue_commonjs2_vue_root_Vue_.createCommentVNode)("", true)]), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.createElementVNode)("p", QRCodeLoginvue_type_template_id_5b8744aa_scoped_true_hoisted_10, (0,external_commonjs_vue_commonjs2_vue_root_Vue_.toDisplayString)($props.bdwxShow ? $options.i18n('微信扫码进行账号绑定') : $options.i18n('微信或App扫码均可登录')), 1), $data.wxRandom ? ((0,external_commonjs_vue_commonjs2_vue_root_Vue_.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.createElementBlock)("div", QRCodeLoginvue_type_template_id_5b8744aa_scoped_true_hoisted_11, (0,external_commonjs_vue_commonjs2_vue_root_Vue_.toDisplayString)($options.i18n('你当前的微信暂未绑定账号或手机号,需先完成绑定,后续登录将无需重复验证,直接进入即可~')), 1)) : (0,external_commonjs_vue_commonjs2_vue_root_Vue_.createCommentVNode)("", true)], 2);
34874
37848
  }
34875
- ;// ./src/components/QRCodeLogin.vue?vue&type=template&id=2d48678a&scoped=true
37849
+ ;// ./src/components/QRCodeLogin.vue?vue&type=template&id=5b8744aa&scoped=true
34876
37850
 
37851
+ // EXTERNAL MODULE: ./node_modules/qrcode/lib/browser.js
37852
+ var browser = __webpack_require__(7583);
34877
37853
  ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/@vue/cli-service/node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/components/QRCodeLogin.vue?vue&type=script&lang=js
34878
37854
 
34879
37855
 
34880
- // import QRCode from 'qrcodejs2';
34881
37856
 
34882
37857
  /* harmony default export */ const QRCodeLoginvue_type_script_lang_js = ({
34883
37858
  props: {
@@ -34932,7 +37907,6 @@ function QRCodeLoginvue_type_template_id_2d48678a_scoped_true_render(_ctx, _cach
34932
37907
  login_generateQrCode().then(function (_ref) {
34933
37908
  var data = _ref.data;
34934
37909
  _this.loading = false;
34935
- // this.qrCodeUrl = data.data.qrCodeUrl;
34936
37910
  _this.generateQRCode(data.data.qrUrl);
34937
37911
  _this.sceneId = data.data.sceneId;
34938
37912
  _this.expireTime = data.data.expireTime;
@@ -34946,37 +37920,62 @@ function QRCodeLoginvue_type_template_id_2d48678a_scoped_true_render(_ctx, _cach
34946
37920
  console.error(err);
34947
37921
  });
34948
37922
  },
37923
+ // 使用新的qrcode库生成二维码
34949
37924
  generateQRCode: function generateQRCode(url) {
37925
+ var _this2 = this;
34950
37926
  var containerId = "qrcode-container-".concat(this._uid);
34951
- document.getElementById(containerId).innerHTML = '';
34952
- // // 创建新的二维码实例
34953
- // new QRCode(document.getElementById(containerId), {
34954
- // text: url, // 二维码内容(链接)
34955
- // width: 240, // 宽度
34956
- // height: 240, // 高度
34957
- // colorDark: '#000000', // 前景色
34958
- // colorLight: '#ffffff', // 背景色
34959
- // correctLevel: QRCode.CorrectLevel.H, // 容错级别
34960
- // });
37927
+ var container = document.getElementById(containerId);
37928
+ if (!container) {
37929
+ console.error('二维码容器未找到');
37930
+ return;
37931
+ }
37932
+
37933
+ // 清空容器
37934
+ container.innerHTML = '';
37935
+
37936
+ // 使用 qrcode 库生成二维码到 Canvas
37937
+ browser.toCanvas(url, {
37938
+ width: 240,
37939
+ height: 240,
37940
+ color: {
37941
+ dark: '#000000',
37942
+ // 前景色
37943
+ light: '#ffffff' // 背景色
37944
+ },
37945
+ errorCorrectionLevel: 'H',
37946
+ // 容错级别:L, M, Q, H
37947
+ margin: 1,
37948
+ // 边距
37949
+ scale: 4 // 缩放比例
37950
+ }, function (error, canvas) {
37951
+ if (error) {
37952
+ console.error('生成二维码失败:', error);
37953
+ _this2.error = '生成二维码失败,请重试';
37954
+ return;
37955
+ }
37956
+
37957
+ // 将生成的canvas添加到容器中
37958
+ container.appendChild(canvas);
37959
+ });
34961
37960
  },
34962
37961
  // 轮询检查登录状态
34963
37962
  startPolling: function startPolling() {
34964
- var _this2 = this;
37963
+ var _this3 = this;
34965
37964
  this.pollTimer = setInterval(function () {
34966
- checkCodeStatus(_this2.sceneId).then(function (res) {
37965
+ checkCodeStatus(_this3.sceneId).then(function (res) {
34967
37966
  var status = res.data.data.status;
34968
37967
  if (status === 1) {
34969
37968
  // 登录中,更新状态为已扫码
34970
- _this2.loginStatus = status;
37969
+ _this3.loginStatus = status;
34971
37970
  } else if (status === 2) {
34972
37971
  // 登录成功,存储token并跳转
34973
- _this2.$emit('loginSuccess', res.data.data);
34974
- _this2.wxRandom = res.data.data.wxRandom;
34975
- _this2.clearTimers();
37972
+ _this3.$emit('loginSuccess', res.data.data);
37973
+ _this3.wxRandom = res.data.data.wxRandom;
37974
+ _this3.clearTimers();
34976
37975
  } else if (status === 3) {
34977
37976
  // 二维码过期,停止轮询并显示提示
34978
- _this2.loginStatus = 3;
34979
- _this2.clearTimers();
37977
+ _this3.loginStatus = 3;
37978
+ _this3.clearTimers();
34980
37979
  }
34981
37980
  // 其他状态(扫描未确认)不处理
34982
37981
  })["catch"](function (err) {
@@ -34986,19 +37985,25 @@ function QRCodeLoginvue_type_template_id_2d48678a_scoped_true_render(_ctx, _cach
34986
37985
  },
34987
37986
  // 倒计时
34988
37987
  startCountdown: function startCountdown() {
34989
- var _this3 = this;
37988
+ var _this4 = this;
34990
37989
  this.statusTimer = setInterval(function () {
34991
- _this3.expireTime--;
34992
- if (_this3.expireTime <= 0) {
34993
- _this3.loginStatus = 3; // 设置为过期状态
34994
- _this3.clearTimers();
37990
+ _this4.expireTime--;
37991
+ if (_this4.expireTime <= 0) {
37992
+ _this4.loginStatus = 3; // 设置为过期状态
37993
+ _this4.clearTimers();
34995
37994
  }
34996
37995
  }, 1000);
34997
37996
  },
34998
37997
  // 清除定时器
34999
37998
  clearTimers: function clearTimers() {
35000
- if (this.pollTimer) clearInterval(this.pollTimer);
35001
- if (this.statusTimer) clearInterval(this.statusTimer);
37999
+ if (this.pollTimer) {
38000
+ clearInterval(this.pollTimer);
38001
+ this.pollTimer = null;
38002
+ }
38003
+ if (this.statusTimer) {
38004
+ clearInterval(this.statusTimer);
38005
+ this.statusTimer = null;
38006
+ }
35002
38007
  },
35003
38008
  // 重新扫码
35004
38009
  handleRescanQrCode: function handleRescanQrCode() {
@@ -35009,10 +38014,10 @@ function QRCodeLoginvue_type_template_id_2d48678a_scoped_true_render(_ctx, _cach
35009
38014
  });
35010
38015
  ;// ./src/components/QRCodeLogin.vue?vue&type=script&lang=js
35011
38016
 
35012
- ;// ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-64.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-64.use[1]!./node_modules/@vue/cli-service/node_modules/vue-loader/dist/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-64.use[2]!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-64.use[3]!./node_modules/@vue/cli-service/node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/components/QRCodeLogin.vue?vue&type=style&index=0&id=2d48678a&lang=scss&scoped=true
38017
+ ;// ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-64.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-64.use[1]!./node_modules/@vue/cli-service/node_modules/vue-loader/dist/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-64.use[2]!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-64.use[3]!./node_modules/@vue/cli-service/node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/components/QRCodeLogin.vue?vue&type=style&index=0&id=5b8744aa&lang=scss&scoped=true
35013
38018
  // extracted by mini-css-extract-plugin
35014
38019
 
35015
- ;// ./src/components/QRCodeLogin.vue?vue&type=style&index=0&id=2d48678a&lang=scss&scoped=true
38020
+ ;// ./src/components/QRCodeLogin.vue?vue&type=style&index=0&id=5b8744aa&lang=scss&scoped=true
35016
38021
 
35017
38022
  ;// ./src/components/QRCodeLogin.vue
35018
38023
 
@@ -35022,7 +38027,7 @@ function QRCodeLoginvue_type_template_id_2d48678a_scoped_true_render(_ctx, _cach
35022
38027
  ;
35023
38028
 
35024
38029
 
35025
- const QRCodeLogin_exports_ = /*#__PURE__*/(0,exportHelper/* default */.A)(QRCodeLoginvue_type_script_lang_js, [['render',QRCodeLoginvue_type_template_id_2d48678a_scoped_true_render],['__scopeId',"data-v-2d48678a"]])
38030
+ const QRCodeLogin_exports_ = /*#__PURE__*/(0,exportHelper/* default */.A)(QRCodeLoginvue_type_script_lang_js, [['render',QRCodeLoginvue_type_template_id_5b8744aa_scoped_true_render],['__scopeId',"data-v-5b8744aa"]])
35026
38031
 
35027
38032
  /* harmony default export */ const QRCodeLogin = (QRCodeLogin_exports_);
35028
38033
  ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/@vue/cli-service/node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/cli-service/node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/components/mobileBinding.vue?vue&type=template&id=3371c604&scoped=true