@sythos/js_barcode_universal 1.5.13 → 1.5.15

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.
Files changed (137) hide show
  1. package/LICENSE +22 -4
  2. package/NOTICE.md +10 -1
  3. package/README.md +416 -22
  4. package/bundle/sythos-barcode.esm.js +22176 -11991
  5. package/bundle/sythos-barcode.js +22059 -11991
  6. package/licenses/README.md +12 -1
  7. package/licenses/codablockf.license +51 -0
  8. package/licenses/code16k.license +52 -0
  9. package/licenses/code25.license +58 -0
  10. package/licenses/code32.license +51 -0
  11. package/licenses/dotcode.license +66 -0
  12. package/licenses/gs1-composite.license +106 -0
  13. package/licenses/gs1-databar.license +21 -14
  14. package/licenses/hanxin.license +95 -0
  15. package/licenses/maxicode.license +62 -0
  16. package/licenses/postal.license +61 -0
  17. package/licenses/pzn.license +53 -0
  18. package/licenses/telepen.license +73 -0
  19. package/llms.txt +62 -6
  20. package/package.json +47 -3
  21. package/src/index.d.ts +111 -6
  22. package/src/index.js +362 -13
  23. package/src/js/codablockf/decoder.js +198 -0
  24. package/src/js/codablockf/encoder.js +97 -0
  25. package/src/js/codablockf/index.js +3 -0
  26. package/src/js/code16k/decoder.js +303 -0
  27. package/src/js/code16k/detector.js +187 -0
  28. package/src/js/code16k/encoder.js +153 -0
  29. package/src/js/code16k/index.js +14 -0
  30. package/src/js/code16k/tables.js +152 -0
  31. package/src/js/composite/index.js +570 -0
  32. package/src/js/core/detection-contract.js +185 -0
  33. package/src/js/core/symbol-layout.js +155 -0
  34. package/src/js/databar/expanded.js +968 -0
  35. package/src/js/databar/index.js +4 -0
  36. package/src/js/databar/layout.js +192 -0
  37. package/src/js/databar/limited.js +533 -0
  38. package/src/js/databar/stacked-omnidirectional.js +548 -0
  39. package/src/js/databar/stacked.js +528 -0
  40. package/src/js/dotcode/decoder.js +548 -0
  41. package/src/js/dotcode/detector.js +251 -0
  42. package/src/js/dotcode/encoder.js +453 -0
  43. package/src/js/dotcode/index.js +34 -0
  44. package/src/js/dotcode/tables.js +168 -0
  45. package/src/js/hanxin/decoder.js +299 -0
  46. package/src/js/hanxin/detector.js +122 -0
  47. package/src/js/hanxin/encoder.js +259 -0
  48. package/src/js/hanxin/index.js +16 -0
  49. package/src/js/hanxin/tables.js +316 -0
  50. package/src/js/image/height-coded.js +164 -0
  51. package/src/js/maxicode/decoder.js +275 -0
  52. package/src/js/maxicode/detector.js +118 -0
  53. package/src/js/maxicode/encoder.js +438 -0
  54. package/src/js/maxicode/index.js +34 -0
  55. package/src/js/maxicode/tables.js +132 -0
  56. package/src/js/oned/code25.js +148 -0
  57. package/src/js/oned/index.js +21 -3
  58. package/src/js/oned/postal.js +889 -0
  59. package/src/js/oned/reader.js +272 -7
  60. package/src/js/oned/telepen.js +361 -0
  61. package/src/js/oned/writers.js +186 -12
  62. package/src/js/stacked128/common.js +208 -0
  63. package/src/ts/codablockf/decoder.ts +212 -0
  64. package/src/ts/codablockf/encoder.ts +128 -0
  65. package/src/ts/codablockf/index.d.ts +31 -0
  66. package/src/ts/codablockf/index.ts +6 -0
  67. package/src/ts/code16k/decoder.d.ts +25 -0
  68. package/src/ts/code16k/decoder.ts +313 -0
  69. package/src/ts/code16k/detector.d.ts +21 -0
  70. package/src/ts/code16k/detector.ts +203 -0
  71. package/src/ts/code16k/encoder.d.ts +26 -0
  72. package/src/ts/code16k/encoder.ts +198 -0
  73. package/src/ts/code16k/index.d.ts +10 -0
  74. package/src/ts/code16k/index.ts +47 -0
  75. package/src/ts/code16k/tables.d.ts +54 -0
  76. package/src/ts/code16k/tables.ts +195 -0
  77. package/src/ts/composite/index.d.ts +74 -0
  78. package/src/ts/composite/index.ts +547 -0
  79. package/src/ts/core/detection-contract.d.ts +119 -0
  80. package/src/ts/core/detection-contract.ts +267 -0
  81. package/src/ts/core/symbol-layout.d.ts +108 -0
  82. package/src/ts/core/symbol-layout.ts +236 -0
  83. package/src/ts/databar/expanded.d.ts +40 -0
  84. package/src/ts/databar/expanded.ts +948 -0
  85. package/src/ts/databar/index.d.ts +48 -0
  86. package/src/ts/databar/index.ts +48 -0
  87. package/src/ts/databar/layout.d.ts +122 -0
  88. package/src/ts/databar/layout.ts +275 -0
  89. package/src/ts/databar/limited.d.ts +85 -0
  90. package/src/ts/databar/limited.ts +553 -0
  91. package/src/ts/databar/stacked-omnidirectional.d.ts +128 -0
  92. package/src/ts/databar/stacked-omnidirectional.ts +559 -0
  93. package/src/ts/databar/stacked.d.ts +96 -0
  94. package/src/ts/databar/stacked.ts +549 -0
  95. package/src/ts/dotcode/decoder.d.ts +58 -0
  96. package/src/ts/dotcode/decoder.ts +467 -0
  97. package/src/ts/dotcode/detector.d.ts +63 -0
  98. package/src/ts/dotcode/detector.ts +263 -0
  99. package/src/ts/dotcode/encoder.d.ts +69 -0
  100. package/src/ts/dotcode/encoder.ts +427 -0
  101. package/src/ts/dotcode/index.d.ts +37 -0
  102. package/src/ts/dotcode/index.ts +72 -0
  103. package/src/ts/dotcode/tables.d.ts +74 -0
  104. package/src/ts/dotcode/tables.ts +174 -0
  105. package/src/ts/hanxin/decoder.d.ts +48 -0
  106. package/src/ts/hanxin/decoder.ts +314 -0
  107. package/src/ts/hanxin/detector.d.ts +45 -0
  108. package/src/ts/hanxin/detector.ts +124 -0
  109. package/src/ts/hanxin/encoder.d.ts +41 -0
  110. package/src/ts/hanxin/encoder.ts +290 -0
  111. package/src/ts/hanxin/index.d.ts +16 -0
  112. package/src/ts/hanxin/index.ts +18 -0
  113. package/src/ts/hanxin/tables.d.ts +80 -0
  114. package/src/ts/hanxin/tables.ts +348 -0
  115. package/src/ts/image/height-coded.d.ts +101 -0
  116. package/src/ts/image/height-coded.ts +227 -0
  117. package/src/ts/index.d.ts +46 -2
  118. package/src/ts/index.ts +380 -13
  119. package/src/ts/maxicode/decoder.ts +265 -0
  120. package/src/ts/maxicode/detector.ts +109 -0
  121. package/src/ts/maxicode/encoder.ts +414 -0
  122. package/src/ts/maxicode/index.d.ts +96 -0
  123. package/src/ts/maxicode/index.ts +44 -0
  124. package/src/ts/maxicode/tables.ts +136 -0
  125. package/src/ts/oned/code25.d.ts +42 -0
  126. package/src/ts/oned/code25.ts +170 -0
  127. package/src/ts/oned/index.d.ts +7 -2
  128. package/src/ts/oned/index.ts +45 -3
  129. package/src/ts/oned/postal.d.ts +44 -0
  130. package/src/ts/oned/postal.ts +819 -0
  131. package/src/ts/oned/reader.d.ts +35 -0
  132. package/src/ts/oned/reader.ts +261 -7
  133. package/src/ts/oned/telepen.d.ts +65 -0
  134. package/src/ts/oned/telepen.ts +368 -0
  135. package/src/ts/oned/writers.d.ts +32 -0
  136. package/src/ts/oned/writers.ts +184 -13
  137. package/src/ts/stacked128/common.ts +225 -0
