x-print-designer 0.3.0 → 0.3.2

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 (50) hide show
  1. package/README.md +683 -507
  2. package/dist/Axis-NtNlSRsM.js +18246 -0
  3. package/dist/JsBarcode-CjIGssVQ.js +3866 -0
  4. package/dist/browser-C6dIfuJY.js +2153 -0
  5. package/dist/charts-CJaPVvDI.js +18428 -0
  6. package/dist/components-Dye0evtC.js +16442 -0
  7. package/dist/core-BbvNjmfU.js +233 -0
  8. package/dist/createSeriesData-DGiG-J3b.js +434 -0
  9. package/dist/customGraphicKeyframeAnimation-BY-XZFeb.js +9429 -0
  10. package/dist/dom-to-image-more.min-D3v39OhI.js +540 -0
  11. package/dist/graphic-BEFAeatd.js +11299 -0
  12. package/dist/html2canvas.esm-DWZSdXKi.js +7795 -0
  13. package/dist/index-DP3SRWJa.js +336 -0
  14. package/dist/index.es-CruLo21o.js +10445 -0
  15. package/dist/jspdf.es.min-tuXNPC83.js +11560 -0
  16. package/dist/jszip.min-BA8HtUau.js +2354 -0
  17. package/dist/print-designer.css +1 -0
  18. package/dist/print-designer.es.js +4 -0
  19. package/dist/print-designer.umd.js +394 -0
  20. package/dist/purify.es-DadB-l2n.js +1029 -0
  21. package/dist/renderers-Dm0Mcw0c.js +2387 -0
  22. package/dist/typeof-DxTVrAEz.js +11 -0
  23. package/dist/web-component-Bb1zyh8n.js +51520 -0
  24. package/dist/web-component.d.ts +102 -0
  25. package/package.json +1 -1
  26. package/dist/assets/Axis-hDyHms34.js +0 -21
  27. package/dist/assets/JsBarcode-BOwNyIpk.js +0 -1
  28. package/dist/assets/barcode-BoWGE6Vo.js +0 -8
  29. package/dist/assets/browser-CR_q2Gy7.js +0 -1
  30. package/dist/assets/canvg-ChoTXRpY.js +0 -18
  31. package/dist/assets/charts-oAXpTr-7.js +0 -1
  32. package/dist/assets/components-scMrpbvF.js +0 -22
  33. package/dist/assets/core-DLbFUvXo.js +0 -1
  34. package/dist/assets/createSeriesData-DY7MF9QR.js +0 -1
  35. package/dist/assets/customGraphicKeyframeAnimation-g4tvH6et.js +0 -3
  36. package/dist/assets/dom-to-image-more.min-Bzng6PqA.js +0 -1
  37. package/dist/assets/favicon-o5K9zUr2.ico +0 -0
  38. package/dist/assets/graphic-Cay9kDL2.js +0 -29
  39. package/dist/assets/html2canvas.esm-QH1iLAAe.js +0 -22
  40. package/dist/assets/index-BSfajosV.js +0 -154
  41. package/dist/assets/index-DNdDSD-C.css +0 -1
  42. package/dist/assets/jszip.min-DLPWIKb1.js +0 -12
  43. package/dist/assets/logo-DXm7qK2I.png +0 -0
  44. package/dist/assets/monaco-CyPiZSXM.js +0 -11
  45. package/dist/assets/pdf-Cjgn4CZy.js +0 -170
  46. package/dist/assets/purify.es-B5CD4DQe.js +0 -2
  47. package/dist/assets/renderers-CHDIdITR.js +0 -3
  48. package/dist/assets/utils-C6aID195.js +0 -1
  49. package/dist/assets/vendor-BlGuBhzR.js +0 -39
  50. package/dist/index.html +0 -19
