@wirecat/cli-memo 0.131.62 → 0.131.64
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/bin/memo.js +2 -2
- package/dist/bundle/{app-server-QBJG7OGQ.js → app-server-7KM4MSDA.js} +9 -9
- package/dist/bundle/{auto-Z4MEU5OY.js → auto-V3FUD6RW.js} +16 -16
- package/dist/bundle/{chunk-LK6D26RK.js → chunk-3SCHFNUH.js} +5 -5
- package/dist/bundle/{chunk-HGNWJJDT.js → chunk-3YNJBKGV.js} +13 -1
- package/dist/bundle/{chunk-Q3VEUHC7.js → chunk-6OS7PTOC.js} +3 -3
- package/dist/bundle/{chunk-2UCLF4AO.js → chunk-DXTNBVLV.js} +394 -115
- package/dist/bundle/{chunk-2VDRVJCR.js → chunk-EDBZEHAU.js} +5 -4
- package/dist/bundle/{chunk-H3COKFXP.js → chunk-FHZKHKBJ.js} +1651 -11
- package/dist/bundle/{chunk-TBSWOVM3.js → chunk-FKUA3BTM.js} +14 -14
- package/dist/bundle/{chunk-TSKGEK2S.js → chunk-LVLFLWGY.js} +3 -3
- package/dist/bundle/{chunk-O2NQCWRM.js → chunk-ML46T7UC.js} +8 -8
- package/dist/bundle/{chunk-XX37LSNV.js → chunk-MYXB2T77.js} +25 -1
- package/dist/bundle/{chunk-WDZOEBTE.js → chunk-NH3A5QTW.js} +2 -2
- package/dist/bundle/{chunk-6OZ2WI7Y.js → chunk-NIJZXGJN.js} +1 -1
- package/dist/bundle/{chunk-EGI6JHIA.js → chunk-NRHF7TQ4.js} +2 -2
- package/dist/bundle/{chunk-WDWKG7FJ.js → chunk-PVGK67AJ.js} +17 -0
- package/dist/bundle/{chunk-E5JQFEIQ.js → chunk-QHNAPLVB.js} +4 -4
- package/dist/bundle/{chunk-SJ55SMBE.js → chunk-QTF4ZXOL.js} +2 -1
- package/dist/bundle/chunk-T3LVSUNZ.js +301 -0
- package/dist/bundle/{chunk-OXBETHGN.js → chunk-UXAP7MNL.js} +4 -4
- package/dist/bundle/{chunk-3ZXWLFUG.js → chunk-VLUDHCCX.js} +3 -3
- package/dist/bundle/{chunk-KREN56SX.js → chunk-WINH45XG.js} +4 -4
- package/dist/bundle/{chunk-FD3OQYFL.js → chunk-XPT5PX7H.js} +4 -4
- package/dist/bundle/{chunk-SJ36WSEI.js → chunk-ZX6SWNSR.js} +3 -3
- package/dist/bundle/{command-contract-SIXWLKAS.js → command-contract-PLB2JGFJ.js} +2 -2
- package/dist/bundle/{entry-SFLEGFSN.js → entry-MUE6HWX3.js} +1 -1
- package/dist/bundle/{failure-B33C3BFU.js → failure-6SP64Q66.js} +14 -14
- package/dist/bundle/{first-run-ZKDGFY6P.js → first-run-3JYWLJCH.js} +1 -1
- package/dist/bundle/{first-screen-IQEU7XF2.js → first-screen-QH34AIFV.js} +3 -3
- package/dist/bundle/{mcp-Y4XMDC5Q.js → mcp-QX2D6EXA.js} +6 -6
- package/dist/bundle/memo.js +6 -6
- package/dist/bundle/{program-DSQWICNB.js → program-LXQLWUAG.js} +1789 -422
- package/dist/bundle/{server-IQILK5YP.js → server-L622PMVC.js} +9 -9
- package/dist/bundle/{server-ZHFC3PIP.js → server-MVJU7QG4.js} +19 -19
- package/dist/bundle/{server-NKI7SVK5.js → server-SJVP2XXD.js} +6 -6
- package/dist/bundle/{store-6H4FPFTX.js → store-M5QSIRWJ.js} +1 -1
- package/dist/bundle/{store-maintenance-command-IFVWSQMJ.js → store-maintenance-command-PQCO5ICC.js} +5 -5
- package/dist/bundle/{update-LR5BVLBD.js → update-MQUCCIBB.js} +15 -15
- package/dist/contract-overrides/search.js +2 -2
- package/dist/contract-overrides/search.js.map +1 -1
- package/dist/discovery/command.d.ts.map +1 -1
- package/dist/discovery/command.js +6 -0
- package/dist/discovery/command.js.map +1 -1
- package/dist/events/command.d.ts +4 -0
- package/dist/events/command.d.ts.map +1 -0
- package/dist/events/command.js +35 -0
- package/dist/events/command.js.map +1 -0
- package/dist/events/events.d.ts +52 -0
- package/dist/events/events.d.ts.map +1 -0
- package/dist/events/events.js +199 -0
- package/dist/events/events.js.map +1 -0
- package/dist/examples.d.ts.map +1 -1
- package/dist/examples.js +90 -3
- package/dist/examples.js.map +1 -1
- package/dist/finance/command.d.ts +1 -1
- package/dist/finance/command.d.ts.map +1 -1
- package/dist/finance/command.js +13 -30
- package/dist/finance/command.js.map +1 -1
- package/dist/finance/contracts-command.d.ts +12 -0
- package/dist/finance/contracts-command.d.ts.map +1 -0
- package/dist/finance/contracts-command.js +110 -0
- package/dist/finance/contracts-command.js.map +1 -0
- package/dist/finance/deals-command.d.ts.map +1 -1
- package/dist/finance/deals-command.js +5 -4
- package/dist/finance/deals-command.js.map +1 -1
- package/dist/finance/lines-command.d.ts +37 -0
- package/dist/finance/lines-command.d.ts.map +1 -0
- package/dist/finance/lines-command.js +70 -0
- package/dist/finance/lines-command.js.map +1 -0
- package/dist/finance/orders-command.d.ts.map +1 -1
- package/dist/finance/orders-command.js +5 -2
- package/dist/finance/orders-command.js.map +1 -1
- package/dist/finance/products-command.d.ts +12 -0
- package/dist/finance/products-command.d.ts.map +1 -0
- package/dist/finance/products-command.js +99 -0
- package/dist/finance/products-command.js.map +1 -0
- package/dist/finance/subscriptions-command.d.ts +12 -0
- package/dist/finance/subscriptions-command.d.ts.map +1 -0
- package/dist/finance/subscriptions-command.js +153 -0
- package/dist/finance/subscriptions-command.js.map +1 -0
- package/dist/finance/transactions-command.d.ts +12 -0
- package/dist/finance/transactions-command.d.ts.map +1 -0
- package/dist/finance/transactions-command.js +137 -0
- package/dist/finance/transactions-command.js.map +1 -0
- package/dist/finance/wallets-command.d.ts +12 -0
- package/dist/finance/wallets-command.d.ts.map +1 -0
- package/dist/finance/wallets-command.js +106 -0
- package/dist/finance/wallets-command.js.map +1 -0
- package/dist/finance/written.d.ts +37 -0
- package/dist/finance/written.d.ts.map +1 -0
- package/dist/finance/written.js +36 -0
- package/dist/finance/written.js.map +1 -0
- package/dist/knowledge/command.d.ts.map +1 -1
- package/dist/knowledge/command.js +3 -2
- package/dist/knowledge/command.js.map +1 -1
- package/dist/mcp/permissions.d.ts +1 -1
- package/dist/mcp/permissions.d.ts.map +1 -1
- package/dist/mcp/permissions.js +1 -0
- package/dist/mcp/permissions.js.map +1 -1
- package/dist/options.d.ts +2 -0
- package/dist/options.d.ts.map +1 -1
- package/dist/options.js +2 -0
- package/dist/options.js.map +1 -1
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +174 -0
- package/dist/program.js.map +1 -1
- package/dist/reasons.d.ts.map +1 -1
- package/dist/reasons.js +24 -0
- package/dist/reasons.js.map +1 -1
- package/dist/records/import.d.ts +2 -4
- package/dist/records/import.d.ts.map +1 -1
- package/dist/records/import.js +41 -41
- package/dist/records/import.js.map +1 -1
- package/dist/records/input.d.ts +20 -0
- package/dist/records/input.d.ts.map +1 -0
- package/dist/records/input.js +115 -0
- package/dist/records/input.js.map +1 -0
- package/dist/records/mapping.d.ts +16 -1
- package/dist/records/mapping.d.ts.map +1 -1
- package/dist/records/mapping.js +24 -11
- package/dist/records/mapping.js.map +1 -1
- package/dist/records/record-commands.d.ts +8 -0
- package/dist/records/record-commands.d.ts.map +1 -0
- package/dist/records/record-commands.js +89 -0
- package/dist/records/record-commands.js.map +1 -0
- package/dist/records/sources.d.ts +48 -0
- package/dist/records/sources.d.ts.map +1 -0
- package/dist/records/sources.js +72 -0
- package/dist/records/sources.js.map +1 -0
- package/dist/review/kinds.d.ts +1 -1
- package/dist/review/kinds.d.ts.map +1 -1
- package/dist/review/kinds.js +4 -0
- package/dist/review/kinds.js.map +1 -1
- package/dist/review/review.d.ts.map +1 -1
- package/dist/review/review.js +4 -0
- package/dist/review/review.js.map +1 -1
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +34 -0
- package/dist/rows.js.map +1 -1
- package/dist/search/command.d.ts.map +1 -1
- package/dist/search/command.js +9 -4
- package/dist/search/command.js.map +1 -1
- package/dist/search/lane-gates.d.ts +3 -0
- package/dist/search/lane-gates.d.ts.map +1 -1
- package/dist/search/lane-gates.js +9 -3
- package/dist/search/lane-gates.js.map +1 -1
- package/dist/search/search.d.ts +3 -1
- package/dist/search/search.d.ts.map +1 -1
- package/dist/search/search.js +2 -1
- package/dist/search/search.js.map +1 -1
- package/dist/show/command.d.ts +6 -1
- package/dist/show/command.d.ts.map +1 -1
- package/dist/show/command.js +49 -4
- package/dist/show/command.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/skills/cli-memo/SKILL.md +8 -5
- package/skills/cli-memo/topics/money.md +20 -1
- package/skills/cli-memo/topics/proposals.md +8 -5
- package/skills/cli-memo/topics/search.md +7 -0
- package/dist/bundle/chunk-HMJ3D7XE.js +0 -1901
|
@@ -27,19 +27,19 @@ import {
|
|
|
27
27
|
serverSearchOptions,
|
|
28
28
|
summaryOf,
|
|
29
29
|
unansweredHours
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-FKUA3BTM.js";
|
|
31
31
|
import {
|
|
32
32
|
MAIL_HIT_UNTRUSTED,
|
|
33
33
|
messagesAnswer,
|
|
34
34
|
offsetOf,
|
|
35
35
|
shownOf
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-3SCHFNUH.js";
|
|
37
37
|
import {
|
|
38
38
|
messageItem
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-QHNAPLVB.js";
|
|
40
40
|
import {
|
|
41
41
|
knownPermissionKeys
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-VLUDHCCX.js";
|
|
43
43
|
import {
|
|
44
44
|
AGENDA_DEFAULTS,
|
|
45
45
|
DEFAULT_BACKEND,
|
|
@@ -63,7 +63,7 @@ import {
|
|
|
63
63
|
sourceKey,
|
|
64
64
|
typedQuery,
|
|
65
65
|
withQuery
|
|
66
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-DXTNBVLV.js";
|
|
67
67
|
import {
|
|
68
68
|
Command,
|
|
69
69
|
FETCH,
|
|
@@ -96,7 +96,7 @@ import {
|
|
|
96
96
|
snakeKeys,
|
|
97
97
|
withSettingDefaults,
|
|
98
98
|
withoutSetting
|
|
99
|
-
} from "./chunk-
|
|
99
|
+
} from "./chunk-PVGK67AJ.js";
|
|
100
100
|
import {
|
|
101
101
|
mailHolderVariable,
|
|
102
102
|
readOnlyLockOf
|
|
@@ -113,8 +113,9 @@ import {
|
|
|
113
113
|
registrableOf,
|
|
114
114
|
scoreGroup,
|
|
115
115
|
validateFields
|
|
116
|
-
} from "./chunk-
|
|
116
|
+
} from "./chunk-3YNJBKGV.js";
|
|
117
117
|
import {
|
|
118
|
+
DEAL_KINDS,
|
|
118
119
|
count,
|
|
119
120
|
dateRange,
|
|
120
121
|
defineQuery,
|
|
@@ -7198,6 +7199,1639 @@ var mailReadCommands = sharedCommand((mail) => [
|
|
|
7198
7199
|
conversationsCommand(mail)
|
|
7199
7200
|
]);
|
|
7200
7201
|
|
|
7202
|
+
// node_modules/.pnpm/qrcode-generator@2.0.4/node_modules/qrcode-generator/dist/qrcode.mjs
|
|
7203
|
+
var qrcode = /* @__PURE__ */ __name(function(typeNumber, errorCorrectionLevel) {
|
|
7204
|
+
const PAD0 = 236;
|
|
7205
|
+
const PAD1 = 17;
|
|
7206
|
+
let _typeNumber = typeNumber;
|
|
7207
|
+
const _errorCorrectionLevel = QRErrorCorrectionLevel[errorCorrectionLevel];
|
|
7208
|
+
let _modules = null;
|
|
7209
|
+
let _moduleCount = 0;
|
|
7210
|
+
let _dataCache = null;
|
|
7211
|
+
const _dataList = [];
|
|
7212
|
+
const _this = {};
|
|
7213
|
+
const makeImpl = /* @__PURE__ */ __name(function(test, maskPattern) {
|
|
7214
|
+
_moduleCount = _typeNumber * 4 + 17;
|
|
7215
|
+
_modules = (function(moduleCount) {
|
|
7216
|
+
const modules = new Array(moduleCount);
|
|
7217
|
+
for (let row = 0; row < moduleCount; row += 1) {
|
|
7218
|
+
modules[row] = new Array(moduleCount);
|
|
7219
|
+
for (let col = 0; col < moduleCount; col += 1) {
|
|
7220
|
+
modules[row][col] = null;
|
|
7221
|
+
}
|
|
7222
|
+
}
|
|
7223
|
+
return modules;
|
|
7224
|
+
})(_moduleCount);
|
|
7225
|
+
setupPositionProbePattern(0, 0);
|
|
7226
|
+
setupPositionProbePattern(_moduleCount - 7, 0);
|
|
7227
|
+
setupPositionProbePattern(0, _moduleCount - 7);
|
|
7228
|
+
setupPositionAdjustPattern();
|
|
7229
|
+
setupTimingPattern();
|
|
7230
|
+
setupTypeInfo(test, maskPattern);
|
|
7231
|
+
if (_typeNumber >= 7) {
|
|
7232
|
+
setupTypeNumber(test);
|
|
7233
|
+
}
|
|
7234
|
+
if (_dataCache == null) {
|
|
7235
|
+
_dataCache = createData(_typeNumber, _errorCorrectionLevel, _dataList);
|
|
7236
|
+
}
|
|
7237
|
+
mapData(_dataCache, maskPattern);
|
|
7238
|
+
}, "makeImpl");
|
|
7239
|
+
const setupPositionProbePattern = /* @__PURE__ */ __name(function(row, col) {
|
|
7240
|
+
for (let r = -1; r <= 7; r += 1) {
|
|
7241
|
+
if (row + r <= -1 || _moduleCount <= row + r) continue;
|
|
7242
|
+
for (let c = -1; c <= 7; c += 1) {
|
|
7243
|
+
if (col + c <= -1 || _moduleCount <= col + c) continue;
|
|
7244
|
+
if (0 <= r && r <= 6 && (c == 0 || c == 6) || 0 <= c && c <= 6 && (r == 0 || r == 6) || 2 <= r && r <= 4 && 2 <= c && c <= 4) {
|
|
7245
|
+
_modules[row + r][col + c] = true;
|
|
7246
|
+
} else {
|
|
7247
|
+
_modules[row + r][col + c] = false;
|
|
7248
|
+
}
|
|
7249
|
+
}
|
|
7250
|
+
}
|
|
7251
|
+
}, "setupPositionProbePattern");
|
|
7252
|
+
const getBestMaskPattern = /* @__PURE__ */ __name(function() {
|
|
7253
|
+
let minLostPoint = 0;
|
|
7254
|
+
let pattern2 = 0;
|
|
7255
|
+
for (let i = 0; i < 8; i += 1) {
|
|
7256
|
+
makeImpl(true, i);
|
|
7257
|
+
const lostPoint = QRUtil.getLostPoint(_this);
|
|
7258
|
+
if (i == 0 || minLostPoint > lostPoint) {
|
|
7259
|
+
minLostPoint = lostPoint;
|
|
7260
|
+
pattern2 = i;
|
|
7261
|
+
}
|
|
7262
|
+
}
|
|
7263
|
+
return pattern2;
|
|
7264
|
+
}, "getBestMaskPattern");
|
|
7265
|
+
const setupTimingPattern = /* @__PURE__ */ __name(function() {
|
|
7266
|
+
for (let r = 8; r < _moduleCount - 8; r += 1) {
|
|
7267
|
+
if (_modules[r][6] != null) {
|
|
7268
|
+
continue;
|
|
7269
|
+
}
|
|
7270
|
+
_modules[r][6] = r % 2 == 0;
|
|
7271
|
+
}
|
|
7272
|
+
for (let c = 8; c < _moduleCount - 8; c += 1) {
|
|
7273
|
+
if (_modules[6][c] != null) {
|
|
7274
|
+
continue;
|
|
7275
|
+
}
|
|
7276
|
+
_modules[6][c] = c % 2 == 0;
|
|
7277
|
+
}
|
|
7278
|
+
}, "setupTimingPattern");
|
|
7279
|
+
const setupPositionAdjustPattern = /* @__PURE__ */ __name(function() {
|
|
7280
|
+
const pos = QRUtil.getPatternPosition(_typeNumber);
|
|
7281
|
+
for (let i = 0; i < pos.length; i += 1) {
|
|
7282
|
+
for (let j = 0; j < pos.length; j += 1) {
|
|
7283
|
+
const row = pos[i];
|
|
7284
|
+
const col = pos[j];
|
|
7285
|
+
if (_modules[row][col] != null) {
|
|
7286
|
+
continue;
|
|
7287
|
+
}
|
|
7288
|
+
for (let r = -2; r <= 2; r += 1) {
|
|
7289
|
+
for (let c = -2; c <= 2; c += 1) {
|
|
7290
|
+
if (r == -2 || r == 2 || c == -2 || c == 2 || r == 0 && c == 0) {
|
|
7291
|
+
_modules[row + r][col + c] = true;
|
|
7292
|
+
} else {
|
|
7293
|
+
_modules[row + r][col + c] = false;
|
|
7294
|
+
}
|
|
7295
|
+
}
|
|
7296
|
+
}
|
|
7297
|
+
}
|
|
7298
|
+
}
|
|
7299
|
+
}, "setupPositionAdjustPattern");
|
|
7300
|
+
const setupTypeNumber = /* @__PURE__ */ __name(function(test) {
|
|
7301
|
+
const bits = QRUtil.getBCHTypeNumber(_typeNumber);
|
|
7302
|
+
for (let i = 0; i < 18; i += 1) {
|
|
7303
|
+
const mod = !test && (bits >> i & 1) == 1;
|
|
7304
|
+
_modules[Math.floor(i / 3)][i % 3 + _moduleCount - 8 - 3] = mod;
|
|
7305
|
+
}
|
|
7306
|
+
for (let i = 0; i < 18; i += 1) {
|
|
7307
|
+
const mod = !test && (bits >> i & 1) == 1;
|
|
7308
|
+
_modules[i % 3 + _moduleCount - 8 - 3][Math.floor(i / 3)] = mod;
|
|
7309
|
+
}
|
|
7310
|
+
}, "setupTypeNumber");
|
|
7311
|
+
const setupTypeInfo = /* @__PURE__ */ __name(function(test, maskPattern) {
|
|
7312
|
+
const data = _errorCorrectionLevel << 3 | maskPattern;
|
|
7313
|
+
const bits = QRUtil.getBCHTypeInfo(data);
|
|
7314
|
+
for (let i = 0; i < 15; i += 1) {
|
|
7315
|
+
const mod = !test && (bits >> i & 1) == 1;
|
|
7316
|
+
if (i < 6) {
|
|
7317
|
+
_modules[i][8] = mod;
|
|
7318
|
+
} else if (i < 8) {
|
|
7319
|
+
_modules[i + 1][8] = mod;
|
|
7320
|
+
} else {
|
|
7321
|
+
_modules[_moduleCount - 15 + i][8] = mod;
|
|
7322
|
+
}
|
|
7323
|
+
}
|
|
7324
|
+
for (let i = 0; i < 15; i += 1) {
|
|
7325
|
+
const mod = !test && (bits >> i & 1) == 1;
|
|
7326
|
+
if (i < 8) {
|
|
7327
|
+
_modules[8][_moduleCount - i - 1] = mod;
|
|
7328
|
+
} else if (i < 9) {
|
|
7329
|
+
_modules[8][15 - i - 1 + 1] = mod;
|
|
7330
|
+
} else {
|
|
7331
|
+
_modules[8][15 - i - 1] = mod;
|
|
7332
|
+
}
|
|
7333
|
+
}
|
|
7334
|
+
_modules[_moduleCount - 8][8] = !test;
|
|
7335
|
+
}, "setupTypeInfo");
|
|
7336
|
+
const mapData = /* @__PURE__ */ __name(function(data, maskPattern) {
|
|
7337
|
+
let inc = -1;
|
|
7338
|
+
let row = _moduleCount - 1;
|
|
7339
|
+
let bitIndex = 7;
|
|
7340
|
+
let byteIndex = 0;
|
|
7341
|
+
const maskFunc = QRUtil.getMaskFunction(maskPattern);
|
|
7342
|
+
for (let col = _moduleCount - 1; col > 0; col -= 2) {
|
|
7343
|
+
if (col == 6) col -= 1;
|
|
7344
|
+
while (true) {
|
|
7345
|
+
for (let c = 0; c < 2; c += 1) {
|
|
7346
|
+
if (_modules[row][col - c] == null) {
|
|
7347
|
+
let dark = false;
|
|
7348
|
+
if (byteIndex < data.length) {
|
|
7349
|
+
dark = (data[byteIndex] >>> bitIndex & 1) == 1;
|
|
7350
|
+
}
|
|
7351
|
+
const mask = maskFunc(row, col - c);
|
|
7352
|
+
if (mask) {
|
|
7353
|
+
dark = !dark;
|
|
7354
|
+
}
|
|
7355
|
+
_modules[row][col - c] = dark;
|
|
7356
|
+
bitIndex -= 1;
|
|
7357
|
+
if (bitIndex == -1) {
|
|
7358
|
+
byteIndex += 1;
|
|
7359
|
+
bitIndex = 7;
|
|
7360
|
+
}
|
|
7361
|
+
}
|
|
7362
|
+
}
|
|
7363
|
+
row += inc;
|
|
7364
|
+
if (row < 0 || _moduleCount <= row) {
|
|
7365
|
+
row -= inc;
|
|
7366
|
+
inc = -inc;
|
|
7367
|
+
break;
|
|
7368
|
+
}
|
|
7369
|
+
}
|
|
7370
|
+
}
|
|
7371
|
+
}, "mapData");
|
|
7372
|
+
const createBytes = /* @__PURE__ */ __name(function(buffer, rsBlocks) {
|
|
7373
|
+
let offset = 0;
|
|
7374
|
+
let maxDcCount = 0;
|
|
7375
|
+
let maxEcCount = 0;
|
|
7376
|
+
const dcdata = new Array(rsBlocks.length);
|
|
7377
|
+
const ecdata = new Array(rsBlocks.length);
|
|
7378
|
+
for (let r = 0; r < rsBlocks.length; r += 1) {
|
|
7379
|
+
const dcCount = rsBlocks[r].dataCount;
|
|
7380
|
+
const ecCount = rsBlocks[r].totalCount - dcCount;
|
|
7381
|
+
maxDcCount = Math.max(maxDcCount, dcCount);
|
|
7382
|
+
maxEcCount = Math.max(maxEcCount, ecCount);
|
|
7383
|
+
dcdata[r] = new Array(dcCount);
|
|
7384
|
+
for (let i = 0; i < dcdata[r].length; i += 1) {
|
|
7385
|
+
dcdata[r][i] = 255 & buffer.getBuffer()[i + offset];
|
|
7386
|
+
}
|
|
7387
|
+
offset += dcCount;
|
|
7388
|
+
const rsPoly = QRUtil.getErrorCorrectPolynomial(ecCount);
|
|
7389
|
+
const rawPoly = qrPolynomial(dcdata[r], rsPoly.getLength() - 1);
|
|
7390
|
+
const modPoly = rawPoly.mod(rsPoly);
|
|
7391
|
+
ecdata[r] = new Array(rsPoly.getLength() - 1);
|
|
7392
|
+
for (let i = 0; i < ecdata[r].length; i += 1) {
|
|
7393
|
+
const modIndex = i + modPoly.getLength() - ecdata[r].length;
|
|
7394
|
+
ecdata[r][i] = modIndex >= 0 ? modPoly.getAt(modIndex) : 0;
|
|
7395
|
+
}
|
|
7396
|
+
}
|
|
7397
|
+
let totalCodeCount = 0;
|
|
7398
|
+
for (let i = 0; i < rsBlocks.length; i += 1) {
|
|
7399
|
+
totalCodeCount += rsBlocks[i].totalCount;
|
|
7400
|
+
}
|
|
7401
|
+
const data = new Array(totalCodeCount);
|
|
7402
|
+
let index = 0;
|
|
7403
|
+
for (let i = 0; i < maxDcCount; i += 1) {
|
|
7404
|
+
for (let r = 0; r < rsBlocks.length; r += 1) {
|
|
7405
|
+
if (i < dcdata[r].length) {
|
|
7406
|
+
data[index] = dcdata[r][i];
|
|
7407
|
+
index += 1;
|
|
7408
|
+
}
|
|
7409
|
+
}
|
|
7410
|
+
}
|
|
7411
|
+
for (let i = 0; i < maxEcCount; i += 1) {
|
|
7412
|
+
for (let r = 0; r < rsBlocks.length; r += 1) {
|
|
7413
|
+
if (i < ecdata[r].length) {
|
|
7414
|
+
data[index] = ecdata[r][i];
|
|
7415
|
+
index += 1;
|
|
7416
|
+
}
|
|
7417
|
+
}
|
|
7418
|
+
}
|
|
7419
|
+
return data;
|
|
7420
|
+
}, "createBytes");
|
|
7421
|
+
const createData = /* @__PURE__ */ __name(function(typeNumber2, errorCorrectionLevel2, dataList) {
|
|
7422
|
+
const rsBlocks = QRRSBlock.getRSBlocks(typeNumber2, errorCorrectionLevel2);
|
|
7423
|
+
const buffer = qrBitBuffer();
|
|
7424
|
+
for (let i = 0; i < dataList.length; i += 1) {
|
|
7425
|
+
const data = dataList[i];
|
|
7426
|
+
buffer.put(data.getMode(), 4);
|
|
7427
|
+
buffer.put(data.getLength(), QRUtil.getLengthInBits(data.getMode(), typeNumber2));
|
|
7428
|
+
data.write(buffer);
|
|
7429
|
+
}
|
|
7430
|
+
let totalDataCount = 0;
|
|
7431
|
+
for (let i = 0; i < rsBlocks.length; i += 1) {
|
|
7432
|
+
totalDataCount += rsBlocks[i].dataCount;
|
|
7433
|
+
}
|
|
7434
|
+
if (buffer.getLengthInBits() > totalDataCount * 8) {
|
|
7435
|
+
throw "code length overflow. (" + buffer.getLengthInBits() + ">" + totalDataCount * 8 + ")";
|
|
7436
|
+
}
|
|
7437
|
+
if (buffer.getLengthInBits() + 4 <= totalDataCount * 8) {
|
|
7438
|
+
buffer.put(0, 4);
|
|
7439
|
+
}
|
|
7440
|
+
while (buffer.getLengthInBits() % 8 != 0) {
|
|
7441
|
+
buffer.putBit(false);
|
|
7442
|
+
}
|
|
7443
|
+
while (true) {
|
|
7444
|
+
if (buffer.getLengthInBits() >= totalDataCount * 8) {
|
|
7445
|
+
break;
|
|
7446
|
+
}
|
|
7447
|
+
buffer.put(PAD0, 8);
|
|
7448
|
+
if (buffer.getLengthInBits() >= totalDataCount * 8) {
|
|
7449
|
+
break;
|
|
7450
|
+
}
|
|
7451
|
+
buffer.put(PAD1, 8);
|
|
7452
|
+
}
|
|
7453
|
+
return createBytes(buffer, rsBlocks);
|
|
7454
|
+
}, "createData");
|
|
7455
|
+
_this.addData = function(data, mode) {
|
|
7456
|
+
mode = mode || "Byte";
|
|
7457
|
+
let newData = null;
|
|
7458
|
+
switch (mode) {
|
|
7459
|
+
case "Numeric":
|
|
7460
|
+
newData = qrNumber(data);
|
|
7461
|
+
break;
|
|
7462
|
+
case "Alphanumeric":
|
|
7463
|
+
newData = qrAlphaNum(data);
|
|
7464
|
+
break;
|
|
7465
|
+
case "Byte":
|
|
7466
|
+
newData = qr8BitByte(data);
|
|
7467
|
+
break;
|
|
7468
|
+
case "Kanji":
|
|
7469
|
+
newData = qrKanji(data);
|
|
7470
|
+
break;
|
|
7471
|
+
default:
|
|
7472
|
+
throw "mode:" + mode;
|
|
7473
|
+
}
|
|
7474
|
+
_dataList.push(newData);
|
|
7475
|
+
_dataCache = null;
|
|
7476
|
+
};
|
|
7477
|
+
_this.isDark = function(row, col) {
|
|
7478
|
+
if (row < 0 || _moduleCount <= row || col < 0 || _moduleCount <= col) {
|
|
7479
|
+
throw row + "," + col;
|
|
7480
|
+
}
|
|
7481
|
+
return _modules[row][col];
|
|
7482
|
+
};
|
|
7483
|
+
_this.getModuleCount = function() {
|
|
7484
|
+
return _moduleCount;
|
|
7485
|
+
};
|
|
7486
|
+
_this.make = function() {
|
|
7487
|
+
if (_typeNumber < 1) {
|
|
7488
|
+
let typeNumber2 = 1;
|
|
7489
|
+
for (; typeNumber2 < 40; typeNumber2++) {
|
|
7490
|
+
const rsBlocks = QRRSBlock.getRSBlocks(typeNumber2, _errorCorrectionLevel);
|
|
7491
|
+
const buffer = qrBitBuffer();
|
|
7492
|
+
for (let i = 0; i < _dataList.length; i++) {
|
|
7493
|
+
const data = _dataList[i];
|
|
7494
|
+
buffer.put(data.getMode(), 4);
|
|
7495
|
+
buffer.put(data.getLength(), QRUtil.getLengthInBits(data.getMode(), typeNumber2));
|
|
7496
|
+
data.write(buffer);
|
|
7497
|
+
}
|
|
7498
|
+
let totalDataCount = 0;
|
|
7499
|
+
for (let i = 0; i < rsBlocks.length; i++) {
|
|
7500
|
+
totalDataCount += rsBlocks[i].dataCount;
|
|
7501
|
+
}
|
|
7502
|
+
if (buffer.getLengthInBits() <= totalDataCount * 8) {
|
|
7503
|
+
break;
|
|
7504
|
+
}
|
|
7505
|
+
}
|
|
7506
|
+
_typeNumber = typeNumber2;
|
|
7507
|
+
}
|
|
7508
|
+
makeImpl(false, getBestMaskPattern());
|
|
7509
|
+
};
|
|
7510
|
+
_this.createTableTag = function(cellSize, margin) {
|
|
7511
|
+
cellSize = cellSize || 2;
|
|
7512
|
+
margin = typeof margin == "undefined" ? cellSize * 4 : margin;
|
|
7513
|
+
let qrHtml = "";
|
|
7514
|
+
qrHtml += '<table style="';
|
|
7515
|
+
qrHtml += " border-width: 0px; border-style: none;";
|
|
7516
|
+
qrHtml += " border-collapse: collapse;";
|
|
7517
|
+
qrHtml += " padding: 0px; margin: " + margin + "px;";
|
|
7518
|
+
qrHtml += '">';
|
|
7519
|
+
qrHtml += "<tbody>";
|
|
7520
|
+
for (let r = 0; r < _this.getModuleCount(); r += 1) {
|
|
7521
|
+
qrHtml += "<tr>";
|
|
7522
|
+
for (let c = 0; c < _this.getModuleCount(); c += 1) {
|
|
7523
|
+
qrHtml += '<td style="';
|
|
7524
|
+
qrHtml += " border-width: 0px; border-style: none;";
|
|
7525
|
+
qrHtml += " border-collapse: collapse;";
|
|
7526
|
+
qrHtml += " padding: 0px; margin: 0px;";
|
|
7527
|
+
qrHtml += " width: " + cellSize + "px;";
|
|
7528
|
+
qrHtml += " height: " + cellSize + "px;";
|
|
7529
|
+
qrHtml += " background-color: ";
|
|
7530
|
+
qrHtml += _this.isDark(r, c) ? "#000000" : "#ffffff";
|
|
7531
|
+
qrHtml += ";";
|
|
7532
|
+
qrHtml += '"/>';
|
|
7533
|
+
}
|
|
7534
|
+
qrHtml += "</tr>";
|
|
7535
|
+
}
|
|
7536
|
+
qrHtml += "</tbody>";
|
|
7537
|
+
qrHtml += "</table>";
|
|
7538
|
+
return qrHtml;
|
|
7539
|
+
};
|
|
7540
|
+
_this.createSvgTag = function(cellSize, margin, alt, title) {
|
|
7541
|
+
let opts = {};
|
|
7542
|
+
if (typeof arguments[0] == "object") {
|
|
7543
|
+
opts = arguments[0];
|
|
7544
|
+
cellSize = opts.cellSize;
|
|
7545
|
+
margin = opts.margin;
|
|
7546
|
+
alt = opts.alt;
|
|
7547
|
+
title = opts.title;
|
|
7548
|
+
}
|
|
7549
|
+
cellSize = cellSize || 2;
|
|
7550
|
+
margin = typeof margin == "undefined" ? cellSize * 4 : margin;
|
|
7551
|
+
alt = typeof alt === "string" ? { text: alt } : alt || {};
|
|
7552
|
+
alt.text = alt.text || null;
|
|
7553
|
+
alt.id = alt.text ? alt.id || "qrcode-description" : null;
|
|
7554
|
+
title = typeof title === "string" ? { text: title } : title || {};
|
|
7555
|
+
title.text = title.text || null;
|
|
7556
|
+
title.id = title.text ? title.id || "qrcode-title" : null;
|
|
7557
|
+
const size = _this.getModuleCount() * cellSize + margin * 2;
|
|
7558
|
+
let c, mc, r, mr, qrSvg = "", rect;
|
|
7559
|
+
rect = "l" + cellSize + ",0 0," + cellSize + " -" + cellSize + ",0 0,-" + cellSize + "z ";
|
|
7560
|
+
qrSvg += '<svg version="1.1" xmlns="http://www.w3.org/2000/svg"';
|
|
7561
|
+
qrSvg += !opts.scalable ? ' width="' + size + 'px" height="' + size + 'px"' : "";
|
|
7562
|
+
qrSvg += ' viewBox="0 0 ' + size + " " + size + '" ';
|
|
7563
|
+
qrSvg += ' preserveAspectRatio="xMinYMin meet"';
|
|
7564
|
+
qrSvg += title.text || alt.text ? ' role="img" aria-labelledby="' + escapeXml([title.id, alt.id].join(" ").trim()) + '"' : "";
|
|
7565
|
+
qrSvg += ">";
|
|
7566
|
+
qrSvg += title.text ? '<title id="' + escapeXml(title.id) + '">' + escapeXml(title.text) + "</title>" : "";
|
|
7567
|
+
qrSvg += alt.text ? '<description id="' + escapeXml(alt.id) + '">' + escapeXml(alt.text) + "</description>" : "";
|
|
7568
|
+
qrSvg += '<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>';
|
|
7569
|
+
qrSvg += '<path d="';
|
|
7570
|
+
for (r = 0; r < _this.getModuleCount(); r += 1) {
|
|
7571
|
+
mr = r * cellSize + margin;
|
|
7572
|
+
for (c = 0; c < _this.getModuleCount(); c += 1) {
|
|
7573
|
+
if (_this.isDark(r, c)) {
|
|
7574
|
+
mc = c * cellSize + margin;
|
|
7575
|
+
qrSvg += "M" + mc + "," + mr + rect;
|
|
7576
|
+
}
|
|
7577
|
+
}
|
|
7578
|
+
}
|
|
7579
|
+
qrSvg += '" stroke="transparent" fill="black"/>';
|
|
7580
|
+
qrSvg += "</svg>";
|
|
7581
|
+
return qrSvg;
|
|
7582
|
+
};
|
|
7583
|
+
_this.createDataURL = function(cellSize, margin) {
|
|
7584
|
+
cellSize = cellSize || 2;
|
|
7585
|
+
margin = typeof margin == "undefined" ? cellSize * 4 : margin;
|
|
7586
|
+
const size = _this.getModuleCount() * cellSize + margin * 2;
|
|
7587
|
+
const min = margin;
|
|
7588
|
+
const max = size - margin;
|
|
7589
|
+
return createDataURL(size, size, function(x, y) {
|
|
7590
|
+
if (min <= x && x < max && min <= y && y < max) {
|
|
7591
|
+
const c = Math.floor((x - min) / cellSize);
|
|
7592
|
+
const r = Math.floor((y - min) / cellSize);
|
|
7593
|
+
return _this.isDark(r, c) ? 0 : 1;
|
|
7594
|
+
} else {
|
|
7595
|
+
return 1;
|
|
7596
|
+
}
|
|
7597
|
+
});
|
|
7598
|
+
};
|
|
7599
|
+
_this.createImgTag = function(cellSize, margin, alt) {
|
|
7600
|
+
cellSize = cellSize || 2;
|
|
7601
|
+
margin = typeof margin == "undefined" ? cellSize * 4 : margin;
|
|
7602
|
+
const size = _this.getModuleCount() * cellSize + margin * 2;
|
|
7603
|
+
let img = "";
|
|
7604
|
+
img += "<img";
|
|
7605
|
+
img += ' src="';
|
|
7606
|
+
img += _this.createDataURL(cellSize, margin);
|
|
7607
|
+
img += '"';
|
|
7608
|
+
img += ' width="';
|
|
7609
|
+
img += size;
|
|
7610
|
+
img += '"';
|
|
7611
|
+
img += ' height="';
|
|
7612
|
+
img += size;
|
|
7613
|
+
img += '"';
|
|
7614
|
+
if (alt) {
|
|
7615
|
+
img += ' alt="';
|
|
7616
|
+
img += escapeXml(alt);
|
|
7617
|
+
img += '"';
|
|
7618
|
+
}
|
|
7619
|
+
img += "/>";
|
|
7620
|
+
return img;
|
|
7621
|
+
};
|
|
7622
|
+
const escapeXml = /* @__PURE__ */ __name(function(s) {
|
|
7623
|
+
let escaped = "";
|
|
7624
|
+
for (let i = 0; i < s.length; i += 1) {
|
|
7625
|
+
const c = s.charAt(i);
|
|
7626
|
+
switch (c) {
|
|
7627
|
+
case "<":
|
|
7628
|
+
escaped += "<";
|
|
7629
|
+
break;
|
|
7630
|
+
case ">":
|
|
7631
|
+
escaped += ">";
|
|
7632
|
+
break;
|
|
7633
|
+
case "&":
|
|
7634
|
+
escaped += "&";
|
|
7635
|
+
break;
|
|
7636
|
+
case '"':
|
|
7637
|
+
escaped += """;
|
|
7638
|
+
break;
|
|
7639
|
+
default:
|
|
7640
|
+
escaped += c;
|
|
7641
|
+
break;
|
|
7642
|
+
}
|
|
7643
|
+
}
|
|
7644
|
+
return escaped;
|
|
7645
|
+
}, "escapeXml");
|
|
7646
|
+
const _createHalfASCII = /* @__PURE__ */ __name(function(margin) {
|
|
7647
|
+
const cellSize = 1;
|
|
7648
|
+
margin = typeof margin == "undefined" ? cellSize * 2 : margin;
|
|
7649
|
+
const size = _this.getModuleCount() * cellSize + margin * 2;
|
|
7650
|
+
const min = margin;
|
|
7651
|
+
const max = size - margin;
|
|
7652
|
+
let y, x, r1, r2, p;
|
|
7653
|
+
const blocks = {
|
|
7654
|
+
"\u2588\u2588": "\u2588",
|
|
7655
|
+
"\u2588 ": "\u2580",
|
|
7656
|
+
" \u2588": "\u2584",
|
|
7657
|
+
" ": " "
|
|
7658
|
+
};
|
|
7659
|
+
const blocksLastLineNoMargin = {
|
|
7660
|
+
"\u2588\u2588": "\u2580",
|
|
7661
|
+
"\u2588 ": "\u2580",
|
|
7662
|
+
" \u2588": " ",
|
|
7663
|
+
" ": " "
|
|
7664
|
+
};
|
|
7665
|
+
let ascii = "";
|
|
7666
|
+
for (y = 0; y < size; y += 2) {
|
|
7667
|
+
r1 = Math.floor((y - min) / cellSize);
|
|
7668
|
+
r2 = Math.floor((y + 1 - min) / cellSize);
|
|
7669
|
+
for (x = 0; x < size; x += 1) {
|
|
7670
|
+
p = "\u2588";
|
|
7671
|
+
if (min <= x && x < max && min <= y && y < max && _this.isDark(r1, Math.floor((x - min) / cellSize))) {
|
|
7672
|
+
p = " ";
|
|
7673
|
+
}
|
|
7674
|
+
if (min <= x && x < max && min <= y + 1 && y + 1 < max && _this.isDark(r2, Math.floor((x - min) / cellSize))) {
|
|
7675
|
+
p += " ";
|
|
7676
|
+
} else {
|
|
7677
|
+
p += "\u2588";
|
|
7678
|
+
}
|
|
7679
|
+
ascii += margin < 1 && y + 1 >= max ? blocksLastLineNoMargin[p] : blocks[p];
|
|
7680
|
+
}
|
|
7681
|
+
ascii += "\n";
|
|
7682
|
+
}
|
|
7683
|
+
if (size % 2 && margin > 0) {
|
|
7684
|
+
return ascii.substring(0, ascii.length - size - 1) + Array(size + 1).join("\u2580");
|
|
7685
|
+
}
|
|
7686
|
+
return ascii.substring(0, ascii.length - 1);
|
|
7687
|
+
}, "_createHalfASCII");
|
|
7688
|
+
_this.createASCII = function(cellSize, margin) {
|
|
7689
|
+
cellSize = cellSize || 1;
|
|
7690
|
+
if (cellSize < 2) {
|
|
7691
|
+
return _createHalfASCII(margin);
|
|
7692
|
+
}
|
|
7693
|
+
cellSize -= 1;
|
|
7694
|
+
margin = typeof margin == "undefined" ? cellSize * 2 : margin;
|
|
7695
|
+
const size = _this.getModuleCount() * cellSize + margin * 2;
|
|
7696
|
+
const min = margin;
|
|
7697
|
+
const max = size - margin;
|
|
7698
|
+
let y, x, r, p;
|
|
7699
|
+
const white = Array(cellSize + 1).join("\u2588\u2588");
|
|
7700
|
+
const black = Array(cellSize + 1).join(" ");
|
|
7701
|
+
let ascii = "";
|
|
7702
|
+
let line2 = "";
|
|
7703
|
+
for (y = 0; y < size; y += 1) {
|
|
7704
|
+
r = Math.floor((y - min) / cellSize);
|
|
7705
|
+
line2 = "";
|
|
7706
|
+
for (x = 0; x < size; x += 1) {
|
|
7707
|
+
p = 1;
|
|
7708
|
+
if (min <= x && x < max && min <= y && y < max && _this.isDark(r, Math.floor((x - min) / cellSize))) {
|
|
7709
|
+
p = 0;
|
|
7710
|
+
}
|
|
7711
|
+
line2 += p ? white : black;
|
|
7712
|
+
}
|
|
7713
|
+
for (r = 0; r < cellSize; r += 1) {
|
|
7714
|
+
ascii += line2 + "\n";
|
|
7715
|
+
}
|
|
7716
|
+
}
|
|
7717
|
+
return ascii.substring(0, ascii.length - 1);
|
|
7718
|
+
};
|
|
7719
|
+
_this.renderTo2dContext = function(context, cellSize) {
|
|
7720
|
+
cellSize = cellSize || 2;
|
|
7721
|
+
const length = _this.getModuleCount();
|
|
7722
|
+
for (let row = 0; row < length; row++) {
|
|
7723
|
+
for (let col = 0; col < length; col++) {
|
|
7724
|
+
context.fillStyle = _this.isDark(row, col) ? "black" : "white";
|
|
7725
|
+
context.fillRect(col * cellSize, row * cellSize, cellSize, cellSize);
|
|
7726
|
+
}
|
|
7727
|
+
}
|
|
7728
|
+
};
|
|
7729
|
+
return _this;
|
|
7730
|
+
}, "qrcode");
|
|
7731
|
+
qrcode.stringToBytes = function(s) {
|
|
7732
|
+
const bytes = [];
|
|
7733
|
+
for (let i = 0; i < s.length; i += 1) {
|
|
7734
|
+
const c = s.charCodeAt(i);
|
|
7735
|
+
bytes.push(c & 255);
|
|
7736
|
+
}
|
|
7737
|
+
return bytes;
|
|
7738
|
+
};
|
|
7739
|
+
qrcode.createStringToBytes = function(unicodeData, numChars) {
|
|
7740
|
+
const unicodeMap = (function() {
|
|
7741
|
+
const bin = base64DecodeInputStream(unicodeData);
|
|
7742
|
+
const read = /* @__PURE__ */ __name(function() {
|
|
7743
|
+
const b = bin.read();
|
|
7744
|
+
if (b == -1) throw "eof";
|
|
7745
|
+
return b;
|
|
7746
|
+
}, "read");
|
|
7747
|
+
let count2 = 0;
|
|
7748
|
+
const unicodeMap2 = {};
|
|
7749
|
+
while (true) {
|
|
7750
|
+
const b0 = bin.read();
|
|
7751
|
+
if (b0 == -1) break;
|
|
7752
|
+
const b1 = read();
|
|
7753
|
+
const b2 = read();
|
|
7754
|
+
const b3 = read();
|
|
7755
|
+
const k = String.fromCharCode(b0 << 8 | b1);
|
|
7756
|
+
const v = b2 << 8 | b3;
|
|
7757
|
+
unicodeMap2[k] = v;
|
|
7758
|
+
count2 += 1;
|
|
7759
|
+
}
|
|
7760
|
+
if (count2 != numChars) {
|
|
7761
|
+
throw count2 + " != " + numChars;
|
|
7762
|
+
}
|
|
7763
|
+
return unicodeMap2;
|
|
7764
|
+
})();
|
|
7765
|
+
const unknownChar = "?".charCodeAt(0);
|
|
7766
|
+
return function(s) {
|
|
7767
|
+
const bytes = [];
|
|
7768
|
+
for (let i = 0; i < s.length; i += 1) {
|
|
7769
|
+
const c = s.charCodeAt(i);
|
|
7770
|
+
if (c < 128) {
|
|
7771
|
+
bytes.push(c);
|
|
7772
|
+
} else {
|
|
7773
|
+
const b = unicodeMap[s.charAt(i)];
|
|
7774
|
+
if (typeof b == "number") {
|
|
7775
|
+
if ((b & 255) == b) {
|
|
7776
|
+
bytes.push(b);
|
|
7777
|
+
} else {
|
|
7778
|
+
bytes.push(b >>> 8);
|
|
7779
|
+
bytes.push(b & 255);
|
|
7780
|
+
}
|
|
7781
|
+
} else {
|
|
7782
|
+
bytes.push(unknownChar);
|
|
7783
|
+
}
|
|
7784
|
+
}
|
|
7785
|
+
}
|
|
7786
|
+
return bytes;
|
|
7787
|
+
};
|
|
7788
|
+
};
|
|
7789
|
+
var QRMode = {
|
|
7790
|
+
MODE_NUMBER: 1 << 0,
|
|
7791
|
+
MODE_ALPHA_NUM: 1 << 1,
|
|
7792
|
+
MODE_8BIT_BYTE: 1 << 2,
|
|
7793
|
+
MODE_KANJI: 1 << 3
|
|
7794
|
+
};
|
|
7795
|
+
var QRErrorCorrectionLevel = {
|
|
7796
|
+
L: 1,
|
|
7797
|
+
M: 0,
|
|
7798
|
+
Q: 3,
|
|
7799
|
+
H: 2
|
|
7800
|
+
};
|
|
7801
|
+
var QRMaskPattern = {
|
|
7802
|
+
PATTERN000: 0,
|
|
7803
|
+
PATTERN001: 1,
|
|
7804
|
+
PATTERN010: 2,
|
|
7805
|
+
PATTERN011: 3,
|
|
7806
|
+
PATTERN100: 4,
|
|
7807
|
+
PATTERN101: 5,
|
|
7808
|
+
PATTERN110: 6,
|
|
7809
|
+
PATTERN111: 7
|
|
7810
|
+
};
|
|
7811
|
+
var QRUtil = (function() {
|
|
7812
|
+
const PATTERN_POSITION_TABLE = [
|
|
7813
|
+
[],
|
|
7814
|
+
[6, 18],
|
|
7815
|
+
[6, 22],
|
|
7816
|
+
[6, 26],
|
|
7817
|
+
[6, 30],
|
|
7818
|
+
[6, 34],
|
|
7819
|
+
[6, 22, 38],
|
|
7820
|
+
[6, 24, 42],
|
|
7821
|
+
[6, 26, 46],
|
|
7822
|
+
[6, 28, 50],
|
|
7823
|
+
[6, 30, 54],
|
|
7824
|
+
[6, 32, 58],
|
|
7825
|
+
[6, 34, 62],
|
|
7826
|
+
[6, 26, 46, 66],
|
|
7827
|
+
[6, 26, 48, 70],
|
|
7828
|
+
[6, 26, 50, 74],
|
|
7829
|
+
[6, 30, 54, 78],
|
|
7830
|
+
[6, 30, 56, 82],
|
|
7831
|
+
[6, 30, 58, 86],
|
|
7832
|
+
[6, 34, 62, 90],
|
|
7833
|
+
[6, 28, 50, 72, 94],
|
|
7834
|
+
[6, 26, 50, 74, 98],
|
|
7835
|
+
[6, 30, 54, 78, 102],
|
|
7836
|
+
[6, 28, 54, 80, 106],
|
|
7837
|
+
[6, 32, 58, 84, 110],
|
|
7838
|
+
[6, 30, 58, 86, 114],
|
|
7839
|
+
[6, 34, 62, 90, 118],
|
|
7840
|
+
[6, 26, 50, 74, 98, 122],
|
|
7841
|
+
[6, 30, 54, 78, 102, 126],
|
|
7842
|
+
[6, 26, 52, 78, 104, 130],
|
|
7843
|
+
[6, 30, 56, 82, 108, 134],
|
|
7844
|
+
[6, 34, 60, 86, 112, 138],
|
|
7845
|
+
[6, 30, 58, 86, 114, 142],
|
|
7846
|
+
[6, 34, 62, 90, 118, 146],
|
|
7847
|
+
[6, 30, 54, 78, 102, 126, 150],
|
|
7848
|
+
[6, 24, 50, 76, 102, 128, 154],
|
|
7849
|
+
[6, 28, 54, 80, 106, 132, 158],
|
|
7850
|
+
[6, 32, 58, 84, 110, 136, 162],
|
|
7851
|
+
[6, 26, 54, 82, 110, 138, 166],
|
|
7852
|
+
[6, 30, 58, 86, 114, 142, 170]
|
|
7853
|
+
];
|
|
7854
|
+
const G15 = 1 << 10 | 1 << 8 | 1 << 5 | 1 << 4 | 1 << 2 | 1 << 1 | 1 << 0;
|
|
7855
|
+
const G18 = 1 << 12 | 1 << 11 | 1 << 10 | 1 << 9 | 1 << 8 | 1 << 5 | 1 << 2 | 1 << 0;
|
|
7856
|
+
const G15_MASK = 1 << 14 | 1 << 12 | 1 << 10 | 1 << 4 | 1 << 1;
|
|
7857
|
+
const _this = {};
|
|
7858
|
+
const getBCHDigit = /* @__PURE__ */ __name(function(data) {
|
|
7859
|
+
let digit = 0;
|
|
7860
|
+
while (data != 0) {
|
|
7861
|
+
digit += 1;
|
|
7862
|
+
data >>>= 1;
|
|
7863
|
+
}
|
|
7864
|
+
return digit;
|
|
7865
|
+
}, "getBCHDigit");
|
|
7866
|
+
_this.getBCHTypeInfo = function(data) {
|
|
7867
|
+
let d = data << 10;
|
|
7868
|
+
while (getBCHDigit(d) - getBCHDigit(G15) >= 0) {
|
|
7869
|
+
d ^= G15 << getBCHDigit(d) - getBCHDigit(G15);
|
|
7870
|
+
}
|
|
7871
|
+
return (data << 10 | d) ^ G15_MASK;
|
|
7872
|
+
};
|
|
7873
|
+
_this.getBCHTypeNumber = function(data) {
|
|
7874
|
+
let d = data << 12;
|
|
7875
|
+
while (getBCHDigit(d) - getBCHDigit(G18) >= 0) {
|
|
7876
|
+
d ^= G18 << getBCHDigit(d) - getBCHDigit(G18);
|
|
7877
|
+
}
|
|
7878
|
+
return data << 12 | d;
|
|
7879
|
+
};
|
|
7880
|
+
_this.getPatternPosition = function(typeNumber) {
|
|
7881
|
+
return PATTERN_POSITION_TABLE[typeNumber - 1];
|
|
7882
|
+
};
|
|
7883
|
+
_this.getMaskFunction = function(maskPattern) {
|
|
7884
|
+
switch (maskPattern) {
|
|
7885
|
+
case QRMaskPattern.PATTERN000:
|
|
7886
|
+
return function(i, j) {
|
|
7887
|
+
return (i + j) % 2 == 0;
|
|
7888
|
+
};
|
|
7889
|
+
case QRMaskPattern.PATTERN001:
|
|
7890
|
+
return function(i, j) {
|
|
7891
|
+
return i % 2 == 0;
|
|
7892
|
+
};
|
|
7893
|
+
case QRMaskPattern.PATTERN010:
|
|
7894
|
+
return function(i, j) {
|
|
7895
|
+
return j % 3 == 0;
|
|
7896
|
+
};
|
|
7897
|
+
case QRMaskPattern.PATTERN011:
|
|
7898
|
+
return function(i, j) {
|
|
7899
|
+
return (i + j) % 3 == 0;
|
|
7900
|
+
};
|
|
7901
|
+
case QRMaskPattern.PATTERN100:
|
|
7902
|
+
return function(i, j) {
|
|
7903
|
+
return (Math.floor(i / 2) + Math.floor(j / 3)) % 2 == 0;
|
|
7904
|
+
};
|
|
7905
|
+
case QRMaskPattern.PATTERN101:
|
|
7906
|
+
return function(i, j) {
|
|
7907
|
+
return i * j % 2 + i * j % 3 == 0;
|
|
7908
|
+
};
|
|
7909
|
+
case QRMaskPattern.PATTERN110:
|
|
7910
|
+
return function(i, j) {
|
|
7911
|
+
return (i * j % 2 + i * j % 3) % 2 == 0;
|
|
7912
|
+
};
|
|
7913
|
+
case QRMaskPattern.PATTERN111:
|
|
7914
|
+
return function(i, j) {
|
|
7915
|
+
return (i * j % 3 + (i + j) % 2) % 2 == 0;
|
|
7916
|
+
};
|
|
7917
|
+
default:
|
|
7918
|
+
throw "bad maskPattern:" + maskPattern;
|
|
7919
|
+
}
|
|
7920
|
+
};
|
|
7921
|
+
_this.getErrorCorrectPolynomial = function(errorCorrectLength) {
|
|
7922
|
+
let a = qrPolynomial([1], 0);
|
|
7923
|
+
for (let i = 0; i < errorCorrectLength; i += 1) {
|
|
7924
|
+
a = a.multiply(qrPolynomial([1, QRMath.gexp(i)], 0));
|
|
7925
|
+
}
|
|
7926
|
+
return a;
|
|
7927
|
+
};
|
|
7928
|
+
_this.getLengthInBits = function(mode, type) {
|
|
7929
|
+
if (1 <= type && type < 10) {
|
|
7930
|
+
switch (mode) {
|
|
7931
|
+
case QRMode.MODE_NUMBER:
|
|
7932
|
+
return 10;
|
|
7933
|
+
case QRMode.MODE_ALPHA_NUM:
|
|
7934
|
+
return 9;
|
|
7935
|
+
case QRMode.MODE_8BIT_BYTE:
|
|
7936
|
+
return 8;
|
|
7937
|
+
case QRMode.MODE_KANJI:
|
|
7938
|
+
return 8;
|
|
7939
|
+
default:
|
|
7940
|
+
throw "mode:" + mode;
|
|
7941
|
+
}
|
|
7942
|
+
} else if (type < 27) {
|
|
7943
|
+
switch (mode) {
|
|
7944
|
+
case QRMode.MODE_NUMBER:
|
|
7945
|
+
return 12;
|
|
7946
|
+
case QRMode.MODE_ALPHA_NUM:
|
|
7947
|
+
return 11;
|
|
7948
|
+
case QRMode.MODE_8BIT_BYTE:
|
|
7949
|
+
return 16;
|
|
7950
|
+
case QRMode.MODE_KANJI:
|
|
7951
|
+
return 10;
|
|
7952
|
+
default:
|
|
7953
|
+
throw "mode:" + mode;
|
|
7954
|
+
}
|
|
7955
|
+
} else if (type < 41) {
|
|
7956
|
+
switch (mode) {
|
|
7957
|
+
case QRMode.MODE_NUMBER:
|
|
7958
|
+
return 14;
|
|
7959
|
+
case QRMode.MODE_ALPHA_NUM:
|
|
7960
|
+
return 13;
|
|
7961
|
+
case QRMode.MODE_8BIT_BYTE:
|
|
7962
|
+
return 16;
|
|
7963
|
+
case QRMode.MODE_KANJI:
|
|
7964
|
+
return 12;
|
|
7965
|
+
default:
|
|
7966
|
+
throw "mode:" + mode;
|
|
7967
|
+
}
|
|
7968
|
+
} else {
|
|
7969
|
+
throw "type:" + type;
|
|
7970
|
+
}
|
|
7971
|
+
};
|
|
7972
|
+
_this.getLostPoint = function(qrcode2) {
|
|
7973
|
+
const moduleCount = qrcode2.getModuleCount();
|
|
7974
|
+
let lostPoint = 0;
|
|
7975
|
+
for (let row = 0; row < moduleCount; row += 1) {
|
|
7976
|
+
for (let col = 0; col < moduleCount; col += 1) {
|
|
7977
|
+
let sameCount = 0;
|
|
7978
|
+
const dark = qrcode2.isDark(row, col);
|
|
7979
|
+
for (let r = -1; r <= 1; r += 1) {
|
|
7980
|
+
if (row + r < 0 || moduleCount <= row + r) {
|
|
7981
|
+
continue;
|
|
7982
|
+
}
|
|
7983
|
+
for (let c = -1; c <= 1; c += 1) {
|
|
7984
|
+
if (col + c < 0 || moduleCount <= col + c) {
|
|
7985
|
+
continue;
|
|
7986
|
+
}
|
|
7987
|
+
if (r == 0 && c == 0) {
|
|
7988
|
+
continue;
|
|
7989
|
+
}
|
|
7990
|
+
if (dark == qrcode2.isDark(row + r, col + c)) {
|
|
7991
|
+
sameCount += 1;
|
|
7992
|
+
}
|
|
7993
|
+
}
|
|
7994
|
+
}
|
|
7995
|
+
if (sameCount > 5) {
|
|
7996
|
+
lostPoint += 3 + sameCount - 5;
|
|
7997
|
+
}
|
|
7998
|
+
}
|
|
7999
|
+
}
|
|
8000
|
+
;
|
|
8001
|
+
for (let row = 0; row < moduleCount - 1; row += 1) {
|
|
8002
|
+
for (let col = 0; col < moduleCount - 1; col += 1) {
|
|
8003
|
+
let count2 = 0;
|
|
8004
|
+
if (qrcode2.isDark(row, col)) count2 += 1;
|
|
8005
|
+
if (qrcode2.isDark(row + 1, col)) count2 += 1;
|
|
8006
|
+
if (qrcode2.isDark(row, col + 1)) count2 += 1;
|
|
8007
|
+
if (qrcode2.isDark(row + 1, col + 1)) count2 += 1;
|
|
8008
|
+
if (count2 == 0 || count2 == 4) {
|
|
8009
|
+
lostPoint += 3;
|
|
8010
|
+
}
|
|
8011
|
+
}
|
|
8012
|
+
}
|
|
8013
|
+
for (let row = 0; row < moduleCount; row += 1) {
|
|
8014
|
+
for (let col = 0; col < moduleCount - 6; col += 1) {
|
|
8015
|
+
if (qrcode2.isDark(row, col) && !qrcode2.isDark(row, col + 1) && qrcode2.isDark(row, col + 2) && qrcode2.isDark(row, col + 3) && qrcode2.isDark(row, col + 4) && !qrcode2.isDark(row, col + 5) && qrcode2.isDark(row, col + 6)) {
|
|
8016
|
+
lostPoint += 40;
|
|
8017
|
+
}
|
|
8018
|
+
}
|
|
8019
|
+
}
|
|
8020
|
+
for (let col = 0; col < moduleCount; col += 1) {
|
|
8021
|
+
for (let row = 0; row < moduleCount - 6; row += 1) {
|
|
8022
|
+
if (qrcode2.isDark(row, col) && !qrcode2.isDark(row + 1, col) && qrcode2.isDark(row + 2, col) && qrcode2.isDark(row + 3, col) && qrcode2.isDark(row + 4, col) && !qrcode2.isDark(row + 5, col) && qrcode2.isDark(row + 6, col)) {
|
|
8023
|
+
lostPoint += 40;
|
|
8024
|
+
}
|
|
8025
|
+
}
|
|
8026
|
+
}
|
|
8027
|
+
let darkCount = 0;
|
|
8028
|
+
for (let col = 0; col < moduleCount; col += 1) {
|
|
8029
|
+
for (let row = 0; row < moduleCount; row += 1) {
|
|
8030
|
+
if (qrcode2.isDark(row, col)) {
|
|
8031
|
+
darkCount += 1;
|
|
8032
|
+
}
|
|
8033
|
+
}
|
|
8034
|
+
}
|
|
8035
|
+
const ratio = Math.abs(100 * darkCount / moduleCount / moduleCount - 50) / 5;
|
|
8036
|
+
lostPoint += ratio * 10;
|
|
8037
|
+
return lostPoint;
|
|
8038
|
+
};
|
|
8039
|
+
return _this;
|
|
8040
|
+
})();
|
|
8041
|
+
var QRMath = (function() {
|
|
8042
|
+
const EXP_TABLE = new Array(256);
|
|
8043
|
+
const LOG_TABLE = new Array(256);
|
|
8044
|
+
for (let i = 0; i < 8; i += 1) {
|
|
8045
|
+
EXP_TABLE[i] = 1 << i;
|
|
8046
|
+
}
|
|
8047
|
+
for (let i = 8; i < 256; i += 1) {
|
|
8048
|
+
EXP_TABLE[i] = EXP_TABLE[i - 4] ^ EXP_TABLE[i - 5] ^ EXP_TABLE[i - 6] ^ EXP_TABLE[i - 8];
|
|
8049
|
+
}
|
|
8050
|
+
for (let i = 0; i < 255; i += 1) {
|
|
8051
|
+
LOG_TABLE[EXP_TABLE[i]] = i;
|
|
8052
|
+
}
|
|
8053
|
+
const _this = {};
|
|
8054
|
+
_this.glog = function(n) {
|
|
8055
|
+
if (n < 1) {
|
|
8056
|
+
throw "glog(" + n + ")";
|
|
8057
|
+
}
|
|
8058
|
+
return LOG_TABLE[n];
|
|
8059
|
+
};
|
|
8060
|
+
_this.gexp = function(n) {
|
|
8061
|
+
while (n < 0) {
|
|
8062
|
+
n += 255;
|
|
8063
|
+
}
|
|
8064
|
+
while (n >= 256) {
|
|
8065
|
+
n -= 255;
|
|
8066
|
+
}
|
|
8067
|
+
return EXP_TABLE[n];
|
|
8068
|
+
};
|
|
8069
|
+
return _this;
|
|
8070
|
+
})();
|
|
8071
|
+
var qrPolynomial = /* @__PURE__ */ __name(function(num, shift) {
|
|
8072
|
+
if (typeof num.length == "undefined") {
|
|
8073
|
+
throw num.length + "/" + shift;
|
|
8074
|
+
}
|
|
8075
|
+
const _num = (function() {
|
|
8076
|
+
let offset = 0;
|
|
8077
|
+
while (offset < num.length && num[offset] == 0) {
|
|
8078
|
+
offset += 1;
|
|
8079
|
+
}
|
|
8080
|
+
const _num2 = new Array(num.length - offset + shift);
|
|
8081
|
+
for (let i = 0; i < num.length - offset; i += 1) {
|
|
8082
|
+
_num2[i] = num[i + offset];
|
|
8083
|
+
}
|
|
8084
|
+
return _num2;
|
|
8085
|
+
})();
|
|
8086
|
+
const _this = {};
|
|
8087
|
+
_this.getAt = function(index) {
|
|
8088
|
+
return _num[index];
|
|
8089
|
+
};
|
|
8090
|
+
_this.getLength = function() {
|
|
8091
|
+
return _num.length;
|
|
8092
|
+
};
|
|
8093
|
+
_this.multiply = function(e) {
|
|
8094
|
+
const num2 = new Array(_this.getLength() + e.getLength() - 1);
|
|
8095
|
+
for (let i = 0; i < _this.getLength(); i += 1) {
|
|
8096
|
+
for (let j = 0; j < e.getLength(); j += 1) {
|
|
8097
|
+
num2[i + j] ^= QRMath.gexp(QRMath.glog(_this.getAt(i)) + QRMath.glog(e.getAt(j)));
|
|
8098
|
+
}
|
|
8099
|
+
}
|
|
8100
|
+
return qrPolynomial(num2, 0);
|
|
8101
|
+
};
|
|
8102
|
+
_this.mod = function(e) {
|
|
8103
|
+
if (_this.getLength() - e.getLength() < 0) {
|
|
8104
|
+
return _this;
|
|
8105
|
+
}
|
|
8106
|
+
const ratio = QRMath.glog(_this.getAt(0)) - QRMath.glog(e.getAt(0));
|
|
8107
|
+
const num2 = new Array(_this.getLength());
|
|
8108
|
+
for (let i = 0; i < _this.getLength(); i += 1) {
|
|
8109
|
+
num2[i] = _this.getAt(i);
|
|
8110
|
+
}
|
|
8111
|
+
for (let i = 0; i < e.getLength(); i += 1) {
|
|
8112
|
+
num2[i] ^= QRMath.gexp(QRMath.glog(e.getAt(i)) + ratio);
|
|
8113
|
+
}
|
|
8114
|
+
return qrPolynomial(num2, 0).mod(e);
|
|
8115
|
+
};
|
|
8116
|
+
return _this;
|
|
8117
|
+
}, "qrPolynomial");
|
|
8118
|
+
var QRRSBlock = (function() {
|
|
8119
|
+
const RS_BLOCK_TABLE = [
|
|
8120
|
+
// L
|
|
8121
|
+
// M
|
|
8122
|
+
// Q
|
|
8123
|
+
// H
|
|
8124
|
+
// 1
|
|
8125
|
+
[1, 26, 19],
|
|
8126
|
+
[1, 26, 16],
|
|
8127
|
+
[1, 26, 13],
|
|
8128
|
+
[1, 26, 9],
|
|
8129
|
+
// 2
|
|
8130
|
+
[1, 44, 34],
|
|
8131
|
+
[1, 44, 28],
|
|
8132
|
+
[1, 44, 22],
|
|
8133
|
+
[1, 44, 16],
|
|
8134
|
+
// 3
|
|
8135
|
+
[1, 70, 55],
|
|
8136
|
+
[1, 70, 44],
|
|
8137
|
+
[2, 35, 17],
|
|
8138
|
+
[2, 35, 13],
|
|
8139
|
+
// 4
|
|
8140
|
+
[1, 100, 80],
|
|
8141
|
+
[2, 50, 32],
|
|
8142
|
+
[2, 50, 24],
|
|
8143
|
+
[4, 25, 9],
|
|
8144
|
+
// 5
|
|
8145
|
+
[1, 134, 108],
|
|
8146
|
+
[2, 67, 43],
|
|
8147
|
+
[2, 33, 15, 2, 34, 16],
|
|
8148
|
+
[2, 33, 11, 2, 34, 12],
|
|
8149
|
+
// 6
|
|
8150
|
+
[2, 86, 68],
|
|
8151
|
+
[4, 43, 27],
|
|
8152
|
+
[4, 43, 19],
|
|
8153
|
+
[4, 43, 15],
|
|
8154
|
+
// 7
|
|
8155
|
+
[2, 98, 78],
|
|
8156
|
+
[4, 49, 31],
|
|
8157
|
+
[2, 32, 14, 4, 33, 15],
|
|
8158
|
+
[4, 39, 13, 1, 40, 14],
|
|
8159
|
+
// 8
|
|
8160
|
+
[2, 121, 97],
|
|
8161
|
+
[2, 60, 38, 2, 61, 39],
|
|
8162
|
+
[4, 40, 18, 2, 41, 19],
|
|
8163
|
+
[4, 40, 14, 2, 41, 15],
|
|
8164
|
+
// 9
|
|
8165
|
+
[2, 146, 116],
|
|
8166
|
+
[3, 58, 36, 2, 59, 37],
|
|
8167
|
+
[4, 36, 16, 4, 37, 17],
|
|
8168
|
+
[4, 36, 12, 4, 37, 13],
|
|
8169
|
+
// 10
|
|
8170
|
+
[2, 86, 68, 2, 87, 69],
|
|
8171
|
+
[4, 69, 43, 1, 70, 44],
|
|
8172
|
+
[6, 43, 19, 2, 44, 20],
|
|
8173
|
+
[6, 43, 15, 2, 44, 16],
|
|
8174
|
+
// 11
|
|
8175
|
+
[4, 101, 81],
|
|
8176
|
+
[1, 80, 50, 4, 81, 51],
|
|
8177
|
+
[4, 50, 22, 4, 51, 23],
|
|
8178
|
+
[3, 36, 12, 8, 37, 13],
|
|
8179
|
+
// 12
|
|
8180
|
+
[2, 116, 92, 2, 117, 93],
|
|
8181
|
+
[6, 58, 36, 2, 59, 37],
|
|
8182
|
+
[4, 46, 20, 6, 47, 21],
|
|
8183
|
+
[7, 42, 14, 4, 43, 15],
|
|
8184
|
+
// 13
|
|
8185
|
+
[4, 133, 107],
|
|
8186
|
+
[8, 59, 37, 1, 60, 38],
|
|
8187
|
+
[8, 44, 20, 4, 45, 21],
|
|
8188
|
+
[12, 33, 11, 4, 34, 12],
|
|
8189
|
+
// 14
|
|
8190
|
+
[3, 145, 115, 1, 146, 116],
|
|
8191
|
+
[4, 64, 40, 5, 65, 41],
|
|
8192
|
+
[11, 36, 16, 5, 37, 17],
|
|
8193
|
+
[11, 36, 12, 5, 37, 13],
|
|
8194
|
+
// 15
|
|
8195
|
+
[5, 109, 87, 1, 110, 88],
|
|
8196
|
+
[5, 65, 41, 5, 66, 42],
|
|
8197
|
+
[5, 54, 24, 7, 55, 25],
|
|
8198
|
+
[11, 36, 12, 7, 37, 13],
|
|
8199
|
+
// 16
|
|
8200
|
+
[5, 122, 98, 1, 123, 99],
|
|
8201
|
+
[7, 73, 45, 3, 74, 46],
|
|
8202
|
+
[15, 43, 19, 2, 44, 20],
|
|
8203
|
+
[3, 45, 15, 13, 46, 16],
|
|
8204
|
+
// 17
|
|
8205
|
+
[1, 135, 107, 5, 136, 108],
|
|
8206
|
+
[10, 74, 46, 1, 75, 47],
|
|
8207
|
+
[1, 50, 22, 15, 51, 23],
|
|
8208
|
+
[2, 42, 14, 17, 43, 15],
|
|
8209
|
+
// 18
|
|
8210
|
+
[5, 150, 120, 1, 151, 121],
|
|
8211
|
+
[9, 69, 43, 4, 70, 44],
|
|
8212
|
+
[17, 50, 22, 1, 51, 23],
|
|
8213
|
+
[2, 42, 14, 19, 43, 15],
|
|
8214
|
+
// 19
|
|
8215
|
+
[3, 141, 113, 4, 142, 114],
|
|
8216
|
+
[3, 70, 44, 11, 71, 45],
|
|
8217
|
+
[17, 47, 21, 4, 48, 22],
|
|
8218
|
+
[9, 39, 13, 16, 40, 14],
|
|
8219
|
+
// 20
|
|
8220
|
+
[3, 135, 107, 5, 136, 108],
|
|
8221
|
+
[3, 67, 41, 13, 68, 42],
|
|
8222
|
+
[15, 54, 24, 5, 55, 25],
|
|
8223
|
+
[15, 43, 15, 10, 44, 16],
|
|
8224
|
+
// 21
|
|
8225
|
+
[4, 144, 116, 4, 145, 117],
|
|
8226
|
+
[17, 68, 42],
|
|
8227
|
+
[17, 50, 22, 6, 51, 23],
|
|
8228
|
+
[19, 46, 16, 6, 47, 17],
|
|
8229
|
+
// 22
|
|
8230
|
+
[2, 139, 111, 7, 140, 112],
|
|
8231
|
+
[17, 74, 46],
|
|
8232
|
+
[7, 54, 24, 16, 55, 25],
|
|
8233
|
+
[34, 37, 13],
|
|
8234
|
+
// 23
|
|
8235
|
+
[4, 151, 121, 5, 152, 122],
|
|
8236
|
+
[4, 75, 47, 14, 76, 48],
|
|
8237
|
+
[11, 54, 24, 14, 55, 25],
|
|
8238
|
+
[16, 45, 15, 14, 46, 16],
|
|
8239
|
+
// 24
|
|
8240
|
+
[6, 147, 117, 4, 148, 118],
|
|
8241
|
+
[6, 73, 45, 14, 74, 46],
|
|
8242
|
+
[11, 54, 24, 16, 55, 25],
|
|
8243
|
+
[30, 46, 16, 2, 47, 17],
|
|
8244
|
+
// 25
|
|
8245
|
+
[8, 132, 106, 4, 133, 107],
|
|
8246
|
+
[8, 75, 47, 13, 76, 48],
|
|
8247
|
+
[7, 54, 24, 22, 55, 25],
|
|
8248
|
+
[22, 45, 15, 13, 46, 16],
|
|
8249
|
+
// 26
|
|
8250
|
+
[10, 142, 114, 2, 143, 115],
|
|
8251
|
+
[19, 74, 46, 4, 75, 47],
|
|
8252
|
+
[28, 50, 22, 6, 51, 23],
|
|
8253
|
+
[33, 46, 16, 4, 47, 17],
|
|
8254
|
+
// 27
|
|
8255
|
+
[8, 152, 122, 4, 153, 123],
|
|
8256
|
+
[22, 73, 45, 3, 74, 46],
|
|
8257
|
+
[8, 53, 23, 26, 54, 24],
|
|
8258
|
+
[12, 45, 15, 28, 46, 16],
|
|
8259
|
+
// 28
|
|
8260
|
+
[3, 147, 117, 10, 148, 118],
|
|
8261
|
+
[3, 73, 45, 23, 74, 46],
|
|
8262
|
+
[4, 54, 24, 31, 55, 25],
|
|
8263
|
+
[11, 45, 15, 31, 46, 16],
|
|
8264
|
+
// 29
|
|
8265
|
+
[7, 146, 116, 7, 147, 117],
|
|
8266
|
+
[21, 73, 45, 7, 74, 46],
|
|
8267
|
+
[1, 53, 23, 37, 54, 24],
|
|
8268
|
+
[19, 45, 15, 26, 46, 16],
|
|
8269
|
+
// 30
|
|
8270
|
+
[5, 145, 115, 10, 146, 116],
|
|
8271
|
+
[19, 75, 47, 10, 76, 48],
|
|
8272
|
+
[15, 54, 24, 25, 55, 25],
|
|
8273
|
+
[23, 45, 15, 25, 46, 16],
|
|
8274
|
+
// 31
|
|
8275
|
+
[13, 145, 115, 3, 146, 116],
|
|
8276
|
+
[2, 74, 46, 29, 75, 47],
|
|
8277
|
+
[42, 54, 24, 1, 55, 25],
|
|
8278
|
+
[23, 45, 15, 28, 46, 16],
|
|
8279
|
+
// 32
|
|
8280
|
+
[17, 145, 115],
|
|
8281
|
+
[10, 74, 46, 23, 75, 47],
|
|
8282
|
+
[10, 54, 24, 35, 55, 25],
|
|
8283
|
+
[19, 45, 15, 35, 46, 16],
|
|
8284
|
+
// 33
|
|
8285
|
+
[17, 145, 115, 1, 146, 116],
|
|
8286
|
+
[14, 74, 46, 21, 75, 47],
|
|
8287
|
+
[29, 54, 24, 19, 55, 25],
|
|
8288
|
+
[11, 45, 15, 46, 46, 16],
|
|
8289
|
+
// 34
|
|
8290
|
+
[13, 145, 115, 6, 146, 116],
|
|
8291
|
+
[14, 74, 46, 23, 75, 47],
|
|
8292
|
+
[44, 54, 24, 7, 55, 25],
|
|
8293
|
+
[59, 46, 16, 1, 47, 17],
|
|
8294
|
+
// 35
|
|
8295
|
+
[12, 151, 121, 7, 152, 122],
|
|
8296
|
+
[12, 75, 47, 26, 76, 48],
|
|
8297
|
+
[39, 54, 24, 14, 55, 25],
|
|
8298
|
+
[22, 45, 15, 41, 46, 16],
|
|
8299
|
+
// 36
|
|
8300
|
+
[6, 151, 121, 14, 152, 122],
|
|
8301
|
+
[6, 75, 47, 34, 76, 48],
|
|
8302
|
+
[46, 54, 24, 10, 55, 25],
|
|
8303
|
+
[2, 45, 15, 64, 46, 16],
|
|
8304
|
+
// 37
|
|
8305
|
+
[17, 152, 122, 4, 153, 123],
|
|
8306
|
+
[29, 74, 46, 14, 75, 47],
|
|
8307
|
+
[49, 54, 24, 10, 55, 25],
|
|
8308
|
+
[24, 45, 15, 46, 46, 16],
|
|
8309
|
+
// 38
|
|
8310
|
+
[4, 152, 122, 18, 153, 123],
|
|
8311
|
+
[13, 74, 46, 32, 75, 47],
|
|
8312
|
+
[48, 54, 24, 14, 55, 25],
|
|
8313
|
+
[42, 45, 15, 32, 46, 16],
|
|
8314
|
+
// 39
|
|
8315
|
+
[20, 147, 117, 4, 148, 118],
|
|
8316
|
+
[40, 75, 47, 7, 76, 48],
|
|
8317
|
+
[43, 54, 24, 22, 55, 25],
|
|
8318
|
+
[10, 45, 15, 67, 46, 16],
|
|
8319
|
+
// 40
|
|
8320
|
+
[19, 148, 118, 6, 149, 119],
|
|
8321
|
+
[18, 75, 47, 31, 76, 48],
|
|
8322
|
+
[34, 54, 24, 34, 55, 25],
|
|
8323
|
+
[20, 45, 15, 61, 46, 16]
|
|
8324
|
+
];
|
|
8325
|
+
const qrRSBlock = /* @__PURE__ */ __name(function(totalCount, dataCount) {
|
|
8326
|
+
const _this2 = {};
|
|
8327
|
+
_this2.totalCount = totalCount;
|
|
8328
|
+
_this2.dataCount = dataCount;
|
|
8329
|
+
return _this2;
|
|
8330
|
+
}, "qrRSBlock");
|
|
8331
|
+
const _this = {};
|
|
8332
|
+
const getRsBlockTable = /* @__PURE__ */ __name(function(typeNumber, errorCorrectionLevel) {
|
|
8333
|
+
switch (errorCorrectionLevel) {
|
|
8334
|
+
case QRErrorCorrectionLevel.L:
|
|
8335
|
+
return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 0];
|
|
8336
|
+
case QRErrorCorrectionLevel.M:
|
|
8337
|
+
return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 1];
|
|
8338
|
+
case QRErrorCorrectionLevel.Q:
|
|
8339
|
+
return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 2];
|
|
8340
|
+
case QRErrorCorrectionLevel.H:
|
|
8341
|
+
return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 3];
|
|
8342
|
+
default:
|
|
8343
|
+
return void 0;
|
|
8344
|
+
}
|
|
8345
|
+
}, "getRsBlockTable");
|
|
8346
|
+
_this.getRSBlocks = function(typeNumber, errorCorrectionLevel) {
|
|
8347
|
+
const rsBlock = getRsBlockTable(typeNumber, errorCorrectionLevel);
|
|
8348
|
+
if (typeof rsBlock == "undefined") {
|
|
8349
|
+
throw "bad rs block @ typeNumber:" + typeNumber + "/errorCorrectionLevel:" + errorCorrectionLevel;
|
|
8350
|
+
}
|
|
8351
|
+
const length = rsBlock.length / 3;
|
|
8352
|
+
const list = [];
|
|
8353
|
+
for (let i = 0; i < length; i += 1) {
|
|
8354
|
+
const count2 = rsBlock[i * 3 + 0];
|
|
8355
|
+
const totalCount = rsBlock[i * 3 + 1];
|
|
8356
|
+
const dataCount = rsBlock[i * 3 + 2];
|
|
8357
|
+
for (let j = 0; j < count2; j += 1) {
|
|
8358
|
+
list.push(qrRSBlock(totalCount, dataCount));
|
|
8359
|
+
}
|
|
8360
|
+
}
|
|
8361
|
+
return list;
|
|
8362
|
+
};
|
|
8363
|
+
return _this;
|
|
8364
|
+
})();
|
|
8365
|
+
var qrBitBuffer = /* @__PURE__ */ __name(function() {
|
|
8366
|
+
const _buffer = [];
|
|
8367
|
+
let _length = 0;
|
|
8368
|
+
const _this = {};
|
|
8369
|
+
_this.getBuffer = function() {
|
|
8370
|
+
return _buffer;
|
|
8371
|
+
};
|
|
8372
|
+
_this.getAt = function(index) {
|
|
8373
|
+
const bufIndex = Math.floor(index / 8);
|
|
8374
|
+
return (_buffer[bufIndex] >>> 7 - index % 8 & 1) == 1;
|
|
8375
|
+
};
|
|
8376
|
+
_this.put = function(num, length) {
|
|
8377
|
+
for (let i = 0; i < length; i += 1) {
|
|
8378
|
+
_this.putBit((num >>> length - i - 1 & 1) == 1);
|
|
8379
|
+
}
|
|
8380
|
+
};
|
|
8381
|
+
_this.getLengthInBits = function() {
|
|
8382
|
+
return _length;
|
|
8383
|
+
};
|
|
8384
|
+
_this.putBit = function(bit) {
|
|
8385
|
+
const bufIndex = Math.floor(_length / 8);
|
|
8386
|
+
if (_buffer.length <= bufIndex) {
|
|
8387
|
+
_buffer.push(0);
|
|
8388
|
+
}
|
|
8389
|
+
if (bit) {
|
|
8390
|
+
_buffer[bufIndex] |= 128 >>> _length % 8;
|
|
8391
|
+
}
|
|
8392
|
+
_length += 1;
|
|
8393
|
+
};
|
|
8394
|
+
return _this;
|
|
8395
|
+
}, "qrBitBuffer");
|
|
8396
|
+
var qrNumber = /* @__PURE__ */ __name(function(data) {
|
|
8397
|
+
const _mode = QRMode.MODE_NUMBER;
|
|
8398
|
+
const _data = data;
|
|
8399
|
+
const _this = {};
|
|
8400
|
+
_this.getMode = function() {
|
|
8401
|
+
return _mode;
|
|
8402
|
+
};
|
|
8403
|
+
_this.getLength = function(buffer) {
|
|
8404
|
+
return _data.length;
|
|
8405
|
+
};
|
|
8406
|
+
_this.write = function(buffer) {
|
|
8407
|
+
const data2 = _data;
|
|
8408
|
+
let i = 0;
|
|
8409
|
+
while (i + 2 < data2.length) {
|
|
8410
|
+
buffer.put(strToNum(data2.substring(i, i + 3)), 10);
|
|
8411
|
+
i += 3;
|
|
8412
|
+
}
|
|
8413
|
+
if (i < data2.length) {
|
|
8414
|
+
if (data2.length - i == 1) {
|
|
8415
|
+
buffer.put(strToNum(data2.substring(i, i + 1)), 4);
|
|
8416
|
+
} else if (data2.length - i == 2) {
|
|
8417
|
+
buffer.put(strToNum(data2.substring(i, i + 2)), 7);
|
|
8418
|
+
}
|
|
8419
|
+
}
|
|
8420
|
+
};
|
|
8421
|
+
const strToNum = /* @__PURE__ */ __name(function(s) {
|
|
8422
|
+
let num = 0;
|
|
8423
|
+
for (let i = 0; i < s.length; i += 1) {
|
|
8424
|
+
num = num * 10 + chatToNum(s.charAt(i));
|
|
8425
|
+
}
|
|
8426
|
+
return num;
|
|
8427
|
+
}, "strToNum");
|
|
8428
|
+
const chatToNum = /* @__PURE__ */ __name(function(c) {
|
|
8429
|
+
if ("0" <= c && c <= "9") {
|
|
8430
|
+
return c.charCodeAt(0) - "0".charCodeAt(0);
|
|
8431
|
+
}
|
|
8432
|
+
throw "illegal char :" + c;
|
|
8433
|
+
}, "chatToNum");
|
|
8434
|
+
return _this;
|
|
8435
|
+
}, "qrNumber");
|
|
8436
|
+
var qrAlphaNum = /* @__PURE__ */ __name(function(data) {
|
|
8437
|
+
const _mode = QRMode.MODE_ALPHA_NUM;
|
|
8438
|
+
const _data = data;
|
|
8439
|
+
const _this = {};
|
|
8440
|
+
_this.getMode = function() {
|
|
8441
|
+
return _mode;
|
|
8442
|
+
};
|
|
8443
|
+
_this.getLength = function(buffer) {
|
|
8444
|
+
return _data.length;
|
|
8445
|
+
};
|
|
8446
|
+
_this.write = function(buffer) {
|
|
8447
|
+
const s = _data;
|
|
8448
|
+
let i = 0;
|
|
8449
|
+
while (i + 1 < s.length) {
|
|
8450
|
+
buffer.put(
|
|
8451
|
+
getCode(s.charAt(i)) * 45 + getCode(s.charAt(i + 1)),
|
|
8452
|
+
11
|
|
8453
|
+
);
|
|
8454
|
+
i += 2;
|
|
8455
|
+
}
|
|
8456
|
+
if (i < s.length) {
|
|
8457
|
+
buffer.put(getCode(s.charAt(i)), 6);
|
|
8458
|
+
}
|
|
8459
|
+
};
|
|
8460
|
+
const getCode = /* @__PURE__ */ __name(function(c) {
|
|
8461
|
+
if ("0" <= c && c <= "9") {
|
|
8462
|
+
return c.charCodeAt(0) - "0".charCodeAt(0);
|
|
8463
|
+
} else if ("A" <= c && c <= "Z") {
|
|
8464
|
+
return c.charCodeAt(0) - "A".charCodeAt(0) + 10;
|
|
8465
|
+
} else {
|
|
8466
|
+
switch (c) {
|
|
8467
|
+
case " ":
|
|
8468
|
+
return 36;
|
|
8469
|
+
case "$":
|
|
8470
|
+
return 37;
|
|
8471
|
+
case "%":
|
|
8472
|
+
return 38;
|
|
8473
|
+
case "*":
|
|
8474
|
+
return 39;
|
|
8475
|
+
case "+":
|
|
8476
|
+
return 40;
|
|
8477
|
+
case "-":
|
|
8478
|
+
return 41;
|
|
8479
|
+
case ".":
|
|
8480
|
+
return 42;
|
|
8481
|
+
case "/":
|
|
8482
|
+
return 43;
|
|
8483
|
+
case ":":
|
|
8484
|
+
return 44;
|
|
8485
|
+
default:
|
|
8486
|
+
throw "illegal char :" + c;
|
|
8487
|
+
}
|
|
8488
|
+
}
|
|
8489
|
+
}, "getCode");
|
|
8490
|
+
return _this;
|
|
8491
|
+
}, "qrAlphaNum");
|
|
8492
|
+
var qr8BitByte = /* @__PURE__ */ __name(function(data) {
|
|
8493
|
+
const _mode = QRMode.MODE_8BIT_BYTE;
|
|
8494
|
+
const _data = data;
|
|
8495
|
+
const _bytes = qrcode.stringToBytes(data);
|
|
8496
|
+
const _this = {};
|
|
8497
|
+
_this.getMode = function() {
|
|
8498
|
+
return _mode;
|
|
8499
|
+
};
|
|
8500
|
+
_this.getLength = function(buffer) {
|
|
8501
|
+
return _bytes.length;
|
|
8502
|
+
};
|
|
8503
|
+
_this.write = function(buffer) {
|
|
8504
|
+
for (let i = 0; i < _bytes.length; i += 1) {
|
|
8505
|
+
buffer.put(_bytes[i], 8);
|
|
8506
|
+
}
|
|
8507
|
+
};
|
|
8508
|
+
return _this;
|
|
8509
|
+
}, "qr8BitByte");
|
|
8510
|
+
var qrKanji = /* @__PURE__ */ __name(function(data) {
|
|
8511
|
+
const _mode = QRMode.MODE_KANJI;
|
|
8512
|
+
const _data = data;
|
|
8513
|
+
const stringToBytes2 = qrcode.stringToBytes;
|
|
8514
|
+
!(function(c, code) {
|
|
8515
|
+
const test = stringToBytes2(c);
|
|
8516
|
+
if (test.length != 2 || (test[0] << 8 | test[1]) != code) {
|
|
8517
|
+
throw "sjis not supported.";
|
|
8518
|
+
}
|
|
8519
|
+
})("\u53CB", 38726);
|
|
8520
|
+
const _bytes = stringToBytes2(data);
|
|
8521
|
+
const _this = {};
|
|
8522
|
+
_this.getMode = function() {
|
|
8523
|
+
return _mode;
|
|
8524
|
+
};
|
|
8525
|
+
_this.getLength = function(buffer) {
|
|
8526
|
+
return ~~(_bytes.length / 2);
|
|
8527
|
+
};
|
|
8528
|
+
_this.write = function(buffer) {
|
|
8529
|
+
const data2 = _bytes;
|
|
8530
|
+
let i = 0;
|
|
8531
|
+
while (i + 1 < data2.length) {
|
|
8532
|
+
let c = (255 & data2[i]) << 8 | 255 & data2[i + 1];
|
|
8533
|
+
if (33088 <= c && c <= 40956) {
|
|
8534
|
+
c -= 33088;
|
|
8535
|
+
} else if (57408 <= c && c <= 60351) {
|
|
8536
|
+
c -= 49472;
|
|
8537
|
+
} else {
|
|
8538
|
+
throw "illegal char at " + (i + 1) + "/" + c;
|
|
8539
|
+
}
|
|
8540
|
+
c = (c >>> 8 & 255) * 192 + (c & 255);
|
|
8541
|
+
buffer.put(c, 13);
|
|
8542
|
+
i += 2;
|
|
8543
|
+
}
|
|
8544
|
+
if (i < data2.length) {
|
|
8545
|
+
throw "illegal char at " + (i + 1);
|
|
8546
|
+
}
|
|
8547
|
+
};
|
|
8548
|
+
return _this;
|
|
8549
|
+
}, "qrKanji");
|
|
8550
|
+
var byteArrayOutputStream = /* @__PURE__ */ __name(function() {
|
|
8551
|
+
const _bytes = [];
|
|
8552
|
+
const _this = {};
|
|
8553
|
+
_this.writeByte = function(b) {
|
|
8554
|
+
_bytes.push(b & 255);
|
|
8555
|
+
};
|
|
8556
|
+
_this.writeShort = function(i) {
|
|
8557
|
+
_this.writeByte(i);
|
|
8558
|
+
_this.writeByte(i >>> 8);
|
|
8559
|
+
};
|
|
8560
|
+
_this.writeBytes = function(b, off, len) {
|
|
8561
|
+
off = off || 0;
|
|
8562
|
+
len = len || b.length;
|
|
8563
|
+
for (let i = 0; i < len; i += 1) {
|
|
8564
|
+
_this.writeByte(b[i + off]);
|
|
8565
|
+
}
|
|
8566
|
+
};
|
|
8567
|
+
_this.writeString = function(s) {
|
|
8568
|
+
for (let i = 0; i < s.length; i += 1) {
|
|
8569
|
+
_this.writeByte(s.charCodeAt(i));
|
|
8570
|
+
}
|
|
8571
|
+
};
|
|
8572
|
+
_this.toByteArray = function() {
|
|
8573
|
+
return _bytes;
|
|
8574
|
+
};
|
|
8575
|
+
_this.toString = function() {
|
|
8576
|
+
let s = "";
|
|
8577
|
+
s += "[";
|
|
8578
|
+
for (let i = 0; i < _bytes.length; i += 1) {
|
|
8579
|
+
if (i > 0) {
|
|
8580
|
+
s += ",";
|
|
8581
|
+
}
|
|
8582
|
+
s += _bytes[i];
|
|
8583
|
+
}
|
|
8584
|
+
s += "]";
|
|
8585
|
+
return s;
|
|
8586
|
+
};
|
|
8587
|
+
return _this;
|
|
8588
|
+
}, "byteArrayOutputStream");
|
|
8589
|
+
var base64EncodeOutputStream = /* @__PURE__ */ __name(function() {
|
|
8590
|
+
let _buffer = 0;
|
|
8591
|
+
let _buflen = 0;
|
|
8592
|
+
let _length = 0;
|
|
8593
|
+
let _base64 = "";
|
|
8594
|
+
const _this = {};
|
|
8595
|
+
const writeEncoded = /* @__PURE__ */ __name(function(b) {
|
|
8596
|
+
_base64 += String.fromCharCode(encode(b & 63));
|
|
8597
|
+
}, "writeEncoded");
|
|
8598
|
+
const encode = /* @__PURE__ */ __name(function(n) {
|
|
8599
|
+
if (n < 0) {
|
|
8600
|
+
throw "n:" + n;
|
|
8601
|
+
} else if (n < 26) {
|
|
8602
|
+
return 65 + n;
|
|
8603
|
+
} else if (n < 52) {
|
|
8604
|
+
return 97 + (n - 26);
|
|
8605
|
+
} else if (n < 62) {
|
|
8606
|
+
return 48 + (n - 52);
|
|
8607
|
+
} else if (n == 62) {
|
|
8608
|
+
return 43;
|
|
8609
|
+
} else if (n == 63) {
|
|
8610
|
+
return 47;
|
|
8611
|
+
} else {
|
|
8612
|
+
throw "n:" + n;
|
|
8613
|
+
}
|
|
8614
|
+
}, "encode");
|
|
8615
|
+
_this.writeByte = function(n) {
|
|
8616
|
+
_buffer = _buffer << 8 | n & 255;
|
|
8617
|
+
_buflen += 8;
|
|
8618
|
+
_length += 1;
|
|
8619
|
+
while (_buflen >= 6) {
|
|
8620
|
+
writeEncoded(_buffer >>> _buflen - 6);
|
|
8621
|
+
_buflen -= 6;
|
|
8622
|
+
}
|
|
8623
|
+
};
|
|
8624
|
+
_this.flush = function() {
|
|
8625
|
+
if (_buflen > 0) {
|
|
8626
|
+
writeEncoded(_buffer << 6 - _buflen);
|
|
8627
|
+
_buffer = 0;
|
|
8628
|
+
_buflen = 0;
|
|
8629
|
+
}
|
|
8630
|
+
if (_length % 3 != 0) {
|
|
8631
|
+
const padlen = 3 - _length % 3;
|
|
8632
|
+
for (let i = 0; i < padlen; i += 1) {
|
|
8633
|
+
_base64 += "=";
|
|
8634
|
+
}
|
|
8635
|
+
}
|
|
8636
|
+
};
|
|
8637
|
+
_this.toString = function() {
|
|
8638
|
+
return _base64;
|
|
8639
|
+
};
|
|
8640
|
+
return _this;
|
|
8641
|
+
}, "base64EncodeOutputStream");
|
|
8642
|
+
var base64DecodeInputStream = /* @__PURE__ */ __name(function(str) {
|
|
8643
|
+
const _str = str;
|
|
8644
|
+
let _pos = 0;
|
|
8645
|
+
let _buffer = 0;
|
|
8646
|
+
let _buflen = 0;
|
|
8647
|
+
const _this = {};
|
|
8648
|
+
_this.read = function() {
|
|
8649
|
+
while (_buflen < 8) {
|
|
8650
|
+
if (_pos >= _str.length) {
|
|
8651
|
+
if (_buflen == 0) {
|
|
8652
|
+
return -1;
|
|
8653
|
+
}
|
|
8654
|
+
throw "unexpected end of file./" + _buflen;
|
|
8655
|
+
}
|
|
8656
|
+
const c = _str.charAt(_pos);
|
|
8657
|
+
_pos += 1;
|
|
8658
|
+
if (c == "=") {
|
|
8659
|
+
_buflen = 0;
|
|
8660
|
+
return -1;
|
|
8661
|
+
} else if (c.match(/^\s$/)) {
|
|
8662
|
+
continue;
|
|
8663
|
+
}
|
|
8664
|
+
_buffer = _buffer << 6 | decode2(c.charCodeAt(0));
|
|
8665
|
+
_buflen += 6;
|
|
8666
|
+
}
|
|
8667
|
+
const n = _buffer >>> _buflen - 8 & 255;
|
|
8668
|
+
_buflen -= 8;
|
|
8669
|
+
return n;
|
|
8670
|
+
};
|
|
8671
|
+
const decode2 = /* @__PURE__ */ __name(function(c) {
|
|
8672
|
+
if (65 <= c && c <= 90) {
|
|
8673
|
+
return c - 65;
|
|
8674
|
+
} else if (97 <= c && c <= 122) {
|
|
8675
|
+
return c - 97 + 26;
|
|
8676
|
+
} else if (48 <= c && c <= 57) {
|
|
8677
|
+
return c - 48 + 52;
|
|
8678
|
+
} else if (c == 43) {
|
|
8679
|
+
return 62;
|
|
8680
|
+
} else if (c == 47) {
|
|
8681
|
+
return 63;
|
|
8682
|
+
} else {
|
|
8683
|
+
throw "c:" + c;
|
|
8684
|
+
}
|
|
8685
|
+
}, "decode");
|
|
8686
|
+
return _this;
|
|
8687
|
+
}, "base64DecodeInputStream");
|
|
8688
|
+
var gifImage = /* @__PURE__ */ __name(function(width, height) {
|
|
8689
|
+
const _width = width;
|
|
8690
|
+
const _height = height;
|
|
8691
|
+
const _data = new Array(width * height);
|
|
8692
|
+
const _this = {};
|
|
8693
|
+
_this.setPixel = function(x, y, pixel) {
|
|
8694
|
+
_data[y * _width + x] = pixel;
|
|
8695
|
+
};
|
|
8696
|
+
_this.write = function(out) {
|
|
8697
|
+
out.writeString("GIF87a");
|
|
8698
|
+
out.writeShort(_width);
|
|
8699
|
+
out.writeShort(_height);
|
|
8700
|
+
out.writeByte(128);
|
|
8701
|
+
out.writeByte(0);
|
|
8702
|
+
out.writeByte(0);
|
|
8703
|
+
out.writeByte(0);
|
|
8704
|
+
out.writeByte(0);
|
|
8705
|
+
out.writeByte(0);
|
|
8706
|
+
out.writeByte(255);
|
|
8707
|
+
out.writeByte(255);
|
|
8708
|
+
out.writeByte(255);
|
|
8709
|
+
out.writeString(",");
|
|
8710
|
+
out.writeShort(0);
|
|
8711
|
+
out.writeShort(0);
|
|
8712
|
+
out.writeShort(_width);
|
|
8713
|
+
out.writeShort(_height);
|
|
8714
|
+
out.writeByte(0);
|
|
8715
|
+
const lzwMinCodeSize = 2;
|
|
8716
|
+
const raster = getLZWRaster(lzwMinCodeSize);
|
|
8717
|
+
out.writeByte(lzwMinCodeSize);
|
|
8718
|
+
let offset = 0;
|
|
8719
|
+
while (raster.length - offset > 255) {
|
|
8720
|
+
out.writeByte(255);
|
|
8721
|
+
out.writeBytes(raster, offset, 255);
|
|
8722
|
+
offset += 255;
|
|
8723
|
+
}
|
|
8724
|
+
out.writeByte(raster.length - offset);
|
|
8725
|
+
out.writeBytes(raster, offset, raster.length - offset);
|
|
8726
|
+
out.writeByte(0);
|
|
8727
|
+
out.writeString(";");
|
|
8728
|
+
};
|
|
8729
|
+
const bitOutputStream = /* @__PURE__ */ __name(function(out) {
|
|
8730
|
+
const _out = out;
|
|
8731
|
+
let _bitLength = 0;
|
|
8732
|
+
let _bitBuffer = 0;
|
|
8733
|
+
const _this2 = {};
|
|
8734
|
+
_this2.write = function(data, length) {
|
|
8735
|
+
if (data >>> length != 0) {
|
|
8736
|
+
throw "length over";
|
|
8737
|
+
}
|
|
8738
|
+
while (_bitLength + length >= 8) {
|
|
8739
|
+
_out.writeByte(255 & (data << _bitLength | _bitBuffer));
|
|
8740
|
+
length -= 8 - _bitLength;
|
|
8741
|
+
data >>>= 8 - _bitLength;
|
|
8742
|
+
_bitBuffer = 0;
|
|
8743
|
+
_bitLength = 0;
|
|
8744
|
+
}
|
|
8745
|
+
_bitBuffer = data << _bitLength | _bitBuffer;
|
|
8746
|
+
_bitLength = _bitLength + length;
|
|
8747
|
+
};
|
|
8748
|
+
_this2.flush = function() {
|
|
8749
|
+
if (_bitLength > 0) {
|
|
8750
|
+
_out.writeByte(_bitBuffer);
|
|
8751
|
+
}
|
|
8752
|
+
};
|
|
8753
|
+
return _this2;
|
|
8754
|
+
}, "bitOutputStream");
|
|
8755
|
+
const getLZWRaster = /* @__PURE__ */ __name(function(lzwMinCodeSize) {
|
|
8756
|
+
const clearCode = 1 << lzwMinCodeSize;
|
|
8757
|
+
const endCode = (1 << lzwMinCodeSize) + 1;
|
|
8758
|
+
let bitLength = lzwMinCodeSize + 1;
|
|
8759
|
+
const table = lzwTable();
|
|
8760
|
+
for (let i = 0; i < clearCode; i += 1) {
|
|
8761
|
+
table.add(String.fromCharCode(i));
|
|
8762
|
+
}
|
|
8763
|
+
table.add(String.fromCharCode(clearCode));
|
|
8764
|
+
table.add(String.fromCharCode(endCode));
|
|
8765
|
+
const byteOut = byteArrayOutputStream();
|
|
8766
|
+
const bitOut = bitOutputStream(byteOut);
|
|
8767
|
+
bitOut.write(clearCode, bitLength);
|
|
8768
|
+
let dataIndex = 0;
|
|
8769
|
+
let s = String.fromCharCode(_data[dataIndex]);
|
|
8770
|
+
dataIndex += 1;
|
|
8771
|
+
while (dataIndex < _data.length) {
|
|
8772
|
+
const c = String.fromCharCode(_data[dataIndex]);
|
|
8773
|
+
dataIndex += 1;
|
|
8774
|
+
if (table.contains(s + c)) {
|
|
8775
|
+
s = s + c;
|
|
8776
|
+
} else {
|
|
8777
|
+
bitOut.write(table.indexOf(s), bitLength);
|
|
8778
|
+
if (table.size() < 4095) {
|
|
8779
|
+
if (table.size() == 1 << bitLength) {
|
|
8780
|
+
bitLength += 1;
|
|
8781
|
+
}
|
|
8782
|
+
table.add(s + c);
|
|
8783
|
+
}
|
|
8784
|
+
s = c;
|
|
8785
|
+
}
|
|
8786
|
+
}
|
|
8787
|
+
bitOut.write(table.indexOf(s), bitLength);
|
|
8788
|
+
bitOut.write(endCode, bitLength);
|
|
8789
|
+
bitOut.flush();
|
|
8790
|
+
return byteOut.toByteArray();
|
|
8791
|
+
}, "getLZWRaster");
|
|
8792
|
+
const lzwTable = /* @__PURE__ */ __name(function() {
|
|
8793
|
+
const _map = {};
|
|
8794
|
+
let _size = 0;
|
|
8795
|
+
const _this2 = {};
|
|
8796
|
+
_this2.add = function(key) {
|
|
8797
|
+
if (_this2.contains(key)) {
|
|
8798
|
+
throw "dup key:" + key;
|
|
8799
|
+
}
|
|
8800
|
+
_map[key] = _size;
|
|
8801
|
+
_size += 1;
|
|
8802
|
+
};
|
|
8803
|
+
_this2.size = function() {
|
|
8804
|
+
return _size;
|
|
8805
|
+
};
|
|
8806
|
+
_this2.indexOf = function(key) {
|
|
8807
|
+
return _map[key];
|
|
8808
|
+
};
|
|
8809
|
+
_this2.contains = function(key) {
|
|
8810
|
+
return typeof _map[key] != "undefined";
|
|
8811
|
+
};
|
|
8812
|
+
return _this2;
|
|
8813
|
+
}, "lzwTable");
|
|
8814
|
+
return _this;
|
|
8815
|
+
}, "gifImage");
|
|
8816
|
+
var createDataURL = /* @__PURE__ */ __name(function(width, height, getPixel) {
|
|
8817
|
+
const gif = gifImage(width, height);
|
|
8818
|
+
for (let y = 0; y < height; y += 1) {
|
|
8819
|
+
for (let x = 0; x < width; x += 1) {
|
|
8820
|
+
gif.setPixel(x, y, getPixel(x, y));
|
|
8821
|
+
}
|
|
8822
|
+
}
|
|
8823
|
+
const b = byteArrayOutputStream();
|
|
8824
|
+
gif.write(b);
|
|
8825
|
+
const base64 = base64EncodeOutputStream();
|
|
8826
|
+
const bytes = b.toByteArray();
|
|
8827
|
+
for (let i = 0; i < bytes.length; i += 1) {
|
|
8828
|
+
base64.writeByte(bytes[i]);
|
|
8829
|
+
}
|
|
8830
|
+
base64.flush();
|
|
8831
|
+
return "data:image/gif;base64," + base64;
|
|
8832
|
+
}, "createDataURL");
|
|
8833
|
+
var stringToBytes = qrcode.stringToBytes;
|
|
8834
|
+
|
|
7201
8835
|
// dist/mcp/granted.js
|
|
7202
8836
|
var granted = /* @__PURE__ */ new WeakMap();
|
|
7203
8837
|
var grantLevels = /* @__PURE__ */ __name((program, levels) => {
|
|
@@ -7213,7 +8847,6 @@ var LANE_GATES = [
|
|
|
7213
8847
|
{
|
|
7214
8848
|
lane: "business",
|
|
7215
8849
|
key: "business.list",
|
|
7216
|
-
// contracts, subscriptions, products and wallets have no memo command yet; their keys guard them once they do.
|
|
7217
8850
|
kinds: {
|
|
7218
8851
|
invoice: "invoices.list",
|
|
7219
8852
|
payment: "payments.list",
|
|
@@ -7223,7 +8856,9 @@ var LANE_GATES = [
|
|
|
7223
8856
|
product: "products.list",
|
|
7224
8857
|
wallet: "wallets.list"
|
|
7225
8858
|
}
|
|
7226
|
-
}
|
|
8859
|
+
},
|
|
8860
|
+
{ lane: "crm", key: "crm.list", kinds: { deal: "deals.list", lead: "leads.list" } },
|
|
8861
|
+
{ lane: "events", key: "events.list", kinds: { event: "events.list" } }
|
|
7227
8862
|
];
|
|
7228
8863
|
var LANE_KEYS = LANE_GATES.map(({ key }) => key);
|
|
7229
8864
|
var leftOut = /* @__PURE__ */ __name((lane, what, key) => ({
|
|
@@ -7250,14 +8885,18 @@ var lanesFor = /* @__PURE__ */ __name((command, asked) => {
|
|
|
7250
8885
|
hidden.add(kind);
|
|
7251
8886
|
skipped.push(leftOut(gate.lane, kind, key));
|
|
7252
8887
|
}
|
|
8888
|
+
if (Object.keys(gate.kinds).every((kind) => hidden.has(kind)))
|
|
8889
|
+
off.add(gate.lane);
|
|
7253
8890
|
}
|
|
7254
8891
|
const shows = hidden.size ? { shows: /* @__PURE__ */ __name((item) => !hidden.has(item.kind), "shows") } : {};
|
|
8892
|
+
const crmKinds = DEAL_KINDS.filter((kind) => !hidden.has(kind));
|
|
8893
|
+
const narrowed = crmKinds.length < DEAL_KINDS.length && !off.has("crm") ? { crmKinds } : {};
|
|
7255
8894
|
if (!off.size)
|
|
7256
|
-
return { only: asked, skipped, ...shows };
|
|
8895
|
+
return { only: asked, ...narrowed, skipped, ...shows };
|
|
7257
8896
|
const only = lanes.filter((lane) => !off.has(lane));
|
|
7258
8897
|
if (!only.length)
|
|
7259
8898
|
throw new CliError("permission_error", `search all has nothing it may read: ${skipped.map(({ reason }) => reason).join("; ")}`, { reason: "search.all-denied" });
|
|
7260
|
-
return { only, skipped, ...shows };
|
|
8899
|
+
return { only, ...narrowed, skipped, ...shows };
|
|
7261
8900
|
}, "lanesFor");
|
|
7262
8901
|
|
|
7263
8902
|
// dist/config-issues.js
|
|
@@ -7662,6 +9301,7 @@ export {
|
|
|
7662
9301
|
OWED_DAYS,
|
|
7663
9302
|
mailReadCommands,
|
|
7664
9303
|
grantLevels,
|
|
9304
|
+
grantedLevel,
|
|
7665
9305
|
lanesFor,
|
|
7666
9306
|
memoPermissionKeys,
|
|
7667
9307
|
NOTE_EXTENSIONS,
|