@cntyclub/ui-react 0.1.0 → 0.1.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.
- package/dist/chunk-2HQPCV2L.js +895 -0
- package/dist/chunk-2HQPCV2L.js.map +1 -0
- package/dist/form.js +10 -4861
- package/dist/form.js.map +1 -1
- package/dist/index.js +8428 -80599
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-HDGMSYQS.js +0 -26461
- package/dist/chunk-HDGMSYQS.js.map +0 -1
- package/dist/chunk-PR4QN5HX.js +0 -39
- package/dist/chunk-PR4QN5HX.js.map +0 -1
- package/dist/qr-code-styling-3Y6LZH6V.js +0 -1123
- package/dist/qr-code-styling-3Y6LZH6V.js.map +0 -1
|
@@ -1,1123 +0,0 @@
|
|
|
1
|
-
import { __commonJS } from './chunk-PR4QN5HX.js';
|
|
2
|
-
|
|
3
|
-
// ../../node_modules/.pnpm/qr-code-styling@1.9.2/node_modules/qr-code-styling/lib/qr-code-styling.js
|
|
4
|
-
var require_qr_code_styling = __commonJS({
|
|
5
|
-
"../../node_modules/.pnpm/qr-code-styling@1.9.2/node_modules/qr-code-styling/lib/qr-code-styling.js"(exports, module) {
|
|
6
|
-
!(function(t, e) {
|
|
7
|
-
"object" == typeof exports && "object" == typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define([], e) : "object" == typeof exports ? exports.QRCodeStyling = e() : t.QRCodeStyling = e();
|
|
8
|
-
})(exports, (() => (() => {
|
|
9
|
-
var t = { 873: (t2, e2) => {
|
|
10
|
-
var i2, r2, n = (function() {
|
|
11
|
-
var t3 = function(t4, e4) {
|
|
12
|
-
var i4 = t4, r4 = s[e4], n3 = null, o2 = 0, h2 = null, p2 = [], v2 = {}, m = function(t5, e5) {
|
|
13
|
-
n3 = (function(t6) {
|
|
14
|
-
for (var e6 = new Array(t6), i5 = 0; i5 < t6; i5 += 1) {
|
|
15
|
-
e6[i5] = new Array(t6);
|
|
16
|
-
for (var r5 = 0; r5 < t6; r5 += 1) e6[i5][r5] = null;
|
|
17
|
-
}
|
|
18
|
-
return e6;
|
|
19
|
-
})(o2 = 4 * i4 + 17), b(0, 0), b(o2 - 7, 0), b(0, o2 - 7), x(), y(), C(t5, e5), i4 >= 7 && S(t5), null == h2 && (h2 = M(i4, r4, p2)), A(h2, e5);
|
|
20
|
-
}, b = function(t5, e5) {
|
|
21
|
-
for (var i5 = -1; i5 <= 7; i5 += 1) if (!(t5 + i5 <= -1 || o2 <= t5 + i5)) for (var r5 = -1; r5 <= 7; r5 += 1) e5 + r5 <= -1 || o2 <= e5 + r5 || (n3[t5 + i5][e5 + r5] = 0 <= i5 && i5 <= 6 && (0 == r5 || 6 == r5) || 0 <= r5 && r5 <= 6 && (0 == i5 || 6 == i5) || 2 <= i5 && i5 <= 4 && 2 <= r5 && r5 <= 4);
|
|
22
|
-
}, y = function() {
|
|
23
|
-
for (var t5 = 8; t5 < o2 - 8; t5 += 1) null == n3[t5][6] && (n3[t5][6] = t5 % 2 == 0);
|
|
24
|
-
for (var e5 = 8; e5 < o2 - 8; e5 += 1) null == n3[6][e5] && (n3[6][e5] = e5 % 2 == 0);
|
|
25
|
-
}, x = function() {
|
|
26
|
-
for (var t5 = a.getPatternPosition(i4), e5 = 0; e5 < t5.length; e5 += 1) for (var r5 = 0; r5 < t5.length; r5 += 1) {
|
|
27
|
-
var o3 = t5[e5], s2 = t5[r5];
|
|
28
|
-
if (null == n3[o3][s2]) for (var h3 = -2; h3 <= 2; h3 += 1) for (var d2 = -2; d2 <= 2; d2 += 1) n3[o3 + h3][s2 + d2] = -2 == h3 || 2 == h3 || -2 == d2 || 2 == d2 || 0 == h3 && 0 == d2;
|
|
29
|
-
}
|
|
30
|
-
}, S = function(t5) {
|
|
31
|
-
for (var e5 = a.getBCHTypeNumber(i4), r5 = 0; r5 < 18; r5 += 1) {
|
|
32
|
-
var s2 = !t5 && 1 == (e5 >> r5 & 1);
|
|
33
|
-
n3[Math.floor(r5 / 3)][r5 % 3 + o2 - 8 - 3] = s2;
|
|
34
|
-
}
|
|
35
|
-
for (r5 = 0; r5 < 18; r5 += 1) s2 = !t5 && 1 == (e5 >> r5 & 1), n3[r5 % 3 + o2 - 8 - 3][Math.floor(r5 / 3)] = s2;
|
|
36
|
-
}, C = function(t5, e5) {
|
|
37
|
-
for (var i5 = r4 << 3 | e5, s2 = a.getBCHTypeInfo(i5), h3 = 0; h3 < 15; h3 += 1) {
|
|
38
|
-
var d2 = !t5 && 1 == (s2 >> h3 & 1);
|
|
39
|
-
h3 < 6 ? n3[h3][8] = d2 : h3 < 8 ? n3[h3 + 1][8] = d2 : n3[o2 - 15 + h3][8] = d2;
|
|
40
|
-
}
|
|
41
|
-
for (h3 = 0; h3 < 15; h3 += 1) d2 = !t5 && 1 == (s2 >> h3 & 1), h3 < 8 ? n3[8][o2 - h3 - 1] = d2 : h3 < 9 ? n3[8][15 - h3 - 1 + 1] = d2 : n3[8][15 - h3 - 1] = d2;
|
|
42
|
-
n3[o2 - 8][8] = !t5;
|
|
43
|
-
}, A = function(t5, e5) {
|
|
44
|
-
for (var i5 = -1, r5 = o2 - 1, s2 = 7, h3 = 0, d2 = a.getMaskFunction(e5), u2 = o2 - 1; u2 > 0; u2 -= 2) for (6 == u2 && (u2 -= 1); ; ) {
|
|
45
|
-
for (var c2 = 0; c2 < 2; c2 += 1) if (null == n3[r5][u2 - c2]) {
|
|
46
|
-
var l2 = false;
|
|
47
|
-
h3 < t5.length && (l2 = 1 == (t5[h3] >>> s2 & 1)), d2(r5, u2 - c2) && (l2 = !l2), n3[r5][u2 - c2] = l2, -1 == (s2 -= 1) && (h3 += 1, s2 = 7);
|
|
48
|
-
}
|
|
49
|
-
if ((r5 += i5) < 0 || o2 <= r5) {
|
|
50
|
-
r5 -= i5, i5 = -i5;
|
|
51
|
-
break;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}, M = function(t5, e5, i5) {
|
|
55
|
-
for (var r5 = u.getRSBlocks(t5, e5), n4 = c(), o3 = 0; o3 < i5.length; o3 += 1) {
|
|
56
|
-
var s2 = i5[o3];
|
|
57
|
-
n4.put(s2.getMode(), 4), n4.put(s2.getLength(), a.getLengthInBits(s2.getMode(), t5)), s2.write(n4);
|
|
58
|
-
}
|
|
59
|
-
var h3 = 0;
|
|
60
|
-
for (o3 = 0; o3 < r5.length; o3 += 1) h3 += r5[o3].dataCount;
|
|
61
|
-
if (n4.getLengthInBits() > 8 * h3) throw "code length overflow. (" + n4.getLengthInBits() + ">" + 8 * h3 + ")";
|
|
62
|
-
for (n4.getLengthInBits() + 4 <= 8 * h3 && n4.put(0, 4); n4.getLengthInBits() % 8 != 0; ) n4.putBit(false);
|
|
63
|
-
for (; !(n4.getLengthInBits() >= 8 * h3 || (n4.put(236, 8), n4.getLengthInBits() >= 8 * h3)); ) n4.put(17, 8);
|
|
64
|
-
return (function(t6, e6) {
|
|
65
|
-
for (var i6 = 0, r6 = 0, n5 = 0, o4 = new Array(e6.length), s3 = new Array(e6.length), h4 = 0; h4 < e6.length; h4 += 1) {
|
|
66
|
-
var u2 = e6[h4].dataCount, c2 = e6[h4].totalCount - u2;
|
|
67
|
-
r6 = Math.max(r6, u2), n5 = Math.max(n5, c2), o4[h4] = new Array(u2);
|
|
68
|
-
for (var l2 = 0; l2 < o4[h4].length; l2 += 1) o4[h4][l2] = 255 & t6.getBuffer()[l2 + i6];
|
|
69
|
-
i6 += u2;
|
|
70
|
-
var g2 = a.getErrorCorrectPolynomial(c2), f2 = d(o4[h4], g2.getLength() - 1).mod(g2);
|
|
71
|
-
for (s3[h4] = new Array(g2.getLength() - 1), l2 = 0; l2 < s3[h4].length; l2 += 1) {
|
|
72
|
-
var w2 = l2 + f2.getLength() - s3[h4].length;
|
|
73
|
-
s3[h4][l2] = w2 >= 0 ? f2.getAt(w2) : 0;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
var p3 = 0;
|
|
77
|
-
for (l2 = 0; l2 < e6.length; l2 += 1) p3 += e6[l2].totalCount;
|
|
78
|
-
var v3 = new Array(p3), _2 = 0;
|
|
79
|
-
for (l2 = 0; l2 < r6; l2 += 1) for (h4 = 0; h4 < e6.length; h4 += 1) l2 < o4[h4].length && (v3[_2] = o4[h4][l2], _2 += 1);
|
|
80
|
-
for (l2 = 0; l2 < n5; l2 += 1) for (h4 = 0; h4 < e6.length; h4 += 1) l2 < s3[h4].length && (v3[_2] = s3[h4][l2], _2 += 1);
|
|
81
|
-
return v3;
|
|
82
|
-
})(n4, r5);
|
|
83
|
-
};
|
|
84
|
-
v2.addData = function(t5, e5) {
|
|
85
|
-
var i5 = null;
|
|
86
|
-
switch (e5 = e5 || "Byte") {
|
|
87
|
-
case "Numeric":
|
|
88
|
-
i5 = l(t5);
|
|
89
|
-
break;
|
|
90
|
-
case "Alphanumeric":
|
|
91
|
-
i5 = g(t5);
|
|
92
|
-
break;
|
|
93
|
-
case "Byte":
|
|
94
|
-
i5 = f(t5);
|
|
95
|
-
break;
|
|
96
|
-
case "Kanji":
|
|
97
|
-
i5 = w(t5);
|
|
98
|
-
break;
|
|
99
|
-
default:
|
|
100
|
-
throw "mode:" + e5;
|
|
101
|
-
}
|
|
102
|
-
p2.push(i5), h2 = null;
|
|
103
|
-
}, v2.isDark = function(t5, e5) {
|
|
104
|
-
if (t5 < 0 || o2 <= t5 || e5 < 0 || o2 <= e5) throw t5 + "," + e5;
|
|
105
|
-
return n3[t5][e5];
|
|
106
|
-
}, v2.getModuleCount = function() {
|
|
107
|
-
return o2;
|
|
108
|
-
}, v2.make = function() {
|
|
109
|
-
if (i4 < 1) {
|
|
110
|
-
for (var t5 = 1; t5 < 40; t5++) {
|
|
111
|
-
for (var e5 = u.getRSBlocks(t5, r4), n4 = c(), o3 = 0; o3 < p2.length; o3++) {
|
|
112
|
-
var s2 = p2[o3];
|
|
113
|
-
n4.put(s2.getMode(), 4), n4.put(s2.getLength(), a.getLengthInBits(s2.getMode(), t5)), s2.write(n4);
|
|
114
|
-
}
|
|
115
|
-
var h3 = 0;
|
|
116
|
-
for (o3 = 0; o3 < e5.length; o3++) h3 += e5[o3].dataCount;
|
|
117
|
-
if (n4.getLengthInBits() <= 8 * h3) break;
|
|
118
|
-
}
|
|
119
|
-
i4 = t5;
|
|
120
|
-
}
|
|
121
|
-
m(false, (function() {
|
|
122
|
-
for (var t6 = 0, e6 = 0, i5 = 0; i5 < 8; i5 += 1) {
|
|
123
|
-
m(true, i5);
|
|
124
|
-
var r5 = a.getLostPoint(v2);
|
|
125
|
-
(0 == i5 || t6 > r5) && (t6 = r5, e6 = i5);
|
|
126
|
-
}
|
|
127
|
-
return e6;
|
|
128
|
-
})());
|
|
129
|
-
}, v2.createTableTag = function(t5, e5) {
|
|
130
|
-
t5 = t5 || 2;
|
|
131
|
-
var i5 = "";
|
|
132
|
-
i5 += '<table style="', i5 += " border-width: 0px; border-style: none;", i5 += " border-collapse: collapse;", i5 += " padding: 0px; margin: " + (e5 = void 0 === e5 ? 4 * t5 : e5) + "px;", i5 += '">', i5 += "<tbody>";
|
|
133
|
-
for (var r5 = 0; r5 < v2.getModuleCount(); r5 += 1) {
|
|
134
|
-
i5 += "<tr>";
|
|
135
|
-
for (var n4 = 0; n4 < v2.getModuleCount(); n4 += 1) i5 += '<td style="', i5 += " border-width: 0px; border-style: none;", i5 += " border-collapse: collapse;", i5 += " padding: 0px; margin: 0px;", i5 += " width: " + t5 + "px;", i5 += " height: " + t5 + "px;", i5 += " background-color: ", i5 += v2.isDark(r5, n4) ? "#000000" : "#ffffff", i5 += ";", i5 += '"/>';
|
|
136
|
-
i5 += "</tr>";
|
|
137
|
-
}
|
|
138
|
-
return (i5 += "</tbody>") + "</table>";
|
|
139
|
-
}, v2.createSvgTag = function(t5, e5, i5, r5) {
|
|
140
|
-
var n4 = {};
|
|
141
|
-
"object" == typeof arguments[0] && (t5 = (n4 = arguments[0]).cellSize, e5 = n4.margin, i5 = n4.alt, r5 = n4.title), t5 = t5 || 2, e5 = void 0 === e5 ? 4 * t5 : e5, (i5 = "string" == typeof i5 ? { text: i5 } : i5 || {}).text = i5.text || null, i5.id = i5.text ? i5.id || "qrcode-description" : null, (r5 = "string" == typeof r5 ? { text: r5 } : r5 || {}).text = r5.text || null, r5.id = r5.text ? r5.id || "qrcode-title" : null;
|
|
142
|
-
var o3, s2, a2, h3, d2 = v2.getModuleCount() * t5 + 2 * e5, u2 = "";
|
|
143
|
-
for (h3 = "l" + t5 + ",0 0," + t5 + " -" + t5 + ",0 0,-" + t5 + "z ", u2 += '<svg version="1.1" xmlns="http://www.w3.org/2000/svg"', u2 += n4.scalable ? "" : ' width="' + d2 + 'px" height="' + d2 + 'px"', u2 += ' viewBox="0 0 ' + d2 + " " + d2 + '" ', u2 += ' preserveAspectRatio="xMinYMin meet"', u2 += r5.text || i5.text ? ' role="img" aria-labelledby="' + $([r5.id, i5.id].join(" ").trim()) + '"' : "", u2 += ">", u2 += r5.text ? '<title id="' + $(r5.id) + '">' + $(r5.text) + "</title>" : "", u2 += i5.text ? '<description id="' + $(i5.id) + '">' + $(i5.text) + "</description>" : "", u2 += '<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>', u2 += '<path d="', s2 = 0; s2 < v2.getModuleCount(); s2 += 1) for (a2 = s2 * t5 + e5, o3 = 0; o3 < v2.getModuleCount(); o3 += 1) v2.isDark(s2, o3) && (u2 += "M" + (o3 * t5 + e5) + "," + a2 + h3);
|
|
144
|
-
return (u2 += '" stroke="transparent" fill="black"/>') + "</svg>";
|
|
145
|
-
}, v2.createDataURL = function(t5, e5) {
|
|
146
|
-
t5 = t5 || 2, e5 = void 0 === e5 ? 4 * t5 : e5;
|
|
147
|
-
var i5 = v2.getModuleCount() * t5 + 2 * e5, r5 = e5, n4 = i5 - e5;
|
|
148
|
-
return _(i5, i5, (function(e6, i6) {
|
|
149
|
-
if (r5 <= e6 && e6 < n4 && r5 <= i6 && i6 < n4) {
|
|
150
|
-
var o3 = Math.floor((e6 - r5) / t5), s2 = Math.floor((i6 - r5) / t5);
|
|
151
|
-
return v2.isDark(s2, o3) ? 0 : 1;
|
|
152
|
-
}
|
|
153
|
-
return 1;
|
|
154
|
-
}));
|
|
155
|
-
}, v2.createImgTag = function(t5, e5, i5) {
|
|
156
|
-
t5 = t5 || 2, e5 = void 0 === e5 ? 4 * t5 : e5;
|
|
157
|
-
var r5 = v2.getModuleCount() * t5 + 2 * e5, n4 = "";
|
|
158
|
-
return n4 += "<img", n4 += ' src="', n4 += v2.createDataURL(t5, e5), n4 += '"', n4 += ' width="', n4 += r5, n4 += '"', n4 += ' height="', n4 += r5, n4 += '"', i5 && (n4 += ' alt="', n4 += $(i5), n4 += '"'), n4 + "/>";
|
|
159
|
-
};
|
|
160
|
-
var $ = function(t5) {
|
|
161
|
-
for (var e5 = "", i5 = 0; i5 < t5.length; i5 += 1) {
|
|
162
|
-
var r5 = t5.charAt(i5);
|
|
163
|
-
switch (r5) {
|
|
164
|
-
case "<":
|
|
165
|
-
e5 += "<";
|
|
166
|
-
break;
|
|
167
|
-
case ">":
|
|
168
|
-
e5 += ">";
|
|
169
|
-
break;
|
|
170
|
-
case "&":
|
|
171
|
-
e5 += "&";
|
|
172
|
-
break;
|
|
173
|
-
case '"':
|
|
174
|
-
e5 += """;
|
|
175
|
-
break;
|
|
176
|
-
default:
|
|
177
|
-
e5 += r5;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
return e5;
|
|
181
|
-
};
|
|
182
|
-
return v2.createASCII = function(t5, e5) {
|
|
183
|
-
if ((t5 = t5 || 1) < 2) return (function(t6) {
|
|
184
|
-
t6 = void 0 === t6 ? 2 : t6;
|
|
185
|
-
var e6, i6, r6, n5, o4, s3 = 1 * v2.getModuleCount() + 2 * t6, a3 = t6, h4 = s3 - t6, d3 = { "\u2588\u2588": "\u2588", "\u2588 ": "\u2580", " \u2588": "\u2584", " ": " " }, u3 = { "\u2588\u2588": "\u2580", "\u2588 ": "\u2580", " \u2588": " ", " ": " " }, c3 = "";
|
|
186
|
-
for (e6 = 0; e6 < s3; e6 += 2) {
|
|
187
|
-
for (r6 = Math.floor((e6 - a3) / 1), n5 = Math.floor((e6 + 1 - a3) / 1), i6 = 0; i6 < s3; i6 += 1) o4 = "\u2588", a3 <= i6 && i6 < h4 && a3 <= e6 && e6 < h4 && v2.isDark(r6, Math.floor((i6 - a3) / 1)) && (o4 = " "), a3 <= i6 && i6 < h4 && a3 <= e6 + 1 && e6 + 1 < h4 && v2.isDark(n5, Math.floor((i6 - a3) / 1)) ? o4 += " " : o4 += "\u2588", c3 += t6 < 1 && e6 + 1 >= h4 ? u3[o4] : d3[o4];
|
|
188
|
-
c3 += "\n";
|
|
189
|
-
}
|
|
190
|
-
return s3 % 2 && t6 > 0 ? c3.substring(0, c3.length - s3 - 1) + Array(s3 + 1).join("\u2580") : c3.substring(0, c3.length - 1);
|
|
191
|
-
})(e5);
|
|
192
|
-
t5 -= 1, e5 = void 0 === e5 ? 2 * t5 : e5;
|
|
193
|
-
var i5, r5, n4, o3, s2 = v2.getModuleCount() * t5 + 2 * e5, a2 = e5, h3 = s2 - e5, d2 = Array(t5 + 1).join("\u2588\u2588"), u2 = Array(t5 + 1).join(" "), c2 = "", l2 = "";
|
|
194
|
-
for (i5 = 0; i5 < s2; i5 += 1) {
|
|
195
|
-
for (n4 = Math.floor((i5 - a2) / t5), l2 = "", r5 = 0; r5 < s2; r5 += 1) o3 = 1, a2 <= r5 && r5 < h3 && a2 <= i5 && i5 < h3 && v2.isDark(n4, Math.floor((r5 - a2) / t5)) && (o3 = 0), l2 += o3 ? d2 : u2;
|
|
196
|
-
for (n4 = 0; n4 < t5; n4 += 1) c2 += l2 + "\n";
|
|
197
|
-
}
|
|
198
|
-
return c2.substring(0, c2.length - 1);
|
|
199
|
-
}, v2.renderTo2dContext = function(t5, e5) {
|
|
200
|
-
e5 = e5 || 2;
|
|
201
|
-
for (var i5 = v2.getModuleCount(), r5 = 0; r5 < i5; r5++) for (var n4 = 0; n4 < i5; n4++) t5.fillStyle = v2.isDark(r5, n4) ? "black" : "white", t5.fillRect(r5 * e5, n4 * e5, e5, e5);
|
|
202
|
-
}, v2;
|
|
203
|
-
};
|
|
204
|
-
t3.stringToBytes = (t3.stringToBytesFuncs = { default: function(t4) {
|
|
205
|
-
for (var e4 = [], i4 = 0; i4 < t4.length; i4 += 1) {
|
|
206
|
-
var r4 = t4.charCodeAt(i4);
|
|
207
|
-
e4.push(255 & r4);
|
|
208
|
-
}
|
|
209
|
-
return e4;
|
|
210
|
-
} }).default, t3.createStringToBytes = function(t4, e4) {
|
|
211
|
-
var i4 = (function() {
|
|
212
|
-
for (var i5 = v(t4), r5 = function() {
|
|
213
|
-
var t5 = i5.read();
|
|
214
|
-
if (-1 == t5) throw "eof";
|
|
215
|
-
return t5;
|
|
216
|
-
}, n3 = 0, o2 = {}; ; ) {
|
|
217
|
-
var s2 = i5.read();
|
|
218
|
-
if (-1 == s2) break;
|
|
219
|
-
var a2 = r5(), h2 = r5() << 8 | r5();
|
|
220
|
-
o2[String.fromCharCode(s2 << 8 | a2)] = h2, n3 += 1;
|
|
221
|
-
}
|
|
222
|
-
if (n3 != e4) throw n3 + " != " + e4;
|
|
223
|
-
return o2;
|
|
224
|
-
})(), r4 = "?".charCodeAt(0);
|
|
225
|
-
return function(t5) {
|
|
226
|
-
for (var e5 = [], n3 = 0; n3 < t5.length; n3 += 1) {
|
|
227
|
-
var o2 = t5.charCodeAt(n3);
|
|
228
|
-
if (o2 < 128) e5.push(o2);
|
|
229
|
-
else {
|
|
230
|
-
var s2 = i4[t5.charAt(n3)];
|
|
231
|
-
"number" == typeof s2 ? (255 & s2) == s2 ? e5.push(s2) : (e5.push(s2 >>> 8), e5.push(255 & s2)) : e5.push(r4);
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
return e5;
|
|
235
|
-
};
|
|
236
|
-
};
|
|
237
|
-
var e3, i3, r3, n2, o, s = { L: 1, M: 0, Q: 3, H: 2 }, a = (e3 = [[], [6, 18], [6, 22], [6, 26], [6, 30], [6, 34], [6, 22, 38], [6, 24, 42], [6, 26, 46], [6, 28, 50], [6, 30, 54], [6, 32, 58], [6, 34, 62], [6, 26, 46, 66], [6, 26, 48, 70], [6, 26, 50, 74], [6, 30, 54, 78], [6, 30, 56, 82], [6, 30, 58, 86], [6, 34, 62, 90], [6, 28, 50, 72, 94], [6, 26, 50, 74, 98], [6, 30, 54, 78, 102], [6, 28, 54, 80, 106], [6, 32, 58, 84, 110], [6, 30, 58, 86, 114], [6, 34, 62, 90, 118], [6, 26, 50, 74, 98, 122], [6, 30, 54, 78, 102, 126], [6, 26, 52, 78, 104, 130], [6, 30, 56, 82, 108, 134], [6, 34, 60, 86, 112, 138], [6, 30, 58, 86, 114, 142], [6, 34, 62, 90, 118, 146], [6, 30, 54, 78, 102, 126, 150], [6, 24, 50, 76, 102, 128, 154], [6, 28, 54, 80, 106, 132, 158], [6, 32, 58, 84, 110, 136, 162], [6, 26, 54, 82, 110, 138, 166], [6, 30, 58, 86, 114, 142, 170]], i3 = 1335, r3 = 7973, o = function(t4) {
|
|
238
|
-
for (var e4 = 0; 0 != t4; ) e4 += 1, t4 >>>= 1;
|
|
239
|
-
return e4;
|
|
240
|
-
}, (n2 = {}).getBCHTypeInfo = function(t4) {
|
|
241
|
-
for (var e4 = t4 << 10; o(e4) - o(i3) >= 0; ) e4 ^= i3 << o(e4) - o(i3);
|
|
242
|
-
return 21522 ^ (t4 << 10 | e4);
|
|
243
|
-
}, n2.getBCHTypeNumber = function(t4) {
|
|
244
|
-
for (var e4 = t4 << 12; o(e4) - o(r3) >= 0; ) e4 ^= r3 << o(e4) - o(r3);
|
|
245
|
-
return t4 << 12 | e4;
|
|
246
|
-
}, n2.getPatternPosition = function(t4) {
|
|
247
|
-
return e3[t4 - 1];
|
|
248
|
-
}, n2.getMaskFunction = function(t4) {
|
|
249
|
-
switch (t4) {
|
|
250
|
-
case 0:
|
|
251
|
-
return function(t5, e4) {
|
|
252
|
-
return (t5 + e4) % 2 == 0;
|
|
253
|
-
};
|
|
254
|
-
case 1:
|
|
255
|
-
return function(t5, e4) {
|
|
256
|
-
return t5 % 2 == 0;
|
|
257
|
-
};
|
|
258
|
-
case 2:
|
|
259
|
-
return function(t5, e4) {
|
|
260
|
-
return e4 % 3 == 0;
|
|
261
|
-
};
|
|
262
|
-
case 3:
|
|
263
|
-
return function(t5, e4) {
|
|
264
|
-
return (t5 + e4) % 3 == 0;
|
|
265
|
-
};
|
|
266
|
-
case 4:
|
|
267
|
-
return function(t5, e4) {
|
|
268
|
-
return (Math.floor(t5 / 2) + Math.floor(e4 / 3)) % 2 == 0;
|
|
269
|
-
};
|
|
270
|
-
case 5:
|
|
271
|
-
return function(t5, e4) {
|
|
272
|
-
return t5 * e4 % 2 + t5 * e4 % 3 == 0;
|
|
273
|
-
};
|
|
274
|
-
case 6:
|
|
275
|
-
return function(t5, e4) {
|
|
276
|
-
return (t5 * e4 % 2 + t5 * e4 % 3) % 2 == 0;
|
|
277
|
-
};
|
|
278
|
-
case 7:
|
|
279
|
-
return function(t5, e4) {
|
|
280
|
-
return (t5 * e4 % 3 + (t5 + e4) % 2) % 2 == 0;
|
|
281
|
-
};
|
|
282
|
-
default:
|
|
283
|
-
throw "bad maskPattern:" + t4;
|
|
284
|
-
}
|
|
285
|
-
}, n2.getErrorCorrectPolynomial = function(t4) {
|
|
286
|
-
for (var e4 = d([1], 0), i4 = 0; i4 < t4; i4 += 1) e4 = e4.multiply(d([1, h.gexp(i4)], 0));
|
|
287
|
-
return e4;
|
|
288
|
-
}, n2.getLengthInBits = function(t4, e4) {
|
|
289
|
-
if (1 <= e4 && e4 < 10) switch (t4) {
|
|
290
|
-
case 1:
|
|
291
|
-
return 10;
|
|
292
|
-
case 2:
|
|
293
|
-
return 9;
|
|
294
|
-
case 4:
|
|
295
|
-
case 8:
|
|
296
|
-
return 8;
|
|
297
|
-
default:
|
|
298
|
-
throw "mode:" + t4;
|
|
299
|
-
}
|
|
300
|
-
else if (e4 < 27) switch (t4) {
|
|
301
|
-
case 1:
|
|
302
|
-
return 12;
|
|
303
|
-
case 2:
|
|
304
|
-
return 11;
|
|
305
|
-
case 4:
|
|
306
|
-
return 16;
|
|
307
|
-
case 8:
|
|
308
|
-
return 10;
|
|
309
|
-
default:
|
|
310
|
-
throw "mode:" + t4;
|
|
311
|
-
}
|
|
312
|
-
else {
|
|
313
|
-
if (!(e4 < 41)) throw "type:" + e4;
|
|
314
|
-
switch (t4) {
|
|
315
|
-
case 1:
|
|
316
|
-
return 14;
|
|
317
|
-
case 2:
|
|
318
|
-
return 13;
|
|
319
|
-
case 4:
|
|
320
|
-
return 16;
|
|
321
|
-
case 8:
|
|
322
|
-
return 12;
|
|
323
|
-
default:
|
|
324
|
-
throw "mode:" + t4;
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
}, n2.getLostPoint = function(t4) {
|
|
328
|
-
for (var e4 = t4.getModuleCount(), i4 = 0, r4 = 0; r4 < e4; r4 += 1) for (var n3 = 0; n3 < e4; n3 += 1) {
|
|
329
|
-
for (var o2 = 0, s2 = t4.isDark(r4, n3), a2 = -1; a2 <= 1; a2 += 1) if (!(r4 + a2 < 0 || e4 <= r4 + a2)) for (var h2 = -1; h2 <= 1; h2 += 1) n3 + h2 < 0 || e4 <= n3 + h2 || 0 == a2 && 0 == h2 || s2 == t4.isDark(r4 + a2, n3 + h2) && (o2 += 1);
|
|
330
|
-
o2 > 5 && (i4 += 3 + o2 - 5);
|
|
331
|
-
}
|
|
332
|
-
for (r4 = 0; r4 < e4 - 1; r4 += 1) for (n3 = 0; n3 < e4 - 1; n3 += 1) {
|
|
333
|
-
var d2 = 0;
|
|
334
|
-
t4.isDark(r4, n3) && (d2 += 1), t4.isDark(r4 + 1, n3) && (d2 += 1), t4.isDark(r4, n3 + 1) && (d2 += 1), t4.isDark(r4 + 1, n3 + 1) && (d2 += 1), 0 != d2 && 4 != d2 || (i4 += 3);
|
|
335
|
-
}
|
|
336
|
-
for (r4 = 0; r4 < e4; r4 += 1) for (n3 = 0; n3 < e4 - 6; n3 += 1) t4.isDark(r4, n3) && !t4.isDark(r4, n3 + 1) && t4.isDark(r4, n3 + 2) && t4.isDark(r4, n3 + 3) && t4.isDark(r4, n3 + 4) && !t4.isDark(r4, n3 + 5) && t4.isDark(r4, n3 + 6) && (i4 += 40);
|
|
337
|
-
for (n3 = 0; n3 < e4; n3 += 1) for (r4 = 0; r4 < e4 - 6; r4 += 1) t4.isDark(r4, n3) && !t4.isDark(r4 + 1, n3) && t4.isDark(r4 + 2, n3) && t4.isDark(r4 + 3, n3) && t4.isDark(r4 + 4, n3) && !t4.isDark(r4 + 5, n3) && t4.isDark(r4 + 6, n3) && (i4 += 40);
|
|
338
|
-
var u2 = 0;
|
|
339
|
-
for (n3 = 0; n3 < e4; n3 += 1) for (r4 = 0; r4 < e4; r4 += 1) t4.isDark(r4, n3) && (u2 += 1);
|
|
340
|
-
return i4 + Math.abs(100 * u2 / e4 / e4 - 50) / 5 * 10;
|
|
341
|
-
}, n2), h = (function() {
|
|
342
|
-
for (var t4 = new Array(256), e4 = new Array(256), i4 = 0; i4 < 8; i4 += 1) t4[i4] = 1 << i4;
|
|
343
|
-
for (i4 = 8; i4 < 256; i4 += 1) t4[i4] = t4[i4 - 4] ^ t4[i4 - 5] ^ t4[i4 - 6] ^ t4[i4 - 8];
|
|
344
|
-
for (i4 = 0; i4 < 255; i4 += 1) e4[t4[i4]] = i4;
|
|
345
|
-
return { glog: function(t5) {
|
|
346
|
-
if (t5 < 1) throw "glog(" + t5 + ")";
|
|
347
|
-
return e4[t5];
|
|
348
|
-
}, gexp: function(e5) {
|
|
349
|
-
for (; e5 < 0; ) e5 += 255;
|
|
350
|
-
for (; e5 >= 256; ) e5 -= 255;
|
|
351
|
-
return t4[e5];
|
|
352
|
-
} };
|
|
353
|
-
})();
|
|
354
|
-
function d(t4, e4) {
|
|
355
|
-
if (void 0 === t4.length) throw t4.length + "/" + e4;
|
|
356
|
-
var i4 = (function() {
|
|
357
|
-
for (var i5 = 0; i5 < t4.length && 0 == t4[i5]; ) i5 += 1;
|
|
358
|
-
for (var r5 = new Array(t4.length - i5 + e4), n3 = 0; n3 < t4.length - i5; n3 += 1) r5[n3] = t4[n3 + i5];
|
|
359
|
-
return r5;
|
|
360
|
-
})(), r4 = { getAt: function(t5) {
|
|
361
|
-
return i4[t5];
|
|
362
|
-
}, getLength: function() {
|
|
363
|
-
return i4.length;
|
|
364
|
-
}, multiply: function(t5) {
|
|
365
|
-
for (var e5 = new Array(r4.getLength() + t5.getLength() - 1), i5 = 0; i5 < r4.getLength(); i5 += 1) for (var n3 = 0; n3 < t5.getLength(); n3 += 1) e5[i5 + n3] ^= h.gexp(h.glog(r4.getAt(i5)) + h.glog(t5.getAt(n3)));
|
|
366
|
-
return d(e5, 0);
|
|
367
|
-
}, mod: function(t5) {
|
|
368
|
-
if (r4.getLength() - t5.getLength() < 0) return r4;
|
|
369
|
-
for (var e5 = h.glog(r4.getAt(0)) - h.glog(t5.getAt(0)), i5 = new Array(r4.getLength()), n3 = 0; n3 < r4.getLength(); n3 += 1) i5[n3] = r4.getAt(n3);
|
|
370
|
-
for (n3 = 0; n3 < t5.getLength(); n3 += 1) i5[n3] ^= h.gexp(h.glog(t5.getAt(n3)) + e5);
|
|
371
|
-
return d(i5, 0).mod(t5);
|
|
372
|
-
} };
|
|
373
|
-
return r4;
|
|
374
|
-
}
|
|
375
|
-
var u = /* @__PURE__ */ (function() {
|
|
376
|
-
var t4 = [[1, 26, 19], [1, 26, 16], [1, 26, 13], [1, 26, 9], [1, 44, 34], [1, 44, 28], [1, 44, 22], [1, 44, 16], [1, 70, 55], [1, 70, 44], [2, 35, 17], [2, 35, 13], [1, 100, 80], [2, 50, 32], [2, 50, 24], [4, 25, 9], [1, 134, 108], [2, 67, 43], [2, 33, 15, 2, 34, 16], [2, 33, 11, 2, 34, 12], [2, 86, 68], [4, 43, 27], [4, 43, 19], [4, 43, 15], [2, 98, 78], [4, 49, 31], [2, 32, 14, 4, 33, 15], [4, 39, 13, 1, 40, 14], [2, 121, 97], [2, 60, 38, 2, 61, 39], [4, 40, 18, 2, 41, 19], [4, 40, 14, 2, 41, 15], [2, 146, 116], [3, 58, 36, 2, 59, 37], [4, 36, 16, 4, 37, 17], [4, 36, 12, 4, 37, 13], [2, 86, 68, 2, 87, 69], [4, 69, 43, 1, 70, 44], [6, 43, 19, 2, 44, 20], [6, 43, 15, 2, 44, 16], [4, 101, 81], [1, 80, 50, 4, 81, 51], [4, 50, 22, 4, 51, 23], [3, 36, 12, 8, 37, 13], [2, 116, 92, 2, 117, 93], [6, 58, 36, 2, 59, 37], [4, 46, 20, 6, 47, 21], [7, 42, 14, 4, 43, 15], [4, 133, 107], [8, 59, 37, 1, 60, 38], [8, 44, 20, 4, 45, 21], [12, 33, 11, 4, 34, 12], [3, 145, 115, 1, 146, 116], [4, 64, 40, 5, 65, 41], [11, 36, 16, 5, 37, 17], [11, 36, 12, 5, 37, 13], [5, 109, 87, 1, 110, 88], [5, 65, 41, 5, 66, 42], [5, 54, 24, 7, 55, 25], [11, 36, 12, 7, 37, 13], [5, 122, 98, 1, 123, 99], [7, 73, 45, 3, 74, 46], [15, 43, 19, 2, 44, 20], [3, 45, 15, 13, 46, 16], [1, 135, 107, 5, 136, 108], [10, 74, 46, 1, 75, 47], [1, 50, 22, 15, 51, 23], [2, 42, 14, 17, 43, 15], [5, 150, 120, 1, 151, 121], [9, 69, 43, 4, 70, 44], [17, 50, 22, 1, 51, 23], [2, 42, 14, 19, 43, 15], [3, 141, 113, 4, 142, 114], [3, 70, 44, 11, 71, 45], [17, 47, 21, 4, 48, 22], [9, 39, 13, 16, 40, 14], [3, 135, 107, 5, 136, 108], [3, 67, 41, 13, 68, 42], [15, 54, 24, 5, 55, 25], [15, 43, 15, 10, 44, 16], [4, 144, 116, 4, 145, 117], [17, 68, 42], [17, 50, 22, 6, 51, 23], [19, 46, 16, 6, 47, 17], [2, 139, 111, 7, 140, 112], [17, 74, 46], [7, 54, 24, 16, 55, 25], [34, 37, 13], [4, 151, 121, 5, 152, 122], [4, 75, 47, 14, 76, 48], [11, 54, 24, 14, 55, 25], [16, 45, 15, 14, 46, 16], [6, 147, 117, 4, 148, 118], [6, 73, 45, 14, 74, 46], [11, 54, 24, 16, 55, 25], [30, 46, 16, 2, 47, 17], [8, 132, 106, 4, 133, 107], [8, 75, 47, 13, 76, 48], [7, 54, 24, 22, 55, 25], [22, 45, 15, 13, 46, 16], [10, 142, 114, 2, 143, 115], [19, 74, 46, 4, 75, 47], [28, 50, 22, 6, 51, 23], [33, 46, 16, 4, 47, 17], [8, 152, 122, 4, 153, 123], [22, 73, 45, 3, 74, 46], [8, 53, 23, 26, 54, 24], [12, 45, 15, 28, 46, 16], [3, 147, 117, 10, 148, 118], [3, 73, 45, 23, 74, 46], [4, 54, 24, 31, 55, 25], [11, 45, 15, 31, 46, 16], [7, 146, 116, 7, 147, 117], [21, 73, 45, 7, 74, 46], [1, 53, 23, 37, 54, 24], [19, 45, 15, 26, 46, 16], [5, 145, 115, 10, 146, 116], [19, 75, 47, 10, 76, 48], [15, 54, 24, 25, 55, 25], [23, 45, 15, 25, 46, 16], [13, 145, 115, 3, 146, 116], [2, 74, 46, 29, 75, 47], [42, 54, 24, 1, 55, 25], [23, 45, 15, 28, 46, 16], [17, 145, 115], [10, 74, 46, 23, 75, 47], [10, 54, 24, 35, 55, 25], [19, 45, 15, 35, 46, 16], [17, 145, 115, 1, 146, 116], [14, 74, 46, 21, 75, 47], [29, 54, 24, 19, 55, 25], [11, 45, 15, 46, 46, 16], [13, 145, 115, 6, 146, 116], [14, 74, 46, 23, 75, 47], [44, 54, 24, 7, 55, 25], [59, 46, 16, 1, 47, 17], [12, 151, 121, 7, 152, 122], [12, 75, 47, 26, 76, 48], [39, 54, 24, 14, 55, 25], [22, 45, 15, 41, 46, 16], [6, 151, 121, 14, 152, 122], [6, 75, 47, 34, 76, 48], [46, 54, 24, 10, 55, 25], [2, 45, 15, 64, 46, 16], [17, 152, 122, 4, 153, 123], [29, 74, 46, 14, 75, 47], [49, 54, 24, 10, 55, 25], [24, 45, 15, 46, 46, 16], [4, 152, 122, 18, 153, 123], [13, 74, 46, 32, 75, 47], [48, 54, 24, 14, 55, 25], [42, 45, 15, 32, 46, 16], [20, 147, 117, 4, 148, 118], [40, 75, 47, 7, 76, 48], [43, 54, 24, 22, 55, 25], [10, 45, 15, 67, 46, 16], [19, 148, 118, 6, 149, 119], [18, 75, 47, 31, 76, 48], [34, 54, 24, 34, 55, 25], [20, 45, 15, 61, 46, 16]], e4 = function(t5, e5) {
|
|
377
|
-
var i5 = {};
|
|
378
|
-
return i5.totalCount = t5, i5.dataCount = e5, i5;
|
|
379
|
-
}, i4 = { getRSBlocks: function(i5, r4) {
|
|
380
|
-
var n3 = (function(e5, i6) {
|
|
381
|
-
switch (i6) {
|
|
382
|
-
case s.L:
|
|
383
|
-
return t4[4 * (e5 - 1) + 0];
|
|
384
|
-
case s.M:
|
|
385
|
-
return t4[4 * (e5 - 1) + 1];
|
|
386
|
-
case s.Q:
|
|
387
|
-
return t4[4 * (e5 - 1) + 2];
|
|
388
|
-
case s.H:
|
|
389
|
-
return t4[4 * (e5 - 1) + 3];
|
|
390
|
-
default:
|
|
391
|
-
return;
|
|
392
|
-
}
|
|
393
|
-
})(i5, r4);
|
|
394
|
-
if (void 0 === n3) throw "bad rs block @ typeNumber:" + i5 + "/errorCorrectionLevel:" + r4;
|
|
395
|
-
for (var o2 = n3.length / 3, a2 = [], h2 = 0; h2 < o2; h2 += 1) for (var d2 = n3[3 * h2 + 0], u2 = n3[3 * h2 + 1], c2 = n3[3 * h2 + 2], l2 = 0; l2 < d2; l2 += 1) a2.push(e4(u2, c2));
|
|
396
|
-
return a2;
|
|
397
|
-
} };
|
|
398
|
-
return i4;
|
|
399
|
-
})(), c = function() {
|
|
400
|
-
var t4 = [], e4 = 0, i4 = { getBuffer: function() {
|
|
401
|
-
return t4;
|
|
402
|
-
}, getAt: function(e5) {
|
|
403
|
-
var i5 = Math.floor(e5 / 8);
|
|
404
|
-
return 1 == (t4[i5] >>> 7 - e5 % 8 & 1);
|
|
405
|
-
}, put: function(t5, e5) {
|
|
406
|
-
for (var r4 = 0; r4 < e5; r4 += 1) i4.putBit(1 == (t5 >>> e5 - r4 - 1 & 1));
|
|
407
|
-
}, getLengthInBits: function() {
|
|
408
|
-
return e4;
|
|
409
|
-
}, putBit: function(i5) {
|
|
410
|
-
var r4 = Math.floor(e4 / 8);
|
|
411
|
-
t4.length <= r4 && t4.push(0), i5 && (t4[r4] |= 128 >>> e4 % 8), e4 += 1;
|
|
412
|
-
} };
|
|
413
|
-
return i4;
|
|
414
|
-
}, l = function(t4) {
|
|
415
|
-
var e4 = t4, i4 = { getMode: function() {
|
|
416
|
-
return 1;
|
|
417
|
-
}, getLength: function(t5) {
|
|
418
|
-
return e4.length;
|
|
419
|
-
}, write: function(t5) {
|
|
420
|
-
for (var i5 = e4, n4 = 0; n4 + 2 < i5.length; ) t5.put(r4(i5.substring(n4, n4 + 3)), 10), n4 += 3;
|
|
421
|
-
n4 < i5.length && (i5.length - n4 == 1 ? t5.put(r4(i5.substring(n4, n4 + 1)), 4) : i5.length - n4 == 2 && t5.put(r4(i5.substring(n4, n4 + 2)), 7));
|
|
422
|
-
} }, r4 = function(t5) {
|
|
423
|
-
for (var e5 = 0, i5 = 0; i5 < t5.length; i5 += 1) e5 = 10 * e5 + n3(t5.charAt(i5));
|
|
424
|
-
return e5;
|
|
425
|
-
}, n3 = function(t5) {
|
|
426
|
-
if ("0" <= t5 && t5 <= "9") return t5.charCodeAt(0) - "0".charCodeAt(0);
|
|
427
|
-
throw "illegal char :" + t5;
|
|
428
|
-
};
|
|
429
|
-
return i4;
|
|
430
|
-
}, g = function(t4) {
|
|
431
|
-
var e4 = t4, i4 = { getMode: function() {
|
|
432
|
-
return 2;
|
|
433
|
-
}, getLength: function(t5) {
|
|
434
|
-
return e4.length;
|
|
435
|
-
}, write: function(t5) {
|
|
436
|
-
for (var i5 = e4, n3 = 0; n3 + 1 < i5.length; ) t5.put(45 * r4(i5.charAt(n3)) + r4(i5.charAt(n3 + 1)), 11), n3 += 2;
|
|
437
|
-
n3 < i5.length && t5.put(r4(i5.charAt(n3)), 6);
|
|
438
|
-
} }, r4 = function(t5) {
|
|
439
|
-
if ("0" <= t5 && t5 <= "9") return t5.charCodeAt(0) - "0".charCodeAt(0);
|
|
440
|
-
if ("A" <= t5 && t5 <= "Z") return t5.charCodeAt(0) - "A".charCodeAt(0) + 10;
|
|
441
|
-
switch (t5) {
|
|
442
|
-
case " ":
|
|
443
|
-
return 36;
|
|
444
|
-
case "$":
|
|
445
|
-
return 37;
|
|
446
|
-
case "%":
|
|
447
|
-
return 38;
|
|
448
|
-
case "*":
|
|
449
|
-
return 39;
|
|
450
|
-
case "+":
|
|
451
|
-
return 40;
|
|
452
|
-
case "-":
|
|
453
|
-
return 41;
|
|
454
|
-
case ".":
|
|
455
|
-
return 42;
|
|
456
|
-
case "/":
|
|
457
|
-
return 43;
|
|
458
|
-
case ":":
|
|
459
|
-
return 44;
|
|
460
|
-
default:
|
|
461
|
-
throw "illegal char :" + t5;
|
|
462
|
-
}
|
|
463
|
-
};
|
|
464
|
-
return i4;
|
|
465
|
-
}, f = function(e4) {
|
|
466
|
-
var i4 = t3.stringToBytes(e4);
|
|
467
|
-
return { getMode: function() {
|
|
468
|
-
return 4;
|
|
469
|
-
}, getLength: function(t4) {
|
|
470
|
-
return i4.length;
|
|
471
|
-
}, write: function(t4) {
|
|
472
|
-
for (var e5 = 0; e5 < i4.length; e5 += 1) t4.put(i4[e5], 8);
|
|
473
|
-
} };
|
|
474
|
-
}, w = function(e4) {
|
|
475
|
-
var i4 = t3.stringToBytesFuncs.SJIS;
|
|
476
|
-
if (!i4) throw "sjis not supported.";
|
|
477
|
-
!(function() {
|
|
478
|
-
var t4 = i4("\u53CB");
|
|
479
|
-
if (2 != t4.length || 38726 != (t4[0] << 8 | t4[1])) throw "sjis not supported.";
|
|
480
|
-
})();
|
|
481
|
-
var r4 = i4(e4), n3 = { getMode: function() {
|
|
482
|
-
return 8;
|
|
483
|
-
}, getLength: function(t4) {
|
|
484
|
-
return ~~(r4.length / 2);
|
|
485
|
-
}, write: function(t4) {
|
|
486
|
-
for (var e5 = r4, i5 = 0; i5 + 1 < e5.length; ) {
|
|
487
|
-
var n4 = (255 & e5[i5]) << 8 | 255 & e5[i5 + 1];
|
|
488
|
-
if (33088 <= n4 && n4 <= 40956) n4 -= 33088;
|
|
489
|
-
else {
|
|
490
|
-
if (!(57408 <= n4 && n4 <= 60351)) throw "illegal char at " + (i5 + 1) + "/" + n4;
|
|
491
|
-
n4 -= 49472;
|
|
492
|
-
}
|
|
493
|
-
n4 = 192 * (n4 >>> 8 & 255) + (255 & n4), t4.put(n4, 13), i5 += 2;
|
|
494
|
-
}
|
|
495
|
-
if (i5 < e5.length) throw "illegal char at " + (i5 + 1);
|
|
496
|
-
} };
|
|
497
|
-
return n3;
|
|
498
|
-
}, p = function() {
|
|
499
|
-
var t4 = [], e4 = { writeByte: function(e5) {
|
|
500
|
-
t4.push(255 & e5);
|
|
501
|
-
}, writeShort: function(t5) {
|
|
502
|
-
e4.writeByte(t5), e4.writeByte(t5 >>> 8);
|
|
503
|
-
}, writeBytes: function(t5, i4, r4) {
|
|
504
|
-
i4 = i4 || 0, r4 = r4 || t5.length;
|
|
505
|
-
for (var n3 = 0; n3 < r4; n3 += 1) e4.writeByte(t5[n3 + i4]);
|
|
506
|
-
}, writeString: function(t5) {
|
|
507
|
-
for (var i4 = 0; i4 < t5.length; i4 += 1) e4.writeByte(t5.charCodeAt(i4));
|
|
508
|
-
}, toByteArray: function() {
|
|
509
|
-
return t4;
|
|
510
|
-
}, toString: function() {
|
|
511
|
-
var e5 = "";
|
|
512
|
-
e5 += "[";
|
|
513
|
-
for (var i4 = 0; i4 < t4.length; i4 += 1) i4 > 0 && (e5 += ","), e5 += t4[i4];
|
|
514
|
-
return e5 + "]";
|
|
515
|
-
} };
|
|
516
|
-
return e4;
|
|
517
|
-
}, v = function(t4) {
|
|
518
|
-
var e4 = t4, i4 = 0, r4 = 0, n3 = 0, o2 = { read: function() {
|
|
519
|
-
for (; n3 < 8; ) {
|
|
520
|
-
if (i4 >= e4.length) {
|
|
521
|
-
if (0 == n3) return -1;
|
|
522
|
-
throw "unexpected end of file./" + n3;
|
|
523
|
-
}
|
|
524
|
-
var t5 = e4.charAt(i4);
|
|
525
|
-
if (i4 += 1, "=" == t5) return n3 = 0, -1;
|
|
526
|
-
t5.match(/^\s$/) || (r4 = r4 << 6 | s2(t5.charCodeAt(0)), n3 += 6);
|
|
527
|
-
}
|
|
528
|
-
var o3 = r4 >>> n3 - 8 & 255;
|
|
529
|
-
return n3 -= 8, o3;
|
|
530
|
-
} }, s2 = function(t5) {
|
|
531
|
-
if (65 <= t5 && t5 <= 90) return t5 - 65;
|
|
532
|
-
if (97 <= t5 && t5 <= 122) return t5 - 97 + 26;
|
|
533
|
-
if (48 <= t5 && t5 <= 57) return t5 - 48 + 52;
|
|
534
|
-
if (43 == t5) return 62;
|
|
535
|
-
if (47 == t5) return 63;
|
|
536
|
-
throw "c:" + t5;
|
|
537
|
-
};
|
|
538
|
-
return o2;
|
|
539
|
-
}, _ = function(t4, e4, i4) {
|
|
540
|
-
for (var r4 = (function(t5, e5) {
|
|
541
|
-
var i5 = t5, r5 = e5, n4 = new Array(t5 * e5), o3 = { setPixel: function(t6, e6, r6) {
|
|
542
|
-
n4[e6 * i5 + t6] = r6;
|
|
543
|
-
}, write: function(t6) {
|
|
544
|
-
t6.writeString("GIF87a"), t6.writeShort(i5), t6.writeShort(r5), t6.writeByte(128), t6.writeByte(0), t6.writeByte(0), t6.writeByte(0), t6.writeByte(0), t6.writeByte(0), t6.writeByte(255), t6.writeByte(255), t6.writeByte(255), t6.writeString(","), t6.writeShort(0), t6.writeShort(0), t6.writeShort(i5), t6.writeShort(r5), t6.writeByte(0);
|
|
545
|
-
var e6 = s3(2);
|
|
546
|
-
t6.writeByte(2);
|
|
547
|
-
for (var n5 = 0; e6.length - n5 > 255; ) t6.writeByte(255), t6.writeBytes(e6, n5, 255), n5 += 255;
|
|
548
|
-
t6.writeByte(e6.length - n5), t6.writeBytes(e6, n5, e6.length - n5), t6.writeByte(0), t6.writeString(";");
|
|
549
|
-
} }, s3 = function(t6) {
|
|
550
|
-
for (var e6 = 1 << t6, i6 = 1 + (1 << t6), r6 = t6 + 1, o4 = a3(), s4 = 0; s4 < e6; s4 += 1) o4.add(String.fromCharCode(s4));
|
|
551
|
-
o4.add(String.fromCharCode(e6)), o4.add(String.fromCharCode(i6));
|
|
552
|
-
var h3, d3, u2, c2 = p(), l2 = (h3 = c2, d3 = 0, u2 = 0, { write: function(t7, e7) {
|
|
553
|
-
if (t7 >>> e7 != 0) throw "length over";
|
|
554
|
-
for (; d3 + e7 >= 8; ) h3.writeByte(255 & (t7 << d3 | u2)), e7 -= 8 - d3, t7 >>>= 8 - d3, u2 = 0, d3 = 0;
|
|
555
|
-
u2 |= t7 << d3, d3 += e7;
|
|
556
|
-
}, flush: function() {
|
|
557
|
-
d3 > 0 && h3.writeByte(u2);
|
|
558
|
-
} });
|
|
559
|
-
l2.write(e6, r6);
|
|
560
|
-
var g2 = 0, f2 = String.fromCharCode(n4[g2]);
|
|
561
|
-
for (g2 += 1; g2 < n4.length; ) {
|
|
562
|
-
var w2 = String.fromCharCode(n4[g2]);
|
|
563
|
-
g2 += 1, o4.contains(f2 + w2) ? f2 += w2 : (l2.write(o4.indexOf(f2), r6), o4.size() < 4095 && (o4.size() == 1 << r6 && (r6 += 1), o4.add(f2 + w2)), f2 = w2);
|
|
564
|
-
}
|
|
565
|
-
return l2.write(o4.indexOf(f2), r6), l2.write(i6, r6), l2.flush(), c2.toByteArray();
|
|
566
|
-
}, a3 = function() {
|
|
567
|
-
var t6 = {}, e6 = 0, i6 = { add: function(r6) {
|
|
568
|
-
if (i6.contains(r6)) throw "dup key:" + r6;
|
|
569
|
-
t6[r6] = e6, e6 += 1;
|
|
570
|
-
}, size: function() {
|
|
571
|
-
return e6;
|
|
572
|
-
}, indexOf: function(e7) {
|
|
573
|
-
return t6[e7];
|
|
574
|
-
}, contains: function(e7) {
|
|
575
|
-
return void 0 !== t6[e7];
|
|
576
|
-
} };
|
|
577
|
-
return i6;
|
|
578
|
-
};
|
|
579
|
-
return o3;
|
|
580
|
-
})(t4, e4), n3 = 0; n3 < e4; n3 += 1) for (var o2 = 0; o2 < t4; o2 += 1) r4.setPixel(o2, n3, i4(o2, n3));
|
|
581
|
-
var s2 = p();
|
|
582
|
-
r4.write(s2);
|
|
583
|
-
for (var a2 = (function() {
|
|
584
|
-
var t5 = 0, e5 = 0, i5 = 0, r5 = "", n4 = {}, o3 = function(t6) {
|
|
585
|
-
r5 += String.fromCharCode(s3(63 & t6));
|
|
586
|
-
}, s3 = function(t6) {
|
|
587
|
-
if (t6 < 0) ;
|
|
588
|
-
else {
|
|
589
|
-
if (t6 < 26) return 65 + t6;
|
|
590
|
-
if (t6 < 52) return t6 - 26 + 97;
|
|
591
|
-
if (t6 < 62) return t6 - 52 + 48;
|
|
592
|
-
if (62 == t6) return 43;
|
|
593
|
-
if (63 == t6) return 47;
|
|
594
|
-
}
|
|
595
|
-
throw "n:" + t6;
|
|
596
|
-
};
|
|
597
|
-
return n4.writeByte = function(r6) {
|
|
598
|
-
for (t5 = t5 << 8 | 255 & r6, e5 += 8, i5 += 1; e5 >= 6; ) o3(t5 >>> e5 - 6), e5 -= 6;
|
|
599
|
-
}, n4.flush = function() {
|
|
600
|
-
if (e5 > 0 && (o3(t5 << 6 - e5), t5 = 0, e5 = 0), i5 % 3 != 0) for (var n5 = 3 - i5 % 3, s4 = 0; s4 < n5; s4 += 1) r5 += "=";
|
|
601
|
-
}, n4.toString = function() {
|
|
602
|
-
return r5;
|
|
603
|
-
}, n4;
|
|
604
|
-
})(), h2 = s2.toByteArray(), d2 = 0; d2 < h2.length; d2 += 1) a2.writeByte(h2[d2]);
|
|
605
|
-
return a2.flush(), "data:image/gif;base64," + a2;
|
|
606
|
-
};
|
|
607
|
-
return t3;
|
|
608
|
-
})();
|
|
609
|
-
n.stringToBytesFuncs["UTF-8"] = function(t3) {
|
|
610
|
-
return (function(t4) {
|
|
611
|
-
for (var e3 = [], i3 = 0; i3 < t4.length; i3++) {
|
|
612
|
-
var r3 = t4.charCodeAt(i3);
|
|
613
|
-
r3 < 128 ? e3.push(r3) : r3 < 2048 ? e3.push(192 | r3 >> 6, 128 | 63 & r3) : r3 < 55296 || r3 >= 57344 ? e3.push(224 | r3 >> 12, 128 | r3 >> 6 & 63, 128 | 63 & r3) : (i3++, r3 = 65536 + ((1023 & r3) << 10 | 1023 & t4.charCodeAt(i3)), e3.push(240 | r3 >> 18, 128 | r3 >> 12 & 63, 128 | r3 >> 6 & 63, 128 | 63 & r3));
|
|
614
|
-
}
|
|
615
|
-
return e3;
|
|
616
|
-
})(t3);
|
|
617
|
-
}, void 0 === (r2 = "function" == typeof (i2 = function() {
|
|
618
|
-
return n;
|
|
619
|
-
}) ? i2.apply(e2, []) : i2) || (t2.exports = r2);
|
|
620
|
-
} }, e = {};
|
|
621
|
-
function i(r2) {
|
|
622
|
-
var n = e[r2];
|
|
623
|
-
if (void 0 !== n) return n.exports;
|
|
624
|
-
var o = e[r2] = { exports: {} };
|
|
625
|
-
return t[r2](o, o.exports, i), o.exports;
|
|
626
|
-
}
|
|
627
|
-
i.n = (t2) => {
|
|
628
|
-
var e2 = t2 && t2.__esModule ? () => t2.default : () => t2;
|
|
629
|
-
return i.d(e2, { a: e2 }), e2;
|
|
630
|
-
}, i.d = (t2, e2) => {
|
|
631
|
-
for (var r2 in e2) i.o(e2, r2) && !i.o(t2, r2) && Object.defineProperty(t2, r2, { enumerable: true, get: e2[r2] });
|
|
632
|
-
}, i.o = (t2, e2) => Object.prototype.hasOwnProperty.call(t2, e2);
|
|
633
|
-
var r = {};
|
|
634
|
-
return (() => {
|
|
635
|
-
i.d(r, { default: () => $ });
|
|
636
|
-
const t2 = (t3) => !!t3 && "object" == typeof t3 && !Array.isArray(t3);
|
|
637
|
-
function e2(i2, ...r2) {
|
|
638
|
-
if (!r2.length) return i2;
|
|
639
|
-
const n2 = r2.shift();
|
|
640
|
-
return void 0 !== n2 && t2(i2) && t2(n2) ? (i2 = Object.assign({}, i2), Object.keys(n2).forEach(((r3) => {
|
|
641
|
-
const o2 = i2[r3], s2 = n2[r3];
|
|
642
|
-
Array.isArray(o2) && Array.isArray(s2) ? i2[r3] = s2 : t2(o2) && t2(s2) ? i2[r3] = e2(Object.assign({}, o2), s2) : i2[r3] = s2;
|
|
643
|
-
})), e2(i2, ...r2)) : i2;
|
|
644
|
-
}
|
|
645
|
-
function n(t3, e3) {
|
|
646
|
-
const i2 = document.createElement("a");
|
|
647
|
-
i2.download = e3, i2.href = t3, document.body.appendChild(i2), i2.click(), document.body.removeChild(i2);
|
|
648
|
-
}
|
|
649
|
-
const o = { L: 0.07, M: 0.15, Q: 0.25, H: 0.3 };
|
|
650
|
-
class s {
|
|
651
|
-
constructor({ svg: t3, type: e3, window: i2 }) {
|
|
652
|
-
this._svg = t3, this._type = e3, this._window = i2;
|
|
653
|
-
}
|
|
654
|
-
draw(t3, e3, i2, r2) {
|
|
655
|
-
let n2;
|
|
656
|
-
switch (this._type) {
|
|
657
|
-
case "dots":
|
|
658
|
-
n2 = this._drawDot;
|
|
659
|
-
break;
|
|
660
|
-
case "classy":
|
|
661
|
-
n2 = this._drawClassy;
|
|
662
|
-
break;
|
|
663
|
-
case "classy-rounded":
|
|
664
|
-
n2 = this._drawClassyRounded;
|
|
665
|
-
break;
|
|
666
|
-
case "rounded":
|
|
667
|
-
n2 = this._drawRounded;
|
|
668
|
-
break;
|
|
669
|
-
case "extra-rounded":
|
|
670
|
-
n2 = this._drawExtraRounded;
|
|
671
|
-
break;
|
|
672
|
-
default:
|
|
673
|
-
n2 = this._drawSquare;
|
|
674
|
-
}
|
|
675
|
-
n2.call(this, { x: t3, y: e3, size: i2, getNeighbor: r2 });
|
|
676
|
-
}
|
|
677
|
-
_rotateFigure({ x: t3, y: e3, size: i2, rotation: r2 = 0, draw: n2 }) {
|
|
678
|
-
var o2;
|
|
679
|
-
const s2 = t3 + i2 / 2, a2 = e3 + i2 / 2;
|
|
680
|
-
n2(), null === (o2 = this._element) || void 0 === o2 || o2.setAttribute("transform", `rotate(${180 * r2 / Math.PI},${s2},${a2})`);
|
|
681
|
-
}
|
|
682
|
-
_basicDot(t3) {
|
|
683
|
-
const { size: e3, x: i2, y: r2 } = t3;
|
|
684
|
-
this._rotateFigure(Object.assign(Object.assign({}, t3), { draw: () => {
|
|
685
|
-
this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "circle"), this._element.setAttribute("cx", String(i2 + e3 / 2)), this._element.setAttribute("cy", String(r2 + e3 / 2)), this._element.setAttribute("r", String(e3 / 2));
|
|
686
|
-
} }));
|
|
687
|
-
}
|
|
688
|
-
_basicSquare(t3) {
|
|
689
|
-
const { size: e3, x: i2, y: r2 } = t3;
|
|
690
|
-
this._rotateFigure(Object.assign(Object.assign({}, t3), { draw: () => {
|
|
691
|
-
this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "rect"), this._element.setAttribute("x", String(i2)), this._element.setAttribute("y", String(r2)), this._element.setAttribute("width", String(e3)), this._element.setAttribute("height", String(e3));
|
|
692
|
-
} }));
|
|
693
|
-
}
|
|
694
|
-
_basicSideRounded(t3) {
|
|
695
|
-
const { size: e3, x: i2, y: r2 } = t3;
|
|
696
|
-
this._rotateFigure(Object.assign(Object.assign({}, t3), { draw: () => {
|
|
697
|
-
this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("d", `M ${i2} ${r2}v ${e3}h ` + e3 / 2 + `a ${e3 / 2} ${e3 / 2}, 0, 0, 0, 0 ${-e3}`);
|
|
698
|
-
} }));
|
|
699
|
-
}
|
|
700
|
-
_basicCornerRounded(t3) {
|
|
701
|
-
const { size: e3, x: i2, y: r2 } = t3;
|
|
702
|
-
this._rotateFigure(Object.assign(Object.assign({}, t3), { draw: () => {
|
|
703
|
-
this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("d", `M ${i2} ${r2}v ${e3}h ${e3}v ` + -e3 / 2 + `a ${e3 / 2} ${e3 / 2}, 0, 0, 0, ${-e3 / 2} ${-e3 / 2}`);
|
|
704
|
-
} }));
|
|
705
|
-
}
|
|
706
|
-
_basicCornerExtraRounded(t3) {
|
|
707
|
-
const { size: e3, x: i2, y: r2 } = t3;
|
|
708
|
-
this._rotateFigure(Object.assign(Object.assign({}, t3), { draw: () => {
|
|
709
|
-
this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("d", `M ${i2} ${r2}v ${e3}h ${e3}a ${e3} ${e3}, 0, 0, 0, ${-e3} ${-e3}`);
|
|
710
|
-
} }));
|
|
711
|
-
}
|
|
712
|
-
_basicCornersRounded(t3) {
|
|
713
|
-
const { size: e3, x: i2, y: r2 } = t3;
|
|
714
|
-
this._rotateFigure(Object.assign(Object.assign({}, t3), { draw: () => {
|
|
715
|
-
this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("d", `M ${i2} ${r2}v ` + e3 / 2 + `a ${e3 / 2} ${e3 / 2}, 0, 0, 0, ${e3 / 2} ${e3 / 2}h ` + e3 / 2 + "v " + -e3 / 2 + `a ${e3 / 2} ${e3 / 2}, 0, 0, 0, ${-e3 / 2} ${-e3 / 2}`);
|
|
716
|
-
} }));
|
|
717
|
-
}
|
|
718
|
-
_drawDot({ x: t3, y: e3, size: i2 }) {
|
|
719
|
-
this._basicDot({ x: t3, y: e3, size: i2, rotation: 0 });
|
|
720
|
-
}
|
|
721
|
-
_drawSquare({ x: t3, y: e3, size: i2 }) {
|
|
722
|
-
this._basicSquare({ x: t3, y: e3, size: i2, rotation: 0 });
|
|
723
|
-
}
|
|
724
|
-
_drawRounded({ x: t3, y: e3, size: i2, getNeighbor: r2 }) {
|
|
725
|
-
const n2 = r2 ? +r2(-1, 0) : 0, o2 = r2 ? +r2(1, 0) : 0, s2 = r2 ? +r2(0, -1) : 0, a2 = r2 ? +r2(0, 1) : 0, h2 = n2 + o2 + s2 + a2;
|
|
726
|
-
if (0 !== h2) if (h2 > 2 || n2 && o2 || s2 && a2) this._basicSquare({ x: t3, y: e3, size: i2, rotation: 0 });
|
|
727
|
-
else {
|
|
728
|
-
if (2 === h2) {
|
|
729
|
-
let r3 = 0;
|
|
730
|
-
return n2 && s2 ? r3 = Math.PI / 2 : s2 && o2 ? r3 = Math.PI : o2 && a2 && (r3 = -Math.PI / 2), void this._basicCornerRounded({ x: t3, y: e3, size: i2, rotation: r3 });
|
|
731
|
-
}
|
|
732
|
-
if (1 === h2) {
|
|
733
|
-
let r3 = 0;
|
|
734
|
-
return s2 ? r3 = Math.PI / 2 : o2 ? r3 = Math.PI : a2 && (r3 = -Math.PI / 2), void this._basicSideRounded({ x: t3, y: e3, size: i2, rotation: r3 });
|
|
735
|
-
}
|
|
736
|
-
}
|
|
737
|
-
else this._basicDot({ x: t3, y: e3, size: i2, rotation: 0 });
|
|
738
|
-
}
|
|
739
|
-
_drawExtraRounded({ x: t3, y: e3, size: i2, getNeighbor: r2 }) {
|
|
740
|
-
const n2 = r2 ? +r2(-1, 0) : 0, o2 = r2 ? +r2(1, 0) : 0, s2 = r2 ? +r2(0, -1) : 0, a2 = r2 ? +r2(0, 1) : 0, h2 = n2 + o2 + s2 + a2;
|
|
741
|
-
if (0 !== h2) if (h2 > 2 || n2 && o2 || s2 && a2) this._basicSquare({ x: t3, y: e3, size: i2, rotation: 0 });
|
|
742
|
-
else {
|
|
743
|
-
if (2 === h2) {
|
|
744
|
-
let r3 = 0;
|
|
745
|
-
return n2 && s2 ? r3 = Math.PI / 2 : s2 && o2 ? r3 = Math.PI : o2 && a2 && (r3 = -Math.PI / 2), void this._basicCornerExtraRounded({ x: t3, y: e3, size: i2, rotation: r3 });
|
|
746
|
-
}
|
|
747
|
-
if (1 === h2) {
|
|
748
|
-
let r3 = 0;
|
|
749
|
-
return s2 ? r3 = Math.PI / 2 : o2 ? r3 = Math.PI : a2 && (r3 = -Math.PI / 2), void this._basicSideRounded({ x: t3, y: e3, size: i2, rotation: r3 });
|
|
750
|
-
}
|
|
751
|
-
}
|
|
752
|
-
else this._basicDot({ x: t3, y: e3, size: i2, rotation: 0 });
|
|
753
|
-
}
|
|
754
|
-
_drawClassy({ x: t3, y: e3, size: i2, getNeighbor: r2 }) {
|
|
755
|
-
const n2 = r2 ? +r2(-1, 0) : 0, o2 = r2 ? +r2(1, 0) : 0, s2 = r2 ? +r2(0, -1) : 0, a2 = r2 ? +r2(0, 1) : 0;
|
|
756
|
-
0 !== n2 + o2 + s2 + a2 ? n2 || s2 ? o2 || a2 ? this._basicSquare({ x: t3, y: e3, size: i2, rotation: 0 }) : this._basicCornerRounded({ x: t3, y: e3, size: i2, rotation: Math.PI / 2 }) : this._basicCornerRounded({ x: t3, y: e3, size: i2, rotation: -Math.PI / 2 }) : this._basicCornersRounded({ x: t3, y: e3, size: i2, rotation: Math.PI / 2 });
|
|
757
|
-
}
|
|
758
|
-
_drawClassyRounded({ x: t3, y: e3, size: i2, getNeighbor: r2 }) {
|
|
759
|
-
const n2 = r2 ? +r2(-1, 0) : 0, o2 = r2 ? +r2(1, 0) : 0, s2 = r2 ? +r2(0, -1) : 0, a2 = r2 ? +r2(0, 1) : 0;
|
|
760
|
-
0 !== n2 + o2 + s2 + a2 ? n2 || s2 ? o2 || a2 ? this._basicSquare({ x: t3, y: e3, size: i2, rotation: 0 }) : this._basicCornerExtraRounded({ x: t3, y: e3, size: i2, rotation: Math.PI / 2 }) : this._basicCornerExtraRounded({ x: t3, y: e3, size: i2, rotation: -Math.PI / 2 }) : this._basicCornersRounded({ x: t3, y: e3, size: i2, rotation: Math.PI / 2 });
|
|
761
|
-
}
|
|
762
|
-
}
|
|
763
|
-
const a = { dot: "dot", square: "square", extraRounded: "extra-rounded" }, h = Object.values(a);
|
|
764
|
-
class d {
|
|
765
|
-
constructor({ svg: t3, type: e3, window: i2 }) {
|
|
766
|
-
this._svg = t3, this._type = e3, this._window = i2;
|
|
767
|
-
}
|
|
768
|
-
draw(t3, e3, i2, r2) {
|
|
769
|
-
let n2;
|
|
770
|
-
switch (this._type) {
|
|
771
|
-
case a.square:
|
|
772
|
-
n2 = this._drawSquare;
|
|
773
|
-
break;
|
|
774
|
-
case a.extraRounded:
|
|
775
|
-
n2 = this._drawExtraRounded;
|
|
776
|
-
break;
|
|
777
|
-
default:
|
|
778
|
-
n2 = this._drawDot;
|
|
779
|
-
}
|
|
780
|
-
n2.call(this, { x: t3, y: e3, size: i2, rotation: r2 });
|
|
781
|
-
}
|
|
782
|
-
_rotateFigure({ x: t3, y: e3, size: i2, rotation: r2 = 0, draw: n2 }) {
|
|
783
|
-
var o2;
|
|
784
|
-
const s2 = t3 + i2 / 2, a2 = e3 + i2 / 2;
|
|
785
|
-
n2(), null === (o2 = this._element) || void 0 === o2 || o2.setAttribute("transform", `rotate(${180 * r2 / Math.PI},${s2},${a2})`);
|
|
786
|
-
}
|
|
787
|
-
_basicDot(t3) {
|
|
788
|
-
const { size: e3, x: i2, y: r2 } = t3, n2 = e3 / 7;
|
|
789
|
-
this._rotateFigure(Object.assign(Object.assign({}, t3), { draw: () => {
|
|
790
|
-
this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("clip-rule", "evenodd"), this._element.setAttribute("d", `M ${i2 + e3 / 2} ${r2}a ${e3 / 2} ${e3 / 2} 0 1 0 0.1 0zm 0 ${n2}a ${e3 / 2 - n2} ${e3 / 2 - n2} 0 1 1 -0.1 0Z`);
|
|
791
|
-
} }));
|
|
792
|
-
}
|
|
793
|
-
_basicSquare(t3) {
|
|
794
|
-
const { size: e3, x: i2, y: r2 } = t3, n2 = e3 / 7;
|
|
795
|
-
this._rotateFigure(Object.assign(Object.assign({}, t3), { draw: () => {
|
|
796
|
-
this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("clip-rule", "evenodd"), this._element.setAttribute("d", `M ${i2} ${r2}v ${e3}h ${e3}v ` + -e3 + `zM ${i2 + n2} ${r2 + n2}h ` + (e3 - 2 * n2) + "v " + (e3 - 2 * n2) + "h " + (2 * n2 - e3) + "z");
|
|
797
|
-
} }));
|
|
798
|
-
}
|
|
799
|
-
_basicExtraRounded(t3) {
|
|
800
|
-
const { size: e3, x: i2, y: r2 } = t3, n2 = e3 / 7;
|
|
801
|
-
this._rotateFigure(Object.assign(Object.assign({}, t3), { draw: () => {
|
|
802
|
-
this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("clip-rule", "evenodd"), this._element.setAttribute("d", `M ${i2} ${r2 + 2.5 * n2}v ` + 2 * n2 + `a ${2.5 * n2} ${2.5 * n2}, 0, 0, 0, ${2.5 * n2} ${2.5 * n2}h ` + 2 * n2 + `a ${2.5 * n2} ${2.5 * n2}, 0, 0, 0, ${2.5 * n2} ${2.5 * -n2}v ` + -2 * n2 + `a ${2.5 * n2} ${2.5 * n2}, 0, 0, 0, ${2.5 * -n2} ${2.5 * -n2}h ` + -2 * n2 + `a ${2.5 * n2} ${2.5 * n2}, 0, 0, 0, ${2.5 * -n2} ${2.5 * n2}M ${i2 + 2.5 * n2} ${r2 + n2}h ` + 2 * n2 + `a ${1.5 * n2} ${1.5 * n2}, 0, 0, 1, ${1.5 * n2} ${1.5 * n2}v ` + 2 * n2 + `a ${1.5 * n2} ${1.5 * n2}, 0, 0, 1, ${1.5 * -n2} ${1.5 * n2}h ` + -2 * n2 + `a ${1.5 * n2} ${1.5 * n2}, 0, 0, 1, ${1.5 * -n2} ${1.5 * -n2}v ` + -2 * n2 + `a ${1.5 * n2} ${1.5 * n2}, 0, 0, 1, ${1.5 * n2} ${1.5 * -n2}`);
|
|
803
|
-
} }));
|
|
804
|
-
}
|
|
805
|
-
_drawDot({ x: t3, y: e3, size: i2, rotation: r2 }) {
|
|
806
|
-
this._basicDot({ x: t3, y: e3, size: i2, rotation: r2 });
|
|
807
|
-
}
|
|
808
|
-
_drawSquare({ x: t3, y: e3, size: i2, rotation: r2 }) {
|
|
809
|
-
this._basicSquare({ x: t3, y: e3, size: i2, rotation: r2 });
|
|
810
|
-
}
|
|
811
|
-
_drawExtraRounded({ x: t3, y: e3, size: i2, rotation: r2 }) {
|
|
812
|
-
this._basicExtraRounded({ x: t3, y: e3, size: i2, rotation: r2 });
|
|
813
|
-
}
|
|
814
|
-
}
|
|
815
|
-
const u = { dot: "dot", square: "square" }, c = Object.values(u);
|
|
816
|
-
class l {
|
|
817
|
-
constructor({ svg: t3, type: e3, window: i2 }) {
|
|
818
|
-
this._svg = t3, this._type = e3, this._window = i2;
|
|
819
|
-
}
|
|
820
|
-
draw(t3, e3, i2, r2) {
|
|
821
|
-
let n2;
|
|
822
|
-
n2 = this._type === u.square ? this._drawSquare : this._drawDot, n2.call(this, { x: t3, y: e3, size: i2, rotation: r2 });
|
|
823
|
-
}
|
|
824
|
-
_rotateFigure({ x: t3, y: e3, size: i2, rotation: r2 = 0, draw: n2 }) {
|
|
825
|
-
var o2;
|
|
826
|
-
const s2 = t3 + i2 / 2, a2 = e3 + i2 / 2;
|
|
827
|
-
n2(), null === (o2 = this._element) || void 0 === o2 || o2.setAttribute("transform", `rotate(${180 * r2 / Math.PI},${s2},${a2})`);
|
|
828
|
-
}
|
|
829
|
-
_basicDot(t3) {
|
|
830
|
-
const { size: e3, x: i2, y: r2 } = t3;
|
|
831
|
-
this._rotateFigure(Object.assign(Object.assign({}, t3), { draw: () => {
|
|
832
|
-
this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "circle"), this._element.setAttribute("cx", String(i2 + e3 / 2)), this._element.setAttribute("cy", String(r2 + e3 / 2)), this._element.setAttribute("r", String(e3 / 2));
|
|
833
|
-
} }));
|
|
834
|
-
}
|
|
835
|
-
_basicSquare(t3) {
|
|
836
|
-
const { size: e3, x: i2, y: r2 } = t3;
|
|
837
|
-
this._rotateFigure(Object.assign(Object.assign({}, t3), { draw: () => {
|
|
838
|
-
this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "rect"), this._element.setAttribute("x", String(i2)), this._element.setAttribute("y", String(r2)), this._element.setAttribute("width", String(e3)), this._element.setAttribute("height", String(e3));
|
|
839
|
-
} }));
|
|
840
|
-
}
|
|
841
|
-
_drawDot({ x: t3, y: e3, size: i2, rotation: r2 }) {
|
|
842
|
-
this._basicDot({ x: t3, y: e3, size: i2, rotation: r2 });
|
|
843
|
-
}
|
|
844
|
-
_drawSquare({ x: t3, y: e3, size: i2, rotation: r2 }) {
|
|
845
|
-
this._basicSquare({ x: t3, y: e3, size: i2, rotation: r2 });
|
|
846
|
-
}
|
|
847
|
-
}
|
|
848
|
-
const g = "circle", 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]], 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]];
|
|
849
|
-
class p {
|
|
850
|
-
constructor(t3, e3) {
|
|
851
|
-
this._roundSize = (t4) => this._options.dotsOptions.roundSize ? Math.floor(t4) : t4, this._window = e3, this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "svg"), this._element.setAttribute("width", String(t3.width)), this._element.setAttribute("height", String(t3.height)), this._element.setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink"), t3.dotsOptions.roundSize || this._element.setAttribute("shape-rendering", "crispEdges"), this._element.setAttribute("viewBox", `0 0 ${t3.width} ${t3.height}`), this._defs = this._window.document.createElementNS("http://www.w3.org/2000/svg", "defs"), this._element.appendChild(this._defs), this._imageUri = t3.image, this._instanceId = p.instanceCount++, this._options = t3;
|
|
852
|
-
}
|
|
853
|
-
get width() {
|
|
854
|
-
return this._options.width;
|
|
855
|
-
}
|
|
856
|
-
get height() {
|
|
857
|
-
return this._options.height;
|
|
858
|
-
}
|
|
859
|
-
getElement() {
|
|
860
|
-
return this._element;
|
|
861
|
-
}
|
|
862
|
-
async drawQR(t3) {
|
|
863
|
-
const e3 = t3.getModuleCount(), i2 = Math.min(this._options.width, this._options.height) - 2 * this._options.margin, r2 = this._options.shape === g ? i2 / Math.sqrt(2) : i2, n2 = this._roundSize(r2 / e3);
|
|
864
|
-
let s2 = { hideXDots: 0, hideYDots: 0, width: 0, height: 0 };
|
|
865
|
-
if (this._qr = t3, this._options.image) {
|
|
866
|
-
if (await this.loadImage(), !this._image) return;
|
|
867
|
-
const { imageOptions: t4, qrOptions: i3 } = this._options, r3 = t4.imageSize * o[i3.errorCorrectionLevel], a2 = Math.floor(r3 * e3 * e3);
|
|
868
|
-
s2 = (function({ originalHeight: t5, originalWidth: e4, maxHiddenDots: i4, maxHiddenAxisDots: r4, dotSize: n3 }) {
|
|
869
|
-
const o2 = { x: 0, y: 0 }, s3 = { x: 0, y: 0 };
|
|
870
|
-
if (t5 <= 0 || e4 <= 0 || i4 <= 0 || n3 <= 0) return { height: 0, width: 0, hideYDots: 0, hideXDots: 0 };
|
|
871
|
-
const a3 = t5 / e4;
|
|
872
|
-
return o2.x = Math.floor(Math.sqrt(i4 / a3)), o2.x <= 0 && (o2.x = 1), r4 && r4 < o2.x && (o2.x = r4), o2.x % 2 == 0 && o2.x--, s3.x = o2.x * n3, o2.y = 1 + 2 * Math.ceil((o2.x * a3 - 1) / 2), s3.y = Math.round(s3.x * a3), (o2.y * o2.x > i4 || r4 && r4 < o2.y) && (r4 && r4 < o2.y ? (o2.y = r4, o2.y % 2 == 0 && o2.x--) : o2.y -= 2, s3.y = o2.y * n3, o2.x = 1 + 2 * Math.ceil((o2.y / a3 - 1) / 2), s3.x = Math.round(s3.y / a3)), { height: s3.y, width: s3.x, hideYDots: o2.y, hideXDots: o2.x };
|
|
873
|
-
})({ originalWidth: this._image.width, originalHeight: this._image.height, maxHiddenDots: a2, maxHiddenAxisDots: e3 - 14, dotSize: n2 });
|
|
874
|
-
}
|
|
875
|
-
this.drawBackground(), this.drawDots(((t4, i3) => {
|
|
876
|
-
var r3, n3, o2, a2, h2, d2;
|
|
877
|
-
return !(this._options.imageOptions.hideBackgroundDots && t4 >= (e3 - s2.hideYDots) / 2 && t4 < (e3 + s2.hideYDots) / 2 && i3 >= (e3 - s2.hideXDots) / 2 && i3 < (e3 + s2.hideXDots) / 2 || (null === (r3 = f[t4]) || void 0 === r3 ? void 0 : r3[i3]) || (null === (n3 = f[t4 - e3 + 7]) || void 0 === n3 ? void 0 : n3[i3]) || (null === (o2 = f[t4]) || void 0 === o2 ? void 0 : o2[i3 - e3 + 7]) || (null === (a2 = w[t4]) || void 0 === a2 ? void 0 : a2[i3]) || (null === (h2 = w[t4 - e3 + 7]) || void 0 === h2 ? void 0 : h2[i3]) || (null === (d2 = w[t4]) || void 0 === d2 ? void 0 : d2[i3 - e3 + 7]));
|
|
878
|
-
})), this.drawCorners(), this._options.image && await this.drawImage({ width: s2.width, height: s2.height, count: e3, dotSize: n2 });
|
|
879
|
-
}
|
|
880
|
-
drawBackground() {
|
|
881
|
-
var t3, e3, i2;
|
|
882
|
-
const r2 = this._element, n2 = this._options;
|
|
883
|
-
if (r2) {
|
|
884
|
-
const r3 = null === (t3 = n2.backgroundOptions) || void 0 === t3 ? void 0 : t3.gradient, o2 = null === (e3 = n2.backgroundOptions) || void 0 === e3 ? void 0 : e3.color;
|
|
885
|
-
let s2 = n2.height, a2 = n2.width;
|
|
886
|
-
if (r3 || o2) {
|
|
887
|
-
const t4 = this._window.document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
888
|
-
this._backgroundClipPath = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), this._backgroundClipPath.setAttribute("id", `clip-path-background-color-${this._instanceId}`), this._defs.appendChild(this._backgroundClipPath), (null === (i2 = n2.backgroundOptions) || void 0 === i2 ? void 0 : i2.round) && (s2 = a2 = Math.min(n2.width, n2.height), t4.setAttribute("rx", String(s2 / 2 * n2.backgroundOptions.round))), t4.setAttribute("x", String(this._roundSize((n2.width - a2) / 2))), t4.setAttribute("y", String(this._roundSize((n2.height - s2) / 2))), t4.setAttribute("width", String(a2)), t4.setAttribute("height", String(s2)), this._backgroundClipPath.appendChild(t4), this._createColor({ options: r3, color: o2, additionalRotation: 0, x: 0, y: 0, height: n2.height, width: n2.width, name: `background-color-${this._instanceId}` });
|
|
889
|
-
}
|
|
890
|
-
}
|
|
891
|
-
}
|
|
892
|
-
drawDots(t3) {
|
|
893
|
-
var e3, i2;
|
|
894
|
-
if (!this._qr) throw "QR code is not defined";
|
|
895
|
-
const r2 = this._options, n2 = this._qr.getModuleCount();
|
|
896
|
-
if (n2 > r2.width || n2 > r2.height) throw "The canvas is too small.";
|
|
897
|
-
const o2 = Math.min(r2.width, r2.height) - 2 * r2.margin, a2 = r2.shape === g ? o2 / Math.sqrt(2) : o2, h2 = this._roundSize(a2 / n2), d2 = this._roundSize((r2.width - n2 * h2) / 2), u2 = this._roundSize((r2.height - n2 * h2) / 2), c2 = new s({ svg: this._element, type: r2.dotsOptions.type, window: this._window });
|
|
898
|
-
this._dotsClipPath = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), this._dotsClipPath.setAttribute("id", `clip-path-dot-color-${this._instanceId}`), this._defs.appendChild(this._dotsClipPath), this._createColor({ options: null === (e3 = r2.dotsOptions) || void 0 === e3 ? void 0 : e3.gradient, color: r2.dotsOptions.color, additionalRotation: 0, x: 0, y: 0, height: r2.height, width: r2.width, name: `dot-color-${this._instanceId}` });
|
|
899
|
-
for (let e4 = 0; e4 < n2; e4++) for (let r3 = 0; r3 < n2; r3++) t3 && !t3(e4, r3) || (null === (i2 = this._qr) || void 0 === i2 ? void 0 : i2.isDark(e4, r3)) && (c2.draw(d2 + r3 * h2, u2 + e4 * h2, h2, ((i3, o3) => !(r3 + i3 < 0 || e4 + o3 < 0 || r3 + i3 >= n2 || e4 + o3 >= n2) && !(t3 && !t3(e4 + o3, r3 + i3)) && !!this._qr && this._qr.isDark(e4 + o3, r3 + i3))), c2._element && this._dotsClipPath && this._dotsClipPath.appendChild(c2._element));
|
|
900
|
-
if (r2.shape === g) {
|
|
901
|
-
const t4 = this._roundSize((o2 / h2 - n2) / 2), e4 = n2 + 2 * t4, i3 = d2 - t4 * h2, r3 = u2 - t4 * h2, s2 = [], a3 = this._roundSize(e4 / 2);
|
|
902
|
-
for (let i4 = 0; i4 < e4; i4++) {
|
|
903
|
-
s2[i4] = [];
|
|
904
|
-
for (let r4 = 0; r4 < e4; r4++) i4 >= t4 - 1 && i4 <= e4 - t4 && r4 >= t4 - 1 && r4 <= e4 - t4 || Math.sqrt((i4 - a3) * (i4 - a3) + (r4 - a3) * (r4 - a3)) > a3 ? s2[i4][r4] = 0 : s2[i4][r4] = this._qr.isDark(r4 - 2 * t4 < 0 ? r4 : r4 >= n2 ? r4 - 2 * t4 : r4 - t4, i4 - 2 * t4 < 0 ? i4 : i4 >= n2 ? i4 - 2 * t4 : i4 - t4) ? 1 : 0;
|
|
905
|
-
}
|
|
906
|
-
for (let t5 = 0; t5 < e4; t5++) for (let n3 = 0; n3 < e4; n3++) s2[t5][n3] && (c2.draw(i3 + n3 * h2, r3 + t5 * h2, h2, ((e5, i4) => {
|
|
907
|
-
var r4;
|
|
908
|
-
return !!(null === (r4 = s2[t5 + i4]) || void 0 === r4 ? void 0 : r4[n3 + e5]);
|
|
909
|
-
})), c2._element && this._dotsClipPath && this._dotsClipPath.appendChild(c2._element));
|
|
910
|
-
}
|
|
911
|
-
}
|
|
912
|
-
drawCorners() {
|
|
913
|
-
if (!this._qr) throw "QR code is not defined";
|
|
914
|
-
const t3 = this._element, e3 = this._options;
|
|
915
|
-
if (!t3) throw "Element code is not defined";
|
|
916
|
-
const i2 = this._qr.getModuleCount(), r2 = Math.min(e3.width, e3.height) - 2 * e3.margin, n2 = e3.shape === g ? r2 / Math.sqrt(2) : r2, o2 = this._roundSize(n2 / i2), a2 = 7 * o2, u2 = 3 * o2, p2 = this._roundSize((e3.width - i2 * o2) / 2), v2 = this._roundSize((e3.height - i2 * o2) / 2);
|
|
917
|
-
[[0, 0, 0], [1, 0, Math.PI / 2], [0, 1, -Math.PI / 2]].forEach((([t4, r3, n3]) => {
|
|
918
|
-
var g2, _2, m2, b2, y2, x2, S2, C2, A2, M2, $2, O, D, k;
|
|
919
|
-
const z = p2 + t4 * o2 * (i2 - 7), B = v2 + r3 * o2 * (i2 - 7);
|
|
920
|
-
let P = this._dotsClipPath, I = this._dotsClipPath;
|
|
921
|
-
if (((null === (g2 = e3.cornersSquareOptions) || void 0 === g2 ? void 0 : g2.gradient) || (null === (_2 = e3.cornersSquareOptions) || void 0 === _2 ? void 0 : _2.color)) && (P = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), P.setAttribute("id", `clip-path-corners-square-color-${t4}-${r3}-${this._instanceId}`), this._defs.appendChild(P), this._cornersSquareClipPath = this._cornersDotClipPath = I = P, this._createColor({ options: null === (m2 = e3.cornersSquareOptions) || void 0 === m2 ? void 0 : m2.gradient, color: null === (b2 = e3.cornersSquareOptions) || void 0 === b2 ? void 0 : b2.color, additionalRotation: n3, x: z, y: B, height: a2, width: a2, name: `corners-square-color-${t4}-${r3}-${this._instanceId}` })), (null === (y2 = e3.cornersSquareOptions) || void 0 === y2 ? void 0 : y2.type) && h.includes(e3.cornersSquareOptions.type)) {
|
|
922
|
-
const t5 = new d({ svg: this._element, type: e3.cornersSquareOptions.type, window: this._window });
|
|
923
|
-
t5.draw(z, B, a2, n3), t5._element && P && P.appendChild(t5._element);
|
|
924
|
-
} else {
|
|
925
|
-
const t5 = new s({ svg: this._element, type: (null === (x2 = e3.cornersSquareOptions) || void 0 === x2 ? void 0 : x2.type) || e3.dotsOptions.type, window: this._window });
|
|
926
|
-
for (let e4 = 0; e4 < f.length; e4++) for (let i3 = 0; i3 < f[e4].length; i3++) (null === (S2 = f[e4]) || void 0 === S2 ? void 0 : S2[i3]) && (t5.draw(z + i3 * o2, B + e4 * o2, o2, ((t6, r4) => {
|
|
927
|
-
var n4;
|
|
928
|
-
return !!(null === (n4 = f[e4 + r4]) || void 0 === n4 ? void 0 : n4[i3 + t6]);
|
|
929
|
-
})), t5._element && P && P.appendChild(t5._element));
|
|
930
|
-
}
|
|
931
|
-
if (((null === (C2 = e3.cornersDotOptions) || void 0 === C2 ? void 0 : C2.gradient) || (null === (A2 = e3.cornersDotOptions) || void 0 === A2 ? void 0 : A2.color)) && (I = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), I.setAttribute("id", `clip-path-corners-dot-color-${t4}-${r3}-${this._instanceId}`), this._defs.appendChild(I), this._cornersDotClipPath = I, this._createColor({ options: null === (M2 = e3.cornersDotOptions) || void 0 === M2 ? void 0 : M2.gradient, color: null === ($2 = e3.cornersDotOptions) || void 0 === $2 ? void 0 : $2.color, additionalRotation: n3, x: z + 2 * o2, y: B + 2 * o2, height: u2, width: u2, name: `corners-dot-color-${t4}-${r3}-${this._instanceId}` })), (null === (O = e3.cornersDotOptions) || void 0 === O ? void 0 : O.type) && c.includes(e3.cornersDotOptions.type)) {
|
|
932
|
-
const t5 = new l({ svg: this._element, type: e3.cornersDotOptions.type, window: this._window });
|
|
933
|
-
t5.draw(z + 2 * o2, B + 2 * o2, u2, n3), t5._element && I && I.appendChild(t5._element);
|
|
934
|
-
} else {
|
|
935
|
-
const t5 = new s({ svg: this._element, type: (null === (D = e3.cornersDotOptions) || void 0 === D ? void 0 : D.type) || e3.dotsOptions.type, window: this._window });
|
|
936
|
-
for (let e4 = 0; e4 < w.length; e4++) for (let i3 = 0; i3 < w[e4].length; i3++) (null === (k = w[e4]) || void 0 === k ? void 0 : k[i3]) && (t5.draw(z + i3 * o2, B + e4 * o2, o2, ((t6, r4) => {
|
|
937
|
-
var n4;
|
|
938
|
-
return !!(null === (n4 = w[e4 + r4]) || void 0 === n4 ? void 0 : n4[i3 + t6]);
|
|
939
|
-
})), t5._element && I && I.appendChild(t5._element));
|
|
940
|
-
}
|
|
941
|
-
}));
|
|
942
|
-
}
|
|
943
|
-
loadImage() {
|
|
944
|
-
return new Promise(((t3, e3) => {
|
|
945
|
-
var i2;
|
|
946
|
-
const r2 = this._options;
|
|
947
|
-
if (!r2.image) return e3("Image is not defined");
|
|
948
|
-
if (null === (i2 = r2.nodeCanvas) || void 0 === i2 ? void 0 : i2.loadImage) r2.nodeCanvas.loadImage(r2.image).then(((e4) => {
|
|
949
|
-
var i3, n2;
|
|
950
|
-
if (this._image = e4, this._options.imageOptions.saveAsBlob) {
|
|
951
|
-
const t4 = null === (i3 = r2.nodeCanvas) || void 0 === i3 ? void 0 : i3.createCanvas(this._image.width, this._image.height);
|
|
952
|
-
null === (n2 = null == t4 ? void 0 : t4.getContext("2d")) || void 0 === n2 || n2.drawImage(e4, 0, 0), this._imageUri = null == t4 ? void 0 : t4.toDataURL();
|
|
953
|
-
}
|
|
954
|
-
t3();
|
|
955
|
-
})).catch(e3);
|
|
956
|
-
else {
|
|
957
|
-
const e4 = new this._window.Image();
|
|
958
|
-
"string" == typeof r2.imageOptions.crossOrigin && (e4.crossOrigin = r2.imageOptions.crossOrigin), this._image = e4, e4.onload = async () => {
|
|
959
|
-
this._options.imageOptions.saveAsBlob && (this._imageUri = await (async function(t4, e5) {
|
|
960
|
-
return new Promise(((i3) => {
|
|
961
|
-
const r3 = new e5.XMLHttpRequest();
|
|
962
|
-
r3.onload = function() {
|
|
963
|
-
const t5 = new e5.FileReader();
|
|
964
|
-
t5.onloadend = function() {
|
|
965
|
-
i3(t5.result);
|
|
966
|
-
}, t5.readAsDataURL(r3.response);
|
|
967
|
-
}, r3.open("GET", t4), r3.responseType = "blob", r3.send();
|
|
968
|
-
}));
|
|
969
|
-
})(r2.image || "", this._window)), t3();
|
|
970
|
-
}, e4.src = r2.image;
|
|
971
|
-
}
|
|
972
|
-
}));
|
|
973
|
-
}
|
|
974
|
-
async drawImage({ width: t3, height: e3, count: i2, dotSize: r2 }) {
|
|
975
|
-
const n2 = this._options, o2 = this._roundSize((n2.width - i2 * r2) / 2), s2 = this._roundSize((n2.height - i2 * r2) / 2), a2 = o2 + this._roundSize(n2.imageOptions.margin + (i2 * r2 - t3) / 2), h2 = s2 + this._roundSize(n2.imageOptions.margin + (i2 * r2 - e3) / 2), d2 = t3 - 2 * n2.imageOptions.margin, u2 = e3 - 2 * n2.imageOptions.margin, c2 = this._window.document.createElementNS("http://www.w3.org/2000/svg", "image");
|
|
976
|
-
c2.setAttribute("href", this._imageUri || ""), c2.setAttribute("xlink:href", this._imageUri || ""), c2.setAttribute("x", String(a2)), c2.setAttribute("y", String(h2)), c2.setAttribute("width", `${d2}px`), c2.setAttribute("height", `${u2}px`), this._element.appendChild(c2);
|
|
977
|
-
}
|
|
978
|
-
_createColor({ options: t3, color: e3, additionalRotation: i2, x: r2, y: n2, height: o2, width: s2, name: a2 }) {
|
|
979
|
-
const h2 = s2 > o2 ? s2 : o2, d2 = this._window.document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
980
|
-
if (d2.setAttribute("x", String(r2)), d2.setAttribute("y", String(n2)), d2.setAttribute("height", String(o2)), d2.setAttribute("width", String(s2)), d2.setAttribute("clip-path", `url('#clip-path-${a2}')`), t3) {
|
|
981
|
-
let e4;
|
|
982
|
-
if ("radial" === t3.type) e4 = this._window.document.createElementNS("http://www.w3.org/2000/svg", "radialGradient"), e4.setAttribute("id", a2), e4.setAttribute("gradientUnits", "userSpaceOnUse"), e4.setAttribute("fx", String(r2 + s2 / 2)), e4.setAttribute("fy", String(n2 + o2 / 2)), e4.setAttribute("cx", String(r2 + s2 / 2)), e4.setAttribute("cy", String(n2 + o2 / 2)), e4.setAttribute("r", String(h2 / 2));
|
|
983
|
-
else {
|
|
984
|
-
const h3 = ((t3.rotation || 0) + i2) % (2 * Math.PI), d3 = (h3 + 2 * Math.PI) % (2 * Math.PI);
|
|
985
|
-
let u2 = r2 + s2 / 2, c2 = n2 + o2 / 2, l2 = r2 + s2 / 2, g2 = n2 + o2 / 2;
|
|
986
|
-
d3 >= 0 && d3 <= 0.25 * Math.PI || d3 > 1.75 * Math.PI && d3 <= 2 * Math.PI ? (u2 -= s2 / 2, c2 -= o2 / 2 * Math.tan(h3), l2 += s2 / 2, g2 += o2 / 2 * Math.tan(h3)) : d3 > 0.25 * Math.PI && d3 <= 0.75 * Math.PI ? (c2 -= o2 / 2, u2 -= s2 / 2 / Math.tan(h3), g2 += o2 / 2, l2 += s2 / 2 / Math.tan(h3)) : d3 > 0.75 * Math.PI && d3 <= 1.25 * Math.PI ? (u2 += s2 / 2, c2 += o2 / 2 * Math.tan(h3), l2 -= s2 / 2, g2 -= o2 / 2 * Math.tan(h3)) : d3 > 1.25 * Math.PI && d3 <= 1.75 * Math.PI && (c2 += o2 / 2, u2 += s2 / 2 / Math.tan(h3), g2 -= o2 / 2, l2 -= s2 / 2 / Math.tan(h3)), e4 = this._window.document.createElementNS("http://www.w3.org/2000/svg", "linearGradient"), e4.setAttribute("id", a2), e4.setAttribute("gradientUnits", "userSpaceOnUse"), e4.setAttribute("x1", String(Math.round(u2))), e4.setAttribute("y1", String(Math.round(c2))), e4.setAttribute("x2", String(Math.round(l2))), e4.setAttribute("y2", String(Math.round(g2)));
|
|
987
|
-
}
|
|
988
|
-
t3.colorStops.forEach((({ offset: t4, color: i3 }) => {
|
|
989
|
-
const r3 = this._window.document.createElementNS("http://www.w3.org/2000/svg", "stop");
|
|
990
|
-
r3.setAttribute("offset", 100 * t4 + "%"), r3.setAttribute("stop-color", i3), e4.appendChild(r3);
|
|
991
|
-
})), d2.setAttribute("fill", `url('#${a2}')`), this._defs.appendChild(e4);
|
|
992
|
-
} else e3 && d2.setAttribute("fill", e3);
|
|
993
|
-
this._element.appendChild(d2);
|
|
994
|
-
}
|
|
995
|
-
}
|
|
996
|
-
p.instanceCount = 0;
|
|
997
|
-
const v = p, _ = "canvas", m = {};
|
|
998
|
-
for (let t3 = 0; t3 <= 40; t3++) m[t3] = t3;
|
|
999
|
-
const b = { type: _, shape: "square", width: 300, height: 300, data: "", margin: 0, qrOptions: { typeNumber: m[0], mode: void 0, errorCorrectionLevel: "Q" }, imageOptions: { saveAsBlob: true, hideBackgroundDots: true, imageSize: 0.4, crossOrigin: void 0, margin: 0 }, dotsOptions: { type: "square", color: "#000", roundSize: true }, backgroundOptions: { round: 0, color: "#fff" } };
|
|
1000
|
-
function y(t3) {
|
|
1001
|
-
const e3 = Object.assign({}, t3);
|
|
1002
|
-
if (!e3.colorStops || !e3.colorStops.length) throw "Field 'colorStops' is required in gradient";
|
|
1003
|
-
return e3.rotation ? e3.rotation = Number(e3.rotation) : e3.rotation = 0, e3.colorStops = e3.colorStops.map(((t4) => Object.assign(Object.assign({}, t4), { offset: Number(t4.offset) }))), e3;
|
|
1004
|
-
}
|
|
1005
|
-
function x(t3) {
|
|
1006
|
-
const e3 = Object.assign({}, t3);
|
|
1007
|
-
return e3.width = Number(e3.width), e3.height = Number(e3.height), e3.margin = Number(e3.margin), e3.imageOptions = Object.assign(Object.assign({}, e3.imageOptions), { hideBackgroundDots: Boolean(e3.imageOptions.hideBackgroundDots), imageSize: Number(e3.imageOptions.imageSize), margin: Number(e3.imageOptions.margin) }), e3.margin > Math.min(e3.width, e3.height) && (e3.margin = Math.min(e3.width, e3.height)), e3.dotsOptions = Object.assign({}, e3.dotsOptions), e3.dotsOptions.gradient && (e3.dotsOptions.gradient = y(e3.dotsOptions.gradient)), e3.cornersSquareOptions && (e3.cornersSquareOptions = Object.assign({}, e3.cornersSquareOptions), e3.cornersSquareOptions.gradient && (e3.cornersSquareOptions.gradient = y(e3.cornersSquareOptions.gradient))), e3.cornersDotOptions && (e3.cornersDotOptions = Object.assign({}, e3.cornersDotOptions), e3.cornersDotOptions.gradient && (e3.cornersDotOptions.gradient = y(e3.cornersDotOptions.gradient))), e3.backgroundOptions && (e3.backgroundOptions = Object.assign({}, e3.backgroundOptions), e3.backgroundOptions.gradient && (e3.backgroundOptions.gradient = y(e3.backgroundOptions.gradient))), e3;
|
|
1008
|
-
}
|
|
1009
|
-
var S = i(873), C = i.n(S);
|
|
1010
|
-
function A(t3) {
|
|
1011
|
-
if (!t3) throw new Error("Extension must be defined");
|
|
1012
|
-
"." === t3[0] && (t3 = t3.substring(1));
|
|
1013
|
-
const e3 = { bmp: "image/bmp", gif: "image/gif", ico: "image/vnd.microsoft.icon", jpeg: "image/jpeg", jpg: "image/jpeg", png: "image/png", svg: "image/svg+xml", tif: "image/tiff", tiff: "image/tiff", webp: "image/webp", pdf: "application/pdf" }[t3.toLowerCase()];
|
|
1014
|
-
if (!e3) throw new Error(`Extension "${t3}" is not supported`);
|
|
1015
|
-
return e3;
|
|
1016
|
-
}
|
|
1017
|
-
class M {
|
|
1018
|
-
constructor(t3) {
|
|
1019
|
-
(null == t3 ? void 0 : t3.jsdom) ? this._window = new t3.jsdom("", { resources: "usable" }).window : this._window = window, this._options = t3 ? x(e2(b, t3)) : b, this.update();
|
|
1020
|
-
}
|
|
1021
|
-
static _clearContainer(t3) {
|
|
1022
|
-
t3 && (t3.innerHTML = "");
|
|
1023
|
-
}
|
|
1024
|
-
_setupSvg() {
|
|
1025
|
-
if (!this._qr) return;
|
|
1026
|
-
const t3 = new v(this._options, this._window);
|
|
1027
|
-
this._svg = t3.getElement(), this._svgDrawingPromise = t3.drawQR(this._qr).then((() => {
|
|
1028
|
-
var e3;
|
|
1029
|
-
this._svg && (null === (e3 = this._extension) || void 0 === e3 || e3.call(this, t3.getElement(), this._options));
|
|
1030
|
-
}));
|
|
1031
|
-
}
|
|
1032
|
-
_setupCanvas() {
|
|
1033
|
-
var t3, e3;
|
|
1034
|
-
this._qr && ((null === (t3 = this._options.nodeCanvas) || void 0 === t3 ? void 0 : t3.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 === (e3 = this._svgDrawingPromise) || void 0 === e3 ? void 0 : e3.then((() => {
|
|
1035
|
-
var t4;
|
|
1036
|
-
if (!this._svg) return;
|
|
1037
|
-
const e4 = this._svg, i2 = new this._window.XMLSerializer().serializeToString(e4), r2 = btoa(i2), n2 = `data:${A("svg")};base64,${r2}`;
|
|
1038
|
-
if (null === (t4 = this._options.nodeCanvas) || void 0 === t4 ? void 0 : t4.loadImage) return this._options.nodeCanvas.loadImage(n2).then(((t5) => {
|
|
1039
|
-
var e5, i3;
|
|
1040
|
-
t5.width = this._options.width, t5.height = this._options.height, null === (i3 = null === (e5 = this._nodeCanvas) || void 0 === e5 ? void 0 : e5.getContext("2d")) || void 0 === i3 || i3.drawImage(t5, 0, 0);
|
|
1041
|
-
}));
|
|
1042
|
-
{
|
|
1043
|
-
const t5 = new this._window.Image();
|
|
1044
|
-
return new Promise(((e5) => {
|
|
1045
|
-
t5.onload = () => {
|
|
1046
|
-
var i3, r3;
|
|
1047
|
-
null === (r3 = null === (i3 = this._domCanvas) || void 0 === i3 ? void 0 : i3.getContext("2d")) || void 0 === r3 || r3.drawImage(t5, 0, 0), e5();
|
|
1048
|
-
}, t5.src = n2;
|
|
1049
|
-
}));
|
|
1050
|
-
}
|
|
1051
|
-
})));
|
|
1052
|
-
}
|
|
1053
|
-
async _getElement(t3 = "png") {
|
|
1054
|
-
if (!this._qr) throw "QR code is empty";
|
|
1055
|
-
return "svg" === t3.toLowerCase() ? (this._svg && this._svgDrawingPromise || this._setupSvg(), await this._svgDrawingPromise, this._svg) : ((this._domCanvas || this._nodeCanvas) && this._canvasDrawingPromise || this._setupCanvas(), await this._canvasDrawingPromise, this._domCanvas || this._nodeCanvas);
|
|
1056
|
-
}
|
|
1057
|
-
update(t3) {
|
|
1058
|
-
M._clearContainer(this._container), this._options = t3 ? x(e2(this._options, t3)) : 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(t4) {
|
|
1059
|
-
switch (true) {
|
|
1060
|
-
case /^[0-9]*$/.test(t4):
|
|
1061
|
-
return "Numeric";
|
|
1062
|
-
case /^[0-9A-Z $%*+\-./:]*$/.test(t4):
|
|
1063
|
-
return "Alphanumeric";
|
|
1064
|
-
default:
|
|
1065
|
-
return "Byte";
|
|
1066
|
-
}
|
|
1067
|
-
})(this._options.data)), this._qr.make(), this._options.type === _ ? this._setupCanvas() : this._setupSvg(), this.append(this._container));
|
|
1068
|
-
}
|
|
1069
|
-
append(t3) {
|
|
1070
|
-
if (t3) {
|
|
1071
|
-
if ("function" != typeof t3.appendChild) throw "Container should be a single DOM node";
|
|
1072
|
-
this._options.type === _ ? this._domCanvas && t3.appendChild(this._domCanvas) : this._svg && t3.appendChild(this._svg), this._container = t3;
|
|
1073
|
-
}
|
|
1074
|
-
}
|
|
1075
|
-
applyExtension(t3) {
|
|
1076
|
-
if (!t3) throw "Extension function should be defined.";
|
|
1077
|
-
this._extension = t3, this.update();
|
|
1078
|
-
}
|
|
1079
|
-
deleteExtension() {
|
|
1080
|
-
this._extension = void 0, this.update();
|
|
1081
|
-
}
|
|
1082
|
-
async getRawData(t3 = "png") {
|
|
1083
|
-
if (!this._qr) throw "QR code is empty";
|
|
1084
|
-
const e3 = await this._getElement(t3), i2 = A(t3);
|
|
1085
|
-
if (!e3) return null;
|
|
1086
|
-
if ("svg" === t3.toLowerCase()) {
|
|
1087
|
-
const t4 = `<?xml version="1.0" standalone="no"?>\r
|
|
1088
|
-
${new this._window.XMLSerializer().serializeToString(e3)}`;
|
|
1089
|
-
return "undefined" == typeof Blob || this._options.jsdom ? Buffer.from(t4) : new Blob([t4], { type: i2 });
|
|
1090
|
-
}
|
|
1091
|
-
return new Promise(((t4) => {
|
|
1092
|
-
const r2 = e3;
|
|
1093
|
-
if ("toBuffer" in r2) if ("image/png" === i2) t4(r2.toBuffer(i2));
|
|
1094
|
-
else if ("image/jpeg" === i2) t4(r2.toBuffer(i2));
|
|
1095
|
-
else {
|
|
1096
|
-
if ("application/pdf" !== i2) throw Error("Unsupported extension");
|
|
1097
|
-
t4(r2.toBuffer(i2));
|
|
1098
|
-
}
|
|
1099
|
-
else "toBlob" in r2 && r2.toBlob(t4, i2, 1);
|
|
1100
|
-
}));
|
|
1101
|
-
}
|
|
1102
|
-
async download(t3) {
|
|
1103
|
-
if (!this._qr) throw "QR code is empty";
|
|
1104
|
-
if ("undefined" == typeof Blob) throw "Cannot download in Node.js, call getRawData instead.";
|
|
1105
|
-
let e3 = "png", i2 = "qr";
|
|
1106
|
-
"string" == typeof t3 ? (e3 = t3, console.warn("Extension is deprecated as argument for 'download' method, please pass object { name: '...', extension: '...' } as argument")) : "object" == typeof t3 && null !== t3 && (t3.name && (i2 = t3.name), t3.extension && (e3 = t3.extension));
|
|
1107
|
-
const r2 = await this._getElement(e3);
|
|
1108
|
-
if (r2) if ("svg" === e3.toLowerCase()) {
|
|
1109
|
-
let t4 = new XMLSerializer().serializeToString(r2);
|
|
1110
|
-
t4 = '<?xml version="1.0" standalone="no"?>\r\n' + t4, n(`data:${A(e3)};charset=utf-8,${encodeURIComponent(t4)}`, `${i2}.svg`);
|
|
1111
|
-
} else n(r2.toDataURL(A(e3)), `${i2}.${e3}`);
|
|
1112
|
-
}
|
|
1113
|
-
}
|
|
1114
|
-
const $ = M;
|
|
1115
|
-
})(), r.default;
|
|
1116
|
-
})()));
|
|
1117
|
-
}
|
|
1118
|
-
});
|
|
1119
|
-
var qrCodeStyling3Y6LZH6V = require_qr_code_styling();
|
|
1120
|
-
|
|
1121
|
-
export { qrCodeStyling3Y6LZH6V as default };
|
|
1122
|
-
//# sourceMappingURL=qr-code-styling-3Y6LZH6V.js.map
|
|
1123
|
-
//# sourceMappingURL=qr-code-styling-3Y6LZH6V.js.map
|