package/src/index.js CHANGED
@@ -48,8 +48,9 @@ import { BitMatrix } from './js/core/bit-matrix.js';
48
48
  import { EncodeError, NotFoundError } from './js/core/errors.js';
49
49
  import { LuminanceSource } from './js/image/luminance.js';
50
50
  import { binarize } from './js/image/binarizer.js';
51
- import { ONED_FORMATS } from './js/oned/index.js';
51
+ import { ONED_FORMATS, encodeCode32, encodePZN, encodeStandard2of5, encodeIndustrial2of5, encodeIATA2of5, encodePostnet, encodePlanet, encodeRM4SCC, encodeKIX, encodeAustraliaPost, encodeJapanPost, encodeIMB, } from './js/oned/index.js';
52
52
  import { decodeOneD } from './js/oned/reader.js';
53
+ import { encodeTelepen, encodeTelepenNumeric } from './js/oned/telepen.js';
53
54
  import * as datamatrix from './js/datamatrix/index.js';
54
55
  import * as qr from './js/qr/index.js';
55
56
  import * as aztec from './js/aztec/index.js';
@@ -61,6 +62,12 @@ import * as frameqr from './js/frameqr/index.js';
61
62
  import * as aztecRune from './js/aztecrune/index.js';
62
63
  import * as compactPdf417 from './js/compactpdf417/index.js';
