@sythos/js_barcode_universal 1.5.7 → 1.5.9

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 (267) hide show
  1. package/LICENSE +5 -4
  2. package/NOTICE.md +2 -2
  3. package/README.md +50 -37
  4. package/bundle/sythos-barcode.esm.js +12051 -11484
  5. package/bundle/sythos-barcode.js +12051 -11484
  6. package/package.json +52 -45
  7. package/src/index.d.ts +363 -0
  8. package/src/index.js +573 -428
  9. package/src/js/aztec/decoder.js +326 -0
  10. package/src/js/aztec/detector.js +251 -0
  11. package/src/js/aztec/encoder.js +276 -0
  12. package/src/js/aztec/high-level.js +216 -0
  13. package/src/js/aztec/index.js +34 -0
  14. package/src/js/aztec/tables.js +196 -0
  15. package/src/js/aztecrune/decoder.js +146 -0
  16. package/src/js/aztecrune/detector.js +180 -0
  17. package/src/js/aztecrune/encoder.js +103 -0
  18. package/src/js/aztecrune/index.js +34 -0
  19. package/src/js/aztecrune/tables.js +142 -0
  20. package/src/js/compactpdf417/decoder.js +123 -0
  21. package/src/js/compactpdf417/detector.js +138 -0
  22. package/src/js/compactpdf417/encoder.js +127 -0
  23. package/src/js/compactpdf417/index.js +5 -0
  24. package/src/js/compactpdf417/tables.js +164 -0
  25. package/src/js/core/bit-buffer.js +158 -0
  26. package/src/js/core/bit-matrix.js +243 -0
  27. package/src/js/core/errors.js +59 -0
  28. package/src/js/core/galois-field.js +193 -0
  29. package/src/js/core/index.js +39 -0
  30. package/src/js/core/reed-solomon.js +318 -0
  31. package/src/js/databar/codec.js +166 -0
  32. package/src/js/databar/decoder.js +224 -0
  33. package/src/js/databar/encoder.js +88 -0
  34. package/src/js/databar/gs1.js +176 -0
  35. package/src/js/databar/index.js +36 -0
  36. package/src/js/databar/patterns.js +139 -0
  37. package/src/js/databar/tables.js +123 -0
  38. package/src/js/datamatrix/decoder.js +296 -0
  39. package/src/js/datamatrix/detector.js +254 -0
  40. package/src/js/datamatrix/encoder.js +250 -0
  41. package/src/js/datamatrix/index.js +34 -0
  42. package/src/js/datamatrix/tables.js +122 -0
  43. package/src/js/frameqr/decoder.js +216 -0
  44. package/src/js/frameqr/detector.js +199 -0
  45. package/src/js/frameqr/encoder.js +143 -0
  46. package/src/js/frameqr/index.js +33 -0
  47. package/src/js/frameqr/tables.js +252 -0
  48. package/src/js/image/binarizer.js +254 -0
  49. package/src/js/image/grid-sampler.js +148 -0
  50. package/src/js/image/index.js +38 -0
  51. package/src/js/image/luminance.js +185 -0
  52. package/src/js/image/perspective.js +158 -0
  53. package/src/js/micropdf417/compaction.js +115 -0
  54. package/src/js/micropdf417/decoder.js +180 -0
  55. package/src/js/micropdf417/detector.js +152 -0
  56. package/src/js/micropdf417/encoder.js +184 -0
  57. package/src/js/micropdf417/error-correction.js +50 -0
  58. package/src/js/micropdf417/index.js +35 -0
  59. package/src/js/micropdf417/tables.js +197 -0
  60. package/src/js/microqr/decoder.js +240 -0
  61. package/src/js/microqr/detector.js +339 -0
  62. package/src/js/microqr/encoder.js +314 -0
  63. package/src/js/microqr/index.js +34 -0
  64. package/src/js/microqr/tables.js +324 -0
  65. package/src/js/oned/addons.js +396 -0
  66. package/src/js/oned/index.js +75 -0
  67. package/src/js/oned/patterns.js +365 -0
  68. package/src/js/oned/reader.js +1383 -0
  69. package/src/js/oned/writers.js +691 -0
  70. package/src/js/pdf417/compaction.js +391 -0
  71. package/src/js/pdf417/decoder.js +110 -0
  72. package/src/js/pdf417/detector.js +484 -0
  73. package/src/js/pdf417/encoder.js +102 -0
  74. package/src/js/pdf417/error-correction.js +44 -0
  75. package/src/{pdf417 → js/pdf417}/index.js +0 -5
  76. package/src/js/pdf417/tables.js +315 -0
  77. package/src/js/qr/decoder.js +539 -0
  78. package/src/js/qr/detector.js +613 -0
  79. package/src/js/qr/encoder.js +873 -0
  80. package/src/js/qr/index.js +42 -0
  81. package/src/js/qr/tables.js +690 -0
  82. package/src/js/render/image-data.js +120 -0
  83. package/src/js/render/index.js +128 -0
  84. package/src/js/render/options.js +152 -0
  85. package/src/js/render/png.js +270 -0
  86. package/src/js/render/svg.js +117 -0
  87. package/src/js/render/webgl.js +200 -0
  88. package/src/js/render/webgpu.js +357 -0
  89. package/src/js/rmqr/decoder.js +209 -0
  90. package/src/js/rmqr/detector.js +122 -0
  91. package/src/js/rmqr/encoder.js +321 -0
  92. package/src/js/rmqr/index.js +33 -0
  93. package/src/js/rmqr/tables.js +177 -0
  94. package/src/{aztec/decoder.js → ts/aztec/decoder.ts} +0 -1
  95. package/{typings → src/ts}/aztec/detector.d.ts +2 -2
  96. package/src/{aztec/detector.js → ts/aztec/detector.ts} +0 -1
  97. package/src/{aztec/encoder.js → ts/aztec/encoder.ts} +0 -1
  98. package/src/{aztec/high-level.js → ts/aztec/high-level.ts} +0 -1
  99. package/src/{aztec/index.js → ts/aztec/index.ts} +0 -1
  100. package/src/{aztec/tables.js → ts/aztec/tables.ts} +0 -1
  101. package/src/{aztecrune/decoder.js → ts/aztecrune/decoder.ts} +0 -1
  102. package/src/{aztecrune/detector.js → ts/aztecrune/detector.ts} +0 -1
  103. package/src/{aztecrune/encoder.js → ts/aztecrune/encoder.ts} +0 -1
  104. package/src/{aztecrune/index.js → ts/aztecrune/index.ts} +0 -1
  105. package/src/{aztecrune/tables.js → ts/aztecrune/tables.ts} +0 -1
  106. package/src/{compactpdf417/decoder.js → ts/compactpdf417/decoder.ts} +0 -1
  107. package/src/{compactpdf417/detector.js → ts/compactpdf417/detector.ts} +0 -1
  108. package/src/{compactpdf417/encoder.js → ts/compactpdf417/encoder.ts} +0 -1
  109. package/src/{compactpdf417/index.js → ts/compactpdf417/index.ts} +0 -5
  110. package/src/{compactpdf417/tables.js → ts/compactpdf417/tables.ts} +0 -1
  111. package/src/{core/bit-buffer.js → ts/core/bit-buffer.ts} +0 -1
  112. package/src/{core/bit-matrix.js → ts/core/bit-matrix.ts} +0 -1
  113. package/src/{core/errors.js → ts/core/errors.ts} +0 -1
  114. package/src/{core/galois-field.js → ts/core/galois-field.ts} +0 -1
  115. package/src/{core/index.js → ts/core/index.ts} +0 -1
  116. package/src/{core/reed-solomon.js → ts/core/reed-solomon.ts} +0 -1
  117. package/src/{databar/codec.js → ts/databar/codec.ts} +0 -1
  118. package/src/{databar/decoder.js → ts/databar/decoder.ts} +0 -1
  119. package/src/{databar/encoder.js → ts/databar/encoder.ts} +0 -1
  120. package/src/{databar/gs1.js → ts/databar/gs1.ts} +0 -1
  121. package/src/{databar/index.js → ts/databar/index.ts} +0 -1
  122. package/src/{databar/patterns.js → ts/databar/patterns.ts} +0 -1
  123. package/src/{databar/tables.js → ts/databar/tables.ts} +0 -1
  124. package/src/{datamatrix/decoder.js → ts/datamatrix/decoder.ts} +0 -1
  125. package/{typings → src/ts}/datamatrix/detector.d.ts +2 -2
  126. package/src/{datamatrix/detector.js → ts/datamatrix/detector.ts} +0 -1
  127. package/src/{datamatrix/encoder.js → ts/datamatrix/encoder.ts} +0 -1
  128. package/src/{datamatrix/index.js → ts/datamatrix/index.ts} +0 -1
  129. package/src/{datamatrix/tables.js → ts/datamatrix/tables.ts} +0 -1
  130. package/src/{frameqr/decoder.js → ts/frameqr/decoder.ts} +15 -16
  131. package/src/{frameqr/detector.js → ts/frameqr/detector.ts} +2 -3
  132. package/src/{frameqr/encoder.js → ts/frameqr/encoder.ts} +7 -8
  133. package/src/{frameqr/index.js → ts/frameqr/index.ts} +0 -1
  134. package/src/{frameqr/tables.js → ts/frameqr/tables.ts} +10 -11
  135. package/src/{image/binarizer.js → ts/image/binarizer.ts} +0 -1
  136. package/src/{image/grid-sampler.js → ts/image/grid-sampler.ts} +0 -1
  137. package/src/{image/index.js → ts/image/index.ts} +0 -1
  138. package/src/{image/luminance.js → ts/image/luminance.ts} +0 -1
  139. package/src/{image/perspective.js → ts/image/perspective.ts} +0 -1
  140. package/{typings → src/ts}/index.d.ts +3 -3
  141. package/src/ts/index.ts +790 -0
  142. package/src/{micropdf417/compaction.js → ts/micropdf417/compaction.ts} +0 -1
  143. package/src/{micropdf417/decoder.js → ts/micropdf417/decoder.ts} +0 -1
  144. package/src/{micropdf417/detector.js → ts/micropdf417/detector.ts} +0 -1
  145. package/src/{micropdf417/encoder.js → ts/micropdf417/encoder.ts} +0 -1
  146. package/src/{micropdf417/error-correction.js → ts/micropdf417/error-correction.ts} +0 -1
  147. package/src/{micropdf417/index.js → ts/micropdf417/index.ts} +0 -1
  148. package/src/{micropdf417/tables.js → ts/micropdf417/tables.ts} +0 -1
  149. package/src/{microqr/decoder.js → ts/microqr/decoder.ts} +0 -1
  150. package/src/{microqr/detector.js → ts/microqr/detector.ts} +0 -1
  151. package/src/{microqr/encoder.js → ts/microqr/encoder.ts} +0 -1
  152. package/src/{microqr/index.js → ts/microqr/index.ts} +0 -1
  153. package/src/{microqr/tables.js → ts/microqr/tables.ts} +0 -1
  154. package/src/{oned/addons.js → ts/oned/addons.ts} +0 -1
  155. package/src/{oned/index.js → ts/oned/index.ts} +0 -1
  156. package/src/{oned/patterns.js → ts/oned/patterns.ts} +0 -1
  157. package/src/{oned/reader.js → ts/oned/reader.ts} +0 -1
  158. package/src/{oned/writers.js → ts/oned/writers.ts} +0 -1
  159. package/src/{pdf417/compaction.js → ts/pdf417/compaction.ts} +0 -1
  160. package/src/{pdf417/decoder.js → ts/pdf417/decoder.ts} +0 -1
  161. package/src/{pdf417/detector.js → ts/pdf417/detector.ts} +0 -1
  162. package/src/{pdf417/encoder.js → ts/pdf417/encoder.ts} +0 -1
  163. package/src/{pdf417/error-correction.js → ts/pdf417/error-correction.ts} +0 -1
  164. package/src/ts/pdf417/index.ts +6 -0
  165. package/src/{pdf417/tables.js → ts/pdf417/tables.ts} +0 -1
  166. package/src/{qr/decoder.js → ts/qr/decoder.ts} +0 -1
  167. package/src/{qr/detector.js → ts/qr/detector.ts} +0 -1
  168. package/src/{qr/encoder.js → ts/qr/encoder.ts} +0 -1
  169. package/src/{qr/index.js → ts/qr/index.ts} +0 -1
  170. package/src/{qr/tables.js → ts/qr/tables.ts} +0 -1
  171. package/src/{render/image-data.js → ts/render/image-data.ts} +0 -1
  172. package/src/{render/index.js → ts/render/index.ts} +0 -1
  173. package/src/{render/options.js → ts/render/options.ts} +0 -1
  174. package/src/{render/png.js → ts/render/png.ts} +0 -1
  175. package/src/{render/svg.js → ts/render/svg.ts} +0 -1
  176. package/src/{render/webgl.js → ts/render/webgl.ts} +0 -1
  177. package/src/{render/webgpu.js → ts/render/webgpu.ts} +0 -1
  178. package/src/{rmqr/decoder.js → ts/rmqr/decoder.ts} +0 -1
  179. package/src/{rmqr/detector.js → ts/rmqr/detector.ts} +0 -1
  180. package/src/{rmqr/encoder.js → ts/rmqr/encoder.ts} +0 -1
  181. package/src/{rmqr/index.js → ts/rmqr/index.ts} +0 -1
  182. package/src/{rmqr/tables.js → ts/rmqr/tables.ts} +0 -1
  183. /package/{typings → src/ts}/aztec/decoder.d.ts +0 -0
  184. /package/{typings → src/ts}/aztec/encoder.d.ts +0 -0
  185. /package/{typings → src/ts}/aztec/high-level.d.ts +0 -0
  186. /package/{typings → src/ts}/aztec/index.d.ts +0 -0
  187. /package/{typings → src/ts}/aztec/tables.d.ts +0 -0
  188. /package/{typings → src/ts}/aztecrune/decoder.d.ts +0 -0
  189. /package/{typings → src/ts}/aztecrune/detector.d.ts +0 -0
  190. /package/{typings → src/ts}/aztecrune/encoder.d.ts +0 -0
  191. /package/{typings → src/ts}/aztecrune/index.d.ts +0 -0
  192. /package/{typings → src/ts}/aztecrune/tables.d.ts +0 -0
  193. /package/{typings → src/ts}/bundle/sythos-barcode.d.ts +0 -0
  194. /package/{typings → src/ts}/bundle/sythos-barcode.esm.d.ts +0 -0
  195. /package/{typings → src/ts}/compactpdf417/decoder.d.ts +0 -0
  196. /package/{typings → src/ts}/compactpdf417/detector.d.ts +0 -0
  197. /package/{typings → src/ts}/compactpdf417/encoder.d.ts +0 -0
  198. /package/{typings → src/ts}/compactpdf417/index.d.ts +0 -0
  199. /package/{typings → src/ts}/compactpdf417/tables.d.ts +0 -0
  200. /package/{typings → src/ts}/core/bit-buffer.d.ts +0 -0
  201. /package/{typings → src/ts}/core/bit-matrix.d.ts +0 -0
  202. /package/{typings → src/ts}/core/errors.d.ts +0 -0
  203. /package/{typings → src/ts}/core/galois-field.d.ts +0 -0
  204. /package/{typings → src/ts}/core/index.d.ts +0 -0
  205. /package/{typings → src/ts}/core/reed-solomon.d.ts +0 -0
  206. /package/{typings → src/ts}/databar/codec.d.ts +0 -0
  207. /package/{typings → src/ts}/databar/decoder.d.ts +0 -0
  208. /package/{typings → src/ts}/databar/encoder.d.ts +0 -0
  209. /package/{typings → src/ts}/databar/gs1.d.ts +0 -0
  210. /package/{typings → src/ts}/databar/index.d.ts +0 -0
  211. /package/{typings → src/ts}/databar/patterns.d.ts +0 -0
  212. /package/{typings → src/ts}/databar/tables.d.ts +0 -0
  213. /package/{typings → src/ts}/datamatrix/decoder.d.ts +0 -0
  214. /package/{typings → src/ts}/datamatrix/encoder.d.ts +0 -0
  215. /package/{typings → src/ts}/datamatrix/index.d.ts +0 -0
  216. /package/{typings → src/ts}/datamatrix/tables.d.ts +0 -0
  217. /package/{typings → src/ts}/frameqr/decoder.d.ts +0 -0
  218. /package/{typings → src/ts}/frameqr/detector.d.ts +0 -0
  219. /package/{typings → src/ts}/frameqr/encoder.d.ts +0 -0
  220. /package/{typings → src/ts}/frameqr/index.d.ts +0 -0
  221. /package/{typings → src/ts}/frameqr/tables.d.ts +0 -0
  222. /package/{typings → src/ts}/image/binarizer.d.ts +0 -0
  223. /package/{typings → src/ts}/image/grid-sampler.d.ts +0 -0
  224. /package/{typings → src/ts}/image/index.d.ts +0 -0
  225. /package/{typings → src/ts}/image/luminance.d.ts +0 -0
  226. /package/{typings → src/ts}/image/perspective.d.ts +0 -0
  227. /package/{typings → src/ts}/micropdf417/compaction.d.ts +0 -0
  228. /package/{typings → src/ts}/micropdf417/decoder.d.ts +0 -0
  229. /package/{typings → src/ts}/micropdf417/detector.d.ts +0 -0
  230. /package/{typings → src/ts}/micropdf417/encoder.d.ts +0 -0
  231. /package/{typings → src/ts}/micropdf417/error-correction.d.ts +0 -0
  232. /package/{typings → src/ts}/micropdf417/index.d.ts +0 -0
  233. /package/{typings → src/ts}/micropdf417/tables.d.ts +0 -0
  234. /package/{typings → src/ts}/microqr/decoder.d.ts +0 -0
  235. /package/{typings → src/ts}/microqr/detector.d.ts +0 -0
  236. /package/{typings → src/ts}/microqr/encoder.d.ts +0 -0
  237. /package/{typings → src/ts}/microqr/index.d.ts +0 -0
  238. /package/{typings → src/ts}/microqr/tables.d.ts +0 -0
  239. /package/{typings → src/ts}/oned/addons.d.ts +0 -0
  240. /package/{typings → src/ts}/oned/index.d.ts +0 -0
  241. /package/{typings → src/ts}/oned/patterns.d.ts +0 -0
  242. /package/{typings → src/ts}/oned/reader.d.ts +0 -0
  243. /package/{typings → src/ts}/oned/writers.d.ts +0 -0
  244. /package/{typings → src/ts}/pdf417/compaction.d.ts +0 -0
  245. /package/{typings → src/ts}/pdf417/decoder.d.ts +0 -0
  246. /package/{typings → src/ts}/pdf417/detector.d.ts +0 -0
  247. /package/{typings → src/ts}/pdf417/encoder.d.ts +0 -0
  248. /package/{typings → src/ts}/pdf417/error-correction.d.ts +0 -0
  249. /package/{typings → src/ts}/pdf417/index.d.ts +0 -0
  250. /package/{typings → src/ts}/pdf417/tables.d.ts +0 -0
  251. /package/{typings → src/ts}/qr/decoder.d.ts +0 -0
  252. /package/{typings → src/ts}/qr/detector.d.ts +0 -0
  253. /package/{typings → src/ts}/qr/encoder.d.ts +0 -0
  254. /package/{typings → src/ts}/qr/index.d.ts +0 -0
  255. /package/{typings → src/ts}/qr/tables.d.ts +0 -0
  256. /package/{typings → src/ts}/render/image-data.d.ts +0 -0
  257. /package/{typings → src/ts}/render/index.d.ts +0 -0
  258. /package/{typings → src/ts}/render/options.d.ts +0 -0
  259. /package/{typings → src/ts}/render/png.d.ts +0 -0
  260. /package/{typings → src/ts}/render/svg.d.ts +0 -0
  261. /package/{typings → src/ts}/render/webgl.d.ts +0 -0
  262. /package/{typings → src/ts}/render/webgpu.d.ts +0 -0
  263. /package/{typings → src/ts}/rmqr/decoder.d.ts +0 -0
  264. /package/{typings → src/ts}/rmqr/detector.d.ts +0 -0
  265. /package/{typings → src/ts}/rmqr/encoder.d.ts +0 -0
  266. /package/{typings → src/ts}/rmqr/index.d.ts +0 -0
  267. /package/{typings → src/ts}/rmqr/tables.d.ts +0 -0
