@atooyu/uxto-ui 1.1.31 → 1.1.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +476 -222
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +476 -222
- package/dist/index.mjs.map +1 -1
- package/dist/style.css +4 -4
- package/package.json +1 -1
- package/src/components/u-qrcode/u-qrcode.vue +560 -263
package/dist/index.js
CHANGED
|
@@ -5046,241 +5046,466 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
5046
5046
|
setup(__props) {
|
|
5047
5047
|
const props = __props;
|
|
5048
5048
|
const modules = vue.ref([]);
|
|
5049
|
+
const moduleCount = vue.ref(0);
|
|
5049
5050
|
const cellSize = vue.computed(() => {
|
|
5050
|
-
if (
|
|
5051
|
-
return props.size /
|
|
5051
|
+
if (moduleCount.value === 0) return 0;
|
|
5052
|
+
return props.size / moduleCount.value;
|
|
5052
5053
|
});
|
|
5053
5054
|
const QRCode = (() => {
|
|
5054
|
-
const
|
|
5055
|
-
const
|
|
5056
|
-
[
|
|
5057
|
-
[
|
|
5058
|
-
[
|
|
5059
|
-
[
|
|
5060
|
-
[
|
|
5061
|
-
[
|
|
5062
|
-
[
|
|
5063
|
-
[
|
|
5064
|
-
[
|
|
5065
|
-
[
|
|
5066
|
-
[
|
|
5067
|
-
[
|
|
5068
|
-
[
|
|
5069
|
-
[
|
|
5070
|
-
[
|
|
5071
|
-
[
|
|
5072
|
-
[
|
|
5073
|
-
[
|
|
5074
|
-
[
|
|
5075
|
-
[
|
|
5076
|
-
[
|
|
5077
|
-
[
|
|
5078
|
-
[
|
|
5079
|
-
[
|
|
5080
|
-
[
|
|
5081
|
-
[
|
|
5082
|
-
[
|
|
5083
|
-
[
|
|
5084
|
-
[
|
|
5085
|
-
[
|
|
5086
|
-
[
|
|
5087
|
-
[
|
|
5088
|
-
[
|
|
5089
|
-
[
|
|
5090
|
-
[
|
|
5091
|
-
[
|
|
5092
|
-
[
|
|
5093
|
-
[
|
|
5094
|
-
[
|
|
5095
|
-
[
|
|
5055
|
+
const ECL = { L: 1, M: 0, Q: 3, H: 2 };
|
|
5056
|
+
const MAX_LENGTH = [
|
|
5057
|
+
[[], [0, 0], [0, 0], [0, 0], [0, 0]],
|
|
5058
|
+
[[], [41, 25], [34, 20], [27, 16], [17, 10]],
|
|
5059
|
+
[[], [77, 47], [63, 38], [48, 29], [34, 20]],
|
|
5060
|
+
[[], [127, 77], [101, 61], [77, 47], [58, 35]],
|
|
5061
|
+
[[], [187, 114], [149, 90], [111, 67], [82, 50]],
|
|
5062
|
+
[[], [255, 154], [202, 122], [144, 87], [106, 64]],
|
|
5063
|
+
[[], [322, 195], [255, 154], [178, 108], [139, 84]],
|
|
5064
|
+
[[], [370, 224], [293, 178], [221, 134], [154, 93]],
|
|
5065
|
+
[[], [461, 279], [365, 221], [262, 159], [202, 122]],
|
|
5066
|
+
[[], [552, 335], [432, 262], [311, 189], [235, 143]],
|
|
5067
|
+
[[], [652, 395], [513, 311], [366, 221], [288, 174]],
|
|
5068
|
+
[[], [772, 468], [604, 366], [423, 259], [331, 200]],
|
|
5069
|
+
[[], [883, 535], [691, 419], [509, 312], [374, 227]],
|
|
5070
|
+
[[], [1022, 619], [796, 483], [603, 368], [427, 259]],
|
|
5071
|
+
[[], [1101, 667], [871, 528], [651, 395], [462, 283]],
|
|
5072
|
+
[[], [1250, 758], [991, 600], [734, 445], [540, 325]],
|
|
5073
|
+
[[], [1408, 854], [1082, 656], [816, 488], [606, 374]],
|
|
5074
|
+
[[], [1548, 938], [1212, 734], [909, 547], [682, 409]],
|
|
5075
|
+
[[], [1725, 1046], [1346, 816], [970, 587], [766, 465]],
|
|
5076
|
+
[[], [1903, 1153], [1500, 909], [1085, 660], [832, 514]],
|
|
5077
|
+
[[], [2061, 1249], [1600, 970], [1156, 701], [901, 548]],
|
|
5078
|
+
[[], [2232, 1352], [1708, 1035], [1258, 754], [965, 600]],
|
|
5079
|
+
[[], [2409, 1460], [1872, 1134], [1364, 816], [1049, 644]],
|
|
5080
|
+
[[], [2620, 1588], [2059, 1248], [1475, 889], [1117, 678]],
|
|
5081
|
+
[[], [2812, 1704], [2188, 1326], [1588, 947], [1193, 729]],
|
|
5082
|
+
[[], [3057, 1853], [2395, 1451], [1718, 1027], [1290, 783]],
|
|
5083
|
+
[[], [3283, 1990], [2544, 1542], [1804, 1094], [1358, 830]],
|
|
5084
|
+
[[], [3517, 2132], [2701, 1637], [1933, 1162], [1448, 887]],
|
|
5085
|
+
[[], [3669, 2223], [2857, 1732], [2085, 1258], [1528, 936]],
|
|
5086
|
+
[[], [3909, 2369], [3035, 1839], [2181, 1305], [1592, 970]],
|
|
5087
|
+
[[], [4158, 2520], [3289, 1994], [2358, 1417], [1692, 1027]],
|
|
5088
|
+
[[], [4417, 2677], [3486, 2113], [2473, 1488], [1770, 1074]],
|
|
5089
|
+
[[], [4686, 2840], [3693, 2238], [2670, 1600], [1882, 1150]],
|
|
5090
|
+
[[], [4965, 3009], [3909, 2369], [2805, 1696], [1963, 1190]],
|
|
5091
|
+
[[], [5253, 3183], [4134, 2506], [2949, 1779], [2100, 1263]],
|
|
5092
|
+
[[], [5529, 3351], [4343, 2632], [3081, 1861], [2201, 1336]],
|
|
5093
|
+
[[], [5836, 3537], [4588, 2780], [3244, 1962], [2341, 1414]],
|
|
5094
|
+
[[], [6153, 3729], [4775, 2894], [3417, 2071], [2463, 1489]],
|
|
5095
|
+
[[], [6479, 3927], [5039, 3054], [3599, 2180], [2625, 1582]],
|
|
5096
|
+
[[], [6743, 4087], [5313, 3220], [3791, 2289], [2735, 1655]],
|
|
5097
|
+
[[], [7089, 4296], [5596, 3391], [3993, 2420], [2927, 1772]]
|
|
5096
5098
|
];
|
|
5097
|
-
const
|
|
5098
|
-
|
|
5099
|
-
|
|
5100
|
-
|
|
5101
|
-
|
|
5102
|
-
[
|
|
5103
|
-
|
|
5104
|
-
|
|
5105
|
-
[-
|
|
5106
|
-
[-1, 230, 180, 130, 98],
|
|
5107
|
-
[-1, 271, 213, 151, 119],
|
|
5108
|
-
[-1, 321, 251, 177, 137],
|
|
5109
|
-
[-1, 367, 287, 203, 155],
|
|
5110
|
-
[-1, 425, 331, 241, 177],
|
|
5111
|
-
[-1, 458, 362, 258, 194],
|
|
5112
|
-
[-1, 520, 412, 292, 220],
|
|
5113
|
-
[-1, 586, 450, 322, 250],
|
|
5114
|
-
[-1, 644, 504, 364, 280],
|
|
5115
|
-
[-1, 718, 560, 394, 310],
|
|
5116
|
-
[-1, 792, 624, 442, 338],
|
|
5117
|
-
[-1, 858, 666, 482, 382],
|
|
5118
|
-
[-1, 929, 711, 509, 403],
|
|
5119
|
-
[-1, 1003, 779, 565, 439],
|
|
5120
|
-
[-1, 1091, 857, 611, 461],
|
|
5121
|
-
[-1, 1171, 911, 661, 511],
|
|
5122
|
-
[-1, 1273, 997, 715, 535],
|
|
5123
|
-
[-1, 1367, 1059, 751, 593],
|
|
5124
|
-
[-1, 1465, 1125, 805, 625],
|
|
5125
|
-
[-1, 1528, 1190, 868, 658],
|
|
5126
|
-
[-1, 1628, 1264, 908, 698],
|
|
5127
|
-
[-1, 1732, 1370, 982, 742],
|
|
5128
|
-
[-1, 1840, 1452, 1030, 790],
|
|
5129
|
-
[-1, 1952, 1538, 1112, 842],
|
|
5130
|
-
[-1, 2068, 1628, 1168, 898],
|
|
5131
|
-
[-1, 2188, 1722, 1228, 958],
|
|
5132
|
-
[-1, 2303, 1809, 1283, 983],
|
|
5133
|
-
[-1, 2431, 1911, 1351, 1051],
|
|
5134
|
-
[-1, 2563, 1989, 1423, 1093],
|
|
5135
|
-
[-1, 2699, 2099, 1499, 1139],
|
|
5136
|
-
[-1, 2809, 2213, 1579, 1219],
|
|
5137
|
-
[-1, 2953, 2331, 1663, 1273]
|
|
5138
|
-
];
|
|
5139
|
-
const GF_EXP = new Array(512);
|
|
5140
|
-
const GF_LOG = new Array(256);
|
|
5141
|
-
let x = 1;
|
|
5142
|
-
for (let i = 0; i < 255; i++) {
|
|
5143
|
-
GF_EXP[i] = x;
|
|
5144
|
-
GF_LOG[x] = i;
|
|
5145
|
-
x = x * 2;
|
|
5146
|
-
if (x >= 256) x ^= 285;
|
|
5099
|
+
const PAD0 = 236;
|
|
5100
|
+
const PAD1 = 17;
|
|
5101
|
+
const EXP_TABLE = new Array(256);
|
|
5102
|
+
const LOG_TABLE = new Array(256);
|
|
5103
|
+
for (let i = 0; i < 8; i++) {
|
|
5104
|
+
EXP_TABLE[i] = 1 << i;
|
|
5105
|
+
}
|
|
5106
|
+
for (let i = 8; i < 256; i++) {
|
|
5107
|
+
EXP_TABLE[i] = EXP_TABLE[i - 4] ^ EXP_TABLE[i - 5] ^ EXP_TABLE[i - 6] ^ EXP_TABLE[i - 8];
|
|
5147
5108
|
}
|
|
5148
|
-
for (let i =
|
|
5149
|
-
|
|
5109
|
+
for (let i = 0; i < 255; i++) {
|
|
5110
|
+
LOG_TABLE[EXP_TABLE[i]] = i;
|
|
5150
5111
|
}
|
|
5151
|
-
|
|
5112
|
+
function gmul(a, b) {
|
|
5152
5113
|
if (a === 0 || b === 0) return 0;
|
|
5153
|
-
return
|
|
5154
|
-
}
|
|
5155
|
-
|
|
5156
|
-
const gen =
|
|
5157
|
-
for (let i = 0; i < eccCount; i++) {
|
|
5158
|
-
const temp = new Array(gen.length + 1).fill(0);
|
|
5159
|
-
for (let j = 0; j < gen.length; j++) {
|
|
5160
|
-
temp[j] ^= gen[j];
|
|
5161
|
-
temp[j + 1] ^= gfMul(gen[j], GF_EXP[i]);
|
|
5162
|
-
}
|
|
5163
|
-
gen.length = 0;
|
|
5164
|
-
gen.push(...temp);
|
|
5165
|
-
}
|
|
5114
|
+
return EXP_TABLE[(LOG_TABLE[a] + LOG_TABLE[b]) % 255];
|
|
5115
|
+
}
|
|
5116
|
+
function getECC(data, eccCount) {
|
|
5117
|
+
const gen = getGenerator(eccCount);
|
|
5166
5118
|
const ecc = new Array(eccCount).fill(0);
|
|
5167
5119
|
for (const byte of data) {
|
|
5168
|
-
const
|
|
5120
|
+
const temp = byte ^ ecc[0];
|
|
5169
5121
|
ecc.shift();
|
|
5170
5122
|
ecc.push(0);
|
|
5171
5123
|
for (let i = 0; i < eccCount; i++) {
|
|
5172
|
-
ecc[i] ^=
|
|
5124
|
+
ecc[i] ^= gmul(gen[i], temp);
|
|
5173
5125
|
}
|
|
5174
5126
|
}
|
|
5175
5127
|
return ecc;
|
|
5176
|
-
}
|
|
5177
|
-
|
|
5178
|
-
|
|
5179
|
-
|
|
5180
|
-
|
|
5181
|
-
|
|
5128
|
+
}
|
|
5129
|
+
function getGenerator(count) {
|
|
5130
|
+
let gen = [1];
|
|
5131
|
+
for (let i = 0; i < count; i++) {
|
|
5132
|
+
const temp = new Array(gen.length + 1).fill(0);
|
|
5133
|
+
for (let j = 0; j < gen.length; j++) {
|
|
5134
|
+
temp[j] ^= gen[j];
|
|
5135
|
+
temp[j + 1] ^= gmul(gen[j], EXP_TABLE[i]);
|
|
5136
|
+
}
|
|
5137
|
+
gen = temp;
|
|
5138
|
+
}
|
|
5139
|
+
return gen;
|
|
5140
|
+
}
|
|
5141
|
+
function getTypeNumber(data, ecl) {
|
|
5142
|
+
const eclIdx = ECL[ecl];
|
|
5143
|
+
for (let type = 1; type <= 40; type++) {
|
|
5144
|
+
const maxLen = MAX_LENGTH[type][eclIdx + 1][2];
|
|
5145
|
+
if (data.length <= maxLen) return type;
|
|
5182
5146
|
}
|
|
5183
5147
|
return 40;
|
|
5184
|
-
}
|
|
5185
|
-
|
|
5186
|
-
const
|
|
5187
|
-
const
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
|
|
5148
|
+
}
|
|
5149
|
+
function createMatrix(typeNumber) {
|
|
5150
|
+
const size = typeNumber * 4 + 17;
|
|
5151
|
+
const matrix = [];
|
|
5152
|
+
for (let i = 0; i < size; i++) {
|
|
5153
|
+
matrix[i] = new Array(size).fill(null);
|
|
5154
|
+
}
|
|
5155
|
+
return matrix;
|
|
5156
|
+
}
|
|
5157
|
+
function setupPositionDetectionPattern(matrix) {
|
|
5158
|
+
const size = matrix.length;
|
|
5159
|
+
const positions = [
|
|
5160
|
+
[0, 0],
|
|
5161
|
+
[size - 7, 0],
|
|
5162
|
+
[0, size - 7]
|
|
5163
|
+
];
|
|
5164
|
+
for (const [row, col] of positions) {
|
|
5165
|
+
for (let r = 0; r < 7; r++) {
|
|
5166
|
+
for (let c = 0; c < 7; c++) {
|
|
5167
|
+
const val = r === 0 || r === 6 || c === 0 || c === 6 || r >= 2 && r <= 4 && c >= 2 && c <= 4 ? 1 : 0;
|
|
5168
|
+
matrix[row + r][col + c] = val;
|
|
5169
|
+
}
|
|
5170
|
+
}
|
|
5171
|
+
}
|
|
5172
|
+
}
|
|
5173
|
+
function setupTimingPattern(matrix) {
|
|
5174
|
+
const size = matrix.length;
|
|
5175
|
+
for (let i = 8; i < size - 8; i++) {
|
|
5176
|
+
const val = i % 2 === 0 ? 1 : 0;
|
|
5177
|
+
if (matrix[6][i] === null) matrix[6][i] = val;
|
|
5178
|
+
if (matrix[i][6] === null) matrix[i][6] = val;
|
|
5179
|
+
}
|
|
5180
|
+
}
|
|
5181
|
+
function setupAlignmentPattern(matrix, typeNumber) {
|
|
5182
|
+
if (typeNumber < 2) return;
|
|
5183
|
+
const positions = getAlignmentPositions(typeNumber);
|
|
5184
|
+
for (const row of positions) {
|
|
5185
|
+
for (const col of positions) {
|
|
5186
|
+
if (matrix[row][col] !== null) continue;
|
|
5187
|
+
for (let r = -2; r <= 2; r++) {
|
|
5188
|
+
for (let c = -2; c <= 2; c++) {
|
|
5189
|
+
const val = Math.abs(r) === 2 || Math.abs(c) === 2 || r === 0 && c === 0 ? 1 : 0;
|
|
5190
|
+
matrix[row + r][col + c] = val;
|
|
5191
|
+
}
|
|
5192
|
+
}
|
|
5193
|
+
}
|
|
5194
|
+
}
|
|
5195
|
+
}
|
|
5196
|
+
function getAlignmentPositions(typeNumber) {
|
|
5197
|
+
if (typeNumber === 1) return [];
|
|
5198
|
+
const intervals = Math.floor(typeNumber / 7) + 1;
|
|
5199
|
+
const size = typeNumber * 4 + 17;
|
|
5200
|
+
const step = Math.ceil((size - 13) / (intervals + 1));
|
|
5201
|
+
const positions = [6];
|
|
5202
|
+
for (let i = 1; i <= intervals; i++) {
|
|
5203
|
+
positions.push(6 + i * step);
|
|
5204
|
+
}
|
|
5205
|
+
positions[positions.length - 1] = size - 7;
|
|
5206
|
+
return [...new Set(positions)].sort((a, b) => a - b);
|
|
5207
|
+
}
|
|
5208
|
+
function setupVersionInfo(matrix, typeNumber) {
|
|
5209
|
+
if (typeNumber < 7) return;
|
|
5210
|
+
const size = matrix.length;
|
|
5211
|
+
let version = typeNumber;
|
|
5212
|
+
for (let i = 0; i < 6; i++) {
|
|
5213
|
+
for (let j = 0; j < 3; j++) {
|
|
5214
|
+
matrix[size - 11 + j][i] = version & 1;
|
|
5215
|
+
matrix[i][size - 11 + j] = version & 1;
|
|
5216
|
+
version >>= 1;
|
|
5217
|
+
}
|
|
5218
|
+
}
|
|
5219
|
+
}
|
|
5220
|
+
function setupFormatInfo(matrix, eclIdx, maskPattern) {
|
|
5221
|
+
const size = matrix.length;
|
|
5222
|
+
const data = eclIdx << 3 | maskPattern;
|
|
5223
|
+
let rem = data;
|
|
5224
|
+
for (let i = 0; i < 10; i++) {
|
|
5225
|
+
rem = rem << 1 ^ (rem >> 9) * 1335;
|
|
5226
|
+
}
|
|
5227
|
+
const format = (data << 10 | rem & 1023) ^ 21522;
|
|
5191
5228
|
const bits = [];
|
|
5192
|
-
|
|
5193
|
-
|
|
5229
|
+
for (let i = 0; i < 15; i++) {
|
|
5230
|
+
bits.push(format >> i & 1);
|
|
5231
|
+
}
|
|
5232
|
+
for (let i = 0; i < 6; i++) {
|
|
5233
|
+
matrix[8][i] = bits[14 - i];
|
|
5234
|
+
}
|
|
5235
|
+
matrix[8][7] = bits[8];
|
|
5236
|
+
matrix[8][8] = bits[7];
|
|
5237
|
+
matrix[7][8] = bits[6];
|
|
5238
|
+
for (let i = 9; i < 15; i++) {
|
|
5239
|
+
matrix[14 - i][8] = bits[14 - i];
|
|
5240
|
+
}
|
|
5241
|
+
for (let i = 0; i < 8; i++) {
|
|
5242
|
+
matrix[8][size - 8 + i] = bits[i];
|
|
5243
|
+
}
|
|
5244
|
+
for (let i = 8; i < 15; i++) {
|
|
5245
|
+
matrix[size - 15 + i][8] = bits[14 - i];
|
|
5246
|
+
}
|
|
5247
|
+
matrix[size - 8][8] = 1;
|
|
5248
|
+
}
|
|
5249
|
+
function createData(typeNumber, eclIdx, data) {
|
|
5250
|
+
const rsBlocks = getRSBlocks(typeNumber, eclIdx);
|
|
5251
|
+
let totalDataCount = 0;
|
|
5252
|
+
for (const block of rsBlocks) {
|
|
5253
|
+
totalDataCount += block.dataCount;
|
|
5254
|
+
}
|
|
5255
|
+
const buffer = [];
|
|
5256
|
+
buffer.push(4);
|
|
5257
|
+
const cciBits = typeNumber < 10 ? 8 : typeNumber < 27 ? 16 : 16;
|
|
5194
5258
|
for (let i = cciBits - 1; i >= 0; i--) {
|
|
5195
|
-
|
|
5259
|
+
buffer.push(data.length >> i & 1);
|
|
5196
5260
|
}
|
|
5197
5261
|
for (const char of data) {
|
|
5198
5262
|
const code2 = char.charCodeAt(0);
|
|
5199
5263
|
for (let i = 7; i >= 0; i--) {
|
|
5200
|
-
|
|
5264
|
+
buffer.push(code2 >> i & 1);
|
|
5201
5265
|
}
|
|
5202
5266
|
}
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5267
|
+
const totalBits = totalDataCount * 8;
|
|
5268
|
+
const termLen = Math.min(4, totalBits - buffer.length);
|
|
5269
|
+
for (let i = 0; i < termLen; i++) {
|
|
5270
|
+
buffer.push(0);
|
|
5271
|
+
}
|
|
5272
|
+
while (buffer.length % 8 !== 0) {
|
|
5273
|
+
buffer.push(0);
|
|
5274
|
+
}
|
|
5206
5275
|
let padIdx = 0;
|
|
5207
|
-
|
|
5276
|
+
const pads = [PAD0, PAD1];
|
|
5277
|
+
while (buffer.length < totalBits) {
|
|
5278
|
+
const pad = pads[padIdx];
|
|
5208
5279
|
for (let i = 7; i >= 0; i--) {
|
|
5209
|
-
|
|
5280
|
+
buffer.push(pad >> i & 1);
|
|
5210
5281
|
}
|
|
5211
5282
|
padIdx = (padIdx + 1) % 2;
|
|
5212
5283
|
}
|
|
5213
|
-
const
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
|
|
5284
|
+
const dataBytes = [];
|
|
5285
|
+
let byteIdx = 0;
|
|
5286
|
+
for (const block of rsBlocks) {
|
|
5287
|
+
const blockData = [];
|
|
5288
|
+
for (let i = 0; i < block.dataCount; i++) {
|
|
5289
|
+
let byte = 0;
|
|
5290
|
+
for (let j = 0; j < 8; j++) {
|
|
5291
|
+
byte = byte << 1 | buffer[byteIdx++];
|
|
5292
|
+
}
|
|
5293
|
+
blockData.push(byte);
|
|
5294
|
+
}
|
|
5295
|
+
dataBytes.push(blockData);
|
|
5218
5296
|
}
|
|
5219
|
-
const
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
const version = getVersion(data, ecl);
|
|
5224
|
-
const size = version * 4 + 17;
|
|
5225
|
-
const matrix = [];
|
|
5226
|
-
for (let i = 0; i < size; i++) {
|
|
5227
|
-
matrix[i] = new Array(size).fill(-1);
|
|
5297
|
+
const eccBytes = [];
|
|
5298
|
+
for (let i = 0; i < rsBlocks.length; i++) {
|
|
5299
|
+
const ecc = getECC(dataBytes[i], rsBlocks[i].totalCount - rsBlocks[i].dataCount);
|
|
5300
|
+
eccBytes.push(ecc);
|
|
5228
5301
|
}
|
|
5229
|
-
const
|
|
5230
|
-
|
|
5231
|
-
|
|
5232
|
-
|
|
5233
|
-
|
|
5234
|
-
|
|
5235
|
-
|
|
5236
|
-
|
|
5237
|
-
|
|
5238
|
-
} else {
|
|
5239
|
-
matrix[tr][tc] = 0;
|
|
5240
|
-
}
|
|
5241
|
-
}
|
|
5302
|
+
const result = [];
|
|
5303
|
+
let maxDataCount = 0;
|
|
5304
|
+
for (const block of rsBlocks) {
|
|
5305
|
+
maxDataCount = Math.max(maxDataCount, block.dataCount);
|
|
5306
|
+
}
|
|
5307
|
+
for (let i = 0; i < maxDataCount; i++) {
|
|
5308
|
+
for (let j = 0; j < rsBlocks.length; j++) {
|
|
5309
|
+
if (i < dataBytes[j].length) {
|
|
5310
|
+
result.push(dataBytes[j][i]);
|
|
5242
5311
|
}
|
|
5243
5312
|
}
|
|
5244
|
-
};
|
|
5245
|
-
addFinder(0, 0);
|
|
5246
|
-
addFinder(size - 7, 0);
|
|
5247
|
-
addFinder(0, size - 7);
|
|
5248
|
-
for (let i = 8; i < size - 8; i++) {
|
|
5249
|
-
matrix[6][i] = i % 2 === 0 ? 1 : 0;
|
|
5250
|
-
matrix[i][6] = i % 2 === 0 ? 1 : 0;
|
|
5251
5313
|
}
|
|
5252
|
-
|
|
5253
|
-
|
|
5254
|
-
|
|
5255
|
-
|
|
5256
|
-
|
|
5257
|
-
|
|
5258
|
-
|
|
5259
|
-
|
|
5260
|
-
for (const row of positions) {
|
|
5261
|
-
for (const col of positions) {
|
|
5262
|
-
if (matrix[row][col] !== -1) continue;
|
|
5263
|
-
for (let r = -2; r <= 2; r++) {
|
|
5264
|
-
for (let c = -2; c <= 2; c++) {
|
|
5265
|
-
const tr = row + r, tc = col + c;
|
|
5266
|
-
if (tr >= 0 && tr < size && tc >= 0 && tc < size && matrix[tr][tc] === -1) {
|
|
5267
|
-
matrix[tr][tc] = Math.abs(r) === 2 || Math.abs(c) === 2 || r === 0 && c === 0 ? 1 : 0;
|
|
5268
|
-
}
|
|
5269
|
-
}
|
|
5270
|
-
}
|
|
5314
|
+
let maxEccCount = 0;
|
|
5315
|
+
for (const block of rsBlocks) {
|
|
5316
|
+
maxEccCount = Math.max(maxEccCount, block.totalCount - block.dataCount);
|
|
5317
|
+
}
|
|
5318
|
+
for (let i = 0; i < maxEccCount; i++) {
|
|
5319
|
+
for (let j = 0; j < rsBlocks.length; j++) {
|
|
5320
|
+
if (i < eccBytes[j].length) {
|
|
5321
|
+
result.push(eccBytes[j][i]);
|
|
5271
5322
|
}
|
|
5272
5323
|
}
|
|
5273
5324
|
}
|
|
5274
|
-
|
|
5275
|
-
|
|
5276
|
-
|
|
5277
|
-
|
|
5278
|
-
|
|
5279
|
-
|
|
5280
|
-
|
|
5281
|
-
|
|
5325
|
+
return result;
|
|
5326
|
+
}
|
|
5327
|
+
function getRSBlocks(typeNumber, eclIdx) {
|
|
5328
|
+
const RS_BLOCK_TABLE = [
|
|
5329
|
+
[1, 26, 19],
|
|
5330
|
+
[1, 26, 16],
|
|
5331
|
+
[1, 26, 13],
|
|
5332
|
+
[1, 26, 9],
|
|
5333
|
+
[1, 44, 34],
|
|
5334
|
+
[1, 44, 28],
|
|
5335
|
+
[1, 44, 22],
|
|
5336
|
+
[1, 44, 16],
|
|
5337
|
+
[1, 70, 55],
|
|
5338
|
+
[1, 70, 44],
|
|
5339
|
+
[2, 35, 17],
|
|
5340
|
+
[2, 35, 13],
|
|
5341
|
+
[1, 100, 80],
|
|
5342
|
+
[2, 50, 32],
|
|
5343
|
+
[2, 50, 24],
|
|
5344
|
+
[4, 25, 9],
|
|
5345
|
+
[1, 134, 108],
|
|
5346
|
+
[2, 67, 43],
|
|
5347
|
+
[2, 33, 15, 2, 34, 16],
|
|
5348
|
+
[2, 33, 11, 2, 34, 12],
|
|
5349
|
+
[2, 86, 68],
|
|
5350
|
+
[4, 43, 27],
|
|
5351
|
+
[4, 43, 19],
|
|
5352
|
+
[4, 43, 15],
|
|
5353
|
+
[2, 98, 78],
|
|
5354
|
+
[4, 49, 31],
|
|
5355
|
+
[2, 32, 14, 4, 33, 15],
|
|
5356
|
+
[4, 39, 13, 1, 40, 14],
|
|
5357
|
+
[2, 121, 97],
|
|
5358
|
+
[2, 60, 38, 2, 61, 39],
|
|
5359
|
+
[4, 40, 18, 2, 41, 19],
|
|
5360
|
+
[4, 40, 14, 2, 41, 15],
|
|
5361
|
+
[2, 146, 116],
|
|
5362
|
+
[3, 58, 36, 2, 59, 37],
|
|
5363
|
+
[4, 36, 16, 4, 37, 17],
|
|
5364
|
+
[4, 36, 12, 4, 37, 13],
|
|
5365
|
+
[2, 86, 68, 2, 87, 69],
|
|
5366
|
+
[4, 69, 43, 1, 70, 44],
|
|
5367
|
+
[6, 43, 19, 2, 44, 20],
|
|
5368
|
+
[6, 43, 15, 2, 44, 16],
|
|
5369
|
+
[4, 101, 81],
|
|
5370
|
+
[1, 80, 50, 4, 81, 51],
|
|
5371
|
+
[4, 50, 22, 4, 51, 23],
|
|
5372
|
+
[3, 36, 12, 8, 37, 13],
|
|
5373
|
+
[2, 116, 92, 2, 117, 93],
|
|
5374
|
+
[6, 58, 36, 2, 59, 37],
|
|
5375
|
+
[4, 46, 20, 6, 47, 21],
|
|
5376
|
+
[7, 42, 14, 4, 43, 15],
|
|
5377
|
+
[4, 133, 107],
|
|
5378
|
+
[8, 59, 37, 1, 60, 38],
|
|
5379
|
+
[8, 44, 20, 4, 45, 21],
|
|
5380
|
+
[12, 33, 11, 4, 34, 12],
|
|
5381
|
+
[3, 145, 115, 1, 146, 116],
|
|
5382
|
+
[4, 64, 40, 5, 65, 41],
|
|
5383
|
+
[11, 36, 16, 5, 37, 17],
|
|
5384
|
+
[11, 36, 12, 5, 37, 13],
|
|
5385
|
+
[5, 109, 87, 1, 110, 88],
|
|
5386
|
+
[5, 65, 41, 5, 66, 42],
|
|
5387
|
+
[5, 54, 24, 7, 55, 25],
|
|
5388
|
+
[11, 36, 12, 7, 37, 13],
|
|
5389
|
+
[5, 122, 98, 1, 123, 99],
|
|
5390
|
+
[7, 73, 45, 3, 74, 46],
|
|
5391
|
+
[15, 43, 19, 2, 44, 20],
|
|
5392
|
+
[3, 45, 15, 13, 46, 16],
|
|
5393
|
+
[1, 135, 107, 5, 136, 108],
|
|
5394
|
+
[10, 74, 46, 1, 75, 47],
|
|
5395
|
+
[1, 50, 22, 15, 51, 23],
|
|
5396
|
+
[2, 42, 14, 17, 43, 15],
|
|
5397
|
+
[5, 150, 120, 1, 151, 121],
|
|
5398
|
+
[9, 69, 43, 4, 70, 44],
|
|
5399
|
+
[17, 50, 22, 1, 51, 23],
|
|
5400
|
+
[2, 42, 14, 19, 43, 15],
|
|
5401
|
+
[3, 141, 113, 4, 142, 114],
|
|
5402
|
+
[3, 70, 44, 11, 71, 45],
|
|
5403
|
+
[17, 47, 21, 4, 48, 22],
|
|
5404
|
+
[9, 39, 13, 16, 40, 14],
|
|
5405
|
+
[3, 135, 107, 5, 136, 108],
|
|
5406
|
+
[3, 67, 41, 13, 68, 42],
|
|
5407
|
+
[15, 54, 24, 5, 55, 25],
|
|
5408
|
+
[15, 43, 15, 10, 44, 16],
|
|
5409
|
+
[4, 144, 116, 4, 145, 117],
|
|
5410
|
+
[17, 68, 42],
|
|
5411
|
+
[17, 50, 22, 6, 51, 23],
|
|
5412
|
+
[19, 46, 16, 6, 47, 17],
|
|
5413
|
+
[2, 139, 111, 7, 140, 112],
|
|
5414
|
+
[17, 74, 46],
|
|
5415
|
+
[7, 54, 24, 16, 55, 25],
|
|
5416
|
+
[34, 37, 13],
|
|
5417
|
+
[4, 151, 121, 5, 152, 122],
|
|
5418
|
+
[4, 75, 47, 14, 76, 48],
|
|
5419
|
+
[11, 54, 24, 14, 55, 25],
|
|
5420
|
+
[16, 45, 15, 14, 46, 16],
|
|
5421
|
+
[6, 147, 117, 4, 148, 118],
|
|
5422
|
+
[6, 73, 45, 14, 74, 46],
|
|
5423
|
+
[11, 54, 24, 16, 55, 25],
|
|
5424
|
+
[30, 46, 16, 2, 47, 17],
|
|
5425
|
+
[8, 132, 106, 4, 133, 107],
|
|
5426
|
+
[8, 75, 47, 13, 76, 48],
|
|
5427
|
+
[7, 54, 24, 22, 55, 25],
|
|
5428
|
+
[22, 45, 15, 13, 46, 16],
|
|
5429
|
+
[10, 142, 114, 2, 143, 115],
|
|
5430
|
+
[19, 74, 46, 4, 75, 47],
|
|
5431
|
+
[28, 50, 22, 6, 51, 23],
|
|
5432
|
+
[33, 46, 16, 4, 47, 17],
|
|
5433
|
+
[8, 152, 122, 4, 153, 123],
|
|
5434
|
+
[22, 73, 45, 3, 74, 46],
|
|
5435
|
+
[8, 53, 23, 26, 54, 24],
|
|
5436
|
+
[12, 45, 15, 28, 46, 16],
|
|
5437
|
+
[3, 147, 117, 10, 148, 118],
|
|
5438
|
+
[3, 73, 45, 23, 74, 46],
|
|
5439
|
+
[4, 54, 24, 31, 55, 25],
|
|
5440
|
+
[11, 45, 15, 31, 46, 16],
|
|
5441
|
+
[7, 146, 116, 7, 147, 117],
|
|
5442
|
+
[21, 73, 45, 7, 74, 46],
|
|
5443
|
+
[1, 53, 23, 37, 54, 24],
|
|
5444
|
+
[19, 45, 15, 26, 46, 16],
|
|
5445
|
+
[5, 145, 115, 10, 146, 116],
|
|
5446
|
+
[19, 75, 47, 10, 76, 48],
|
|
5447
|
+
[15, 54, 24, 25, 55, 25],
|
|
5448
|
+
[23, 45, 15, 25, 46, 16],
|
|
5449
|
+
[13, 145, 115, 3, 146, 116],
|
|
5450
|
+
[2, 74, 46, 29, 75, 47],
|
|
5451
|
+
[42, 54, 24, 1, 55, 25],
|
|
5452
|
+
[23, 45, 15, 28, 46, 16],
|
|
5453
|
+
[17, 145, 115],
|
|
5454
|
+
[10, 74, 46, 23, 75, 47],
|
|
5455
|
+
[10, 54, 24, 35, 55, 25],
|
|
5456
|
+
[19, 45, 15, 35, 46, 16],
|
|
5457
|
+
[17, 145, 115, 1, 146, 116],
|
|
5458
|
+
[14, 74, 46, 21, 75, 47],
|
|
5459
|
+
[29, 54, 24, 19, 55, 25],
|
|
5460
|
+
[11, 45, 15, 46, 46, 16],
|
|
5461
|
+
[13, 145, 115, 6, 146, 116],
|
|
5462
|
+
[14, 74, 46, 23, 75, 47],
|
|
5463
|
+
[44, 54, 24, 7, 55, 25],
|
|
5464
|
+
[59, 46, 16, 1, 47, 17],
|
|
5465
|
+
[12, 151, 121, 7, 152, 122],
|
|
5466
|
+
[12, 75, 47, 26, 76, 48],
|
|
5467
|
+
[39, 54, 24, 14, 55, 25],
|
|
5468
|
+
[22, 45, 15, 41, 46, 16],
|
|
5469
|
+
[6, 151, 121, 14, 152, 122],
|
|
5470
|
+
[6, 75, 47, 34, 76, 48],
|
|
5471
|
+
[46, 54, 24, 10, 55, 25],
|
|
5472
|
+
[2, 45, 15, 64, 46, 16],
|
|
5473
|
+
[17, 152, 122, 4, 153, 123],
|
|
5474
|
+
[29, 74, 46, 14, 75, 47],
|
|
5475
|
+
[49, 54, 24, 10, 55, 25],
|
|
5476
|
+
[24, 45, 15, 46, 46, 16],
|
|
5477
|
+
[4, 152, 122, 18, 153, 123],
|
|
5478
|
+
[13, 74, 46, 32, 75, 47],
|
|
5479
|
+
[48, 54, 24, 14, 55, 25],
|
|
5480
|
+
[42, 45, 15, 32, 46, 16],
|
|
5481
|
+
[20, 147, 117, 4, 148, 118],
|
|
5482
|
+
[40, 75, 47, 7, 76, 48],
|
|
5483
|
+
[43, 54, 24, 22, 55, 25],
|
|
5484
|
+
[10, 45, 15, 67, 46, 16],
|
|
5485
|
+
[19, 148, 118, 6, 149, 119],
|
|
5486
|
+
[18, 75, 47, 31, 76, 48],
|
|
5487
|
+
[34, 54, 24, 34, 55, 25],
|
|
5488
|
+
[20, 45, 15, 61, 46, 16]
|
|
5489
|
+
];
|
|
5490
|
+
const idx = (typeNumber - 1) * 4 + eclIdx;
|
|
5491
|
+
const block = RS_BLOCK_TABLE[idx];
|
|
5492
|
+
const blocks = [];
|
|
5493
|
+
if (block.length === 3) {
|
|
5494
|
+
for (let i = 0; i < block[0]; i++) {
|
|
5495
|
+
blocks.push({ totalCount: block[1], dataCount: block[2] });
|
|
5496
|
+
}
|
|
5497
|
+
} else {
|
|
5498
|
+
for (let i = 0; i < block[0]; i++) {
|
|
5499
|
+
blocks.push({ totalCount: block[1], dataCount: block[2] });
|
|
5500
|
+
}
|
|
5501
|
+
for (let i = 0; i < block[3]; i++) {
|
|
5502
|
+
blocks.push({ totalCount: block[4], dataCount: block[5] });
|
|
5503
|
+
}
|
|
5282
5504
|
}
|
|
5283
|
-
|
|
5505
|
+
return blocks;
|
|
5506
|
+
}
|
|
5507
|
+
function mapData(matrix, data, maskPattern) {
|
|
5508
|
+
const size = matrix.length;
|
|
5284
5509
|
let bitIdx = 0;
|
|
5285
5510
|
let upward = true;
|
|
5286
5511
|
for (let col = size - 1; col >= 0; col -= 2) {
|
|
@@ -5288,10 +5513,13 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
5288
5513
|
for (let row = upward ? size - 1 : 0; upward ? row >= 0 : row < size; upward ? row-- : row++) {
|
|
5289
5514
|
for (let c = 0; c < 2; c++) {
|
|
5290
5515
|
const tc = col - c;
|
|
5291
|
-
if (
|
|
5516
|
+
if (matrix[row][tc] === null) {
|
|
5292
5517
|
let bit = 0;
|
|
5293
|
-
if (bitIdx <
|
|
5294
|
-
bit =
|
|
5518
|
+
if (bitIdx < data.length * 8) {
|
|
5519
|
+
bit = data[Math.floor(bitIdx / 8)] >> 7 - bitIdx % 8 & 1;
|
|
5520
|
+
}
|
|
5521
|
+
if (getMaskBit(maskPattern, row, tc)) {
|
|
5522
|
+
bit ^= 1;
|
|
5295
5523
|
}
|
|
5296
5524
|
matrix[row][tc] = bit;
|
|
5297
5525
|
bitIdx++;
|
|
@@ -5300,27 +5528,49 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
5300
5528
|
}
|
|
5301
5529
|
upward = !upward;
|
|
5302
5530
|
}
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
|
|
5308
|
-
|
|
5531
|
+
}
|
|
5532
|
+
function getMaskBit(pattern, row, col) {
|
|
5533
|
+
switch (pattern) {
|
|
5534
|
+
case 0:
|
|
5535
|
+
return (row + col) % 2 === 0;
|
|
5536
|
+
case 1:
|
|
5537
|
+
return row % 2 === 0;
|
|
5538
|
+
case 2:
|
|
5539
|
+
return col % 3 === 0;
|
|
5540
|
+
case 3:
|
|
5541
|
+
return (row + col) % 3 === 0;
|
|
5542
|
+
case 4:
|
|
5543
|
+
return (Math.floor(row / 2) + Math.floor(col / 3)) % 2 === 0;
|
|
5544
|
+
case 5:
|
|
5545
|
+
return row * col % 2 + row * col % 3 === 0;
|
|
5546
|
+
case 6:
|
|
5547
|
+
return (row * col % 2 + row * col % 3) % 2 === 0;
|
|
5548
|
+
case 7:
|
|
5549
|
+
return ((row + col) % 2 + row * col % 3) % 2 === 0;
|
|
5550
|
+
default:
|
|
5551
|
+
return false;
|
|
5309
5552
|
}
|
|
5310
|
-
|
|
5311
|
-
|
|
5312
|
-
|
|
5313
|
-
|
|
5314
|
-
|
|
5553
|
+
}
|
|
5554
|
+
function generate(data, ecl) {
|
|
5555
|
+
const eclIdx = ECL[ecl];
|
|
5556
|
+
const typeNumber = getTypeNumber(data, ecl);
|
|
5557
|
+
const matrix = createMatrix(typeNumber);
|
|
5558
|
+
setupPositionDetectionPattern(matrix);
|
|
5559
|
+
setupTimingPattern(matrix);
|
|
5560
|
+
setupAlignmentPattern(matrix, typeNumber);
|
|
5561
|
+
const size = matrix.length;
|
|
5562
|
+
for (let i = 0; i < 9; i++) {
|
|
5563
|
+
if (matrix[8][i] === null) matrix[8][i] = 0;
|
|
5564
|
+
if (matrix[i][8] === null) matrix[i][8] = 0;
|
|
5315
5565
|
}
|
|
5316
|
-
|
|
5317
|
-
|
|
5318
|
-
|
|
5319
|
-
|
|
5320
|
-
matrix
|
|
5321
|
-
|
|
5322
|
-
|
|
5323
|
-
|
|
5566
|
+
for (let i = 0; i < 8; i++) {
|
|
5567
|
+
if (matrix[8][size - 1 - i] === null) matrix[8][size - 1 - i] = 0;
|
|
5568
|
+
if (matrix[size - 1 - i][8] === null) matrix[size - 1 - i][8] = 0;
|
|
5569
|
+
}
|
|
5570
|
+
setupVersionInfo(matrix, typeNumber);
|
|
5571
|
+
const dataBytes = createData(typeNumber, eclIdx, data);
|
|
5572
|
+
mapData(matrix, dataBytes, 0);
|
|
5573
|
+
setupFormatInfo(matrix, eclIdx, 0);
|
|
5324
5574
|
const result = [];
|
|
5325
5575
|
for (let row = 0; row < size; row++) {
|
|
5326
5576
|
result[row] = [];
|
|
@@ -5328,20 +5578,24 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
5328
5578
|
result[row][col] = matrix[row][col] === 1;
|
|
5329
5579
|
}
|
|
5330
5580
|
}
|
|
5331
|
-
return result;
|
|
5332
|
-
}
|
|
5581
|
+
return { modules: result, moduleCount: size };
|
|
5582
|
+
}
|
|
5333
5583
|
return { generate };
|
|
5334
5584
|
})();
|
|
5335
5585
|
const generateQRCode = () => {
|
|
5336
5586
|
if (!props.value) {
|
|
5337
5587
|
modules.value = [];
|
|
5588
|
+
moduleCount.value = 0;
|
|
5338
5589
|
return;
|
|
5339
5590
|
}
|
|
5340
5591
|
try {
|
|
5341
|
-
|
|
5592
|
+
const result = QRCode.generate(props.value, props.errorCorrectLevel);
|
|
5593
|
+
modules.value = result.modules;
|
|
5594
|
+
moduleCount.value = result.moduleCount;
|
|
5342
5595
|
} catch (e) {
|
|
5343
5596
|
console.error("QR Code generation failed:", e);
|
|
5344
5597
|
modules.value = [];
|
|
5598
|
+
moduleCount.value = 0;
|
|
5345
5599
|
}
|
|
5346
5600
|
};
|
|
5347
5601
|
vue.watch(() => props.value, generateQRCode);
|
|
@@ -5381,7 +5635,7 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
5381
5635
|
};
|
|
5382
5636
|
}
|
|
5383
5637
|
});
|
|
5384
|
-
const uQrcode = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-
|
|
5638
|
+
const uQrcode = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-857cfd4f"]]);
|
|
5385
5639
|
const _hoisted_1 = { class: "u-barcode" };
|
|
5386
5640
|
const _hoisted_2 = ["canvas-id"];
|
|
5387
5641
|
const _hoisted_3 = ["src"];
|