63
64
  import * as databar from './js/databar/index.js';
65
+ import * as maxicode from './js/maxicode/index.js';
66
+ import * as codablockf from './js/codablockf/index.js';
67
+ import * as code16k from './js/code16k/index.js';
68
+ import * as dotcode from './js/dotcode/index.js';
69
+ import * as hanxin from './js/hanxin/index.js';
70
+ import * as composite from './js/composite/index.js';
64
71
  export { BitMatrix };
65
72
  export { BarcodeError, EncodeError, NotFoundError, FormatError, ChecksumError, } from './js/core/errors.js';
66
73
  export { LuminanceSource } from './js/image/luminance.js';
@@ -77,9 +84,15 @@ export { encodeAztec, decodeAztec, detectAztec, detectAndDecodeAztec } from './j
77
84
  export * from './js/aztecrune/index.js';
78
85
  export { encodePDF417, decodePDF417, detectPDF417, detectAndDecodePDF417 } from './js/pdf417/index.js';
79
86
  export * from './js/compactpdf417/index.js';
80
- // DataBar exports include both the verified GTIN/data layer and the
81
- // Omnidirectional/Truncated physical image path.
87
+ // DataBar exports include the verified GTIN/data layer and the supported
88
+ // Omnidirectional/Truncated, Limited, Stacked and Stacked Omnidirectional paths.
82
89
  export * from './js/databar/index.js';
90
+ export { encodeMaxiCode, decodeMaxiCode, detectMaxiCode, detectAndDecodeMaxiCode, } from './js/maxicode/index.js';
91
+ export { encodeCodablockF, decodeCodablockF, detectCodablockF, detectAndDecodeCodablockF, } from './js/codablockf/index.js';
92
+ export { encodeCode16K, decodeCode16K, detectCode16K, detectAndDecodeCode16K, } from './js/code16k/index.js';
93
+ export * from './js/dotcode/index.js';
94
+ export * from './js/hanxin/index.js';
95
+ export { GS1_COMPOSITE_PROFILE, GS1_COMPOSITE_HOSTS, encodeGS1Composite, decodeGS1Composite, detectGS1Composite, detectAndDecodeGS1Composite, } from './js/composite/index.js';
83
96
  export { encodeMicroPDF417, decodeMicroPDF417, detectMicroPDF417, detectAndDecodeMicroPDF417, } from './js/micropdf417/index.js';
84
97
  export { encodeMicroQR, decodeMicroQR, detectMicroQR, detectAndDecodeMicroQR } from './js/microqr/index.js';
85
98
  export { encodeRMQR, decodeRMQR, detectRMQR, detectAndDecodeRMQR } from './js/rmqr/index.js';
@@ -130,6 +143,26 @@ const compactPdf417CanEncode = typeof compactPdf417.encodeCompactPDF417 === 'fun
130
143
  const compactPdf417CanDecode = typeof compactPdf417.detectAndDecodeCompactPDF417 === 'function';
131
144
  const dataBarCanEncode = typeof databar.encodeDataBar14 === 'function';
132
145
  const dataBarCanDecode = typeof databar.decodeDataBar14Scanline === 'function';
146
+ const dataBarStackedCanEncode = typeof databar.encodeDataBar14Stacked === 'function';
147
+ const dataBarStackedCanDecode = typeof databar.detectAndDecodeDataBar14Stacked === 'function';
148
+ const dataBarStackedOmniCanEncode = typeof databar.encodeDataBarStackedOmnidirectional === 'function';
149
+ const dataBarStackedOmniCanDecode = typeof databar.detectAndDecodeDataBarStackedOmnidirectional === 'function';
150
+ const dataBarLimitedCanEncode = typeof databar.encodeDataBarLimited === 'function';
151
+ const dataBarLimitedCanDecode = typeof databar.detectAndDecodeDataBarLimited === 'function';
152
+ const dataBarExpandedCanEncode = typeof databar.encodeDataBarExpanded === 'function';
153
+ const dataBarExpandedCanDecode = typeof databar.detectAndDecodeDataBarExpanded === 'function';
154
+ const maxicodeCanEncode = typeof maxicode.encodeMaxiCode === 'function';
155
+ const maxicodeCanDecode = typeof maxicode.detectAndDecodeMaxiCode === 'function';
156
+ const codablockfCanEncode = typeof codablockf.encodeCodablockF === 'function';
157
+ const codablockfCanDecode = typeof codablockf.detectAndDecodeCodablockF === 'function';
158
+ const code16kCanEncode = typeof code16k.encodeCode16K === 'function';
159
+ const code16kCanDecode = typeof code16k.detectAndDecodeCode16K === 'function';
160
+ const dotCodeCanEncode = typeof dotcode.encodeDotCode === 'function';
161
+ const dotCodeCanDecode = typeof dotcode.detectAndDecodeDotCode === 'function';
162
+ const hanXinCanEncode = typeof hanxin.encodeHanXin === 'function';
163
+ const hanXinCanDecode = typeof hanxin.detectAndDecodeHanXin === 'function';
164
+ const gs1CompositeCanEncode = typeof composite.encodeGS1Composite === 'function';
165
+ const gs1CompositeCanDecode = typeof composite.detectAndDecodeGS1Composite === 'function';
133
166
  /**
134
167
  * Every format this build supports.
135
168
  *
@@ -226,6 +259,76 @@ export function listFormats() {
226
259
  canRead: dataBarCanDecode,
227
260
  kind: /** @type {'1D'} */ ('1D'),
