@tectra-ng/qr 0.0.0-stage → 0.1.6

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Tectra contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,52 @@
1
- # Temporary Holding Version
1
+ # @tectra-ng/qr
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ ```bash
4
+ npm install @tectra-ng/qr
5
+ ```
6
+
7
+ QR codes in plain TypeScript with no dependencies — for any framework, Node and server rendering. The encoder covers the whole standard: versions 1–40, error-correction levels L, M, Q and H, numeric, alphanumeric and UTF-8 text. On top of it: SVG paths with shaped dots and corner eyes, a finished SVG with colours, gradients and a logo, and a PNG in the browser. `tectra-ng` includes it; in Angular use the `<tx-qr-code>` block from `@tectra-ng/blocks/qr-code`.
8
+
9
+ ```ts
10
+ import { qrToPng, qrToSvg } from '@tectra-ng/qr';
11
+
12
+ const svg = qrToSvg('https://example.com', {
13
+ size: 240,
14
+ dotStyle: 'rounded',
15
+ eyeFrameStyle: 'rounded',
16
+ eyeBallStyle: 'circle',
17
+ gradient: { type: 'linear', colors: ['#111827', '#2563eb'], rotation: 45 },
18
+ logo: '/logo.svg',
19
+ });
20
+
21
+ const png = await qrToPng('https://example.com', { pixelSize: 1024 });
22
+ ```
23
+
24
+ ## API
25
+
26
+ | Function | What it does |
27
+ |---|---|
28
+ | `encodeQr(text, { errorCorrection, minVersion, maxVersion, mask, boostErrorCorrection })` | The matrix: `version`, `size`, `errorCorrection`, `mask`, `modules` (`boolean[][]`, rows of dark modules). Throws `TxQrCapacityError` when the text does not fit |
29
+ | `qrPaths(matrix, { dotStyle, eyeFrameStyle, eyeBallStyle, clearSize })` | SVG path data for the dots, the eye rings and the eye centres, in module units |
30
+ | `qrLayout(text, style)` | Matrix, paths, the logo box and the view box in one call — for your own SVG |
31
+ | `qrGradientLine(gradient, size)` | Coordinates of a linear or radial gradient across the code |
32
+ | `qrToSvg(text, options)` | A standalone SVG string |
33
+ | `qrToPng(text, options)` | A PNG data URL — browser only |
34
+ | `svgToPng(svg, pixelSize)`, `inlineSvgImages(svg)`, `svgDataUrl(svg)` | Helpers for your own SVG: PNG export with the images embedded |
35
+
36
+ ## Options
37
+
38
+ | Name | Description |
39
+ |---|---|
40
+ | size | Width and height of the SVG in px (default 200) |
41
+ | margin | Quiet zone in modules (default 1) |
42
+ | errorCorrection | `L`, `M`, `Q`, `H`; `M` by default, `H` with a logo |
43
+ | dotStyle | `square` (default), `dots`, `rounded` (joined neighbours), `soft` |
44
+ | eyeFrameStyle, eyeBallStyle | `square` (default), `rounded`, `circle` |
45
+ | color, background | Dots and background (`#000000` on `#ffffff` by default) |
46
+ | eyeColor, eyeBallColor | Own colours of the eye rings and centres |
47
+ | gradient | `{ type: 'linear' \| 'radial', colors: [from, to], rotation }` |
48
+ | logo, logoSize, logoMargin | Image in the middle (share of the code, default 0.22, at most 0.4) and the empty modules around it |
49
+ | title | `<title>` of the SVG for screen readers |
50
+ | pixelSize | PNG side in px (default 1024) |
51
+
52
+ Keep dark dots on a light background — many scanners cannot read the opposite. The code imports nothing; the published `package.json` lists `tslib` only because the Angular package builder adds it to every package.
@@ -0,0 +1,944 @@
1
+ const LEVELS = {
2
+ L: {
3
+ index: 0,
4
+ format: 1
5
+ },
6
+ M: {
7
+ index: 1,
8
+ format: 0
9
+ },
10
+ Q: {
11
+ index: 2,
12
+ format: 3
13
+ },
14
+ H: {
15
+ index: 3,
16
+ format: 2
17
+ }
18
+ };
19
+ const ECC_CODEWORDS_PER_BLOCK = [
20
+ [
21
+ -1,
22
+ 7,
23
+ 10,
24
+ 15,
25
+ 20,
26
+ 26,
27
+ 18,
28
+ 20,
29
+ 24,
30
+ 30,
31
+ 18,
32
+ 20,
33
+ 24,
34
+ 26,
35
+ 30,
36
+ 22,
37
+ 24,
38
+ 28,
39
+ 30,
40
+ 28,
41
+ 28,
42
+ 28,
43
+ 28,
44
+ 30,
45
+ 30,
46
+ 26,
47
+ 28,
48
+ 30,
49
+ 30,
50
+ 30,
51
+ 30,
52
+ 30,
53
+ 30,
54
+ 30,
55
+ 30,
56
+ 30,
57
+ 30,
58
+ 30,
59
+ 30,
60
+ 30,
61
+ 30
62
+ ],
63
+ [
64
+ -1,
65
+ 10,
66
+ 16,
67
+ 26,
68
+ 18,
69
+ 24,
70
+ 16,
71
+ 18,
72
+ 22,
73
+ 22,
74
+ 26,
75
+ 30,
76
+ 22,
77
+ 22,
78
+ 24,
79
+ 24,
80
+ 28,
81
+ 28,
82
+ 26,
83
+ 26,
84
+ 26,
85
+ 26,
86
+ 28,
87
+ 28,
88
+ 28,
89
+ 28,
90
+ 28,
91
+ 28,
92
+ 28,
93
+ 28,
94
+ 28,
95
+ 28,
96
+ 28,
97
+ 28,
98
+ 28,
99
+ 28,
100
+ 28,
101
+ 28,
102
+ 28,
103
+ 28,
104
+ 28
105
+ ],
106
+ [
107
+ -1,
108
+ 13,
109
+ 22,
110
+ 18,
111
+ 26,
112
+ 18,
113
+ 24,
114
+ 18,
115
+ 22,
116
+ 20,
117
+ 24,
118
+ 28,
119
+ 26,
120
+ 24,
121
+ 20,
122
+ 30,
123
+ 24,
124
+ 28,
125
+ 28,
126
+ 26,
127
+ 30,
128
+ 28,
129
+ 30,
130
+ 30,
131
+ 30,
132
+ 30,
133
+ 28,
134
+ 30,
135
+ 30,
136
+ 30,
137
+ 30,
138
+ 30,
139
+ 30,
140
+ 30,
141
+ 30,
142
+ 30,
143
+ 30,
144
+ 30,
145
+ 30,
146
+ 30,
147
+ 30
148
+ ],
149
+ [
150
+ -1,
151
+ 17,
152
+ 28,
153
+ 22,
154
+ 16,
155
+ 22,
156
+ 28,
157
+ 26,
158
+ 26,
159
+ 24,
160
+ 28,
161
+ 24,
162
+ 28,
163
+ 22,
164
+ 24,
165
+ 24,
166
+ 30,
167
+ 28,
168
+ 28,
169
+ 26,
170
+ 28,
171
+ 30,
172
+ 24,
173
+ 30,
174
+ 30,
175
+ 30,
176
+ 30,
177
+ 30,
178
+ 30,
179
+ 30,
180
+ 30,
181
+ 30,
182
+ 30,
183
+ 30,
184
+ 30,
185
+ 30,
186
+ 30,
187
+ 30,
188
+ 30,
189
+ 30,
190
+ 30
191
+ ]
192
+ ];
193
+ const ERROR_CORRECTION_BLOCKS = [
194
+ [
195
+ -1,
196
+ 1,
197
+ 1,
198
+ 1,
199
+ 1,
200
+ 1,
201
+ 2,
202
+ 2,
203
+ 2,
204
+ 2,
205
+ 4,
206
+ 4,
207
+ 4,
208
+ 4,
209
+ 4,
210
+ 6,
211
+ 6,
212
+ 6,
213
+ 6,
214
+ 7,
215
+ 8,
216
+ 8,
217
+ 9,
218
+ 9,
219
+ 10,
220
+ 12,
221
+ 12,
222
+ 12,
223
+ 13,
224
+ 14,
225
+ 15,
226
+ 16,
227
+ 17,
228
+ 18,
229
+ 19,
230
+ 19,
231
+ 20,
232
+ 21,
233
+ 22,
234
+ 24,
235
+ 25
236
+ ],
237
+ [
238
+ -1,
239
+ 1,
240
+ 1,
241
+ 1,
242
+ 2,
243
+ 2,
244
+ 4,
245
+ 4,
246
+ 4,
247
+ 5,
248
+ 5,
249
+ 5,
250
+ 8,
251
+ 9,
252
+ 9,
253
+ 10,
254
+ 10,
255
+ 11,
256
+ 13,
257
+ 14,
258
+ 16,
259
+ 17,
260
+ 17,
261
+ 18,
262
+ 20,
263
+ 21,
264
+ 23,
265
+ 25,
266
+ 26,
267
+ 28,
268
+ 29,
269
+ 31,
270
+ 33,
271
+ 35,
272
+ 37,
273
+ 38,
274
+ 40,
275
+ 43,
276
+ 45,
277
+ 47,
278
+ 49
279
+ ],
280
+ [
281
+ -1,
282
+ 1,
283
+ 1,
284
+ 2,
285
+ 2,
286
+ 4,
287
+ 4,
288
+ 6,
289
+ 6,
290
+ 8,
291
+ 8,
292
+ 8,
293
+ 10,
294
+ 12,
295
+ 16,
296
+ 12,
297
+ 17,
298
+ 16,
299
+ 18,
300
+ 21,
301
+ 20,
302
+ 23,
303
+ 23,
304
+ 25,
305
+ 27,
306
+ 29,
307
+ 34,
308
+ 34,
309
+ 35,
310
+ 38,
311
+ 40,
312
+ 43,
313
+ 45,
314
+ 48,
315
+ 51,
316
+ 53,
317
+ 56,
318
+ 59,
319
+ 62,
320
+ 65,
321
+ 68
322
+ ],
323
+ [
324
+ -1,
325
+ 1,
326
+ 1,
327
+ 2,
328
+ 4,
329
+ 4,
330
+ 4,
331
+ 5,
332
+ 6,
333
+ 8,
334
+ 8,
335
+ 11,
336
+ 11,
337
+ 16,
338
+ 16,
339
+ 18,
340
+ 16,
341
+ 19,
342
+ 21,
343
+ 25,
344
+ 25,
345
+ 25,
346
+ 34,
347
+ 30,
348
+ 32,
349
+ 35,
350
+ 37,
351
+ 40,
352
+ 42,
353
+ 45,
354
+ 48,
355
+ 51,
356
+ 54,
357
+ 57,
358
+ 60,
359
+ 63,
360
+ 66,
361
+ 70,
362
+ 74,
363
+ 77,
364
+ 81
365
+ ]
366
+ ];
367
+ const ALPHANUMERIC = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";
368
+ const NUMERIC_PATTERN = /^[0-9]*$/;
369
+ const ALPHANUMERIC_PATTERN = /^[0-9A-Z $%*+./:-]*$/;
370
+ const PENALTY_RUN = 3;
371
+ const PENALTY_BLOCK = 3;
372
+ const PENALTY_FINDER = 40;
373
+ const PENALTY_BALANCE = 10;
374
+ const MODES = {
375
+ numeric: {
376
+ indicator: 1,
377
+ countBits: [
378
+ 10,
379
+ 12,
380
+ 14
381
+ ]
382
+ },
383
+ alphanumeric: {
384
+ indicator: 2,
385
+ countBits: [
386
+ 9,
387
+ 11,
388
+ 13
389
+ ]
390
+ },
391
+ byte: {
392
+ indicator: 4,
393
+ countBits: [
394
+ 8,
395
+ 16,
396
+ 16
397
+ ]
398
+ }
399
+ };
400
+ var TxQrCapacityError = class extends Error {
401
+ constructor() {
402
+ super("The data does not fit in a QR code");
403
+ }
404
+ };
405
+ function pushBits(bits, value, length) {
406
+ for (let i = length - 1; i >= 0; i -= 1) bits.push(value >>> i & 1);
407
+ }
408
+ function makeSegment(text) {
409
+ const bits = [];
410
+ if (NUMERIC_PATTERN.test(text)) {
411
+ for (let i = 0; i < text.length; i += 3) {
412
+ const group = text.slice(i, i + 3);
413
+ pushBits(bits, Number(group), group.length * 3 + 1);
414
+ }
415
+ return {
416
+ mode: MODES.numeric,
417
+ count: text.length,
418
+ bits
419
+ };
420
+ }
421
+ if (ALPHANUMERIC_PATTERN.test(text)) {
422
+ for (let i = 0; i + 1 < text.length; i += 2) pushBits(bits, ALPHANUMERIC.indexOf(text[i]) * 45 + ALPHANUMERIC.indexOf(text[i + 1]), 11);
423
+ if (text.length % 2) pushBits(bits, ALPHANUMERIC.indexOf(text[text.length - 1]), 6);
424
+ return {
425
+ mode: MODES.alphanumeric,
426
+ count: text.length,
427
+ bits
428
+ };
429
+ }
430
+ const bytes = new TextEncoder().encode(text);
431
+ bytes.forEach((byte) => pushBits(bits, byte, 8));
432
+ return {
433
+ mode: MODES.byte,
434
+ count: bytes.length,
435
+ bits
436
+ };
437
+ }
438
+ function countBits(mode, version) {
439
+ return mode.countBits[version < 10 ? 0 : version < 27 ? 1 : 2];
440
+ }
441
+ function rawDataModules(version) {
442
+ let result = (16 * version + 128) * version + 64;
443
+ if (version >= 2) {
444
+ const alignments = Math.floor(version / 7) + 2;
445
+ result -= (25 * alignments - 10) * alignments - 55;
446
+ if (version >= 7) result -= 36;
447
+ }
448
+ return result;
449
+ }
450
+ function dataCodewords(version, level) {
451
+ return Math.floor(rawDataModules(version) / 8) - ECC_CODEWORDS_PER_BLOCK[level][version] * ERROR_CORRECTION_BLOCKS[level][version];
452
+ }
453
+ function segmentBits(segment, version) {
454
+ const length = countBits(segment.mode, version);
455
+ return segment.count >= 1 << length ? Infinity : 4 + length + segment.bits.length;
456
+ }
457
+ function multiply(x, y) {
458
+ let z = 0;
459
+ for (let i = 7; i >= 0; i -= 1) {
460
+ z = z << 1 ^ (z >>> 7) * 285;
461
+ z ^= (y >>> i & 1) * x;
462
+ }
463
+ return z;
464
+ }
465
+ function divisor(degree) {
466
+ const result = new Array(degree).fill(0);
467
+ result[degree - 1] = 1;
468
+ let root = 1;
469
+ for (let i = 0; i < degree; i += 1) {
470
+ for (let j = 0; j < result.length; j += 1) {
471
+ result[j] = multiply(result[j], root);
472
+ if (j + 1 < result.length) result[j] ^= result[j + 1];
473
+ }
474
+ root = multiply(root, 2);
475
+ }
476
+ return result;
477
+ }
478
+ function remainder(data, generator) {
479
+ const result = generator.map(() => 0);
480
+ for (const byte of data) {
481
+ const factor = byte ^ (result.shift() ?? 0);
482
+ result.push(0);
483
+ generator.forEach((coefficient, i) => result[i] ^= multiply(coefficient, factor));
484
+ }
485
+ return result;
486
+ }
487
+ function interleave(data, version, level) {
488
+ const blocks = ERROR_CORRECTION_BLOCKS[level][version];
489
+ const eccLength = ECC_CODEWORDS_PER_BLOCK[level][version];
490
+ const raw = Math.floor(rawDataModules(version) / 8);
491
+ const shortBlocks = blocks - raw % blocks;
492
+ const shortLength = Math.floor(raw / blocks);
493
+ const generator = divisor(eccLength);
494
+ const all = [];
495
+ for (let i = 0, k = 0; i < blocks; i += 1) {
496
+ const chunk = data.slice(k, k + shortLength - eccLength + (i < shortBlocks ? 0 : 1));
497
+ k += chunk.length;
498
+ const ecc = remainder(chunk, generator);
499
+ if (i < shortBlocks) chunk.push(0);
500
+ all.push([...chunk, ...ecc]);
501
+ }
502
+ const result = [];
503
+ for (let i = 0; i < all[0].length; i += 1) all.forEach((block, j) => {
504
+ if (i !== shortLength - eccLength || j >= shortBlocks) result.push(block[i]);
505
+ });
506
+ return result;
507
+ }
508
+ function alignmentPositions(version) {
509
+ if (version === 1) return [];
510
+ const count = Math.floor(version / 7) + 2;
511
+ const size = version * 4 + 17;
512
+ const step = version === 32 ? 26 : Math.ceil((version * 4 + 4) / (count * 2 - 2)) * 2;
513
+ const result = [6];
514
+ for (let position = size - 7; result.length < count; position -= step) result.splice(1, 0, position);
515
+ return result;
516
+ }
517
+ function maskBit(mask, x, y) {
518
+ switch (mask) {
519
+ case 0: return (x + y) % 2 === 0;
520
+ case 1: return y % 2 === 0;
521
+ case 2: return x % 3 === 0;
522
+ case 3: return (x + y) % 3 === 0;
523
+ case 4: return (Math.floor(x / 3) + Math.floor(y / 2)) % 2 === 0;
524
+ case 5: return x * y % 2 + x * y % 3 === 0;
525
+ case 6: return (x * y % 2 + x * y % 3) % 2 === 0;
526
+ default: return ((x + y) % 2 + x * y % 3) % 2 === 0;
527
+ }
528
+ }
529
+ var Grid = class {
530
+ size;
531
+ modules;
532
+ reserved;
533
+ constructor(size) {
534
+ this.size = size;
535
+ this.modules = Array.from({ length: size }, () => new Array(size).fill(false));
536
+ this.reserved = Array.from({ length: size }, () => new Array(size).fill(false));
537
+ }
538
+ set(x, y, dark) {
539
+ this.modules[y][x] = dark;
540
+ this.reserved[y][x] = true;
541
+ }
542
+ };
543
+ function drawFinder(grid, cx, cy) {
544
+ for (let dy = -4; dy <= 4; dy += 1) for (let dx = -4; dx <= 4; dx += 1) {
545
+ const x = cx + dx;
546
+ const y = cy + dy;
547
+ if (x >= 0 && x < grid.size && y >= 0 && y < grid.size) {
548
+ const distance = Math.max(Math.abs(dx), Math.abs(dy));
549
+ grid.set(x, y, distance !== 2 && distance !== 4);
550
+ }
551
+ }
552
+ }
553
+ function drawFormat(grid, level, mask) {
554
+ const data = level << 3 | mask;
555
+ let rem = data;
556
+ for (let i = 0; i < 10; i += 1) rem = rem << 1 ^ (rem >>> 9) * 1335;
557
+ const bits = (data << 10 | rem) ^ 21522;
558
+ const bit = (i) => (bits >>> i & 1) !== 0;
559
+ const size = grid.size;
560
+ for (let i = 0; i <= 5; i += 1) grid.set(8, i, bit(i));
561
+ grid.set(8, 7, bit(6));
562
+ grid.set(8, 8, bit(7));
563
+ grid.set(7, 8, bit(8));
564
+ for (let i = 9; i < 15; i += 1) grid.set(14 - i, 8, bit(i));
565
+ for (let i = 0; i < 8; i += 1) grid.set(size - 1 - i, 8, bit(i));
566
+ for (let i = 8; i < 15; i += 1) grid.set(8, size - 15 + i, bit(i));
567
+ grid.set(8, size - 8, true);
568
+ }
569
+ function drawPatterns(grid, version, level) {
570
+ const size = grid.size;
571
+ for (let i = 0; i < size; i += 1) {
572
+ grid.set(6, i, i % 2 === 0);
573
+ grid.set(i, 6, i % 2 === 0);
574
+ }
575
+ drawFinder(grid, 3, 3);
576
+ drawFinder(grid, size - 4, 3);
577
+ drawFinder(grid, 3, size - 4);
578
+ const positions = alignmentPositions(version);
579
+ const last = positions.length - 1;
580
+ positions.forEach((y, i) => positions.forEach((x, j) => {
581
+ if (i === 0 && j === 0 || i === 0 && j === last || i === last && j === 0) return;
582
+ for (let dy = -2; dy <= 2; dy += 1) for (let dx = -2; dx <= 2; dx += 1) grid.set(x + dx, y + dy, Math.max(Math.abs(dx), Math.abs(dy)) !== 1);
583
+ }));
584
+ drawFormat(grid, level, 0);
585
+ if (version >= 7) {
586
+ let rem = version;
587
+ for (let i = 0; i < 12; i += 1) rem = rem << 1 ^ (rem >>> 11) * 7973;
588
+ const bits = version << 12 | rem;
589
+ for (let i = 0; i < 18; i += 1) {
590
+ const dark = (bits >>> i & 1) !== 0;
591
+ const a = size - 11 + i % 3;
592
+ const b = Math.floor(i / 3);
593
+ grid.set(a, b, dark);
594
+ grid.set(b, a, dark);
595
+ }
596
+ }
597
+ }
598
+ function drawCodewords(grid, codewords) {
599
+ const size = grid.size;
600
+ let i = 0;
601
+ for (let right = size - 1; right >= 1; right -= 2) {
602
+ if (right === 6) right = 5;
603
+ for (let vertical = 0; vertical < size; vertical += 1) for (let j = 0; j < 2; j += 1) {
604
+ const x = right - j;
605
+ const y = (right + 1 & 2) === 0 ? size - 1 - vertical : vertical;
606
+ if (!grid.reserved[y][x] && i < codewords.length * 8) {
607
+ grid.modules[y][x] = (codewords[i >>> 3] >>> 7 - (i & 7) & 1) !== 0;
608
+ i += 1;
609
+ }
610
+ }
611
+ }
612
+ }
613
+ function applyMask(grid, mask) {
614
+ for (let y = 0; y < grid.size; y += 1) for (let x = 0; x < grid.size; x += 1) if (!grid.reserved[y][x] && maskBit(mask, x, y)) grid.modules[y][x] = !grid.modules[y][x];
615
+ }
616
+ function penalty(grid) {
617
+ const size = grid.size;
618
+ const modules = grid.modules;
619
+ let result = 0;
620
+ const addHistory = (run, history) => {
621
+ if (history[0] === 0) run += size;
622
+ history.pop();
623
+ history.unshift(run);
624
+ };
625
+ const countPatterns = (history) => {
626
+ const n = history[1];
627
+ const core = n > 0 && history[2] === n && history[3] === n * 3 && history[4] === n && history[5] === n;
628
+ return (core && history[0] >= n * 4 && history[6] >= n ? 1 : 0) + (core && history[6] >= n * 4 && history[0] >= n ? 1 : 0);
629
+ };
630
+ const terminate = (color, run, history) => {
631
+ if (color) {
632
+ addHistory(run, history);
633
+ run = 0;
634
+ }
635
+ addHistory(run + size, history);
636
+ return countPatterns(history);
637
+ };
638
+ for (const vertical of [false, true]) for (let a = 0; a < size; a += 1) {
639
+ let color = false;
640
+ let run = 0;
641
+ const history = [
642
+ 0,
643
+ 0,
644
+ 0,
645
+ 0,
646
+ 0,
647
+ 0,
648
+ 0
649
+ ];
650
+ for (let b = 0; b < size; b += 1) {
651
+ const dark = vertical ? modules[b][a] : modules[a][b];
652
+ if (dark === color) {
653
+ run += 1;
654
+ if (run === 5) result += PENALTY_RUN;
655
+ else if (run > 5) result += 1;
656
+ } else {
657
+ addHistory(run, history);
658
+ if (!color) result += countPatterns(history) * PENALTY_FINDER;
659
+ color = dark;
660
+ run = 1;
661
+ }
662
+ }
663
+ result += terminate(color, run, history) * PENALTY_FINDER;
664
+ }
665
+ let dark = 0;
666
+ for (let y = 0; y < size; y += 1) for (let x = 0; x < size; x += 1) {
667
+ const color = modules[y][x];
668
+ if (color) dark += 1;
669
+ if (y < size - 1 && x < size - 1 && color === modules[y][x + 1] && color === modules[y + 1][x] && color === modules[y + 1][x + 1]) result += PENALTY_BLOCK;
670
+ }
671
+ const total = size * size;
672
+ return result + (Math.ceil(Math.abs(dark * 20 - total * 10) / total) - 1) * PENALTY_BALANCE;
673
+ }
674
+ function encodeQr(text, options = {}) {
675
+ const minVersion = options.minVersion ?? 1;
676
+ const maxVersion = options.maxVersion ?? 40;
677
+ let errorCorrection = options.errorCorrection ?? "M";
678
+ const segment = makeSegment(text);
679
+ let version = minVersion;
680
+ let used = Infinity;
681
+ for (; version <= maxVersion; version += 1) {
682
+ used = segmentBits(segment, version);
683
+ if (used <= dataCodewords(version, LEVELS[errorCorrection].index) * 8) break;
684
+ }
685
+ if (version > maxVersion) throw new TxQrCapacityError();
686
+ if (options.boostErrorCorrection) {
687
+ for (const level of ["Q", "H"]) if (LEVELS[level].index > LEVELS[errorCorrection].index && used <= dataCodewords(version, LEVELS[level].index) * 8) errorCorrection = level;
688
+ }
689
+ const level = LEVELS[errorCorrection];
690
+ const capacity = dataCodewords(version, level.index) * 8;
691
+ const bits = [];
692
+ pushBits(bits, segment.mode.indicator, 4);
693
+ pushBits(bits, segment.count, countBits(segment.mode, version));
694
+ bits.push(...segment.bits);
695
+ pushBits(bits, 0, Math.min(4, capacity - bits.length));
696
+ pushBits(bits, 0, (8 - bits.length % 8) % 8);
697
+ for (let pad = 236; bits.length < capacity; pad ^= 253) pushBits(bits, pad, 8);
698
+ const data = [];
699
+ for (let i = 0; i < bits.length; i += 8) data.push(bits.slice(i, i + 8).reduce((byte, bit) => byte << 1 | bit, 0));
700
+ const grid = new Grid(version * 4 + 17);
701
+ drawPatterns(grid, version, level.format);
702
+ drawCodewords(grid, interleave(data, version, level.index));
703
+ let mask = options.mask ?? -1;
704
+ if (mask < 0) {
705
+ let best = Infinity;
706
+ for (let candidate = 0; candidate < 8; candidate += 1) {
707
+ applyMask(grid, candidate);
708
+ drawFormat(grid, level.format, candidate);
709
+ const score = penalty(grid);
710
+ if (score < best) {
711
+ best = score;
712
+ mask = candidate;
713
+ }
714
+ applyMask(grid, candidate);
715
+ }
716
+ }
717
+ applyMask(grid, mask);
718
+ drawFormat(grid, level.format, mask);
719
+ return {
720
+ version,
721
+ size: grid.size,
722
+ errorCorrection,
723
+ mask,
724
+ modules: grid.modules
725
+ };
726
+ }
727
+ const EYE = 7;
728
+ const DOT_RADIUS = .48;
729
+ const SOFT_INSET = .05;
730
+ const SOFT_RADIUS = .25;
731
+ const round = (value) => +value.toFixed(3);
732
+ function rect(x, y, width, height) {
733
+ return `M${round(x)} ${round(y)}h${round(width)}v${round(height)}h${round(-width)}z`;
734
+ }
735
+ function roundedRect(x, y, width, height, radius) {
736
+ const r = Math.min(radius, width / 2, height / 2);
737
+ if (r <= 0) return rect(x, y, width, height);
738
+ const w = round(width - 2 * r);
739
+ const h = round(height - 2 * r);
740
+ const a = round(r);
741
+ return `M${round(x + r)} ${round(y)}h${w}a${a} ${a} 0 0 1 ${a} ${a}v${h}a${a} ${a} 0 0 1 ${-a} ${a}h${-w}a${a} ${a} 0 0 1 ${-a} ${-a}v${-h}a${a} ${a} 0 0 1 ${a} ${-a}z`;
742
+ }
743
+ function circle(cx, cy, radius) {
744
+ const r = round(radius);
745
+ return `M${round(cx - radius)} ${round(cy)}a${r} ${r} 0 1 0 ${round(2 * radius)} 0a${r} ${r} 0 1 0 ${round(-2 * radius)} 0z`;
746
+ }
747
+ function corneredSquare(x, y, corners) {
748
+ const [topLeft, topRight, bottomRight, bottomLeft] = corners.map((rounded) => rounded ? .5 : 0);
749
+ const parts = [`M${x + topLeft} ${y}`, `h${round(1 - topLeft - topRight)}`];
750
+ if (topRight) parts.push(`a${topRight} ${topRight} 0 0 1 ${topRight} ${topRight}`);
751
+ parts.push(`v${round(1 - topRight - bottomRight)}`);
752
+ if (bottomRight) parts.push(`a${bottomRight} ${bottomRight} 0 0 1 ${-bottomRight} ${bottomRight}`);
753
+ parts.push(`h${round(-(1 - bottomRight - bottomLeft))}`);
754
+ if (bottomLeft) parts.push(`a${bottomLeft} ${bottomLeft} 0 0 1 ${-bottomLeft} ${-bottomLeft}`);
755
+ parts.push(`v${round(-(1 - bottomLeft - topLeft))}`);
756
+ if (topLeft) parts.push(`a${topLeft} ${topLeft} 0 0 1 ${topLeft} ${-topLeft}`);
757
+ return parts.join("") + "z";
758
+ }
759
+ function eyeFrame(x, y, style) {
760
+ switch (style) {
761
+ case "circle": return circle(x + 3.5, y + 3.5, 3.5) + circle(x + 3.5, y + 3.5, 2.5);
762
+ case "rounded": return roundedRect(x, y, EYE, EYE, 2.25) + roundedRect(x + 1, y + 1, 5, 5, 1.25);
763
+ default: return rect(x, y, EYE, EYE) + rect(x + 1, y + 1, 5, 5);
764
+ }
765
+ }
766
+ function eyeBall(x, y, style) {
767
+ switch (style) {
768
+ case "circle": return circle(x + 3.5, y + 3.5, 1.5);
769
+ case "rounded": return roundedRect(x + 2, y + 2, 3, 3, .9);
770
+ default: return rect(x + 2, y + 2, 3, 3);
771
+ }
772
+ }
773
+ function qrPaths(matrix, options) {
774
+ const size = matrix.size;
775
+ const eyes = [
776
+ {
777
+ x: 0,
778
+ y: 0
779
+ },
780
+ {
781
+ x: size - EYE,
782
+ y: 0
783
+ },
784
+ {
785
+ x: 0,
786
+ y: size - EYE
787
+ }
788
+ ];
789
+ const clear = options.clearSize ?? 0;
790
+ const inEye = (x, y) => eyes.some((eye) => x >= eye.x && x < eye.x + EYE && y >= eye.y && y < eye.y + EYE);
791
+ const cleared = (x, y) => clear > 0 && Math.abs(x + .5 - size / 2) < clear / 2 && Math.abs(y + .5 - size / 2) < clear / 2;
792
+ const dark = (x, y) => x >= 0 && y >= 0 && x < size && y < size && matrix.modules[y][x] && !inEye(x, y) && !cleared(x, y);
793
+ const parts = [];
794
+ for (let y = 0; y < size; y += 1) {
795
+ if (options.dotStyle === "square") {
796
+ for (let x = 0; x < size; x += 1) {
797
+ if (!dark(x, y)) continue;
798
+ let end = x;
799
+ while (dark(end + 1, y)) end += 1;
800
+ parts.push(rect(x, y, end - x + 1, 1));
801
+ x = end;
802
+ }
803
+ continue;
804
+ }
805
+ for (let x = 0; x < size; x += 1) {
806
+ if (!dark(x, y)) continue;
807
+ if (options.dotStyle === "dots") parts.push(circle(x + .5, y + .5, DOT_RADIUS));
808
+ else if (options.dotStyle === "soft") parts.push(roundedRect(x + SOFT_INSET, y + SOFT_INSET, 1 - 2 * SOFT_INSET, 1 - 2 * SOFT_INSET, SOFT_RADIUS));
809
+ else {
810
+ const top = dark(x, y - 1);
811
+ const right = dark(x + 1, y);
812
+ const bottom = dark(x, y + 1);
813
+ const left = dark(x - 1, y);
814
+ parts.push(corneredSquare(x, y, [
815
+ !top && !left,
816
+ !top && !right,
817
+ !bottom && !right,
818
+ !bottom && !left
819
+ ]));
820
+ }
821
+ }
822
+ }
823
+ return {
824
+ dots: parts.join(""),
825
+ eyeFrames: eyes.map((eye) => eyeFrame(eye.x, eye.y, options.eyeFrameStyle)).join(""),
826
+ eyeBalls: eyes.map((eye) => eyeBall(eye.x, eye.y, options.eyeBallStyle)).join(""),
827
+ eyes
828
+ };
829
+ }
830
+ const MAX_LOGO_SIZE = .4;
831
+ function qrLogoBox(matrix, style) {
832
+ if (!style.logo) return null;
833
+ const side = Math.min(Math.max(style.logoSize ?? .22, 0), MAX_LOGO_SIZE) * matrix.size;
834
+ const offset = (matrix.size - side) / 2;
835
+ return {
836
+ x: offset,
837
+ y: offset,
838
+ size: side,
839
+ clear: Math.ceil(side + 2 * (style.logoMargin ?? 1))
840
+ };
841
+ }
842
+ function qrGradientLine(gradient, size) {
843
+ const center = size / 2;
844
+ const angle = (gradient.rotation ?? 0) * Math.PI / 180;
845
+ const dx = Math.cos(angle) * size / 2;
846
+ const dy = Math.sin(angle) * size / 2;
847
+ return {
848
+ radial: gradient.type === "radial",
849
+ colors: gradient.colors,
850
+ center,
851
+ radius: size * .75,
852
+ x1: center - dx,
853
+ y1: center - dy,
854
+ x2: center + dx,
855
+ y2: center + dy
856
+ };
857
+ }
858
+ function qrLayout(text, style = {}) {
859
+ const matrix = encodeQr(text, { errorCorrection: style.errorCorrection ?? (style.logo ? "H" : "M") });
860
+ const logoBox = qrLogoBox(matrix, style);
861
+ const margin = Math.max(style.margin ?? 1, 0);
862
+ const total = matrix.size + 2 * margin;
863
+ return {
864
+ matrix,
865
+ logoBox,
866
+ paths: qrPaths(matrix, {
867
+ dotStyle: style.dotStyle ?? "square",
868
+ eyeFrameStyle: style.eyeFrameStyle ?? "square",
869
+ eyeBallStyle: style.eyeBallStyle ?? "square",
870
+ clearSize: logoBox?.clear
871
+ }),
872
+ viewBox: {
873
+ x: -margin,
874
+ y: -margin,
875
+ size: total,
876
+ value: `${-margin} ${-margin} ${total} ${total}`
877
+ }
878
+ };
879
+ }
880
+ let nextId = 0;
881
+ const escape = (value) => String(value).replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
882
+ function qrToSvg(text, options = {}) {
883
+ const { viewBox, paths, logoBox, matrix } = qrLayout(text, options);
884
+ const size = options.size ?? 200;
885
+ const color = options.color ?? "#000000";
886
+ const gradientId = `tx-qr-gradient-${nextId += 1}`;
887
+ const parts = [];
888
+ let dotFill = color;
889
+ if (options.gradient) {
890
+ const line = qrGradientLine(options.gradient, matrix.size);
891
+ const stops = `<stop offset="0" stop-color="${escape(line.colors[0])}"/><stop offset="1" stop-color="${escape(line.colors[1])}"/>`;
892
+ parts.push(line.radial ? `<defs><radialGradient id="${gradientId}" gradientUnits="userSpaceOnUse" cx="${line.center}" cy="${line.center}" r="${line.radius}">${stops}</radialGradient></defs>` : `<defs><linearGradient id="${gradientId}" gradientUnits="userSpaceOnUse" x1="${line.x1}" y1="${line.y1}" x2="${line.x2}" y2="${line.y2}">${stops}</linearGradient></defs>`);
893
+ dotFill = `url(#${gradientId})`;
894
+ }
895
+ const eyeFill = options.eyeColor ?? dotFill;
896
+ const ballFill = options.eyeBallColor ?? options.eyeColor ?? dotFill;
897
+ parts.push(`<rect x="${viewBox.x}" y="${viewBox.y}" width="${viewBox.size}" height="${viewBox.size}" fill="${escape(options.background ?? "#ffffff")}"/>`);
898
+ parts.push(`<path d="${paths.dots}" fill="${escape(dotFill)}"/>`);
899
+ parts.push(`<path d="${paths.eyeFrames}" fill-rule="evenodd" fill="${escape(eyeFill)}"/>`);
900
+ parts.push(`<path d="${paths.eyeBalls}" fill="${escape(ballFill)}"/>`);
901
+ if (logoBox && options.logo) parts.push(`<image href="${escape(options.logo)}" x="${logoBox.x}" y="${logoBox.y}" width="${logoBox.size}" height="${logoBox.size}" preserveAspectRatio="xMidYMid meet"/>`);
902
+ const title = options.title ? `<title>${escape(options.title)}</title>` : "";
903
+ const crisp = (options.dotStyle ?? "square") === "square" ? " shape-rendering=\"crispEdges\"" : "";
904
+ return `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="${viewBox.value}"${crisp}>${title}${parts.join("")}</svg>`;
905
+ }
906
+ async function toDataUrl(url) {
907
+ const blob = await (await fetch(url)).blob();
908
+ return new Promise((resolve, reject) => {
909
+ const reader = new FileReader();
910
+ reader.onload = () => resolve(String(reader.result));
911
+ reader.onerror = () => reject(reader.error);
912
+ reader.readAsDataURL(blob);
913
+ });
914
+ }
915
+ async function inlineSvgImages(svg) {
916
+ const urls = Array.from(new Set(Array.from(svg.matchAll(/href="([^"]+)"/g), (match) => match[1]))).filter((url) => !url.startsWith("data:") && !url.startsWith("#"));
917
+ let result = svg;
918
+ for (const url of urls) try {
919
+ const dataUrl = await toDataUrl(url.replace(/&amp;/g, "&"));
920
+ result = result.split(`href="${url}"`).join(`href="${dataUrl}"`);
921
+ } catch {
922
+ continue;
923
+ }
924
+ return result;
925
+ }
926
+ function svgDataUrl(svg) {
927
+ return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svg)}`;
928
+ }
929
+ async function svgToPng(svg, pixelSize = 1024) {
930
+ const image = new Image();
931
+ image.src = svgDataUrl(await inlineSvgImages(svg));
932
+ await image.decode();
933
+ const canvas = document.createElement("canvas");
934
+ canvas.width = pixelSize;
935
+ canvas.height = pixelSize;
936
+ canvas.getContext("2d")?.drawImage(image, 0, 0, pixelSize, pixelSize);
937
+ return canvas.toDataURL("image/png");
938
+ }
939
+ function qrToPng(text, options = {}) {
940
+ return svgToPng(qrToSvg(text, options), options.pixelSize ?? 1024);
941
+ }
942
+ export { TxQrCapacityError, encodeQr, inlineSvgImages, qrGradientLine, qrLayout, qrLogoBox, qrPaths, qrToPng, qrToSvg, roundedRect, svgDataUrl, svgToPng };
943
+
944
+ //# sourceMappingURL=tectra-ng-qr.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tectra-ng-qr.mjs","names":[],"sources":["../../../../packages/qr/src/encoder.ts","../../../../packages/qr/src/paths.ts","../../../../packages/qr/src/layout.ts","../../../../packages/qr/src/svg.ts","../../../../packages/qr/src/png.ts"],"sourcesContent":["import { TxQrErrorCorrection, TxQrMatrix } from './types';\n\nconst LEVELS: Record<TxQrErrorCorrection, { index: number; format: number }> = {\n L: { index: 0, format: 1 },\n M: { index: 1, format: 0 },\n Q: { index: 2, format: 3 },\n H: { index: 3, format: 2 },\n};\n\nconst ECC_CODEWORDS_PER_BLOCK = [\n [-1, 7, 10, 15, 20, 26, 18, 20, 24, 30, 18, 20, 24, 26, 30, 22, 24, 28, 30, 28, 28, 28, 28, 30, 30, 26, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30],\n [-1, 10, 16, 26, 18, 24, 16, 18, 22, 22, 26, 30, 22, 22, 24, 24, 28, 28, 26, 26, 26, 26, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28],\n [-1, 13, 22, 18, 26, 18, 24, 18, 22, 20, 24, 28, 26, 24, 20, 30, 24, 28, 28, 26, 30, 28, 30, 30, 30, 30, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30],\n [-1, 17, 28, 22, 16, 22, 28, 26, 26, 24, 28, 24, 28, 22, 24, 24, 30, 28, 28, 26, 28, 30, 24, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30],\n];\n\nconst ERROR_CORRECTION_BLOCKS = [\n [-1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 4, 4, 4, 4, 4, 6, 6, 6, 6, 7, 8, 8, 9, 9, 10, 12, 12, 12, 13, 14, 15, 16, 17, 18, 19, 19, 20, 21, 22, 24, 25],\n [-1, 1, 1, 1, 2, 2, 4, 4, 4, 5, 5, 5, 8, 9, 9, 10, 10, 11, 13, 14, 16, 17, 17, 18, 20, 21, 23, 25, 26, 28, 29, 31, 33, 35, 37, 38, 40, 43, 45, 47, 49],\n [-1, 1, 1, 2, 2, 4, 4, 6, 6, 8, 8, 8, 10, 12, 16, 12, 17, 16, 18, 21, 20, 23, 23, 25, 27, 29, 34, 34, 35, 38, 40, 43, 45, 48, 51, 53, 56, 59, 62, 65, 68],\n [-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],\n];\n\nconst ALPHANUMERIC = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:';\nconst NUMERIC_PATTERN = /^[0-9]*$/;\nconst ALPHANUMERIC_PATTERN = /^[0-9A-Z $%*+./:-]*$/;\nconst PENALTY_RUN = 3;\nconst PENALTY_BLOCK = 3;\nconst PENALTY_FINDER = 40;\nconst PENALTY_BALANCE = 10;\n\ninterface Mode {\n indicator: number;\n countBits: [number, number, number];\n}\n\nconst MODES: Record<'numeric' | 'alphanumeric' | 'byte', Mode> = {\n numeric: { indicator: 0x1, countBits: [10, 12, 14] },\n alphanumeric: { indicator: 0x2, countBits: [9, 11, 13] },\n byte: { indicator: 0x4, countBits: [8, 16, 16] },\n};\n\ninterface Segment {\n mode: Mode;\n count: number;\n bits: number[];\n}\n\nexport interface TxQrEncodeOptions {\n errorCorrection?: TxQrErrorCorrection;\n minVersion?: number;\n maxVersion?: number;\n mask?: number;\n boostErrorCorrection?: boolean;\n}\n\nexport class TxQrCapacityError extends Error {\n constructor() {\n super('The data does not fit in a QR code');\n }\n}\n\nfunction pushBits(bits: number[], value: number, length: number): void {\n for (let i = length - 1; i >= 0; i -= 1) {\n bits.push((value >>> i) & 1);\n }\n}\n\nfunction makeSegment(text: string): Segment {\n const bits: number[] = [];\n if (NUMERIC_PATTERN.test(text)) {\n for (let i = 0; i < text.length; i += 3) {\n const group = text.slice(i, i + 3);\n pushBits(bits, Number(group), group.length * 3 + 1);\n }\n return { mode: MODES.numeric, count: text.length, bits };\n }\n if (ALPHANUMERIC_PATTERN.test(text)) {\n for (let i = 0; i + 1 < text.length; i += 2) {\n pushBits(bits, ALPHANUMERIC.indexOf(text[i]) * 45 + ALPHANUMERIC.indexOf(text[i + 1]), 11);\n }\n if (text.length % 2) {\n pushBits(bits, ALPHANUMERIC.indexOf(text[text.length - 1]), 6);\n }\n return { mode: MODES.alphanumeric, count: text.length, bits };\n }\n const bytes = new TextEncoder().encode(text);\n bytes.forEach((byte) => pushBits(bits, byte, 8));\n return { mode: MODES.byte, count: bytes.length, bits };\n}\n\nfunction countBits(mode: Mode, version: number): number {\n return mode.countBits[version < 10 ? 0 : version < 27 ? 1 : 2];\n}\n\nfunction rawDataModules(version: number): number {\n let result = (16 * version + 128) * version + 64;\n if (version >= 2) {\n const alignments = Math.floor(version / 7) + 2;\n result -= (25 * alignments - 10) * alignments - 55;\n if (version >= 7) {\n result -= 36;\n }\n }\n return result;\n}\n\nfunction dataCodewords(version: number, level: number): number {\n return Math.floor(rawDataModules(version) / 8) - ECC_CODEWORDS_PER_BLOCK[level][version] * ERROR_CORRECTION_BLOCKS[level][version];\n}\n\nfunction segmentBits(segment: Segment, version: number): number {\n const length = countBits(segment.mode, version);\n return segment.count >= 1 << length ? Infinity : 4 + length + segment.bits.length;\n}\n\nfunction multiply(x: number, y: number): number {\n let z = 0;\n for (let i = 7; i >= 0; i -= 1) {\n z = (z << 1) ^ ((z >>> 7) * 0x11d);\n z ^= ((y >>> i) & 1) * x;\n }\n return z;\n}\n\nfunction divisor(degree: number): number[] {\n const result = new Array<number>(degree).fill(0);\n result[degree - 1] = 1;\n let root = 1;\n for (let i = 0; i < degree; i += 1) {\n for (let j = 0; j < result.length; j += 1) {\n result[j] = multiply(result[j], root);\n if (j + 1 < result.length) {\n result[j] ^= result[j + 1];\n }\n }\n root = multiply(root, 0x02);\n }\n return result;\n}\n\nfunction remainder(data: readonly number[], generator: readonly number[]): number[] {\n const result = generator.map(() => 0);\n for (const byte of data) {\n const factor = byte ^ (result.shift() ?? 0);\n result.push(0);\n generator.forEach((coefficient, i) => (result[i] ^= multiply(coefficient, factor)));\n }\n return result;\n}\n\nfunction interleave(data: readonly number[], version: number, level: number): number[] {\n const blocks = ERROR_CORRECTION_BLOCKS[level][version];\n const eccLength = ECC_CODEWORDS_PER_BLOCK[level][version];\n const raw = Math.floor(rawDataModules(version) / 8);\n const shortBlocks = blocks - (raw % blocks);\n const shortLength = Math.floor(raw / blocks);\n const generator = divisor(eccLength);\n const all: number[][] = [];\n for (let i = 0, k = 0; i < blocks; i += 1) {\n const chunk = data.slice(k, k + shortLength - eccLength + (i < shortBlocks ? 0 : 1));\n k += chunk.length;\n const ecc = remainder(chunk, generator);\n if (i < shortBlocks) {\n chunk.push(0);\n }\n all.push([...chunk, ...ecc]);\n }\n const result: number[] = [];\n for (let i = 0; i < all[0].length; i += 1) {\n all.forEach((block, j) => {\n if (i !== shortLength - eccLength || j >= shortBlocks) {\n result.push(block[i]);\n }\n });\n }\n return result;\n}\n\nfunction alignmentPositions(version: number): number[] {\n if (version === 1) {\n return [];\n }\n const count = Math.floor(version / 7) + 2;\n const size = version * 4 + 17;\n const step = version === 32 ? 26 : Math.ceil((version * 4 + 4) / (count * 2 - 2)) * 2;\n const result = [6];\n for (let position = size - 7; result.length < count; position -= step) {\n result.splice(1, 0, position);\n }\n return result;\n}\n\nfunction maskBit(mask: number, x: number, y: number): boolean {\n switch (mask) {\n case 0:\n return (x + y) % 2 === 0;\n case 1:\n return y % 2 === 0;\n case 2:\n return x % 3 === 0;\n case 3:\n return (x + y) % 3 === 0;\n case 4:\n return (Math.floor(x / 3) + Math.floor(y / 2)) % 2 === 0;\n case 5:\n return ((x * y) % 2) + ((x * y) % 3) === 0;\n case 6:\n return (((x * y) % 2) + ((x * y) % 3)) % 2 === 0;\n default:\n return (((x + y) % 2) + ((x * y) % 3)) % 2 === 0;\n }\n}\n\nclass Grid {\n readonly modules: boolean[][];\n readonly reserved: boolean[][];\n\n constructor(readonly size: number) {\n this.modules = Array.from({ length: size }, () => new Array<boolean>(size).fill(false));\n this.reserved = Array.from({ length: size }, () => new Array<boolean>(size).fill(false));\n }\n\n set(x: number, y: number, dark: boolean): void {\n this.modules[y][x] = dark;\n this.reserved[y][x] = true;\n }\n}\n\nfunction drawFinder(grid: Grid, cx: number, cy: number): void {\n for (let dy = -4; dy <= 4; dy += 1) {\n for (let dx = -4; dx <= 4; dx += 1) {\n const x = cx + dx;\n const y = cy + dy;\n if (x >= 0 && x < grid.size && y >= 0 && y < grid.size) {\n const distance = Math.max(Math.abs(dx), Math.abs(dy));\n grid.set(x, y, distance !== 2 && distance !== 4);\n }\n }\n }\n}\n\nfunction drawFormat(grid: Grid, level: number, mask: number): void {\n const data = (level << 3) | mask;\n let rem = data;\n for (let i = 0; i < 10; i += 1) {\n rem = (rem << 1) ^ ((rem >>> 9) * 0x537);\n }\n const bits = ((data << 10) | rem) ^ 0x5412;\n const bit = (i: number) => ((bits >>> i) & 1) !== 0;\n const size = grid.size;\n for (let i = 0; i <= 5; i += 1) {\n grid.set(8, i, bit(i));\n }\n grid.set(8, 7, bit(6));\n grid.set(8, 8, bit(7));\n grid.set(7, 8, bit(8));\n for (let i = 9; i < 15; i += 1) {\n grid.set(14 - i, 8, bit(i));\n }\n for (let i = 0; i < 8; i += 1) {\n grid.set(size - 1 - i, 8, bit(i));\n }\n for (let i = 8; i < 15; i += 1) {\n grid.set(8, size - 15 + i, bit(i));\n }\n grid.set(8, size - 8, true);\n}\n\nfunction drawPatterns(grid: Grid, version: number, level: number): void {\n const size = grid.size;\n for (let i = 0; i < size; i += 1) {\n grid.set(6, i, i % 2 === 0);\n grid.set(i, 6, i % 2 === 0);\n }\n drawFinder(grid, 3, 3);\n drawFinder(grid, size - 4, 3);\n drawFinder(grid, 3, size - 4);\n const positions = alignmentPositions(version);\n const last = positions.length - 1;\n positions.forEach((y, i) =>\n positions.forEach((x, j) => {\n if ((i === 0 && j === 0) || (i === 0 && j === last) || (i === last && j === 0)) {\n return;\n }\n for (let dy = -2; dy <= 2; dy += 1) {\n for (let dx = -2; dx <= 2; dx += 1) {\n grid.set(x + dx, y + dy, Math.max(Math.abs(dx), Math.abs(dy)) !== 1);\n }\n }\n }),\n );\n drawFormat(grid, level, 0);\n if (version >= 7) {\n let rem = version;\n for (let i = 0; i < 12; i += 1) {\n rem = (rem << 1) ^ ((rem >>> 11) * 0x1f25);\n }\n const bits = (version << 12) | rem;\n for (let i = 0; i < 18; i += 1) {\n const dark = ((bits >>> i) & 1) !== 0;\n const a = size - 11 + (i % 3);\n const b = Math.floor(i / 3);\n grid.set(a, b, dark);\n grid.set(b, a, dark);\n }\n }\n}\n\nfunction drawCodewords(grid: Grid, codewords: readonly number[]): void {\n const size = grid.size;\n let i = 0;\n for (let right = size - 1; right >= 1; right -= 2) {\n if (right === 6) {\n right = 5;\n }\n for (let vertical = 0; vertical < size; vertical += 1) {\n for (let j = 0; j < 2; j += 1) {\n const x = right - j;\n const upward = ((right + 1) & 2) === 0;\n const y = upward ? size - 1 - vertical : vertical;\n if (!grid.reserved[y][x] && i < codewords.length * 8) {\n grid.modules[y][x] = ((codewords[i >>> 3] >>> (7 - (i & 7))) & 1) !== 0;\n i += 1;\n }\n }\n }\n }\n}\n\nfunction applyMask(grid: Grid, mask: number): void {\n for (let y = 0; y < grid.size; y += 1) {\n for (let x = 0; x < grid.size; x += 1) {\n if (!grid.reserved[y][x] && maskBit(mask, x, y)) {\n grid.modules[y][x] = !grid.modules[y][x];\n }\n }\n }\n}\n\nfunction penalty(grid: Grid): number {\n const size = grid.size;\n const modules = grid.modules;\n let result = 0;\n const addHistory = (run: number, history: number[]) => {\n if (history[0] === 0) {\n run += size;\n }\n history.pop();\n history.unshift(run);\n };\n const countPatterns = (history: number[]) => {\n const n = history[1];\n const core = n > 0 && history[2] === n && history[3] === n * 3 && history[4] === n && history[5] === n;\n return (core && history[0] >= n * 4 && history[6] >= n ? 1 : 0) + (core && history[6] >= n * 4 && history[0] >= n ? 1 : 0);\n };\n const terminate = (color: boolean, run: number, history: number[]) => {\n if (color) {\n addHistory(run, history);\n run = 0;\n }\n addHistory(run + size, history);\n return countPatterns(history);\n };\n for (const vertical of [false, true]) {\n for (let a = 0; a < size; a += 1) {\n let color = false;\n let run = 0;\n const history = [0, 0, 0, 0, 0, 0, 0];\n for (let b = 0; b < size; b += 1) {\n const dark = vertical ? modules[b][a] : modules[a][b];\n if (dark === color) {\n run += 1;\n if (run === 5) {\n result += PENALTY_RUN;\n } else if (run > 5) {\n result += 1;\n }\n } else {\n addHistory(run, history);\n if (!color) {\n result += countPatterns(history) * PENALTY_FINDER;\n }\n color = dark;\n run = 1;\n }\n }\n result += terminate(color, run, history) * PENALTY_FINDER;\n }\n }\n let dark = 0;\n for (let y = 0; y < size; y += 1) {\n for (let x = 0; x < size; x += 1) {\n const color = modules[y][x];\n if (color) {\n dark += 1;\n }\n if (y < size - 1 && x < size - 1 && color === modules[y][x + 1] && color === modules[y + 1][x] && color === modules[y + 1][x + 1]) {\n result += PENALTY_BLOCK;\n }\n }\n }\n const total = size * size;\n return result + (Math.ceil(Math.abs(dark * 20 - total * 10) / total) - 1) * PENALTY_BALANCE;\n}\n\nexport function encodeQr(text: string, options: TxQrEncodeOptions = {}): TxQrMatrix {\n const minVersion = options.minVersion ?? 1;\n const maxVersion = options.maxVersion ?? 40;\n let errorCorrection = options.errorCorrection ?? 'M';\n const segment = makeSegment(text);\n let version = minVersion;\n let used = Infinity;\n for (; version <= maxVersion; version += 1) {\n used = segmentBits(segment, version);\n if (used <= dataCodewords(version, LEVELS[errorCorrection].index) * 8) {\n break;\n }\n }\n if (version > maxVersion) {\n throw new TxQrCapacityError();\n }\n if (options.boostErrorCorrection) {\n for (const level of ['Q', 'H'] as const) {\n if (LEVELS[level].index > LEVELS[errorCorrection].index && used <= dataCodewords(version, LEVELS[level].index) * 8) {\n errorCorrection = level;\n }\n }\n }\n const level = LEVELS[errorCorrection];\n const capacity = dataCodewords(version, level.index) * 8;\n const bits: number[] = [];\n pushBits(bits, segment.mode.indicator, 4);\n pushBits(bits, segment.count, countBits(segment.mode, version));\n bits.push(...segment.bits);\n pushBits(bits, 0, Math.min(4, capacity - bits.length));\n pushBits(bits, 0, (8 - (bits.length % 8)) % 8);\n for (let pad = 0xec; bits.length < capacity; pad ^= 0xec ^ 0x11) {\n pushBits(bits, pad, 8);\n }\n const data: number[] = [];\n for (let i = 0; i < bits.length; i += 8) {\n data.push(bits.slice(i, i + 8).reduce((byte, bit) => (byte << 1) | bit, 0));\n }\n const grid = new Grid(version * 4 + 17);\n drawPatterns(grid, version, level.format);\n drawCodewords(grid, interleave(data, version, level.index));\n let mask = options.mask ?? -1;\n if (mask < 0) {\n let best = Infinity;\n for (let candidate = 0; candidate < 8; candidate += 1) {\n applyMask(grid, candidate);\n drawFormat(grid, level.format, candidate);\n const score = penalty(grid);\n if (score < best) {\n best = score;\n mask = candidate;\n }\n applyMask(grid, candidate);\n }\n }\n applyMask(grid, mask);\n drawFormat(grid, level.format, mask);\n return { version, size: grid.size, errorCorrection, mask, modules: grid.modules };\n}\n","import { TxQrDotStyle, TxQrEyeBallStyle, TxQrEyeFrameStyle, TxQrMatrix } from './types';\n\nexport interface TxQrShapeOptions {\n dotStyle: TxQrDotStyle;\n eyeFrameStyle: TxQrEyeFrameStyle;\n eyeBallStyle: TxQrEyeBallStyle;\n clearSize?: number;\n}\n\nexport interface TxQrPaths {\n dots: string;\n eyeFrames: string;\n eyeBalls: string;\n eyes: readonly { x: number; y: number }[];\n}\n\nconst EYE = 7;\nconst DOT_RADIUS = 0.48;\nconst SOFT_INSET = 0.05;\nconst SOFT_RADIUS = 0.25;\n\nconst round = (value: number) => +value.toFixed(3);\n\nfunction rect(x: number, y: number, width: number, height: number): string {\n return `M${round(x)} ${round(y)}h${round(width)}v${round(height)}h${round(-width)}z`;\n}\n\nexport function roundedRect(x: number, y: number, width: number, height: number, radius: number): string {\n const r = Math.min(radius, width / 2, height / 2);\n if (r <= 0) {\n return rect(x, y, width, height);\n }\n const w = round(width - 2 * r);\n const h = round(height - 2 * r);\n const a = round(r);\n return `M${round(x + r)} ${round(y)}h${w}a${a} ${a} 0 0 1 ${a} ${a}v${h}a${a} ${a} 0 0 1 ${-a} ${a}h${-w}a${a} ${a} 0 0 1 ${-a} ${-a}v${-h}a${a} ${a} 0 0 1 ${a} ${-a}z`;\n}\n\nfunction circle(cx: number, cy: number, radius: number): string {\n const r = round(radius);\n return `M${round(cx - radius)} ${round(cy)}a${r} ${r} 0 1 0 ${round(2 * radius)} 0a${r} ${r} 0 1 0 ${round(-2 * radius)} 0z`;\n}\n\nfunction corneredSquare(x: number, y: number, corners: readonly [boolean, boolean, boolean, boolean]): string {\n const [topLeft, topRight, bottomRight, bottomLeft] = corners.map((rounded) => (rounded ? 0.5 : 0));\n const parts = [`M${x + topLeft} ${y}`, `h${round(1 - topLeft - topRight)}`];\n if (topRight) {\n parts.push(`a${topRight} ${topRight} 0 0 1 ${topRight} ${topRight}`);\n }\n parts.push(`v${round(1 - topRight - bottomRight)}`);\n if (bottomRight) {\n parts.push(`a${bottomRight} ${bottomRight} 0 0 1 ${-bottomRight} ${bottomRight}`);\n }\n parts.push(`h${round(-(1 - bottomRight - bottomLeft))}`);\n if (bottomLeft) {\n parts.push(`a${bottomLeft} ${bottomLeft} 0 0 1 ${-bottomLeft} ${-bottomLeft}`);\n }\n parts.push(`v${round(-(1 - bottomLeft - topLeft))}`);\n if (topLeft) {\n parts.push(`a${topLeft} ${topLeft} 0 0 1 ${topLeft} ${-topLeft}`);\n }\n return parts.join('') + 'z';\n}\n\nfunction eyeFrame(x: number, y: number, style: TxQrEyeFrameStyle): string {\n switch (style) {\n case 'circle':\n return circle(x + 3.5, y + 3.5, 3.5) + circle(x + 3.5, y + 3.5, 2.5);\n case 'rounded':\n return roundedRect(x, y, EYE, EYE, 2.25) + roundedRect(x + 1, y + 1, 5, 5, 1.25);\n default:\n return rect(x, y, EYE, EYE) + rect(x + 1, y + 1, 5, 5);\n }\n}\n\nfunction eyeBall(x: number, y: number, style: TxQrEyeBallStyle): string {\n switch (style) {\n case 'circle':\n return circle(x + 3.5, y + 3.5, 1.5);\n case 'rounded':\n return roundedRect(x + 2, y + 2, 3, 3, 0.9);\n default:\n return rect(x + 2, y + 2, 3, 3);\n }\n}\n\nexport function qrPaths(matrix: TxQrMatrix, options: TxQrShapeOptions): TxQrPaths {\n const size = matrix.size;\n const eyes = [\n { x: 0, y: 0 },\n { x: size - EYE, y: 0 },\n { x: 0, y: size - EYE },\n ];\n const clear = options.clearSize ?? 0;\n const inEye = (x: number, y: number) => eyes.some((eye) => x >= eye.x && x < eye.x + EYE && y >= eye.y && y < eye.y + EYE);\n const cleared = (x: number, y: number) => clear > 0 && Math.abs(x + 0.5 - size / 2) < clear / 2 && Math.abs(y + 0.5 - size / 2) < clear / 2;\n const dark = (x: number, y: number) => x >= 0 && y >= 0 && x < size && y < size && matrix.modules[y][x] && !inEye(x, y) && !cleared(x, y);\n\n const parts: string[] = [];\n for (let y = 0; y < size; y += 1) {\n if (options.dotStyle === 'square') {\n for (let x = 0; x < size; x += 1) {\n if (!dark(x, y)) {\n continue;\n }\n let end = x;\n while (dark(end + 1, y)) {\n end += 1;\n }\n parts.push(rect(x, y, end - x + 1, 1));\n x = end;\n }\n continue;\n }\n for (let x = 0; x < size; x += 1) {\n if (!dark(x, y)) {\n continue;\n }\n if (options.dotStyle === 'dots') {\n parts.push(circle(x + 0.5, y + 0.5, DOT_RADIUS));\n } else if (options.dotStyle === 'soft') {\n parts.push(roundedRect(x + SOFT_INSET, y + SOFT_INSET, 1 - 2 * SOFT_INSET, 1 - 2 * SOFT_INSET, SOFT_RADIUS));\n } else {\n const top = dark(x, y - 1);\n const right = dark(x + 1, y);\n const bottom = dark(x, y + 1);\n const left = dark(x - 1, y);\n parts.push(corneredSquare(x, y, [!top && !left, !top && !right, !bottom && !right, !bottom && !left]));\n }\n }\n }\n\n return {\n dots: parts.join(''),\n eyeFrames: eyes.map((eye) => eyeFrame(eye.x, eye.y, options.eyeFrameStyle)).join(''),\n eyeBalls: eyes.map((eye) => eyeBall(eye.x, eye.y, options.eyeBallStyle)).join(''),\n eyes,\n };\n}\n","import { encodeQr } from './encoder';\nimport { TxQrPaths, qrPaths } from './paths';\nimport { TxQrGradient, TxQrMatrix, TxQrStyle } from './types';\n\nconst MAX_LOGO_SIZE = 0.4;\n\nexport interface TxQrLogoBox {\n x: number;\n y: number;\n size: number;\n clear: number;\n}\n\nexport interface TxQrGradientLine {\n radial: boolean;\n colors: readonly [string, string];\n center: number;\n radius: number;\n x1: number;\n y1: number;\n x2: number;\n y2: number;\n}\n\nexport interface TxQrLayout {\n matrix: TxQrMatrix;\n paths: TxQrPaths;\n logoBox: TxQrLogoBox | null;\n viewBox: { x: number; y: number; size: number; value: string };\n}\n\nexport function qrLogoBox(matrix: TxQrMatrix, style: TxQrStyle): TxQrLogoBox | null {\n if (!style.logo) {\n return null;\n }\n const side = Math.min(Math.max(style.logoSize ?? 0.22, 0), MAX_LOGO_SIZE) * matrix.size;\n const offset = (matrix.size - side) / 2;\n return { x: offset, y: offset, size: side, clear: Math.ceil(side + 2 * (style.logoMargin ?? 1)) };\n}\n\nexport function qrGradientLine(gradient: TxQrGradient, size: number): TxQrGradientLine {\n const center = size / 2;\n const angle = ((gradient.rotation ?? 0) * Math.PI) / 180;\n const dx = (Math.cos(angle) * size) / 2;\n const dy = (Math.sin(angle) * size) / 2;\n return { radial: gradient.type === 'radial', colors: gradient.colors, center, radius: size * 0.75, x1: center - dx, y1: center - dy, x2: center + dx, y2: center + dy };\n}\n\nexport function qrLayout(text: string, style: TxQrStyle = {}): TxQrLayout {\n const matrix = encodeQr(text, { errorCorrection: style.errorCorrection ?? (style.logo ? 'H' : 'M') });\n const logoBox = qrLogoBox(matrix, style);\n const margin = Math.max(style.margin ?? 1, 0);\n const total = matrix.size + 2 * margin;\n return {\n matrix,\n logoBox,\n paths: qrPaths(matrix, {\n dotStyle: style.dotStyle ?? 'square',\n eyeFrameStyle: style.eyeFrameStyle ?? 'square',\n eyeBallStyle: style.eyeBallStyle ?? 'square',\n clearSize: logoBox?.clear,\n }),\n viewBox: { x: -margin, y: -margin, size: total, value: `${-margin} ${-margin} ${total} ${total}` },\n };\n}\n","import { qrGradientLine, qrLayout } from './layout';\nimport { TxQrSvgOptions } from './types';\n\nlet nextId = 0;\n\nconst escape = (value: string | number) =>\n String(value).replace(/&/g, '&amp;').replace(/\"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');\n\nexport function qrToSvg(text: string, options: TxQrSvgOptions = {}): string {\n const layout = qrLayout(text, options);\n const { viewBox, paths, logoBox, matrix } = layout;\n const size = options.size ?? 200;\n const color = options.color ?? '#000000';\n const gradientId = `tx-qr-gradient-${(nextId += 1)}`;\n const parts: string[] = [];\n let dotFill = color;\n if (options.gradient) {\n const line = qrGradientLine(options.gradient, matrix.size);\n const stops = `<stop offset=\"0\" stop-color=\"${escape(line.colors[0])}\"/><stop offset=\"1\" stop-color=\"${escape(line.colors[1])}\"/>`;\n parts.push(\n line.radial\n ? `<defs><radialGradient id=\"${gradientId}\" gradientUnits=\"userSpaceOnUse\" cx=\"${line.center}\" cy=\"${line.center}\" r=\"${line.radius}\">${stops}</radialGradient></defs>`\n : `<defs><linearGradient id=\"${gradientId}\" gradientUnits=\"userSpaceOnUse\" x1=\"${line.x1}\" y1=\"${line.y1}\" x2=\"${line.x2}\" y2=\"${line.y2}\">${stops}</linearGradient></defs>`,\n );\n dotFill = `url(#${gradientId})`;\n }\n const eyeFill = options.eyeColor ?? dotFill;\n const ballFill = options.eyeBallColor ?? options.eyeColor ?? dotFill;\n parts.push(`<rect x=\"${viewBox.x}\" y=\"${viewBox.y}\" width=\"${viewBox.size}\" height=\"${viewBox.size}\" fill=\"${escape(options.background ?? '#ffffff')}\"/>`);\n parts.push(`<path d=\"${paths.dots}\" fill=\"${escape(dotFill)}\"/>`);\n parts.push(`<path d=\"${paths.eyeFrames}\" fill-rule=\"evenodd\" fill=\"${escape(eyeFill)}\"/>`);\n parts.push(`<path d=\"${paths.eyeBalls}\" fill=\"${escape(ballFill)}\"/>`);\n if (logoBox && options.logo) {\n parts.push(\n `<image href=\"${escape(options.logo)}\" x=\"${logoBox.x}\" y=\"${logoBox.y}\" width=\"${logoBox.size}\" height=\"${logoBox.size}\" preserveAspectRatio=\"xMidYMid meet\"/>`,\n );\n }\n const title = options.title ? `<title>${escape(options.title)}</title>` : '';\n const crisp = (options.dotStyle ?? 'square') === 'square' ? ' shape-rendering=\"crispEdges\"' : '';\n return `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"${size}\" height=\"${size}\" viewBox=\"${viewBox.value}\"${crisp}>${title}${parts.join('')}</svg>`;\n}\n","import { qrToSvg } from './svg';\nimport { TxQrPngOptions } from './types';\n\nasync function toDataUrl(url: string): Promise<string> {\n const blob = await (await fetch(url)).blob();\n return new Promise<string>((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = () => resolve(String(reader.result));\n reader.onerror = () => reject(reader.error);\n reader.readAsDataURL(blob);\n });\n}\n\nexport async function inlineSvgImages(svg: string): Promise<string> {\n const urls = Array.from(new Set(Array.from(svg.matchAll(/href=\"([^\"]+)\"/g), (match) => match[1]))).filter((url) => !url.startsWith('data:') && !url.startsWith('#'));\n let result = svg;\n for (const url of urls) {\n try {\n const dataUrl = await toDataUrl(url.replace(/&amp;/g, '&'));\n result = result.split(`href=\"${url}\"`).join(`href=\"${dataUrl}\"`);\n } catch {\n continue;\n }\n }\n return result;\n}\n\nexport function svgDataUrl(svg: string): string {\n return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svg)}`;\n}\n\nexport async function svgToPng(svg: string, pixelSize = 1024): Promise<string> {\n const image = new Image();\n image.src = svgDataUrl(await inlineSvgImages(svg));\n await image.decode();\n const canvas = document.createElement('canvas');\n canvas.width = pixelSize;\n canvas.height = pixelSize;\n canvas.getContext('2d')?.drawImage(image, 0, 0, pixelSize, pixelSize);\n return canvas.toDataURL('image/png');\n}\n\nexport function qrToPng(text: string, options: TxQrPngOptions = {}): Promise<string> {\n return svgToPng(qrToSvg(text, options), options.pixelSize ?? 1024);\n}\n"],"mappings":"AAEA,MAAM,SAAyE;CA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AAC,CAAC,CAAC,CAAC,QAAQ,QAAQ,CAAC,IAAI,WAAW,OAAO,KAAK,CAAC,IAAI,WAAW,GAAG,CAAC;CACnK,IAAI,SAAS;CACb,KAAK,MAAM,OAAO,MAChB,IAAI;EACF,MAAM,UAAU,MAAM,UAAU,IAAI,QAAQ,UAAU,GAAG,CAAC;EAC1D,SAAS,OAAO,MAAM,SAAS,IAAG,EAAG,CAAC,CAAC,KAAK,SAAS,QAAO,EAAG;CACjE,QAAQ;EACN;CACF;CAEF,OAAO;AACT;AAEA,SAAgB,WAAW,KAAW;CACpC,OAAO,oCAAoC,mBAAmB,GAAG;AACnE;AAEA,eAAsB,SAAS,KAAa,YAAY,MAAI;CAC1D,MAAM,QAAQ,IAAI,MAAK;CACvB,MAAM,MAAM,WAAW,MAAM,gBAAgB,GAAG,CAAC;CACjD,MAAM,MAAM,OAAM;CAClB,MAAM,SAAS,SAAS,cAAc,QAAQ;CAC9C,OAAO,QAAQ;CACf,OAAO,SAAS;CAChB,OAAO,WAAW,IAAI,CAAC,EAAE,UAAU,OAAO,GAAG,GAAG,WAAW,SAAS;CACpE,OAAO,OAAO,UAAU,WAAW;AACrC;AAEA,SAAgB,QAAQ,MAAc,UAA0B,CAAA,GAAE;CAChE,OAAO,SAAS,QAAQ,MAAM,OAAO,GAAG,QAAQ,aAAa,IAAI;AACnE"}
package/package.json CHANGED
@@ -1,6 +1,43 @@
1
1
  {
2
2
  "name": "@tectra-ng/qr",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.6",
4
+ "description": "QR codes with no dependencies: an encoder for every version and error-correction level, and styled SVG or PNG output with shaped dots and eyes, colours, gradients and a logo. Works in any framework and on the server.",
5
+ "license": "MIT",
6
+ "homepage": "https://tectra-ng.com/components/qr-code",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/kulakovskyi/tectra-ng.git",
10
+ "directory": "packages/qr"
11
+ },
12
+ "bugs": "https://github.com/kulakovskyi/tectra-ng/issues",
13
+ "keywords": [
14
+ "tectra",
15
+ "qr",
16
+ "qrcode",
17
+ "qr-code",
18
+ "qr-code-generator",
19
+ "svg",
20
+ "png",
21
+ "zero-dependency",
22
+ "typescript"
23
+ ],
24
+ "sideEffects": false,
25
+ "publishConfig": {
26
+ "access": "public"
27
+ },
28
+ "module": "fesm2022/tectra-ng-qr.mjs",
29
+ "typings": "types/tectra-ng-qr.d.ts",
30
+ "exports": {
31
+ "./package.json": {
32
+ "default": "./package.json"
33
+ },
34
+ ".": {
35
+ "types": "./types/tectra-ng-qr.d.ts",
36
+ "default": "./fesm2022/tectra-ng-qr.mjs"
37
+ }
38
+ },
39
+ "type": "module",
40
+ "dependencies": {
41
+ "tslib": "^2.3.0"
42
+ }
6
43
  }
