@plattar/plattar-qrcode 1.178.1 → 2.7.1
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.
|
@@ -6,7 +6,8 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
|
|
|
6
6
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
7
7
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
8
8
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
9
|
-
function
|
|
9
|
+
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
10
|
+
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
10
11
|
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
11
12
|
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
12
13
|
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
@@ -310,7 +311,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
310
311
|
}
|
|
311
312
|
try {
|
|
312
313
|
var b64Link = btoa(url);
|
|
313
|
-
|
|
314
|
+
var serverType = _this3.hasAttribute("server") ? _this3.getAttribute("server") : "production";
|
|
315
|
+
fetch(serverType === "staging" ? "https://c.plattar.space/shorten" : "https://c.plattar.com/shorten", {
|
|
314
316
|
cache: "no-store",
|
|
315
317
|
method: "POST",
|
|
316
318
|
headers: {
|
|
@@ -3884,7 +3886,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3884
3886
|
|
|
3885
3887
|
i.d(r, {
|
|
3886
3888
|
"default": function _default() {
|
|
3887
|
-
return
|
|
3889
|
+
return $;
|
|
3888
3890
|
}
|
|
3889
3891
|
});
|
|
3890
3892
|
var t = function t(_t2) {
|
|
@@ -4226,23 +4228,29 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4226
4228
|
}
|
|
4227
4229
|
}]);
|
|
4228
4230
|
}();
|
|
4229
|
-
var a =
|
|
4230
|
-
|
|
4231
|
+
var a = {
|
|
4232
|
+
dot: "dot",
|
|
4233
|
+
square: "square",
|
|
4234
|
+
extraRounded: "extra-rounded"
|
|
4235
|
+
},
|
|
4236
|
+
h = Object.values(a);
|
|
4237
|
+
var d = /*#__PURE__*/function () {
|
|
4238
|
+
function d(_ref9) {
|
|
4231
4239
|
var t = _ref9.svg,
|
|
4232
4240
|
e = _ref9.type,
|
|
4233
4241
|
i = _ref9.window;
|
|
4234
|
-
_classCallCheck(this,
|
|
4242
|
+
_classCallCheck(this, d);
|
|
4235
4243
|
this._svg = t, this._type = e, this._window = i;
|
|
4236
4244
|
}
|
|
4237
|
-
return _createClass(
|
|
4245
|
+
return _createClass(d, [{
|
|
4238
4246
|
key: "draw",
|
|
4239
4247
|
value: function draw(t, e, i, r) {
|
|
4240
4248
|
var n;
|
|
4241
4249
|
switch (this._type) {
|
|
4242
|
-
case
|
|
4250
|
+
case a.square:
|
|
4243
4251
|
n = this._drawSquare;
|
|
4244
4252
|
break;
|
|
4245
|
-
case
|
|
4253
|
+
case a.extraRounded:
|
|
4246
4254
|
n = this._drawExtraRounded;
|
|
4247
4255
|
break;
|
|
4248
4256
|
default:
|
|
@@ -4257,67 +4265,67 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4257
4265
|
}
|
|
4258
4266
|
}, {
|
|
4259
4267
|
key: "_rotateFigure",
|
|
4260
|
-
value: function _rotateFigure(
|
|
4261
|
-
var t =
|
|
4262
|
-
e =
|
|
4263
|
-
i =
|
|
4264
|
-
|
|
4265
|
-
r =
|
|
4266
|
-
n =
|
|
4268
|
+
value: function _rotateFigure(_ref0) {
|
|
4269
|
+
var t = _ref0.x,
|
|
4270
|
+
e = _ref0.y,
|
|
4271
|
+
i = _ref0.size,
|
|
4272
|
+
_ref0$rotation = _ref0.rotation,
|
|
4273
|
+
r = _ref0$rotation === void 0 ? 0 : _ref0$rotation,
|
|
4274
|
+
n = _ref0.draw;
|
|
4267
4275
|
var o;
|
|
4268
4276
|
var s = t + i / 2,
|
|
4269
|
-
|
|
4270
|
-
n(), null === (o = this._element) || void 0 === o || o.setAttribute("transform", "rotate(".concat(180 * r / Math.PI, ",").concat(s, ",").concat(
|
|
4277
|
+
a = e + i / 2;
|
|
4278
|
+
n(), null === (o = this._element) || void 0 === o || o.setAttribute("transform", "rotate(".concat(180 * r / Math.PI, ",").concat(s, ",").concat(a, ")"));
|
|
4271
4279
|
}
|
|
4272
4280
|
}, {
|
|
4273
4281
|
key: "_basicDot",
|
|
4274
4282
|
value: function _basicDot(t) {
|
|
4275
|
-
var
|
|
4283
|
+
var _this0 = this;
|
|
4276
4284
|
var e = t.size,
|
|
4277
4285
|
i = t.x,
|
|
4278
4286
|
r = t.y,
|
|
4279
4287
|
n = e / 7;
|
|
4280
4288
|
this._rotateFigure(Object.assign(Object.assign({}, t), {
|
|
4281
4289
|
draw: function draw() {
|
|
4282
|
-
|
|
4290
|
+
_this0._element = _this0._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), _this0._element.setAttribute("clip-rule", "evenodd"), _this0._element.setAttribute("d", "M ".concat(i + e / 2, " ").concat(r, "a ").concat(e / 2, " ").concat(e / 2, " 0 1 0 0.1 0zm 0 ").concat(n, "a ").concat(e / 2 - n, " ").concat(e / 2 - n, " 0 1 1 -0.1 0Z"));
|
|
4283
4291
|
}
|
|
4284
4292
|
}));
|
|
4285
4293
|
}
|
|
4286
4294
|
}, {
|
|
4287
4295
|
key: "_basicSquare",
|
|
4288
4296
|
value: function _basicSquare(t) {
|
|
4289
|
-
var
|
|
4297
|
+
var _this1 = this;
|
|
4290
4298
|
var e = t.size,
|
|
4291
4299
|
i = t.x,
|
|
4292
4300
|
r = t.y,
|
|
4293
4301
|
n = e / 7;
|
|
4294
4302
|
this._rotateFigure(Object.assign(Object.assign({}, t), {
|
|
4295
4303
|
draw: function draw() {
|
|
4296
|
-
|
|
4304
|
+
_this1._element = _this1._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), _this1._element.setAttribute("clip-rule", "evenodd"), _this1._element.setAttribute("d", "M ".concat(i, " ").concat(r, "v ").concat(e, "h ").concat(e, "v ") + -e + "z" + "M ".concat(i + n, " ").concat(r + n, "h ") + (e - 2 * n) + "v " + (e - 2 * n) + "h " + (2 * n - e) + "z");
|
|
4297
4305
|
}
|
|
4298
4306
|
}));
|
|
4299
4307
|
}
|
|
4300
4308
|
}, {
|
|
4301
4309
|
key: "_basicExtraRounded",
|
|
4302
4310
|
value: function _basicExtraRounded(t) {
|
|
4303
|
-
var
|
|
4311
|
+
var _this10 = this;
|
|
4304
4312
|
var e = t.size,
|
|
4305
4313
|
i = t.x,
|
|
4306
4314
|
r = t.y,
|
|
4307
4315
|
n = e / 7;
|
|
4308
4316
|
this._rotateFigure(Object.assign(Object.assign({}, t), {
|
|
4309
4317
|
draw: function draw() {
|
|
4310
|
-
|
|
4318
|
+
_this10._element = _this10._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), _this10._element.setAttribute("clip-rule", "evenodd"), _this10._element.setAttribute("d", "M ".concat(i, " ").concat(r + 2.5 * n, "v ") + 2 * n + "a ".concat(2.5 * n, " ").concat(2.5 * n, ", 0, 0, 0, ").concat(2.5 * n, " ").concat(2.5 * n, "h ") + 2 * n + "a ".concat(2.5 * n, " ").concat(2.5 * n, ", 0, 0, 0, ").concat(2.5 * n, " ").concat(2.5 * -n, "v ") + -2 * n + "a ".concat(2.5 * n, " ").concat(2.5 * n, ", 0, 0, 0, ").concat(2.5 * -n, " ").concat(2.5 * -n, "h ") + -2 * n + "a ".concat(2.5 * n, " ").concat(2.5 * n, ", 0, 0, 0, ").concat(2.5 * -n, " ").concat(2.5 * n) + "M ".concat(i + 2.5 * n, " ").concat(r + n, "h ") + 2 * n + "a ".concat(1.5 * n, " ").concat(1.5 * n, ", 0, 0, 1, ").concat(1.5 * n, " ").concat(1.5 * n, "v ") + 2 * n + "a ".concat(1.5 * n, " ").concat(1.5 * n, ", 0, 0, 1, ").concat(1.5 * -n, " ").concat(1.5 * n, "h ") + -2 * n + "a ".concat(1.5 * n, " ").concat(1.5 * n, ", 0, 0, 1, ").concat(1.5 * -n, " ").concat(1.5 * -n, "v ") + -2 * n + "a ".concat(1.5 * n, " ").concat(1.5 * n, ", 0, 0, 1, ").concat(1.5 * n, " ").concat(1.5 * -n));
|
|
4311
4319
|
}
|
|
4312
4320
|
}));
|
|
4313
4321
|
}
|
|
4314
4322
|
}, {
|
|
4315
4323
|
key: "_drawDot",
|
|
4316
|
-
value: function _drawDot(
|
|
4317
|
-
var t =
|
|
4318
|
-
e =
|
|
4319
|
-
i =
|
|
4320
|
-
r =
|
|
4324
|
+
value: function _drawDot(_ref1) {
|
|
4325
|
+
var t = _ref1.x,
|
|
4326
|
+
e = _ref1.y,
|
|
4327
|
+
i = _ref1.size,
|
|
4328
|
+
r = _ref1.rotation;
|
|
4321
4329
|
this._basicDot({
|
|
4322
4330
|
x: t,
|
|
4323
4331
|
y: e,
|
|
@@ -4327,11 +4335,11 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4327
4335
|
}
|
|
4328
4336
|
}, {
|
|
4329
4337
|
key: "_drawSquare",
|
|
4330
|
-
value: function _drawSquare(
|
|
4331
|
-
var t =
|
|
4332
|
-
e =
|
|
4333
|
-
i =
|
|
4334
|
-
r =
|
|
4338
|
+
value: function _drawSquare(_ref10) {
|
|
4339
|
+
var t = _ref10.x,
|
|
4340
|
+
e = _ref10.y,
|
|
4341
|
+
i = _ref10.size,
|
|
4342
|
+
r = _ref10.rotation;
|
|
4335
4343
|
this._basicSquare({
|
|
4336
4344
|
x: t,
|
|
4337
4345
|
y: e,
|
|
@@ -4341,11 +4349,11 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4341
4349
|
}
|
|
4342
4350
|
}, {
|
|
4343
4351
|
key: "_drawExtraRounded",
|
|
4344
|
-
value: function _drawExtraRounded(
|
|
4345
|
-
var t =
|
|
4346
|
-
e =
|
|
4347
|
-
i =
|
|
4348
|
-
r =
|
|
4352
|
+
value: function _drawExtraRounded(_ref11) {
|
|
4353
|
+
var t = _ref11.x,
|
|
4354
|
+
e = _ref11.y,
|
|
4355
|
+
i = _ref11.size,
|
|
4356
|
+
r = _ref11.rotation;
|
|
4349
4357
|
this._basicExtraRounded({
|
|
4350
4358
|
x: t,
|
|
4351
4359
|
y: e,
|
|
@@ -4355,19 +4363,24 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4355
4363
|
}
|
|
4356
4364
|
}]);
|
|
4357
4365
|
}();
|
|
4358
|
-
var
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4366
|
+
var u = {
|
|
4367
|
+
dot: "dot",
|
|
4368
|
+
square: "square"
|
|
4369
|
+
},
|
|
4370
|
+
c = Object.values(u);
|
|
4371
|
+
var l = /*#__PURE__*/function () {
|
|
4372
|
+
function l(_ref12) {
|
|
4373
|
+
var t = _ref12.svg,
|
|
4374
|
+
e = _ref12.type,
|
|
4375
|
+
i = _ref12.window;
|
|
4376
|
+
_classCallCheck(this, l);
|
|
4364
4377
|
this._svg = t, this._type = e, this._window = i;
|
|
4365
4378
|
}
|
|
4366
|
-
return _createClass(
|
|
4379
|
+
return _createClass(l, [{
|
|
4367
4380
|
key: "draw",
|
|
4368
4381
|
value: function draw(t, e, i, r) {
|
|
4369
4382
|
var n;
|
|
4370
|
-
n =
|
|
4383
|
+
n = this._type === u.square ? this._drawSquare : this._drawDot, n.call(this, {
|
|
4371
4384
|
x: t,
|
|
4372
4385
|
y: e,
|
|
4373
4386
|
size: i,
|
|
@@ -4376,13 +4389,13 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4376
4389
|
}
|
|
4377
4390
|
}, {
|
|
4378
4391
|
key: "_rotateFigure",
|
|
4379
|
-
value: function _rotateFigure(
|
|
4380
|
-
var t =
|
|
4381
|
-
e =
|
|
4382
|
-
i =
|
|
4383
|
-
|
|
4384
|
-
r =
|
|
4385
|
-
n =
|
|
4392
|
+
value: function _rotateFigure(_ref13) {
|
|
4393
|
+
var t = _ref13.x,
|
|
4394
|
+
e = _ref13.y,
|
|
4395
|
+
i = _ref13.size,
|
|
4396
|
+
_ref13$rotation = _ref13.rotation,
|
|
4397
|
+
r = _ref13$rotation === void 0 ? 0 : _ref13$rotation,
|
|
4398
|
+
n = _ref13.draw;
|
|
4386
4399
|
var o;
|
|
4387
4400
|
var s = t + i / 2,
|
|
4388
4401
|
a = e + i / 2;
|
|
@@ -4391,36 +4404,36 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4391
4404
|
}, {
|
|
4392
4405
|
key: "_basicDot",
|
|
4393
4406
|
value: function _basicDot(t) {
|
|
4394
|
-
var
|
|
4407
|
+
var _this11 = this;
|
|
4395
4408
|
var e = t.size,
|
|
4396
4409
|
i = t.x,
|
|
4397
4410
|
r = t.y;
|
|
4398
4411
|
this._rotateFigure(Object.assign(Object.assign({}, t), {
|
|
4399
4412
|
draw: function draw() {
|
|
4400
|
-
|
|
4413
|
+
_this11._element = _this11._window.document.createElementNS("http://www.w3.org/2000/svg", "circle"), _this11._element.setAttribute("cx", String(i + e / 2)), _this11._element.setAttribute("cy", String(r + e / 2)), _this11._element.setAttribute("r", String(e / 2));
|
|
4401
4414
|
}
|
|
4402
4415
|
}));
|
|
4403
4416
|
}
|
|
4404
4417
|
}, {
|
|
4405
4418
|
key: "_basicSquare",
|
|
4406
4419
|
value: function _basicSquare(t) {
|
|
4407
|
-
var
|
|
4420
|
+
var _this12 = this;
|
|
4408
4421
|
var e = t.size,
|
|
4409
4422
|
i = t.x,
|
|
4410
4423
|
r = t.y;
|
|
4411
4424
|
this._rotateFigure(Object.assign(Object.assign({}, t), {
|
|
4412
4425
|
draw: function draw() {
|
|
4413
|
-
|
|
4426
|
+
_this12._element = _this12._window.document.createElementNS("http://www.w3.org/2000/svg", "rect"), _this12._element.setAttribute("x", String(i)), _this12._element.setAttribute("y", String(r)), _this12._element.setAttribute("width", String(e)), _this12._element.setAttribute("height", String(e));
|
|
4414
4427
|
}
|
|
4415
4428
|
}));
|
|
4416
4429
|
}
|
|
4417
4430
|
}, {
|
|
4418
4431
|
key: "_drawDot",
|
|
4419
|
-
value: function _drawDot(
|
|
4420
|
-
var t =
|
|
4421
|
-
e =
|
|
4422
|
-
i =
|
|
4423
|
-
r =
|
|
4432
|
+
value: function _drawDot(_ref14) {
|
|
4433
|
+
var t = _ref14.x,
|
|
4434
|
+
e = _ref14.y,
|
|
4435
|
+
i = _ref14.size,
|
|
4436
|
+
r = _ref14.rotation;
|
|
4424
4437
|
this._basicDot({
|
|
4425
4438
|
x: t,
|
|
4426
4439
|
y: e,
|
|
@@ -4430,11 +4443,11 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4430
4443
|
}
|
|
4431
4444
|
}, {
|
|
4432
4445
|
key: "_drawSquare",
|
|
4433
|
-
value: function _drawSquare(
|
|
4434
|
-
var t =
|
|
4435
|
-
e =
|
|
4436
|
-
i =
|
|
4437
|
-
r =
|
|
4446
|
+
value: function _drawSquare(_ref15) {
|
|
4447
|
+
var t = _ref15.x,
|
|
4448
|
+
e = _ref15.y,
|
|
4449
|
+
i = _ref15.size,
|
|
4450
|
+
r = _ref15.rotation;
|
|
4438
4451
|
this._basicSquare({
|
|
4439
4452
|
x: t,
|
|
4440
4453
|
y: e,
|
|
@@ -4444,18 +4457,18 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4444
4457
|
}
|
|
4445
4458
|
}]);
|
|
4446
4459
|
}();
|
|
4447
|
-
var
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
var
|
|
4451
|
-
function
|
|
4452
|
-
var
|
|
4453
|
-
_classCallCheck(this,
|
|
4460
|
+
var g = "circle",
|
|
4461
|
+
f = [[1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1]],
|
|
4462
|
+
w = [[0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]];
|
|
4463
|
+
var p = /*#__PURE__*/function () {
|
|
4464
|
+
function p(t, e) {
|
|
4465
|
+
var _this13 = this;
|
|
4466
|
+
_classCallCheck(this, p);
|
|
4454
4467
|
this._roundSize = function (t) {
|
|
4455
|
-
return
|
|
4456
|
-
}, this._window = e, this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "svg"), this._element.setAttribute("width", String(t.width)), this._element.setAttribute("height", String(t.height)), this._element.setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink"), t.dotsOptions.roundSize || this._element.setAttribute("shape-rendering", "crispEdges"), this._element.setAttribute("viewBox", "0 0 ".concat(t.width, " ").concat(t.height)), this._defs = this._window.document.createElementNS("http://www.w3.org/2000/svg", "defs"), this._element.appendChild(this._defs), this._imageUri = t.image, this._instanceId =
|
|
4468
|
+
return _this13._options.dotsOptions.roundSize ? Math.floor(t) : t;
|
|
4469
|
+
}, this._window = e, this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "svg"), this._element.setAttribute("width", String(t.width)), this._element.setAttribute("height", String(t.height)), this._element.setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink"), t.dotsOptions.roundSize || this._element.setAttribute("shape-rendering", "crispEdges"), this._element.setAttribute("viewBox", "0 0 ".concat(t.width, " ").concat(t.height)), this._defs = this._window.document.createElementNS("http://www.w3.org/2000/svg", "defs"), this._element.appendChild(this._defs), this._imageUri = t.image, this._instanceId = p.instanceCount++, this._options = t;
|
|
4457
4470
|
}
|
|
4458
|
-
return _createClass(
|
|
4471
|
+
return _createClass(p, [{
|
|
4459
4472
|
key: "width",
|
|
4460
4473
|
get: function get() {
|
|
4461
4474
|
return this._options.width;
|
|
@@ -4473,13 +4486,13 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4473
4486
|
}, {
|
|
4474
4487
|
key: "drawQR",
|
|
4475
4488
|
value: function () {
|
|
4476
|
-
var _drawQR = _asyncToGenerator(/*#__PURE__*/
|
|
4477
|
-
var
|
|
4478
|
-
var e, i, r, n, s, _this$_options, _t3, _i, _r5,
|
|
4479
|
-
return
|
|
4480
|
-
while (1) switch (_context2.
|
|
4489
|
+
var _drawQR = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(t) {
|
|
4490
|
+
var _this14 = this;
|
|
4491
|
+
var e, i, r, n, s, _this$_options, _t3, _i, _r5, _a, _t4;
|
|
4492
|
+
return _regenerator().w(function (_context2) {
|
|
4493
|
+
while (1) switch (_context2.n) {
|
|
4481
4494
|
case 0:
|
|
4482
|
-
e = t.getModuleCount(), i = Math.min(this._options.width, this._options.height) - 2 * this._options.margin, r = this._options.shape ===
|
|
4495
|
+
e = t.getModuleCount(), i = Math.min(this._options.width, this._options.height) - 2 * this._options.margin, r = this._options.shape === g ? i / Math.sqrt(2) : i, n = this._roundSize(r / e);
|
|
4483
4496
|
s = {
|
|
4484
4497
|
hideXDots: 0,
|
|
4485
4498
|
hideYDots: 0,
|
|
@@ -4487,25 +4500,25 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4487
4500
|
height: 0
|
|
4488
4501
|
};
|
|
4489
4502
|
if (!(this._qr = t, this._options.image)) {
|
|
4490
|
-
_context2.
|
|
4503
|
+
_context2.n = 3;
|
|
4491
4504
|
break;
|
|
4492
4505
|
}
|
|
4493
|
-
_context2.
|
|
4506
|
+
_context2.n = 1;
|
|
4494
4507
|
return this.loadImage();
|
|
4495
|
-
case
|
|
4508
|
+
case 1:
|
|
4496
4509
|
if (this._image) {
|
|
4497
|
-
_context2.
|
|
4510
|
+
_context2.n = 2;
|
|
4498
4511
|
break;
|
|
4499
4512
|
}
|
|
4500
|
-
return _context2.
|
|
4501
|
-
case
|
|
4502
|
-
_this$_options = this._options, _t3 = _this$_options.imageOptions, _i = _this$_options.qrOptions, _r5 = _t3.imageSize * o[_i.errorCorrectionLevel],
|
|
4503
|
-
s = function (
|
|
4504
|
-
var t =
|
|
4505
|
-
e =
|
|
4506
|
-
i =
|
|
4507
|
-
r =
|
|
4508
|
-
n =
|
|
4513
|
+
return _context2.a(2);
|
|
4514
|
+
case 2:
|
|
4515
|
+
_this$_options = this._options, _t3 = _this$_options.imageOptions, _i = _this$_options.qrOptions, _r5 = _t3.imageSize * o[_i.errorCorrectionLevel], _a = Math.floor(_r5 * e * e);
|
|
4516
|
+
s = function (_ref16) {
|
|
4517
|
+
var t = _ref16.originalHeight,
|
|
4518
|
+
e = _ref16.originalWidth,
|
|
4519
|
+
i = _ref16.maxHiddenDots,
|
|
4520
|
+
r = _ref16.maxHiddenAxisDots,
|
|
4521
|
+
n = _ref16.dotSize;
|
|
4509
4522
|
var o = {
|
|
4510
4523
|
x: 0,
|
|
4511
4524
|
y: 0
|
|
@@ -4530,32 +4543,31 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4530
4543
|
}({
|
|
4531
4544
|
originalWidth: this._image.width,
|
|
4532
4545
|
originalHeight: this._image.height,
|
|
4533
|
-
maxHiddenDots:
|
|
4546
|
+
maxHiddenDots: _a,
|
|
4534
4547
|
maxHiddenAxisDots: e - 14,
|
|
4535
4548
|
dotSize: n
|
|
4536
4549
|
});
|
|
4537
|
-
case
|
|
4550
|
+
case 3:
|
|
4538
4551
|
this.drawBackground();
|
|
4539
4552
|
this.drawDots(function (t, i) {
|
|
4540
4553
|
var r, n, o, a, h, d;
|
|
4541
|
-
return !(
|
|
4554
|
+
return !(_this14._options.imageOptions.hideBackgroundDots && t >= (e - s.hideYDots) / 2 && t < (e + s.hideYDots) / 2 && i >= (e - s.hideXDots) / 2 && i < (e + s.hideXDots) / 2 || (null === (r = f[t]) || void 0 === r ? void 0 : r[i]) || (null === (n = f[t - e + 7]) || void 0 === n ? void 0 : n[i]) || (null === (o = f[t]) || void 0 === o ? void 0 : o[i - e + 7]) || (null === (a = w[t]) || void 0 === a ? void 0 : a[i]) || (null === (h = w[t - e + 7]) || void 0 === h ? void 0 : h[i]) || (null === (d = w[t]) || void 0 === d ? void 0 : d[i - e + 7]));
|
|
4542
4555
|
});
|
|
4543
4556
|
this.drawCorners();
|
|
4544
|
-
|
|
4545
|
-
if (!
|
|
4546
|
-
_context2.
|
|
4557
|
+
_t4 = this._options.image;
|
|
4558
|
+
if (!_t4) {
|
|
4559
|
+
_context2.n = 4;
|
|
4547
4560
|
break;
|
|
4548
4561
|
}
|
|
4549
|
-
_context2.
|
|
4562
|
+
_context2.n = 4;
|
|
4550
4563
|
return this.drawImage({
|
|
4551
4564
|
width: s.width,
|
|
4552
4565
|
height: s.height,
|
|
4553
4566
|
count: e,
|
|
4554
4567
|
dotSize: n
|
|
4555
4568
|
});
|
|
4556
|
-
case
|
|
4557
|
-
|
|
4558
|
-
return _context2.stop();
|
|
4569
|
+
case 4:
|
|
4570
|
+
return _context2.a(2);
|
|
4559
4571
|
}
|
|
4560
4572
|
}, _callee, this);
|
|
4561
4573
|
}));
|
|
@@ -4573,11 +4585,11 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4573
4585
|
if (r) {
|
|
4574
4586
|
var _r6 = null === (t = n.backgroundOptions) || void 0 === t ? void 0 : t.gradient,
|
|
4575
4587
|
_o = null === (e = n.backgroundOptions) || void 0 === e ? void 0 : e.color;
|
|
4576
|
-
var
|
|
4577
|
-
|
|
4588
|
+
var s = n.height,
|
|
4589
|
+
_a2 = n.width;
|
|
4578
4590
|
if (_r6 || _o) {
|
|
4579
|
-
var
|
|
4580
|
-
this._backgroundClipPath = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), this._backgroundClipPath.setAttribute("id", "clip-path-background-color-".concat(this._instanceId)), this._defs.appendChild(this._backgroundClipPath), (null === (i = n.backgroundOptions) || void 0 === i ? void 0 : i.round) && (
|
|
4591
|
+
var _t5 = this._window.document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
4592
|
+
this._backgroundClipPath = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), this._backgroundClipPath.setAttribute("id", "clip-path-background-color-".concat(this._instanceId)), this._defs.appendChild(this._backgroundClipPath), (null === (i = n.backgroundOptions) || void 0 === i ? void 0 : i.round) && (s = _a2 = Math.min(n.width, n.height), _t5.setAttribute("rx", String(s / 2 * n.backgroundOptions.round))), _t5.setAttribute("x", String(this._roundSize((n.width - _a2) / 2))), _t5.setAttribute("y", String(this._roundSize((n.height - s) / 2))), _t5.setAttribute("width", String(_a2)), _t5.setAttribute("height", String(s)), this._backgroundClipPath.appendChild(_t5), this._createColor({
|
|
4581
4593
|
options: _r6,
|
|
4582
4594
|
color: _o,
|
|
4583
4595
|
additionalRotation: 0,
|
|
@@ -4593,18 +4605,18 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4593
4605
|
}, {
|
|
4594
4606
|
key: "drawDots",
|
|
4595
4607
|
value: function drawDots(t) {
|
|
4596
|
-
var
|
|
4608
|
+
var _this15 = this;
|
|
4597
4609
|
var e, i;
|
|
4598
4610
|
if (!this._qr) throw "QR code is not defined";
|
|
4599
4611
|
var r = this._options,
|
|
4600
4612
|
n = this._qr.getModuleCount();
|
|
4601
4613
|
if (n > r.width || n > r.height) throw "The canvas is too small.";
|
|
4602
4614
|
var o = Math.min(r.width, r.height) - 2 * r.margin,
|
|
4603
|
-
a = r.shape ===
|
|
4615
|
+
a = r.shape === g ? o / Math.sqrt(2) : o,
|
|
4604
4616
|
h = this._roundSize(a / n),
|
|
4605
|
-
|
|
4606
|
-
|
|
4607
|
-
|
|
4617
|
+
d = this._roundSize((r.width - n * h) / 2),
|
|
4618
|
+
u = this._roundSize((r.height - n * h) / 2),
|
|
4619
|
+
c = new s({
|
|
4608
4620
|
svg: this._element,
|
|
4609
4621
|
type: r.dotsOptions.type,
|
|
4610
4622
|
window: this._window
|
|
@@ -4621,9 +4633,9 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4621
4633
|
});
|
|
4622
4634
|
var _loop = function _loop(_e2) {
|
|
4623
4635
|
var _loop4 = function _loop4(_r9) {
|
|
4624
|
-
t && !t(_e2, _r9) || (null === (i =
|
|
4625
|
-
return !(_r9 + i < 0 || _e2 + o < 0 || _r9 + i >= n || _e2 + o >= n) && !(t && !t(_e2 + o, _r9 + i)) && !!
|
|
4626
|
-
}),
|
|
4636
|
+
t && !t(_e2, _r9) || (null === (i = _this15._qr) || void 0 === i ? void 0 : i.isDark(_e2, _r9)) && (c.draw(d + _r9 * h, u + _e2 * h, h, function (i, o) {
|
|
4637
|
+
return !(_r9 + i < 0 || _e2 + o < 0 || _r9 + i >= n || _e2 + o >= n) && !(t && !t(_e2 + o, _r9 + i)) && !!_this15._qr && _this15._qr.isDark(_e2 + o, _r9 + i);
|
|
4638
|
+
}), c._element && _this15._dotsClipPath && _this15._dotsClipPath.appendChild(c._element));
|
|
4627
4639
|
};
|
|
4628
4640
|
for (var _r9 = 0; _r9 < n; _r9++) {
|
|
4629
4641
|
_loop4(_r9);
|
|
@@ -4632,130 +4644,130 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4632
4644
|
for (var _e2 = 0; _e2 < n; _e2++) {
|
|
4633
4645
|
_loop(_e2);
|
|
4634
4646
|
}
|
|
4635
|
-
if (r.shape ===
|
|
4636
|
-
var
|
|
4637
|
-
_e3 = n + 2 *
|
|
4638
|
-
_i2 =
|
|
4639
|
-
_r7 =
|
|
4640
|
-
|
|
4641
|
-
|
|
4647
|
+
if (r.shape === g) {
|
|
4648
|
+
var _t6 = this._roundSize((o / h - n) / 2),
|
|
4649
|
+
_e3 = n + 2 * _t6,
|
|
4650
|
+
_i2 = d - _t6 * h,
|
|
4651
|
+
_r7 = u - _t6 * h,
|
|
4652
|
+
s = [],
|
|
4653
|
+
_a3 = this._roundSize(_e3 / 2);
|
|
4642
4654
|
for (var _i3 = 0; _i3 < _e3; _i3++) {
|
|
4643
|
-
|
|
4644
|
-
for (var _r8 = 0; _r8 < _e3; _r8++) _i3 >=
|
|
4655
|
+
s[_i3] = [];
|
|
4656
|
+
for (var _r8 = 0; _r8 < _e3; _r8++) _i3 >= _t6 - 1 && _i3 <= _e3 - _t6 && _r8 >= _t6 - 1 && _r8 <= _e3 - _t6 || Math.sqrt((_i3 - _a3) * (_i3 - _a3) + (_r8 - _a3) * (_r8 - _a3)) > _a3 ? s[_i3][_r8] = 0 : s[_i3][_r8] = this._qr.isDark(_r8 - 2 * _t6 < 0 ? _r8 : _r8 >= n ? _r8 - 2 * _t6 : _r8 - _t6, _i3 - 2 * _t6 < 0 ? _i3 : _i3 >= n ? _i3 - 2 * _t6 : _i3 - _t6) ? 1 : 0;
|
|
4645
4657
|
}
|
|
4646
|
-
var _loop2 = function _loop2(
|
|
4658
|
+
var _loop2 = function _loop2(_t7) {
|
|
4647
4659
|
var _loop3 = function _loop3(_n) {
|
|
4648
|
-
|
|
4660
|
+
s[_t7][_n] && (c.draw(_i2 + _n * h, _r7 + _t7 * h, h, function (e, i) {
|
|
4649
4661
|
var r;
|
|
4650
|
-
return !!(null === (r =
|
|
4651
|
-
}),
|
|
4662
|
+
return !!(null === (r = s[_t7 + i]) || void 0 === r ? void 0 : r[_n + e]);
|
|
4663
|
+
}), c._element && _this15._dotsClipPath && _this15._dotsClipPath.appendChild(c._element));
|
|
4652
4664
|
};
|
|
4653
4665
|
for (var _n = 0; _n < _e3; _n++) {
|
|
4654
4666
|
_loop3(_n);
|
|
4655
4667
|
}
|
|
4656
4668
|
};
|
|
4657
|
-
for (var
|
|
4658
|
-
_loop2(
|
|
4669
|
+
for (var _t7 = 0; _t7 < _e3; _t7++) {
|
|
4670
|
+
_loop2(_t7);
|
|
4659
4671
|
}
|
|
4660
4672
|
}
|
|
4661
4673
|
}
|
|
4662
4674
|
}, {
|
|
4663
4675
|
key: "drawCorners",
|
|
4664
4676
|
value: function drawCorners() {
|
|
4665
|
-
var
|
|
4677
|
+
var _this16 = this;
|
|
4666
4678
|
if (!this._qr) throw "QR code is not defined";
|
|
4667
4679
|
var t = this._element,
|
|
4668
4680
|
e = this._options;
|
|
4669
4681
|
if (!t) throw "Element code is not defined";
|
|
4670
4682
|
var i = this._qr.getModuleCount(),
|
|
4671
4683
|
r = Math.min(e.width, e.height) - 2 * e.margin,
|
|
4672
|
-
n = e.shape ===
|
|
4684
|
+
n = e.shape === g ? r / Math.sqrt(2) : r,
|
|
4673
4685
|
o = this._roundSize(n / i),
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
[[0, 0, 0], [1, 0, Math.PI / 2], [0, 1, -Math.PI / 2]].forEach(function (
|
|
4679
|
-
var
|
|
4680
|
-
t =
|
|
4681
|
-
r =
|
|
4682
|
-
n =
|
|
4683
|
-
var
|
|
4684
|
-
var
|
|
4685
|
-
|
|
4686
|
-
var
|
|
4687
|
-
|
|
4688
|
-
if (((null === (
|
|
4689
|
-
options: null === (
|
|
4690
|
-
color: null === (
|
|
4686
|
+
a = 7 * o,
|
|
4687
|
+
u = 3 * o,
|
|
4688
|
+
_p = this._roundSize((e.width - i * o) / 2),
|
|
4689
|
+
v = this._roundSize((e.height - i * o) / 2);
|
|
4690
|
+
[[0, 0, 0], [1, 0, Math.PI / 2], [0, 1, -Math.PI / 2]].forEach(function (_ref17) {
|
|
4691
|
+
var _ref18 = _slicedToArray(_ref17, 3),
|
|
4692
|
+
t = _ref18[0],
|
|
4693
|
+
r = _ref18[1],
|
|
4694
|
+
n = _ref18[2];
|
|
4695
|
+
var g, _, m, b, y, x, S, C, A, M, $, O, D, k;
|
|
4696
|
+
var z = _p + t * o * (i - 7),
|
|
4697
|
+
B = v + r * o * (i - 7);
|
|
4698
|
+
var P = _this16._dotsClipPath,
|
|
4699
|
+
I = _this16._dotsClipPath;
|
|
4700
|
+
if (((null === (g = e.cornersSquareOptions) || void 0 === g ? void 0 : g.gradient) || (null === (_ = e.cornersSquareOptions) || void 0 === _ ? void 0 : _.color)) && (P = _this16._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), P.setAttribute("id", "clip-path-corners-square-color-".concat(t, "-").concat(r, "-").concat(_this16._instanceId)), _this16._defs.appendChild(P), _this16._cornersSquareClipPath = _this16._cornersDotClipPath = I = P, _this16._createColor({
|
|
4701
|
+
options: null === (m = e.cornersSquareOptions) || void 0 === m ? void 0 : m.gradient,
|
|
4702
|
+
color: null === (b = e.cornersSquareOptions) || void 0 === b ? void 0 : b.color,
|
|
4691
4703
|
additionalRotation: n,
|
|
4692
|
-
x:
|
|
4693
|
-
y:
|
|
4694
|
-
height:
|
|
4695
|
-
width:
|
|
4696
|
-
name: "corners-square-color-".concat(t, "-").concat(r, "-").concat(
|
|
4697
|
-
})), null === (
|
|
4698
|
-
var
|
|
4699
|
-
svg:
|
|
4704
|
+
x: z,
|
|
4705
|
+
y: B,
|
|
4706
|
+
height: a,
|
|
4707
|
+
width: a,
|
|
4708
|
+
name: "corners-square-color-".concat(t, "-").concat(r, "-").concat(_this16._instanceId)
|
|
4709
|
+
})), (null === (y = e.cornersSquareOptions) || void 0 === y ? void 0 : y.type) && h.includes(e.cornersSquareOptions.type)) {
|
|
4710
|
+
var _t8 = new d({
|
|
4711
|
+
svg: _this16._element,
|
|
4700
4712
|
type: e.cornersSquareOptions.type,
|
|
4701
|
-
window:
|
|
4713
|
+
window: _this16._window
|
|
4702
4714
|
});
|
|
4703
|
-
|
|
4715
|
+
_t8.draw(z, B, a, n), _t8._element && P && P.appendChild(_t8._element);
|
|
4704
4716
|
} else {
|
|
4705
|
-
var
|
|
4706
|
-
svg:
|
|
4707
|
-
type: e.dotsOptions.type,
|
|
4708
|
-
window:
|
|
4717
|
+
var _t9 = new s({
|
|
4718
|
+
svg: _this16._element,
|
|
4719
|
+
type: (null === (x = e.cornersSquareOptions) || void 0 === x ? void 0 : x.type) || e.dotsOptions.type,
|
|
4720
|
+
window: _this16._window
|
|
4709
4721
|
});
|
|
4710
4722
|
var _loop5 = function _loop5(_e4) {
|
|
4711
4723
|
var _loop6 = function _loop6(_i4) {
|
|
4712
|
-
(null === (
|
|
4724
|
+
(null === (S = f[_e4]) || void 0 === S ? void 0 : S[_i4]) && (_t9.draw(z + _i4 * o, B + _e4 * o, o, function (t, r) {
|
|
4713
4725
|
var n;
|
|
4714
|
-
return !!(null === (n =
|
|
4715
|
-
}),
|
|
4726
|
+
return !!(null === (n = f[_e4 + r]) || void 0 === n ? void 0 : n[_i4 + t]);
|
|
4727
|
+
}), _t9._element && P && P.appendChild(_t9._element));
|
|
4716
4728
|
};
|
|
4717
|
-
for (var _i4 = 0; _i4 <
|
|
4729
|
+
for (var _i4 = 0; _i4 < f[_e4].length; _i4++) {
|
|
4718
4730
|
_loop6(_i4);
|
|
4719
4731
|
}
|
|
4720
4732
|
};
|
|
4721
|
-
for (var _e4 = 0; _e4 <
|
|
4733
|
+
for (var _e4 = 0; _e4 < f.length; _e4++) {
|
|
4722
4734
|
_loop5(_e4);
|
|
4723
4735
|
}
|
|
4724
4736
|
}
|
|
4725
|
-
if (((null === (
|
|
4726
|
-
options: null === (
|
|
4727
|
-
color: null === (
|
|
4737
|
+
if (((null === (C = e.cornersDotOptions) || void 0 === C ? void 0 : C.gradient) || (null === (A = e.cornersDotOptions) || void 0 === A ? void 0 : A.color)) && (I = _this16._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), I.setAttribute("id", "clip-path-corners-dot-color-".concat(t, "-").concat(r, "-").concat(_this16._instanceId)), _this16._defs.appendChild(I), _this16._cornersDotClipPath = I, _this16._createColor({
|
|
4738
|
+
options: null === (M = e.cornersDotOptions) || void 0 === M ? void 0 : M.gradient,
|
|
4739
|
+
color: null === ($ = e.cornersDotOptions) || void 0 === $ ? void 0 : $.color,
|
|
4728
4740
|
additionalRotation: n,
|
|
4729
|
-
x:
|
|
4730
|
-
y:
|
|
4731
|
-
height:
|
|
4732
|
-
width:
|
|
4733
|
-
name: "corners-dot-color-".concat(t, "-").concat(r, "-").concat(
|
|
4734
|
-
})), null === (
|
|
4735
|
-
var
|
|
4736
|
-
svg:
|
|
4741
|
+
x: z + 2 * o,
|
|
4742
|
+
y: B + 2 * o,
|
|
4743
|
+
height: u,
|
|
4744
|
+
width: u,
|
|
4745
|
+
name: "corners-dot-color-".concat(t, "-").concat(r, "-").concat(_this16._instanceId)
|
|
4746
|
+
})), (null === (O = e.cornersDotOptions) || void 0 === O ? void 0 : O.type) && c.includes(e.cornersDotOptions.type)) {
|
|
4747
|
+
var _t0 = new l({
|
|
4748
|
+
svg: _this16._element,
|
|
4737
4749
|
type: e.cornersDotOptions.type,
|
|
4738
|
-
window:
|
|
4750
|
+
window: _this16._window
|
|
4739
4751
|
});
|
|
4740
|
-
|
|
4752
|
+
_t0.draw(z + 2 * o, B + 2 * o, u, n), _t0._element && I && I.appendChild(_t0._element);
|
|
4741
4753
|
} else {
|
|
4742
|
-
var
|
|
4743
|
-
svg:
|
|
4744
|
-
type: e.dotsOptions.type,
|
|
4745
|
-
window:
|
|
4754
|
+
var _t1 = new s({
|
|
4755
|
+
svg: _this16._element,
|
|
4756
|
+
type: (null === (D = e.cornersDotOptions) || void 0 === D ? void 0 : D.type) || e.dotsOptions.type,
|
|
4757
|
+
window: _this16._window
|
|
4746
4758
|
});
|
|
4747
4759
|
var _loop7 = function _loop7(_e5) {
|
|
4748
4760
|
var _loop8 = function _loop8(_i5) {
|
|
4749
|
-
(null === (
|
|
4761
|
+
(null === (k = w[_e5]) || void 0 === k ? void 0 : k[_i5]) && (_t1.draw(z + _i5 * o, B + _e5 * o, o, function (t, r) {
|
|
4750
4762
|
var n;
|
|
4751
|
-
return !!(null === (n =
|
|
4752
|
-
}),
|
|
4763
|
+
return !!(null === (n = w[_e5 + r]) || void 0 === n ? void 0 : n[_i5 + t]);
|
|
4764
|
+
}), _t1._element && I && I.appendChild(_t1._element));
|
|
4753
4765
|
};
|
|
4754
|
-
for (var _i5 = 0; _i5 <
|
|
4766
|
+
for (var _i5 = 0; _i5 < w[_e5].length; _i5++) {
|
|
4755
4767
|
_loop8(_i5);
|
|
4756
4768
|
}
|
|
4757
4769
|
};
|
|
4758
|
-
for (var _e5 = 0; _e5 <
|
|
4770
|
+
for (var _e5 = 0; _e5 < w.length; _e5++) {
|
|
4759
4771
|
_loop7(_e5);
|
|
4760
4772
|
}
|
|
4761
4773
|
}
|
|
@@ -4764,36 +4776,37 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4764
4776
|
}, {
|
|
4765
4777
|
key: "loadImage",
|
|
4766
4778
|
value: function loadImage() {
|
|
4767
|
-
var
|
|
4779
|
+
var _this17 = this;
|
|
4768
4780
|
return new Promise(function (t, e) {
|
|
4769
4781
|
var i;
|
|
4770
|
-
var r =
|
|
4782
|
+
var r = _this17._options;
|
|
4771
4783
|
if (!r.image) return e("Image is not defined");
|
|
4772
4784
|
if (null === (i = r.nodeCanvas) || void 0 === i ? void 0 : i.loadImage) r.nodeCanvas.loadImage(r.image).then(function (e) {
|
|
4773
4785
|
var i, n;
|
|
4774
|
-
if (
|
|
4775
|
-
var
|
|
4776
|
-
null === (n = null ==
|
|
4786
|
+
if (_this17._image = e, _this17._options.imageOptions.saveAsBlob) {
|
|
4787
|
+
var _t10 = null === (i = r.nodeCanvas) || void 0 === i ? void 0 : i.createCanvas(_this17._image.width, _this17._image.height);
|
|
4788
|
+
null === (n = null == _t10 ? void 0 : _t10.getContext("2d")) || void 0 === n || n.drawImage(e, 0, 0), _this17._imageUri = null == _t10 ? void 0 : _t10.toDataURL();
|
|
4777
4789
|
}
|
|
4778
4790
|
t();
|
|
4779
4791
|
})["catch"](e);else {
|
|
4780
|
-
var _e6 = new
|
|
4781
|
-
"string" == typeof r.imageOptions.crossOrigin && (_e6.crossOrigin = r.imageOptions.crossOrigin),
|
|
4782
|
-
|
|
4783
|
-
|
|
4792
|
+
var _e6 = new _this17._window.Image();
|
|
4793
|
+
"string" == typeof r.imageOptions.crossOrigin && (_e6.crossOrigin = r.imageOptions.crossOrigin), _this17._image = _e6, _e6.onload = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
|
|
4794
|
+
var _t11;
|
|
4795
|
+
return _regenerator().w(function (_context4) {
|
|
4796
|
+
while (1) switch (_context4.n) {
|
|
4784
4797
|
case 0:
|
|
4785
|
-
|
|
4786
|
-
if (!
|
|
4787
|
-
_context4.
|
|
4798
|
+
_t11 = _this17._options.imageOptions.saveAsBlob;
|
|
4799
|
+
if (!_t11) {
|
|
4800
|
+
_context4.n = 2;
|
|
4788
4801
|
break;
|
|
4789
4802
|
}
|
|
4790
|
-
_context4.
|
|
4803
|
+
_context4.n = 1;
|
|
4791
4804
|
return function () {
|
|
4792
|
-
var
|
|
4793
|
-
return
|
|
4794
|
-
while (1) switch (_context3.
|
|
4805
|
+
var _ref20 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(t, e) {
|
|
4806
|
+
return _regenerator().w(function (_context3) {
|
|
4807
|
+
while (1) switch (_context3.n) {
|
|
4795
4808
|
case 0:
|
|
4796
|
-
return _context3.
|
|
4809
|
+
return _context3.a(2, new Promise(function (i) {
|
|
4797
4810
|
var r = new e.XMLHttpRequest();
|
|
4798
4811
|
r.onload = function () {
|
|
4799
4812
|
var t = new e.FileReader();
|
|
@@ -4802,23 +4815,19 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4802
4815
|
}, t.readAsDataURL(r.response);
|
|
4803
4816
|
}, r.open("GET", t), r.responseType = "blob", r.send();
|
|
4804
4817
|
}));
|
|
4805
|
-
case 1:
|
|
4806
|
-
case "end":
|
|
4807
|
-
return _context3.stop();
|
|
4808
4818
|
}
|
|
4809
4819
|
}, _callee2);
|
|
4810
4820
|
}));
|
|
4811
4821
|
return function (_x2, _x3) {
|
|
4812
|
-
return
|
|
4822
|
+
return _ref20.apply(this, arguments);
|
|
4813
4823
|
};
|
|
4814
|
-
}()(r.image || "",
|
|
4815
|
-
case
|
|
4816
|
-
|
|
4817
|
-
case
|
|
4824
|
+
}()(r.image || "", _this17._window);
|
|
4825
|
+
case 1:
|
|
4826
|
+
_this17._imageUri = _context4.v;
|
|
4827
|
+
case 2:
|
|
4818
4828
|
t();
|
|
4819
|
-
case
|
|
4820
|
-
|
|
4821
|
-
return _context4.stop();
|
|
4829
|
+
case 3:
|
|
4830
|
+
return _context4.a(2);
|
|
4822
4831
|
}
|
|
4823
4832
|
}, _callee3);
|
|
4824
4833
|
})), _e6.src = r.image;
|
|
@@ -4828,17 +4837,16 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4828
4837
|
}, {
|
|
4829
4838
|
key: "drawImage",
|
|
4830
4839
|
value: function () {
|
|
4831
|
-
var _drawImage = _asyncToGenerator(/*#__PURE__*/
|
|
4840
|
+
var _drawImage = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(_ref21) {
|
|
4832
4841
|
var t, e, i, r, n, o, s, a, h, d, u, c;
|
|
4833
|
-
return
|
|
4834
|
-
while (1) switch (_context5.
|
|
4842
|
+
return _regenerator().w(function (_context5) {
|
|
4843
|
+
while (1) switch (_context5.n) {
|
|
4835
4844
|
case 0:
|
|
4836
|
-
t =
|
|
4845
|
+
t = _ref21.width, e = _ref21.height, i = _ref21.count, r = _ref21.dotSize;
|
|
4837
4846
|
n = this._options, o = this._roundSize((n.width - i * r) / 2), s = this._roundSize((n.height - i * r) / 2), a = o + this._roundSize(n.imageOptions.margin + (i * r - t) / 2), h = s + this._roundSize(n.imageOptions.margin + (i * r - e) / 2), d = t - 2 * n.imageOptions.margin, u = e - 2 * n.imageOptions.margin, c = this._window.document.createElementNS("http://www.w3.org/2000/svg", "image");
|
|
4838
|
-
c.setAttribute("href", this._imageUri || ""), c.setAttribute("x", String(a)), c.setAttribute("y", String(h)), c.setAttribute("width", "".concat(d, "px")), c.setAttribute("height", "".concat(u, "px")), this._element.appendChild(c);
|
|
4839
|
-
case
|
|
4840
|
-
|
|
4841
|
-
return _context5.stop();
|
|
4847
|
+
c.setAttribute("href", this._imageUri || ""), c.setAttribute("xlink:href", this._imageUri || ""), c.setAttribute("x", String(a)), c.setAttribute("y", String(h)), c.setAttribute("width", "".concat(d, "px")), c.setAttribute("height", "".concat(u, "px")), this._element.appendChild(c);
|
|
4848
|
+
case 1:
|
|
4849
|
+
return _context5.a(2);
|
|
4842
4850
|
}
|
|
4843
4851
|
}, _callee4, this);
|
|
4844
4852
|
}));
|
|
@@ -4849,16 +4857,16 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4849
4857
|
}()
|
|
4850
4858
|
}, {
|
|
4851
4859
|
key: "_createColor",
|
|
4852
|
-
value: function _createColor(
|
|
4853
|
-
var
|
|
4854
|
-
var t =
|
|
4855
|
-
e =
|
|
4856
|
-
i =
|
|
4857
|
-
r =
|
|
4858
|
-
n =
|
|
4859
|
-
o =
|
|
4860
|
-
s =
|
|
4861
|
-
a =
|
|
4860
|
+
value: function _createColor(_ref22) {
|
|
4861
|
+
var _this18 = this;
|
|
4862
|
+
var t = _ref22.options,
|
|
4863
|
+
e = _ref22.color,
|
|
4864
|
+
i = _ref22.additionalRotation,
|
|
4865
|
+
r = _ref22.x,
|
|
4866
|
+
n = _ref22.y,
|
|
4867
|
+
o = _ref22.height,
|
|
4868
|
+
s = _ref22.width,
|
|
4869
|
+
a = _ref22.name;
|
|
4862
4870
|
var h = s > o ? s : o,
|
|
4863
4871
|
d = this._window.document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
4864
4872
|
if (d.setAttribute("x", String(r)), d.setAttribute("y", String(n)), d.setAttribute("height", String(o)), d.setAttribute("width", String(s)), d.setAttribute("clip-path", "url('#clip-path-".concat(a, "')")), t) {
|
|
@@ -4868,14 +4876,14 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4868
4876
|
_d = (_h + 2 * Math.PI) % (2 * Math.PI);
|
|
4869
4877
|
var _u = r + s / 2,
|
|
4870
4878
|
_c = n + o / 2,
|
|
4871
|
-
|
|
4879
|
+
_l = r + s / 2,
|
|
4872
4880
|
_g = n + o / 2;
|
|
4873
|
-
_d >= 0 && _d <= .25 * Math.PI || _d > 1.75 * Math.PI && _d <= 2 * Math.PI ? (_u -= s / 2, _c -= o / 2 * Math.tan(_h),
|
|
4881
|
+
_d >= 0 && _d <= .25 * Math.PI || _d > 1.75 * Math.PI && _d <= 2 * Math.PI ? (_u -= s / 2, _c -= o / 2 * Math.tan(_h), _l += s / 2, _g += o / 2 * Math.tan(_h)) : _d > .25 * Math.PI && _d <= .75 * Math.PI ? (_c -= o / 2, _u -= s / 2 / Math.tan(_h), _g += o / 2, _l += s / 2 / Math.tan(_h)) : _d > .75 * Math.PI && _d <= 1.25 * Math.PI ? (_u += s / 2, _c += o / 2 * Math.tan(_h), _l -= s / 2, _g -= o / 2 * Math.tan(_h)) : _d > 1.25 * Math.PI && _d <= 1.75 * Math.PI && (_c += o / 2, _u += s / 2 / Math.tan(_h), _g -= o / 2, _l -= s / 2 / Math.tan(_h)), _e7 = this._window.document.createElementNS("http://www.w3.org/2000/svg", "linearGradient"), _e7.setAttribute("id", a), _e7.setAttribute("gradientUnits", "userSpaceOnUse"), _e7.setAttribute("x1", String(Math.round(_u))), _e7.setAttribute("y1", String(Math.round(_c))), _e7.setAttribute("x2", String(Math.round(_l))), _e7.setAttribute("y2", String(Math.round(_g)));
|
|
4874
4882
|
}
|
|
4875
|
-
t.colorStops.forEach(function (
|
|
4876
|
-
var t =
|
|
4877
|
-
i =
|
|
4878
|
-
var r =
|
|
4883
|
+
t.colorStops.forEach(function (_ref23) {
|
|
4884
|
+
var t = _ref23.offset,
|
|
4885
|
+
i = _ref23.color;
|
|
4886
|
+
var r = _this18._window.document.createElementNS("http://www.w3.org/2000/svg", "stop");
|
|
4879
4887
|
r.setAttribute("offset", 100 * t + "%"), r.setAttribute("stop-color", i), _e7.appendChild(r);
|
|
4880
4888
|
}), d.setAttribute("fill", "url('#".concat(a, "')")), this._defs.appendChild(_e7);
|
|
4881
4889
|
} else e && d.setAttribute("fill", e);
|
|
@@ -4883,20 +4891,20 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4883
4891
|
}
|
|
4884
4892
|
}]);
|
|
4885
4893
|
}();
|
|
4886
|
-
|
|
4887
|
-
var
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
for (var _t12 = 0; _t12 <= 40; _t12++)
|
|
4891
|
-
var
|
|
4892
|
-
type:
|
|
4894
|
+
p.instanceCount = 0;
|
|
4895
|
+
var v = p,
|
|
4896
|
+
_ = "canvas",
|
|
4897
|
+
m = {};
|
|
4898
|
+
for (var _t12 = 0; _t12 <= 40; _t12++) m[_t12] = _t12;
|
|
4899
|
+
var b = {
|
|
4900
|
+
type: _,
|
|
4893
4901
|
shape: "square",
|
|
4894
4902
|
width: 300,
|
|
4895
4903
|
height: 300,
|
|
4896
4904
|
data: "",
|
|
4897
4905
|
margin: 0,
|
|
4898
4906
|
qrOptions: {
|
|
4899
|
-
typeNumber:
|
|
4907
|
+
typeNumber: m[0],
|
|
4900
4908
|
mode: void 0,
|
|
4901
4909
|
errorCorrectionLevel: "Q"
|
|
4902
4910
|
},
|
|
@@ -4917,7 +4925,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4917
4925
|
color: "#fff"
|
|
4918
4926
|
}
|
|
4919
4927
|
};
|
|
4920
|
-
function
|
|
4928
|
+
function y(t) {
|
|
4921
4929
|
var e = Object.assign({}, t);
|
|
4922
4930
|
if (!e.colorStops || !e.colorStops.length) throw "Field 'colorStops' is required in gradient";
|
|
4923
4931
|
return e.rotation ? e.rotation = Number(e.rotation) : e.rotation = 0, e.colorStops = e.colorStops.map(function (t) {
|
|
@@ -4926,17 +4934,17 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4926
4934
|
});
|
|
4927
4935
|
}), e;
|
|
4928
4936
|
}
|
|
4929
|
-
function
|
|
4937
|
+
function x(t) {
|
|
4930
4938
|
var e = Object.assign({}, t);
|
|
4931
4939
|
return e.width = Number(e.width), e.height = Number(e.height), e.margin = Number(e.margin), e.imageOptions = Object.assign(Object.assign({}, e.imageOptions), {
|
|
4932
4940
|
hideBackgroundDots: Boolean(e.imageOptions.hideBackgroundDots),
|
|
4933
4941
|
imageSize: Number(e.imageOptions.imageSize),
|
|
4934
4942
|
margin: Number(e.imageOptions.margin)
|
|
4935
|
-
}), e.margin > Math.min(e.width, e.height) && (e.margin = Math.min(e.width, e.height)), e.dotsOptions = Object.assign({}, e.dotsOptions), e.dotsOptions.gradient && (e.dotsOptions.gradient =
|
|
4943
|
+
}), e.margin > Math.min(e.width, e.height) && (e.margin = Math.min(e.width, e.height)), e.dotsOptions = Object.assign({}, e.dotsOptions), e.dotsOptions.gradient && (e.dotsOptions.gradient = y(e.dotsOptions.gradient)), e.cornersSquareOptions && (e.cornersSquareOptions = Object.assign({}, e.cornersSquareOptions), e.cornersSquareOptions.gradient && (e.cornersSquareOptions.gradient = y(e.cornersSquareOptions.gradient))), e.cornersDotOptions && (e.cornersDotOptions = Object.assign({}, e.cornersDotOptions), e.cornersDotOptions.gradient && (e.cornersDotOptions.gradient = y(e.cornersDotOptions.gradient))), e.backgroundOptions && (e.backgroundOptions = Object.assign({}, e.backgroundOptions), e.backgroundOptions.gradient && (e.backgroundOptions.gradient = y(e.backgroundOptions.gradient))), e;
|
|
4936
4944
|
}
|
|
4937
|
-
var
|
|
4938
|
-
|
|
4939
|
-
function
|
|
4945
|
+
var S = i(873),
|
|
4946
|
+
C = i.n(S);
|
|
4947
|
+
function A(t) {
|
|
4940
4948
|
if (!t) throw new Error("Extension must be defined");
|
|
4941
4949
|
"." === t[0] && (t = t.substring(1));
|
|
4942
4950
|
var e = {
|
|
@@ -4955,46 +4963,46 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4955
4963
|
if (!e) throw new Error("Extension \"".concat(t, "\" is not supported"));
|
|
4956
4964
|
return e;
|
|
4957
4965
|
}
|
|
4958
|
-
var
|
|
4959
|
-
function
|
|
4960
|
-
_classCallCheck(this,
|
|
4966
|
+
var M = /*#__PURE__*/function () {
|
|
4967
|
+
function M(t) {
|
|
4968
|
+
_classCallCheck(this, M);
|
|
4961
4969
|
(null == t ? void 0 : t.jsdom) ? this._window = new t.jsdom("", {
|
|
4962
4970
|
resources: "usable"
|
|
4963
|
-
}).window : this._window = window, this._options = t ?
|
|
4971
|
+
}).window : this._window = window, this._options = t ? x(e(b, t)) : b, this.update();
|
|
4964
4972
|
}
|
|
4965
|
-
return _createClass(
|
|
4973
|
+
return _createClass(M, [{
|
|
4966
4974
|
key: "_setupSvg",
|
|
4967
4975
|
value: function _setupSvg() {
|
|
4968
|
-
var
|
|
4976
|
+
var _this19 = this;
|
|
4969
4977
|
if (!this._qr) return;
|
|
4970
|
-
var t = new
|
|
4978
|
+
var t = new v(this._options, this._window);
|
|
4971
4979
|
this._svg = t.getElement(), this._svgDrawingPromise = t.drawQR(this._qr).then(function () {
|
|
4972
4980
|
var e;
|
|
4973
|
-
|
|
4981
|
+
_this19._svg && (null === (e = _this19._extension) || void 0 === e || e.call(_this19, t.getElement(), _this19._options));
|
|
4974
4982
|
});
|
|
4975
4983
|
}
|
|
4976
4984
|
}, {
|
|
4977
4985
|
key: "_setupCanvas",
|
|
4978
4986
|
value: function _setupCanvas() {
|
|
4979
|
-
var
|
|
4987
|
+
var _this20 = this;
|
|
4980
4988
|
var t, e;
|
|
4981
4989
|
this._qr && ((null === (t = this._options.nodeCanvas) || void 0 === t ? void 0 : t.createCanvas) ? (this._nodeCanvas = this._options.nodeCanvas.createCanvas(this._options.width, this._options.height), this._nodeCanvas.width = this._options.width, this._nodeCanvas.height = this._options.height) : (this._domCanvas = document.createElement("canvas"), this._domCanvas.width = this._options.width, this._domCanvas.height = this._options.height), this._setupSvg(), this._canvasDrawingPromise = null === (e = this._svgDrawingPromise) || void 0 === e ? void 0 : e.then(function () {
|
|
4982
4990
|
var t;
|
|
4983
|
-
if (!
|
|
4984
|
-
var e =
|
|
4985
|
-
i = new
|
|
4991
|
+
if (!_this20._svg) return;
|
|
4992
|
+
var e = _this20._svg,
|
|
4993
|
+
i = new _this20._window.XMLSerializer().serializeToString(e),
|
|
4986
4994
|
r = btoa(i),
|
|
4987
|
-
n = "data:".concat(
|
|
4988
|
-
if (null === (t =
|
|
4995
|
+
n = "data:".concat(A("svg"), ";base64,").concat(r);
|
|
4996
|
+
if (null === (t = _this20._options.nodeCanvas) || void 0 === t ? void 0 : t.loadImage) return _this20._options.nodeCanvas.loadImage(n).then(function (t) {
|
|
4989
4997
|
var e, i;
|
|
4990
|
-
t.width =
|
|
4998
|
+
t.width = _this20._options.width, t.height = _this20._options.height, null === (i = null === (e = _this20._nodeCanvas) || void 0 === e ? void 0 : e.getContext("2d")) || void 0 === i || i.drawImage(t, 0, 0);
|
|
4991
4999
|
});
|
|
4992
5000
|
{
|
|
4993
|
-
var _t13 = new
|
|
5001
|
+
var _t13 = new _this20._window.Image();
|
|
4994
5002
|
return new Promise(function (e) {
|
|
4995
5003
|
_t13.onload = function () {
|
|
4996
5004
|
var i, r;
|
|
4997
|
-
null === (r = null === (i =
|
|
5005
|
+
null === (r = null === (i = _this20._domCanvas) || void 0 === i ? void 0 : i.getContext("2d")) || void 0 === r || r.drawImage(_t13, 0, 0), e();
|
|
4998
5006
|
}, _t13.src = n;
|
|
4999
5007
|
});
|
|
5000
5008
|
}
|
|
@@ -5003,41 +5011,39 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
5003
5011
|
}, {
|
|
5004
5012
|
key: "_getElement",
|
|
5005
5013
|
value: function () {
|
|
5006
|
-
var _getElement2 = _asyncToGenerator(/*#__PURE__*/
|
|
5014
|
+
var _getElement2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
|
|
5007
5015
|
var t,
|
|
5008
|
-
_args5 = arguments
|
|
5009
|
-
|
|
5010
|
-
|
|
5016
|
+
_args5 = arguments,
|
|
5017
|
+
_t14;
|
|
5018
|
+
return _regenerator().w(function (_context6) {
|
|
5019
|
+
while (1) switch (_context6.n) {
|
|
5011
5020
|
case 0:
|
|
5012
5021
|
t = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : "png";
|
|
5013
5022
|
if (this._qr) {
|
|
5014
|
-
_context6.
|
|
5023
|
+
_context6.n = 1;
|
|
5015
5024
|
break;
|
|
5016
5025
|
}
|
|
5017
5026
|
throw "QR code is empty";
|
|
5018
|
-
case
|
|
5027
|
+
case 1:
|
|
5019
5028
|
if (!("svg" === t.toLowerCase())) {
|
|
5020
|
-
_context6.
|
|
5029
|
+
_context6.n = 3;
|
|
5021
5030
|
break;
|
|
5022
5031
|
}
|
|
5023
5032
|
this._svg && this._svgDrawingPromise || this._setupSvg();
|
|
5024
|
-
_context6.
|
|
5033
|
+
_context6.n = 2;
|
|
5025
5034
|
return this._svgDrawingPromise;
|
|
5026
|
-
case
|
|
5027
|
-
|
|
5028
|
-
_context6.
|
|
5035
|
+
case 2:
|
|
5036
|
+
_t14 = this._svg;
|
|
5037
|
+
_context6.n = 5;
|
|
5029
5038
|
break;
|
|
5030
|
-
case
|
|
5039
|
+
case 3:
|
|
5031
5040
|
(this._domCanvas || this._nodeCanvas) && this._canvasDrawingPromise || this._setupCanvas();
|
|
5032
|
-
_context6.
|
|
5041
|
+
_context6.n = 4;
|
|
5033
5042
|
return this._canvasDrawingPromise;
|
|
5034
|
-
case
|
|
5035
|
-
|
|
5036
|
-
case
|
|
5037
|
-
return _context6.
|
|
5038
|
-
case 15:
|
|
5039
|
-
case "end":
|
|
5040
|
-
return _context6.stop();
|
|
5043
|
+
case 4:
|
|
5044
|
+
_t14 = this._domCanvas || this._nodeCanvas;
|
|
5045
|
+
case 5:
|
|
5046
|
+
return _context6.a(2, _t14);
|
|
5041
5047
|
}
|
|
5042
5048
|
}, _callee5, this);
|
|
5043
5049
|
}));
|
|
@@ -5049,7 +5055,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
5049
5055
|
}, {
|
|
5050
5056
|
key: "update",
|
|
5051
5057
|
value: function update(t) {
|
|
5052
|
-
|
|
5058
|
+
M._clearContainer(this._container), this._options = t ? x(e(this._options, t)) : this._options, this._options.data && (this._qr = C()(this._options.qrOptions.typeNumber, this._options.qrOptions.errorCorrectionLevel), this._qr.addData(this._options.data, this._options.qrOptions.mode || function (t) {
|
|
5053
5059
|
switch (!0) {
|
|
5054
5060
|
case /^[0-9]*$/.test(t):
|
|
5055
5061
|
return "Numeric";
|
|
@@ -5058,14 +5064,14 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
5058
5064
|
default:
|
|
5059
5065
|
return "Byte";
|
|
5060
5066
|
}
|
|
5061
|
-
}(this._options.data)), this._qr.make(), this._options.type ===
|
|
5067
|
+
}(this._options.data)), this._qr.make(), this._options.type === _ ? this._setupCanvas() : this._setupSvg(), this.append(this._container));
|
|
5062
5068
|
}
|
|
5063
5069
|
}, {
|
|
5064
5070
|
key: "append",
|
|
5065
5071
|
value: function append(t) {
|
|
5066
5072
|
if (t) {
|
|
5067
5073
|
if ("function" != typeof t.appendChild) throw "Container should be a single DOM node";
|
|
5068
|
-
this._options.type ===
|
|
5074
|
+
this._options.type === _ ? this._domCanvas && t.appendChild(this._domCanvas) : this._svg && t.appendChild(this._svg), this._container = t;
|
|
5069
5075
|
}
|
|
5070
5076
|
}
|
|
5071
5077
|
}, {
|
|
@@ -5082,43 +5088,43 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
5082
5088
|
}, {
|
|
5083
5089
|
key: "getRawData",
|
|
5084
5090
|
value: function () {
|
|
5085
|
-
var _getRawData = _asyncToGenerator(/*#__PURE__*/
|
|
5091
|
+
var _getRawData = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6() {
|
|
5086
5092
|
var t,
|
|
5087
5093
|
e,
|
|
5088
5094
|
i,
|
|
5089
|
-
|
|
5095
|
+
_t15,
|
|
5090
5096
|
_args6 = arguments;
|
|
5091
|
-
return
|
|
5092
|
-
while (1) switch (_context7.
|
|
5097
|
+
return _regenerator().w(function (_context7) {
|
|
5098
|
+
while (1) switch (_context7.n) {
|
|
5093
5099
|
case 0:
|
|
5094
5100
|
t = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : "png";
|
|
5095
5101
|
if (this._qr) {
|
|
5096
|
-
_context7.
|
|
5102
|
+
_context7.n = 1;
|
|
5097
5103
|
break;
|
|
5098
5104
|
}
|
|
5099
5105
|
throw "QR code is empty";
|
|
5100
|
-
case
|
|
5101
|
-
_context7.
|
|
5106
|
+
case 1:
|
|
5107
|
+
_context7.n = 2;
|
|
5102
5108
|
return this._getElement(t);
|
|
5103
|
-
case
|
|
5104
|
-
e = _context7.
|
|
5105
|
-
i =
|
|
5109
|
+
case 2:
|
|
5110
|
+
e = _context7.v;
|
|
5111
|
+
i = A(t);
|
|
5106
5112
|
if (e) {
|
|
5107
|
-
_context7.
|
|
5113
|
+
_context7.n = 3;
|
|
5108
5114
|
break;
|
|
5109
5115
|
}
|
|
5110
|
-
return _context7.
|
|
5111
|
-
case
|
|
5116
|
+
return _context7.a(2, null);
|
|
5117
|
+
case 3:
|
|
5112
5118
|
if (!("svg" === t.toLowerCase())) {
|
|
5113
|
-
_context7.
|
|
5119
|
+
_context7.n = 4;
|
|
5114
5120
|
break;
|
|
5115
5121
|
}
|
|
5116
|
-
|
|
5117
|
-
return _context7.
|
|
5122
|
+
_t15 = "<?xml version=\"1.0\" standalone=\"no\"?>\r\n".concat(new this._window.XMLSerializer().serializeToString(e));
|
|
5123
|
+
return _context7.a(2, "undefined" == typeof Blob || this._options.jsdom ? Buffer.from(_t15) : new Blob([_t15], {
|
|
5118
5124
|
type: i
|
|
5119
5125
|
}));
|
|
5120
|
-
case
|
|
5121
|
-
return _context7.
|
|
5126
|
+
case 4:
|
|
5127
|
+
return _context7.a(2, new Promise(function (t) {
|
|
5122
5128
|
var r = e;
|
|
5123
5129
|
if ("toBuffer" in r) {
|
|
5124
5130
|
if ("image/png" === i) t(r.toBuffer(i));else if ("image/jpeg" === i) t(r.toBuffer(i));else {
|
|
@@ -5127,9 +5133,6 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
5127
5133
|
}
|
|
5128
5134
|
} else "toBlob" in r && r.toBlob(t, i, 1);
|
|
5129
5135
|
}));
|
|
5130
|
-
case 13:
|
|
5131
|
-
case "end":
|
|
5132
|
-
return _context7.stop();
|
|
5133
5136
|
}
|
|
5134
5137
|
}, _callee6, this);
|
|
5135
5138
|
}));
|
|
@@ -5141,36 +5144,35 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
5141
5144
|
}, {
|
|
5142
5145
|
key: "download",
|
|
5143
5146
|
value: function () {
|
|
5144
|
-
var _download = _asyncToGenerator(/*#__PURE__*/
|
|
5145
|
-
var e, i, r,
|
|
5146
|
-
return
|
|
5147
|
-
while (1) switch (_context8.
|
|
5147
|
+
var _download = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(t) {
|
|
5148
|
+
var e, i, r, _t16;
|
|
5149
|
+
return _regenerator().w(function (_context8) {
|
|
5150
|
+
while (1) switch (_context8.n) {
|
|
5148
5151
|
case 0:
|
|
5149
5152
|
if (this._qr) {
|
|
5150
|
-
_context8.
|
|
5153
|
+
_context8.n = 1;
|
|
5151
5154
|
break;
|
|
5152
5155
|
}
|
|
5153
5156
|
throw "QR code is empty";
|
|
5154
|
-
case
|
|
5157
|
+
case 1:
|
|
5155
5158
|
if (!("undefined" == typeof Blob)) {
|
|
5156
|
-
_context8.
|
|
5159
|
+
_context8.n = 2;
|
|
5157
5160
|
break;
|
|
5158
5161
|
}
|
|
5159
5162
|
throw "Cannot download in Node.js, call getRawData instead.";
|
|
5160
|
-
case
|
|
5163
|
+
case 2:
|
|
5161
5164
|
e = "png", i = "qr";
|
|
5162
5165
|
"string" == typeof t ? (e = t, console.warn("Extension is deprecated as argument for 'download' method, please pass object { name: '...', extension: '...' } as argument")) : "object" == _typeof(t) && null !== t && (t.name && (i = t.name), t.extension && (e = t.extension));
|
|
5163
|
-
_context8.
|
|
5166
|
+
_context8.n = 3;
|
|
5164
5167
|
return this._getElement(e);
|
|
5165
|
-
case
|
|
5166
|
-
r = _context8.
|
|
5168
|
+
case 3:
|
|
5169
|
+
r = _context8.v;
|
|
5167
5170
|
if (r) if ("svg" === e.toLowerCase()) {
|
|
5168
|
-
|
|
5169
|
-
|
|
5170
|
-
} else n(r.toDataURL(
|
|
5171
|
-
case
|
|
5172
|
-
|
|
5173
|
-
return _context8.stop();
|
|
5171
|
+
_t16 = new XMLSerializer().serializeToString(r);
|
|
5172
|
+
_t16 = '<?xml version="1.0" standalone="no"?>\r\n' + _t16, n("data:".concat(A(e), ";charset=utf-8,").concat(encodeURIComponent(_t16)), "".concat(i, ".svg"));
|
|
5173
|
+
} else n(r.toDataURL(A(e)), "".concat(i, ".").concat(e));
|
|
5174
|
+
case 4:
|
|
5175
|
+
return _context8.a(2);
|
|
5174
5176
|
}
|
|
5175
5177
|
}, _callee7, this);
|
|
5176
5178
|
}));
|
|
@@ -5186,7 +5188,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
5186
5188
|
}
|
|
5187
5189
|
}]);
|
|
5188
5190
|
}();
|
|
5189
|
-
var
|
|
5191
|
+
var $ = M;
|
|
5190
5192
|
}(), r["default"];
|
|
5191
5193
|
}();
|
|
5192
5194
|
});
|
|
@@ -5196,7 +5198,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
5196
5198
|
"buffer": 5
|
|
5197
5199
|
}],
|
|
5198
5200
|
9: [function (require, module, exports) {
|
|
5199
|
-
module.exports = "
|
|
5201
|
+
module.exports = "2.7.1";
|
|
5200
5202
|
}, {}]
|
|
5201
5203
|
}, {}, [3])(3);
|
|
5202
5204
|
});
|