228
261
  });
262
+ formats.push({
263
+ id: 'gs1databar-stacked',
264
+ label: 'GS1 DataBar Stacked',
265
+ canWrite: dataBarStackedCanEncode,
266
+ canRead: dataBarStackedCanDecode,
267
+ kind: /** @type {'1D'} */ ('1D'),
268
+ });
269
+ formats.push({
270
+ id: 'gs1databar-stacked-omnidirectional',
271
+ label: 'GS1 DataBar Stacked Omnidirectional',
272
+ canWrite: dataBarStackedOmniCanEncode,
273
+ canRead: dataBarStackedOmniCanDecode,
274
+ kind: /** @type {'1D'} */ ('1D'),
275
+ });
276
+ formats.push({
277
+ id: 'gs1databar-limited',
278
+ label: 'GS1 DataBar Limited',
279
+ canWrite: dataBarLimitedCanEncode,
280
+ canRead: dataBarLimitedCanDecode,
281
+ kind: /** @type {'1D'} */ ('1D'),
282
+ });
283
+ formats.push({
284
+ id: 'gs1databar-expanded',
285
+ label: 'GS1 DataBar Expanded',
286
+ canWrite: dataBarExpandedCanEncode,
287
+ canRead: dataBarExpandedCanDecode,
288
+ kind: /** @type {'1D'} */ ('1D'),
289
+ });
290
+ formats.push({
291
+ id: 'maxicode',
292
+ label: 'MaxiCode',
293
+ canWrite: maxicodeCanEncode,
294
+ canRead: maxicodeCanDecode,
295
+ kind: /** @type {'2D'} */ ('2D'),
296
+ });
297
+ formats.push({
298
+ id: 'codablockf',
299
+ label: 'Codablock-F',
300
+ canWrite: codablockfCanEncode,
301
+ canRead: codablockfCanDecode,
302
+ kind: /** @type {'2D'} */ ('2D'),
303
+ });
304
+ formats.push({
305
+ id: 'code16k',
306
+ label: 'Code 16K',
307
+ canWrite: code16kCanEncode,
308
+ canRead: code16kCanDecode,
309
+ kind: /** @type {'2D'} */ ('2D'),
310
+ });
311
+ formats.push({
312
+ id: 'dotcode',
313
+ label: 'DotCode',
314
+ canWrite: dotCodeCanEncode,
315
+ canRead: dotCodeCanDecode,
316
+ kind: /** @type {'2D'} */ ('2D'),
317
+ });
318
+ formats.push({
319
+ id: 'hanxin',
320
+ label: 'Han Xin Code',
321
+ canWrite: hanXinCanEncode,
322
+ canRead: hanXinCanDecode,
323
+ kind: /** @type {'2D'} */ ('2D'),
324
+ });
325
+ formats.push({
326
+ id: 'gs1composite',
327
+ label: 'GS1 DataBar Composite (bounded profile)',
328
+ canWrite: gs1CompositeCanEncode,
329
+ canRead: gs1CompositeCanDecode,
330
+ kind: /** @type {'2D'} */ ('2D'),
331
+ });
229
332
  return formats;
230
333
  }
