icve-sso-vue3 0.0.18 → 0.0.19

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