@atooyu/uxto-ui 1.1.33 → 1.1.34
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 +233 -515
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +233 -515
- 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 +270 -599
package/dist/index.js
CHANGED
|
@@ -5051,557 +5051,275 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
5051
5051
|
if (moduleCount.value === 0) return 0;
|
|
5052
5052
|
return props.size / moduleCount.value;
|
|
5053
5053
|
});
|
|
5054
|
-
const
|
|
5055
|
-
|
|
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
|
-
|
|
5096
|
-
|
|
5097
|
-
|
|
5098
|
-
]
|
|
5099
|
-
|
|
5100
|
-
|
|
5101
|
-
|
|
5102
|
-
|
|
5103
|
-
|
|
5104
|
-
|
|
5105
|
-
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
|
|
5116
|
-
|
|
5117
|
-
|
|
5118
|
-
|
|
5119
|
-
|
|
5120
|
-
|
|
5121
|
-
|
|
5122
|
-
|
|
5123
|
-
|
|
5124
|
-
|
|
5125
|
-
|
|
5054
|
+
const ECL_INDEX = { L: 0, M: 1, Q: 2, H: 3 };
|
|
5055
|
+
const DATA_CAPACITY = [
|
|
5056
|
+
[0, 0, 0, 0],
|
|
5057
|
+
// version 0 (不存在)
|
|
5058
|
+
[17, 14, 11, 7],
|
|
5059
|
+
// version 1
|
|
5060
|
+
[32, 26, 20, 14],
|
|
5061
|
+
[53, 42, 32, 24],
|
|
5062
|
+
[78, 62, 46, 34],
|
|
5063
|
+
[106, 84, 60, 44],
|
|
5064
|
+
[134, 106, 74, 58],
|
|
5065
|
+
[154, 122, 86, 64],
|
|
5066
|
+
[192, 152, 108, 84],
|
|
5067
|
+
[230, 180, 130, 98],
|
|
5068
|
+
[271, 213, 151, 119],
|
|
5069
|
+
[321, 251, 177, 137],
|
|
5070
|
+
[367, 287, 203, 155],
|
|
5071
|
+
[425, 331, 241, 177],
|
|
5072
|
+
[458, 362, 258, 194],
|
|
5073
|
+
[520, 412, 292, 220],
|
|
5074
|
+
[586, 450, 322, 250],
|
|
5075
|
+
[644, 504, 364, 280],
|
|
5076
|
+
[718, 560, 394, 310],
|
|
5077
|
+
[792, 624, 442, 338],
|
|
5078
|
+
[858, 666, 482, 382]
|
|
5079
|
+
];
|
|
5080
|
+
const ECC_CODEWORDS = [
|
|
5081
|
+
[0, 0, 0, 0],
|
|
5082
|
+
[7, 10, 13, 17],
|
|
5083
|
+
[10, 16, 22, 28],
|
|
5084
|
+
[15, 26, 36, 44],
|
|
5085
|
+
[20, 36, 52, 64],
|
|
5086
|
+
[26, 48, 72, 88],
|
|
5087
|
+
[36, 64, 96, 112],
|
|
5088
|
+
[40, 72, 108, 130],
|
|
5089
|
+
[48, 88, 132, 156],
|
|
5090
|
+
[60, 110, 160, 192],
|
|
5091
|
+
[72, 130, 192, 224],
|
|
5092
|
+
[80, 150, 224, 264],
|
|
5093
|
+
[96, 176, 260, 308],
|
|
5094
|
+
[104, 198, 288, 352],
|
|
5095
|
+
[120, 216, 320, 384],
|
|
5096
|
+
[132, 240, 360, 432],
|
|
5097
|
+
[144, 280, 408, 480],
|
|
5098
|
+
[168, 308, 448, 532],
|
|
5099
|
+
[180, 338, 504, 588],
|
|
5100
|
+
[196, 364, 546, 650],
|
|
5101
|
+
[224, 416, 600, 700]
|
|
5102
|
+
];
|
|
5103
|
+
const GF_EXP = new Array(512);
|
|
5104
|
+
const GF_LOG = new Array(256);
|
|
5105
|
+
let _x = 1;
|
|
5106
|
+
for (let _i = 0; _i < 255; _i++) {
|
|
5107
|
+
GF_EXP[_i] = _x;
|
|
5108
|
+
GF_LOG[_x] = _i;
|
|
5109
|
+
_x = _x * 2;
|
|
5110
|
+
if (_x >= 256) _x ^= 285;
|
|
5111
|
+
}
|
|
5112
|
+
for (let _i = 255; _i < 512; _i++) {
|
|
5113
|
+
GF_EXP[_i] = GF_EXP[_i - 255];
|
|
5114
|
+
}
|
|
5115
|
+
function gfMul(a, b) {
|
|
5116
|
+
if (a === 0 || b === 0) return 0;
|
|
5117
|
+
return GF_EXP[GF_LOG[a] + GF_LOG[b]];
|
|
5118
|
+
}
|
|
5119
|
+
function rsEncode(data, eccCount) {
|
|
5120
|
+
let gen = [1];
|
|
5121
|
+
for (let i = 0; i < eccCount; i++) {
|
|
5122
|
+
const tmp = new Array(gen.length + 1).fill(0);
|
|
5123
|
+
for (let j = 0; j < gen.length; j++) {
|
|
5124
|
+
tmp[j] ^= gen[j];
|
|
5125
|
+
tmp[j + 1] ^= gfMul(gen[j], GF_EXP[i]);
|
|
5126
5126
|
}
|
|
5127
|
-
|
|
5128
|
-
}
|
|
5129
|
-
|
|
5130
|
-
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
|
|
5134
|
-
|
|
5135
|
-
|
|
5136
|
-
}
|
|
5137
|
-
gen = temp;
|
|
5127
|
+
gen = tmp;
|
|
5128
|
+
}
|
|
5129
|
+
const ecc = new Array(eccCount).fill(0);
|
|
5130
|
+
for (const byte of data) {
|
|
5131
|
+
const factor = byte ^ ecc[0];
|
|
5132
|
+
ecc.shift();
|
|
5133
|
+
ecc.push(0);
|
|
5134
|
+
for (let i = 0; i < eccCount; i++) {
|
|
5135
|
+
ecc[i] ^= gfMul(gen[i], factor);
|
|
5138
5136
|
}
|
|
5139
|
-
return gen;
|
|
5140
5137
|
}
|
|
5141
|
-
|
|
5142
|
-
|
|
5143
|
-
|
|
5144
|
-
|
|
5145
|
-
|
|
5146
|
-
}
|
|
5147
|
-
return 40;
|
|
5138
|
+
return ecc;
|
|
5139
|
+
}
|
|
5140
|
+
function getVersion(dataLen, eclIdx) {
|
|
5141
|
+
for (let v = 1; v <= 20; v++) {
|
|
5142
|
+
if (DATA_CAPACITY[v][eclIdx] >= dataLen) return v;
|
|
5148
5143
|
}
|
|
5149
|
-
|
|
5150
|
-
|
|
5151
|
-
|
|
5152
|
-
|
|
5153
|
-
|
|
5154
|
-
|
|
5155
|
-
|
|
5156
|
-
|
|
5157
|
-
|
|
5158
|
-
|
|
5159
|
-
|
|
5160
|
-
|
|
5161
|
-
|
|
5162
|
-
|
|
5163
|
-
|
|
5164
|
-
|
|
5165
|
-
|
|
5166
|
-
|
|
5167
|
-
|
|
5168
|
-
|
|
5144
|
+
return 20;
|
|
5145
|
+
}
|
|
5146
|
+
function getAlignmentPositions(version) {
|
|
5147
|
+
if (version === 1) return [];
|
|
5148
|
+
const intervals = Math.floor(version / 7) + 1;
|
|
5149
|
+
const size = version * 4 + 17;
|
|
5150
|
+
const step = Math.ceil((size - 13) / (intervals + 1));
|
|
5151
|
+
const positions = [6];
|
|
5152
|
+
let pos = size - 7;
|
|
5153
|
+
while (pos > 6) {
|
|
5154
|
+
positions.unshift(pos);
|
|
5155
|
+
pos -= step;
|
|
5156
|
+
}
|
|
5157
|
+
return positions;
|
|
5158
|
+
}
|
|
5159
|
+
function generateQR(text, errorCorrectionLevel) {
|
|
5160
|
+
const eclIdx = ECL_INDEX[errorCorrectionLevel] ?? 1;
|
|
5161
|
+
const version = getVersion(text.length, eclIdx);
|
|
5162
|
+
const size = version * 4 + 17;
|
|
5163
|
+
const matrix = [];
|
|
5164
|
+
for (let i = 0; i < size; i++) {
|
|
5165
|
+
matrix[i] = new Array(size).fill(-1);
|
|
5166
|
+
}
|
|
5167
|
+
function drawFinder(r, c) {
|
|
5168
|
+
for (let dr = -1; dr <= 7; dr++) {
|
|
5169
|
+
for (let dc = -1; dc <= 7; dc++) {
|
|
5170
|
+
const nr = r + dr;
|
|
5171
|
+
const nc = c + dc;
|
|
5172
|
+
if (nr < 0 || nr >= size || nc < 0 || nc >= size) continue;
|
|
5173
|
+
if (dr === -1 || dr === 7 || dc === -1 || dc === 7) {
|
|
5174
|
+
matrix[nr][nc] = 0;
|
|
5175
|
+
} else if (dr === 0 || dr === 6 || dc === 0 || dc === 6) {
|
|
5176
|
+
matrix[nr][nc] = 1;
|
|
5177
|
+
} else if (dr >= 2 && dr <= 4 && dc >= 2 && dc <= 4) {
|
|
5178
|
+
matrix[nr][nc] = 1;
|
|
5179
|
+
} else {
|
|
5180
|
+
matrix[nr][nc] = 0;
|
|
5169
5181
|
}
|
|
5170
5182
|
}
|
|
5171
5183
|
}
|
|
5172
5184
|
}
|
|
5173
|
-
|
|
5174
|
-
|
|
5175
|
-
|
|
5176
|
-
|
|
5177
|
-
|
|
5178
|
-
|
|
5179
|
-
|
|
5180
|
-
|
|
5181
|
-
|
|
5182
|
-
|
|
5183
|
-
|
|
5184
|
-
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
|
|
5185
|
+
drawFinder(0, 0);
|
|
5186
|
+
drawFinder(size - 7, 0);
|
|
5187
|
+
drawFinder(0, size - 7);
|
|
5188
|
+
for (let i = 8; i < size - 8; i++) {
|
|
5189
|
+
matrix[6][i] = (i & 1) === 0 ? 1 : 0;
|
|
5190
|
+
matrix[i][6] = (i & 1) === 0 ? 1 : 0;
|
|
5191
|
+
}
|
|
5192
|
+
if (version >= 2) {
|
|
5193
|
+
const alignPos = getAlignmentPositions(version);
|
|
5194
|
+
for (const r of alignPos) {
|
|
5195
|
+
for (const c of alignPos) {
|
|
5196
|
+
if (matrix[r][c] !== -1) continue;
|
|
5197
|
+
for (let dr = -2; dr <= 2; dr++) {
|
|
5198
|
+
for (let dc = -2; dc <= 2; dc++) {
|
|
5199
|
+
const nr = r + dr;
|
|
5200
|
+
const nc = c + dc;
|
|
5201
|
+
if (nr >= 0 && nr < size && nc >= 0 && nc < size && matrix[nr][nc] === -1) {
|
|
5202
|
+
matrix[nr][nc] = Math.abs(dr) === 2 || Math.abs(dc) === 2 || dr === 0 && dc === 0 ? 1 : 0;
|
|
5203
|
+
}
|
|
5191
5204
|
}
|
|
5192
5205
|
}
|
|
5193
5206
|
}
|
|
5194
5207
|
}
|
|
5195
5208
|
}
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
-
|
|
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
|
-
}
|
|
5209
|
+
matrix[size - 8][8] = 1;
|
|
5210
|
+
for (let i = 0; i < 9; i++) {
|
|
5211
|
+
if (matrix[8][i] === -1) matrix[8][i] = 0;
|
|
5212
|
+
if (matrix[i][8] === -1) matrix[i][8] = 0;
|
|
5219
5213
|
}
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
|
|
5228
|
-
|
|
5229
|
-
|
|
5230
|
-
|
|
5231
|
-
|
|
5232
|
-
for (let i =
|
|
5233
|
-
|
|
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];
|
|
5214
|
+
for (let i = 0; i < 8; i++) {
|
|
5215
|
+
if (matrix[8][size - 1 - i] === -1) matrix[8][size - 1 - i] = 0;
|
|
5216
|
+
if (matrix[size - 1 - i][8] === -1) matrix[size - 1 - i][8] = 0;
|
|
5217
|
+
}
|
|
5218
|
+
const bits = [];
|
|
5219
|
+
bits.push(0, 1, 0, 0);
|
|
5220
|
+
const cciBits = version <= 9 ? 8 : 16;
|
|
5221
|
+
for (let i = cciBits - 1; i >= 0; i--) {
|
|
5222
|
+
bits.push(text.length >> i & 1);
|
|
5223
|
+
}
|
|
5224
|
+
for (const ch of text) {
|
|
5225
|
+
const code2 = ch.charCodeAt(0);
|
|
5226
|
+
for (let i = 7; i >= 0; i--) {
|
|
5227
|
+
bits.push(code2 >> i & 1);
|
|
5246
5228
|
}
|
|
5247
|
-
matrix[size - 8][8] = 1;
|
|
5248
5229
|
}
|
|
5249
|
-
|
|
5250
|
-
|
|
5251
|
-
|
|
5252
|
-
|
|
5253
|
-
|
|
5254
|
-
|
|
5255
|
-
|
|
5256
|
-
|
|
5257
|
-
|
|
5258
|
-
|
|
5259
|
-
buffer.push(data.length >> i & 1);
|
|
5260
|
-
}
|
|
5261
|
-
for (const char of data) {
|
|
5262
|
-
const code2 = char.charCodeAt(0);
|
|
5263
|
-
for (let i = 7; i >= 0; i--) {
|
|
5264
|
-
buffer.push(code2 >> i & 1);
|
|
5265
|
-
}
|
|
5266
|
-
}
|
|
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
|
-
}
|
|
5275
|
-
let padIdx = 0;
|
|
5276
|
-
const pads = [PAD0, PAD1];
|
|
5277
|
-
while (buffer.length < totalBits) {
|
|
5278
|
-
const pad = pads[padIdx];
|
|
5279
|
-
for (let i = 7; i >= 0; i--) {
|
|
5280
|
-
buffer.push(pad >> i & 1);
|
|
5281
|
-
}
|
|
5282
|
-
padIdx = (padIdx + 1) % 2;
|
|
5283
|
-
}
|
|
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);
|
|
5230
|
+
const dataCapacity = DATA_CAPACITY[version][eclIdx];
|
|
5231
|
+
const termLen = Math.min(4, dataCapacity * 8 - bits.length);
|
|
5232
|
+
for (let i = 0; i < termLen; i++) bits.push(0);
|
|
5233
|
+
while (bits.length % 8 !== 0) bits.push(0);
|
|
5234
|
+
const pads = [236, 17];
|
|
5235
|
+
let padIdx = 0;
|
|
5236
|
+
while (bits.length < dataCapacity * 8) {
|
|
5237
|
+
const pad = pads[padIdx];
|
|
5238
|
+
for (let i = 7; i >= 0; i--) {
|
|
5239
|
+
bits.push(pad >> i & 1);
|
|
5296
5240
|
}
|
|
5297
|
-
|
|
5298
|
-
|
|
5299
|
-
|
|
5300
|
-
|
|
5301
|
-
|
|
5302
|
-
|
|
5303
|
-
|
|
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]);
|
|
5311
|
-
}
|
|
5312
|
-
}
|
|
5313
|
-
}
|
|
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]);
|
|
5322
|
-
}
|
|
5323
|
-
}
|
|
5324
|
-
}
|
|
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
|
-
}
|
|
5241
|
+
padIdx = (padIdx + 1) % 2;
|
|
5242
|
+
}
|
|
5243
|
+
const dataBytes = [];
|
|
5244
|
+
for (let i = 0; i < bits.length; i += 8) {
|
|
5245
|
+
let b = 0;
|
|
5246
|
+
for (let j = 0; j < 8; j++) {
|
|
5247
|
+
b = b << 1 | bits[i + j];
|
|
5504
5248
|
}
|
|
5505
|
-
|
|
5506
|
-
}
|
|
5507
|
-
|
|
5508
|
-
|
|
5509
|
-
|
|
5510
|
-
|
|
5511
|
-
|
|
5512
|
-
|
|
5513
|
-
|
|
5514
|
-
|
|
5515
|
-
|
|
5516
|
-
|
|
5517
|
-
|
|
5518
|
-
|
|
5519
|
-
|
|
5520
|
-
|
|
5521
|
-
|
|
5522
|
-
|
|
5523
|
-
|
|
5524
|
-
matrix[row][tc] = bit;
|
|
5525
|
-
bitIdx++;
|
|
5249
|
+
dataBytes.push(b);
|
|
5250
|
+
}
|
|
5251
|
+
const eccCount = ECC_CODEWORDS[version][eclIdx];
|
|
5252
|
+
const eccBytes = rsEncode(dataBytes, eccCount);
|
|
5253
|
+
const codewords = [...dataBytes, ...eccBytes];
|
|
5254
|
+
let bitIdx = 0;
|
|
5255
|
+
let upward = true;
|
|
5256
|
+
for (let col = size - 1; col >= 0; col -= 2) {
|
|
5257
|
+
if (col === 6) col = 5;
|
|
5258
|
+
for (let row = upward ? size - 1 : 0; upward ? row >= 0 : row < size; upward ? row-- : row++) {
|
|
5259
|
+
for (let c = 0; c < 2; c++) {
|
|
5260
|
+
const tc = col - c;
|
|
5261
|
+
if (tc >= 0 && matrix[row][tc] === -1) {
|
|
5262
|
+
let bit = 0;
|
|
5263
|
+
if (bitIdx < codewords.length * 8) {
|
|
5264
|
+
bit = codewords[Math.floor(bitIdx / 8)] >> 7 - bitIdx % 8 & 1;
|
|
5265
|
+
}
|
|
5266
|
+
if ((row + tc & 1) === 0) {
|
|
5267
|
+
bit = bit === 1 ? 0 : 1;
|
|
5526
5268
|
}
|
|
5269
|
+
matrix[row][tc] = bit;
|
|
5270
|
+
bitIdx++;
|
|
5527
5271
|
}
|
|
5528
5272
|
}
|
|
5529
|
-
upward = !upward;
|
|
5530
|
-
}
|
|
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;
|
|
5552
5273
|
}
|
|
5553
|
-
|
|
5554
|
-
|
|
5555
|
-
|
|
5556
|
-
|
|
5557
|
-
|
|
5558
|
-
|
|
5559
|
-
|
|
5560
|
-
|
|
5561
|
-
|
|
5562
|
-
|
|
5563
|
-
|
|
5564
|
-
|
|
5565
|
-
|
|
5566
|
-
|
|
5567
|
-
|
|
5568
|
-
|
|
5569
|
-
|
|
5570
|
-
|
|
5571
|
-
|
|
5572
|
-
|
|
5573
|
-
|
|
5574
|
-
|
|
5575
|
-
|
|
5576
|
-
|
|
5577
|
-
|
|
5578
|
-
result[row][col] = matrix[row][col] === 1;
|
|
5579
|
-
}
|
|
5274
|
+
upward = !upward;
|
|
5275
|
+
}
|
|
5276
|
+
const eclBits = { L: 1, M: 0, Q: 3, H: 2 }[errorCorrectionLevel] ?? 0;
|
|
5277
|
+
const formatData = eclBits << 3 | 0;
|
|
5278
|
+
let rem = formatData;
|
|
5279
|
+
for (let i = 0; i < 10; i++) {
|
|
5280
|
+
rem = rem << 1 ^ (rem >> 9) * 1335;
|
|
5281
|
+
}
|
|
5282
|
+
const formatBits = (formatData << 10 | rem & 1023) ^ 21522;
|
|
5283
|
+
const fb = [];
|
|
5284
|
+
for (let i = 14; i >= 0; i--) {
|
|
5285
|
+
fb.push(formatBits >> i & 1);
|
|
5286
|
+
}
|
|
5287
|
+
for (let i = 0; i < 6; i++) matrix[8][i] = fb[i];
|
|
5288
|
+
matrix[8][7] = fb[6];
|
|
5289
|
+
matrix[8][8] = fb[7];
|
|
5290
|
+
matrix[7][8] = fb[8];
|
|
5291
|
+
for (let i = 9; i < 15; i++) matrix[14 - i][8] = fb[i];
|
|
5292
|
+
for (let i = 0; i < 8; i++) matrix[8][size - 8 + i] = fb[14 - i];
|
|
5293
|
+
for (let i = 8; i < 15; i++) matrix[size - 15 + i][8] = fb[14 - i];
|
|
5294
|
+
const result = [];
|
|
5295
|
+
for (let r = 0; r < size; r++) {
|
|
5296
|
+
result[r] = [];
|
|
5297
|
+
for (let c = 0; c < size; c++) {
|
|
5298
|
+
result[r][c] = matrix[r][c] === 1;
|
|
5580
5299
|
}
|
|
5581
|
-
return { modules: result, moduleCount: size };
|
|
5582
5300
|
}
|
|
5583
|
-
return
|
|
5584
|
-
}
|
|
5585
|
-
const
|
|
5301
|
+
return result;
|
|
5302
|
+
}
|
|
5303
|
+
const generate = () => {
|
|
5586
5304
|
if (!props.value) {
|
|
5587
5305
|
modules.value = [];
|
|
5588
5306
|
moduleCount.value = 0;
|
|
5589
5307
|
return;
|
|
5590
5308
|
}
|
|
5591
5309
|
try {
|
|
5592
|
-
const result =
|
|
5593
|
-
modules.value = result
|
|
5594
|
-
moduleCount.value = result.
|
|
5310
|
+
const result = generateQR(props.value, props.errorCorrectLevel);
|
|
5311
|
+
modules.value = result;
|
|
5312
|
+
moduleCount.value = result.length;
|
|
5595
5313
|
} catch (e) {
|
|
5596
5314
|
console.error("QR Code generation failed:", e);
|
|
5597
5315
|
modules.value = [];
|
|
5598
5316
|
moduleCount.value = 0;
|
|
5599
5317
|
}
|
|
5600
5318
|
};
|
|
5601
|
-
vue.watch(() => props.value,
|
|
5602
|
-
vue.watch(() => props.errorCorrectLevel,
|
|
5319
|
+
vue.watch(() => props.value, generate);
|
|
5320
|
+
vue.watch(() => props.errorCorrectLevel, generate);
|
|
5603
5321
|
vue.onMounted(() => {
|
|
5604
|
-
|
|
5322
|
+
generate();
|
|
5605
5323
|
});
|
|
5606
5324
|
return (_ctx, _cache) => {
|
|
5607
5325
|
return vue.openBlock(), vue.createElementBlock("view", {
|
|
@@ -5635,7 +5353,7 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
5635
5353
|
};
|
|
5636
5354
|
}
|
|
5637
5355
|
});
|
|
5638
|
-
const uQrcode = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-
|
|
5356
|
+
const uQrcode = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-4ef3178d"]]);
|
|
5639
5357
|
const _hoisted_1 = { class: "u-barcode" };
|
|
5640
5358
|
const _hoisted_2 = ["canvas-id"];
|
|
5641
5359
|
const _hoisted_3 = ["src"];
|