231
334
  /**
@@ -239,9 +342,11 @@ export function listFormats() {
239
342
  * @param {string | number} text
240
343
  * @param {object} [options]
241
344
  * @param {string} [options.format] Format id. Default 'qr'.
242
- * @param {'L'|'M'|'Q'|'H'} [options.ecc] QR error-correction level.
243
- * @param {number} [options.version] QR version, 1-40. Auto if omitted.
345
+ * @param {'L'|'M'|'Q'|'H'|'L1'|'L2'|'L3'|'L4'|1|2|3|4} [options.ecc] QR or Han Xin error-correction level.
346
+ * @param {number} [options.version] QR version 1-40 or Han Xin version 1-3. Auto if omitted.
244
347
  * @param {boolean} [options.checkDigit] Append a check digit, where optional.
348
+ * @param {'ascii'|'numeric'} [options.telepenMode] Telepen encoding mode.
349
+ * @param {boolean} [options.numeric] Alias for Telepen Numeric mode.
245
350
  * @param {boolean} [options.fullAscii] Code 39 extended encoding.
246
351
  * @param {boolean} [options.gs1] Emit a leading FNC1.
247
352
  * @param {number} [options.layers] Aztec layer count; automatic if omitted.
@@ -254,6 +359,16 @@ export function listFormats() {
254
359
  * @param {'auto'|'text'|'byte'|'numeric'} [options.compaction] PDF417 compaction mode.
255
360
  * @param {number} [options.eci] MicroPDF417 byte-compaction ECI assignment (3 or 26).
256
361
  * @param {number} [options.aspectRatio] Preferred MicroPDF417 symbol aspect ratio.
362
+ * @param {0|1|2|3} [options.mask] Han Xin data mask.
363
+ * @param {boolean} [options.pzn8] Select the eight-digit PZN profile.
364
+ * @param {'pzn7'|'pzn8'|'standard'|'industrial'|'iata'} [options.variant] PZN or Code 25 variant.
365
+ * @param {number} [options.wideRatio] Wide-bar ratio for Code 25 variants.
366
+ * @param {2|3|4|5|'auto'|'numeric'|'text'|'byte'} [options.mode] MaxiCode mode or Han Xin payload mode.
367
+ * @param {{postalCode:string,countryCode:number,serviceClass:number}} [options.primary] MaxiCode structured primary data for modes 2 and 3.
368
+ * @param {'latin1'} [options.charset] MaxiCode character set declaration.
369
+ * @param {boolean} [options.linkage] GS1 DataBar composite linkage flag.
370
+ * @param {number} [options.moduleScale] Integer module scale for GS1 DataBar physical variants.
371
+ * @param {number} [options.height] Output height for a GS1 DataBar physical variant.
257
372
  * @param {object} [options.canvas] Sythos Canvas QR artwork reservation.
258
373
  * @param {'square'|'circle'|'diamond'} [options.canvas.shape] Canvas shape.
259
374
  * @param {number} [options.canvas.size] Odd canvas size in QR modules.
@@ -300,9 +415,92 @@ export function encode(text, options = {}) {
300
415
  if (format === 'gs1databar14' || format === 'gs1-databar14' || format === 'databar') {
301
416
  return databar.encodeDataBar14(value, options);
302
417
  }
418
+ if (format === 'gs1databar-stacked' || format === 'gs1-databar-stacked' || format === 'databar-stacked') {
419
+ return databar.encodeDataBar14Stacked(value, options);
420
+ }
421
+ if (format === 'gs1databar-stacked-omnidirectional'
422
+ || format === 'gs1-databar-stacked-omnidirectional'
423
+ || format === 'databar-stacked-omni') {
424
+ return databar.encodeDataBarStackedOmnidirectional(value, options);
425
+ }
426
+ if (format === 'gs1databar-limited' || format === 'gs1-databar-limited' || format === 'databar-limited') {
427
+ return databar.encodeDataBarLimited(value, options);
428
+ }
429
+ if (format === 'gs1databar-expanded' || format === 'gs1-databar-expanded' || format === 'databar-expanded') {
430
+ return databar.encodeDataBarExpanded(value, options);
431
+ }
432
+ if (format === 'maxicode' || format === 'maxi-code') {
433
+ return maxicode.encodeMaxiCode(value, options);
434
+ }
435
+ if (format === 'codablockf' || format === 'codablock-f' || format === 'codablock') {
436
+ return codablockf.encodeCodablockF(value, options);
437
+ }
438
+ if (format === 'code16k' || format === 'code-16k') {
439
+ return code16k.encodeCode16K(value, options);
440
+ }
441
+ if (format === 'dotcode' || format === 'dot-code') {
442
+ return dotcode.encodeDotCode(value, options);
443
+ }
444
+ if (format === 'hanxin' || format === 'han-xin') {
445
+ return hanxin.encodeHanXin(value, options);
446
+ }
447
+ if (format === 'gs1composite' || format === 'gs1-composite' || format === 'composite') {
448
+ return composite.encodeGS1Composite(value, options);
449
+ }
450
+ if (format === 'telepennumeric' || format === 'telepen-numeric') {
451
+ return encodeTelepenNumeric(value);
452
+ }
453
+ if (format === 'telepen' || format === 'telepen-alpha') {
454
+ return encodeTelepen(value, options);
455
+ }
456
+ if (format === 'code32' || format === 'italian-pharmacode') {
457
+ return encodeCode32(value);
458
+ }
459
+ if (format === 'pzn' || format === 'pzn7' || format === 'pzn8') {
460
+ return encodePZN(value, {
461
+ ...options,
462
+ pzn8: format === 'pzn8' || options.pzn8 === true || options.variant === 'pzn8',
463
+ });
464
+ }
465
+ if (format === 'code2of5' || format === 'standard2of5' || format === 'standard-2-of-5') {
466
+ return encodeStandard2of5(value, options);
467
+ }
468
+ if (format === 'industrial2of5' || format === 'industrial-2-of-5') {
469
+ return encodeIndustrial2of5(value, options);
470
+ }
471
+ if (format === 'iata2of5' || format === 'iata-2-of-5') {
472
+ return encodeIATA2of5(value, options);
473
+ }
474
+ if (format === 'postnet' || format === 'usps-postnet') {
475
+ return encodePostnet(value, options);
476
+ }
477
+ if (format === 'planet' || format === 'usps-planet') {
478
+ return encodePlanet(value, options);
479
+ }
480
+ if (format === 'rm4scc' || format === 'royalmail' || format === 'royal-mail') {
481
+ return encodeRM4SCC(value, options);
482
+ }
483
+ if (format === 'kix') {
484
+ return encodeKIX(value);
485
+ }
486
+ if (format === 'auspost' || format === 'australia-post' || format === 'australiapost') {
487
+ return encodeAustraliaPost(value, options);
488
+ }
489
+ if (format === 'japanpost' || format === 'japan-post') {
490
+ return encodeJapanPost(value);
491
+ }
492
+ if (format === 'imb' || format === 'onecode' || format === 'usps-onecode') {
493
+ return encodeIMB(value);
494
+ }
303
495
  const entry = ONED_FORMATS[format];
304
496
  if (!entry) {
305
- const known = [...Object.keys(ONED_FORMATS), 'qr', 'datamatrix', 'aztec', 'aztecrune', 'pdf417', 'compactpdf417', 'micropdf417', 'microqr', 'rmqr', 'frameqr', 'gs1databar14'].join(', ');
497
+ const known = [...Object.keys(ONED_FORMATS), 'telepennumeric', 'telepen-numeric',
498
+ 'code32', 'italian-pharmacode', 'pzn', 'pzn7', 'pzn8',
499
+ 'code2of5', 'standard2of5', 'standard-2-of-5', 'industrial-2-of-5', 'iata-2-of-5',
500
+ 'postnet', 'usps-postnet', 'planet', 'usps-planet', 'rm4scc', 'royalmail', 'royal-mail',
501
+ 'kix', 'auspost', 'australia-post', 'australiapost', 'japanpost', 'japan-post',
502
+ 'imb', 'onecode', 'usps-onecode',
503
+ 'qr', 'datamatrix', 'aztec', 'aztecrune', 'pdf417', 'compactpdf417', 'micropdf417', 'microqr', 'rmqr', 'frameqr', 'gs1databar14', 'gs1databar-stacked', 'gs1databar-stacked-omnidirectional', 'gs1databar-limited', 'gs1databar-expanded', 'maxicode', 'codablockf', 'code16k', 'dotcode', 'hanxin', 'gs1composite', 'gs1-composite', 'composite'].join(', ');
306
504
  throw new EncodeError(`Unknown format "${format}". Known formats: ${known}`);
307
505
  }
308
506
  return entry.encode(value, options);
@@ -322,6 +520,8 @@ export function encode(text, options = {}) {
322
520
  * @property {number} [columns] PDF417 column count.
323
521
  * @property {number} [eccLevel] PDF417 error-correction level.
324
522
  * @property {number} [rowHeight] PDF417 row height in modules.
523
+ * @property {number} [moduleSize] Detected module scale for stacked formats.
524
+ * @property {boolean} [checksum] Whether the stacked format checks passed.
325
525
  * @property {number} [variant] MicroPDF417 predefined variant number.
326
526
  * @property {number} [eccCodewords] MicroPDF417 fixed error-correction codewords.
327
527
  * @property {string} [profile] Sythos Canvas QR profile identifier.
@@ -338,6 +538,10 @@ export function encode(text, options = {}) {
338
538
  * @property {string} [gs1ParseError] Semantic GS1 parsing error after a valid physical read.
339
539
  * @property {string} [gtin] GS1 DataBar GTIN-14 payload.
340
540
  * @property {boolean} [linkage] GS1 DataBar linkage flag.
541
+ * @property {boolean} [checkDigit] Whether an optional numeric check digit was validated.
542
+ * @property {'pzn7'|'pzn8'} [pznVariant] PZN variant identified by the decoder.
543
+ * @property {0|1|2|3} [mask] Han Xin data mask.
544
+ * @property {boolean} [inverted] Han Xin module polarity.
341
545
  */
