@wirecat/cli-memo 0.131.61 → 0.131.63
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/{all-profiles-WPBMSWJF.js → all-profiles-L6EBORCV.js} +5 -5
- package/dist/bundle/{anthropic-FZRVISSX.js → anthropic-42PADP4V.js} +2 -2
- package/dist/bundle/{app-server-QGIZPU4R.js → app-server-QBJG7OGQ.js} +35 -35
- package/dist/bundle/auto-LGA3VXKQ.js +85 -0
- package/dist/bundle/{bun-AO76624P.js → bun-NYSNYHAD.js} +2 -2
- package/dist/bundle/{bun-sqlite-HYBE66QU.js → bun-sqlite-B46U7KI7.js} +2 -2
- package/dist/bundle/{chunk-233N77WN.js → chunk-2UCLF4AO.js} +273 -272
- package/dist/bundle/{chunk-YRHLPKTG.js → chunk-2XVXF4RW.js} +2 -2
- package/dist/bundle/{chunk-IZZU4NS6.js → chunk-347UBASY.js} +3 -3
- package/dist/bundle/{chunk-RRHSJ7CR.js → chunk-37E74SKW.js} +62 -62
- package/dist/bundle/{chunk-7DPHHUSZ.js → chunk-3ZXWLFUG.js} +21 -21
- package/dist/bundle/{chunk-6YK3RZZJ.js → chunk-4BKSE3CG.js} +4 -4
- package/dist/bundle/{chunk-WFDGEREJ.js → chunk-4GTZSCUE.js} +2 -2
- package/dist/bundle/{chunk-OFERGS4J.js → chunk-4SUROBD4.js} +2 -2
- package/dist/bundle/{chunk-5ZVWDMDT.js → chunk-5D7BPC33.js} +1 -1
- package/dist/bundle/{chunk-CTRVHHBK.js → chunk-5Q534L4I.js} +5 -5
- package/dist/bundle/{chunk-RRPUM4RS.js → chunk-6OZ2WI7Y.js} +2 -2
- package/dist/bundle/{chunk-B4VCZOLF.js → chunk-724DPWN6.js} +1 -1
- package/dist/bundle/{chunk-4WKZ3UIZ.js → chunk-A524HPDV.js} +1 -1
- package/dist/bundle/{chunk-2Q55K5HY.js → chunk-ACG5QN77.js} +2 -2
- package/dist/bundle/{chunk-WMRR2SNG.js → chunk-B3SERZMP.js} +1 -1
- package/dist/bundle/{chunk-XT7EJLA4.js → chunk-BOMHJR2E.js} +4 -4
- package/dist/bundle/{chunk-SSX6S3EG.js → chunk-DKO7WEXJ.js} +1 -1
- package/dist/bundle/{chunk-YVCNJKDA.js → chunk-E5JQFEIQ.js} +42 -42
- package/dist/bundle/{chunk-LIW42UCX.js → chunk-EGI6JHIA.js} +9 -9
- package/dist/bundle/{chunk-2UXFM5GE.js → chunk-FC5PK6M6.js} +12 -12
- package/dist/bundle/{chunk-HLTGPK6P.js → chunk-FG4Q6T72.js} +4 -4
- package/dist/bundle/{chunk-ETYD55QD.js → chunk-FH4P5UQA.js} +3 -3
- package/dist/bundle/{chunk-7CKXTTZG.js → chunk-FWRBJAQZ.js} +2 -2
- package/dist/bundle/{chunk-F6E7DSJO.js → chunk-GNHDE7FH.js} +1738 -32
- package/dist/bundle/{chunk-6NHJ4TTJ.js → chunk-HGNWJJDT.js} +336 -335
- package/dist/bundle/{chunk-OQSOQYSQ.js → chunk-HKC7GDJD.js} +4 -4
- package/dist/bundle/{chunk-XYFYZP2N.js → chunk-I5L7MLZ6.js} +1 -1
- package/dist/bundle/{chunk-KZRBIHQL.js → chunk-K4WCDPDL.js} +5 -5
- package/dist/bundle/{chunk-3FPF5DBU.js → chunk-K5VF47E2.js} +5 -5
- package/dist/bundle/{chunk-K6FQVROA.js → chunk-LK6D26RK.js} +21 -21
- package/dist/bundle/{chunk-6AEQACVV.js → chunk-MWAXS4BX.js} +7 -7
- package/dist/bundle/{chunk-D4PK5OXW.js → chunk-NZJUMLTD.js} +1 -1
- package/dist/bundle/{chunk-UTUUXAPS.js → chunk-O2NQCWRM.js} +28 -28
- package/dist/bundle/{chunk-35OBIX5A.js → chunk-OXBETHGN.js} +8 -8
- package/dist/bundle/{chunk-OIHKFGHK.js → chunk-PKUBC2ME.js} +3 -3
- package/dist/bundle/{chunk-7ETYPYIN.js → chunk-Q3VEUHC7.js} +12 -12
- package/dist/bundle/{chunk-RT476OFI.js → chunk-RGZUDHAQ.js} +7 -7
- package/dist/bundle/{chunk-UTSMQ7KI.js → chunk-RLX5SC2X.js} +1 -1
- package/dist/bundle/{chunk-PSYZ33UQ.js → chunk-RP6VV35S.js} +1 -1
- package/dist/bundle/{chunk-R7ZD7TNI.js → chunk-RSG7BRXI.js} +1 -1
- package/dist/bundle/{chunk-37ILRM2G.js → chunk-RTLQHLHG.js} +4 -4
- package/dist/bundle/{chunk-4HLYKLGJ.js → chunk-SIBQ34LX.js} +1 -1
- package/dist/bundle/{chunk-JAJSTFBB.js → chunk-SIJA2UYC.js} +6 -6
- package/dist/bundle/{chunk-MQCBJGXA.js → chunk-SJ55SMBE.js} +9 -9
- package/dist/bundle/{chunk-I6LNI45S.js → chunk-SOQGV3ZM.js} +5 -5
- package/dist/bundle/{chunk-5SD4CV2D.js → chunk-TBSWOVM3.js} +571 -293
- package/dist/bundle/{chunk-STXMSLU6.js → chunk-TKPIS4G2.js} +1 -1
- package/dist/bundle/{chunk-XU7UER3B.js → chunk-TSKGEK2S.js} +10 -10
- package/dist/bundle/{chunk-2VMZLQ5K.js → chunk-V7TJSYFK.js} +2 -2
- package/dist/bundle/{chunk-KGZM5WYK.js → chunk-VTKLHYCZ.js} +4 -4
- package/dist/bundle/{chunk-7E46JN6V.js → chunk-VX4HNQLN.js} +2 -2
- package/dist/bundle/{chunk-OEPBIWHI.js → chunk-WDWKG7FJ.js} +150 -150
- package/dist/bundle/{chunk-OWVHNTY6.js → chunk-WDZOEBTE.js} +6 -6
- package/dist/bundle/{chunk-7NKBX7FC.js → chunk-XVREIQ2N.js} +2 -2
- package/dist/bundle/chunk-YVJAD5E7.js +268 -0
- package/dist/bundle/{chunk-Y264FW55.js → chunk-ZUQXDJ7A.js} +1 -1
- package/dist/bundle/{command-contract-4TGN6GSP.js → command-contract-SIXWLKAS.js} +11 -11
- package/dist/bundle/{decode-S3PPQHID.js → decode-2Z4GCIGA.js} +2 -2
- package/dist/bundle/{echarts-AH6U7X2S.js → echarts-JADCSUD7.js} +2 -2
- package/dist/bundle/{embed-4NSZECMB.js → embed-ZLEPINEK.js} +3 -3
- package/dist/bundle/{embedder-EGRA7YEY.js → embedder-E3DHPZCK.js} +6 -6
- package/dist/bundle/{entry-O3V72WZP.js → entry-SFLEGFSN.js} +4 -4
- package/dist/bundle/failure-OGSLUNT6.js +65 -0
- package/dist/bundle/{first-run-S7RRDIGX.js → first-run-ZKDGFY6P.js} +5 -5
- package/dist/bundle/{first-screen-YKJAQUVE.js → first-screen-IQEU7XF2.js} +12 -12
- package/dist/bundle/{instructions-ETUUZKBM.js → instructions-ECXOBMWS.js} +1 -1
- package/dist/bundle/{mcp-J3K7RC5W.js → mcp-Y4XMDC5Q.js} +35 -35
- package/dist/bundle/memo.js +6 -6
- package/dist/bundle/{node-O4XVOEGO.js → node-A6363DJ4.js} +2 -2
- package/dist/bundle/{node-sqlite-PC3K43U7.js → node-sqlite-FA2P77PW.js} +3 -3
- package/dist/bundle/{oauth-MBJUEG2Z.js → oauth-DBGARGR7.js} +4 -4
- package/dist/bundle/{open-5FAYV6JM.js → open-5YYG2VWH.js} +2 -2
- package/dist/bundle/{openai-57CRSGLH.js → openai-BPVP7TZ7.js} +7 -7
- package/dist/bundle/{process-NAW4COYH.js → process-DGPZRHQA.js} +1 -1
- package/dist/bundle/{program-CFJAGFYD.js → program-ZHLCEVWB.js} +618 -290
- package/dist/bundle/{prompt-FT2MMVS7.js → prompt-NTAZWPWA.js} +2 -2
- package/dist/bundle/{recognize-PEYPOI3Q.js → recognize-OGEP5VD3.js} +1 -1
- package/dist/bundle/{remote-FQAXACFW.js → remote-DER2PFH6.js} +4 -4
- package/dist/bundle/{rerank-4KEB4X6T.js → rerank-PB5ACFHS.js} +4 -4
- package/dist/bundle/{serve-LCTIHO37.js → serve-KNEY4BXK.js} +6 -6
- package/dist/bundle/{server-XQLRMM73.js → server-I5BPRS5C.js} +55 -52
- package/dist/bundle/server-IQILK5YP.js +61 -0
- package/dist/bundle/server-NKI7SVK5.js +48 -0
- package/dist/bundle/{state-YF4M4RHC.js → state-JMCWHHZM.js} +3 -3
- package/dist/bundle/{store-EQEMYMCC.js → store-6H4FPFTX.js} +9 -9
- package/dist/bundle/store-maintenance-command-IFVWSQMJ.js +47 -0
- package/dist/bundle/update-YMILPFRY.js +68 -0
- package/dist/config-issues.d.ts +4 -1
- package/dist/config-issues.d.ts.map +1 -1
- package/dist/config-issues.js +6 -2
- package/dist/config-issues.js.map +1 -1
- package/dist/contract-overrides/search.js +2 -2
- package/dist/contract-overrides/search.js.map +1 -1
- package/dist/digest/command.d.ts.map +1 -1
- package/dist/digest/command.js +11 -7
- package/dist/digest/command.js.map +1 -1
- package/dist/digest/digest.d.ts +29 -4
- package/dist/digest/digest.d.ts.map +1 -1
- package/dist/digest/digest.js +124 -39
- package/dist/digest/digest.js.map +1 -1
- package/dist/digest/sync-health.d.ts +51 -0
- package/dist/digest/sync-health.d.ts.map +1 -0
- package/dist/digest/sync-health.js +116 -0
- package/dist/digest/sync-health.js.map +1 -0
- package/dist/digest/tasks.d.ts +38 -0
- package/dist/digest/tasks.d.ts.map +1 -0
- package/dist/digest/tasks.js +108 -0
- package/dist/digest/tasks.js.map +1 -0
- package/dist/digest/text.d.ts.map +1 -1
- package/dist/digest/text.js +9 -2
- package/dist/digest/text.js.map +1 -1
- package/dist/knowledge/messenger-sync.d.ts +5 -0
- package/dist/knowledge/messenger-sync.d.ts.map +1 -1
- package/dist/knowledge/messenger-sync.js +12 -9
- package/dist/knowledge/messenger-sync.js.map +1 -1
- package/dist/mcp/catalogue.d.ts.map +1 -1
- package/dist/mcp/catalogue.js +5 -3
- package/dist/mcp/catalogue.js.map +1 -1
- package/dist/mcp/granted.d.ts +13 -0
- package/dist/mcp/granted.d.ts.map +1 -0
- package/dist/mcp/granted.js +19 -0
- package/dist/mcp/granted.js.map +1 -0
- package/dist/search/command.d.ts.map +1 -1
- package/dist/search/command.js +19 -7
- package/dist/search/command.js.map +1 -1
- package/dist/search/lane-gates.d.ts +33 -0
- package/dist/search/lane-gates.d.ts.map +1 -0
- package/dist/search/lane-gates.js +65 -0
- package/dist/search/lane-gates.js.map +1 -0
- package/dist/search/search.d.ts +5 -2
- package/dist/search/search.d.ts.map +1 -1
- package/dist/search/search.js +24 -2
- package/dist/search/search.js.map +1 -1
- package/dist/show/command.d.ts +3 -1
- package/dist/show/command.d.ts.map +1 -1
- package/dist/show/command.js +28 -3
- package/dist/show/command.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
- package/skills/morning-digest/SKILL.md +24 -10
- package/dist/bundle/auto-5VPCO4DD.js +0 -85
- package/dist/bundle/chunk-3FDJSMLJ.js +0 -1900
- package/dist/bundle/failure-CFGWWTV5.js +0 -65
- package/dist/bundle/server-AQTWRRAJ.js +0 -61
- package/dist/bundle/server-JIFODLCU.js +0 -48
- package/dist/bundle/store-maintenance-command-7IC3LTYY.js +0 -47
- package/dist/bundle/update-T237KLFA.js +0 -68
- /package/dist/bundle/{chunk-GFNWVGLD.js → chunk-C3XNJQD7.js} +0 -0
|
@@ -1,1900 +0,0 @@
|
|
|
1
|
-
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
-
const require = __bundleRequire(import.meta.url);
|
|
3
|
-
import {
|
|
4
|
-
decisionPolicy
|
|
5
|
-
} from "./chunk-F6E7DSJO.js";
|
|
6
|
-
import {
|
|
7
|
-
compactText,
|
|
8
|
-
currentRun,
|
|
9
|
-
itemOf,
|
|
10
|
-
listOf,
|
|
11
|
-
renderAnswer,
|
|
12
|
-
resolveOutput,
|
|
13
|
-
rootOf,
|
|
14
|
-
rowShapeOf,
|
|
15
|
-
rowsOfEntity,
|
|
16
|
-
sealed,
|
|
17
|
-
snakeKeysKeeping
|
|
18
|
-
} from "./chunk-OEPBIWHI.js";
|
|
19
|
-
import {
|
|
20
|
-
openStore
|
|
21
|
-
} from "./chunk-6NHJ4TTJ.js";
|
|
22
|
-
import {
|
|
23
|
-
STORE_CLIENT
|
|
24
|
-
} from "./chunk-R7ZD7TNI.js";
|
|
25
|
-
import {
|
|
26
|
-
createRenderer
|
|
27
|
-
} from "./chunk-EMNQPMZO.js";
|
|
28
|
-
import {
|
|
29
|
-
COMPACT_FLAG
|
|
30
|
-
} from "./chunk-RCGFSWZE.js";
|
|
31
|
-
import {
|
|
32
|
-
CliError
|
|
33
|
-
} from "./chunk-4ZW6ZJ2V.js";
|
|
34
|
-
import {
|
|
35
|
-
__name
|
|
36
|
-
} from "./chunk-ZVVMGPBJ.js";
|
|
37
|
-
|
|
38
|
-
// node_modules/.pnpm/qrcode-generator@2.0.4/node_modules/qrcode-generator/dist/qrcode.mjs
|
|
39
|
-
var qrcode = /* @__PURE__ */ __name(function(typeNumber, errorCorrectionLevel) {
|
|
40
|
-
const PAD0 = 236;
|
|
41
|
-
const PAD1 = 17;
|
|
42
|
-
let _typeNumber = typeNumber;
|
|
43
|
-
const _errorCorrectionLevel = QRErrorCorrectionLevel[errorCorrectionLevel];
|
|
44
|
-
let _modules = null;
|
|
45
|
-
let _moduleCount = 0;
|
|
46
|
-
let _dataCache = null;
|
|
47
|
-
const _dataList = [];
|
|
48
|
-
const _this = {};
|
|
49
|
-
const makeImpl = /* @__PURE__ */ __name(function(test, maskPattern) {
|
|
50
|
-
_moduleCount = _typeNumber * 4 + 17;
|
|
51
|
-
_modules = (function(moduleCount) {
|
|
52
|
-
const modules = new Array(moduleCount);
|
|
53
|
-
for (let row = 0; row < moduleCount; row += 1) {
|
|
54
|
-
modules[row] = new Array(moduleCount);
|
|
55
|
-
for (let col = 0; col < moduleCount; col += 1) {
|
|
56
|
-
modules[row][col] = null;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
return modules;
|
|
60
|
-
})(_moduleCount);
|
|
61
|
-
setupPositionProbePattern(0, 0);
|
|
62
|
-
setupPositionProbePattern(_moduleCount - 7, 0);
|
|
63
|
-
setupPositionProbePattern(0, _moduleCount - 7);
|
|
64
|
-
setupPositionAdjustPattern();
|
|
65
|
-
setupTimingPattern();
|
|
66
|
-
setupTypeInfo(test, maskPattern);
|
|
67
|
-
if (_typeNumber >= 7) {
|
|
68
|
-
setupTypeNumber(test);
|
|
69
|
-
}
|
|
70
|
-
if (_dataCache == null) {
|
|
71
|
-
_dataCache = createData(_typeNumber, _errorCorrectionLevel, _dataList);
|
|
72
|
-
}
|
|
73
|
-
mapData(_dataCache, maskPattern);
|
|
74
|
-
}, "makeImpl");
|
|
75
|
-
const setupPositionProbePattern = /* @__PURE__ */ __name(function(row, col) {
|
|
76
|
-
for (let r = -1; r <= 7; r += 1) {
|
|
77
|
-
if (row + r <= -1 || _moduleCount <= row + r) continue;
|
|
78
|
-
for (let c = -1; c <= 7; c += 1) {
|
|
79
|
-
if (col + c <= -1 || _moduleCount <= col + c) continue;
|
|
80
|
-
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) {
|
|
81
|
-
_modules[row + r][col + c] = true;
|
|
82
|
-
} else {
|
|
83
|
-
_modules[row + r][col + c] = false;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}, "setupPositionProbePattern");
|
|
88
|
-
const getBestMaskPattern = /* @__PURE__ */ __name(function() {
|
|
89
|
-
let minLostPoint = 0;
|
|
90
|
-
let pattern = 0;
|
|
91
|
-
for (let i = 0; i < 8; i += 1) {
|
|
92
|
-
makeImpl(true, i);
|
|
93
|
-
const lostPoint = QRUtil.getLostPoint(_this);
|
|
94
|
-
if (i == 0 || minLostPoint > lostPoint) {
|
|
95
|
-
minLostPoint = lostPoint;
|
|
96
|
-
pattern = i;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
return pattern;
|
|
100
|
-
}, "getBestMaskPattern");
|
|
101
|
-
const setupTimingPattern = /* @__PURE__ */ __name(function() {
|
|
102
|
-
for (let r = 8; r < _moduleCount - 8; r += 1) {
|
|
103
|
-
if (_modules[r][6] != null) {
|
|
104
|
-
continue;
|
|
105
|
-
}
|
|
106
|
-
_modules[r][6] = r % 2 == 0;
|
|
107
|
-
}
|
|
108
|
-
for (let c = 8; c < _moduleCount - 8; c += 1) {
|
|
109
|
-
if (_modules[6][c] != null) {
|
|
110
|
-
continue;
|
|
111
|
-
}
|
|
112
|
-
_modules[6][c] = c % 2 == 0;
|
|
113
|
-
}
|
|
114
|
-
}, "setupTimingPattern");
|
|
115
|
-
const setupPositionAdjustPattern = /* @__PURE__ */ __name(function() {
|
|
116
|
-
const pos = QRUtil.getPatternPosition(_typeNumber);
|
|
117
|
-
for (let i = 0; i < pos.length; i += 1) {
|
|
118
|
-
for (let j = 0; j < pos.length; j += 1) {
|
|
119
|
-
const row = pos[i];
|
|
120
|
-
const col = pos[j];
|
|
121
|
-
if (_modules[row][col] != null) {
|
|
122
|
-
continue;
|
|
123
|
-
}
|
|
124
|
-
for (let r = -2; r <= 2; r += 1) {
|
|
125
|
-
for (let c = -2; c <= 2; c += 1) {
|
|
126
|
-
if (r == -2 || r == 2 || c == -2 || c == 2 || r == 0 && c == 0) {
|
|
127
|
-
_modules[row + r][col + c] = true;
|
|
128
|
-
} else {
|
|
129
|
-
_modules[row + r][col + c] = false;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}, "setupPositionAdjustPattern");
|
|
136
|
-
const setupTypeNumber = /* @__PURE__ */ __name(function(test) {
|
|
137
|
-
const bits = QRUtil.getBCHTypeNumber(_typeNumber);
|
|
138
|
-
for (let i = 0; i < 18; i += 1) {
|
|
139
|
-
const mod = !test && (bits >> i & 1) == 1;
|
|
140
|
-
_modules[Math.floor(i / 3)][i % 3 + _moduleCount - 8 - 3] = mod;
|
|
141
|
-
}
|
|
142
|
-
for (let i = 0; i < 18; i += 1) {
|
|
143
|
-
const mod = !test && (bits >> i & 1) == 1;
|
|
144
|
-
_modules[i % 3 + _moduleCount - 8 - 3][Math.floor(i / 3)] = mod;
|
|
145
|
-
}
|
|
146
|
-
}, "setupTypeNumber");
|
|
147
|
-
const setupTypeInfo = /* @__PURE__ */ __name(function(test, maskPattern) {
|
|
148
|
-
const data = _errorCorrectionLevel << 3 | maskPattern;
|
|
149
|
-
const bits = QRUtil.getBCHTypeInfo(data);
|
|
150
|
-
for (let i = 0; i < 15; i += 1) {
|
|
151
|
-
const mod = !test && (bits >> i & 1) == 1;
|
|
152
|
-
if (i < 6) {
|
|
153
|
-
_modules[i][8] = mod;
|
|
154
|
-
} else if (i < 8) {
|
|
155
|
-
_modules[i + 1][8] = mod;
|
|
156
|
-
} else {
|
|
157
|
-
_modules[_moduleCount - 15 + i][8] = mod;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
for (let i = 0; i < 15; i += 1) {
|
|
161
|
-
const mod = !test && (bits >> i & 1) == 1;
|
|
162
|
-
if (i < 8) {
|
|
163
|
-
_modules[8][_moduleCount - i - 1] = mod;
|
|
164
|
-
} else if (i < 9) {
|
|
165
|
-
_modules[8][15 - i - 1 + 1] = mod;
|
|
166
|
-
} else {
|
|
167
|
-
_modules[8][15 - i - 1] = mod;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
_modules[_moduleCount - 8][8] = !test;
|
|
171
|
-
}, "setupTypeInfo");
|
|
172
|
-
const mapData = /* @__PURE__ */ __name(function(data, maskPattern) {
|
|
173
|
-
let inc = -1;
|
|
174
|
-
let row = _moduleCount - 1;
|
|
175
|
-
let bitIndex = 7;
|
|
176
|
-
let byteIndex = 0;
|
|
177
|
-
const maskFunc = QRUtil.getMaskFunction(maskPattern);
|
|
178
|
-
for (let col = _moduleCount - 1; col > 0; col -= 2) {
|
|
179
|
-
if (col == 6) col -= 1;
|
|
180
|
-
while (true) {
|
|
181
|
-
for (let c = 0; c < 2; c += 1) {
|
|
182
|
-
if (_modules[row][col - c] == null) {
|
|
183
|
-
let dark = false;
|
|
184
|
-
if (byteIndex < data.length) {
|
|
185
|
-
dark = (data[byteIndex] >>> bitIndex & 1) == 1;
|
|
186
|
-
}
|
|
187
|
-
const mask = maskFunc(row, col - c);
|
|
188
|
-
if (mask) {
|
|
189
|
-
dark = !dark;
|
|
190
|
-
}
|
|
191
|
-
_modules[row][col - c] = dark;
|
|
192
|
-
bitIndex -= 1;
|
|
193
|
-
if (bitIndex == -1) {
|
|
194
|
-
byteIndex += 1;
|
|
195
|
-
bitIndex = 7;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
row += inc;
|
|
200
|
-
if (row < 0 || _moduleCount <= row) {
|
|
201
|
-
row -= inc;
|
|
202
|
-
inc = -inc;
|
|
203
|
-
break;
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
}, "mapData");
|
|
208
|
-
const createBytes = /* @__PURE__ */ __name(function(buffer, rsBlocks) {
|
|
209
|
-
let offset = 0;
|
|
210
|
-
let maxDcCount = 0;
|
|
211
|
-
let maxEcCount = 0;
|
|
212
|
-
const dcdata = new Array(rsBlocks.length);
|
|
213
|
-
const ecdata = new Array(rsBlocks.length);
|
|
214
|
-
for (let r = 0; r < rsBlocks.length; r += 1) {
|
|
215
|
-
const dcCount = rsBlocks[r].dataCount;
|
|
216
|
-
const ecCount = rsBlocks[r].totalCount - dcCount;
|
|
217
|
-
maxDcCount = Math.max(maxDcCount, dcCount);
|
|
218
|
-
maxEcCount = Math.max(maxEcCount, ecCount);
|
|
219
|
-
dcdata[r] = new Array(dcCount);
|
|
220
|
-
for (let i = 0; i < dcdata[r].length; i += 1) {
|
|
221
|
-
dcdata[r][i] = 255 & buffer.getBuffer()[i + offset];
|
|
222
|
-
}
|
|
223
|
-
offset += dcCount;
|
|
224
|
-
const rsPoly = QRUtil.getErrorCorrectPolynomial(ecCount);
|
|
225
|
-
const rawPoly = qrPolynomial(dcdata[r], rsPoly.getLength() - 1);
|
|
226
|
-
const modPoly = rawPoly.mod(rsPoly);
|
|
227
|
-
ecdata[r] = new Array(rsPoly.getLength() - 1);
|
|
228
|
-
for (let i = 0; i < ecdata[r].length; i += 1) {
|
|
229
|
-
const modIndex = i + modPoly.getLength() - ecdata[r].length;
|
|
230
|
-
ecdata[r][i] = modIndex >= 0 ? modPoly.getAt(modIndex) : 0;
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
let totalCodeCount = 0;
|
|
234
|
-
for (let i = 0; i < rsBlocks.length; i += 1) {
|
|
235
|
-
totalCodeCount += rsBlocks[i].totalCount;
|
|
236
|
-
}
|
|
237
|
-
const data = new Array(totalCodeCount);
|
|
238
|
-
let index = 0;
|
|
239
|
-
for (let i = 0; i < maxDcCount; i += 1) {
|
|
240
|
-
for (let r = 0; r < rsBlocks.length; r += 1) {
|
|
241
|
-
if (i < dcdata[r].length) {
|
|
242
|
-
data[index] = dcdata[r][i];
|
|
243
|
-
index += 1;
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
for (let i = 0; i < maxEcCount; i += 1) {
|
|
248
|
-
for (let r = 0; r < rsBlocks.length; r += 1) {
|
|
249
|
-
if (i < ecdata[r].length) {
|
|
250
|
-
data[index] = ecdata[r][i];
|
|
251
|
-
index += 1;
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
return data;
|
|
256
|
-
}, "createBytes");
|
|
257
|
-
const createData = /* @__PURE__ */ __name(function(typeNumber2, errorCorrectionLevel2, dataList) {
|
|
258
|
-
const rsBlocks = QRRSBlock.getRSBlocks(typeNumber2, errorCorrectionLevel2);
|
|
259
|
-
const buffer = qrBitBuffer();
|
|
260
|
-
for (let i = 0; i < dataList.length; i += 1) {
|
|
261
|
-
const data = dataList[i];
|
|
262
|
-
buffer.put(data.getMode(), 4);
|
|
263
|
-
buffer.put(data.getLength(), QRUtil.getLengthInBits(data.getMode(), typeNumber2));
|
|
264
|
-
data.write(buffer);
|
|
265
|
-
}
|
|
266
|
-
let totalDataCount = 0;
|
|
267
|
-
for (let i = 0; i < rsBlocks.length; i += 1) {
|
|
268
|
-
totalDataCount += rsBlocks[i].dataCount;
|
|
269
|
-
}
|
|
270
|
-
if (buffer.getLengthInBits() > totalDataCount * 8) {
|
|
271
|
-
throw "code length overflow. (" + buffer.getLengthInBits() + ">" + totalDataCount * 8 + ")";
|
|
272
|
-
}
|
|
273
|
-
if (buffer.getLengthInBits() + 4 <= totalDataCount * 8) {
|
|
274
|
-
buffer.put(0, 4);
|
|
275
|
-
}
|
|
276
|
-
while (buffer.getLengthInBits() % 8 != 0) {
|
|
277
|
-
buffer.putBit(false);
|
|
278
|
-
}
|
|
279
|
-
while (true) {
|
|
280
|
-
if (buffer.getLengthInBits() >= totalDataCount * 8) {
|
|
281
|
-
break;
|
|
282
|
-
}
|
|
283
|
-
buffer.put(PAD0, 8);
|
|
284
|
-
if (buffer.getLengthInBits() >= totalDataCount * 8) {
|
|
285
|
-
break;
|
|
286
|
-
}
|
|
287
|
-
buffer.put(PAD1, 8);
|
|
288
|
-
}
|
|
289
|
-
return createBytes(buffer, rsBlocks);
|
|
290
|
-
}, "createData");
|
|
291
|
-
_this.addData = function(data, mode) {
|
|
292
|
-
mode = mode || "Byte";
|
|
293
|
-
let newData = null;
|
|
294
|
-
switch (mode) {
|
|
295
|
-
case "Numeric":
|
|
296
|
-
newData = qrNumber(data);
|
|
297
|
-
break;
|
|
298
|
-
case "Alphanumeric":
|
|
299
|
-
newData = qrAlphaNum(data);
|
|
300
|
-
break;
|
|
301
|
-
case "Byte":
|
|
302
|
-
newData = qr8BitByte(data);
|
|
303
|
-
break;
|
|
304
|
-
case "Kanji":
|
|
305
|
-
newData = qrKanji(data);
|
|
306
|
-
break;
|
|
307
|
-
default:
|
|
308
|
-
throw "mode:" + mode;
|
|
309
|
-
}
|
|
310
|
-
_dataList.push(newData);
|
|
311
|
-
_dataCache = null;
|
|
312
|
-
};
|
|
313
|
-
_this.isDark = function(row, col) {
|
|
314
|
-
if (row < 0 || _moduleCount <= row || col < 0 || _moduleCount <= col) {
|
|
315
|
-
throw row + "," + col;
|
|
316
|
-
}
|
|
317
|
-
return _modules[row][col];
|
|
318
|
-
};
|
|
319
|
-
_this.getModuleCount = function() {
|
|
320
|
-
return _moduleCount;
|
|
321
|
-
};
|
|
322
|
-
_this.make = function() {
|
|
323
|
-
if (_typeNumber < 1) {
|
|
324
|
-
let typeNumber2 = 1;
|
|
325
|
-
for (; typeNumber2 < 40; typeNumber2++) {
|
|
326
|
-
const rsBlocks = QRRSBlock.getRSBlocks(typeNumber2, _errorCorrectionLevel);
|
|
327
|
-
const buffer = qrBitBuffer();
|
|
328
|
-
for (let i = 0; i < _dataList.length; i++) {
|
|
329
|
-
const data = _dataList[i];
|
|
330
|
-
buffer.put(data.getMode(), 4);
|
|
331
|
-
buffer.put(data.getLength(), QRUtil.getLengthInBits(data.getMode(), typeNumber2));
|
|
332
|
-
data.write(buffer);
|
|
333
|
-
}
|
|
334
|
-
let totalDataCount = 0;
|
|
335
|
-
for (let i = 0; i < rsBlocks.length; i++) {
|
|
336
|
-
totalDataCount += rsBlocks[i].dataCount;
|
|
337
|
-
}
|
|
338
|
-
if (buffer.getLengthInBits() <= totalDataCount * 8) {
|
|
339
|
-
break;
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
_typeNumber = typeNumber2;
|
|
343
|
-
}
|
|
344
|
-
makeImpl(false, getBestMaskPattern());
|
|
345
|
-
};
|
|
346
|
-
_this.createTableTag = function(cellSize, margin) {
|
|
347
|
-
cellSize = cellSize || 2;
|
|
348
|
-
margin = typeof margin == "undefined" ? cellSize * 4 : margin;
|
|
349
|
-
let qrHtml = "";
|
|
350
|
-
qrHtml += '<table style="';
|
|
351
|
-
qrHtml += " border-width: 0px; border-style: none;";
|
|
352
|
-
qrHtml += " border-collapse: collapse;";
|
|
353
|
-
qrHtml += " padding: 0px; margin: " + margin + "px;";
|
|
354
|
-
qrHtml += '">';
|
|
355
|
-
qrHtml += "<tbody>";
|
|
356
|
-
for (let r = 0; r < _this.getModuleCount(); r += 1) {
|
|
357
|
-
qrHtml += "<tr>";
|
|
358
|
-
for (let c = 0; c < _this.getModuleCount(); c += 1) {
|
|
359
|
-
qrHtml += '<td style="';
|
|
360
|
-
qrHtml += " border-width: 0px; border-style: none;";
|
|
361
|
-
qrHtml += " border-collapse: collapse;";
|
|
362
|
-
qrHtml += " padding: 0px; margin: 0px;";
|
|
363
|
-
qrHtml += " width: " + cellSize + "px;";
|
|
364
|
-
qrHtml += " height: " + cellSize + "px;";
|
|
365
|
-
qrHtml += " background-color: ";
|
|
366
|
-
qrHtml += _this.isDark(r, c) ? "#000000" : "#ffffff";
|
|
367
|
-
qrHtml += ";";
|
|
368
|
-
qrHtml += '"/>';
|
|
369
|
-
}
|
|
370
|
-
qrHtml += "</tr>";
|
|
371
|
-
}
|
|
372
|
-
qrHtml += "</tbody>";
|
|
373
|
-
qrHtml += "</table>";
|
|
374
|
-
return qrHtml;
|
|
375
|
-
};
|
|
376
|
-
_this.createSvgTag = function(cellSize, margin, alt, title) {
|
|
377
|
-
let opts = {};
|
|
378
|
-
if (typeof arguments[0] == "object") {
|
|
379
|
-
opts = arguments[0];
|
|
380
|
-
cellSize = opts.cellSize;
|
|
381
|
-
margin = opts.margin;
|
|
382
|
-
alt = opts.alt;
|
|
383
|
-
title = opts.title;
|
|
384
|
-
}
|
|
385
|
-
cellSize = cellSize || 2;
|
|
386
|
-
margin = typeof margin == "undefined" ? cellSize * 4 : margin;
|
|
387
|
-
alt = typeof alt === "string" ? { text: alt } : alt || {};
|
|
388
|
-
alt.text = alt.text || null;
|
|
389
|
-
alt.id = alt.text ? alt.id || "qrcode-description" : null;
|
|
390
|
-
title = typeof title === "string" ? { text: title } : title || {};
|
|
391
|
-
title.text = title.text || null;
|
|
392
|
-
title.id = title.text ? title.id || "qrcode-title" : null;
|
|
393
|
-
const size = _this.getModuleCount() * cellSize + margin * 2;
|
|
394
|
-
let c, mc, r, mr, qrSvg = "", rect;
|
|
395
|
-
rect = "l" + cellSize + ",0 0," + cellSize + " -" + cellSize + ",0 0,-" + cellSize + "z ";
|
|
396
|
-
qrSvg += '<svg version="1.1" xmlns="http://www.w3.org/2000/svg"';
|
|
397
|
-
qrSvg += !opts.scalable ? ' width="' + size + 'px" height="' + size + 'px"' : "";
|
|
398
|
-
qrSvg += ' viewBox="0 0 ' + size + " " + size + '" ';
|
|
399
|
-
qrSvg += ' preserveAspectRatio="xMinYMin meet"';
|
|
400
|
-
qrSvg += title.text || alt.text ? ' role="img" aria-labelledby="' + escapeXml([title.id, alt.id].join(" ").trim()) + '"' : "";
|
|
401
|
-
qrSvg += ">";
|
|
402
|
-
qrSvg += title.text ? '<title id="' + escapeXml(title.id) + '">' + escapeXml(title.text) + "</title>" : "";
|
|
403
|
-
qrSvg += alt.text ? '<description id="' + escapeXml(alt.id) + '">' + escapeXml(alt.text) + "</description>" : "";
|
|
404
|
-
qrSvg += '<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>';
|
|
405
|
-
qrSvg += '<path d="';
|
|
406
|
-
for (r = 0; r < _this.getModuleCount(); r += 1) {
|
|
407
|
-
mr = r * cellSize + margin;
|
|
408
|
-
for (c = 0; c < _this.getModuleCount(); c += 1) {
|
|
409
|
-
if (_this.isDark(r, c)) {
|
|
410
|
-
mc = c * cellSize + margin;
|
|
411
|
-
qrSvg += "M" + mc + "," + mr + rect;
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
qrSvg += '" stroke="transparent" fill="black"/>';
|
|
416
|
-
qrSvg += "</svg>";
|
|
417
|
-
return qrSvg;
|
|
418
|
-
};
|
|
419
|
-
_this.createDataURL = function(cellSize, margin) {
|
|
420
|
-
cellSize = cellSize || 2;
|
|
421
|
-
margin = typeof margin == "undefined" ? cellSize * 4 : margin;
|
|
422
|
-
const size = _this.getModuleCount() * cellSize + margin * 2;
|
|
423
|
-
const min = margin;
|
|
424
|
-
const max = size - margin;
|
|
425
|
-
return createDataURL(size, size, function(x, y) {
|
|
426
|
-
if (min <= x && x < max && min <= y && y < max) {
|
|
427
|
-
const c = Math.floor((x - min) / cellSize);
|
|
428
|
-
const r = Math.floor((y - min) / cellSize);
|
|
429
|
-
return _this.isDark(r, c) ? 0 : 1;
|
|
430
|
-
} else {
|
|
431
|
-
return 1;
|
|
432
|
-
}
|
|
433
|
-
});
|
|
434
|
-
};
|
|
435
|
-
_this.createImgTag = function(cellSize, margin, alt) {
|
|
436
|
-
cellSize = cellSize || 2;
|
|
437
|
-
margin = typeof margin == "undefined" ? cellSize * 4 : margin;
|
|
438
|
-
const size = _this.getModuleCount() * cellSize + margin * 2;
|
|
439
|
-
let img = "";
|
|
440
|
-
img += "<img";
|
|
441
|
-
img += ' src="';
|
|
442
|
-
img += _this.createDataURL(cellSize, margin);
|
|
443
|
-
img += '"';
|
|
444
|
-
img += ' width="';
|
|
445
|
-
img += size;
|
|
446
|
-
img += '"';
|
|
447
|
-
img += ' height="';
|
|
448
|
-
img += size;
|
|
449
|
-
img += '"';
|
|
450
|
-
if (alt) {
|
|
451
|
-
img += ' alt="';
|
|
452
|
-
img += escapeXml(alt);
|
|
453
|
-
img += '"';
|
|
454
|
-
}
|
|
455
|
-
img += "/>";
|
|
456
|
-
return img;
|
|
457
|
-
};
|
|
458
|
-
const escapeXml = /* @__PURE__ */ __name(function(s) {
|
|
459
|
-
let escaped = "";
|
|
460
|
-
for (let i = 0; i < s.length; i += 1) {
|
|
461
|
-
const c = s.charAt(i);
|
|
462
|
-
switch (c) {
|
|
463
|
-
case "<":
|
|
464
|
-
escaped += "<";
|
|
465
|
-
break;
|
|
466
|
-
case ">":
|
|
467
|
-
escaped += ">";
|
|
468
|
-
break;
|
|
469
|
-
case "&":
|
|
470
|
-
escaped += "&";
|
|
471
|
-
break;
|
|
472
|
-
case '"':
|
|
473
|
-
escaped += """;
|
|
474
|
-
break;
|
|
475
|
-
default:
|
|
476
|
-
escaped += c;
|
|
477
|
-
break;
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
return escaped;
|
|
481
|
-
}, "escapeXml");
|
|
482
|
-
const _createHalfASCII = /* @__PURE__ */ __name(function(margin) {
|
|
483
|
-
const cellSize = 1;
|
|
484
|
-
margin = typeof margin == "undefined" ? cellSize * 2 : margin;
|
|
485
|
-
const size = _this.getModuleCount() * cellSize + margin * 2;
|
|
486
|
-
const min = margin;
|
|
487
|
-
const max = size - margin;
|
|
488
|
-
let y, x, r1, r2, p;
|
|
489
|
-
const blocks = {
|
|
490
|
-
"\u2588\u2588": "\u2588",
|
|
491
|
-
"\u2588 ": "\u2580",
|
|
492
|
-
" \u2588": "\u2584",
|
|
493
|
-
" ": " "
|
|
494
|
-
};
|
|
495
|
-
const blocksLastLineNoMargin = {
|
|
496
|
-
"\u2588\u2588": "\u2580",
|
|
497
|
-
"\u2588 ": "\u2580",
|
|
498
|
-
" \u2588": " ",
|
|
499
|
-
" ": " "
|
|
500
|
-
};
|
|
501
|
-
let ascii = "";
|
|
502
|
-
for (y = 0; y < size; y += 2) {
|
|
503
|
-
r1 = Math.floor((y - min) / cellSize);
|
|
504
|
-
r2 = Math.floor((y + 1 - min) / cellSize);
|
|
505
|
-
for (x = 0; x < size; x += 1) {
|
|
506
|
-
p = "\u2588";
|
|
507
|
-
if (min <= x && x < max && min <= y && y < max && _this.isDark(r1, Math.floor((x - min) / cellSize))) {
|
|
508
|
-
p = " ";
|
|
509
|
-
}
|
|
510
|
-
if (min <= x && x < max && min <= y + 1 && y + 1 < max && _this.isDark(r2, Math.floor((x - min) / cellSize))) {
|
|
511
|
-
p += " ";
|
|
512
|
-
} else {
|
|
513
|
-
p += "\u2588";
|
|
514
|
-
}
|
|
515
|
-
ascii += margin < 1 && y + 1 >= max ? blocksLastLineNoMargin[p] : blocks[p];
|
|
516
|
-
}
|
|
517
|
-
ascii += "\n";
|
|
518
|
-
}
|
|
519
|
-
if (size % 2 && margin > 0) {
|
|
520
|
-
return ascii.substring(0, ascii.length - size - 1) + Array(size + 1).join("\u2580");
|
|
521
|
-
}
|
|
522
|
-
return ascii.substring(0, ascii.length - 1);
|
|
523
|
-
}, "_createHalfASCII");
|
|
524
|
-
_this.createASCII = function(cellSize, margin) {
|
|
525
|
-
cellSize = cellSize || 1;
|
|
526
|
-
if (cellSize < 2) {
|
|
527
|
-
return _createHalfASCII(margin);
|
|
528
|
-
}
|
|
529
|
-
cellSize -= 1;
|
|
530
|
-
margin = typeof margin == "undefined" ? cellSize * 2 : margin;
|
|
531
|
-
const size = _this.getModuleCount() * cellSize + margin * 2;
|
|
532
|
-
const min = margin;
|
|
533
|
-
const max = size - margin;
|
|
534
|
-
let y, x, r, p;
|
|
535
|
-
const white = Array(cellSize + 1).join("\u2588\u2588");
|
|
536
|
-
const black = Array(cellSize + 1).join(" ");
|
|
537
|
-
let ascii = "";
|
|
538
|
-
let line = "";
|
|
539
|
-
for (y = 0; y < size; y += 1) {
|
|
540
|
-
r = Math.floor((y - min) / cellSize);
|
|
541
|
-
line = "";
|
|
542
|
-
for (x = 0; x < size; x += 1) {
|
|
543
|
-
p = 1;
|
|
544
|
-
if (min <= x && x < max && min <= y && y < max && _this.isDark(r, Math.floor((x - min) / cellSize))) {
|
|
545
|
-
p = 0;
|
|
546
|
-
}
|
|
547
|
-
line += p ? white : black;
|
|
548
|
-
}
|
|
549
|
-
for (r = 0; r < cellSize; r += 1) {
|
|
550
|
-
ascii += line + "\n";
|
|
551
|
-
}
|
|
552
|
-
}
|
|
553
|
-
return ascii.substring(0, ascii.length - 1);
|
|
554
|
-
};
|
|
555
|
-
_this.renderTo2dContext = function(context, cellSize) {
|
|
556
|
-
cellSize = cellSize || 2;
|
|
557
|
-
const length = _this.getModuleCount();
|
|
558
|
-
for (let row = 0; row < length; row++) {
|
|
559
|
-
for (let col = 0; col < length; col++) {
|
|
560
|
-
context.fillStyle = _this.isDark(row, col) ? "black" : "white";
|
|
561
|
-
context.fillRect(col * cellSize, row * cellSize, cellSize, cellSize);
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
};
|
|
565
|
-
return _this;
|
|
566
|
-
}, "qrcode");
|
|
567
|
-
qrcode.stringToBytes = function(s) {
|
|
568
|
-
const bytes = [];
|
|
569
|
-
for (let i = 0; i < s.length; i += 1) {
|
|
570
|
-
const c = s.charCodeAt(i);
|
|
571
|
-
bytes.push(c & 255);
|
|
572
|
-
}
|
|
573
|
-
return bytes;
|
|
574
|
-
};
|
|
575
|
-
qrcode.createStringToBytes = function(unicodeData, numChars) {
|
|
576
|
-
const unicodeMap = (function() {
|
|
577
|
-
const bin = base64DecodeInputStream(unicodeData);
|
|
578
|
-
const read = /* @__PURE__ */ __name(function() {
|
|
579
|
-
const b = bin.read();
|
|
580
|
-
if (b == -1) throw "eof";
|
|
581
|
-
return b;
|
|
582
|
-
}, "read");
|
|
583
|
-
let count = 0;
|
|
584
|
-
const unicodeMap2 = {};
|
|
585
|
-
while (true) {
|
|
586
|
-
const b0 = bin.read();
|
|
587
|
-
if (b0 == -1) break;
|
|
588
|
-
const b1 = read();
|
|
589
|
-
const b2 = read();
|
|
590
|
-
const b3 = read();
|
|
591
|
-
const k = String.fromCharCode(b0 << 8 | b1);
|
|
592
|
-
const v = b2 << 8 | b3;
|
|
593
|
-
unicodeMap2[k] = v;
|
|
594
|
-
count += 1;
|
|
595
|
-
}
|
|
596
|
-
if (count != numChars) {
|
|
597
|
-
throw count + " != " + numChars;
|
|
598
|
-
}
|
|
599
|
-
return unicodeMap2;
|
|
600
|
-
})();
|
|
601
|
-
const unknownChar = "?".charCodeAt(0);
|
|
602
|
-
return function(s) {
|
|
603
|
-
const bytes = [];
|
|
604
|
-
for (let i = 0; i < s.length; i += 1) {
|
|
605
|
-
const c = s.charCodeAt(i);
|
|
606
|
-
if (c < 128) {
|
|
607
|
-
bytes.push(c);
|
|
608
|
-
} else {
|
|
609
|
-
const b = unicodeMap[s.charAt(i)];
|
|
610
|
-
if (typeof b == "number") {
|
|
611
|
-
if ((b & 255) == b) {
|
|
612
|
-
bytes.push(b);
|
|
613
|
-
} else {
|
|
614
|
-
bytes.push(b >>> 8);
|
|
615
|
-
bytes.push(b & 255);
|
|
616
|
-
}
|
|
617
|
-
} else {
|
|
618
|
-
bytes.push(unknownChar);
|
|
619
|
-
}
|
|
620
|
-
}
|
|
621
|
-
}
|
|
622
|
-
return bytes;
|
|
623
|
-
};
|
|
624
|
-
};
|
|
625
|
-
var QRMode = {
|
|
626
|
-
MODE_NUMBER: 1 << 0,
|
|
627
|
-
MODE_ALPHA_NUM: 1 << 1,
|
|
628
|
-
MODE_8BIT_BYTE: 1 << 2,
|
|
629
|
-
MODE_KANJI: 1 << 3
|
|
630
|
-
};
|
|
631
|
-
var QRErrorCorrectionLevel = {
|
|
632
|
-
L: 1,
|
|
633
|
-
M: 0,
|
|
634
|
-
Q: 3,
|
|
635
|
-
H: 2
|
|
636
|
-
};
|
|
637
|
-
var QRMaskPattern = {
|
|
638
|
-
PATTERN000: 0,
|
|
639
|
-
PATTERN001: 1,
|
|
640
|
-
PATTERN010: 2,
|
|
641
|
-
PATTERN011: 3,
|
|
642
|
-
PATTERN100: 4,
|
|
643
|
-
PATTERN101: 5,
|
|
644
|
-
PATTERN110: 6,
|
|
645
|
-
PATTERN111: 7
|
|
646
|
-
};
|
|
647
|
-
var QRUtil = (function() {
|
|
648
|
-
const PATTERN_POSITION_TABLE = [
|
|
649
|
-
[],
|
|
650
|
-
[6, 18],
|
|
651
|
-
[6, 22],
|
|
652
|
-
[6, 26],
|
|
653
|
-
[6, 30],
|
|
654
|
-
[6, 34],
|
|
655
|
-
[6, 22, 38],
|
|
656
|
-
[6, 24, 42],
|
|
657
|
-
[6, 26, 46],
|
|
658
|
-
[6, 28, 50],
|
|
659
|
-
[6, 30, 54],
|
|
660
|
-
[6, 32, 58],
|
|
661
|
-
[6, 34, 62],
|
|
662
|
-
[6, 26, 46, 66],
|
|
663
|
-
[6, 26, 48, 70],
|
|
664
|
-
[6, 26, 50, 74],
|
|
665
|
-
[6, 30, 54, 78],
|
|
666
|
-
[6, 30, 56, 82],
|
|
667
|
-
[6, 30, 58, 86],
|
|
668
|
-
[6, 34, 62, 90],
|
|
669
|
-
[6, 28, 50, 72, 94],
|
|
670
|
-
[6, 26, 50, 74, 98],
|
|
671
|
-
[6, 30, 54, 78, 102],
|
|
672
|
-
[6, 28, 54, 80, 106],
|
|
673
|
-
[6, 32, 58, 84, 110],
|
|
674
|
-
[6, 30, 58, 86, 114],
|
|
675
|
-
[6, 34, 62, 90, 118],
|
|
676
|
-
[6, 26, 50, 74, 98, 122],
|
|
677
|
-
[6, 30, 54, 78, 102, 126],
|
|
678
|
-
[6, 26, 52, 78, 104, 130],
|
|
679
|
-
[6, 30, 56, 82, 108, 134],
|
|
680
|
-
[6, 34, 60, 86, 112, 138],
|
|
681
|
-
[6, 30, 58, 86, 114, 142],
|
|
682
|
-
[6, 34, 62, 90, 118, 146],
|
|
683
|
-
[6, 30, 54, 78, 102, 126, 150],
|
|
684
|
-
[6, 24, 50, 76, 102, 128, 154],
|
|
685
|
-
[6, 28, 54, 80, 106, 132, 158],
|
|
686
|
-
[6, 32, 58, 84, 110, 136, 162],
|
|
687
|
-
[6, 26, 54, 82, 110, 138, 166],
|
|
688
|
-
[6, 30, 58, 86, 114, 142, 170]
|
|
689
|
-
];
|
|
690
|
-
const G15 = 1 << 10 | 1 << 8 | 1 << 5 | 1 << 4 | 1 << 2 | 1 << 1 | 1 << 0;
|
|
691
|
-
const G18 = 1 << 12 | 1 << 11 | 1 << 10 | 1 << 9 | 1 << 8 | 1 << 5 | 1 << 2 | 1 << 0;
|
|
692
|
-
const G15_MASK = 1 << 14 | 1 << 12 | 1 << 10 | 1 << 4 | 1 << 1;
|
|
693
|
-
const _this = {};
|
|
694
|
-
const getBCHDigit = /* @__PURE__ */ __name(function(data) {
|
|
695
|
-
let digit = 0;
|
|
696
|
-
while (data != 0) {
|
|
697
|
-
digit += 1;
|
|
698
|
-
data >>>= 1;
|
|
699
|
-
}
|
|
700
|
-
return digit;
|
|
701
|
-
}, "getBCHDigit");
|
|
702
|
-
_this.getBCHTypeInfo = function(data) {
|
|
703
|
-
let d = data << 10;
|
|
704
|
-
while (getBCHDigit(d) - getBCHDigit(G15) >= 0) {
|
|
705
|
-
d ^= G15 << getBCHDigit(d) - getBCHDigit(G15);
|
|
706
|
-
}
|
|
707
|
-
return (data << 10 | d) ^ G15_MASK;
|
|
708
|
-
};
|
|
709
|
-
_this.getBCHTypeNumber = function(data) {
|
|
710
|
-
let d = data << 12;
|
|
711
|
-
while (getBCHDigit(d) - getBCHDigit(G18) >= 0) {
|
|
712
|
-
d ^= G18 << getBCHDigit(d) - getBCHDigit(G18);
|
|
713
|
-
}
|
|
714
|
-
return data << 12 | d;
|
|
715
|
-
};
|
|
716
|
-
_this.getPatternPosition = function(typeNumber) {
|
|
717
|
-
return PATTERN_POSITION_TABLE[typeNumber - 1];
|
|
718
|
-
};
|
|
719
|
-
_this.getMaskFunction = function(maskPattern) {
|
|
720
|
-
switch (maskPattern) {
|
|
721
|
-
case QRMaskPattern.PATTERN000:
|
|
722
|
-
return function(i, j) {
|
|
723
|
-
return (i + j) % 2 == 0;
|
|
724
|
-
};
|
|
725
|
-
case QRMaskPattern.PATTERN001:
|
|
726
|
-
return function(i, j) {
|
|
727
|
-
return i % 2 == 0;
|
|
728
|
-
};
|
|
729
|
-
case QRMaskPattern.PATTERN010:
|
|
730
|
-
return function(i, j) {
|
|
731
|
-
return j % 3 == 0;
|
|
732
|
-
};
|
|
733
|
-
case QRMaskPattern.PATTERN011:
|
|
734
|
-
return function(i, j) {
|
|
735
|
-
return (i + j) % 3 == 0;
|
|
736
|
-
};
|
|
737
|
-
case QRMaskPattern.PATTERN100:
|
|
738
|
-
return function(i, j) {
|
|
739
|
-
return (Math.floor(i / 2) + Math.floor(j / 3)) % 2 == 0;
|
|
740
|
-
};
|
|
741
|
-
case QRMaskPattern.PATTERN101:
|
|
742
|
-
return function(i, j) {
|
|
743
|
-
return i * j % 2 + i * j % 3 == 0;
|
|
744
|
-
};
|
|
745
|
-
case QRMaskPattern.PATTERN110:
|
|
746
|
-
return function(i, j) {
|
|
747
|
-
return (i * j % 2 + i * j % 3) % 2 == 0;
|
|
748
|
-
};
|
|
749
|
-
case QRMaskPattern.PATTERN111:
|
|
750
|
-
return function(i, j) {
|
|
751
|
-
return (i * j % 3 + (i + j) % 2) % 2 == 0;
|
|
752
|
-
};
|
|
753
|
-
default:
|
|
754
|
-
throw "bad maskPattern:" + maskPattern;
|
|
755
|
-
}
|
|
756
|
-
};
|
|
757
|
-
_this.getErrorCorrectPolynomial = function(errorCorrectLength) {
|
|
758
|
-
let a = qrPolynomial([1], 0);
|
|
759
|
-
for (let i = 0; i < errorCorrectLength; i += 1) {
|
|
760
|
-
a = a.multiply(qrPolynomial([1, QRMath.gexp(i)], 0));
|
|
761
|
-
}
|
|
762
|
-
return a;
|
|
763
|
-
};
|
|
764
|
-
_this.getLengthInBits = function(mode, type) {
|
|
765
|
-
if (1 <= type && type < 10) {
|
|
766
|
-
switch (mode) {
|
|
767
|
-
case QRMode.MODE_NUMBER:
|
|
768
|
-
return 10;
|
|
769
|
-
case QRMode.MODE_ALPHA_NUM:
|
|
770
|
-
return 9;
|
|
771
|
-
case QRMode.MODE_8BIT_BYTE:
|
|
772
|
-
return 8;
|
|
773
|
-
case QRMode.MODE_KANJI:
|
|
774
|
-
return 8;
|
|
775
|
-
default:
|
|
776
|
-
throw "mode:" + mode;
|
|
777
|
-
}
|
|
778
|
-
} else if (type < 27) {
|
|
779
|
-
switch (mode) {
|
|
780
|
-
case QRMode.MODE_NUMBER:
|
|
781
|
-
return 12;
|
|
782
|
-
case QRMode.MODE_ALPHA_NUM:
|
|
783
|
-
return 11;
|
|
784
|
-
case QRMode.MODE_8BIT_BYTE:
|
|
785
|
-
return 16;
|
|
786
|
-
case QRMode.MODE_KANJI:
|
|
787
|
-
return 10;
|
|
788
|
-
default:
|
|
789
|
-
throw "mode:" + mode;
|
|
790
|
-
}
|
|
791
|
-
} else if (type < 41) {
|
|
792
|
-
switch (mode) {
|
|
793
|
-
case QRMode.MODE_NUMBER:
|
|
794
|
-
return 14;
|
|
795
|
-
case QRMode.MODE_ALPHA_NUM:
|
|
796
|
-
return 13;
|
|
797
|
-
case QRMode.MODE_8BIT_BYTE:
|
|
798
|
-
return 16;
|
|
799
|
-
case QRMode.MODE_KANJI:
|
|
800
|
-
return 12;
|
|
801
|
-
default:
|
|
802
|
-
throw "mode:" + mode;
|
|
803
|
-
}
|
|
804
|
-
} else {
|
|
805
|
-
throw "type:" + type;
|
|
806
|
-
}
|
|
807
|
-
};
|
|
808
|
-
_this.getLostPoint = function(qrcode2) {
|
|
809
|
-
const moduleCount = qrcode2.getModuleCount();
|
|
810
|
-
let lostPoint = 0;
|
|
811
|
-
for (let row = 0; row < moduleCount; row += 1) {
|
|
812
|
-
for (let col = 0; col < moduleCount; col += 1) {
|
|
813
|
-
let sameCount = 0;
|
|
814
|
-
const dark = qrcode2.isDark(row, col);
|
|
815
|
-
for (let r = -1; r <= 1; r += 1) {
|
|
816
|
-
if (row + r < 0 || moduleCount <= row + r) {
|
|
817
|
-
continue;
|
|
818
|
-
}
|
|
819
|
-
for (let c = -1; c <= 1; c += 1) {
|
|
820
|
-
if (col + c < 0 || moduleCount <= col + c) {
|
|
821
|
-
continue;
|
|
822
|
-
}
|
|
823
|
-
if (r == 0 && c == 0) {
|
|
824
|
-
continue;
|
|
825
|
-
}
|
|
826
|
-
if (dark == qrcode2.isDark(row + r, col + c)) {
|
|
827
|
-
sameCount += 1;
|
|
828
|
-
}
|
|
829
|
-
}
|
|
830
|
-
}
|
|
831
|
-
if (sameCount > 5) {
|
|
832
|
-
lostPoint += 3 + sameCount - 5;
|
|
833
|
-
}
|
|
834
|
-
}
|
|
835
|
-
}
|
|
836
|
-
;
|
|
837
|
-
for (let row = 0; row < moduleCount - 1; row += 1) {
|
|
838
|
-
for (let col = 0; col < moduleCount - 1; col += 1) {
|
|
839
|
-
let count = 0;
|
|
840
|
-
if (qrcode2.isDark(row, col)) count += 1;
|
|
841
|
-
if (qrcode2.isDark(row + 1, col)) count += 1;
|
|
842
|
-
if (qrcode2.isDark(row, col + 1)) count += 1;
|
|
843
|
-
if (qrcode2.isDark(row + 1, col + 1)) count += 1;
|
|
844
|
-
if (count == 0 || count == 4) {
|
|
845
|
-
lostPoint += 3;
|
|
846
|
-
}
|
|
847
|
-
}
|
|
848
|
-
}
|
|
849
|
-
for (let row = 0; row < moduleCount; row += 1) {
|
|
850
|
-
for (let col = 0; col < moduleCount - 6; col += 1) {
|
|
851
|
-
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)) {
|
|
852
|
-
lostPoint += 40;
|
|
853
|
-
}
|
|
854
|
-
}
|
|
855
|
-
}
|
|
856
|
-
for (let col = 0; col < moduleCount; col += 1) {
|
|
857
|
-
for (let row = 0; row < moduleCount - 6; row += 1) {
|
|
858
|
-
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)) {
|
|
859
|
-
lostPoint += 40;
|
|
860
|
-
}
|
|
861
|
-
}
|
|
862
|
-
}
|
|
863
|
-
let darkCount = 0;
|
|
864
|
-
for (let col = 0; col < moduleCount; col += 1) {
|
|
865
|
-
for (let row = 0; row < moduleCount; row += 1) {
|
|
866
|
-
if (qrcode2.isDark(row, col)) {
|
|
867
|
-
darkCount += 1;
|
|
868
|
-
}
|
|
869
|
-
}
|
|
870
|
-
}
|
|
871
|
-
const ratio = Math.abs(100 * darkCount / moduleCount / moduleCount - 50) / 5;
|
|
872
|
-
lostPoint += ratio * 10;
|
|
873
|
-
return lostPoint;
|
|
874
|
-
};
|
|
875
|
-
return _this;
|
|
876
|
-
})();
|
|
877
|
-
var QRMath = (function() {
|
|
878
|
-
const EXP_TABLE = new Array(256);
|
|
879
|
-
const LOG_TABLE = new Array(256);
|
|
880
|
-
for (let i = 0; i < 8; i += 1) {
|
|
881
|
-
EXP_TABLE[i] = 1 << i;
|
|
882
|
-
}
|
|
883
|
-
for (let i = 8; i < 256; i += 1) {
|
|
884
|
-
EXP_TABLE[i] = EXP_TABLE[i - 4] ^ EXP_TABLE[i - 5] ^ EXP_TABLE[i - 6] ^ EXP_TABLE[i - 8];
|
|
885
|
-
}
|
|
886
|
-
for (let i = 0; i < 255; i += 1) {
|
|
887
|
-
LOG_TABLE[EXP_TABLE[i]] = i;
|
|
888
|
-
}
|
|
889
|
-
const _this = {};
|
|
890
|
-
_this.glog = function(n) {
|
|
891
|
-
if (n < 1) {
|
|
892
|
-
throw "glog(" + n + ")";
|
|
893
|
-
}
|
|
894
|
-
return LOG_TABLE[n];
|
|
895
|
-
};
|
|
896
|
-
_this.gexp = function(n) {
|
|
897
|
-
while (n < 0) {
|
|
898
|
-
n += 255;
|
|
899
|
-
}
|
|
900
|
-
while (n >= 256) {
|
|
901
|
-
n -= 255;
|
|
902
|
-
}
|
|
903
|
-
return EXP_TABLE[n];
|
|
904
|
-
};
|
|
905
|
-
return _this;
|
|
906
|
-
})();
|
|
907
|
-
var qrPolynomial = /* @__PURE__ */ __name(function(num, shift) {
|
|
908
|
-
if (typeof num.length == "undefined") {
|
|
909
|
-
throw num.length + "/" + shift;
|
|
910
|
-
}
|
|
911
|
-
const _num = (function() {
|
|
912
|
-
let offset = 0;
|
|
913
|
-
while (offset < num.length && num[offset] == 0) {
|
|
914
|
-
offset += 1;
|
|
915
|
-
}
|
|
916
|
-
const _num2 = new Array(num.length - offset + shift);
|
|
917
|
-
for (let i = 0; i < num.length - offset; i += 1) {
|
|
918
|
-
_num2[i] = num[i + offset];
|
|
919
|
-
}
|
|
920
|
-
return _num2;
|
|
921
|
-
})();
|
|
922
|
-
const _this = {};
|
|
923
|
-
_this.getAt = function(index) {
|
|
924
|
-
return _num[index];
|
|
925
|
-
};
|
|
926
|
-
_this.getLength = function() {
|
|
927
|
-
return _num.length;
|
|
928
|
-
};
|
|
929
|
-
_this.multiply = function(e) {
|
|
930
|
-
const num2 = new Array(_this.getLength() + e.getLength() - 1);
|
|
931
|
-
for (let i = 0; i < _this.getLength(); i += 1) {
|
|
932
|
-
for (let j = 0; j < e.getLength(); j += 1) {
|
|
933
|
-
num2[i + j] ^= QRMath.gexp(QRMath.glog(_this.getAt(i)) + QRMath.glog(e.getAt(j)));
|
|
934
|
-
}
|
|
935
|
-
}
|
|
936
|
-
return qrPolynomial(num2, 0);
|
|
937
|
-
};
|
|
938
|
-
_this.mod = function(e) {
|
|
939
|
-
if (_this.getLength() - e.getLength() < 0) {
|
|
940
|
-
return _this;
|
|
941
|
-
}
|
|
942
|
-
const ratio = QRMath.glog(_this.getAt(0)) - QRMath.glog(e.getAt(0));
|
|
943
|
-
const num2 = new Array(_this.getLength());
|
|
944
|
-
for (let i = 0; i < _this.getLength(); i += 1) {
|
|
945
|
-
num2[i] = _this.getAt(i);
|
|
946
|
-
}
|
|
947
|
-
for (let i = 0; i < e.getLength(); i += 1) {
|
|
948
|
-
num2[i] ^= QRMath.gexp(QRMath.glog(e.getAt(i)) + ratio);
|
|
949
|
-
}
|
|
950
|
-
return qrPolynomial(num2, 0).mod(e);
|
|
951
|
-
};
|
|
952
|
-
return _this;
|
|
953
|
-
}, "qrPolynomial");
|
|
954
|
-
var QRRSBlock = (function() {
|
|
955
|
-
const RS_BLOCK_TABLE = [
|
|
956
|
-
// L
|
|
957
|
-
// M
|
|
958
|
-
// Q
|
|
959
|
-
// H
|
|
960
|
-
// 1
|
|
961
|
-
[1, 26, 19],
|
|
962
|
-
[1, 26, 16],
|
|
963
|
-
[1, 26, 13],
|
|
964
|
-
[1, 26, 9],
|
|
965
|
-
// 2
|
|
966
|
-
[1, 44, 34],
|
|
967
|
-
[1, 44, 28],
|
|
968
|
-
[1, 44, 22],
|
|
969
|
-
[1, 44, 16],
|
|
970
|
-
// 3
|
|
971
|
-
[1, 70, 55],
|
|
972
|
-
[1, 70, 44],
|
|
973
|
-
[2, 35, 17],
|
|
974
|
-
[2, 35, 13],
|
|
975
|
-
// 4
|
|
976
|
-
[1, 100, 80],
|
|
977
|
-
[2, 50, 32],
|
|
978
|
-
[2, 50, 24],
|
|
979
|
-
[4, 25, 9],
|
|
980
|
-
// 5
|
|
981
|
-
[1, 134, 108],
|
|
982
|
-
[2, 67, 43],
|
|
983
|
-
[2, 33, 15, 2, 34, 16],
|
|
984
|
-
[2, 33, 11, 2, 34, 12],
|
|
985
|
-
// 6
|
|
986
|
-
[2, 86, 68],
|
|
987
|
-
[4, 43, 27],
|
|
988
|
-
[4, 43, 19],
|
|
989
|
-
[4, 43, 15],
|
|
990
|
-
// 7
|
|
991
|
-
[2, 98, 78],
|
|
992
|
-
[4, 49, 31],
|
|
993
|
-
[2, 32, 14, 4, 33, 15],
|
|
994
|
-
[4, 39, 13, 1, 40, 14],
|
|
995
|
-
// 8
|
|
996
|
-
[2, 121, 97],
|
|
997
|
-
[2, 60, 38, 2, 61, 39],
|
|
998
|
-
[4, 40, 18, 2, 41, 19],
|
|
999
|
-
[4, 40, 14, 2, 41, 15],
|
|
1000
|
-
// 9
|
|
1001
|
-
[2, 146, 116],
|
|
1002
|
-
[3, 58, 36, 2, 59, 37],
|
|
1003
|
-
[4, 36, 16, 4, 37, 17],
|
|
1004
|
-
[4, 36, 12, 4, 37, 13],
|
|
1005
|
-
// 10
|
|
1006
|
-
[2, 86, 68, 2, 87, 69],
|
|
1007
|
-
[4, 69, 43, 1, 70, 44],
|
|
1008
|
-
[6, 43, 19, 2, 44, 20],
|
|
1009
|
-
[6, 43, 15, 2, 44, 16],
|
|
1010
|
-
// 11
|
|
1011
|
-
[4, 101, 81],
|
|
1012
|
-
[1, 80, 50, 4, 81, 51],
|
|
1013
|
-
[4, 50, 22, 4, 51, 23],
|
|
1014
|
-
[3, 36, 12, 8, 37, 13],
|
|
1015
|
-
// 12
|
|
1016
|
-
[2, 116, 92, 2, 117, 93],
|
|
1017
|
-
[6, 58, 36, 2, 59, 37],
|
|
1018
|
-
[4, 46, 20, 6, 47, 21],
|
|
1019
|
-
[7, 42, 14, 4, 43, 15],
|
|
1020
|
-
// 13
|
|
1021
|
-
[4, 133, 107],
|
|
1022
|
-
[8, 59, 37, 1, 60, 38],
|
|
1023
|
-
[8, 44, 20, 4, 45, 21],
|
|
1024
|
-
[12, 33, 11, 4, 34, 12],
|
|
1025
|
-
// 14
|
|
1026
|
-
[3, 145, 115, 1, 146, 116],
|
|
1027
|
-
[4, 64, 40, 5, 65, 41],
|
|
1028
|
-
[11, 36, 16, 5, 37, 17],
|
|
1029
|
-
[11, 36, 12, 5, 37, 13],
|
|
1030
|
-
// 15
|
|
1031
|
-
[5, 109, 87, 1, 110, 88],
|
|
1032
|
-
[5, 65, 41, 5, 66, 42],
|
|
1033
|
-
[5, 54, 24, 7, 55, 25],
|
|
1034
|
-
[11, 36, 12, 7, 37, 13],
|
|
1035
|
-
// 16
|
|
1036
|
-
[5, 122, 98, 1, 123, 99],
|
|
1037
|
-
[7, 73, 45, 3, 74, 46],
|
|
1038
|
-
[15, 43, 19, 2, 44, 20],
|
|
1039
|
-
[3, 45, 15, 13, 46, 16],
|
|
1040
|
-
// 17
|
|
1041
|
-
[1, 135, 107, 5, 136, 108],
|
|
1042
|
-
[10, 74, 46, 1, 75, 47],
|
|
1043
|
-
[1, 50, 22, 15, 51, 23],
|
|
1044
|
-
[2, 42, 14, 17, 43, 15],
|
|
1045
|
-
// 18
|
|
1046
|
-
[5, 150, 120, 1, 151, 121],
|
|
1047
|
-
[9, 69, 43, 4, 70, 44],
|
|
1048
|
-
[17, 50, 22, 1, 51, 23],
|
|
1049
|
-
[2, 42, 14, 19, 43, 15],
|
|
1050
|
-
// 19
|
|
1051
|
-
[3, 141, 113, 4, 142, 114],
|
|
1052
|
-
[3, 70, 44, 11, 71, 45],
|
|
1053
|
-
[17, 47, 21, 4, 48, 22],
|
|
1054
|
-
[9, 39, 13, 16, 40, 14],
|
|
1055
|
-
// 20
|
|
1056
|
-
[3, 135, 107, 5, 136, 108],
|
|
1057
|
-
[3, 67, 41, 13, 68, 42],
|
|
1058
|
-
[15, 54, 24, 5, 55, 25],
|
|
1059
|
-
[15, 43, 15, 10, 44, 16],
|
|
1060
|
-
// 21
|
|
1061
|
-
[4, 144, 116, 4, 145, 117],
|
|
1062
|
-
[17, 68, 42],
|
|
1063
|
-
[17, 50, 22, 6, 51, 23],
|
|
1064
|
-
[19, 46, 16, 6, 47, 17],
|
|
1065
|
-
// 22
|
|
1066
|
-
[2, 139, 111, 7, 140, 112],
|
|
1067
|
-
[17, 74, 46],
|
|
1068
|
-
[7, 54, 24, 16, 55, 25],
|
|
1069
|
-
[34, 37, 13],
|
|
1070
|
-
// 23
|
|
1071
|
-
[4, 151, 121, 5, 152, 122],
|
|
1072
|
-
[4, 75, 47, 14, 76, 48],
|
|
1073
|
-
[11, 54, 24, 14, 55, 25],
|
|
1074
|
-
[16, 45, 15, 14, 46, 16],
|
|
1075
|
-
// 24
|
|
1076
|
-
[6, 147, 117, 4, 148, 118],
|
|
1077
|
-
[6, 73, 45, 14, 74, 46],
|
|
1078
|
-
[11, 54, 24, 16, 55, 25],
|
|
1079
|
-
[30, 46, 16, 2, 47, 17],
|
|
1080
|
-
// 25
|
|
1081
|
-
[8, 132, 106, 4, 133, 107],
|
|
1082
|
-
[8, 75, 47, 13, 76, 48],
|
|
1083
|
-
[7, 54, 24, 22, 55, 25],
|
|
1084
|
-
[22, 45, 15, 13, 46, 16],
|
|
1085
|
-
// 26
|
|
1086
|
-
[10, 142, 114, 2, 143, 115],
|
|
1087
|
-
[19, 74, 46, 4, 75, 47],
|
|
1088
|
-
[28, 50, 22, 6, 51, 23],
|
|
1089
|
-
[33, 46, 16, 4, 47, 17],
|
|
1090
|
-
// 27
|
|
1091
|
-
[8, 152, 122, 4, 153, 123],
|
|
1092
|
-
[22, 73, 45, 3, 74, 46],
|
|
1093
|
-
[8, 53, 23, 26, 54, 24],
|
|
1094
|
-
[12, 45, 15, 28, 46, 16],
|
|
1095
|
-
// 28
|
|
1096
|
-
[3, 147, 117, 10, 148, 118],
|
|
1097
|
-
[3, 73, 45, 23, 74, 46],
|
|
1098
|
-
[4, 54, 24, 31, 55, 25],
|
|
1099
|
-
[11, 45, 15, 31, 46, 16],
|
|
1100
|
-
// 29
|
|
1101
|
-
[7, 146, 116, 7, 147, 117],
|
|
1102
|
-
[21, 73, 45, 7, 74, 46],
|
|
1103
|
-
[1, 53, 23, 37, 54, 24],
|
|
1104
|
-
[19, 45, 15, 26, 46, 16],
|
|
1105
|
-
// 30
|
|
1106
|
-
[5, 145, 115, 10, 146, 116],
|
|
1107
|
-
[19, 75, 47, 10, 76, 48],
|
|
1108
|
-
[15, 54, 24, 25, 55, 25],
|
|
1109
|
-
[23, 45, 15, 25, 46, 16],
|
|
1110
|
-
// 31
|
|
1111
|
-
[13, 145, 115, 3, 146, 116],
|
|
1112
|
-
[2, 74, 46, 29, 75, 47],
|
|
1113
|
-
[42, 54, 24, 1, 55, 25],
|
|
1114
|
-
[23, 45, 15, 28, 46, 16],
|
|
1115
|
-
// 32
|
|
1116
|
-
[17, 145, 115],
|
|
1117
|
-
[10, 74, 46, 23, 75, 47],
|
|
1118
|
-
[10, 54, 24, 35, 55, 25],
|
|
1119
|
-
[19, 45, 15, 35, 46, 16],
|
|
1120
|
-
// 33
|
|
1121
|
-
[17, 145, 115, 1, 146, 116],
|
|
1122
|
-
[14, 74, 46, 21, 75, 47],
|
|
1123
|
-
[29, 54, 24, 19, 55, 25],
|
|
1124
|
-
[11, 45, 15, 46, 46, 16],
|
|
1125
|
-
// 34
|
|
1126
|
-
[13, 145, 115, 6, 146, 116],
|
|
1127
|
-
[14, 74, 46, 23, 75, 47],
|
|
1128
|
-
[44, 54, 24, 7, 55, 25],
|
|
1129
|
-
[59, 46, 16, 1, 47, 17],
|
|
1130
|
-
// 35
|
|
1131
|
-
[12, 151, 121, 7, 152, 122],
|
|
1132
|
-
[12, 75, 47, 26, 76, 48],
|
|
1133
|
-
[39, 54, 24, 14, 55, 25],
|
|
1134
|
-
[22, 45, 15, 41, 46, 16],
|
|
1135
|
-
// 36
|
|
1136
|
-
[6, 151, 121, 14, 152, 122],
|
|
1137
|
-
[6, 75, 47, 34, 76, 48],
|
|
1138
|
-
[46, 54, 24, 10, 55, 25],
|
|
1139
|
-
[2, 45, 15, 64, 46, 16],
|
|
1140
|
-
// 37
|
|
1141
|
-
[17, 152, 122, 4, 153, 123],
|
|
1142
|
-
[29, 74, 46, 14, 75, 47],
|
|
1143
|
-
[49, 54, 24, 10, 55, 25],
|
|
1144
|
-
[24, 45, 15, 46, 46, 16],
|
|
1145
|
-
// 38
|
|
1146
|
-
[4, 152, 122, 18, 153, 123],
|
|
1147
|
-
[13, 74, 46, 32, 75, 47],
|
|
1148
|
-
[48, 54, 24, 14, 55, 25],
|
|
1149
|
-
[42, 45, 15, 32, 46, 16],
|
|
1150
|
-
// 39
|
|
1151
|
-
[20, 147, 117, 4, 148, 118],
|
|
1152
|
-
[40, 75, 47, 7, 76, 48],
|
|
1153
|
-
[43, 54, 24, 22, 55, 25],
|
|
1154
|
-
[10, 45, 15, 67, 46, 16],
|
|
1155
|
-
// 40
|
|
1156
|
-
[19, 148, 118, 6, 149, 119],
|
|
1157
|
-
[18, 75, 47, 31, 76, 48],
|
|
1158
|
-
[34, 54, 24, 34, 55, 25],
|
|
1159
|
-
[20, 45, 15, 61, 46, 16]
|
|
1160
|
-
];
|
|
1161
|
-
const qrRSBlock = /* @__PURE__ */ __name(function(totalCount, dataCount) {
|
|
1162
|
-
const _this2 = {};
|
|
1163
|
-
_this2.totalCount = totalCount;
|
|
1164
|
-
_this2.dataCount = dataCount;
|
|
1165
|
-
return _this2;
|
|
1166
|
-
}, "qrRSBlock");
|
|
1167
|
-
const _this = {};
|
|
1168
|
-
const getRsBlockTable = /* @__PURE__ */ __name(function(typeNumber, errorCorrectionLevel) {
|
|
1169
|
-
switch (errorCorrectionLevel) {
|
|
1170
|
-
case QRErrorCorrectionLevel.L:
|
|
1171
|
-
return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 0];
|
|
1172
|
-
case QRErrorCorrectionLevel.M:
|
|
1173
|
-
return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 1];
|
|
1174
|
-
case QRErrorCorrectionLevel.Q:
|
|
1175
|
-
return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 2];
|
|
1176
|
-
case QRErrorCorrectionLevel.H:
|
|
1177
|
-
return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 3];
|
|
1178
|
-
default:
|
|
1179
|
-
return void 0;
|
|
1180
|
-
}
|
|
1181
|
-
}, "getRsBlockTable");
|
|
1182
|
-
_this.getRSBlocks = function(typeNumber, errorCorrectionLevel) {
|
|
1183
|
-
const rsBlock = getRsBlockTable(typeNumber, errorCorrectionLevel);
|
|
1184
|
-
if (typeof rsBlock == "undefined") {
|
|
1185
|
-
throw "bad rs block @ typeNumber:" + typeNumber + "/errorCorrectionLevel:" + errorCorrectionLevel;
|
|
1186
|
-
}
|
|
1187
|
-
const length = rsBlock.length / 3;
|
|
1188
|
-
const list = [];
|
|
1189
|
-
for (let i = 0; i < length; i += 1) {
|
|
1190
|
-
const count = rsBlock[i * 3 + 0];
|
|
1191
|
-
const totalCount = rsBlock[i * 3 + 1];
|
|
1192
|
-
const dataCount = rsBlock[i * 3 + 2];
|
|
1193
|
-
for (let j = 0; j < count; j += 1) {
|
|
1194
|
-
list.push(qrRSBlock(totalCount, dataCount));
|
|
1195
|
-
}
|
|
1196
|
-
}
|
|
1197
|
-
return list;
|
|
1198
|
-
};
|
|
1199
|
-
return _this;
|
|
1200
|
-
})();
|
|
1201
|
-
var qrBitBuffer = /* @__PURE__ */ __name(function() {
|
|
1202
|
-
const _buffer = [];
|
|
1203
|
-
let _length = 0;
|
|
1204
|
-
const _this = {};
|
|
1205
|
-
_this.getBuffer = function() {
|
|
1206
|
-
return _buffer;
|
|
1207
|
-
};
|
|
1208
|
-
_this.getAt = function(index) {
|
|
1209
|
-
const bufIndex = Math.floor(index / 8);
|
|
1210
|
-
return (_buffer[bufIndex] >>> 7 - index % 8 & 1) == 1;
|
|
1211
|
-
};
|
|
1212
|
-
_this.put = function(num, length) {
|
|
1213
|
-
for (let i = 0; i < length; i += 1) {
|
|
1214
|
-
_this.putBit((num >>> length - i - 1 & 1) == 1);
|
|
1215
|
-
}
|
|
1216
|
-
};
|
|
1217
|
-
_this.getLengthInBits = function() {
|
|
1218
|
-
return _length;
|
|
1219
|
-
};
|
|
1220
|
-
_this.putBit = function(bit) {
|
|
1221
|
-
const bufIndex = Math.floor(_length / 8);
|
|
1222
|
-
if (_buffer.length <= bufIndex) {
|
|
1223
|
-
_buffer.push(0);
|
|
1224
|
-
}
|
|
1225
|
-
if (bit) {
|
|
1226
|
-
_buffer[bufIndex] |= 128 >>> _length % 8;
|
|
1227
|
-
}
|
|
1228
|
-
_length += 1;
|
|
1229
|
-
};
|
|
1230
|
-
return _this;
|
|
1231
|
-
}, "qrBitBuffer");
|
|
1232
|
-
var qrNumber = /* @__PURE__ */ __name(function(data) {
|
|
1233
|
-
const _mode = QRMode.MODE_NUMBER;
|
|
1234
|
-
const _data = data;
|
|
1235
|
-
const _this = {};
|
|
1236
|
-
_this.getMode = function() {
|
|
1237
|
-
return _mode;
|
|
1238
|
-
};
|
|
1239
|
-
_this.getLength = function(buffer) {
|
|
1240
|
-
return _data.length;
|
|
1241
|
-
};
|
|
1242
|
-
_this.write = function(buffer) {
|
|
1243
|
-
const data2 = _data;
|
|
1244
|
-
let i = 0;
|
|
1245
|
-
while (i + 2 < data2.length) {
|
|
1246
|
-
buffer.put(strToNum(data2.substring(i, i + 3)), 10);
|
|
1247
|
-
i += 3;
|
|
1248
|
-
}
|
|
1249
|
-
if (i < data2.length) {
|
|
1250
|
-
if (data2.length - i == 1) {
|
|
1251
|
-
buffer.put(strToNum(data2.substring(i, i + 1)), 4);
|
|
1252
|
-
} else if (data2.length - i == 2) {
|
|
1253
|
-
buffer.put(strToNum(data2.substring(i, i + 2)), 7);
|
|
1254
|
-
}
|
|
1255
|
-
}
|
|
1256
|
-
};
|
|
1257
|
-
const strToNum = /* @__PURE__ */ __name(function(s) {
|
|
1258
|
-
let num = 0;
|
|
1259
|
-
for (let i = 0; i < s.length; i += 1) {
|
|
1260
|
-
num = num * 10 + chatToNum(s.charAt(i));
|
|
1261
|
-
}
|
|
1262
|
-
return num;
|
|
1263
|
-
}, "strToNum");
|
|
1264
|
-
const chatToNum = /* @__PURE__ */ __name(function(c) {
|
|
1265
|
-
if ("0" <= c && c <= "9") {
|
|
1266
|
-
return c.charCodeAt(0) - "0".charCodeAt(0);
|
|
1267
|
-
}
|
|
1268
|
-
throw "illegal char :" + c;
|
|
1269
|
-
}, "chatToNum");
|
|
1270
|
-
return _this;
|
|
1271
|
-
}, "qrNumber");
|
|
1272
|
-
var qrAlphaNum = /* @__PURE__ */ __name(function(data) {
|
|
1273
|
-
const _mode = QRMode.MODE_ALPHA_NUM;
|
|
1274
|
-
const _data = data;
|
|
1275
|
-
const _this = {};
|
|
1276
|
-
_this.getMode = function() {
|
|
1277
|
-
return _mode;
|
|
1278
|
-
};
|
|
1279
|
-
_this.getLength = function(buffer) {
|
|
1280
|
-
return _data.length;
|
|
1281
|
-
};
|
|
1282
|
-
_this.write = function(buffer) {
|
|
1283
|
-
const s = _data;
|
|
1284
|
-
let i = 0;
|
|
1285
|
-
while (i + 1 < s.length) {
|
|
1286
|
-
buffer.put(
|
|
1287
|
-
getCode(s.charAt(i)) * 45 + getCode(s.charAt(i + 1)),
|
|
1288
|
-
11
|
|
1289
|
-
);
|
|
1290
|
-
i += 2;
|
|
1291
|
-
}
|
|
1292
|
-
if (i < s.length) {
|
|
1293
|
-
buffer.put(getCode(s.charAt(i)), 6);
|
|
1294
|
-
}
|
|
1295
|
-
};
|
|
1296
|
-
const getCode = /* @__PURE__ */ __name(function(c) {
|
|
1297
|
-
if ("0" <= c && c <= "9") {
|
|
1298
|
-
return c.charCodeAt(0) - "0".charCodeAt(0);
|
|
1299
|
-
} else if ("A" <= c && c <= "Z") {
|
|
1300
|
-
return c.charCodeAt(0) - "A".charCodeAt(0) + 10;
|
|
1301
|
-
} else {
|
|
1302
|
-
switch (c) {
|
|
1303
|
-
case " ":
|
|
1304
|
-
return 36;
|
|
1305
|
-
case "$":
|
|
1306
|
-
return 37;
|
|
1307
|
-
case "%":
|
|
1308
|
-
return 38;
|
|
1309
|
-
case "*":
|
|
1310
|
-
return 39;
|
|
1311
|
-
case "+":
|
|
1312
|
-
return 40;
|
|
1313
|
-
case "-":
|
|
1314
|
-
return 41;
|
|
1315
|
-
case ".":
|
|
1316
|
-
return 42;
|
|
1317
|
-
case "/":
|
|
1318
|
-
return 43;
|
|
1319
|
-
case ":":
|
|
1320
|
-
return 44;
|
|
1321
|
-
default:
|
|
1322
|
-
throw "illegal char :" + c;
|
|
1323
|
-
}
|
|
1324
|
-
}
|
|
1325
|
-
}, "getCode");
|
|
1326
|
-
return _this;
|
|
1327
|
-
}, "qrAlphaNum");
|
|
1328
|
-
var qr8BitByte = /* @__PURE__ */ __name(function(data) {
|
|
1329
|
-
const _mode = QRMode.MODE_8BIT_BYTE;
|
|
1330
|
-
const _data = data;
|
|
1331
|
-
const _bytes = qrcode.stringToBytes(data);
|
|
1332
|
-
const _this = {};
|
|
1333
|
-
_this.getMode = function() {
|
|
1334
|
-
return _mode;
|
|
1335
|
-
};
|
|
1336
|
-
_this.getLength = function(buffer) {
|
|
1337
|
-
return _bytes.length;
|
|
1338
|
-
};
|
|
1339
|
-
_this.write = function(buffer) {
|
|
1340
|
-
for (let i = 0; i < _bytes.length; i += 1) {
|
|
1341
|
-
buffer.put(_bytes[i], 8);
|
|
1342
|
-
}
|
|
1343
|
-
};
|
|
1344
|
-
return _this;
|
|
1345
|
-
}, "qr8BitByte");
|
|
1346
|
-
var qrKanji = /* @__PURE__ */ __name(function(data) {
|
|
1347
|
-
const _mode = QRMode.MODE_KANJI;
|
|
1348
|
-
const _data = data;
|
|
1349
|
-
const stringToBytes2 = qrcode.stringToBytes;
|
|
1350
|
-
!(function(c, code) {
|
|
1351
|
-
const test = stringToBytes2(c);
|
|
1352
|
-
if (test.length != 2 || (test[0] << 8 | test[1]) != code) {
|
|
1353
|
-
throw "sjis not supported.";
|
|
1354
|
-
}
|
|
1355
|
-
})("\u53CB", 38726);
|
|
1356
|
-
const _bytes = stringToBytes2(data);
|
|
1357
|
-
const _this = {};
|
|
1358
|
-
_this.getMode = function() {
|
|
1359
|
-
return _mode;
|
|
1360
|
-
};
|
|
1361
|
-
_this.getLength = function(buffer) {
|
|
1362
|
-
return ~~(_bytes.length / 2);
|
|
1363
|
-
};
|
|
1364
|
-
_this.write = function(buffer) {
|
|
1365
|
-
const data2 = _bytes;
|
|
1366
|
-
let i = 0;
|
|
1367
|
-
while (i + 1 < data2.length) {
|
|
1368
|
-
let c = (255 & data2[i]) << 8 | 255 & data2[i + 1];
|
|
1369
|
-
if (33088 <= c && c <= 40956) {
|
|
1370
|
-
c -= 33088;
|
|
1371
|
-
} else if (57408 <= c && c <= 60351) {
|
|
1372
|
-
c -= 49472;
|
|
1373
|
-
} else {
|
|
1374
|
-
throw "illegal char at " + (i + 1) + "/" + c;
|
|
1375
|
-
}
|
|
1376
|
-
c = (c >>> 8 & 255) * 192 + (c & 255);
|
|
1377
|
-
buffer.put(c, 13);
|
|
1378
|
-
i += 2;
|
|
1379
|
-
}
|
|
1380
|
-
if (i < data2.length) {
|
|
1381
|
-
throw "illegal char at " + (i + 1);
|
|
1382
|
-
}
|
|
1383
|
-
};
|
|
1384
|
-
return _this;
|
|
1385
|
-
}, "qrKanji");
|
|
1386
|
-
var byteArrayOutputStream = /* @__PURE__ */ __name(function() {
|
|
1387
|
-
const _bytes = [];
|
|
1388
|
-
const _this = {};
|
|
1389
|
-
_this.writeByte = function(b) {
|
|
1390
|
-
_bytes.push(b & 255);
|
|
1391
|
-
};
|
|
1392
|
-
_this.writeShort = function(i) {
|
|
1393
|
-
_this.writeByte(i);
|
|
1394
|
-
_this.writeByte(i >>> 8);
|
|
1395
|
-
};
|
|
1396
|
-
_this.writeBytes = function(b, off, len) {
|
|
1397
|
-
off = off || 0;
|
|
1398
|
-
len = len || b.length;
|
|
1399
|
-
for (let i = 0; i < len; i += 1) {
|
|
1400
|
-
_this.writeByte(b[i + off]);
|
|
1401
|
-
}
|
|
1402
|
-
};
|
|
1403
|
-
_this.writeString = function(s) {
|
|
1404
|
-
for (let i = 0; i < s.length; i += 1) {
|
|
1405
|
-
_this.writeByte(s.charCodeAt(i));
|
|
1406
|
-
}
|
|
1407
|
-
};
|
|
1408
|
-
_this.toByteArray = function() {
|
|
1409
|
-
return _bytes;
|
|
1410
|
-
};
|
|
1411
|
-
_this.toString = function() {
|
|
1412
|
-
let s = "";
|
|
1413
|
-
s += "[";
|
|
1414
|
-
for (let i = 0; i < _bytes.length; i += 1) {
|
|
1415
|
-
if (i > 0) {
|
|
1416
|
-
s += ",";
|
|
1417
|
-
}
|
|
1418
|
-
s += _bytes[i];
|
|
1419
|
-
}
|
|
1420
|
-
s += "]";
|
|
1421
|
-
return s;
|
|
1422
|
-
};
|
|
1423
|
-
return _this;
|
|
1424
|
-
}, "byteArrayOutputStream");
|
|
1425
|
-
var base64EncodeOutputStream = /* @__PURE__ */ __name(function() {
|
|
1426
|
-
let _buffer = 0;
|
|
1427
|
-
let _buflen = 0;
|
|
1428
|
-
let _length = 0;
|
|
1429
|
-
let _base64 = "";
|
|
1430
|
-
const _this = {};
|
|
1431
|
-
const writeEncoded = /* @__PURE__ */ __name(function(b) {
|
|
1432
|
-
_base64 += String.fromCharCode(encode(b & 63));
|
|
1433
|
-
}, "writeEncoded");
|
|
1434
|
-
const encode = /* @__PURE__ */ __name(function(n) {
|
|
1435
|
-
if (n < 0) {
|
|
1436
|
-
throw "n:" + n;
|
|
1437
|
-
} else if (n < 26) {
|
|
1438
|
-
return 65 + n;
|
|
1439
|
-
} else if (n < 52) {
|
|
1440
|
-
return 97 + (n - 26);
|
|
1441
|
-
} else if (n < 62) {
|
|
1442
|
-
return 48 + (n - 52);
|
|
1443
|
-
} else if (n == 62) {
|
|
1444
|
-
return 43;
|
|
1445
|
-
} else if (n == 63) {
|
|
1446
|
-
return 47;
|
|
1447
|
-
} else {
|
|
1448
|
-
throw "n:" + n;
|
|
1449
|
-
}
|
|
1450
|
-
}, "encode");
|
|
1451
|
-
_this.writeByte = function(n) {
|
|
1452
|
-
_buffer = _buffer << 8 | n & 255;
|
|
1453
|
-
_buflen += 8;
|
|
1454
|
-
_length += 1;
|
|
1455
|
-
while (_buflen >= 6) {
|
|
1456
|
-
writeEncoded(_buffer >>> _buflen - 6);
|
|
1457
|
-
_buflen -= 6;
|
|
1458
|
-
}
|
|
1459
|
-
};
|
|
1460
|
-
_this.flush = function() {
|
|
1461
|
-
if (_buflen > 0) {
|
|
1462
|
-
writeEncoded(_buffer << 6 - _buflen);
|
|
1463
|
-
_buffer = 0;
|
|
1464
|
-
_buflen = 0;
|
|
1465
|
-
}
|
|
1466
|
-
if (_length % 3 != 0) {
|
|
1467
|
-
const padlen = 3 - _length % 3;
|
|
1468
|
-
for (let i = 0; i < padlen; i += 1) {
|
|
1469
|
-
_base64 += "=";
|
|
1470
|
-
}
|
|
1471
|
-
}
|
|
1472
|
-
};
|
|
1473
|
-
_this.toString = function() {
|
|
1474
|
-
return _base64;
|
|
1475
|
-
};
|
|
1476
|
-
return _this;
|
|
1477
|
-
}, "base64EncodeOutputStream");
|
|
1478
|
-
var base64DecodeInputStream = /* @__PURE__ */ __name(function(str) {
|
|
1479
|
-
const _str = str;
|
|
1480
|
-
let _pos = 0;
|
|
1481
|
-
let _buffer = 0;
|
|
1482
|
-
let _buflen = 0;
|
|
1483
|
-
const _this = {};
|
|
1484
|
-
_this.read = function() {
|
|
1485
|
-
while (_buflen < 8) {
|
|
1486
|
-
if (_pos >= _str.length) {
|
|
1487
|
-
if (_buflen == 0) {
|
|
1488
|
-
return -1;
|
|
1489
|
-
}
|
|
1490
|
-
throw "unexpected end of file./" + _buflen;
|
|
1491
|
-
}
|
|
1492
|
-
const c = _str.charAt(_pos);
|
|
1493
|
-
_pos += 1;
|
|
1494
|
-
if (c == "=") {
|
|
1495
|
-
_buflen = 0;
|
|
1496
|
-
return -1;
|
|
1497
|
-
} else if (c.match(/^\s$/)) {
|
|
1498
|
-
continue;
|
|
1499
|
-
}
|
|
1500
|
-
_buffer = _buffer << 6 | decode(c.charCodeAt(0));
|
|
1501
|
-
_buflen += 6;
|
|
1502
|
-
}
|
|
1503
|
-
const n = _buffer >>> _buflen - 8 & 255;
|
|
1504
|
-
_buflen -= 8;
|
|
1505
|
-
return n;
|
|
1506
|
-
};
|
|
1507
|
-
const decode = /* @__PURE__ */ __name(function(c) {
|
|
1508
|
-
if (65 <= c && c <= 90) {
|
|
1509
|
-
return c - 65;
|
|
1510
|
-
} else if (97 <= c && c <= 122) {
|
|
1511
|
-
return c - 97 + 26;
|
|
1512
|
-
} else if (48 <= c && c <= 57) {
|
|
1513
|
-
return c - 48 + 52;
|
|
1514
|
-
} else if (c == 43) {
|
|
1515
|
-
return 62;
|
|
1516
|
-
} else if (c == 47) {
|
|
1517
|
-
return 63;
|
|
1518
|
-
} else {
|
|
1519
|
-
throw "c:" + c;
|
|
1520
|
-
}
|
|
1521
|
-
}, "decode");
|
|
1522
|
-
return _this;
|
|
1523
|
-
}, "base64DecodeInputStream");
|
|
1524
|
-
var gifImage = /* @__PURE__ */ __name(function(width, height) {
|
|
1525
|
-
const _width = width;
|
|
1526
|
-
const _height = height;
|
|
1527
|
-
const _data = new Array(width * height);
|
|
1528
|
-
const _this = {};
|
|
1529
|
-
_this.setPixel = function(x, y, pixel) {
|
|
1530
|
-
_data[y * _width + x] = pixel;
|
|
1531
|
-
};
|
|
1532
|
-
_this.write = function(out) {
|
|
1533
|
-
out.writeString("GIF87a");
|
|
1534
|
-
out.writeShort(_width);
|
|
1535
|
-
out.writeShort(_height);
|
|
1536
|
-
out.writeByte(128);
|
|
1537
|
-
out.writeByte(0);
|
|
1538
|
-
out.writeByte(0);
|
|
1539
|
-
out.writeByte(0);
|
|
1540
|
-
out.writeByte(0);
|
|
1541
|
-
out.writeByte(0);
|
|
1542
|
-
out.writeByte(255);
|
|
1543
|
-
out.writeByte(255);
|
|
1544
|
-
out.writeByte(255);
|
|
1545
|
-
out.writeString(",");
|
|
1546
|
-
out.writeShort(0);
|
|
1547
|
-
out.writeShort(0);
|
|
1548
|
-
out.writeShort(_width);
|
|
1549
|
-
out.writeShort(_height);
|
|
1550
|
-
out.writeByte(0);
|
|
1551
|
-
const lzwMinCodeSize = 2;
|
|
1552
|
-
const raster = getLZWRaster(lzwMinCodeSize);
|
|
1553
|
-
out.writeByte(lzwMinCodeSize);
|
|
1554
|
-
let offset = 0;
|
|
1555
|
-
while (raster.length - offset > 255) {
|
|
1556
|
-
out.writeByte(255);
|
|
1557
|
-
out.writeBytes(raster, offset, 255);
|
|
1558
|
-
offset += 255;
|
|
1559
|
-
}
|
|
1560
|
-
out.writeByte(raster.length - offset);
|
|
1561
|
-
out.writeBytes(raster, offset, raster.length - offset);
|
|
1562
|
-
out.writeByte(0);
|
|
1563
|
-
out.writeString(";");
|
|
1564
|
-
};
|
|
1565
|
-
const bitOutputStream = /* @__PURE__ */ __name(function(out) {
|
|
1566
|
-
const _out = out;
|
|
1567
|
-
let _bitLength = 0;
|
|
1568
|
-
let _bitBuffer = 0;
|
|
1569
|
-
const _this2 = {};
|
|
1570
|
-
_this2.write = function(data, length) {
|
|
1571
|
-
if (data >>> length != 0) {
|
|
1572
|
-
throw "length over";
|
|
1573
|
-
}
|
|
1574
|
-
while (_bitLength + length >= 8) {
|
|
1575
|
-
_out.writeByte(255 & (data << _bitLength | _bitBuffer));
|
|
1576
|
-
length -= 8 - _bitLength;
|
|
1577
|
-
data >>>= 8 - _bitLength;
|
|
1578
|
-
_bitBuffer = 0;
|
|
1579
|
-
_bitLength = 0;
|
|
1580
|
-
}
|
|
1581
|
-
_bitBuffer = data << _bitLength | _bitBuffer;
|
|
1582
|
-
_bitLength = _bitLength + length;
|
|
1583
|
-
};
|
|
1584
|
-
_this2.flush = function() {
|
|
1585
|
-
if (_bitLength > 0) {
|
|
1586
|
-
_out.writeByte(_bitBuffer);
|
|
1587
|
-
}
|
|
1588
|
-
};
|
|
1589
|
-
return _this2;
|
|
1590
|
-
}, "bitOutputStream");
|
|
1591
|
-
const getLZWRaster = /* @__PURE__ */ __name(function(lzwMinCodeSize) {
|
|
1592
|
-
const clearCode = 1 << lzwMinCodeSize;
|
|
1593
|
-
const endCode = (1 << lzwMinCodeSize) + 1;
|
|
1594
|
-
let bitLength = lzwMinCodeSize + 1;
|
|
1595
|
-
const table = lzwTable();
|
|
1596
|
-
for (let i = 0; i < clearCode; i += 1) {
|
|
1597
|
-
table.add(String.fromCharCode(i));
|
|
1598
|
-
}
|
|
1599
|
-
table.add(String.fromCharCode(clearCode));
|
|
1600
|
-
table.add(String.fromCharCode(endCode));
|
|
1601
|
-
const byteOut = byteArrayOutputStream();
|
|
1602
|
-
const bitOut = bitOutputStream(byteOut);
|
|
1603
|
-
bitOut.write(clearCode, bitLength);
|
|
1604
|
-
let dataIndex = 0;
|
|
1605
|
-
let s = String.fromCharCode(_data[dataIndex]);
|
|
1606
|
-
dataIndex += 1;
|
|
1607
|
-
while (dataIndex < _data.length) {
|
|
1608
|
-
const c = String.fromCharCode(_data[dataIndex]);
|
|
1609
|
-
dataIndex += 1;
|
|
1610
|
-
if (table.contains(s + c)) {
|
|
1611
|
-
s = s + c;
|
|
1612
|
-
} else {
|
|
1613
|
-
bitOut.write(table.indexOf(s), bitLength);
|
|
1614
|
-
if (table.size() < 4095) {
|
|
1615
|
-
if (table.size() == 1 << bitLength) {
|
|
1616
|
-
bitLength += 1;
|
|
1617
|
-
}
|
|
1618
|
-
table.add(s + c);
|
|
1619
|
-
}
|
|
1620
|
-
s = c;
|
|
1621
|
-
}
|
|
1622
|
-
}
|
|
1623
|
-
bitOut.write(table.indexOf(s), bitLength);
|
|
1624
|
-
bitOut.write(endCode, bitLength);
|
|
1625
|
-
bitOut.flush();
|
|
1626
|
-
return byteOut.toByteArray();
|
|
1627
|
-
}, "getLZWRaster");
|
|
1628
|
-
const lzwTable = /* @__PURE__ */ __name(function() {
|
|
1629
|
-
const _map = {};
|
|
1630
|
-
let _size = 0;
|
|
1631
|
-
const _this2 = {};
|
|
1632
|
-
_this2.add = function(key) {
|
|
1633
|
-
if (_this2.contains(key)) {
|
|
1634
|
-
throw "dup key:" + key;
|
|
1635
|
-
}
|
|
1636
|
-
_map[key] = _size;
|
|
1637
|
-
_size += 1;
|
|
1638
|
-
};
|
|
1639
|
-
_this2.size = function() {
|
|
1640
|
-
return _size;
|
|
1641
|
-
};
|
|
1642
|
-
_this2.indexOf = function(key) {
|
|
1643
|
-
return _map[key];
|
|
1644
|
-
};
|
|
1645
|
-
_this2.contains = function(key) {
|
|
1646
|
-
return typeof _map[key] != "undefined";
|
|
1647
|
-
};
|
|
1648
|
-
return _this2;
|
|
1649
|
-
}, "lzwTable");
|
|
1650
|
-
return _this;
|
|
1651
|
-
}, "gifImage");
|
|
1652
|
-
var createDataURL = /* @__PURE__ */ __name(function(width, height, getPixel) {
|
|
1653
|
-
const gif = gifImage(width, height);
|
|
1654
|
-
for (let y = 0; y < height; y += 1) {
|
|
1655
|
-
for (let x = 0; x < width; x += 1) {
|
|
1656
|
-
gif.setPixel(x, y, getPixel(x, y));
|
|
1657
|
-
}
|
|
1658
|
-
}
|
|
1659
|
-
const b = byteArrayOutputStream();
|
|
1660
|
-
gif.write(b);
|
|
1661
|
-
const base64 = base64EncodeOutputStream();
|
|
1662
|
-
const bytes = b.toByteArray();
|
|
1663
|
-
for (let i = 0; i < bytes.length; i += 1) {
|
|
1664
|
-
base64.writeByte(bytes[i]);
|
|
1665
|
-
}
|
|
1666
|
-
base64.flush();
|
|
1667
|
-
return "data:image/gif;base64," + base64;
|
|
1668
|
-
}, "createDataURL");
|
|
1669
|
-
var stringToBytes = qrcode.stringToBytes;
|
|
1670
|
-
|
|
1671
|
-
// dist/output.js
|
|
1672
|
-
var snakeKeys = snakeKeysKeeping(["front_matter", "metadata", "headers"]);
|
|
1673
|
-
var atDetail = /* @__PURE__ */ __name((value, level) => {
|
|
1674
|
-
let picked = "";
|
|
1675
|
-
resolveOutput({
|
|
1676
|
-
json: true,
|
|
1677
|
-
streams: { data: /* @__PURE__ */ __name((chunk) => picked += chunk, "data"), diagnostic: /* @__PURE__ */ __name(() => void 0, "diagnostic"), progress: /* @__PURE__ */ __name(() => void 0, "progress") },
|
|
1678
|
-
...level === void 0 ? {} : { hitDetail: level }
|
|
1679
|
-
}).renderer.result(value);
|
|
1680
|
-
return JSON.parse(picked);
|
|
1681
|
-
}, "atDetail");
|
|
1682
|
-
|
|
1683
|
-
// dist/rows.js
|
|
1684
|
-
var sender = { field: ["sender_is_me", "sender_name"], tag: "me" };
|
|
1685
|
-
var fact = {
|
|
1686
|
-
columns: [
|
|
1687
|
-
{ field: "ref" },
|
|
1688
|
-
{ field: "kind" },
|
|
1689
|
-
{ field: "status" },
|
|
1690
|
-
{ field: "subject_name" },
|
|
1691
|
-
{ field: "project_name" },
|
|
1692
|
-
{ field: ["occurred_at", "created_at"], as: "day" }
|
|
1693
|
-
],
|
|
1694
|
-
text: ["text"]
|
|
1695
|
-
};
|
|
1696
|
-
var ROWS = {
|
|
1697
|
-
"search all": {
|
|
1698
|
-
columns: [{ field: "ref" }, { field: "kind" }, { field: "timestamp", as: "time" }, { field: "title" }, sender],
|
|
1699
|
-
text: ["excerpt"]
|
|
1700
|
-
},
|
|
1701
|
-
"search notes": {
|
|
1702
|
-
columns: [{ field: "ref" }, { field: "updated_at", as: "day" }, { field: ["title", "path"] }],
|
|
1703
|
-
text: ["excerpt"]
|
|
1704
|
-
},
|
|
1705
|
-
"search memories": fact,
|
|
1706
|
-
"search people": { columns: [{ field: "ref" }, { field: "name" }] },
|
|
1707
|
-
"notes list": {
|
|
1708
|
-
columns: [
|
|
1709
|
-
{ field: "ref" },
|
|
1710
|
-
{ field: "updated_at", as: "day" },
|
|
1711
|
-
{ field: "source" },
|
|
1712
|
-
{ field: ["title", "path"] },
|
|
1713
|
-
{ field: "via" }
|
|
1714
|
-
],
|
|
1715
|
-
text: ["text"]
|
|
1716
|
-
},
|
|
1717
|
-
"facts list": fact,
|
|
1718
|
-
"invoices list": {
|
|
1719
|
-
columns: [{ field: "ref" }, { field: "project_name" }, { field: ["issue_date", "created_at"], as: "day" }],
|
|
1720
|
-
text: ["title"]
|
|
1721
|
-
},
|
|
1722
|
-
"payments list": {
|
|
1723
|
-
columns: [{ field: "ref" }, { field: "project_name" }, { field: "date", as: "day" }],
|
|
1724
|
-
text: ["title"]
|
|
1725
|
-
},
|
|
1726
|
-
"deals list": {
|
|
1727
|
-
columns: [{ field: "ref" }, { field: "project_name" }, { field: "close_date", as: "day" }],
|
|
1728
|
-
text: ["summary"]
|
|
1729
|
-
},
|
|
1730
|
-
"leads list": {
|
|
1731
|
-
columns: [{ field: "ref" }, { field: "project_name" }, { field: "created_at", as: "day" }],
|
|
1732
|
-
text: ["summary"]
|
|
1733
|
-
},
|
|
1734
|
-
"memories list": fact,
|
|
1735
|
-
"people list": {
|
|
1736
|
-
columns: [
|
|
1737
|
-
{ field: "ref" },
|
|
1738
|
-
{ field: "name" },
|
|
1739
|
-
{ field: "owner", tag: "owner" },
|
|
1740
|
-
{ field: "tasks", as: "count", tag: "tasks" }
|
|
1741
|
-
]
|
|
1742
|
-
},
|
|
1743
|
-
"organizations list": { columns: [{ field: "ref" }, { field: "name" }, { field: "kind" }] },
|
|
1744
|
-
"projects list": { columns: [{ field: "ref" }, { field: "key" }, { field: "name" }, { field: "kind" }] },
|
|
1745
|
-
"relationships list": {
|
|
1746
|
-
columns: [
|
|
1747
|
-
{ field: "id" },
|
|
1748
|
-
{ field: "from" },
|
|
1749
|
-
{ field: "kind" },
|
|
1750
|
-
{ field: "to" },
|
|
1751
|
-
{ field: "role" },
|
|
1752
|
-
{ field: "purpose" },
|
|
1753
|
-
{ field: "confirmed", tag: "confirmed" }
|
|
1754
|
-
]
|
|
1755
|
-
},
|
|
1756
|
-
"tasks list": {
|
|
1757
|
-
columns: [
|
|
1758
|
-
{ field: ["key", "ref", "id"] },
|
|
1759
|
-
{ field: "state" },
|
|
1760
|
-
{ field: "kind" },
|
|
1761
|
-
{ field: "priority_label" },
|
|
1762
|
-
{ field: "project_key" },
|
|
1763
|
-
{ field: "due_at", as: "day" },
|
|
1764
|
-
{ field: "source" }
|
|
1765
|
-
],
|
|
1766
|
-
text: ["title", "message.text"]
|
|
1767
|
-
},
|
|
1768
|
-
"messages show": {
|
|
1769
|
-
columns: [
|
|
1770
|
-
{ field: "ref" },
|
|
1771
|
-
{ field: ["timestamp", "date"], as: "time" },
|
|
1772
|
-
{ field: "chat_title" },
|
|
1773
|
-
{ field: ["from", "sender_is_me", "sender_name"], tag: "me" },
|
|
1774
|
-
{ field: "subject" },
|
|
1775
|
-
{ field: "attachments", as: "files" }
|
|
1776
|
-
],
|
|
1777
|
-
text: ["text", "excerpt"]
|
|
1778
|
-
},
|
|
1779
|
-
"projects evidence": {
|
|
1780
|
-
columns: [{ field: "project_ref" }],
|
|
1781
|
-
sections: { items: "memo_evidence_item", people: "memo_evidence_person", linked_chats: "linked_chat" }
|
|
1782
|
-
},
|
|
1783
|
-
show: {
|
|
1784
|
-
columns: [{ field: "ref" }, { field: "kind" }, { field: "state" }, { field: "title" }, { field: "open.line" }]
|
|
1785
|
-
}
|
|
1786
|
-
};
|
|
1787
|
-
var SECTION_ROWS = {
|
|
1788
|
-
memo_evidence_item: {
|
|
1789
|
-
columns: [{ field: "ref" }, { field: "context" }, { field: "kind" }, { field: "title" }],
|
|
1790
|
-
text: ["text"]
|
|
1791
|
-
},
|
|
1792
|
-
memo_finance: {
|
|
1793
|
-
columns: [
|
|
1794
|
-
{ field: "direction" },
|
|
1795
|
-
{ field: "currency" },
|
|
1796
|
-
{ field: "billed" },
|
|
1797
|
-
{ field: "paid" },
|
|
1798
|
-
{ field: "owed" },
|
|
1799
|
-
{ field: "invoices", as: "count", tag: "invoices" },
|
|
1800
|
-
{ field: "payments", as: "count", tag: "payments" }
|
|
1801
|
-
]
|
|
1802
|
-
},
|
|
1803
|
-
memo_deal: {
|
|
1804
|
-
columns: [
|
|
1805
|
-
{ field: "ref" },
|
|
1806
|
-
{ field: "stage" },
|
|
1807
|
-
{ field: "amount" },
|
|
1808
|
-
{ field: "currency" },
|
|
1809
|
-
{ field: "close_date", as: "day" }
|
|
1810
|
-
],
|
|
1811
|
-
text: ["title"]
|
|
1812
|
-
},
|
|
1813
|
-
memo_evidence_person: {
|
|
1814
|
-
columns: [{ field: "person" }, { field: "name" }, { field: "items", as: "count", tag: "items" }]
|
|
1815
|
-
}
|
|
1816
|
-
};
|
|
1817
|
-
var shared = rowsOfEntity();
|
|
1818
|
-
var sectionRowOf = /* @__PURE__ */ __name((entity) => SECTION_ROWS[entity] ?? shared(entity), "sectionRowOf");
|
|
1819
|
-
var pathOf = /* @__PURE__ */ __name((command) => {
|
|
1820
|
-
const words = [];
|
|
1821
|
-
for (let at = command; at?.parent; at = at.parent)
|
|
1822
|
-
words.unshift(at.name());
|
|
1823
|
-
return words.join(" ");
|
|
1824
|
-
}, "pathOf");
|
|
1825
|
-
var rowOf = /* @__PURE__ */ __name((command) => command && ROWS[pathOf(command)] || rowShapeOf(command), "rowOf");
|
|
1826
|
-
|
|
1827
|
-
// dist/answer.js
|
|
1828
|
-
var itemAnswer = /* @__PURE__ */ __name((value, extra) => itemOf(snakeKeys(value), extra), "itemAnswer");
|
|
1829
|
-
var listAnswer = /* @__PURE__ */ __name((command, input) => {
|
|
1830
|
-
const body = listOf(command, { ...input, items: snakeKeys(input.items) });
|
|
1831
|
-
if (input.cursor !== void 0 || input.page !== void 0)
|
|
1832
|
-
return body;
|
|
1833
|
-
if (body.page.mode === "page")
|
|
1834
|
-
delete body.page.next_page;
|
|
1835
|
-
const next = body.next?.filter(({ step }) => step !== "page.next") ?? [];
|
|
1836
|
-
if (next.length > 0)
|
|
1837
|
-
body.next = next;
|
|
1838
|
-
else
|
|
1839
|
-
delete body.next;
|
|
1840
|
-
return body;
|
|
1841
|
-
}, "listAnswer");
|
|
1842
|
-
var wholeList = /* @__PURE__ */ __name((command, items) => listAnswer(command, { items, limit: Math.max(1, items.length), has_more: false }), "wholeList");
|
|
1843
|
-
var withStore = /* @__PURE__ */ __name(async (env, work) => {
|
|
1844
|
-
const store = await openStore({ env, ...STORE_CLIENT, decisions: decisionPolicy(env) });
|
|
1845
|
-
try {
|
|
1846
|
-
return await work(store);
|
|
1847
|
-
} finally {
|
|
1848
|
-
await store.close();
|
|
1849
|
-
}
|
|
1850
|
-
}, "withStore");
|
|
1851
|
-
var running = /* @__PURE__ */ new WeakMap();
|
|
1852
|
-
var timezone = /* @__PURE__ */ __name(() => Intl.DateTimeFormat().resolvedOptions().timeZone, "timezone");
|
|
1853
|
-
var plainText = /* @__PURE__ */ __name((body, command) => {
|
|
1854
|
-
const { next: _, ...rest } = body;
|
|
1855
|
-
return compactText(rest, rowOf(command), { timezone: timezone() }, sectionRowOf);
|
|
1856
|
-
}, "plainText");
|
|
1857
|
-
var compactView = /* @__PURE__ */ __name((command, full) => (kept) => {
|
|
1858
|
-
const whole = sealed(kept);
|
|
1859
|
-
const next = whole.next?.map((step) => step.kind === "command" && step.line ? { ...step, line: `${step.line} ${COMPACT_FLAG}` } : step);
|
|
1860
|
-
return compactText(next ? { ...whole, next } : whole, rowOf(command), {
|
|
1861
|
-
timezone: timezone(),
|
|
1862
|
-
...full ? { textChars: 0 } : {}
|
|
1863
|
-
}, sectionRowOf);
|
|
1864
|
-
}, "compactView");
|
|
1865
|
-
var trackAnswers = /* @__PURE__ */ __name((program) => {
|
|
1866
|
-
currentRun();
|
|
1867
|
-
program.option(COMPACT_FLAG, "one line per item for an agent: reference first, text last, paging and next steps as # lines").hook("preAction", (root, leaf) => {
|
|
1868
|
-
const { compact, json, brief } = leaf.optsWithGlobals();
|
|
1869
|
-
if (compact && (json || brief))
|
|
1870
|
-
throw new CliError("validation_error", `${COMPACT_FLAG} and ${json ? "--json" : "--brief"} are two forms \u2014 pick one`);
|
|
1871
|
-
running.set(root, leaf);
|
|
1872
|
-
});
|
|
1873
|
-
}, "trackAnswers");
|
|
1874
|
-
var answers = /* @__PURE__ */ __name((program, streams, env) => {
|
|
1875
|
-
const print = /* @__PURE__ */ __name((json, body, text, asked) => {
|
|
1876
|
-
const format = json ? "json" : "pretty";
|
|
1877
|
-
const root = rootOf(program);
|
|
1878
|
-
const leaf = running.get(root) ?? root;
|
|
1879
|
-
const { compact = asked, full } = leaf.optsWithGlobals();
|
|
1880
|
-
const renderer = createRenderer({ format, color: false, streams });
|
|
1881
|
-
const drawn = compact === true && !json;
|
|
1882
|
-
renderAnswer(leaf, { renderer: drawn ? { ...renderer, note: /* @__PURE__ */ __name(() => void 0, "note") } : renderer, format, streams }, body, drawn ? compactView(leaf, full === true) : () => `${text ?? plainText(body, leaf)}
|
|
1883
|
-
`);
|
|
1884
|
-
}, "print");
|
|
1885
|
-
return {
|
|
1886
|
-
print,
|
|
1887
|
-
run: /* @__PURE__ */ __name(async (json, work) => print(json, await withStore(env, work)), "run")
|
|
1888
|
-
};
|
|
1889
|
-
}, "answers");
|
|
1890
|
-
|
|
1891
|
-
export {
|
|
1892
|
-
atDetail,
|
|
1893
|
-
itemAnswer,
|
|
1894
|
-
listAnswer,
|
|
1895
|
-
wholeList,
|
|
1896
|
-
withStore,
|
|
1897
|
-
plainText,
|
|
1898
|
-
trackAnswers,
|
|
1899
|
-
answers
|
|
1900
|
-
};
|