@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.
- package/LICENSE +22 -4
- package/NOTICE.md +10 -1
- package/README.md +416 -22
- package/bundle/sythos-barcode.esm.js +22176 -11991
- package/bundle/sythos-barcode.js +22059 -11991
- package/licenses/README.md +12 -1
- package/licenses/codablockf.license +51 -0
- package/licenses/code16k.license +52 -0
- package/licenses/code25.license +58 -0
- package/licenses/code32.license +51 -0
- package/licenses/dotcode.license +66 -0
- package/licenses/gs1-composite.license +106 -0
- package/licenses/gs1-databar.license +21 -14
- package/licenses/hanxin.license +95 -0
- package/licenses/maxicode.license +62 -0
- package/licenses/postal.license +61 -0
- package/licenses/pzn.license +53 -0
- package/licenses/telepen.license +73 -0
- package/llms.txt +62 -6
- package/package.json +47 -3
- package/src/index.d.ts +111 -6
- package/src/index.js +362 -13
- package/src/js/codablockf/decoder.js +198 -0
- package/src/js/codablockf/encoder.js +97 -0
- package/src/js/codablockf/index.js +3 -0
- package/src/js/code16k/decoder.js +303 -0
- package/src/js/code16k/detector.js +187 -0
- package/src/js/code16k/encoder.js +153 -0
- package/src/js/code16k/index.js +14 -0
- package/src/js/code16k/tables.js +152 -0
- package/src/js/composite/index.js +570 -0
- package/src/js/core/detection-contract.js +185 -0
- package/src/js/core/symbol-layout.js +155 -0
- package/src/js/databar/expanded.js +968 -0
- package/src/js/databar/index.js +4 -0
- package/src/js/databar/layout.js +192 -0
- package/src/js/databar/limited.js +533 -0
- package/src/js/databar/stacked-omnidirectional.js +548 -0
- package/src/js/databar/stacked.js +528 -0
- package/src/js/dotcode/decoder.js +548 -0
- package/src/js/dotcode/detector.js +251 -0
- package/src/js/dotcode/encoder.js +453 -0
- package/src/js/dotcode/index.js +34 -0
- package/src/js/dotcode/tables.js +168 -0
- package/src/js/hanxin/decoder.js +299 -0
- package/src/js/hanxin/detector.js +122 -0
- package/src/js/hanxin/encoder.js +259 -0
- package/src/js/hanxin/index.js +16 -0
- package/src/js/hanxin/tables.js +316 -0
- package/src/js/image/height-coded.js +164 -0
- package/src/js/maxicode/decoder.js +275 -0
- package/src/js/maxicode/detector.js +118 -0
- package/src/js/maxicode/encoder.js +438 -0
- package/src/js/maxicode/index.js +34 -0
- package/src/js/maxicode/tables.js +132 -0
- package/src/js/oned/code25.js +148 -0
- package/src/js/oned/index.js +21 -3
- package/src/js/oned/postal.js +889 -0
- package/src/js/oned/reader.js +272 -7
- package/src/js/oned/telepen.js +361 -0
- package/src/js/oned/writers.js +186 -12
- package/src/js/stacked128/common.js +208 -0
- package/src/ts/codablockf/decoder.ts +212 -0
- package/src/ts/codablockf/encoder.ts +128 -0
- package/src/ts/codablockf/index.d.ts +31 -0
- package/src/ts/codablockf/index.ts +6 -0
- package/src/ts/code16k/decoder.d.ts +25 -0
- package/src/ts/code16k/decoder.ts +313 -0
- package/src/ts/code16k/detector.d.ts +21 -0
- package/src/ts/code16k/detector.ts +203 -0
- package/src/ts/code16k/encoder.d.ts +26 -0
- package/src/ts/code16k/encoder.ts +198 -0
- package/src/ts/code16k/index.d.ts +10 -0
- package/src/ts/code16k/index.ts +47 -0
- package/src/ts/code16k/tables.d.ts +54 -0
- package/src/ts/code16k/tables.ts +195 -0
- package/src/ts/composite/index.d.ts +74 -0
- package/src/ts/composite/index.ts +547 -0
- package/src/ts/core/detection-contract.d.ts +119 -0
- package/src/ts/core/detection-contract.ts +267 -0
- package/src/ts/core/symbol-layout.d.ts +108 -0
- package/src/ts/core/symbol-layout.ts +236 -0
- package/src/ts/databar/expanded.d.ts +40 -0
- package/src/ts/databar/expanded.ts +948 -0
- package/src/ts/databar/index.d.ts +48 -0
- package/src/ts/databar/index.ts +48 -0
- package/src/ts/databar/layout.d.ts +122 -0
- package/src/ts/databar/layout.ts +275 -0
- package/src/ts/databar/limited.d.ts +85 -0
- package/src/ts/databar/limited.ts +553 -0
- package/src/ts/databar/stacked-omnidirectional.d.ts +128 -0
- package/src/ts/databar/stacked-omnidirectional.ts +559 -0
- package/src/ts/databar/stacked.d.ts +96 -0
- package/src/ts/databar/stacked.ts +549 -0
- package/src/ts/dotcode/decoder.d.ts +58 -0
- package/src/ts/dotcode/decoder.ts +467 -0
- package/src/ts/dotcode/detector.d.ts +63 -0
- package/src/ts/dotcode/detector.ts +263 -0
- package/src/ts/dotcode/encoder.d.ts +69 -0
- package/src/ts/dotcode/encoder.ts +427 -0
- package/src/ts/dotcode/index.d.ts +37 -0
- package/src/ts/dotcode/index.ts +72 -0
- package/src/ts/dotcode/tables.d.ts +74 -0
- package/src/ts/dotcode/tables.ts +174 -0
- package/src/ts/hanxin/decoder.d.ts +48 -0
- package/src/ts/hanxin/decoder.ts +314 -0
- package/src/ts/hanxin/detector.d.ts +45 -0
- package/src/ts/hanxin/detector.ts +124 -0
- package/src/ts/hanxin/encoder.d.ts +41 -0
- package/src/ts/hanxin/encoder.ts +290 -0
- package/src/ts/hanxin/index.d.ts +16 -0
- package/src/ts/hanxin/index.ts +18 -0
- package/src/ts/hanxin/tables.d.ts +80 -0
- package/src/ts/hanxin/tables.ts +348 -0
- package/src/ts/image/height-coded.d.ts +101 -0
- package/src/ts/image/height-coded.ts +227 -0
- package/src/ts/index.d.ts +46 -2
- package/src/ts/index.ts +380 -13
- package/src/ts/maxicode/decoder.ts +265 -0
- package/src/ts/maxicode/detector.ts +109 -0
- package/src/ts/maxicode/encoder.ts +414 -0
- package/src/ts/maxicode/index.d.ts +96 -0
- package/src/ts/maxicode/index.ts +44 -0
- package/src/ts/maxicode/tables.ts +136 -0
- package/src/ts/oned/code25.d.ts +42 -0
- package/src/ts/oned/code25.ts +170 -0
- package/src/ts/oned/index.d.ts +7 -2
- package/src/ts/oned/index.ts +45 -3
- package/src/ts/oned/postal.d.ts +44 -0
- package/src/ts/oned/postal.ts +819 -0
- package/src/ts/oned/reader.d.ts +35 -0
- package/src/ts/oned/reader.ts +261 -7
- package/src/ts/oned/telepen.d.ts +65 -0
- package/src/ts/oned/telepen.ts +368 -0
- package/src/ts/oned/writers.d.ts +32 -0
- package/src/ts/oned/writers.ts +184 -13
- package/src/ts/stacked128/common.ts +225 -0
|
@@ -0,0 +1,553 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Sythos Barcode Suite
|
|
3
|
+
*
|
|
4
|
+
* MIT License
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) 2026 Sythos
|
|
7
|
+
*
|
|
8
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
10
|
+
* in the Software without restriction, including without limitation the rights
|
|
11
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
13
|
+
* furnished to do so, subject to the following conditions:
|
|
14
|
+
*
|
|
15
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
16
|
+
* copies or substantial portions of the Software.
|
|
17
|
+
*
|
|
18
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
+
* SOFTWARE.
|
|
25
|
+
*
|
|
26
|
+
* SPDX-License-Identifier: MIT
|
|
27
|
+
*
|
|
28
|
+
* Original work. No code from any other barcode implementation.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* GS1 DataBar Limited writer, clean-raster reader and detector.
|
|
33
|
+
*
|
|
34
|
+
* The implementation is deliberately limited to the standalone GTIN element
|
|
35
|
+
* string (01). Composite linkage is represented by the standard linkage flag,
|
|
36
|
+
* but the companion 2D component is outside this module.
|
|
37
|
+
*
|
|
38
|
+
* @module databar/limited
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
import { BitMatrix } from '../core/bit-matrix.js';
|
|
42
|
+
import { ChecksumError, EncodeError, FormatError } from '../core/errors.js';
|
|
43
|
+
import { createDetectionCandidate } from '../core/detection-contract.js';
|
|
44
|
+
import { decodeDataBarLimitedGTIN, encodeDataBarLimitedGTIN } from './codec.js';
|
|
45
|
+
import { dataBarWidths } from './patterns.js';
|
|
46
|
+
|
|
47
|
+
const SYMBOL_MODULES = 79;
|
|
48
|
+
const DATA_CHARACTER_MODULES = 26;
|
|
49
|
+
const CHECK_CHARACTER_MODULES = 18;
|
|
50
|
+
const DATA_CHARACTER_ELEMENTS = 7;
|
|
51
|
+
const CHECK_CHARACTER_ELEMENTS = 6;
|
|
52
|
+
const CHECK_CHARACTER_COMBINATIONS = 21;
|
|
53
|
+
const MIN_HEIGHT_MODULES = 10;
|
|
54
|
+
const MAX_DIMENSION = 32_768;
|
|
55
|
+
const MAX_MODULES = 16_777_216;
|
|
56
|
+
|
|
57
|
+
const GROUPS = Object.freeze([
|
|
58
|
+
Object.freeze({
|
|
59
|
+
first: 0, last: 183_063, gsum: 0,
|
|
60
|
+
oddModules: 17, evenModules: 9,
|
|
61
|
+
oddWidest: 6, evenWidest: 3,
|
|
62
|
+
oddTotal: 6_538, evenTotal: 28,
|
|
63
|
+
}),
|
|
64
|
+
Object.freeze({
|
|
65
|
+
first: 183_064, last: 820_063, gsum: 183_064,
|
|
66
|
+
oddModules: 13, evenModules: 13,
|
|
67
|
+
oddWidest: 5, evenWidest: 4,
|
|
68
|
+
oddTotal: 875, evenTotal: 728,
|
|
69
|
+
}),
|
|
70
|
+
Object.freeze({
|
|
71
|
+
first: 820_064, last: 1_000_775, gsum: 820_064,
|
|
72
|
+
oddModules: 9, evenModules: 17,
|
|
73
|
+
oddWidest: 3, evenWidest: 6,
|
|
74
|
+
oddTotal: 28, evenTotal: 6_454,
|
|
75
|
+
}),
|
|
76
|
+
Object.freeze({
|
|
77
|
+
first: 1_000_776, last: 1_491_020, gsum: 1_000_776,
|
|
78
|
+
oddModules: 15, evenModules: 11,
|
|
79
|
+
oddWidest: 5, evenWidest: 4,
|
|
80
|
+
oddTotal: 2_415, evenTotal: 203,
|
|
81
|
+
}),
|
|
82
|
+
Object.freeze({
|
|
83
|
+
first: 1_491_021, last: 1_979_844, gsum: 1_491_021,
|
|
84
|
+
oddModules: 11, evenModules: 15,
|
|
85
|
+
oddWidest: 4, evenWidest: 5,
|
|
86
|
+
oddTotal: 203, evenTotal: 2_408,
|
|
87
|
+
}),
|
|
88
|
+
Object.freeze({
|
|
89
|
+
first: 1_979_845, last: 1_996_938, gsum: 1_979_845,
|
|
90
|
+
oddModules: 19, evenModules: 7,
|
|
91
|
+
oddWidest: 8, evenWidest: 1,
|
|
92
|
+
oddTotal: 17_094, evenTotal: 1,
|
|
93
|
+
}),
|
|
94
|
+
Object.freeze({
|
|
95
|
+
first: 1_996_939, last: 2_013_570, gsum: 1_996_939,
|
|
96
|
+
oddModules: 7, evenModules: 19,
|
|
97
|
+
oddWidest: 1, evenWidest: 8,
|
|
98
|
+
oddTotal: 1, evenTotal: 16_632,
|
|
99
|
+
}),
|
|
100
|
+
]);
|
|
101
|
+
|
|
102
|
+
const CHECKSUM_WEIGHTS = Object.freeze([
|
|
103
|
+
1, 3, 9, 27, 81, 65, 17, 51, 64, 14, 42, 37, 22, 66,
|
|
104
|
+
20, 60, 2, 6, 18, 54, 73, 41, 34, 13, 39, 28, 84, 74,
|
|
105
|
+
]);
|
|
106
|
+
|
|
107
|
+
/* Annex C sequence values for check values 0 through 88. */
|
|
108
|
+
const CHECKSUM_SEQUENCES = Object.freeze([
|
|
109
|
+
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
|
|
110
|
+
10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
|
|
111
|
+
20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
|
|
112
|
+
30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
|
|
113
|
+
40, 41, 42, 43, 45, 52, 57, 63, 64, 65,
|
|
114
|
+
66, 73, 74, 75, 76, 77, 78, 79, 82, 126,
|
|
115
|
+
127, 128, 129, 130, 132, 141, 142, 143, 144, 145,
|
|
116
|
+
146, 210, 211, 212, 213, 214, 215, 216, 217, 220,
|
|
117
|
+
316, 317, 318, 319, 320, 322, 323, 326, 337,
|
|
118
|
+
]);
|
|
119
|
+
|
|
120
|
+
function isRecord(value) {
|
|
121
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function positiveInteger(value, label) {
|
|
125
|
+
if (!Number.isSafeInteger(value) || value < 1) {
|
|
126
|
+
throw new EncodeError(`GS1 DataBar Limited ${label} must be a positive integer`);
|
|
127
|
+
}
|
|
128
|
+
return value;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function checkedGeometry(options) {
|
|
132
|
+
if (options === undefined) options = {};
|
|
133
|
+
if (!isRecord(options)) throw new TypeError('GS1 DataBar Limited options must be an object');
|
|
134
|
+
if (options.linkage !== undefined && typeof options.linkage !== 'boolean') {
|
|
135
|
+
throw new TypeError('GS1 DataBar linkage must be a boolean');
|
|
136
|
+
}
|
|
137
|
+
if (options.moduleScale !== undefined && options.scale !== undefined
|
|
138
|
+
&& options.moduleScale !== options.scale) {
|
|
139
|
+
throw new EncodeError('GS1 DataBar Limited moduleScale and scale disagree');
|
|
140
|
+
}
|
|
141
|
+
const scale = positiveInteger(options.moduleScale ?? options.scale ?? 1, 'moduleScale');
|
|
142
|
+
const height = positiveInteger(options.height ?? MIN_HEIGHT_MODULES * scale, 'height');
|
|
143
|
+
if (height < MIN_HEIGHT_MODULES * scale) {
|
|
144
|
+
throw new EncodeError('GS1 DataBar Limited height is below the normative 10-module minimum');
|
|
145
|
+
}
|
|
146
|
+
const width = SYMBOL_MODULES * scale;
|
|
147
|
+
if (width > MAX_DIMENSION || height > MAX_DIMENSION || width * height > MAX_MODULES) {
|
|
148
|
+
throw new EncodeError('GS1 DataBar Limited dimensions exceed the safe matrix limit');
|
|
149
|
+
}
|
|
150
|
+
return Object.freeze({ scale, height, width, linkage: options.linkage === true });
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function combinations(n, r) {
|
|
154
|
+
if (n < r || r < 0) return 0;
|
|
155
|
+
if (r === 0 || n === r) return 1;
|
|
156
|
+
const k = Math.min(r, n - r);
|
|
157
|
+
let result = 1;
|
|
158
|
+
for (let i = 1; i <= k; i++) result = result * (n - k + i) / i;
|
|
159
|
+
return result;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function candidateCount(remaining, bar, width, elements, maximumWidth, noNarrow, narrowMask) {
|
|
163
|
+
let count = combinations(remaining - width - 1, elements - bar - 2);
|
|
164
|
+
if (noNarrow && narrowMask === 0
|
|
165
|
+
&& remaining - width - (elements - bar - 1) >= elements - bar - 1) {
|
|
166
|
+
count -= combinations(remaining - width - (elements - bar), elements - bar - 2);
|
|
167
|
+
}
|
|
168
|
+
if (elements - bar - 1 > 1) {
|
|
169
|
+
let tooWide = 0;
|
|
170
|
+
for (let last = remaining - width - (elements - bar - 2); last > maximumWidth; last--) {
|
|
171
|
+
tooWide += combinations(remaining - width - last - 1, elements - bar - 3);
|
|
172
|
+
}
|
|
173
|
+
count -= tooWide * (elements - 1 - bar);
|
|
174
|
+
} else if (remaining - width > maximumWidth) {
|
|
175
|
+
count--;
|
|
176
|
+
}
|
|
177
|
+
return count;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function unrankWidths(rank, modules, elements, maximumWidth, noNarrow) {
|
|
181
|
+
return dataBarWidths(rank, modules, elements, maximumWidth, noNarrow);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function rankWidths(widths, modules, elements, maximumWidth, noNarrow) {
|
|
185
|
+
if (!Array.isArray(widths) || widths.length !== elements
|
|
186
|
+
|| widths.some((width) => !Number.isSafeInteger(width) || width < 1 || width > maximumWidth)
|
|
187
|
+
|| widths.reduce((sum, width) => sum + width, 0) !== modules) {
|
|
188
|
+
throw new FormatError('GS1 DataBar Limited subset widths are invalid');
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
let rank = 0;
|
|
192
|
+
let remaining = modules;
|
|
193
|
+
let narrowMask = 0;
|
|
194
|
+
for (let bar = 0; bar < elements - 1; bar++) {
|
|
195
|
+
const selected = widths[bar];
|
|
196
|
+
for (let width = 1; width < selected; width++) {
|
|
197
|
+
if (width === 1) narrowMask |= 1 << bar;
|
|
198
|
+
rank += candidateCount(remaining, bar, width, elements, maximumWidth, noNarrow, narrowMask);
|
|
199
|
+
narrowMask &= ~(1 << bar);
|
|
200
|
+
}
|
|
201
|
+
if (selected === 1) narrowMask |= 1 << bar;
|
|
202
|
+
else narrowMask &= ~(1 << bar);
|
|
203
|
+
remaining -= selected;
|
|
204
|
+
}
|
|
205
|
+
if (widths[elements - 1] !== remaining) {
|
|
206
|
+
throw new FormatError('GS1 DataBar Limited subset rank is not canonical');
|
|
207
|
+
}
|
|
208
|
+
const canonical = unrankWidths(rank, modules, elements, maximumWidth, noNarrow);
|
|
209
|
+
if (canonical.some((width, index) => width !== widths[index])) {
|
|
210
|
+
throw new FormatError('GS1 DataBar Limited subset width sequence is not canonical');
|
|
211
|
+
}
|
|
212
|
+
return rank;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
function groupForValue(value) {
|
|
216
|
+
const group = GROUPS.find((entry) => value >= entry.first && value <= entry.last);
|
|
217
|
+
if (!group) throw new RangeError('GS1 DataBar Limited character value is out of range');
|
|
218
|
+
return group;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
function dataCharacterWidths(value) {
|
|
222
|
+
if (!Number.isSafeInteger(value) || value < 0 || value > GROUPS.at(-1).last) {
|
|
223
|
+
throw new RangeError('GS1 DataBar Limited character value is out of range');
|
|
224
|
+
}
|
|
225
|
+
const group = groupForValue(value);
|
|
226
|
+
const offset = value - group.gsum;
|
|
227
|
+
const oddRank = Math.floor(offset / group.evenTotal);
|
|
228
|
+
const evenRank = offset % group.evenTotal;
|
|
229
|
+
const odd = unrankWidths(oddRank, group.oddModules, DATA_CHARACTER_ELEMENTS, group.oddWidest, false);
|
|
230
|
+
const even = unrankWidths(evenRank, group.evenModules, DATA_CHARACTER_ELEMENTS, group.evenWidest, true);
|
|
231
|
+
const widths = [];
|
|
232
|
+
for (let index = 0; index < DATA_CHARACTER_ELEMENTS; index++) widths.push(odd[index], even[index]);
|
|
233
|
+
if (widths.reduce((sum, width) => sum + width, 0) !== DATA_CHARACTER_MODULES) {
|
|
234
|
+
throw new EncodeError('GS1 DataBar Limited data character width total is invalid');
|
|
235
|
+
}
|
|
236
|
+
return widths;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
function dataCharacterValue(widths) {
|
|
240
|
+
if (!Array.isArray(widths) || widths.length !== DATA_CHARACTER_ELEMENTS * 2) {
|
|
241
|
+
throw new FormatError('GS1 DataBar Limited data character must contain 14 elements');
|
|
242
|
+
}
|
|
243
|
+
const odd = widths.filter((_, index) => (index & 1) === 0);
|
|
244
|
+
const even = widths.filter((_, index) => (index & 1) === 1);
|
|
245
|
+
const oddModules = odd.reduce((sum, width) => sum + width, 0);
|
|
246
|
+
const group = GROUPS.find((entry) => entry.oddModules === oddModules
|
|
247
|
+
&& entry.evenModules === even.reduce((sum, width) => sum + width, 0));
|
|
248
|
+
if (!group) throw new FormatError('GS1 DataBar Limited data character module totals are invalid');
|
|
249
|
+
const oddRank = rankWidths(odd, group.oddModules, DATA_CHARACTER_ELEMENTS, group.oddWidest, false);
|
|
250
|
+
const evenRank = rankWidths(even, group.evenModules, DATA_CHARACTER_ELEMENTS, group.evenWidest, true);
|
|
251
|
+
const value = group.gsum + oddRank * group.evenTotal + evenRank;
|
|
252
|
+
if (value < group.first || value > group.last) {
|
|
253
|
+
throw new FormatError('GS1 DataBar Limited data character value is out of range');
|
|
254
|
+
}
|
|
255
|
+
return value;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
function checksumForWidths(left, right) {
|
|
259
|
+
let checksum = 0;
|
|
260
|
+
for (let index = 0; index < DATA_CHARACTER_ELEMENTS * 2; index++) {
|
|
261
|
+
checksum += CHECKSUM_WEIGHTS[index] * left[index];
|
|
262
|
+
checksum += CHECKSUM_WEIGHTS[index + DATA_CHARACTER_ELEMENTS * 2] * right[index];
|
|
263
|
+
}
|
|
264
|
+
return checksum % 89;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
function checksumWidths(checksum) {
|
|
268
|
+
if (!Number.isInteger(checksum) || checksum < 0 || checksum >= CHECKSUM_SEQUENCES.length) {
|
|
269
|
+
throw new RangeError('GS1 DataBar Limited checksum is out of range');
|
|
270
|
+
}
|
|
271
|
+
const sequence = CHECKSUM_SEQUENCES[checksum];
|
|
272
|
+
const spaces = unrankWidths(Math.floor(sequence / CHECK_CHARACTER_COMBINATIONS), 8,
|
|
273
|
+
CHECK_CHARACTER_ELEMENTS, 3, true);
|
|
274
|
+
const bars = unrankWidths(sequence % CHECK_CHARACTER_COMBINATIONS, 8,
|
|
275
|
+
CHECK_CHARACTER_ELEMENTS, 3, true);
|
|
276
|
+
return Object.freeze([
|
|
277
|
+
...spaces.flatMap((width, index) => [width, bars[index]]),
|
|
278
|
+
1, 1,
|
|
279
|
+
]);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
const CHECKSUM_PATTERNS = Object.freeze(Array.from(
|
|
283
|
+
{ length: CHECKSUM_SEQUENCES.length }, (_, checksum) => checksumWidths(checksum),
|
|
284
|
+
));
|
|
285
|
+
const CHECKSUM_PATTERN_VALUES = new Map(
|
|
286
|
+
CHECKSUM_PATTERNS.map((widths, checksum) => [widths.join(','), checksum]),
|
|
287
|
+
);
|
|
288
|
+
|
|
289
|
+
function paintRuns(widths, height, scale) {
|
|
290
|
+
const matrix = new BitMatrix(SYMBOL_MODULES * scale, height);
|
|
291
|
+
let cursor = 0;
|
|
292
|
+
let dark = false;
|
|
293
|
+
for (const width of widths) {
|
|
294
|
+
if (dark) matrix.setRegion(cursor * scale, 0, width * scale, height);
|
|
295
|
+
cursor += width;
|
|
296
|
+
dark = !dark;
|
|
297
|
+
}
|
|
298
|
+
if (cursor !== SYMBOL_MODULES) throw new EncodeError('GS1 DataBar Limited symbol width is invalid');
|
|
299
|
+
return matrix;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* Encode a checked GTIN as GS1 DataBar Limited.
|
|
304
|
+
*
|
|
305
|
+
* The accepted GTIN forms are the same as the shared DataBar codec: GTIN-8,
|
|
306
|
+
* GTIN-12, GTIN-13 and GTIN-14, normalized to fourteen digits. The indicator
|
|
307
|
+
* digit must be zero or one. The returned matrix is 79 modules wide and at
|
|
308
|
+
* least 10 modules high.
|
|
309
|
+
*/
|
|
310
|
+
export function encodeDataBarLimited(value, options = {}) {
|
|
311
|
+
const geometry = checkedGeometry(options);
|
|
312
|
+
const compacted = encodeDataBarLimitedGTIN(value, { linkage: geometry.linkage });
|
|
313
|
+
const left = dataCharacterWidths(compacted.left);
|
|
314
|
+
const right = dataCharacterWidths(compacted.right);
|
|
315
|
+
const checksum = checksumForWidths(left, right);
|
|
316
|
+
const widths = [1, 1, ...left, ...checksumWidths(checksum), ...right, 1, 1, 5];
|
|
317
|
+
const matrix = paintRuns(widths, geometry.height, geometry.scale);
|
|
318
|
+
matrix.databar = Object.freeze({
|
|
319
|
+
variant: 'limited',
|
|
320
|
+
gtin: compacted.gtin,
|
|
321
|
+
linkage: compacted.linkage,
|
|
322
|
+
checksum,
|
|
323
|
+
modules: SYMBOL_MODULES,
|
|
324
|
+
moduleScale: geometry.scale,
|
|
325
|
+
height: geometry.height,
|
|
326
|
+
});
|
|
327
|
+
return matrix;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
function requireMatrix(matrix) {
|
|
331
|
+
if (!matrix || !Number.isInteger(matrix.width) || !Number.isInteger(matrix.height)
|
|
332
|
+
|| matrix.width < 1 || matrix.height < 1 || typeof matrix.get !== 'function') {
|
|
333
|
+
throw new TypeError('GS1 DataBar Limited decoder expects a BitMatrix-like value');
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
function sampledRuns(matrix) {
|
|
338
|
+
requireMatrix(matrix);
|
|
339
|
+
if (matrix.width % SYMBOL_MODULES !== 0) {
|
|
340
|
+
throw new FormatError('GS1 DataBar Limited matrix width must be a multiple of 79 modules');
|
|
341
|
+
}
|
|
342
|
+
const scale = matrix.width / SYMBOL_MODULES;
|
|
343
|
+
if (!Number.isSafeInteger(scale) || scale < 1 || matrix.height < MIN_HEIGHT_MODULES * scale) {
|
|
344
|
+
throw new FormatError('GS1 DataBar Limited matrix scale or height is invalid');
|
|
345
|
+
}
|
|
346
|
+
const y = Math.floor(matrix.height / 2);
|
|
347
|
+
const bits = [];
|
|
348
|
+
for (let x = 0; x < SYMBOL_MODULES; x++) {
|
|
349
|
+
const value = Boolean(matrix.get(x * scale + Math.floor(scale / 2), y));
|
|
350
|
+
for (let dx = 0; dx < scale; dx++) {
|
|
351
|
+
if (Boolean(matrix.get(x * scale + dx, y)) !== value) {
|
|
352
|
+
throw new FormatError('GS1 DataBar Limited horizontal modules are not integer-scaled');
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
bits.push(value);
|
|
356
|
+
}
|
|
357
|
+
// Limited is a single-row linear symbol: a clean raster must repeat the
|
|
358
|
+
// same module pattern through its complete height. Sampling only one row
|
|
359
|
+
// would otherwise accept a partially erased bar above or below that row.
|
|
360
|
+
for (let row = 0; row < matrix.height; row++) {
|
|
361
|
+
for (let x = 0; x < SYMBOL_MODULES; x++) {
|
|
362
|
+
const expected = bits[x];
|
|
363
|
+
for (let dx = 0; dx < scale; dx++) {
|
|
364
|
+
if (Boolean(matrix.get(x * scale + dx, row)) !== expected) {
|
|
365
|
+
throw new FormatError('GS1 DataBar Limited rows are inconsistent');
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
const runs = [];
|
|
371
|
+
let dark = bits[0];
|
|
372
|
+
let width = 0;
|
|
373
|
+
for (const bit of bits) {
|
|
374
|
+
if (bit === dark) width++;
|
|
375
|
+
else {
|
|
376
|
+
runs.push({ dark, width });
|
|
377
|
+
dark = bit;
|
|
378
|
+
width = 1;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
runs.push({ dark, width });
|
|
382
|
+
if (runs.length !== 47) {
|
|
383
|
+
throw new FormatError('GS1 DataBar Limited element count is invalid');
|
|
384
|
+
}
|
|
385
|
+
const expected = [1, 1, 1, 1, 5];
|
|
386
|
+
if (runs[0].dark || runs[0].width !== expected[0]
|
|
387
|
+
|| !runs[1].dark || runs[1].width !== expected[1]
|
|
388
|
+
|| runs[44].dark || runs[44].width !== expected[2]
|
|
389
|
+
|| !runs[45].dark || runs[45].width !== expected[3]
|
|
390
|
+
|| runs[46].dark || runs[46].width !== expected[4]) {
|
|
391
|
+
throw new FormatError('GS1 DataBar Limited guard pattern is invalid');
|
|
392
|
+
}
|
|
393
|
+
return { runs, scale };
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
/** Decode a clean or integer-scaled GS1 DataBar Limited matrix. */
|
|
397
|
+
export function decodeDataBarLimited(matrix) {
|
|
398
|
+
const { runs, scale } = sampledRuns(matrix);
|
|
399
|
+
const leftWidths = runs.slice(2, 16).map(({ width }) => width);
|
|
400
|
+
const checkWidths = runs.slice(16, 30).map(({ width }) => width);
|
|
401
|
+
const rightWidths = runs.slice(30, 44).map(({ width }) => width);
|
|
402
|
+
const checksum = CHECKSUM_PATTERN_VALUES.get(checkWidths.join(','));
|
|
403
|
+
if (checksum === undefined) {
|
|
404
|
+
throw new FormatError('GS1 DataBar Limited check character is invalid');
|
|
405
|
+
}
|
|
406
|
+
const expectedChecksum = checksumForWidths(leftWidths, rightWidths);
|
|
407
|
+
if (checksum !== expectedChecksum) {
|
|
408
|
+
throw new ChecksumError('GS1 DataBar Limited checksum mismatch');
|
|
409
|
+
}
|
|
410
|
+
const left = dataCharacterValue(leftWidths);
|
|
411
|
+
const right = dataCharacterValue(rightWidths);
|
|
412
|
+
const decoded = decodeDataBarLimitedGTIN({ left, right });
|
|
413
|
+
const element = Object.freeze({ ai: '01', value: decoded.gtin, fixed: true });
|
|
414
|
+
return Object.freeze({
|
|
415
|
+
format: 'databar-limited',
|
|
416
|
+
variant: 'limited',
|
|
417
|
+
text: decoded.gtin,
|
|
418
|
+
gtin: decoded.gtin,
|
|
419
|
+
gs1: true,
|
|
420
|
+
linkage: decoded.linkage,
|
|
421
|
+
checksum,
|
|
422
|
+
checksumValid: true,
|
|
423
|
+
moduleScale: scale,
|
|
424
|
+
height: matrix.height,
|
|
425
|
+
symbologyIdentifier: ']e0',
|
|
426
|
+
elements: Object.freeze([element]),
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
function crop(source, box) {
|
|
431
|
+
const output = new BitMatrix(box.width, box.height);
|
|
432
|
+
for (let y = 0; y < box.height; y++) {
|
|
433
|
+
for (let x = 0; x < box.width; x++) {
|
|
434
|
+
if (source.get(box.x + x, box.y + y)) output.set(x, y);
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
return output;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
function rotateClockwise(source) {
|
|
441
|
+
const output = new BitMatrix(source.height, source.width);
|
|
442
|
+
for (let y = 0; y < source.height; y++) {
|
|
443
|
+
for (let x = 0; x < source.width; x++) {
|
|
444
|
+
if (source.get(x, y)) output.set(source.height - 1 - y, x);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
return output;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
function cornersFor(box) {
|
|
451
|
+
return [
|
|
452
|
+
{ x: box.x, y: box.y },
|
|
453
|
+
{ x: box.x + box.width, y: box.y },
|
|
454
|
+
{ x: box.x + box.width, y: box.y + box.height },
|
|
455
|
+
{ x: box.x, y: box.y + box.height },
|
|
456
|
+
];
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
function canonicalCorners(points) {
|
|
460
|
+
const byRow = [...points].sort((left, right) => left.y - right.y || left.x - right.x);
|
|
461
|
+
const [topLeft, topRight] = byRow.slice(0, 2).sort((left, right) => left.x - right.x);
|
|
462
|
+
const [bottomLeft, bottomRight] = byRow.slice(2).sort((left, right) => left.x - right.x);
|
|
463
|
+
return [topLeft, topRight, bottomRight, bottomLeft];
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
function mapPoint(point, previous) {
|
|
467
|
+
return { x: point.y, y: previous.height - point.x };
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
function validImage(image) {
|
|
471
|
+
return isRecord(image) && typeof image.get === 'function'
|
|
472
|
+
&& Number.isSafeInteger(image.width) && Number.isSafeInteger(image.height)
|
|
473
|
+
&& image.width > 0 && image.height > 0
|
|
474
|
+
&& image.width <= MAX_DIMENSION && image.height <= MAX_DIMENSION
|
|
475
|
+
&& image.width * image.height <= MAX_MODULES;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
/**
|
|
479
|
+
* Detect and decode a complete, dark-on-light Limited symbol in a binary
|
|
480
|
+
* image. The clean detector accepts integer module scaling and quarter turns;
|
|
481
|
+
* perspective, grayscale thresholding and partial symbols are intentionally
|
|
482
|
+
* rejected so a detector never returns a plausible-looking partial value.
|
|
483
|
+
*/
|
|
484
|
+
export function detectDataBarLimited(binaryImage, options = {}) {
|
|
485
|
+
if (!validImage(binaryImage) || !isRecord(options)) return null;
|
|
486
|
+
let oriented = binaryImage;
|
|
487
|
+
let toOriginal = (point) => ({ x: point.x, y: point.y });
|
|
488
|
+
|
|
489
|
+
for (let rotation = 0; rotation < 4; rotation++) {
|
|
490
|
+
const bounds = oriented.getBounds?.();
|
|
491
|
+
if (bounds && bounds.width > 0 && bounds.height > 0) {
|
|
492
|
+
const scale = bounds.width / 73;
|
|
493
|
+
const x = bounds.x - scale;
|
|
494
|
+
if (Number.isSafeInteger(scale) && scale >= 1 && x >= 0
|
|
495
|
+
&& x + SYMBOL_MODULES * scale <= oriented.width
|
|
496
|
+
&& bounds.height >= MIN_HEIGHT_MODULES * scale) {
|
|
497
|
+
const candidateBox = { x, y: bounds.y, width: SYMBOL_MODULES * scale, height: bounds.height };
|
|
498
|
+
try {
|
|
499
|
+
const matrix = crop(oriented, candidateBox);
|
|
500
|
+
const result = decodeDataBarLimited(matrix);
|
|
501
|
+
const geometry = createDetectionCandidate({
|
|
502
|
+
corners: canonicalCorners(cornersFor(candidateBox).map((point) => toOriginal(point))),
|
|
503
|
+
moduleSize: scale,
|
|
504
|
+
rotation: rotation * 90,
|
|
505
|
+
matrix,
|
|
506
|
+
confidence: 1,
|
|
507
|
+
}, {
|
|
508
|
+
result,
|
|
509
|
+
quality: {
|
|
510
|
+
quietZone: bounds.x > 0 && bounds.y > 0
|
|
511
|
+
&& bounds.x + bounds.width < oriented.width
|
|
512
|
+
&& bounds.y + bounds.height < oriented.height,
|
|
513
|
+
checksum: true,
|
|
514
|
+
rows: 1,
|
|
515
|
+
consistency: 1,
|
|
516
|
+
},
|
|
517
|
+
score: 1,
|
|
518
|
+
});
|
|
519
|
+
return Object.freeze({ ...result, ...geometry });
|
|
520
|
+
} catch {
|
|
521
|
+
// The complete dark bounds may belong to another linear symbol.
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
const previous = oriented;
|
|
527
|
+
const previousToOriginal = toOriginal;
|
|
528
|
+
oriented = rotateClockwise(previous);
|
|
529
|
+
toOriginal = (point) => previousToOriginal(mapPoint(point, previous));
|
|
530
|
+
}
|
|
531
|
+
return null;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
/** Detect-and-decode alias matching the other DataBar modules. */
|
|
535
|
+
export const detectAndDecodeDataBarLimited = detectDataBarLimited;
|
|
536
|
+
|
|
537
|
+
/**
|
|
538
|
+
* Decode a complete, unscaled binary scanline. This helper is intentionally
|
|
539
|
+
* strict: callers that have only one sampled row must provide a full 79-module
|
|
540
|
+
* symbol and the reader expands it to the normative minimum height.
|
|
541
|
+
*/
|
|
542
|
+
export function decodeDataBarLimitedScanline(row) {
|
|
543
|
+
if (!row || (typeof row.length !== 'number') || row.length !== SYMBOL_MODULES) return null;
|
|
544
|
+
const matrix = new BitMatrix(SYMBOL_MODULES, MIN_HEIGHT_MODULES);
|
|
545
|
+
for (let x = 0; x < SYMBOL_MODULES; x++) {
|
|
546
|
+
if (row[x]) matrix.setRegion(x, 0, 1, MIN_HEIGHT_MODULES);
|
|
547
|
+
}
|
|
548
|
+
try {
|
|
549
|
+
return decodeDataBarLimited(matrix);
|
|
550
|
+
} catch {
|
|
551
|
+
return null;
|
|
552
|
+
}
|
|
553
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Sythos Barcode Suite
|
|
3
|
+
*
|
|
4
|
+
* MIT License
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) 2026 Sythos
|
|
7
|
+
* SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
|
|
8
|
+
*
|
|
9
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
11
|
+
* in the Software without restriction, including without limitation the rights
|
|
12
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
14
|
+
* furnished to do so, subject to the following conditions:
|
|
15
|
+
*
|
|
16
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
17
|
+
* copies or substantial portions of the Software.
|
|
18
|
+
*
|
|
19
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
25
|
+
* SOFTWARE.
|
|
26
|
+
*
|
|
27
|
+
* SPDX-License-Identifier: MIT
|
|
28
|
+
*
|
|
29
|
+
* Original work. No code from any other barcode implementation.
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
import { BitMatrix } from '../core/bit-matrix.js';
|
|
33
|
+
|
|
34
|
+
export type DataBarStackedOmnidirectionalVariant =
|
|
35
|
+
| 'stacked-omnidirectional'
|
|
36
|
+
| 'stacked-omni'
|
|
37
|
+
| 'stackedomni';
|
|
38
|
+
|
|
39
|
+
export interface DataBarStackedOmnidirectionalOptions {
|
|
40
|
+
/** Optional alias accepted for compatibility with the DataBar writer. */
|
|
41
|
+
variant?: DataBarStackedOmnidirectionalVariant;
|
|
42
|
+
/** Whether the symbol carries the composite/linkage flag. */
|
|
43
|
+
linkage?: boolean;
|
|
44
|
+
/** Height in modules of each of the two rows; minimum is 33. */
|
|
45
|
+
rowHeight?: number;
|
|
46
|
+
/** Alias for rowHeight. */
|
|
47
|
+
barHeight?: number;
|
|
48
|
+
/** Alias for rowHeight. */
|
|
49
|
+
height?: number;
|
|
50
|
+
/** The standard separator is fixed at three modules. */
|
|
51
|
+
separatorModules?: 3;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface DataBarStackedOmnidirectionalElement {
|
|
55
|
+
readonly ai: '01';
|
|
56
|
+
readonly value: string;
|
|
57
|
+
readonly fixed: true;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface DataBarStackedOmnidirectionalResult {
|
|
61
|
+
readonly format: 'databar-stacked-omnidirectional';
|
|
62
|
+
readonly variant: 'stacked-omnidirectional';
|
|
63
|
+
readonly text: string;
|
|
64
|
+
readonly gtin: string;
|
|
65
|
+
readonly gs1: true;
|
|
66
|
+
readonly linkage: boolean;
|
|
67
|
+
readonly symbologyIdentifier: ']e0';
|
|
68
|
+
readonly checksum: number;
|
|
69
|
+
readonly checksumValid: true;
|
|
70
|
+
readonly rows: 2;
|
|
71
|
+
readonly rowHeight: number;
|
|
72
|
+
readonly separatorModules: 3;
|
|
73
|
+
readonly elements: readonly [DataBarStackedOmnidirectionalElement];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export type DataBarStackedOmnidirectionalRotation = 0 | 90 | 180 | 270;
|
|
77
|
+
|
|
78
|
+
export interface DataBarStackedOmnidirectionalDetection extends DataBarStackedOmnidirectionalResult {
|
|
79
|
+
readonly matrix: BitMatrix;
|
|
80
|
+
readonly corners: readonly [
|
|
81
|
+
{ readonly x: number; readonly y: number },
|
|
82
|
+
{ readonly x: number; readonly y: number },
|
|
83
|
+
{ readonly x: number; readonly y: number },
|
|
84
|
+
{ readonly x: number; readonly y: number },
|
|
85
|
+
];
|
|
86
|
+
readonly moduleSize: number;
|
|
87
|
+
readonly rotation: DataBarStackedOmnidirectionalRotation;
|
|
88
|
+
readonly confidence: 1;
|
|
89
|
+
readonly quality: {
|
|
90
|
+
readonly quietZone: boolean;
|
|
91
|
+
readonly checksum: true;
|
|
92
|
+
readonly rows: 2;
|
|
93
|
+
readonly consistency: 1;
|
|
94
|
+
};
|
|
95
|
+
readonly score: 1;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** Encode a checked GTIN as GS1 DataBar Stacked Omnidirectional. */
|
|
99
|
+
export declare function encodeDataBarStackedOmnidirectional(
|
|
100
|
+
value: string | number | bigint,
|
|
101
|
+
options?: DataBarStackedOmnidirectionalOptions,
|
|
102
|
+
): BitMatrix;
|
|
103
|
+
|
|
104
|
+
/** Decode a clean, upright GS1 DataBar Stacked Omnidirectional matrix. */
|
|
105
|
+
export declare function decodeDataBarStackedOmnidirectional(
|
|
106
|
+
matrix: BitMatrix,
|
|
107
|
+
options?: Pick<DataBarStackedOmnidirectionalOptions, 'rowHeight' | 'barHeight' | 'height' | 'separatorModules'>,
|
|
108
|
+
): DataBarStackedOmnidirectionalResult;
|
|
109
|
+
|
|
110
|
+
/** Detect and decode one clean, integer-scaled Stacked Omnidirectional symbol. */
|
|
111
|
+
export declare function detectDataBarStackedOmnidirectional(
|
|
112
|
+
binaryImage: BitMatrix,
|
|
113
|
+
options?: Pick<DataBarStackedOmnidirectionalOptions, 'rowHeight' | 'barHeight' | 'height' | 'separatorModules'>,
|
|
114
|
+
): DataBarStackedOmnidirectionalDetection | null;
|
|
115
|
+
|
|
116
|
+
/** Detect-and-decode alias matching the other matrix-format modules. */
|
|
117
|
+
export declare const detectAndDecodeDataBarStackedOmnidirectional: typeof detectDataBarStackedOmnidirectional;
|
|
118
|
+
|
|
119
|
+
export declare const encodeDataBarStackedOmni: typeof encodeDataBarStackedOmnidirectional;
|
|
120
|
+
export declare const decodeDataBarStackedOmni: typeof decodeDataBarStackedOmnidirectional;
|
|
121
|
+
export declare const detectDataBarStackedOmni: typeof detectDataBarStackedOmnidirectional;
|
|
122
|
+
export declare const detectAndDecodeDataBarStackedOmni: typeof detectDataBarStackedOmnidirectional;
|
|
123
|
+
export declare const encodeDataBar14StackedOmnidirectional: typeof encodeDataBarStackedOmnidirectional;
|
|
124
|
+
export declare const decodeDataBar14StackedOmnidirectional: typeof decodeDataBarStackedOmnidirectional;
|
|
125
|
+
export declare const detectDataBar14StackedOmnidirectional: typeof detectDataBarStackedOmnidirectional;
|
|
126
|
+
export declare const encodeDataBar14StackedOmni: typeof encodeDataBarStackedOmnidirectional;
|
|
127
|
+
export declare const decodeDataBar14StackedOmni: typeof decodeDataBarStackedOmnidirectional;
|
|
128
|
+
export declare const detectDataBar14StackedOmni: typeof detectDataBarStackedOmnidirectional;
|