342
546
  /**
343
547
  * Find and decode every barcode in an image.
@@ -369,10 +573,37 @@ export function decode(image, options = {}) {
369
573
  const wantMicroQR = !want || want.has('microqr') || want.has('micro-qr');
370
574
  const wantRMQR = !want || want.has('rmqr') || want.has('r-mqr') || want.has('rectangular-micro-qr');
371
575
  const wantFrameQR = !want || want.has('frameqr') || want.has('frame-qr') || want.has('canvas-qr');
372
- const oneDAliases = new Set(['gs1databar14', 'databar', 'gs1-databar14']);
576
+ const wantMaxiCode = !want || want.has('maxicode') || want.has('maxi-code');
577
+ const wantCodablockF = !want || want.has('codablockf') || want.has('codablock-f') || want.has('codablock');
578
+ const wantCode16K = !want || want.has('code16k') || want.has('code-16k');
579
+ const wantDotCode = !want || want.has('dotcode') || want.has('dot-code');
580
+ const wantHanXin = !want || want.has('hanxin') || want.has('han-xin');
581
+ const wantGS1Composite = !want || want.has('gs1composite') || want.has('gs1-composite') || want.has('composite');
582
+ const wantDataBarStacked = !want || want.has('gs1databar-stacked') || want.has('gs1-databar-stacked') || want.has('databar-stacked');
583
+ const wantDataBarStackedOmni = !want || want.has('gs1databar-stacked-omnidirectional')
584
+ || want.has('gs1-databar-stacked-omnidirectional') || want.has('databar-stacked-omni');
585
+ const wantDataBarLimited = !want || want.has('gs1databar-limited')
586
+ || want.has('gs1-databar-limited') || want.has('databar-limited');
587
+ const wantDataBarExpanded = !want || want.has('gs1databar-expanded')
588
+ || want.has('gs1-databar-expanded') || want.has('databar-expanded');
589
+ const oneDAliases = new Set([
590
+ 'gs1databar14', 'databar', 'gs1-databar14',
591
+ 'gs1databar-stacked', 'gs1-databar-stacked', 'databar-stacked',
592
+ 'gs1databar-stacked-omnidirectional', 'gs1-databar-stacked-omnidirectional', 'databar-stacked-omni',
593
+ 'gs1databar-limited', 'gs1-databar-limited', 'databar-limited',
594
+ 'gs1databar-expanded', 'gs1-databar-expanded', 'databar-expanded',
595
+ 'telepen-alpha', 'telepennumeric', 'telepen-numeric',
596
+ 'code32', 'italian-pharmacode', 'pzn7', 'pzn8',
597
+ 'code2of5', 'standard2of5', 'standard-2-of-5',
598
+ 'industrial-2-of-5', 'iata-2-of-5',
599
+ 'usps-postnet', 'usps-planet', 'royalmail', 'royal-mail',
600
+ 'australia-post', 'australiapost', 'japan-post', 'onecode', 'usps-onecode',
601
+ ]);
373
602
  const wantOneD = !want || [...want].some((f) => f in ONED_FORMATS || oneDAliases.has(f));
374
603
  const wantTwoD = wantQR || wantDataMatrix || wantAztec || wantAztecRune || wantPDF417
375
- || wantCompactPDF417 || wantMicroPDF417 || wantMicroQR || wantRMQR || wantFrameQR;
604
+ || wantCompactPDF417 || wantMicroPDF417 || wantMicroQR || wantRMQR || wantFrameQR || wantMaxiCode
605
+ || wantCodablockF || wantCode16K || wantDotCode || wantHanXin || wantGS1Composite
606
+ || wantDataBarStacked || wantDataBarStackedOmni || wantDataBarLimited || wantDataBarExpanded;
376
607
  const source = LuminanceSource.fromImageData(image);
377
608
  const results = [];
378
609
  // Light-on-dark symbols are common on screens and packaging, so a second
@@ -521,6 +752,120 @@ export function decode(image, options = {}) {
521
752
  /* no Sythos Canvas QR profile in this pass */
