@yoooloo42/joker 1.0.248 → 1.0.250

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.
package/dist/index.cjs.js CHANGED
@@ -4,24 +4,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var elementPlus = require('element-plus');
6
6
  var vue = require('vue');
7
- var qrcodejs2 = require('qrcodejs2');
8
-
9
- function _interopNamespaceDefault(e) {
10
- var n = Object.create(null);
11
- if (e) {
12
- Object.keys(e).forEach(function (k) {
13
- if (k !== 'default') {
14
- var d = Object.getOwnPropertyDescriptor(e, k);
15
- Object.defineProperty(n, k, d.get ? d : {
16
- enumerable: true,
17
- get: function () { return e[k]; }
18
- });
19
- }
20
- });
21
- }
22
- n.default = e;
23
- return Object.freeze(n);
24
- }
25
7
 
26
8
  function _mergeNamespaces(n, m) {
27
9
  m.forEach(function (e) {
@@ -38,8 +20,6 @@ function _mergeNamespaces(n, m) {
38
20
  return Object.freeze(n);
39
21
  }
40
22
 
41
- var qrcodejs2__namespace = /*#__PURE__*/_interopNamespaceDefault(qrcodejs2);
42
-
43
23
  /*! xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */
44
24
  /* vim: set ts=2: */
45
25
  /*exported XLSX */
@@ -15830,7 +15810,7 @@ function sheet_set_array_formula(ws/*:Worksheet*/, range, formula/*:string*/, dy
15830
15810
  return ws;
15831
15811
  }
15832
15812
 
15833
- var utils$2/*:any*/ = {
15813
+ var utils$4/*:any*/ = {
15834
15814
  encode_col: encode_col,
15835
15815
  encode_row: encode_row,
15836
15816
  encode_cell: encode_cell,
@@ -15872,35 +15852,6 @@ var utils$2/*:any*/ = {
15872
15852
 
15873
15853
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
15874
15854
 
15875
- function getAugmentedNamespace(n) {
15876
- if (Object.prototype.hasOwnProperty.call(n, '__esModule')) return n;
15877
- var f = n.default;
15878
- if (typeof f == "function") {
15879
- var a = function a () {
15880
- var isInstance = false;
15881
- try {
15882
- isInstance = this instanceof a;
15883
- } catch {}
15884
- if (isInstance) {
15885
- return Reflect.construct(f, arguments, this.constructor);
15886
- }
15887
- return f.apply(this, arguments);
15888
- };
15889
- a.prototype = f.prototype;
15890
- } else a = {};
15891
- Object.defineProperty(a, '__esModule', {value: true});
15892
- Object.keys(n).forEach(function (k) {
15893
- var d = Object.getOwnPropertyDescriptor(n, k);
15894
- Object.defineProperty(a, k, d.get ? d : {
15895
- enumerable: true,
15896
- get: function () {
15897
- return n[k];
15898
- }
15899
- });
15900
- });
15901
- return a;
15902
- }
15903
-
15904
15855
  var FileSaver_min$1 = {exports: {}};
15905
15856
 
15906
15857
  var FileSaver_min = FileSaver_min$1.exports;
@@ -15951,9 +15902,9 @@ function jsonToExcel(_ref) {
15951
15902
  const aoa = [header, ...data];
15952
15903
 
15953
15904
  // 3. 创建工作簿和工作表
15954
- const ws = utils$2.aoa_to_sheet(aoa);
15955
- const wb = utils$2.book_new();
15956
- utils$2.book_append_sheet(wb, ws, 'Sheet1');
15905
+ const ws = utils$4.aoa_to_sheet(aoa);
15906
+ const wb = utils$4.book_new();
15907
+ utils$4.book_append_sheet(wb, ws, 'Sheet1');
15957
15908
 
15958
15909
  // 4. 生成 Excel 文件
15959
15910
  const wbout = writeSync(wb, {
@@ -16857,7 +16808,7 @@ const asap = typeof queueMicrotask !== 'undefined' ?
16857
16808
  const isIterable = (thing) => thing != null && isFunction$1(thing[iterator]);
16858
16809
 
16859
16810
 
16860
- var utils$1 = {
16811
+ var utils$3 = {
16861
16812
  isArray: isArray$1,
16862
16813
  isArrayBuffer,
16863
16814
  isBuffer: isBuffer$1,
@@ -18921,7 +18872,7 @@ function AxiosError$1(message, code, config, request, response) {
18921
18872
  }
18922
18873
  }
18923
18874
 
18924
- utils$1.inherits(AxiosError$1, Error, {
18875
+ utils$3.inherits(AxiosError$1, Error, {
18925
18876
  toJSON: function toJSON() {
18926
18877
  return {
18927
18878
  // Standard
@@ -18936,7 +18887,7 @@ utils$1.inherits(AxiosError$1, Error, {
18936
18887
  columnNumber: this.columnNumber,
18937
18888
  stack: this.stack,
18938
18889
  // Axios
18939
- config: utils$1.toJSONObject(this.config),
18890
+ config: utils$3.toJSONObject(this.config),
18940
18891
  code: this.code,
18941
18892
  status: this.status
18942
18893
  };
@@ -18971,7 +18922,7 @@ Object.defineProperty(prototype$1, 'isAxiosError', {value: true});
18971
18922
  AxiosError$1.from = (error, code, config, request, response, customProps) => {
18972
18923
  const axiosError = Object.create(prototype$1);
18973
18924
 
18974
- utils$1.toFlatObject(error, axiosError, function filter(obj) {
18925
+ utils$3.toFlatObject(error, axiosError, function filter(obj) {
18975
18926
  return obj !== Error.prototype;
18976
18927
  }, prop => {
18977
18928
  return prop !== 'isAxiosError';
@@ -19006,7 +18957,7 @@ var httpAdapter = null;
19006
18957
  * @returns {boolean}
19007
18958
  */
19008
18959
  function isVisitable(thing) {
19009
- return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
18960
+ return utils$3.isPlainObject(thing) || utils$3.isArray(thing);
19010
18961
  }
19011
18962
 
19012
18963
  /**
@@ -19017,7 +18968,7 @@ function isVisitable(thing) {
19017
18968
  * @returns {string} the key without the brackets.
19018
18969
  */
19019
18970
  function removeBrackets(key) {
19020
- return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
18971
+ return utils$3.endsWith(key, '[]') ? key.slice(0, -2) : key;
19021
18972
  }
19022
18973
 
19023
18974
  /**
@@ -19046,10 +18997,10 @@ function renderKey(path, key, dots) {
19046
18997
  * @returns {boolean}
19047
18998
  */
19048
18999
  function isFlatArray(arr) {
19049
- return utils$1.isArray(arr) && !arr.some(isVisitable);
19000
+ return utils$3.isArray(arr) && !arr.some(isVisitable);
19050
19001
  }
19051
19002
 
19052
- const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
19003
+ const predicates = utils$3.toFlatObject(utils$3, {}, null, function filter(prop) {
19053
19004
  return /^is[A-Z]/.test(prop);
19054
19005
  });
19055
19006
 
@@ -19077,7 +19028,7 @@ const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop)
19077
19028
  * @returns
19078
19029
  */
19079
19030
  function toFormData$1(obj, formData, options) {
19080
- if (!utils$1.isObject(obj)) {
19031
+ if (!utils$3.isObject(obj)) {
19081
19032
  throw new TypeError('target must be an object');
19082
19033
  }
19083
19034
 
@@ -19085,13 +19036,13 @@ function toFormData$1(obj, formData, options) {
19085
19036
  formData = formData || new (FormData)();
19086
19037
 
19087
19038
  // eslint-disable-next-line no-param-reassign
19088
- options = utils$1.toFlatObject(options, {
19039
+ options = utils$3.toFlatObject(options, {
19089
19040
  metaTokens: true,
19090
19041
  dots: false,
19091
19042
  indexes: false
19092
19043
  }, false, function defined(option, source) {
19093
19044
  // eslint-disable-next-line no-eq-null,eqeqeq
19094
- return !utils$1.isUndefined(source[option]);
19045
+ return !utils$3.isUndefined(source[option]);
19095
19046
  });
19096
19047
 
19097
19048
  const metaTokens = options.metaTokens;
@@ -19100,28 +19051,28 @@ function toFormData$1(obj, formData, options) {
19100
19051
  const dots = options.dots;
19101
19052
  const indexes = options.indexes;
19102
19053
  const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
19103
- const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
19054
+ const useBlob = _Blob && utils$3.isSpecCompliantForm(formData);
19104
19055
 
19105
- if (!utils$1.isFunction(visitor)) {
19056
+ if (!utils$3.isFunction(visitor)) {
19106
19057
  throw new TypeError('visitor must be a function');
19107
19058
  }
19108
19059
 
19109
19060
  function convertValue(value) {
19110
19061
  if (value === null) return '';
19111
19062
 
19112
- if (utils$1.isDate(value)) {
19063
+ if (utils$3.isDate(value)) {
19113
19064
  return value.toISOString();
19114
19065
  }
19115
19066
 
19116
- if (utils$1.isBoolean(value)) {
19067
+ if (utils$3.isBoolean(value)) {
19117
19068
  return value.toString();
19118
19069
  }
19119
19070
 
19120
- if (!useBlob && utils$1.isBlob(value)) {
19071
+ if (!useBlob && utils$3.isBlob(value)) {
19121
19072
  throw new AxiosError$1('Blob is not supported. Use a Buffer instead.');
19122
19073
  }
19123
19074
 
19124
- if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
19075
+ if (utils$3.isArrayBuffer(value) || utils$3.isTypedArray(value)) {
19125
19076
  return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer$1.from(value);
19126
19077
  }
19127
19078
 
@@ -19142,20 +19093,20 @@ function toFormData$1(obj, formData, options) {
19142
19093
  let arr = value;
19143
19094
 
19144
19095
  if (value && !path && typeof value === 'object') {
19145
- if (utils$1.endsWith(key, '{}')) {
19096
+ if (utils$3.endsWith(key, '{}')) {
19146
19097
  // eslint-disable-next-line no-param-reassign
19147
19098
  key = metaTokens ? key : key.slice(0, -2);
19148
19099
  // eslint-disable-next-line no-param-reassign
19149
19100
  value = JSON.stringify(value);
19150
19101
  } else if (
19151
- (utils$1.isArray(value) && isFlatArray(value)) ||
19152
- ((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))
19102
+ (utils$3.isArray(value) && isFlatArray(value)) ||
19103
+ ((utils$3.isFileList(value) || utils$3.endsWith(key, '[]')) && (arr = utils$3.toArray(value))
19153
19104
  )) {
19154
19105
  // eslint-disable-next-line no-param-reassign
19155
19106
  key = removeBrackets(key);
19156
19107
 
19157
19108
  arr.forEach(function each(el, index) {
19158
- !(utils$1.isUndefined(el) || el === null) && formData.append(
19109
+ !(utils$3.isUndefined(el) || el === null) && formData.append(
19159
19110
  // eslint-disable-next-line no-nested-ternary
19160
19111
  indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),
19161
19112
  convertValue(el)
@@ -19183,7 +19134,7 @@ function toFormData$1(obj, formData, options) {
19183
19134
  });
19184
19135
 
19185
19136
  function build(value, path) {
19186
- if (utils$1.isUndefined(value)) return;
19137
+ if (utils$3.isUndefined(value)) return;
19187
19138
 
19188
19139
  if (stack.indexOf(value) !== -1) {
19189
19140
  throw Error('Circular reference detected in ' + path.join('.'));
@@ -19191,9 +19142,9 @@ function toFormData$1(obj, formData, options) {
19191
19142
 
19192
19143
  stack.push(value);
19193
19144
 
19194
- utils$1.forEach(value, function each(el, key) {
19195
- const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(
19196
- formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers
19145
+ utils$3.forEach(value, function each(el, key) {
19146
+ const result = !(utils$3.isUndefined(el) || el === null) && visitor.call(
19147
+ formData, el, utils$3.isString(key) ? key.trim() : key, path, exposedHelpers
19197
19148
  );
19198
19149
 
19199
19150
  if (result === true) {
@@ -19204,7 +19155,7 @@ function toFormData$1(obj, formData, options) {
19204
19155
  stack.pop();
19205
19156
  }
19206
19157
 
19207
- if (!utils$1.isObject(obj)) {
19158
+ if (!utils$3.isObject(obj)) {
19208
19159
  throw new TypeError('data must be an object');
19209
19160
  }
19210
19161
 
@@ -19299,7 +19250,7 @@ function buildURL(url, params, options) {
19299
19250
 
19300
19251
  const _encode = options && options.encode || encode;
19301
19252
 
19302
- if (utils$1.isFunction(options)) {
19253
+ if (utils$3.isFunction(options)) {
19303
19254
  options = {
19304
19255
  serialize: options
19305
19256
  };
@@ -19312,7 +19263,7 @@ function buildURL(url, params, options) {
19312
19263
  if (serializeFn) {
19313
19264
  serializedParams = serializeFn(params, options);
19314
19265
  } else {
19315
- serializedParams = utils$1.isURLSearchParams(params) ?
19266
+ serializedParams = utils$3.isURLSearchParams(params) ?
19316
19267
  params.toString() :
19317
19268
  new AxiosURLSearchParams(params, options).toString(_encode);
19318
19269
  }
@@ -19387,7 +19338,7 @@ class InterceptorManager {
19387
19338
  * @returns {void}
19388
19339
  */
19389
19340
  forEach(fn) {
19390
- utils$1.forEach(this.handlers, function forEachHandler(h) {
19341
+ utils$3.forEach(this.handlers, function forEachHandler(h) {
19391
19342
  if (h !== null) {
19392
19343
  fn(h);
19393
19344
  }
@@ -19461,7 +19412,7 @@ const hasStandardBrowserWebWorkerEnv = (() => {
19461
19412
 
19462
19413
  const origin = hasBrowserEnv && window.location.href || 'http://localhost';
19463
19414
 
19464
- var utils = /*#__PURE__*/Object.freeze({
19415
+ var utils$2 = /*#__PURE__*/Object.freeze({
19465
19416
  __proto__: null,
19466
19417
  hasBrowserEnv: hasBrowserEnv,
19467
19418
  hasStandardBrowserEnv: hasStandardBrowserEnv,
@@ -19471,14 +19422,14 @@ var utils = /*#__PURE__*/Object.freeze({
19471
19422
  });
19472
19423
 
19473
19424
  var platform = {
19474
- ...utils,
19425
+ ...utils$2,
19475
19426
  ...platform$1
19476
19427
  };
19477
19428
 
19478
19429
  function toURLEncodedForm(data, options) {
19479
19430
  return toFormData$1(data, new platform.classes.URLSearchParams(), {
19480
19431
  visitor: function(value, key, path, helpers) {
19481
- if (platform.isNode && utils$1.isBuffer(value)) {
19432
+ if (platform.isNode && utils$3.isBuffer(value)) {
19482
19433
  this.append(key, value.toString('base64'));
19483
19434
  return false;
19484
19435
  }
@@ -19501,7 +19452,7 @@ function parsePropPath(name) {
19501
19452
  // foo.x.y.z
19502
19453
  // foo-x-y-z
19503
19454
  // foo x y z
19504
- return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
19455
+ return utils$3.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
19505
19456
  return match[0] === '[]' ? '' : match[1] || match[0];
19506
19457
  });
19507
19458
  }
@@ -19541,10 +19492,10 @@ function formDataToJSON(formData) {
19541
19492
 
19542
19493
  const isNumericKey = Number.isFinite(+name);
19543
19494
  const isLast = index >= path.length;
19544
- name = !name && utils$1.isArray(target) ? target.length : name;
19495
+ name = !name && utils$3.isArray(target) ? target.length : name;
19545
19496
 
19546
19497
  if (isLast) {
19547
- if (utils$1.hasOwnProp(target, name)) {
19498
+ if (utils$3.hasOwnProp(target, name)) {
19548
19499
  target[name] = [target[name], value];
19549
19500
  } else {
19550
19501
  target[name] = value;
@@ -19553,23 +19504,23 @@ function formDataToJSON(formData) {
19553
19504
  return !isNumericKey;
19554
19505
  }
19555
19506
 
19556
- if (!target[name] || !utils$1.isObject(target[name])) {
19507
+ if (!target[name] || !utils$3.isObject(target[name])) {
19557
19508
  target[name] = [];
19558
19509
  }
19559
19510
 
19560
19511
  const result = buildPath(path, value, target[name], index);
19561
19512
 
19562
- if (result && utils$1.isArray(target[name])) {
19513
+ if (result && utils$3.isArray(target[name])) {
19563
19514
  target[name] = arrayToObject(target[name]);
19564
19515
  }
19565
19516
 
19566
19517
  return !isNumericKey;
19567
19518
  }
19568
19519
 
19569
- if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
19520
+ if (utils$3.isFormData(formData) && utils$3.isFunction(formData.entries)) {
19570
19521
  const obj = {};
19571
19522
 
19572
- utils$1.forEachEntry(formData, (name, value) => {
19523
+ utils$3.forEachEntry(formData, (name, value) => {
19573
19524
  buildPath(parsePropPath(name), value, obj, 0);
19574
19525
  });
19575
19526
 
@@ -19590,10 +19541,10 @@ function formDataToJSON(formData) {
19590
19541
  * @returns {string} A stringified version of the rawValue.
19591
19542
  */
19592
19543
  function stringifySafely(rawValue, parser, encoder) {
19593
- if (utils$1.isString(rawValue)) {
19544
+ if (utils$3.isString(rawValue)) {
19594
19545
  try {
19595
19546
  (parser || JSON.parse)(rawValue);
19596
- return utils$1.trim(rawValue);
19547
+ return utils$3.trim(rawValue);
19597
19548
  } catch (e) {
19598
19549
  if (e.name !== 'SyntaxError') {
19599
19550
  throw e;
@@ -19613,31 +19564,31 @@ const defaults = {
19613
19564
  transformRequest: [function transformRequest(data, headers) {
19614
19565
  const contentType = headers.getContentType() || '';
19615
19566
  const hasJSONContentType = contentType.indexOf('application/json') > -1;
19616
- const isObjectPayload = utils$1.isObject(data);
19567
+ const isObjectPayload = utils$3.isObject(data);
19617
19568
 
19618
- if (isObjectPayload && utils$1.isHTMLForm(data)) {
19569
+ if (isObjectPayload && utils$3.isHTMLForm(data)) {
19619
19570
  data = new FormData(data);
19620
19571
  }
19621
19572
 
19622
- const isFormData = utils$1.isFormData(data);
19573
+ const isFormData = utils$3.isFormData(data);
19623
19574
 
19624
19575
  if (isFormData) {
19625
19576
  return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
19626
19577
  }
19627
19578
 
19628
- if (utils$1.isArrayBuffer(data) ||
19629
- utils$1.isBuffer(data) ||
19630
- utils$1.isStream(data) ||
19631
- utils$1.isFile(data) ||
19632
- utils$1.isBlob(data) ||
19633
- utils$1.isReadableStream(data)
19579
+ if (utils$3.isArrayBuffer(data) ||
19580
+ utils$3.isBuffer(data) ||
19581
+ utils$3.isStream(data) ||
19582
+ utils$3.isFile(data) ||
19583
+ utils$3.isBlob(data) ||
19584
+ utils$3.isReadableStream(data)
19634
19585
  ) {
19635
19586
  return data;
19636
19587
  }
19637
- if (utils$1.isArrayBufferView(data)) {
19588
+ if (utils$3.isArrayBufferView(data)) {
19638
19589
  return data.buffer;
19639
19590
  }
19640
- if (utils$1.isURLSearchParams(data)) {
19591
+ if (utils$3.isURLSearchParams(data)) {
19641
19592
  headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
19642
19593
  return data.toString();
19643
19594
  }
@@ -19649,7 +19600,7 @@ const defaults = {
19649
19600
  return toURLEncodedForm(data, this.formSerializer).toString();
19650
19601
  }
19651
19602
 
19652
- if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
19603
+ if ((isFileList = utils$3.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
19653
19604
  const _FormData = this.env && this.env.FormData;
19654
19605
 
19655
19606
  return toFormData$1(
@@ -19673,11 +19624,11 @@ const defaults = {
19673
19624
  const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
19674
19625
  const JSONRequested = this.responseType === 'json';
19675
19626
 
19676
- if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
19627
+ if (utils$3.isResponse(data) || utils$3.isReadableStream(data)) {
19677
19628
  return data;
19678
19629
  }
19679
19630
 
19680
- if (data && utils$1.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
19631
+ if (data && utils$3.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
19681
19632
  const silentJSONParsing = transitional && transitional.silentJSONParsing;
19682
19633
  const strictJSONParsing = !silentJSONParsing && JSONRequested;
19683
19634
 
@@ -19725,13 +19676,13 @@ const defaults = {
19725
19676
  }
19726
19677
  };
19727
19678
 
19728
- utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
19679
+ utils$3.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
19729
19680
  defaults.headers[method] = {};
19730
19681
  });
19731
19682
 
19732
19683
  // RawAxiosHeaders whose duplicates are ignored by node
19733
19684
  // c.f. https://nodejs.org/api/http.html#http_message_headers
19734
- const ignoreDuplicateOf = utils$1.toObjectSet([
19685
+ const ignoreDuplicateOf = utils$3.toObjectSet([
19735
19686
  'age', 'authorization', 'content-length', 'content-type', 'etag',
19736
19687
  'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
19737
19688
  'last-modified', 'location', 'max-forwards', 'proxy-authorization',
@@ -19792,7 +19743,7 @@ function normalizeValue(value) {
19792
19743
  return value;
19793
19744
  }
19794
19745
 
19795
- return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
19746
+ return utils$3.isArray(value) ? value.map(normalizeValue) : String(value);
19796
19747
  }
19797
19748
 
19798
19749
  function parseTokens(str) {
@@ -19810,7 +19761,7 @@ function parseTokens(str) {
19810
19761
  const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
19811
19762
 
19812
19763
  function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
19813
- if (utils$1.isFunction(filter)) {
19764
+ if (utils$3.isFunction(filter)) {
19814
19765
  return filter.call(this, value, header);
19815
19766
  }
19816
19767
 
@@ -19818,13 +19769,13 @@ function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
19818
19769
  value = header;
19819
19770
  }
19820
19771
 
19821
- if (!utils$1.isString(value)) return;
19772
+ if (!utils$3.isString(value)) return;
19822
19773
 
19823
- if (utils$1.isString(filter)) {
19774
+ if (utils$3.isString(filter)) {
19824
19775
  return value.indexOf(filter) !== -1;
19825
19776
  }
19826
19777
 
19827
- if (utils$1.isRegExp(filter)) {
19778
+ if (utils$3.isRegExp(filter)) {
19828
19779
  return filter.test(value);
19829
19780
  }
19830
19781
  }
@@ -19837,7 +19788,7 @@ function formatHeader(header) {
19837
19788
  }
19838
19789
 
19839
19790
  function buildAccessors(obj, header) {
19840
- const accessorName = utils$1.toCamelCase(' ' + header);
19791
+ const accessorName = utils$3.toCamelCase(' ' + header);
19841
19792
 
19842
19793
  ['get', 'set', 'has'].forEach(methodName => {
19843
19794
  Object.defineProperty(obj, methodName + accessorName, {
@@ -19864,7 +19815,7 @@ let AxiosHeaders$1 = class AxiosHeaders {
19864
19815
  throw new Error('header name must be a non-empty string');
19865
19816
  }
19866
19817
 
19867
- const key = utils$1.findKey(self, lHeader);
19818
+ const key = utils$3.findKey(self, lHeader);
19868
19819
 
19869
19820
  if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {
19870
19821
  self[key || _header] = normalizeValue(_value);
@@ -19872,21 +19823,21 @@ let AxiosHeaders$1 = class AxiosHeaders {
19872
19823
  }
19873
19824
 
19874
19825
  const setHeaders = (headers, _rewrite) =>
19875
- utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
19826
+ utils$3.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
19876
19827
 
19877
- if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
19828
+ if (utils$3.isPlainObject(header) || header instanceof this.constructor) {
19878
19829
  setHeaders(header, valueOrRewrite);
19879
- } else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
19830
+ } else if(utils$3.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
19880
19831
  setHeaders(parseHeaders(header), valueOrRewrite);
19881
- } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
19832
+ } else if (utils$3.isObject(header) && utils$3.isIterable(header)) {
19882
19833
  let obj = {}, dest, key;
19883
19834
  for (const entry of header) {
19884
- if (!utils$1.isArray(entry)) {
19835
+ if (!utils$3.isArray(entry)) {
19885
19836
  throw TypeError('Object iterator must return a key-value pair');
19886
19837
  }
19887
19838
 
19888
19839
  obj[key = entry[0]] = (dest = obj[key]) ?
19889
- (utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]]) : entry[1];
19840
+ (utils$3.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]]) : entry[1];
19890
19841
  }
19891
19842
 
19892
19843
  setHeaders(obj, valueOrRewrite);
@@ -19901,7 +19852,7 @@ let AxiosHeaders$1 = class AxiosHeaders {
19901
19852
  header = normalizeHeader(header);
19902
19853
 
19903
19854
  if (header) {
19904
- const key = utils$1.findKey(this, header);
19855
+ const key = utils$3.findKey(this, header);
19905
19856
 
19906
19857
  if (key) {
19907
19858
  const value = this[key];
@@ -19914,11 +19865,11 @@ let AxiosHeaders$1 = class AxiosHeaders {
19914
19865
  return parseTokens(value);
19915
19866
  }
19916
19867
 
19917
- if (utils$1.isFunction(parser)) {
19868
+ if (utils$3.isFunction(parser)) {
19918
19869
  return parser.call(this, value, key);
19919
19870
  }
19920
19871
 
19921
- if (utils$1.isRegExp(parser)) {
19872
+ if (utils$3.isRegExp(parser)) {
19922
19873
  return parser.exec(value);
19923
19874
  }
19924
19875
 
@@ -19931,7 +19882,7 @@ let AxiosHeaders$1 = class AxiosHeaders {
19931
19882
  header = normalizeHeader(header);
19932
19883
 
19933
19884
  if (header) {
19934
- const key = utils$1.findKey(this, header);
19885
+ const key = utils$3.findKey(this, header);
19935
19886
 
19936
19887
  return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
19937
19888
  }
@@ -19947,7 +19898,7 @@ let AxiosHeaders$1 = class AxiosHeaders {
19947
19898
  _header = normalizeHeader(_header);
19948
19899
 
19949
19900
  if (_header) {
19950
- const key = utils$1.findKey(self, _header);
19901
+ const key = utils$3.findKey(self, _header);
19951
19902
 
19952
19903
  if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
19953
19904
  delete self[key];
@@ -19957,7 +19908,7 @@ let AxiosHeaders$1 = class AxiosHeaders {
19957
19908
  }
19958
19909
  }
19959
19910
 
19960
- if (utils$1.isArray(header)) {
19911
+ if (utils$3.isArray(header)) {
19961
19912
  header.forEach(deleteHeader);
19962
19913
  } else {
19963
19914
  deleteHeader(header);
@@ -19986,8 +19937,8 @@ let AxiosHeaders$1 = class AxiosHeaders {
19986
19937
  const self = this;
19987
19938
  const headers = {};
19988
19939
 
19989
- utils$1.forEach(this, (value, header) => {
19990
- const key = utils$1.findKey(headers, header);
19940
+ utils$3.forEach(this, (value, header) => {
19941
+ const key = utils$3.findKey(headers, header);
19991
19942
 
19992
19943
  if (key) {
19993
19944
  self[key] = normalizeValue(value);
@@ -20016,8 +19967,8 @@ let AxiosHeaders$1 = class AxiosHeaders {
20016
19967
  toJSON(asStrings) {
20017
19968
  const obj = Object.create(null);
20018
19969
 
20019
- utils$1.forEach(this, (value, header) => {
20020
- value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
19970
+ utils$3.forEach(this, (value, header) => {
19971
+ value != null && value !== false && (obj[header] = asStrings && utils$3.isArray(value) ? value.join(', ') : value);
20021
19972
  });
20022
19973
 
20023
19974
  return obj;
@@ -20068,7 +20019,7 @@ let AxiosHeaders$1 = class AxiosHeaders {
20068
20019
  }
20069
20020
  }
20070
20021
 
20071
- utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
20022
+ utils$3.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
20072
20023
 
20073
20024
  return this;
20074
20025
  }
@@ -20077,7 +20028,7 @@ let AxiosHeaders$1 = class AxiosHeaders {
20077
20028
  AxiosHeaders$1.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
20078
20029
 
20079
20030
  // reserved names hotfix
20080
- utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({value}, key) => {
20031
+ utils$3.reduceDescriptors(AxiosHeaders$1.prototype, ({value}, key) => {
20081
20032
  let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
20082
20033
  return {
20083
20034
  get: () => value,
@@ -20087,7 +20038,7 @@ utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({value}, key) => {
20087
20038
  }
20088
20039
  });
20089
20040
 
20090
- utils$1.freezeMethods(AxiosHeaders$1);
20041
+ utils$3.freezeMethods(AxiosHeaders$1);
20091
20042
 
20092
20043
  /**
20093
20044
  * Transform the data for a request or a response
@@ -20103,7 +20054,7 @@ function transformData(fns, response) {
20103
20054
  const headers = AxiosHeaders$1.from(context.headers);
20104
20055
  let data = context.data;
20105
20056
 
20106
- utils$1.forEach(fns, function transform(fn) {
20057
+ utils$3.forEach(fns, function transform(fn) {
20107
20058
  data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
20108
20059
  });
20109
20060
 
@@ -20131,7 +20082,7 @@ function CanceledError$1(message, config, request) {
20131
20082
  this.name = 'CanceledError';
20132
20083
  }
20133
20084
 
20134
- utils$1.inherits(CanceledError$1, AxiosError$1, {
20085
+ utils$3.inherits(CanceledError$1, AxiosError$1, {
20135
20086
  __CANCEL__: true
20136
20087
  });
20137
20088
 
@@ -20298,7 +20249,7 @@ const progressEventDecorator = (total, throttled) => {
20298
20249
  }), throttled[1]];
20299
20250
  };
20300
20251
 
20301
- const asyncDecorator = (fn) => (...args) => utils$1.asap(() => fn(...args));
20252
+ const asyncDecorator = (fn) => (...args) => utils$3.asap(() => fn(...args));
20302
20253
 
20303
20254
  var isURLSameOrigin = platform.hasStandardBrowserEnv ? ((origin, isMSIE) => (url) => {
20304
20255
  url = new URL(url, platform.origin);
@@ -20322,19 +20273,19 @@ var cookies = platform.hasStandardBrowserEnv ?
20322
20273
 
20323
20274
  const cookie = [`${name}=${encodeURIComponent(value)}`];
20324
20275
 
20325
- if (utils$1.isNumber(expires)) {
20276
+ if (utils$3.isNumber(expires)) {
20326
20277
  cookie.push(`expires=${new Date(expires).toUTCString()}`);
20327
20278
  }
20328
- if (utils$1.isString(path)) {
20279
+ if (utils$3.isString(path)) {
20329
20280
  cookie.push(`path=${path}`);
20330
20281
  }
20331
- if (utils$1.isString(domain)) {
20282
+ if (utils$3.isString(domain)) {
20332
20283
  cookie.push(`domain=${domain}`);
20333
20284
  }
20334
20285
  if (secure === true) {
20335
20286
  cookie.push('secure');
20336
20287
  }
20337
- if (utils$1.isString(sameSite)) {
20288
+ if (utils$3.isString(sameSite)) {
20338
20289
  cookie.push(`SameSite=${sameSite}`);
20339
20290
  }
20340
20291
 
@@ -20426,11 +20377,11 @@ function mergeConfig$1(config1, config2) {
20426
20377
  const config = {};
20427
20378
 
20428
20379
  function getMergedValue(target, source, prop, caseless) {
20429
- if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
20430
- return utils$1.merge.call({caseless}, target, source);
20431
- } else if (utils$1.isPlainObject(source)) {
20432
- return utils$1.merge({}, source);
20433
- } else if (utils$1.isArray(source)) {
20380
+ if (utils$3.isPlainObject(target) && utils$3.isPlainObject(source)) {
20381
+ return utils$3.merge.call({caseless}, target, source);
20382
+ } else if (utils$3.isPlainObject(source)) {
20383
+ return utils$3.merge({}, source);
20384
+ } else if (utils$3.isArray(source)) {
20434
20385
  return source.slice();
20435
20386
  }
20436
20387
  return source;
@@ -20438,25 +20389,25 @@ function mergeConfig$1(config1, config2) {
20438
20389
 
20439
20390
  // eslint-disable-next-line consistent-return
20440
20391
  function mergeDeepProperties(a, b, prop, caseless) {
20441
- if (!utils$1.isUndefined(b)) {
20392
+ if (!utils$3.isUndefined(b)) {
20442
20393
  return getMergedValue(a, b, prop, caseless);
20443
- } else if (!utils$1.isUndefined(a)) {
20394
+ } else if (!utils$3.isUndefined(a)) {
20444
20395
  return getMergedValue(undefined, a, prop, caseless);
20445
20396
  }
20446
20397
  }
20447
20398
 
20448
20399
  // eslint-disable-next-line consistent-return
20449
20400
  function valueFromConfig2(a, b) {
20450
- if (!utils$1.isUndefined(b)) {
20401
+ if (!utils$3.isUndefined(b)) {
20451
20402
  return getMergedValue(undefined, b);
20452
20403
  }
20453
20404
  }
20454
20405
 
20455
20406
  // eslint-disable-next-line consistent-return
20456
20407
  function defaultToConfig2(a, b) {
20457
- if (!utils$1.isUndefined(b)) {
20408
+ if (!utils$3.isUndefined(b)) {
20458
20409
  return getMergedValue(undefined, b);
20459
- } else if (!utils$1.isUndefined(a)) {
20410
+ } else if (!utils$3.isUndefined(a)) {
20460
20411
  return getMergedValue(undefined, a);
20461
20412
  }
20462
20413
  }
@@ -20502,10 +20453,10 @@ function mergeConfig$1(config1, config2) {
20502
20453
  headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
20503
20454
  };
20504
20455
 
20505
- utils$1.forEach(Object.keys({...config1, ...config2}), function computeConfigValue(prop) {
20456
+ utils$3.forEach(Object.keys({...config1, ...config2}), function computeConfigValue(prop) {
20506
20457
  const merge = mergeMap[prop] || mergeDeepProperties;
20507
20458
  const configValue = merge(config1[prop], config2[prop], prop);
20508
- (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
20459
+ (utils$3.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
20509
20460
  });
20510
20461
 
20511
20462
  return config;
@@ -20527,10 +20478,10 @@ var resolveConfig = (config) => {
20527
20478
  );
20528
20479
  }
20529
20480
 
20530
- if (utils$1.isFormData(data)) {
20481
+ if (utils$3.isFormData(data)) {
20531
20482
  if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
20532
20483
  headers.setContentType(undefined); // browser handles it
20533
- } else if (utils$1.isFunction(data.getHeaders)) {
20484
+ } else if (utils$3.isFunction(data.getHeaders)) {
20534
20485
  // Node.js FormData (like form-data package)
20535
20486
  const formHeaders = data.getHeaders();
20536
20487
  // Only set safe headers to avoid overwriting security headers
@@ -20548,7 +20499,7 @@ var resolveConfig = (config) => {
20548
20499
  // Specifically not if we're in a web worker, or react-native.
20549
20500
 
20550
20501
  if (platform.hasStandardBrowserEnv) {
20551
- withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
20502
+ withXSRFToken && utils$3.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
20552
20503
 
20553
20504
  if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) {
20554
20505
  // Add xsrf header
@@ -20692,13 +20643,13 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
20692
20643
 
20693
20644
  // Add headers to the request
20694
20645
  if ('setRequestHeader' in request) {
20695
- utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
20646
+ utils$3.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
20696
20647
  request.setRequestHeader(key, val);
20697
20648
  });
20698
20649
  }
20699
20650
 
20700
20651
  // Add withCredentials to request if needed
20701
- if (!utils$1.isUndefined(_config.withCredentials)) {
20652
+ if (!utils$3.isUndefined(_config.withCredentials)) {
20702
20653
  request.withCredentials = !!_config.withCredentials;
20703
20654
  }
20704
20655
 
@@ -20790,7 +20741,7 @@ const composeSignals = (signals, timeout) => {
20790
20741
 
20791
20742
  const {signal} = controller;
20792
20743
 
20793
- signal.unsubscribe = () => utils$1.asap(unsubscribe);
20744
+ signal.unsubscribe = () => utils$3.asap(unsubscribe);
20794
20745
 
20795
20746
  return signal;
20796
20747
  }
@@ -20885,15 +20836,15 @@ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
20885
20836
 
20886
20837
  const DEFAULT_CHUNK_SIZE = 64 * 1024;
20887
20838
 
20888
- const {isFunction} = utils$1;
20839
+ const {isFunction} = utils$3;
20889
20840
 
20890
20841
  const globalFetchAPI = (({Request, Response}) => ({
20891
20842
  Request, Response
20892
- }))(utils$1.global);
20843
+ }))(utils$3.global);
20893
20844
 
20894
20845
  const {
20895
20846
  ReadableStream: ReadableStream$1, TextEncoder: TextEncoder$1
20896
- } = utils$1.global;
20847
+ } = utils$3.global;
20897
20848
 
20898
20849
 
20899
20850
  const test = (fn, ...args) => {
@@ -20905,7 +20856,7 @@ const test = (fn, ...args) => {
20905
20856
  };
20906
20857
 
20907
20858
  const factory = (env) => {
20908
- env = utils$1.merge.call({
20859
+ env = utils$3.merge.call({
20909
20860
  skipUndefined: true
20910
20861
  }, globalFetchAPI, env);
20911
20862
 
@@ -20941,7 +20892,7 @@ const factory = (env) => {
20941
20892
  });
20942
20893
 
20943
20894
  const supportsResponseStream = isResponseSupported && isReadableStreamSupported &&
20944
- test(() => utils$1.isReadableStream(new Response('').body));
20895
+ test(() => utils$3.isReadableStream(new Response('').body));
20945
20896
 
20946
20897
  const resolvers = {
20947
20898
  stream: supportsResponseStream && ((res) => res.body)
@@ -20966,11 +20917,11 @@ const factory = (env) => {
20966
20917
  return 0;
20967
20918
  }
20968
20919
 
20969
- if (utils$1.isBlob(body)) {
20920
+ if (utils$3.isBlob(body)) {
20970
20921
  return body.size;
20971
20922
  }
20972
20923
 
20973
- if (utils$1.isSpecCompliantForm(body)) {
20924
+ if (utils$3.isSpecCompliantForm(body)) {
20974
20925
  const _request = new Request(platform.origin, {
20975
20926
  method: 'POST',
20976
20927
  body,
@@ -20978,21 +20929,21 @@ const factory = (env) => {
20978
20929
  return (await _request.arrayBuffer()).byteLength;
20979
20930
  }
20980
20931
 
20981
- if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
20932
+ if (utils$3.isArrayBufferView(body) || utils$3.isArrayBuffer(body)) {
20982
20933
  return body.byteLength;
20983
20934
  }
20984
20935
 
20985
- if (utils$1.isURLSearchParams(body)) {
20936
+ if (utils$3.isURLSearchParams(body)) {
20986
20937
  body = body + '';
20987
20938
  }
20988
20939
 
20989
- if (utils$1.isString(body)) {
20940
+ if (utils$3.isString(body)) {
20990
20941
  return (await encodeText(body)).byteLength;
20991
20942
  }
20992
20943
  };
20993
20944
 
20994
20945
  const resolveBodyLength = async (headers, body) => {
20995
- const length = utils$1.toFiniteNumber(headers.getContentLength());
20946
+ const length = utils$3.toFiniteNumber(headers.getContentLength());
20996
20947
 
20997
20948
  return length == null ? getBodyLength(body) : length;
20998
20949
  };
@@ -21040,7 +20991,7 @@ const factory = (env) => {
21040
20991
 
21041
20992
  let contentTypeHeader;
21042
20993
 
21043
- if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
20994
+ if (utils$3.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
21044
20995
  headers.setContentType(contentTypeHeader);
21045
20996
  }
21046
20997
 
@@ -21054,7 +21005,7 @@ const factory = (env) => {
21054
21005
  }
21055
21006
  }
21056
21007
 
21057
- if (!utils$1.isString(withCredentials)) {
21008
+ if (!utils$3.isString(withCredentials)) {
21058
21009
  withCredentials = withCredentials ? 'include' : 'omit';
21059
21010
  }
21060
21011
 
@@ -21085,7 +21036,7 @@ const factory = (env) => {
21085
21036
  options[prop] = response[prop];
21086
21037
  });
21087
21038
 
21088
- const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
21039
+ const responseContentLength = utils$3.toFiniteNumber(response.headers.get('content-length'));
21089
21040
 
21090
21041
  const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
21091
21042
  responseContentLength,
@@ -21103,7 +21054,7 @@ const factory = (env) => {
21103
21054
 
21104
21055
  responseType = responseType || 'text';
21105
21056
 
21106
- let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
21057
+ let responseData = await resolvers[utils$3.findKey(resolvers, responseType) || 'text'](response, config);
21107
21058
 
21108
21059
  !isStreamResponse && unsubscribe && unsubscribe();
21109
21060
 
@@ -21178,7 +21129,7 @@ const knownAdapters = {
21178
21129
  };
21179
21130
 
21180
21131
  // Assign adapter names for easier debugging and identification
21181
- utils$1.forEach(knownAdapters, (fn, value) => {
21132
+ utils$3.forEach(knownAdapters, (fn, value) => {
21182
21133
  if (fn) {
21183
21134
  try {
21184
21135
  Object.defineProperty(fn, 'name', { value });
@@ -21203,7 +21154,7 @@ const renderReason = (reason) => `- ${reason}`;
21203
21154
  * @param {Function|null|false} adapter
21204
21155
  * @returns {boolean}
21205
21156
  */
21206
- const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
21157
+ const isResolvedHandle = (adapter) => utils$3.isFunction(adapter) || adapter === null || adapter === false;
21207
21158
 
21208
21159
  /**
21209
21160
  * Get the first suitable adapter from the provided list.
@@ -21216,7 +21167,7 @@ const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter ===
21216
21167
  * @returns {Function} The resolved adapter function
21217
21168
  */
21218
21169
  function getAdapter$1(adapters, config) {
21219
- adapters = utils$1.isArray(adapters) ? adapters : [adapters];
21170
+ adapters = utils$3.isArray(adapters) ? adapters : [adapters];
21220
21171
 
21221
21172
  const { length } = adapters;
21222
21173
  let nameOrAdapter;
@@ -21238,7 +21189,7 @@ function getAdapter$1(adapters, config) {
21238
21189
  }
21239
21190
  }
21240
21191
 
21241
- if (adapter && (utils$1.isFunction(adapter) || (adapter = adapter.get(config)))) {
21192
+ if (adapter && (utils$3.isFunction(adapter) || (adapter = adapter.get(config)))) {
21242
21193
  break;
21243
21194
  }
21244
21195
 
@@ -21527,7 +21478,7 @@ let Axios$1 = class Axios {
21527
21478
  }
21528
21479
 
21529
21480
  if (paramsSerializer != null) {
21530
- if (utils$1.isFunction(paramsSerializer)) {
21481
+ if (utils$3.isFunction(paramsSerializer)) {
21531
21482
  config.paramsSerializer = {
21532
21483
  serialize: paramsSerializer
21533
21484
  };
@@ -21555,12 +21506,12 @@ let Axios$1 = class Axios {
21555
21506
  config.method = (config.method || this.defaults.method || 'get').toLowerCase();
21556
21507
 
21557
21508
  // Flatten headers
21558
- let contextHeaders = headers && utils$1.merge(
21509
+ let contextHeaders = headers && utils$3.merge(
21559
21510
  headers.common,
21560
21511
  headers[config.method]
21561
21512
  );
21562
21513
 
21563
- headers && utils$1.forEach(
21514
+ headers && utils$3.forEach(
21564
21515
  ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
21565
21516
  (method) => {
21566
21517
  delete headers[method];
@@ -21645,7 +21596,7 @@ let Axios$1 = class Axios {
21645
21596
  };
21646
21597
 
21647
21598
  // Provide aliases for supported request methods
21648
- utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
21599
+ utils$3.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
21649
21600
  /*eslint func-names:0*/
21650
21601
  Axios$1.prototype[method] = function(url, config) {
21651
21602
  return this.request(mergeConfig$1(config || {}, {
@@ -21656,7 +21607,7 @@ utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoDa
21656
21607
  };
21657
21608
  });
21658
21609
 
21659
- utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
21610
+ utils$3.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
21660
21611
  /*eslint func-names:0*/
21661
21612
 
21662
21613
  function generateHTTPMethod(isForm) {
@@ -21842,7 +21793,7 @@ function spread$1(callback) {
21842
21793
  * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
21843
21794
  */
21844
21795
  function isAxiosError$1(payload) {
21845
- return utils$1.isObject(payload) && (payload.isAxiosError === true);
21796
+ return utils$3.isObject(payload) && (payload.isAxiosError === true);
21846
21797
  }
21847
21798
 
21848
21799
  const HttpStatusCode$1 = {
@@ -21933,10 +21884,10 @@ function createInstance(defaultConfig) {
21933
21884
  const instance = bind(Axios$1.prototype.request, context);
21934
21885
 
21935
21886
  // Copy axios.prototype to instance
21936
- utils$1.extend(instance, Axios$1.prototype, context, {allOwnKeys: true});
21887
+ utils$3.extend(instance, Axios$1.prototype, context, {allOwnKeys: true});
21937
21888
 
21938
21889
  // Copy context to instance
21939
- utils$1.extend(instance, context, null, {allOwnKeys: true});
21890
+ utils$3.extend(instance, context, null, {allOwnKeys: true});
21940
21891
 
21941
21892
  // Factory for creating new instances
21942
21893
  instance.create = function create(instanceConfig) {
@@ -21980,7 +21931,7 @@ axios.mergeConfig = mergeConfig$1;
21980
21931
 
21981
21932
  axios.AxiosHeaders = AxiosHeaders$1;
21982
21933
 
21983
- axios.formToJSON = thing => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
21934
+ axios.formToJSON = thing => formDataToJSON(utils$3.isHTMLForm(thing) ? new FormData(thing) : thing);
21984
21935
 
21985
21936
  axios.getAdapter = adapters.getAdapter;
21986
21937
 
@@ -44166,7 +44117,7 @@ var formProps = {
44166
44117
  }
44167
44118
  };
44168
44119
 
44169
- var qrcode = {
44120
+ var qrcode$1 = {
44170
44121
  formData: {
44171
44122
  code_url: '',
44172
44123
  amount: 0,
@@ -44185,7 +44136,7 @@ function init(_ref) {
44185
44136
  let {
44186
44137
  scopeThis
44187
44138
  } = _ref;
44188
- ly0request$1.ly0.storpro({
44139
+ ly0request$1.storpro({
44189
44140
  storproName: 'ly0d2.record0.getPgData',
44190
44141
  data: null
44191
44142
  }).then(result => {
@@ -44202,7 +44153,7 @@ function submit(_ref2) {
44202
44153
  } = _ref2;
44203
44154
  if (scopeThis.formData.process_code === "0") {
44204
44155
  //系统外流转
44205
- ly0request$1.ly0.storpro({
44156
+ ly0request$1.storpro({
44206
44157
  storproName: "ly0d2.wxzf.cash",
44207
44158
  data: {
44208
44159
  id_business: scopeThis.formData.id_business,
@@ -44223,7 +44174,7 @@ function submit(_ref2) {
44223
44174
  });
44224
44175
  } else if (scopeThis.formData.process_code === "wxzf0") {
44225
44176
  // 微信支付.客户付款码付款
44226
- ly0request$1.ly0.storpro({
44177
+ ly0request$1.storpro({
44227
44178
  storproName: "ly0d2.wxzf.wxzf0",
44228
44179
  data: {
44229
44180
  id_business: scopeThis.formData.id_business,
@@ -44249,7 +44200,7 @@ function submit(_ref2) {
44249
44200
  });
44250
44201
  } else if (scopeThis.formData.process_code === "wxzf2") {
44251
44202
  // 微信支付.商户二维码收款
44252
- ly0request$1.ly0.storpro({
44203
+ ly0request$1.storpro({
44253
44204
  storproName: "ly0d2.wxzf.wxzf2",
44254
44205
  data: {
44255
44206
  id_business: scopeThis.formData.id_business,
@@ -44293,46 +44244,3127 @@ var handles$1 = {
44293
44244
  submit
44294
44245
  };
44295
44246
 
44296
- var require$$0 = /*@__PURE__*/getAugmentedNamespace(qrcodejs2__namespace);
44247
+ var browser = {};
44248
+
44249
+ var canPromise;
44250
+ var hasRequiredCanPromise;
44251
+
44252
+ function requireCanPromise () {
44253
+ if (hasRequiredCanPromise) return canPromise;
44254
+ hasRequiredCanPromise = 1;
44255
+ // can-promise has a crash in some versions of react native that dont have
44256
+ // standard global objects
44257
+ // https://github.com/soldair/node-qrcode/issues/157
44258
+
44259
+ canPromise = function () {
44260
+ return typeof Promise === 'function' && Promise.prototype && Promise.prototype.then
44261
+ };
44262
+ return canPromise;
44263
+ }
44264
+
44265
+ var qrcode = {};
44266
+
44267
+ var utils$1 = {};
44268
+
44269
+ var hasRequiredUtils$1;
44270
+
44271
+ function requireUtils$1 () {
44272
+ if (hasRequiredUtils$1) return utils$1;
44273
+ hasRequiredUtils$1 = 1;
44274
+ let toSJISFunction;
44275
+ const CODEWORDS_COUNT = [
44276
+ 0, // Not used
44277
+ 26, 44, 70, 100, 134, 172, 196, 242, 292, 346,
44278
+ 404, 466, 532, 581, 655, 733, 815, 901, 991, 1085,
44279
+ 1156, 1258, 1364, 1474, 1588, 1706, 1828, 1921, 2051, 2185,
44280
+ 2323, 2465, 2611, 2761, 2876, 3034, 3196, 3362, 3532, 3706
44281
+ ];
44282
+
44283
+ /**
44284
+ * Returns the QR Code size for the specified version
44285
+ *
44286
+ * @param {Number} version QR Code version
44287
+ * @return {Number} size of QR code
44288
+ */
44289
+ utils$1.getSymbolSize = function getSymbolSize (version) {
44290
+ if (!version) throw new Error('"version" cannot be null or undefined')
44291
+ if (version < 1 || version > 40) throw new Error('"version" should be in range from 1 to 40')
44292
+ return version * 4 + 17
44293
+ };
44294
+
44295
+ /**
44296
+ * Returns the total number of codewords used to store data and EC information.
44297
+ *
44298
+ * @param {Number} version QR Code version
44299
+ * @return {Number} Data length in bits
44300
+ */
44301
+ utils$1.getSymbolTotalCodewords = function getSymbolTotalCodewords (version) {
44302
+ return CODEWORDS_COUNT[version]
44303
+ };
44304
+
44305
+ /**
44306
+ * Encode data with Bose-Chaudhuri-Hocquenghem
44307
+ *
44308
+ * @param {Number} data Value to encode
44309
+ * @return {Number} Encoded value
44310
+ */
44311
+ utils$1.getBCHDigit = function (data) {
44312
+ let digit = 0;
44313
+
44314
+ while (data !== 0) {
44315
+ digit++;
44316
+ data >>>= 1;
44317
+ }
44318
+
44319
+ return digit
44320
+ };
44321
+
44322
+ utils$1.setToSJISFunction = function setToSJISFunction (f) {
44323
+ if (typeof f !== 'function') {
44324
+ throw new Error('"toSJISFunc" is not a valid function.')
44325
+ }
44326
+
44327
+ toSJISFunction = f;
44328
+ };
44329
+
44330
+ utils$1.isKanjiModeEnabled = function () {
44331
+ return typeof toSJISFunction !== 'undefined'
44332
+ };
44333
+
44334
+ utils$1.toSJIS = function toSJIS (kanji) {
44335
+ return toSJISFunction(kanji)
44336
+ };
44337
+ return utils$1;
44338
+ }
44339
+
44340
+ var errorCorrectionLevel = {};
44341
+
44342
+ var hasRequiredErrorCorrectionLevel;
44343
+
44344
+ function requireErrorCorrectionLevel () {
44345
+ if (hasRequiredErrorCorrectionLevel) return errorCorrectionLevel;
44346
+ hasRequiredErrorCorrectionLevel = 1;
44347
+ (function (exports$1) {
44348
+ exports$1.L = { bit: 1 };
44349
+ exports$1.M = { bit: 0 };
44350
+ exports$1.Q = { bit: 3 };
44351
+ exports$1.H = { bit: 2 };
44352
+
44353
+ function fromString (string) {
44354
+ if (typeof string !== 'string') {
44355
+ throw new Error('Param is not a string')
44356
+ }
44357
+
44358
+ const lcStr = string.toLowerCase();
44359
+
44360
+ switch (lcStr) {
44361
+ case 'l':
44362
+ case 'low':
44363
+ return exports$1.L
44364
+
44365
+ case 'm':
44366
+ case 'medium':
44367
+ return exports$1.M
44368
+
44369
+ case 'q':
44370
+ case 'quartile':
44371
+ return exports$1.Q
44372
+
44373
+ case 'h':
44374
+ case 'high':
44375
+ return exports$1.H
44376
+
44377
+ default:
44378
+ throw new Error('Unknown EC Level: ' + string)
44379
+ }
44380
+ }
44381
+
44382
+ exports$1.isValid = function isValid (level) {
44383
+ return level && typeof level.bit !== 'undefined' &&
44384
+ level.bit >= 0 && level.bit < 4
44385
+ };
44386
+
44387
+ exports$1.from = function from (value, defaultValue) {
44388
+ if (exports$1.isValid(value)) {
44389
+ return value
44390
+ }
44391
+
44392
+ try {
44393
+ return fromString(value)
44394
+ } catch (e) {
44395
+ return defaultValue
44396
+ }
44397
+ };
44398
+ } (errorCorrectionLevel));
44399
+ return errorCorrectionLevel;
44400
+ }
44401
+
44402
+ var bitBuffer;
44403
+ var hasRequiredBitBuffer;
44404
+
44405
+ function requireBitBuffer () {
44406
+ if (hasRequiredBitBuffer) return bitBuffer;
44407
+ hasRequiredBitBuffer = 1;
44408
+ function BitBuffer () {
44409
+ this.buffer = [];
44410
+ this.length = 0;
44411
+ }
44412
+
44413
+ BitBuffer.prototype = {
44414
+
44415
+ get: function (index) {
44416
+ const bufIndex = Math.floor(index / 8);
44417
+ return ((this.buffer[bufIndex] >>> (7 - index % 8)) & 1) === 1
44418
+ },
44419
+
44420
+ put: function (num, length) {
44421
+ for (let i = 0; i < length; i++) {
44422
+ this.putBit(((num >>> (length - i - 1)) & 1) === 1);
44423
+ }
44424
+ },
44425
+
44426
+ getLengthInBits: function () {
44427
+ return this.length
44428
+ },
44429
+
44430
+ putBit: function (bit) {
44431
+ const bufIndex = Math.floor(this.length / 8);
44432
+ if (this.buffer.length <= bufIndex) {
44433
+ this.buffer.push(0);
44434
+ }
44435
+
44436
+ if (bit) {
44437
+ this.buffer[bufIndex] |= (0x80 >>> (this.length % 8));
44438
+ }
44439
+
44440
+ this.length++;
44441
+ }
44442
+ };
44443
+
44444
+ bitBuffer = BitBuffer;
44445
+ return bitBuffer;
44446
+ }
44447
+
44448
+ /**
44449
+ * Helper class to handle QR Code symbol modules
44450
+ *
44451
+ * @param {Number} size Symbol size
44452
+ */
44453
+
44454
+ var bitMatrix;
44455
+ var hasRequiredBitMatrix;
44456
+
44457
+ function requireBitMatrix () {
44458
+ if (hasRequiredBitMatrix) return bitMatrix;
44459
+ hasRequiredBitMatrix = 1;
44460
+ function BitMatrix (size) {
44461
+ if (!size || size < 1) {
44462
+ throw new Error('BitMatrix size must be defined and greater than 0')
44463
+ }
44464
+
44465
+ this.size = size;
44466
+ this.data = new Uint8Array(size * size);
44467
+ this.reservedBit = new Uint8Array(size * size);
44468
+ }
44469
+
44470
+ /**
44471
+ * Set bit value at specified location
44472
+ * If reserved flag is set, this bit will be ignored during masking process
44473
+ *
44474
+ * @param {Number} row
44475
+ * @param {Number} col
44476
+ * @param {Boolean} value
44477
+ * @param {Boolean} reserved
44478
+ */
44479
+ BitMatrix.prototype.set = function (row, col, value, reserved) {
44480
+ const index = row * this.size + col;
44481
+ this.data[index] = value;
44482
+ if (reserved) this.reservedBit[index] = true;
44483
+ };
44484
+
44485
+ /**
44486
+ * Returns bit value at specified location
44487
+ *
44488
+ * @param {Number} row
44489
+ * @param {Number} col
44490
+ * @return {Boolean}
44491
+ */
44492
+ BitMatrix.prototype.get = function (row, col) {
44493
+ return this.data[row * this.size + col]
44494
+ };
44495
+
44496
+ /**
44497
+ * Applies xor operator at specified location
44498
+ * (used during masking process)
44499
+ *
44500
+ * @param {Number} row
44501
+ * @param {Number} col
44502
+ * @param {Boolean} value
44503
+ */
44504
+ BitMatrix.prototype.xor = function (row, col, value) {
44505
+ this.data[row * this.size + col] ^= value;
44506
+ };
44507
+
44508
+ /**
44509
+ * Check if bit at specified location is reserved
44510
+ *
44511
+ * @param {Number} row
44512
+ * @param {Number} col
44513
+ * @return {Boolean}
44514
+ */
44515
+ BitMatrix.prototype.isReserved = function (row, col) {
44516
+ return this.reservedBit[row * this.size + col]
44517
+ };
44518
+
44519
+ bitMatrix = BitMatrix;
44520
+ return bitMatrix;
44521
+ }
44522
+
44523
+ var alignmentPattern = {};
44524
+
44525
+ /**
44526
+ * Alignment pattern are fixed reference pattern in defined positions
44527
+ * in a matrix symbology, which enables the decode software to re-synchronise
44528
+ * the coordinate mapping of the image modules in the event of moderate amounts
44529
+ * of distortion of the image.
44530
+ *
44531
+ * Alignment patterns are present only in QR Code symbols of version 2 or larger
44532
+ * and their number depends on the symbol version.
44533
+ */
44534
+
44535
+ var hasRequiredAlignmentPattern;
44536
+
44537
+ function requireAlignmentPattern () {
44538
+ if (hasRequiredAlignmentPattern) return alignmentPattern;
44539
+ hasRequiredAlignmentPattern = 1;
44540
+ (function (exports$1) {
44541
+ const getSymbolSize = requireUtils$1().getSymbolSize;
44542
+
44543
+ /**
44544
+ * Calculate the row/column coordinates of the center module of each alignment pattern
44545
+ * for the specified QR Code version.
44546
+ *
44547
+ * The alignment patterns are positioned symmetrically on either side of the diagonal
44548
+ * running from the top left corner of the symbol to the bottom right corner.
44549
+ *
44550
+ * Since positions are simmetrical only half of the coordinates are returned.
44551
+ * Each item of the array will represent in turn the x and y coordinate.
44552
+ * @see {@link getPositions}
44553
+ *
44554
+ * @param {Number} version QR Code version
44555
+ * @return {Array} Array of coordinate
44556
+ */
44557
+ exports$1.getRowColCoords = function getRowColCoords (version) {
44558
+ if (version === 1) return []
44559
+
44560
+ const posCount = Math.floor(version / 7) + 2;
44561
+ const size = getSymbolSize(version);
44562
+ const intervals = size === 145 ? 26 : Math.ceil((size - 13) / (2 * posCount - 2)) * 2;
44563
+ const positions = [size - 7]; // Last coord is always (size - 7)
44564
+
44565
+ for (let i = 1; i < posCount - 1; i++) {
44566
+ positions[i] = positions[i - 1] - intervals;
44567
+ }
44568
+
44569
+ positions.push(6); // First coord is always 6
44570
+
44571
+ return positions.reverse()
44572
+ };
44573
+
44574
+ /**
44575
+ * Returns an array containing the positions of each alignment pattern.
44576
+ * Each array's element represent the center point of the pattern as (x, y) coordinates
44577
+ *
44578
+ * Coordinates are calculated expanding the row/column coordinates returned by {@link getRowColCoords}
44579
+ * and filtering out the items that overlaps with finder pattern
44580
+ *
44581
+ * @example
44582
+ * For a Version 7 symbol {@link getRowColCoords} returns values 6, 22 and 38.
44583
+ * The alignment patterns, therefore, are to be centered on (row, column)
44584
+ * positions (6,22), (22,6), (22,22), (22,38), (38,22), (38,38).
44585
+ * Note that the coordinates (6,6), (6,38), (38,6) are occupied by finder patterns
44586
+ * and are not therefore used for alignment patterns.
44587
+ *
44588
+ * let pos = getPositions(7)
44589
+ * // [[6,22], [22,6], [22,22], [22,38], [38,22], [38,38]]
44590
+ *
44591
+ * @param {Number} version QR Code version
44592
+ * @return {Array} Array of coordinates
44593
+ */
44594
+ exports$1.getPositions = function getPositions (version) {
44595
+ const coords = [];
44596
+ const pos = exports$1.getRowColCoords(version);
44597
+ const posLength = pos.length;
44598
+
44599
+ for (let i = 0; i < posLength; i++) {
44600
+ for (let j = 0; j < posLength; j++) {
44601
+ // Skip if position is occupied by finder patterns
44602
+ if ((i === 0 && j === 0) || // top-left
44603
+ (i === 0 && j === posLength - 1) || // bottom-left
44604
+ (i === posLength - 1 && j === 0)) { // top-right
44605
+ continue
44606
+ }
44607
+
44608
+ coords.push([pos[i], pos[j]]);
44609
+ }
44610
+ }
44611
+
44612
+ return coords
44613
+ };
44614
+ } (alignmentPattern));
44615
+ return alignmentPattern;
44616
+ }
44617
+
44618
+ var finderPattern = {};
44619
+
44620
+ var hasRequiredFinderPattern;
44621
+
44622
+ function requireFinderPattern () {
44623
+ if (hasRequiredFinderPattern) return finderPattern;
44624
+ hasRequiredFinderPattern = 1;
44625
+ const getSymbolSize = requireUtils$1().getSymbolSize;
44626
+ const FINDER_PATTERN_SIZE = 7;
44627
+
44628
+ /**
44629
+ * Returns an array containing the positions of each finder pattern.
44630
+ * Each array's element represent the top-left point of the pattern as (x, y) coordinates
44631
+ *
44632
+ * @param {Number} version QR Code version
44633
+ * @return {Array} Array of coordinates
44634
+ */
44635
+ finderPattern.getPositions = function getPositions (version) {
44636
+ const size = getSymbolSize(version);
44637
+
44638
+ return [
44639
+ // top-left
44640
+ [0, 0],
44641
+ // top-right
44642
+ [size - FINDER_PATTERN_SIZE, 0],
44643
+ // bottom-left
44644
+ [0, size - FINDER_PATTERN_SIZE]
44645
+ ]
44646
+ };
44647
+ return finderPattern;
44648
+ }
44649
+
44650
+ var maskPattern = {};
44651
+
44652
+ /**
44653
+ * Data mask pattern reference
44654
+ * @type {Object}
44655
+ */
44656
+
44657
+ var hasRequiredMaskPattern;
44658
+
44659
+ function requireMaskPattern () {
44660
+ if (hasRequiredMaskPattern) return maskPattern;
44661
+ hasRequiredMaskPattern = 1;
44662
+ (function (exports$1) {
44663
+ exports$1.Patterns = {
44664
+ PATTERN000: 0,
44665
+ PATTERN001: 1,
44666
+ PATTERN010: 2,
44667
+ PATTERN011: 3,
44668
+ PATTERN100: 4,
44669
+ PATTERN101: 5,
44670
+ PATTERN110: 6,
44671
+ PATTERN111: 7
44672
+ };
44673
+
44674
+ /**
44675
+ * Weighted penalty scores for the undesirable features
44676
+ * @type {Object}
44677
+ */
44678
+ const PenaltyScores = {
44679
+ N1: 3,
44680
+ N2: 3,
44681
+ N3: 40,
44682
+ N4: 10
44683
+ };
44684
+
44685
+ /**
44686
+ * Check if mask pattern value is valid
44687
+ *
44688
+ * @param {Number} mask Mask pattern
44689
+ * @return {Boolean} true if valid, false otherwise
44690
+ */
44691
+ exports$1.isValid = function isValid (mask) {
44692
+ return mask != null && mask !== '' && !isNaN(mask) && mask >= 0 && mask <= 7
44693
+ };
44694
+
44695
+ /**
44696
+ * Returns mask pattern from a value.
44697
+ * If value is not valid, returns undefined
44698
+ *
44699
+ * @param {Number|String} value Mask pattern value
44700
+ * @return {Number} Valid mask pattern or undefined
44701
+ */
44702
+ exports$1.from = function from (value) {
44703
+ return exports$1.isValid(value) ? parseInt(value, 10) : undefined
44704
+ };
44705
+
44706
+ /**
44707
+ * Find adjacent modules in row/column with the same color
44708
+ * and assign a penalty value.
44709
+ *
44710
+ * Points: N1 + i
44711
+ * i is the amount by which the number of adjacent modules of the same color exceeds 5
44712
+ */
44713
+ exports$1.getPenaltyN1 = function getPenaltyN1 (data) {
44714
+ const size = data.size;
44715
+ let points = 0;
44716
+ let sameCountCol = 0;
44717
+ let sameCountRow = 0;
44718
+ let lastCol = null;
44719
+ let lastRow = null;
44720
+
44721
+ for (let row = 0; row < size; row++) {
44722
+ sameCountCol = sameCountRow = 0;
44723
+ lastCol = lastRow = null;
44724
+
44725
+ for (let col = 0; col < size; col++) {
44726
+ let module = data.get(row, col);
44727
+ if (module === lastCol) {
44728
+ sameCountCol++;
44729
+ } else {
44730
+ if (sameCountCol >= 5) points += PenaltyScores.N1 + (sameCountCol - 5);
44731
+ lastCol = module;
44732
+ sameCountCol = 1;
44733
+ }
44734
+
44735
+ module = data.get(col, row);
44736
+ if (module === lastRow) {
44737
+ sameCountRow++;
44738
+ } else {
44739
+ if (sameCountRow >= 5) points += PenaltyScores.N1 + (sameCountRow - 5);
44740
+ lastRow = module;
44741
+ sameCountRow = 1;
44742
+ }
44743
+ }
44744
+
44745
+ if (sameCountCol >= 5) points += PenaltyScores.N1 + (sameCountCol - 5);
44746
+ if (sameCountRow >= 5) points += PenaltyScores.N1 + (sameCountRow - 5);
44747
+ }
44748
+
44749
+ return points
44750
+ };
44751
+
44752
+ /**
44753
+ * Find 2x2 blocks with the same color and assign a penalty value
44754
+ *
44755
+ * Points: N2 * (m - 1) * (n - 1)
44756
+ */
44757
+ exports$1.getPenaltyN2 = function getPenaltyN2 (data) {
44758
+ const size = data.size;
44759
+ let points = 0;
44760
+
44761
+ for (let row = 0; row < size - 1; row++) {
44762
+ for (let col = 0; col < size - 1; col++) {
44763
+ const last = data.get(row, col) +
44764
+ data.get(row, col + 1) +
44765
+ data.get(row + 1, col) +
44766
+ data.get(row + 1, col + 1);
44767
+
44768
+ if (last === 4 || last === 0) points++;
44769
+ }
44770
+ }
44771
+
44772
+ return points * PenaltyScores.N2
44773
+ };
44774
+
44775
+ /**
44776
+ * Find 1:1:3:1:1 ratio (dark:light:dark:light:dark) pattern in row/column,
44777
+ * preceded or followed by light area 4 modules wide
44778
+ *
44779
+ * Points: N3 * number of pattern found
44780
+ */
44781
+ exports$1.getPenaltyN3 = function getPenaltyN3 (data) {
44782
+ const size = data.size;
44783
+ let points = 0;
44784
+ let bitsCol = 0;
44785
+ let bitsRow = 0;
44786
+
44787
+ for (let row = 0; row < size; row++) {
44788
+ bitsCol = bitsRow = 0;
44789
+ for (let col = 0; col < size; col++) {
44790
+ bitsCol = ((bitsCol << 1) & 0x7FF) | data.get(row, col);
44791
+ if (col >= 10 && (bitsCol === 0x5D0 || bitsCol === 0x05D)) points++;
44792
+
44793
+ bitsRow = ((bitsRow << 1) & 0x7FF) | data.get(col, row);
44794
+ if (col >= 10 && (bitsRow === 0x5D0 || bitsRow === 0x05D)) points++;
44795
+ }
44796
+ }
44797
+
44798
+ return points * PenaltyScores.N3
44799
+ };
44800
+
44801
+ /**
44802
+ * Calculate proportion of dark modules in entire symbol
44803
+ *
44804
+ * Points: N4 * k
44805
+ *
44806
+ * k is the rating of the deviation of the proportion of dark modules
44807
+ * in the symbol from 50% in steps of 5%
44808
+ */
44809
+ exports$1.getPenaltyN4 = function getPenaltyN4 (data) {
44810
+ let darkCount = 0;
44811
+ const modulesCount = data.data.length;
44812
+
44813
+ for (let i = 0; i < modulesCount; i++) darkCount += data.data[i];
44814
+
44815
+ const k = Math.abs(Math.ceil((darkCount * 100 / modulesCount) / 5) - 10);
44816
+
44817
+ return k * PenaltyScores.N4
44818
+ };
44819
+
44820
+ /**
44821
+ * Return mask value at given position
44822
+ *
44823
+ * @param {Number} maskPattern Pattern reference value
44824
+ * @param {Number} i Row
44825
+ * @param {Number} j Column
44826
+ * @return {Boolean} Mask value
44827
+ */
44828
+ function getMaskAt (maskPattern, i, j) {
44829
+ switch (maskPattern) {
44830
+ case exports$1.Patterns.PATTERN000: return (i + j) % 2 === 0
44831
+ case exports$1.Patterns.PATTERN001: return i % 2 === 0
44832
+ case exports$1.Patterns.PATTERN010: return j % 3 === 0
44833
+ case exports$1.Patterns.PATTERN011: return (i + j) % 3 === 0
44834
+ case exports$1.Patterns.PATTERN100: return (Math.floor(i / 2) + Math.floor(j / 3)) % 2 === 0
44835
+ case exports$1.Patterns.PATTERN101: return (i * j) % 2 + (i * j) % 3 === 0
44836
+ case exports$1.Patterns.PATTERN110: return ((i * j) % 2 + (i * j) % 3) % 2 === 0
44837
+ case exports$1.Patterns.PATTERN111: return ((i * j) % 3 + (i + j) % 2) % 2 === 0
44838
+
44839
+ default: throw new Error('bad maskPattern:' + maskPattern)
44840
+ }
44841
+ }
44842
+
44843
+ /**
44844
+ * Apply a mask pattern to a BitMatrix
44845
+ *
44846
+ * @param {Number} pattern Pattern reference number
44847
+ * @param {BitMatrix} data BitMatrix data
44848
+ */
44849
+ exports$1.applyMask = function applyMask (pattern, data) {
44850
+ const size = data.size;
44851
+
44852
+ for (let col = 0; col < size; col++) {
44853
+ for (let row = 0; row < size; row++) {
44854
+ if (data.isReserved(row, col)) continue
44855
+ data.xor(row, col, getMaskAt(pattern, row, col));
44856
+ }
44857
+ }
44858
+ };
44859
+
44860
+ /**
44861
+ * Returns the best mask pattern for data
44862
+ *
44863
+ * @param {BitMatrix} data
44864
+ * @return {Number} Mask pattern reference number
44865
+ */
44866
+ exports$1.getBestMask = function getBestMask (data, setupFormatFunc) {
44867
+ const numPatterns = Object.keys(exports$1.Patterns).length;
44868
+ let bestPattern = 0;
44869
+ let lowerPenalty = Infinity;
44870
+
44871
+ for (let p = 0; p < numPatterns; p++) {
44872
+ setupFormatFunc(p);
44873
+ exports$1.applyMask(p, data);
44874
+
44875
+ // Calculate penalty
44876
+ const penalty =
44877
+ exports$1.getPenaltyN1(data) +
44878
+ exports$1.getPenaltyN2(data) +
44879
+ exports$1.getPenaltyN3(data) +
44880
+ exports$1.getPenaltyN4(data);
44881
+
44882
+ // Undo previously applied mask
44883
+ exports$1.applyMask(p, data);
44884
+
44885
+ if (penalty < lowerPenalty) {
44886
+ lowerPenalty = penalty;
44887
+ bestPattern = p;
44888
+ }
44889
+ }
44890
+
44891
+ return bestPattern
44892
+ };
44893
+ } (maskPattern));
44894
+ return maskPattern;
44895
+ }
44896
+
44897
+ var errorCorrectionCode = {};
44898
+
44899
+ var hasRequiredErrorCorrectionCode;
44900
+
44901
+ function requireErrorCorrectionCode () {
44902
+ if (hasRequiredErrorCorrectionCode) return errorCorrectionCode;
44903
+ hasRequiredErrorCorrectionCode = 1;
44904
+ const ECLevel = requireErrorCorrectionLevel();
44905
+
44906
+ const EC_BLOCKS_TABLE = [
44907
+ // L M Q H
44908
+ 1, 1, 1, 1,
44909
+ 1, 1, 1, 1,
44910
+ 1, 1, 2, 2,
44911
+ 1, 2, 2, 4,
44912
+ 1, 2, 4, 4,
44913
+ 2, 4, 4, 4,
44914
+ 2, 4, 6, 5,
44915
+ 2, 4, 6, 6,
44916
+ 2, 5, 8, 8,
44917
+ 4, 5, 8, 8,
44918
+ 4, 5, 8, 11,
44919
+ 4, 8, 10, 11,
44920
+ 4, 9, 12, 16,
44921
+ 4, 9, 16, 16,
44922
+ 6, 10, 12, 18,
44923
+ 6, 10, 17, 16,
44924
+ 6, 11, 16, 19,
44925
+ 6, 13, 18, 21,
44926
+ 7, 14, 21, 25,
44927
+ 8, 16, 20, 25,
44928
+ 8, 17, 23, 25,
44929
+ 9, 17, 23, 34,
44930
+ 9, 18, 25, 30,
44931
+ 10, 20, 27, 32,
44932
+ 12, 21, 29, 35,
44933
+ 12, 23, 34, 37,
44934
+ 12, 25, 34, 40,
44935
+ 13, 26, 35, 42,
44936
+ 14, 28, 38, 45,
44937
+ 15, 29, 40, 48,
44938
+ 16, 31, 43, 51,
44939
+ 17, 33, 45, 54,
44940
+ 18, 35, 48, 57,
44941
+ 19, 37, 51, 60,
44942
+ 19, 38, 53, 63,
44943
+ 20, 40, 56, 66,
44944
+ 21, 43, 59, 70,
44945
+ 22, 45, 62, 74,
44946
+ 24, 47, 65, 77,
44947
+ 25, 49, 68, 81
44948
+ ];
44949
+
44950
+ const EC_CODEWORDS_TABLE = [
44951
+ // L M Q H
44952
+ 7, 10, 13, 17,
44953
+ 10, 16, 22, 28,
44954
+ 15, 26, 36, 44,
44955
+ 20, 36, 52, 64,
44956
+ 26, 48, 72, 88,
44957
+ 36, 64, 96, 112,
44958
+ 40, 72, 108, 130,
44959
+ 48, 88, 132, 156,
44960
+ 60, 110, 160, 192,
44961
+ 72, 130, 192, 224,
44962
+ 80, 150, 224, 264,
44963
+ 96, 176, 260, 308,
44964
+ 104, 198, 288, 352,
44965
+ 120, 216, 320, 384,
44966
+ 132, 240, 360, 432,
44967
+ 144, 280, 408, 480,
44968
+ 168, 308, 448, 532,
44969
+ 180, 338, 504, 588,
44970
+ 196, 364, 546, 650,
44971
+ 224, 416, 600, 700,
44972
+ 224, 442, 644, 750,
44973
+ 252, 476, 690, 816,
44974
+ 270, 504, 750, 900,
44975
+ 300, 560, 810, 960,
44976
+ 312, 588, 870, 1050,
44977
+ 336, 644, 952, 1110,
44978
+ 360, 700, 1020, 1200,
44979
+ 390, 728, 1050, 1260,
44980
+ 420, 784, 1140, 1350,
44981
+ 450, 812, 1200, 1440,
44982
+ 480, 868, 1290, 1530,
44983
+ 510, 924, 1350, 1620,
44984
+ 540, 980, 1440, 1710,
44985
+ 570, 1036, 1530, 1800,
44986
+ 570, 1064, 1590, 1890,
44987
+ 600, 1120, 1680, 1980,
44988
+ 630, 1204, 1770, 2100,
44989
+ 660, 1260, 1860, 2220,
44990
+ 720, 1316, 1950, 2310,
44991
+ 750, 1372, 2040, 2430
44992
+ ];
44993
+
44994
+ /**
44995
+ * Returns the number of error correction block that the QR Code should contain
44996
+ * for the specified version and error correction level.
44997
+ *
44998
+ * @param {Number} version QR Code version
44999
+ * @param {Number} errorCorrectionLevel Error correction level
45000
+ * @return {Number} Number of error correction blocks
45001
+ */
45002
+ errorCorrectionCode.getBlocksCount = function getBlocksCount (version, errorCorrectionLevel) {
45003
+ switch (errorCorrectionLevel) {
45004
+ case ECLevel.L:
45005
+ return EC_BLOCKS_TABLE[(version - 1) * 4 + 0]
45006
+ case ECLevel.M:
45007
+ return EC_BLOCKS_TABLE[(version - 1) * 4 + 1]
45008
+ case ECLevel.Q:
45009
+ return EC_BLOCKS_TABLE[(version - 1) * 4 + 2]
45010
+ case ECLevel.H:
45011
+ return EC_BLOCKS_TABLE[(version - 1) * 4 + 3]
45012
+ default:
45013
+ return undefined
45014
+ }
45015
+ };
45016
+
45017
+ /**
45018
+ * Returns the number of error correction codewords to use for the specified
45019
+ * version and error correction level.
45020
+ *
45021
+ * @param {Number} version QR Code version
45022
+ * @param {Number} errorCorrectionLevel Error correction level
45023
+ * @return {Number} Number of error correction codewords
45024
+ */
45025
+ errorCorrectionCode.getTotalCodewordsCount = function getTotalCodewordsCount (version, errorCorrectionLevel) {
45026
+ switch (errorCorrectionLevel) {
45027
+ case ECLevel.L:
45028
+ return EC_CODEWORDS_TABLE[(version - 1) * 4 + 0]
45029
+ case ECLevel.M:
45030
+ return EC_CODEWORDS_TABLE[(version - 1) * 4 + 1]
45031
+ case ECLevel.Q:
45032
+ return EC_CODEWORDS_TABLE[(version - 1) * 4 + 2]
45033
+ case ECLevel.H:
45034
+ return EC_CODEWORDS_TABLE[(version - 1) * 4 + 3]
45035
+ default:
45036
+ return undefined
45037
+ }
45038
+ };
45039
+ return errorCorrectionCode;
45040
+ }
45041
+
45042
+ var polynomial = {};
45043
+
45044
+ var galoisField = {};
45045
+
45046
+ var hasRequiredGaloisField;
45047
+
45048
+ function requireGaloisField () {
45049
+ if (hasRequiredGaloisField) return galoisField;
45050
+ hasRequiredGaloisField = 1;
45051
+ const EXP_TABLE = new Uint8Array(512);
45052
+ const LOG_TABLE = new Uint8Array(256)
45053
+ /**
45054
+ * Precompute the log and anti-log tables for faster computation later
45055
+ *
45056
+ * For each possible value in the galois field 2^8, we will pre-compute
45057
+ * the logarithm and anti-logarithm (exponential) of this value
45058
+ *
45059
+ * ref {@link https://en.wikiversity.org/wiki/Reed%E2%80%93Solomon_codes_for_coders#Introduction_to_mathematical_fields}
45060
+ */
45061
+ ;(function initTables () {
45062
+ let x = 1;
45063
+ for (let i = 0; i < 255; i++) {
45064
+ EXP_TABLE[i] = x;
45065
+ LOG_TABLE[x] = i;
45066
+
45067
+ x <<= 1; // multiply by 2
45068
+
45069
+ // The QR code specification says to use byte-wise modulo 100011101 arithmetic.
45070
+ // This means that when a number is 256 or larger, it should be XORed with 0x11D.
45071
+ if (x & 0x100) { // similar to x >= 256, but a lot faster (because 0x100 == 256)
45072
+ x ^= 0x11D;
45073
+ }
45074
+ }
45075
+
45076
+ // Optimization: double the size of the anti-log table so that we don't need to mod 255 to
45077
+ // stay inside the bounds (because we will mainly use this table for the multiplication of
45078
+ // two GF numbers, no more).
45079
+ // @see {@link mul}
45080
+ for (let i = 255; i < 512; i++) {
45081
+ EXP_TABLE[i] = EXP_TABLE[i - 255];
45082
+ }
45083
+ }());
45084
+
45085
+ /**
45086
+ * Returns log value of n inside Galois Field
45087
+ *
45088
+ * @param {Number} n
45089
+ * @return {Number}
45090
+ */
45091
+ galoisField.log = function log (n) {
45092
+ if (n < 1) throw new Error('log(' + n + ')')
45093
+ return LOG_TABLE[n]
45094
+ };
45095
+
45096
+ /**
45097
+ * Returns anti-log value of n inside Galois Field
45098
+ *
45099
+ * @param {Number} n
45100
+ * @return {Number}
45101
+ */
45102
+ galoisField.exp = function exp (n) {
45103
+ return EXP_TABLE[n]
45104
+ };
45105
+
45106
+ /**
45107
+ * Multiplies two number inside Galois Field
45108
+ *
45109
+ * @param {Number} x
45110
+ * @param {Number} y
45111
+ * @return {Number}
45112
+ */
45113
+ galoisField.mul = function mul (x, y) {
45114
+ if (x === 0 || y === 0) return 0
45115
+
45116
+ // should be EXP_TABLE[(LOG_TABLE[x] + LOG_TABLE[y]) % 255] if EXP_TABLE wasn't oversized
45117
+ // @see {@link initTables}
45118
+ return EXP_TABLE[LOG_TABLE[x] + LOG_TABLE[y]]
45119
+ };
45120
+ return galoisField;
45121
+ }
45122
+
45123
+ var hasRequiredPolynomial;
45124
+
45125
+ function requirePolynomial () {
45126
+ if (hasRequiredPolynomial) return polynomial;
45127
+ hasRequiredPolynomial = 1;
45128
+ (function (exports$1) {
45129
+ const GF = requireGaloisField();
45130
+
45131
+ /**
45132
+ * Multiplies two polynomials inside Galois Field
45133
+ *
45134
+ * @param {Uint8Array} p1 Polynomial
45135
+ * @param {Uint8Array} p2 Polynomial
45136
+ * @return {Uint8Array} Product of p1 and p2
45137
+ */
45138
+ exports$1.mul = function mul (p1, p2) {
45139
+ const coeff = new Uint8Array(p1.length + p2.length - 1);
45140
+
45141
+ for (let i = 0; i < p1.length; i++) {
45142
+ for (let j = 0; j < p2.length; j++) {
45143
+ coeff[i + j] ^= GF.mul(p1[i], p2[j]);
45144
+ }
45145
+ }
45146
+
45147
+ return coeff
45148
+ };
45149
+
45150
+ /**
45151
+ * Calculate the remainder of polynomials division
45152
+ *
45153
+ * @param {Uint8Array} divident Polynomial
45154
+ * @param {Uint8Array} divisor Polynomial
45155
+ * @return {Uint8Array} Remainder
45156
+ */
45157
+ exports$1.mod = function mod (divident, divisor) {
45158
+ let result = new Uint8Array(divident);
45159
+
45160
+ while ((result.length - divisor.length) >= 0) {
45161
+ const coeff = result[0];
45162
+
45163
+ for (let i = 0; i < divisor.length; i++) {
45164
+ result[i] ^= GF.mul(divisor[i], coeff);
45165
+ }
45166
+
45167
+ // remove all zeros from buffer head
45168
+ let offset = 0;
45169
+ while (offset < result.length && result[offset] === 0) offset++;
45170
+ result = result.slice(offset);
45171
+ }
45172
+
45173
+ return result
45174
+ };
45175
+
45176
+ /**
45177
+ * Generate an irreducible generator polynomial of specified degree
45178
+ * (used by Reed-Solomon encoder)
45179
+ *
45180
+ * @param {Number} degree Degree of the generator polynomial
45181
+ * @return {Uint8Array} Buffer containing polynomial coefficients
45182
+ */
45183
+ exports$1.generateECPolynomial = function generateECPolynomial (degree) {
45184
+ let poly = new Uint8Array([1]);
45185
+ for (let i = 0; i < degree; i++) {
45186
+ poly = exports$1.mul(poly, new Uint8Array([1, GF.exp(i)]));
45187
+ }
45188
+
45189
+ return poly
45190
+ };
45191
+ } (polynomial));
45192
+ return polynomial;
45193
+ }
45194
+
45195
+ var reedSolomonEncoder;
45196
+ var hasRequiredReedSolomonEncoder;
45197
+
45198
+ function requireReedSolomonEncoder () {
45199
+ if (hasRequiredReedSolomonEncoder) return reedSolomonEncoder;
45200
+ hasRequiredReedSolomonEncoder = 1;
45201
+ const Polynomial = requirePolynomial();
45202
+
45203
+ function ReedSolomonEncoder (degree) {
45204
+ this.genPoly = undefined;
45205
+ this.degree = degree;
45206
+
45207
+ if (this.degree) this.initialize(this.degree);
45208
+ }
45209
+
45210
+ /**
45211
+ * Initialize the encoder.
45212
+ * The input param should correspond to the number of error correction codewords.
45213
+ *
45214
+ * @param {Number} degree
45215
+ */
45216
+ ReedSolomonEncoder.prototype.initialize = function initialize (degree) {
45217
+ // create an irreducible generator polynomial
45218
+ this.degree = degree;
45219
+ this.genPoly = Polynomial.generateECPolynomial(this.degree);
45220
+ };
45221
+
45222
+ /**
45223
+ * Encodes a chunk of data
45224
+ *
45225
+ * @param {Uint8Array} data Buffer containing input data
45226
+ * @return {Uint8Array} Buffer containing encoded data
45227
+ */
45228
+ ReedSolomonEncoder.prototype.encode = function encode (data) {
45229
+ if (!this.genPoly) {
45230
+ throw new Error('Encoder not initialized')
45231
+ }
45232
+
45233
+ // Calculate EC for this data block
45234
+ // extends data size to data+genPoly size
45235
+ const paddedData = new Uint8Array(data.length + this.degree);
45236
+ paddedData.set(data);
45237
+
45238
+ // The error correction codewords are the remainder after dividing the data codewords
45239
+ // by a generator polynomial
45240
+ const remainder = Polynomial.mod(paddedData, this.genPoly);
45241
+
45242
+ // return EC data blocks (last n byte, where n is the degree of genPoly)
45243
+ // If coefficients number in remainder are less than genPoly degree,
45244
+ // pad with 0s to the left to reach the needed number of coefficients
45245
+ const start = this.degree - remainder.length;
45246
+ if (start > 0) {
45247
+ const buff = new Uint8Array(this.degree);
45248
+ buff.set(remainder, start);
45249
+
45250
+ return buff
45251
+ }
45252
+
45253
+ return remainder
45254
+ };
45255
+
45256
+ reedSolomonEncoder = ReedSolomonEncoder;
45257
+ return reedSolomonEncoder;
45258
+ }
45259
+
45260
+ var version = {};
45261
+
45262
+ var mode = {};
45263
+
45264
+ var versionCheck = {};
45265
+
45266
+ /**
45267
+ * Check if QR Code version is valid
45268
+ *
45269
+ * @param {Number} version QR Code version
45270
+ * @return {Boolean} true if valid version, false otherwise
45271
+ */
45272
+
45273
+ var hasRequiredVersionCheck;
45274
+
45275
+ function requireVersionCheck () {
45276
+ if (hasRequiredVersionCheck) return versionCheck;
45277
+ hasRequiredVersionCheck = 1;
45278
+ versionCheck.isValid = function isValid (version) {
45279
+ return !isNaN(version) && version >= 1 && version <= 40
45280
+ };
45281
+ return versionCheck;
45282
+ }
45283
+
45284
+ var regex = {};
45285
+
45286
+ var hasRequiredRegex;
45287
+
45288
+ function requireRegex () {
45289
+ if (hasRequiredRegex) return regex;
45290
+ hasRequiredRegex = 1;
45291
+ const numeric = '[0-9]+';
45292
+ const alphanumeric = '[A-Z $%*+\\-./:]+';
45293
+ let kanji = '(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|' +
45294
+ '[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|' +
45295
+ '[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|' +
45296
+ '[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+';
45297
+ kanji = kanji.replace(/u/g, '\\u');
45298
+
45299
+ const byte = '(?:(?![A-Z0-9 $%*+\\-./:]|' + kanji + ')(?:.|[\r\n]))+';
45300
+
45301
+ regex.KANJI = new RegExp(kanji, 'g');
45302
+ regex.BYTE_KANJI = new RegExp('[^A-Z0-9 $%*+\\-./:]+', 'g');
45303
+ regex.BYTE = new RegExp(byte, 'g');
45304
+ regex.NUMERIC = new RegExp(numeric, 'g');
45305
+ regex.ALPHANUMERIC = new RegExp(alphanumeric, 'g');
45306
+
45307
+ const TEST_KANJI = new RegExp('^' + kanji + '$');
45308
+ const TEST_NUMERIC = new RegExp('^' + numeric + '$');
45309
+ const TEST_ALPHANUMERIC = new RegExp('^[A-Z0-9 $%*+\\-./:]+$');
45310
+
45311
+ regex.testKanji = function testKanji (str) {
45312
+ return TEST_KANJI.test(str)
45313
+ };
45314
+
45315
+ regex.testNumeric = function testNumeric (str) {
45316
+ return TEST_NUMERIC.test(str)
45317
+ };
45318
+
45319
+ regex.testAlphanumeric = function testAlphanumeric (str) {
45320
+ return TEST_ALPHANUMERIC.test(str)
45321
+ };
45322
+ return regex;
45323
+ }
45324
+
45325
+ var hasRequiredMode;
45326
+
45327
+ function requireMode () {
45328
+ if (hasRequiredMode) return mode;
45329
+ hasRequiredMode = 1;
45330
+ (function (exports$1) {
45331
+ const VersionCheck = requireVersionCheck();
45332
+ const Regex = requireRegex();
45333
+
45334
+ /**
45335
+ * Numeric mode encodes data from the decimal digit set (0 - 9)
45336
+ * (byte values 30HEX to 39HEX).
45337
+ * Normally, 3 data characters are represented by 10 bits.
45338
+ *
45339
+ * @type {Object}
45340
+ */
45341
+ exports$1.NUMERIC = {
45342
+ id: 'Numeric',
45343
+ bit: 1 << 0,
45344
+ ccBits: [10, 12, 14]
45345
+ };
45346
+
45347
+ /**
45348
+ * Alphanumeric mode encodes data from a set of 45 characters,
45349
+ * i.e. 10 numeric digits (0 - 9),
45350
+ * 26 alphabetic characters (A - Z),
45351
+ * and 9 symbols (SP, $, %, *, +, -, ., /, :).
45352
+ * Normally, two input characters are represented by 11 bits.
45353
+ *
45354
+ * @type {Object}
45355
+ */
45356
+ exports$1.ALPHANUMERIC = {
45357
+ id: 'Alphanumeric',
45358
+ bit: 1 << 1,
45359
+ ccBits: [9, 11, 13]
45360
+ };
45361
+
45362
+ /**
45363
+ * In byte mode, data is encoded at 8 bits per character.
45364
+ *
45365
+ * @type {Object}
45366
+ */
45367
+ exports$1.BYTE = {
45368
+ id: 'Byte',
45369
+ bit: 1 << 2,
45370
+ ccBits: [8, 16, 16]
45371
+ };
45372
+
45373
+ /**
45374
+ * The Kanji mode efficiently encodes Kanji characters in accordance with
45375
+ * the Shift JIS system based on JIS X 0208.
45376
+ * The Shift JIS values are shifted from the JIS X 0208 values.
45377
+ * JIS X 0208 gives details of the shift coded representation.
45378
+ * Each two-byte character value is compacted to a 13-bit binary codeword.
45379
+ *
45380
+ * @type {Object}
45381
+ */
45382
+ exports$1.KANJI = {
45383
+ id: 'Kanji',
45384
+ bit: 1 << 3,
45385
+ ccBits: [8, 10, 12]
45386
+ };
45387
+
45388
+ /**
45389
+ * Mixed mode will contain a sequences of data in a combination of any of
45390
+ * the modes described above
45391
+ *
45392
+ * @type {Object}
45393
+ */
45394
+ exports$1.MIXED = {
45395
+ bit: -1
45396
+ };
45397
+
45398
+ /**
45399
+ * Returns the number of bits needed to store the data length
45400
+ * according to QR Code specifications.
45401
+ *
45402
+ * @param {Mode} mode Data mode
45403
+ * @param {Number} version QR Code version
45404
+ * @return {Number} Number of bits
45405
+ */
45406
+ exports$1.getCharCountIndicator = function getCharCountIndicator (mode, version) {
45407
+ if (!mode.ccBits) throw new Error('Invalid mode: ' + mode)
45408
+
45409
+ if (!VersionCheck.isValid(version)) {
45410
+ throw new Error('Invalid version: ' + version)
45411
+ }
45412
+
45413
+ if (version >= 1 && version < 10) return mode.ccBits[0]
45414
+ else if (version < 27) return mode.ccBits[1]
45415
+ return mode.ccBits[2]
45416
+ };
45417
+
45418
+ /**
45419
+ * Returns the most efficient mode to store the specified data
45420
+ *
45421
+ * @param {String} dataStr Input data string
45422
+ * @return {Mode} Best mode
45423
+ */
45424
+ exports$1.getBestModeForData = function getBestModeForData (dataStr) {
45425
+ if (Regex.testNumeric(dataStr)) return exports$1.NUMERIC
45426
+ else if (Regex.testAlphanumeric(dataStr)) return exports$1.ALPHANUMERIC
45427
+ else if (Regex.testKanji(dataStr)) return exports$1.KANJI
45428
+ else return exports$1.BYTE
45429
+ };
45430
+
45431
+ /**
45432
+ * Return mode name as string
45433
+ *
45434
+ * @param {Mode} mode Mode object
45435
+ * @returns {String} Mode name
45436
+ */
45437
+ exports$1.toString = function toString (mode) {
45438
+ if (mode && mode.id) return mode.id
45439
+ throw new Error('Invalid mode')
45440
+ };
45441
+
45442
+ /**
45443
+ * Check if input param is a valid mode object
45444
+ *
45445
+ * @param {Mode} mode Mode object
45446
+ * @returns {Boolean} True if valid mode, false otherwise
45447
+ */
45448
+ exports$1.isValid = function isValid (mode) {
45449
+ return mode && mode.bit && mode.ccBits
45450
+ };
45451
+
45452
+ /**
45453
+ * Get mode object from its name
45454
+ *
45455
+ * @param {String} string Mode name
45456
+ * @returns {Mode} Mode object
45457
+ */
45458
+ function fromString (string) {
45459
+ if (typeof string !== 'string') {
45460
+ throw new Error('Param is not a string')
45461
+ }
45462
+
45463
+ const lcStr = string.toLowerCase();
45464
+
45465
+ switch (lcStr) {
45466
+ case 'numeric':
45467
+ return exports$1.NUMERIC
45468
+ case 'alphanumeric':
45469
+ return exports$1.ALPHANUMERIC
45470
+ case 'kanji':
45471
+ return exports$1.KANJI
45472
+ case 'byte':
45473
+ return exports$1.BYTE
45474
+ default:
45475
+ throw new Error('Unknown mode: ' + string)
45476
+ }
45477
+ }
45478
+
45479
+ /**
45480
+ * Returns mode from a value.
45481
+ * If value is not a valid mode, returns defaultValue
45482
+ *
45483
+ * @param {Mode|String} value Encoding mode
45484
+ * @param {Mode} defaultValue Fallback value
45485
+ * @return {Mode} Encoding mode
45486
+ */
45487
+ exports$1.from = function from (value, defaultValue) {
45488
+ if (exports$1.isValid(value)) {
45489
+ return value
45490
+ }
45491
+
45492
+ try {
45493
+ return fromString(value)
45494
+ } catch (e) {
45495
+ return defaultValue
45496
+ }
45497
+ };
45498
+ } (mode));
45499
+ return mode;
45500
+ }
45501
+
45502
+ var hasRequiredVersion;
45503
+
45504
+ function requireVersion () {
45505
+ if (hasRequiredVersion) return version;
45506
+ hasRequiredVersion = 1;
45507
+ (function (exports$1) {
45508
+ const Utils = requireUtils$1();
45509
+ const ECCode = requireErrorCorrectionCode();
45510
+ const ECLevel = requireErrorCorrectionLevel();
45511
+ const Mode = requireMode();
45512
+ const VersionCheck = requireVersionCheck();
45513
+
45514
+ // Generator polynomial used to encode version information
45515
+ const G18 = (1 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (1 << 8) | (1 << 5) | (1 << 2) | (1 << 0);
45516
+ const G18_BCH = Utils.getBCHDigit(G18);
45517
+
45518
+ function getBestVersionForDataLength (mode, length, errorCorrectionLevel) {
45519
+ for (let currentVersion = 1; currentVersion <= 40; currentVersion++) {
45520
+ if (length <= exports$1.getCapacity(currentVersion, errorCorrectionLevel, mode)) {
45521
+ return currentVersion
45522
+ }
45523
+ }
45524
+
45525
+ return undefined
45526
+ }
45527
+
45528
+ function getReservedBitsCount (mode, version) {
45529
+ // Character count indicator + mode indicator bits
45530
+ return Mode.getCharCountIndicator(mode, version) + 4
45531
+ }
45532
+
45533
+ function getTotalBitsFromDataArray (segments, version) {
45534
+ let totalBits = 0;
45535
+
45536
+ segments.forEach(function (data) {
45537
+ const reservedBits = getReservedBitsCount(data.mode, version);
45538
+ totalBits += reservedBits + data.getBitsLength();
45539
+ });
45540
+
45541
+ return totalBits
45542
+ }
45543
+
45544
+ function getBestVersionForMixedData (segments, errorCorrectionLevel) {
45545
+ for (let currentVersion = 1; currentVersion <= 40; currentVersion++) {
45546
+ const length = getTotalBitsFromDataArray(segments, currentVersion);
45547
+ if (length <= exports$1.getCapacity(currentVersion, errorCorrectionLevel, Mode.MIXED)) {
45548
+ return currentVersion
45549
+ }
45550
+ }
45551
+
45552
+ return undefined
45553
+ }
45554
+
45555
+ /**
45556
+ * Returns version number from a value.
45557
+ * If value is not a valid version, returns defaultValue
45558
+ *
45559
+ * @param {Number|String} value QR Code version
45560
+ * @param {Number} defaultValue Fallback value
45561
+ * @return {Number} QR Code version number
45562
+ */
45563
+ exports$1.from = function from (value, defaultValue) {
45564
+ if (VersionCheck.isValid(value)) {
45565
+ return parseInt(value, 10)
45566
+ }
45567
+
45568
+ return defaultValue
45569
+ };
45570
+
45571
+ /**
45572
+ * Returns how much data can be stored with the specified QR code version
45573
+ * and error correction level
45574
+ *
45575
+ * @param {Number} version QR Code version (1-40)
45576
+ * @param {Number} errorCorrectionLevel Error correction level
45577
+ * @param {Mode} mode Data mode
45578
+ * @return {Number} Quantity of storable data
45579
+ */
45580
+ exports$1.getCapacity = function getCapacity (version, errorCorrectionLevel, mode) {
45581
+ if (!VersionCheck.isValid(version)) {
45582
+ throw new Error('Invalid QR Code version')
45583
+ }
45584
+
45585
+ // Use Byte mode as default
45586
+ if (typeof mode === 'undefined') mode = Mode.BYTE;
45587
+
45588
+ // Total codewords for this QR code version (Data + Error correction)
45589
+ const totalCodewords = Utils.getSymbolTotalCodewords(version);
45590
+
45591
+ // Total number of error correction codewords
45592
+ const ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel);
45593
+
45594
+ // Total number of data codewords
45595
+ const dataTotalCodewordsBits = (totalCodewords - ecTotalCodewords) * 8;
45596
+
45597
+ if (mode === Mode.MIXED) return dataTotalCodewordsBits
45598
+
45599
+ const usableBits = dataTotalCodewordsBits - getReservedBitsCount(mode, version);
45600
+
45601
+ // Return max number of storable codewords
45602
+ switch (mode) {
45603
+ case Mode.NUMERIC:
45604
+ return Math.floor((usableBits / 10) * 3)
45605
+
45606
+ case Mode.ALPHANUMERIC:
45607
+ return Math.floor((usableBits / 11) * 2)
45608
+
45609
+ case Mode.KANJI:
45610
+ return Math.floor(usableBits / 13)
45611
+
45612
+ case Mode.BYTE:
45613
+ default:
45614
+ return Math.floor(usableBits / 8)
45615
+ }
45616
+ };
45617
+
45618
+ /**
45619
+ * Returns the minimum version needed to contain the amount of data
45620
+ *
45621
+ * @param {Segment} data Segment of data
45622
+ * @param {Number} [errorCorrectionLevel=H] Error correction level
45623
+ * @param {Mode} mode Data mode
45624
+ * @return {Number} QR Code version
45625
+ */
45626
+ exports$1.getBestVersionForData = function getBestVersionForData (data, errorCorrectionLevel) {
45627
+ let seg;
45628
+
45629
+ const ecl = ECLevel.from(errorCorrectionLevel, ECLevel.M);
45630
+
45631
+ if (Array.isArray(data)) {
45632
+ if (data.length > 1) {
45633
+ return getBestVersionForMixedData(data, ecl)
45634
+ }
45635
+
45636
+ if (data.length === 0) {
45637
+ return 1
45638
+ }
45639
+
45640
+ seg = data[0];
45641
+ } else {
45642
+ seg = data;
45643
+ }
45644
+
45645
+ return getBestVersionForDataLength(seg.mode, seg.getLength(), ecl)
45646
+ };
45647
+
45648
+ /**
45649
+ * Returns version information with relative error correction bits
45650
+ *
45651
+ * The version information is included in QR Code symbols of version 7 or larger.
45652
+ * It consists of an 18-bit sequence containing 6 data bits,
45653
+ * with 12 error correction bits calculated using the (18, 6) Golay code.
45654
+ *
45655
+ * @param {Number} version QR Code version
45656
+ * @return {Number} Encoded version info bits
45657
+ */
45658
+ exports$1.getEncodedBits = function getEncodedBits (version) {
45659
+ if (!VersionCheck.isValid(version) || version < 7) {
45660
+ throw new Error('Invalid QR Code version')
45661
+ }
45662
+
45663
+ let d = version << 12;
45664
+
45665
+ while (Utils.getBCHDigit(d) - G18_BCH >= 0) {
45666
+ d ^= (G18 << (Utils.getBCHDigit(d) - G18_BCH));
45667
+ }
45668
+
45669
+ return (version << 12) | d
45670
+ };
45671
+ } (version));
45672
+ return version;
45673
+ }
45674
+
45675
+ var formatInfo = {};
45676
+
45677
+ var hasRequiredFormatInfo;
45678
+
45679
+ function requireFormatInfo () {
45680
+ if (hasRequiredFormatInfo) return formatInfo;
45681
+ hasRequiredFormatInfo = 1;
45682
+ const Utils = requireUtils$1();
45683
+
45684
+ const G15 = (1 << 10) | (1 << 8) | (1 << 5) | (1 << 4) | (1 << 2) | (1 << 1) | (1 << 0);
45685
+ const G15_MASK = (1 << 14) | (1 << 12) | (1 << 10) | (1 << 4) | (1 << 1);
45686
+ const G15_BCH = Utils.getBCHDigit(G15);
45687
+
45688
+ /**
45689
+ * Returns format information with relative error correction bits
45690
+ *
45691
+ * The format information is a 15-bit sequence containing 5 data bits,
45692
+ * with 10 error correction bits calculated using the (15, 5) BCH code.
45693
+ *
45694
+ * @param {Number} errorCorrectionLevel Error correction level
45695
+ * @param {Number} mask Mask pattern
45696
+ * @return {Number} Encoded format information bits
45697
+ */
45698
+ formatInfo.getEncodedBits = function getEncodedBits (errorCorrectionLevel, mask) {
45699
+ const data = ((errorCorrectionLevel.bit << 3) | mask);
45700
+ let d = data << 10;
45701
+
45702
+ while (Utils.getBCHDigit(d) - G15_BCH >= 0) {
45703
+ d ^= (G15 << (Utils.getBCHDigit(d) - G15_BCH));
45704
+ }
45705
+
45706
+ // xor final data with mask pattern in order to ensure that
45707
+ // no combination of Error Correction Level and data mask pattern
45708
+ // will result in an all-zero data string
45709
+ return ((data << 10) | d) ^ G15_MASK
45710
+ };
45711
+ return formatInfo;
45712
+ }
45713
+
45714
+ var segments = {};
45715
+
45716
+ var numericData;
45717
+ var hasRequiredNumericData;
45718
+
45719
+ function requireNumericData () {
45720
+ if (hasRequiredNumericData) return numericData;
45721
+ hasRequiredNumericData = 1;
45722
+ const Mode = requireMode();
45723
+
45724
+ function NumericData (data) {
45725
+ this.mode = Mode.NUMERIC;
45726
+ this.data = data.toString();
45727
+ }
45728
+
45729
+ NumericData.getBitsLength = function getBitsLength (length) {
45730
+ return 10 * Math.floor(length / 3) + ((length % 3) ? ((length % 3) * 3 + 1) : 0)
45731
+ };
45732
+
45733
+ NumericData.prototype.getLength = function getLength () {
45734
+ return this.data.length
45735
+ };
45736
+
45737
+ NumericData.prototype.getBitsLength = function getBitsLength () {
45738
+ return NumericData.getBitsLength(this.data.length)
45739
+ };
45740
+
45741
+ NumericData.prototype.write = function write (bitBuffer) {
45742
+ let i, group, value;
45743
+
45744
+ // The input data string is divided into groups of three digits,
45745
+ // and each group is converted to its 10-bit binary equivalent.
45746
+ for (i = 0; i + 3 <= this.data.length; i += 3) {
45747
+ group = this.data.substr(i, 3);
45748
+ value = parseInt(group, 10);
45749
+
45750
+ bitBuffer.put(value, 10);
45751
+ }
45752
+
45753
+ // If the number of input digits is not an exact multiple of three,
45754
+ // the final one or two digits are converted to 4 or 7 bits respectively.
45755
+ const remainingNum = this.data.length - i;
45756
+ if (remainingNum > 0) {
45757
+ group = this.data.substr(i);
45758
+ value = parseInt(group, 10);
45759
+
45760
+ bitBuffer.put(value, remainingNum * 3 + 1);
45761
+ }
45762
+ };
45763
+
45764
+ numericData = NumericData;
45765
+ return numericData;
45766
+ }
45767
+
45768
+ var alphanumericData;
45769
+ var hasRequiredAlphanumericData;
45770
+
45771
+ function requireAlphanumericData () {
45772
+ if (hasRequiredAlphanumericData) return alphanumericData;
45773
+ hasRequiredAlphanumericData = 1;
45774
+ const Mode = requireMode();
45775
+
45776
+ /**
45777
+ * Array of characters available in alphanumeric mode
45778
+ *
45779
+ * As per QR Code specification, to each character
45780
+ * is assigned a value from 0 to 44 which in this case coincides
45781
+ * with the array index
45782
+ *
45783
+ * @type {Array}
45784
+ */
45785
+ const ALPHA_NUM_CHARS = [
45786
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
45787
+ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
45788
+ 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
45789
+ ' ', '$', '%', '*', '+', '-', '.', '/', ':'
45790
+ ];
45791
+
45792
+ function AlphanumericData (data) {
45793
+ this.mode = Mode.ALPHANUMERIC;
45794
+ this.data = data;
45795
+ }
45796
+
45797
+ AlphanumericData.getBitsLength = function getBitsLength (length) {
45798
+ return 11 * Math.floor(length / 2) + 6 * (length % 2)
45799
+ };
45800
+
45801
+ AlphanumericData.prototype.getLength = function getLength () {
45802
+ return this.data.length
45803
+ };
45804
+
45805
+ AlphanumericData.prototype.getBitsLength = function getBitsLength () {
45806
+ return AlphanumericData.getBitsLength(this.data.length)
45807
+ };
45808
+
45809
+ AlphanumericData.prototype.write = function write (bitBuffer) {
45810
+ let i;
45811
+
45812
+ // Input data characters are divided into groups of two characters
45813
+ // and encoded as 11-bit binary codes.
45814
+ for (i = 0; i + 2 <= this.data.length; i += 2) {
45815
+ // The character value of the first character is multiplied by 45
45816
+ let value = ALPHA_NUM_CHARS.indexOf(this.data[i]) * 45;
45817
+
45818
+ // The character value of the second digit is added to the product
45819
+ value += ALPHA_NUM_CHARS.indexOf(this.data[i + 1]);
45820
+
45821
+ // The sum is then stored as 11-bit binary number
45822
+ bitBuffer.put(value, 11);
45823
+ }
45824
+
45825
+ // If the number of input data characters is not a multiple of two,
45826
+ // the character value of the final character is encoded as a 6-bit binary number.
45827
+ if (this.data.length % 2) {
45828
+ bitBuffer.put(ALPHA_NUM_CHARS.indexOf(this.data[i]), 6);
45829
+ }
45830
+ };
45831
+
45832
+ alphanumericData = AlphanumericData;
45833
+ return alphanumericData;
45834
+ }
45835
+
45836
+ var byteData;
45837
+ var hasRequiredByteData;
45838
+
45839
+ function requireByteData () {
45840
+ if (hasRequiredByteData) return byteData;
45841
+ hasRequiredByteData = 1;
45842
+ const Mode = requireMode();
45843
+
45844
+ function ByteData (data) {
45845
+ this.mode = Mode.BYTE;
45846
+ if (typeof (data) === 'string') {
45847
+ this.data = new TextEncoder().encode(data);
45848
+ } else {
45849
+ this.data = new Uint8Array(data);
45850
+ }
45851
+ }
45852
+
45853
+ ByteData.getBitsLength = function getBitsLength (length) {
45854
+ return length * 8
45855
+ };
45856
+
45857
+ ByteData.prototype.getLength = function getLength () {
45858
+ return this.data.length
45859
+ };
45860
+
45861
+ ByteData.prototype.getBitsLength = function getBitsLength () {
45862
+ return ByteData.getBitsLength(this.data.length)
45863
+ };
45864
+
45865
+ ByteData.prototype.write = function (bitBuffer) {
45866
+ for (let i = 0, l = this.data.length; i < l; i++) {
45867
+ bitBuffer.put(this.data[i], 8);
45868
+ }
45869
+ };
45870
+
45871
+ byteData = ByteData;
45872
+ return byteData;
45873
+ }
45874
+
45875
+ var kanjiData;
45876
+ var hasRequiredKanjiData;
45877
+
45878
+ function requireKanjiData () {
45879
+ if (hasRequiredKanjiData) return kanjiData;
45880
+ hasRequiredKanjiData = 1;
45881
+ const Mode = requireMode();
45882
+ const Utils = requireUtils$1();
45883
+
45884
+ function KanjiData (data) {
45885
+ this.mode = Mode.KANJI;
45886
+ this.data = data;
45887
+ }
45888
+
45889
+ KanjiData.getBitsLength = function getBitsLength (length) {
45890
+ return length * 13
45891
+ };
45892
+
45893
+ KanjiData.prototype.getLength = function getLength () {
45894
+ return this.data.length
45895
+ };
45896
+
45897
+ KanjiData.prototype.getBitsLength = function getBitsLength () {
45898
+ return KanjiData.getBitsLength(this.data.length)
45899
+ };
45900
+
45901
+ KanjiData.prototype.write = function (bitBuffer) {
45902
+ let i;
45903
+
45904
+ // In the Shift JIS system, Kanji characters are represented by a two byte combination.
45905
+ // These byte values are shifted from the JIS X 0208 values.
45906
+ // JIS X 0208 gives details of the shift coded representation.
45907
+ for (i = 0; i < this.data.length; i++) {
45908
+ let value = Utils.toSJIS(this.data[i]);
45909
+
45910
+ // For characters with Shift JIS values from 0x8140 to 0x9FFC:
45911
+ if (value >= 0x8140 && value <= 0x9FFC) {
45912
+ // Subtract 0x8140 from Shift JIS value
45913
+ value -= 0x8140;
45914
+
45915
+ // For characters with Shift JIS values from 0xE040 to 0xEBBF
45916
+ } else if (value >= 0xE040 && value <= 0xEBBF) {
45917
+ // Subtract 0xC140 from Shift JIS value
45918
+ value -= 0xC140;
45919
+ } else {
45920
+ throw new Error(
45921
+ 'Invalid SJIS character: ' + this.data[i] + '\n' +
45922
+ 'Make sure your charset is UTF-8')
45923
+ }
45924
+
45925
+ // Multiply most significant byte of result by 0xC0
45926
+ // and add least significant byte to product
45927
+ value = (((value >>> 8) & 0xff) * 0xC0) + (value & 0xff);
45928
+
45929
+ // Convert result to a 13-bit binary string
45930
+ bitBuffer.put(value, 13);
45931
+ }
45932
+ };
45933
+
45934
+ kanjiData = KanjiData;
45935
+ return kanjiData;
45936
+ }
45937
+
45938
+ var dijkstra = {exports: {}};
45939
+
45940
+ var hasRequiredDijkstra;
45941
+
45942
+ function requireDijkstra () {
45943
+ if (hasRequiredDijkstra) return dijkstra.exports;
45944
+ hasRequiredDijkstra = 1;
45945
+ (function (module) {
45946
+
45947
+ /******************************************************************************
45948
+ * Created 2008-08-19.
45949
+ *
45950
+ * Dijkstra path-finding functions. Adapted from the Dijkstar Python project.
45951
+ *
45952
+ * Copyright (C) 2008
45953
+ * Wyatt Baldwin <self@wyattbaldwin.com>
45954
+ * All rights reserved
45955
+ *
45956
+ * Licensed under the MIT license.
45957
+ *
45958
+ * http://www.opensource.org/licenses/mit-license.php
45959
+ *
45960
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
45961
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
45962
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
45963
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
45964
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
45965
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
45966
+ * THE SOFTWARE.
45967
+ *****************************************************************************/
45968
+ var dijkstra = {
45969
+ single_source_shortest_paths: function(graph, s, d) {
45970
+ // Predecessor map for each node that has been encountered.
45971
+ // node ID => predecessor node ID
45972
+ var predecessors = {};
45973
+
45974
+ // Costs of shortest paths from s to all nodes encountered.
45975
+ // node ID => cost
45976
+ var costs = {};
45977
+ costs[s] = 0;
45978
+
45979
+ // Costs of shortest paths from s to all nodes encountered; differs from
45980
+ // `costs` in that it provides easy access to the node that currently has
45981
+ // the known shortest path from s.
45982
+ // XXX: Do we actually need both `costs` and `open`?
45983
+ var open = dijkstra.PriorityQueue.make();
45984
+ open.push(s, 0);
45985
+
45986
+ var closest,
45987
+ u, v,
45988
+ cost_of_s_to_u,
45989
+ adjacent_nodes,
45990
+ cost_of_e,
45991
+ cost_of_s_to_u_plus_cost_of_e,
45992
+ cost_of_s_to_v,
45993
+ first_visit;
45994
+ while (!open.empty()) {
45995
+ // In the nodes remaining in graph that have a known cost from s,
45996
+ // find the node, u, that currently has the shortest path from s.
45997
+ closest = open.pop();
45998
+ u = closest.value;
45999
+ cost_of_s_to_u = closest.cost;
46000
+
46001
+ // Get nodes adjacent to u...
46002
+ adjacent_nodes = graph[u] || {};
46003
+
46004
+ // ...and explore the edges that connect u to those nodes, updating
46005
+ // the cost of the shortest paths to any or all of those nodes as
46006
+ // necessary. v is the node across the current edge from u.
46007
+ for (v in adjacent_nodes) {
46008
+ if (adjacent_nodes.hasOwnProperty(v)) {
46009
+ // Get the cost of the edge running from u to v.
46010
+ cost_of_e = adjacent_nodes[v];
46011
+
46012
+ // Cost of s to u plus the cost of u to v across e--this is *a*
46013
+ // cost from s to v that may or may not be less than the current
46014
+ // known cost to v.
46015
+ cost_of_s_to_u_plus_cost_of_e = cost_of_s_to_u + cost_of_e;
46016
+
46017
+ // If we haven't visited v yet OR if the current known cost from s to
46018
+ // v is greater than the new cost we just found (cost of s to u plus
46019
+ // cost of u to v across e), update v's cost in the cost list and
46020
+ // update v's predecessor in the predecessor list (it's now u).
46021
+ cost_of_s_to_v = costs[v];
46022
+ first_visit = (typeof costs[v] === 'undefined');
46023
+ if (first_visit || cost_of_s_to_v > cost_of_s_to_u_plus_cost_of_e) {
46024
+ costs[v] = cost_of_s_to_u_plus_cost_of_e;
46025
+ open.push(v, cost_of_s_to_u_plus_cost_of_e);
46026
+ predecessors[v] = u;
46027
+ }
46028
+ }
46029
+ }
46030
+ }
46031
+
46032
+ if (typeof d !== 'undefined' && typeof costs[d] === 'undefined') {
46033
+ var msg = ['Could not find a path from ', s, ' to ', d, '.'].join('');
46034
+ throw new Error(msg);
46035
+ }
46036
+
46037
+ return predecessors;
46038
+ },
46039
+
46040
+ extract_shortest_path_from_predecessor_list: function(predecessors, d) {
46041
+ var nodes = [];
46042
+ var u = d;
46043
+ while (u) {
46044
+ nodes.push(u);
46045
+ predecessors[u];
46046
+ u = predecessors[u];
46047
+ }
46048
+ nodes.reverse();
46049
+ return nodes;
46050
+ },
46051
+
46052
+ find_path: function(graph, s, d) {
46053
+ var predecessors = dijkstra.single_source_shortest_paths(graph, s, d);
46054
+ return dijkstra.extract_shortest_path_from_predecessor_list(
46055
+ predecessors, d);
46056
+ },
46057
+
46058
+ /**
46059
+ * A very naive priority queue implementation.
46060
+ */
46061
+ PriorityQueue: {
46062
+ make: function (opts) {
46063
+ var T = dijkstra.PriorityQueue,
46064
+ t = {},
46065
+ key;
46066
+ opts = opts || {};
46067
+ for (key in T) {
46068
+ if (T.hasOwnProperty(key)) {
46069
+ t[key] = T[key];
46070
+ }
46071
+ }
46072
+ t.queue = [];
46073
+ t.sorter = opts.sorter || T.default_sorter;
46074
+ return t;
46075
+ },
46076
+
46077
+ default_sorter: function (a, b) {
46078
+ return a.cost - b.cost;
46079
+ },
46080
+
46081
+ /**
46082
+ * Add a new item to the queue and ensure the highest priority element
46083
+ * is at the front of the queue.
46084
+ */
46085
+ push: function (value, cost) {
46086
+ var item = {value: value, cost: cost};
46087
+ this.queue.push(item);
46088
+ this.queue.sort(this.sorter);
46089
+ },
46090
+
46091
+ /**
46092
+ * Return the highest priority element in the queue.
46093
+ */
46094
+ pop: function () {
46095
+ return this.queue.shift();
46096
+ },
46097
+
46098
+ empty: function () {
46099
+ return this.queue.length === 0;
46100
+ }
46101
+ }
46102
+ };
46103
+
46104
+
46105
+ // node.js module exports
46106
+ {
46107
+ module.exports = dijkstra;
46108
+ }
46109
+ } (dijkstra));
46110
+ return dijkstra.exports;
46111
+ }
46112
+
46113
+ var hasRequiredSegments;
46114
+
46115
+ function requireSegments () {
46116
+ if (hasRequiredSegments) return segments;
46117
+ hasRequiredSegments = 1;
46118
+ (function (exports$1) {
46119
+ const Mode = requireMode();
46120
+ const NumericData = requireNumericData();
46121
+ const AlphanumericData = requireAlphanumericData();
46122
+ const ByteData = requireByteData();
46123
+ const KanjiData = requireKanjiData();
46124
+ const Regex = requireRegex();
46125
+ const Utils = requireUtils$1();
46126
+ const dijkstra = requireDijkstra();
46127
+
46128
+ /**
46129
+ * Returns UTF8 byte length
46130
+ *
46131
+ * @param {String} str Input string
46132
+ * @return {Number} Number of byte
46133
+ */
46134
+ function getStringByteLength (str) {
46135
+ return unescape(encodeURIComponent(str)).length
46136
+ }
46137
+
46138
+ /**
46139
+ * Get a list of segments of the specified mode
46140
+ * from a string
46141
+ *
46142
+ * @param {Mode} mode Segment mode
46143
+ * @param {String} str String to process
46144
+ * @return {Array} Array of object with segments data
46145
+ */
46146
+ function getSegments (regex, mode, str) {
46147
+ const segments = [];
46148
+ let result;
46149
+
46150
+ while ((result = regex.exec(str)) !== null) {
46151
+ segments.push({
46152
+ data: result[0],
46153
+ index: result.index,
46154
+ mode: mode,
46155
+ length: result[0].length
46156
+ });
46157
+ }
46158
+
46159
+ return segments
46160
+ }
46161
+
46162
+ /**
46163
+ * Extracts a series of segments with the appropriate
46164
+ * modes from a string
46165
+ *
46166
+ * @param {String} dataStr Input string
46167
+ * @return {Array} Array of object with segments data
46168
+ */
46169
+ function getSegmentsFromString (dataStr) {
46170
+ const numSegs = getSegments(Regex.NUMERIC, Mode.NUMERIC, dataStr);
46171
+ const alphaNumSegs = getSegments(Regex.ALPHANUMERIC, Mode.ALPHANUMERIC, dataStr);
46172
+ let byteSegs;
46173
+ let kanjiSegs;
46174
+
46175
+ if (Utils.isKanjiModeEnabled()) {
46176
+ byteSegs = getSegments(Regex.BYTE, Mode.BYTE, dataStr);
46177
+ kanjiSegs = getSegments(Regex.KANJI, Mode.KANJI, dataStr);
46178
+ } else {
46179
+ byteSegs = getSegments(Regex.BYTE_KANJI, Mode.BYTE, dataStr);
46180
+ kanjiSegs = [];
46181
+ }
46182
+
46183
+ const segs = numSegs.concat(alphaNumSegs, byteSegs, kanjiSegs);
46184
+
46185
+ return segs
46186
+ .sort(function (s1, s2) {
46187
+ return s1.index - s2.index
46188
+ })
46189
+ .map(function (obj) {
46190
+ return {
46191
+ data: obj.data,
46192
+ mode: obj.mode,
46193
+ length: obj.length
46194
+ }
46195
+ })
46196
+ }
46197
+
46198
+ /**
46199
+ * Returns how many bits are needed to encode a string of
46200
+ * specified length with the specified mode
46201
+ *
46202
+ * @param {Number} length String length
46203
+ * @param {Mode} mode Segment mode
46204
+ * @return {Number} Bit length
46205
+ */
46206
+ function getSegmentBitsLength (length, mode) {
46207
+ switch (mode) {
46208
+ case Mode.NUMERIC:
46209
+ return NumericData.getBitsLength(length)
46210
+ case Mode.ALPHANUMERIC:
46211
+ return AlphanumericData.getBitsLength(length)
46212
+ case Mode.KANJI:
46213
+ return KanjiData.getBitsLength(length)
46214
+ case Mode.BYTE:
46215
+ return ByteData.getBitsLength(length)
46216
+ }
46217
+ }
46218
+
46219
+ /**
46220
+ * Merges adjacent segments which have the same mode
46221
+ *
46222
+ * @param {Array} segs Array of object with segments data
46223
+ * @return {Array} Array of object with segments data
46224
+ */
46225
+ function mergeSegments (segs) {
46226
+ return segs.reduce(function (acc, curr) {
46227
+ const prevSeg = acc.length - 1 >= 0 ? acc[acc.length - 1] : null;
46228
+ if (prevSeg && prevSeg.mode === curr.mode) {
46229
+ acc[acc.length - 1].data += curr.data;
46230
+ return acc
46231
+ }
46232
+
46233
+ acc.push(curr);
46234
+ return acc
46235
+ }, [])
46236
+ }
46237
+
46238
+ /**
46239
+ * Generates a list of all possible nodes combination which
46240
+ * will be used to build a segments graph.
46241
+ *
46242
+ * Nodes are divided by groups. Each group will contain a list of all the modes
46243
+ * in which is possible to encode the given text.
46244
+ *
46245
+ * For example the text '12345' can be encoded as Numeric, Alphanumeric or Byte.
46246
+ * The group for '12345' will contain then 3 objects, one for each
46247
+ * possible encoding mode.
46248
+ *
46249
+ * Each node represents a possible segment.
46250
+ *
46251
+ * @param {Array} segs Array of object with segments data
46252
+ * @return {Array} Array of object with segments data
46253
+ */
46254
+ function buildNodes (segs) {
46255
+ const nodes = [];
46256
+ for (let i = 0; i < segs.length; i++) {
46257
+ const seg = segs[i];
46258
+
46259
+ switch (seg.mode) {
46260
+ case Mode.NUMERIC:
46261
+ nodes.push([seg,
46262
+ { data: seg.data, mode: Mode.ALPHANUMERIC, length: seg.length },
46263
+ { data: seg.data, mode: Mode.BYTE, length: seg.length }
46264
+ ]);
46265
+ break
46266
+ case Mode.ALPHANUMERIC:
46267
+ nodes.push([seg,
46268
+ { data: seg.data, mode: Mode.BYTE, length: seg.length }
46269
+ ]);
46270
+ break
46271
+ case Mode.KANJI:
46272
+ nodes.push([seg,
46273
+ { data: seg.data, mode: Mode.BYTE, length: getStringByteLength(seg.data) }
46274
+ ]);
46275
+ break
46276
+ case Mode.BYTE:
46277
+ nodes.push([
46278
+ { data: seg.data, mode: Mode.BYTE, length: getStringByteLength(seg.data) }
46279
+ ]);
46280
+ }
46281
+ }
46282
+
46283
+ return nodes
46284
+ }
46285
+
46286
+ /**
46287
+ * Builds a graph from a list of nodes.
46288
+ * All segments in each node group will be connected with all the segments of
46289
+ * the next group and so on.
46290
+ *
46291
+ * At each connection will be assigned a weight depending on the
46292
+ * segment's byte length.
46293
+ *
46294
+ * @param {Array} nodes Array of object with segments data
46295
+ * @param {Number} version QR Code version
46296
+ * @return {Object} Graph of all possible segments
46297
+ */
46298
+ function buildGraph (nodes, version) {
46299
+ const table = {};
46300
+ const graph = { start: {} };
46301
+ let prevNodeIds = ['start'];
46302
+
46303
+ for (let i = 0; i < nodes.length; i++) {
46304
+ const nodeGroup = nodes[i];
46305
+ const currentNodeIds = [];
46306
+
46307
+ for (let j = 0; j < nodeGroup.length; j++) {
46308
+ const node = nodeGroup[j];
46309
+ const key = '' + i + j;
46310
+
46311
+ currentNodeIds.push(key);
46312
+ table[key] = { node: node, lastCount: 0 };
46313
+ graph[key] = {};
46314
+
46315
+ for (let n = 0; n < prevNodeIds.length; n++) {
46316
+ const prevNodeId = prevNodeIds[n];
46317
+
46318
+ if (table[prevNodeId] && table[prevNodeId].node.mode === node.mode) {
46319
+ graph[prevNodeId][key] =
46320
+ getSegmentBitsLength(table[prevNodeId].lastCount + node.length, node.mode) -
46321
+ getSegmentBitsLength(table[prevNodeId].lastCount, node.mode);
46322
+
46323
+ table[prevNodeId].lastCount += node.length;
46324
+ } else {
46325
+ if (table[prevNodeId]) table[prevNodeId].lastCount = node.length;
46326
+
46327
+ graph[prevNodeId][key] = getSegmentBitsLength(node.length, node.mode) +
46328
+ 4 + Mode.getCharCountIndicator(node.mode, version); // switch cost
46329
+ }
46330
+ }
46331
+ }
46332
+
46333
+ prevNodeIds = currentNodeIds;
46334
+ }
46335
+
46336
+ for (let n = 0; n < prevNodeIds.length; n++) {
46337
+ graph[prevNodeIds[n]].end = 0;
46338
+ }
46339
+
46340
+ return { map: graph, table: table }
46341
+ }
46342
+
46343
+ /**
46344
+ * Builds a segment from a specified data and mode.
46345
+ * If a mode is not specified, the more suitable will be used.
46346
+ *
46347
+ * @param {String} data Input data
46348
+ * @param {Mode | String} modesHint Data mode
46349
+ * @return {Segment} Segment
46350
+ */
46351
+ function buildSingleSegment (data, modesHint) {
46352
+ let mode;
46353
+ const bestMode = Mode.getBestModeForData(data);
46354
+
46355
+ mode = Mode.from(modesHint, bestMode);
46356
+
46357
+ // Make sure data can be encoded
46358
+ if (mode !== Mode.BYTE && mode.bit < bestMode.bit) {
46359
+ throw new Error('"' + data + '"' +
46360
+ ' cannot be encoded with mode ' + Mode.toString(mode) +
46361
+ '.\n Suggested mode is: ' + Mode.toString(bestMode))
46362
+ }
46363
+
46364
+ // Use Mode.BYTE if Kanji support is disabled
46365
+ if (mode === Mode.KANJI && !Utils.isKanjiModeEnabled()) {
46366
+ mode = Mode.BYTE;
46367
+ }
46368
+
46369
+ switch (mode) {
46370
+ case Mode.NUMERIC:
46371
+ return new NumericData(data)
46372
+
46373
+ case Mode.ALPHANUMERIC:
46374
+ return new AlphanumericData(data)
46375
+
46376
+ case Mode.KANJI:
46377
+ return new KanjiData(data)
46378
+
46379
+ case Mode.BYTE:
46380
+ return new ByteData(data)
46381
+ }
46382
+ }
46383
+
46384
+ /**
46385
+ * Builds a list of segments from an array.
46386
+ * Array can contain Strings or Objects with segment's info.
46387
+ *
46388
+ * For each item which is a string, will be generated a segment with the given
46389
+ * string and the more appropriate encoding mode.
46390
+ *
46391
+ * For each item which is an object, will be generated a segment with the given
46392
+ * data and mode.
46393
+ * Objects must contain at least the property "data".
46394
+ * If property "mode" is not present, the more suitable mode will be used.
46395
+ *
46396
+ * @param {Array} array Array of objects with segments data
46397
+ * @return {Array} Array of Segments
46398
+ */
46399
+ exports$1.fromArray = function fromArray (array) {
46400
+ return array.reduce(function (acc, seg) {
46401
+ if (typeof seg === 'string') {
46402
+ acc.push(buildSingleSegment(seg, null));
46403
+ } else if (seg.data) {
46404
+ acc.push(buildSingleSegment(seg.data, seg.mode));
46405
+ }
46406
+
46407
+ return acc
46408
+ }, [])
46409
+ };
46410
+
46411
+ /**
46412
+ * Builds an optimized sequence of segments from a string,
46413
+ * which will produce the shortest possible bitstream.
46414
+ *
46415
+ * @param {String} data Input string
46416
+ * @param {Number} version QR Code version
46417
+ * @return {Array} Array of segments
46418
+ */
46419
+ exports$1.fromString = function fromString (data, version) {
46420
+ const segs = getSegmentsFromString(data, Utils.isKanjiModeEnabled());
46421
+
46422
+ const nodes = buildNodes(segs);
46423
+ const graph = buildGraph(nodes, version);
46424
+ const path = dijkstra.find_path(graph.map, 'start', 'end');
46425
+
46426
+ const optimizedSegs = [];
46427
+ for (let i = 1; i < path.length - 1; i++) {
46428
+ optimizedSegs.push(graph.table[path[i]].node);
46429
+ }
46430
+
46431
+ return exports$1.fromArray(mergeSegments(optimizedSegs))
46432
+ };
46433
+
46434
+ /**
46435
+ * Splits a string in various segments with the modes which
46436
+ * best represent their content.
46437
+ * The produced segments are far from being optimized.
46438
+ * The output of this function is only used to estimate a QR Code version
46439
+ * which may contain the data.
46440
+ *
46441
+ * @param {string} data Input string
46442
+ * @return {Array} Array of segments
46443
+ */
46444
+ exports$1.rawSplit = function rawSplit (data) {
46445
+ return exports$1.fromArray(
46446
+ getSegmentsFromString(data, Utils.isKanjiModeEnabled())
46447
+ )
46448
+ };
46449
+ } (segments));
46450
+ return segments;
46451
+ }
46452
+
46453
+ var hasRequiredQrcode;
46454
+
46455
+ function requireQrcode () {
46456
+ if (hasRequiredQrcode) return qrcode;
46457
+ hasRequiredQrcode = 1;
46458
+ const Utils = requireUtils$1();
46459
+ const ECLevel = requireErrorCorrectionLevel();
46460
+ const BitBuffer = requireBitBuffer();
46461
+ const BitMatrix = requireBitMatrix();
46462
+ const AlignmentPattern = requireAlignmentPattern();
46463
+ const FinderPattern = requireFinderPattern();
46464
+ const MaskPattern = requireMaskPattern();
46465
+ const ECCode = requireErrorCorrectionCode();
46466
+ const ReedSolomonEncoder = requireReedSolomonEncoder();
46467
+ const Version = requireVersion();
46468
+ const FormatInfo = requireFormatInfo();
46469
+ const Mode = requireMode();
46470
+ const Segments = requireSegments();
46471
+
46472
+ /**
46473
+ * QRCode for JavaScript
46474
+ *
46475
+ * modified by Ryan Day for nodejs support
46476
+ * Copyright (c) 2011 Ryan Day
46477
+ *
46478
+ * Licensed under the MIT license:
46479
+ * http://www.opensource.org/licenses/mit-license.php
46480
+ *
46481
+ //---------------------------------------------------------------------
46482
+ // QRCode for JavaScript
46483
+ //
46484
+ // Copyright (c) 2009 Kazuhiko Arase
46485
+ //
46486
+ // URL: http://www.d-project.com/
46487
+ //
46488
+ // Licensed under the MIT license:
46489
+ // http://www.opensource.org/licenses/mit-license.php
46490
+ //
46491
+ // The word "QR Code" is registered trademark of
46492
+ // DENSO WAVE INCORPORATED
46493
+ // http://www.denso-wave.com/qrcode/faqpatent-e.html
46494
+ //
46495
+ //---------------------------------------------------------------------
46496
+ */
46497
+
46498
+ /**
46499
+ * Add finder patterns bits to matrix
46500
+ *
46501
+ * @param {BitMatrix} matrix Modules matrix
46502
+ * @param {Number} version QR Code version
46503
+ */
46504
+ function setupFinderPattern (matrix, version) {
46505
+ const size = matrix.size;
46506
+ const pos = FinderPattern.getPositions(version);
46507
+
46508
+ for (let i = 0; i < pos.length; i++) {
46509
+ const row = pos[i][0];
46510
+ const col = pos[i][1];
46511
+
46512
+ for (let r = -1; r <= 7; r++) {
46513
+ if (row + r <= -1 || size <= row + r) continue
46514
+
46515
+ for (let c = -1; c <= 7; c++) {
46516
+ if (col + c <= -1 || size <= col + c) continue
46517
+
46518
+ if ((r >= 0 && r <= 6 && (c === 0 || c === 6)) ||
46519
+ (c >= 0 && c <= 6 && (r === 0 || r === 6)) ||
46520
+ (r >= 2 && r <= 4 && c >= 2 && c <= 4)) {
46521
+ matrix.set(row + r, col + c, true, true);
46522
+ } else {
46523
+ matrix.set(row + r, col + c, false, true);
46524
+ }
46525
+ }
46526
+ }
46527
+ }
46528
+ }
46529
+
46530
+ /**
46531
+ * Add timing pattern bits to matrix
46532
+ *
46533
+ * Note: this function must be called before {@link setupAlignmentPattern}
46534
+ *
46535
+ * @param {BitMatrix} matrix Modules matrix
46536
+ */
46537
+ function setupTimingPattern (matrix) {
46538
+ const size = matrix.size;
46539
+
46540
+ for (let r = 8; r < size - 8; r++) {
46541
+ const value = r % 2 === 0;
46542
+ matrix.set(r, 6, value, true);
46543
+ matrix.set(6, r, value, true);
46544
+ }
46545
+ }
46546
+
46547
+ /**
46548
+ * Add alignment patterns bits to matrix
46549
+ *
46550
+ * Note: this function must be called after {@link setupTimingPattern}
46551
+ *
46552
+ * @param {BitMatrix} matrix Modules matrix
46553
+ * @param {Number} version QR Code version
46554
+ */
46555
+ function setupAlignmentPattern (matrix, version) {
46556
+ const pos = AlignmentPattern.getPositions(version);
46557
+
46558
+ for (let i = 0; i < pos.length; i++) {
46559
+ const row = pos[i][0];
46560
+ const col = pos[i][1];
46561
+
46562
+ for (let r = -2; r <= 2; r++) {
46563
+ for (let c = -2; c <= 2; c++) {
46564
+ if (r === -2 || r === 2 || c === -2 || c === 2 ||
46565
+ (r === 0 && c === 0)) {
46566
+ matrix.set(row + r, col + c, true, true);
46567
+ } else {
46568
+ matrix.set(row + r, col + c, false, true);
46569
+ }
46570
+ }
46571
+ }
46572
+ }
46573
+ }
46574
+
46575
+ /**
46576
+ * Add version info bits to matrix
46577
+ *
46578
+ * @param {BitMatrix} matrix Modules matrix
46579
+ * @param {Number} version QR Code version
46580
+ */
46581
+ function setupVersionInfo (matrix, version) {
46582
+ const size = matrix.size;
46583
+ const bits = Version.getEncodedBits(version);
46584
+ let row, col, mod;
46585
+
46586
+ for (let i = 0; i < 18; i++) {
46587
+ row = Math.floor(i / 3);
46588
+ col = i % 3 + size - 8 - 3;
46589
+ mod = ((bits >> i) & 1) === 1;
46590
+
46591
+ matrix.set(row, col, mod, true);
46592
+ matrix.set(col, row, mod, true);
46593
+ }
46594
+ }
46595
+
46596
+ /**
46597
+ * Add format info bits to matrix
46598
+ *
46599
+ * @param {BitMatrix} matrix Modules matrix
46600
+ * @param {ErrorCorrectionLevel} errorCorrectionLevel Error correction level
46601
+ * @param {Number} maskPattern Mask pattern reference value
46602
+ */
46603
+ function setupFormatInfo (matrix, errorCorrectionLevel, maskPattern) {
46604
+ const size = matrix.size;
46605
+ const bits = FormatInfo.getEncodedBits(errorCorrectionLevel, maskPattern);
46606
+ let i, mod;
46607
+
46608
+ for (i = 0; i < 15; i++) {
46609
+ mod = ((bits >> i) & 1) === 1;
46610
+
46611
+ // vertical
46612
+ if (i < 6) {
46613
+ matrix.set(i, 8, mod, true);
46614
+ } else if (i < 8) {
46615
+ matrix.set(i + 1, 8, mod, true);
46616
+ } else {
46617
+ matrix.set(size - 15 + i, 8, mod, true);
46618
+ }
46619
+
46620
+ // horizontal
46621
+ if (i < 8) {
46622
+ matrix.set(8, size - i - 1, mod, true);
46623
+ } else if (i < 9) {
46624
+ matrix.set(8, 15 - i - 1 + 1, mod, true);
46625
+ } else {
46626
+ matrix.set(8, 15 - i - 1, mod, true);
46627
+ }
46628
+ }
46629
+
46630
+ // fixed module
46631
+ matrix.set(size - 8, 8, 1, true);
46632
+ }
46633
+
46634
+ /**
46635
+ * Add encoded data bits to matrix
46636
+ *
46637
+ * @param {BitMatrix} matrix Modules matrix
46638
+ * @param {Uint8Array} data Data codewords
46639
+ */
46640
+ function setupData (matrix, data) {
46641
+ const size = matrix.size;
46642
+ let inc = -1;
46643
+ let row = size - 1;
46644
+ let bitIndex = 7;
46645
+ let byteIndex = 0;
46646
+
46647
+ for (let col = size - 1; col > 0; col -= 2) {
46648
+ if (col === 6) col--;
46649
+
46650
+ while (true) {
46651
+ for (let c = 0; c < 2; c++) {
46652
+ if (!matrix.isReserved(row, col - c)) {
46653
+ let dark = false;
46654
+
46655
+ if (byteIndex < data.length) {
46656
+ dark = (((data[byteIndex] >>> bitIndex) & 1) === 1);
46657
+ }
46658
+
46659
+ matrix.set(row, col - c, dark);
46660
+ bitIndex--;
46661
+
46662
+ if (bitIndex === -1) {
46663
+ byteIndex++;
46664
+ bitIndex = 7;
46665
+ }
46666
+ }
46667
+ }
46668
+
46669
+ row += inc;
46670
+
46671
+ if (row < 0 || size <= row) {
46672
+ row -= inc;
46673
+ inc = -inc;
46674
+ break
46675
+ }
46676
+ }
46677
+ }
46678
+ }
46679
+
46680
+ /**
46681
+ * Create encoded codewords from data input
46682
+ *
46683
+ * @param {Number} version QR Code version
46684
+ * @param {ErrorCorrectionLevel} errorCorrectionLevel Error correction level
46685
+ * @param {ByteData} data Data input
46686
+ * @return {Uint8Array} Buffer containing encoded codewords
46687
+ */
46688
+ function createData (version, errorCorrectionLevel, segments) {
46689
+ // Prepare data buffer
46690
+ const buffer = new BitBuffer();
46691
+
46692
+ segments.forEach(function (data) {
46693
+ // prefix data with mode indicator (4 bits)
46694
+ buffer.put(data.mode.bit, 4);
46695
+
46696
+ // Prefix data with character count indicator.
46697
+ // The character count indicator is a string of bits that represents the
46698
+ // number of characters that are being encoded.
46699
+ // The character count indicator must be placed after the mode indicator
46700
+ // and must be a certain number of bits long, depending on the QR version
46701
+ // and data mode
46702
+ // @see {@link Mode.getCharCountIndicator}.
46703
+ buffer.put(data.getLength(), Mode.getCharCountIndicator(data.mode, version));
46704
+
46705
+ // add binary data sequence to buffer
46706
+ data.write(buffer);
46707
+ });
46708
+
46709
+ // Calculate required number of bits
46710
+ const totalCodewords = Utils.getSymbolTotalCodewords(version);
46711
+ const ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel);
46712
+ const dataTotalCodewordsBits = (totalCodewords - ecTotalCodewords) * 8;
46713
+
46714
+ // Add a terminator.
46715
+ // If the bit string is shorter than the total number of required bits,
46716
+ // a terminator of up to four 0s must be added to the right side of the string.
46717
+ // If the bit string is more than four bits shorter than the required number of bits,
46718
+ // add four 0s to the end.
46719
+ if (buffer.getLengthInBits() + 4 <= dataTotalCodewordsBits) {
46720
+ buffer.put(0, 4);
46721
+ }
46722
+
46723
+ // If the bit string is fewer than four bits shorter, add only the number of 0s that
46724
+ // are needed to reach the required number of bits.
46725
+
46726
+ // After adding the terminator, if the number of bits in the string is not a multiple of 8,
46727
+ // pad the string on the right with 0s to make the string's length a multiple of 8.
46728
+ while (buffer.getLengthInBits() % 8 !== 0) {
46729
+ buffer.putBit(0);
46730
+ }
46731
+
46732
+ // Add pad bytes if the string is still shorter than the total number of required bits.
46733
+ // Extend the buffer to fill the data capacity of the symbol corresponding to
46734
+ // the Version and Error Correction Level by adding the Pad Codewords 11101100 (0xEC)
46735
+ // and 00010001 (0x11) alternately.
46736
+ const remainingByte = (dataTotalCodewordsBits - buffer.getLengthInBits()) / 8;
46737
+ for (let i = 0; i < remainingByte; i++) {
46738
+ buffer.put(i % 2 ? 0x11 : 0xEC, 8);
46739
+ }
46740
+
46741
+ return createCodewords(buffer, version, errorCorrectionLevel)
46742
+ }
46743
+
46744
+ /**
46745
+ * Encode input data with Reed-Solomon and return codewords with
46746
+ * relative error correction bits
46747
+ *
46748
+ * @param {BitBuffer} bitBuffer Data to encode
46749
+ * @param {Number} version QR Code version
46750
+ * @param {ErrorCorrectionLevel} errorCorrectionLevel Error correction level
46751
+ * @return {Uint8Array} Buffer containing encoded codewords
46752
+ */
46753
+ function createCodewords (bitBuffer, version, errorCorrectionLevel) {
46754
+ // Total codewords for this QR code version (Data + Error correction)
46755
+ const totalCodewords = Utils.getSymbolTotalCodewords(version);
46756
+
46757
+ // Total number of error correction codewords
46758
+ const ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel);
46759
+
46760
+ // Total number of data codewords
46761
+ const dataTotalCodewords = totalCodewords - ecTotalCodewords;
46762
+
46763
+ // Total number of blocks
46764
+ const ecTotalBlocks = ECCode.getBlocksCount(version, errorCorrectionLevel);
46765
+
46766
+ // Calculate how many blocks each group should contain
46767
+ const blocksInGroup2 = totalCodewords % ecTotalBlocks;
46768
+ const blocksInGroup1 = ecTotalBlocks - blocksInGroup2;
46769
+
46770
+ const totalCodewordsInGroup1 = Math.floor(totalCodewords / ecTotalBlocks);
46771
+
46772
+ const dataCodewordsInGroup1 = Math.floor(dataTotalCodewords / ecTotalBlocks);
46773
+ const dataCodewordsInGroup2 = dataCodewordsInGroup1 + 1;
46774
+
46775
+ // Number of EC codewords is the same for both groups
46776
+ const ecCount = totalCodewordsInGroup1 - dataCodewordsInGroup1;
46777
+
46778
+ // Initialize a Reed-Solomon encoder with a generator polynomial of degree ecCount
46779
+ const rs = new ReedSolomonEncoder(ecCount);
46780
+
46781
+ let offset = 0;
46782
+ const dcData = new Array(ecTotalBlocks);
46783
+ const ecData = new Array(ecTotalBlocks);
46784
+ let maxDataSize = 0;
46785
+ const buffer = new Uint8Array(bitBuffer.buffer);
46786
+
46787
+ // Divide the buffer into the required number of blocks
46788
+ for (let b = 0; b < ecTotalBlocks; b++) {
46789
+ const dataSize = b < blocksInGroup1 ? dataCodewordsInGroup1 : dataCodewordsInGroup2;
46790
+
46791
+ // extract a block of data from buffer
46792
+ dcData[b] = buffer.slice(offset, offset + dataSize);
46793
+
46794
+ // Calculate EC codewords for this data block
46795
+ ecData[b] = rs.encode(dcData[b]);
46796
+
46797
+ offset += dataSize;
46798
+ maxDataSize = Math.max(maxDataSize, dataSize);
46799
+ }
46800
+
46801
+ // Create final data
46802
+ // Interleave the data and error correction codewords from each block
46803
+ const data = new Uint8Array(totalCodewords);
46804
+ let index = 0;
46805
+ let i, r;
46806
+
46807
+ // Add data codewords
46808
+ for (i = 0; i < maxDataSize; i++) {
46809
+ for (r = 0; r < ecTotalBlocks; r++) {
46810
+ if (i < dcData[r].length) {
46811
+ data[index++] = dcData[r][i];
46812
+ }
46813
+ }
46814
+ }
46815
+
46816
+ // Apped EC codewords
46817
+ for (i = 0; i < ecCount; i++) {
46818
+ for (r = 0; r < ecTotalBlocks; r++) {
46819
+ data[index++] = ecData[r][i];
46820
+ }
46821
+ }
46822
+
46823
+ return data
46824
+ }
46825
+
46826
+ /**
46827
+ * Build QR Code symbol
46828
+ *
46829
+ * @param {String} data Input string
46830
+ * @param {Number} version QR Code version
46831
+ * @param {ErrorCorretionLevel} errorCorrectionLevel Error level
46832
+ * @param {MaskPattern} maskPattern Mask pattern
46833
+ * @return {Object} Object containing symbol data
46834
+ */
46835
+ function createSymbol (data, version, errorCorrectionLevel, maskPattern) {
46836
+ let segments;
46837
+
46838
+ if (Array.isArray(data)) {
46839
+ segments = Segments.fromArray(data);
46840
+ } else if (typeof data === 'string') {
46841
+ let estimatedVersion = version;
46842
+
46843
+ if (!estimatedVersion) {
46844
+ const rawSegments = Segments.rawSplit(data);
46845
+
46846
+ // Estimate best version that can contain raw splitted segments
46847
+ estimatedVersion = Version.getBestVersionForData(rawSegments, errorCorrectionLevel);
46848
+ }
46849
+
46850
+ // Build optimized segments
46851
+ // If estimated version is undefined, try with the highest version
46852
+ segments = Segments.fromString(data, estimatedVersion || 40);
46853
+ } else {
46854
+ throw new Error('Invalid data')
46855
+ }
46856
+
46857
+ // Get the min version that can contain data
46858
+ const bestVersion = Version.getBestVersionForData(segments, errorCorrectionLevel);
46859
+
46860
+ // If no version is found, data cannot be stored
46861
+ if (!bestVersion) {
46862
+ throw new Error('The amount of data is too big to be stored in a QR Code')
46863
+ }
46864
+
46865
+ // If not specified, use min version as default
46866
+ if (!version) {
46867
+ version = bestVersion;
46868
+
46869
+ // Check if the specified version can contain the data
46870
+ } else if (version < bestVersion) {
46871
+ throw new Error('\n' +
46872
+ 'The chosen QR Code version cannot contain this amount of data.\n' +
46873
+ 'Minimum version required to store current data is: ' + bestVersion + '.\n'
46874
+ )
46875
+ }
46876
+
46877
+ const dataBits = createData(version, errorCorrectionLevel, segments);
46878
+
46879
+ // Allocate matrix buffer
46880
+ const moduleCount = Utils.getSymbolSize(version);
46881
+ const modules = new BitMatrix(moduleCount);
46882
+
46883
+ // Add function modules
46884
+ setupFinderPattern(modules, version);
46885
+ setupTimingPattern(modules);
46886
+ setupAlignmentPattern(modules, version);
46887
+
46888
+ // Add temporary dummy bits for format info just to set them as reserved.
46889
+ // This is needed to prevent these bits from being masked by {@link MaskPattern.applyMask}
46890
+ // since the masking operation must be performed only on the encoding region.
46891
+ // These blocks will be replaced with correct values later in code.
46892
+ setupFormatInfo(modules, errorCorrectionLevel, 0);
46893
+
46894
+ if (version >= 7) {
46895
+ setupVersionInfo(modules, version);
46896
+ }
46897
+
46898
+ // Add data codewords
46899
+ setupData(modules, dataBits);
46900
+
46901
+ if (isNaN(maskPattern)) {
46902
+ // Find best mask pattern
46903
+ maskPattern = MaskPattern.getBestMask(modules,
46904
+ setupFormatInfo.bind(null, modules, errorCorrectionLevel));
46905
+ }
46906
+
46907
+ // Apply mask pattern
46908
+ MaskPattern.applyMask(maskPattern, modules);
46909
+
46910
+ // Replace format info bits with correct values
46911
+ setupFormatInfo(modules, errorCorrectionLevel, maskPattern);
46912
+
46913
+ return {
46914
+ modules: modules,
46915
+ version: version,
46916
+ errorCorrectionLevel: errorCorrectionLevel,
46917
+ maskPattern: maskPattern,
46918
+ segments: segments
46919
+ }
46920
+ }
46921
+
46922
+ /**
46923
+ * QR Code
46924
+ *
46925
+ * @param {String | Array} data Input data
46926
+ * @param {Object} options Optional configurations
46927
+ * @param {Number} options.version QR Code version
46928
+ * @param {String} options.errorCorrectionLevel Error correction level
46929
+ * @param {Function} options.toSJISFunc Helper func to convert utf8 to sjis
46930
+ */
46931
+ qrcode.create = function create (data, options) {
46932
+ if (typeof data === 'undefined' || data === '') {
46933
+ throw new Error('No input text')
46934
+ }
46935
+
46936
+ let errorCorrectionLevel = ECLevel.M;
46937
+ let version;
46938
+ let mask;
46939
+
46940
+ if (typeof options !== 'undefined') {
46941
+ // Use higher error correction level as default
46942
+ errorCorrectionLevel = ECLevel.from(options.errorCorrectionLevel, ECLevel.M);
46943
+ version = Version.from(options.version);
46944
+ mask = MaskPattern.from(options.maskPattern);
46945
+
46946
+ if (options.toSJISFunc) {
46947
+ Utils.setToSJISFunction(options.toSJISFunc);
46948
+ }
46949
+ }
46950
+
46951
+ return createSymbol(data, version, errorCorrectionLevel, mask)
46952
+ };
46953
+ return qrcode;
46954
+ }
46955
+
46956
+ var canvas = {};
46957
+
46958
+ var utils = {};
46959
+
46960
+ var hasRequiredUtils;
46961
+
46962
+ function requireUtils () {
46963
+ if (hasRequiredUtils) return utils;
46964
+ hasRequiredUtils = 1;
46965
+ (function (exports$1) {
46966
+ function hex2rgba (hex) {
46967
+ if (typeof hex === 'number') {
46968
+ hex = hex.toString();
46969
+ }
46970
+
46971
+ if (typeof hex !== 'string') {
46972
+ throw new Error('Color should be defined as hex string')
46973
+ }
46974
+
46975
+ let hexCode = hex.slice().replace('#', '').split('');
46976
+ if (hexCode.length < 3 || hexCode.length === 5 || hexCode.length > 8) {
46977
+ throw new Error('Invalid hex color: ' + hex)
46978
+ }
46979
+
46980
+ // Convert from short to long form (fff -> ffffff)
46981
+ if (hexCode.length === 3 || hexCode.length === 4) {
46982
+ hexCode = Array.prototype.concat.apply([], hexCode.map(function (c) {
46983
+ return [c, c]
46984
+ }));
46985
+ }
46986
+
46987
+ // Add default alpha value
46988
+ if (hexCode.length === 6) hexCode.push('F', 'F');
46989
+
46990
+ const hexValue = parseInt(hexCode.join(''), 16);
46991
+
46992
+ return {
46993
+ r: (hexValue >> 24) & 255,
46994
+ g: (hexValue >> 16) & 255,
46995
+ b: (hexValue >> 8) & 255,
46996
+ a: hexValue & 255,
46997
+ hex: '#' + hexCode.slice(0, 6).join('')
46998
+ }
46999
+ }
47000
+
47001
+ exports$1.getOptions = function getOptions (options) {
47002
+ if (!options) options = {};
47003
+ if (!options.color) options.color = {};
47004
+
47005
+ const margin = typeof options.margin === 'undefined' ||
47006
+ options.margin === null ||
47007
+ options.margin < 0
47008
+ ? 4
47009
+ : options.margin;
47010
+
47011
+ const width = options.width && options.width >= 21 ? options.width : undefined;
47012
+ const scale = options.scale || 4;
47013
+
47014
+ return {
47015
+ width: width,
47016
+ scale: width ? 4 : scale,
47017
+ margin: margin,
47018
+ color: {
47019
+ dark: hex2rgba(options.color.dark || '#000000ff'),
47020
+ light: hex2rgba(options.color.light || '#ffffffff')
47021
+ },
47022
+ type: options.type,
47023
+ rendererOpts: options.rendererOpts || {}
47024
+ }
47025
+ };
47026
+
47027
+ exports$1.getScale = function getScale (qrSize, opts) {
47028
+ return opts.width && opts.width >= qrSize + opts.margin * 2
47029
+ ? opts.width / (qrSize + opts.margin * 2)
47030
+ : opts.scale
47031
+ };
47032
+
47033
+ exports$1.getImageWidth = function getImageWidth (qrSize, opts) {
47034
+ const scale = exports$1.getScale(qrSize, opts);
47035
+ return Math.floor((qrSize + opts.margin * 2) * scale)
47036
+ };
47037
+
47038
+ exports$1.qrToImageData = function qrToImageData (imgData, qr, opts) {
47039
+ const size = qr.modules.size;
47040
+ const data = qr.modules.data;
47041
+ const scale = exports$1.getScale(size, opts);
47042
+ const symbolSize = Math.floor((size + opts.margin * 2) * scale);
47043
+ const scaledMargin = opts.margin * scale;
47044
+ const palette = [opts.color.light, opts.color.dark];
47045
+
47046
+ for (let i = 0; i < symbolSize; i++) {
47047
+ for (let j = 0; j < symbolSize; j++) {
47048
+ let posDst = (i * symbolSize + j) * 4;
47049
+ let pxColor = opts.color.light;
47050
+
47051
+ if (i >= scaledMargin && j >= scaledMargin &&
47052
+ i < symbolSize - scaledMargin && j < symbolSize - scaledMargin) {
47053
+ const iSrc = Math.floor((i - scaledMargin) / scale);
47054
+ const jSrc = Math.floor((j - scaledMargin) / scale);
47055
+ pxColor = palette[data[iSrc * size + jSrc] ? 1 : 0];
47056
+ }
47057
+
47058
+ imgData[posDst++] = pxColor.r;
47059
+ imgData[posDst++] = pxColor.g;
47060
+ imgData[posDst++] = pxColor.b;
47061
+ imgData[posDst] = pxColor.a;
47062
+ }
47063
+ }
47064
+ };
47065
+ } (utils));
47066
+ return utils;
47067
+ }
47068
+
47069
+ var hasRequiredCanvas;
47070
+
47071
+ function requireCanvas () {
47072
+ if (hasRequiredCanvas) return canvas;
47073
+ hasRequiredCanvas = 1;
47074
+ (function (exports$1) {
47075
+ const Utils = requireUtils();
47076
+
47077
+ function clearCanvas (ctx, canvas, size) {
47078
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
47079
+
47080
+ if (!canvas.style) canvas.style = {};
47081
+ canvas.height = size;
47082
+ canvas.width = size;
47083
+ canvas.style.height = size + 'px';
47084
+ canvas.style.width = size + 'px';
47085
+ }
47086
+
47087
+ function getCanvasElement () {
47088
+ try {
47089
+ return document.createElement('canvas')
47090
+ } catch (e) {
47091
+ throw new Error('You need to specify a canvas element')
47092
+ }
47093
+ }
47094
+
47095
+ exports$1.render = function render (qrData, canvas, options) {
47096
+ let opts = options;
47097
+ let canvasEl = canvas;
47098
+
47099
+ if (typeof opts === 'undefined' && (!canvas || !canvas.getContext)) {
47100
+ opts = canvas;
47101
+ canvas = undefined;
47102
+ }
47103
+
47104
+ if (!canvas) {
47105
+ canvasEl = getCanvasElement();
47106
+ }
47107
+
47108
+ opts = Utils.getOptions(opts);
47109
+ const size = Utils.getImageWidth(qrData.modules.size, opts);
47110
+
47111
+ const ctx = canvasEl.getContext('2d');
47112
+ const image = ctx.createImageData(size, size);
47113
+ Utils.qrToImageData(image.data, qrData, opts);
47114
+
47115
+ clearCanvas(ctx, canvasEl, size);
47116
+ ctx.putImageData(image, 0, 0);
47117
+
47118
+ return canvasEl
47119
+ };
47120
+
47121
+ exports$1.renderToDataURL = function renderToDataURL (qrData, canvas, options) {
47122
+ let opts = options;
47123
+
47124
+ if (typeof opts === 'undefined' && (!canvas || !canvas.getContext)) {
47125
+ opts = canvas;
47126
+ canvas = undefined;
47127
+ }
47128
+
47129
+ if (!opts) opts = {};
47130
+
47131
+ const canvasEl = exports$1.render(qrData, canvas, opts);
47132
+
47133
+ const type = opts.type || 'image/png';
47134
+ const rendererOpts = opts.rendererOpts || {};
47135
+
47136
+ return canvasEl.toDataURL(type, rendererOpts.quality)
47137
+ };
47138
+ } (canvas));
47139
+ return canvas;
47140
+ }
47141
+
47142
+ var svgTag = {};
47143
+
47144
+ var hasRequiredSvgTag;
47145
+
47146
+ function requireSvgTag () {
47147
+ if (hasRequiredSvgTag) return svgTag;
47148
+ hasRequiredSvgTag = 1;
47149
+ const Utils = requireUtils();
47150
+
47151
+ function getColorAttrib (color, attrib) {
47152
+ const alpha = color.a / 255;
47153
+ const str = attrib + '="' + color.hex + '"';
47154
+
47155
+ return alpha < 1
47156
+ ? str + ' ' + attrib + '-opacity="' + alpha.toFixed(2).slice(1) + '"'
47157
+ : str
47158
+ }
47159
+
47160
+ function svgCmd (cmd, x, y) {
47161
+ let str = cmd + x;
47162
+ if (typeof y !== 'undefined') str += ' ' + y;
47163
+
47164
+ return str
47165
+ }
47166
+
47167
+ function qrToPath (data, size, margin) {
47168
+ let path = '';
47169
+ let moveBy = 0;
47170
+ let newRow = false;
47171
+ let lineLength = 0;
47172
+
47173
+ for (let i = 0; i < data.length; i++) {
47174
+ const col = Math.floor(i % size);
47175
+ const row = Math.floor(i / size);
47176
+
47177
+ if (!col && !newRow) newRow = true;
47178
+
47179
+ if (data[i]) {
47180
+ lineLength++;
47181
+
47182
+ if (!(i > 0 && col > 0 && data[i - 1])) {
47183
+ path += newRow
47184
+ ? svgCmd('M', col + margin, 0.5 + row + margin)
47185
+ : svgCmd('m', moveBy, 0);
47186
+
47187
+ moveBy = 0;
47188
+ newRow = false;
47189
+ }
47190
+
47191
+ if (!(col + 1 < size && data[i + 1])) {
47192
+ path += svgCmd('h', lineLength);
47193
+ lineLength = 0;
47194
+ }
47195
+ } else {
47196
+ moveBy++;
47197
+ }
47198
+ }
47199
+
47200
+ return path
47201
+ }
47202
+
47203
+ svgTag.render = function render (qrData, options, cb) {
47204
+ const opts = Utils.getOptions(options);
47205
+ const size = qrData.modules.size;
47206
+ const data = qrData.modules.data;
47207
+ const qrcodesize = size + opts.margin * 2;
47208
+
47209
+ const bg = !opts.color.light.a
47210
+ ? ''
47211
+ : '<path ' + getColorAttrib(opts.color.light, 'fill') +
47212
+ ' d="M0 0h' + qrcodesize + 'v' + qrcodesize + 'H0z"/>';
47213
+
47214
+ const path =
47215
+ '<path ' + getColorAttrib(opts.color.dark, 'stroke') +
47216
+ ' d="' + qrToPath(data, size, opts.margin) + '"/>';
47217
+
47218
+ const viewBox = 'viewBox="' + '0 0 ' + qrcodesize + ' ' + qrcodesize + '"';
47219
+
47220
+ const width = !opts.width ? '' : 'width="' + opts.width + '" height="' + opts.width + '" ';
47221
+
47222
+ const svgTag = '<svg xmlns="http://www.w3.org/2000/svg" ' + width + viewBox + ' shape-rendering="crispEdges">' + bg + path + '</svg>\n';
47223
+
47224
+ if (typeof cb === 'function') {
47225
+ cb(null, svgTag);
47226
+ }
47227
+
47228
+ return svgTag
47229
+ };
47230
+ return svgTag;
47231
+ }
47232
+
47233
+ var hasRequiredBrowser;
47234
+
47235
+ function requireBrowser () {
47236
+ if (hasRequiredBrowser) return browser;
47237
+ hasRequiredBrowser = 1;
47238
+ const canPromise = requireCanPromise();
47239
+
47240
+ const QRCode = requireQrcode();
47241
+ const CanvasRenderer = requireCanvas();
47242
+ const SvgRenderer = requireSvgTag();
47243
+
47244
+ function renderCanvas (renderFunc, canvas, text, opts, cb) {
47245
+ const args = [].slice.call(arguments, 1);
47246
+ const argsNum = args.length;
47247
+ const isLastArgCb = typeof args[argsNum - 1] === 'function';
47248
+
47249
+ if (!isLastArgCb && !canPromise()) {
47250
+ throw new Error('Callback required as last argument')
47251
+ }
47252
+
47253
+ if (isLastArgCb) {
47254
+ if (argsNum < 2) {
47255
+ throw new Error('Too few arguments provided')
47256
+ }
47257
+
47258
+ if (argsNum === 2) {
47259
+ cb = text;
47260
+ text = canvas;
47261
+ canvas = opts = undefined;
47262
+ } else if (argsNum === 3) {
47263
+ if (canvas.getContext && typeof cb === 'undefined') {
47264
+ cb = opts;
47265
+ opts = undefined;
47266
+ } else {
47267
+ cb = opts;
47268
+ opts = text;
47269
+ text = canvas;
47270
+ canvas = undefined;
47271
+ }
47272
+ }
47273
+ } else {
47274
+ if (argsNum < 1) {
47275
+ throw new Error('Too few arguments provided')
47276
+ }
47277
+
47278
+ if (argsNum === 1) {
47279
+ text = canvas;
47280
+ canvas = opts = undefined;
47281
+ } else if (argsNum === 2 && !canvas.getContext) {
47282
+ opts = text;
47283
+ text = canvas;
47284
+ canvas = undefined;
47285
+ }
47286
+
47287
+ return new Promise(function (resolve, reject) {
47288
+ try {
47289
+ const data = QRCode.create(text, opts);
47290
+ resolve(renderFunc(data, canvas, opts));
47291
+ } catch (e) {
47292
+ reject(e);
47293
+ }
47294
+ })
47295
+ }
47296
+
47297
+ try {
47298
+ const data = QRCode.create(text, opts);
47299
+ cb(null, renderFunc(data, canvas, opts));
47300
+ } catch (e) {
47301
+ cb(e);
47302
+ }
47303
+ }
47304
+
47305
+ browser.create = QRCode.create;
47306
+ browser.toCanvas = renderCanvas.bind(null, CanvasRenderer.render);
47307
+ browser.toDataURL = renderCanvas.bind(null, CanvasRenderer.renderToDataURL);
47308
+
47309
+ // only svg for now.
47310
+ browser.toString = renderCanvas.bind(null, function (data, _, opts) {
47311
+ return SvgRenderer.render(data, opts)
47312
+ });
47313
+ return browser;
47314
+ }
47315
+
47316
+ var browserExports = requireBrowser();
44297
47317
 
44298
47318
  var handles = {
44299
- init(_ref) {
47319
+ async init(_ref) {
44300
47320
  let {
44301
47321
  scopeThis
44302
47322
  } = _ref;
44303
- const QRCode = require$$0;
44304
- document.getElementById('qrcodejs2.ly0d2cash').innerHTML = '';
44305
- new QRCode(document.getElementById('qrcodejs2.ly0d2cash'), {
44306
- text: scopeThis.props.formData.code_url,
44307
- width: 120,
44308
- height: 120
44309
- });
44310
- // 如果不显示第二个窗口
44311
- if (!scopeThis.props.popup.second) {
44312
- return;
44313
- }
47323
+ // 获取容器元素
47324
+ const container = document.getElementById('qrcodejs2.ly0d2cash');
47325
+ if (!container) return;
47326
+
47327
+ // 清空并生成主窗口二维码 (现代写法使用 canvas 或插入图片)
47328
+ container.innerHTML = '<canvas id="main_qr_canvas"></canvas>';
47329
+ const canvas = document.getElementById('main_qr_canvas');
47330
+ try {
47331
+ await browserExports.toCanvas(canvas, scopeThis.props.formData.code_url, {
47332
+ width: 120,
47333
+ margin: 2
47334
+ });
44314
47335
 
44315
- // 获取第二块屏幕的位置
44316
- let secondScreen = window.screen,
44317
- secondScreenLeft = 0,
44318
- secondScreenTop = 0;
44319
- if (window.screen.width > window.innerWidth) {
44320
- secondScreenLeft = secondScreen.availLeft;
44321
- secondScreenTop = secondScreen.availTop;
47336
+ // 如果不显示第二个窗口
47337
+ if (!scopeThis.props.popup.second) {
47338
+ return;
47339
+ }
47340
+
47341
+ // 获取第二块屏幕的位置
47342
+ let secondScreen = window.screen,
47343
+ secondScreenLeft = 0,
47344
+ secondScreenTop = 0;
47345
+ if (window.screen.width > window.innerWidth) {
47346
+ secondScreenLeft = secondScreen.availLeft;
47347
+ secondScreenTop = secondScreen.availTop;
47348
+ }
47349
+ // 处理第二块屏幕
47350
+ scopeThis.winPayAnother = window.open('', '_blank', 'width=600' + ',height=300' + ',screenX=' + secondScreenLeft + ',screenY=' + secondScreenTop + ',location=no' + ',menubar=no' + ',resizable=no' + ',scrollbars=no' + ',status=no' + ',titlebar=no' + ',toolbar=no');
47351
+ // 写入 HTML 内容
47352
+ scopeThis.winPayAnother.document.write("<div style='text-align:center; margin-top:20px;'>尊敬的客户,请您使用微信扫描二维码,以完成支付</div>" + "<div style='text-align:center; color:blue; font-size:large; font-weight:bold;'>金额:¥" + scopeThis.props.formData.amount + '</div>' + "<div style='text-align:center; margin-top:20px;'>" + "<div id='qrcodejs2.ly0d2cash' style='display:inline-block;'>" + '</div></div>');
47353
+ // 在第二个窗口生成二维码
47354
+ const secondCanvas = scopeThis.winPayAnother.document.getElementById('second_qr_canvas');
47355
+ await browserExports.toCanvas(secondCanvas, scopeThis.props.formData.code_url, {
47356
+ width: 160,
47357
+ margin: 2
47358
+ });
47359
+ } catch (err) {
47360
+ console.error('二维码生成失败:', err);
44322
47361
  }
44323
- scopeThis.winPayAnother = window.open('', '_blank', 'width=600' + ',height=300' + ',screenX=' + secondScreenLeft + ',screenY=' + secondScreenTop + ',location=no' + ',menubar=no' + ',resizable=no' + ',scrollbars=no' + ',status=no' + ',titlebar=no' + ',toolbar=no');
44324
- scopeThis.winPayAnother.document.write("<div style='text-align:center; margin-top:20px;'>尊敬的客户,请您使用微信扫描二维码,以完成支付</div>" + "<div style='text-align:center; color:blue; font-size:large; font-weight:bold;'>金额:¥" + scopeThis.props.formData.amount + '</div>' + "<div style='text-align:center; margin-top:20px;'>" + "<div id='qrcodejs2.ly0d2cash' style='display:inline-block;'>" + '</div></div>');
44325
- new QRCode(scopeThis.winPayAnother.document.getElementById('qrcodejs2.ly0d2cash'), {
44326
- text: scopeThis.props.formData.code_url,
44327
- width: 160,
44328
- height: 160
44329
- });
44330
47362
  },
44331
47363
  confirm(_ref2) {
44332
47364
  let {
44333
47365
  scopeThis
44334
47366
  } = _ref2;
44335
- ly0request$1.ly0.storpro({
47367
+ ly0request$1.storpro({
44336
47368
  storproName: 'ly0d2.wxzf.getStatus',
44337
47369
  data: {
44338
47370
  mchid: scopeThis.props.formData.mchid,
@@ -44470,7 +47502,7 @@ const scopeThis = vue.reactive({
44470
47502
  arrProcess: [],
44471
47503
  arrMethod: [],
44472
47504
  },
44473
- qrcode,
47505
+ qrcode: qrcode$1,
44474
47506
  });
44475
47507
 
44476
47508
  vue.onMounted(()=>{