@@ -0,0 +1,177 @@
1
+ /*!
2
+ * Sythos Barcode Suite
3
+ *
4
+ * MIT License
5
+ *
6
+ * Copyright (c) 2026 Sythos
7
+ *
8
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ * of this software and associated documentation files (the "Software"), to deal
10
+ * in the Software without restriction, including without limitation the rights
11
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ * copies of the Software, and to permit persons to whom the Software is
13
+ * furnished to do so, subject to the following conditions:
14
+ *
15
+ * The above copyright notice and this permission notice shall be included in all
16
+ * copies or substantial portions of the Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ * SOFTWARE.
25
+ *
26
+ * SPDX-License-Identifier: MIT
27
+ *
28
+ * Original work. No code from any other barcode implementation.
29
+ */
30
+ import { BitMatrix } from '../core/bit-matrix.js';
31
+ /** The 32 rMQR dimensions in ISO/IEC 23941 order (width, height). */
32
+ export const RMQR_SIZES = Object.freeze([
33
+ [43, 7], [59, 7], [77, 7], [99, 7], [139, 7],
34
+ [43, 9], [59, 9], [77, 9], [99, 9], [139, 9],
35
+ [27, 11], [43, 11], [59, 11], [77, 11], [99, 11], [139, 11],
36
+ [27, 13], [43, 13], [59, 13], [77, 13], [99, 13], [139, 13],
37
+ [43, 15], [59, 15], [77, 15], [99, 15], [139, 15],
38
+ [43, 17], [59, 17], [77, 17], [99, 17], [139, 17],
39
+ ]);
40
+ const REMAINDER_BITS = Object.freeze([0, 3, 5, 6, 1, 2, 3, 1, 4, 5, 2, 1, 0, 2, 7, 6, 4, 1, 6, 4, 3, 0, 1, 4, 6, 7, 2, 1, 2, 0, 3, 4]);
41
+ const TOTAL_CODEWORDS = Object.freeze([13, 21, 32, 44, 68, 21, 33, 49, 66, 99, 15, 31, 47, 67, 89, 132, 21, 41, 60, 85, 113, 166, 51, 74, 103, 136, 199, 61, 88, 122, 160, 232]);
42
+ // Each block is [number of blocks, total codewords per block, data codewords per block].
43
+ const M_BLOCKS = [
44
+ [[1, 13, 6]], [[1, 21, 12]], [[1, 32, 20]], [[1, 44, 28]], [[1, 68, 44]],
45
+ [[1, 21, 12]], [[1, 33, 21]], [[1, 49, 31]], [[1, 66, 42]], [[1, 49, 31], [1, 50, 32]],
46
+ [[1, 15, 7]], [[1, 31, 19]], [[1, 47, 31]], [[1, 67, 43]], [[1, 44, 28], [1, 45, 29]], [[2, 66, 42]],
47
+ [[1, 21, 14]], [[1, 41, 27]], [[1, 60, 38]], [[1, 42, 26], [1, 43, 27]], [[1, 56, 36], [1, 57, 37]], [[2, 55, 35], [1, 56, 36]],
48
+ [[1, 51, 33]], [[1, 74, 48]], [[1, 51, 33], [1, 52, 34]], [[2, 68, 44]], [[2, 66, 42], [1, 67, 43]],
49
+ [[1, 60, 39]], [[2, 44, 28]], [[2, 61, 39]], [[2, 53, 33], [1, 54, 34]], [[4, 58, 38]],
50
+ ];
51
+ const H_BLOCKS = [
52
+ [[1, 13, 3]], [[1, 21, 7]], [[1, 32, 10]], [[1, 44, 14]], [[2, 34, 12]],
53
+ [[1, 21, 7]], [[1, 33, 11]], [[1, 24, 8], [1, 25, 9]], [[2, 33, 11]], [[3, 33, 11]],
54
+ [[1, 15, 5]], [[1, 31, 11]], [[1, 23, 7], [1, 24, 8]], [[1, 33, 11], [1, 34, 12]], [[1, 44, 14], [1, 45, 15]], [[3, 44, 14]],
55
+ [[1, 21, 7]], [[1, 41, 13]], [[2, 30, 10]], [[1, 42, 14], [1, 43, 15]], [[1, 37, 11], [2, 38, 12]], [[2, 41, 13], [2, 42, 14]],
56
+ [[1, 25, 7], [1, 26, 8]], [[2, 37, 13]], [[2, 34, 10], [1, 35, 11]], [[4, 34, 12]], [[1, 39, 13], [4, 40, 14]],
57
+ [[1, 30, 10], [1, 31, 11]], [[2, 44, 14]], [[1, 40, 12], [2, 41, 13]], [[4, 40, 14]], [[2, 38, 12], [4, 39, 13]],
58
+ ];
59
+ const COUNT_BITS = Object.freeze({
60
+ numeric: [4, 5, 6, 7, 7, 5, 6, 7, 7, 8, 4, 6, 7, 7, 8, 8, 5, 6, 7, 7, 8, 8, 7, 7, 8, 8, 9, 7, 8, 8, 8, 9],
61
+ alphanumeric: [3, 5, 5, 6, 6, 5, 5, 6, 6, 7, 4, 5, 6, 6, 7, 7, 5, 6, 6, 7, 7, 8, 6, 7, 7, 7, 8, 6, 7, 7, 8, 8],
62
+ byte: [3, 4, 5, 5, 6, 4, 5, 5, 6, 6, 3, 5, 5, 6, 6, 7, 4, 6, 6, 7, 7, 7, 6, 6, 7, 7, 7, 6, 6, 7, 7, 8],
63
+ kanji: [2, 3, 4, 5, 5, 3, 4, 5, 5, 6, 2, 4, 5, 5, 6, 6, 3, 5, 5, 6, 6, 7, 5, 5, 6, 6, 7, 5, 6, 6, 6, 7],
64
+ });
65
+ const ALIGNMENT_BY_WIDTH = Object.freeze({ 27: [], 43: [21], 59: [19, 39], 77: [25, 51], 99: [23, 49, 75], 139: [27, 55, 83, 111] });
66
+ /** @param {number} version */
67
+ export function versionInfo(version) {
68
+ if (!Number.isInteger(version) || version < 1 || version > 32)
69
+ throw new RangeError(`rMQR: version must be 1-32, got ${version}`);
70
+ const [width, height] = RMQR_SIZES[version - 1];
71
+ const blockTable = (ecc) => ecc === 'M' ? M_BLOCKS[version - 1] : H_BLOCKS[version - 1];
72
+ const blockLayout = (ecc) => {
73
+ if (ecc !== 'M' && ecc !== 'H')
74
+ throw new RangeError(`rMQR: ECC must be M or H, got ${ecc}`);
75
+ const blocks = [];
76
+ for (const [count, total, data] of blockTable(ecc))
77
+ for (let i = 0; i < count; i++)
78
+ blocks.push({ total, data, ecc: total - data });
79
+ return { blocks, totalCodewords: TOTAL_CODEWORDS[version - 1], totalDataCodewords: blocks.reduce((n, b) => n + b.data, 0), eccCodewords: blocks.reduce((n, b) => n + b.ecc, 0) };
80
+ };
81
+ return Object.freeze({ version, width, height, name: `R${height}x${width}`, indicator: version - 1, remainderBits: REMAINDER_BITS[version - 1], totalCodewords: TOTAL_CODEWORDS[version - 1], countBits(mode) { return COUNT_BITS[mode]?.[version - 1] ?? 0; }, blockLayout });
82
+ }
83
+ /** @param {number} width @param {number} height */
84
+ export function versionForSize(width, height) {
85
+ const i = RMQR_SIZES.findIndex(([w, h]) => w === width && h === height);
86
+ return i < 0 ? null : versionInfo(i + 1);
87
+ }
88
+ /** @param {number} version */
89
+ export function alignmentCoordinates(version) { return ALIGNMENT_BY_WIDTH[versionInfo(version).width] || []; }
90
+ function bchRemainder(value) {
91
+ const generator = 0x1f25;
92
+ let v = value << 12;
93
+ while (v !== 0 && v.toString(2).length >= 13)
94
+ v ^= generator << (v.toString(2).length - 13);
95
+ return v;
96
+ }
97
+ /** Unmasked 18-bit format sequence: 5-bit version indicator plus ECC bit. */
98
+ export function formatBits(version, ecc) {
99
+ const v = versionInfo(version);
100
+ if (ecc !== 'M' && ecc !== 'H')
101
+ throw new RangeError(`rMQR: ECC must be M or H, got ${ecc}`);
102
+ const data = v.indicator | (ecc === 'H' ? 1 << 5 : 0);
103
+ return (data << 12) | bchRemainder(data);
104
+ }
105
+ export const FORMAT_MASK_FINDER = 0b011111101010110010;
106
+ export const FORMAT_MASK_SUB = 0b100000101001111011;
107
+ /** rMQR has one fixed mask: floor(y/2)+floor(x/3) even. */
108
+ export function maskBit(x, y) { return (Math.floor(y / 2) + Math.floor(x / 3)) % 2 === 0; }
109
+ /** Function modules; set bits are non-data cells. */
110
+ export function functionModules(version) {
111
+ const v = versionInfo(version);
112
+ const m = new BitMatrix(v.width, v.height);
113
+ const { width: w, height: h } = v;
114
+ m.setRegion(0, 0, w, 1);
115
+ m.setRegion(0, h - 1, w, 1);
116
+ m.setRegion(0, 1, 1, h - 2);
117
+ m.setRegion(w - 1, 1, 1, h - 2);
118
+ for (const cx of alignmentCoordinates(version)) {
119
+ m.setRegion(cx - 1, 1, 3, 2);
120
+ m.setRegion(cx - 1, h - 3, 3, 2);
121
+ m.setRegion(cx, 3, 1, h - 6);
122
+ }
123
+ m.setRegion(1, 1, 7, h === 7 ? 5 : 7);
124
+ m.setRegion(8, 1, 3, 5);
125
+ m.setRegion(11, 1, 1, 3);
126
+ m.setRegion(w - 5, h - 5, 4, 4);
127
+ m.setRegion(w - 8, h - 6, 3, 5);
128
+ m.setRegion(w - 5, h - 6, 3, 1);
129
+ m.set(w - 2, 1);
130
+ if (h > 9)
131
+ m.set(1, h - 2);
132
+ return m;
133
+ }
134
+ /** Data coordinates in the standard right-to-left two-column traversal. */
135
+ export function dataModuleOrder(version) {
136
+ const v = versionInfo(version);
137
+ const fn = functionModules(version);
138
+ const out = [];
139
+ let cx = v.width - 2, cy = v.height - 6, dy = -1;
140
+ // The data path starts beside the lower-right format area, then snakes
141
+ // through each pair of columns between the one-module outer border.
142
+ while (cx > 0) {
143
+ for (const xx of [cx, cx - 1])
144
+ if (!fn.get(xx, cy))
145
+ out.push([xx, cy]);
146
+ if (dy < 0 && cy === 1) {
147
+ cx -= 2;
148
+ dy = 1;
149
+ }
150
+ else if (dy > 0 && cy === v.height - 2) {
151
+ cx -= 2;
152
+ dy = -1;
153
+ }
154
+ else
155
+ cy += dy;
156
+ }
157
+ return out;
158
+ }
159
+ export function dataBitCapacity(version, ecc) { const b = versionInfo(version).blockLayout(ecc); return b.totalDataCodewords * 8; }
160
+ export function validateTables() {
161
+ const problems = [];
162
+ if (RMQR_SIZES.length !== 32)
163
+ problems.push(`expected 32 sizes, got ${RMQR_SIZES.length}`);
164
+ for (let i = 1; i <= 32; i++) {
165
+ const v = versionInfo(i);
166
+ const order = dataModuleOrder(i);
167
+ const expected = v.totalCodewords * 8 + v.remainderBits;
168
+ if (order.length !== expected)
169
+ problems.push(`${v.name}: data modules ${order.length}, expected ${expected}`);
170
+ for (const ecc of ['M', 'H']) {
171
+ const b = v.blockLayout(ecc);
172
+ if (b.totalCodewords !== v.totalCodewords)
173
+ problems.push(`${v.name}-${ecc}: block total mismatch`);
174
+ }
175
+ }
176
+ return problems;
177
+ }
@@ -23,7 +23,6 @@
23
23
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
24
  * SOFTWARE.