522
753
  }
523
754
  }
755
+ if (wantMaxiCode && maxicodeCanDecode) {
756
+ try {
757
+ const found = maxicode.detectAndDecodeMaxiCode(candidateBits);
758
+ if (found)
759
+ add(found, 'maxicode');
760
+ }
761
+ catch {
762
+ /* no MaxiCode in this pass */
763
+ }
764
+ }
765
+ if (wantCodablockF && codablockfCanDecode) {
766
+ const codablockBits = binarizer === 'auto'
767
+ ? [candidateBits, binarize(candidateSource, 'global')]
768
+ : [candidateBits];
769
+ for (const thresholdBits of codablockBits) {
770
+ try {
771
+ const found = codablockf.detectAndDecodeCodablockF(thresholdBits);
772
+ if (found) {
773
+ add(found, 'codablockf');
774
+ break;
775
+ }
776
+ }
777
+ catch {
778
+ /* no Codablock-F in this pass */
779
+ }
780
+ }
781
+ }
782
+ if (wantCode16K && code16kCanDecode) {
783
+ const code16KBits = binarizer === 'auto'
784
+ ? [candidateBits, binarize(candidateSource, 'global')]
785
+ : [candidateBits];
786
+ for (const thresholdBits of code16KBits) {
787
+ try {
788
+ const found = code16k.detectAndDecodeCode16K(thresholdBits);
789
+ if (found) {
790
+ add(found, 'code16k');
791
+ break;
792
+ }
793
+ }
794
+ catch {
795
+ /* no Code 16K in this pass */
796
+ }
797
+ }
798
+ }
799
+ if (wantDotCode && dotCodeCanDecode) {
800
+ try {
801
+ const found = dotcode.detectAndDecodeDotCode(candidateBits);
802
+ for (const result of found)
803
+ add(result, 'dotcode');
804
+ }
805
+ catch {
806
+ /* no DotCode in this pass */
807
+ }
808
+ }
809
+ if (wantHanXin && hanXinCanDecode) {
810
+ try {
811
+ const found = hanxin.detectAndDecodeHanXin(candidateBits);
812
+ if (found)
813
+ add(found, 'hanxin');
814
+ }
815
+ catch {
816
+ /* no Han Xin code in this pass */
817
+ }
818
+ }
819
+ if (wantGS1Composite && gs1CompositeCanDecode) {
820
+ try {
821
+ const found = composite.detectAndDecodeGS1Composite(candidateBits);
822
+ if (found)
823
+ add(found, 'gs1composite');
824
+ }
825
+ catch {
826
+ /* no bounded GS1 Composite symbol in this pass */
827
+ }
828
+ }
829
+ if (wantDataBarStacked && dataBarStackedCanDecode) {
830
+ try {
831
+ const found = databar.detectAndDecodeDataBar14Stacked(candidateBits);
832
+ if (found)
833
+ add(found, 'gs1databar-stacked');
834
+ }
835
+ catch {
836
+ /* no GS1 DataBar Stacked in this pass */
837
+ }
838
+ }
839
+ if (wantDataBarStackedOmni && dataBarStackedOmniCanDecode) {
840
+ try {
841
+ const found = databar.detectAndDecodeDataBarStackedOmnidirectional(candidateBits);
842
+ if (found)
843
+ add(found, 'gs1databar-stacked-omnidirectional');
844
+ }
845
+ catch {
846
+ /* no GS1 DataBar Stacked Omnidirectional in this pass */
847
+ }
848
+ }
849
+ if (wantDataBarLimited && dataBarLimitedCanDecode) {
850
+ try {
851
+ const found = databar.detectAndDecodeDataBarLimited(candidateBits);
852
+ if (found)
853
+ add(found, 'gs1databar-limited');
854
+ }
855
+ catch {
856
+ /* no GS1 DataBar Limited in this pass */
857
+ }
858
+ }
859
+ if (wantDataBarExpanded && dataBarExpandedCanDecode) {
860
+ try {
861
+ const found = databar.detectAndDecodeDataBarExpanded(candidateBits);
862
+ if (found)
863
+ add(found, 'gs1databar-expanded');
864
+ }
865
+ catch {
866
+ /* no GS1 DataBar Expanded in this pass */
867
+ }
868
+ }
524
869
  return results.length > before;