@@ -0,0 +1,3866 @@
1
+ import { getDefaultExportFromCjs } from "./web-component-Bb1zyh8n.js";
2
+ function _mergeNamespaces(n, m) {
3
+ for (var i = 0; i < m.length; i++) {
4
+ const e = m[i];
5
+ if (typeof e !== "string" && !Array.isArray(e)) {
6
+ for (const k in e) {
7
+ if (k !== "default" && !(k in n)) {
8
+ const d = Object.getOwnPropertyDescriptor(e, k);
9
+ if (d) {
10
+ Object.defineProperty(n, k, d.get ? d : {
11
+ enumerable: true,
12
+ get: () => e[k]
13
+ });
14
+ }
15
+ }
16
+ }
17
+ }
18
+ }
19
+ return Object.freeze(Object.defineProperty(n, Symbol.toStringTag, { value: "Module" }));
20
+ }
21
+ var barcodes = {};
22
+ var CODE39 = {};
23
+ var Barcode = {};
24
+ var hasRequiredBarcode;
25
+ function requireBarcode() {
26
+ if (hasRequiredBarcode) return Barcode;
27
+ hasRequiredBarcode = 1;
28
+ Object.defineProperty(Barcode, "__esModule", {
29
+ value: true
30
+ });
31
+ function _classCallCheck(instance, Constructor) {
32
+ if (!(instance instanceof Constructor)) {
33
+ throw new TypeError("Cannot call a class as a function");
34
+ }
35
+ }
36
+ var Barcode$1 = function Barcode2(data, options) {
37
+ _classCallCheck(this, Barcode2);
38
+ this.data = data;
39
+ this.text = options.text || data;
40
+ this.options = options;
41
+ };
42
+ Barcode.default = Barcode$1;
43
+ return Barcode;
44
+ }
45
+ var hasRequiredCODE39;
46
+ function requireCODE39() {
47
+ if (hasRequiredCODE39) return CODE39;
48
+ hasRequiredCODE39 = 1;
49
+ Object.defineProperty(CODE39, "__esModule", {
50
+ value: true
51
+ });
52
+ CODE39.CODE39 = void 0;
53
+ var _createClass = /* @__PURE__ */ (function() {
54
+ function defineProperties(target, props) {
55
+ for (var i = 0; i < props.length; i++) {
56
+ var descriptor = props[i];
57
+ descriptor.enumerable = descriptor.enumerable || false;
58
+ descriptor.configurable = true;
59
+ if ("value" in descriptor) descriptor.writable = true;
60
+ Object.defineProperty(target, descriptor.key, descriptor);
61
+ }
62
+ }
63
+ return function(Constructor, protoProps, staticProps) {
64
+ if (protoProps) defineProperties(Constructor.prototype, protoProps);
65
+ if (staticProps) defineProperties(Constructor, staticProps);
66
+ return Constructor;
67
+ };
68
+ })();
69
+ var _Barcode2 = requireBarcode();
70
+ var _Barcode3 = _interopRequireDefault(_Barcode2);
71
+ function _interopRequireDefault(obj) {
72
+ return obj && obj.__esModule ? obj : { default: obj };
73
+ }
74
+ function _classCallCheck(instance, Constructor) {
75
+ if (!(instance instanceof Constructor)) {
76
+ throw new TypeError("Cannot call a class as a function");
77
+ }
78
+ }
79
+ function _possibleConstructorReturn(self, call) {
80
+ if (!self) {
81
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
82
+ }
83
+ return call && (typeof call === "object" || typeof call === "function") ? call : self;
84
+ }
85
+ function _inherits(subClass, superClass) {
86
+ if (typeof superClass !== "function" && superClass !== null) {
87
+ throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
88
+ }
89
+ subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });
90
+ if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
91
+ }
92
+ var CODE39$1 = (function(_Barcode) {
93
+ _inherits(CODE392, _Barcode);
94
+ function CODE392(data, options) {
95
+ _classCallCheck(this, CODE392);
96
+ data = data.toUpperCase();
97
+ if (options.mod43) {
98
+ data += getCharacter(mod43checksum(data));
99
+ }
100
+ return _possibleConstructorReturn(this, (CODE392.__proto__ || Object.getPrototypeOf(CODE392)).call(this, data, options));
101
+ }
102
+ _createClass(CODE392, [{
103
+ key: "encode",
104
+ value: function encode() {
105
+ var result = getEncoding("*");
106
+ for (var i = 0; i < this.data.length; i++) {
107
+ result += getEncoding(this.data[i]) + "0";
108
+ }
109
+ result += getEncoding("*");
110
+ return {
111
+ data: result,
112
+ text: this.text
113
+ };
114
+ }
115
+ }, {
116
+ key: "valid",
117
+ value: function valid() {
118
+ return this.data.search(/^[0-9A-Z\-\.\ \$\/\+\%]+$/) !== -1;
119
+ }
120
+ }]);
121
+ return CODE392;
122
+ })(_Barcode3.default);
123
+ var characters = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "-", ".", " ", "$", "/", "+", "%", "*"];
124
+ var encodings = [20957, 29783, 23639, 30485, 20951, 29813, 23669, 20855, 29789, 23645, 29975, 23831, 30533, 22295, 30149, 24005, 21623, 29981, 23837, 22301, 30023, 23879, 30545, 22343, 30161, 24017, 21959, 30065, 23921, 22385, 29015, 18263, 29141, 17879, 29045, 18293, 17783, 29021, 18269, 17477, 17489, 17681, 20753, 35770];
125
+ function getEncoding(character) {
126
+ return getBinary(characterValue(character));
127
+ }
128
+ function getBinary(characterValue2) {
129
+ return encodings[characterValue2].toString(2);
130
+ }
131
+ function getCharacter(characterValue2) {
132
+ return characters[characterValue2];
133
+ }
134
+ function characterValue(character) {
135
+ return characters.indexOf(character);
136
+ }
137
+ function mod43checksum(data) {
138
+ var checksum = 0;
139
+ for (var i = 0; i < data.length; i++) {
140
+ checksum += characterValue(data[i]);
141
+ }
142
+ checksum = checksum % 43;
143
+ return checksum;
144
+ }
145
+ CODE39.CODE39 = CODE39$1;
146
+ return CODE39;
147
+ }
148
+ var CODE128$1 = {};
149
+ var CODE128_AUTO = {};
150
+ var CODE128 = {};
151
+ var constants$3 = {};
152
+ var hasRequiredConstants$3;
153
+ function requireConstants$3() {
154
+ if (hasRequiredConstants$3) return constants$3;
155
+ hasRequiredConstants$3 = 1;
156
+ Object.defineProperty(constants$3, "__esModule", {
157
+ value: true
158
+ });
159
+ var _SET_BY_CODE;
160
+ function _defineProperty(obj, key, value) {
161
+ if (key in obj) {
162
+ Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
163
+ } else {
164
+ obj[key] = value;
165
+ }
166
+ return obj;
167
+ }
168
+ var SET_A = constants$3.SET_A = 0;
169
+ var SET_B = constants$3.SET_B = 1;
170
+ var SET_C = constants$3.SET_C = 2;
171
+ constants$3.SHIFT = 98;
172
+ var START_A = constants$3.START_A = 103;
173
+ var START_B = constants$3.START_B = 104;
174
+ var START_C = constants$3.START_C = 105;
175
+ constants$3.MODULO = 103;
176
+ constants$3.STOP = 106;
177
+ constants$3.FNC1 = 207;
178
+ constants$3.SET_BY_CODE = (_SET_BY_CODE = {}, _defineProperty(_SET_BY_CODE, START_A, SET_A), _defineProperty(_SET_BY_CODE, START_B, SET_B), _defineProperty(_SET_BY_CODE, START_C, SET_C), _SET_BY_CODE);
179
+ constants$3.SWAP = {
180
+ 101: SET_A,
181
+ 100: SET_B,
182
+ 99: SET_C
183
+ };
184
+ constants$3.A_START_CHAR = String.fromCharCode(208);
185
+ constants$3.B_START_CHAR = String.fromCharCode(209);
186
+ constants$3.C_START_CHAR = String.fromCharCode(210);
187
+ constants$3.A_CHARS = "[\0-_È-Ï]";
188
+ constants$3.B_CHARS = "[ -È-Ï]";
189
+ constants$3.C_CHARS = "(Ï*[0-9]{2}Ï*)";
190
+ constants$3.BARS = [11011001100, 11001101100, 11001100110, 10010011e3, 10010001100, 10001001100, 10011001e3, 10011000100, 10001100100, 11001001e3, 11001000100, 11000100100, 10110011100, 10011011100, 10011001110, 10111001100, 10011101100, 10011100110, 11001110010, 11001011100, 11001001110, 11011100100, 11001110100, 11101101110, 11101001100, 11100101100, 11100100110, 11101100100, 11100110100, 11100110010, 11011011e3, 11011000110, 11000110110, 10100011e3, 10001011e3, 10001000110, 10110001e3, 10001101e3, 10001100010, 11010001e3, 11000101e3, 11000100010, 10110111e3, 10110001110, 10001101110, 10111011e3, 10111000110, 10001110110, 11101110110, 11010001110, 11000101110, 11011101e3, 11011100010, 11011101110, 11101011e3, 11101000110, 11100010110, 11101101e3, 11101100010, 11100011010, 11101111010, 11001000010, 11110001010, 1010011e4, 10100001100, 1001011e4, 10010000110, 10000101100, 10000100110, 1011001e4, 10110000100, 1001101e4, 10011000010, 10000110100, 10000110010, 11000010010, 1100101e4, 11110111010, 11000010100, 10001111010, 10100111100, 10010111100, 10010011110, 10111100100, 10011110100, 10011110010, 11110100100, 11110010100, 11110010010, 11011011110, 11011110110, 11110110110, 10101111e3, 10100011110, 10001011110, 10111101e3, 10111100010, 11110101e3, 11110100010, 10111011110, 10111101110, 11101011110, 11110101110, 11010000100, 1101001e4, 11010011100, 1100011101011];
191
+ return constants$3;
192
+ }
193
+ var hasRequiredCODE128$1;
194
+ function requireCODE128$1() {
195
+ if (hasRequiredCODE128$1) return CODE128;
196
+ hasRequiredCODE128$1 = 1;
197
+ Object.defineProperty(CODE128, "__esModule", {
198
+ value: true
199
+ });
200
+ var _createClass = /* @__PURE__ */ (function() {
201
+ function defineProperties(target, props) {
202
+ for (var i = 0; i < props.length; i++) {
203
+ var descriptor = props[i];
204
+ descriptor.enumerable = descriptor.enumerable || false;
205
+ descriptor.configurable = true;
206
+ if ("value" in descriptor) descriptor.writable = true;
207
+ Object.defineProperty(target, descriptor.key, descriptor);
208
+ }
209
+ }
210
+ return function(Constructor, protoProps, staticProps) {
211
+ if (protoProps) defineProperties(Constructor.prototype, protoProps);
212
+ if (staticProps) defineProperties(Constructor, staticProps);
213
+ return Constructor;
214
+ };
215
+ })();
216
+ var _Barcode2 = requireBarcode();
217
+ var _Barcode3 = _interopRequireDefault(_Barcode2);
218
+ var _constants = requireConstants$3();
219
+ function _interopRequireDefault(obj) {
220
+ return obj && obj.__esModule ? obj : { default: obj };
221
+ }
222
+ function _classCallCheck(instance, Constructor) {
223
+ if (!(instance instanceof Constructor)) {
224
+ throw new TypeError("Cannot call a class as a function");
225
+ }
226
+ }
227
+ function _possibleConstructorReturn(self, call) {
228
+ if (!self) {
229
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
230
+ }
231
+ return call && (typeof call === "object" || typeof call === "function") ? call : self;
232
+ }
233
+ function _inherits(subClass, superClass) {
234
+ if (typeof superClass !== "function" && superClass !== null) {
235
+ throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
236
+ }
237
+ subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });
238
+ if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
239
+ }
240
+ var CODE128$12 = (function(_Barcode) {
241
+ _inherits(CODE1282, _Barcode);
242
+ function CODE1282(data, options) {
243
+ _classCallCheck(this, CODE1282);
244
+ var _this = _possibleConstructorReturn(this, (CODE1282.__proto__ || Object.getPrototypeOf(CODE1282)).call(this, data.substring(1), options));
245
+ _this.bytes = data.split("").map(function(char) {
246
+ return char.charCodeAt(0);
247
+ });
248
+ return _this;
249
+ }
250
+ _createClass(CODE1282, [{
251
+ key: "valid",
252
+ value: function valid() {
253
+ return /^[\x00-\x7F\xC8-\xD3]+$/.test(this.data);
254
+ }
255
+ // The public encoding function
256
+ }, {
257
+ key: "encode",
258
+ value: function encode() {
259
+ var bytes = this.bytes;
260
+ var startIndex = bytes.shift() - 105;
261
+ var startSet = _constants.SET_BY_CODE[startIndex];
262
+ if (startSet === void 0) {
263
+ throw new RangeError("The encoding does not start with a start character.");
264
+ }
265
+ if (this.shouldEncodeAsEan128() === true) {
266
+ bytes.unshift(_constants.FNC1);
267
+ }
268
+ var encodingResult = CODE1282.next(bytes, 1, startSet);
269
+ return {
270
+ text: this.text === this.data ? this.text.replace(/[^\x20-\x7E]/g, "") : this.text,
271
+ data: (
272
+ // Add the start bits
273
+ CODE1282.getBar(startIndex) + // Add the encoded bits
274
+ encodingResult.result + // Add the checksum
275
+ CODE1282.getBar((encodingResult.checksum + startIndex) % _constants.MODULO) + // Add the end bits
276
+ CODE1282.getBar(_constants.STOP)
277
+ )
278
+ };
279
+ }
280
+ // GS1-128/EAN-128
281
+ }, {
282
+ key: "shouldEncodeAsEan128",
283
+ value: function shouldEncodeAsEan128() {
284
+ var isEAN128 = this.options.ean128 || false;
285
+ if (typeof isEAN128 === "string") {
286
+ isEAN128 = isEAN128.toLowerCase() === "true";
287
+ }
288
+ return isEAN128;
289
+ }
290
+ // Get a bar symbol by index
291
+ }], [{
292
+ key: "getBar",
293
+ value: function getBar(index) {
294
+ return _constants.BARS[index] ? _constants.BARS[index].toString() : "";
295
+ }
296
+ // Correct an index by a set and shift it from the bytes array
297
+ }, {
298
+ key: "correctIndex",
299
+ value: function correctIndex(bytes, set) {
300
+ if (set === _constants.SET_A) {
301
+ var charCode = bytes.shift();
302
+ return charCode < 32 ? charCode + 64 : charCode - 32;
303
+ } else if (set === _constants.SET_B) {
304
+ return bytes.shift() - 32;
305
+ } else {
306
+ return (bytes.shift() - 48) * 10 + bytes.shift() - 48;
307
+ }
308
+ }
309
+ }, {
310
+ key: "next",
311
+ value: function next(bytes, pos, set) {
312
+ if (!bytes.length) {
313
+ return { result: "", checksum: 0 };
314
+ }
315
+ var nextCode = void 0, index = void 0;
316
+ if (bytes[0] >= 200) {
317
+ index = bytes.shift() - 105;
318
+ var nextSet = _constants.SWAP[index];
319
+ if (nextSet !== void 0) {
320
+ nextCode = CODE1282.next(bytes, pos + 1, nextSet);
321
+ } else {
322
+ if ((set === _constants.SET_A || set === _constants.SET_B) && index === _constants.SHIFT) {
323
+ bytes[0] = set === _constants.SET_A ? bytes[0] > 95 ? bytes[0] - 96 : bytes[0] : bytes[0] < 32 ? bytes[0] + 96 : bytes[0];
324
+ }
325
+ nextCode = CODE1282.next(bytes, pos + 1, set);
326
+ }
327
+ } else {
328
+ index = CODE1282.correctIndex(bytes, set);
329
+ nextCode = CODE1282.next(bytes, pos + 1, set);
330
+ }
331
+ var enc = CODE1282.getBar(index);
332
+ var weight = index * pos;
333
+ return {
334
+ result: enc + nextCode.result,
335
+ checksum: weight + nextCode.checksum
336
+ };
337
+ }
338
+ }]);
339
+ return CODE1282;
340
+ })(_Barcode3.default);
341
+ CODE128.default = CODE128$12;
342
+ return CODE128;
343
+ }
344
+ var auto = {};
345
+ var hasRequiredAuto;
346
+ function requireAuto() {
347
+ if (hasRequiredAuto) return auto;
348
+ hasRequiredAuto = 1;
349
+ Object.defineProperty(auto, "__esModule", {
350
+ value: true
351
+ });
352
+ var _constants = requireConstants$3();
353
+ var matchSetALength = function matchSetALength2(string) {
354
+ return string.match(new RegExp("^" + _constants.A_CHARS + "*"))[0].length;
355
+ };
356
+ var matchSetBLength = function matchSetBLength2(string) {
357
+ return string.match(new RegExp("^" + _constants.B_CHARS + "*"))[0].length;
358
+ };
359
+ var matchSetC = function matchSetC2(string) {
360
+ return string.match(new RegExp("^" + _constants.C_CHARS + "*"))[0];
361
+ };
362
+ function autoSelectFromAB(string, isA) {
363
+ var ranges = isA ? _constants.A_CHARS : _constants.B_CHARS;
364
+ var untilC = string.match(new RegExp("^(" + ranges + "+?)(([0-9]{2}){2,})([^0-9]|$)"));
365
+ if (untilC) {
366
+ return untilC[1] + String.fromCharCode(204) + autoSelectFromC(string.substring(untilC[1].length));
367
+ }
368
+ var chars = string.match(new RegExp("^" + ranges + "+"))[0];
369
+ if (chars.length === string.length) {
370
+ return string;
371
+ }
372
+ return chars + String.fromCharCode(isA ? 205 : 206) + autoSelectFromAB(string.substring(chars.length), !isA);
373
+ }
374
+ function autoSelectFromC(string) {
375
+ var cMatch = matchSetC(string);
376
+ var length = cMatch.length;
377
+ if (length === string.length) {
378
+ return string;
379
+ }
380
+ string = string.substring(length);
381
+ var isA = matchSetALength(string) >= matchSetBLength(string);
382
+ return cMatch + String.fromCharCode(isA ? 206 : 205) + autoSelectFromAB(string, isA);
383
+ }
384
+ auto.default = function(string) {
385
+ var newString = void 0;
386
+ var cLength = matchSetC(string).length;
387
+ if (cLength >= 2) {
388
+ newString = _constants.C_START_CHAR + autoSelectFromC(string);
389
+ } else {
390
+ var isA = matchSetALength(string) > matchSetBLength(string);
391
+ newString = (isA ? _constants.A_START_CHAR : _constants.B_START_CHAR) + autoSelectFromAB(string, isA);
392
+ }
393
+ return newString.replace(
394
+ /[\xCD\xCE]([^])[\xCD\xCE]/,
395
+ // Any sequence between 205 and 206 characters
396
+ function(match, char) {
397
+ return String.fromCharCode(203) + char;
398
+ }
399
+ );
400
+ };
401
+ return auto;
402
+ }
403
+ var hasRequiredCODE128_AUTO;
404
+ function requireCODE128_AUTO() {
405
+ if (hasRequiredCODE128_AUTO) return CODE128_AUTO;
406
+ hasRequiredCODE128_AUTO = 1;
407
+ Object.defineProperty(CODE128_AUTO, "__esModule", {
408
+ value: true
409
+ });
410
+ var _CODE2 = requireCODE128$1();
411
+ var _CODE3 = _interopRequireDefault(_CODE2);
412
+ var _auto = requireAuto();
413
+ var _auto2 = _interopRequireDefault(_auto);
414
+ function _interopRequireDefault(obj) {
415
+ return obj && obj.__esModule ? obj : { default: obj };
416
+ }
417
+ function _classCallCheck(instance, Constructor) {
418
+ if (!(instance instanceof Constructor)) {
419
+ throw new TypeError("Cannot call a class as a function");
420
+ }
421
+ }
422
+ function _possibleConstructorReturn(self, call) {
423
+ if (!self) {
424
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
425
+ }
426
+ return call && (typeof call === "object" || typeof call === "function") ? call : self;
427
+ }
428
+ function _inherits(subClass, superClass) {
429
+ if (typeof superClass !== "function" && superClass !== null) {
430
+ throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
431
+ }
432
+ subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });
433
+ if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
434
+ }
435
+ var CODE128AUTO = (function(_CODE) {
436
+ _inherits(CODE128AUTO2, _CODE);
437
+ function CODE128AUTO2(data, options) {
438
+ _classCallCheck(this, CODE128AUTO2);
439
+ if (/^[\x00-\x7F\xC8-\xD3]+$/.test(data)) {
440
+ var _this = _possibleConstructorReturn(this, (CODE128AUTO2.__proto__ || Object.getPrototypeOf(CODE128AUTO2)).call(this, (0, _auto2.default)(data), options));
441
+ } else {
442
+ var _this = _possibleConstructorReturn(this, (CODE128AUTO2.__proto__ || Object.getPrototypeOf(CODE128AUTO2)).call(this, data, options));
443
+ }
444
+ return _possibleConstructorReturn(_this);
445
+ }
446
+ return CODE128AUTO2;
447
+ })(_CODE3.default);
448
+ CODE128_AUTO.default = CODE128AUTO;
449
+ return CODE128_AUTO;
450
+ }
451
+ var CODE128A = {};
452
+ var hasRequiredCODE128A;
453
+ function requireCODE128A() {
454
+ if (hasRequiredCODE128A) return CODE128A;
455
+ hasRequiredCODE128A = 1;
456
+ Object.defineProperty(CODE128A, "__esModule", {
457
+ value: true
458
+ });
459
+ var _createClass = /* @__PURE__ */ (function() {
460
+ function defineProperties(target, props) {
461
+ for (var i = 0; i < props.length; i++) {
462
+ var descriptor = props[i];
463
+ descriptor.enumerable = descriptor.enumerable || false;
464
+ descriptor.configurable = true;
465
+ if ("value" in descriptor) descriptor.writable = true;
466
+ Object.defineProperty(target, descriptor.key, descriptor);
467
+ }
468
+ }
469
+ return function(Constructor, protoProps, staticProps) {
470
+ if (protoProps) defineProperties(Constructor.prototype, protoProps);
471
+ if (staticProps) defineProperties(Constructor, staticProps);
472
+ return Constructor;
473
+ };
474
+ })();
475
+ var _CODE2 = requireCODE128$1();
476
+ var _CODE3 = _interopRequireDefault(_CODE2);
477
+ var _constants = requireConstants$3();
478
+ function _interopRequireDefault(obj) {
479
+ return obj && obj.__esModule ? obj : { default: obj };
480
+ }
481
+ function _classCallCheck(instance, Constructor) {
482
+ if (!(instance instanceof Constructor)) {
483
+ throw new TypeError("Cannot call a class as a function");
484
+ }
485
+ }
486
+ function _possibleConstructorReturn(self, call) {
487
+ if (!self) {
488
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
489
+ }
490
+ return call && (typeof call === "object" || typeof call === "function") ? call : self;
491
+ }
492
+ function _inherits(subClass, superClass) {
493
+ if (typeof superClass !== "function" && superClass !== null) {
494
+ throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
495
+ }
496
+ subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });
497
+ if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
498
+ }
499
+ var CODE128A$1 = (function(_CODE) {
500
+ _inherits(CODE128A2, _CODE);
501
+ function CODE128A2(string, options) {
502
+ _classCallCheck(this, CODE128A2);
503
+ return _possibleConstructorReturn(this, (CODE128A2.__proto__ || Object.getPrototypeOf(CODE128A2)).call(this, _constants.A_START_CHAR + string, options));
504
+ }
505
+ _createClass(CODE128A2, [{
506
+ key: "valid",
507
+ value: function valid() {
508
+ return new RegExp("^" + _constants.A_CHARS + "+$").test(this.data);
509
+ }
510
+ }]);
511
+ return CODE128A2;
512
+ })(_CODE3.default);
513
+ CODE128A.default = CODE128A$1;
514
+ return CODE128A;
515
+ }
516
+ var CODE128B = {};
517
+ var hasRequiredCODE128B;
518
+ function requireCODE128B() {
519
+ if (hasRequiredCODE128B) return CODE128B;
520
+ hasRequiredCODE128B = 1;
521
+ Object.defineProperty(CODE128B, "__esModule", {
522
+ value: true
523
+ });
524
+ var _createClass = /* @__PURE__ */ (function() {
525
+ function defineProperties(target, props) {
526
+ for (var i = 0; i < props.length; i++) {
527
+ var descriptor = props[i];
528
+ descriptor.enumerable = descriptor.enumerable || false;
529
+ descriptor.configurable = true;
530
+ if ("value" in descriptor) descriptor.writable = true;
531
+ Object.defineProperty(target, descriptor.key, descriptor);
532
+ }
533
+ }
534
+ return function(Constructor, protoProps, staticProps) {
535
+ if (protoProps) defineProperties(Constructor.prototype, protoProps);
536
+ if (staticProps) defineProperties(Constructor, staticProps);
537
+ return Constructor;
538
+ };
539
+ })();
540
+ var _CODE2 = requireCODE128$1();
541
+ var _CODE3 = _interopRequireDefault(_CODE2);
542
+ var _constants = requireConstants$3();
543
+ function _interopRequireDefault(obj) {
544
+ return obj && obj.__esModule ? obj : { default: obj };
545
+ }
546
+ function _classCallCheck(instance, Constructor) {
547
+ if (!(instance instanceof Constructor)) {
548
+ throw new TypeError("Cannot call a class as a function");
549
+ }
550
+ }
551
+ function _possibleConstructorReturn(self, call) {
552
+ if (!self) {
553
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
554
+ }
555
+ return call && (typeof call === "object" || typeof call === "function") ? call : self;
556
+ }
557
+ function _inherits(subClass, superClass) {
558
+ if (typeof superClass !== "function" && superClass !== null) {
559
+ throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
560
+ }
561
+ subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });
562
+ if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
563
+ }
564
+ var CODE128B$1 = (function(_CODE) {
565
+ _inherits(CODE128B2, _CODE);
566
+ function CODE128B2(string, options) {
567
+ _classCallCheck(this, CODE128B2);
568
+ return _possibleConstructorReturn(this, (CODE128B2.__proto__ || Object.getPrototypeOf(CODE128B2)).call(this, _constants.B_START_CHAR + string, options));
569
+ }
570
+ _createClass(CODE128B2, [{
571
+ key: "valid",
572
+ value: function valid() {
573
+ return new RegExp("^" + _constants.B_CHARS + "+$").test(this.data);
574
+ }
575
+ }]);
576
+ return CODE128B2;
577
+ })(_CODE3.default);
578
+ CODE128B.default = CODE128B$1;
579
+ return CODE128B;
580
+ }
581
+ var CODE128C = {};
582
+ var hasRequiredCODE128C;
583
+ function requireCODE128C() {
584
+ if (hasRequiredCODE128C) return CODE128C;
585
+ hasRequiredCODE128C = 1;
586
+ Object.defineProperty(CODE128C, "__esModule", {
587
+ value: true
588
+ });
589
+ var _createClass = /* @__PURE__ */ (function() {
590
+ function defineProperties(target, props) {
591
+ for (var i = 0; i < props.length; i++) {
592
+ var descriptor = props[i];
593
+ descriptor.enumerable = descriptor.enumerable || false;
594
+ descriptor.configurable = true;
595
+ if ("value" in descriptor) descriptor.writable = true;
596
+ Object.defineProperty(target, descriptor.key, descriptor);
597
+ }
598
+ }
599
+ return function(Constructor, protoProps, staticProps) {
600
+ if (protoProps) defineProperties(Constructor.prototype, protoProps);
601
+ if (staticProps) defineProperties(Constructor, staticProps);
602
+ return Constructor;
603
+ };
604
+ })();
605
+ var _CODE2 = requireCODE128$1();
606
+ var _CODE3 = _interopRequireDefault(_CODE2);
607
+ var _constants = requireConstants$3();
608
+ function _interopRequireDefault(obj) {
609
+ return obj && obj.__esModule ? obj : { default: obj };
610
+ }
611
+ function _classCallCheck(instance, Constructor) {
612
+ if (!(instance instanceof Constructor)) {
613
+ throw new TypeError("Cannot call a class as a function");
614
+ }
615
+ }
616
+ function _possibleConstructorReturn(self, call) {
617
+ if (!self) {
618
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
619
+ }
620
+ return call && (typeof call === "object" || typeof call === "function") ? call : self;
621
+ }
622
+ function _inherits(subClass, superClass) {
623
+ if (typeof superClass !== "function" && superClass !== null) {
624
+ throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
625
+ }
626
+ subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });
627
+ if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
628
+ }
629
+ var CODE128C$1 = (function(_CODE) {
630
+ _inherits(CODE128C2, _CODE);
631
+ function CODE128C2(string, options) {
632
+ _classCallCheck(this, CODE128C2);
633
+ return _possibleConstructorReturn(this, (CODE128C2.__proto__ || Object.getPrototypeOf(CODE128C2)).call(this, _constants.C_START_CHAR + string, options));
634
+ }
635
+ _createClass(CODE128C2, [{
636
+ key: "valid",
637
+ value: function valid() {
638
+ return new RegExp("^" + _constants.C_CHARS + "+$").test(this.data);
639
+ }
640
+ }]);
641
+ return CODE128C2;
642
+ })(_CODE3.default);
643
+ CODE128C.default = CODE128C$1;
644
+ return CODE128C;
645
+ }
646
+ var hasRequiredCODE128;
647
+ function requireCODE128() {
648
+ if (hasRequiredCODE128) return CODE128$1;
649
+ hasRequiredCODE128 = 1;
650
+ Object.defineProperty(CODE128$1, "__esModule", {
651
+ value: true
652
+ });
653
+ CODE128$1.CODE128C = CODE128$1.CODE128B = CODE128$1.CODE128A = CODE128$1.CODE128 = void 0;
654
+ var _CODE128_AUTO = requireCODE128_AUTO();
655
+ var _CODE128_AUTO2 = _interopRequireDefault(_CODE128_AUTO);
656
+ var _CODE128A = requireCODE128A();
657
+ var _CODE128A2 = _interopRequireDefault(_CODE128A);
658
+ var _CODE128B = requireCODE128B();
659
+ var _CODE128B2 = _interopRequireDefault(_CODE128B);
660
+ var _CODE128C = requireCODE128C();
661
+ var _CODE128C2 = _interopRequireDefault(_CODE128C);
662
+ function _interopRequireDefault(obj) {
663
+ return obj && obj.__esModule ? obj : { default: obj };
664
+ }
665
+ CODE128$1.CODE128 = _CODE128_AUTO2.default;
666
+ CODE128$1.CODE128A = _CODE128A2.default;
667
+ CODE128$1.CODE128B = _CODE128B2.default;
668
+ CODE128$1.CODE128C = _CODE128C2.default;
669
+ return CODE128$1;
670
+ }
671
+ var EAN_UPC = {};
672
+ var EAN13 = {};
673
+ var constants$2 = {};
674
+ var hasRequiredConstants$2;
675
+ function requireConstants$2() {
676
+ if (hasRequiredConstants$2) return constants$2;
677
+ hasRequiredConstants$2 = 1;
678
+ Object.defineProperty(constants$2, "__esModule", {
679
+ value: true
680
+ });
681
+ constants$2.SIDE_BIN = "101";
682
+ constants$2.MIDDLE_BIN = "01010";
683
+ constants$2.BINARIES = {
684
+ "L": [
685
+ // The L (left) type of encoding
686
+ "0001101",
687
+ "0011001",
688
+ "0010011",
689
+ "0111101",
690
+ "0100011",
691
+ "0110001",
692
+ "0101111",
693
+ "0111011",
694
+ "0110111",
695
+ "0001011"
696
+ ],
697
+ "G": [
698
+ // The G type of encoding
699
+ "0100111",
700
+ "0110011",
701
+ "0011011",
702
+ "0100001",
703
+ "0011101",
704
+ "0111001",
705
+ "0000101",
706
+ "0010001",
707
+ "0001001",
708
+ "0010111"
709
+ ],
710
+ "R": [
711
+ // The R (right) type of encoding
712
+ "1110010",
713
+ "1100110",
714
+ "1101100",
715
+ "1000010",
716
+ "1011100",
717
+ "1001110",
718
+ "1010000",
719
+ "1000100",
720
+ "1001000",
721
+ "1110100"
722
+ ],
723
+ "O": [
724
+ // The O (odd) encoding for UPC-E
725
+ "0001101",
726
+ "0011001",
727
+ "0010011",
728
+ "0111101",
729
+ "0100011",
730
+ "0110001",
731
+ "0101111",
732
+ "0111011",
733
+ "0110111",
734
+ "0001011"
735
+ ],
736
+ "E": [
737
+ // The E (even) encoding for UPC-E
738
+ "0100111",
739
+ "0110011",
740
+ "0011011",
741
+ "0100001",
742
+ "0011101",
743
+ "0111001",
744
+ "0000101",
745
+ "0010001",
746
+ "0001001",
747
+ "0010111"
748
+ ]
749
+ };
750
+ constants$2.EAN2_STRUCTURE = ["LL", "LG", "GL", "GG"];
751
+ constants$2.EAN5_STRUCTURE = ["GGLLL", "GLGLL", "GLLGL", "GLLLG", "LGGLL", "LLGGL", "LLLGG", "LGLGL", "LGLLG", "LLGLG"];
752
+ constants$2.EAN13_STRUCTURE = ["LLLLLL", "LLGLGG", "LLGGLG", "LLGGGL", "LGLLGG", "LGGLLG", "LGGGLL", "LGLGLG", "LGLGGL", "LGGLGL"];
753
+ return constants$2;
754
+ }
755
+ var EAN = {};
756
+ var encoder = {};
757
+ var hasRequiredEncoder;
758
+ function requireEncoder() {
759
+ if (hasRequiredEncoder) return encoder;
760
+ hasRequiredEncoder = 1;
761
+ Object.defineProperty(encoder, "__esModule", {
762
+ value: true
763
+ });
764
+ var _constants = requireConstants$2();
765
+ var encode = function encode2(data, structure, separator) {
766
+ var encoded = data.split("").map(function(val, idx) {
767
+ return _constants.BINARIES[structure[idx]];
768
+ }).map(function(val, idx) {
769
+ return val ? val[data[idx]] : "";
770
+ });
771
+ if (separator) {
772
+ var last = data.length - 1;
773
+ encoded = encoded.map(function(val, idx) {
774
+ return idx < last ? val + separator : val;
775
+ });
776
+ }
777
+ return encoded.join("");
778
+ };
779
+ encoder.default = encode;
780
+ return encoder;
781
+ }
782
+ var hasRequiredEAN;
783
+ function requireEAN() {
784
+ if (hasRequiredEAN) return EAN;
785
+ hasRequiredEAN = 1;
786
+ Object.defineProperty(EAN, "__esModule", {
787
+ value: true
788
+ });
789
+ var _createClass = /* @__PURE__ */ (function() {
790
+ function defineProperties(target, props) {
791
+ for (var i = 0; i < props.length; i++) {
792
+ var descriptor = props[i];
793
+ descriptor.enumerable = descriptor.enumerable || false;
794
+ descriptor.configurable = true;
795
+ if ("value" in descriptor) descriptor.writable = true;
796
+ Object.defineProperty(target, descriptor.key, descriptor);
797
+ }
798
+ }
799
+ return function(Constructor, protoProps, staticProps) {
800
+ if (protoProps) defineProperties(Constructor.prototype, protoProps);
801
+ if (staticProps) defineProperties(Constructor, staticProps);
802
+ return Constructor;
803
+ };
804
+ })();
805
+ var _constants = requireConstants$2();
806
+ var _encoder = requireEncoder();
807
+ var _encoder2 = _interopRequireDefault(_encoder);
808
+ var _Barcode2 = requireBarcode();
809
+ var _Barcode3 = _interopRequireDefault(_Barcode2);
810
+ function _interopRequireDefault(obj) {
811
+ return obj && obj.__esModule ? obj : { default: obj };
812
+ }
813
+ function _classCallCheck(instance, Constructor) {
814
+ if (!(instance instanceof Constructor)) {
815
+ throw new TypeError("Cannot call a class as a function");
816
+ }
817
+ }
818
+ function _possibleConstructorReturn(self, call) {
819
+ if (!self) {
820
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
821
+ }
822
+ return call && (typeof call === "object" || typeof call === "function") ? call : self;
823
+ }
824
+ function _inherits(subClass, superClass) {
825
+ if (typeof superClass !== "function" && superClass !== null) {
826
+ throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
827
+ }
828
+ subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });
829
+ if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
830
+ }
831
+ var EAN$1 = (function(_Barcode) {
832
+ _inherits(EAN3, _Barcode);
833
+ function EAN3(data, options) {
834
+ _classCallCheck(this, EAN3);
835
+ var _this = _possibleConstructorReturn(this, (EAN3.__proto__ || Object.getPrototypeOf(EAN3)).call(this, data, options));
836
+ _this.fontSize = !options.flat && options.fontSize > options.width * 10 ? options.width * 10 : options.fontSize;
837
+ _this.guardHeight = options.height + _this.fontSize / 2 + options.textMargin;
838
+ return _this;
839
+ }
840
+ _createClass(EAN3, [{
841
+ key: "encode",
842
+ value: function encode() {
843
+ return this.options.flat ? this.encodeFlat() : this.encodeGuarded();
844
+ }
845
+ }, {
846
+ key: "leftText",
847
+ value: function leftText(from, to) {
848
+ return this.text.substr(from, to);
849
+ }
850
+ }, {
851
+ key: "leftEncode",
852
+ value: function leftEncode(data, structure) {
853
+ return (0, _encoder2.default)(data, structure);
854
+ }
855
+ }, {
856
+ key: "rightText",
857
+ value: function rightText(from, to) {
858
+ return this.text.substr(from, to);
859
+ }
860
+ }, {
861
+ key: "rightEncode",
862
+ value: function rightEncode(data, structure) {
863
+ return (0, _encoder2.default)(data, structure);
864
+ }
865
+ }, {
866
+ key: "encodeGuarded",
867
+ value: function encodeGuarded() {
868
+ var textOptions = { fontSize: this.fontSize };
869
+ var guardOptions = { height: this.guardHeight };
870
+ return [{ data: _constants.SIDE_BIN, options: guardOptions }, { data: this.leftEncode(), text: this.leftText(), options: textOptions }, { data: _constants.MIDDLE_BIN, options: guardOptions }, { data: this.rightEncode(), text: this.rightText(), options: textOptions }, { data: _constants.SIDE_BIN, options: guardOptions }];
871
+ }
872
+ }, {
873
+ key: "encodeFlat",
874
+ value: function encodeFlat() {
875
+ var data = [_constants.SIDE_BIN, this.leftEncode(), _constants.MIDDLE_BIN, this.rightEncode(), _constants.SIDE_BIN];
876
+ return {
877
+ data: data.join(""),
878
+ text: this.text
879
+ };
880
+ }
881
+ }]);
882
+ return EAN3;
883
+ })(_Barcode3.default);
884
+ EAN.default = EAN$1;
885
+ return EAN;
886
+ }
887
+ var hasRequiredEAN13;
888
+ function requireEAN13() {
889
+ if (hasRequiredEAN13) return EAN13;
890
+ hasRequiredEAN13 = 1;
891
+ Object.defineProperty(EAN13, "__esModule", {
892
+ value: true
893
+ });
894
+ var _createClass = /* @__PURE__ */ (function() {
895
+ function defineProperties(target, props) {
896
+ for (var i = 0; i < props.length; i++) {
897
+ var descriptor = props[i];
898
+ descriptor.enumerable = descriptor.enumerable || false;
899
+ descriptor.configurable = true;
900
+ if ("value" in descriptor) descriptor.writable = true;
901
+ Object.defineProperty(target, descriptor.key, descriptor);
902
+ }
903
+ }
904
+ return function(Constructor, protoProps, staticProps) {
905
+ if (protoProps) defineProperties(Constructor.prototype, protoProps);
906
+ if (staticProps) defineProperties(Constructor, staticProps);
907
+ return Constructor;
908
+ };
909
+ })();
910
+ var _get = function get(object2, property, receiver) {
911
+ if (object2 === null) object2 = Function.prototype;
912
+ var desc = Object.getOwnPropertyDescriptor(object2, property);
913
+ if (desc === void 0) {
914
+ var parent = Object.getPrototypeOf(object2);
915
+ if (parent === null) {
916
+ return void 0;
917
+ } else {
918
+ return get(parent, property, receiver);
919
+ }
920
+ } else if ("value" in desc) {
921
+ return desc.value;
922
+ } else {
923
+ var getter = desc.get;
924
+ if (getter === void 0) {
925
+ return void 0;
926
+ }
927
+ return getter.call(receiver);
928
+ }
929
+ };
930
+ var _constants = requireConstants$2();
931
+ var _EAN2 = requireEAN();
932
+ var _EAN3 = _interopRequireDefault(_EAN2);
933
+ function _interopRequireDefault(obj) {
934
+ return obj && obj.__esModule ? obj : { default: obj };
935
+ }
936
+ function _classCallCheck(instance, Constructor) {
937
+ if (!(instance instanceof Constructor)) {
938
+ throw new TypeError("Cannot call a class as a function");
939
+ }
940
+ }
941
+ function _possibleConstructorReturn(self, call) {
942
+ if (!self) {
943
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
944
+ }
945
+ return call && (typeof call === "object" || typeof call === "function") ? call : self;
946
+ }
947
+ function _inherits(subClass, superClass) {
948
+ if (typeof superClass !== "function" && superClass !== null) {
949
+ throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
950
+ }
951
+ subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });
952
+ if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
953
+ }
954
+ var checksum = function checksum2(number) {
955
+ var res = number.substr(0, 12).split("").map(function(n) {
956
+ return +n;
957
+ }).reduce(function(sum, a, idx) {
958
+ return idx % 2 ? sum + a * 3 : sum + a;
959
+ }, 0);
960
+ return (10 - res % 10) % 10;
961
+ };
962
+ var EAN13$1 = (function(_EAN) {
963
+ _inherits(EAN132, _EAN);
964
+ function EAN132(data, options) {
965
+ _classCallCheck(this, EAN132);
966
+ if (data.search(/^[0-9]{12}$/) !== -1) {
967
+ data += checksum(data);
968
+ }
969
+ var _this = _possibleConstructorReturn(this, (EAN132.__proto__ || Object.getPrototypeOf(EAN132)).call(this, data, options));
970
+ _this.lastChar = options.lastChar;
971
+ return _this;
972
+ }
973
+ _createClass(EAN132, [{
974
+ key: "valid",
975
+ value: function valid() {
976
+ return this.data.search(/^[0-9]{13}$/) !== -1 && +this.data[12] === checksum(this.data);
977
+ }
978
+ }, {
979
+ key: "leftText",
980
+ value: function leftText() {
981
+ return _get(EAN132.prototype.__proto__ || Object.getPrototypeOf(EAN132.prototype), "leftText", this).call(this, 1, 6);
982
+ }
983
+ }, {
984
+ key: "leftEncode",
985
+ value: function leftEncode() {
986
+ var data = this.data.substr(1, 6);
987
+ var structure = _constants.EAN13_STRUCTURE[this.data[0]];
988
+ return _get(EAN132.prototype.__proto__ || Object.getPrototypeOf(EAN132.prototype), "leftEncode", this).call(this, data, structure);
989
+ }
990
+ }, {
991
+ key: "rightText",
992
+ value: function rightText() {
993
+ return _get(EAN132.prototype.__proto__ || Object.getPrototypeOf(EAN132.prototype), "rightText", this).call(this, 7, 6);
994
+ }
995
+ }, {
996
+ key: "rightEncode",
997
+ value: function rightEncode() {
998
+ var data = this.data.substr(7, 6);
999
+ return _get(EAN132.prototype.__proto__ || Object.getPrototypeOf(EAN132.prototype), "rightEncode", this).call(this, data, "RRRRRR");
1000
+ }
1001
+ // The "standard" way of printing EAN13 barcodes with guard bars
1002
+ }, {
1003
+ key: "encodeGuarded",
1004
+ value: function encodeGuarded() {
1005
+ var data = _get(EAN132.prototype.__proto__ || Object.getPrototypeOf(EAN132.prototype), "encodeGuarded", this).call(this);
1006
+ if (this.options.displayValue) {
1007
+ data.unshift({
1008
+ data: "000000000000",
1009
+ text: this.text.substr(0, 1),
1010
+ options: { textAlign: "left", fontSize: this.fontSize }
1011
+ });
1012
+ if (this.options.lastChar) {
1013
+ data.push({
1014
+ data: "00"
1015
+ });
1016
+ data.push({
1017
+ data: "00000",
1018
+ text: this.options.lastChar,
1019
+ options: { fontSize: this.fontSize }
1020
+ });
1021
+ }
1022
+ }
1023
+ return data;
1024
+ }
1025
+ }]);
1026
+ return EAN132;
1027
+ })(_EAN3.default);
1028
+ EAN13.default = EAN13$1;
1029
+ return EAN13;
1030
+ }
1031
+ var EAN8 = {};
1032
+ var hasRequiredEAN8;
1033
+ function requireEAN8() {
1034
+ if (hasRequiredEAN8) return EAN8;
1035
+ hasRequiredEAN8 = 1;
1036
+ Object.defineProperty(EAN8, "__esModule", {
1037
+ value: true
1038
+ });
1039
+ var _createClass = /* @__PURE__ */ (function() {
1040
+ function defineProperties(target, props) {
1041
+ for (var i = 0; i < props.length; i++) {
1042
+ var descriptor = props[i];
1043
+ descriptor.enumerable = descriptor.enumerable || false;
1044
+ descriptor.configurable = true;
1045
+ if ("value" in descriptor) descriptor.writable = true;
1046
+ Object.defineProperty(target, descriptor.key, descriptor);
1047
+ }
1048
+ }
1049
+ return function(Constructor, protoProps, staticProps) {
1050
+ if (protoProps) defineProperties(Constructor.prototype, protoProps);
1051
+ if (staticProps) defineProperties(Constructor, staticProps);
1052
+ return Constructor;
1053
+ };
1054
+ })();
1055
+ var _get = function get(object2, property, receiver) {
1056
+ if (object2 === null) object2 = Function.prototype;
1057
+ var desc = Object.getOwnPropertyDescriptor(object2, property);
1058
+ if (desc === void 0) {
1059
+ var parent = Object.getPrototypeOf(object2);
1060
+ if (parent === null) {
1061
+ return void 0;
1062
+ } else {
1063
+ return get(parent, property, receiver);
1064
+ }
1065
+ } else if ("value" in desc) {
1066
+ return desc.value;
1067
+ } else {
1068
+ var getter = desc.get;
1069
+ if (getter === void 0) {
1070
+ return void 0;
1071
+ }
1072
+ return getter.call(receiver);
1073
+ }
1074
+ };
1075
+ var _EAN2 = requireEAN();
1076
+ var _EAN3 = _interopRequireDefault(_EAN2);
1077
+ function _interopRequireDefault(obj) {
1078
+ return obj && obj.__esModule ? obj : { default: obj };
1079
+ }
1080
+ function _classCallCheck(instance, Constructor) {
1081
+ if (!(instance instanceof Constructor)) {
1082
+ throw new TypeError("Cannot call a class as a function");
1083
+ }
1084
+ }
1085
+ function _possibleConstructorReturn(self, call) {
1086
+ if (!self) {
1087
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1088
+ }
1089
+ return call && (typeof call === "object" || typeof call === "function") ? call : self;
1090
+ }
1091
+ function _inherits(subClass, superClass) {
1092
+ if (typeof superClass !== "function" && superClass !== null) {
1093
+ throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
1094
+ }
1095
+ subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });
1096
+ if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
1097
+ }
1098
+ var checksum = function checksum2(number) {
1099
+ var res = number.substr(0, 7).split("").map(function(n) {
1100
+ return +n;
1101
+ }).reduce(function(sum, a, idx) {
1102
+ return idx % 2 ? sum + a : sum + a * 3;
1103
+ }, 0);
1104
+ return (10 - res % 10) % 10;
1105
+ };
1106
+ var EAN8$1 = (function(_EAN) {
1107
+ _inherits(EAN82, _EAN);
1108
+ function EAN82(data, options) {
1109
+ _classCallCheck(this, EAN82);
1110
+ if (data.search(/^[0-9]{7}$/) !== -1) {
1111
+ data += checksum(data);
1112
+ }
1113
+ return _possibleConstructorReturn(this, (EAN82.__proto__ || Object.getPrototypeOf(EAN82)).call(this, data, options));
1114
+ }
1115
+ _createClass(EAN82, [{
1116
+ key: "valid",
1117
+ value: function valid() {
1118
+ return this.data.search(/^[0-9]{8}$/) !== -1 && +this.data[7] === checksum(this.data);
1119
+ }
1120
+ }, {
1121
+ key: "leftText",
1122
+ value: function leftText() {
1123
+ return _get(EAN82.prototype.__proto__ || Object.getPrototypeOf(EAN82.prototype), "leftText", this).call(this, 0, 4);
1124
+ }
1125
+ }, {
1126
+ key: "leftEncode",
1127
+ value: function leftEncode() {
1128
+ var data = this.data.substr(0, 4);
1129
+ return _get(EAN82.prototype.__proto__ || Object.getPrototypeOf(EAN82.prototype), "leftEncode", this).call(this, data, "LLLL");
1130
+ }
1131
+ }, {
1132
+ key: "rightText",
1133
+ value: function rightText() {
1134
+ return _get(EAN82.prototype.__proto__ || Object.getPrototypeOf(EAN82.prototype), "rightText", this).call(this, 4, 4);
1135
+ }
1136
+ }, {
1137
+ key: "rightEncode",
1138
+ value: function rightEncode() {
1139
+ var data = this.data.substr(4, 4);
1140
+ return _get(EAN82.prototype.__proto__ || Object.getPrototypeOf(EAN82.prototype), "rightEncode", this).call(this, data, "RRRR");
1141
+ }
1142
+ }]);
1143
+ return EAN82;
1144
+ })(_EAN3.default);
1145
+ EAN8.default = EAN8$1;
1146
+ return EAN8;
1147
+ }
1148
+ var EAN5 = {};
1149
+ var hasRequiredEAN5;
1150
+ function requireEAN5() {
1151
+ if (hasRequiredEAN5) return EAN5;
1152
+ hasRequiredEAN5 = 1;
1153
+ Object.defineProperty(EAN5, "__esModule", {
1154
+ value: true
1155
+ });
1156
+ var _createClass = /* @__PURE__ */ (function() {
1157
+ function defineProperties(target, props) {
1158
+ for (var i = 0; i < props.length; i++) {
1159
+ var descriptor = props[i];
1160
+ descriptor.enumerable = descriptor.enumerable || false;
1161
+ descriptor.configurable = true;
1162
+ if ("value" in descriptor) descriptor.writable = true;
1163
+ Object.defineProperty(target, descriptor.key, descriptor);
1164
+ }
1165
+ }
1166
+ return function(Constructor, protoProps, staticProps) {
1167
+ if (protoProps) defineProperties(Constructor.prototype, protoProps);
1168
+ if (staticProps) defineProperties(Constructor, staticProps);
1169
+ return Constructor;
1170
+ };
1171
+ })();
1172
+ var _constants = requireConstants$2();
1173
+ var _encoder = requireEncoder();
1174
+ var _encoder2 = _interopRequireDefault(_encoder);
1175
+ var _Barcode2 = requireBarcode();
1176
+ var _Barcode3 = _interopRequireDefault(_Barcode2);
1177
+ function _interopRequireDefault(obj) {
1178
+ return obj && obj.__esModule ? obj : { default: obj };
1179
+ }
1180
+ function _classCallCheck(instance, Constructor) {
1181
+ if (!(instance instanceof Constructor)) {
1182
+ throw new TypeError("Cannot call a class as a function");
1183
+ }
1184
+ }
1185
+ function _possibleConstructorReturn(self, call) {
1186
+ if (!self) {
1187
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1188
+ }
1189
+ return call && (typeof call === "object" || typeof call === "function") ? call : self;
1190
+ }
1191
+ function _inherits(subClass, superClass) {
1192
+ if (typeof superClass !== "function" && superClass !== null) {
1193
+ throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
1194
+ }
1195
+ subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });
1196
+ if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
1197
+ }
1198
+ var checksum = function checksum2(data) {
1199
+ var result = data.split("").map(function(n) {
1200
+ return +n;
1201
+ }).reduce(function(sum, a, idx) {
1202
+ return idx % 2 ? sum + a * 9 : sum + a * 3;
1203
+ }, 0);
1204
+ return result % 10;
1205
+ };
1206
+ var EAN5$1 = (function(_Barcode) {
1207
+ _inherits(EAN52, _Barcode);
1208
+ function EAN52(data, options) {
1209
+ _classCallCheck(this, EAN52);
1210
+ return _possibleConstructorReturn(this, (EAN52.__proto__ || Object.getPrototypeOf(EAN52)).call(this, data, options));
1211
+ }
1212
+ _createClass(EAN52, [{
1213
+ key: "valid",
1214
+ value: function valid() {
1215
+ return this.data.search(/^[0-9]{5}$/) !== -1;
1216
+ }
1217
+ }, {
1218
+ key: "encode",
1219
+ value: function encode() {
1220
+ var structure = _constants.EAN5_STRUCTURE[checksum(this.data)];
1221
+ return {
1222
+ data: "1011" + (0, _encoder2.default)(this.data, structure, "01"),
1223
+ text: this.text
1224
+ };
1225
+ }
1226
+ }]);
1227
+ return EAN52;
1228
+ })(_Barcode3.default);
1229
+ EAN5.default = EAN5$1;
1230
+ return EAN5;
1231
+ }
1232
+ var EAN2 = {};
1233
+ var hasRequiredEAN2;
1234
+ function requireEAN2() {
1235
+ if (hasRequiredEAN2) return EAN2;
1236
+ hasRequiredEAN2 = 1;
1237
+ Object.defineProperty(EAN2, "__esModule", {
1238
+ value: true
1239
+ });
1240
+ var _createClass = /* @__PURE__ */ (function() {
1241
+ function defineProperties(target, props) {
1242
+ for (var i = 0; i < props.length; i++) {
1243
+ var descriptor = props[i];
1244
+ descriptor.enumerable = descriptor.enumerable || false;
1245
+ descriptor.configurable = true;
1246
+ if ("value" in descriptor) descriptor.writable = true;
1247
+ Object.defineProperty(target, descriptor.key, descriptor);
1248
+ }
1249
+ }
1250
+ return function(Constructor, protoProps, staticProps) {
1251
+ if (protoProps) defineProperties(Constructor.prototype, protoProps);
1252
+ if (staticProps) defineProperties(Constructor, staticProps);
1253
+ return Constructor;
1254
+ };
1255
+ })();
1256
+ var _constants = requireConstants$2();
1257
+ var _encoder = requireEncoder();
1258
+ var _encoder2 = _interopRequireDefault(_encoder);
1259
+ var _Barcode2 = requireBarcode();
1260
+ var _Barcode3 = _interopRequireDefault(_Barcode2);
1261
+ function _interopRequireDefault(obj) {
1262
+ return obj && obj.__esModule ? obj : { default: obj };
1263
+ }
1264
+ function _classCallCheck(instance, Constructor) {
1265
+ if (!(instance instanceof Constructor)) {
1266
+ throw new TypeError("Cannot call a class as a function");
1267
+ }
1268
+ }
1269
+ function _possibleConstructorReturn(self, call) {
1270
+ if (!self) {
1271
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1272
+ }
1273
+ return call && (typeof call === "object" || typeof call === "function") ? call : self;
1274
+ }
1275
+ function _inherits(subClass, superClass) {
1276
+ if (typeof superClass !== "function" && superClass !== null) {
1277
+ throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
1278
+ }
1279
+ subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });
1280
+ if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
1281
+ }
1282
+ var EAN2$1 = (function(_Barcode) {
1283
+ _inherits(EAN22, _Barcode);
1284
+ function EAN22(data, options) {
1285
+ _classCallCheck(this, EAN22);
1286
+ return _possibleConstructorReturn(this, (EAN22.__proto__ || Object.getPrototypeOf(EAN22)).call(this, data, options));
1287
+ }
1288
+ _createClass(EAN22, [{
1289
+ key: "valid",
1290
+ value: function valid() {
1291
+ return this.data.search(/^[0-9]{2}$/) !== -1;
1292
+ }
1293
+ }, {
1294
+ key: "encode",
1295
+ value: function encode() {
1296
+ var structure = _constants.EAN2_STRUCTURE[parseInt(this.data) % 4];
1297
+ return {
1298
+ // Start bits + Encode the two digits with 01 in between
1299
+ data: "1011" + (0, _encoder2.default)(this.data, structure, "01"),
1300
+ text: this.text
1301
+ };
1302
+ }
1303
+ }]);
1304
+ return EAN22;
1305
+ })(_Barcode3.default);
1306
+ EAN2.default = EAN2$1;
1307
+ return EAN2;
1308
+ }
1309
+ var UPC = {};
1310
+ var hasRequiredUPC;
1311
+ function requireUPC() {
1312
+ if (hasRequiredUPC) return UPC;
1313
+ hasRequiredUPC = 1;
1314
+ Object.defineProperty(UPC, "__esModule", {
1315
+ value: true
1316
+ });
1317
+ var _createClass = /* @__PURE__ */ (function() {
1318
+ function defineProperties(target, props) {
1319
+ for (var i = 0; i < props.length; i++) {
1320
+ var descriptor = props[i];
1321
+ descriptor.enumerable = descriptor.enumerable || false;
1322
+ descriptor.configurable = true;
1323
+ if ("value" in descriptor) descriptor.writable = true;
1324
+ Object.defineProperty(target, descriptor.key, descriptor);
1325
+ }
1326
+ }
1327
+ return function(Constructor, protoProps, staticProps) {
1328
+ if (protoProps) defineProperties(Constructor.prototype, protoProps);
1329
+ if (staticProps) defineProperties(Constructor, staticProps);
1330
+ return Constructor;
1331
+ };
1332
+ })();
1333
+ UPC.checksum = checksum;
1334
+ var _encoder = requireEncoder();
1335
+ var _encoder2 = _interopRequireDefault(_encoder);
1336
+ var _Barcode2 = requireBarcode();
1337
+ var _Barcode3 = _interopRequireDefault(_Barcode2);
1338
+ function _interopRequireDefault(obj) {
1339
+ return obj && obj.__esModule ? obj : { default: obj };
1340
+ }
1341
+ function _classCallCheck(instance, Constructor) {
1342
+ if (!(instance instanceof Constructor)) {
1343
+ throw new TypeError("Cannot call a class as a function");
1344
+ }
1345
+ }
1346
+ function _possibleConstructorReturn(self, call) {
1347
+ if (!self) {
1348
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1349
+ }
1350
+ return call && (typeof call === "object" || typeof call === "function") ? call : self;
1351
+ }
1352
+ function _inherits(subClass, superClass) {
1353
+ if (typeof superClass !== "function" && superClass !== null) {
1354
+ throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
1355
+ }
1356
+ subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });
1357
+ if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
1358
+ }
1359
+ var UPC$1 = (function(_Barcode) {
1360
+ _inherits(UPC2, _Barcode);
1361
+ function UPC2(data, options) {
1362
+ _classCallCheck(this, UPC2);
1363
+ if (data.search(/^[0-9]{11}$/) !== -1) {
1364
+ data += checksum(data);
1365
+ }
1366
+ var _this = _possibleConstructorReturn(this, (UPC2.__proto__ || Object.getPrototypeOf(UPC2)).call(this, data, options));
1367
+ _this.displayValue = options.displayValue;
1368
+ if (options.fontSize > options.width * 10) {
1369
+ _this.fontSize = options.width * 10;
1370
+ } else {
1371
+ _this.fontSize = options.fontSize;
1372
+ }
1373
+ _this.guardHeight = options.height + _this.fontSize / 2 + options.textMargin;
1374
+ return _this;
1375
+ }
1376
+ _createClass(UPC2, [{
1377
+ key: "valid",
1378
+ value: function valid() {
1379
+ return this.data.search(/^[0-9]{12}$/) !== -1 && this.data[11] == checksum(this.data);
1380
+ }
1381
+ }, {
1382
+ key: "encode",
1383
+ value: function encode() {
1384
+ if (this.options.flat) {
1385
+ return this.flatEncoding();
1386
+ } else {
1387
+ return this.guardedEncoding();
1388
+ }
1389
+ }
1390
+ }, {
1391
+ key: "flatEncoding",
1392
+ value: function flatEncoding() {
1393
+ var result = "";
1394
+ result += "101";
1395
+ result += (0, _encoder2.default)(this.data.substr(0, 6), "LLLLLL");
1396
+ result += "01010";
1397
+ result += (0, _encoder2.default)(this.data.substr(6, 6), "RRRRRR");
1398
+ result += "101";
1399
+ return {
1400
+ data: result,
1401
+ text: this.text
1402
+ };
1403
+ }
1404
+ }, {
1405
+ key: "guardedEncoding",
1406
+ value: function guardedEncoding() {
1407
+ var result = [];
1408
+ if (this.displayValue) {
1409
+ result.push({
1410
+ data: "00000000",
1411
+ text: this.text.substr(0, 1),
1412
+ options: { textAlign: "left", fontSize: this.fontSize }
1413
+ });
1414
+ }
1415
+ result.push({
1416
+ data: "101" + (0, _encoder2.default)(this.data[0], "L"),
1417
+ options: { height: this.guardHeight }
1418
+ });
1419
+ result.push({
1420
+ data: (0, _encoder2.default)(this.data.substr(1, 5), "LLLLL"),
1421
+ text: this.text.substr(1, 5),
1422
+ options: { fontSize: this.fontSize }
1423
+ });
1424
+ result.push({
1425
+ data: "01010",
1426
+ options: { height: this.guardHeight }
1427
+ });
1428
+ result.push({
1429
+ data: (0, _encoder2.default)(this.data.substr(6, 5), "RRRRR"),
1430
+ text: this.text.substr(6, 5),
1431
+ options: { fontSize: this.fontSize }
1432
+ });
1433
+ result.push({
1434
+ data: (0, _encoder2.default)(this.data[11], "R") + "101",
1435
+ options: { height: this.guardHeight }
1436
+ });
1437
+ if (this.displayValue) {
1438
+ result.push({
1439
+ data: "00000000",
1440
+ text: this.text.substr(11, 1),
1441
+ options: { textAlign: "right", fontSize: this.fontSize }
1442
+ });
1443
+ }
1444
+ return result;
1445
+ }
1446
+ }]);
1447
+ return UPC2;
1448
+ })(_Barcode3.default);
1449
+ function checksum(number) {
1450
+ var result = 0;
1451
+ var i;
1452
+ for (i = 1; i < 11; i += 2) {
1453
+ result += parseInt(number[i]);
1454
+ }
1455
+ for (i = 0; i < 11; i += 2) {
1456
+ result += parseInt(number[i]) * 3;
1457
+ }
1458
+ return (10 - result % 10) % 10;
1459
+ }
1460
+ UPC.default = UPC$1;
1461
+ return UPC;
1462
+ }
1463
+ var UPCE = {};
1464
+ var hasRequiredUPCE;
1465
+ function requireUPCE() {
1466
+ if (hasRequiredUPCE) return UPCE;
1467
+ hasRequiredUPCE = 1;
1468
+ Object.defineProperty(UPCE, "__esModule", {
1469
+ value: true
1470
+ });
1471
+ var _createClass = /* @__PURE__ */ (function() {
1472
+ function defineProperties(target, props) {
1473
+ for (var i = 0; i < props.length; i++) {
1474
+ var descriptor = props[i];
1475
+ descriptor.enumerable = descriptor.enumerable || false;
1476
+ descriptor.configurable = true;
1477
+ if ("value" in descriptor) descriptor.writable = true;
1478
+ Object.defineProperty(target, descriptor.key, descriptor);
1479
+ }
1480
+ }
1481
+ return function(Constructor, protoProps, staticProps) {
1482
+ if (protoProps) defineProperties(Constructor.prototype, protoProps);
1483
+ if (staticProps) defineProperties(Constructor, staticProps);
1484
+ return Constructor;
1485
+ };
1486
+ })();
1487
+ var _encoder = requireEncoder();
1488
+ var _encoder2 = _interopRequireDefault(_encoder);
1489
+ var _Barcode2 = requireBarcode();
1490
+ var _Barcode3 = _interopRequireDefault(_Barcode2);
1491
+ var _UPC = requireUPC();
1492
+ function _interopRequireDefault(obj) {
1493
+ return obj && obj.__esModule ? obj : { default: obj };
1494
+ }
1495
+ function _classCallCheck(instance, Constructor) {
1496
+ if (!(instance instanceof Constructor)) {
1497
+ throw new TypeError("Cannot call a class as a function");
1498
+ }
1499
+ }
1500
+ function _possibleConstructorReturn(self, call) {
1501
+ if (!self) {
1502
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1503
+ }
1504
+ return call && (typeof call === "object" || typeof call === "function") ? call : self;
1505
+ }
1506
+ function _inherits(subClass, superClass) {
1507
+ if (typeof superClass !== "function" && superClass !== null) {
1508
+ throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
1509
+ }
1510
+ subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });
1511
+ if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
1512
+ }
1513
+ var EXPANSIONS = ["XX00000XXX", "XX10000XXX", "XX20000XXX", "XXX00000XX", "XXXX00000X", "XXXXX00005", "XXXXX00006", "XXXXX00007", "XXXXX00008", "XXXXX00009"];
1514
+ var PARITIES = [["EEEOOO", "OOOEEE"], ["EEOEOO", "OOEOEE"], ["EEOOEO", "OOEEOE"], ["EEOOOE", "OOEEEO"], ["EOEEOO", "OEOOEE"], ["EOOEEO", "OEEOOE"], ["EOOOEE", "OEEEOO"], ["EOEOEO", "OEOEOE"], ["EOEOOE", "OEOEEO"], ["EOOEOE", "OEEOEO"]];
1515
+ var UPCE$1 = (function(_Barcode) {
1516
+ _inherits(UPCE2, _Barcode);
1517
+ function UPCE2(data, options) {
1518
+ _classCallCheck(this, UPCE2);
1519
+ var _this = _possibleConstructorReturn(this, (UPCE2.__proto__ || Object.getPrototypeOf(UPCE2)).call(this, data, options));
1520
+ _this.isValid = false;
1521
+ if (data.search(/^[0-9]{6}$/) !== -1) {
1522
+ _this.middleDigits = data;
1523
+ _this.upcA = expandToUPCA(data, "0");
1524
+ _this.text = options.text || "" + _this.upcA[0] + data + _this.upcA[_this.upcA.length - 1];
1525
+ _this.isValid = true;
1526
+ } else if (data.search(/^[01][0-9]{7}$/) !== -1) {
1527
+ _this.middleDigits = data.substring(1, data.length - 1);
1528
+ _this.upcA = expandToUPCA(_this.middleDigits, data[0]);
1529
+ if (_this.upcA[_this.upcA.length - 1] === data[data.length - 1]) {
1530
+ _this.isValid = true;
1531
+ } else {
1532
+ return _possibleConstructorReturn(_this);
1533
+ }
1534
+ } else {
1535
+ return _possibleConstructorReturn(_this);
1536
+ }
1537
+ _this.displayValue = options.displayValue;
1538
+ if (options.fontSize > options.width * 10) {
1539
+ _this.fontSize = options.width * 10;
1540
+ } else {
1541
+ _this.fontSize = options.fontSize;
1542
+ }
1543
+ _this.guardHeight = options.height + _this.fontSize / 2 + options.textMargin;
1544
+ return _this;
1545
+ }
1546
+ _createClass(UPCE2, [{
1547
+ key: "valid",
1548
+ value: function valid() {
1549
+ return this.isValid;
1550
+ }
1551
+ }, {
1552
+ key: "encode",
1553
+ value: function encode() {
1554
+ if (this.options.flat) {
1555
+ return this.flatEncoding();
1556
+ } else {
1557
+ return this.guardedEncoding();
1558
+ }
1559
+ }
1560
+ }, {
1561
+ key: "flatEncoding",
1562
+ value: function flatEncoding() {
1563
+ var result = "";
1564
+ result += "101";
1565
+ result += this.encodeMiddleDigits();
1566
+ result += "010101";
1567
+ return {
1568
+ data: result,
1569
+ text: this.text
1570
+ };
1571
+ }
1572
+ }, {
1573
+ key: "guardedEncoding",
1574
+ value: function guardedEncoding() {
1575
+ var result = [];
1576
+ if (this.displayValue) {
1577
+ result.push({
1578
+ data: "00000000",
1579
+ text: this.text[0],
1580
+ options: { textAlign: "left", fontSize: this.fontSize }
1581
+ });
1582
+ }
1583
+ result.push({
1584
+ data: "101",
1585
+ options: { height: this.guardHeight }
1586
+ });
1587
+ result.push({
1588
+ data: this.encodeMiddleDigits(),
1589
+ text: this.text.substring(1, 7),
1590
+ options: { fontSize: this.fontSize }
1591
+ });
1592
+ result.push({
1593
+ data: "010101",
1594
+ options: { height: this.guardHeight }
1595
+ });
1596
+ if (this.displayValue) {
1597
+ result.push({
1598
+ data: "00000000",
1599
+ text: this.text[7],
1600
+ options: { textAlign: "right", fontSize: this.fontSize }
1601
+ });
1602
+ }
1603
+ return result;
1604
+ }
1605
+ }, {
1606
+ key: "encodeMiddleDigits",
1607
+ value: function encodeMiddleDigits() {
1608
+ var numberSystem = this.upcA[0];
1609
+ var checkDigit = this.upcA[this.upcA.length - 1];
1610
+ var parity = PARITIES[parseInt(checkDigit)][parseInt(numberSystem)];
1611
+ return (0, _encoder2.default)(this.middleDigits, parity);
1612
+ }
1613
+ }]);
1614
+ return UPCE2;
1615
+ })(_Barcode3.default);
1616
+ function expandToUPCA(middleDigits, numberSystem) {
1617
+ var lastUpcE = parseInt(middleDigits[middleDigits.length - 1]);
1618
+ var expansion = EXPANSIONS[lastUpcE];
1619
+ var result = "";
1620
+ var digitIndex = 0;
1621
+ for (var i = 0; i < expansion.length; i++) {
1622
+ var c = expansion[i];
1623
+ if (c === "X") {
1624
+ result += middleDigits[digitIndex++];
1625
+ } else {
1626
+ result += c;
1627
+ }
1628
+ }
1629
+ result = "" + numberSystem + result;
1630
+ return "" + result + (0, _UPC.checksum)(result);
1631
+ }
1632
+ UPCE.default = UPCE$1;
1633
+ return UPCE;
1634
+ }
1635
+ var hasRequiredEAN_UPC;
1636
+ function requireEAN_UPC() {
1637
+ if (hasRequiredEAN_UPC) return EAN_UPC;
1638
+ hasRequiredEAN_UPC = 1;
1639
+ Object.defineProperty(EAN_UPC, "__esModule", {
1640
+ value: true
1641
+ });
1642
+ EAN_UPC.UPCE = EAN_UPC.UPC = EAN_UPC.EAN2 = EAN_UPC.EAN5 = EAN_UPC.EAN8 = EAN_UPC.EAN13 = void 0;
1643
+ var _EAN = requireEAN13();
1644
+ var _EAN2 = _interopRequireDefault(_EAN);
1645
+ var _EAN3 = requireEAN8();
1646
+ var _EAN4 = _interopRequireDefault(_EAN3);
1647
+ var _EAN5 = requireEAN5();
1648
+ var _EAN6 = _interopRequireDefault(_EAN5);
1649
+ var _EAN7 = requireEAN2();
1650
+ var _EAN8 = _interopRequireDefault(_EAN7);
1651
+ var _UPC = requireUPC();
1652
+ var _UPC2 = _interopRequireDefault(_UPC);
1653
+ var _UPCE = requireUPCE();
1654
+ var _UPCE2 = _interopRequireDefault(_UPCE);
1655
+ function _interopRequireDefault(obj) {
1656
+ return obj && obj.__esModule ? obj : { default: obj };
1657
+ }
1658
+ EAN_UPC.EAN13 = _EAN2.default;
1659
+ EAN_UPC.EAN8 = _EAN4.default;
1660
+ EAN_UPC.EAN5 = _EAN6.default;
1661
+ EAN_UPC.EAN2 = _EAN8.default;
1662
+ EAN_UPC.UPC = _UPC2.default;
1663
+ EAN_UPC.UPCE = _UPCE2.default;
1664
+ return EAN_UPC;
1665
+ }
1666
+ var ITF$1 = {};
1667
+ var ITF = {};
1668
+ var constants$1 = {};
1669
+ var hasRequiredConstants$1;
1670
+ function requireConstants$1() {
1671
+ if (hasRequiredConstants$1) return constants$1;
1672
+ hasRequiredConstants$1 = 1;
1673
+ Object.defineProperty(constants$1, "__esModule", {
1674
+ value: true
1675
+ });
1676
+ constants$1.START_BIN = "1010";
1677
+ constants$1.END_BIN = "11101";
1678
+ constants$1.BINARIES = ["00110", "10001", "01001", "11000", "00101", "10100", "01100", "00011", "10010", "01010"];
1679
+ return constants$1;
1680
+ }
1681
+ var hasRequiredITF$1;
1682
+ function requireITF$1() {
1683
+ if (hasRequiredITF$1) return ITF;
1684
+ hasRequiredITF$1 = 1;
1685
+ Object.defineProperty(ITF, "__esModule", {
1686
+ value: true
1687
+ });
1688
+ var _createClass = /* @__PURE__ */ (function() {
1689
+ function defineProperties(target, props) {
1690
+ for (var i = 0; i < props.length; i++) {
1691
+ var descriptor = props[i];
1692
+ descriptor.enumerable = descriptor.enumerable || false;
1693
+ descriptor.configurable = true;
1694
+ if ("value" in descriptor) descriptor.writable = true;
1695
+ Object.defineProperty(target, descriptor.key, descriptor);
1696
+ }
1697
+ }
1698
+ return function(Constructor, protoProps, staticProps) {
1699
+ if (protoProps) defineProperties(Constructor.prototype, protoProps);
1700
+ if (staticProps) defineProperties(Constructor, staticProps);
1701
+ return Constructor;
1702
+ };
1703
+ })();
1704
+ var _constants = requireConstants$1();
1705
+ var _Barcode2 = requireBarcode();
1706
+ var _Barcode3 = _interopRequireDefault(_Barcode2);
1707
+ function _interopRequireDefault(obj) {
1708
+ return obj && obj.__esModule ? obj : { default: obj };
1709
+ }
1710
+ function _classCallCheck(instance, Constructor) {
1711
+ if (!(instance instanceof Constructor)) {
1712
+ throw new TypeError("Cannot call a class as a function");
1713
+ }
1714
+ }
1715
+ function _possibleConstructorReturn(self, call) {
1716
+ if (!self) {
1717
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1718
+ }
1719
+ return call && (typeof call === "object" || typeof call === "function") ? call : self;
1720
+ }
1721
+ function _inherits(subClass, superClass) {
1722
+ if (typeof superClass !== "function" && superClass !== null) {
1723
+ throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
1724
+ }
1725
+ subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });
1726
+ if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
1727
+ }
1728
+ var ITF$12 = (function(_Barcode) {
1729
+ _inherits(ITF2, _Barcode);
1730
+ function ITF2() {
1731
+ _classCallCheck(this, ITF2);
1732
+ return _possibleConstructorReturn(this, (ITF2.__proto__ || Object.getPrototypeOf(ITF2)).apply(this, arguments));
1733
+ }
1734
+ _createClass(ITF2, [{
1735
+ key: "valid",
1736
+ value: function valid() {
1737
+ return this.data.search(/^([0-9]{2})+$/) !== -1;
1738
+ }
1739
+ }, {
1740
+ key: "encode",
1741
+ value: function encode() {
1742
+ var _this2 = this;
1743
+ var encoded = this.data.match(/.{2}/g).map(function(pair) {
1744
+ return _this2.encodePair(pair);
1745
+ }).join("");
1746
+ return {
1747
+ data: _constants.START_BIN + encoded + _constants.END_BIN,
1748
+ text: this.text
1749
+ };
1750
+ }
1751
+ // Calculate the data of a number pair
1752
+ }, {
1753
+ key: "encodePair",
1754
+ value: function encodePair(pair) {
1755
+ var second = _constants.BINARIES[pair[1]];
1756
+ return _constants.BINARIES[pair[0]].split("").map(function(first, idx) {
1757
+ return (first === "1" ? "111" : "1") + (second[idx] === "1" ? "000" : "0");
1758
+ }).join("");
1759
+ }
1760
+ }]);
1761
+ return ITF2;
1762
+ })(_Barcode3.default);
1763
+ ITF.default = ITF$12;
1764
+ return ITF;
1765
+ }
1766
+ var ITF14 = {};
1767
+ var hasRequiredITF14;
1768
+ function requireITF14() {
1769
+ if (hasRequiredITF14) return ITF14;
1770
+ hasRequiredITF14 = 1;
1771
+ Object.defineProperty(ITF14, "__esModule", {
1772
+ value: true
1773
+ });
1774
+ var _createClass = /* @__PURE__ */ (function() {
1775
+ function defineProperties(target, props) {
1776
+ for (var i = 0; i < props.length; i++) {
1777
+ var descriptor = props[i];
1778
+ descriptor.enumerable = descriptor.enumerable || false;
1779
+ descriptor.configurable = true;
1780
+ if ("value" in descriptor) descriptor.writable = true;
1781
+ Object.defineProperty(target, descriptor.key, descriptor);
1782
+ }
1783
+ }
1784
+ return function(Constructor, protoProps, staticProps) {
1785
+ if (protoProps) defineProperties(Constructor.prototype, protoProps);
1786
+ if (staticProps) defineProperties(Constructor, staticProps);
1787
+ return Constructor;
1788
+ };
1789
+ })();
1790
+ var _ITF2 = requireITF$1();
1791
+ var _ITF3 = _interopRequireDefault(_ITF2);
1792
+ function _interopRequireDefault(obj) {
1793
+ return obj && obj.__esModule ? obj : { default: obj };
1794
+ }
1795
+ function _classCallCheck(instance, Constructor) {
1796
+ if (!(instance instanceof Constructor)) {
1797
+ throw new TypeError("Cannot call a class as a function");
1798
+ }
1799
+ }
1800
+ function _possibleConstructorReturn(self, call) {
1801
+ if (!self) {
1802
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1803
+ }
1804
+ return call && (typeof call === "object" || typeof call === "function") ? call : self;
1805
+ }
1806
+ function _inherits(subClass, superClass) {
1807
+ if (typeof superClass !== "function" && superClass !== null) {
1808
+ throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
1809
+ }
1810
+ subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });
1811
+ if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
1812
+ }
1813
+ var checksum = function checksum2(data) {
1814
+ var res = data.substr(0, 13).split("").map(function(num) {
1815
+ return parseInt(num, 10);
1816
+ }).reduce(function(sum, n, idx) {
1817
+ return sum + n * (3 - idx % 2 * 2);
1818
+ }, 0);
1819
+ return Math.ceil(res / 10) * 10 - res;
1820
+ };
1821
+ var ITF14$1 = (function(_ITF) {
1822
+ _inherits(ITF142, _ITF);
1823
+ function ITF142(data, options) {
1824
+ _classCallCheck(this, ITF142);
1825
+ if (data.search(/^[0-9]{13}$/) !== -1) {
1826
+ data += checksum(data);
1827
+ }
1828
+ return _possibleConstructorReturn(this, (ITF142.__proto__ || Object.getPrototypeOf(ITF142)).call(this, data, options));
1829
+ }
1830
+ _createClass(ITF142, [{
1831
+ key: "valid",
1832
+ value: function valid() {
1833
+ return this.data.search(/^[0-9]{14}$/) !== -1 && +this.data[13] === checksum(this.data);
1834
+ }
1835
+ }]);
1836
+ return ITF142;
1837
+ })(_ITF3.default);
1838
+ ITF14.default = ITF14$1;
1839
+ return ITF14;
1840
+ }
1841
+ var hasRequiredITF;
1842
+ function requireITF() {
1843
+ if (hasRequiredITF) return ITF$1;
1844
+ hasRequiredITF = 1;
1845
+ Object.defineProperty(ITF$1, "__esModule", {
1846
+ value: true
1847
+ });
1848
+ ITF$1.ITF14 = ITF$1.ITF = void 0;
1849
+ var _ITF = requireITF$1();
1850
+ var _ITF2 = _interopRequireDefault(_ITF);
1851
+ var _ITF3 = requireITF14();
1852
+ var _ITF4 = _interopRequireDefault(_ITF3);
1853
+ function _interopRequireDefault(obj) {
1854
+ return obj && obj.__esModule ? obj : { default: obj };
1855
+ }
1856
+ ITF$1.ITF = _ITF2.default;
1857
+ ITF$1.ITF14 = _ITF4.default;
1858
+ return ITF$1;
1859
+ }
1860
+ var MSI$1 = {};
1861
+ var MSI = {};
1862
+ var hasRequiredMSI$1;
1863
+ function requireMSI$1() {
1864
+ if (hasRequiredMSI$1) return MSI;
1865
+ hasRequiredMSI$1 = 1;
1866
+ Object.defineProperty(MSI, "__esModule", {
1867
+ value: true
1868
+ });
1869
+ var _createClass = /* @__PURE__ */ (function() {
1870
+ function defineProperties(target, props) {
1871
+ for (var i = 0; i < props.length; i++) {
1872
+ var descriptor = props[i];
1873
+ descriptor.enumerable = descriptor.enumerable || false;
1874
+ descriptor.configurable = true;
1875
+ if ("value" in descriptor) descriptor.writable = true;
1876
+ Object.defineProperty(target, descriptor.key, descriptor);
1877
+ }
1878
+ }
1879
+ return function(Constructor, protoProps, staticProps) {
1880
+ if (protoProps) defineProperties(Constructor.prototype, protoProps);
1881
+ if (staticProps) defineProperties(Constructor, staticProps);
1882
+ return Constructor;
1883
+ };
1884
+ })();
1885
+ var _Barcode2 = requireBarcode();
1886
+ var _Barcode3 = _interopRequireDefault(_Barcode2);
1887
+ function _interopRequireDefault(obj) {
1888
+ return obj && obj.__esModule ? obj : { default: obj };
1889
+ }
1890
+ function _classCallCheck(instance, Constructor) {
1891
+ if (!(instance instanceof Constructor)) {
1892
+ throw new TypeError("Cannot call a class as a function");
1893
+ }
1894
+ }
1895
+ function _possibleConstructorReturn(self, call) {
1896
+ if (!self) {
1897
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1898
+ }
1899
+ return call && (typeof call === "object" || typeof call === "function") ? call : self;
1900
+ }
1901
+ function _inherits(subClass, superClass) {
1902
+ if (typeof superClass !== "function" && superClass !== null) {
1903
+ throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
1904
+ }
1905
+ subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });
1906
+ if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
1907
+ }
1908
+ var MSI$12 = (function(_Barcode) {
1909
+ _inherits(MSI2, _Barcode);
1910
+ function MSI2(data, options) {
1911
+ _classCallCheck(this, MSI2);
1912
+ return _possibleConstructorReturn(this, (MSI2.__proto__ || Object.getPrototypeOf(MSI2)).call(this, data, options));
1913
+ }
1914
+ _createClass(MSI2, [{
1915
+ key: "encode",
1916
+ value: function encode() {
1917
+ var ret = "110";
1918
+ for (var i = 0; i < this.data.length; i++) {
1919
+ var digit = parseInt(this.data[i]);
1920
+ var bin = digit.toString(2);
1921
+ bin = addZeroes(bin, 4 - bin.length);
1922
+ for (var b = 0; b < bin.length; b++) {
1923
+ ret += bin[b] == "0" ? "100" : "110";
1924
+ }
1925
+ }
1926
+ ret += "1001";
1927
+ return {
1928
+ data: ret,
1929
+ text: this.text
1930
+ };
1931
+ }
1932
+ }, {
1933
+ key: "valid",
1934
+ value: function valid() {
1935
+ return this.data.search(/^[0-9]+$/) !== -1;
1936
+ }
1937
+ }]);
1938
+ return MSI2;
1939
+ })(_Barcode3.default);
1940
+ function addZeroes(number, n) {
1941
+ for (var i = 0; i < n; i++) {
1942
+ number = "0" + number;
1943
+ }
1944
+ return number;
1945
+ }
1946
+ MSI.default = MSI$12;
1947
+ return MSI;
1948
+ }
1949
+ var MSI10 = {};
1950
+ var checksums = {};
1951
+ var hasRequiredChecksums;
1952
+ function requireChecksums() {
1953
+ if (hasRequiredChecksums) return checksums;
1954
+ hasRequiredChecksums = 1;
1955
+ Object.defineProperty(checksums, "__esModule", {
1956
+ value: true
1957
+ });
1958
+ checksums.mod10 = mod10;
1959
+ checksums.mod11 = mod11;
1960
+ function mod10(number) {
1961
+ var sum = 0;
1962
+ for (var i = 0; i < number.length; i++) {
1963
+ var n = parseInt(number[i]);
1964
+ if ((i + number.length) % 2 === 0) {
1965
+ sum += n;
1966
+ } else {
1967
+ sum += n * 2 % 10 + Math.floor(n * 2 / 10);
1968
+ }
1969
+ }
1970
+ return (10 - sum % 10) % 10;
1971
+ }
1972
+ function mod11(number) {
1973
+ var sum = 0;
1974
+ var weights = [2, 3, 4, 5, 6, 7];
1975
+ for (var i = 0; i < number.length; i++) {
1976
+ var n = parseInt(number[number.length - 1 - i]);
1977
+ sum += weights[i % weights.length] * n;
1978
+ }
1979
+ return (11 - sum % 11) % 11;
1980
+ }
1981
+ return checksums;
1982
+ }
1983
+ var hasRequiredMSI10;
1984
+ function requireMSI10() {
1985
+ if (hasRequiredMSI10) return MSI10;
1986
+ hasRequiredMSI10 = 1;
1987
+ Object.defineProperty(MSI10, "__esModule", {
1988
+ value: true
1989
+ });
1990
+ var _MSI2 = requireMSI$1();
1991
+ var _MSI3 = _interopRequireDefault(_MSI2);
1992
+ var _checksums = requireChecksums();
1993
+ function _interopRequireDefault(obj) {
1994
+ return obj && obj.__esModule ? obj : { default: obj };
1995
+ }
1996
+ function _classCallCheck(instance, Constructor) {
1997
+ if (!(instance instanceof Constructor)) {
1998
+ throw new TypeError("Cannot call a class as a function");
1999
+ }
2000
+ }
2001
+ function _possibleConstructorReturn(self, call) {
2002
+ if (!self) {
2003
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
2004
+ }
2005
+ return call && (typeof call === "object" || typeof call === "function") ? call : self;
2006
+ }
2007
+ function _inherits(subClass, superClass) {
2008
+ if (typeof superClass !== "function" && superClass !== null) {
2009
+ throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
2010
+ }
2011
+ subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });
2012
+ if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
2013
+ }
2014
+ var MSI10$1 = (function(_MSI) {
2015
+ _inherits(MSI102, _MSI);
2016
+ function MSI102(data, options) {
2017
+ _classCallCheck(this, MSI102);
2018
+ return _possibleConstructorReturn(this, (MSI102.__proto__ || Object.getPrototypeOf(MSI102)).call(this, data + (0, _checksums.mod10)(data), options));
2019
+ }
2020
+ return MSI102;
2021
+ })(_MSI3.default);
2022
+ MSI10.default = MSI10$1;
2023
+ return MSI10;
2024
+ }
2025
+ var MSI11 = {};
2026
+ var hasRequiredMSI11;
2027
+ function requireMSI11() {
2028
+ if (hasRequiredMSI11) return MSI11;
2029
+ hasRequiredMSI11 = 1;
2030
+ Object.defineProperty(MSI11, "__esModule", {
2031
+ value: true
2032
+ });
2033
+ var _MSI2 = requireMSI$1();
2034
+ var _MSI3 = _interopRequireDefault(_MSI2);
2035
+ var _checksums = requireChecksums();
2036
+ function _interopRequireDefault(obj) {
2037
+ return obj && obj.__esModule ? obj : { default: obj };
2038
+ }
2039
+ function _classCallCheck(instance, Constructor) {
2040
+ if (!(instance instanceof Constructor)) {
2041
+ throw new TypeError("Cannot call a class as a function");
2042
+ }
2043
+ }
2044
+ function _possibleConstructorReturn(self, call) {
2045
+ if (!self) {
2046
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
2047
+ }
2048
+ return call && (typeof call === "object" || typeof call === "function") ? call : self;
2049
+ }
2050
+ function _inherits(subClass, superClass) {
2051
+ if (typeof superClass !== "function" && superClass !== null) {
2052
+ throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
2053
+ }
2054
+ subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });
2055
+ if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
2056
+ }
2057
+ var MSI11$1 = (function(_MSI) {
2058
+ _inherits(MSI112, _MSI);
2059
+ function MSI112(data, options) {
2060
+ _classCallCheck(this, MSI112);
2061
+ return _possibleConstructorReturn(this, (MSI112.__proto__ || Object.getPrototypeOf(MSI112)).call(this, data + (0, _checksums.mod11)(data), options));
2062
+ }
2063
+ return MSI112;
2064
+ })(_MSI3.default);
2065
+ MSI11.default = MSI11$1;
2066
+ return MSI11;
2067
+ }
2068
+ var MSI1010 = {};
2069
+ var hasRequiredMSI1010;
2070
+ function requireMSI1010() {
2071
+ if (hasRequiredMSI1010) return MSI1010;
2072
+ hasRequiredMSI1010 = 1;
2073
+ Object.defineProperty(MSI1010, "__esModule", {
2074
+ value: true
2075
+ });
2076
+ var _MSI2 = requireMSI$1();
2077
+ var _MSI3 = _interopRequireDefault(_MSI2);
2078
+ var _checksums = requireChecksums();
2079
+ function _interopRequireDefault(obj) {
2080
+ return obj && obj.__esModule ? obj : { default: obj };
2081
+ }
2082
+ function _classCallCheck(instance, Constructor) {
2083
+ if (!(instance instanceof Constructor)) {
2084
+ throw new TypeError("Cannot call a class as a function");
2085
+ }
2086
+ }
2087
+ function _possibleConstructorReturn(self, call) {
2088
+ if (!self) {
2089
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
2090
+ }
2091
+ return call && (typeof call === "object" || typeof call === "function") ? call : self;
2092
+ }
2093
+ function _inherits(subClass, superClass) {
2094
+ if (typeof superClass !== "function" && superClass !== null) {
2095
+ throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
2096
+ }
2097
+ subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });
2098
+ if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
2099
+ }
2100
+ var MSI1010$1 = (function(_MSI) {
2101
+ _inherits(MSI10102, _MSI);
2102
+ function MSI10102(data, options) {
2103
+ _classCallCheck(this, MSI10102);
2104
+ data += (0, _checksums.mod10)(data);
2105
+ data += (0, _checksums.mod10)(data);
2106
+ return _possibleConstructorReturn(this, (MSI10102.__proto__ || Object.getPrototypeOf(MSI10102)).call(this, data, options));
2107
+ }
2108
+ return MSI10102;
2109
+ })(_MSI3.default);
2110
+ MSI1010.default = MSI1010$1;
2111
+ return MSI1010;
2112
+ }
2113
+ var MSI1110 = {};
2114
+ var hasRequiredMSI1110;
2115
+ function requireMSI1110() {
2116
+ if (hasRequiredMSI1110) return MSI1110;
2117
+ hasRequiredMSI1110 = 1;
2118
+ Object.defineProperty(MSI1110, "__esModule", {
2119
+ value: true
2120
+ });
2121
+ var _MSI2 = requireMSI$1();
2122
+ var _MSI3 = _interopRequireDefault(_MSI2);
2123
+ var _checksums = requireChecksums();
2124
+ function _interopRequireDefault(obj) {
2125
+ return obj && obj.__esModule ? obj : { default: obj };
2126
+ }
2127
+ function _classCallCheck(instance, Constructor) {
2128
+ if (!(instance instanceof Constructor)) {
2129
+ throw new TypeError("Cannot call a class as a function");
2130
+ }
2131
+ }
2132
+ function _possibleConstructorReturn(self, call) {
2133
+ if (!self) {
2134
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
2135
+ }
2136
+ return call && (typeof call === "object" || typeof call === "function") ? call : self;
2137
+ }
2138
+ function _inherits(subClass, superClass) {
2139
+ if (typeof superClass !== "function" && superClass !== null) {
2140
+ throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
2141
+ }
2142
+ subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });
2143
+ if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
2144
+ }
2145
+ var MSI1110$1 = (function(_MSI) {
2146
+ _inherits(MSI11102, _MSI);
2147
+ function MSI11102(data, options) {
2148
+ _classCallCheck(this, MSI11102);
2149
+ data += (0, _checksums.mod11)(data);
2150
+ data += (0, _checksums.mod10)(data);
2151
+ return _possibleConstructorReturn(this, (MSI11102.__proto__ || Object.getPrototypeOf(MSI11102)).call(this, data, options));
2152
+ }
2153
+ return MSI11102;
2154
+ })(_MSI3.default);
2155
+ MSI1110.default = MSI1110$1;
2156
+ return MSI1110;
2157
+ }
2158
+ var hasRequiredMSI;
2159
+ function requireMSI() {
2160
+ if (hasRequiredMSI) return MSI$1;
2161
+ hasRequiredMSI = 1;
2162
+ Object.defineProperty(MSI$1, "__esModule", {
2163
+ value: true
2164
+ });
2165
+ MSI$1.MSI1110 = MSI$1.MSI1010 = MSI$1.MSI11 = MSI$1.MSI10 = MSI$1.MSI = void 0;
2166
+ var _MSI = requireMSI$1();
2167
+ var _MSI2 = _interopRequireDefault(_MSI);
2168
+ var _MSI3 = requireMSI10();
2169
+ var _MSI4 = _interopRequireDefault(_MSI3);
2170
+ var _MSI5 = requireMSI11();
2171
+ var _MSI6 = _interopRequireDefault(_MSI5);
2172
+ var _MSI7 = requireMSI1010();
2173
+ var _MSI8 = _interopRequireDefault(_MSI7);
2174
+ var _MSI9 = requireMSI1110();
2175
+ var _MSI10 = _interopRequireDefault(_MSI9);
2176
+ function _interopRequireDefault(obj) {
2177
+ return obj && obj.__esModule ? obj : { default: obj };
2178
+ }
2179
+ MSI$1.MSI = _MSI2.default;
2180
+ MSI$1.MSI10 = _MSI4.default;
2181
+ MSI$1.MSI11 = _MSI6.default;
2182
+ MSI$1.MSI1010 = _MSI8.default;
2183
+ MSI$1.MSI1110 = _MSI10.default;
2184
+ return MSI$1;
2185
+ }
2186
+ var pharmacode = {};
2187
+ var hasRequiredPharmacode;
2188
+ function requirePharmacode() {
2189
+ if (hasRequiredPharmacode) return pharmacode;
2190
+ hasRequiredPharmacode = 1;
2191
+ Object.defineProperty(pharmacode, "__esModule", {
2192
+ value: true
2193
+ });
2194
+ pharmacode.pharmacode = void 0;
2195
+ var _createClass = /* @__PURE__ */ (function() {
2196
+ function defineProperties(target, props) {
2197
+ for (var i = 0; i < props.length; i++) {
2198
+ var descriptor = props[i];
2199
+ descriptor.enumerable = descriptor.enumerable || false;
2200
+ descriptor.configurable = true;
2201
+ if ("value" in descriptor) descriptor.writable = true;
2202
+ Object.defineProperty(target, descriptor.key, descriptor);
2203
+ }
2204
+ }
2205
+ return function(Constructor, protoProps, staticProps) {
2206
+ if (protoProps) defineProperties(Constructor.prototype, protoProps);
2207
+ if (staticProps) defineProperties(Constructor, staticProps);
2208
+ return Constructor;
2209
+ };
2210
+ })();
2211
+ var _Barcode2 = requireBarcode();
2212
+ var _Barcode3 = _interopRequireDefault(_Barcode2);
2213
+ function _interopRequireDefault(obj) {
2214
+ return obj && obj.__esModule ? obj : { default: obj };
2215
+ }
2216
+ function _classCallCheck(instance, Constructor) {
2217
+ if (!(instance instanceof Constructor)) {
2218
+ throw new TypeError("Cannot call a class as a function");
2219
+ }
2220
+ }
2221
+ function _possibleConstructorReturn(self, call) {
2222
+ if (!self) {
2223
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
2224
+ }
2225
+ return call && (typeof call === "object" || typeof call === "function") ? call : self;
2226
+ }
2227
+ function _inherits(subClass, superClass) {
2228
+ if (typeof superClass !== "function" && superClass !== null) {
2229
+ throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
2230
+ }
2231
+ subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });
2232
+ if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
2233
+ }
2234
+ var pharmacode$1 = (function(_Barcode) {
2235
+ _inherits(pharmacode2, _Barcode);
2236
+ function pharmacode2(data, options) {
2237
+ _classCallCheck(this, pharmacode2);
2238
+ var _this = _possibleConstructorReturn(this, (pharmacode2.__proto__ || Object.getPrototypeOf(pharmacode2)).call(this, data, options));
2239
+ _this.number = parseInt(data, 10);
2240
+ return _this;
2241
+ }
2242
+ _createClass(pharmacode2, [{
2243
+ key: "encode",
2244
+ value: function encode() {
2245
+ var z = this.number;
2246
+ var result = "";
2247
+ while (!isNaN(z) && z != 0) {
2248
+ if (z % 2 === 0) {
2249
+ result = "11100" + result;
2250
+ z = (z - 2) / 2;
2251
+ } else {
2252
+ result = "100" + result;
2253
+ z = (z - 1) / 2;
2254
+ }
2255
+ }
2256
+ result = result.slice(0, -2);
2257
+ return {
2258
+ data: result,
2259
+ text: this.text
2260
+ };
2261
+ }
2262
+ }, {
2263
+ key: "valid",
2264
+ value: function valid() {
2265
+ return this.number >= 3 && this.number <= 131070;
2266
+ }
2267
+ }]);
2268
+ return pharmacode2;
2269
+ })(_Barcode3.default);
2270
+ pharmacode.pharmacode = pharmacode$1;
2271
+ return pharmacode;
2272
+ }
2273
+ var codabar = {};
2274
+ var hasRequiredCodabar;
2275
+ function requireCodabar() {
2276
+ if (hasRequiredCodabar) return codabar;
2277
+ hasRequiredCodabar = 1;
2278
+ Object.defineProperty(codabar, "__esModule", {
2279
+ value: true
2280
+ });
2281
+ codabar.codabar = void 0;
2282
+ var _createClass = /* @__PURE__ */ (function() {
2283
+ function defineProperties(target, props) {
2284
+ for (var i = 0; i < props.length; i++) {
2285
+ var descriptor = props[i];
2286
+ descriptor.enumerable = descriptor.enumerable || false;
2287
+ descriptor.configurable = true;
2288
+ if ("value" in descriptor) descriptor.writable = true;
2289
+ Object.defineProperty(target, descriptor.key, descriptor);
2290
+ }
2291
+ }
2292
+ return function(Constructor, protoProps, staticProps) {
2293
+ if (protoProps) defineProperties(Constructor.prototype, protoProps);
2294
+ if (staticProps) defineProperties(Constructor, staticProps);
2295
+ return Constructor;
2296
+ };
2297
+ })();
2298
+ var _Barcode2 = requireBarcode();
2299
+ var _Barcode3 = _interopRequireDefault(_Barcode2);
2300
+ function _interopRequireDefault(obj) {
2301
+ return obj && obj.__esModule ? obj : { default: obj };
2302
+ }
2303
+ function _classCallCheck(instance, Constructor) {
2304
+ if (!(instance instanceof Constructor)) {
2305
+ throw new TypeError("Cannot call a class as a function");
2306
+ }
2307
+ }
2308
+ function _possibleConstructorReturn(self, call) {
2309
+ if (!self) {
2310
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
2311
+ }
2312
+ return call && (typeof call === "object" || typeof call === "function") ? call : self;
2313
+ }
2314
+ function _inherits(subClass, superClass) {
2315
+ if (typeof superClass !== "function" && superClass !== null) {
2316
+ throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
2317
+ }
2318
+ subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });
2319
+ if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
2320
+ }
2321
+ var codabar$1 = (function(_Barcode) {
2322
+ _inherits(codabar2, _Barcode);
2323
+ function codabar2(data, options) {
2324
+ _classCallCheck(this, codabar2);
2325
+ if (data.search(/^[0-9\-\$\:\.\+\/]+$/) === 0) {
2326
+ data = "A" + data + "A";
2327
+ }
2328
+ var _this = _possibleConstructorReturn(this, (codabar2.__proto__ || Object.getPrototypeOf(codabar2)).call(this, data.toUpperCase(), options));
2329
+ _this.text = _this.options.text || _this.text.replace(/[A-D]/g, "");
2330
+ return _this;
2331
+ }
2332
+ _createClass(codabar2, [{
2333
+ key: "valid",
2334
+ value: function valid() {
2335
+ return this.data.search(/^[A-D][0-9\-\$\:\.\+\/]+[A-D]$/) !== -1;
2336
+ }
2337
+ }, {
2338
+ key: "encode",
2339
+ value: function encode() {
2340
+ var result = [];
2341
+ var encodings = this.getEncodings();
2342
+ for (var i = 0; i < this.data.length; i++) {
2343
+ result.push(encodings[this.data.charAt(i)]);
2344
+ if (i !== this.data.length - 1) {
2345
+ result.push("0");
2346
+ }
2347
+ }
2348
+ return {
2349
+ text: this.text,
2350
+ data: result.join("")
2351
+ };
2352
+ }
2353
+ }, {
2354
+ key: "getEncodings",
2355
+ value: function getEncodings() {
2356
+ return {
2357
+ "0": "101010011",
2358
+ "1": "101011001",
2359
+ "2": "101001011",
2360
+ "3": "110010101",
2361
+ "4": "101101001",
2362
+ "5": "110101001",
2363
+ "6": "100101011",
2364
+ "7": "100101101",
2365
+ "8": "100110101",
2366
+ "9": "110100101",
2367
+ "-": "101001101",
2368
+ "$": "101100101",
2369
+ ":": "1101011011",
2370
+ "/": "1101101011",
2371
+ ".": "1101101101",
2372
+ "+": "1011011011",
2373
+ "A": "1011001001",
2374
+ "B": "1001001011",
2375
+ "C": "1010010011",
2376
+ "D": "1010011001"
2377
+ };
2378
+ }
2379
+ }]);
2380
+ return codabar2;
2381
+ })(_Barcode3.default);
2382
+ codabar.codabar = codabar$1;
2383
+ return codabar;
2384
+ }
2385
+ var CODE93$1 = {};
2386
+ var CODE93 = {};
2387
+ var constants = {};
2388
+ var hasRequiredConstants;
2389
+ function requireConstants() {
2390
+ if (hasRequiredConstants) return constants;
2391
+ hasRequiredConstants = 1;
2392
+ Object.defineProperty(constants, "__esModule", {
2393
+ value: true
2394
+ });
2395
+ constants.SYMBOLS = [
2396
+ "0",
2397
+ "1",
2398
+ "2",
2399
+ "3",
2400
+ "4",
2401
+ "5",
2402
+ "6",
2403
+ "7",
2404
+ "8",
2405
+ "9",
2406
+ "A",
2407
+ "B",
2408
+ "C",
2409
+ "D",
2410
+ "E",
2411
+ "F",
2412
+ "G",
2413
+ "H",
2414
+ "I",
2415
+ "J",
2416
+ "K",
2417
+ "L",
2418
+ "M",
2419
+ "N",
2420
+ "O",
2421
+ "P",
2422
+ "Q",
2423
+ "R",
2424
+ "S",
2425
+ "T",
2426
+ "U",
2427
+ "V",
2428
+ "W",
2429
+ "X",
2430
+ "Y",
2431
+ "Z",
2432
+ "-",
2433
+ ".",
2434
+ " ",
2435
+ "$",
2436
+ "/",
2437
+ "+",
2438
+ "%",
2439
+ // Only used for csum and multi-symbols character encodings
2440
+ "($)",
2441
+ "(%)",
2442
+ "(/)",
2443
+ "(+)",
2444
+ // Start/Stop
2445
+ "ÿ"
2446
+ ];
2447
+ constants.BINARIES = ["100010100", "101001000", "101000100", "101000010", "100101000", "100100100", "100100010", "101010000", "100010010", "100001010", "110101000", "110100100", "110100010", "110010100", "110010010", "110001010", "101101000", "101100100", "101100010", "100110100", "100011010", "101011000", "101001100", "101000110", "100101100", "100010110", "110110100", "110110010", "110101100", "110100110", "110010110", "110011010", "101101100", "101100110", "100110110", "100111010", "100101110", "111010100", "111010010", "111001010", "101101110", "101110110", "110101110", "100100110", "111011010", "111010110", "100110010", "101011110"];
2448
+ constants.MULTI_SYMBOLS = {
2449
+ "\0": ["(%)", "U"],
2450
+ "": ["($)", "A"],
2451
+ "": ["($)", "B"],
2452
+ "": ["($)", "C"],
2453
+ "": ["($)", "D"],
2454
+ "": ["($)", "E"],
2455
+ "": ["($)", "F"],
2456
+ "\x07": ["($)", "G"],
2457
+ "\b": ["($)", "H"],
2458
+ " ": ["($)", "I"],
2459
+ "\n": ["($)", "J"],
2460
+ "\v": ["($)", "K"],
2461
+ "\f": ["($)", "L"],
2462
+ "\r": ["($)", "M"],
2463
+ "": ["($)", "N"],
2464
+ "": ["($)", "O"],
2465
+ "": ["($)", "P"],
2466
+ "": ["($)", "Q"],
2467
+ "": ["($)", "R"],
2468
+ "": ["($)", "S"],
2469
+ "": ["($)", "T"],
2470
+ "": ["($)", "U"],
2471
+ "": ["($)", "V"],
2472
+ "": ["($)", "W"],
2473
+ "": ["($)", "X"],
2474
+ "": ["($)", "Y"],
2475
+ "": ["($)", "Z"],
2476
+ "\x1B": ["(%)", "A"],
2477
+ "": ["(%)", "B"],
2478
+ "": ["(%)", "C"],
2479
+ "": ["(%)", "D"],
2480
+ "": ["(%)", "E"],
2481
+ "!": ["(/)", "A"],
2482
+ '"': ["(/)", "B"],
2483
+ "#": ["(/)", "C"],
2484
+ "&": ["(/)", "F"],
2485
+ "'": ["(/)", "G"],
2486
+ "(": ["(/)", "H"],
2487
+ ")": ["(/)", "I"],
2488
+ "*": ["(/)", "J"],
2489
+ ",": ["(/)", "L"],
2490
+ ":": ["(/)", "Z"],
2491
+ ";": ["(%)", "F"],
2492
+ "<": ["(%)", "G"],
2493
+ "=": ["(%)", "H"],
2494
+ ">": ["(%)", "I"],
2495
+ "?": ["(%)", "J"],
2496
+ "@": ["(%)", "V"],
2497
+ "[": ["(%)", "K"],
2498
+ "\\": ["(%)", "L"],
2499
+ "]": ["(%)", "M"],
2500
+ "^": ["(%)", "N"],
2501
+ "_": ["(%)", "O"],
2502
+ "`": ["(%)", "W"],
2503
+ "a": ["(+)", "A"],
2504
+ "b": ["(+)", "B"],
2505
+ "c": ["(+)", "C"],
2506
+ "d": ["(+)", "D"],
2507
+ "e": ["(+)", "E"],
2508
+ "f": ["(+)", "F"],
2509
+ "g": ["(+)", "G"],
2510
+ "h": ["(+)", "H"],
2511
+ "i": ["(+)", "I"],
2512
+ "j": ["(+)", "J"],
2513
+ "k": ["(+)", "K"],
2514
+ "l": ["(+)", "L"],
2515
+ "m": ["(+)", "M"],
2516
+ "n": ["(+)", "N"],
2517
+ "o": ["(+)", "O"],
2518
+ "p": ["(+)", "P"],
2519
+ "q": ["(+)", "Q"],
2520
+ "r": ["(+)", "R"],
2521
+ "s": ["(+)", "S"],
2522
+ "t": ["(+)", "T"],
2523
+ "u": ["(+)", "U"],
2524
+ "v": ["(+)", "V"],
2525
+ "w": ["(+)", "W"],
2526
+ "x": ["(+)", "X"],
2527
+ "y": ["(+)", "Y"],
2528
+ "z": ["(+)", "Z"],
2529
+ "{": ["(%)", "P"],
2530
+ "|": ["(%)", "Q"],
2531
+ "}": ["(%)", "R"],
2532
+ "~": ["(%)", "S"],
2533
+ "": ["(%)", "T"]
2534
+ };
2535
+ return constants;
2536
+ }
2537
+ var hasRequiredCODE93$1;
2538
+ function requireCODE93$1() {
2539
+ if (hasRequiredCODE93$1) return CODE93;
2540
+ hasRequiredCODE93$1 = 1;
2541
+ Object.defineProperty(CODE93, "__esModule", {
2542
+ value: true
2543
+ });
2544
+ var _createClass = /* @__PURE__ */ (function() {
2545
+ function defineProperties(target, props) {
2546
+ for (var i = 0; i < props.length; i++) {
2547
+ var descriptor = props[i];
2548
+ descriptor.enumerable = descriptor.enumerable || false;
2549
+ descriptor.configurable = true;
2550
+ if ("value" in descriptor) descriptor.writable = true;
2551
+ Object.defineProperty(target, descriptor.key, descriptor);
2552
+ }
2553
+ }
2554
+ return function(Constructor, protoProps, staticProps) {
2555
+ if (protoProps) defineProperties(Constructor.prototype, protoProps);
2556
+ if (staticProps) defineProperties(Constructor, staticProps);
2557
+ return Constructor;
2558
+ };
2559
+ })();
2560
+ var _constants = requireConstants();
2561
+ var _Barcode2 = requireBarcode();
2562
+ var _Barcode3 = _interopRequireDefault(_Barcode2);
2563
+ function _interopRequireDefault(obj) {
2564
+ return obj && obj.__esModule ? obj : { default: obj };
2565
+ }
2566
+ function _classCallCheck(instance, Constructor) {
2567
+ if (!(instance instanceof Constructor)) {
2568
+ throw new TypeError("Cannot call a class as a function");
2569
+ }
2570
+ }
2571
+ function _possibleConstructorReturn(self, call) {
2572
+ if (!self) {
2573
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
2574
+ }
2575
+ return call && (typeof call === "object" || typeof call === "function") ? call : self;
2576
+ }
2577
+ function _inherits(subClass, superClass) {
2578
+ if (typeof superClass !== "function" && superClass !== null) {
2579
+ throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
2580
+ }
2581
+ subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });
2582
+ if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
2583
+ }
2584
+ var CODE93$12 = (function(_Barcode) {
2585
+ _inherits(CODE932, _Barcode);
2586
+ function CODE932(data, options) {
2587
+ _classCallCheck(this, CODE932);
2588
+ return _possibleConstructorReturn(this, (CODE932.__proto__ || Object.getPrototypeOf(CODE932)).call(this, data, options));
2589
+ }
2590
+ _createClass(CODE932, [{
2591
+ key: "valid",
2592
+ value: function valid() {
2593
+ return /^[0-9A-Z\-. $/+%]+$/.test(this.data);
2594
+ }
2595
+ }, {
2596
+ key: "encode",
2597
+ value: function encode() {
2598
+ var symbols = this.data.split("").flatMap(function(c) {
2599
+ return _constants.MULTI_SYMBOLS[c] || c;
2600
+ });
2601
+ var encoded = symbols.map(function(s) {
2602
+ return CODE932.getEncoding(s);
2603
+ }).join("");
2604
+ var csumC = CODE932.checksum(symbols, 20);
2605
+ var csumK = CODE932.checksum(symbols.concat(csumC), 15);
2606
+ return {
2607
+ text: this.text,
2608
+ data: (
2609
+ // Add the start bits
2610
+ CODE932.getEncoding("ÿ") + // Add the encoded bits
2611
+ encoded + // Add the checksum
2612
+ CODE932.getEncoding(csumC) + CODE932.getEncoding(csumK) + // Add the stop bits
2613
+ CODE932.getEncoding("ÿ") + // Add the termination bit
2614
+ "1"
2615
+ )
2616
+ };
2617
+ }
2618
+ // Get the binary encoding of a symbol
2619
+ }], [{
2620
+ key: "getEncoding",
2621
+ value: function getEncoding(symbol) {
2622
+ return _constants.BINARIES[CODE932.symbolValue(symbol)];
2623
+ }
2624
+ // Get the symbol for a symbol value
2625
+ }, {
2626
+ key: "getSymbol",
2627
+ value: function getSymbol(symbolValue) {
2628
+ return _constants.SYMBOLS[symbolValue];
2629
+ }
2630
+ // Get the symbol value of a symbol
2631
+ }, {
2632
+ key: "symbolValue",
2633
+ value: function symbolValue(symbol) {
2634
+ return _constants.SYMBOLS.indexOf(symbol);
2635
+ }
2636
+ // Calculate a checksum symbol
2637
+ }, {
2638
+ key: "checksum",
2639
+ value: function checksum(symbols, maxWeight) {
2640
+ var csum = symbols.slice().reverse().reduce(function(sum, symbol, idx) {
2641
+ var weight = idx % maxWeight + 1;
2642
+ return sum + CODE932.symbolValue(symbol) * weight;
2643
+ }, 0);
2644
+ return CODE932.getSymbol(csum % 47);
2645
+ }
2646
+ }]);
2647
+ return CODE932;
2648
+ })(_Barcode3.default);
2649
+ CODE93.default = CODE93$12;
2650
+ return CODE93;
2651
+ }
2652
+ var CODE93FullASCII = {};
2653
+ var hasRequiredCODE93FullASCII;
2654
+ function requireCODE93FullASCII() {
2655
+ if (hasRequiredCODE93FullASCII) return CODE93FullASCII;
2656
+ hasRequiredCODE93FullASCII = 1;
2657
+ Object.defineProperty(CODE93FullASCII, "__esModule", {
2658
+ value: true
2659
+ });
2660
+ var _createClass = /* @__PURE__ */ (function() {
2661
+ function defineProperties(target, props) {
2662
+ for (var i = 0; i < props.length; i++) {
2663
+ var descriptor = props[i];
2664
+ descriptor.enumerable = descriptor.enumerable || false;
2665
+ descriptor.configurable = true;
2666
+ if ("value" in descriptor) descriptor.writable = true;
2667
+ Object.defineProperty(target, descriptor.key, descriptor);
2668
+ }
2669
+ }
2670
+ return function(Constructor, protoProps, staticProps) {
2671
+ if (protoProps) defineProperties(Constructor.prototype, protoProps);
2672
+ if (staticProps) defineProperties(Constructor, staticProps);
2673
+ return Constructor;
2674
+ };
2675
+ })();
2676
+ var _CODE2 = requireCODE93$1();
2677
+ var _CODE3 = _interopRequireDefault(_CODE2);
2678
+ function _interopRequireDefault(obj) {
2679
+ return obj && obj.__esModule ? obj : { default: obj };
2680
+ }
2681
+ function _classCallCheck(instance, Constructor) {
2682
+ if (!(instance instanceof Constructor)) {
2683
+ throw new TypeError("Cannot call a class as a function");
2684
+ }
2685
+ }
2686
+ function _possibleConstructorReturn(self, call) {
2687
+ if (!self) {
2688
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
2689
+ }
2690
+ return call && (typeof call === "object" || typeof call === "function") ? call : self;
2691
+ }
2692
+ function _inherits(subClass, superClass) {
2693
+ if (typeof superClass !== "function" && superClass !== null) {
2694
+ throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
2695
+ }
2696
+ subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });
2697
+ if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
2698
+ }
2699
+ var CODE93FullASCII$1 = (function(_CODE) {
2700
+ _inherits(CODE93FullASCII2, _CODE);
2701
+ function CODE93FullASCII2(data, options) {
2702
+ _classCallCheck(this, CODE93FullASCII2);
2703
+ return _possibleConstructorReturn(this, (CODE93FullASCII2.__proto__ || Object.getPrototypeOf(CODE93FullASCII2)).call(this, data, options));
2704
+ }
2705
+ _createClass(CODE93FullASCII2, [{
2706
+ key: "valid",
2707
+ value: function valid() {
2708
+ return /^[\x00-\x7f]+$/.test(this.data);
2709
+ }
2710
+ }]);
2711
+ return CODE93FullASCII2;
2712
+ })(_CODE3.default);
2713
+ CODE93FullASCII.default = CODE93FullASCII$1;
2714
+ return CODE93FullASCII;
2715
+ }
2716
+ var hasRequiredCODE93;
2717
+ function requireCODE93() {
2718
+ if (hasRequiredCODE93) return CODE93$1;
2719
+ hasRequiredCODE93 = 1;
2720
+ Object.defineProperty(CODE93$1, "__esModule", {
2721
+ value: true
2722
+ });
2723
+ CODE93$1.CODE93FullASCII = CODE93$1.CODE93 = void 0;
2724
+ var _CODE = requireCODE93$1();
2725
+ var _CODE2 = _interopRequireDefault(_CODE);
2726
+ var _CODE93FullASCII = requireCODE93FullASCII();
2727
+ var _CODE93FullASCII2 = _interopRequireDefault(_CODE93FullASCII);
2728
+ function _interopRequireDefault(obj) {
2729
+ return obj && obj.__esModule ? obj : { default: obj };
2730
+ }
2731
+ CODE93$1.CODE93 = _CODE2.default;
2732
+ CODE93$1.CODE93FullASCII = _CODE93FullASCII2.default;
2733
+ return CODE93$1;
2734
+ }
2735
+ var GenericBarcode = {};
2736
+ var hasRequiredGenericBarcode;
2737
+ function requireGenericBarcode() {
2738
+ if (hasRequiredGenericBarcode) return GenericBarcode;
2739
+ hasRequiredGenericBarcode = 1;
2740
+ Object.defineProperty(GenericBarcode, "__esModule", {
2741
+ value: true
2742
+ });
2743
+ GenericBarcode.GenericBarcode = void 0;
2744
+ var _createClass = /* @__PURE__ */ (function() {
2745
+ function defineProperties(target, props) {
2746
+ for (var i = 0; i < props.length; i++) {
2747
+ var descriptor = props[i];
2748
+ descriptor.enumerable = descriptor.enumerable || false;
2749
+ descriptor.configurable = true;
2750
+ if ("value" in descriptor) descriptor.writable = true;
2751
+ Object.defineProperty(target, descriptor.key, descriptor);
2752
+ }
2753
+ }
2754
+ return function(Constructor, protoProps, staticProps) {
2755
+ if (protoProps) defineProperties(Constructor.prototype, protoProps);
2756
+ if (staticProps) defineProperties(Constructor, staticProps);
2757
+ return Constructor;
2758
+ };
2759
+ })();
2760
+ var _Barcode2 = requireBarcode();
2761
+ var _Barcode3 = _interopRequireDefault(_Barcode2);
2762
+ function _interopRequireDefault(obj) {
2763
+ return obj && obj.__esModule ? obj : { default: obj };
2764
+ }
2765
+ function _classCallCheck(instance, Constructor) {
2766
+ if (!(instance instanceof Constructor)) {
2767
+ throw new TypeError("Cannot call a class as a function");
2768
+ }
2769
+ }
2770
+ function _possibleConstructorReturn(self, call) {
2771
+ if (!self) {
2772
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
2773
+ }
2774
+ return call && (typeof call === "object" || typeof call === "function") ? call : self;
2775
+ }
2776
+ function _inherits(subClass, superClass) {
2777
+ if (typeof superClass !== "function" && superClass !== null) {
2778
+ throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
2779
+ }
2780
+ subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });
2781
+ if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
2782
+ }
2783
+ var GenericBarcode$1 = (function(_Barcode) {
2784
+ _inherits(GenericBarcode2, _Barcode);
2785
+ function GenericBarcode2(data, options) {
2786
+ _classCallCheck(this, GenericBarcode2);
2787
+ return _possibleConstructorReturn(this, (GenericBarcode2.__proto__ || Object.getPrototypeOf(GenericBarcode2)).call(this, data, options));
2788
+ }
2789
+ _createClass(GenericBarcode2, [{
2790
+ key: "encode",
2791
+ value: function encode() {
2792
+ return {
2793
+ data: "10101010101010101010101010101010101010101",
2794
+ text: this.text
2795
+ };
2796
+ }
2797
+ // Resturn true/false if the string provided is valid for this encoder
2798
+ }, {
2799
+ key: "valid",
2800
+ value: function valid() {
2801
+ return true;
2802
+ }
2803
+ }]);
2804
+ return GenericBarcode2;
2805
+ })(_Barcode3.default);
2806
+ GenericBarcode.GenericBarcode = GenericBarcode$1;
2807
+ return GenericBarcode;
2808
+ }
2809
+ var hasRequiredBarcodes;
2810
+ function requireBarcodes() {
2811
+ if (hasRequiredBarcodes) return barcodes;
2812
+ hasRequiredBarcodes = 1;
2813
+ Object.defineProperty(barcodes, "__esModule", {
2814
+ value: true
2815
+ });
2816
+ var _CODE = requireCODE39();
2817
+ var _CODE2 = requireCODE128();
2818
+ var _EAN_UPC = requireEAN_UPC();
2819
+ var _ITF = requireITF();
2820
+ var _MSI = requireMSI();
2821
+ var _pharmacode = requirePharmacode();
2822
+ var _codabar = requireCodabar();
2823
+ var _CODE3 = requireCODE93();
2824
+ var _GenericBarcode = requireGenericBarcode();
2825
+ barcodes.default = {
2826
+ CODE39: _CODE.CODE39,
2827
+ CODE128: _CODE2.CODE128,
2828
+ CODE128A: _CODE2.CODE128A,
2829
+ CODE128B: _CODE2.CODE128B,
2830
+ CODE128C: _CODE2.CODE128C,
2831
+ EAN13: _EAN_UPC.EAN13,
2832
+ EAN8: _EAN_UPC.EAN8,
2833
+ EAN5: _EAN_UPC.EAN5,
2834
+ EAN2: _EAN_UPC.EAN2,
2835
+ UPC: _EAN_UPC.UPC,
2836
+ UPCE: _EAN_UPC.UPCE,
2837
+ ITF14: _ITF.ITF14,
2838
+ ITF: _ITF.ITF,
2839
+ MSI: _MSI.MSI,
2840
+ MSI10: _MSI.MSI10,
2841
+ MSI11: _MSI.MSI11,
2842
+ MSI1010: _MSI.MSI1010,
2843
+ MSI1110: _MSI.MSI1110,
2844
+ pharmacode: _pharmacode.pharmacode,
2845
+ codabar: _codabar.codabar,
2846
+ CODE93: _CODE3.CODE93,
2847
+ CODE93FullASCII: _CODE3.CODE93FullASCII,
2848
+ GenericBarcode: _GenericBarcode.GenericBarcode
2849
+ };
2850
+ return barcodes;
2851
+ }
2852
+ var merge = {};
2853
+ var hasRequiredMerge;
2854
+ function requireMerge() {
2855
+ if (hasRequiredMerge) return merge;
2856
+ hasRequiredMerge = 1;
2857
+ Object.defineProperty(merge, "__esModule", {
2858
+ value: true
2859
+ });
2860
+ var _extends = Object.assign || function(target) {
2861
+ for (var i = 1; i < arguments.length; i++) {
2862
+ var source = arguments[i];
2863
+ for (var key in source) {
2864
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
2865
+ target[key] = source[key];
2866
+ }
2867
+ }
2868
+ }
2869
+ return target;
2870
+ };
2871
+ merge.default = function(old, replaceObj) {
2872
+ return _extends({}, old, replaceObj);
2873
+ };
2874
+ return merge;
2875
+ }
2876
+ var linearizeEncodings = {};
2877
+ var hasRequiredLinearizeEncodings;
2878
+ function requireLinearizeEncodings() {
2879
+ if (hasRequiredLinearizeEncodings) return linearizeEncodings;
2880
+ hasRequiredLinearizeEncodings = 1;
2881
+ Object.defineProperty(linearizeEncodings, "__esModule", {
2882
+ value: true
2883
+ });
2884
+ linearizeEncodings.default = linearizeEncodings$1;
2885
+ function linearizeEncodings$1(encodings) {
2886
+ var linearEncodings = [];
2887
+ function nextLevel(encoded) {
2888
+ if (Array.isArray(encoded)) {
2889
+ for (var i = 0; i < encoded.length; i++) {
2890
+ nextLevel(encoded[i]);
2891
+ }
2892
+ } else {
2893
+ encoded.text = encoded.text || "";
2894
+ encoded.data = encoded.data || "";
2895
+ linearEncodings.push(encoded);
2896
+ }
2897
+ }
2898
+ nextLevel(encodings);
2899
+ return linearEncodings;
2900
+ }
2901
+ return linearizeEncodings;
2902
+ }
2903
+ var fixOptions = {};
2904
+ var hasRequiredFixOptions;
2905
+ function requireFixOptions() {
2906
+ if (hasRequiredFixOptions) return fixOptions;
2907
+ hasRequiredFixOptions = 1;
2908
+ Object.defineProperty(fixOptions, "__esModule", {
2909
+ value: true
2910
+ });
2911
+ fixOptions.default = fixOptions$1;
2912
+ function fixOptions$1(options) {
2913
+ options.marginTop = options.marginTop || options.margin;
2914
+ options.marginBottom = options.marginBottom || options.margin;
2915
+ options.marginRight = options.marginRight || options.margin;
2916
+ options.marginLeft = options.marginLeft || options.margin;
2917
+ return options;
2918
+ }
2919
+ return fixOptions;
2920
+ }
2921
+ var getRenderProperties = {};
2922
+ var getOptionsFromElement = {};
2923
+ var optionsFromStrings = {};
2924
+ var hasRequiredOptionsFromStrings;
2925
+ function requireOptionsFromStrings() {
2926
+ if (hasRequiredOptionsFromStrings) return optionsFromStrings;
2927
+ hasRequiredOptionsFromStrings = 1;
2928
+ Object.defineProperty(optionsFromStrings, "__esModule", {
2929
+ value: true
2930
+ });
2931
+ optionsFromStrings.default = optionsFromStrings$1;
2932
+ function optionsFromStrings$1(options) {
2933
+ var intOptions = ["width", "height", "textMargin", "fontSize", "margin", "marginTop", "marginBottom", "marginLeft", "marginRight"];
2934
+ for (var intOption in intOptions) {
2935
+ if (intOptions.hasOwnProperty(intOption)) {
2936
+ intOption = intOptions[intOption];
2937
+ if (typeof options[intOption] === "string") {
2938
+ options[intOption] = parseInt(options[intOption], 10);
2939
+ }
2940
+ }
2941
+ }
2942
+ if (typeof options["displayValue"] === "string") {
2943
+ options["displayValue"] = options["displayValue"] != "false";
2944
+ }
2945
+ return options;
2946
+ }
2947
+ return optionsFromStrings;
2948
+ }
2949
+ var defaults = {};
2950
+ var hasRequiredDefaults;
2951
+ function requireDefaults() {
2952
+ if (hasRequiredDefaults) return defaults;
2953
+ hasRequiredDefaults = 1;
2954
+ Object.defineProperty(defaults, "__esModule", {
2955
+ value: true
2956
+ });
2957
+ var defaults$1 = {
2958
+ width: 2,
2959
+ height: 100,
2960
+ format: "auto",
2961
+ displayValue: true,
2962
+ fontOptions: "",
2963
+ font: "monospace",
2964
+ text: void 0,
2965
+ textAlign: "center",
2966
+ textPosition: "bottom",
2967
+ textMargin: 2,
2968
+ fontSize: 20,
2969
+ background: "#ffffff",
2970
+ lineColor: "#000000",
2971
+ margin: 10,
2972
+ marginTop: void 0,
2973
+ marginBottom: void 0,
2974
+ marginLeft: void 0,
2975
+ marginRight: void 0,
2976
+ valid: function valid() {
2977
+ }
2978
+ };
2979
+ defaults.default = defaults$1;
2980
+ return defaults;
2981
+ }
2982
+ var hasRequiredGetOptionsFromElement;
2983
+ function requireGetOptionsFromElement() {
2984
+ if (hasRequiredGetOptionsFromElement) return getOptionsFromElement;
2985
+ hasRequiredGetOptionsFromElement = 1;
2986
+ Object.defineProperty(getOptionsFromElement, "__esModule", {
2987
+ value: true
2988
+ });
2989
+ var _optionsFromStrings = requireOptionsFromStrings();
2990
+ var _optionsFromStrings2 = _interopRequireDefault(_optionsFromStrings);
2991
+ var _defaults = requireDefaults();
2992
+ var _defaults2 = _interopRequireDefault(_defaults);
2993
+ function _interopRequireDefault(obj) {
2994
+ return obj && obj.__esModule ? obj : { default: obj };
2995
+ }
2996
+ function getOptionsFromElement$1(element) {
2997
+ var options = {};
2998
+ for (var property in _defaults2.default) {
2999
+ if (_defaults2.default.hasOwnProperty(property)) {
3000
+ if (element.hasAttribute("jsbarcode-" + property.toLowerCase())) {
3001
+ options[property] = element.getAttribute("jsbarcode-" + property.toLowerCase());
3002
+ }
3003
+ if (element.hasAttribute("data-" + property.toLowerCase())) {
3004
+ options[property] = element.getAttribute("data-" + property.toLowerCase());
3005
+ }
3006
+ }
3007
+ }
3008
+ options["value"] = element.getAttribute("jsbarcode-value") || element.getAttribute("data-value");
3009
+ options = (0, _optionsFromStrings2.default)(options);
3010
+ return options;
3011
+ }
3012
+ getOptionsFromElement.default = getOptionsFromElement$1;
3013
+ return getOptionsFromElement;
3014
+ }
3015
+ var renderers = {};
3016
+ var canvas = {};
3017
+ var shared = {};
3018
+ var hasRequiredShared;
3019
+ function requireShared() {
3020
+ if (hasRequiredShared) return shared;
3021
+ hasRequiredShared = 1;
3022
+ Object.defineProperty(shared, "__esModule", {
3023
+ value: true
3024
+ });
3025
+ shared.getTotalWidthOfEncodings = shared.calculateEncodingAttributes = shared.getBarcodePadding = shared.getEncodingHeight = shared.getMaximumHeightOfEncodings = void 0;
3026
+ var _merge = requireMerge();
3027
+ var _merge2 = _interopRequireDefault(_merge);
3028
+ function _interopRequireDefault(obj) {
3029
+ return obj && obj.__esModule ? obj : { default: obj };
3030
+ }
3031
+ function getEncodingHeight(encoding, options) {
3032
+ return options.height + (options.displayValue && encoding.text.length > 0 ? options.fontSize + options.textMargin : 0) + options.marginTop + options.marginBottom;
3033
+ }
3034
+ function getBarcodePadding(textWidth, barcodeWidth, options) {
3035
+ if (options.displayValue && barcodeWidth < textWidth) {
3036
+ if (options.textAlign == "center") {
3037
+ return Math.floor((textWidth - barcodeWidth) / 2);
3038
+ } else if (options.textAlign == "left") {
3039
+ return 0;
3040
+ } else if (options.textAlign == "right") {
3041
+ return Math.floor(textWidth - barcodeWidth);
3042
+ }
3043
+ }
3044
+ return 0;
3045
+ }
3046
+ function calculateEncodingAttributes(encodings, barcodeOptions, context) {
3047
+ for (var i = 0; i < encodings.length; i++) {
3048
+ var encoding = encodings[i];
3049
+ var options = (0, _merge2.default)(barcodeOptions, encoding.options);
3050
+ var textWidth;
3051
+ if (options.displayValue) {
3052
+ textWidth = messureText(encoding.text, options, context);
3053
+ } else {
3054
+ textWidth = 0;
3055
+ }
3056
+ var barcodeWidth = encoding.data.length * options.width;
3057
+ encoding.width = Math.ceil(Math.max(textWidth, barcodeWidth));
3058
+ encoding.height = getEncodingHeight(encoding, options);
3059
+ encoding.barcodePadding = getBarcodePadding(textWidth, barcodeWidth, options);
3060
+ }
3061
+ }
3062
+ function getTotalWidthOfEncodings(encodings) {
3063
+ var totalWidth = 0;
3064
+ for (var i = 0; i < encodings.length; i++) {
3065
+ totalWidth += encodings[i].width;
3066
+ }
3067
+ return totalWidth;
3068
+ }
3069
+ function getMaximumHeightOfEncodings(encodings) {
3070
+ var maxHeight = 0;
3071
+ for (var i = 0; i < encodings.length; i++) {
3072
+ if (encodings[i].height > maxHeight) {
3073
+ maxHeight = encodings[i].height;
3074
+ }
3075
+ }
3076
+ return maxHeight;
3077
+ }
3078
+ function messureText(string, options, context) {
3079
+ var ctx;
3080
+ if (context) {
3081
+ ctx = context;
3082
+ } else if (typeof document !== "undefined") {
3083
+ ctx = document.createElement("canvas").getContext("2d");
3084
+ } else {
3085
+ return 0;
3086
+ }
3087
+ ctx.font = options.fontOptions + " " + options.fontSize + "px " + options.font;
3088
+ var measureTextResult = ctx.measureText(string);
3089
+ if (!measureTextResult) {
3090
+ return 0;
3091
+ }
3092
+ var size = measureTextResult.width;
3093
+ return size;
3094
+ }
3095
+ shared.getMaximumHeightOfEncodings = getMaximumHeightOfEncodings;
3096
+ shared.getEncodingHeight = getEncodingHeight;
3097
+ shared.getBarcodePadding = getBarcodePadding;
3098
+ shared.calculateEncodingAttributes = calculateEncodingAttributes;
3099
+ shared.getTotalWidthOfEncodings = getTotalWidthOfEncodings;
3100
+ return shared;
3101
+ }
3102
+ var hasRequiredCanvas;
3103
+ function requireCanvas() {
3104
+ if (hasRequiredCanvas) return canvas;
3105
+ hasRequiredCanvas = 1;
3106
+ Object.defineProperty(canvas, "__esModule", {
3107
+ value: true
3108
+ });
3109
+ var _createClass = /* @__PURE__ */ (function() {
3110
+ function defineProperties(target, props) {
3111
+ for (var i = 0; i < props.length; i++) {
3112
+ var descriptor = props[i];
3113
+ descriptor.enumerable = descriptor.enumerable || false;
3114
+ descriptor.configurable = true;
3115
+ if ("value" in descriptor) descriptor.writable = true;
3116
+ Object.defineProperty(target, descriptor.key, descriptor);
3117
+ }
3118
+ }
3119
+ return function(Constructor, protoProps, staticProps) {
3120
+ if (protoProps) defineProperties(Constructor.prototype, protoProps);
3121
+ if (staticProps) defineProperties(Constructor, staticProps);
3122
+ return Constructor;
3123
+ };
3124
+ })();
3125
+ var _merge = requireMerge();
3126
+ var _merge2 = _interopRequireDefault(_merge);
3127
+ var _shared = requireShared();
3128
+ function _interopRequireDefault(obj) {
3129
+ return obj && obj.__esModule ? obj : { default: obj };
3130
+ }
3131
+ function _classCallCheck(instance, Constructor) {
3132
+ if (!(instance instanceof Constructor)) {
3133
+ throw new TypeError("Cannot call a class as a function");
3134
+ }
3135
+ }
3136
+ var CanvasRenderer = (function() {
3137
+ function CanvasRenderer2(canvas2, encodings, options) {
3138
+ _classCallCheck(this, CanvasRenderer2);
3139
+ this.canvas = canvas2;
3140
+ this.encodings = encodings;
3141
+ this.options = options;
3142
+ }
3143
+ _createClass(CanvasRenderer2, [{
3144
+ key: "render",
3145
+ value: function render() {
3146
+ if (!this.canvas.getContext) {
3147
+ throw new Error("The browser does not support canvas.");
3148
+ }
3149
+ this.prepareCanvas();
3150
+ for (var i = 0; i < this.encodings.length; i++) {
3151
+ var encodingOptions = (0, _merge2.default)(this.options, this.encodings[i].options);
3152
+ this.drawCanvasBarcode(encodingOptions, this.encodings[i]);
3153
+ this.drawCanvasText(encodingOptions, this.encodings[i]);
3154
+ this.moveCanvasDrawing(this.encodings[i]);
3155
+ }
3156
+ this.restoreCanvas();
3157
+ }
3158
+ }, {
3159
+ key: "prepareCanvas",
3160
+ value: function prepareCanvas() {
3161
+ var ctx = this.canvas.getContext("2d");
3162
+ ctx.save();
3163
+ (0, _shared.calculateEncodingAttributes)(this.encodings, this.options, ctx);
3164
+ var totalWidth = (0, _shared.getTotalWidthOfEncodings)(this.encodings);
3165
+ var maxHeight = (0, _shared.getMaximumHeightOfEncodings)(this.encodings);
3166
+ this.canvas.width = totalWidth + this.options.marginLeft + this.options.marginRight;
3167
+ this.canvas.height = maxHeight;
3168
+ ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
3169
+ if (this.options.background) {
3170
+ ctx.fillStyle = this.options.background;
3171
+ ctx.fillRect(0, 0, this.canvas.width, this.canvas.height);
3172
+ }
3173
+ ctx.translate(this.options.marginLeft, 0);
3174
+ }
3175
+ }, {
3176
+ key: "drawCanvasBarcode",
3177
+ value: function drawCanvasBarcode(options, encoding) {
3178
+ var ctx = this.canvas.getContext("2d");
3179
+ var binary = encoding.data;
3180
+ var yFrom;
3181
+ if (options.textPosition == "top") {
3182
+ yFrom = options.marginTop + options.fontSize + options.textMargin;
3183
+ } else {
3184
+ yFrom = options.marginTop;
3185
+ }
3186
+ ctx.fillStyle = options.lineColor;
3187
+ for (var b = 0; b < binary.length; b++) {
3188
+ var x = b * options.width + encoding.barcodePadding;
3189
+ if (binary[b] === "1") {
3190
+ ctx.fillRect(x, yFrom, options.width, options.height);
3191
+ } else if (binary[b]) {
3192
+ ctx.fillRect(x, yFrom, options.width, options.height * binary[b]);
3193
+ }
3194
+ }
3195
+ }
3196
+ }, {
3197
+ key: "drawCanvasText",
3198
+ value: function drawCanvasText(options, encoding) {
3199
+ var ctx = this.canvas.getContext("2d");
3200
+ var font = options.fontOptions + " " + options.fontSize + "px " + options.font;
3201
+ if (options.displayValue) {
3202
+ var x, y;
3203
+ if (options.textPosition == "top") {
3204
+ y = options.marginTop + options.fontSize - options.textMargin;
3205
+ } else {
3206
+ y = options.height + options.textMargin + options.marginTop + options.fontSize;
3207
+ }
3208
+ ctx.font = font;
3209
+ if (options.textAlign == "left" || encoding.barcodePadding > 0) {
3210
+ x = 0;
3211
+ ctx.textAlign = "left";
3212
+ } else if (options.textAlign == "right") {
3213
+ x = encoding.width - 1;
3214
+ ctx.textAlign = "right";
3215
+ } else {
3216
+ x = encoding.width / 2;
3217
+ ctx.textAlign = "center";
3218
+ }
3219
+ ctx.fillText(encoding.text, x, y);
3220
+ }
3221
+ }
3222
+ }, {
3223
+ key: "moveCanvasDrawing",
3224
+ value: function moveCanvasDrawing(encoding) {
3225
+ var ctx = this.canvas.getContext("2d");
3226
+ ctx.translate(encoding.width, 0);
3227
+ }
3228
+ }, {
3229
+ key: "restoreCanvas",
3230
+ value: function restoreCanvas() {
3231
+ var ctx = this.canvas.getContext("2d");
3232
+ ctx.restore();
3233
+ }
3234
+ }]);
3235
+ return CanvasRenderer2;
3236
+ })();
3237
+ canvas.default = CanvasRenderer;
3238
+ return canvas;
3239
+ }
3240
+ var svg = {};
3241
+ var hasRequiredSvg;
3242
+ function requireSvg() {
3243
+ if (hasRequiredSvg) return svg;
3244
+ hasRequiredSvg = 1;
3245
+ Object.defineProperty(svg, "__esModule", {
3246
+ value: true
3247
+ });
3248
+ var _createClass = /* @__PURE__ */ (function() {
3249
+ function defineProperties(target, props) {
3250
+ for (var i = 0; i < props.length; i++) {
3251
+ var descriptor = props[i];
3252
+ descriptor.enumerable = descriptor.enumerable || false;
3253
+ descriptor.configurable = true;
3254
+ if ("value" in descriptor) descriptor.writable = true;
3255
+ Object.defineProperty(target, descriptor.key, descriptor);
3256
+ }
3257
+ }
3258
+ return function(Constructor, protoProps, staticProps) {
3259
+ if (protoProps) defineProperties(Constructor.prototype, protoProps);
3260
+ if (staticProps) defineProperties(Constructor, staticProps);
3261
+ return Constructor;
3262
+ };
3263
+ })();
3264
+ var _merge = requireMerge();
3265
+ var _merge2 = _interopRequireDefault(_merge);
3266
+ var _shared = requireShared();
3267
+ function _interopRequireDefault(obj) {
3268
+ return obj && obj.__esModule ? obj : { default: obj };
3269
+ }
3270
+ function _classCallCheck(instance, Constructor) {
3271
+ if (!(instance instanceof Constructor)) {
3272
+ throw new TypeError("Cannot call a class as a function");
3273
+ }
3274
+ }
3275
+ var svgns = "http://www.w3.org/2000/svg";
3276
+ var SVGRenderer = (function() {
3277
+ function SVGRenderer2(svg2, encodings, options) {
3278
+ _classCallCheck(this, SVGRenderer2);
3279
+ this.svg = svg2;
3280
+ this.encodings = encodings;
3281
+ this.options = options;
3282
+ this.document = options.xmlDocument || document;
3283
+ }
3284
+ _createClass(SVGRenderer2, [{
3285
+ key: "render",
3286
+ value: function render() {
3287
+ var currentX = this.options.marginLeft;
3288
+ this.prepareSVG();
3289
+ for (var i = 0; i < this.encodings.length; i++) {
3290
+ var encoding = this.encodings[i];
3291
+ var encodingOptions = (0, _merge2.default)(this.options, encoding.options);
3292
+ var group = this.createGroup(currentX, encodingOptions.marginTop, this.svg);
3293
+ this.setGroupOptions(group, encodingOptions);
3294
+ this.drawSvgBarcode(group, encodingOptions, encoding);
3295
+ this.drawSVGText(group, encodingOptions, encoding);
3296
+ currentX += encoding.width;
3297
+ }
3298
+ }
3299
+ }, {
3300
+ key: "prepareSVG",
3301
+ value: function prepareSVG() {
3302
+ while (this.svg.firstChild) {
3303
+ this.svg.removeChild(this.svg.firstChild);
3304
+ }
3305
+ (0, _shared.calculateEncodingAttributes)(this.encodings, this.options);
3306
+ var totalWidth = (0, _shared.getTotalWidthOfEncodings)(this.encodings);
3307
+ var maxHeight = (0, _shared.getMaximumHeightOfEncodings)(this.encodings);
3308
+ var width = totalWidth + this.options.marginLeft + this.options.marginRight;
3309
+ this.setSvgAttributes(width, maxHeight);
3310
+ if (this.options.background) {
3311
+ this.drawRect(0, 0, width, maxHeight, this.svg).setAttribute("fill", this.options.background);
3312
+ }
3313
+ }
3314
+ }, {
3315
+ key: "drawSvgBarcode",
3316
+ value: function drawSvgBarcode(parent, options, encoding) {
3317
+ var binary = encoding.data;
3318
+ var yFrom;
3319
+ if (options.textPosition == "top") {
3320
+ yFrom = options.fontSize + options.textMargin;
3321
+ } else {
3322
+ yFrom = 0;
3323
+ }
3324
+ var barWidth = 0;
3325
+ var x = 0;
3326
+ for (var b = 0; b < binary.length; b++) {
3327
+ x = b * options.width + encoding.barcodePadding;
3328
+ if (binary[b] === "1") {
3329
+ barWidth++;
3330
+ } else if (barWidth > 0) {
3331
+ this.drawRect(x - options.width * barWidth, yFrom, options.width * barWidth, options.height, parent);
3332
+ barWidth = 0;
3333
+ }
3334
+ }
3335
+ if (barWidth > 0) {
3336
+ this.drawRect(x - options.width * (barWidth - 1), yFrom, options.width * barWidth, options.height, parent);
3337
+ }
3338
+ }
3339
+ }, {
3340
+ key: "drawSVGText",
3341
+ value: function drawSVGText(parent, options, encoding) {
3342
+ var textElem = this.document.createElementNS(svgns, "text");
3343
+ if (options.displayValue) {
3344
+ var x, y;
3345
+ textElem.setAttribute("font-family", options.font);
3346
+ textElem.setAttribute("font-size", options.fontSize);
3347
+ if (options.fontOptions.includes("bold")) {
3348
+ textElem.setAttribute("font-weight", "bold");
3349
+ }
3350
+ if (options.fontOptions.includes("italic")) {
3351
+ textElem.setAttribute("font-style", "italic");
3352
+ }
3353
+ if (options.textPosition == "top") {
3354
+ y = options.fontSize - options.textMargin;
3355
+ } else {
3356
+ y = options.height + options.textMargin + options.fontSize;
3357
+ }
3358
+ if (options.textAlign == "left" || encoding.barcodePadding > 0) {
3359
+ x = 0;
3360
+ textElem.setAttribute("text-anchor", "start");
3361
+ } else if (options.textAlign == "right") {
3362
+ x = encoding.width - 1;
3363
+ textElem.setAttribute("text-anchor", "end");
3364
+ } else {
3365
+ x = encoding.width / 2;
3366
+ textElem.setAttribute("text-anchor", "middle");
3367
+ }
3368
+ textElem.setAttribute("x", x);
3369
+ textElem.setAttribute("y", y);
3370
+ textElem.appendChild(this.document.createTextNode(encoding.text));
3371
+ parent.appendChild(textElem);
3372
+ }
3373
+ }
3374
+ }, {
3375
+ key: "setSvgAttributes",
3376
+ value: function setSvgAttributes(width, height) {
3377
+ var svg2 = this.svg;
3378
+ svg2.setAttribute("width", width + "px");
3379
+ svg2.setAttribute("height", height + "px");
3380
+ svg2.setAttribute("x", "0px");
3381
+ svg2.setAttribute("y", "0px");
3382
+ svg2.setAttribute("viewBox", "0 0 " + width + " " + height);
3383
+ svg2.setAttribute("xmlns", svgns);
3384
+ svg2.setAttribute("version", "1.1");
3385
+ }
3386
+ }, {
3387
+ key: "createGroup",
3388
+ value: function createGroup(x, y, parent) {
3389
+ var group = this.document.createElementNS(svgns, "g");
3390
+ group.setAttribute("transform", "translate(" + x + ", " + y + ")");
3391
+ parent.appendChild(group);
3392
+ return group;
3393
+ }
3394
+ }, {
3395
+ key: "setGroupOptions",
3396
+ value: function setGroupOptions(group, options) {
3397
+ group.setAttribute("fill", options.lineColor);
3398
+ }
3399
+ }, {
3400
+ key: "drawRect",
3401
+ value: function drawRect(x, y, width, height, parent) {
3402
+ var rect = this.document.createElementNS(svgns, "rect");
3403
+ rect.setAttribute("x", x);
3404
+ rect.setAttribute("y", y);
3405
+ rect.setAttribute("width", width);
3406
+ rect.setAttribute("height", height);
3407
+ parent.appendChild(rect);
3408
+ return rect;
3409
+ }
3410
+ }]);
3411
+ return SVGRenderer2;
3412
+ })();
3413
+ svg.default = SVGRenderer;
3414
+ return svg;
3415
+ }
3416
+ var object = {};
3417
+ var hasRequiredObject;
3418
+ function requireObject() {
3419
+ if (hasRequiredObject) return object;
3420
+ hasRequiredObject = 1;
3421
+ Object.defineProperty(object, "__esModule", {
3422
+ value: true
3423
+ });
3424
+ var _createClass = /* @__PURE__ */ (function() {
3425
+ function defineProperties(target, props) {
3426
+ for (var i = 0; i < props.length; i++) {
3427
+ var descriptor = props[i];
3428
+ descriptor.enumerable = descriptor.enumerable || false;
3429
+ descriptor.configurable = true;
3430
+ if ("value" in descriptor) descriptor.writable = true;
3431
+ Object.defineProperty(target, descriptor.key, descriptor);
3432
+ }
3433
+ }
3434
+ return function(Constructor, protoProps, staticProps) {
3435
+ if (protoProps) defineProperties(Constructor.prototype, protoProps);
3436
+ if (staticProps) defineProperties(Constructor, staticProps);
3437
+ return Constructor;
3438
+ };
3439
+ })();
3440
+ function _classCallCheck(instance, Constructor) {
3441
+ if (!(instance instanceof Constructor)) {
3442
+ throw new TypeError("Cannot call a class as a function");
3443
+ }
3444
+ }
3445
+ var ObjectRenderer = (function() {
3446
+ function ObjectRenderer2(object2, encodings, options) {
3447
+ _classCallCheck(this, ObjectRenderer2);
3448
+ this.object = object2;
3449
+ this.encodings = encodings;
3450
+ this.options = options;
3451
+ }
3452
+ _createClass(ObjectRenderer2, [{
3453
+ key: "render",
3454
+ value: function render() {
3455
+ this.object.encodings = this.encodings;
3456
+ }
3457
+ }]);
3458
+ return ObjectRenderer2;
3459
+ })();
3460
+ object.default = ObjectRenderer;
3461
+ return object;
3462
+ }
3463
+ var hasRequiredRenderers;
3464
+ function requireRenderers() {
3465
+ if (hasRequiredRenderers) return renderers;
3466
+ hasRequiredRenderers = 1;
3467
+ Object.defineProperty(renderers, "__esModule", {
3468
+ value: true
3469
+ });
3470
+ var _canvas = requireCanvas();
3471
+ var _canvas2 = _interopRequireDefault(_canvas);
3472
+ var _svg = requireSvg();
3473
+ var _svg2 = _interopRequireDefault(_svg);
3474
+ var _object = requireObject();
3475
+ var _object2 = _interopRequireDefault(_object);
3476
+ function _interopRequireDefault(obj) {
3477
+ return obj && obj.__esModule ? obj : { default: obj };
3478
+ }
3479
+ renderers.default = { CanvasRenderer: _canvas2.default, SVGRenderer: _svg2.default, ObjectRenderer: _object2.default };
3480
+ return renderers;
3481
+ }
3482
+ var exceptions = {};
3483
+ var hasRequiredExceptions;
3484
+ function requireExceptions() {
3485
+ if (hasRequiredExceptions) return exceptions;
3486
+ hasRequiredExceptions = 1;
3487
+ Object.defineProperty(exceptions, "__esModule", {
3488
+ value: true
3489
+ });
3490
+ function _classCallCheck(instance, Constructor) {
3491
+ if (!(instance instanceof Constructor)) {
3492
+ throw new TypeError("Cannot call a class as a function");
3493
+ }
3494
+ }
3495
+ function _possibleConstructorReturn(self, call) {
3496
+ if (!self) {
3497
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
3498
+ }
3499
+ return call && (typeof call === "object" || typeof call === "function") ? call : self;
3500
+ }
3501
+ function _inherits(subClass, superClass) {
3502
+ if (typeof superClass !== "function" && superClass !== null) {
3503
+ throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
3504
+ }
3505
+ subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });
3506
+ if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
3507
+ }
3508
+ var InvalidInputException = (function(_Error) {
3509
+ _inherits(InvalidInputException2, _Error);
3510
+ function InvalidInputException2(symbology, input) {
3511
+ _classCallCheck(this, InvalidInputException2);
3512
+ var _this = _possibleConstructorReturn(this, (InvalidInputException2.__proto__ || Object.getPrototypeOf(InvalidInputException2)).call(this));
3513
+ _this.name = "InvalidInputException";
3514
+ _this.symbology = symbology;
3515
+ _this.input = input;
3516
+ _this.message = '"' + _this.input + '" is not a valid input for ' + _this.symbology;
3517
+ return _this;
3518
+ }
3519
+ return InvalidInputException2;
3520
+ })(Error);
3521
+ var InvalidElementException = (function(_Error2) {
3522
+ _inherits(InvalidElementException2, _Error2);
3523
+ function InvalidElementException2() {
3524
+ _classCallCheck(this, InvalidElementException2);
3525
+ var _this2 = _possibleConstructorReturn(this, (InvalidElementException2.__proto__ || Object.getPrototypeOf(InvalidElementException2)).call(this));
3526
+ _this2.name = "InvalidElementException";
3527
+ _this2.message = "Not supported type to render on";
3528
+ return _this2;
3529
+ }
3530
+ return InvalidElementException2;
3531
+ })(Error);
3532
+ var NoElementException = (function(_Error3) {
3533
+ _inherits(NoElementException2, _Error3);
3534
+ function NoElementException2() {
3535
+ _classCallCheck(this, NoElementException2);
3536
+ var _this3 = _possibleConstructorReturn(this, (NoElementException2.__proto__ || Object.getPrototypeOf(NoElementException2)).call(this));
3537
+ _this3.name = "NoElementException";
3538
+ _this3.message = "No element to render on.";
3539
+ return _this3;
3540
+ }
3541
+ return NoElementException2;
3542
+ })(Error);
3543
+ exceptions.InvalidInputException = InvalidInputException;
3544
+ exceptions.InvalidElementException = InvalidElementException;
3545
+ exceptions.NoElementException = NoElementException;
3546
+ return exceptions;
3547
+ }
3548
+ var hasRequiredGetRenderProperties;
3549
+ function requireGetRenderProperties() {
3550
+ if (hasRequiredGetRenderProperties) return getRenderProperties;
3551
+ hasRequiredGetRenderProperties = 1;
3552
+ Object.defineProperty(getRenderProperties, "__esModule", {
3553
+ value: true
3554
+ });
3555
+ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function(obj) {
3556
+ return typeof obj;
3557
+ } : function(obj) {
3558
+ return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
3559
+ };
3560
+ var _getOptionsFromElement = requireGetOptionsFromElement();
3561
+ var _getOptionsFromElement2 = _interopRequireDefault(_getOptionsFromElement);
3562
+ var _renderers = requireRenderers();
3563
+ var _renderers2 = _interopRequireDefault(_renderers);
3564
+ var _exceptions = requireExceptions();
3565
+ function _interopRequireDefault(obj) {
3566
+ return obj && obj.__esModule ? obj : { default: obj };
3567
+ }
3568
+ function getRenderProperties$1(element) {
3569
+ if (typeof element === "string") {
3570
+ return querySelectedRenderProperties(element);
3571
+ } else if (Array.isArray(element)) {
3572
+ var returnArray = [];
3573
+ for (var i = 0; i < element.length; i++) {
3574
+ returnArray.push(getRenderProperties$1(element[i]));
3575
+ }
3576
+ return returnArray;
3577
+ } else if (typeof HTMLCanvasElement !== "undefined" && element instanceof HTMLImageElement) {
3578
+ return newCanvasRenderProperties(element);
3579
+ } else if (element && element.nodeName && element.nodeName.toLowerCase() === "svg" || typeof SVGElement !== "undefined" && element instanceof SVGElement) {
3580
+ return {
3581
+ element,
3582
+ options: (0, _getOptionsFromElement2.default)(element),
3583
+ renderer: _renderers2.default.SVGRenderer
3584
+ };
3585
+ } else if (typeof HTMLCanvasElement !== "undefined" && element instanceof HTMLCanvasElement) {
3586
+ return {
3587
+ element,
3588
+ options: (0, _getOptionsFromElement2.default)(element),
3589
+ renderer: _renderers2.default.CanvasRenderer
3590
+ };
3591
+ } else if (element && element.getContext) {
3592
+ return {
3593
+ element,
3594
+ renderer: _renderers2.default.CanvasRenderer
3595
+ };
3596
+ } else if (element && (typeof element === "undefined" ? "undefined" : _typeof(element)) === "object" && !element.nodeName) {
3597
+ return {
3598
+ element,
3599
+ renderer: _renderers2.default.ObjectRenderer
3600
+ };
3601
+ } else {
3602
+ throw new _exceptions.InvalidElementException();
3603
+ }
3604
+ }
3605
+ function querySelectedRenderProperties(string) {
3606
+ var selector = document.querySelectorAll(string);
3607
+ if (selector.length === 0) {
3608
+ return void 0;
3609
+ } else {
3610
+ var returnArray = [];
3611
+ for (var i = 0; i < selector.length; i++) {
3612
+ returnArray.push(getRenderProperties$1(selector[i]));
3613
+ }
3614
+ return returnArray;
3615
+ }
3616
+ }
3617
+ function newCanvasRenderProperties(imgElement) {
3618
+ var canvas2 = document.createElement("canvas");
3619
+ return {
3620
+ element: canvas2,
3621
+ options: (0, _getOptionsFromElement2.default)(imgElement),
3622
+ renderer: _renderers2.default.CanvasRenderer,
3623
+ afterRender: function afterRender() {
3624
+ imgElement.setAttribute("src", canvas2.toDataURL());
3625
+ }
3626
+ };
3627
+ }
3628
+ getRenderProperties.default = getRenderProperties$1;
3629
+ return getRenderProperties;
3630
+ }
3631
+ var ErrorHandler = {};
3632
+ var hasRequiredErrorHandler;
3633
+ function requireErrorHandler() {
3634
+ if (hasRequiredErrorHandler) return ErrorHandler;
3635
+ hasRequiredErrorHandler = 1;
3636
+ Object.defineProperty(ErrorHandler, "__esModule", {
3637
+ value: true
3638
+ });
3639
+ var _createClass = /* @__PURE__ */ (function() {
3640
+ function defineProperties(target, props) {
3641
+ for (var i = 0; i < props.length; i++) {
3642
+ var descriptor = props[i];
3643
+ descriptor.enumerable = descriptor.enumerable || false;
3644
+ descriptor.configurable = true;
3645
+ if ("value" in descriptor) descriptor.writable = true;
3646
+ Object.defineProperty(target, descriptor.key, descriptor);
3647
+ }
3648
+ }
3649
+ return function(Constructor, protoProps, staticProps) {
3650
+ if (protoProps) defineProperties(Constructor.prototype, protoProps);
3651
+ if (staticProps) defineProperties(Constructor, staticProps);
3652
+ return Constructor;
3653
+ };
3654
+ })();
3655
+ function _classCallCheck(instance, Constructor) {
3656
+ if (!(instance instanceof Constructor)) {
3657
+ throw new TypeError("Cannot call a class as a function");
3658
+ }
3659
+ }
3660
+ var ErrorHandler$1 = (function() {
3661
+ function ErrorHandler2(api) {
3662
+ _classCallCheck(this, ErrorHandler2);
3663
+ this.api = api;
3664
+ }
3665
+ _createClass(ErrorHandler2, [{
3666
+ key: "handleCatch",
3667
+ value: function handleCatch(e) {
3668
+ if (e.name === "InvalidInputException") {
3669
+ if (this.api._options.valid !== this.api._defaults.valid) {
3670
+ this.api._options.valid(false);
3671
+ } else {
3672
+ throw e.message;
3673
+ }
3674
+ } else {
3675
+ throw e;
3676
+ }
3677
+ this.api.render = function() {
3678
+ };
3679
+ }
3680
+ }, {
3681
+ key: "wrapBarcodeCall",
3682
+ value: function wrapBarcodeCall(func) {
3683
+ try {
3684
+ var result = func.apply(void 0, arguments);
3685
+ this.api._options.valid(true);
3686
+ return result;
3687
+ } catch (e) {
3688
+ this.handleCatch(e);
3689
+ return this.api;
3690
+ }
3691
+ }
3692
+ }]);
3693
+ return ErrorHandler2;
3694
+ })();
3695
+ ErrorHandler.default = ErrorHandler$1;
3696
+ return ErrorHandler;
3697
+ }
3698
+ var JsBarcode_1;
3699
+ var hasRequiredJsBarcode;
3700
+ function requireJsBarcode() {
3701
+ if (hasRequiredJsBarcode) return JsBarcode_1;
3702
+ hasRequiredJsBarcode = 1;
3703
+ var _barcodes = requireBarcodes();
3704
+ var _barcodes2 = _interopRequireDefault(_barcodes);
3705
+ var _merge = requireMerge();
3706
+ var _merge2 = _interopRequireDefault(_merge);
3707
+ var _linearizeEncodings = requireLinearizeEncodings();
3708
+ var _linearizeEncodings2 = _interopRequireDefault(_linearizeEncodings);
3709
+ var _fixOptions = requireFixOptions();
3710
+ var _fixOptions2 = _interopRequireDefault(_fixOptions);
3711
+ var _getRenderProperties = requireGetRenderProperties();
3712
+ var _getRenderProperties2 = _interopRequireDefault(_getRenderProperties);
3713
+ var _optionsFromStrings = requireOptionsFromStrings();
3714
+ var _optionsFromStrings2 = _interopRequireDefault(_optionsFromStrings);
3715
+ var _ErrorHandler = requireErrorHandler();
3716
+ var _ErrorHandler2 = _interopRequireDefault(_ErrorHandler);
3717
+ var _exceptions = requireExceptions();
3718
+ var _defaults = requireDefaults();
3719
+ var _defaults2 = _interopRequireDefault(_defaults);
3720
+ function _interopRequireDefault(obj) {
3721
+ return obj && obj.__esModule ? obj : { default: obj };
3722
+ }
3723
+ var API = function API2() {
3724
+ };
3725
+ var JsBarcode2 = function JsBarcode3(element, text, options) {
3726
+ var api = new API();
3727
+ if (typeof element === "undefined") {
3728
+ throw Error("No element to render on was provided.");
3729
+ }
3730
+ api._renderProperties = (0, _getRenderProperties2.default)(element);
3731
+ api._encodings = [];
3732
+ api._options = _defaults2.default;
3733
+ api._errorHandler = new _ErrorHandler2.default(api);
3734
+ if (typeof text !== "undefined") {
3735
+ options = options || {};
3736
+ if (!options.format) {
3737
+ options.format = autoSelectBarcode();
3738
+ }
3739
+ api.options(options)[options.format](text, options).render();
3740
+ }
3741
+ return api;
3742
+ };
3743
+ JsBarcode2.getModule = function(name2) {
3744
+ return _barcodes2.default[name2];
3745
+ };
3746
+ for (var name in _barcodes2.default) {
3747
+ if (_barcodes2.default.hasOwnProperty(name)) {
3748
+ registerBarcode(_barcodes2.default, name);
3749
+ }
3750
+ }
3751
+ function registerBarcode(barcodes2, name2) {
3752
+ API.prototype[name2] = API.prototype[name2.toUpperCase()] = API.prototype[name2.toLowerCase()] = function(text, options) {
3753
+ var api = this;
3754
+ return api._errorHandler.wrapBarcodeCall(function() {
3755
+ options.text = typeof options.text === "undefined" ? void 0 : "" + options.text;
3756
+ var newOptions = (0, _merge2.default)(api._options, options);
3757
+ newOptions = (0, _optionsFromStrings2.default)(newOptions);
3758
+ var Encoder = barcodes2[name2];
3759
+ var encoded = encode(text, Encoder, newOptions);
3760
+ api._encodings.push(encoded);
3761
+ return api;
3762
+ });
3763
+ };
3764
+ }
3765
+ function encode(text, Encoder, options) {
3766
+ text = "" + text;
3767
+ var encoder2 = new Encoder(text, options);
3768
+ if (!encoder2.valid()) {
3769
+ throw new _exceptions.InvalidInputException(encoder2.constructor.name, text);
3770
+ }
3771
+ var encoded = encoder2.encode();
3772
+ encoded = (0, _linearizeEncodings2.default)(encoded);
3773
+ for (var i = 0; i < encoded.length; i++) {
3774
+ encoded[i].options = (0, _merge2.default)(options, encoded[i].options);
3775
+ }
3776
+ return encoded;
3777
+ }
3778
+ function autoSelectBarcode() {
3779
+ if (_barcodes2.default["CODE128"]) {
3780
+ return "CODE128";
3781
+ }
3782
+ return Object.keys(_barcodes2.default)[0];
3783
+ }
3784
+ API.prototype.options = function(options) {
3785
+ this._options = (0, _merge2.default)(this._options, options);
3786
+ return this;
3787
+ };
3788
+ API.prototype.blank = function(size) {
3789
+ var zeroes = new Array(size + 1).join("0");
3790
+ this._encodings.push({ data: zeroes });
3791
+ return this;
3792
+ };
3793
+ API.prototype.init = function() {
3794
+ if (!this._renderProperties) {
3795
+ return;
3796
+ }
3797
+ if (!Array.isArray(this._renderProperties)) {
3798
+ this._renderProperties = [this._renderProperties];
3799
+ }
3800
+ var renderProperty;
3801
+ for (var i in this._renderProperties) {
3802
+ renderProperty = this._renderProperties[i];
3803
+ var options = (0, _merge2.default)(this._options, renderProperty.options);
3804
+ if (options.format == "auto") {
3805
+ options.format = autoSelectBarcode();
3806
+ }
3807
+ this._errorHandler.wrapBarcodeCall(function() {
3808
+ var text = options.value;
3809
+ var Encoder = _barcodes2.default[options.format.toUpperCase()];
3810
+ var encoded = encode(text, Encoder, options);
3811
+ render(renderProperty, encoded, options);
3812
+ });
3813
+ }
3814
+ };
3815
+ API.prototype.render = function() {
3816
+ if (!this._renderProperties) {
3817
+ throw new _exceptions.NoElementException();
3818
+ }
3819
+ if (Array.isArray(this._renderProperties)) {
3820
+ for (var i = 0; i < this._renderProperties.length; i++) {
3821
+ render(this._renderProperties[i], this._encodings, this._options);
3822
+ }
3823
+ } else {
3824
+ render(this._renderProperties, this._encodings, this._options);
3825
+ }
3826
+ return this;
3827
+ };
3828
+ API.prototype._defaults = _defaults2.default;
3829
+ function render(renderProperties, encodings, options) {
3830
+ encodings = (0, _linearizeEncodings2.default)(encodings);
3831
+ for (var i = 0; i < encodings.length; i++) {
3832
+ encodings[i].options = (0, _merge2.default)(options, encodings[i].options);
3833
+ (0, _fixOptions2.default)(encodings[i].options);
3834
+ }
3835
+ (0, _fixOptions2.default)(options);
3836
+ var Renderer = renderProperties.renderer;
3837
+ var renderer = new Renderer(renderProperties.element, encodings, options);
3838
+ renderer.render();
3839
+ if (renderProperties.afterRender) {
3840
+ renderProperties.afterRender();
3841
+ }
3842
+ }
3843
+ if (typeof window !== "undefined") {
3844
+ window.JsBarcode = JsBarcode2;
3845
+ }
3846
+ if (typeof jQuery !== "undefined") {
3847
+ jQuery.fn.JsBarcode = function(content, options) {
3848
+ var elementArray = [];
3849
+ jQuery(this).each(function() {
3850
+ elementArray.push(this);
3851
+ });
3852
+ return JsBarcode2(elementArray, content, options);
3853
+ };
3854
+ }
3855
+ JsBarcode_1 = JsBarcode2;
3856
+ return JsBarcode_1;
3857
+ }
3858
+ var JsBarcodeExports = requireJsBarcode();
3859
+ const JsBarcode = /* @__PURE__ */ getDefaultExportFromCjs(JsBarcodeExports);
3860
+ const JsBarcode$1 = /* @__PURE__ */ _mergeNamespaces({
3861
+ __proto__: null,
3862
+ default: JsBarcode
3863
+ }, [JsBarcodeExports]);
3864
+ export {
3865
+ JsBarcode$1 as JsBarcode
3866
+ };