@lglab/react-qr-code 1.4.9 → 1.5.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.es.js +1684 -1317
- package/dist/src/components/background.d.ts +9 -0
- package/dist/src/components/background.d.ts.map +1 -0
- package/dist/src/components/data-modules.d.ts +4 -0
- package/dist/src/components/data-modules.d.ts.map +1 -0
- package/dist/src/components/data-modules.test.d.ts +2 -0
- package/dist/src/components/data-modules.test.d.ts.map +1 -0
- package/dist/src/components/finder-patter-inner.test.d.ts +2 -0
- package/dist/src/components/finder-patter-inner.test.d.ts.map +1 -0
- package/dist/src/components/finder-patter-outer.test.d.ts +2 -0
- package/dist/src/components/finder-patter-outer.test.d.ts.map +1 -0
- package/dist/src/components/finder-patterns-inner.d.ts +4 -0
- package/dist/src/components/finder-patterns-inner.d.ts.map +1 -0
- package/dist/src/components/finder-patterns-outer.d.ts +4 -0
- package/dist/src/components/finder-patterns-outer.d.ts.map +1 -0
- package/dist/src/components/gradient.d.ts +8 -0
- package/dist/src/components/gradient.d.ts.map +1 -0
- package/dist/src/constants.d.ts +74 -0
- package/dist/src/constants.d.ts.map +1 -0
- package/dist/src/hooks/use-ids.d.ts +5 -0
- package/dist/src/hooks/use-ids.d.ts.map +1 -0
- package/dist/src/hooks/use-qr-code.d.ts +18 -0
- package/dist/src/hooks/use-qr-code.d.ts.map +1 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/lib/qrcodegen/index.d.ts +101 -0
- package/dist/src/lib/qrcodegen/index.d.ts.map +1 -0
- package/dist/src/react-qr-code.d.ts +4 -0
- package/dist/src/react-qr-code.d.ts.map +1 -0
- package/dist/src/react-qr-code.test.d.ts +2 -0
- package/dist/src/react-qr-code.test.d.ts.map +1 -0
- package/dist/src/test/data-modules-neightbours.d.ts +29 -0
- package/dist/src/test/data-modules-neightbours.d.ts.map +1 -0
- package/dist/src/types/lib.d.ts +174 -0
- package/dist/src/types/lib.d.ts.map +1 -0
- package/dist/src/types/utils.d.ts +55 -0
- package/dist/src/types/utils.d.ts.map +1 -0
- package/dist/src/utils/data-modules.d.ts +28 -0
- package/dist/src/utils/data-modules.d.ts.map +1 -0
- package/dist/src/utils/data-modules.test.d.ts +2 -0
- package/dist/src/utils/data-modules.test.d.ts.map +1 -0
- package/dist/src/utils/download.d.ts +4 -0
- package/dist/src/utils/download.d.ts.map +1 -0
- package/dist/src/utils/finder-patterns-inner.d.ts +13 -0
- package/dist/src/utils/finder-patterns-inner.d.ts.map +1 -0
- package/dist/src/utils/finder-patterns-outer.d.ts +18 -0
- package/dist/src/utils/finder-patterns-outer.d.ts.map +1 -0
- package/dist/src/utils/qr-code.d.ts +6 -0
- package/dist/src/utils/qr-code.d.ts.map +1 -0
- package/dist/src/utils/qr-code.test.d.ts +2 -0
- package/dist/src/utils/qr-code.test.d.ts.map +1 -0
- package/dist/src/utils/settings.d.ts +15 -0
- package/dist/src/utils/settings.d.ts.map +1 -0
- package/dist/src/utils/svg.d.ts +13 -0
- package/dist/src/utils/svg.d.ts.map +1 -0
- package/package.json +12 -13
- package/dist/index.d.ts +0 -300
package/dist/index.es.js
CHANGED
|
@@ -1,1342 +1,1709 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { forwardRef as e, useCallback as t, useId as n, useImperativeHandle as r, useMemo as i, useRef as a } from "react";
|
|
2
|
+
import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
3
|
+
//#region src/utils/svg.ts
|
|
4
|
+
var l = /\.?0+$/;
|
|
5
|
+
function u(e) {
|
|
6
|
+
return e.toFixed(7).replace(l, "");
|
|
6
7
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
8
|
+
var d = (e) => {
|
|
9
|
+
let t = e % 360 * (Math.PI / 180), n = Math.max(0, Math.min(100, 50 - 50 * Math.cos(t))), r = Math.max(0, Math.min(100, 50 - 50 * Math.sin(t))), i = Math.max(0, Math.min(100, 50 + 50 * Math.cos(t))), a = Math.max(0, Math.min(100, 50 + 50 * Math.sin(t)));
|
|
10
|
+
return {
|
|
11
|
+
x1: `${n}%`,
|
|
12
|
+
y1: `${r}%`,
|
|
13
|
+
x2: `${i}%`,
|
|
14
|
+
y2: `${a}%`
|
|
15
|
+
};
|
|
16
|
+
}, f = (e, t, n, r) => {
|
|
17
|
+
let i = n / 2, a = i / 2, o = Math.PI / r, s = "";
|
|
18
|
+
for (let n = 0; n < 2 * r; n++) {
|
|
19
|
+
let r = n * o - Math.PI / 2, c = n % 2 == 0 ? i : a, l = e + c * Math.cos(r), u = t + c * Math.sin(r);
|
|
20
|
+
s += `${n === 0 ? "M" : "L"} ${l},${u} `;
|
|
21
|
+
}
|
|
22
|
+
return s + "Z";
|
|
23
|
+
}, p = (e, t, n, r) => `M ${e} ${t}Q ${e + r} ${t + n / 2}, ${e} ${t + n}Q ${e + n / 2} ${t + n - r}, ${e + n} ${t + n}Q ${e + n - r} ${t + n / 2}, ${e + n} ${t}Q ${e + n / 2} ${t + r}, ${e} ${t}Z`, m = .15, h = .1, g = .7, _ = 4, v = (e, t, n) => {
|
|
24
|
+
let r = n * m, i = n * h, a = n - r * 2, o = `M${e},${t + r}h${n}v${a}h${-n}Z`, s = n * g, c = e + (n - s) / 2, l = (s - i) / (_ - 1);
|
|
25
|
+
return o + Array.from({ length: _ }, (e, a) => {
|
|
26
|
+
let o = c + l * a;
|
|
27
|
+
return `M${o},${t}h${i}v${r}h${-i}ZM${o},${t + n - r}h${i}v${r}h${-i}Z`;
|
|
28
|
+
}).join("");
|
|
29
|
+
}, y = (e, t, n) => {
|
|
30
|
+
let r = n / 8;
|
|
31
|
+
return `M ${e + n} ${t + r * 3}
|
|
32
|
+
V ${t + r}
|
|
33
|
+
h -${r}
|
|
34
|
+
V ${t}
|
|
35
|
+
H ${e + r * 5}
|
|
36
|
+
v ${r}
|
|
37
|
+
H ${e + r * 3}
|
|
38
|
+
V ${t}
|
|
39
|
+
H ${e + r}
|
|
40
|
+
v ${r}
|
|
41
|
+
H ${e}
|
|
42
|
+
v ${r * 2}
|
|
43
|
+
h ${r}
|
|
44
|
+
v ${r * 2}
|
|
45
|
+
H ${e}
|
|
46
|
+
v ${r * 2}
|
|
47
|
+
h ${r}
|
|
48
|
+
v ${r}
|
|
49
|
+
h ${r * 2}
|
|
50
|
+
v -${r}
|
|
51
|
+
h ${r * 2}
|
|
52
|
+
v ${r}
|
|
53
|
+
h ${r * 2}
|
|
54
|
+
v -${r}
|
|
55
|
+
h ${r}
|
|
56
|
+
V ${t + r * 5}
|
|
57
|
+
h -${r}
|
|
58
|
+
V ${t + r * 3}
|
|
59
|
+
h ${r}
|
|
54
60
|
Z`;
|
|
55
|
-
},
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
},
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
61
|
+
}, b = (e, t, n) => {
|
|
62
|
+
let r = !1, i = 0;
|
|
63
|
+
return [
|
|
64
|
+
"M",
|
|
65
|
+
1,
|
|
66
|
+
.3262506,
|
|
67
|
+
"c",
|
|
68
|
+
0,
|
|
69
|
+
.0383376,
|
|
70
|
+
-.0064626,
|
|
71
|
+
.0758377,
|
|
72
|
+
-.0193751,
|
|
73
|
+
.1125001,
|
|
74
|
+
"s",
|
|
75
|
+
-.0356247,
|
|
76
|
+
.076875,
|
|
77
|
+
-.0681248,
|
|
78
|
+
.1206252,
|
|
79
|
+
"c",
|
|
80
|
+
-.0325,
|
|
81
|
+
.0437499,
|
|
82
|
+
-.0762503,
|
|
83
|
+
.0931247,
|
|
84
|
+
-.1312501,
|
|
85
|
+
.1481249,
|
|
86
|
+
"C",
|
|
87
|
+
.7262502,
|
|
88
|
+
.7625008,
|
|
89
|
+
.6566626,
|
|
90
|
+
.8279132,
|
|
91
|
+
.5724999,
|
|
92
|
+
.9037505,
|
|
93
|
+
"L",
|
|
94
|
+
.5,
|
|
95
|
+
.9687506,
|
|
96
|
+
"L",
|
|
97
|
+
.4275001,
|
|
98
|
+
.9037505,
|
|
99
|
+
"C",
|
|
100
|
+
.3433374,
|
|
101
|
+
.8279132,
|
|
102
|
+
.2737499,
|
|
103
|
+
.7625005,
|
|
104
|
+
.21875,
|
|
105
|
+
.7075007,
|
|
106
|
+
"C",
|
|
107
|
+
.1637501,
|
|
108
|
+
.6525008,
|
|
109
|
+
.1199999,
|
|
110
|
+
.6031258,
|
|
111
|
+
.0874999,
|
|
112
|
+
.5593758,
|
|
113
|
+
"S",
|
|
114
|
+
.0322876,
|
|
115
|
+
.4754133,
|
|
116
|
+
.0193751,
|
|
117
|
+
.4387506,
|
|
118
|
+
"S",
|
|
119
|
+
0,
|
|
120
|
+
.3645881,
|
|
121
|
+
0,
|
|
122
|
+
.3262506,
|
|
123
|
+
"c",
|
|
124
|
+
0,
|
|
125
|
+
-.0783374,
|
|
126
|
+
.0262499,
|
|
127
|
+
-.1437498,
|
|
128
|
+
.07875,
|
|
129
|
+
-.1962499,
|
|
130
|
+
"s",
|
|
131
|
+
.1179124,
|
|
132
|
+
-.07875,
|
|
133
|
+
.1962499,
|
|
134
|
+
-.07875,
|
|
135
|
+
"c",
|
|
136
|
+
.0433376,
|
|
137
|
+
0,
|
|
138
|
+
.0845875,
|
|
139
|
+
.0091625,
|
|
140
|
+
.12375,
|
|
141
|
+
.0274999,
|
|
142
|
+
"S",
|
|
143
|
+
.4716623,
|
|
144
|
+
.1229131,
|
|
145
|
+
.5,
|
|
146
|
+
.1562506,
|
|
147
|
+
"c",
|
|
148
|
+
.0283374,
|
|
149
|
+
-.0333375,
|
|
150
|
+
.0620874,
|
|
151
|
+
-.0591625,
|
|
152
|
+
.1012502,
|
|
153
|
+
-.0775,
|
|
154
|
+
"c",
|
|
155
|
+
.0391627,
|
|
156
|
+
-.0183375,
|
|
157
|
+
.0804126,
|
|
158
|
+
-.0274999,
|
|
159
|
+
.12375,
|
|
160
|
+
-.0274999,
|
|
161
|
+
"c",
|
|
162
|
+
.0783374,
|
|
163
|
+
0,
|
|
164
|
+
.1437497,
|
|
165
|
+
.0262499,
|
|
166
|
+
.1962501,
|
|
167
|
+
.07875,
|
|
168
|
+
"S",
|
|
169
|
+
1,
|
|
170
|
+
.2479131,
|
|
171
|
+
1,
|
|
172
|
+
.3262506,
|
|
173
|
+
"z"
|
|
174
|
+
].map((a) => typeof a == "string" ? (i = 0, r = a.toUpperCase() == a, a) : (i++, a *= n, r && (a += i % 2 == 1 ? e : t), u(a))).join(" ");
|
|
175
|
+
}, x = { "data-testid": "background" }, ee = ({ background: e, bgGradientId: t, numCells: n }) => {
|
|
176
|
+
if (!e) return null;
|
|
177
|
+
if (typeof e == "string") return /* @__PURE__ */ s("path", {
|
|
178
|
+
fill: e,
|
|
179
|
+
d: `M0,0 h${n}v${n}H0z`,
|
|
180
|
+
...x
|
|
181
|
+
});
|
|
182
|
+
let r = d(e?.rotation || 0);
|
|
183
|
+
return /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ s("defs", { children: e.type === "linear" ? /* @__PURE__ */ s("linearGradient", {
|
|
184
|
+
id: t,
|
|
185
|
+
gradientUnits: "userSpaceOnUse",
|
|
186
|
+
...r,
|
|
187
|
+
children: e.stops?.map((e, t) => /* @__PURE__ */ s("stop", {
|
|
188
|
+
offset: e.offset,
|
|
189
|
+
stopColor: e.color
|
|
190
|
+
}, t))
|
|
191
|
+
}) : /* @__PURE__ */ s("radialGradient", {
|
|
192
|
+
id: t,
|
|
193
|
+
gradientUnits: "userSpaceOnUse",
|
|
194
|
+
cx: "50%",
|
|
195
|
+
cy: "50%",
|
|
196
|
+
r: "50%",
|
|
197
|
+
children: e.stops?.map((e, t) => /* @__PURE__ */ s("stop", {
|
|
198
|
+
offset: e.offset,
|
|
199
|
+
stopColor: e.color
|
|
200
|
+
}, t))
|
|
201
|
+
}) }), /* @__PURE__ */ s("path", {
|
|
202
|
+
fill: `url(#${t})`,
|
|
203
|
+
d: `M0,0 h${n}v${n}H0z`,
|
|
204
|
+
...x
|
|
205
|
+
})] });
|
|
206
|
+
}, S;
|
|
207
|
+
(function(e) {
|
|
208
|
+
class t {
|
|
209
|
+
static encodeText(e, n) {
|
|
210
|
+
let r = S.QrSegment.makeSegments(e);
|
|
211
|
+
return t.encodeSegments(r, n);
|
|
212
|
+
}
|
|
213
|
+
static encodeBinary(e, n) {
|
|
214
|
+
let r = S.QrSegment.makeBytes(e);
|
|
215
|
+
return t.encodeSegments([r], n);
|
|
216
|
+
}
|
|
217
|
+
static encodeSegments(e, r, o = 1, s = 40, c = -1, l = !0) {
|
|
218
|
+
if (!(t.MIN_VERSION <= o && o <= s && s <= t.MAX_VERSION) || c < -1 || c > 7) throw RangeError("Invalid value");
|
|
219
|
+
let u, d;
|
|
220
|
+
for (u = o;; u++) {
|
|
221
|
+
let n = t.getNumDataCodewords(u, r) * 8, i = a.getTotalBits(e, u);
|
|
222
|
+
if (i <= n) {
|
|
223
|
+
d = i;
|
|
224
|
+
break;
|
|
225
|
+
}
|
|
226
|
+
if (u >= s) throw RangeError("Data too long");
|
|
227
|
+
}
|
|
228
|
+
for (let e of [
|
|
229
|
+
t.Ecc.MEDIUM,
|
|
230
|
+
t.Ecc.QUARTILE,
|
|
231
|
+
t.Ecc.HIGH
|
|
232
|
+
]) l && d <= t.getNumDataCodewords(u, e) * 8 && (r = e);
|
|
233
|
+
let f = [];
|
|
234
|
+
for (let t of e) {
|
|
235
|
+
n(t.mode.modeBits, 4, f), n(t.numChars, t.mode.numCharCountBits(u), f);
|
|
236
|
+
for (let e of t.getData()) f.push(e);
|
|
237
|
+
}
|
|
238
|
+
i(f.length == d);
|
|
239
|
+
let p = t.getNumDataCodewords(u, r) * 8;
|
|
240
|
+
i(f.length <= p), n(0, Math.min(4, p - f.length), f), n(0, (8 - f.length % 8) % 8, f), i(f.length % 8 == 0);
|
|
241
|
+
for (let e = 236; f.length < p; e ^= 253) n(e, 8, f);
|
|
242
|
+
let m = [];
|
|
243
|
+
for (; m.length * 8 < f.length;) m.push(0);
|
|
244
|
+
return f.forEach((e, t) => m[t >>> 3] |= e << 7 - (t & 7)), new t(u, r, m, c);
|
|
245
|
+
}
|
|
246
|
+
constructor(e, n, r, a) {
|
|
247
|
+
if (this.version = e, this.errorCorrectionLevel = n, this.modules = [], this.isFunction = [], e < t.MIN_VERSION || e > t.MAX_VERSION) throw RangeError("Version value out of range");
|
|
248
|
+
if (a < -1 || a > 7) throw RangeError("Mask value out of range");
|
|
249
|
+
this.size = e * 4 + 17;
|
|
250
|
+
let o = [];
|
|
251
|
+
for (let e = 0; e < this.size; e++) o.push(!1);
|
|
252
|
+
for (let e = 0; e < this.size; e++) this.modules.push(o.slice()), this.isFunction.push(o.slice());
|
|
253
|
+
this.drawFunctionPatterns();
|
|
254
|
+
let s = this.addEccAndInterleave(r);
|
|
255
|
+
if (this.drawCodewords(s), a == -1) {
|
|
256
|
+
let e = 1e9;
|
|
257
|
+
for (let t = 0; t < 8; t++) {
|
|
258
|
+
this.applyMask(t), this.drawFormatBits(t);
|
|
259
|
+
let n = this.getPenaltyScore();
|
|
260
|
+
n < e && (a = t, e = n), this.applyMask(t);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
i(0 <= a && a <= 7), this.mask = a, this.applyMask(a), this.drawFormatBits(a), this.isFunction = [];
|
|
264
|
+
}
|
|
265
|
+
getModule(e, t) {
|
|
266
|
+
return 0 <= e && e < this.size && 0 <= t && t < this.size && this.modules[t][e];
|
|
267
|
+
}
|
|
268
|
+
getModules() {
|
|
269
|
+
return this.modules;
|
|
270
|
+
}
|
|
271
|
+
drawFunctionPatterns() {
|
|
272
|
+
for (let e = 0; e < this.size; e++) this.setFunctionModule(6, e, e % 2 == 0), this.setFunctionModule(e, 6, e % 2 == 0);
|
|
273
|
+
this.drawFinderPattern(3, 3), this.drawFinderPattern(this.size - 4, 3), this.drawFinderPattern(3, this.size - 4);
|
|
274
|
+
let e = this.getAlignmentPatternPositions(), t = e.length;
|
|
275
|
+
for (let n = 0; n < t; n++) for (let r = 0; r < t; r++) n == 0 && r == 0 || n == 0 && r == t - 1 || n == t - 1 && r == 0 || this.drawAlignmentPattern(e[n], e[r]);
|
|
276
|
+
this.drawFormatBits(0), this.drawVersion();
|
|
277
|
+
}
|
|
278
|
+
drawFormatBits(e) {
|
|
279
|
+
let t = this.errorCorrectionLevel.formatBits << 3 | e, n = t;
|
|
280
|
+
for (let e = 0; e < 10; e++) n = n << 1 ^ (n >>> 9) * 1335;
|
|
281
|
+
let a = (t << 10 | n) ^ 21522;
|
|
282
|
+
i(a >>> 15 == 0);
|
|
283
|
+
for (let e = 0; e <= 5; e++) this.setFunctionModule(8, e, r(a, e));
|
|
284
|
+
this.setFunctionModule(8, 7, r(a, 6)), this.setFunctionModule(8, 8, r(a, 7)), this.setFunctionModule(7, 8, r(a, 8));
|
|
285
|
+
for (let e = 9; e < 15; e++) this.setFunctionModule(14 - e, 8, r(a, e));
|
|
286
|
+
for (let e = 0; e < 8; e++) this.setFunctionModule(this.size - 1 - e, 8, r(a, e));
|
|
287
|
+
for (let e = 8; e < 15; e++) this.setFunctionModule(8, this.size - 15 + e, r(a, e));
|
|
288
|
+
this.setFunctionModule(8, this.size - 8, !0);
|
|
289
|
+
}
|
|
290
|
+
drawVersion() {
|
|
291
|
+
if (this.version < 7) return;
|
|
292
|
+
let e = this.version;
|
|
293
|
+
for (let t = 0; t < 12; t++) e = e << 1 ^ (e >>> 11) * 7973;
|
|
294
|
+
let t = this.version << 12 | e;
|
|
295
|
+
i(t >>> 18 == 0);
|
|
296
|
+
for (let e = 0; e < 18; e++) {
|
|
297
|
+
let n = r(t, e), i = this.size - 11 + e % 3, a = Math.floor(e / 3);
|
|
298
|
+
this.setFunctionModule(i, a, n), this.setFunctionModule(a, i, n);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
drawFinderPattern(e, t) {
|
|
302
|
+
for (let n = -4; n <= 4; n++) for (let r = -4; r <= 4; r++) {
|
|
303
|
+
let i = Math.max(Math.abs(r), Math.abs(n)), a = e + r, o = t + n;
|
|
304
|
+
0 <= a && a < this.size && 0 <= o && o < this.size && this.setFunctionModule(a, o, i != 2 && i != 4);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
drawAlignmentPattern(e, t) {
|
|
308
|
+
for (let n = -2; n <= 2; n++) for (let r = -2; r <= 2; r++) this.setFunctionModule(e + r, t + n, Math.max(Math.abs(r), Math.abs(n)) != 1);
|
|
309
|
+
}
|
|
310
|
+
setFunctionModule(e, t, n) {
|
|
311
|
+
this.modules[t][e] = n, this.isFunction[t][e] = !0;
|
|
312
|
+
}
|
|
313
|
+
addEccAndInterleave(e) {
|
|
314
|
+
let n = this.version, r = this.errorCorrectionLevel;
|
|
315
|
+
if (e.length != t.getNumDataCodewords(n, r)) throw RangeError("Invalid argument");
|
|
316
|
+
let a = t.NUM_ERROR_CORRECTION_BLOCKS[r.ordinal][n], o = t.ECC_CODEWORDS_PER_BLOCK[r.ordinal][n], s = Math.floor(t.getNumRawDataModules(n) / 8), c = a - s % a, l = Math.floor(s / a), u = [], d = t.reedSolomonComputeDivisor(o);
|
|
317
|
+
for (let n = 0, r = 0; n < a; n++) {
|
|
318
|
+
let i = e.slice(r, r + l - o + (n < c ? 0 : 1));
|
|
319
|
+
r += i.length;
|
|
320
|
+
let a = t.reedSolomonComputeRemainder(i, d);
|
|
321
|
+
n < c && i.push(0), u.push(i.concat(a));
|
|
322
|
+
}
|
|
323
|
+
let f = [];
|
|
324
|
+
for (let e = 0; e < u[0].length; e++) u.forEach((t, n) => {
|
|
325
|
+
(e != l - o || n >= c) && f.push(t[e]);
|
|
326
|
+
});
|
|
327
|
+
return i(f.length == s), f;
|
|
328
|
+
}
|
|
329
|
+
drawCodewords(e) {
|
|
330
|
+
if (e.length != Math.floor(t.getNumRawDataModules(this.version) / 8)) throw RangeError("Invalid argument");
|
|
331
|
+
let n = 0;
|
|
332
|
+
for (let t = this.size - 1; t >= 1; t -= 2) {
|
|
333
|
+
t == 6 && (t = 5);
|
|
334
|
+
for (let i = 0; i < this.size; i++) for (let a = 0; a < 2; a++) {
|
|
335
|
+
let o = t - a, s = t + 1 & 2 ? i : this.size - 1 - i;
|
|
336
|
+
!this.isFunction[s][o] && n < e.length * 8 && (this.modules[s][o] = r(e[n >>> 3], 7 - (n & 7)), n++);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
i(n == e.length * 8);
|
|
340
|
+
}
|
|
341
|
+
applyMask(e) {
|
|
342
|
+
if (e < 0 || e > 7) throw RangeError("Mask value out of range");
|
|
343
|
+
for (let t = 0; t < this.size; t++) for (let n = 0; n < this.size; n++) {
|
|
344
|
+
let r;
|
|
345
|
+
switch (e) {
|
|
346
|
+
case 0:
|
|
347
|
+
r = (n + t) % 2 == 0;
|
|
348
|
+
break;
|
|
349
|
+
case 1:
|
|
350
|
+
r = t % 2 == 0;
|
|
351
|
+
break;
|
|
352
|
+
case 2:
|
|
353
|
+
r = n % 3 == 0;
|
|
354
|
+
break;
|
|
355
|
+
case 3:
|
|
356
|
+
r = (n + t) % 3 == 0;
|
|
357
|
+
break;
|
|
358
|
+
case 4:
|
|
359
|
+
r = (Math.floor(n / 3) + Math.floor(t / 2)) % 2 == 0;
|
|
360
|
+
break;
|
|
361
|
+
case 5:
|
|
362
|
+
r = n * t % 2 + n * t % 3 == 0;
|
|
363
|
+
break;
|
|
364
|
+
case 6:
|
|
365
|
+
r = (n * t % 2 + n * t % 3) % 2 == 0;
|
|
366
|
+
break;
|
|
367
|
+
case 7:
|
|
368
|
+
r = ((n + t) % 2 + n * t % 3) % 2 == 0;
|
|
369
|
+
break;
|
|
370
|
+
default: throw Error("Unreachable");
|
|
371
|
+
}
|
|
372
|
+
!this.isFunction[t][n] && r && (this.modules[t][n] = !this.modules[t][n]);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
getPenaltyScore() {
|
|
376
|
+
let e = 0;
|
|
377
|
+
for (let n = 0; n < this.size; n++) {
|
|
378
|
+
let r = !1, i = 0, a = [
|
|
379
|
+
0,
|
|
380
|
+
0,
|
|
381
|
+
0,
|
|
382
|
+
0,
|
|
383
|
+
0,
|
|
384
|
+
0,
|
|
385
|
+
0
|
|
386
|
+
];
|
|
387
|
+
for (let o = 0; o < this.size; o++) this.modules[n][o] == r ? (i++, i == 5 ? e += t.PENALTY_N1 : i > 5 && e++) : (this.finderPenaltyAddHistory(i, a), r || (e += this.finderPenaltyCountPatterns(a) * t.PENALTY_N3), r = this.modules[n][o], i = 1);
|
|
388
|
+
e += this.finderPenaltyTerminateAndCount(r, i, a) * t.PENALTY_N3;
|
|
389
|
+
}
|
|
390
|
+
for (let n = 0; n < this.size; n++) {
|
|
391
|
+
let r = !1, i = 0, a = [
|
|
392
|
+
0,
|
|
393
|
+
0,
|
|
394
|
+
0,
|
|
395
|
+
0,
|
|
396
|
+
0,
|
|
397
|
+
0,
|
|
398
|
+
0
|
|
399
|
+
];
|
|
400
|
+
for (let o = 0; o < this.size; o++) this.modules[o][n] == r ? (i++, i == 5 ? e += t.PENALTY_N1 : i > 5 && e++) : (this.finderPenaltyAddHistory(i, a), r || (e += this.finderPenaltyCountPatterns(a) * t.PENALTY_N3), r = this.modules[o][n], i = 1);
|
|
401
|
+
e += this.finderPenaltyTerminateAndCount(r, i, a) * t.PENALTY_N3;
|
|
402
|
+
}
|
|
403
|
+
for (let n = 0; n < this.size - 1; n++) for (let r = 0; r < this.size - 1; r++) {
|
|
404
|
+
let i = this.modules[n][r];
|
|
405
|
+
i == this.modules[n][r + 1] && i == this.modules[n + 1][r] && i == this.modules[n + 1][r + 1] && (e += t.PENALTY_N2);
|
|
406
|
+
}
|
|
407
|
+
let n = 0;
|
|
408
|
+
for (let e of this.modules) n = e.reduce((e, t) => e + +!!t, n);
|
|
409
|
+
let r = this.size * this.size, a = Math.ceil(Math.abs(n * 20 - r * 10) / r) - 1;
|
|
410
|
+
return i(0 <= a && a <= 9), e += a * t.PENALTY_N4, i(0 <= e && e <= 2568888), e;
|
|
411
|
+
}
|
|
412
|
+
getAlignmentPatternPositions() {
|
|
413
|
+
if (this.version == 1) return [];
|
|
414
|
+
{
|
|
415
|
+
let e = Math.floor(this.version / 7) + 2, t = this.version == 32 ? 26 : Math.ceil((this.version * 4 + 4) / (e * 2 - 2)) * 2, n = [6];
|
|
416
|
+
for (let r = this.size - 7; n.length < e; r -= t) n.splice(1, 0, r);
|
|
417
|
+
return n;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
static getNumRawDataModules(e) {
|
|
421
|
+
if (e < t.MIN_VERSION || e > t.MAX_VERSION) throw RangeError("Version number out of range");
|
|
422
|
+
let n = (16 * e + 128) * e + 64;
|
|
423
|
+
if (e >= 2) {
|
|
424
|
+
let t = Math.floor(e / 7) + 2;
|
|
425
|
+
n -= (25 * t - 10) * t - 55, e >= 7 && (n -= 36);
|
|
426
|
+
}
|
|
427
|
+
return i(208 <= n && n <= 29648), n;
|
|
428
|
+
}
|
|
429
|
+
static getNumDataCodewords(e, n) {
|
|
430
|
+
return Math.floor(t.getNumRawDataModules(e) / 8) - t.ECC_CODEWORDS_PER_BLOCK[n.ordinal][e] * t.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][e];
|
|
431
|
+
}
|
|
432
|
+
static reedSolomonComputeDivisor(e) {
|
|
433
|
+
if (e < 1 || e > 255) throw RangeError("Degree out of range");
|
|
434
|
+
let n = [];
|
|
435
|
+
for (let t = 0; t < e - 1; t++) n.push(0);
|
|
436
|
+
n.push(1);
|
|
437
|
+
let r = 1;
|
|
438
|
+
for (let i = 0; i < e; i++) {
|
|
439
|
+
for (let e = 0; e < n.length; e++) n[e] = t.reedSolomonMultiply(n[e], r), e + 1 < n.length && (n[e] ^= n[e + 1]);
|
|
440
|
+
r = t.reedSolomonMultiply(r, 2);
|
|
441
|
+
}
|
|
442
|
+
return n;
|
|
443
|
+
}
|
|
444
|
+
static reedSolomonComputeRemainder(e, n) {
|
|
445
|
+
let r = n.map((e) => 0);
|
|
446
|
+
for (let i of e) {
|
|
447
|
+
let e = i ^ r.shift();
|
|
448
|
+
r.push(0), n.forEach((n, i) => r[i] ^= t.reedSolomonMultiply(n, e));
|
|
449
|
+
}
|
|
450
|
+
return r;
|
|
451
|
+
}
|
|
452
|
+
static reedSolomonMultiply(e, t) {
|
|
453
|
+
if (e >>> 8 || t >>> 8) throw RangeError("Byte out of range");
|
|
454
|
+
let n = 0;
|
|
455
|
+
for (let r = 7; r >= 0; r--) n = n << 1 ^ (n >>> 7) * 285, n ^= (t >>> r & 1) * e;
|
|
456
|
+
return i(n >>> 8 == 0), n;
|
|
457
|
+
}
|
|
458
|
+
finderPenaltyCountPatterns(e) {
|
|
459
|
+
let t = e[1];
|
|
460
|
+
i(t <= this.size * 3);
|
|
461
|
+
let n = t > 0 && e[2] == t && e[3] == t * 3 && e[4] == t && e[5] == t;
|
|
462
|
+
return (n && e[0] >= t * 4 && e[6] >= t ? 1 : 0) + (n && e[6] >= t * 4 && e[0] >= t ? 1 : 0);
|
|
463
|
+
}
|
|
464
|
+
finderPenaltyTerminateAndCount(e, t, n) {
|
|
465
|
+
return e && (this.finderPenaltyAddHistory(t, n), t = 0), t += this.size, this.finderPenaltyAddHistory(t, n), this.finderPenaltyCountPatterns(n);
|
|
466
|
+
}
|
|
467
|
+
finderPenaltyAddHistory(e, t) {
|
|
468
|
+
t[0] == 0 && (e += this.size), t.pop(), t.unshift(e);
|
|
469
|
+
}
|
|
470
|
+
static {
|
|
471
|
+
this.MIN_VERSION = 1;
|
|
472
|
+
}
|
|
473
|
+
static {
|
|
474
|
+
this.MAX_VERSION = 40;
|
|
475
|
+
}
|
|
476
|
+
static {
|
|
477
|
+
this.PENALTY_N1 = 3;
|
|
478
|
+
}
|
|
479
|
+
static {
|
|
480
|
+
this.PENALTY_N2 = 3;
|
|
481
|
+
}
|
|
482
|
+
static {
|
|
483
|
+
this.PENALTY_N3 = 40;
|
|
484
|
+
}
|
|
485
|
+
static {
|
|
486
|
+
this.PENALTY_N4 = 10;
|
|
487
|
+
}
|
|
488
|
+
static {
|
|
489
|
+
this.ECC_CODEWORDS_PER_BLOCK = [
|
|
490
|
+
[
|
|
491
|
+
-1,
|
|
492
|
+
7,
|
|
493
|
+
10,
|
|
494
|
+
15,
|
|
495
|
+
20,
|
|
496
|
+
26,
|
|
497
|
+
18,
|
|
498
|
+
20,
|
|
499
|
+
24,
|
|
500
|
+
30,
|
|
501
|
+
18,
|
|
502
|
+
20,
|
|
503
|
+
24,
|
|
504
|
+
26,
|
|
505
|
+
30,
|
|
506
|
+
22,
|
|
507
|
+
24,
|
|
508
|
+
28,
|
|
509
|
+
30,
|
|
510
|
+
28,
|
|
511
|
+
28,
|
|
512
|
+
28,
|
|
513
|
+
28,
|
|
514
|
+
30,
|
|
515
|
+
30,
|
|
516
|
+
26,
|
|
517
|
+
28,
|
|
518
|
+
30,
|
|
519
|
+
30,
|
|
520
|
+
30,
|
|
521
|
+
30,
|
|
522
|
+
30,
|
|
523
|
+
30,
|
|
524
|
+
30,
|
|
525
|
+
30,
|
|
526
|
+
30,
|
|
527
|
+
30,
|
|
528
|
+
30,
|
|
529
|
+
30,
|
|
530
|
+
30,
|
|
531
|
+
30
|
|
532
|
+
],
|
|
533
|
+
[
|
|
534
|
+
-1,
|
|
535
|
+
10,
|
|
536
|
+
16,
|
|
537
|
+
26,
|
|
538
|
+
18,
|
|
539
|
+
24,
|
|
540
|
+
16,
|
|
541
|
+
18,
|
|
542
|
+
22,
|
|
543
|
+
22,
|
|
544
|
+
26,
|
|
545
|
+
30,
|
|
546
|
+
22,
|
|
547
|
+
22,
|
|
548
|
+
24,
|
|
549
|
+
24,
|
|
550
|
+
28,
|
|
551
|
+
28,
|
|
552
|
+
26,
|
|
553
|
+
26,
|
|
554
|
+
26,
|
|
555
|
+
26,
|
|
556
|
+
28,
|
|
557
|
+
28,
|
|
558
|
+
28,
|
|
559
|
+
28,
|
|
560
|
+
28,
|
|
561
|
+
28,
|
|
562
|
+
28,
|
|
563
|
+
28,
|
|
564
|
+
28,
|
|
565
|
+
28,
|
|
566
|
+
28,
|
|
567
|
+
28,
|
|
568
|
+
28,
|
|
569
|
+
28,
|
|
570
|
+
28,
|
|
571
|
+
28,
|
|
572
|
+
28,
|
|
573
|
+
28,
|
|
574
|
+
28
|
|
575
|
+
],
|
|
576
|
+
[
|
|
577
|
+
-1,
|
|
578
|
+
13,
|
|
579
|
+
22,
|
|
580
|
+
18,
|
|
581
|
+
26,
|
|
582
|
+
18,
|
|
583
|
+
24,
|
|
584
|
+
18,
|
|
585
|
+
22,
|
|
586
|
+
20,
|
|
587
|
+
24,
|
|
588
|
+
28,
|
|
589
|
+
26,
|
|
590
|
+
24,
|
|
591
|
+
20,
|
|
592
|
+
30,
|
|
593
|
+
24,
|
|
594
|
+
28,
|
|
595
|
+
28,
|
|
596
|
+
26,
|
|
597
|
+
30,
|
|
598
|
+
28,
|
|
599
|
+
30,
|
|
600
|
+
30,
|
|
601
|
+
30,
|
|
602
|
+
30,
|
|
603
|
+
28,
|
|
604
|
+
30,
|
|
605
|
+
30,
|
|
606
|
+
30,
|
|
607
|
+
30,
|
|
608
|
+
30,
|
|
609
|
+
30,
|
|
610
|
+
30,
|
|
611
|
+
30,
|
|
612
|
+
30,
|
|
613
|
+
30,
|
|
614
|
+
30,
|
|
615
|
+
30,
|
|
616
|
+
30,
|
|
617
|
+
30
|
|
618
|
+
],
|
|
619
|
+
[
|
|
620
|
+
-1,
|
|
621
|
+
17,
|
|
622
|
+
28,
|
|
623
|
+
22,
|
|
624
|
+
16,
|
|
625
|
+
22,
|
|
626
|
+
28,
|
|
627
|
+
26,
|
|
628
|
+
26,
|
|
629
|
+
24,
|
|
630
|
+
28,
|
|
631
|
+
24,
|
|
632
|
+
28,
|
|
633
|
+
22,
|
|
634
|
+
24,
|
|
635
|
+
24,
|
|
636
|
+
30,
|
|
637
|
+
28,
|
|
638
|
+
28,
|
|
639
|
+
26,
|
|
640
|
+
28,
|
|
641
|
+
30,
|
|
642
|
+
24,
|
|
643
|
+
30,
|
|
644
|
+
30,
|
|
645
|
+
30,
|
|
646
|
+
30,
|
|
647
|
+
30,
|
|
648
|
+
30,
|
|
649
|
+
30,
|
|
650
|
+
30,
|
|
651
|
+
30,
|
|
652
|
+
30,
|
|
653
|
+
30,
|
|
654
|
+
30,
|
|
655
|
+
30,
|
|
656
|
+
30,
|
|
657
|
+
30,
|
|
658
|
+
30,
|
|
659
|
+
30,
|
|
660
|
+
30
|
|
661
|
+
]
|
|
662
|
+
];
|
|
663
|
+
}
|
|
664
|
+
static {
|
|
665
|
+
this.NUM_ERROR_CORRECTION_BLOCKS = [
|
|
666
|
+
[
|
|
667
|
+
-1,
|
|
668
|
+
1,
|
|
669
|
+
1,
|
|
670
|
+
1,
|
|
671
|
+
1,
|
|
672
|
+
1,
|
|
673
|
+
2,
|
|
674
|
+
2,
|
|
675
|
+
2,
|
|
676
|
+
2,
|
|
677
|
+
4,
|
|
678
|
+
4,
|
|
679
|
+
4,
|
|
680
|
+
4,
|
|
681
|
+
4,
|
|
682
|
+
6,
|
|
683
|
+
6,
|
|
684
|
+
6,
|
|
685
|
+
6,
|
|
686
|
+
7,
|
|
687
|
+
8,
|
|
688
|
+
8,
|
|
689
|
+
9,
|
|
690
|
+
9,
|
|
691
|
+
10,
|
|
692
|
+
12,
|
|
693
|
+
12,
|
|
694
|
+
12,
|
|
695
|
+
13,
|
|
696
|
+
14,
|
|
697
|
+
15,
|
|
698
|
+
16,
|
|
699
|
+
17,
|
|
700
|
+
18,
|
|
701
|
+
19,
|
|
702
|
+
19,
|
|
703
|
+
20,
|
|
704
|
+
21,
|
|
705
|
+
22,
|
|
706
|
+
24,
|
|
707
|
+
25
|
|
708
|
+
],
|
|
709
|
+
[
|
|
710
|
+
-1,
|
|
711
|
+
1,
|
|
712
|
+
1,
|
|
713
|
+
1,
|
|
714
|
+
2,
|
|
715
|
+
2,
|
|
716
|
+
4,
|
|
717
|
+
4,
|
|
718
|
+
4,
|
|
719
|
+
5,
|
|
720
|
+
5,
|
|
721
|
+
5,
|
|
722
|
+
8,
|
|
723
|
+
9,
|
|
724
|
+
9,
|
|
725
|
+
10,
|
|
726
|
+
10,
|
|
727
|
+
11,
|
|
728
|
+
13,
|
|
729
|
+
14,
|
|
730
|
+
16,
|
|
731
|
+
17,
|
|
732
|
+
17,
|
|
733
|
+
18,
|
|
734
|
+
20,
|
|
735
|
+
21,
|
|
736
|
+
23,
|
|
737
|
+
25,
|
|
738
|
+
26,
|
|
739
|
+
28,
|
|
740
|
+
29,
|
|
741
|
+
31,
|
|
742
|
+
33,
|
|
743
|
+
35,
|
|
744
|
+
37,
|
|
745
|
+
38,
|
|
746
|
+
40,
|
|
747
|
+
43,
|
|
748
|
+
45,
|
|
749
|
+
47,
|
|
750
|
+
49
|
|
751
|
+
],
|
|
752
|
+
[
|
|
753
|
+
-1,
|
|
754
|
+
1,
|
|
755
|
+
1,
|
|
756
|
+
2,
|
|
757
|
+
2,
|
|
758
|
+
4,
|
|
759
|
+
4,
|
|
760
|
+
6,
|
|
761
|
+
6,
|
|
762
|
+
8,
|
|
763
|
+
8,
|
|
764
|
+
8,
|
|
765
|
+
10,
|
|
766
|
+
12,
|
|
767
|
+
16,
|
|
768
|
+
12,
|
|
769
|
+
17,
|
|
770
|
+
16,
|
|
771
|
+
18,
|
|
772
|
+
21,
|
|
773
|
+
20,
|
|
774
|
+
23,
|
|
775
|
+
23,
|
|
776
|
+
25,
|
|
777
|
+
27,
|
|
778
|
+
29,
|
|
779
|
+
34,
|
|
780
|
+
34,
|
|
781
|
+
35,
|
|
782
|
+
38,
|
|
783
|
+
40,
|
|
784
|
+
43,
|
|
785
|
+
45,
|
|
786
|
+
48,
|
|
787
|
+
51,
|
|
788
|
+
53,
|
|
789
|
+
56,
|
|
790
|
+
59,
|
|
791
|
+
62,
|
|
792
|
+
65,
|
|
793
|
+
68
|
|
794
|
+
],
|
|
795
|
+
[
|
|
796
|
+
-1,
|
|
797
|
+
1,
|
|
798
|
+
1,
|
|
799
|
+
2,
|
|
800
|
+
4,
|
|
801
|
+
4,
|
|
802
|
+
4,
|
|
803
|
+
5,
|
|
804
|
+
6,
|
|
805
|
+
8,
|
|
806
|
+
8,
|
|
807
|
+
11,
|
|
808
|
+
11,
|
|
809
|
+
16,
|
|
810
|
+
16,
|
|
811
|
+
18,
|
|
812
|
+
16,
|
|
813
|
+
19,
|
|
814
|
+
21,
|
|
815
|
+
25,
|
|
816
|
+
25,
|
|
817
|
+
25,
|
|
818
|
+
34,
|
|
819
|
+
30,
|
|
820
|
+
32,
|
|
821
|
+
35,
|
|
822
|
+
37,
|
|
823
|
+
40,
|
|
824
|
+
42,
|
|
825
|
+
45,
|
|
826
|
+
48,
|
|
827
|
+
51,
|
|
828
|
+
54,
|
|
829
|
+
57,
|
|
830
|
+
60,
|
|
831
|
+
63,
|
|
832
|
+
66,
|
|
833
|
+
70,
|
|
834
|
+
74,
|
|
835
|
+
77,
|
|
836
|
+
81
|
|
837
|
+
]
|
|
838
|
+
];
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
e.QrCode = t;
|
|
842
|
+
function n(e, t, n) {
|
|
843
|
+
if (t < 0 || t > 31 || e >>> t) throw RangeError("Value out of range");
|
|
844
|
+
for (let r = t - 1; r >= 0; r--) n.push(e >>> r & 1);
|
|
845
|
+
}
|
|
846
|
+
function r(e, t) {
|
|
847
|
+
return (e >>> t & 1) != 0;
|
|
848
|
+
}
|
|
849
|
+
function i(e) {
|
|
850
|
+
if (!e) throw Error("Assertion error");
|
|
851
|
+
}
|
|
852
|
+
class a {
|
|
853
|
+
static makeBytes(e) {
|
|
854
|
+
let t = [];
|
|
855
|
+
for (let r of e) n(r, 8, t);
|
|
856
|
+
return new a(a.Mode.BYTE, e.length, t);
|
|
857
|
+
}
|
|
858
|
+
static makeNumeric(e) {
|
|
859
|
+
if (!a.isNumeric(e)) throw RangeError("String contains non-numeric characters");
|
|
860
|
+
let t = [];
|
|
861
|
+
for (let r = 0; r < e.length;) {
|
|
862
|
+
let i = Math.min(e.length - r, 3);
|
|
863
|
+
n(parseInt(e.substring(r, r + i), 10), i * 3 + 1, t), r += i;
|
|
864
|
+
}
|
|
865
|
+
return new a(a.Mode.NUMERIC, e.length, t);
|
|
866
|
+
}
|
|
867
|
+
static makeAlphanumeric(e) {
|
|
868
|
+
if (!a.isAlphanumeric(e)) throw RangeError("String contains unencodable characters in alphanumeric mode");
|
|
869
|
+
let t = [], r;
|
|
870
|
+
for (r = 0; r + 2 <= e.length; r += 2) {
|
|
871
|
+
let i = a.ALPHANUMERIC_CHARSET.indexOf(e.charAt(r)) * 45;
|
|
872
|
+
i += a.ALPHANUMERIC_CHARSET.indexOf(e.charAt(r + 1)), n(i, 11, t);
|
|
873
|
+
}
|
|
874
|
+
return r < e.length && n(a.ALPHANUMERIC_CHARSET.indexOf(e.charAt(r)), 6, t), new a(a.Mode.ALPHANUMERIC, e.length, t);
|
|
875
|
+
}
|
|
876
|
+
static makeSegments(e) {
|
|
877
|
+
return e == "" ? [] : a.isNumeric(e) ? [a.makeNumeric(e)] : a.isAlphanumeric(e) ? [a.makeAlphanumeric(e)] : [a.makeBytes(a.toUtf8ByteArray(e))];
|
|
878
|
+
}
|
|
879
|
+
static makeEci(e) {
|
|
880
|
+
let t = [];
|
|
881
|
+
if (e < 0) throw RangeError("ECI assignment value out of range");
|
|
882
|
+
if (e < 128) n(e, 8, t);
|
|
883
|
+
else if (e < 16384) n(2, 2, t), n(e, 14, t);
|
|
884
|
+
else if (e < 1e6) n(6, 3, t), n(e, 21, t);
|
|
885
|
+
else throw RangeError("ECI assignment value out of range");
|
|
886
|
+
return new a(a.Mode.ECI, 0, t);
|
|
887
|
+
}
|
|
888
|
+
static isNumeric(e) {
|
|
889
|
+
return a.NUMERIC_REGEX.test(e);
|
|
890
|
+
}
|
|
891
|
+
static isAlphanumeric(e) {
|
|
892
|
+
return a.ALPHANUMERIC_REGEX.test(e);
|
|
893
|
+
}
|
|
894
|
+
constructor(e, t, n) {
|
|
895
|
+
if (this.mode = e, this.numChars = t, this.bitData = n, t < 0) throw RangeError("Invalid argument");
|
|
896
|
+
this.bitData = n.slice();
|
|
897
|
+
}
|
|
898
|
+
getData() {
|
|
899
|
+
return this.bitData.slice();
|
|
900
|
+
}
|
|
901
|
+
static getTotalBits(e, t) {
|
|
902
|
+
let n = 0;
|
|
903
|
+
for (let r of e) {
|
|
904
|
+
let e = r.mode.numCharCountBits(t);
|
|
905
|
+
if (r.numChars >= 1 << e) return Infinity;
|
|
906
|
+
n += 4 + e + r.bitData.length;
|
|
907
|
+
}
|
|
908
|
+
return n;
|
|
909
|
+
}
|
|
910
|
+
static toUtf8ByteArray(e) {
|
|
911
|
+
e = encodeURI(e);
|
|
912
|
+
let t = [];
|
|
913
|
+
for (let n = 0; n < e.length; n++) e.charAt(n) == "%" ? (t.push(parseInt(e.substring(n + 1, n + 3), 16)), n += 2) : t.push(e.charCodeAt(n));
|
|
914
|
+
return t;
|
|
915
|
+
}
|
|
916
|
+
static {
|
|
917
|
+
this.NUMERIC_REGEX = /^[0-9]*$/;
|
|
918
|
+
}
|
|
919
|
+
static {
|
|
920
|
+
this.ALPHANUMERIC_REGEX = /^[A-Z0-9 $%*+.\/:-]*$/;
|
|
921
|
+
}
|
|
922
|
+
static {
|
|
923
|
+
this.ALPHANUMERIC_CHARSET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
e.QrSegment = a;
|
|
927
|
+
})(S ||= {}), (function(e) {
|
|
928
|
+
let t;
|
|
929
|
+
(function(e) {
|
|
930
|
+
class t {
|
|
931
|
+
static {
|
|
932
|
+
this.LOW = new t(0, 1);
|
|
933
|
+
}
|
|
934
|
+
static {
|
|
935
|
+
this.MEDIUM = new t(1, 0);
|
|
936
|
+
}
|
|
937
|
+
static {
|
|
938
|
+
this.QUARTILE = new t(2, 3);
|
|
939
|
+
}
|
|
940
|
+
static {
|
|
941
|
+
this.HIGH = new t(3, 2);
|
|
942
|
+
}
|
|
943
|
+
constructor(e, t) {
|
|
944
|
+
this.ordinal = e, this.formatBits = t;
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
e.Ecc = t;
|
|
948
|
+
})(t ||= e.QrCode ||= {});
|
|
949
|
+
})(S ||= {}), (function(e) {
|
|
950
|
+
let t;
|
|
951
|
+
(function(e) {
|
|
952
|
+
class t {
|
|
953
|
+
static {
|
|
954
|
+
this.NUMERIC = new t(1, [
|
|
955
|
+
10,
|
|
956
|
+
12,
|
|
957
|
+
14
|
|
958
|
+
]);
|
|
959
|
+
}
|
|
960
|
+
static {
|
|
961
|
+
this.ALPHANUMERIC = new t(2, [
|
|
962
|
+
9,
|
|
963
|
+
11,
|
|
964
|
+
13
|
|
965
|
+
]);
|
|
966
|
+
}
|
|
967
|
+
static {
|
|
968
|
+
this.BYTE = new t(4, [
|
|
969
|
+
8,
|
|
970
|
+
16,
|
|
971
|
+
16
|
|
972
|
+
]);
|
|
973
|
+
}
|
|
974
|
+
static {
|
|
975
|
+
this.KANJI = new t(8, [
|
|
976
|
+
8,
|
|
977
|
+
10,
|
|
978
|
+
12
|
|
979
|
+
]);
|
|
980
|
+
}
|
|
981
|
+
static {
|
|
982
|
+
this.ECI = new t(7, [
|
|
983
|
+
0,
|
|
984
|
+
0,
|
|
985
|
+
0
|
|
986
|
+
]);
|
|
987
|
+
}
|
|
988
|
+
constructor(e, t) {
|
|
989
|
+
this.modeBits = e, this.numBitsCharCount = t;
|
|
990
|
+
}
|
|
991
|
+
numCharCountBits(e) {
|
|
992
|
+
return this.numBitsCharCount[Math.floor((e + 7) / 17)];
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
e.Mode = t;
|
|
996
|
+
})(t ||= e.QrSegment ||= {});
|
|
997
|
+
})(S ||= {});
|
|
998
|
+
var C = S, w = {
|
|
999
|
+
L: C.QrCode.Ecc.LOW,
|
|
1000
|
+
M: C.QrCode.Ecc.MEDIUM,
|
|
1001
|
+
Q: C.QrCode.Ecc.QUARTILE,
|
|
1002
|
+
H: C.QrCode.Ecc.HIGH
|
|
1003
|
+
}, T = .5, E = .5, te = "react-qr-code", D = "react-qr-code-gradient", O = "react-qr-code-bg-gradient", ne = .1, k = [
|
|
1004
|
+
[
|
|
1005
|
+
1,
|
|
1006
|
+
1,
|
|
1007
|
+
1,
|
|
1008
|
+
1,
|
|
1009
|
+
1,
|
|
1010
|
+
1,
|
|
1011
|
+
1
|
|
1012
|
+
],
|
|
1013
|
+
[
|
|
1014
|
+
1,
|
|
1015
|
+
0,
|
|
1016
|
+
0,
|
|
1017
|
+
0,
|
|
1018
|
+
0,
|
|
1019
|
+
0,
|
|
1020
|
+
1
|
|
1021
|
+
],
|
|
1022
|
+
[
|
|
1023
|
+
1,
|
|
1024
|
+
0,
|
|
1025
|
+
0,
|
|
1026
|
+
0,
|
|
1027
|
+
0,
|
|
1028
|
+
0,
|
|
1029
|
+
1
|
|
1030
|
+
],
|
|
1031
|
+
[
|
|
1032
|
+
1,
|
|
1033
|
+
0,
|
|
1034
|
+
0,
|
|
1035
|
+
0,
|
|
1036
|
+
0,
|
|
1037
|
+
0,
|
|
1038
|
+
1
|
|
1039
|
+
],
|
|
1040
|
+
[
|
|
1041
|
+
1,
|
|
1042
|
+
0,
|
|
1043
|
+
0,
|
|
1044
|
+
0,
|
|
1045
|
+
0,
|
|
1046
|
+
0,
|
|
1047
|
+
1
|
|
1048
|
+
],
|
|
1049
|
+
[
|
|
1050
|
+
1,
|
|
1051
|
+
0,
|
|
1052
|
+
0,
|
|
1053
|
+
0,
|
|
1054
|
+
0,
|
|
1055
|
+
0,
|
|
1056
|
+
1
|
|
1057
|
+
],
|
|
1058
|
+
[
|
|
1059
|
+
1,
|
|
1060
|
+
1,
|
|
1061
|
+
1,
|
|
1062
|
+
1,
|
|
1063
|
+
1,
|
|
1064
|
+
1,
|
|
1065
|
+
1
|
|
1066
|
+
]
|
|
1067
|
+
], A = {
|
|
1068
|
+
"inpoint-sm": [
|
|
1069
|
+
0,
|
|
1070
|
+
90,
|
|
1071
|
+
-90
|
|
1072
|
+
],
|
|
1073
|
+
inpoint: [
|
|
1074
|
+
0,
|
|
1075
|
+
90,
|
|
1076
|
+
-90
|
|
1077
|
+
],
|
|
1078
|
+
"inpoint-lg": [
|
|
1079
|
+
0,
|
|
1080
|
+
90,
|
|
1081
|
+
-90
|
|
1082
|
+
],
|
|
1083
|
+
"outpoint-sm": [
|
|
1084
|
+
180,
|
|
1085
|
+
-90,
|
|
1086
|
+
90
|
|
1087
|
+
],
|
|
1088
|
+
outpoint: [
|
|
1089
|
+
180,
|
|
1090
|
+
-90,
|
|
1091
|
+
90
|
|
1092
|
+
],
|
|
1093
|
+
"outpoint-lg": [
|
|
1094
|
+
180,
|
|
1095
|
+
-90,
|
|
1096
|
+
90
|
|
1097
|
+
],
|
|
1098
|
+
"leaf-sm": [
|
|
1099
|
+
0,
|
|
1100
|
+
90,
|
|
1101
|
+
-90
|
|
1102
|
+
],
|
|
1103
|
+
leaf: [
|
|
1104
|
+
0,
|
|
1105
|
+
90,
|
|
1106
|
+
-90
|
|
1107
|
+
],
|
|
1108
|
+
"leaf-lg": [
|
|
1109
|
+
0,
|
|
1110
|
+
90,
|
|
1111
|
+
-90
|
|
1112
|
+
]
|
|
1113
|
+
}, j = {
|
|
1114
|
+
"rounded-sm": 3,
|
|
1115
|
+
rounded: 4,
|
|
1116
|
+
"rounded-lg": 5,
|
|
1117
|
+
"leaf-sm": 3,
|
|
1118
|
+
leaf: 4,
|
|
1119
|
+
"leaf-lg": 5,
|
|
1120
|
+
"inpoint-sm": 3,
|
|
1121
|
+
inpoint: 4,
|
|
1122
|
+
"inpoint-lg": 5,
|
|
1123
|
+
"outpoint-sm": 3,
|
|
1124
|
+
outpoint: 4,
|
|
1125
|
+
"outpoint-lg": 5
|
|
1126
|
+
}, M = {
|
|
1127
|
+
square: 0,
|
|
1128
|
+
diamond: 0,
|
|
1129
|
+
circle: 3,
|
|
1130
|
+
"rounded-sm": .5,
|
|
1131
|
+
rounded: .9,
|
|
1132
|
+
"rounded-lg": 1.1,
|
|
1133
|
+
"leaf-sm": 1.5,
|
|
1134
|
+
leaf: 2,
|
|
1135
|
+
"leaf-lg": 2.3,
|
|
1136
|
+
"inpoint-sm": 1.5,
|
|
1137
|
+
inpoint: 2,
|
|
1138
|
+
"inpoint-lg": 2.3,
|
|
1139
|
+
"outpoint-sm": 1.5,
|
|
1140
|
+
outpoint: 2,
|
|
1141
|
+
"outpoint-lg": 2.3
|
|
1142
|
+
}, N = [
|
|
1143
|
+
[
|
|
1144
|
+
0,
|
|
1145
|
+
0,
|
|
1146
|
+
0,
|
|
1147
|
+
0,
|
|
1148
|
+
0,
|
|
1149
|
+
0,
|
|
1150
|
+
0
|
|
1151
|
+
],
|
|
1152
|
+
[
|
|
1153
|
+
0,
|
|
1154
|
+
0,
|
|
1155
|
+
0,
|
|
1156
|
+
0,
|
|
1157
|
+
0,
|
|
1158
|
+
0,
|
|
1159
|
+
0
|
|
1160
|
+
],
|
|
1161
|
+
[
|
|
1162
|
+
0,
|
|
1163
|
+
0,
|
|
1164
|
+
1,
|
|
1165
|
+
1,
|
|
1166
|
+
1,
|
|
1167
|
+
0,
|
|
1168
|
+
0
|
|
1169
|
+
],
|
|
1170
|
+
[
|
|
1171
|
+
0,
|
|
1172
|
+
0,
|
|
1173
|
+
1,
|
|
1174
|
+
1,
|
|
1175
|
+
1,
|
|
1176
|
+
0,
|
|
1177
|
+
0
|
|
1178
|
+
],
|
|
1179
|
+
[
|
|
1180
|
+
0,
|
|
1181
|
+
0,
|
|
1182
|
+
1,
|
|
1183
|
+
1,
|
|
1184
|
+
1,
|
|
1185
|
+
0,
|
|
1186
|
+
0
|
|
1187
|
+
],
|
|
1188
|
+
[
|
|
1189
|
+
0,
|
|
1190
|
+
0,
|
|
1191
|
+
0,
|
|
1192
|
+
0,
|
|
1193
|
+
0,
|
|
1194
|
+
0,
|
|
1195
|
+
0
|
|
1196
|
+
],
|
|
1197
|
+
[
|
|
1198
|
+
0,
|
|
1199
|
+
0,
|
|
1200
|
+
0,
|
|
1201
|
+
0,
|
|
1202
|
+
0,
|
|
1203
|
+
0,
|
|
1204
|
+
0
|
|
1205
|
+
]
|
|
1206
|
+
], P = ({ x: e, y: t, numCells: n }) => !!(N[e]?.[t] || N[e - n + 7]?.[t] || N[e]?.[t - n + 7]), re = ({ x: e, y: t, radius: n }) => {
|
|
1207
|
+
let r = 3 - n, i = n / 2, a = 3 - i;
|
|
1208
|
+
return `M ${e} ${t + i}v ${r}a ${i} ${i}, 0, 0, 0, ${i} ${i}h ${a}v ${-a}a ${i} ${i}, 0, 0, 0, ${-i} ${-i}h ${-r}H ${e}z`;
|
|
1209
|
+
}, F = ({ x: e, y: t, radius: n }) => {
|
|
1210
|
+
let r = 3 - n, i = n / 2, a = 3 - i;
|
|
1211
|
+
return `M ${e} ${t + i}v ${r}a ${i} ${i}, 0, 0, 0, ${i} ${i}h ${a}v ${-a}a ${i} ${i}, 0, 0, 0, ${-i} ${-i}h ${-r}a ${i} ${i}, 0, 0, 0, ${-i} ${i}`;
|
|
1212
|
+
}, I = ({ x: e, y: t, numCells: n }) => !!(k[e]?.[t] || k[e - n + 7]?.[t] || k[e]?.[t - n + 7]), ie = ({ x: e, y: t, radius: n }) => {
|
|
1213
|
+
let r = 7 - n, i = n / 2;
|
|
1214
|
+
return `M ${e} ${t + i}v ${r}a ${i} ${i}, 0, 0, 0, ${i} ${i}h ${r}a ${i} ${i}, 0, 0, 0, ${i} ${-i}v ${-r}a ${i} ${i}, 0, 0, 0, ${-i} ${-i}h ${-r}a ${i} ${i}, 0, 0, 0, ${-i} ${i}M ${e + i} ${t + 1}h ${r}a ${i - 1} ${i - 1}, 0, 0, 1, ${i - 1} ${i - 1}v ${r}a ${i - 1} ${i - 1}, 0, 0, 1, ${-(i - 1)} ${i - 1}h ${-r}a ${i - 1} ${i - 1}, 0, 0, 1, ${-(i - 1)} ${-(i - 1)}v ${-r}a ${i - 1} ${i - 1}, 0, 0, 1, ${i - 1} ${-(i - 1)}`;
|
|
1215
|
+
}, ae = ({ x: e, y: t, radius: n }) => {
|
|
1216
|
+
let r = 7 - n, i = n / 2, a = 7 - i;
|
|
1217
|
+
return `M ${e} ${t + i}v ${r}a ${i} ${i}, 0, 0, 0, ${i} ${i}h ${a}v ${-a}a ${i} ${i}, 0, 0, 0, ${-i} ${-i}h ${-r}H ${e}zM ${e + i} ${t + 1}h ${r}a ${i - 1} ${i - 1}, 0, 0, 1, ${i - 1} ${i - 1}v ${a - 1}h ${-(a - 1)}a ${i - 1} ${i - 1}, 0, 0, 1, ${-(i - 1)} ${-(i - 1)}v ${-(a - 1)}z`;
|
|
1218
|
+
}, oe = ({ x: e, y: t, radius: n }) => {
|
|
1219
|
+
let r = 7 - n, i = n / 2, a = 7 - i;
|
|
1220
|
+
return `M ${e} ${t + i}v ${r}a ${i} ${i}, 0, 0, 0, ${i} ${i}h ${a}v ${-a}a ${i} ${i}, 0, 0, 0, ${-i} ${-i}h ${-r}a ${i} ${i}, 0, 0, 0, ${-i} ${i}M ${e + i} ${t + 1}h ${r}a ${i - 1} ${i - 1}, 0, 0, 1, ${i - 1} ${i - 1}v ${a - 1}h ${-(a - 1)}a ${i - 1} ${i - 1}, 0, 0, 1, ${-(i - 1)} ${-(i - 1)}v ${-r}a ${i - 1} ${i - 1}, 0, 0, 1, ${i - 1} ${-(i - 1)}`;
|
|
1221
|
+
}, se = (e) => e === "square" || e === "pinched-square" || e === "circle" || e === "star" || e === "heart" || e === "diamond" || e === "hashtag", ce = (e, t) => e === "square-sm" ? .75 : t ? Math.random() * .25 + .75 : 1, L = (e, t, n) => {
|
|
1222
|
+
let r = {
|
|
1223
|
+
left: e === 0 ? !1 : n[t][e - 1],
|
|
1224
|
+
right: e === n[t].length - 1 ? !1 : n[t][e + 1],
|
|
1225
|
+
top: t === 0 ? !1 : n[t - 1][e],
|
|
1226
|
+
bottom: t === n.length - 1 ? !1 : n[t + 1][e]
|
|
1227
|
+
};
|
|
1228
|
+
return {
|
|
1229
|
+
...r,
|
|
1230
|
+
count: Object.values(r).filter(Boolean).length
|
|
1231
|
+
};
|
|
1232
|
+
}, R = ({ x: e, y: t, modules: n, numCells: r }) => t >= 0 && t < n.length && e >= 0 && e < n[t].length && n[t][e] && !I({
|
|
1233
|
+
x: e,
|
|
1234
|
+
y: t,
|
|
1235
|
+
numCells: r
|
|
1236
|
+
}) && !P({
|
|
1237
|
+
x: e,
|
|
1238
|
+
y: t,
|
|
1239
|
+
numCells: r
|
|
1240
|
+
}), le = (e, t, n, r) => {
|
|
1241
|
+
let i = {
|
|
1242
|
+
left: R({
|
|
1243
|
+
x: e - 1,
|
|
1244
|
+
y: t,
|
|
1245
|
+
modules: n,
|
|
1246
|
+
numCells: r
|
|
1247
|
+
}),
|
|
1248
|
+
right: R({
|
|
1249
|
+
x: e + 1,
|
|
1250
|
+
y: t,
|
|
1251
|
+
modules: n,
|
|
1252
|
+
numCells: r
|
|
1253
|
+
}),
|
|
1254
|
+
top: R({
|
|
1255
|
+
x: e,
|
|
1256
|
+
y: t - 1,
|
|
1257
|
+
modules: n,
|
|
1258
|
+
numCells: r
|
|
1259
|
+
}),
|
|
1260
|
+
bottom: R({
|
|
1261
|
+
x: e,
|
|
1262
|
+
y: t + 1,
|
|
1263
|
+
modules: n,
|
|
1264
|
+
numCells: r
|
|
1265
|
+
})
|
|
1266
|
+
};
|
|
1267
|
+
return {
|
|
1268
|
+
...i,
|
|
1269
|
+
count: Object.values(i).filter(Boolean).length
|
|
1270
|
+
};
|
|
1271
|
+
}, z = (e, t, n, r) => `M${e},${t}h${n}v${r}h${-n}Z`, B = (e, t, n) => z(e, t, n, n), V = (e, t, n) => `M${e},${t + n / 2}a${n / 2},${n / 2} 0 1,0 ${n},0a${n / 2},${n / 2} 0 1,0 -${n},0Z`, H = (e, t, n) => `M${e},${t + n / 2}l${n / 2},-${n / 2}l${n / 2},${n / 2}l-${n / 2},${n / 2}Z`, U = (e, t, n) => `M${e - n},${t}a${n},${n} 0 1,1 ${n * 2},0a${n},${n} 0 1,1 ${-n * 2},0Z`, ue = ({ count: e }) => e === 1, de = (e, t) => `M ${e} ${t}
|
|
812
1272
|
v 1
|
|
813
1273
|
h 1
|
|
814
1274
|
v -0.5
|
|
815
|
-
a 0.5 0.5, 0, 0, 0, -0.5 -0.5`,
|
|
1275
|
+
a 0.5 0.5, 0, 0, 0, -0.5 -0.5`, W = (e, t) => `M ${e + 1} ${t}
|
|
816
1276
|
v 1
|
|
817
1277
|
h -1
|
|
818
1278
|
v -0.5
|
|
819
|
-
a 0.5 0.5, 0, 0, 1, 0.5 -0.5`, G = (
|
|
1279
|
+
a 0.5 0.5, 0, 0, 1, 0.5 -0.5`, G = (e, t) => `M ${e} ${t}
|
|
820
1280
|
v 1
|
|
821
1281
|
h 0.5
|
|
822
1282
|
a 0.5 0.5, 0, 0, 0, 0.5 -0.5
|
|
823
1283
|
v -0.5
|
|
824
|
-
h -1`,
|
|
1284
|
+
h -1`, K = (e, t) => `M ${e + 1} ${t}
|
|
825
1285
|
v 1
|
|
826
1286
|
h -0.5
|
|
827
1287
|
a 0.5 0.5, 0, 0, 1, -0.5 -0.5
|
|
828
1288
|
v -0.5
|
|
829
|
-
h 1`,
|
|
1289
|
+
h 1`, q = (e, t) => `M ${e} ${t}
|
|
830
1290
|
v 1
|
|
831
1291
|
h 0.5
|
|
832
|
-
a 0.5 0.5, 0, 0, 0, 0 -1`,
|
|
1292
|
+
a 0.5 0.5, 0, 0, 0, 0 -1`, J = (e, t) => `M ${e + 1} ${t}
|
|
833
1293
|
v 1
|
|
834
1294
|
h -0.5
|
|
835
|
-
a 0.5 0.5, 0, 0, 1, 0 -1`,
|
|
1295
|
+
a 0.5 0.5, 0, 0, 1, 0 -1`, Y = (e, t) => `M ${e} ${t + 1}
|
|
836
1296
|
h 1
|
|
837
1297
|
v -0.5
|
|
838
|
-
a 0.5 0.5, 0, 0, 0, -1 0`,
|
|
1298
|
+
a 0.5 0.5, 0, 0, 0, -1 0`, X = (e, t) => `M ${e} ${t}
|
|
839
1299
|
h 1
|
|
840
1300
|
v 0.5
|
|
841
|
-
a 0.5 0.5, 0, 0, 1, -1 0`,
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
})
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
},
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
}
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
})
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
})
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
}
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
})
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
}
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
}, $.onerror = (d) => console.error("Error loading QR code:", d);
|
|
1247
|
-
}, Jt = ct((s, a) => {
|
|
1248
|
-
const {
|
|
1249
|
-
value: c,
|
|
1250
|
-
size: i = pt,
|
|
1251
|
-
level: o = mt,
|
|
1252
|
-
background: u,
|
|
1253
|
-
gradient: l,
|
|
1254
|
-
minVersion: m = gt,
|
|
1255
|
-
boostLevel: f,
|
|
1256
|
-
marginSize: e,
|
|
1257
|
-
finderPatternOuterSettings: n,
|
|
1258
|
-
finderPatternInnerSettings: t,
|
|
1259
|
-
dataModulesSettings: r,
|
|
1260
|
-
imageSettings: h,
|
|
1261
|
-
svgProps: $
|
|
1262
|
-
} = s, d = lt(null), { gradientId: M, bgGradientId: g } = jt(), { margin: A, cells: E, numCells: p, calculatedImageSettings: N } = xt({
|
|
1263
|
-
value: c,
|
|
1264
|
-
level: o,
|
|
1265
|
-
minVersion: m,
|
|
1266
|
-
boostLevel: f,
|
|
1267
|
-
marginSize: e,
|
|
1268
|
-
imageSettings: h,
|
|
1269
|
-
size: i
|
|
1270
|
-
});
|
|
1271
|
-
ht(a, () => ({
|
|
1272
|
-
svg: d.current,
|
|
1273
|
-
download: ({
|
|
1274
|
-
name: O = It,
|
|
1275
|
-
format: _ = "svg",
|
|
1276
|
-
size: z = 500
|
|
1277
|
-
}) => {
|
|
1278
|
-
d.current && (_ === "svg" ? Kt({ svgRef: d, fileSize: z, fileName: O }) : Wt({
|
|
1279
|
-
svgRef: d,
|
|
1280
|
-
fileSize: z,
|
|
1281
|
-
fileName: O,
|
|
1282
|
-
fileFormat: _,
|
|
1283
|
-
imageSettings: h,
|
|
1284
|
-
calculatedImageSettings: N,
|
|
1285
|
-
size: i,
|
|
1286
|
-
numCells: p,
|
|
1287
|
-
margin: A
|
|
1288
|
-
}));
|
|
1289
|
-
}
|
|
1290
|
-
}));
|
|
1291
|
-
let I = E, w = null;
|
|
1292
|
-
h != null && N != null && (N.excavation != null && (I = Vt(E, N.excavation)), w = /* @__PURE__ */ C(
|
|
1293
|
-
"image",
|
|
1294
|
-
{
|
|
1295
|
-
href: h.src,
|
|
1296
|
-
height: N.h,
|
|
1297
|
-
width: N.w,
|
|
1298
|
-
x: N.x + A,
|
|
1299
|
-
y: N.y + A,
|
|
1300
|
-
preserveAspectRatio: "none",
|
|
1301
|
-
opacity: N.opacity,
|
|
1302
|
-
crossOrigin: N.crossOrigin
|
|
1303
|
-
}
|
|
1304
|
-
));
|
|
1305
|
-
const P = {
|
|
1306
|
-
modules: I,
|
|
1307
|
-
margin: A,
|
|
1308
|
-
gradient: l,
|
|
1309
|
-
gradientId: M
|
|
1310
|
-
};
|
|
1311
|
-
return /* @__PURE__ */ K(
|
|
1312
|
-
"svg",
|
|
1313
|
-
{
|
|
1314
|
-
height: i,
|
|
1315
|
-
width: i,
|
|
1316
|
-
viewBox: `0 0 ${p} ${p}`,
|
|
1317
|
-
ref: d,
|
|
1318
|
-
role: "img",
|
|
1319
|
-
"aria-label": $?.["aria-label"] || "QR Code",
|
|
1320
|
-
...$,
|
|
1321
|
-
children: [
|
|
1322
|
-
/* @__PURE__ */ C(Gt, { gradient: l, gradientId: M }),
|
|
1323
|
-
/* @__PURE__ */ C(
|
|
1324
|
-
$t,
|
|
1325
|
-
{
|
|
1326
|
-
background: u,
|
|
1327
|
-
bgGradientId: g,
|
|
1328
|
-
numCells: p
|
|
1329
|
-
}
|
|
1330
|
-
),
|
|
1331
|
-
/* @__PURE__ */ C(Yt, { settings: n, ...P }),
|
|
1332
|
-
/* @__PURE__ */ C(qt, { settings: t, ...P }),
|
|
1333
|
-
/* @__PURE__ */ C(Qt, { settings: r, ...P }),
|
|
1334
|
-
w
|
|
1335
|
-
]
|
|
1336
|
-
}
|
|
1337
|
-
);
|
|
1301
|
+
a 0.5 0.5, 0, 0, 1, -1 0`, fe = (e, t, n) => `M ${e + 1} ${t}h -${n / 2}a ${n / 2.5} ${n / 2.5}, 0, 0, 0, ${-n / 2.5} ${n / 2.5}v ${n / 2}h ${n / 2}a ${n / 2.5} ${n / 2.5}, 0, 0, 0, ${n / 2.5} ${-n / 2.5}`, pe = (e) => ({
|
|
1302
|
+
color: e?.color || "#000000",
|
|
1303
|
+
style: e?.style || "square",
|
|
1304
|
+
randomSize: e?.randomSize || !1
|
|
1305
|
+
}), me = (e) => ({
|
|
1306
|
+
color: e?.color || "#000000",
|
|
1307
|
+
style: e?.style || "square"
|
|
1308
|
+
}), he = (e) => ({
|
|
1309
|
+
color: e?.color || "#000000",
|
|
1310
|
+
style: e?.style || "square"
|
|
1311
|
+
}), ge = ({ modules: e, margin: n, settings: r, gradient: a, gradientId: o }) => {
|
|
1312
|
+
let { color: c, style: l, randomSize: u } = i(() => pe(r), [r]), d = [], m = e.length, h = se(l) && u, g = t(() => ce(l, h), [l, h]);
|
|
1313
|
+
return e.forEach((t, r) => {
|
|
1314
|
+
t.forEach((t, i) => {
|
|
1315
|
+
if (I({
|
|
1316
|
+
x: i,
|
|
1317
|
+
y: r,
|
|
1318
|
+
numCells: m
|
|
1319
|
+
}) || P({
|
|
1320
|
+
x: i,
|
|
1321
|
+
y: r,
|
|
1322
|
+
numCells: m
|
|
1323
|
+
})) return;
|
|
1324
|
+
let a = g(), o = 1 * a, s = (1 - 1 * a) / 2, c = i + n + s, u = r + n + s;
|
|
1325
|
+
if (t) {
|
|
1326
|
+
if (l === "circuit-board") {
|
|
1327
|
+
let t = i + n + .5, a = r + n + .5, o = T / 2, s = 1 + T, c = le(i, r, e, m), { right: l, bottom: u, count: f } = c;
|
|
1328
|
+
if (l && d.push(z(t - o, a - o, s, T)), u && d.push(z(t - o, a - o, T, s)), f === 0) {
|
|
1329
|
+
let e = .75, t = (1 - e) / 2;
|
|
1330
|
+
d.push(B(i + n + t, r + n + t, e));
|
|
1331
|
+
} else ue({
|
|
1332
|
+
...c,
|
|
1333
|
+
count: f
|
|
1334
|
+
}) && d.push(U(t, a, E));
|
|
1335
|
+
} else if (l === "square" || l === "square-sm") d.push(B(c, u, o));
|
|
1336
|
+
else if (l === "pinched-square") d.push(p(c, u, o, .25));
|
|
1337
|
+
else if (l === "circle") d.push(V(c, u, o));
|
|
1338
|
+
else if (l === "diamond") d.push(H(c, u, o));
|
|
1339
|
+
else if (l === "star") d.push(f(c + o / 2, u + o / 2, o * 1.1, 5));
|
|
1340
|
+
else if (l === "heart") d.push(b(c, u, o));
|
|
1341
|
+
else if (l === "hashtag") d.push(y(c, u, o));
|
|
1342
|
+
else if (l === "rounded") {
|
|
1343
|
+
let { left: t, right: n, top: a, bottom: o, count: s } = L(i, r, e);
|
|
1344
|
+
s === 0 ? d.push(V(c, u, 1)) : s > 2 || t && n || a && o ? d.push(B(c, u, 1)) : s === 2 ? t && a ? d.push(G(c, u)) : a && n ? d.push(K(c, u)) : n && o ? d.push(W(c, u)) : d.push(de(c, u)) : a ? d.push(X(c, u)) : n ? d.push(J(c, u)) : o ? d.push(Y(c, u)) : d.push(q(c, u));
|
|
1345
|
+
} else if (l === "leaf") {
|
|
1346
|
+
let { left: t, right: n, top: a, bottom: s, count: l } = L(i, r, e);
|
|
1347
|
+
if (l === 0) d.push(fe(c, u, o));
|
|
1348
|
+
else if (!t && !a) {
|
|
1349
|
+
d.push(W(c, u));
|
|
1350
|
+
return;
|
|
1351
|
+
} else !n && !s ? d.push(G(c, u)) : d.push(B(c, u, 1));
|
|
1352
|
+
} else if (l === "vertical-line") {
|
|
1353
|
+
let { left: t, right: n, top: a, bottom: o, count: s } = L(i, r, e);
|
|
1354
|
+
s === 0 || t && !(a || o) || n && !(a || o) ? d.push(V(c, u, 1)) : a && o ? d.push(B(c, u, 1)) : a && !o ? d.push(X(c, u)) : o && !a && d.push(Y(c, u));
|
|
1355
|
+
} else if (l === "horizontal-line") {
|
|
1356
|
+
let { left: t, right: n, top: a, bottom: o, count: s } = L(i, r, e);
|
|
1357
|
+
s === 0 || a && !(t || n) || o && !(t || n) ? d.push(V(c, u, 1)) : t && n ? d.push(B(c, u, 1)) : t && !n ? d.push(q(c, u)) : n && !t && d.push(J(c, u));
|
|
1358
|
+
}
|
|
1359
|
+
}
|
|
1360
|
+
});
|
|
1361
|
+
}), /* @__PURE__ */ s("path", {
|
|
1362
|
+
fill: a ? `url(#${o})` : c,
|
|
1363
|
+
d: d.join(""),
|
|
1364
|
+
shapeRendering: l === "square" ? "crispEdges" : "geometricPrecision",
|
|
1365
|
+
"data-testid": "data-modules"
|
|
1366
|
+
});
|
|
1367
|
+
}, Z = { "data-testid": "finder-patterns-inner" }, _e = ({ modules: e, margin: t, settings: n, gradient: r, gradientId: a }) => {
|
|
1368
|
+
let { color: o, style: c } = i(() => he(n), [n]), l = r ? `url(#${a})` : o, u = i(() => [
|
|
1369
|
+
{
|
|
1370
|
+
x: t + 2,
|
|
1371
|
+
y: t + 2
|
|
1372
|
+
},
|
|
1373
|
+
{
|
|
1374
|
+
x: e.length + t - 7 + 2,
|
|
1375
|
+
y: t + 2
|
|
1376
|
+
},
|
|
1377
|
+
{
|
|
1378
|
+
x: t + 2,
|
|
1379
|
+
y: e.length + t - 7 + 2
|
|
1380
|
+
}
|
|
1381
|
+
], [t, e.length]), d = (e, t) => `finder-patterns-inner-${c}-${e}-${t}`;
|
|
1382
|
+
if (c === "rounded-sm" || c === "rounded" || c === "rounded-lg" || c === "circle" || c === "square") return u.map((e) => {
|
|
1383
|
+
let { x: t, y: n } = e;
|
|
1384
|
+
return /* @__PURE__ */ s("rect", {
|
|
1385
|
+
x: t,
|
|
1386
|
+
y: n,
|
|
1387
|
+
width: 3,
|
|
1388
|
+
height: 3,
|
|
1389
|
+
fill: l,
|
|
1390
|
+
rx: M[c],
|
|
1391
|
+
...Z
|
|
1392
|
+
}, d(t, n));
|
|
1393
|
+
});
|
|
1394
|
+
if (c === "pinched-square") return u.map((e) => {
|
|
1395
|
+
let { x: t, y: n } = e;
|
|
1396
|
+
return /* @__PURE__ */ s("path", {
|
|
1397
|
+
fill: l,
|
|
1398
|
+
d: p(t, n, 3, .25),
|
|
1399
|
+
...Z
|
|
1400
|
+
}, d(t, n));
|
|
1401
|
+
});
|
|
1402
|
+
if (c === "diamond") return u.map((e) => {
|
|
1403
|
+
let { x: t, y: n } = e, r = Math.sqrt(1.5), i = 3 / r, a = i - i / r;
|
|
1404
|
+
return /* @__PURE__ */ s("rect", {
|
|
1405
|
+
x: t + a / 2,
|
|
1406
|
+
y: n + a / 2,
|
|
1407
|
+
width: i,
|
|
1408
|
+
height: i,
|
|
1409
|
+
fill: l,
|
|
1410
|
+
style: {
|
|
1411
|
+
transform: "rotate(45deg)",
|
|
1412
|
+
transformOrigin: "center",
|
|
1413
|
+
transformBox: "fill-box"
|
|
1414
|
+
},
|
|
1415
|
+
...Z
|
|
1416
|
+
}, d(t, n));
|
|
1417
|
+
});
|
|
1418
|
+
if (c === "inpoint-sm" || c === "inpoint" || c === "inpoint-lg" || c === "outpoint-sm" || c === "outpoint" || c === "outpoint-lg" || c === "leaf-sm" || c === "leaf" || c === "leaf-lg") {
|
|
1419
|
+
let e = c === "leaf-sm" || c === "leaf" || c === "leaf-lg" ? re : F;
|
|
1420
|
+
return u.map((e, t) => ({
|
|
1421
|
+
...e,
|
|
1422
|
+
rotation: A[c][t]
|
|
1423
|
+
})).map(({ x: t, y: n, rotation: r }) => /* @__PURE__ */ s("path", {
|
|
1424
|
+
fill: l,
|
|
1425
|
+
d: e({
|
|
1426
|
+
x: t,
|
|
1427
|
+
y: n,
|
|
1428
|
+
radius: M[c]
|
|
1429
|
+
}),
|
|
1430
|
+
style: {
|
|
1431
|
+
transform: `rotate(${r}deg)`,
|
|
1432
|
+
transformOrigin: "center",
|
|
1433
|
+
transformBox: "fill-box"
|
|
1434
|
+
},
|
|
1435
|
+
...Z
|
|
1436
|
+
}, d(t, n)));
|
|
1437
|
+
}
|
|
1438
|
+
if (c === "heart") return u.map(({ x: e, y: t }) => /* @__PURE__ */ s("path", {
|
|
1439
|
+
fill: l,
|
|
1440
|
+
d: b(e, t, 3),
|
|
1441
|
+
...Z
|
|
1442
|
+
}, d(e, t)));
|
|
1443
|
+
if (c === "star") return u.map(({ x: e, y: t }) => /* @__PURE__ */ s("path", {
|
|
1444
|
+
fill: l,
|
|
1445
|
+
d: f(e + 3 / 2, t + 3 / 2, 3 * 1.2, 5),
|
|
1446
|
+
...Z
|
|
1447
|
+
}, d(e, t)));
|
|
1448
|
+
if (c === "microchip") return u.map(({ x: e, y: t }) => /* @__PURE__ */ s("path", {
|
|
1449
|
+
fill: l,
|
|
1450
|
+
d: v(e, t, 3),
|
|
1451
|
+
...Z
|
|
1452
|
+
}, d(e, t)));
|
|
1453
|
+
if (c === "hashtag") return u.map(({ x: e, y: t }) => /* @__PURE__ */ s("path", {
|
|
1454
|
+
fill: l,
|
|
1455
|
+
d: y(e - .25, t - .25, 3.5),
|
|
1456
|
+
...Z
|
|
1457
|
+
}, d(e, t)));
|
|
1458
|
+
}, Q = { "data-testid": "finder-patterns-outer" }, ve = ({ modules: e, margin: t, settings: n, gradient: r, gradientId: a }) => {
|
|
1459
|
+
let { style: o, color: c } = i(() => me(n), [n]), l = r ? `url(#${a})` : c, u = [], d = i(() => [
|
|
1460
|
+
{
|
|
1461
|
+
x: t,
|
|
1462
|
+
y: t
|
|
1463
|
+
},
|
|
1464
|
+
{
|
|
1465
|
+
x: e.length + t - 7,
|
|
1466
|
+
y: t
|
|
1467
|
+
},
|
|
1468
|
+
{
|
|
1469
|
+
x: t,
|
|
1470
|
+
y: e.length + t - 7
|
|
1471
|
+
}
|
|
1472
|
+
], [t, e.length]);
|
|
1473
|
+
if ([
|
|
1474
|
+
"rounded-sm",
|
|
1475
|
+
"rounded",
|
|
1476
|
+
"rounded-lg",
|
|
1477
|
+
"circle",
|
|
1478
|
+
"square",
|
|
1479
|
+
"pinched-square"
|
|
1480
|
+
].includes(o)) {
|
|
1481
|
+
for (let e of d) {
|
|
1482
|
+
let { x: t, y: n } = e;
|
|
1483
|
+
if (o === "rounded-sm" || o === "rounded" || o === "rounded-lg") u.push(ie({
|
|
1484
|
+
x: t,
|
|
1485
|
+
y: n,
|
|
1486
|
+
radius: j[o]
|
|
1487
|
+
}));
|
|
1488
|
+
else if (o === "circle") u.push(`M ${t + 7 / 2} ${n}a ${7 / 2} ${7 / 2} 0 1 0 0.01 0zzm 0 1a ${7 / 2 - 1} ${7 / 2 - 1} 0 1 1 -0.01 0Z`);
|
|
1489
|
+
else if (o === "pinched-square") {
|
|
1490
|
+
let e = .5, r = 1.25;
|
|
1491
|
+
u.push(`M ${t} ${n}Q ${t + e} ${n + 7 / 2}, ${t} ${n + 7}Q ${t + 7 / 2} ${n + 7 - e}, ${t + 7} ${n + 7}Q ${t + 7 - e} ${n + 7 / 2}, ${t + 7} ${n}Q ${t + 7 / 2} ${n + e}, ${t} ${n}zM ${t + 1} ${n + 1}Q ${t + 7 / 2} ${n + r}, ${t + 7 - 1} ${n + 1}Q ${t + 7 - r} ${n + 7 / 2}, ${t + 7 - 1} ${n + 7 - 1}Q ${t + 7 / 2} ${n + 7 - r}, ${t + 1} ${n + 7 - 1}Q ${t + r} ${n + 7 / 2}, ${t + 1} ${n + 1}z`);
|
|
1492
|
+
} else u.push(`M ${t} ${n}v 7h 7v -7zM ${t + 1} ${n + 1}h 5v 5h -5z`);
|
|
1493
|
+
}
|
|
1494
|
+
return /* @__PURE__ */ s("path", {
|
|
1495
|
+
fill: l,
|
|
1496
|
+
d: u.join(""),
|
|
1497
|
+
...Q
|
|
1498
|
+
});
|
|
1499
|
+
}
|
|
1500
|
+
if (o === "inpoint-sm" || o === "inpoint" || o === "inpoint-lg" || o === "outpoint-sm" || o === "outpoint" || o === "outpoint-lg" || o === "leaf-sm" || o === "leaf" || o === "leaf-lg") {
|
|
1501
|
+
let e = o === "leaf-sm" || o === "leaf" || o === "leaf-lg" ? ae : oe;
|
|
1502
|
+
return d.map((e, t) => ({
|
|
1503
|
+
...e,
|
|
1504
|
+
rotation: A[o][t]
|
|
1505
|
+
})).map(({ x: t, y: n, rotation: r }) => /* @__PURE__ */ s("path", {
|
|
1506
|
+
fill: l,
|
|
1507
|
+
d: e({
|
|
1508
|
+
x: t,
|
|
1509
|
+
y: n,
|
|
1510
|
+
radius: j[o]
|
|
1511
|
+
}),
|
|
1512
|
+
style: {
|
|
1513
|
+
transform: `rotate(${r}deg)`,
|
|
1514
|
+
transformOrigin: "center",
|
|
1515
|
+
transformBox: "fill-box"
|
|
1516
|
+
},
|
|
1517
|
+
...Q
|
|
1518
|
+
}, `finder-patterns-outer-${o}-${t}-${n}`));
|
|
1519
|
+
}
|
|
1520
|
+
}, ye = ({ gradient: e, gradientId: t }) => {
|
|
1521
|
+
if (!e) return null;
|
|
1522
|
+
let n = d(e?.rotation || 0);
|
|
1523
|
+
return /* @__PURE__ */ s("defs", { children: e.type === "linear" ? /* @__PURE__ */ s("linearGradient", {
|
|
1524
|
+
id: t,
|
|
1525
|
+
gradientUnits: "userSpaceOnUse",
|
|
1526
|
+
...n,
|
|
1527
|
+
children: e.stops?.map((e, t) => /* @__PURE__ */ s("stop", {
|
|
1528
|
+
offset: e.offset,
|
|
1529
|
+
stopColor: e.color
|
|
1530
|
+
}, t))
|
|
1531
|
+
}) : /* @__PURE__ */ s("radialGradient", {
|
|
1532
|
+
id: t,
|
|
1533
|
+
gradientUnits: "userSpaceOnUse",
|
|
1534
|
+
cx: "50%",
|
|
1535
|
+
cy: "50%",
|
|
1536
|
+
r: "50%",
|
|
1537
|
+
children: e.stops?.map((e, t) => /* @__PURE__ */ s("stop", {
|
|
1538
|
+
offset: e.offset,
|
|
1539
|
+
stopColor: e.color
|
|
1540
|
+
}, t))
|
|
1541
|
+
}) });
|
|
1542
|
+
}, be = () => {
|
|
1543
|
+
let e = n();
|
|
1544
|
+
return {
|
|
1545
|
+
gradientId: `${D}-${e}`,
|
|
1546
|
+
bgGradientId: `${O}-${e}`
|
|
1547
|
+
};
|
|
1548
|
+
}, xe = (e, t) => e.slice().map((e, n) => n < t.y || n >= t.y + t.h ? e : e.map((e, n) => n < t.x || n >= t.x + t.w ? e : !1)), Se = (e, t, n, r) => {
|
|
1549
|
+
if (r == null) return null;
|
|
1550
|
+
let i = e.length + n * 2, a = Math.floor(t * ne), o = i / t, s = (r.width || a) * o, c = (r.height || a) * o, l = r.x == null ? e.length / 2 - s / 2 : r.x * o, u = r.y == null ? e.length / 2 - c / 2 : r.y * o, d = r.opacity == null ? 1 : r.opacity, f = null;
|
|
1551
|
+
if (r.excavate) {
|
|
1552
|
+
let e = Math.floor(l), t = Math.floor(u);
|
|
1553
|
+
f = {
|
|
1554
|
+
x: e,
|
|
1555
|
+
y: t,
|
|
1556
|
+
w: Math.ceil(s + l - e),
|
|
1557
|
+
h: Math.ceil(c + u - t)
|
|
1558
|
+
};
|
|
1559
|
+
}
|
|
1560
|
+
let p = r.crossOrigin;
|
|
1561
|
+
return {
|
|
1562
|
+
x: l,
|
|
1563
|
+
y: u,
|
|
1564
|
+
h: c,
|
|
1565
|
+
w: s,
|
|
1566
|
+
excavation: f,
|
|
1567
|
+
opacity: d,
|
|
1568
|
+
crossOrigin: p
|
|
1569
|
+
};
|
|
1570
|
+
}, Ce = (e) => e == null ? 4 : Math.max(Math.floor(e), 0), we = ({ value: e, level: t, minVersion: n, marginSize: r, imageSettings: a, size: o, boostLevel: s }) => {
|
|
1571
|
+
let c = i(() => {
|
|
1572
|
+
let r = (Array.isArray(e) ? e : [e]).reduce((e, t) => (e.push(...C.QrSegment.makeSegments(t)), e), []);
|
|
1573
|
+
return C.QrCode.encodeSegments(r, w[t], n, void 0, void 0, s);
|
|
1574
|
+
}, [
|
|
1575
|
+
e,
|
|
1576
|
+
t,
|
|
1577
|
+
n,
|
|
1578
|
+
s
|
|
1579
|
+
]), { cells: l, margin: u, numCells: d, calculatedImageSettings: f } = i(() => {
|
|
1580
|
+
let e = c.getModules(), t = Ce(r);
|
|
1581
|
+
return {
|
|
1582
|
+
cells: e,
|
|
1583
|
+
margin: t,
|
|
1584
|
+
numCells: e.length + t * 2,
|
|
1585
|
+
calculatedImageSettings: Se(e, o, t, a)
|
|
1586
|
+
};
|
|
1587
|
+
}, [
|
|
1588
|
+
c,
|
|
1589
|
+
o,
|
|
1590
|
+
a,
|
|
1591
|
+
r
|
|
1592
|
+
]);
|
|
1593
|
+
return {
|
|
1594
|
+
qrcode: c,
|
|
1595
|
+
margin: u,
|
|
1596
|
+
cells: l,
|
|
1597
|
+
numCells: d,
|
|
1598
|
+
calculatedImageSettings: f
|
|
1599
|
+
};
|
|
1600
|
+
}, Te = ({ svgRef: e, fileSize: t, fileName: n }) => {
|
|
1601
|
+
if (!e.current) return;
|
|
1602
|
+
let r = e.current.cloneNode(!0);
|
|
1603
|
+
r.setAttribute("width", t.toString()), r.setAttribute("height", t.toString());
|
|
1604
|
+
let i = new XMLSerializer(), a = new Blob([i.serializeToString(r)], { type: "image/svg+xml" }), o = URL.createObjectURL(a), s = document.createElement("a");
|
|
1605
|
+
s.href = o, s.download = `${n}.svg`, document.body.appendChild(s), s.click(), document.body.removeChild(s), URL.revokeObjectURL(o);
|
|
1606
|
+
}, Ee = ({ svgRef: e, fileSize: t, fileName: n, fileFormat: r, imageSettings: i, calculatedImageSettings: a, size: o, numCells: s, margin: c }) => {
|
|
1607
|
+
if (!e.current) return;
|
|
1608
|
+
let l = document.createElement("canvas"), u = l.getContext("2d");
|
|
1609
|
+
if (!u) return;
|
|
1610
|
+
l.width = t, l.height = t;
|
|
1611
|
+
let d = new XMLSerializer().serializeToString(e.current), f = new Blob([d], { type: "image/svg+xml;charset=utf-8" }), p = URL.createObjectURL(f), m = new Image();
|
|
1612
|
+
m.crossOrigin = "anonymous", m.src = p, m.onload = () => {
|
|
1613
|
+
if (u.drawImage(m, 0, 0, t, t), URL.revokeObjectURL(p), i?.src && a) {
|
|
1614
|
+
let e = new Image();
|
|
1615
|
+
e.crossOrigin = "anonymous", e.src = i.src, e.onload = () => {
|
|
1616
|
+
let d = t / o, f = s / t, p = i.width * d, m = i.x ? (a.x + c) / f : (t - p) / 2, h = i.y ? (a.y + c) / f : (t - p) / 2;
|
|
1617
|
+
u.drawImage(e, m, h, p, p);
|
|
1618
|
+
let g = r === "png" ? "image/png" : "image/jpeg", _ = document.createElement("a");
|
|
1619
|
+
_.href = l.toDataURL(g), _.download = `${n}.${r}`, document.body.appendChild(_), _.click(), document.body.removeChild(_);
|
|
1620
|
+
}, e.onerror = (e) => console.error("Error loading logo:", e);
|
|
1621
|
+
} else {
|
|
1622
|
+
let e = r === "png" ? "image/png" : "image/jpeg", t = document.createElement("a");
|
|
1623
|
+
t.href = l.toDataURL(e), t.download = `${n}.${r}`, document.body.appendChild(t), t.click(), document.body.removeChild(t);
|
|
1624
|
+
}
|
|
1625
|
+
}, m.onerror = (e) => console.error("Error loading QR code:", e);
|
|
1626
|
+
}, $ = e((e, t) => {
|
|
1627
|
+
let { value: n, size: i = 128, level: o = "M", background: l, gradient: u, minVersion: d = 1, boostLevel: f, marginSize: p, finderPatternOuterSettings: m, finderPatternInnerSettings: h, dataModulesSettings: g, imageSettings: _, svgProps: v } = e, y = a(null), { gradientId: b, bgGradientId: x } = be(), { margin: S, cells: C, numCells: w, calculatedImageSettings: T } = we({
|
|
1628
|
+
value: n,
|
|
1629
|
+
level: o,
|
|
1630
|
+
minVersion: d,
|
|
1631
|
+
boostLevel: f,
|
|
1632
|
+
marginSize: p,
|
|
1633
|
+
imageSettings: _,
|
|
1634
|
+
size: i
|
|
1635
|
+
});
|
|
1636
|
+
r(t, () => ({
|
|
1637
|
+
svg: y.current,
|
|
1638
|
+
download: ({ name: e = te, format: t = "svg", size: n = 500 }) => {
|
|
1639
|
+
y.current && (t === "svg" ? Te({
|
|
1640
|
+
svgRef: y,
|
|
1641
|
+
fileSize: n,
|
|
1642
|
+
fileName: e
|
|
1643
|
+
}) : Ee({
|
|
1644
|
+
svgRef: y,
|
|
1645
|
+
fileSize: n,
|
|
1646
|
+
fileName: e,
|
|
1647
|
+
fileFormat: t,
|
|
1648
|
+
imageSettings: _,
|
|
1649
|
+
calculatedImageSettings: T,
|
|
1650
|
+
size: i,
|
|
1651
|
+
numCells: w,
|
|
1652
|
+
margin: S
|
|
1653
|
+
}));
|
|
1654
|
+
}
|
|
1655
|
+
}));
|
|
1656
|
+
let E = C, D = null;
|
|
1657
|
+
_ != null && T != null && (T.excavation != null && (E = xe(C, T.excavation)), D = /* @__PURE__ */ s("image", {
|
|
1658
|
+
href: _.src,
|
|
1659
|
+
height: T.h,
|
|
1660
|
+
width: T.w,
|
|
1661
|
+
x: T.x + S,
|
|
1662
|
+
y: T.y + S,
|
|
1663
|
+
preserveAspectRatio: "none",
|
|
1664
|
+
opacity: T.opacity,
|
|
1665
|
+
crossOrigin: T.crossOrigin
|
|
1666
|
+
}));
|
|
1667
|
+
let O = {
|
|
1668
|
+
modules: E,
|
|
1669
|
+
margin: S,
|
|
1670
|
+
gradient: u,
|
|
1671
|
+
gradientId: b
|
|
1672
|
+
};
|
|
1673
|
+
return /* @__PURE__ */ c("svg", {
|
|
1674
|
+
height: i,
|
|
1675
|
+
width: i,
|
|
1676
|
+
viewBox: `0 0 ${w} ${w}`,
|
|
1677
|
+
ref: y,
|
|
1678
|
+
role: "img",
|
|
1679
|
+
"aria-label": v?.["aria-label"] || "QR Code",
|
|
1680
|
+
...v,
|
|
1681
|
+
children: [
|
|
1682
|
+
/* @__PURE__ */ s(ye, {
|
|
1683
|
+
gradient: u,
|
|
1684
|
+
gradientId: b
|
|
1685
|
+
}),
|
|
1686
|
+
/* @__PURE__ */ s(ee, {
|
|
1687
|
+
background: l,
|
|
1688
|
+
bgGradientId: x,
|
|
1689
|
+
numCells: w
|
|
1690
|
+
}),
|
|
1691
|
+
/* @__PURE__ */ s(ve, {
|
|
1692
|
+
settings: m,
|
|
1693
|
+
...O
|
|
1694
|
+
}),
|
|
1695
|
+
/* @__PURE__ */ s(_e, {
|
|
1696
|
+
settings: h,
|
|
1697
|
+
...O
|
|
1698
|
+
}),
|
|
1699
|
+
/* @__PURE__ */ s(ge, {
|
|
1700
|
+
settings: g,
|
|
1701
|
+
...O
|
|
1702
|
+
}),
|
|
1703
|
+
D
|
|
1704
|
+
]
|
|
1705
|
+
});
|
|
1338
1706
|
});
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
};
|
|
1707
|
+
$.displayName = "ReactQRCode";
|
|
1708
|
+
//#endregion
|
|
1709
|
+
export { $ as ReactQRCode };
|