25
25
  *
26
- * SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
27
26
  * SPDX-License-Identifier: MIT
28
27
  *
29
28
  * Original work. No code from any other barcode implementation.
@@ -55,8 +55,8 @@ export declare function detectAztec(binaryImage: import('../core/bit-matrix.js')
55
55
  * images without an Aztec code, therefore invalid candidates return null.
56
56
  *
57
57
  * @param {import('../core/bit-matrix.js').BitMatrix} binaryImage
58
- * @returns {(import('./decoder.js').DecodeResult & {corners: Point[]}) | null}
58
+ * @returns {(import("./decoder.js").DecodeResult & {corners: Point[]}) | null}
59
59
  */
60
- export declare function detectAndDecodeAztec(binaryImage: import('../core/bit-matrix.js').BitMatrix): (import('./decoder.js').DecodeResult & {
60
+ export declare function detectAndDecodeAztec(binaryImage: import('../core/bit-matrix.js').BitMatrix): (import("./decoder.js").DecodeResult & {
61
61
  corners: Point[];
62
62
  }) | null;
@@ -23,7 +23,6 @@
23
23
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
24
  * SOFTWARE.
25
25
  *
26
- * SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
27
26
  * SPDX-License-Identifier: MIT
28
27
  *
29
28
  * Original work. No code from any other barcode implementation.
@@ -23,7 +23,6 @@
23
23
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
24
  * SOFTWARE.
25
25
  *
26
- * SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
27
26
  * SPDX-License-Identifier: MIT
28
27
  *
29
28
  * Original work. No code from any other barcode implementation.
@@ -23,7 +23,6 @@
23
23
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
24
  * SOFTWARE.
25
25
  *
26
- * SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
27
26
  * SPDX-License-Identifier: MIT
28
27
  *
29
28
  * Original work. No code from any other barcode implementation.
@@ -23,7 +23,6 @@
23
23
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
24
  * SOFTWARE.
25
25
  *
26
- * SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
27
26
  * SPDX-License-Identifier: MIT
28
27
  *
29
28
  * Original work. No code from any other barcode implementation.
@@ -23,7 +23,6 @@
23
23
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
24
  * SOFTWARE.
25
25
  *
26
- * SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
27
26
  * SPDX-License-Identifier: MIT
28
27
  *
29
28
  * Original work. No code from any other barcode implementation.
@@ -23,7 +23,6 @@
23
23
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
24
  * SOFTWARE.
25
25
  *
26
- * SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
27
26
  * SPDX-License-Identifier: MIT
28
27
  *
29
28
  * Original work. No code from any other barcode implementation.
@@ -23,7 +23,6 @@
23
23
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
24
  * SOFTWARE.
25
25
  *
26
- * SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
27
26
  * SPDX-License-Identifier: MIT
28
27
  *
29
28
  * Original work. No code from any other barcode implementation.
@@ -23,7 +23,6 @@
23
23
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
24
  * SOFTWARE.
25
25
  *
26
- * SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
27
26
  * SPDX-License-Identifier: MIT
28
27
  *
29
28
  * Original work. No code from any other barcode implementation.
@@ -23,7 +23,6 @@
23
23
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
24
  * SOFTWARE.
25
25
  *
26
- * SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
27
26
  * SPDX-License-Identifier: MIT
28
27
  *
29
28
  * Original work. No code from any other barcode implementation.
@@ -23,7 +23,6 @@
23
23
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
24
  * SOFTWARE.
25
25
  *
26
- * SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
27
26
  * SPDX-License-Identifier: MIT
28
27
  *
29
28
  * Original work. No code from any other barcode implementation.
@@ -23,7 +23,6 @@
23
23
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
24
  * SOFTWARE.
25
25
  *
26
- * SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
27
26
  * SPDX-License-Identifier: MIT
28
27
  *
29
28
  * Original work. No code from any other barcode implementation.
@@ -23,7 +23,6 @@
23
23
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
24
  * SOFTWARE.
25
25
  *
26
- * SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
27
26
  * SPDX-License-Identifier: MIT
28
27
  *
29
28
  * Original work. No code from any other barcode implementation.
@@ -23,7 +23,6 @@
23
23
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
24
  * SOFTWARE.
25
25
  *
26
- * SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
27
26
  * SPDX-License-Identifier: MIT
28
27
  *
29
28
  * Original work. No code from any other barcode implementation.
@@ -1,8 +1,3 @@
1
- /*!
2
- * SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
3
- * SPDX-License-Identifier: MIT
4
- */
5
-
6
1
  /* Compact PDF417 public module exports. */
7
2
 
8
3
  export {
@@ -23,7 +23,6 @@
23
23
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
24
  * SOFTWARE.
25
25
  *
26
- * SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
27
26
  * SPDX-License-Identifier: MIT
28
27
  *
29
28
  * Original work. No code from any other barcode implementation.
@@ -23,7 +23,6 @@
23
23
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
24
  * SOFTWARE.
25
25
  *
26
- * SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
27
26
  * SPDX-License-Identifier: MIT
28
27
  *
29
28
  * Original work. No code from any other barcode implementation.
@@ -23,7 +23,6 @@
23
23
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
24
  * SOFTWARE.
25
25
  *
26
- * SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
27
26
  * SPDX-License-Identifier: MIT
28
27
  *
29
28
  * Original work. No code from any other barcode implementation.
@@ -23,7 +23,6 @@
23
23
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
24
  * SOFTWARE.
25
25
  *
26
- * SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
27
26
  * SPDX-License-Identifier: MIT
28
27
  *
29
28
  * Original work. No code from any other barcode implementation.
@@ -23,7 +23,6 @@
23
23
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
24
  * SOFTWARE.
25
25
  *
26
- * SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
27
26
  * SPDX-License-Identifier: MIT
28
27
  *
29
28
  * Original work. No code from any other barcode implementation.
@@ -23,7 +23,6 @@
23
23
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
24
  * SOFTWARE.
25
25
  *
26
- * SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
27
26
  * SPDX-License-Identifier: MIT
28
27
  *
29
28
  * Original work. No code from any other barcode implementation.
@@ -23,7 +23,6 @@
23
23
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
24
  * SOFTWARE.
25
25
  *
26
- * SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
27
26
  * SPDX-License-Identifier: MIT
28
27
  *
29
28
  * Original work. No code from any other barcode implementation.
@@ -23,7 +23,6 @@
23
23
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
24
  * SOFTWARE.
25
25
  *
26
- * SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
27
26
  * SPDX-License-Identifier: MIT
28
27
  *
29
28
  * Original work. No code from any other barcode implementation.
@@ -4,7 +4,6 @@
4
4
  * MIT License
5
5
  *
6
6
  * Copyright (c) 2026 Sythos
7
- * SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
8
7
  *
9
8
  * Permission is hereby granted, free of charge, to any person obtaining a copy
10
9
  * of this software and associated documentation files (the "Software"), to deal
@@ -23,7 +23,6 @@
23
23
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
24
  * SOFTWARE.
25
25
  *
26
- * SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
27
26
  * SPDX-License-Identifier: MIT
28
27
  *
29
28
  * Original work. No code from any other barcode implementation.
@@ -23,7 +23,6 @@
23
23
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
24
  * SOFTWARE.
25
25
  *
26
- * SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
27
26
  * SPDX-License-Identifier: MIT
28
27
  *
29
28
  * Original work. No code from any other barcode implementation.
@@ -4,7 +4,6 @@
4
4
  * MIT License
5
5
  *
6
6
  * Copyright (c) 2026 Sythos
7
- * SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
8
7
  *
9
8
  * Permission is hereby granted, free of charge, to any person obtaining a copy
10
9
  * of this software and associated documentation files (the "Software"), to deal
@@ -23,7 +23,6 @@
23
23
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
24
  * SOFTWARE.
25
25
  *
26
- * SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
27
26
  * SPDX-License-Identifier: MIT
28
27
  *
29
28
  * Original work. No code from any other barcode implementation.
@@ -23,7 +23,6 @@
23
23
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
24
  * SOFTWARE.
25
25
  *
26
- * SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
27
26
  * SPDX-License-Identifier: MIT
28
27
  *
29
28
  * Original work. No code from any other barcode implementation.
@@ -23,7 +23,6 @@
23
23
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
24
  * SOFTWARE.
25
25
  *
26
- * SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
27
26
  * SPDX-License-Identifier: MIT
28
27
  *
29
28
  * Original work. No code from any other barcode implementation.
@@ -52,8 +52,8 @@ export declare function detectDataMatrix(binaryImage: import('../core/bit-matrix
52
52
  * image without a symbol, so candidates that cannot decode are skipped.
53
53
  *
54
54
  * @param {import('../core/bit-matrix.js').BitMatrix} binaryImage
55
- * @returns {(import('./decoder.js').DecodeResult & {corners: Point[]}) | null}
55
+ * @returns {(import("./decoder.js").DecodeResult & {corners: Point[]}) | null}
56
56
  */
57
- export declare function detectAndDecodeDataMatrix(binaryImage: import('../core/bit-matrix.js').BitMatrix): (import('./decoder.js').DecodeResult & {
57
+ export declare function detectAndDecodeDataMatrix(binaryImage: import('../core/bit-matrix.js').BitMatrix): (import("./decoder.js").DecodeResult & {
58
58
  corners: Point[];
59
59
  }) | null;
@@ -23,7 +23,6 @@
23
23
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
24
  * SOFTWARE.
25
25
  *
26
- * SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
27
26
  * SPDX-License-Identifier: MIT
28
27
  *
29
28
  * Original work. No code from any other barcode implementation.
@@ -23,7 +23,6 @@
23
23
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
24
  * SOFTWARE.
25
25
  *
26
- * SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
27
26
  * SPDX-License-Identifier: MIT
28
27
  *
29
28
  * Original work. No code from any other barcode implementation.
@@ -23,7 +23,6 @@
23
23
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
24
  * SOFTWARE.
25
25
  *
26
- * SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
27
26
  * SPDX-License-Identifier: MIT
28
27
  *
29
28
  * Original work. No code from any other barcode implementation.
@@ -23,7 +23,6 @@
23
23
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
24
  * SOFTWARE.
25
25
  *
26
- * SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
27
26
  * SPDX-License-Identifier: MIT
28
27
  *
29
28
  * Original work. No code from any other barcode implementation.
@@ -4,7 +4,6 @@
4
4
  * MIT License
5
5
  *
6
6
  * Copyright (c) 2026 Sythos
7
- * SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
8
7
  *
9
8
  * Permission is hereby granted, free of charge, to any person obtaining a copy
10
9
  * of this software and associated documentation files (the "Software"), to deal
@@ -30,7 +29,7 @@
30
29
  */
31
30
 
32
31
  /**
33
- * Decoder for FrameQR Code.
32
+ * Decoder for the Sythos Canvas QR profile.
34
33
  *
35
34
  * This is intentionally not a DENSO FrameQR decoder. The profile is a QR
36
35
  * symbol with a bounded artwork reservation and an explicit `frameqr` marker.
@@ -88,7 +87,7 @@ function isExpectedProfile(profile) {
88
87
  * @returns {{canvas: object, damage: object}}
89
88
  */
90
89
  function validateCanvas(symbolSize, version, canvas) {
91
- if (!isObject(canvas)) throw new FormatError('FrameQR Code: canvas metadata is missing');
90
+ if (!isObject(canvas)) throw new FormatError('Sythos Canvas QR: canvas metadata is missing');
92
91
 
93
92
  let normalized;
94
93
  try {
@@ -104,14 +103,14 @@ function validateCanvas(symbolSize, version, canvas) {
104
103
  }
105
104
  } catch (error) {
106
105
  if (error instanceof FormatError) throw error;
107
- throw new FormatError(`FrameQR Code: invalid canvas metadata: ${error.message}`);
106
+ throw new FormatError(`Sythos Canvas QR: invalid canvas metadata: ${error.message}`);
108
107
  }
109
108
 
110
109
  let damage;
111
110
  try {
112
111
  damage = analyzeCanvasDamage(version, normalized);
113
112
  } catch (error) {
114
- throw new FormatError(`FrameQR Code: cannot analyse canvas damage: ${error.message}`);
113
+ throw new FormatError(`Sythos Canvas QR: cannot analyse canvas damage: ${error.message}`);
115
114
  }
116
115
  return { canvas: normalized, damage };
117
116
  }
@@ -136,24 +135,24 @@ function resolveProfile(matrix, options) {
136
135
  const markerId = isObject(markerProfile) ? markerProfile.id : markerProfile;
137
136
  const suppliedId = isObject(suppliedProfile) ? suppliedProfile.id : suppliedProfile;
138
137
  if (markerId !== suppliedId) {
139
- throw new FormatError('FrameQR Code: matrix and requested profile markers disagree');
138
+ throw new FormatError('Sythos Canvas QR: matrix and requested profile markers disagree');
140
139
  }
141
140
  }
142
141
  const profile = markerProfile ?? suppliedProfile;
143
142
 
144
143
  if (!isExpectedProfile(profile)) {
145
144
  throw new FormatError(
146
- 'FrameQR Code: profile marker is missing or is not a FrameQR Code symbol'
145
+ 'Sythos Canvas QR: profile marker is missing or is not the Sythos Canvas QR profile'
147
146
  );
148
147
  }
149
148
  if (marker && marker.certified === true) {
150
149
  throw new FormatError(
151
- 'FrameQR Code: certified FrameQR input is not supported by this profile decoder'
150
+ 'Sythos Canvas QR: certified FrameQR input is not supported by this profile decoder'
152
151
  );
153
152
  }
154
153
  if (!marker && !options.allowUnmarked) {
155
154
  throw new FormatError(
156
- 'FrameQR Code: unmarked QR matrix rejected; provide a verified profile marker'
155
+ 'Sythos Canvas QR: unmarked QR matrix rejected; provide a verified profile marker'
157
156
  );
158
157
  }
159
158
 
@@ -161,7 +160,7 @@ function resolveProfile(matrix, options) {
161
160
  const canvas = options.canvas ?? markerCanvas;
162
161
  const version = (matrix.width - 17) / 4;
163
162
  if (!Number.isInteger(version) || version < 1 || version > 40) {
164
- throw new FormatError(`FrameQR Code: invalid QR symbol size ${matrix.width}`);
163
+ throw new FormatError(`Sythos Canvas QR: invalid QR symbol size ${matrix.width}`);
165
164
  }
166
165
  const checked = validateCanvas(matrix.width, version, canvas);
167
166
  if (markerCanvas && options.canvas) {
@@ -169,11 +168,11 @@ function resolveProfile(matrix, options) {
169
168
  try {
170
169
  marked = normalizeCanvasSpec(matrix.width, markerCanvas);
171
170
  } catch (error) {
172
- throw new FormatError(`FrameQR Code: invalid marker canvas: ${error.message}`);
171
+ throw new FormatError(`Sythos Canvas QR: invalid marker canvas: ${error.message}`);
173
172
  }
174
173
  const fields = ['shape', 'centerX', 'centerY', 'width', 'height', 'angle'];
175
174
  if (fields.some((field) => marked[field] !== checked.canvas[field])) {
176
- throw new FormatError('FrameQR Code: matrix and requested canvas metadata disagree');
175
+ throw new FormatError('Sythos Canvas QR: matrix and requested canvas metadata disagree');
177
176
  }
178
177
  }
179
178
  return {
@@ -185,7 +184,7 @@ function resolveProfile(matrix, options) {
185
184
  }
186
185
 
187
186
  /**
188
- * Decode a FrameQR Code matrix.
187
+ * Decode a Sythos Canvas QR matrix.
189
188
  *
190
189
  * @param {import('../core/bit-matrix.js').BitMatrix} matrix
191
190
  * Square QR modules, normally returned by `encodeFrameQR` or a FrameQR
@@ -205,11 +204,11 @@ function resolveProfile(matrix, options) {
205
204
  */
206
205
  export function decodeFrameQR(matrix, options = {}) {
207
206
  if (!matrix || !Number.isInteger(matrix.width) || !Number.isInteger(matrix.height)) {
208
- throw new FormatError('FrameQR Code: no matrix supplied');
207
+ throw new FormatError('Sythos Canvas QR: no matrix supplied');
209
208
  }
210
209
  if (matrix.width !== matrix.height) {
211
210
  throw new FormatError(
212
- `FrameQR Code: symbol must be square, got ${matrix.width}x${matrix.height}`
211
+ `Sythos Canvas QR: symbol must be square, got ${matrix.width}x${matrix.height}`
213
212
  );
214
213
  }
215
214
 
@@ -221,7 +220,7 @@ export function decodeFrameQR(matrix, options = {}) {
221
220
  // Preserve the original QR/RS error when possible, but give callers a
222
221
  // profile-specific context without exposing implementation details.
223
222
  if (error instanceof FormatError) {
224
- throw new FormatError(`FrameQR Code: payload is not recoverable: ${error.message}`);
223
+ throw new FormatError(`Sythos Canvas QR: payload is not recoverable: ${error.message}`);
225
224
  }
226
225
  throw error;
227
226
  }