525
870
  };
526
871
  const twoDFound = readTwoD(bits);
@@ -610,17 +955,21 @@ export function decode(image, options = {}) {
610
955
  return true;
611
956
  });
612
957
  // On large clean rasters, hybrid thresholding can erase otherwise uniform
613
- // QR/PDF417 modules. Keep auto/hybrid as the primary strategy, then make one
614
- // focused global retry only when the complete primary pass found nothing.
958
+ // QR, PDF417 and MaxiCode modules. Keep auto/hybrid as the primary strategy,
959
+ // then make one focused global retry only when the complete primary pass
960
+ // found nothing.
615
961
  // This deliberately leaves an explicit global request single-pass.
616
962
  const retryFormats = formats
617
963
  ? formats.filter((format) => {
618
964
  const id = String(format).toLowerCase();
619
965
  return id === 'qr' || id === 'qrcode'
620
966
  || id === 'pdf417' || id === 'pdf-417'
621
- || id === 'compactpdf417' || id === 'compact-pdf417' || id === 'compact-pdf-417';
967
+ || id === 'compactpdf417' || id === 'compact-pdf417' || id === 'compact-pdf-417'
968
+ || id === 'maxicode' || id === 'maxi-code'
969
+ || id === 'hanxin' || id === 'han-xin'
970
+ || id === 'gs1composite' || id === 'gs1-composite' || id === 'composite';
622
971
  })
623
- : ['qr', 'pdf417', 'compactpdf417'];
972
+ : ['qr', 'pdf417', 'compactpdf417', 'maxicode', 'hanxin', 'gs1composite'];
624
973
  const shouldRetryGlobal = unique.length === 0
625
974
  && (binarizer === 'auto' || binarizer === 'hybrid')
626
975
  && retryFormats.length > 0;
@@ -779,4 +1128,4 @@ export function decodeStrict(image, options) {
779
1128
  return results[0];
780
1129
  }
781
1130
  /** Library version, matching package.json. */
782
- export const VERSION = '1.5.13';
1131
+ export const VERSION = '1.5.15';