@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/ts/index.d.ts CHANGED
@@ -45,6 +45,7 @@
45
45
  * @module @sythos/js_barcode_universal
46
46
  */
47
47
  import { BitMatrix } from './core/bit-matrix.js';
48
+ import type { GS1CompositeComponent, GS1CompositeInput } from './composite/index.js';
48
49
  export { BitMatrix };
49
50
  export { BarcodeError, EncodeError, NotFoundError, FormatError, ChecksumError, } from './core/errors.js';
50
51
  export { LuminanceSource } from './image/luminance.js';
@@ -66,6 +67,22 @@ export { encodeMicroPDF417, decodeMicroPDF417, detectMicroPDF417, detectAndDecod
66
67
  export { encodeMicroQR, decodeMicroQR, detectMicroQR, detectAndDecodeMicroQR } from './microqr/index.js';
67
68
  export { encodeRMQR, decodeRMQR, detectRMQR, detectAndDecodeRMQR } from './rmqr/index.js';
68
69
  export { encodeFrameQR, decodeFrameQR, detectFrameQR, detectAndDecodeFrameQR, } from './frameqr/index.js';
70
+ export {
71
+ GS1_COMPOSITE_PROFILE,
72
+ GS1_COMPOSITE_HOSTS,
73
+ encodeGS1Composite,
74
+ decodeGS1Composite,
75
+ detectGS1Composite,
76
+ detectAndDecodeGS1Composite,
77
+ } from './composite/index.js';
78
+ export type {
79
+ GS1CompositeHostFormat,
80
+ GS1CompositeComponent,
81
+ GS1Element,
82
+ GS1CompositeInput,
83
+ GS1CompositeOptions,
84
+ GS1CompositeResult,
85
+ } from './composite/index.js';
69
86
  export type FormatInfo = {
70
87
  id: string;
71
88
  label: string;
@@ -99,6 +116,9 @@ export declare function listFormats(): FormatInfo[];
99
116
  * @param {'L'|'M'|'Q'|'H'} [options.ecc] QR error-correction level.
100
117
  * @param {number} [options.version] QR version, 1-40. Auto if omitted.
101
118
  * @param {boolean} [options.checkDigit] Append a check digit, where optional.
119
+ * @param {boolean} [options.pzn8] Select the eight-digit PZN profile.
120
+ * @param {'pzn7'|'pzn8'|'standard'|'industrial'|'iata'} [options.variant] PZN or Code 25 variant.
121
+ * @param {number} [options.wideRatio] Wide-bar ratio for Code 25 variants.
102
122
  * @param {boolean} [options.fullAscii] Code 39 extended encoding.
103
123
  * @param {boolean} [options.gs1] Emit a leading FNC1.
104
124
  * @param {number} [options.layers] Aztec layer count; automatic if omitted.
@@ -121,11 +141,16 @@ export declare function listFormats(): FormatInfo[];
121
141
  * @param {0|90|180|270} [options.canvas.angle] Canvas quarter-turn.
122
142
  * @returns {BitMatrix}
123
143
  */
124
- export declare function encode(text: string | number, options?: {
144
+ export declare function encode(text: string | number | GS1CompositeInput, options?: {
125
145
  format?: string;
126
146
  ecc?: 'L' | 'M' | 'Q' | 'H';
127
147
  version?: number;
128
148
  checkDigit?: boolean;
149
+ pzn8?: boolean;
150
+ variant?: 'pzn7' | 'pzn8' | 'standard' | 'industrial' | 'iata';
151
+ wideRatio?: number;
152
+ telepenMode?: 'ascii' | 'numeric';
153
+ numeric?: boolean;
129
154
  fullAscii?: boolean;
130
155
  gs1?: boolean;
131
156
  layers?: number;
@@ -147,6 +172,9 @@ export declare function encode(text: string | number, options?: {
147
172
  centerY?: number;
148
173
  angle?: 0 | 90 | 180 | 270;
149
174
  };
175
+ component?: GS1CompositeComponent;
176
+ separatorGap?: 1 | 2 | 3;
177
+ moduleScale?: number;
150
178
  }): BitMatrix;
151
179
  export type DecodeResult = {
152
180
  text: string;
@@ -286,6 +314,20 @@ export type DecodeResult = {
286
314
  * GS1 DataBar linkage flag.
287
315
  */
288
316
  linkage?: boolean;
317
+ /** Whether an optional numeric check digit was validated. */
318
+ checkDigit?: boolean;
319
+ /** PZN variant identified by the decoder. */
320
+ pznVariant?: 'pzn7' | 'pzn8';
321
+ /** Whether the composite component is CC-A or CC-B. */
322
+ component?: 'cc-a' | 'cc-b';
323
+ /** Selected MicroPDF417-derived composite component variant. */
324
+ componentVariant?: number;
325
+ componentRows?: number;
326
+ componentColumns?: number;
327
+ componentRowHeight?: number;
328
+ separatorGap?: number;
329
+ linearFormat?: string;
330
+ linear?: Record<string, unknown>;
289
331
  };
290
332
  /**
291
333
  * @typedef {object} DecodeResult
@@ -318,6 +360,8 @@ export type DecodeResult = {
318
360
  * @property {string} [gs1ParseError] Semantic GS1 parsing error after a valid physical read.
319
361
  * @property {string} [gtin] GS1 DataBar GTIN-14 payload.
320
362
  * @property {boolean} [linkage] GS1 DataBar linkage flag.
363
+ * @property {boolean} [checkDigit] Whether an optional numeric check digit was validated.
364
+ * @property {'pzn7'|'pzn8'} [pznVariant] PZN variant identified by the decoder.
321
365
  */
322
366
  /**
323
367
  * Find and decode every barcode in an image.
@@ -360,4 +404,4 @@ export declare function decodeStrict(image: {
360
404
  height: number;
361
405
  }, options?: object): DecodeResult;
362
406
  /** Library version, matching package.json. */
363
- export declare const VERSION = "1.5.13";
407
+ export declare const VERSION = "1.5.15";
package/src/ts/index.ts CHANGED
@@ -50,8 +50,23 @@ import { BitMatrix } from './core/bit-matrix.js';
50
50
  import { EncodeError, NotFoundError } from './core/errors.js';
51
51
  import { LuminanceSource } from './image/luminance.js';
52
52
  import { binarize } from './image/binarizer.js';
53
- import { ONED_FORMATS } from './oned/index.js';
53
+ import {
54
+ ONED_FORMATS,
55
+ encodeCode32,
56
+ encodePZN,
57
+ encodeStandard2of5,
58
+ encodeIndustrial2of5,
59
+ encodeIATA2of5,
60
+ encodePostnet,
61
+ encodePlanet,
62
+ encodeRM4SCC,
63
+ encodeKIX,
64
+ encodeAustraliaPost,
65
+ encodeJapanPost,
66
+ encodeIMB,
67
+ } from './oned/index.js';
54
68
  import { decodeOneD } from './oned/reader.js';
69
+ import { encodeTelepen, encodeTelepenNumeric } from './oned/telepen.js';
55
70
  import * as datamatrix from './datamatrix/index.js';
56
71
  import * as qr from './qr/index.js';
57
72
  import * as aztec from './aztec/index.js';
@@ -63,6 +78,12 @@ import * as frameqr from './frameqr/index.js';
63
78
  import * as aztecRune from './aztecrune/index.js';
64
79
  import * as compactPdf417 from './compactpdf417/index.js';
65
80
  import * as databar from './databar/index.js';
81
+ import * as maxicode from './maxicode/index.js';
82
+ import * as codablockf from './codablockf/index.js';
83
+ import * as code16k from './code16k/index.js';
84
+ import * as dotcode from './dotcode/index.js';
85
+ import * as hanxin from './hanxin/index.js';
86
+ import * as composite from './composite/index.js';
66
87
 
67
88
  export { BitMatrix };
68
89
  export {
@@ -84,9 +105,31 @@ export { encodeAztec, decodeAztec, detectAztec, detectAndDecodeAztec } from './a
84
105
  export * from './aztecrune/index.js';
85
106
  export { encodePDF417, decodePDF417, detectPDF417, detectAndDecodePDF417 } from './pdf417/index.js';
86
107
  export * from './compactpdf417/index.js';
87
- // DataBar exports include both the verified GTIN/data layer and the
88
- // Omnidirectional/Truncated physical image path.
108
+ // DataBar exports include the verified GTIN/data layer and the supported
109
+ // Omnidirectional/Truncated, Limited, Stacked and Stacked Omnidirectional paths.
89
110
  export * from './databar/index.js';
111
+ export {
112
+ encodeMaxiCode,
113
+ decodeMaxiCode,
114
+ detectMaxiCode,
115
+ detectAndDecodeMaxiCode,
116
+ } from './maxicode/index.js';
117
+ export {
118
+ encodeCodablockF, decodeCodablockF, detectCodablockF, detectAndDecodeCodablockF,
119
+ } from './codablockf/index.js';
120
+ export {
121
+ encodeCode16K, decodeCode16K, detectCode16K, detectAndDecodeCode16K,
122
+ } from './code16k/index.js';
123
+ export * from './dotcode/index.js';
124
+ export * from './hanxin/index.js';
125
+ export {
126
+ GS1_COMPOSITE_PROFILE,
127
+ GS1_COMPOSITE_HOSTS,
128
+ encodeGS1Composite,
129
+ decodeGS1Composite,
130
+ detectGS1Composite,
131
+ detectAndDecodeGS1Composite,
132
+ } from './composite/index.js';
90
133
  export {
91
134
  encodeMicroPDF417, decodeMicroPDF417, detectMicroPDF417, detectAndDecodeMicroPDF417,
92
135
  } from './micropdf417/index.js';
@@ -143,6 +186,26 @@ const compactPdf417CanEncode = typeof compactPdf417.encodeCompactPDF417 === 'fun
143
186
  const compactPdf417CanDecode = typeof compactPdf417.detectAndDecodeCompactPDF417 === 'function';
144
187
  const dataBarCanEncode = typeof databar.encodeDataBar14 === 'function';
145
188
  const dataBarCanDecode = typeof databar.decodeDataBar14Scanline === 'function';
189
+ const dataBarStackedCanEncode = typeof databar.encodeDataBar14Stacked === 'function';
190
+ const dataBarStackedCanDecode = typeof databar.detectAndDecodeDataBar14Stacked === 'function';
191
+ const dataBarStackedOmniCanEncode = typeof databar.encodeDataBarStackedOmnidirectional === 'function';
192
+ const dataBarStackedOmniCanDecode = typeof databar.detectAndDecodeDataBarStackedOmnidirectional === 'function';
193
+ const dataBarLimitedCanEncode = typeof databar.encodeDataBarLimited === 'function';
194
+ const dataBarLimitedCanDecode = typeof databar.detectAndDecodeDataBarLimited === 'function';
195
+ const dataBarExpandedCanEncode = typeof databar.encodeDataBarExpanded === 'function';
196
+ const dataBarExpandedCanDecode = typeof databar.detectAndDecodeDataBarExpanded === 'function';
197
+ const maxicodeCanEncode = typeof maxicode.encodeMaxiCode === 'function';
198
+ const maxicodeCanDecode = typeof maxicode.detectAndDecodeMaxiCode === 'function';
199
+ const codablockfCanEncode = typeof codablockf.encodeCodablockF === 'function';
200
+ const codablockfCanDecode = typeof codablockf.detectAndDecodeCodablockF === 'function';
201
+ const code16kCanEncode = typeof code16k.encodeCode16K === 'function';
202
+ const code16kCanDecode = typeof code16k.detectAndDecodeCode16K === 'function';
203
+ const dotCodeCanEncode = typeof dotcode.encodeDotCode === 'function';
204
+ const dotCodeCanDecode = typeof dotcode.detectAndDecodeDotCode === 'function';
205
+ const hanXinCanEncode = typeof hanxin.encodeHanXin === 'function';
206
+ const hanXinCanDecode = typeof hanxin.detectAndDecodeHanXin === 'function';
207
+ const gs1CompositeCanEncode = typeof composite.encodeGS1Composite === 'function';
208
+ const gs1CompositeCanDecode = typeof composite.detectAndDecodeGS1Composite === 'function';
146
209
 
147
210
  /**
148
211
  * Every format this build supports.
@@ -241,6 +304,76 @@ export function listFormats() {
241
304
  canRead: dataBarCanDecode,
242
305
  kind: /** @type {'1D'} */ ('1D'),
243
306
  });
307
+ formats.push({
308
+ id: 'gs1databar-stacked',
309
+ label: 'GS1 DataBar Stacked',
310
+ canWrite: dataBarStackedCanEncode,
311
+ canRead: dataBarStackedCanDecode,
312
+ kind: /** @type {'1D'} */ ('1D'),
313
+ });
314
+ formats.push({
315
+ id: 'gs1databar-stacked-omnidirectional',
316
+ label: 'GS1 DataBar Stacked Omnidirectional',
317
+ canWrite: dataBarStackedOmniCanEncode,
318
+ canRead: dataBarStackedOmniCanDecode,
319
+ kind: /** @type {'1D'} */ ('1D'),
320
+ });
321
+ formats.push({
322
+ id: 'gs1databar-limited',
323
+ label: 'GS1 DataBar Limited',
324
+ canWrite: dataBarLimitedCanEncode,
325
+ canRead: dataBarLimitedCanDecode,
326
+ kind: /** @type {'1D'} */ ('1D'),
327
+ });
328
+ formats.push({
329
+ id: 'gs1databar-expanded',
330
+ label: 'GS1 DataBar Expanded',
331
+ canWrite: dataBarExpandedCanEncode,
332
+ canRead: dataBarExpandedCanDecode,
333
+ kind: /** @type {'1D'} */ ('1D'),
334
+ });
335
+ formats.push({
336
+ id: 'maxicode',
337
+ label: 'MaxiCode',
338
+ canWrite: maxicodeCanEncode,
339
+ canRead: maxicodeCanDecode,
340
+ kind: /** @type {'2D'} */ ('2D'),
341
+ });
342
+ formats.push({
343
+ id: 'codablockf',
344
+ label: 'Codablock-F',
345
+ canWrite: codablockfCanEncode,
346
+ canRead: codablockfCanDecode,
347
+ kind: /** @type {'2D'} */ ('2D'),
348
+ });
349
+ formats.push({
350
+ id: 'code16k',
351
+ label: 'Code 16K',
352
+ canWrite: code16kCanEncode,
353
+ canRead: code16kCanDecode,
354
+ kind: /** @type {'2D'} */ ('2D'),
355
+ });
356
+ formats.push({
357
+ id: 'dotcode',
358
+ label: 'DotCode',
359
+ canWrite: dotCodeCanEncode,
360
+ canRead: dotCodeCanDecode,
361
+ kind: /** @type {'2D'} */ ('2D'),
362
+ });
363
+ formats.push({
364
+ id: 'hanxin',
365
+ label: 'Han Xin Code',
366
+ canWrite: hanXinCanEncode,
367
+ canRead: hanXinCanDecode,
368
+ kind: /** @type {'2D'} */ ('2D'),
369
+ });
370
+ formats.push({
371
+ id: 'gs1composite',
372
+ label: 'GS1 DataBar Composite (bounded profile)',
373
+ canWrite: gs1CompositeCanEncode,
374
+ canRead: gs1CompositeCanDecode,
375
+ kind: /** @type {'2D'} */ ('2D'),
376
+ });
244
377
 
245
378
  return formats;
246
379
  }
@@ -256,9 +389,11 @@ export function listFormats() {
256
389
  * @param {string | number} text
257
390
  * @param {object} [options]
258
391
  * @param {string} [options.format] Format id. Default 'qr'.
259
- * @param {'L'|'M'|'Q'|'H'} [options.ecc] QR error-correction level.
260
- * @param {number} [options.version] QR version, 1-40. Auto if omitted.
392
+ * @param {'L'|'M'|'Q'|'H'|'L1'|'L2'|'L3'|'L4'|1|2|3|4} [options.ecc] QR or Han Xin error-correction level.
393
+ * @param {number} [options.version] QR version 1-40 or Han Xin version 1-3. Auto if omitted.
261
394
  * @param {boolean} [options.checkDigit] Append a check digit, where optional.
395
+ * @param {'ascii'|'numeric'} [options.telepenMode] Telepen encoding mode.
396
+ * @param {boolean} [options.numeric] Alias for Telepen Numeric mode.
262
397
  * @param {boolean} [options.fullAscii] Code 39 extended encoding.
263
398
  * @param {boolean} [options.gs1] Emit a leading FNC1.
264
399
  * @param {number} [options.layers] Aztec layer count; automatic if omitted.
@@ -271,6 +406,16 @@ export function listFormats() {
271
406
  * @param {'auto'|'text'|'byte'|'numeric'} [options.compaction] PDF417 compaction mode.
272
407
  * @param {number} [options.eci] MicroPDF417 byte-compaction ECI assignment (3 or 26).
273
408
  * @param {number} [options.aspectRatio] Preferred MicroPDF417 symbol aspect ratio.
409
+ * @param {0|1|2|3} [options.mask] Han Xin data mask.
410
+ * @param {boolean} [options.pzn8] Select the eight-digit PZN profile.
411
+ * @param {'pzn7'|'pzn8'|'standard'|'industrial'|'iata'} [options.variant] PZN or Code 25 variant.
412
+ * @param {number} [options.wideRatio] Wide-bar ratio for Code 25 variants.
413
+ * @param {2|3|4|5|'auto'|'numeric'|'text'|'byte'} [options.mode] MaxiCode mode or Han Xin payload mode.
414
+ * @param {{postalCode:string,countryCode:number,serviceClass:number}} [options.primary] MaxiCode structured primary data for modes 2 and 3.
415
+ * @param {'latin1'} [options.charset] MaxiCode character set declaration.
416
+ * @param {boolean} [options.linkage] GS1 DataBar composite linkage flag.
417
+ * @param {number} [options.moduleScale] Integer module scale for GS1 DataBar physical variants.
418
+ * @param {number} [options.height] Output height for a GS1 DataBar physical variant.
274
419
  * @param {object} [options.canvas] Sythos Canvas QR artwork reservation.
275
420
  * @param {'square'|'circle'|'diamond'} [options.canvas.shape] Canvas shape.
276
421
  * @param {number} [options.canvas.size] Odd canvas size in QR modules.
@@ -318,10 +463,94 @@ export function encode(text, options = {}) {
318
463
  if (format === 'gs1databar14' || format === 'gs1-databar14' || format === 'databar') {
319
464
  return databar.encodeDataBar14(value, options);
320
465
  }
466
+ if (format === 'gs1databar-stacked' || format === 'gs1-databar-stacked' || format === 'databar-stacked') {
467
+ return databar.encodeDataBar14Stacked(value, options);
468
+ }
469
+ if (format === 'gs1databar-stacked-omnidirectional'
470
+ || format === 'gs1-databar-stacked-omnidirectional'
471
+ || format === 'databar-stacked-omni') {
472
+ return databar.encodeDataBarStackedOmnidirectional(value, options);
473
+ }
474
+ if (format === 'gs1databar-limited' || format === 'gs1-databar-limited' || format === 'databar-limited') {
475
+ return databar.encodeDataBarLimited(value, options);
476
+ }
477
+ if (format === 'gs1databar-expanded' || format === 'gs1-databar-expanded' || format === 'databar-expanded') {
478
+ return databar.encodeDataBarExpanded(value, options);
479
+ }
480
+ if (format === 'maxicode' || format === 'maxi-code') {
481
+ return maxicode.encodeMaxiCode(value, options);
482
+ }
483
+ if (format === 'codablockf' || format === 'codablock-f' || format === 'codablock') {
484
+ return codablockf.encodeCodablockF(value, options);
485
+ }
486
+ if (format === 'code16k' || format === 'code-16k') {
487
+ return code16k.encodeCode16K(value, options);
488
+ }
489
+ if (format === 'dotcode' || format === 'dot-code') {
490
+ return dotcode.encodeDotCode(value, options);
491
+ }
492
+ if (format === 'hanxin' || format === 'han-xin') {
493
+ return hanxin.encodeHanXin(value, options);
494
+ }
495
+ if (format === 'gs1composite' || format === 'gs1-composite' || format === 'composite') {
496
+ return composite.encodeGS1Composite(value, options);
497
+ }
498
+ if (format === 'telepennumeric' || format === 'telepen-numeric') {
499
+ return encodeTelepenNumeric(value);
500
+ }
501
+ if (format === 'telepen' || format === 'telepen-alpha') {
502
+ return encodeTelepen(value, options);
503
+ }
504
+
505
+ if (format === 'code32' || format === 'italian-pharmacode') {
506
+ return encodeCode32(value);
507
+ }
508
+ if (format === 'pzn' || format === 'pzn7' || format === 'pzn8') {
509
+ return encodePZN(value, {
510
+ ...options,
511
+ pzn8: format === 'pzn8' || options.pzn8 === true || options.variant === 'pzn8',
512
+ });
513
+ }
514
+ if (format === 'code2of5' || format === 'standard2of5' || format === 'standard-2-of-5') {
515
+ return encodeStandard2of5(value, options);
516
+ }
517
+ if (format === 'industrial2of5' || format === 'industrial-2-of-5') {
518
+ return encodeIndustrial2of5(value, options);
519
+ }
520
+ if (format === 'iata2of5' || format === 'iata-2-of-5') {
521
+ return encodeIATA2of5(value, options);
522
+ }
523
+ if (format === 'postnet' || format === 'usps-postnet') {
524
+ return encodePostnet(value, options);
525
+ }
526
+ if (format === 'planet' || format === 'usps-planet') {
527
+ return encodePlanet(value, options);
528
+ }
529
+ if (format === 'rm4scc' || format === 'royalmail' || format === 'royal-mail') {
530
+ return encodeRM4SCC(value, options);
531
+ }
532
+ if (format === 'kix') {
533
+ return encodeKIX(value);
534
+ }
535
+ if (format === 'auspost' || format === 'australia-post' || format === 'australiapost') {
536
+ return encodeAustraliaPost(value, options);
537
+ }
538
+ if (format === 'japanpost' || format === 'japan-post') {
539
+ return encodeJapanPost(value);
540
+ }
541
+ if (format === 'imb' || format === 'onecode' || format === 'usps-onecode') {
542
+ return encodeIMB(value);
543
+ }
321
544
 
322
545
  const entry = ONED_FORMATS[format];
323
546
  if (!entry) {
324
- const known = [...Object.keys(ONED_FORMATS), 'qr', 'datamatrix', 'aztec', 'aztecrune', 'pdf417', 'compactpdf417', 'micropdf417', 'microqr', 'rmqr', 'frameqr', 'gs1databar14'].join(', ');
547
+ const known = [...Object.keys(ONED_FORMATS), 'telepennumeric', 'telepen-numeric',
548
+ 'code32', 'italian-pharmacode', 'pzn', 'pzn7', 'pzn8',
549
+ 'code2of5', 'standard2of5', 'standard-2-of-5', 'industrial-2-of-5', 'iata-2-of-5',
550
+ 'postnet', 'usps-postnet', 'planet', 'usps-planet', 'rm4scc', 'royalmail', 'royal-mail',
551
+ 'kix', 'auspost', 'australia-post', 'australiapost', 'japanpost', 'japan-post',
552
+ 'imb', 'onecode', 'usps-onecode',
553
+ '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(', ');
325
554
  throw new EncodeError(`Unknown format "${format}". Known formats: ${known}`);
326
555
  }
327
556
  return entry.encode(value, options);
@@ -342,6 +571,8 @@ export function encode(text, options = {}) {
342
571
  * @property {number} [columns] PDF417 column count.
343
572
  * @property {number} [eccLevel] PDF417 error-correction level.
344
573
  * @property {number} [rowHeight] PDF417 row height in modules.
574
+ * @property {number} [moduleSize] Detected module scale for stacked formats.
575
+ * @property {boolean} [checksum] Whether the stacked format checks passed.
345
576
  * @property {number} [variant] MicroPDF417 predefined variant number.
346
577
  * @property {number} [eccCodewords] MicroPDF417 fixed error-correction codewords.
347
578
  * @property {string} [profile] Sythos Canvas QR profile identifier.
@@ -358,6 +589,10 @@ export function encode(text, options = {}) {
358
589
  * @property {string} [gs1ParseError] Semantic GS1 parsing error after a valid physical read.
359
590
  * @property {string} [gtin] GS1 DataBar GTIN-14 payload.
360
591
  * @property {boolean} [linkage] GS1 DataBar linkage flag.
592
+ * @property {boolean} [checkDigit] Whether an optional numeric check digit was validated.
593
+ * @property {'pzn7'|'pzn8'} [pznVariant] PZN variant identified by the decoder.
594
+ * @property {0|1|2|3} [mask] Han Xin data mask.
595
+ * @property {boolean} [inverted] Han Xin module polarity.
361
596
  */
362
597
 
363
598
  /**
@@ -390,10 +625,37 @@ export function decode(image, options = {}) {
390
625
  const wantMicroQR = !want || want.has('microqr') || want.has('micro-qr');
391
626
  const wantRMQR = !want || want.has('rmqr') || want.has('r-mqr') || want.has('rectangular-micro-qr');
392
627
  const wantFrameQR = !want || want.has('frameqr') || want.has('frame-qr') || want.has('canvas-qr');
393
- const oneDAliases = new Set(['gs1databar14', 'databar', 'gs1-databar14']);
628
+ const wantMaxiCode = !want || want.has('maxicode') || want.has('maxi-code');
629
+ const wantCodablockF = !want || want.has('codablockf') || want.has('codablock-f') || want.has('codablock');
630
+ const wantCode16K = !want || want.has('code16k') || want.has('code-16k');
631
+ const wantDotCode = !want || want.has('dotcode') || want.has('dot-code');
632
+ const wantHanXin = !want || want.has('hanxin') || want.has('han-xin');
633
+ const wantGS1Composite = !want || want.has('gs1composite') || want.has('gs1-composite') || want.has('composite');
634
+ const wantDataBarStacked = !want || want.has('gs1databar-stacked') || want.has('gs1-databar-stacked') || want.has('databar-stacked');
635
+ const wantDataBarStackedOmni = !want || want.has('gs1databar-stacked-omnidirectional')
636
+ || want.has('gs1-databar-stacked-omnidirectional') || want.has('databar-stacked-omni');
637
+ const wantDataBarLimited = !want || want.has('gs1databar-limited')
638
+ || want.has('gs1-databar-limited') || want.has('databar-limited');
639
+ const wantDataBarExpanded = !want || want.has('gs1databar-expanded')
640
+ || want.has('gs1-databar-expanded') || want.has('databar-expanded');
641
+ const oneDAliases = new Set([
642
+ 'gs1databar14', 'databar', 'gs1-databar14',
643
+ 'gs1databar-stacked', 'gs1-databar-stacked', 'databar-stacked',
644
+ 'gs1databar-stacked-omnidirectional', 'gs1-databar-stacked-omnidirectional', 'databar-stacked-omni',
645
+ 'gs1databar-limited', 'gs1-databar-limited', 'databar-limited',
646
+ 'gs1databar-expanded', 'gs1-databar-expanded', 'databar-expanded',
647
+ 'telepen-alpha', 'telepennumeric', 'telepen-numeric',
648
+ 'code32', 'italian-pharmacode', 'pzn7', 'pzn8',
649
+ 'code2of5', 'standard2of5', 'standard-2-of-5',
650
+ 'industrial-2-of-5', 'iata-2-of-5',
651
+ 'usps-postnet', 'usps-planet', 'royalmail', 'royal-mail',
652
+ 'australia-post', 'australiapost', 'japan-post', 'onecode', 'usps-onecode',
653
+ ]);
394
654
  const wantOneD = !want || [...want].some((f) => f in ONED_FORMATS || oneDAliases.has(f));
395
655
  const wantTwoD = wantQR || wantDataMatrix || wantAztec || wantAztecRune || wantPDF417
396
- || wantCompactPDF417 || wantMicroPDF417 || wantMicroQR || wantRMQR || wantFrameQR;
656
+ || wantCompactPDF417 || wantMicroPDF417 || wantMicroQR || wantRMQR || wantFrameQR || wantMaxiCode
657
+ || wantCodablockF || wantCode16K || wantDotCode || wantHanXin || wantGS1Composite
658
+ || wantDataBarStacked || wantDataBarStackedOmni || wantDataBarLimited || wantDataBarExpanded;
397
659
 
398
660
  const source = LuminanceSource.fromImageData(image);
399
661
  const results = [];
@@ -529,6 +791,107 @@ export function decode(image, options = {}) {
529
791
  }
530
792
  }
531
793
 
794
+ if (wantMaxiCode && maxicodeCanDecode) {
795
+ try {
796
+ const found = maxicode.detectAndDecodeMaxiCode(candidateBits);
797
+ if (found) add(found, 'maxicode');
798
+ } catch {
799
+ /* no MaxiCode in this pass */
800
+ }
801
+ }
802
+
803
+ if (wantCodablockF && codablockfCanDecode) {
804
+ const codablockBits = binarizer === 'auto'
805
+ ? [candidateBits, binarize(candidateSource, 'global')]
806
+ : [candidateBits];
807
+ for (const thresholdBits of codablockBits) {
808
+ try {
809
+ const found = codablockf.detectAndDecodeCodablockF(thresholdBits);
810
+ if (found) { add(found, 'codablockf'); break; }
811
+ } catch {
812
+ /* no Codablock-F in this pass */
813
+ }
814
+ }
815
+ }
816
+
817
+ if (wantCode16K && code16kCanDecode) {
818
+ const code16KBits = binarizer === 'auto'
819
+ ? [candidateBits, binarize(candidateSource, 'global')]
820
+ : [candidateBits];
821
+ for (const thresholdBits of code16KBits) {
822
+ try {
823
+ const found = code16k.detectAndDecodeCode16K(thresholdBits);
824
+ if (found) { add(found, 'code16k'); break; }
825
+ } catch {
826
+ /* no Code 16K in this pass */
827
+ }
828
+ }
829
+ }
830
+
831
+ if (wantDotCode && dotCodeCanDecode) {
832
+ try {
833
+ const found = dotcode.detectAndDecodeDotCode(candidateBits);
834
+ for (const result of found) add(result, 'dotcode');
835
+ } catch {
836
+ /* no DotCode in this pass */
837
+ }
838
+ }
839
+
840
+ if (wantHanXin && hanXinCanDecode) {
841
+ try {
842
+ const found = hanxin.detectAndDecodeHanXin(candidateBits);
843
+ if (found) add(found, 'hanxin');
844
+ } catch {
845
+ /* no Han Xin code in this pass */
846
+ }
847
+ }
848
+
849
+ if (wantGS1Composite && gs1CompositeCanDecode) {
850
+ try {
851
+ const found = composite.detectAndDecodeGS1Composite(candidateBits);
852
+ if (found) add(found, 'gs1composite');
853
+ } catch {
854
+ /* no bounded GS1 Composite symbol in this pass */
855
+ }
856
+ }
857
+
858
+
859
+ if (wantDataBarStacked && dataBarStackedCanDecode) {
860
+ try {
861
+ const found = databar.detectAndDecodeDataBar14Stacked(candidateBits);
862
+ if (found) add(found, 'gs1databar-stacked');
863
+ } catch {
864
+ /* no GS1 DataBar Stacked in this pass */
865
+ }
866
+ }
867
+
868
+ if (wantDataBarStackedOmni && dataBarStackedOmniCanDecode) {
869
+ try {
870
+ const found = databar.detectAndDecodeDataBarStackedOmnidirectional(candidateBits);
871
+ if (found) add(found, 'gs1databar-stacked-omnidirectional');
872
+ } catch {
873
+ /* no GS1 DataBar Stacked Omnidirectional in this pass */
874
+ }
875
+ }
876
+
877
+ if (wantDataBarLimited && dataBarLimitedCanDecode) {
878
+ try {
879
+ const found = databar.detectAndDecodeDataBarLimited(candidateBits);
880
+ if (found) add(found, 'gs1databar-limited');
881
+ } catch {
882
+ /* no GS1 DataBar Limited in this pass */
883
+ }
884
+ }
885
+
886
+ if (wantDataBarExpanded && dataBarExpandedCanDecode) {
887
+ try {
888
+ const found = databar.detectAndDecodeDataBarExpanded(candidateBits);
889
+ if (found) add(found, 'gs1databar-expanded');
890
+ } catch {
891
+ /* no GS1 DataBar Expanded in this pass */
892
+ }
893
+ }
894
+
532
895
  return results.length > before;
533
896
  };
534
897
 
@@ -619,17 +982,21 @@ export function decode(image, options = {}) {
619
982
  });
620
983
 
621
984
  // On large clean rasters, hybrid thresholding can erase otherwise uniform
622
- // QR/PDF417 modules. Keep auto/hybrid as the primary strategy, then make one
623
- // focused global retry only when the complete primary pass found nothing.
985
+ // QR, PDF417 and MaxiCode modules. Keep auto/hybrid as the primary strategy,
986
+ // then make one focused global retry only when the complete primary pass
987
+ // found nothing.
624
988
  // This deliberately leaves an explicit global request single-pass.
625
989
  const retryFormats = formats
626
990
  ? formats.filter((format) => {
627
991
  const id = String(format).toLowerCase();
628
992
  return id === 'qr' || id === 'qrcode'
629
993
  || id === 'pdf417' || id === 'pdf-417'
630
- || id === 'compactpdf417' || id === 'compact-pdf417' || id === 'compact-pdf-417';
994
+ || id === 'compactpdf417' || id === 'compact-pdf417' || id === 'compact-pdf-417'
995
+ || id === 'maxicode' || id === 'maxi-code'
996
+ || id === 'hanxin' || id === 'han-xin'
997
+ || id === 'gs1composite' || id === 'gs1-composite' || id === 'composite';
631
998
  })
632
- : ['qr', 'pdf417', 'compactpdf417'];
999
+ : ['qr', 'pdf417', 'compactpdf417', 'maxicode', 'hanxin', 'gs1composite'];
633
1000
  const shouldRetryGlobal = unique.length === 0
634
1001
  && (binarizer === 'auto' || binarizer === 'hybrid')
635
1002
  && retryFormats.length > 0;
@@ -787,4 +1154,4 @@ export function decodeStrict(image, options) {
787
1154
  }
788
1155
 
789
1156
  /** Library version, matching package.json. */
790
- export const VERSION = '1.5.13';
1157
+ export const VERSION = '1.5.15';