@wirecat/hubspot-cli 0.0.0-stage → 0.1.0
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/CHANGELOG.md +29 -0
- package/LICENSE +204 -0
- package/README.md +256 -2
- package/contracts/wirecat.json +1965 -0
- package/dist/bin/hubspot.d.ts +3 -0
- package/dist/bin/hubspot.d.ts.map +1 -0
- package/dist/bin/hubspot.js +40 -0
- package/dist/bin/hubspot.js.map +1 -0
- package/dist/bundle/all-profiles-64JAUYW4.js +279 -0
- package/dist/bundle/anthropic-VJOS4OUM.js +91 -0
- package/dist/bundle/app-server-422MCA7S.js +245 -0
- package/dist/bundle/bun-M3J2QTR3.js +169 -0
- package/dist/bundle/bun-sqlite-IX3XYA5F.js +76 -0
- package/dist/bundle/chunk-24ERVFJP.js +73 -0
- package/dist/bundle/chunk-2QZK5BEP.js +392 -0
- package/dist/bundle/chunk-2TWQIWWG.js +1328 -0
- package/dist/bundle/chunk-2VGD63G6.js +604 -0
- package/dist/bundle/chunk-2VGZRYEH.js +334 -0
- package/dist/bundle/chunk-36ITRDYY.js +63116 -0
- package/dist/bundle/chunk-43EKCUBJ.js +72 -0
- package/dist/bundle/chunk-4W6BMH45.js +731 -0
- package/dist/bundle/chunk-5A6ZYNAQ.js +2003 -0
- package/dist/bundle/chunk-5D4AEUVA.js +24783 -0
- package/dist/bundle/chunk-5GBUCHRU.js +274 -0
- package/dist/bundle/chunk-5K7QLJMM.js +4072 -0
- package/dist/bundle/chunk-65TWQ7BV.js +54 -0
- package/dist/bundle/chunk-7ELMWE3P.js +12066 -0
- package/dist/bundle/chunk-ADLS6FVG.js +24600 -0
- package/dist/bundle/chunk-B3MANLNK.js +602 -0
- package/dist/bundle/chunk-BKXDHU3G.js +1395 -0
- package/dist/bundle/chunk-C32AKHTY.js +2310 -0
- package/dist/bundle/chunk-CLAN3FES.js +1246 -0
- package/dist/bundle/chunk-CWXOXIWS.js +46 -0
- package/dist/bundle/chunk-D72URWJE.js +532 -0
- package/dist/bundle/chunk-DB2XKHI4.js +72 -0
- package/dist/bundle/chunk-DBEQI5YM.js +100 -0
- package/dist/bundle/chunk-DFCHHR5M.js +38 -0
- package/dist/bundle/chunk-DFDN6AUB.js +21 -0
- package/dist/bundle/chunk-DRWWJLI6.js +188 -0
- package/dist/bundle/chunk-DSP36YHQ.js +29 -0
- package/dist/bundle/chunk-E52JAS35.js +1028 -0
- package/dist/bundle/chunk-E5WLE7BM.js +78 -0
- package/dist/bundle/chunk-ECEZOLOD.js +230 -0
- package/dist/bundle/chunk-EH6ZEJGT.js +932 -0
- package/dist/bundle/chunk-FBCCBCFH.js +288 -0
- package/dist/bundle/chunk-FKA7DOCK.js +53 -0
- package/dist/bundle/chunk-FOZYMDRL.js +259 -0
- package/dist/bundle/chunk-FPUGMDJV.js +7 -0
- package/dist/bundle/chunk-FTFV3HFW.js +721 -0
- package/dist/bundle/chunk-H3TNVEQX.js +782 -0
- package/dist/bundle/chunk-HC5ZWE5X.js +193 -0
- package/dist/bundle/chunk-HCAZV5NP.js +95 -0
- package/dist/bundle/chunk-HTAN663T.js +4045 -0
- package/dist/bundle/chunk-HZRQLAHO.js +16 -0
- package/dist/bundle/chunk-IMJQRPLN.js +92 -0
- package/dist/bundle/chunk-JLDBMEKZ.js +106 -0
- package/dist/bundle/chunk-JRCPCVPI.js +9393 -0
- package/dist/bundle/chunk-LNV33FDC.js +786 -0
- package/dist/bundle/chunk-LOBVOGOE.js +66 -0
- package/dist/bundle/chunk-MVA5HVKL.js +1392 -0
- package/dist/bundle/chunk-N2XADGL4.js +76 -0
- package/dist/bundle/chunk-NHHJHXMQ.js +58 -0
- package/dist/bundle/chunk-NUU4WZVL.js +52 -0
- package/dist/bundle/chunk-NWHEHV3K.js +133 -0
- package/dist/bundle/chunk-NXERIDPJ.js +319 -0
- package/dist/bundle/chunk-O3DYRCIT.js +23 -0
- package/dist/bundle/chunk-O55RWNSH.js +161 -0
- package/dist/bundle/chunk-P5BHKKBI.js +206 -0
- package/dist/bundle/chunk-PPHBRESD.js +82 -0
- package/dist/bundle/chunk-PVKF24ZW.js +364 -0
- package/dist/bundle/chunk-QGFX5MXL.js +460 -0
- package/dist/bundle/chunk-QJW35N5V.js +761 -0
- package/dist/bundle/chunk-QU25DA5N.js +360 -0
- package/dist/bundle/chunk-RMIYKDUL.js +1068 -0
- package/dist/bundle/chunk-RR5MX5TM.js +142 -0
- package/dist/bundle/chunk-SAKK2YRU.js +218 -0
- package/dist/bundle/chunk-SDQGB4KB.js +185 -0
- package/dist/bundle/chunk-TBJYLC5K.js +2788 -0
- package/dist/bundle/chunk-TI46WQXQ.js +1197 -0
- package/dist/bundle/chunk-TKVL2C3B.js +170 -0
- package/dist/bundle/chunk-TOSCB4SO.js +1227 -0
- package/dist/bundle/chunk-TP7GDWVF.js +6848 -0
- package/dist/bundle/chunk-UUMUL4L3.js +72 -0
- package/dist/bundle/chunk-VIEYMDBR.js +41 -0
- package/dist/bundle/chunk-W53EJOFQ.js +63 -0
- package/dist/bundle/chunk-W7HM2VGO.js +24 -0
- package/dist/bundle/chunk-WE4UFASG.js +88 -0
- package/dist/bundle/chunk-WQBX7XYP.js +26174 -0
- package/dist/bundle/chunk-X2M6NIQG.js +18 -0
- package/dist/bundle/chunk-X7XUX7A4.js +1846 -0
- package/dist/bundle/chunk-XRREFEIW.js +372 -0
- package/dist/bundle/chunk-Y5E2WNWB.js +35 -0
- package/dist/bundle/chunk-ZBDSHFG4.js +40933 -0
- package/dist/bundle/chunk-ZVVMGPBJ.js +50 -0
- package/dist/bundle/command-contract-C6CBFXZF.js +40 -0
- package/dist/bundle/command-server-entry-DJKVVZCQ.js +169 -0
- package/dist/bundle/decode-FC65Y4IV.js +297 -0
- package/dist/bundle/definitions-MVPICAWV.js +2991 -0
- package/dist/bundle/dispatch-KOISQ5QJ.js +411 -0
- package/dist/bundle/dist-MYZZKZJ7.js +7577 -0
- package/dist/bundle/echarts-FVTUDXDU.js +42501 -0
- package/dist/bundle/embed-VNBZFPYH.js +38 -0
- package/dist/bundle/embedder-6U4NOFRO.js +111 -0
- package/dist/bundle/failure-FZ6VYKEQ.js +25 -0
- package/dist/bundle/first-run-RPIJZEDT.js +29 -0
- package/dist/bundle/first-screen-RTVMGHAE.js +40 -0
- package/dist/bundle/hubspot.js +198 -0
- package/dist/bundle/instructions-HET7BCYK.js +11 -0
- package/dist/bundle/mcp-RGNRW77S.js +167 -0
- package/dist/bundle/meeting-combined-L5AGBPYX.js +25 -0
- package/dist/bundle/meeting-model-NTB4RK3F.js +25 -0
- package/dist/bundle/meeting-semantic-JY3OGCBS.js +22 -0
- package/dist/bundle/node-CXZIFHZC.js +176 -0
- package/dist/bundle/node-P4E63KXA.js +2340 -0
- package/dist/bundle/node-TLZSIHIJ.js +21 -0
- package/dist/bundle/node-sqlite-P3O7XN7Q.js +74 -0
- package/dist/bundle/oauth-HNCY4B2S.js +20 -0
- package/dist/bundle/open-F4P6YV54.js +23 -0
- package/dist/bundle/openai-4AICLIK3.js +238 -0
- package/dist/bundle/process-5RUXWGYS.js +91 -0
- package/dist/bundle/program-POG5GHUQ.js +9241 -0
- package/dist/bundle/prompt-NFMDVBZ4.js +17 -0
- package/dist/bundle/recognize-DKN3RY4V.js +26 -0
- package/dist/bundle/remote-6QHAGQWY.js +31 -0
- package/dist/bundle/rerank-M4KHEHUZ.js +52 -0
- package/dist/bundle/schemas-JRL3DLMP.js +952 -0
- package/dist/bundle/serve-DNU43ND6.js +199 -0
- package/dist/bundle/server-C3ZHA7AZ.js +77 -0
- package/dist/bundle/server-XJSNF3K5.js +207 -0
- package/dist/bundle/source-A3SBLHC4.js +934 -0
- package/dist/bundle/sqlite-runtime-EMQAC63N.js +20 -0
- package/dist/bundle/state-T45CX7VY.js +36 -0
- package/dist/bundle/store-6LCEVBAZ.js +176 -0
- package/dist/bundle/store-6TZ2FCVA.js +295 -0
- package/dist/bundle/store-CCDNUB6A.js +32 -0
- package/dist/bundle/store-maintenance-command-BRCG6MNA.js +68 -0
- package/dist/commands/account.d.ts +3 -0
- package/dist/commands/account.d.ts.map +1 -0
- package/dist/commands/account.js +87 -0
- package/dist/commands/account.js.map +1 -0
- package/dist/commands/api.d.ts +9 -0
- package/dist/commands/api.d.ts.map +1 -0
- package/dist/commands/api.js +65 -0
- package/dist/commands/api.js.map +1 -0
- package/dist/commands/comments.d.ts +3 -0
- package/dist/commands/comments.d.ts.map +1 -0
- package/dist/commands/comments.js +114 -0
- package/dist/commands/comments.js.map +1 -0
- package/dist/commands/crm-shared.d.ts +8 -0
- package/dist/commands/crm-shared.d.ts.map +1 -0
- package/dist/commands/crm-shared.js +93 -0
- package/dist/commands/crm-shared.js.map +1 -0
- package/dist/commands/schedule.d.ts +3 -0
- package/dist/commands/schedule.d.ts.map +1 -0
- package/dist/commands/schedule.js +9 -0
- package/dist/commands/schedule.js.map +1 -0
- package/dist/commands/session.d.ts +14 -0
- package/dist/commands/session.d.ts.map +1 -0
- package/dist/commands/session.js +164 -0
- package/dist/commands/session.js.map +1 -0
- package/dist/config.d.ts +22 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +28 -0
- package/dist/config.js.map +1 -0
- package/dist/context.d.ts +88 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +137 -0
- package/dist/context.js.map +1 -0
- package/dist/crm/activities.d.ts +24 -0
- package/dist/crm/activities.d.ts.map +1 -0
- package/dist/crm/activities.js +214 -0
- package/dist/crm/activities.js.map +1 -0
- package/dist/crm/associations.d.ts +20 -0
- package/dist/crm/associations.d.ts.map +1 -0
- package/dist/crm/associations.js +47 -0
- package/dist/crm/associations.js.map +1 -0
- package/dist/crm/records.d.ts +63 -0
- package/dist/crm/records.d.ts.map +1 -0
- package/dist/crm/records.js +333 -0
- package/dist/crm/records.js.map +1 -0
- package/dist/crm/search.d.ts +57 -0
- package/dist/crm/search.d.ts.map +1 -0
- package/dist/crm/search.js +47 -0
- package/dist/crm/search.js.map +1 -0
- package/dist/crm/source.d.ts +32 -0
- package/dist/crm/source.d.ts.map +1 -0
- package/dist/crm/source.js +369 -0
- package/dist/crm/source.js.map +1 -0
- package/dist/generated/definitions.d.ts +3 -0
- package/dist/generated/definitions.d.ts.map +1 -0
- package/dist/generated/definitions.js +2987 -0
- package/dist/generated/definitions.js.map +1 -0
- package/dist/generated/manifest.d.ts +6 -0
- package/dist/generated/manifest.d.ts.map +1 -0
- package/dist/generated/manifest.js +6499 -0
- package/dist/generated/manifest.js.map +1 -0
- package/dist/generated/schemas.d.ts +205 -0
- package/dist/generated/schemas.d.ts.map +1 -0
- package/dist/generated/schemas.js +810 -0
- package/dist/generated/schemas.js.map +1 -0
- package/dist/generated/types.d.ts +1114 -0
- package/dist/generated/types.d.ts.map +1 -0
- package/dist/generated/types.js +5 -0
- package/dist/generated/types.js.map +1 -0
- package/dist/hubspot/account.d.ts +12 -0
- package/dist/hubspot/account.d.ts.map +1 -0
- package/dist/hubspot/account.js +23 -0
- package/dist/hubspot/account.js.map +1 -0
- package/dist/hubspot/transport.d.ts +76 -0
- package/dist/hubspot/transport.d.ts.map +1 -0
- package/dist/hubspot/transport.js +346 -0
- package/dist/hubspot/transport.js.map +1 -0
- package/dist/identity.d.ts +7 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +32 -0
- package/dist/identity.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/program.d.ts +6 -0
- package/dist/program.d.ts.map +1 -0
- package/dist/program.js +77 -0
- package/dist/program.js.map +1 -0
- package/dist/reasons.d.ts +10 -0
- package/dist/reasons.d.ts.map +1 -0
- package/dist/reasons.js +33 -0
- package/dist/reasons.js.map +1 -0
- package/dist/sample/comments.d.ts +61 -0
- package/dist/sample/comments.d.ts.map +1 -0
- package/dist/sample/comments.js +39 -0
- package/dist/sample/comments.js.map +1 -0
- package/dist/sample/records.d.ts +16 -0
- package/dist/sample/records.d.ts.map +1 -0
- package/dist/sample/records.js +22 -0
- package/dist/sample/records.js.map +1 -0
- package/dist/sample/transport.d.ts +42 -0
- package/dist/sample/transport.d.ts.map +1 -0
- package/dist/sample/transport.js +153 -0
- package/dist/sample/transport.js.map +1 -0
- package/dist/setup/flow.d.ts +2 -0
- package/dist/setup/flow.d.ts.map +1 -0
- package/dist/setup/flow.js +97 -0
- package/dist/setup/flow.js.map +1 -0
- package/dist/setup/texts.en.json +19 -0
- package/dist/setup/texts.es.json +19 -0
- package/dist/setup/texts.ru.json +19 -0
- package/dist/store.d.ts +16 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.js +34 -0
- package/dist/store.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +2 -0
- package/dist/version.js.map +1 -0
- package/dist/wcat.d.ts +3 -0
- package/dist/wcat.d.ts.map +1 -0
- package/dist/wcat.js +4 -0
- package/dist/wcat.js.map +1 -0
- package/dist/whoami.d.ts +19 -0
- package/dist/whoami.d.ts.map +1 -0
- package/dist/whoami.js +15 -0
- package/dist/whoami.js.map +1 -0
- package/package.json +98 -4
- package/skills/hubspot-cli/SKILL.md +97 -0
- package/skills/hubspot-cli/references/api/api-basic.md +462 -0
- package/skills/hubspot-cli/references/api/api-batch.md +149 -0
- package/skills/hubspot-cli/references/api/api-search.md +147 -0
- package/skills/hubspot-cli/references/api.md +15 -0
|
@@ -0,0 +1,1846 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
REASONS
|
|
5
|
+
} from "./chunk-H3TNVEQX.js";
|
|
6
|
+
import {
|
|
7
|
+
RECORD_TYPES
|
|
8
|
+
} from "./chunk-5A6ZYNAQ.js";
|
|
9
|
+
import {
|
|
10
|
+
parseReference
|
|
11
|
+
} from "./chunk-QJW35N5V.js";
|
|
12
|
+
import {
|
|
13
|
+
defineReasons
|
|
14
|
+
} from "./chunk-TOSCB4SO.js";
|
|
15
|
+
import {
|
|
16
|
+
__name
|
|
17
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
18
|
+
|
|
19
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/domain/links.js
|
|
20
|
+
var LINK_VERSION = "v1";
|
|
21
|
+
var DEFAULT_LINK_CONFIG = { base: "https://wirecat.dev/o", enabled: true };
|
|
22
|
+
var APP_PREFIX = "wirecat://open";
|
|
23
|
+
var MAX_PATH = 512;
|
|
24
|
+
var MAX_SEGMENTS = 6;
|
|
25
|
+
var TASK_FILTERS = ["overdue", "today", "tomorrow", "undated"];
|
|
26
|
+
var DATE = /^\d{4}-\d{2}-\d{2}$/;
|
|
27
|
+
var DATE_TIME = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:\d{2})$/;
|
|
28
|
+
var isMoment = /* @__PURE__ */ __name((text, pattern) => pattern.test(text) && !Number.isNaN(Date.parse(text)), "isMoment");
|
|
29
|
+
var partsOf = /* @__PURE__ */ __name((target) => {
|
|
30
|
+
switch (target.type) {
|
|
31
|
+
case "message":
|
|
32
|
+
return ["msg", target.provider, target.account, target.chat, target.message];
|
|
33
|
+
case "chat":
|
|
34
|
+
return ["chat", target.provider, target.account, target.chat];
|
|
35
|
+
case "task":
|
|
36
|
+
case "person":
|
|
37
|
+
case "project":
|
|
38
|
+
return [target.type, target.id];
|
|
39
|
+
case "tasks":
|
|
40
|
+
return target.filter === "new" ? ["tasks", "new", target.since] : ["tasks", target.filter];
|
|
41
|
+
case "proposal":
|
|
42
|
+
return ["proposal", target.id];
|
|
43
|
+
case "digest":
|
|
44
|
+
return ["digest", target.date];
|
|
45
|
+
case "sync":
|
|
46
|
+
return target.account === void 0 ? ["sync", target.tool] : ["sync", target.tool, target.account];
|
|
47
|
+
case "meeting":
|
|
48
|
+
return ["meeting", target.provider, target.account, target.meeting];
|
|
49
|
+
}
|
|
50
|
+
}, "partsOf");
|
|
51
|
+
var pathOf = /* @__PURE__ */ __name((target) => partsOf(target).map(encodeURIComponent).join("/"), "pathOf");
|
|
52
|
+
var targetOfParts = /* @__PURE__ */ __name((parts) => {
|
|
53
|
+
const [kind, ...rest] = parts;
|
|
54
|
+
const [a = "", b = "", c = "", d = ""] = rest;
|
|
55
|
+
switch (kind) {
|
|
56
|
+
case "msg":
|
|
57
|
+
return rest.length === 4 ? { type: "message", provider: a, account: b, chat: c, message: d } : null;
|
|
58
|
+
case "chat":
|
|
59
|
+
return rest.length === 3 ? { type: "chat", provider: a, account: b, chat: c } : null;
|
|
60
|
+
case "task":
|
|
61
|
+
case "person":
|
|
62
|
+
case "project":
|
|
63
|
+
return rest.length === 1 ? { type: kind, id: a } : null;
|
|
64
|
+
case "tasks":
|
|
65
|
+
if (rest.length === 1 && TASK_FILTERS.includes(a))
|
|
66
|
+
return { type: "tasks", filter: a };
|
|
67
|
+
return rest.length === 2 && a === "new" && (isMoment(b, DATE) || isMoment(b, DATE_TIME)) ? { type: "tasks", filter: "new", since: b } : null;
|
|
68
|
+
case "proposal":
|
|
69
|
+
return rest.length === 1 ? { type: "proposal", id: a } : null;
|
|
70
|
+
case "digest":
|
|
71
|
+
return rest.length === 1 && isMoment(a, DATE) ? { type: "digest", date: a } : null;
|
|
72
|
+
case "sync":
|
|
73
|
+
return rest.length === 1 || rest.length === 2 ? { type: "sync", tool: a, ...rest.length === 2 ? { account: b } : {} } : null;
|
|
74
|
+
case "meeting":
|
|
75
|
+
return rest.length === 3 ? { type: "meeting", provider: a, account: b, meeting: c } : null;
|
|
76
|
+
default:
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
}, "targetOfParts");
|
|
80
|
+
var targetOfPath = /* @__PURE__ */ __name((path) => {
|
|
81
|
+
const raw = path.split("/");
|
|
82
|
+
if (raw.some((part) => part === ""))
|
|
83
|
+
return null;
|
|
84
|
+
try {
|
|
85
|
+
return targetOfParts(raw.map(decodeURIComponent));
|
|
86
|
+
} catch {
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
}, "targetOfPath");
|
|
90
|
+
var formatLink = /* @__PURE__ */ __name((target) => `/${LINK_VERSION}/${pathOf(target)}`, "formatLink");
|
|
91
|
+
var parseLink = /* @__PURE__ */ __name((text) => {
|
|
92
|
+
const link = text.trim();
|
|
93
|
+
const path = link.startsWith(`${APP_PREFIX}/`) ? link.slice(APP_PREFIX.length) : link.startsWith("https://") && link.includes("#") ? link.slice(link.indexOf("#") + 1) : link;
|
|
94
|
+
if (path.length > MAX_PATH || !path.startsWith(`/${LINK_VERSION}/`))
|
|
95
|
+
return null;
|
|
96
|
+
const rest = path.split("?")[0].slice(LINK_VERSION.length + 2);
|
|
97
|
+
if (rest.split("/").length + 1 > MAX_SEGMENTS)
|
|
98
|
+
return null;
|
|
99
|
+
return targetOfPath(rest);
|
|
100
|
+
}, "parseLink");
|
|
101
|
+
var LINK_ONLY = /* @__PURE__ */ new Set(["tasks", "proposal", "digest", "sync"]);
|
|
102
|
+
var FROM_REFERENCE = /* @__PURE__ */ new Set(["message", "chat", "task", "person", "project"]);
|
|
103
|
+
var ENTITY_KINDS = /* @__PURE__ */ new Set(["person", "project"]);
|
|
104
|
+
var refsForLink = /* @__PURE__ */ __name((refs) => [
|
|
105
|
+
...refs.filter((ref) => !ENTITY_KINDS.has(ref.slice(0, ref.indexOf(":")))),
|
|
106
|
+
...refs.filter((ref) => ENTITY_KINDS.has(ref.slice(0, ref.indexOf(":"))))
|
|
107
|
+
], "refsForLink");
|
|
108
|
+
var linkTargetOf = /* @__PURE__ */ __name((ref) => {
|
|
109
|
+
const text = ref.trim();
|
|
110
|
+
const colon = text.indexOf(":");
|
|
111
|
+
if (colon < 0)
|
|
112
|
+
return null;
|
|
113
|
+
const kind = text.slice(0, colon);
|
|
114
|
+
if (LINK_ONLY.has(kind))
|
|
115
|
+
return targetOfPath(`${kind}/${text.slice(colon + 1)}`);
|
|
116
|
+
try {
|
|
117
|
+
const reference = parseReference(text);
|
|
118
|
+
return FROM_REFERENCE.has(reference.type) ? reference : null;
|
|
119
|
+
} catch {
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
}, "linkTargetOf");
|
|
123
|
+
var linkConfigOf = /* @__PURE__ */ __name((section) => {
|
|
124
|
+
const value = section && typeof section === "object" ? section : {};
|
|
125
|
+
const base = typeof value.base === "string" && /^https:\/\/[^\s#?]+$/.test(value.base) ? value.base.replace(/\/+$/, "") : DEFAULT_LINK_CONFIG.base;
|
|
126
|
+
return { base, enabled: typeof value.enabled === "boolean" ? value.enabled : DEFAULT_LINK_CONFIG.enabled };
|
|
127
|
+
}, "linkConfigOf");
|
|
128
|
+
var linkFor = /* @__PURE__ */ __name((ref, { form, config = DEFAULT_LINK_CONFIG, env = process.env }) => {
|
|
129
|
+
if (!config.enabled || env.WIRECAT_LINKS === "off")
|
|
130
|
+
return null;
|
|
131
|
+
const target = typeof ref === "string" ? linkTargetOf(ref) : ref;
|
|
132
|
+
if (target === null)
|
|
133
|
+
return null;
|
|
134
|
+
const path = formatLink(target);
|
|
135
|
+
if (path.length > MAX_PATH || parseLink(path) === null)
|
|
136
|
+
return null;
|
|
137
|
+
return form === "app" ? `${APP_PREFIX}${path}` : `${config.base}#${path}`;
|
|
138
|
+
}, "linkFor");
|
|
139
|
+
|
|
140
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/domain/records-table.js
|
|
141
|
+
var TABLE_RECORD_TYPES = Object.keys(RECORD_TYPES).filter((type) => RECORD_TYPES[type].sheet !== false);
|
|
142
|
+
|
|
143
|
+
// node_modules/.pnpm/qrcode-generator@2.0.4/node_modules/qrcode-generator/dist/qrcode.mjs
|
|
144
|
+
var qrcode = /* @__PURE__ */ __name(function(typeNumber, errorCorrectionLevel) {
|
|
145
|
+
const PAD0 = 236;
|
|
146
|
+
const PAD1 = 17;
|
|
147
|
+
let _typeNumber = typeNumber;
|
|
148
|
+
const _errorCorrectionLevel = QRErrorCorrectionLevel[errorCorrectionLevel];
|
|
149
|
+
let _modules = null;
|
|
150
|
+
let _moduleCount = 0;
|
|
151
|
+
let _dataCache = null;
|
|
152
|
+
const _dataList = [];
|
|
153
|
+
const _this = {};
|
|
154
|
+
const makeImpl = /* @__PURE__ */ __name(function(test, maskPattern) {
|
|
155
|
+
_moduleCount = _typeNumber * 4 + 17;
|
|
156
|
+
_modules = (function(moduleCount) {
|
|
157
|
+
const modules = new Array(moduleCount);
|
|
158
|
+
for (let row = 0; row < moduleCount; row += 1) {
|
|
159
|
+
modules[row] = new Array(moduleCount);
|
|
160
|
+
for (let col = 0; col < moduleCount; col += 1) {
|
|
161
|
+
modules[row][col] = null;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
return modules;
|
|
165
|
+
})(_moduleCount);
|
|
166
|
+
setupPositionProbePattern(0, 0);
|
|
167
|
+
setupPositionProbePattern(_moduleCount - 7, 0);
|
|
168
|
+
setupPositionProbePattern(0, _moduleCount - 7);
|
|
169
|
+
setupPositionAdjustPattern();
|
|
170
|
+
setupTimingPattern();
|
|
171
|
+
setupTypeInfo(test, maskPattern);
|
|
172
|
+
if (_typeNumber >= 7) {
|
|
173
|
+
setupTypeNumber(test);
|
|
174
|
+
}
|
|
175
|
+
if (_dataCache == null) {
|
|
176
|
+
_dataCache = createData(_typeNumber, _errorCorrectionLevel, _dataList);
|
|
177
|
+
}
|
|
178
|
+
mapData(_dataCache, maskPattern);
|
|
179
|
+
}, "makeImpl");
|
|
180
|
+
const setupPositionProbePattern = /* @__PURE__ */ __name(function(row, col) {
|
|
181
|
+
for (let r = -1; r <= 7; r += 1) {
|
|
182
|
+
if (row + r <= -1 || _moduleCount <= row + r) continue;
|
|
183
|
+
for (let c = -1; c <= 7; c += 1) {
|
|
184
|
+
if (col + c <= -1 || _moduleCount <= col + c) continue;
|
|
185
|
+
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) {
|
|
186
|
+
_modules[row + r][col + c] = true;
|
|
187
|
+
} else {
|
|
188
|
+
_modules[row + r][col + c] = false;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}, "setupPositionProbePattern");
|
|
193
|
+
const getBestMaskPattern = /* @__PURE__ */ __name(function() {
|
|
194
|
+
let minLostPoint = 0;
|
|
195
|
+
let pattern = 0;
|
|
196
|
+
for (let i = 0; i < 8; i += 1) {
|
|
197
|
+
makeImpl(true, i);
|
|
198
|
+
const lostPoint = QRUtil.getLostPoint(_this);
|
|
199
|
+
if (i == 0 || minLostPoint > lostPoint) {
|
|
200
|
+
minLostPoint = lostPoint;
|
|
201
|
+
pattern = i;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return pattern;
|
|
205
|
+
}, "getBestMaskPattern");
|
|
206
|
+
const setupTimingPattern = /* @__PURE__ */ __name(function() {
|
|
207
|
+
for (let r = 8; r < _moduleCount - 8; r += 1) {
|
|
208
|
+
if (_modules[r][6] != null) {
|
|
209
|
+
continue;
|
|
210
|
+
}
|
|
211
|
+
_modules[r][6] = r % 2 == 0;
|
|
212
|
+
}
|
|
213
|
+
for (let c = 8; c < _moduleCount - 8; c += 1) {
|
|
214
|
+
if (_modules[6][c] != null) {
|
|
215
|
+
continue;
|
|
216
|
+
}
|
|
217
|
+
_modules[6][c] = c % 2 == 0;
|
|
218
|
+
}
|
|
219
|
+
}, "setupTimingPattern");
|
|
220
|
+
const setupPositionAdjustPattern = /* @__PURE__ */ __name(function() {
|
|
221
|
+
const pos = QRUtil.getPatternPosition(_typeNumber);
|
|
222
|
+
for (let i = 0; i < pos.length; i += 1) {
|
|
223
|
+
for (let j = 0; j < pos.length; j += 1) {
|
|
224
|
+
const row = pos[i];
|
|
225
|
+
const col = pos[j];
|
|
226
|
+
if (_modules[row][col] != null) {
|
|
227
|
+
continue;
|
|
228
|
+
}
|
|
229
|
+
for (let r = -2; r <= 2; r += 1) {
|
|
230
|
+
for (let c = -2; c <= 2; c += 1) {
|
|
231
|
+
if (r == -2 || r == 2 || c == -2 || c == 2 || r == 0 && c == 0) {
|
|
232
|
+
_modules[row + r][col + c] = true;
|
|
233
|
+
} else {
|
|
234
|
+
_modules[row + r][col + c] = false;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}, "setupPositionAdjustPattern");
|
|
241
|
+
const setupTypeNumber = /* @__PURE__ */ __name(function(test) {
|
|
242
|
+
const bits = QRUtil.getBCHTypeNumber(_typeNumber);
|
|
243
|
+
for (let i = 0; i < 18; i += 1) {
|
|
244
|
+
const mod = !test && (bits >> i & 1) == 1;
|
|
245
|
+
_modules[Math.floor(i / 3)][i % 3 + _moduleCount - 8 - 3] = mod;
|
|
246
|
+
}
|
|
247
|
+
for (let i = 0; i < 18; i += 1) {
|
|
248
|
+
const mod = !test && (bits >> i & 1) == 1;
|
|
249
|
+
_modules[i % 3 + _moduleCount - 8 - 3][Math.floor(i / 3)] = mod;
|
|
250
|
+
}
|
|
251
|
+
}, "setupTypeNumber");
|
|
252
|
+
const setupTypeInfo = /* @__PURE__ */ __name(function(test, maskPattern) {
|
|
253
|
+
const data = _errorCorrectionLevel << 3 | maskPattern;
|
|
254
|
+
const bits = QRUtil.getBCHTypeInfo(data);
|
|
255
|
+
for (let i = 0; i < 15; i += 1) {
|
|
256
|
+
const mod = !test && (bits >> i & 1) == 1;
|
|
257
|
+
if (i < 6) {
|
|
258
|
+
_modules[i][8] = mod;
|
|
259
|
+
} else if (i < 8) {
|
|
260
|
+
_modules[i + 1][8] = mod;
|
|
261
|
+
} else {
|
|
262
|
+
_modules[_moduleCount - 15 + i][8] = mod;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
for (let i = 0; i < 15; i += 1) {
|
|
266
|
+
const mod = !test && (bits >> i & 1) == 1;
|
|
267
|
+
if (i < 8) {
|
|
268
|
+
_modules[8][_moduleCount - i - 1] = mod;
|
|
269
|
+
} else if (i < 9) {
|
|
270
|
+
_modules[8][15 - i - 1 + 1] = mod;
|
|
271
|
+
} else {
|
|
272
|
+
_modules[8][15 - i - 1] = mod;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
_modules[_moduleCount - 8][8] = !test;
|
|
276
|
+
}, "setupTypeInfo");
|
|
277
|
+
const mapData = /* @__PURE__ */ __name(function(data, maskPattern) {
|
|
278
|
+
let inc = -1;
|
|
279
|
+
let row = _moduleCount - 1;
|
|
280
|
+
let bitIndex = 7;
|
|
281
|
+
let byteIndex = 0;
|
|
282
|
+
const maskFunc = QRUtil.getMaskFunction(maskPattern);
|
|
283
|
+
for (let col = _moduleCount - 1; col > 0; col -= 2) {
|
|
284
|
+
if (col == 6) col -= 1;
|
|
285
|
+
while (true) {
|
|
286
|
+
for (let c = 0; c < 2; c += 1) {
|
|
287
|
+
if (_modules[row][col - c] == null) {
|
|
288
|
+
let dark = false;
|
|
289
|
+
if (byteIndex < data.length) {
|
|
290
|
+
dark = (data[byteIndex] >>> bitIndex & 1) == 1;
|
|
291
|
+
}
|
|
292
|
+
const mask = maskFunc(row, col - c);
|
|
293
|
+
if (mask) {
|
|
294
|
+
dark = !dark;
|
|
295
|
+
}
|
|
296
|
+
_modules[row][col - c] = dark;
|
|
297
|
+
bitIndex -= 1;
|
|
298
|
+
if (bitIndex == -1) {
|
|
299
|
+
byteIndex += 1;
|
|
300
|
+
bitIndex = 7;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
row += inc;
|
|
305
|
+
if (row < 0 || _moduleCount <= row) {
|
|
306
|
+
row -= inc;
|
|
307
|
+
inc = -inc;
|
|
308
|
+
break;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}, "mapData");
|
|
313
|
+
const createBytes = /* @__PURE__ */ __name(function(buffer, rsBlocks) {
|
|
314
|
+
let offset = 0;
|
|
315
|
+
let maxDcCount = 0;
|
|
316
|
+
let maxEcCount = 0;
|
|
317
|
+
const dcdata = new Array(rsBlocks.length);
|
|
318
|
+
const ecdata = new Array(rsBlocks.length);
|
|
319
|
+
for (let r = 0; r < rsBlocks.length; r += 1) {
|
|
320
|
+
const dcCount = rsBlocks[r].dataCount;
|
|
321
|
+
const ecCount = rsBlocks[r].totalCount - dcCount;
|
|
322
|
+
maxDcCount = Math.max(maxDcCount, dcCount);
|
|
323
|
+
maxEcCount = Math.max(maxEcCount, ecCount);
|
|
324
|
+
dcdata[r] = new Array(dcCount);
|
|
325
|
+
for (let i = 0; i < dcdata[r].length; i += 1) {
|
|
326
|
+
dcdata[r][i] = 255 & buffer.getBuffer()[i + offset];
|
|
327
|
+
}
|
|
328
|
+
offset += dcCount;
|
|
329
|
+
const rsPoly = QRUtil.getErrorCorrectPolynomial(ecCount);
|
|
330
|
+
const rawPoly = qrPolynomial(dcdata[r], rsPoly.getLength() - 1);
|
|
331
|
+
const modPoly = rawPoly.mod(rsPoly);
|
|
332
|
+
ecdata[r] = new Array(rsPoly.getLength() - 1);
|
|
333
|
+
for (let i = 0; i < ecdata[r].length; i += 1) {
|
|
334
|
+
const modIndex = i + modPoly.getLength() - ecdata[r].length;
|
|
335
|
+
ecdata[r][i] = modIndex >= 0 ? modPoly.getAt(modIndex) : 0;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
let totalCodeCount = 0;
|
|
339
|
+
for (let i = 0; i < rsBlocks.length; i += 1) {
|
|
340
|
+
totalCodeCount += rsBlocks[i].totalCount;
|
|
341
|
+
}
|
|
342
|
+
const data = new Array(totalCodeCount);
|
|
343
|
+
let index = 0;
|
|
344
|
+
for (let i = 0; i < maxDcCount; i += 1) {
|
|
345
|
+
for (let r = 0; r < rsBlocks.length; r += 1) {
|
|
346
|
+
if (i < dcdata[r].length) {
|
|
347
|
+
data[index] = dcdata[r][i];
|
|
348
|
+
index += 1;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
for (let i = 0; i < maxEcCount; i += 1) {
|
|
353
|
+
for (let r = 0; r < rsBlocks.length; r += 1) {
|
|
354
|
+
if (i < ecdata[r].length) {
|
|
355
|
+
data[index] = ecdata[r][i];
|
|
356
|
+
index += 1;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
return data;
|
|
361
|
+
}, "createBytes");
|
|
362
|
+
const createData = /* @__PURE__ */ __name(function(typeNumber2, errorCorrectionLevel2, dataList) {
|
|
363
|
+
const rsBlocks = QRRSBlock.getRSBlocks(typeNumber2, errorCorrectionLevel2);
|
|
364
|
+
const buffer = qrBitBuffer();
|
|
365
|
+
for (let i = 0; i < dataList.length; i += 1) {
|
|
366
|
+
const data = dataList[i];
|
|
367
|
+
buffer.put(data.getMode(), 4);
|
|
368
|
+
buffer.put(data.getLength(), QRUtil.getLengthInBits(data.getMode(), typeNumber2));
|
|
369
|
+
data.write(buffer);
|
|
370
|
+
}
|
|
371
|
+
let totalDataCount = 0;
|
|
372
|
+
for (let i = 0; i < rsBlocks.length; i += 1) {
|
|
373
|
+
totalDataCount += rsBlocks[i].dataCount;
|
|
374
|
+
}
|
|
375
|
+
if (buffer.getLengthInBits() > totalDataCount * 8) {
|
|
376
|
+
throw "code length overflow. (" + buffer.getLengthInBits() + ">" + totalDataCount * 8 + ")";
|
|
377
|
+
}
|
|
378
|
+
if (buffer.getLengthInBits() + 4 <= totalDataCount * 8) {
|
|
379
|
+
buffer.put(0, 4);
|
|
380
|
+
}
|
|
381
|
+
while (buffer.getLengthInBits() % 8 != 0) {
|
|
382
|
+
buffer.putBit(false);
|
|
383
|
+
}
|
|
384
|
+
while (true) {
|
|
385
|
+
if (buffer.getLengthInBits() >= totalDataCount * 8) {
|
|
386
|
+
break;
|
|
387
|
+
}
|
|
388
|
+
buffer.put(PAD0, 8);
|
|
389
|
+
if (buffer.getLengthInBits() >= totalDataCount * 8) {
|
|
390
|
+
break;
|
|
391
|
+
}
|
|
392
|
+
buffer.put(PAD1, 8);
|
|
393
|
+
}
|
|
394
|
+
return createBytes(buffer, rsBlocks);
|
|
395
|
+
}, "createData");
|
|
396
|
+
_this.addData = function(data, mode) {
|
|
397
|
+
mode = mode || "Byte";
|
|
398
|
+
let newData = null;
|
|
399
|
+
switch (mode) {
|
|
400
|
+
case "Numeric":
|
|
401
|
+
newData = qrNumber(data);
|
|
402
|
+
break;
|
|
403
|
+
case "Alphanumeric":
|
|
404
|
+
newData = qrAlphaNum(data);
|
|
405
|
+
break;
|
|
406
|
+
case "Byte":
|
|
407
|
+
newData = qr8BitByte(data);
|
|
408
|
+
break;
|
|
409
|
+
case "Kanji":
|
|
410
|
+
newData = qrKanji(data);
|
|
411
|
+
break;
|
|
412
|
+
default:
|
|
413
|
+
throw "mode:" + mode;
|
|
414
|
+
}
|
|
415
|
+
_dataList.push(newData);
|
|
416
|
+
_dataCache = null;
|
|
417
|
+
};
|
|
418
|
+
_this.isDark = function(row, col) {
|
|
419
|
+
if (row < 0 || _moduleCount <= row || col < 0 || _moduleCount <= col) {
|
|
420
|
+
throw row + "," + col;
|
|
421
|
+
}
|
|
422
|
+
return _modules[row][col];
|
|
423
|
+
};
|
|
424
|
+
_this.getModuleCount = function() {
|
|
425
|
+
return _moduleCount;
|
|
426
|
+
};
|
|
427
|
+
_this.make = function() {
|
|
428
|
+
if (_typeNumber < 1) {
|
|
429
|
+
let typeNumber2 = 1;
|
|
430
|
+
for (; typeNumber2 < 40; typeNumber2++) {
|
|
431
|
+
const rsBlocks = QRRSBlock.getRSBlocks(typeNumber2, _errorCorrectionLevel);
|
|
432
|
+
const buffer = qrBitBuffer();
|
|
433
|
+
for (let i = 0; i < _dataList.length; i++) {
|
|
434
|
+
const data = _dataList[i];
|
|
435
|
+
buffer.put(data.getMode(), 4);
|
|
436
|
+
buffer.put(data.getLength(), QRUtil.getLengthInBits(data.getMode(), typeNumber2));
|
|
437
|
+
data.write(buffer);
|
|
438
|
+
}
|
|
439
|
+
let totalDataCount = 0;
|
|
440
|
+
for (let i = 0; i < rsBlocks.length; i++) {
|
|
441
|
+
totalDataCount += rsBlocks[i].dataCount;
|
|
442
|
+
}
|
|
443
|
+
if (buffer.getLengthInBits() <= totalDataCount * 8) {
|
|
444
|
+
break;
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
_typeNumber = typeNumber2;
|
|
448
|
+
}
|
|
449
|
+
makeImpl(false, getBestMaskPattern());
|
|
450
|
+
};
|
|
451
|
+
_this.createTableTag = function(cellSize, margin) {
|
|
452
|
+
cellSize = cellSize || 2;
|
|
453
|
+
margin = typeof margin == "undefined" ? cellSize * 4 : margin;
|
|
454
|
+
let qrHtml = "";
|
|
455
|
+
qrHtml += '<table style="';
|
|
456
|
+
qrHtml += " border-width: 0px; border-style: none;";
|
|
457
|
+
qrHtml += " border-collapse: collapse;";
|
|
458
|
+
qrHtml += " padding: 0px; margin: " + margin + "px;";
|
|
459
|
+
qrHtml += '">';
|
|
460
|
+
qrHtml += "<tbody>";
|
|
461
|
+
for (let r = 0; r < _this.getModuleCount(); r += 1) {
|
|
462
|
+
qrHtml += "<tr>";
|
|
463
|
+
for (let c = 0; c < _this.getModuleCount(); c += 1) {
|
|
464
|
+
qrHtml += '<td style="';
|
|
465
|
+
qrHtml += " border-width: 0px; border-style: none;";
|
|
466
|
+
qrHtml += " border-collapse: collapse;";
|
|
467
|
+
qrHtml += " padding: 0px; margin: 0px;";
|
|
468
|
+
qrHtml += " width: " + cellSize + "px;";
|
|
469
|
+
qrHtml += " height: " + cellSize + "px;";
|
|
470
|
+
qrHtml += " background-color: ";
|
|
471
|
+
qrHtml += _this.isDark(r, c) ? "#000000" : "#ffffff";
|
|
472
|
+
qrHtml += ";";
|
|
473
|
+
qrHtml += '"/>';
|
|
474
|
+
}
|
|
475
|
+
qrHtml += "</tr>";
|
|
476
|
+
}
|
|
477
|
+
qrHtml += "</tbody>";
|
|
478
|
+
qrHtml += "</table>";
|
|
479
|
+
return qrHtml;
|
|
480
|
+
};
|
|
481
|
+
_this.createSvgTag = function(cellSize, margin, alt, title) {
|
|
482
|
+
let opts = {};
|
|
483
|
+
if (typeof arguments[0] == "object") {
|
|
484
|
+
opts = arguments[0];
|
|
485
|
+
cellSize = opts.cellSize;
|
|
486
|
+
margin = opts.margin;
|
|
487
|
+
alt = opts.alt;
|
|
488
|
+
title = opts.title;
|
|
489
|
+
}
|
|
490
|
+
cellSize = cellSize || 2;
|
|
491
|
+
margin = typeof margin == "undefined" ? cellSize * 4 : margin;
|
|
492
|
+
alt = typeof alt === "string" ? { text: alt } : alt || {};
|
|
493
|
+
alt.text = alt.text || null;
|
|
494
|
+
alt.id = alt.text ? alt.id || "qrcode-description" : null;
|
|
495
|
+
title = typeof title === "string" ? { text: title } : title || {};
|
|
496
|
+
title.text = title.text || null;
|
|
497
|
+
title.id = title.text ? title.id || "qrcode-title" : null;
|
|
498
|
+
const size = _this.getModuleCount() * cellSize + margin * 2;
|
|
499
|
+
let c, mc, r, mr, qrSvg = "", rect;
|
|
500
|
+
rect = "l" + cellSize + ",0 0," + cellSize + " -" + cellSize + ",0 0,-" + cellSize + "z ";
|
|
501
|
+
qrSvg += '<svg version="1.1" xmlns="http://www.w3.org/2000/svg"';
|
|
502
|
+
qrSvg += !opts.scalable ? ' width="' + size + 'px" height="' + size + 'px"' : "";
|
|
503
|
+
qrSvg += ' viewBox="0 0 ' + size + " " + size + '" ';
|
|
504
|
+
qrSvg += ' preserveAspectRatio="xMinYMin meet"';
|
|
505
|
+
qrSvg += title.text || alt.text ? ' role="img" aria-labelledby="' + escapeXml([title.id, alt.id].join(" ").trim()) + '"' : "";
|
|
506
|
+
qrSvg += ">";
|
|
507
|
+
qrSvg += title.text ? '<title id="' + escapeXml(title.id) + '">' + escapeXml(title.text) + "</title>" : "";
|
|
508
|
+
qrSvg += alt.text ? '<description id="' + escapeXml(alt.id) + '">' + escapeXml(alt.text) + "</description>" : "";
|
|
509
|
+
qrSvg += '<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>';
|
|
510
|
+
qrSvg += '<path d="';
|
|
511
|
+
for (r = 0; r < _this.getModuleCount(); r += 1) {
|
|
512
|
+
mr = r * cellSize + margin;
|
|
513
|
+
for (c = 0; c < _this.getModuleCount(); c += 1) {
|
|
514
|
+
if (_this.isDark(r, c)) {
|
|
515
|
+
mc = c * cellSize + margin;
|
|
516
|
+
qrSvg += "M" + mc + "," + mr + rect;
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
qrSvg += '" stroke="transparent" fill="black"/>';
|
|
521
|
+
qrSvg += "</svg>";
|
|
522
|
+
return qrSvg;
|
|
523
|
+
};
|
|
524
|
+
_this.createDataURL = function(cellSize, margin) {
|
|
525
|
+
cellSize = cellSize || 2;
|
|
526
|
+
margin = typeof margin == "undefined" ? cellSize * 4 : margin;
|
|
527
|
+
const size = _this.getModuleCount() * cellSize + margin * 2;
|
|
528
|
+
const min = margin;
|
|
529
|
+
const max = size - margin;
|
|
530
|
+
return createDataURL(size, size, function(x, y) {
|
|
531
|
+
if (min <= x && x < max && min <= y && y < max) {
|
|
532
|
+
const c = Math.floor((x - min) / cellSize);
|
|
533
|
+
const r = Math.floor((y - min) / cellSize);
|
|
534
|
+
return _this.isDark(r, c) ? 0 : 1;
|
|
535
|
+
} else {
|
|
536
|
+
return 1;
|
|
537
|
+
}
|
|
538
|
+
});
|
|
539
|
+
};
|
|
540
|
+
_this.createImgTag = function(cellSize, margin, alt) {
|
|
541
|
+
cellSize = cellSize || 2;
|
|
542
|
+
margin = typeof margin == "undefined" ? cellSize * 4 : margin;
|
|
543
|
+
const size = _this.getModuleCount() * cellSize + margin * 2;
|
|
544
|
+
let img = "";
|
|
545
|
+
img += "<img";
|
|
546
|
+
img += ' src="';
|
|
547
|
+
img += _this.createDataURL(cellSize, margin);
|
|
548
|
+
img += '"';
|
|
549
|
+
img += ' width="';
|
|
550
|
+
img += size;
|
|
551
|
+
img += '"';
|
|
552
|
+
img += ' height="';
|
|
553
|
+
img += size;
|
|
554
|
+
img += '"';
|
|
555
|
+
if (alt) {
|
|
556
|
+
img += ' alt="';
|
|
557
|
+
img += escapeXml(alt);
|
|
558
|
+
img += '"';
|
|
559
|
+
}
|
|
560
|
+
img += "/>";
|
|
561
|
+
return img;
|
|
562
|
+
};
|
|
563
|
+
const escapeXml = /* @__PURE__ */ __name(function(s) {
|
|
564
|
+
let escaped = "";
|
|
565
|
+
for (let i = 0; i < s.length; i += 1) {
|
|
566
|
+
const c = s.charAt(i);
|
|
567
|
+
switch (c) {
|
|
568
|
+
case "<":
|
|
569
|
+
escaped += "<";
|
|
570
|
+
break;
|
|
571
|
+
case ">":
|
|
572
|
+
escaped += ">";
|
|
573
|
+
break;
|
|
574
|
+
case "&":
|
|
575
|
+
escaped += "&";
|
|
576
|
+
break;
|
|
577
|
+
case '"':
|
|
578
|
+
escaped += """;
|
|
579
|
+
break;
|
|
580
|
+
default:
|
|
581
|
+
escaped += c;
|
|
582
|
+
break;
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
return escaped;
|
|
586
|
+
}, "escapeXml");
|
|
587
|
+
const _createHalfASCII = /* @__PURE__ */ __name(function(margin) {
|
|
588
|
+
const cellSize = 1;
|
|
589
|
+
margin = typeof margin == "undefined" ? cellSize * 2 : margin;
|
|
590
|
+
const size = _this.getModuleCount() * cellSize + margin * 2;
|
|
591
|
+
const min = margin;
|
|
592
|
+
const max = size - margin;
|
|
593
|
+
let y, x, r1, r2, p;
|
|
594
|
+
const blocks = {
|
|
595
|
+
"\u2588\u2588": "\u2588",
|
|
596
|
+
"\u2588 ": "\u2580",
|
|
597
|
+
" \u2588": "\u2584",
|
|
598
|
+
" ": " "
|
|
599
|
+
};
|
|
600
|
+
const blocksLastLineNoMargin = {
|
|
601
|
+
"\u2588\u2588": "\u2580",
|
|
602
|
+
"\u2588 ": "\u2580",
|
|
603
|
+
" \u2588": " ",
|
|
604
|
+
" ": " "
|
|
605
|
+
};
|
|
606
|
+
let ascii = "";
|
|
607
|
+
for (y = 0; y < size; y += 2) {
|
|
608
|
+
r1 = Math.floor((y - min) / cellSize);
|
|
609
|
+
r2 = Math.floor((y + 1 - min) / cellSize);
|
|
610
|
+
for (x = 0; x < size; x += 1) {
|
|
611
|
+
p = "\u2588";
|
|
612
|
+
if (min <= x && x < max && min <= y && y < max && _this.isDark(r1, Math.floor((x - min) / cellSize))) {
|
|
613
|
+
p = " ";
|
|
614
|
+
}
|
|
615
|
+
if (min <= x && x < max && min <= y + 1 && y + 1 < max && _this.isDark(r2, Math.floor((x - min) / cellSize))) {
|
|
616
|
+
p += " ";
|
|
617
|
+
} else {
|
|
618
|
+
p += "\u2588";
|
|
619
|
+
}
|
|
620
|
+
ascii += margin < 1 && y + 1 >= max ? blocksLastLineNoMargin[p] : blocks[p];
|
|
621
|
+
}
|
|
622
|
+
ascii += "\n";
|
|
623
|
+
}
|
|
624
|
+
if (size % 2 && margin > 0) {
|
|
625
|
+
return ascii.substring(0, ascii.length - size - 1) + Array(size + 1).join("\u2580");
|
|
626
|
+
}
|
|
627
|
+
return ascii.substring(0, ascii.length - 1);
|
|
628
|
+
}, "_createHalfASCII");
|
|
629
|
+
_this.createASCII = function(cellSize, margin) {
|
|
630
|
+
cellSize = cellSize || 1;
|
|
631
|
+
if (cellSize < 2) {
|
|
632
|
+
return _createHalfASCII(margin);
|
|
633
|
+
}
|
|
634
|
+
cellSize -= 1;
|
|
635
|
+
margin = typeof margin == "undefined" ? cellSize * 2 : margin;
|
|
636
|
+
const size = _this.getModuleCount() * cellSize + margin * 2;
|
|
637
|
+
const min = margin;
|
|
638
|
+
const max = size - margin;
|
|
639
|
+
let y, x, r, p;
|
|
640
|
+
const white = Array(cellSize + 1).join("\u2588\u2588");
|
|
641
|
+
const black = Array(cellSize + 1).join(" ");
|
|
642
|
+
let ascii = "";
|
|
643
|
+
let line = "";
|
|
644
|
+
for (y = 0; y < size; y += 1) {
|
|
645
|
+
r = Math.floor((y - min) / cellSize);
|
|
646
|
+
line = "";
|
|
647
|
+
for (x = 0; x < size; x += 1) {
|
|
648
|
+
p = 1;
|
|
649
|
+
if (min <= x && x < max && min <= y && y < max && _this.isDark(r, Math.floor((x - min) / cellSize))) {
|
|
650
|
+
p = 0;
|
|
651
|
+
}
|
|
652
|
+
line += p ? white : black;
|
|
653
|
+
}
|
|
654
|
+
for (r = 0; r < cellSize; r += 1) {
|
|
655
|
+
ascii += line + "\n";
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
return ascii.substring(0, ascii.length - 1);
|
|
659
|
+
};
|
|
660
|
+
_this.renderTo2dContext = function(context, cellSize) {
|
|
661
|
+
cellSize = cellSize || 2;
|
|
662
|
+
const length = _this.getModuleCount();
|
|
663
|
+
for (let row = 0; row < length; row++) {
|
|
664
|
+
for (let col = 0; col < length; col++) {
|
|
665
|
+
context.fillStyle = _this.isDark(row, col) ? "black" : "white";
|
|
666
|
+
context.fillRect(col * cellSize, row * cellSize, cellSize, cellSize);
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
};
|
|
670
|
+
return _this;
|
|
671
|
+
}, "qrcode");
|
|
672
|
+
qrcode.stringToBytes = function(s) {
|
|
673
|
+
const bytes = [];
|
|
674
|
+
for (let i = 0; i < s.length; i += 1) {
|
|
675
|
+
const c = s.charCodeAt(i);
|
|
676
|
+
bytes.push(c & 255);
|
|
677
|
+
}
|
|
678
|
+
return bytes;
|
|
679
|
+
};
|
|
680
|
+
qrcode.createStringToBytes = function(unicodeData, numChars) {
|
|
681
|
+
const unicodeMap = (function() {
|
|
682
|
+
const bin = base64DecodeInputStream(unicodeData);
|
|
683
|
+
const read = /* @__PURE__ */ __name(function() {
|
|
684
|
+
const b = bin.read();
|
|
685
|
+
if (b == -1) throw "eof";
|
|
686
|
+
return b;
|
|
687
|
+
}, "read");
|
|
688
|
+
let count = 0;
|
|
689
|
+
const unicodeMap2 = {};
|
|
690
|
+
while (true) {
|
|
691
|
+
const b0 = bin.read();
|
|
692
|
+
if (b0 == -1) break;
|
|
693
|
+
const b1 = read();
|
|
694
|
+
const b2 = read();
|
|
695
|
+
const b3 = read();
|
|
696
|
+
const k = String.fromCharCode(b0 << 8 | b1);
|
|
697
|
+
const v = b2 << 8 | b3;
|
|
698
|
+
unicodeMap2[k] = v;
|
|
699
|
+
count += 1;
|
|
700
|
+
}
|
|
701
|
+
if (count != numChars) {
|
|
702
|
+
throw count + " != " + numChars;
|
|
703
|
+
}
|
|
704
|
+
return unicodeMap2;
|
|
705
|
+
})();
|
|
706
|
+
const unknownChar = "?".charCodeAt(0);
|
|
707
|
+
return function(s) {
|
|
708
|
+
const bytes = [];
|
|
709
|
+
for (let i = 0; i < s.length; i += 1) {
|
|
710
|
+
const c = s.charCodeAt(i);
|
|
711
|
+
if (c < 128) {
|
|
712
|
+
bytes.push(c);
|
|
713
|
+
} else {
|
|
714
|
+
const b = unicodeMap[s.charAt(i)];
|
|
715
|
+
if (typeof b == "number") {
|
|
716
|
+
if ((b & 255) == b) {
|
|
717
|
+
bytes.push(b);
|
|
718
|
+
} else {
|
|
719
|
+
bytes.push(b >>> 8);
|
|
720
|
+
bytes.push(b & 255);
|
|
721
|
+
}
|
|
722
|
+
} else {
|
|
723
|
+
bytes.push(unknownChar);
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
return bytes;
|
|
728
|
+
};
|
|
729
|
+
};
|
|
730
|
+
var QRMode = {
|
|
731
|
+
MODE_NUMBER: 1 << 0,
|
|
732
|
+
MODE_ALPHA_NUM: 1 << 1,
|
|
733
|
+
MODE_8BIT_BYTE: 1 << 2,
|
|
734
|
+
MODE_KANJI: 1 << 3
|
|
735
|
+
};
|
|
736
|
+
var QRErrorCorrectionLevel = {
|
|
737
|
+
L: 1,
|
|
738
|
+
M: 0,
|
|
739
|
+
Q: 3,
|
|
740
|
+
H: 2
|
|
741
|
+
};
|
|
742
|
+
var QRMaskPattern = {
|
|
743
|
+
PATTERN000: 0,
|
|
744
|
+
PATTERN001: 1,
|
|
745
|
+
PATTERN010: 2,
|
|
746
|
+
PATTERN011: 3,
|
|
747
|
+
PATTERN100: 4,
|
|
748
|
+
PATTERN101: 5,
|
|
749
|
+
PATTERN110: 6,
|
|
750
|
+
PATTERN111: 7
|
|
751
|
+
};
|
|
752
|
+
var QRUtil = (function() {
|
|
753
|
+
const PATTERN_POSITION_TABLE = [
|
|
754
|
+
[],
|
|
755
|
+
[6, 18],
|
|
756
|
+
[6, 22],
|
|
757
|
+
[6, 26],
|
|
758
|
+
[6, 30],
|
|
759
|
+
[6, 34],
|
|
760
|
+
[6, 22, 38],
|
|
761
|
+
[6, 24, 42],
|
|
762
|
+
[6, 26, 46],
|
|
763
|
+
[6, 28, 50],
|
|
764
|
+
[6, 30, 54],
|
|
765
|
+
[6, 32, 58],
|
|
766
|
+
[6, 34, 62],
|
|
767
|
+
[6, 26, 46, 66],
|
|
768
|
+
[6, 26, 48, 70],
|
|
769
|
+
[6, 26, 50, 74],
|
|
770
|
+
[6, 30, 54, 78],
|
|
771
|
+
[6, 30, 56, 82],
|
|
772
|
+
[6, 30, 58, 86],
|
|
773
|
+
[6, 34, 62, 90],
|
|
774
|
+
[6, 28, 50, 72, 94],
|
|
775
|
+
[6, 26, 50, 74, 98],
|
|
776
|
+
[6, 30, 54, 78, 102],
|
|
777
|
+
[6, 28, 54, 80, 106],
|
|
778
|
+
[6, 32, 58, 84, 110],
|
|
779
|
+
[6, 30, 58, 86, 114],
|
|
780
|
+
[6, 34, 62, 90, 118],
|
|
781
|
+
[6, 26, 50, 74, 98, 122],
|
|
782
|
+
[6, 30, 54, 78, 102, 126],
|
|
783
|
+
[6, 26, 52, 78, 104, 130],
|
|
784
|
+
[6, 30, 56, 82, 108, 134],
|
|
785
|
+
[6, 34, 60, 86, 112, 138],
|
|
786
|
+
[6, 30, 58, 86, 114, 142],
|
|
787
|
+
[6, 34, 62, 90, 118, 146],
|
|
788
|
+
[6, 30, 54, 78, 102, 126, 150],
|
|
789
|
+
[6, 24, 50, 76, 102, 128, 154],
|
|
790
|
+
[6, 28, 54, 80, 106, 132, 158],
|
|
791
|
+
[6, 32, 58, 84, 110, 136, 162],
|
|
792
|
+
[6, 26, 54, 82, 110, 138, 166],
|
|
793
|
+
[6, 30, 58, 86, 114, 142, 170]
|
|
794
|
+
];
|
|
795
|
+
const G15 = 1 << 10 | 1 << 8 | 1 << 5 | 1 << 4 | 1 << 2 | 1 << 1 | 1 << 0;
|
|
796
|
+
const G18 = 1 << 12 | 1 << 11 | 1 << 10 | 1 << 9 | 1 << 8 | 1 << 5 | 1 << 2 | 1 << 0;
|
|
797
|
+
const G15_MASK = 1 << 14 | 1 << 12 | 1 << 10 | 1 << 4 | 1 << 1;
|
|
798
|
+
const _this = {};
|
|
799
|
+
const getBCHDigit = /* @__PURE__ */ __name(function(data) {
|
|
800
|
+
let digit = 0;
|
|
801
|
+
while (data != 0) {
|
|
802
|
+
digit += 1;
|
|
803
|
+
data >>>= 1;
|
|
804
|
+
}
|
|
805
|
+
return digit;
|
|
806
|
+
}, "getBCHDigit");
|
|
807
|
+
_this.getBCHTypeInfo = function(data) {
|
|
808
|
+
let d = data << 10;
|
|
809
|
+
while (getBCHDigit(d) - getBCHDigit(G15) >= 0) {
|
|
810
|
+
d ^= G15 << getBCHDigit(d) - getBCHDigit(G15);
|
|
811
|
+
}
|
|
812
|
+
return (data << 10 | d) ^ G15_MASK;
|
|
813
|
+
};
|
|
814
|
+
_this.getBCHTypeNumber = function(data) {
|
|
815
|
+
let d = data << 12;
|
|
816
|
+
while (getBCHDigit(d) - getBCHDigit(G18) >= 0) {
|
|
817
|
+
d ^= G18 << getBCHDigit(d) - getBCHDigit(G18);
|
|
818
|
+
}
|
|
819
|
+
return data << 12 | d;
|
|
820
|
+
};
|
|
821
|
+
_this.getPatternPosition = function(typeNumber) {
|
|
822
|
+
return PATTERN_POSITION_TABLE[typeNumber - 1];
|
|
823
|
+
};
|
|
824
|
+
_this.getMaskFunction = function(maskPattern) {
|
|
825
|
+
switch (maskPattern) {
|
|
826
|
+
case QRMaskPattern.PATTERN000:
|
|
827
|
+
return function(i, j) {
|
|
828
|
+
return (i + j) % 2 == 0;
|
|
829
|
+
};
|
|
830
|
+
case QRMaskPattern.PATTERN001:
|
|
831
|
+
return function(i, j) {
|
|
832
|
+
return i % 2 == 0;
|
|
833
|
+
};
|
|
834
|
+
case QRMaskPattern.PATTERN010:
|
|
835
|
+
return function(i, j) {
|
|
836
|
+
return j % 3 == 0;
|
|
837
|
+
};
|
|
838
|
+
case QRMaskPattern.PATTERN011:
|
|
839
|
+
return function(i, j) {
|
|
840
|
+
return (i + j) % 3 == 0;
|
|
841
|
+
};
|
|
842
|
+
case QRMaskPattern.PATTERN100:
|
|
843
|
+
return function(i, j) {
|
|
844
|
+
return (Math.floor(i / 2) + Math.floor(j / 3)) % 2 == 0;
|
|
845
|
+
};
|
|
846
|
+
case QRMaskPattern.PATTERN101:
|
|
847
|
+
return function(i, j) {
|
|
848
|
+
return i * j % 2 + i * j % 3 == 0;
|
|
849
|
+
};
|
|
850
|
+
case QRMaskPattern.PATTERN110:
|
|
851
|
+
return function(i, j) {
|
|
852
|
+
return (i * j % 2 + i * j % 3) % 2 == 0;
|
|
853
|
+
};
|
|
854
|
+
case QRMaskPattern.PATTERN111:
|
|
855
|
+
return function(i, j) {
|
|
856
|
+
return (i * j % 3 + (i + j) % 2) % 2 == 0;
|
|
857
|
+
};
|
|
858
|
+
default:
|
|
859
|
+
throw "bad maskPattern:" + maskPattern;
|
|
860
|
+
}
|
|
861
|
+
};
|
|
862
|
+
_this.getErrorCorrectPolynomial = function(errorCorrectLength) {
|
|
863
|
+
let a = qrPolynomial([1], 0);
|
|
864
|
+
for (let i = 0; i < errorCorrectLength; i += 1) {
|
|
865
|
+
a = a.multiply(qrPolynomial([1, QRMath.gexp(i)], 0));
|
|
866
|
+
}
|
|
867
|
+
return a;
|
|
868
|
+
};
|
|
869
|
+
_this.getLengthInBits = function(mode, type) {
|
|
870
|
+
if (1 <= type && type < 10) {
|
|
871
|
+
switch (mode) {
|
|
872
|
+
case QRMode.MODE_NUMBER:
|
|
873
|
+
return 10;
|
|
874
|
+
case QRMode.MODE_ALPHA_NUM:
|
|
875
|
+
return 9;
|
|
876
|
+
case QRMode.MODE_8BIT_BYTE:
|
|
877
|
+
return 8;
|
|
878
|
+
case QRMode.MODE_KANJI:
|
|
879
|
+
return 8;
|
|
880
|
+
default:
|
|
881
|
+
throw "mode:" + mode;
|
|
882
|
+
}
|
|
883
|
+
} else if (type < 27) {
|
|
884
|
+
switch (mode) {
|
|
885
|
+
case QRMode.MODE_NUMBER:
|
|
886
|
+
return 12;
|
|
887
|
+
case QRMode.MODE_ALPHA_NUM:
|
|
888
|
+
return 11;
|
|
889
|
+
case QRMode.MODE_8BIT_BYTE:
|
|
890
|
+
return 16;
|
|
891
|
+
case QRMode.MODE_KANJI:
|
|
892
|
+
return 10;
|
|
893
|
+
default:
|
|
894
|
+
throw "mode:" + mode;
|
|
895
|
+
}
|
|
896
|
+
} else if (type < 41) {
|
|
897
|
+
switch (mode) {
|
|
898
|
+
case QRMode.MODE_NUMBER:
|
|
899
|
+
return 14;
|
|
900
|
+
case QRMode.MODE_ALPHA_NUM:
|
|
901
|
+
return 13;
|
|
902
|
+
case QRMode.MODE_8BIT_BYTE:
|
|
903
|
+
return 16;
|
|
904
|
+
case QRMode.MODE_KANJI:
|
|
905
|
+
return 12;
|
|
906
|
+
default:
|
|
907
|
+
throw "mode:" + mode;
|
|
908
|
+
}
|
|
909
|
+
} else {
|
|
910
|
+
throw "type:" + type;
|
|
911
|
+
}
|
|
912
|
+
};
|
|
913
|
+
_this.getLostPoint = function(qrcode2) {
|
|
914
|
+
const moduleCount = qrcode2.getModuleCount();
|
|
915
|
+
let lostPoint = 0;
|
|
916
|
+
for (let row = 0; row < moduleCount; row += 1) {
|
|
917
|
+
for (let col = 0; col < moduleCount; col += 1) {
|
|
918
|
+
let sameCount = 0;
|
|
919
|
+
const dark = qrcode2.isDark(row, col);
|
|
920
|
+
for (let r = -1; r <= 1; r += 1) {
|
|
921
|
+
if (row + r < 0 || moduleCount <= row + r) {
|
|
922
|
+
continue;
|
|
923
|
+
}
|
|
924
|
+
for (let c = -1; c <= 1; c += 1) {
|
|
925
|
+
if (col + c < 0 || moduleCount <= col + c) {
|
|
926
|
+
continue;
|
|
927
|
+
}
|
|
928
|
+
if (r == 0 && c == 0) {
|
|
929
|
+
continue;
|
|
930
|
+
}
|
|
931
|
+
if (dark == qrcode2.isDark(row + r, col + c)) {
|
|
932
|
+
sameCount += 1;
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
if (sameCount > 5) {
|
|
937
|
+
lostPoint += 3 + sameCount - 5;
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
;
|
|
942
|
+
for (let row = 0; row < moduleCount - 1; row += 1) {
|
|
943
|
+
for (let col = 0; col < moduleCount - 1; col += 1) {
|
|
944
|
+
let count = 0;
|
|
945
|
+
if (qrcode2.isDark(row, col)) count += 1;
|
|
946
|
+
if (qrcode2.isDark(row + 1, col)) count += 1;
|
|
947
|
+
if (qrcode2.isDark(row, col + 1)) count += 1;
|
|
948
|
+
if (qrcode2.isDark(row + 1, col + 1)) count += 1;
|
|
949
|
+
if (count == 0 || count == 4) {
|
|
950
|
+
lostPoint += 3;
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
for (let row = 0; row < moduleCount; row += 1) {
|
|
955
|
+
for (let col = 0; col < moduleCount - 6; col += 1) {
|
|
956
|
+
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)) {
|
|
957
|
+
lostPoint += 40;
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
for (let col = 0; col < moduleCount; col += 1) {
|
|
962
|
+
for (let row = 0; row < moduleCount - 6; row += 1) {
|
|
963
|
+
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)) {
|
|
964
|
+
lostPoint += 40;
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
let darkCount = 0;
|
|
969
|
+
for (let col = 0; col < moduleCount; col += 1) {
|
|
970
|
+
for (let row = 0; row < moduleCount; row += 1) {
|
|
971
|
+
if (qrcode2.isDark(row, col)) {
|
|
972
|
+
darkCount += 1;
|
|
973
|
+
}
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
const ratio = Math.abs(100 * darkCount / moduleCount / moduleCount - 50) / 5;
|
|
977
|
+
lostPoint += ratio * 10;
|
|
978
|
+
return lostPoint;
|
|
979
|
+
};
|
|
980
|
+
return _this;
|
|
981
|
+
})();
|
|
982
|
+
var QRMath = (function() {
|
|
983
|
+
const EXP_TABLE = new Array(256);
|
|
984
|
+
const LOG_TABLE = new Array(256);
|
|
985
|
+
for (let i = 0; i < 8; i += 1) {
|
|
986
|
+
EXP_TABLE[i] = 1 << i;
|
|
987
|
+
}
|
|
988
|
+
for (let i = 8; i < 256; i += 1) {
|
|
989
|
+
EXP_TABLE[i] = EXP_TABLE[i - 4] ^ EXP_TABLE[i - 5] ^ EXP_TABLE[i - 6] ^ EXP_TABLE[i - 8];
|
|
990
|
+
}
|
|
991
|
+
for (let i = 0; i < 255; i += 1) {
|
|
992
|
+
LOG_TABLE[EXP_TABLE[i]] = i;
|
|
993
|
+
}
|
|
994
|
+
const _this = {};
|
|
995
|
+
_this.glog = function(n) {
|
|
996
|
+
if (n < 1) {
|
|
997
|
+
throw "glog(" + n + ")";
|
|
998
|
+
}
|
|
999
|
+
return LOG_TABLE[n];
|
|
1000
|
+
};
|
|
1001
|
+
_this.gexp = function(n) {
|
|
1002
|
+
while (n < 0) {
|
|
1003
|
+
n += 255;
|
|
1004
|
+
}
|
|
1005
|
+
while (n >= 256) {
|
|
1006
|
+
n -= 255;
|
|
1007
|
+
}
|
|
1008
|
+
return EXP_TABLE[n];
|
|
1009
|
+
};
|
|
1010
|
+
return _this;
|
|
1011
|
+
})();
|
|
1012
|
+
var qrPolynomial = /* @__PURE__ */ __name(function(num, shift) {
|
|
1013
|
+
if (typeof num.length == "undefined") {
|
|
1014
|
+
throw num.length + "/" + shift;
|
|
1015
|
+
}
|
|
1016
|
+
const _num = (function() {
|
|
1017
|
+
let offset = 0;
|
|
1018
|
+
while (offset < num.length && num[offset] == 0) {
|
|
1019
|
+
offset += 1;
|
|
1020
|
+
}
|
|
1021
|
+
const _num2 = new Array(num.length - offset + shift);
|
|
1022
|
+
for (let i = 0; i < num.length - offset; i += 1) {
|
|
1023
|
+
_num2[i] = num[i + offset];
|
|
1024
|
+
}
|
|
1025
|
+
return _num2;
|
|
1026
|
+
})();
|
|
1027
|
+
const _this = {};
|
|
1028
|
+
_this.getAt = function(index) {
|
|
1029
|
+
return _num[index];
|
|
1030
|
+
};
|
|
1031
|
+
_this.getLength = function() {
|
|
1032
|
+
return _num.length;
|
|
1033
|
+
};
|
|
1034
|
+
_this.multiply = function(e) {
|
|
1035
|
+
const num2 = new Array(_this.getLength() + e.getLength() - 1);
|
|
1036
|
+
for (let i = 0; i < _this.getLength(); i += 1) {
|
|
1037
|
+
for (let j = 0; j < e.getLength(); j += 1) {
|
|
1038
|
+
num2[i + j] ^= QRMath.gexp(QRMath.glog(_this.getAt(i)) + QRMath.glog(e.getAt(j)));
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
return qrPolynomial(num2, 0);
|
|
1042
|
+
};
|
|
1043
|
+
_this.mod = function(e) {
|
|
1044
|
+
if (_this.getLength() - e.getLength() < 0) {
|
|
1045
|
+
return _this;
|
|
1046
|
+
}
|
|
1047
|
+
const ratio = QRMath.glog(_this.getAt(0)) - QRMath.glog(e.getAt(0));
|
|
1048
|
+
const num2 = new Array(_this.getLength());
|
|
1049
|
+
for (let i = 0; i < _this.getLength(); i += 1) {
|
|
1050
|
+
num2[i] = _this.getAt(i);
|
|
1051
|
+
}
|
|
1052
|
+
for (let i = 0; i < e.getLength(); i += 1) {
|
|
1053
|
+
num2[i] ^= QRMath.gexp(QRMath.glog(e.getAt(i)) + ratio);
|
|
1054
|
+
}
|
|
1055
|
+
return qrPolynomial(num2, 0).mod(e);
|
|
1056
|
+
};
|
|
1057
|
+
return _this;
|
|
1058
|
+
}, "qrPolynomial");
|
|
1059
|
+
var QRRSBlock = (function() {
|
|
1060
|
+
const RS_BLOCK_TABLE = [
|
|
1061
|
+
// L
|
|
1062
|
+
// M
|
|
1063
|
+
// Q
|
|
1064
|
+
// H
|
|
1065
|
+
// 1
|
|
1066
|
+
[1, 26, 19],
|
|
1067
|
+
[1, 26, 16],
|
|
1068
|
+
[1, 26, 13],
|
|
1069
|
+
[1, 26, 9],
|
|
1070
|
+
// 2
|
|
1071
|
+
[1, 44, 34],
|
|
1072
|
+
[1, 44, 28],
|
|
1073
|
+
[1, 44, 22],
|
|
1074
|
+
[1, 44, 16],
|
|
1075
|
+
// 3
|
|
1076
|
+
[1, 70, 55],
|
|
1077
|
+
[1, 70, 44],
|
|
1078
|
+
[2, 35, 17],
|
|
1079
|
+
[2, 35, 13],
|
|
1080
|
+
// 4
|
|
1081
|
+
[1, 100, 80],
|
|
1082
|
+
[2, 50, 32],
|
|
1083
|
+
[2, 50, 24],
|
|
1084
|
+
[4, 25, 9],
|
|
1085
|
+
// 5
|
|
1086
|
+
[1, 134, 108],
|
|
1087
|
+
[2, 67, 43],
|
|
1088
|
+
[2, 33, 15, 2, 34, 16],
|
|
1089
|
+
[2, 33, 11, 2, 34, 12],
|
|
1090
|
+
// 6
|
|
1091
|
+
[2, 86, 68],
|
|
1092
|
+
[4, 43, 27],
|
|
1093
|
+
[4, 43, 19],
|
|
1094
|
+
[4, 43, 15],
|
|
1095
|
+
// 7
|
|
1096
|
+
[2, 98, 78],
|
|
1097
|
+
[4, 49, 31],
|
|
1098
|
+
[2, 32, 14, 4, 33, 15],
|
|
1099
|
+
[4, 39, 13, 1, 40, 14],
|
|
1100
|
+
// 8
|
|
1101
|
+
[2, 121, 97],
|
|
1102
|
+
[2, 60, 38, 2, 61, 39],
|
|
1103
|
+
[4, 40, 18, 2, 41, 19],
|
|
1104
|
+
[4, 40, 14, 2, 41, 15],
|
|
1105
|
+
// 9
|
|
1106
|
+
[2, 146, 116],
|
|
1107
|
+
[3, 58, 36, 2, 59, 37],
|
|
1108
|
+
[4, 36, 16, 4, 37, 17],
|
|
1109
|
+
[4, 36, 12, 4, 37, 13],
|
|
1110
|
+
// 10
|
|
1111
|
+
[2, 86, 68, 2, 87, 69],
|
|
1112
|
+
[4, 69, 43, 1, 70, 44],
|
|
1113
|
+
[6, 43, 19, 2, 44, 20],
|
|
1114
|
+
[6, 43, 15, 2, 44, 16],
|
|
1115
|
+
// 11
|
|
1116
|
+
[4, 101, 81],
|
|
1117
|
+
[1, 80, 50, 4, 81, 51],
|
|
1118
|
+
[4, 50, 22, 4, 51, 23],
|
|
1119
|
+
[3, 36, 12, 8, 37, 13],
|
|
1120
|
+
// 12
|
|
1121
|
+
[2, 116, 92, 2, 117, 93],
|
|
1122
|
+
[6, 58, 36, 2, 59, 37],
|
|
1123
|
+
[4, 46, 20, 6, 47, 21],
|
|
1124
|
+
[7, 42, 14, 4, 43, 15],
|
|
1125
|
+
// 13
|
|
1126
|
+
[4, 133, 107],
|
|
1127
|
+
[8, 59, 37, 1, 60, 38],
|
|
1128
|
+
[8, 44, 20, 4, 45, 21],
|
|
1129
|
+
[12, 33, 11, 4, 34, 12],
|
|
1130
|
+
// 14
|
|
1131
|
+
[3, 145, 115, 1, 146, 116],
|
|
1132
|
+
[4, 64, 40, 5, 65, 41],
|
|
1133
|
+
[11, 36, 16, 5, 37, 17],
|
|
1134
|
+
[11, 36, 12, 5, 37, 13],
|
|
1135
|
+
// 15
|
|
1136
|
+
[5, 109, 87, 1, 110, 88],
|
|
1137
|
+
[5, 65, 41, 5, 66, 42],
|
|
1138
|
+
[5, 54, 24, 7, 55, 25],
|
|
1139
|
+
[11, 36, 12, 7, 37, 13],
|
|
1140
|
+
// 16
|
|
1141
|
+
[5, 122, 98, 1, 123, 99],
|
|
1142
|
+
[7, 73, 45, 3, 74, 46],
|
|
1143
|
+
[15, 43, 19, 2, 44, 20],
|
|
1144
|
+
[3, 45, 15, 13, 46, 16],
|
|
1145
|
+
// 17
|
|
1146
|
+
[1, 135, 107, 5, 136, 108],
|
|
1147
|
+
[10, 74, 46, 1, 75, 47],
|
|
1148
|
+
[1, 50, 22, 15, 51, 23],
|
|
1149
|
+
[2, 42, 14, 17, 43, 15],
|
|
1150
|
+
// 18
|
|
1151
|
+
[5, 150, 120, 1, 151, 121],
|
|
1152
|
+
[9, 69, 43, 4, 70, 44],
|
|
1153
|
+
[17, 50, 22, 1, 51, 23],
|
|
1154
|
+
[2, 42, 14, 19, 43, 15],
|
|
1155
|
+
// 19
|
|
1156
|
+
[3, 141, 113, 4, 142, 114],
|
|
1157
|
+
[3, 70, 44, 11, 71, 45],
|
|
1158
|
+
[17, 47, 21, 4, 48, 22],
|
|
1159
|
+
[9, 39, 13, 16, 40, 14],
|
|
1160
|
+
// 20
|
|
1161
|
+
[3, 135, 107, 5, 136, 108],
|
|
1162
|
+
[3, 67, 41, 13, 68, 42],
|
|
1163
|
+
[15, 54, 24, 5, 55, 25],
|
|
1164
|
+
[15, 43, 15, 10, 44, 16],
|
|
1165
|
+
// 21
|
|
1166
|
+
[4, 144, 116, 4, 145, 117],
|
|
1167
|
+
[17, 68, 42],
|
|
1168
|
+
[17, 50, 22, 6, 51, 23],
|
|
1169
|
+
[19, 46, 16, 6, 47, 17],
|
|
1170
|
+
// 22
|
|
1171
|
+
[2, 139, 111, 7, 140, 112],
|
|
1172
|
+
[17, 74, 46],
|
|
1173
|
+
[7, 54, 24, 16, 55, 25],
|
|
1174
|
+
[34, 37, 13],
|
|
1175
|
+
// 23
|
|
1176
|
+
[4, 151, 121, 5, 152, 122],
|
|
1177
|
+
[4, 75, 47, 14, 76, 48],
|
|
1178
|
+
[11, 54, 24, 14, 55, 25],
|
|
1179
|
+
[16, 45, 15, 14, 46, 16],
|
|
1180
|
+
// 24
|
|
1181
|
+
[6, 147, 117, 4, 148, 118],
|
|
1182
|
+
[6, 73, 45, 14, 74, 46],
|
|
1183
|
+
[11, 54, 24, 16, 55, 25],
|
|
1184
|
+
[30, 46, 16, 2, 47, 17],
|
|
1185
|
+
// 25
|
|
1186
|
+
[8, 132, 106, 4, 133, 107],
|
|
1187
|
+
[8, 75, 47, 13, 76, 48],
|
|
1188
|
+
[7, 54, 24, 22, 55, 25],
|
|
1189
|
+
[22, 45, 15, 13, 46, 16],
|
|
1190
|
+
// 26
|
|
1191
|
+
[10, 142, 114, 2, 143, 115],
|
|
1192
|
+
[19, 74, 46, 4, 75, 47],
|
|
1193
|
+
[28, 50, 22, 6, 51, 23],
|
|
1194
|
+
[33, 46, 16, 4, 47, 17],
|
|
1195
|
+
// 27
|
|
1196
|
+
[8, 152, 122, 4, 153, 123],
|
|
1197
|
+
[22, 73, 45, 3, 74, 46],
|
|
1198
|
+
[8, 53, 23, 26, 54, 24],
|
|
1199
|
+
[12, 45, 15, 28, 46, 16],
|
|
1200
|
+
// 28
|
|
1201
|
+
[3, 147, 117, 10, 148, 118],
|
|
1202
|
+
[3, 73, 45, 23, 74, 46],
|
|
1203
|
+
[4, 54, 24, 31, 55, 25],
|
|
1204
|
+
[11, 45, 15, 31, 46, 16],
|
|
1205
|
+
// 29
|
|
1206
|
+
[7, 146, 116, 7, 147, 117],
|
|
1207
|
+
[21, 73, 45, 7, 74, 46],
|
|
1208
|
+
[1, 53, 23, 37, 54, 24],
|
|
1209
|
+
[19, 45, 15, 26, 46, 16],
|
|
1210
|
+
// 30
|
|
1211
|
+
[5, 145, 115, 10, 146, 116],
|
|
1212
|
+
[19, 75, 47, 10, 76, 48],
|
|
1213
|
+
[15, 54, 24, 25, 55, 25],
|
|
1214
|
+
[23, 45, 15, 25, 46, 16],
|
|
1215
|
+
// 31
|
|
1216
|
+
[13, 145, 115, 3, 146, 116],
|
|
1217
|
+
[2, 74, 46, 29, 75, 47],
|
|
1218
|
+
[42, 54, 24, 1, 55, 25],
|
|
1219
|
+
[23, 45, 15, 28, 46, 16],
|
|
1220
|
+
// 32
|
|
1221
|
+
[17, 145, 115],
|
|
1222
|
+
[10, 74, 46, 23, 75, 47],
|
|
1223
|
+
[10, 54, 24, 35, 55, 25],
|
|
1224
|
+
[19, 45, 15, 35, 46, 16],
|
|
1225
|
+
// 33
|
|
1226
|
+
[17, 145, 115, 1, 146, 116],
|
|
1227
|
+
[14, 74, 46, 21, 75, 47],
|
|
1228
|
+
[29, 54, 24, 19, 55, 25],
|
|
1229
|
+
[11, 45, 15, 46, 46, 16],
|
|
1230
|
+
// 34
|
|
1231
|
+
[13, 145, 115, 6, 146, 116],
|
|
1232
|
+
[14, 74, 46, 23, 75, 47],
|
|
1233
|
+
[44, 54, 24, 7, 55, 25],
|
|
1234
|
+
[59, 46, 16, 1, 47, 17],
|
|
1235
|
+
// 35
|
|
1236
|
+
[12, 151, 121, 7, 152, 122],
|
|
1237
|
+
[12, 75, 47, 26, 76, 48],
|
|
1238
|
+
[39, 54, 24, 14, 55, 25],
|
|
1239
|
+
[22, 45, 15, 41, 46, 16],
|
|
1240
|
+
// 36
|
|
1241
|
+
[6, 151, 121, 14, 152, 122],
|
|
1242
|
+
[6, 75, 47, 34, 76, 48],
|
|
1243
|
+
[46, 54, 24, 10, 55, 25],
|
|
1244
|
+
[2, 45, 15, 64, 46, 16],
|
|
1245
|
+
// 37
|
|
1246
|
+
[17, 152, 122, 4, 153, 123],
|
|
1247
|
+
[29, 74, 46, 14, 75, 47],
|
|
1248
|
+
[49, 54, 24, 10, 55, 25],
|
|
1249
|
+
[24, 45, 15, 46, 46, 16],
|
|
1250
|
+
// 38
|
|
1251
|
+
[4, 152, 122, 18, 153, 123],
|
|
1252
|
+
[13, 74, 46, 32, 75, 47],
|
|
1253
|
+
[48, 54, 24, 14, 55, 25],
|
|
1254
|
+
[42, 45, 15, 32, 46, 16],
|
|
1255
|
+
// 39
|
|
1256
|
+
[20, 147, 117, 4, 148, 118],
|
|
1257
|
+
[40, 75, 47, 7, 76, 48],
|
|
1258
|
+
[43, 54, 24, 22, 55, 25],
|
|
1259
|
+
[10, 45, 15, 67, 46, 16],
|
|
1260
|
+
// 40
|
|
1261
|
+
[19, 148, 118, 6, 149, 119],
|
|
1262
|
+
[18, 75, 47, 31, 76, 48],
|
|
1263
|
+
[34, 54, 24, 34, 55, 25],
|
|
1264
|
+
[20, 45, 15, 61, 46, 16]
|
|
1265
|
+
];
|
|
1266
|
+
const qrRSBlock = /* @__PURE__ */ __name(function(totalCount, dataCount) {
|
|
1267
|
+
const _this2 = {};
|
|
1268
|
+
_this2.totalCount = totalCount;
|
|
1269
|
+
_this2.dataCount = dataCount;
|
|
1270
|
+
return _this2;
|
|
1271
|
+
}, "qrRSBlock");
|
|
1272
|
+
const _this = {};
|
|
1273
|
+
const getRsBlockTable = /* @__PURE__ */ __name(function(typeNumber, errorCorrectionLevel) {
|
|
1274
|
+
switch (errorCorrectionLevel) {
|
|
1275
|
+
case QRErrorCorrectionLevel.L:
|
|
1276
|
+
return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 0];
|
|
1277
|
+
case QRErrorCorrectionLevel.M:
|
|
1278
|
+
return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 1];
|
|
1279
|
+
case QRErrorCorrectionLevel.Q:
|
|
1280
|
+
return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 2];
|
|
1281
|
+
case QRErrorCorrectionLevel.H:
|
|
1282
|
+
return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 3];
|
|
1283
|
+
default:
|
|
1284
|
+
return void 0;
|
|
1285
|
+
}
|
|
1286
|
+
}, "getRsBlockTable");
|
|
1287
|
+
_this.getRSBlocks = function(typeNumber, errorCorrectionLevel) {
|
|
1288
|
+
const rsBlock = getRsBlockTable(typeNumber, errorCorrectionLevel);
|
|
1289
|
+
if (typeof rsBlock == "undefined") {
|
|
1290
|
+
throw "bad rs block @ typeNumber:" + typeNumber + "/errorCorrectionLevel:" + errorCorrectionLevel;
|
|
1291
|
+
}
|
|
1292
|
+
const length = rsBlock.length / 3;
|
|
1293
|
+
const list = [];
|
|
1294
|
+
for (let i = 0; i < length; i += 1) {
|
|
1295
|
+
const count = rsBlock[i * 3 + 0];
|
|
1296
|
+
const totalCount = rsBlock[i * 3 + 1];
|
|
1297
|
+
const dataCount = rsBlock[i * 3 + 2];
|
|
1298
|
+
for (let j = 0; j < count; j += 1) {
|
|
1299
|
+
list.push(qrRSBlock(totalCount, dataCount));
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1302
|
+
return list;
|
|
1303
|
+
};
|
|
1304
|
+
return _this;
|
|
1305
|
+
})();
|
|
1306
|
+
var qrBitBuffer = /* @__PURE__ */ __name(function() {
|
|
1307
|
+
const _buffer = [];
|
|
1308
|
+
let _length = 0;
|
|
1309
|
+
const _this = {};
|
|
1310
|
+
_this.getBuffer = function() {
|
|
1311
|
+
return _buffer;
|
|
1312
|
+
};
|
|
1313
|
+
_this.getAt = function(index) {
|
|
1314
|
+
const bufIndex = Math.floor(index / 8);
|
|
1315
|
+
return (_buffer[bufIndex] >>> 7 - index % 8 & 1) == 1;
|
|
1316
|
+
};
|
|
1317
|
+
_this.put = function(num, length) {
|
|
1318
|
+
for (let i = 0; i < length; i += 1) {
|
|
1319
|
+
_this.putBit((num >>> length - i - 1 & 1) == 1);
|
|
1320
|
+
}
|
|
1321
|
+
};
|
|
1322
|
+
_this.getLengthInBits = function() {
|
|
1323
|
+
return _length;
|
|
1324
|
+
};
|
|
1325
|
+
_this.putBit = function(bit) {
|
|
1326
|
+
const bufIndex = Math.floor(_length / 8);
|
|
1327
|
+
if (_buffer.length <= bufIndex) {
|
|
1328
|
+
_buffer.push(0);
|
|
1329
|
+
}
|
|
1330
|
+
if (bit) {
|
|
1331
|
+
_buffer[bufIndex] |= 128 >>> _length % 8;
|
|
1332
|
+
}
|
|
1333
|
+
_length += 1;
|
|
1334
|
+
};
|
|
1335
|
+
return _this;
|
|
1336
|
+
}, "qrBitBuffer");
|
|
1337
|
+
var qrNumber = /* @__PURE__ */ __name(function(data) {
|
|
1338
|
+
const _mode = QRMode.MODE_NUMBER;
|
|
1339
|
+
const _data = data;
|
|
1340
|
+
const _this = {};
|
|
1341
|
+
_this.getMode = function() {
|
|
1342
|
+
return _mode;
|
|
1343
|
+
};
|
|
1344
|
+
_this.getLength = function(buffer) {
|
|
1345
|
+
return _data.length;
|
|
1346
|
+
};
|
|
1347
|
+
_this.write = function(buffer) {
|
|
1348
|
+
const data2 = _data;
|
|
1349
|
+
let i = 0;
|
|
1350
|
+
while (i + 2 < data2.length) {
|
|
1351
|
+
buffer.put(strToNum(data2.substring(i, i + 3)), 10);
|
|
1352
|
+
i += 3;
|
|
1353
|
+
}
|
|
1354
|
+
if (i < data2.length) {
|
|
1355
|
+
if (data2.length - i == 1) {
|
|
1356
|
+
buffer.put(strToNum(data2.substring(i, i + 1)), 4);
|
|
1357
|
+
} else if (data2.length - i == 2) {
|
|
1358
|
+
buffer.put(strToNum(data2.substring(i, i + 2)), 7);
|
|
1359
|
+
}
|
|
1360
|
+
}
|
|
1361
|
+
};
|
|
1362
|
+
const strToNum = /* @__PURE__ */ __name(function(s) {
|
|
1363
|
+
let num = 0;
|
|
1364
|
+
for (let i = 0; i < s.length; i += 1) {
|
|
1365
|
+
num = num * 10 + chatToNum(s.charAt(i));
|
|
1366
|
+
}
|
|
1367
|
+
return num;
|
|
1368
|
+
}, "strToNum");
|
|
1369
|
+
const chatToNum = /* @__PURE__ */ __name(function(c) {
|
|
1370
|
+
if ("0" <= c && c <= "9") {
|
|
1371
|
+
return c.charCodeAt(0) - "0".charCodeAt(0);
|
|
1372
|
+
}
|
|
1373
|
+
throw "illegal char :" + c;
|
|
1374
|
+
}, "chatToNum");
|
|
1375
|
+
return _this;
|
|
1376
|
+
}, "qrNumber");
|
|
1377
|
+
var qrAlphaNum = /* @__PURE__ */ __name(function(data) {
|
|
1378
|
+
const _mode = QRMode.MODE_ALPHA_NUM;
|
|
1379
|
+
const _data = data;
|
|
1380
|
+
const _this = {};
|
|
1381
|
+
_this.getMode = function() {
|
|
1382
|
+
return _mode;
|
|
1383
|
+
};
|
|
1384
|
+
_this.getLength = function(buffer) {
|
|
1385
|
+
return _data.length;
|
|
1386
|
+
};
|
|
1387
|
+
_this.write = function(buffer) {
|
|
1388
|
+
const s = _data;
|
|
1389
|
+
let i = 0;
|
|
1390
|
+
while (i + 1 < s.length) {
|
|
1391
|
+
buffer.put(
|
|
1392
|
+
getCode(s.charAt(i)) * 45 + getCode(s.charAt(i + 1)),
|
|
1393
|
+
11
|
|
1394
|
+
);
|
|
1395
|
+
i += 2;
|
|
1396
|
+
}
|
|
1397
|
+
if (i < s.length) {
|
|
1398
|
+
buffer.put(getCode(s.charAt(i)), 6);
|
|
1399
|
+
}
|
|
1400
|
+
};
|
|
1401
|
+
const getCode = /* @__PURE__ */ __name(function(c) {
|
|
1402
|
+
if ("0" <= c && c <= "9") {
|
|
1403
|
+
return c.charCodeAt(0) - "0".charCodeAt(0);
|
|
1404
|
+
} else if ("A" <= c && c <= "Z") {
|
|
1405
|
+
return c.charCodeAt(0) - "A".charCodeAt(0) + 10;
|
|
1406
|
+
} else {
|
|
1407
|
+
switch (c) {
|
|
1408
|
+
case " ":
|
|
1409
|
+
return 36;
|
|
1410
|
+
case "$":
|
|
1411
|
+
return 37;
|
|
1412
|
+
case "%":
|
|
1413
|
+
return 38;
|
|
1414
|
+
case "*":
|
|
1415
|
+
return 39;
|
|
1416
|
+
case "+":
|
|
1417
|
+
return 40;
|
|
1418
|
+
case "-":
|
|
1419
|
+
return 41;
|
|
1420
|
+
case ".":
|
|
1421
|
+
return 42;
|
|
1422
|
+
case "/":
|
|
1423
|
+
return 43;
|
|
1424
|
+
case ":":
|
|
1425
|
+
return 44;
|
|
1426
|
+
default:
|
|
1427
|
+
throw "illegal char :" + c;
|
|
1428
|
+
}
|
|
1429
|
+
}
|
|
1430
|
+
}, "getCode");
|
|
1431
|
+
return _this;
|
|
1432
|
+
}, "qrAlphaNum");
|
|
1433
|
+
var qr8BitByte = /* @__PURE__ */ __name(function(data) {
|
|
1434
|
+
const _mode = QRMode.MODE_8BIT_BYTE;
|
|
1435
|
+
const _data = data;
|
|
1436
|
+
const _bytes = qrcode.stringToBytes(data);
|
|
1437
|
+
const _this = {};
|
|
1438
|
+
_this.getMode = function() {
|
|
1439
|
+
return _mode;
|
|
1440
|
+
};
|
|
1441
|
+
_this.getLength = function(buffer) {
|
|
1442
|
+
return _bytes.length;
|
|
1443
|
+
};
|
|
1444
|
+
_this.write = function(buffer) {
|
|
1445
|
+
for (let i = 0; i < _bytes.length; i += 1) {
|
|
1446
|
+
buffer.put(_bytes[i], 8);
|
|
1447
|
+
}
|
|
1448
|
+
};
|
|
1449
|
+
return _this;
|
|
1450
|
+
}, "qr8BitByte");
|
|
1451
|
+
var qrKanji = /* @__PURE__ */ __name(function(data) {
|
|
1452
|
+
const _mode = QRMode.MODE_KANJI;
|
|
1453
|
+
const _data = data;
|
|
1454
|
+
const stringToBytes2 = qrcode.stringToBytes;
|
|
1455
|
+
!(function(c, code) {
|
|
1456
|
+
const test = stringToBytes2(c);
|
|
1457
|
+
if (test.length != 2 || (test[0] << 8 | test[1]) != code) {
|
|
1458
|
+
throw "sjis not supported.";
|
|
1459
|
+
}
|
|
1460
|
+
})("\u53CB", 38726);
|
|
1461
|
+
const _bytes = stringToBytes2(data);
|
|
1462
|
+
const _this = {};
|
|
1463
|
+
_this.getMode = function() {
|
|
1464
|
+
return _mode;
|
|
1465
|
+
};
|
|
1466
|
+
_this.getLength = function(buffer) {
|
|
1467
|
+
return ~~(_bytes.length / 2);
|
|
1468
|
+
};
|
|
1469
|
+
_this.write = function(buffer) {
|
|
1470
|
+
const data2 = _bytes;
|
|
1471
|
+
let i = 0;
|
|
1472
|
+
while (i + 1 < data2.length) {
|
|
1473
|
+
let c = (255 & data2[i]) << 8 | 255 & data2[i + 1];
|
|
1474
|
+
if (33088 <= c && c <= 40956) {
|
|
1475
|
+
c -= 33088;
|
|
1476
|
+
} else if (57408 <= c && c <= 60351) {
|
|
1477
|
+
c -= 49472;
|
|
1478
|
+
} else {
|
|
1479
|
+
throw "illegal char at " + (i + 1) + "/" + c;
|
|
1480
|
+
}
|
|
1481
|
+
c = (c >>> 8 & 255) * 192 + (c & 255);
|
|
1482
|
+
buffer.put(c, 13);
|
|
1483
|
+
i += 2;
|
|
1484
|
+
}
|
|
1485
|
+
if (i < data2.length) {
|
|
1486
|
+
throw "illegal char at " + (i + 1);
|
|
1487
|
+
}
|
|
1488
|
+
};
|
|
1489
|
+
return _this;
|
|
1490
|
+
}, "qrKanji");
|
|
1491
|
+
var byteArrayOutputStream = /* @__PURE__ */ __name(function() {
|
|
1492
|
+
const _bytes = [];
|
|
1493
|
+
const _this = {};
|
|
1494
|
+
_this.writeByte = function(b) {
|
|
1495
|
+
_bytes.push(b & 255);
|
|
1496
|
+
};
|
|
1497
|
+
_this.writeShort = function(i) {
|
|
1498
|
+
_this.writeByte(i);
|
|
1499
|
+
_this.writeByte(i >>> 8);
|
|
1500
|
+
};
|
|
1501
|
+
_this.writeBytes = function(b, off, len) {
|
|
1502
|
+
off = off || 0;
|
|
1503
|
+
len = len || b.length;
|
|
1504
|
+
for (let i = 0; i < len; i += 1) {
|
|
1505
|
+
_this.writeByte(b[i + off]);
|
|
1506
|
+
}
|
|
1507
|
+
};
|
|
1508
|
+
_this.writeString = function(s) {
|
|
1509
|
+
for (let i = 0; i < s.length; i += 1) {
|
|
1510
|
+
_this.writeByte(s.charCodeAt(i));
|
|
1511
|
+
}
|
|
1512
|
+
};
|
|
1513
|
+
_this.toByteArray = function() {
|
|
1514
|
+
return _bytes;
|
|
1515
|
+
};
|
|
1516
|
+
_this.toString = function() {
|
|
1517
|
+
let s = "";
|
|
1518
|
+
s += "[";
|
|
1519
|
+
for (let i = 0; i < _bytes.length; i += 1) {
|
|
1520
|
+
if (i > 0) {
|
|
1521
|
+
s += ",";
|
|
1522
|
+
}
|
|
1523
|
+
s += _bytes[i];
|
|
1524
|
+
}
|
|
1525
|
+
s += "]";
|
|
1526
|
+
return s;
|
|
1527
|
+
};
|
|
1528
|
+
return _this;
|
|
1529
|
+
}, "byteArrayOutputStream");
|
|
1530
|
+
var base64EncodeOutputStream = /* @__PURE__ */ __name(function() {
|
|
1531
|
+
let _buffer = 0;
|
|
1532
|
+
let _buflen = 0;
|
|
1533
|
+
let _length = 0;
|
|
1534
|
+
let _base64 = "";
|
|
1535
|
+
const _this = {};
|
|
1536
|
+
const writeEncoded = /* @__PURE__ */ __name(function(b) {
|
|
1537
|
+
_base64 += String.fromCharCode(encode(b & 63));
|
|
1538
|
+
}, "writeEncoded");
|
|
1539
|
+
const encode = /* @__PURE__ */ __name(function(n) {
|
|
1540
|
+
if (n < 0) {
|
|
1541
|
+
throw "n:" + n;
|
|
1542
|
+
} else if (n < 26) {
|
|
1543
|
+
return 65 + n;
|
|
1544
|
+
} else if (n < 52) {
|
|
1545
|
+
return 97 + (n - 26);
|
|
1546
|
+
} else if (n < 62) {
|
|
1547
|
+
return 48 + (n - 52);
|
|
1548
|
+
} else if (n == 62) {
|
|
1549
|
+
return 43;
|
|
1550
|
+
} else if (n == 63) {
|
|
1551
|
+
return 47;
|
|
1552
|
+
} else {
|
|
1553
|
+
throw "n:" + n;
|
|
1554
|
+
}
|
|
1555
|
+
}, "encode");
|
|
1556
|
+
_this.writeByte = function(n) {
|
|
1557
|
+
_buffer = _buffer << 8 | n & 255;
|
|
1558
|
+
_buflen += 8;
|
|
1559
|
+
_length += 1;
|
|
1560
|
+
while (_buflen >= 6) {
|
|
1561
|
+
writeEncoded(_buffer >>> _buflen - 6);
|
|
1562
|
+
_buflen -= 6;
|
|
1563
|
+
}
|
|
1564
|
+
};
|
|
1565
|
+
_this.flush = function() {
|
|
1566
|
+
if (_buflen > 0) {
|
|
1567
|
+
writeEncoded(_buffer << 6 - _buflen);
|
|
1568
|
+
_buffer = 0;
|
|
1569
|
+
_buflen = 0;
|
|
1570
|
+
}
|
|
1571
|
+
if (_length % 3 != 0) {
|
|
1572
|
+
const padlen = 3 - _length % 3;
|
|
1573
|
+
for (let i = 0; i < padlen; i += 1) {
|
|
1574
|
+
_base64 += "=";
|
|
1575
|
+
}
|
|
1576
|
+
}
|
|
1577
|
+
};
|
|
1578
|
+
_this.toString = function() {
|
|
1579
|
+
return _base64;
|
|
1580
|
+
};
|
|
1581
|
+
return _this;
|
|
1582
|
+
}, "base64EncodeOutputStream");
|
|
1583
|
+
var base64DecodeInputStream = /* @__PURE__ */ __name(function(str) {
|
|
1584
|
+
const _str = str;
|
|
1585
|
+
let _pos = 0;
|
|
1586
|
+
let _buffer = 0;
|
|
1587
|
+
let _buflen = 0;
|
|
1588
|
+
const _this = {};
|
|
1589
|
+
_this.read = function() {
|
|
1590
|
+
while (_buflen < 8) {
|
|
1591
|
+
if (_pos >= _str.length) {
|
|
1592
|
+
if (_buflen == 0) {
|
|
1593
|
+
return -1;
|
|
1594
|
+
}
|
|
1595
|
+
throw "unexpected end of file./" + _buflen;
|
|
1596
|
+
}
|
|
1597
|
+
const c = _str.charAt(_pos);
|
|
1598
|
+
_pos += 1;
|
|
1599
|
+
if (c == "=") {
|
|
1600
|
+
_buflen = 0;
|
|
1601
|
+
return -1;
|
|
1602
|
+
} else if (c.match(/^\s$/)) {
|
|
1603
|
+
continue;
|
|
1604
|
+
}
|
|
1605
|
+
_buffer = _buffer << 6 | decode(c.charCodeAt(0));
|
|
1606
|
+
_buflen += 6;
|
|
1607
|
+
}
|
|
1608
|
+
const n = _buffer >>> _buflen - 8 & 255;
|
|
1609
|
+
_buflen -= 8;
|
|
1610
|
+
return n;
|
|
1611
|
+
};
|
|
1612
|
+
const decode = /* @__PURE__ */ __name(function(c) {
|
|
1613
|
+
if (65 <= c && c <= 90) {
|
|
1614
|
+
return c - 65;
|
|
1615
|
+
} else if (97 <= c && c <= 122) {
|
|
1616
|
+
return c - 97 + 26;
|
|
1617
|
+
} else if (48 <= c && c <= 57) {
|
|
1618
|
+
return c - 48 + 52;
|
|
1619
|
+
} else if (c == 43) {
|
|
1620
|
+
return 62;
|
|
1621
|
+
} else if (c == 47) {
|
|
1622
|
+
return 63;
|
|
1623
|
+
} else {
|
|
1624
|
+
throw "c:" + c;
|
|
1625
|
+
}
|
|
1626
|
+
}, "decode");
|
|
1627
|
+
return _this;
|
|
1628
|
+
}, "base64DecodeInputStream");
|
|
1629
|
+
var gifImage = /* @__PURE__ */ __name(function(width, height) {
|
|
1630
|
+
const _width = width;
|
|
1631
|
+
const _height = height;
|
|
1632
|
+
const _data = new Array(width * height);
|
|
1633
|
+
const _this = {};
|
|
1634
|
+
_this.setPixel = function(x, y, pixel) {
|
|
1635
|
+
_data[y * _width + x] = pixel;
|
|
1636
|
+
};
|
|
1637
|
+
_this.write = function(out) {
|
|
1638
|
+
out.writeString("GIF87a");
|
|
1639
|
+
out.writeShort(_width);
|
|
1640
|
+
out.writeShort(_height);
|
|
1641
|
+
out.writeByte(128);
|
|
1642
|
+
out.writeByte(0);
|
|
1643
|
+
out.writeByte(0);
|
|
1644
|
+
out.writeByte(0);
|
|
1645
|
+
out.writeByte(0);
|
|
1646
|
+
out.writeByte(0);
|
|
1647
|
+
out.writeByte(255);
|
|
1648
|
+
out.writeByte(255);
|
|
1649
|
+
out.writeByte(255);
|
|
1650
|
+
out.writeString(",");
|
|
1651
|
+
out.writeShort(0);
|
|
1652
|
+
out.writeShort(0);
|
|
1653
|
+
out.writeShort(_width);
|
|
1654
|
+
out.writeShort(_height);
|
|
1655
|
+
out.writeByte(0);
|
|
1656
|
+
const lzwMinCodeSize = 2;
|
|
1657
|
+
const raster = getLZWRaster(lzwMinCodeSize);
|
|
1658
|
+
out.writeByte(lzwMinCodeSize);
|
|
1659
|
+
let offset = 0;
|
|
1660
|
+
while (raster.length - offset > 255) {
|
|
1661
|
+
out.writeByte(255);
|
|
1662
|
+
out.writeBytes(raster, offset, 255);
|
|
1663
|
+
offset += 255;
|
|
1664
|
+
}
|
|
1665
|
+
out.writeByte(raster.length - offset);
|
|
1666
|
+
out.writeBytes(raster, offset, raster.length - offset);
|
|
1667
|
+
out.writeByte(0);
|
|
1668
|
+
out.writeString(";");
|
|
1669
|
+
};
|
|
1670
|
+
const bitOutputStream = /* @__PURE__ */ __name(function(out) {
|
|
1671
|
+
const _out = out;
|
|
1672
|
+
let _bitLength = 0;
|
|
1673
|
+
let _bitBuffer = 0;
|
|
1674
|
+
const _this2 = {};
|
|
1675
|
+
_this2.write = function(data, length) {
|
|
1676
|
+
if (data >>> length != 0) {
|
|
1677
|
+
throw "length over";
|
|
1678
|
+
}
|
|
1679
|
+
while (_bitLength + length >= 8) {
|
|
1680
|
+
_out.writeByte(255 & (data << _bitLength | _bitBuffer));
|
|
1681
|
+
length -= 8 - _bitLength;
|
|
1682
|
+
data >>>= 8 - _bitLength;
|
|
1683
|
+
_bitBuffer = 0;
|
|
1684
|
+
_bitLength = 0;
|
|
1685
|
+
}
|
|
1686
|
+
_bitBuffer = data << _bitLength | _bitBuffer;
|
|
1687
|
+
_bitLength = _bitLength + length;
|
|
1688
|
+
};
|
|
1689
|
+
_this2.flush = function() {
|
|
1690
|
+
if (_bitLength > 0) {
|
|
1691
|
+
_out.writeByte(_bitBuffer);
|
|
1692
|
+
}
|
|
1693
|
+
};
|
|
1694
|
+
return _this2;
|
|
1695
|
+
}, "bitOutputStream");
|
|
1696
|
+
const getLZWRaster = /* @__PURE__ */ __name(function(lzwMinCodeSize) {
|
|
1697
|
+
const clearCode = 1 << lzwMinCodeSize;
|
|
1698
|
+
const endCode = (1 << lzwMinCodeSize) + 1;
|
|
1699
|
+
let bitLength = lzwMinCodeSize + 1;
|
|
1700
|
+
const table = lzwTable();
|
|
1701
|
+
for (let i = 0; i < clearCode; i += 1) {
|
|
1702
|
+
table.add(String.fromCharCode(i));
|
|
1703
|
+
}
|
|
1704
|
+
table.add(String.fromCharCode(clearCode));
|
|
1705
|
+
table.add(String.fromCharCode(endCode));
|
|
1706
|
+
const byteOut = byteArrayOutputStream();
|
|
1707
|
+
const bitOut = bitOutputStream(byteOut);
|
|
1708
|
+
bitOut.write(clearCode, bitLength);
|
|
1709
|
+
let dataIndex = 0;
|
|
1710
|
+
let s = String.fromCharCode(_data[dataIndex]);
|
|
1711
|
+
dataIndex += 1;
|
|
1712
|
+
while (dataIndex < _data.length) {
|
|
1713
|
+
const c = String.fromCharCode(_data[dataIndex]);
|
|
1714
|
+
dataIndex += 1;
|
|
1715
|
+
if (table.contains(s + c)) {
|
|
1716
|
+
s = s + c;
|
|
1717
|
+
} else {
|
|
1718
|
+
bitOut.write(table.indexOf(s), bitLength);
|
|
1719
|
+
if (table.size() < 4095) {
|
|
1720
|
+
if (table.size() == 1 << bitLength) {
|
|
1721
|
+
bitLength += 1;
|
|
1722
|
+
}
|
|
1723
|
+
table.add(s + c);
|
|
1724
|
+
}
|
|
1725
|
+
s = c;
|
|
1726
|
+
}
|
|
1727
|
+
}
|
|
1728
|
+
bitOut.write(table.indexOf(s), bitLength);
|
|
1729
|
+
bitOut.write(endCode, bitLength);
|
|
1730
|
+
bitOut.flush();
|
|
1731
|
+
return byteOut.toByteArray();
|
|
1732
|
+
}, "getLZWRaster");
|
|
1733
|
+
const lzwTable = /* @__PURE__ */ __name(function() {
|
|
1734
|
+
const _map = {};
|
|
1735
|
+
let _size = 0;
|
|
1736
|
+
const _this2 = {};
|
|
1737
|
+
_this2.add = function(key) {
|
|
1738
|
+
if (_this2.contains(key)) {
|
|
1739
|
+
throw "dup key:" + key;
|
|
1740
|
+
}
|
|
1741
|
+
_map[key] = _size;
|
|
1742
|
+
_size += 1;
|
|
1743
|
+
};
|
|
1744
|
+
_this2.size = function() {
|
|
1745
|
+
return _size;
|
|
1746
|
+
};
|
|
1747
|
+
_this2.indexOf = function(key) {
|
|
1748
|
+
return _map[key];
|
|
1749
|
+
};
|
|
1750
|
+
_this2.contains = function(key) {
|
|
1751
|
+
return typeof _map[key] != "undefined";
|
|
1752
|
+
};
|
|
1753
|
+
return _this2;
|
|
1754
|
+
}, "lzwTable");
|
|
1755
|
+
return _this;
|
|
1756
|
+
}, "gifImage");
|
|
1757
|
+
var createDataURL = /* @__PURE__ */ __name(function(width, height, getPixel) {
|
|
1758
|
+
const gif = gifImage(width, height);
|
|
1759
|
+
for (let y = 0; y < height; y += 1) {
|
|
1760
|
+
for (let x = 0; x < width; x += 1) {
|
|
1761
|
+
gif.setPixel(x, y, getPixel(x, y));
|
|
1762
|
+
}
|
|
1763
|
+
}
|
|
1764
|
+
const b = byteArrayOutputStream();
|
|
1765
|
+
gif.write(b);
|
|
1766
|
+
const base64 = base64EncodeOutputStream();
|
|
1767
|
+
const bytes = b.toByteArray();
|
|
1768
|
+
for (let i = 0; i < bytes.length; i += 1) {
|
|
1769
|
+
base64.writeByte(bytes[i]);
|
|
1770
|
+
}
|
|
1771
|
+
base64.flush();
|
|
1772
|
+
return "data:image/gif;base64," + base64;
|
|
1773
|
+
}, "createDataURL");
|
|
1774
|
+
var stringToBytes = qrcode.stringToBytes;
|
|
1775
|
+
|
|
1776
|
+
// dist/reasons.js
|
|
1777
|
+
var CORE = new Set(REASONS.map((one) => one.reason));
|
|
1778
|
+
var OWN = [
|
|
1779
|
+
["session.duplicate", "conflict", "another profile here already signs in to this HubSpot account"],
|
|
1780
|
+
["account.id-missing", "configuration_error", "WCHUBSPOT_TOKEN needs WCHUBSPOT_ACCOUNT, the HubSpot account's id"],
|
|
1781
|
+
["account.id-malformed", "configuration_error", "WCHUBSPOT_ACCOUNT must be the HubSpot account's id, digits only"],
|
|
1782
|
+
[
|
|
1783
|
+
"account.unchecked",
|
|
1784
|
+
"configuration_error",
|
|
1785
|
+
"a WCHUBSPOT_TOKEN profile uses the local copy only after an online run checked it"
|
|
1786
|
+
],
|
|
1787
|
+
["account.mismatch", "configuration_error", "WCHUBSPOT_ACCOUNT names another account than the token's own"],
|
|
1788
|
+
["account-remove.account-shared", "conflict", "another profile reads the same account, whose copy the store shares"],
|
|
1789
|
+
["session.expired", "authentication_error", "HubSpot refused the key: it was revoked, expired or mistyped"],
|
|
1790
|
+
["hubspot.scope-missing", "permission_error", "the HubSpot key lacks a scope this command needs"],
|
|
1791
|
+
["hubspot.access-denied", "permission_error", "the HubSpot key may not read this"],
|
|
1792
|
+
["hubspot.daily-limit", "rate_limited", "the HubSpot account spent its daily API allowance, shared by all its apps"],
|
|
1793
|
+
["hubspot.rate-limit", "rate_limited", "HubSpot asked to slow down for a few seconds"],
|
|
1794
|
+
["hubspot.too-many-filters", "validation_error", "a HubSpot search takes at most 6 conditions together"],
|
|
1795
|
+
["hubspot.search-cap", "validation_error", "a HubSpot search reaches only its first 10,000 results"]
|
|
1796
|
+
];
|
|
1797
|
+
var REASONS2 = defineReasons(OWN.filter(([reason]) => !CORE.has(reason)).map(([reason, code, message]) => ({
|
|
1798
|
+
reason,
|
|
1799
|
+
code,
|
|
1800
|
+
message,
|
|
1801
|
+
details: []
|
|
1802
|
+
})));
|
|
1803
|
+
var DETAILS2 = ["account", "profile", "profiles", "status", "scope"];
|
|
1804
|
+
|
|
1805
|
+
// dist/version.js
|
|
1806
|
+
var VERSION = "0.1.0";
|
|
1807
|
+
|
|
1808
|
+
// dist/identity.js
|
|
1809
|
+
var PACKAGE = "@wirecat/hubspot-cli";
|
|
1810
|
+
var IDENTITY = {
|
|
1811
|
+
command: "hubspot",
|
|
1812
|
+
appName: "hubspot-cli",
|
|
1813
|
+
envPrefix: "WCHUBSPOT",
|
|
1814
|
+
description: "read a HubSpot account's CRM",
|
|
1815
|
+
version: VERSION,
|
|
1816
|
+
issues: "https://github.com/WireCatLabs/hubspot-cli/issues/new",
|
|
1817
|
+
messenger: false,
|
|
1818
|
+
contentLanguages: ["en", "es", "ru"],
|
|
1819
|
+
// hubspot paces itself to 4 requests a second (PACE in src/hubspot/transport.ts); a run's budget counts on half that.
|
|
1820
|
+
requestMs: 500,
|
|
1821
|
+
errors: { reasons: REASONS2, details: DETAILS2 }
|
|
1822
|
+
};
|
|
1823
|
+
var DESKTOP = {
|
|
1824
|
+
...IDENTITY,
|
|
1825
|
+
docs: "https://github.com/WireCatLabs/hubspot-cli#readme",
|
|
1826
|
+
// Every request goes to HubSpot's one API host; `api` refuses any other (src/commands/api.ts).
|
|
1827
|
+
hosts: ["api.hubapi.com"],
|
|
1828
|
+
tagline: "HubSpot CRM: deals, contacts and companies",
|
|
1829
|
+
syncs: "your deals, contacts and companies",
|
|
1830
|
+
signIn: {
|
|
1831
|
+
gives: "Lets your agent read the account's CRM with the scopes you give the key; this release changes nothing.",
|
|
1832
|
+
asks: "A service key or a legacy private app's access token from your HubSpot account, with read scopes."
|
|
1833
|
+
}
|
|
1834
|
+
};
|
|
1835
|
+
var SKILL = new URL("../skills/hubspot-cli/SKILL.md", new URL("../identity.js", import.meta.url).href);
|
|
1836
|
+
|
|
1837
|
+
export {
|
|
1838
|
+
DEFAULT_LINK_CONFIG,
|
|
1839
|
+
refsForLink,
|
|
1840
|
+
linkConfigOf,
|
|
1841
|
+
linkFor,
|
|
1842
|
+
PACKAGE,
|
|
1843
|
+
IDENTITY,
|
|
1844
|
+
DESKTOP,
|
|
1845
|
+
SKILL
|
|
1846
|
+
};
|