@lglab/react-qr-code 1.2.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +3 -3
- package/dist/index.es.js +646 -591
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useMemo as L, useCallback as
|
|
1
|
+
import { jsx as w, jsxs as K, Fragment as st } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as L, useCallback as it, useRef as at, useImperativeHandle as ct } from "react";
|
|
3
3
|
/**
|
|
4
4
|
* @license QR Code generator library (TypeScript)
|
|
5
5
|
* Copyright (c) Project Nayuki.
|
|
6
6
|
* SPDX-License-Identifier: MIT
|
|
7
7
|
*/
|
|
8
|
-
var
|
|
8
|
+
var v;
|
|
9
9
|
((r) => {
|
|
10
10
|
const d = class d {
|
|
11
11
|
/*-- Constructor (low level) and fields --*/
|
|
@@ -13,28 +13,28 @@ var O;
|
|
|
13
13
|
// error correction level, data codeword bytes, and mask number.
|
|
14
14
|
// This is a low-level API that most users should not use directly.
|
|
15
15
|
// A mid-level API is the encodeSegments() function.
|
|
16
|
-
constructor(
|
|
17
|
-
if (this.version =
|
|
16
|
+
constructor(o, t, e, c) {
|
|
17
|
+
if (this.version = o, this.errorCorrectionLevel = t, this.modules = [], this.isFunction = [], o < d.MIN_VERSION || o > d.MAX_VERSION)
|
|
18
18
|
throw new RangeError("Version value out of range");
|
|
19
|
-
if (
|
|
19
|
+
if (c < -1 || c > 7)
|
|
20
20
|
throw new RangeError("Mask value out of range");
|
|
21
|
-
this.size =
|
|
21
|
+
this.size = o * 4 + 17;
|
|
22
22
|
let h = [];
|
|
23
|
-
for (let
|
|
23
|
+
for (let $ = 0; $ < this.size; $++)
|
|
24
24
|
h.push(!1);
|
|
25
|
-
for (let
|
|
25
|
+
for (let $ = 0; $ < this.size; $++)
|
|
26
26
|
this.modules.push(h.slice()), this.isFunction.push(h.slice());
|
|
27
27
|
this.drawFunctionPatterns();
|
|
28
|
-
const
|
|
29
|
-
if (this.drawCodewords(
|
|
30
|
-
let
|
|
28
|
+
const f = this.addEccAndInterleave(e);
|
|
29
|
+
if (this.drawCodewords(f), c == -1) {
|
|
30
|
+
let $ = 1e9;
|
|
31
31
|
for (let p = 0; p < 8; p++) {
|
|
32
32
|
this.applyMask(p), this.drawFormatBits(p);
|
|
33
33
|
const M = this.getPenaltyScore();
|
|
34
|
-
M <
|
|
34
|
+
M < $ && (c = p, $ = M), this.applyMask(p);
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
|
|
37
|
+
n(0 <= c && c <= 7), this.mask = c, this.applyMask(c), this.drawFormatBits(c), this.isFunction = [];
|
|
38
38
|
}
|
|
39
39
|
/*-- Static factory functions (high level) --*/
|
|
40
40
|
// Returns a QR Code representing the given Unicode text string at the given error correction level.
|
|
@@ -42,17 +42,17 @@ var O;
|
|
|
42
42
|
// Unicode code points (not UTF-16 code units) if the low error correction level is used. The smallest possible
|
|
43
43
|
// QR Code version is automatically chosen for the output. The ECC level of the result may be higher than the
|
|
44
44
|
// ecl argument if it can be done without increasing the version.
|
|
45
|
-
static encodeText(
|
|
46
|
-
const
|
|
47
|
-
return d.encodeSegments(
|
|
45
|
+
static encodeText(o, t) {
|
|
46
|
+
const e = r.QrSegment.makeSegments(o);
|
|
47
|
+
return d.encodeSegments(e, t);
|
|
48
48
|
}
|
|
49
49
|
// Returns a QR Code representing the given binary data at the given error correction level.
|
|
50
50
|
// This function always encodes using the binary segment mode, not any text mode. The maximum number of
|
|
51
51
|
// bytes allowed is 2953. The smallest possible QR Code version is automatically chosen for the output.
|
|
52
52
|
// The ECC level of the result may be higher than the ecl argument if it can be done without increasing the version.
|
|
53
|
-
static encodeBinary(
|
|
54
|
-
const
|
|
55
|
-
return d.encodeSegments([
|
|
53
|
+
static encodeBinary(o, t) {
|
|
54
|
+
const e = r.QrSegment.makeBytes(o);
|
|
55
|
+
return d.encodeSegments([e], t);
|
|
56
56
|
}
|
|
57
57
|
/*-- Static factory functions (mid level) --*/
|
|
58
58
|
// Returns a QR Code representing the given segments with the given encoding parameters.
|
|
@@ -64,43 +64,43 @@ var O;
|
|
|
64
64
|
// This function allows the user to create a custom sequence of segments that switches
|
|
65
65
|
// between modes (such as alphanumeric and byte) to encode text in less space.
|
|
66
66
|
// This is a mid-level API; the high-level API is encodeText() and encodeBinary().
|
|
67
|
-
static encodeSegments(
|
|
68
|
-
if (!(d.MIN_VERSION <=
|
|
67
|
+
static encodeSegments(o, t, e = 1, c = 40, h = -1, f = !0) {
|
|
68
|
+
if (!(d.MIN_VERSION <= e && e <= c && c <= d.MAX_VERSION) || h < -1 || h > 7)
|
|
69
69
|
throw new RangeError("Invalid value");
|
|
70
|
-
let
|
|
71
|
-
for (
|
|
72
|
-
const R = d.getNumDataCodewords(
|
|
73
|
-
if (
|
|
74
|
-
p =
|
|
70
|
+
let $, p;
|
|
71
|
+
for ($ = e; ; $++) {
|
|
72
|
+
const R = d.getNumDataCodewords($, t) * 8, I = l.getTotalBits(o, $);
|
|
73
|
+
if (I <= R) {
|
|
74
|
+
p = I;
|
|
75
75
|
break;
|
|
76
76
|
}
|
|
77
|
-
if (
|
|
77
|
+
if ($ >= c)
|
|
78
78
|
throw new RangeError("Data too long");
|
|
79
79
|
}
|
|
80
80
|
for (const R of [d.Ecc.MEDIUM, d.Ecc.QUARTILE, d.Ecc.HIGH])
|
|
81
|
-
|
|
81
|
+
f && p <= d.getNumDataCodewords($, R) * 8 && (t = R);
|
|
82
82
|
let M = [];
|
|
83
|
-
for (const R of
|
|
84
|
-
|
|
85
|
-
for (const
|
|
86
|
-
M.push(
|
|
83
|
+
for (const R of o) {
|
|
84
|
+
a(R.mode.modeBits, 4, M), a(R.numChars, R.mode.numCharCountBits($), M);
|
|
85
|
+
for (const I of R.getData())
|
|
86
|
+
M.push(I);
|
|
87
87
|
}
|
|
88
|
-
|
|
89
|
-
const E = d.getNumDataCodewords(
|
|
90
|
-
|
|
88
|
+
n(M.length == p);
|
|
89
|
+
const E = d.getNumDataCodewords($, t) * 8;
|
|
90
|
+
n(M.length <= E), a(0, Math.min(4, E - M.length), M), a(0, (8 - M.length % 8) % 8, M), n(M.length % 8 == 0);
|
|
91
91
|
for (let R = 236; M.length < E; R ^= 253)
|
|
92
|
-
|
|
92
|
+
a(R, 8, M);
|
|
93
93
|
let m = [];
|
|
94
94
|
for (; m.length * 8 < M.length; )
|
|
95
95
|
m.push(0);
|
|
96
|
-
return M.forEach((R,
|
|
96
|
+
return M.forEach((R, I) => m[I >>> 3] |= R << 7 - (I & 7)), new d($, t, m, h);
|
|
97
97
|
}
|
|
98
98
|
/*-- Accessor methods --*/
|
|
99
99
|
// Returns the color of the module (pixel) at the given coordinates, which is false
|
|
100
100
|
// for light or true for dark. The top left corner has the coordinates (x=0, y=0).
|
|
101
101
|
// If the given coordinates are out of bounds, then false (light) is returned.
|
|
102
|
-
getModule(
|
|
103
|
-
return 0 <=
|
|
102
|
+
getModule(o, t) {
|
|
103
|
+
return 0 <= o && o < this.size && 0 <= t && t < this.size && this.modules[t][o];
|
|
104
104
|
}
|
|
105
105
|
// Modified to expose modules for easy access
|
|
106
106
|
getModules() {
|
|
@@ -109,33 +109,33 @@ var O;
|
|
|
109
109
|
/*-- Private helper methods for constructor: Drawing function modules --*/
|
|
110
110
|
// Reads this object's version field, and draws and marks all function modules.
|
|
111
111
|
drawFunctionPatterns() {
|
|
112
|
-
for (let
|
|
113
|
-
this.setFunctionModule(6,
|
|
112
|
+
for (let e = 0; e < this.size; e++)
|
|
113
|
+
this.setFunctionModule(6, e, e % 2 == 0), this.setFunctionModule(e, 6, e % 2 == 0);
|
|
114
114
|
this.drawFinderPattern(3, 3), this.drawFinderPattern(this.size - 4, 3), this.drawFinderPattern(3, this.size - 4);
|
|
115
|
-
const
|
|
116
|
-
for (let
|
|
117
|
-
for (let
|
|
118
|
-
|
|
115
|
+
const o = this.getAlignmentPatternPositions(), t = o.length;
|
|
116
|
+
for (let e = 0; e < t; e++)
|
|
117
|
+
for (let c = 0; c < t; c++)
|
|
118
|
+
e == 0 && c == 0 || e == 0 && c == t - 1 || e == t - 1 && c == 0 || this.drawAlignmentPattern(o[e], o[c]);
|
|
119
119
|
this.drawFormatBits(0), this.drawVersion();
|
|
120
120
|
}
|
|
121
121
|
// Draws two copies of the format bits (with its own error correction code)
|
|
122
122
|
// based on the given mask and this object's error correction level field.
|
|
123
|
-
drawFormatBits(
|
|
124
|
-
const
|
|
125
|
-
let
|
|
123
|
+
drawFormatBits(o) {
|
|
124
|
+
const t = this.errorCorrectionLevel.formatBits << 3 | o;
|
|
125
|
+
let e = t;
|
|
126
126
|
for (let h = 0; h < 10; h++)
|
|
127
|
-
|
|
128
|
-
const
|
|
129
|
-
|
|
127
|
+
e = e << 1 ^ (e >>> 9) * 1335;
|
|
128
|
+
const c = (t << 10 | e) ^ 21522;
|
|
129
|
+
n(c >>> 15 == 0);
|
|
130
130
|
for (let h = 0; h <= 5; h++)
|
|
131
|
-
this.setFunctionModule(8, h,
|
|
132
|
-
this.setFunctionModule(8, 7,
|
|
131
|
+
this.setFunctionModule(8, h, s(c, h));
|
|
132
|
+
this.setFunctionModule(8, 7, s(c, 6)), this.setFunctionModule(8, 8, s(c, 7)), this.setFunctionModule(7, 8, s(c, 8));
|
|
133
133
|
for (let h = 9; h < 15; h++)
|
|
134
|
-
this.setFunctionModule(14 - h, 8,
|
|
134
|
+
this.setFunctionModule(14 - h, 8, s(c, h));
|
|
135
135
|
for (let h = 0; h < 8; h++)
|
|
136
|
-
this.setFunctionModule(this.size - 1 - h, 8,
|
|
136
|
+
this.setFunctionModule(this.size - 1 - h, 8, s(c, h));
|
|
137
137
|
for (let h = 8; h < 15; h++)
|
|
138
|
-
this.setFunctionModule(8, this.size - 15 + h,
|
|
138
|
+
this.setFunctionModule(8, this.size - 15 + h, s(c, h));
|
|
139
139
|
this.setFunctionModule(8, this.size - 8, !0);
|
|
140
140
|
}
|
|
141
141
|
// Draws two copies of the version bits (with its own error correction code),
|
|
@@ -143,144 +143,144 @@ var O;
|
|
|
143
143
|
drawVersion() {
|
|
144
144
|
if (this.version < 7)
|
|
145
145
|
return;
|
|
146
|
-
let
|
|
147
|
-
for (let
|
|
148
|
-
|
|
149
|
-
const
|
|
150
|
-
t
|
|
151
|
-
for (let
|
|
152
|
-
const
|
|
153
|
-
this.setFunctionModule(h,
|
|
146
|
+
let o = this.version;
|
|
147
|
+
for (let e = 0; e < 12; e++)
|
|
148
|
+
o = o << 1 ^ (o >>> 11) * 7973;
|
|
149
|
+
const t = this.version << 12 | o;
|
|
150
|
+
n(t >>> 18 == 0);
|
|
151
|
+
for (let e = 0; e < 18; e++) {
|
|
152
|
+
const c = s(t, e), h = this.size - 11 + e % 3, f = Math.floor(e / 3);
|
|
153
|
+
this.setFunctionModule(h, f, c), this.setFunctionModule(f, h, c);
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
// Draws a 9*9 finder pattern including the border separator,
|
|
157
157
|
// with the center module at (x, y). Modules can be out of bounds.
|
|
158
|
-
drawFinderPattern(
|
|
159
|
-
for (let
|
|
160
|
-
for (let
|
|
161
|
-
const h = Math.max(Math.abs(
|
|
162
|
-
0 <=
|
|
158
|
+
drawFinderPattern(o, t) {
|
|
159
|
+
for (let e = -4; e <= 4; e++)
|
|
160
|
+
for (let c = -4; c <= 4; c++) {
|
|
161
|
+
const h = Math.max(Math.abs(c), Math.abs(e)), f = o + c, $ = t + e;
|
|
162
|
+
0 <= f && f < this.size && 0 <= $ && $ < this.size && this.setFunctionModule(f, $, h != 2 && h != 4);
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
165
|
// Draws a 5*5 alignment pattern, with the center module
|
|
166
166
|
// at (x, y). All modules must be in bounds.
|
|
167
|
-
drawAlignmentPattern(
|
|
168
|
-
for (let
|
|
169
|
-
for (let
|
|
170
|
-
this.setFunctionModule(
|
|
167
|
+
drawAlignmentPattern(o, t) {
|
|
168
|
+
for (let e = -2; e <= 2; e++)
|
|
169
|
+
for (let c = -2; c <= 2; c++)
|
|
170
|
+
this.setFunctionModule(o + c, t + e, Math.max(Math.abs(c), Math.abs(e)) != 1);
|
|
171
171
|
}
|
|
172
172
|
// Sets the color of a module and marks it as a function module.
|
|
173
173
|
// Only used by the constructor. Coordinates must be in bounds.
|
|
174
|
-
setFunctionModule(
|
|
175
|
-
this.modules[
|
|
174
|
+
setFunctionModule(o, t, e) {
|
|
175
|
+
this.modules[t][o] = e, this.isFunction[t][o] = !0;
|
|
176
176
|
}
|
|
177
177
|
/*-- Private helper methods for constructor: Codewords and masking --*/
|
|
178
178
|
// Returns a new byte string representing the given data with the appropriate error correction
|
|
179
179
|
// codewords appended to it, based on this object's version and error correction level.
|
|
180
|
-
addEccAndInterleave(
|
|
181
|
-
const
|
|
182
|
-
if (
|
|
180
|
+
addEccAndInterleave(o) {
|
|
181
|
+
const t = this.version, e = this.errorCorrectionLevel;
|
|
182
|
+
if (o.length != d.getNumDataCodewords(t, e))
|
|
183
183
|
throw new RangeError("Invalid argument");
|
|
184
|
-
const
|
|
184
|
+
const c = d.NUM_ERROR_CORRECTION_BLOCKS[e.ordinal][t], h = d.ECC_CODEWORDS_PER_BLOCK[e.ordinal][t], f = Math.floor(d.getNumRawDataModules(t) / 8), $ = c - f % c, p = Math.floor(f / c);
|
|
185
185
|
let M = [];
|
|
186
186
|
const E = d.reedSolomonComputeDivisor(h);
|
|
187
|
-
for (let R = 0,
|
|
188
|
-
let
|
|
189
|
-
|
|
190
|
-
const
|
|
191
|
-
R <
|
|
187
|
+
for (let R = 0, I = 0; R < c; R++) {
|
|
188
|
+
let C = o.slice(I, I + p - h + (R < $ ? 0 : 1));
|
|
189
|
+
I += C.length;
|
|
190
|
+
const A = d.reedSolomonComputeRemainder(C, E);
|
|
191
|
+
R < $ && C.push(0), M.push(C.concat(A));
|
|
192
192
|
}
|
|
193
193
|
let m = [];
|
|
194
194
|
for (let R = 0; R < M[0].length; R++)
|
|
195
|
-
M.forEach((
|
|
196
|
-
(R != p - h ||
|
|
195
|
+
M.forEach((I, C) => {
|
|
196
|
+
(R != p - h || C >= $) && m.push(I[R]);
|
|
197
197
|
});
|
|
198
|
-
return
|
|
198
|
+
return n(m.length == f), m;
|
|
199
199
|
}
|
|
200
200
|
// Draws the given sequence of 8-bit codewords (data and error correction) onto the entire
|
|
201
201
|
// data area of this QR Code. Function modules need to be marked off before this is called.
|
|
202
|
-
drawCodewords(
|
|
203
|
-
if (
|
|
202
|
+
drawCodewords(o) {
|
|
203
|
+
if (o.length != Math.floor(d.getNumRawDataModules(this.version) / 8))
|
|
204
204
|
throw new RangeError("Invalid argument");
|
|
205
|
-
let
|
|
206
|
-
for (let
|
|
207
|
-
|
|
208
|
-
for (let
|
|
205
|
+
let t = 0;
|
|
206
|
+
for (let e = this.size - 1; e >= 1; e -= 2) {
|
|
207
|
+
e == 6 && (e = 5);
|
|
208
|
+
for (let c = 0; c < this.size; c++)
|
|
209
209
|
for (let h = 0; h < 2; h++) {
|
|
210
|
-
const
|
|
211
|
-
!this.isFunction[p][
|
|
210
|
+
const f = e - h, p = (e + 1 & 2) == 0 ? this.size - 1 - c : c;
|
|
211
|
+
!this.isFunction[p][f] && t < o.length * 8 && (this.modules[p][f] = s(o[t >>> 3], 7 - (t & 7)), t++);
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
|
-
t
|
|
214
|
+
n(t == o.length * 8);
|
|
215
215
|
}
|
|
216
216
|
// XORs the codeword modules in this QR Code with the given mask pattern.
|
|
217
217
|
// The function modules must be marked and the codeword bits must be drawn
|
|
218
218
|
// before masking. Due to the arithmetic of XOR, calling applyMask() with
|
|
219
219
|
// the same mask value a second time will undo the mask. A final well-formed
|
|
220
220
|
// QR Code needs exactly one (not zero, two, etc.) mask applied.
|
|
221
|
-
applyMask(
|
|
222
|
-
if (
|
|
221
|
+
applyMask(o) {
|
|
222
|
+
if (o < 0 || o > 7)
|
|
223
223
|
throw new RangeError("Mask value out of range");
|
|
224
|
-
for (let
|
|
225
|
-
for (let
|
|
226
|
-
let
|
|
227
|
-
switch (
|
|
224
|
+
for (let t = 0; t < this.size; t++)
|
|
225
|
+
for (let e = 0; e < this.size; e++) {
|
|
226
|
+
let c;
|
|
227
|
+
switch (o) {
|
|
228
228
|
case 0:
|
|
229
|
-
|
|
229
|
+
c = (e + t) % 2 == 0;
|
|
230
230
|
break;
|
|
231
231
|
case 1:
|
|
232
|
-
|
|
232
|
+
c = t % 2 == 0;
|
|
233
233
|
break;
|
|
234
234
|
case 2:
|
|
235
|
-
|
|
235
|
+
c = e % 3 == 0;
|
|
236
236
|
break;
|
|
237
237
|
case 3:
|
|
238
|
-
|
|
238
|
+
c = (e + t) % 3 == 0;
|
|
239
239
|
break;
|
|
240
240
|
case 4:
|
|
241
|
-
|
|
241
|
+
c = (Math.floor(e / 3) + Math.floor(t / 2)) % 2 == 0;
|
|
242
242
|
break;
|
|
243
243
|
case 5:
|
|
244
|
-
|
|
244
|
+
c = e * t % 2 + e * t % 3 == 0;
|
|
245
245
|
break;
|
|
246
246
|
case 6:
|
|
247
|
-
|
|
247
|
+
c = (e * t % 2 + e * t % 3) % 2 == 0;
|
|
248
248
|
break;
|
|
249
249
|
case 7:
|
|
250
|
-
|
|
250
|
+
c = ((e + t) % 2 + e * t % 3) % 2 == 0;
|
|
251
251
|
break;
|
|
252
252
|
default:
|
|
253
253
|
throw new Error("Unreachable");
|
|
254
254
|
}
|
|
255
|
-
!this.isFunction[
|
|
255
|
+
!this.isFunction[t][e] && c && (this.modules[t][e] = !this.modules[t][e]);
|
|
256
256
|
}
|
|
257
257
|
}
|
|
258
258
|
// Calculates and returns the penalty score based on state of this QR Code's current modules.
|
|
259
259
|
// This is used by the automatic mask choice algorithm to find the mask pattern that yields the lowest score.
|
|
260
260
|
getPenaltyScore() {
|
|
261
|
-
let
|
|
261
|
+
let o = 0;
|
|
262
262
|
for (let h = 0; h < this.size; h++) {
|
|
263
|
-
let
|
|
263
|
+
let f = !1, $ = 0, p = [0, 0, 0, 0, 0, 0, 0];
|
|
264
264
|
for (let M = 0; M < this.size; M++)
|
|
265
|
-
this.modules[h][M] ==
|
|
266
|
-
|
|
265
|
+
this.modules[h][M] == f ? ($++, $ == 5 ? o += d.PENALTY_N1 : $ > 5 && o++) : (this.finderPenaltyAddHistory($, p), f || (o += this.finderPenaltyCountPatterns(p) * d.PENALTY_N3), f = this.modules[h][M], $ = 1);
|
|
266
|
+
o += this.finderPenaltyTerminateAndCount(f, $, p) * d.PENALTY_N3;
|
|
267
267
|
}
|
|
268
268
|
for (let h = 0; h < this.size; h++) {
|
|
269
|
-
let
|
|
269
|
+
let f = !1, $ = 0, p = [0, 0, 0, 0, 0, 0, 0];
|
|
270
270
|
for (let M = 0; M < this.size; M++)
|
|
271
|
-
this.modules[M][h] ==
|
|
272
|
-
|
|
271
|
+
this.modules[M][h] == f ? ($++, $ == 5 ? o += d.PENALTY_N1 : $ > 5 && o++) : (this.finderPenaltyAddHistory($, p), f || (o += this.finderPenaltyCountPatterns(p) * d.PENALTY_N3), f = this.modules[M][h], $ = 1);
|
|
272
|
+
o += this.finderPenaltyTerminateAndCount(f, $, p) * d.PENALTY_N3;
|
|
273
273
|
}
|
|
274
274
|
for (let h = 0; h < this.size - 1; h++)
|
|
275
|
-
for (let
|
|
276
|
-
const
|
|
277
|
-
|
|
275
|
+
for (let f = 0; f < this.size - 1; f++) {
|
|
276
|
+
const $ = this.modules[h][f];
|
|
277
|
+
$ == this.modules[h][f + 1] && $ == this.modules[h + 1][f] && $ == this.modules[h + 1][f + 1] && (o += d.PENALTY_N2);
|
|
278
278
|
}
|
|
279
|
-
let
|
|
279
|
+
let t = 0;
|
|
280
280
|
for (const h of this.modules)
|
|
281
|
-
|
|
282
|
-
const
|
|
283
|
-
return
|
|
281
|
+
t = h.reduce((f, $) => f + ($ ? 1 : 0), t);
|
|
282
|
+
const e = this.size * this.size, c = Math.ceil(Math.abs(t * 20 - e * 10) / e) - 1;
|
|
283
|
+
return n(0 <= c && c <= 9), o += c * d.PENALTY_N4, n(0 <= o && o <= 2568888), o;
|
|
284
284
|
}
|
|
285
285
|
/*-- Private helper functions --*/
|
|
286
286
|
// Returns an ascending list of positions of alignment patterns for this version number.
|
|
@@ -290,83 +290,83 @@ var O;
|
|
|
290
290
|
if (this.version == 1)
|
|
291
291
|
return [];
|
|
292
292
|
{
|
|
293
|
-
const
|
|
294
|
-
let
|
|
295
|
-
for (let
|
|
296
|
-
|
|
297
|
-
return
|
|
293
|
+
const o = Math.floor(this.version / 7) + 2, t = this.version == 32 ? 26 : Math.ceil((this.version * 4 + 4) / (o * 2 - 2)) * 2;
|
|
294
|
+
let e = [6];
|
|
295
|
+
for (let c = this.size - 7; e.length < o; c -= t)
|
|
296
|
+
e.splice(1, 0, c);
|
|
297
|
+
return e;
|
|
298
298
|
}
|
|
299
299
|
}
|
|
300
300
|
// Returns the number of data bits that can be stored in a QR Code of the given version number, after
|
|
301
301
|
// all function modules are excluded. This includes remainder bits, so it might not be a multiple of 8.
|
|
302
302
|
// The result is in the range [208, 29648]. This could be implemented as a 40-entry lookup table.
|
|
303
|
-
static getNumRawDataModules(
|
|
304
|
-
if (
|
|
303
|
+
static getNumRawDataModules(o) {
|
|
304
|
+
if (o < d.MIN_VERSION || o > d.MAX_VERSION)
|
|
305
305
|
throw new RangeError("Version number out of range");
|
|
306
|
-
let
|
|
307
|
-
if (
|
|
308
|
-
const
|
|
309
|
-
|
|
306
|
+
let t = (16 * o + 128) * o + 64;
|
|
307
|
+
if (o >= 2) {
|
|
308
|
+
const e = Math.floor(o / 7) + 2;
|
|
309
|
+
t -= (25 * e - 10) * e - 55, o >= 7 && (t -= 36);
|
|
310
310
|
}
|
|
311
|
-
return
|
|
311
|
+
return n(208 <= t && t <= 29648), t;
|
|
312
312
|
}
|
|
313
313
|
// Returns the number of 8-bit data (i.e. not error correction) codewords contained in any
|
|
314
314
|
// QR Code of the given version number and error correction level, with remainder bits discarded.
|
|
315
315
|
// This stateless pure function could be implemented as a (40*4)-cell lookup table.
|
|
316
|
-
static getNumDataCodewords(
|
|
317
|
-
return Math.floor(d.getNumRawDataModules(
|
|
316
|
+
static getNumDataCodewords(o, t) {
|
|
317
|
+
return Math.floor(d.getNumRawDataModules(o) / 8) - d.ECC_CODEWORDS_PER_BLOCK[t.ordinal][o] * d.NUM_ERROR_CORRECTION_BLOCKS[t.ordinal][o];
|
|
318
318
|
}
|
|
319
319
|
// Returns a Reed-Solomon ECC generator polynomial for the given degree. This could be
|
|
320
320
|
// implemented as a lookup table over all possible parameter values, instead of as an algorithm.
|
|
321
|
-
static reedSolomonComputeDivisor(
|
|
322
|
-
if (
|
|
321
|
+
static reedSolomonComputeDivisor(o) {
|
|
322
|
+
if (o < 1 || o > 255)
|
|
323
323
|
throw new RangeError("Degree out of range");
|
|
324
|
-
let
|
|
325
|
-
for (let
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
let
|
|
329
|
-
for (let
|
|
330
|
-
for (let h = 0; h <
|
|
331
|
-
|
|
332
|
-
|
|
324
|
+
let t = [];
|
|
325
|
+
for (let c = 0; c < o - 1; c++)
|
|
326
|
+
t.push(0);
|
|
327
|
+
t.push(1);
|
|
328
|
+
let e = 1;
|
|
329
|
+
for (let c = 0; c < o; c++) {
|
|
330
|
+
for (let h = 0; h < t.length; h++)
|
|
331
|
+
t[h] = d.reedSolomonMultiply(t[h], e), h + 1 < t.length && (t[h] ^= t[h + 1]);
|
|
332
|
+
e = d.reedSolomonMultiply(e, 2);
|
|
333
333
|
}
|
|
334
|
-
return
|
|
334
|
+
return t;
|
|
335
335
|
}
|
|
336
336
|
// Returns the Reed-Solomon error correction codeword for the given data and divisor polynomials.
|
|
337
|
-
static reedSolomonComputeRemainder(
|
|
338
|
-
let
|
|
339
|
-
for (const
|
|
340
|
-
const h =
|
|
341
|
-
|
|
337
|
+
static reedSolomonComputeRemainder(o, t) {
|
|
338
|
+
let e = t.map((c) => 0);
|
|
339
|
+
for (const c of o) {
|
|
340
|
+
const h = c ^ e.shift();
|
|
341
|
+
e.push(0), t.forEach((f, $) => e[$] ^= d.reedSolomonMultiply(f, h));
|
|
342
342
|
}
|
|
343
|
-
return
|
|
343
|
+
return e;
|
|
344
344
|
}
|
|
345
345
|
// Returns the product of the two given field elements modulo GF(2^8/0x11D). The arguments and result
|
|
346
346
|
// are unsigned 8-bit integers. This could be implemented as a lookup table of 256*256 entries of uint8.
|
|
347
|
-
static reedSolomonMultiply(
|
|
348
|
-
if (
|
|
347
|
+
static reedSolomonMultiply(o, t) {
|
|
348
|
+
if (o >>> 8 || t >>> 8)
|
|
349
349
|
throw new RangeError("Byte out of range");
|
|
350
|
-
let
|
|
351
|
-
for (let
|
|
352
|
-
|
|
353
|
-
return
|
|
350
|
+
let e = 0;
|
|
351
|
+
for (let c = 7; c >= 0; c--)
|
|
352
|
+
e = e << 1 ^ (e >>> 7) * 285, e ^= (t >>> c & 1) * o;
|
|
353
|
+
return n(e >>> 8 == 0), e;
|
|
354
354
|
}
|
|
355
355
|
// Can only be called immediately after a light run is added, and
|
|
356
356
|
// returns either 0, 1, or 2. A helper function for getPenaltyScore().
|
|
357
|
-
finderPenaltyCountPatterns(
|
|
358
|
-
const
|
|
359
|
-
t
|
|
360
|
-
const
|
|
361
|
-
return (
|
|
357
|
+
finderPenaltyCountPatterns(o) {
|
|
358
|
+
const t = o[1];
|
|
359
|
+
n(t <= this.size * 3);
|
|
360
|
+
const e = t > 0 && o[2] == t && o[3] == t * 3 && o[4] == t && o[5] == t;
|
|
361
|
+
return (e && o[0] >= t * 4 && o[6] >= t ? 1 : 0) + (e && o[6] >= t * 4 && o[0] >= t ? 1 : 0);
|
|
362
362
|
}
|
|
363
363
|
// Must be called at the end of a line (row or column) of modules. A helper function for getPenaltyScore().
|
|
364
|
-
finderPenaltyTerminateAndCount(
|
|
365
|
-
return
|
|
364
|
+
finderPenaltyTerminateAndCount(o, t, e) {
|
|
365
|
+
return o && (this.finderPenaltyAddHistory(t, e), t = 0), t += this.size, this.finderPenaltyAddHistory(t, e), this.finderPenaltyCountPatterns(e);
|
|
366
366
|
}
|
|
367
367
|
// Pushes the given value to the front and drops the last value. A helper function for getPenaltyScore().
|
|
368
|
-
finderPenaltyAddHistory(
|
|
369
|
-
|
|
368
|
+
finderPenaltyAddHistory(o, t) {
|
|
369
|
+
t[0] == 0 && (o += this.size), t.pop(), t.unshift(o);
|
|
370
370
|
}
|
|
371
371
|
};
|
|
372
372
|
d.MIN_VERSION = 1, d.MAX_VERSION = 40, d.PENALTY_N1 = 3, d.PENALTY_N2 = 3, d.PENALTY_N3 = 40, d.PENALTY_N4 = 10, d.ECC_CODEWORDS_PER_BLOCK = [
|
|
@@ -392,19 +392,19 @@ var O;
|
|
|
392
392
|
[-1, 1, 1, 2, 4, 4, 4, 5, 6, 8, 8, 11, 11, 16, 16, 18, 16, 19, 21, 25, 25, 25, 34, 30, 32, 35, 37, 40, 42, 45, 48, 51, 54, 57, 60, 63, 66, 70, 74, 77, 81]
|
|
393
393
|
// High
|
|
394
394
|
];
|
|
395
|
-
let
|
|
396
|
-
r.QrCode =
|
|
397
|
-
function
|
|
398
|
-
if (
|
|
395
|
+
let i = d;
|
|
396
|
+
r.QrCode = i;
|
|
397
|
+
function a(N, o, t) {
|
|
398
|
+
if (o < 0 || o > 31 || N >>> o)
|
|
399
399
|
throw new RangeError("Value out of range");
|
|
400
|
-
for (let
|
|
401
|
-
|
|
400
|
+
for (let e = o - 1; e >= 0; e--)
|
|
401
|
+
t.push(N >>> e & 1);
|
|
402
402
|
}
|
|
403
|
-
function
|
|
404
|
-
return (
|
|
403
|
+
function s(N, o) {
|
|
404
|
+
return (N >>> o & 1) != 0;
|
|
405
405
|
}
|
|
406
|
-
function
|
|
407
|
-
if (!
|
|
406
|
+
function n(N) {
|
|
407
|
+
if (!N)
|
|
408
408
|
throw new Error("Assertion error");
|
|
409
409
|
}
|
|
410
410
|
const u = class u {
|
|
@@ -412,76 +412,76 @@ var O;
|
|
|
412
412
|
// Creates a new QR Code segment with the given attributes and data.
|
|
413
413
|
// The character count (numChars) must agree with the mode and the bit buffer length,
|
|
414
414
|
// but the constraint isn't checked. The given bit buffer is cloned and stored.
|
|
415
|
-
constructor(
|
|
416
|
-
if (this.mode =
|
|
415
|
+
constructor(o, t, e) {
|
|
416
|
+
if (this.mode = o, this.numChars = t, this.bitData = e, t < 0)
|
|
417
417
|
throw new RangeError("Invalid argument");
|
|
418
|
-
this.bitData =
|
|
418
|
+
this.bitData = e.slice();
|
|
419
419
|
}
|
|
420
420
|
/*-- Static factory functions (mid level) --*/
|
|
421
421
|
// Returns a segment representing the given binary data encoded in
|
|
422
422
|
// byte mode. All input byte arrays are acceptable. Any text string
|
|
423
423
|
// can be converted to UTF-8 bytes and encoded as a byte mode segment.
|
|
424
|
-
static makeBytes(
|
|
425
|
-
let
|
|
426
|
-
for (const
|
|
427
|
-
|
|
428
|
-
return new u(u.Mode.BYTE,
|
|
424
|
+
static makeBytes(o) {
|
|
425
|
+
let t = [];
|
|
426
|
+
for (const e of o)
|
|
427
|
+
a(e, 8, t);
|
|
428
|
+
return new u(u.Mode.BYTE, o.length, t);
|
|
429
429
|
}
|
|
430
430
|
// Returns a segment representing the given string of decimal digits encoded in numeric mode.
|
|
431
|
-
static makeNumeric(
|
|
432
|
-
if (!u.isNumeric(
|
|
431
|
+
static makeNumeric(o) {
|
|
432
|
+
if (!u.isNumeric(o))
|
|
433
433
|
throw new RangeError("String contains non-numeric characters");
|
|
434
|
-
let
|
|
435
|
-
for (let
|
|
436
|
-
const
|
|
437
|
-
|
|
434
|
+
let t = [];
|
|
435
|
+
for (let e = 0; e < o.length; ) {
|
|
436
|
+
const c = Math.min(o.length - e, 3);
|
|
437
|
+
a(parseInt(o.substring(e, e + c), 10), c * 3 + 1, t), e += c;
|
|
438
438
|
}
|
|
439
|
-
return new u(u.Mode.NUMERIC,
|
|
439
|
+
return new u(u.Mode.NUMERIC, o.length, t);
|
|
440
440
|
}
|
|
441
441
|
// Returns a segment representing the given text string encoded in alphanumeric mode.
|
|
442
442
|
// The characters allowed are: 0 to 9, A to Z (uppercase only), space,
|
|
443
443
|
// dollar, percent, asterisk, plus, hyphen, period, slash, colon.
|
|
444
|
-
static makeAlphanumeric(
|
|
445
|
-
if (!u.isAlphanumeric(
|
|
444
|
+
static makeAlphanumeric(o) {
|
|
445
|
+
if (!u.isAlphanumeric(o))
|
|
446
446
|
throw new RangeError("String contains unencodable characters in alphanumeric mode");
|
|
447
|
-
let
|
|
448
|
-
for (
|
|
449
|
-
let
|
|
450
|
-
|
|
447
|
+
let t = [], e;
|
|
448
|
+
for (e = 0; e + 2 <= o.length; e += 2) {
|
|
449
|
+
let c = u.ALPHANUMERIC_CHARSET.indexOf(o.charAt(e)) * 45;
|
|
450
|
+
c += u.ALPHANUMERIC_CHARSET.indexOf(o.charAt(e + 1)), a(c, 11, t);
|
|
451
451
|
}
|
|
452
|
-
return
|
|
452
|
+
return e < o.length && a(u.ALPHANUMERIC_CHARSET.indexOf(o.charAt(e)), 6, t), new u(u.Mode.ALPHANUMERIC, o.length, t);
|
|
453
453
|
}
|
|
454
454
|
// Returns a new mutable list of zero or more segments to represent the given Unicode text string.
|
|
455
455
|
// The result may use various segment modes and switch modes to optimize the length of the bit stream.
|
|
456
|
-
static makeSegments(
|
|
457
|
-
return
|
|
456
|
+
static makeSegments(o) {
|
|
457
|
+
return o == "" ? [] : u.isNumeric(o) ? [u.makeNumeric(o)] : u.isAlphanumeric(o) ? [u.makeAlphanumeric(o)] : [u.makeBytes(u.toUtf8ByteArray(o))];
|
|
458
458
|
}
|
|
459
459
|
// Returns a segment representing an Extended Channel Interpretation
|
|
460
460
|
// (ECI) designator with the given assignment value.
|
|
461
|
-
static makeEci(
|
|
462
|
-
let
|
|
463
|
-
if (
|
|
461
|
+
static makeEci(o) {
|
|
462
|
+
let t = [];
|
|
463
|
+
if (o < 0)
|
|
464
464
|
throw new RangeError("ECI assignment value out of range");
|
|
465
|
-
if (
|
|
466
|
-
|
|
467
|
-
else if (
|
|
468
|
-
|
|
469
|
-
else if (
|
|
470
|
-
|
|
465
|
+
if (o < 128)
|
|
466
|
+
a(o, 8, t);
|
|
467
|
+
else if (o < 16384)
|
|
468
|
+
a(2, 2, t), a(o, 14, t);
|
|
469
|
+
else if (o < 1e6)
|
|
470
|
+
a(6, 3, t), a(o, 21, t);
|
|
471
471
|
else
|
|
472
472
|
throw new RangeError("ECI assignment value out of range");
|
|
473
|
-
return new u(u.Mode.ECI, 0,
|
|
473
|
+
return new u(u.Mode.ECI, 0, t);
|
|
474
474
|
}
|
|
475
475
|
// Tests whether the given string can be encoded as a segment in numeric mode.
|
|
476
476
|
// A string is encodable iff each character is in the range 0 to 9.
|
|
477
|
-
static isNumeric(
|
|
478
|
-
return u.NUMERIC_REGEX.test(
|
|
477
|
+
static isNumeric(o) {
|
|
478
|
+
return u.NUMERIC_REGEX.test(o);
|
|
479
479
|
}
|
|
480
480
|
// Tests whether the given string can be encoded as a segment in alphanumeric mode.
|
|
481
481
|
// A string is encodable iff each character is in the following set: 0 to 9, A to Z
|
|
482
482
|
// (uppercase only), space, dollar, percent, asterisk, plus, hyphen, period, slash, colon.
|
|
483
|
-
static isAlphanumeric(
|
|
484
|
-
return u.ALPHANUMERIC_REGEX.test(
|
|
483
|
+
static isAlphanumeric(o) {
|
|
484
|
+
return u.ALPHANUMERIC_REGEX.test(o);
|
|
485
485
|
}
|
|
486
486
|
/*-- Methods --*/
|
|
487
487
|
// Returns a new copy of the data bits of this segment.
|
|
@@ -490,68 +490,68 @@ var O;
|
|
|
490
490
|
}
|
|
491
491
|
// (Package-private) Calculates and returns the number of bits needed to encode the given segments at
|
|
492
492
|
// the given version. The result is infinity if a segment has too many characters to fit its length field.
|
|
493
|
-
static getTotalBits(
|
|
494
|
-
let
|
|
495
|
-
for (const
|
|
496
|
-
const h =
|
|
497
|
-
if (
|
|
493
|
+
static getTotalBits(o, t) {
|
|
494
|
+
let e = 0;
|
|
495
|
+
for (const c of o) {
|
|
496
|
+
const h = c.mode.numCharCountBits(t);
|
|
497
|
+
if (c.numChars >= 1 << h)
|
|
498
498
|
return 1 / 0;
|
|
499
|
-
|
|
499
|
+
e += 4 + h + c.bitData.length;
|
|
500
500
|
}
|
|
501
|
-
return
|
|
501
|
+
return e;
|
|
502
502
|
}
|
|
503
503
|
// Returns a new array of bytes representing the given string encoded in UTF-8.
|
|
504
|
-
static toUtf8ByteArray(
|
|
505
|
-
|
|
506
|
-
let
|
|
507
|
-
for (let
|
|
508
|
-
|
|
509
|
-
return
|
|
504
|
+
static toUtf8ByteArray(o) {
|
|
505
|
+
o = encodeURI(o);
|
|
506
|
+
let t = [];
|
|
507
|
+
for (let e = 0; e < o.length; e++)
|
|
508
|
+
o.charAt(e) != "%" ? t.push(o.charCodeAt(e)) : (t.push(parseInt(o.substring(e + 1, e + 3), 16)), e += 2);
|
|
509
|
+
return t;
|
|
510
510
|
}
|
|
511
511
|
};
|
|
512
512
|
u.NUMERIC_REGEX = /^[0-9]*$/, u.ALPHANUMERIC_REGEX = /^[A-Z0-9 $%*+.\/:-]*$/, u.ALPHANUMERIC_CHARSET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";
|
|
513
|
-
let
|
|
514
|
-
r.QrSegment =
|
|
515
|
-
})(
|
|
513
|
+
let l = u;
|
|
514
|
+
r.QrSegment = l;
|
|
515
|
+
})(v || (v = {}));
|
|
516
516
|
((r) => {
|
|
517
|
-
((
|
|
518
|
-
const
|
|
517
|
+
((i) => {
|
|
518
|
+
const s = class s {
|
|
519
519
|
// The QR Code can tolerate about 30% erroneous codewords
|
|
520
520
|
/*-- Constructor and fields --*/
|
|
521
|
-
constructor(
|
|
522
|
-
this.ordinal =
|
|
521
|
+
constructor(l, d) {
|
|
522
|
+
this.ordinal = l, this.formatBits = d;
|
|
523
523
|
}
|
|
524
524
|
};
|
|
525
|
-
|
|
526
|
-
let
|
|
527
|
-
|
|
525
|
+
s.LOW = new s(0, 1), s.MEDIUM = new s(1, 0), s.QUARTILE = new s(2, 3), s.HIGH = new s(3, 2);
|
|
526
|
+
let a = s;
|
|
527
|
+
i.Ecc = a;
|
|
528
528
|
})(r.QrCode || (r.QrCode = {}));
|
|
529
|
-
})(
|
|
529
|
+
})(v || (v = {}));
|
|
530
530
|
((r) => {
|
|
531
|
-
((
|
|
532
|
-
const
|
|
531
|
+
((i) => {
|
|
532
|
+
const s = class s {
|
|
533
533
|
/*-- Constructor and fields --*/
|
|
534
|
-
constructor(
|
|
535
|
-
this.modeBits =
|
|
534
|
+
constructor(l, d) {
|
|
535
|
+
this.modeBits = l, this.numBitsCharCount = d;
|
|
536
536
|
}
|
|
537
537
|
/*-- Method --*/
|
|
538
538
|
// (Package-private) Returns the bit width of the character count field for a segment in
|
|
539
539
|
// this mode in a QR Code at the given version number. The result is in the range [0, 16].
|
|
540
|
-
numCharCountBits(
|
|
541
|
-
return this.numBitsCharCount[Math.floor((
|
|
540
|
+
numCharCountBits(l) {
|
|
541
|
+
return this.numBitsCharCount[Math.floor((l + 7) / 17)];
|
|
542
542
|
}
|
|
543
543
|
};
|
|
544
|
-
|
|
545
|
-
let
|
|
546
|
-
|
|
544
|
+
s.NUMERIC = new s(1, [10, 12, 14]), s.ALPHANUMERIC = new s(2, [9, 11, 13]), s.BYTE = new s(4, [8, 16, 16]), s.KANJI = new s(8, [8, 10, 12]), s.ECI = new s(7, [0, 0, 0]);
|
|
545
|
+
let a = s;
|
|
546
|
+
i.Mode = a;
|
|
547
547
|
})(r.QrSegment || (r.QrSegment = {}));
|
|
548
|
-
})(
|
|
549
|
-
const
|
|
550
|
-
L:
|
|
551
|
-
M:
|
|
552
|
-
Q:
|
|
553
|
-
H:
|
|
554
|
-
},
|
|
548
|
+
})(v || (v = {}));
|
|
549
|
+
const S = v, lt = {
|
|
550
|
+
L: S.QrCode.Ecc.LOW,
|
|
551
|
+
M: S.QrCode.Ecc.MEDIUM,
|
|
552
|
+
Q: S.QrCode.Ecc.QUARTILE,
|
|
553
|
+
H: S.QrCode.Ecc.HIGH
|
|
554
|
+
}, ht = 128, ut = "M", dt = 1, $t = 4, W = 5, _ = "#000000", ft = "square", pt = "square", mt = "square", Et = "react-qr-code", b = "react-qr-code-gradient", F = "react-qr-code-bg-gradient", Mt = 0.1, g = 7, O = 3, B = [
|
|
555
555
|
[1, 1, 1, 1, 1, 1, 1],
|
|
556
556
|
[1, 0, 0, 0, 0, 0, 1],
|
|
557
557
|
[1, 0, 0, 0, 0, 0, 1],
|
|
@@ -569,7 +569,7 @@ const y = O, at = {
|
|
|
569
569
|
"leaf-sm": [0, 90, -90],
|
|
570
570
|
leaf: [0, 90, -90],
|
|
571
571
|
"leaf-lg": [0, 90, -90]
|
|
572
|
-
},
|
|
572
|
+
}, Q = {
|
|
573
573
|
"rounded-sm": 3,
|
|
574
574
|
rounded: 4,
|
|
575
575
|
"rounded-lg": 5,
|
|
@@ -582,7 +582,7 @@ const y = O, at = {
|
|
|
582
582
|
"outpoint-sm": 3,
|
|
583
583
|
outpoint: 4,
|
|
584
584
|
"outpoint-lg": 5
|
|
585
|
-
},
|
|
585
|
+
}, k = {
|
|
586
586
|
square: 0,
|
|
587
587
|
diamond: 0,
|
|
588
588
|
circle: 3,
|
|
@@ -598,7 +598,7 @@ const y = O, at = {
|
|
|
598
598
|
"outpoint-sm": 1.5,
|
|
599
599
|
outpoint: 2,
|
|
600
600
|
"outpoint-lg": 2.3
|
|
601
|
-
},
|
|
601
|
+
}, H = [
|
|
602
602
|
[0, 0, 0, 0, 0, 0, 0],
|
|
603
603
|
[0, 0, 0, 0, 0, 0, 0],
|
|
604
604
|
[0, 0, 1, 1, 1, 0, 0],
|
|
@@ -606,28 +606,60 @@ const y = O, at = {
|
|
|
606
606
|
[0, 0, 1, 1, 1, 0, 0],
|
|
607
607
|
[0, 0, 0, 0, 0, 0, 0],
|
|
608
608
|
[0, 0, 0, 0, 0, 0, 0]
|
|
609
|
-
],
|
|
610
|
-
function
|
|
611
|
-
return r.toFixed(7).replace(
|
|
609
|
+
], Rt = /\.?0+$/;
|
|
610
|
+
function gt(r) {
|
|
611
|
+
return r.toFixed(7).replace(Rt, "");
|
|
612
612
|
}
|
|
613
613
|
const tt = (r) => {
|
|
614
|
-
const
|
|
614
|
+
const i = r % 360 * (Math.PI / 180), a = Math.max(0, Math.min(100, 50 - 50 * Math.cos(i))), s = Math.max(0, Math.min(100, 50 - 50 * Math.sin(i))), n = Math.max(0, Math.min(100, 50 + 50 * Math.cos(i))), l = Math.max(0, Math.min(100, 50 + 50 * Math.sin(i)));
|
|
615
615
|
return {
|
|
616
|
-
x1: `${
|
|
617
|
-
y1: `${
|
|
618
|
-
x2: `${
|
|
619
|
-
y2: `${
|
|
616
|
+
x1: `${a}%`,
|
|
617
|
+
y1: `${s}%`,
|
|
618
|
+
x2: `${n}%`,
|
|
619
|
+
y2: `${l}%`
|
|
620
620
|
};
|
|
621
|
-
}, et = (r,
|
|
622
|
-
const
|
|
621
|
+
}, et = (r, i, a, s) => {
|
|
622
|
+
const n = a / 2, l = n / 2, d = Math.PI / s;
|
|
623
623
|
let u = "";
|
|
624
|
-
for (let
|
|
625
|
-
const
|
|
626
|
-
u += `${
|
|
624
|
+
for (let N = 0; N < 2 * s; N++) {
|
|
625
|
+
const o = N * d - Math.PI / 2, t = N % 2 === 0 ? n : l, e = r + t * Math.cos(o), c = i + t * Math.sin(o);
|
|
626
|
+
u += `${N === 0 ? "M" : "L"} ${e},${c} `;
|
|
627
627
|
}
|
|
628
628
|
return u + "Z";
|
|
629
|
-
}, ot = (r, s,
|
|
630
|
-
|
|
629
|
+
}, ot = (r, i, a, s) => `M ${r} ${i}Q ${r + s} ${i + a / 2}, ${r} ${i + a}Q ${r + a / 2} ${i + a - s}, ${r + a} ${i + a}Q ${r + a - s} ${i + a / 2}, ${r + a} ${i}Q ${r + a / 2} ${i + s}, ${r} ${i}Z`, nt = (r, i, a) => {
|
|
630
|
+
const s = a / 8;
|
|
631
|
+
return `M ${r + a} ${i + s * 3}
|
|
632
|
+
V ${i + s}
|
|
633
|
+
h -${s}
|
|
634
|
+
V ${i}
|
|
635
|
+
H ${r + s * 5}
|
|
636
|
+
v ${s}
|
|
637
|
+
H ${r + s * 3}
|
|
638
|
+
V ${i}
|
|
639
|
+
H ${r + s}
|
|
640
|
+
v ${s}
|
|
641
|
+
H ${r}
|
|
642
|
+
v ${s * 2}
|
|
643
|
+
h ${s}
|
|
644
|
+
v ${s * 2}
|
|
645
|
+
H ${r}
|
|
646
|
+
v ${s * 2}
|
|
647
|
+
h ${s}
|
|
648
|
+
v ${s}
|
|
649
|
+
h ${s * 2}
|
|
650
|
+
v -${s}
|
|
651
|
+
h ${s * 2}
|
|
652
|
+
v ${s}
|
|
653
|
+
h ${s * 2}
|
|
654
|
+
v -${s}
|
|
655
|
+
h ${s}
|
|
656
|
+
V ${i + s * 5}
|
|
657
|
+
h -${s}
|
|
658
|
+
V ${i + s * 3}
|
|
659
|
+
h ${s}
|
|
660
|
+
Z`;
|
|
661
|
+
}, rt = (r, i, a) => {
|
|
662
|
+
let s = !1, n = 0;
|
|
631
663
|
return [
|
|
632
664
|
"M",
|
|
633
665
|
1,
|
|
@@ -739,18 +771,18 @@ const tt = (r) => {
|
|
|
739
771
|
1,
|
|
740
772
|
0.3262506,
|
|
741
773
|
"z"
|
|
742
|
-
].map((
|
|
743
|
-
},
|
|
774
|
+
].map((l) => typeof l == "string" ? (n = 0, s = l.toUpperCase() == l, l) : (n++, l = l * a, s && (l += n % 2 == 1 ? r : i), gt(l))).join(" ");
|
|
775
|
+
}, q = {
|
|
744
776
|
"data-testid": "background"
|
|
745
|
-
},
|
|
746
|
-
var
|
|
777
|
+
}, Nt = ({ background: r, numCells: i }) => {
|
|
778
|
+
var s, n;
|
|
747
779
|
if (!r)
|
|
748
780
|
return null;
|
|
749
781
|
if (typeof r == "string")
|
|
750
|
-
return /* @__PURE__ */
|
|
751
|
-
const
|
|
752
|
-
return /* @__PURE__ */
|
|
753
|
-
/* @__PURE__ */
|
|
782
|
+
return /* @__PURE__ */ w("path", { fill: r, d: `M0,0 h${i}v${i}H0z`, ...q });
|
|
783
|
+
const a = tt((r == null ? void 0 : r.rotation) || 0);
|
|
784
|
+
return /* @__PURE__ */ K(st, { children: [
|
|
785
|
+
/* @__PURE__ */ w("defs", { children: r.type === "linear" ? /* @__PURE__ */ w("linearGradient", { id: F, gradientUnits: "userSpaceOnUse", ...a, children: (s = r.stops) == null ? void 0 : s.map((l, d) => /* @__PURE__ */ w("stop", { offset: l.offset, stopColor: l.color }, d)) }) : /* @__PURE__ */ w(
|
|
754
786
|
"radialGradient",
|
|
755
787
|
{
|
|
756
788
|
id: F,
|
|
@@ -758,222 +790,231 @@ const tt = (r) => {
|
|
|
758
790
|
cx: "50%",
|
|
759
791
|
cy: "50%",
|
|
760
792
|
r: "50%",
|
|
761
|
-
children: (
|
|
793
|
+
children: (n = r.stops) == null ? void 0 : n.map((l, d) => /* @__PURE__ */ w("stop", { offset: l.offset, stopColor: l.color }, d))
|
|
762
794
|
}
|
|
763
795
|
) }),
|
|
764
|
-
/* @__PURE__ */
|
|
796
|
+
/* @__PURE__ */ w(
|
|
765
797
|
"path",
|
|
766
798
|
{
|
|
767
799
|
fill: `url(#${F})`,
|
|
768
|
-
d: `M0,0 h${
|
|
769
|
-
...
|
|
800
|
+
d: `M0,0 h${i}v${i}H0z`,
|
|
801
|
+
...q
|
|
770
802
|
}
|
|
771
803
|
)
|
|
772
804
|
] });
|
|
773
|
-
},
|
|
774
|
-
const
|
|
775
|
-
left: r === 0 ? !1 :
|
|
776
|
-
right: r ===
|
|
777
|
-
top:
|
|
778
|
-
bottom:
|
|
805
|
+
}, It = (r) => r === "square" || r === "circle" || r === "star" || r === "heart" || r === "diamond" || r === "hashtag", Ct = (r, i) => r === "square-sm" ? 0.75 : i ? Math.random() * (1 - 0.75) + 0.75 : 1, D = (r, i, a) => {
|
|
806
|
+
const s = {
|
|
807
|
+
left: r === 0 ? !1 : a[i][r - 1],
|
|
808
|
+
right: r === a[i].length - 1 ? !1 : a[i][r + 1],
|
|
809
|
+
top: i === 0 ? !1 : a[i - 1][r],
|
|
810
|
+
bottom: i === a.length - 1 ? !1 : a[i + 1][r]
|
|
779
811
|
};
|
|
780
812
|
return {
|
|
781
|
-
...
|
|
782
|
-
count: Object.values(
|
|
813
|
+
...s,
|
|
814
|
+
count: Object.values(s).filter(Boolean).length
|
|
783
815
|
};
|
|
784
|
-
},
|
|
816
|
+
}, U = (r, i, a) => `M${r},${i}h${a}v${a}h-${a}Z`, y = (r, i, a) => `M${r},${i + a / 2}a${a / 2},${a / 2} 0 1,0 ${a},0a${a / 2},${a / 2} 0 1,0 -${a},0Z`, wt = (r, i, a) => `M${r},${i + a / 2}l${a / 2},-${a / 2}l${a / 2},${a / 2}l-${a / 2},${a / 2}Z`, At = (r, i) => `M ${r} ${i}
|
|
785
817
|
v 1
|
|
786
818
|
h 1
|
|
787
819
|
v -0.5
|
|
788
|
-
a 0.5 0.5, 0, 0, 0, -0.5 -0.5`,
|
|
820
|
+
a 0.5 0.5, 0, 0, 0, -0.5 -0.5`, Y = (r, i) => `M ${r + 1} ${i}
|
|
789
821
|
v 1
|
|
790
822
|
h -1
|
|
791
823
|
v -0.5
|
|
792
|
-
a 0.5 0.5, 0, 0, 1, 0.5 -0.5`,
|
|
824
|
+
a 0.5 0.5, 0, 0, 1, 0.5 -0.5`, G = (r, i) => `M ${r} ${i}
|
|
793
825
|
v 1
|
|
794
826
|
h 0.5
|
|
795
827
|
a 0.5 0.5, 0, 0, 0, 0.5 -0.5
|
|
796
828
|
v -0.5
|
|
797
|
-
h -1`,
|
|
829
|
+
h -1`, Pt = (r, i) => `M ${r + 1} ${i}
|
|
798
830
|
v 1
|
|
799
831
|
h -0.5
|
|
800
832
|
a 0.5 0.5, 0, 0, 1, -0.5 -0.5
|
|
801
833
|
v -0.5
|
|
802
|
-
h 1`,
|
|
834
|
+
h 1`, j = (r, i) => `M ${r} ${i}
|
|
803
835
|
v 1
|
|
804
836
|
h 0.5
|
|
805
|
-
a 0.5 0.5, 0, 0, 0, 0 -1`,
|
|
837
|
+
a 0.5 0.5, 0, 0, 0, 0 -1`, V = (r, i) => `M ${r + 1} ${i}
|
|
806
838
|
v 1
|
|
807
839
|
h -0.5
|
|
808
|
-
a 0.5 0.5, 0, 0, 1, 0 -1`,
|
|
840
|
+
a 0.5 0.5, 0, 0, 1, 0 -1`, X = (r, i) => `M ${r} ${i + 1}
|
|
809
841
|
h 1
|
|
810
842
|
v -0.5
|
|
811
|
-
a 0.5 0.5, 0, 0, 0, -1 0`,
|
|
843
|
+
a 0.5 0.5, 0, 0, 0, -1 0`, Z = (r, i) => `M ${r} ${i}
|
|
812
844
|
h 1
|
|
813
845
|
v 0.5
|
|
814
|
-
a 0.5 0.5, 0, 0, 1, -1 0`,
|
|
846
|
+
a 0.5 0.5, 0, 0, 1, -1 0`, Ot = (r, i, a) => `M ${r + 1} ${i}h -${a / 2}a ${a / 2.5} ${a / 2.5}, 0, 0, 0, ${-a / 2.5} ${a / 2.5}v ${a / 2}h ${a / 2}a ${a / 2.5} ${a / 2.5}, 0, 0, 0, ${a / 2.5} ${-a / 2.5}`, Tt = ({
|
|
815
847
|
x: r,
|
|
816
|
-
y:
|
|
817
|
-
numCells:
|
|
848
|
+
y: i,
|
|
849
|
+
numCells: a
|
|
818
850
|
}) => {
|
|
819
|
-
var
|
|
820
|
-
return !!((
|
|
821
|
-
},
|
|
851
|
+
var s, n, l;
|
|
852
|
+
return !!((s = H[r]) != null && s[i] || (n = H[r - a + 7]) != null && n[i] || (l = H[r]) != null && l[i - a + 7]);
|
|
853
|
+
}, Lt = ({
|
|
822
854
|
x: r,
|
|
823
|
-
y:
|
|
824
|
-
radius:
|
|
855
|
+
y: i,
|
|
856
|
+
radius: a
|
|
825
857
|
}) => {
|
|
826
|
-
const
|
|
827
|
-
return `M ${r} ${
|
|
828
|
-
},
|
|
858
|
+
const s = O - a, n = a / 2, l = O - n;
|
|
859
|
+
return `M ${r} ${i + n}v ${s}a ${n} ${n}, 0, 0, 0, ${n} ${n}h ${l}v ${-l}a ${n} ${n}, 0, 0, 0, ${-n} ${-n}h ${-s}H ${r}z`;
|
|
860
|
+
}, vt = ({
|
|
829
861
|
x: r,
|
|
830
|
-
y:
|
|
831
|
-
radius:
|
|
862
|
+
y: i,
|
|
863
|
+
radius: a
|
|
832
864
|
}) => {
|
|
833
|
-
const
|
|
834
|
-
return `M ${r} ${
|
|
835
|
-
},
|
|
865
|
+
const s = O - a, n = a / 2, l = O - n;
|
|
866
|
+
return `M ${r} ${i + n}v ${s}a ${n} ${n}, 0, 0, 0, ${n} ${n}h ${l}v ${-l}a ${n} ${n}, 0, 0, 0, ${-n} ${-n}h ${-s}a ${n} ${n}, 0, 0, 0, ${-n} ${n}`;
|
|
867
|
+
}, St = ({
|
|
836
868
|
x: r,
|
|
837
|
-
y:
|
|
838
|
-
numCells:
|
|
869
|
+
y: i,
|
|
870
|
+
numCells: a
|
|
839
871
|
}) => {
|
|
840
|
-
var
|
|
841
|
-
return !!((
|
|
842
|
-
},
|
|
872
|
+
var s, n, l;
|
|
873
|
+
return !!((s = B[r]) != null && s[i] || (n = B[r - a + 7]) != null && n[i] || (l = B[r]) != null && l[i - a + 7]);
|
|
874
|
+
}, Ut = ({
|
|
843
875
|
x: r,
|
|
844
|
-
y:
|
|
845
|
-
radius:
|
|
876
|
+
y: i,
|
|
877
|
+
radius: a
|
|
846
878
|
}) => {
|
|
847
|
-
const
|
|
848
|
-
return `M ${r} ${
|
|
849
|
-
},
|
|
879
|
+
const s = g - a, n = a / 2;
|
|
880
|
+
return `M ${r} ${i + n}v ${s}a ${n} ${n}, 0, 0, 0, ${n} ${n}h ${s}a ${n} ${n}, 0, 0, 0, ${n} ${-n}v ${-s}a ${n} ${n}, 0, 0, 0, ${-n} ${-n}h ${-s}a ${n} ${n}, 0, 0, 0, ${-n} ${n}M ${r + n} ${i + 1}h ${s}a ${n - 1} ${n - 1}, 0, 0, 1, ${n - 1} ${n - 1}v ${s}a ${n - 1} ${n - 1}, 0, 0, 1, ${-(n - 1)} ${n - 1}h ${-s}a ${n - 1} ${n - 1}, 0, 0, 1, ${-(n - 1)} ${-(n - 1)}v ${-s}a ${n - 1} ${n - 1}, 0, 0, 1, ${n - 1} ${-(n - 1)}`;
|
|
881
|
+
}, bt = ({
|
|
850
882
|
x: r,
|
|
851
|
-
y:
|
|
852
|
-
radius:
|
|
883
|
+
y: i,
|
|
884
|
+
radius: a
|
|
853
885
|
}) => {
|
|
854
|
-
const
|
|
855
|
-
return `M ${r} ${
|
|
856
|
-
},
|
|
886
|
+
const s = g - a, n = a / 2, l = g - n;
|
|
887
|
+
return `M ${r} ${i + n}v ${s}a ${n} ${n}, 0, 0, 0, ${n} ${n}h ${l}v ${-l}a ${n} ${n}, 0, 0, 0, ${-n} ${-n}h ${-s}H ${r}zM ${r + n} ${i + 1}h ${s}a ${n - 1} ${n - 1}, 0, 0, 1, ${n - 1} ${n - 1}v ${l - 1}h ${-(l - 1)}a ${n - 1} ${n - 1}, 0, 0, 1, ${-(n - 1)} ${-(n - 1)}v ${-(l - 1)}z`;
|
|
888
|
+
}, Dt = ({
|
|
857
889
|
x: r,
|
|
858
|
-
y:
|
|
859
|
-
radius:
|
|
890
|
+
y: i,
|
|
891
|
+
radius: a
|
|
860
892
|
}) => {
|
|
861
|
-
const
|
|
862
|
-
return `M ${r} ${
|
|
863
|
-
},
|
|
864
|
-
color: (r == null ? void 0 : r.color) ||
|
|
865
|
-
style: (r == null ? void 0 : r.style) ||
|
|
893
|
+
const s = g - a, n = a / 2, l = g - n;
|
|
894
|
+
return `M ${r} ${i + n}v ${s}a ${n} ${n}, 0, 0, 0, ${n} ${n}h ${l}v ${-l}a ${n} ${n}, 0, 0, 0, ${-n} ${-n}h ${-s}a ${n} ${n}, 0, 0, 0, ${-n} ${n}M ${r + n} ${i + 1}h ${s}a ${n - 1} ${n - 1}, 0, 0, 1, ${n - 1} ${n - 1}v ${l - 1}h ${-(l - 1)}a ${n - 1} ${n - 1}, 0, 0, 1, ${-(n - 1)} ${-(n - 1)}v ${-s}a ${n - 1} ${n - 1}, 0, 0, 1, ${n - 1} ${-(n - 1)}`;
|
|
895
|
+
}, yt = (r) => ({
|
|
896
|
+
color: (r == null ? void 0 : r.color) || _,
|
|
897
|
+
style: (r == null ? void 0 : r.style) || mt,
|
|
866
898
|
randomSize: (r == null ? void 0 : r.randomSize) || !1
|
|
867
|
-
}),
|
|
868
|
-
color: (r == null ? void 0 : r.color) ||
|
|
869
|
-
style: (r == null ? void 0 : r.style) || dt
|
|
870
|
-
}), Dt = (r) => ({
|
|
871
|
-
color: (r == null ? void 0 : r.color) || x,
|
|
899
|
+
}), Ft = (r) => ({
|
|
900
|
+
color: (r == null ? void 0 : r.color) || _,
|
|
872
901
|
style: (r == null ? void 0 : r.style) || ft
|
|
873
|
-
}),
|
|
902
|
+
}), Bt = (r) => ({
|
|
903
|
+
color: (r == null ? void 0 : r.color) || _,
|
|
904
|
+
style: (r == null ? void 0 : r.style) || pt
|
|
905
|
+
}), Ht = ({
|
|
874
906
|
modules: r,
|
|
875
|
-
margin:
|
|
876
|
-
settings:
|
|
877
|
-
gradient:
|
|
907
|
+
margin: i,
|
|
908
|
+
settings: a,
|
|
909
|
+
gradient: s
|
|
878
910
|
}) => {
|
|
879
|
-
const { color:
|
|
880
|
-
() =>
|
|
881
|
-
[
|
|
882
|
-
), u = [],
|
|
883
|
-
() =>
|
|
884
|
-
[
|
|
911
|
+
const { color: n, style: l, randomSize: d } = L(
|
|
912
|
+
() => yt(a),
|
|
913
|
+
[a]
|
|
914
|
+
), u = [], N = r.length, o = It(l) && d, t = it(
|
|
915
|
+
() => Ct(l, o),
|
|
916
|
+
[l, o]
|
|
885
917
|
);
|
|
886
|
-
return r.forEach((
|
|
887
|
-
|
|
888
|
-
if (
|
|
918
|
+
return r.forEach((e, c) => {
|
|
919
|
+
e.forEach((h, f) => {
|
|
920
|
+
if (St({ x: f, y: c, numCells: N }) || Tt({ x: f, y: c, numCells: N }))
|
|
889
921
|
return;
|
|
890
|
-
const
|
|
922
|
+
const $ = t(), p = 1 * $, M = (1 - 1 * $) / 2, E = f + i + M, m = c + i + M;
|
|
891
923
|
if (h) {
|
|
892
|
-
if (
|
|
893
|
-
u.push(
|
|
894
|
-
else if (
|
|
895
|
-
u.push(
|
|
896
|
-
else if (
|
|
897
|
-
u.push(
|
|
898
|
-
else if (
|
|
924
|
+
if (l === "square" || l === "square-sm")
|
|
925
|
+
u.push(U(E, m, p));
|
|
926
|
+
else if (l === "pinched-square")
|
|
927
|
+
u.push(ot(E, m, p, 0.25));
|
|
928
|
+
else if (l === "circle")
|
|
929
|
+
u.push(y(E, m, p));
|
|
930
|
+
else if (l === "diamond")
|
|
931
|
+
u.push(wt(E, m, p));
|
|
932
|
+
else if (l === "star")
|
|
899
933
|
u.push(
|
|
900
934
|
et(E + p / 2, m + p / 2, p * 1.1, W)
|
|
901
935
|
);
|
|
902
|
-
else if (
|
|
903
|
-
u.push(
|
|
904
|
-
else if (
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
936
|
+
else if (l === "heart")
|
|
937
|
+
u.push(rt(E, m, p));
|
|
938
|
+
else if (l === "hashtag")
|
|
939
|
+
u.push(nt(E, m, p));
|
|
940
|
+
else if (l === "rounded") {
|
|
941
|
+
const { left: R, right: I, top: C, bottom: A, count: P } = D(f, c, r);
|
|
942
|
+
P === 0 ? u.push(y(E, m, 1)) : P > 2 || R && I || C && A ? u.push(U(E, m, 1)) : P === 2 ? R && C ? u.push(G(E, m)) : C && I ? u.push(Pt(E, m)) : I && A ? u.push(Y(E, m)) : u.push(At(E, m)) : C ? u.push(Z(E, m)) : I ? u.push(V(E, m)) : A ? u.push(X(E, m)) : u.push(j(E, m));
|
|
943
|
+
} else if (l === "leaf") {
|
|
944
|
+
const { left: R, right: I, top: C, bottom: A, count: P } = D(f, c, r);
|
|
909
945
|
if (P === 0)
|
|
910
|
-
u.push(
|
|
911
|
-
else if (!R && !
|
|
912
|
-
u.push(
|
|
946
|
+
u.push(Ot(E, m, p));
|
|
947
|
+
else if (!R && !C) {
|
|
948
|
+
u.push(Y(E, m));
|
|
913
949
|
return;
|
|
914
|
-
} else !
|
|
915
|
-
} else if (
|
|
916
|
-
const { left: R, right:
|
|
917
|
-
P === 0 || R && !(
|
|
918
|
-
} else if (
|
|
919
|
-
const { left: R, right:
|
|
920
|
-
P === 0 ||
|
|
950
|
+
} else !I && !A ? u.push(G(E, m)) : u.push(U(E, m, 1));
|
|
951
|
+
} else if (l === "vertical-line") {
|
|
952
|
+
const { left: R, right: I, top: C, bottom: A, count: P } = D(f, c, r);
|
|
953
|
+
P === 0 || R && !(C || A) || I && !(C || A) ? u.push(y(E, m, 1)) : C && A ? u.push(U(E, m, 1)) : C && !A ? u.push(Z(E, m)) : A && !C && u.push(X(E, m));
|
|
954
|
+
} else if (l === "horizontal-line") {
|
|
955
|
+
const { left: R, right: I, top: C, bottom: A, count: P } = D(f, c, r);
|
|
956
|
+
P === 0 || C && !(R || I) || A && !(R || I) ? u.push(y(E, m, 1)) : R && I ? u.push(U(E, m, 1)) : R && !I ? u.push(j(E, m)) : I && !R && u.push(V(E, m));
|
|
921
957
|
}
|
|
922
958
|
}
|
|
923
959
|
});
|
|
924
|
-
}), /* @__PURE__ */
|
|
960
|
+
}), /* @__PURE__ */ w(
|
|
925
961
|
"path",
|
|
926
962
|
{
|
|
927
|
-
fill:
|
|
963
|
+
fill: s ? `url(#${b})` : n,
|
|
928
964
|
d: u.join(""),
|
|
929
|
-
shapeRendering:
|
|
965
|
+
shapeRendering: l === "square" ? "crispEdges" : "geometricPrecision",
|
|
930
966
|
"data-testid": "data-modules"
|
|
931
967
|
}
|
|
932
968
|
);
|
|
933
|
-
},
|
|
969
|
+
}, T = {
|
|
934
970
|
"data-testid": "finder-patterns-inner"
|
|
935
|
-
},
|
|
971
|
+
}, _t = ({
|
|
936
972
|
modules: r,
|
|
937
|
-
margin:
|
|
938
|
-
settings:
|
|
939
|
-
gradient:
|
|
973
|
+
margin: i,
|
|
974
|
+
settings: a,
|
|
975
|
+
gradient: s
|
|
940
976
|
}) => {
|
|
941
|
-
const { color:
|
|
942
|
-
() =>
|
|
943
|
-
[
|
|
944
|
-
), d =
|
|
977
|
+
const { color: n, style: l } = L(
|
|
978
|
+
() => Bt(a),
|
|
979
|
+
[a]
|
|
980
|
+
), d = s ? `url(#${b})` : n, u = L(
|
|
945
981
|
() => [
|
|
946
|
-
{ x:
|
|
947
|
-
{ x: r.length +
|
|
948
|
-
{ x:
|
|
982
|
+
{ x: i + 2, y: i + 2 },
|
|
983
|
+
{ x: r.length + i - g + 2, y: i + 2 },
|
|
984
|
+
{ x: i + 2, y: r.length + i - g + 2 }
|
|
949
985
|
],
|
|
950
|
-
[
|
|
951
|
-
),
|
|
952
|
-
if (
|
|
953
|
-
return u.map((
|
|
954
|
-
const { x:
|
|
955
|
-
return /* @__PURE__ */
|
|
986
|
+
[i, r.length]
|
|
987
|
+
), N = (o, t) => `finder-patterns-inner-${l}-${o}-${t}`;
|
|
988
|
+
if (l === "rounded-sm" || l === "rounded" || l === "rounded-lg" || l === "circle" || l === "square")
|
|
989
|
+
return u.map((o) => {
|
|
990
|
+
const { x: t, y: e } = o;
|
|
991
|
+
return /* @__PURE__ */ w(
|
|
956
992
|
"rect",
|
|
957
993
|
{
|
|
958
|
-
x:
|
|
959
|
-
y:
|
|
960
|
-
width:
|
|
961
|
-
height:
|
|
994
|
+
x: t,
|
|
995
|
+
y: e,
|
|
996
|
+
width: O,
|
|
997
|
+
height: O,
|
|
962
998
|
fill: d,
|
|
963
|
-
rx:
|
|
964
|
-
...
|
|
999
|
+
rx: k[l],
|
|
1000
|
+
...T
|
|
965
1001
|
},
|
|
966
|
-
|
|
1002
|
+
N(t, e)
|
|
967
1003
|
);
|
|
968
1004
|
});
|
|
969
|
-
if (
|
|
970
|
-
return u.map((
|
|
971
|
-
const { x:
|
|
972
|
-
return /* @__PURE__ */
|
|
1005
|
+
if (l === "pinched-square")
|
|
1006
|
+
return u.map((o) => {
|
|
1007
|
+
const { x: t, y: e } = o, c = ot(t, e, O, 0.25);
|
|
1008
|
+
return /* @__PURE__ */ w("path", { fill: d, d: c, ...T }, N(t, e));
|
|
1009
|
+
});
|
|
1010
|
+
if (l === "diamond")
|
|
1011
|
+
return u.map((o) => {
|
|
1012
|
+
const { x: t, y: e } = o, c = Math.sqrt(1.5), h = O / c, f = h - h / c;
|
|
1013
|
+
return /* @__PURE__ */ w(
|
|
973
1014
|
"rect",
|
|
974
1015
|
{
|
|
975
|
-
x:
|
|
976
|
-
y:
|
|
1016
|
+
x: t + f / 2,
|
|
1017
|
+
y: e + f / 2,
|
|
977
1018
|
width: h,
|
|
978
1019
|
height: h,
|
|
979
1020
|
fill: d,
|
|
@@ -982,263 +1023,277 @@ const tt = (r) => {
|
|
|
982
1023
|
transformOrigin: "center",
|
|
983
1024
|
transformBox: "fill-box"
|
|
984
1025
|
},
|
|
985
|
-
...
|
|
1026
|
+
...T
|
|
986
1027
|
},
|
|
987
|
-
|
|
1028
|
+
N(t, e)
|
|
988
1029
|
);
|
|
989
1030
|
});
|
|
990
|
-
if (
|
|
991
|
-
const
|
|
992
|
-
return u.map((
|
|
993
|
-
...
|
|
994
|
-
rotation: J[
|
|
995
|
-
})).map(({ x:
|
|
996
|
-
const h =
|
|
997
|
-
x:
|
|
998
|
-
y:
|
|
999
|
-
radius:
|
|
1031
|
+
if (l === "inpoint-sm" || l === "inpoint" || l === "inpoint-lg" || l === "outpoint-sm" || l === "outpoint" || l === "outpoint-lg" || l === "leaf-sm" || l === "leaf" || l === "leaf-lg") {
|
|
1032
|
+
const o = l === "leaf-sm" || l === "leaf" || l === "leaf-lg" ? Lt : vt;
|
|
1033
|
+
return u.map((t, e) => ({
|
|
1034
|
+
...t,
|
|
1035
|
+
rotation: J[l][e]
|
|
1036
|
+
})).map(({ x: t, y: e, rotation: c }) => {
|
|
1037
|
+
const h = o({
|
|
1038
|
+
x: t,
|
|
1039
|
+
y: e,
|
|
1040
|
+
radius: k[l]
|
|
1000
1041
|
});
|
|
1001
|
-
return /* @__PURE__ */
|
|
1042
|
+
return /* @__PURE__ */ w(
|
|
1002
1043
|
"path",
|
|
1003
1044
|
{
|
|
1004
1045
|
fill: d,
|
|
1005
1046
|
d: h,
|
|
1006
1047
|
style: {
|
|
1007
|
-
transform: `rotate(${
|
|
1048
|
+
transform: `rotate(${c}deg)`,
|
|
1008
1049
|
transformOrigin: "center",
|
|
1009
1050
|
transformBox: "fill-box"
|
|
1010
1051
|
},
|
|
1011
|
-
...
|
|
1052
|
+
...T
|
|
1012
1053
|
},
|
|
1013
|
-
|
|
1054
|
+
N(t, e)
|
|
1014
1055
|
);
|
|
1015
1056
|
});
|
|
1016
1057
|
}
|
|
1017
|
-
if (
|
|
1018
|
-
return u.map(({ x:
|
|
1058
|
+
if (l === "heart")
|
|
1059
|
+
return u.map(({ x: o, y: t }) => /* @__PURE__ */ w(
|
|
1019
1060
|
"path",
|
|
1020
1061
|
{
|
|
1021
1062
|
fill: d,
|
|
1022
|
-
d:
|
|
1023
|
-
...
|
|
1063
|
+
d: rt(o, t, O),
|
|
1064
|
+
...T
|
|
1024
1065
|
},
|
|
1025
|
-
|
|
1066
|
+
N(o, t)
|
|
1026
1067
|
));
|
|
1027
|
-
if (
|
|
1028
|
-
return u.map(({ x:
|
|
1029
|
-
const
|
|
1030
|
-
return /* @__PURE__ */
|
|
1068
|
+
if (l === "star")
|
|
1069
|
+
return u.map(({ x: o, y: t }) => {
|
|
1070
|
+
const e = o + O / 2, c = t + O / 2, h = et(e, c, O * 1.2, W);
|
|
1071
|
+
return /* @__PURE__ */ w("path", { fill: d, d: h, ...T }, N(o, t));
|
|
1072
|
+
});
|
|
1073
|
+
if (l === "hashtag")
|
|
1074
|
+
return u.map(({ x: o, y: t }) => {
|
|
1075
|
+
const e = nt(o - 0.25, t - 0.25, 3.5);
|
|
1076
|
+
return /* @__PURE__ */ w("path", { fill: d, d: e, ...T }, N(o, t));
|
|
1031
1077
|
});
|
|
1032
|
-
},
|
|
1078
|
+
}, x = {
|
|
1033
1079
|
"data-testid": "finder-patterns-outer"
|
|
1034
1080
|
}, zt = ({
|
|
1035
1081
|
modules: r,
|
|
1036
|
-
margin:
|
|
1037
|
-
settings:
|
|
1038
|
-
gradient:
|
|
1082
|
+
margin: i,
|
|
1083
|
+
settings: a,
|
|
1084
|
+
gradient: s
|
|
1039
1085
|
}) => {
|
|
1040
|
-
const { style:
|
|
1041
|
-
() =>
|
|
1042
|
-
[
|
|
1043
|
-
), d =
|
|
1086
|
+
const { style: n, color: l } = L(
|
|
1087
|
+
() => Ft(a),
|
|
1088
|
+
[a]
|
|
1089
|
+
), d = s ? `url(#${b})` : l, u = [], N = L(
|
|
1044
1090
|
() => [
|
|
1045
|
-
{ x:
|
|
1046
|
-
{ x: r.length +
|
|
1047
|
-
{ x:
|
|
1091
|
+
{ x: i, y: i },
|
|
1092
|
+
{ x: r.length + i - g, y: i },
|
|
1093
|
+
{ x: i, y: r.length + i - g }
|
|
1048
1094
|
],
|
|
1049
|
-
[
|
|
1095
|
+
[i, r.length]
|
|
1050
1096
|
);
|
|
1051
|
-
if ([
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1097
|
+
if ([
|
|
1098
|
+
"rounded-sm",
|
|
1099
|
+
"rounded",
|
|
1100
|
+
"rounded-lg",
|
|
1101
|
+
"circle",
|
|
1102
|
+
"square",
|
|
1103
|
+
"pinched-square"
|
|
1104
|
+
].includes(n)) {
|
|
1105
|
+
for (const o of N) {
|
|
1106
|
+
const { x: t, y: e } = o;
|
|
1107
|
+
n === "rounded-sm" || n === "rounded" || n === "rounded-lg" ? u.push(
|
|
1108
|
+
Ut({
|
|
1109
|
+
x: t,
|
|
1110
|
+
y: e,
|
|
1111
|
+
radius: Q[n]
|
|
1059
1112
|
})
|
|
1060
|
-
) :
|
|
1061
|
-
`M ${
|
|
1113
|
+
) : n === "circle" ? u.push(
|
|
1114
|
+
`M ${t + g / 2} ${e}a ${g / 2} ${g / 2} 0 1 0 0.01 0zzm 0 1a ${g / 2 - 1} ${g / 2 - 1} 0 1 1 -0.01 0Z`
|
|
1115
|
+
) : n === "pinched-square" ? u.push(
|
|
1116
|
+
`M ${t} ${e}Q ${t + 0.5} ${e + g / 2}, ${t} ${e + g}Q ${t + g / 2} ${e + g - 0.5}, ${t + g} ${e + g}Q ${t + g - 0.5} ${e + g / 2}, ${t + g} ${e}Q ${t + g / 2} ${e + 0.5}, ${t} ${e}zM ${t + 1} ${e + 1}Q ${t + g / 2} ${e + 1.25}, ${t + g - 1} ${e + 1}Q ${t + g - 1.25} ${e + g / 2}, ${t + g - 1} ${e + g - 1}Q ${t + g / 2} ${e + g - 1.25}, ${t + 1} ${e + g - 1}Q ${t + 1.25} ${e + g / 2}, ${t + 1} ${e + 1}z`
|
|
1062
1117
|
) : u.push(
|
|
1063
|
-
`M ${
|
|
1118
|
+
`M ${t} ${e}v ${g}h ${g}v -7zM ${t + 1} ${e + 1}h ${g - 2}v ${g - 2}h -5z`
|
|
1064
1119
|
);
|
|
1065
1120
|
}
|
|
1066
|
-
return /* @__PURE__ */
|
|
1121
|
+
return /* @__PURE__ */ w("path", { fill: d, d: u.join(""), ...x });
|
|
1067
1122
|
}
|
|
1068
|
-
if (
|
|
1069
|
-
const
|
|
1070
|
-
return
|
|
1071
|
-
...
|
|
1072
|
-
rotation: J[
|
|
1073
|
-
})).map(({ x:
|
|
1074
|
-
const h =
|
|
1075
|
-
x:
|
|
1076
|
-
y:
|
|
1077
|
-
radius:
|
|
1123
|
+
if (n === "inpoint-sm" || n === "inpoint" || n === "inpoint-lg" || n === "outpoint-sm" || n === "outpoint" || n === "outpoint-lg" || n === "leaf-sm" || n === "leaf" || n === "leaf-lg") {
|
|
1124
|
+
const o = n === "leaf-sm" || n === "leaf" || n === "leaf-lg" ? bt : Dt;
|
|
1125
|
+
return N.map((t, e) => ({
|
|
1126
|
+
...t,
|
|
1127
|
+
rotation: J[n][e]
|
|
1128
|
+
})).map(({ x: t, y: e, rotation: c }) => {
|
|
1129
|
+
const h = o({
|
|
1130
|
+
x: t,
|
|
1131
|
+
y: e,
|
|
1132
|
+
radius: Q[n]
|
|
1078
1133
|
});
|
|
1079
|
-
return /* @__PURE__ */
|
|
1134
|
+
return /* @__PURE__ */ w(
|
|
1080
1135
|
"path",
|
|
1081
1136
|
{
|
|
1082
1137
|
fill: d,
|
|
1083
1138
|
d: h,
|
|
1084
1139
|
style: {
|
|
1085
|
-
transform: `rotate(${
|
|
1140
|
+
transform: `rotate(${c}deg)`,
|
|
1086
1141
|
transformOrigin: "center",
|
|
1087
1142
|
transformBox: "fill-box"
|
|
1088
1143
|
},
|
|
1089
|
-
...
|
|
1144
|
+
...x
|
|
1090
1145
|
},
|
|
1091
|
-
`finder-patterns-outer-${
|
|
1146
|
+
`finder-patterns-outer-${n}-${t}-${e}`
|
|
1092
1147
|
);
|
|
1093
1148
|
});
|
|
1094
1149
|
}
|
|
1095
|
-
},
|
|
1096
|
-
var
|
|
1150
|
+
}, Qt = ({ gradient: r }) => {
|
|
1151
|
+
var a, s;
|
|
1097
1152
|
if (!r)
|
|
1098
1153
|
return null;
|
|
1099
|
-
const
|
|
1100
|
-
return /* @__PURE__ */
|
|
1154
|
+
const i = tt((r == null ? void 0 : r.rotation) || 0);
|
|
1155
|
+
return /* @__PURE__ */ w("defs", { children: r.type === "linear" ? /* @__PURE__ */ w("linearGradient", { id: b, gradientUnits: "userSpaceOnUse", ...i, children: (a = r.stops) == null ? void 0 : a.map((n, l) => /* @__PURE__ */ w("stop", { offset: n.offset, stopColor: n.color }, l)) }) : /* @__PURE__ */ w(
|
|
1101
1156
|
"radialGradient",
|
|
1102
1157
|
{
|
|
1103
|
-
id:
|
|
1158
|
+
id: b,
|
|
1104
1159
|
gradientUnits: "userSpaceOnUse",
|
|
1105
1160
|
cx: "50%",
|
|
1106
1161
|
cy: "50%",
|
|
1107
1162
|
r: "50%",
|
|
1108
|
-
children: (
|
|
1163
|
+
children: (s = r.stops) == null ? void 0 : s.map((n, l) => /* @__PURE__ */ w("stop", { offset: n.offset, stopColor: n.color }, l))
|
|
1109
1164
|
}
|
|
1110
1165
|
) });
|
|
1111
|
-
}, kt = (r,
|
|
1112
|
-
if (
|
|
1166
|
+
}, kt = (r, i) => r.slice().map((a, s) => s < i.y || s >= i.y + i.h ? a : a.map((n, l) => l < i.x || l >= i.x + i.w ? n : !1)), qt = (r, i, a, s) => {
|
|
1167
|
+
if (s == null)
|
|
1113
1168
|
return null;
|
|
1114
|
-
const
|
|
1115
|
-
let
|
|
1116
|
-
if (
|
|
1117
|
-
const
|
|
1118
|
-
|
|
1169
|
+
const n = r.length + a * 2, l = Math.floor(i * Mt), d = n / i, u = (s.width || l) * d, N = (s.height || l) * d, o = s.x == null ? r.length / 2 - u / 2 : s.x * d, t = s.y == null ? r.length / 2 - N / 2 : s.y * d, e = s.opacity == null ? 1 : s.opacity;
|
|
1170
|
+
let c = null;
|
|
1171
|
+
if (s.excavate) {
|
|
1172
|
+
const f = Math.floor(o), $ = Math.floor(t), p = Math.ceil(u + o - f), M = Math.ceil(N + t - $);
|
|
1173
|
+
c = { x: f, y: $, w: p, h: M };
|
|
1119
1174
|
}
|
|
1120
|
-
const h =
|
|
1121
|
-
return { x:
|
|
1122
|
-
}, Yt = (r) => r != null ? Math.max(Math.floor(r), 0) :
|
|
1175
|
+
const h = s.crossOrigin;
|
|
1176
|
+
return { x: o, y: t, h: N, w: u, excavation: c, opacity: e, crossOrigin: h };
|
|
1177
|
+
}, Yt = (r) => r != null ? Math.max(Math.floor(r), 0) : $t, Gt = ({
|
|
1123
1178
|
value: r,
|
|
1124
|
-
level:
|
|
1125
|
-
minVersion:
|
|
1126
|
-
marginSize:
|
|
1127
|
-
imageSettings:
|
|
1128
|
-
size:
|
|
1179
|
+
level: i,
|
|
1180
|
+
minVersion: a,
|
|
1181
|
+
marginSize: s,
|
|
1182
|
+
imageSettings: n,
|
|
1183
|
+
size: l,
|
|
1129
1184
|
boostLevel: d
|
|
1130
1185
|
}) => {
|
|
1131
1186
|
const u = L(() => {
|
|
1132
|
-
const h = (Array.isArray(r) ? r : [r]).reduce((
|
|
1133
|
-
return
|
|
1187
|
+
const h = (Array.isArray(r) ? r : [r]).reduce((f, $) => (f.push(...S.QrSegment.makeSegments($)), f), []);
|
|
1188
|
+
return S.QrCode.encodeSegments(
|
|
1134
1189
|
h,
|
|
1135
|
-
|
|
1136
|
-
|
|
1190
|
+
lt[i],
|
|
1191
|
+
a,
|
|
1137
1192
|
void 0,
|
|
1138
1193
|
void 0,
|
|
1139
1194
|
d
|
|
1140
1195
|
);
|
|
1141
|
-
}, [r,
|
|
1142
|
-
const
|
|
1196
|
+
}, [r, i, a, d]), { cells: N, margin: o, numCells: t, calculatedImageSettings: e } = L(() => {
|
|
1197
|
+
const c = u.getModules(), h = Yt(s), f = c.length + h * 2, $ = qt(c, l, h, n);
|
|
1143
1198
|
return {
|
|
1144
|
-
cells:
|
|
1199
|
+
cells: c,
|
|
1145
1200
|
margin: h,
|
|
1146
|
-
numCells:
|
|
1147
|
-
calculatedImageSettings:
|
|
1201
|
+
numCells: f,
|
|
1202
|
+
calculatedImageSettings: $
|
|
1148
1203
|
};
|
|
1149
|
-
}, [u,
|
|
1204
|
+
}, [u, l, n, s]);
|
|
1150
1205
|
return {
|
|
1151
1206
|
qrcode: u,
|
|
1152
|
-
margin:
|
|
1153
|
-
cells:
|
|
1154
|
-
numCells:
|
|
1155
|
-
calculatedImageSettings:
|
|
1207
|
+
margin: o,
|
|
1208
|
+
cells: N,
|
|
1209
|
+
numCells: t,
|
|
1210
|
+
calculatedImageSettings: e
|
|
1156
1211
|
};
|
|
1157
|
-
},
|
|
1212
|
+
}, jt = ({ svgRef: r, fileSize: i, fileName: a }) => {
|
|
1158
1213
|
if (!r.current) return;
|
|
1159
|
-
const
|
|
1160
|
-
|
|
1161
|
-
const
|
|
1214
|
+
const s = r.current.cloneNode(!0);
|
|
1215
|
+
s.setAttribute("width", i.toString()), s.setAttribute("height", i.toString());
|
|
1216
|
+
const n = new XMLSerializer(), l = new Blob([n.serializeToString(s)], {
|
|
1162
1217
|
type: "image/svg+xml"
|
|
1163
|
-
}), d = URL.createObjectURL(
|
|
1164
|
-
u.href = d, u.download = `${
|
|
1165
|
-
},
|
|
1218
|
+
}), d = URL.createObjectURL(l), u = document.createElement("a");
|
|
1219
|
+
u.href = d, u.download = `${a}.svg`, document.body.appendChild(u), u.click(), document.body.removeChild(u), URL.revokeObjectURL(d);
|
|
1220
|
+
}, Vt = ({
|
|
1166
1221
|
svgRef: r,
|
|
1167
|
-
fileSize:
|
|
1168
|
-
fileName:
|
|
1169
|
-
fileFormat:
|
|
1170
|
-
imageSettings:
|
|
1171
|
-
calculatedImageSettings:
|
|
1222
|
+
fileSize: i,
|
|
1223
|
+
fileName: a,
|
|
1224
|
+
fileFormat: s,
|
|
1225
|
+
imageSettings: n,
|
|
1226
|
+
calculatedImageSettings: l,
|
|
1172
1227
|
size: d,
|
|
1173
1228
|
numCells: u,
|
|
1174
|
-
margin:
|
|
1229
|
+
margin: N
|
|
1175
1230
|
}) => {
|
|
1176
1231
|
if (!r.current) return;
|
|
1177
|
-
const
|
|
1178
|
-
if (!
|
|
1179
|
-
|
|
1180
|
-
const
|
|
1181
|
-
|
|
1182
|
-
if (
|
|
1183
|
-
const
|
|
1184
|
-
|
|
1185
|
-
const p =
|
|
1186
|
-
|
|
1187
|
-
const
|
|
1188
|
-
|
|
1189
|
-
},
|
|
1232
|
+
const o = document.createElement("canvas"), t = o.getContext("2d");
|
|
1233
|
+
if (!t) return;
|
|
1234
|
+
o.width = i, o.height = i;
|
|
1235
|
+
const e = new XMLSerializer().serializeToString(r.current), c = new Blob([e], { type: "image/svg+xml;charset=utf-8" }), h = URL.createObjectURL(c), f = new Image();
|
|
1236
|
+
f.crossOrigin = "anonymous", f.src = h, f.onload = () => {
|
|
1237
|
+
if (t.drawImage(f, 0, 0, i, i), URL.revokeObjectURL(h), n != null && n.src && l) {
|
|
1238
|
+
const $ = new Image();
|
|
1239
|
+
$.crossOrigin = "anonymous", $.src = n.src, $.onload = () => {
|
|
1240
|
+
const p = i / d, M = u / i, E = n.width * p, m = n.x ? (l.x + N) / M : (i - E) / 2, R = n.y ? (l.y + N) / M : (i - E) / 2;
|
|
1241
|
+
t.drawImage($, m, R, E, E);
|
|
1242
|
+
const I = s === "png" ? "image/png" : "image/jpeg", C = document.createElement("a");
|
|
1243
|
+
C.href = o.toDataURL(I), C.download = `${a}.${s}`, document.body.appendChild(C), C.click(), document.body.removeChild(C);
|
|
1244
|
+
}, $.onerror = (p) => console.error("Error loading logo:", p);
|
|
1190
1245
|
} else {
|
|
1191
|
-
const
|
|
1192
|
-
p.href =
|
|
1246
|
+
const $ = s === "png" ? "image/png" : "image/jpeg", p = document.createElement("a");
|
|
1247
|
+
p.href = o.toDataURL($), p.download = `${a}.${s}`, document.body.appendChild(p), p.click(), document.body.removeChild(p);
|
|
1193
1248
|
}
|
|
1194
|
-
},
|
|
1249
|
+
}, f.onerror = ($) => console.error("Error loading QR code:", $);
|
|
1195
1250
|
}, Xt = (r) => {
|
|
1196
1251
|
const {
|
|
1197
|
-
ref:
|
|
1198
|
-
value:
|
|
1199
|
-
size:
|
|
1200
|
-
level:
|
|
1201
|
-
background:
|
|
1252
|
+
ref: i,
|
|
1253
|
+
value: a,
|
|
1254
|
+
size: s = ht,
|
|
1255
|
+
level: n = ut,
|
|
1256
|
+
background: l,
|
|
1202
1257
|
gradient: d,
|
|
1203
|
-
minVersion: u =
|
|
1204
|
-
boostLevel:
|
|
1205
|
-
marginSize:
|
|
1206
|
-
finderPatternOuterSettings:
|
|
1207
|
-
finderPatternInnerSettings:
|
|
1208
|
-
dataModulesSettings:
|
|
1258
|
+
minVersion: u = dt,
|
|
1259
|
+
boostLevel: N,
|
|
1260
|
+
marginSize: o,
|
|
1261
|
+
finderPatternOuterSettings: t,
|
|
1262
|
+
finderPatternInnerSettings: e,
|
|
1263
|
+
dataModulesSettings: c,
|
|
1209
1264
|
imageSettings: h,
|
|
1210
|
-
svgProps:
|
|
1211
|
-
} = r,
|
|
1212
|
-
value:
|
|
1213
|
-
level:
|
|
1265
|
+
svgProps: f
|
|
1266
|
+
} = r, $ = at(null), { margin: p, cells: M, numCells: E, calculatedImageSettings: m } = Gt({
|
|
1267
|
+
value: a,
|
|
1268
|
+
level: n,
|
|
1214
1269
|
minVersion: u,
|
|
1215
|
-
boostLevel:
|
|
1216
|
-
marginSize:
|
|
1270
|
+
boostLevel: N,
|
|
1271
|
+
marginSize: o,
|
|
1217
1272
|
imageSettings: h,
|
|
1218
|
-
size:
|
|
1273
|
+
size: s
|
|
1219
1274
|
});
|
|
1220
|
-
|
|
1221
|
-
svg:
|
|
1275
|
+
ct(i, () => ({
|
|
1276
|
+
svg: $.current,
|
|
1222
1277
|
download: ({
|
|
1223
|
-
name:
|
|
1278
|
+
name: A = Et,
|
|
1224
1279
|
format: P = "svg",
|
|
1225
|
-
size:
|
|
1280
|
+
size: z = 500
|
|
1226
1281
|
}) => {
|
|
1227
|
-
|
|
1228
|
-
svgRef:
|
|
1229
|
-
fileSize:
|
|
1230
|
-
fileName:
|
|
1282
|
+
$.current && (P === "svg" ? jt({ svgRef: $, fileSize: z, fileName: A }) : Vt({
|
|
1283
|
+
svgRef: $,
|
|
1284
|
+
fileSize: z,
|
|
1285
|
+
fileName: A,
|
|
1231
1286
|
fileFormat: P,
|
|
1232
1287
|
imageSettings: h,
|
|
1233
1288
|
calculatedImageSettings: m,
|
|
1234
|
-
size:
|
|
1289
|
+
size: s,
|
|
1235
1290
|
numCells: E,
|
|
1236
1291
|
margin: p
|
|
1237
1292
|
}));
|
|
1238
1293
|
}
|
|
1239
1294
|
}));
|
|
1240
|
-
let R = M,
|
|
1241
|
-
h != null && m != null && (m.excavation != null && (R = kt(M, m.excavation)),
|
|
1295
|
+
let R = M, I = null;
|
|
1296
|
+
h != null && m != null && (m.excavation != null && (R = kt(M, m.excavation)), I = /* @__PURE__ */ w(
|
|
1242
1297
|
"image",
|
|
1243
1298
|
{
|
|
1244
1299
|
href: h.src,
|
|
@@ -1251,28 +1306,28 @@ const tt = (r) => {
|
|
|
1251
1306
|
crossOrigin: m.crossOrigin
|
|
1252
1307
|
}
|
|
1253
1308
|
));
|
|
1254
|
-
const
|
|
1309
|
+
const C = {
|
|
1255
1310
|
modules: R,
|
|
1256
1311
|
margin: p,
|
|
1257
1312
|
gradient: d
|
|
1258
1313
|
};
|
|
1259
|
-
return /* @__PURE__ */
|
|
1314
|
+
return /* @__PURE__ */ K(
|
|
1260
1315
|
"svg",
|
|
1261
1316
|
{
|
|
1262
|
-
height:
|
|
1263
|
-
width:
|
|
1317
|
+
height: s,
|
|
1318
|
+
width: s,
|
|
1264
1319
|
viewBox: `0 0 ${E} ${E}`,
|
|
1265
|
-
ref:
|
|
1320
|
+
ref: $,
|
|
1266
1321
|
role: "img",
|
|
1267
|
-
"aria-label": (
|
|
1268
|
-
|
|
1322
|
+
"aria-label": (f == null ? void 0 : f["aria-label"]) || "QR Code",
|
|
1323
|
+
...f,
|
|
1269
1324
|
children: [
|
|
1270
|
-
/* @__PURE__ */
|
|
1271
|
-
/* @__PURE__ */
|
|
1272
|
-
/* @__PURE__ */
|
|
1273
|
-
/* @__PURE__ */
|
|
1274
|
-
/* @__PURE__ */
|
|
1275
|
-
|
|
1325
|
+
/* @__PURE__ */ w(Qt, { gradient: d }),
|
|
1326
|
+
/* @__PURE__ */ w(Nt, { background: l, numCells: E }),
|
|
1327
|
+
/* @__PURE__ */ w(zt, { settings: t, ...C }),
|
|
1328
|
+
/* @__PURE__ */ w(_t, { settings: e, ...C }),
|
|
1329
|
+
/* @__PURE__ */ w(Ht, { settings: c, ...C }),
|
|
1330
|
+
I
|
|
1276
1331
|
]
|
|
1277
1332
|
}
|
|
1278
1333
|
);
|