@@ -0,0 +1,103 @@
1
+ export type TxQrErrorCorrection = 'L' | 'M' | 'Q' | 'H';
2
+ export type TxQrDotStyle = 'square' | 'dots' | 'rounded' | 'soft';
3
+ export type TxQrEyeFrameStyle = 'square' | 'rounded' | 'circle';
4
+ export type TxQrEyeBallStyle = 'square' | 'rounded' | 'circle';
5
+ export type TxQrImageFormat = 'png' | 'svg';
6
+ export interface TxQrMatrix {
7
+ version: number;
8
+ size: number;
9
+ errorCorrection: TxQrErrorCorrection;
10
+ mask: number;
11
+ modules: boolean[][];
12
+ }
13
+ export interface TxQrGradient {
14
+ type?: 'linear' | 'radial';
15
+ colors: readonly [string, string];
16
+ rotation?: number;
17
+ }
18
+ export interface TxQrStyle {
19
+ margin?: number;
20
+ errorCorrection?: TxQrErrorCorrection;
21
+ dotStyle?: TxQrDotStyle;
22
+ eyeFrameStyle?: TxQrEyeFrameStyle;
23
+ eyeBallStyle?: TxQrEyeBallStyle;
24
+ logo?: string;
25
+ logoSize?: number;
26
+ logoMargin?: number;
27
+ }
28
+ export interface TxQrSvgOptions extends TxQrStyle {
29
+ size?: number;
30
+ color?: string;
31
+ background?: string;
32
+ eyeColor?: string;
33
+ eyeBallColor?: string;
34
+ gradient?: TxQrGradient;
35
+ title?: string;
36
+ }
37
+ export interface TxQrPngOptions extends TxQrSvgOptions {
38
+ pixelSize?: number;
39
+ }
40
+ export interface TxQrEncodeOptions {
41
+ errorCorrection?: TxQrErrorCorrection;
42
+ minVersion?: number;
43
+ maxVersion?: number;
44
+ mask?: number;
45
+ boostErrorCorrection?: boolean;
46
+ }
47
+ export declare class TxQrCapacityError extends Error {
48
+ constructor();
49
+ }
50
+ export declare function encodeQr(text: string, options?: TxQrEncodeOptions): TxQrMatrix;
51
+ export interface TxQrShapeOptions {
52
+ dotStyle: TxQrDotStyle;
53
+ eyeFrameStyle: TxQrEyeFrameStyle;
54
+ eyeBallStyle: TxQrEyeBallStyle;
55
+ clearSize?: number;
56
+ }
57
+ export interface TxQrPaths {
58
+ dots: string;
59
+ eyeFrames: string;
60
+ eyeBalls: string;
61
+ eyes: readonly {
62
+ x: number;
63
+ y: number;
64
+ }[];
65
+ }
66
+ export declare function roundedRect(x: number, y: number, width: number, height: number, radius: number): string;
67
+ export declare function qrPaths(matrix: TxQrMatrix, options: TxQrShapeOptions): TxQrPaths;
68
+ export interface TxQrLogoBox {
69
+ x: number;
70
+ y: number;
71
+ size: number;
72
+ clear: number;
73
+ }
74
+ export interface TxQrGradientLine {
75
+ radial: boolean;
76
+ colors: readonly [string, string];
77
+ center: number;
78
+ radius: number;
79
+ x1: number;
80
+ y1: number;
81
+ x2: number;
82
+ y2: number;
83
+ }
84
+ export interface TxQrLayout {
85
+ matrix: TxQrMatrix;
86
+ paths: TxQrPaths;
87
+ logoBox: TxQrLogoBox | null;
88
+ viewBox: {
89
+ x: number;
90
+ y: number;
91
+ size: number;
92
+ value: string;
93
+ };
94
+ }
95
+ export declare function qrLogoBox(matrix: TxQrMatrix, style: TxQrStyle): TxQrLogoBox | null;
96
+ export declare function qrGradientLine(gradient: TxQrGradient, size: number): TxQrGradientLine;
97
+ export declare function qrLayout(text: string, style?: TxQrStyle): TxQrLayout;
98
+ export declare function qrToSvg(text: string, options?: TxQrSvgOptions): string;
99
+ export declare function inlineSvgImages(svg: string): Promise<string>;
100
+ export declare function svgDataUrl(svg: string): string;
101
+ export declare function svgToPng(svg: string, pixelSize?: number): Promise<string>;
102
+ export declare function qrToPng(text: string, options?: TxQrPngOptions): Promise<string>;
103
+ //# sourceMappingURL=tectra-ng-qr.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tectra-ng-qr.d.ts","names":[],"sources":["../../../../packages/qr/src/types.ts","../../../../packages/qr/src/encoder.ts","../../../../packages/qr/src/paths.ts","../../../../packages/qr/src/layout.ts","../../../../packages/qr/src/svg.ts","../../../../packages/qr/src/png.ts"],"mappings":"AAAA,YAAY;YAEA;YAEA;YAEA;YAEA;iBAEK;EACf;EACA;EACA,iBAAiB;EACjB;EACA;;iBAGe;EACf;EACA;EACA;;iBAGe;EACf;EACA,kBAAkB;EAClB,WAAW;EACX,gBAAgB;EAChB,eAAe;EACf;EACA;EACA;;iBAGe,uBAAuB;EACtC;EACA;EACA;EACA;EACA;EACA,WAAW;EACX;;iBAGe,uBAAuB;EACtC;;iBCEe;EACf,kBAAkB;EAClB;EACA;EACA;EACA;;qBAGW,0BAA0B;EAAA;;wBA8VvB,SAAS,cAAc,UAAS,oBAAyB;iBCpZxD;EACf,UAAU;EACV,eAAe;EACf,cAAc;EACd;;iBAGe;EACf;EACA;EACA;EACA;IAAiB;IAAW;;;wBAcd,YAAY,WAAW,WAAW,eAAe,gBAAgB;wBA2DjE,QAAQ,QAAQ,YAAY,SAAS,mBAAmB;iBChFvD;EACf;EACA;EACA;EACA;;iBAGe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;iBAGe;EACf,QAAQ;EACR,OAAO;EACP,SAAS;EACT;IAAW;IAAW;IAAW;IAAc;;;wBAGjC,UAAU,QAAQ,YAAY,OAAO,YAAY;wBASjD,eAAe,UAAU,cAAc,eAAe;wBAQtD,SAAS,cAAc,QAAO,YAAiB;wBCxC/C,QAAQ,cAAc,UAAS;wBCKzB,gBAAgB,cAAc;wBAcpC,WAAW;wBAIL,SAAS,aAAa,qBAAmB;wBAW/C,QAAQ,cAAc,UAAS,iBAAsB"}