@incodetech/web 2.0.1 → 2.1.0-rc.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/dist/ae-signature/ae-signature.es.js +15 -13
- package/dist/ae-signature/styles.css +3 -17
- package/dist/ae-signature/styles2.css +15 -5
- package/dist/aligndevicelottie-DY_bX_p8.js +12769 -0
- package/dist/antifraud/antifraud.es.js +23 -16
- package/dist/authentication/authentication.es.js +42 -27
- package/dist/autoFocusTitle-BzkUiELM.js +29 -0
- package/dist/{back-horizontal-hint-B8Brxh3U.js → back-horizontal-hint-D_8LptLm.js} +26 -26
- package/dist/back-tutorial-vb1MxlrT.js +14597 -0
- package/dist/{back-vertical-hint-BBo36dxn.js → back-vertical-hint-C1evxxq2.js} +27 -27
- package/dist/backdevicelottie-HypPqBz7.js +16690 -0
- package/dist/base.css +1258 -104
- package/dist/blurdevicelottie-CBXtBFiJ.js +15951 -0
- package/dist/bottomSheet-F1GJfQx_.js +39 -0
- package/dist/browser-ponyfill-CLLvZCVg.js +441 -0
- package/dist/button-CM_hgyIP.js +35 -0
- package/dist/checkbox-BoeLHKgp.js +96 -0
- package/dist/consent/consent.es.js +89 -73
- package/dist/consent/styles.css +35 -22
- package/dist/countrySelector-mSWyHSy4.js +60 -0
- package/dist/cpf-ocr/cpf-ocr.es.js +2 -0
- package/dist/cpfOcr-MtpRztkG.js +92 -0
- package/dist/cpfOcr-jJkYCfsX.js +2 -0
- package/dist/cross-document-data-match/cross-document-data-match.es.js +20 -16
- package/dist/curp-validation/curp-validation.es.js +247 -203
- package/dist/customFields-DXXt9HGM.js +140 -0
- package/dist/customWatchlist-DsW04UF6.js +36 -0
- package/dist/dateInputComposed-C_mh4XBg.js +69 -0
- package/dist/dateInputComposed-Cy6a7ymh.js +1 -0
- package/dist/defineProperty-mefzVtTv.js +39 -0
- package/dist/document-capture/document-capture.es.js +2 -0
- package/dist/document-capture/styles.css +2 -5
- package/dist/documentCapture-8ypBJehw.js +2 -0
- package/dist/documentCapture-BDV_921m.js +880 -0
- package/dist/dropdownComposed-CEWBSdGl.js +1 -0
- package/dist/dropdownComposed-_fgAlo_C.js +380 -0
- package/dist/dynamic-forms/styles.css +25 -13
- package/dist/dynamicForms-DyfnsS7E.js +352 -0
- package/dist/ekyb/ekyb.es.js +2 -2
- package/dist/ekyb/styles.css +2 -0
- package/dist/ekybModule-CIPGmCvD.js +279 -0
- package/dist/ekybModule-DFoYpheB.js +2 -0
- package/dist/ekyc/ekyc.es.js +2 -2
- package/dist/ekyc/styles.css +9 -7
- package/dist/ekycModule-BGzwgjl1.js +2 -0
- package/dist/ekycModule-BuTaC5ct.js +257 -0
- package/dist/electronic-signature/electronic-signature.es.js +2 -2
- package/dist/electronic-signature-B-Q7M0wK.js +430 -0
- package/dist/email/email.es.js +199 -66
- package/dist/emailInput-KZmhjOdZ.js +39 -0
- package/dist/errorIcon-DJRZpd8j.js +26 -0
- package/dist/expiredId-Q1t6aVpk.js +85 -0
- package/dist/extensibility-Cs3KQQdC.js +3070 -0
- package/dist/extensibility.es.js +26 -25
- package/dist/face-match/face-match.es.js +2 -2
- package/dist/face-match/styles.css +0 -4
- package/dist/faceMatch--RDHJe4t.js +343 -0
- package/dist/faceMatch-yEKPYaym.js +2 -0
- package/dist/field-comparison/field-comparison.es.js +2 -0
- package/dist/field-comparison/styles.css +16 -0
- package/dist/fieldComparison-CAF86bTC.js +88 -0
- package/dist/fieldComparison-D0an7T_g.js +2 -0
- package/dist/fiscal-qr/fiscal-qr.es.js +224 -0
- package/dist/fiscal-qr/styles.css +71 -0
- package/dist/{flip-animation-CgwRsEmK.js → flip-animation-BGRvygw9.js} +4221 -4221
- package/dist/flow/flow.es.js +619 -484
- package/dist/flow/styles.css +378 -418
- package/dist/{front-horizontal-hint-DGGGi8e1.js → front-horizontal-hint-Uf5bHCsd.js} +70 -70
- package/dist/{front-vertical-hint-CNr5mE6Q.js → front-vertical-hint-DdWNA45v.js} +81 -81
- package/dist/frontdevicelottie-CLqitJhG.js +17314 -0
- package/dist/geolocation/geolocation.es.js +486 -395
- package/dist/glaredevicelottie-BS04U6Fc.js +14478 -0
- package/dist/governmentValidation/governmentValidation.es.js +166 -93
- package/dist/governmentValidation/styles.css +0 -17
- package/dist/homeScreen-BZnIEDrV.js +264 -0
- package/dist/hooks-Da_yP_Dr.js +149 -0
- package/dist/i18n-CoCO2ZuN.js +2971 -0
- package/dist/icons-Dbs9ZfYM.js +360 -0
- package/dist/id/id.es.js +583 -414
- package/dist/id/styles.css +59 -43
- package/dist/id-laser-h-DX8UbVNH.js +467 -0
- package/dist/id-laser-v-DhnHdjlB.js +490 -0
- package/dist/id-tutorial-lj4iKtYT.js +13165 -0
- package/dist/id-verification/id-verification.es.js +21 -17
- package/dist/idOcr-CjGbb4dB.js +123 -0
- package/dist/identity-reuse/identity-reuse.es.js +311 -182
- package/dist/identity-reuse/styles.css +134 -80
- package/dist/incode-logo-57XFniXU.js +4 -0
- package/dist/incodeComponent-wfnHlnXx.js +63 -0
- package/dist/incodeModule-BUDoTwT9.js +13 -0
- package/dist/index.es.js +16 -13
- package/dist/inputComposed-BEn7_nZd.js +1 -0
- package/dist/inputComposed-CQ4AsvZg.js +99 -0
- package/dist/loadingIcon-B0ysgiNq.js +148 -0
- package/dist/lottie_light-Dp9Bz3mf.js +9031 -0
- package/dist/mandatoryConsent-r0PQHmv-.js +107 -0
- package/dist/modal-nTSaG7nB.js +139 -0
- package/dist/modal.hooks-D2xhIuHA.js +195 -0
- package/dist/numberedStep-CEtwZqLp.js +13 -0
- package/dist/optionAccessibleLabel-CnA-mNAU.js +202 -0
- package/dist/otpInput-_JmtVwa0.js +195 -0
- package/dist/page-DxGQj7Gk.js +71 -0
- package/dist/{passport-horizontal-hint-Bgquwtac.js → passport-horizontal-hint-Bbm2mvSn.js} +55 -55
- package/dist/{passport-tutorial-DwRwtPVX.js → passport-tutorial-zT1ZoA-D.js} +7096 -7084
- package/dist/{passport-vertical-hint-BT1D5BrW.js → passport-vertical-hint-DJbCtBiM.js} +49 -49
- package/dist/pdf-BZA70WbM.js +22398 -0
- package/dist/pdfViewer-BK-yVIve.js +114 -0
- package/dist/phone/phone.es.js +214 -70
- package/dist/phoneInputComposed-DjNdsmPE.js +12142 -0
- package/dist/processing-BM-wT-1W.js +8 -0
- package/dist/qe-signature/qe-signature.es.js +15 -13
- package/dist/radioGroupComposed-BNuaopVr.js +215 -0
- package/dist/redirect-to-mobile/redirect-to-mobile.es.js +2774 -0
- package/dist/redirect-to-mobile/styles.css +19 -269
- package/dist/registerIncodeElement-77NGCDsy.js +11 -0
- package/dist/requiredLabelHint-DEadtiwx.js +17 -0
- package/dist/richText-Cf9aMOCk.js +3153 -0
- package/dist/rolldown-runtime--E5BIlTp.js +33 -0
- package/dist/selfie/selfie.es.js +54 -37
- package/dist/selfie/styles.css +0 -4
- package/dist/selfieTutorial-CtruLyO2.js +2689 -0
- package/dist/signature/signature.es.js +778 -405
- package/dist/snackbar-CxepGC3e.js +16 -0
- package/dist/spinner-B6RxGFrI.js +1 -0
- package/dist/spinner-D8a_2LvW.js +42 -0
- package/dist/statusPage-DMYPUwRZ.js +28 -0
- package/dist/successIcon-BAyDPT7I.js +30 -0
- package/dist/tabs-C8npVBbk.js +103 -0
- package/dist/themes/dark.css +5 -0
- package/dist/themes/light.css +4 -0
- package/dist/transitionSpinner-DRRz-NV8.js +26 -0
- package/dist/{tutorial-9vHAHvMK.js → tutorial-D1qaY2Tm.js} +1105 -856
- package/dist/types/ae-signature.d.ts +4 -1
- package/dist/types/antifraud.d.ts +9 -3
- package/dist/types/authentication.d.ts +4 -1
- package/dist/types/consent.d.ts +4 -1
- package/dist/types/cpf-ocr.d.ts +12 -0
- package/dist/types/cross-document-data-match.d.ts +4 -1
- package/dist/types/curp-validation.d.ts +9 -3
- package/dist/types/document-capture.d.ts +37 -0
- package/dist/types/ekyb.d.ts +4 -1
- package/dist/types/ekyc.d.ts +4 -1
- package/dist/types/electronic-signature.d.ts +4 -1
- package/dist/types/email.d.ts +4 -1
- package/dist/types/extensibility.d.ts +40 -15
- package/dist/types/face-match.d.ts +4 -1
- package/dist/types/field-comparison.d.ts +38 -0
- package/dist/types/fiscal-qr.d.ts +43 -0
- package/dist/types/flow.d.ts +5 -2
- package/dist/types/geolocation.d.ts +4 -1
- package/dist/types/governmentValidation.d.ts +4 -1
- package/dist/types/id-verification.d.ts +4 -1
- package/dist/types/id.d.ts +4 -1
- package/dist/types/identity-reuse.d.ts +4 -1
- package/dist/types/index.d.ts +20 -2
- package/dist/types/phone.d.ts +4 -1
- package/dist/types/qe-signature.d.ts +4 -1
- package/dist/types/redirect-to-mobile.d.ts +17 -0
- package/dist/types/selfie.d.ts +4 -1
- package/dist/types/signature.d.ts +4 -1
- package/dist/types/watchlist.d.ts +4 -1
- package/dist/types/workflow.d.ts +55 -11
- package/dist/typography-YLgHHuao.js +45 -0
- package/dist/uiConfig-D2_wawvr.js +25 -0
- package/dist/useModuleLoader-CeJ2jL25.js +672 -0
- package/dist/vendor-preact-DThS2ZQ_.js +955 -0
- package/dist/verificationResult-Do5SpZ6X.js +64 -0
- package/dist/verifiedByIncode-DjXOdCml.js +103 -0
- package/dist/watchlist/watchlist.es.js +31 -28
- package/dist/watchlistForBusiness-BFFXC9d-.js +80 -0
- package/dist/workflow/styles.css +449 -427
- package/dist/workflow/workflow.es.js +268 -182
- package/package.json +32 -10
- package/dist/aligndevicelottie-DoV8xKjh.js +0 -12757
- package/dist/autoFocusTitle-QexamZ4i.js +0 -16
- package/dist/back-tutorial-1NOQobGO.js +0 -14585
- package/dist/backdevicelottie-C_ceuqY7.js +0 -16678
- package/dist/blurdevicelottie-UO14Y0WC.js +0 -15939
- package/dist/bottomSheet-DE_8TFEC.js +0 -31
- package/dist/browser-ponyfill-jOkuz57z.js +0 -299
- package/dist/button-DcCUEn2n.js +0 -24
- package/dist/checkbox-Cl57ltq_.js +0 -85
- package/dist/countrySelector-CE-JgIsv.js +0 -58
- package/dist/cpfOcr-D_tbwbvh.js +0 -78
- package/dist/customFields-CW38fQUv.js +0 -127
- package/dist/customWatchlist-D9_yjEQd.js +0 -33
- package/dist/dateInputComposed-BpAGsjN6.js +0 -55
- package/dist/dateInputComposed-DU3o6PAV.js +0 -1
- package/dist/defineProperty-Dh8nSJpJ.js +0 -39
- package/dist/documentCapture-xX-JT7ZY.js +0 -763
- package/dist/dropdownComposed-DFRBG22E.js +0 -284
- package/dist/dropdownComposed-DwTzc2YU.js +0 -1
- package/dist/dynamicForms-CJP1Ia6Q.js +0 -262
- package/dist/ekybModule-BSs7mndb.js +0 -280
- package/dist/ekybModule-D9M3E2Gm.js +0 -2
- package/dist/ekycModule-CU9pt5YN.js +0 -246
- package/dist/ekycModule-CZw9cLno.js +0 -2
- package/dist/electronic-signature-COYXjGdd.js +0 -410
- package/dist/emailInput-DppGf9pv.js +0 -37
- package/dist/expiredId-BnmzE8T3.js +0 -70
- package/dist/extensibility-CzEJfRwo.js +0 -2586
- package/dist/faceMatch-B8j0g0Yo.js +0 -2
- package/dist/faceMatch-BV8UD7tj.js +0 -201
- package/dist/frontdevicelottie-Bu6f9fDE.js +0 -17302
- package/dist/glaredevicelottie-B10axYs_.js +0 -14466
- package/dist/homeScreen-DnP1jw9A.js +0 -227
- package/dist/hooks-BVnGysT7.js +0 -80
- package/dist/i18n-9s4OSqwi.js +0 -2010
- package/dist/icons-Cc7zwchP.js +0 -310
- package/dist/id-laser-h-mBAzHVOK.js +0 -467
- package/dist/id-laser-v-CrFg4bcJ.js +0 -483
- package/dist/id-tutorial-BCr42Pnn.js +0 -13153
- package/dist/idOcr-CCjfWQvH.js +0 -94
- package/dist/incode-logo-DX016usY.js +0 -4
- package/dist/incodeComponent-C1o4M0ZK.js +0 -50
- package/dist/incodeModule-BqCjVgEI.js +0 -18
- package/dist/inputComposed-APSw8C7o.js +0 -89
- package/dist/inputComposed-XYrarFxS.js +0 -1
- package/dist/loadingIcon-BN5YRQUb.js +0 -104
- package/dist/mandatoryConsent-DssKMC3v.js +0 -100
- package/dist/modal-NMxsQHAO.js +0 -135
- package/dist/modal.hooks-CAjcIFZK.js +0 -126
- package/dist/numberedStep-CT-alrK5.js +0 -11
- package/dist/optionAccessibleLabel-CzEeX3Q4.js +0 -140
- package/dist/otpInput-DqRA_egd.js +0 -145
- package/dist/page-C1yT4DLb.js +0 -69
- package/dist/pdf-BurGZ08w.js +0 -14967
- package/dist/pdfViewer-BGBNL1Ea.js +0 -63
- package/dist/phoneInputComposed-bvWhGLFZ.js +0 -11206
- package/dist/processing-G_y3o32b.js +0 -6
- package/dist/radioGroupComposed-BbmvxmD2.js +0 -177
- package/dist/redirectToMobile-C3k1gloW.js +0 -1514
- package/dist/requiredLabelHint-BLwgqozE.js +0 -13
- package/dist/richText-DbJ5sl2n.js +0 -1973
- package/dist/rolldown-runtime-CYMK-g2i.js +0 -20
- package/dist/selfieTutorial-BgrlUMXP.js +0 -2677
- package/dist/snackbar-BDp8x7Cv.js +0 -14
- package/dist/spinner-B4dcie2T.js +0 -1
- package/dist/spinner-CKnjVHxw.js +0 -39
- package/dist/statusPage-CUI7ApcU.js +0 -28
- package/dist/successIcon-DbILeIz_.js +0 -28
- package/dist/tabs-DaPyP71c.js +0 -78
- package/dist/transitionSpinner-PIEPU2Vx.js +0 -17
- package/dist/types/cpf-ocr/styles.d.ts +0 -1
- package/dist/types/document-capture/styles.d.ts +0 -1
- package/dist/types/redirect-to-mobile/styles.d.ts +0 -1
- package/dist/typography-CxjaknHN.js +0 -28
- package/dist/uiConfig-CwpQ-IM6.js +0 -20
- package/dist/useModuleLoader-BFiVA41N.js +0 -432
- package/dist/vendor-preact-D6SntenC.js +0 -958
- package/dist/verificationResult-BrVbUJ4U.js +0 -97
- package/dist/verifiedByIncode-ChZBpqNy.js +0 -101
- package/dist/watchlistForBusiness-BcSNtHCV.js +0 -77
|
@@ -0,0 +1,2774 @@
|
|
|
1
|
+
import { t as __commonJSMin } from "../rolldown-runtime--E5BIlTp.js";
|
|
2
|
+
import { n as useTranslation, t as Trans } from "../i18n-CoCO2ZuN.js";
|
|
3
|
+
import { _ as y, h as q, l as A, p as d, v as u, x as k } from "../vendor-preact-DThS2ZQ_.js";
|
|
4
|
+
import { c as useManager, o as useModuleTerminalCallbacks } from "../hooks-Da_yP_Dr.js";
|
|
5
|
+
import { t as IncodeComponent } from "../incodeComponent-wfnHlnXx.js";
|
|
6
|
+
import { r as Spacer } from "../loadingIcon-B0ysgiNq.js";
|
|
7
|
+
import { t as incode_logo_default } from "../incode-logo-57XFniXU.js";
|
|
8
|
+
import { n as usePageUiConfig, t as VerifiedByIncodeLogo } from "../verifiedByIncode-DjXOdCml.js";
|
|
9
|
+
import { t as TransitionSpinner } from "../transitionSpinner-DRRz-NV8.js";
|
|
10
|
+
import { t as Button } from "../button-CM_hgyIP.js";
|
|
11
|
+
import "../icons-Dbs9ZfYM.js";
|
|
12
|
+
import { t as SuccessIcon } from "../successIcon-BAyDPT7I.js";
|
|
13
|
+
import { t as AutoFocusTitle } from "../autoFocusTitle-BzkUiELM.js";
|
|
14
|
+
import { r as getCountryByCallingCode, t as PhoneInputComposed } from "../phoneInputComposed-DjNdsmPE.js";
|
|
15
|
+
import { t as registerIncodeElement } from "../registerIncodeElement-77NGCDsy.js";
|
|
16
|
+
import { t as Snackbar } from "../snackbar-CxepGC3e.js";
|
|
17
|
+
import { t as Tabs } from "../tabs-C8npVBbk.js";
|
|
18
|
+
import { createRedirectToMobileManager } from "@incodetech/core/redirect-to-mobile";
|
|
19
|
+
//#region src/modules/redirect-to-mobile/redirectHeader.tsx
|
|
20
|
+
var RedirectHeader = ({ logoSrc }) => {
|
|
21
|
+
const { t } = useTranslation();
|
|
22
|
+
return /* @__PURE__ */ u("header", {
|
|
23
|
+
class: "IncodeRedirectHeader",
|
|
24
|
+
children: [
|
|
25
|
+
/* @__PURE__ */ u("div", {
|
|
26
|
+
class: "IncodeRedirectLogoWrapper",
|
|
27
|
+
children: /* @__PURE__ */ u("img", {
|
|
28
|
+
src: logoSrc,
|
|
29
|
+
alt: "",
|
|
30
|
+
"aria-hidden": "true",
|
|
31
|
+
class: "IncodeRedirectLogo"
|
|
32
|
+
})
|
|
33
|
+
}),
|
|
34
|
+
/* @__PURE__ */ u(Spacer, { size: 24 }),
|
|
35
|
+
/* @__PURE__ */ u(AutoFocusTitle, {
|
|
36
|
+
className: "IncodeRedirectTitle",
|
|
37
|
+
children: t("v2.redirectToMobile.title")
|
|
38
|
+
}),
|
|
39
|
+
/* @__PURE__ */ u(Spacer, { size: 12 }),
|
|
40
|
+
/* @__PURE__ */ u("p", {
|
|
41
|
+
class: "IncodeRedirectSubtitle",
|
|
42
|
+
children: t("v2.redirectToMobile.subtitle")
|
|
43
|
+
})
|
|
44
|
+
]
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/modules/redirect-to-mobile/redirectFooter.tsx
|
|
49
|
+
var RedirectFooter = ({ addContinueToDesktop, onContinueOnDesktop }) => {
|
|
50
|
+
const { t } = useTranslation();
|
|
51
|
+
return /* @__PURE__ */ u("footer", {
|
|
52
|
+
class: "IncodeRedirectBottomNav",
|
|
53
|
+
children: [addContinueToDesktop ? /* @__PURE__ */ u("div", {
|
|
54
|
+
class: "IncodeRedirectFooterContent",
|
|
55
|
+
children: [/* @__PURE__ */ u("span", {
|
|
56
|
+
class: "IncodeRedirectFooterContentText",
|
|
57
|
+
children: t("idv2.permissions.or")
|
|
58
|
+
}), /* @__PURE__ */ u(Button, {
|
|
59
|
+
variant: "secondary",
|
|
60
|
+
onClick: onContinueOnDesktop,
|
|
61
|
+
children: t("redirect.continueOnDesktop")
|
|
62
|
+
})]
|
|
63
|
+
}) : null, /* @__PURE__ */ u(VerifiedByIncodeLogo, {})]
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
//#endregion
|
|
67
|
+
//#region src/modules/redirect-to-mobile/resendToast.tsx
|
|
68
|
+
var ResendToast = ({ visible }) => {
|
|
69
|
+
const { t } = useTranslation();
|
|
70
|
+
if (!visible) return null;
|
|
71
|
+
return /* @__PURE__ */ u("div", {
|
|
72
|
+
class: "IncodeRedirectToast",
|
|
73
|
+
children: /* @__PURE__ */ u(Snackbar, {
|
|
74
|
+
variant: "positive",
|
|
75
|
+
children: t("redirect.linkResent")
|
|
76
|
+
})
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
//#endregion
|
|
80
|
+
//#region ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/can-promise.js
|
|
81
|
+
var require_can_promise = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
82
|
+
module.exports = function() {
|
|
83
|
+
return typeof Promise === "function" && Promise.prototype && Promise.prototype.then;
|
|
84
|
+
};
|
|
85
|
+
}));
|
|
86
|
+
//#endregion
|
|
87
|
+
//#region ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/utils.js
|
|
88
|
+
var require_utils$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
89
|
+
var toSJISFunction;
|
|
90
|
+
var CODEWORDS_COUNT = [
|
|
91
|
+
0,
|
|
92
|
+
26,
|
|
93
|
+
44,
|
|
94
|
+
70,
|
|
95
|
+
100,
|
|
96
|
+
134,
|
|
97
|
+
172,
|
|
98
|
+
196,
|
|
99
|
+
242,
|
|
100
|
+
292,
|
|
101
|
+
346,
|
|
102
|
+
404,
|
|
103
|
+
466,
|
|
104
|
+
532,
|
|
105
|
+
581,
|
|
106
|
+
655,
|
|
107
|
+
733,
|
|
108
|
+
815,
|
|
109
|
+
901,
|
|
110
|
+
991,
|
|
111
|
+
1085,
|
|
112
|
+
1156,
|
|
113
|
+
1258,
|
|
114
|
+
1364,
|
|
115
|
+
1474,
|
|
116
|
+
1588,
|
|
117
|
+
1706,
|
|
118
|
+
1828,
|
|
119
|
+
1921,
|
|
120
|
+
2051,
|
|
121
|
+
2185,
|
|
122
|
+
2323,
|
|
123
|
+
2465,
|
|
124
|
+
2611,
|
|
125
|
+
2761,
|
|
126
|
+
2876,
|
|
127
|
+
3034,
|
|
128
|
+
3196,
|
|
129
|
+
3362,
|
|
130
|
+
3532,
|
|
131
|
+
3706
|
|
132
|
+
];
|
|
133
|
+
/**
|
|
134
|
+
* Returns the QR Code size for the specified version
|
|
135
|
+
*
|
|
136
|
+
* @param {Number} version QR Code version
|
|
137
|
+
* @return {Number} size of QR code
|
|
138
|
+
*/
|
|
139
|
+
exports.getSymbolSize = function getSymbolSize(version) {
|
|
140
|
+
if (!version) throw new Error("\"version\" cannot be null or undefined");
|
|
141
|
+
if (version < 1 || version > 40) throw new Error("\"version\" should be in range from 1 to 40");
|
|
142
|
+
return version * 4 + 17;
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* Returns the total number of codewords used to store data and EC information.
|
|
146
|
+
*
|
|
147
|
+
* @param {Number} version QR Code version
|
|
148
|
+
* @return {Number} Data length in bits
|
|
149
|
+
*/
|
|
150
|
+
exports.getSymbolTotalCodewords = function getSymbolTotalCodewords(version) {
|
|
151
|
+
return CODEWORDS_COUNT[version];
|
|
152
|
+
};
|
|
153
|
+
/**
|
|
154
|
+
* Encode data with Bose-Chaudhuri-Hocquenghem
|
|
155
|
+
*
|
|
156
|
+
* @param {Number} data Value to encode
|
|
157
|
+
* @return {Number} Encoded value
|
|
158
|
+
*/
|
|
159
|
+
exports.getBCHDigit = function(data) {
|
|
160
|
+
let digit = 0;
|
|
161
|
+
while (data !== 0) {
|
|
162
|
+
digit++;
|
|
163
|
+
data >>>= 1;
|
|
164
|
+
}
|
|
165
|
+
return digit;
|
|
166
|
+
};
|
|
167
|
+
exports.setToSJISFunction = function setToSJISFunction(f) {
|
|
168
|
+
if (typeof f !== "function") throw new Error("\"toSJISFunc\" is not a valid function.");
|
|
169
|
+
toSJISFunction = f;
|
|
170
|
+
};
|
|
171
|
+
exports.isKanjiModeEnabled = function() {
|
|
172
|
+
return typeof toSJISFunction !== "undefined";
|
|
173
|
+
};
|
|
174
|
+
exports.toSJIS = function toSJIS(kanji) {
|
|
175
|
+
return toSJISFunction(kanji);
|
|
176
|
+
};
|
|
177
|
+
}));
|
|
178
|
+
//#endregion
|
|
179
|
+
//#region ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/error-correction-level.js
|
|
180
|
+
var require_error_correction_level = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
181
|
+
exports.L = { bit: 1 };
|
|
182
|
+
exports.M = { bit: 0 };
|
|
183
|
+
exports.Q = { bit: 3 };
|
|
184
|
+
exports.H = { bit: 2 };
|
|
185
|
+
function fromString(string) {
|
|
186
|
+
if (typeof string !== "string") throw new Error("Param is not a string");
|
|
187
|
+
switch (string.toLowerCase()) {
|
|
188
|
+
case "l":
|
|
189
|
+
case "low": return exports.L;
|
|
190
|
+
case "m":
|
|
191
|
+
case "medium": return exports.M;
|
|
192
|
+
case "q":
|
|
193
|
+
case "quartile": return exports.Q;
|
|
194
|
+
case "h":
|
|
195
|
+
case "high": return exports.H;
|
|
196
|
+
default: throw new Error("Unknown EC Level: " + string);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
exports.isValid = function isValid(level) {
|
|
200
|
+
return level && typeof level.bit !== "undefined" && level.bit >= 0 && level.bit < 4;
|
|
201
|
+
};
|
|
202
|
+
exports.from = function from(value, defaultValue) {
|
|
203
|
+
if (exports.isValid(value)) return value;
|
|
204
|
+
try {
|
|
205
|
+
return fromString(value);
|
|
206
|
+
} catch (e) {
|
|
207
|
+
return defaultValue;
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
}));
|
|
211
|
+
//#endregion
|
|
212
|
+
//#region ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/bit-buffer.js
|
|
213
|
+
var require_bit_buffer = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
214
|
+
function BitBuffer() {
|
|
215
|
+
this.buffer = [];
|
|
216
|
+
this.length = 0;
|
|
217
|
+
}
|
|
218
|
+
BitBuffer.prototype = {
|
|
219
|
+
get: function(index) {
|
|
220
|
+
const bufIndex = Math.floor(index / 8);
|
|
221
|
+
return (this.buffer[bufIndex] >>> 7 - index % 8 & 1) === 1;
|
|
222
|
+
},
|
|
223
|
+
put: function(num, length) {
|
|
224
|
+
for (let i = 0; i < length; i++) this.putBit((num >>> length - i - 1 & 1) === 1);
|
|
225
|
+
},
|
|
226
|
+
getLengthInBits: function() {
|
|
227
|
+
return this.length;
|
|
228
|
+
},
|
|
229
|
+
putBit: function(bit) {
|
|
230
|
+
const bufIndex = Math.floor(this.length / 8);
|
|
231
|
+
if (this.buffer.length <= bufIndex) this.buffer.push(0);
|
|
232
|
+
if (bit) this.buffer[bufIndex] |= 128 >>> this.length % 8;
|
|
233
|
+
this.length++;
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
module.exports = BitBuffer;
|
|
237
|
+
}));
|
|
238
|
+
//#endregion
|
|
239
|
+
//#region ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/bit-matrix.js
|
|
240
|
+
var require_bit_matrix = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
241
|
+
/**
|
|
242
|
+
* Helper class to handle QR Code symbol modules
|
|
243
|
+
*
|
|
244
|
+
* @param {Number} size Symbol size
|
|
245
|
+
*/
|
|
246
|
+
function BitMatrix(size) {
|
|
247
|
+
if (!size || size < 1) throw new Error("BitMatrix size must be defined and greater than 0");
|
|
248
|
+
this.size = size;
|
|
249
|
+
this.data = new Uint8Array(size * size);
|
|
250
|
+
this.reservedBit = new Uint8Array(size * size);
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Set bit value at specified location
|
|
254
|
+
* If reserved flag is set, this bit will be ignored during masking process
|
|
255
|
+
*
|
|
256
|
+
* @param {Number} row
|
|
257
|
+
* @param {Number} col
|
|
258
|
+
* @param {Boolean} value
|
|
259
|
+
* @param {Boolean} reserved
|
|
260
|
+
*/
|
|
261
|
+
BitMatrix.prototype.set = function(row, col, value, reserved) {
|
|
262
|
+
const index = row * this.size + col;
|
|
263
|
+
this.data[index] = value;
|
|
264
|
+
if (reserved) this.reservedBit[index] = true;
|
|
265
|
+
};
|
|
266
|
+
/**
|
|
267
|
+
* Returns bit value at specified location
|
|
268
|
+
*
|
|
269
|
+
* @param {Number} row
|
|
270
|
+
* @param {Number} col
|
|
271
|
+
* @return {Boolean}
|
|
272
|
+
*/
|
|
273
|
+
BitMatrix.prototype.get = function(row, col) {
|
|
274
|
+
return this.data[row * this.size + col];
|
|
275
|
+
};
|
|
276
|
+
/**
|
|
277
|
+
* Applies xor operator at specified location
|
|
278
|
+
* (used during masking process)
|
|
279
|
+
*
|
|
280
|
+
* @param {Number} row
|
|
281
|
+
* @param {Number} col
|
|
282
|
+
* @param {Boolean} value
|
|
283
|
+
*/
|
|
284
|
+
BitMatrix.prototype.xor = function(row, col, value) {
|
|
285
|
+
this.data[row * this.size + col] ^= value;
|
|
286
|
+
};
|
|
287
|
+
/**
|
|
288
|
+
* Check if bit at specified location is reserved
|
|
289
|
+
*
|
|
290
|
+
* @param {Number} row
|
|
291
|
+
* @param {Number} col
|
|
292
|
+
* @return {Boolean}
|
|
293
|
+
*/
|
|
294
|
+
BitMatrix.prototype.isReserved = function(row, col) {
|
|
295
|
+
return this.reservedBit[row * this.size + col];
|
|
296
|
+
};
|
|
297
|
+
module.exports = BitMatrix;
|
|
298
|
+
}));
|
|
299
|
+
//#endregion
|
|
300
|
+
//#region ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/alignment-pattern.js
|
|
301
|
+
var require_alignment_pattern = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
302
|
+
/**
|
|
303
|
+
* Alignment pattern are fixed reference pattern in defined positions
|
|
304
|
+
* in a matrix symbology, which enables the decode software to re-synchronise
|
|
305
|
+
* the coordinate mapping of the image modules in the event of moderate amounts
|
|
306
|
+
* of distortion of the image.
|
|
307
|
+
*
|
|
308
|
+
* Alignment patterns are present only in QR Code symbols of version 2 or larger
|
|
309
|
+
* and their number depends on the symbol version.
|
|
310
|
+
*/
|
|
311
|
+
var getSymbolSize = require_utils$1().getSymbolSize;
|
|
312
|
+
/**
|
|
313
|
+
* Calculate the row/column coordinates of the center module of each alignment pattern
|
|
314
|
+
* for the specified QR Code version.
|
|
315
|
+
*
|
|
316
|
+
* The alignment patterns are positioned symmetrically on either side of the diagonal
|
|
317
|
+
* running from the top left corner of the symbol to the bottom right corner.
|
|
318
|
+
*
|
|
319
|
+
* Since positions are simmetrical only half of the coordinates are returned.
|
|
320
|
+
* Each item of the array will represent in turn the x and y coordinate.
|
|
321
|
+
* @see {@link getPositions}
|
|
322
|
+
*
|
|
323
|
+
* @param {Number} version QR Code version
|
|
324
|
+
* @return {Array} Array of coordinate
|
|
325
|
+
*/
|
|
326
|
+
exports.getRowColCoords = function getRowColCoords(version) {
|
|
327
|
+
if (version === 1) return [];
|
|
328
|
+
const posCount = Math.floor(version / 7) + 2;
|
|
329
|
+
const size = getSymbolSize(version);
|
|
330
|
+
const intervals = size === 145 ? 26 : Math.ceil((size - 13) / (2 * posCount - 2)) * 2;
|
|
331
|
+
const positions = [size - 7];
|
|
332
|
+
for (let i = 1; i < posCount - 1; i++) positions[i] = positions[i - 1] - intervals;
|
|
333
|
+
positions.push(6);
|
|
334
|
+
return positions.reverse();
|
|
335
|
+
};
|
|
336
|
+
/**
|
|
337
|
+
* Returns an array containing the positions of each alignment pattern.
|
|
338
|
+
* Each array's element represent the center point of the pattern as (x, y) coordinates
|
|
339
|
+
*
|
|
340
|
+
* Coordinates are calculated expanding the row/column coordinates returned by {@link getRowColCoords}
|
|
341
|
+
* and filtering out the items that overlaps with finder pattern
|
|
342
|
+
*
|
|
343
|
+
* @example
|
|
344
|
+
* For a Version 7 symbol {@link getRowColCoords} returns values 6, 22 and 38.
|
|
345
|
+
* The alignment patterns, therefore, are to be centered on (row, column)
|
|
346
|
+
* positions (6,22), (22,6), (22,22), (22,38), (38,22), (38,38).
|
|
347
|
+
* Note that the coordinates (6,6), (6,38), (38,6) are occupied by finder patterns
|
|
348
|
+
* and are not therefore used for alignment patterns.
|
|
349
|
+
*
|
|
350
|
+
* let pos = getPositions(7)
|
|
351
|
+
* // [[6,22], [22,6], [22,22], [22,38], [38,22], [38,38]]
|
|
352
|
+
*
|
|
353
|
+
* @param {Number} version QR Code version
|
|
354
|
+
* @return {Array} Array of coordinates
|
|
355
|
+
*/
|
|
356
|
+
exports.getPositions = function getPositions(version) {
|
|
357
|
+
const coords = [];
|
|
358
|
+
const pos = exports.getRowColCoords(version);
|
|
359
|
+
const posLength = pos.length;
|
|
360
|
+
for (let i = 0; i < posLength; i++) for (let j = 0; j < posLength; j++) {
|
|
361
|
+
if (i === 0 && j === 0 || i === 0 && j === posLength - 1 || i === posLength - 1 && j === 0) continue;
|
|
362
|
+
coords.push([pos[i], pos[j]]);
|
|
363
|
+
}
|
|
364
|
+
return coords;
|
|
365
|
+
};
|
|
366
|
+
}));
|
|
367
|
+
//#endregion
|
|
368
|
+
//#region ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/finder-pattern.js
|
|
369
|
+
var require_finder_pattern = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
370
|
+
var getSymbolSize = require_utils$1().getSymbolSize;
|
|
371
|
+
var FINDER_PATTERN_SIZE = 7;
|
|
372
|
+
/**
|
|
373
|
+
* Returns an array containing the positions of each finder pattern.
|
|
374
|
+
* Each array's element represent the top-left point of the pattern as (x, y) coordinates
|
|
375
|
+
*
|
|
376
|
+
* @param {Number} version QR Code version
|
|
377
|
+
* @return {Array} Array of coordinates
|
|
378
|
+
*/
|
|
379
|
+
exports.getPositions = function getPositions(version) {
|
|
380
|
+
const size = getSymbolSize(version);
|
|
381
|
+
return [
|
|
382
|
+
[0, 0],
|
|
383
|
+
[size - FINDER_PATTERN_SIZE, 0],
|
|
384
|
+
[0, size - FINDER_PATTERN_SIZE]
|
|
385
|
+
];
|
|
386
|
+
};
|
|
387
|
+
}));
|
|
388
|
+
//#endregion
|
|
389
|
+
//#region ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/mask-pattern.js
|
|
390
|
+
var require_mask_pattern = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
391
|
+
/**
|
|
392
|
+
* Data mask pattern reference
|
|
393
|
+
* @type {Object}
|
|
394
|
+
*/
|
|
395
|
+
exports.Patterns = {
|
|
396
|
+
PATTERN000: 0,
|
|
397
|
+
PATTERN001: 1,
|
|
398
|
+
PATTERN010: 2,
|
|
399
|
+
PATTERN011: 3,
|
|
400
|
+
PATTERN100: 4,
|
|
401
|
+
PATTERN101: 5,
|
|
402
|
+
PATTERN110: 6,
|
|
403
|
+
PATTERN111: 7
|
|
404
|
+
};
|
|
405
|
+
/**
|
|
406
|
+
* Weighted penalty scores for the undesirable features
|
|
407
|
+
* @type {Object}
|
|
408
|
+
*/
|
|
409
|
+
var PenaltyScores = {
|
|
410
|
+
N1: 3,
|
|
411
|
+
N2: 3,
|
|
412
|
+
N3: 40,
|
|
413
|
+
N4: 10
|
|
414
|
+
};
|
|
415
|
+
/**
|
|
416
|
+
* Check if mask pattern value is valid
|
|
417
|
+
*
|
|
418
|
+
* @param {Number} mask Mask pattern
|
|
419
|
+
* @return {Boolean} true if valid, false otherwise
|
|
420
|
+
*/
|
|
421
|
+
exports.isValid = function isValid(mask) {
|
|
422
|
+
return mask != null && mask !== "" && !isNaN(mask) && mask >= 0 && mask <= 7;
|
|
423
|
+
};
|
|
424
|
+
/**
|
|
425
|
+
* Returns mask pattern from a value.
|
|
426
|
+
* If value is not valid, returns undefined
|
|
427
|
+
*
|
|
428
|
+
* @param {Number|String} value Mask pattern value
|
|
429
|
+
* @return {Number} Valid mask pattern or undefined
|
|
430
|
+
*/
|
|
431
|
+
exports.from = function from(value) {
|
|
432
|
+
return exports.isValid(value) ? parseInt(value, 10) : void 0;
|
|
433
|
+
};
|
|
434
|
+
/**
|
|
435
|
+
* Find adjacent modules in row/column with the same color
|
|
436
|
+
* and assign a penalty value.
|
|
437
|
+
*
|
|
438
|
+
* Points: N1 + i
|
|
439
|
+
* i is the amount by which the number of adjacent modules of the same color exceeds 5
|
|
440
|
+
*/
|
|
441
|
+
exports.getPenaltyN1 = function getPenaltyN1(data) {
|
|
442
|
+
const size = data.size;
|
|
443
|
+
let points = 0;
|
|
444
|
+
let sameCountCol = 0;
|
|
445
|
+
let sameCountRow = 0;
|
|
446
|
+
let lastCol = null;
|
|
447
|
+
let lastRow = null;
|
|
448
|
+
for (let row = 0; row < size; row++) {
|
|
449
|
+
sameCountCol = sameCountRow = 0;
|
|
450
|
+
lastCol = lastRow = null;
|
|
451
|
+
for (let col = 0; col < size; col++) {
|
|
452
|
+
let module$1 = data.get(row, col);
|
|
453
|
+
if (module$1 === lastCol) sameCountCol++;
|
|
454
|
+
else {
|
|
455
|
+
if (sameCountCol >= 5) points += PenaltyScores.N1 + (sameCountCol - 5);
|
|
456
|
+
lastCol = module$1;
|
|
457
|
+
sameCountCol = 1;
|
|
458
|
+
}
|
|
459
|
+
module$1 = data.get(col, row);
|
|
460
|
+
if (module$1 === lastRow) sameCountRow++;
|
|
461
|
+
else {
|
|
462
|
+
if (sameCountRow >= 5) points += PenaltyScores.N1 + (sameCountRow - 5);
|
|
463
|
+
lastRow = module$1;
|
|
464
|
+
sameCountRow = 1;
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
if (sameCountCol >= 5) points += PenaltyScores.N1 + (sameCountCol - 5);
|
|
468
|
+
if (sameCountRow >= 5) points += PenaltyScores.N1 + (sameCountRow - 5);
|
|
469
|
+
}
|
|
470
|
+
return points;
|
|
471
|
+
};
|
|
472
|
+
/**
|
|
473
|
+
* Find 2x2 blocks with the same color and assign a penalty value
|
|
474
|
+
*
|
|
475
|
+
* Points: N2 * (m - 1) * (n - 1)
|
|
476
|
+
*/
|
|
477
|
+
exports.getPenaltyN2 = function getPenaltyN2(data) {
|
|
478
|
+
const size = data.size;
|
|
479
|
+
let points = 0;
|
|
480
|
+
for (let row = 0; row < size - 1; row++) for (let col = 0; col < size - 1; col++) {
|
|
481
|
+
const last = data.get(row, col) + data.get(row, col + 1) + data.get(row + 1, col) + data.get(row + 1, col + 1);
|
|
482
|
+
if (last === 4 || last === 0) points++;
|
|
483
|
+
}
|
|
484
|
+
return points * PenaltyScores.N2;
|
|
485
|
+
};
|
|
486
|
+
/**
|
|
487
|
+
* Find 1:1:3:1:1 ratio (dark:light:dark:light:dark) pattern in row/column,
|
|
488
|
+
* preceded or followed by light area 4 modules wide
|
|
489
|
+
*
|
|
490
|
+
* Points: N3 * number of pattern found
|
|
491
|
+
*/
|
|
492
|
+
exports.getPenaltyN3 = function getPenaltyN3(data) {
|
|
493
|
+
const size = data.size;
|
|
494
|
+
let points = 0;
|
|
495
|
+
let bitsCol = 0;
|
|
496
|
+
let bitsRow = 0;
|
|
497
|
+
for (let row = 0; row < size; row++) {
|
|
498
|
+
bitsCol = bitsRow = 0;
|
|
499
|
+
for (let col = 0; col < size; col++) {
|
|
500
|
+
bitsCol = bitsCol << 1 & 2047 | data.get(row, col);
|
|
501
|
+
if (col >= 10 && (bitsCol === 1488 || bitsCol === 93)) points++;
|
|
502
|
+
bitsRow = bitsRow << 1 & 2047 | data.get(col, row);
|
|
503
|
+
if (col >= 10 && (bitsRow === 1488 || bitsRow === 93)) points++;
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
return points * PenaltyScores.N3;
|
|
507
|
+
};
|
|
508
|
+
/**
|
|
509
|
+
* Calculate proportion of dark modules in entire symbol
|
|
510
|
+
*
|
|
511
|
+
* Points: N4 * k
|
|
512
|
+
*
|
|
513
|
+
* k is the rating of the deviation of the proportion of dark modules
|
|
514
|
+
* in the symbol from 50% in steps of 5%
|
|
515
|
+
*/
|
|
516
|
+
exports.getPenaltyN4 = function getPenaltyN4(data) {
|
|
517
|
+
let darkCount = 0;
|
|
518
|
+
const modulesCount = data.data.length;
|
|
519
|
+
for (let i = 0; i < modulesCount; i++) darkCount += data.data[i];
|
|
520
|
+
return Math.abs(Math.ceil(darkCount * 100 / modulesCount / 5) - 10) * PenaltyScores.N4;
|
|
521
|
+
};
|
|
522
|
+
/**
|
|
523
|
+
* Return mask value at given position
|
|
524
|
+
*
|
|
525
|
+
* @param {Number} maskPattern Pattern reference value
|
|
526
|
+
* @param {Number} i Row
|
|
527
|
+
* @param {Number} j Column
|
|
528
|
+
* @return {Boolean} Mask value
|
|
529
|
+
*/
|
|
530
|
+
function getMaskAt(maskPattern, i, j) {
|
|
531
|
+
switch (maskPattern) {
|
|
532
|
+
case exports.Patterns.PATTERN000: return (i + j) % 2 === 0;
|
|
533
|
+
case exports.Patterns.PATTERN001: return i % 2 === 0;
|
|
534
|
+
case exports.Patterns.PATTERN010: return j % 3 === 0;
|
|
535
|
+
case exports.Patterns.PATTERN011: return (i + j) % 3 === 0;
|
|
536
|
+
case exports.Patterns.PATTERN100: return (Math.floor(i / 2) + Math.floor(j / 3)) % 2 === 0;
|
|
537
|
+
case exports.Patterns.PATTERN101: return i * j % 2 + i * j % 3 === 0;
|
|
538
|
+
case exports.Patterns.PATTERN110: return (i * j % 2 + i * j % 3) % 2 === 0;
|
|
539
|
+
case exports.Patterns.PATTERN111: return (i * j % 3 + (i + j) % 2) % 2 === 0;
|
|
540
|
+
default: throw new Error("bad maskPattern:" + maskPattern);
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* Apply a mask pattern to a BitMatrix
|
|
545
|
+
*
|
|
546
|
+
* @param {Number} pattern Pattern reference number
|
|
547
|
+
* @param {BitMatrix} data BitMatrix data
|
|
548
|
+
*/
|
|
549
|
+
exports.applyMask = function applyMask(pattern, data) {
|
|
550
|
+
const size = data.size;
|
|
551
|
+
for (let col = 0; col < size; col++) for (let row = 0; row < size; row++) {
|
|
552
|
+
if (data.isReserved(row, col)) continue;
|
|
553
|
+
data.xor(row, col, getMaskAt(pattern, row, col));
|
|
554
|
+
}
|
|
555
|
+
};
|
|
556
|
+
/**
|
|
557
|
+
* Returns the best mask pattern for data
|
|
558
|
+
*
|
|
559
|
+
* @param {BitMatrix} data
|
|
560
|
+
* @return {Number} Mask pattern reference number
|
|
561
|
+
*/
|
|
562
|
+
exports.getBestMask = function getBestMask(data, setupFormatFunc) {
|
|
563
|
+
const numPatterns = Object.keys(exports.Patterns).length;
|
|
564
|
+
let bestPattern = 0;
|
|
565
|
+
let lowerPenalty = Infinity;
|
|
566
|
+
for (let p = 0; p < numPatterns; p++) {
|
|
567
|
+
setupFormatFunc(p);
|
|
568
|
+
exports.applyMask(p, data);
|
|
569
|
+
const penalty = exports.getPenaltyN1(data) + exports.getPenaltyN2(data) + exports.getPenaltyN3(data) + exports.getPenaltyN4(data);
|
|
570
|
+
exports.applyMask(p, data);
|
|
571
|
+
if (penalty < lowerPenalty) {
|
|
572
|
+
lowerPenalty = penalty;
|
|
573
|
+
bestPattern = p;
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
return bestPattern;
|
|
577
|
+
};
|
|
578
|
+
}));
|
|
579
|
+
//#endregion
|
|
580
|
+
//#region ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/error-correction-code.js
|
|
581
|
+
var require_error_correction_code = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
582
|
+
var ECLevel = require_error_correction_level();
|
|
583
|
+
var EC_BLOCKS_TABLE = [
|
|
584
|
+
1,
|
|
585
|
+
1,
|
|
586
|
+
1,
|
|
587
|
+
1,
|
|
588
|
+
1,
|
|
589
|
+
1,
|
|
590
|
+
1,
|
|
591
|
+
1,
|
|
592
|
+
1,
|
|
593
|
+
1,
|
|
594
|
+
2,
|
|
595
|
+
2,
|
|
596
|
+
1,
|
|
597
|
+
2,
|
|
598
|
+
2,
|
|
599
|
+
4,
|
|
600
|
+
1,
|
|
601
|
+
2,
|
|
602
|
+
4,
|
|
603
|
+
4,
|
|
604
|
+
2,
|
|
605
|
+
4,
|
|
606
|
+
4,
|
|
607
|
+
4,
|
|
608
|
+
2,
|
|
609
|
+
4,
|
|
610
|
+
6,
|
|
611
|
+
5,
|
|
612
|
+
2,
|
|
613
|
+
4,
|
|
614
|
+
6,
|
|
615
|
+
6,
|
|
616
|
+
2,
|
|
617
|
+
5,
|
|
618
|
+
8,
|
|
619
|
+
8,
|
|
620
|
+
4,
|
|
621
|
+
5,
|
|
622
|
+
8,
|
|
623
|
+
8,
|
|
624
|
+
4,
|
|
625
|
+
5,
|
|
626
|
+
8,
|
|
627
|
+
11,
|
|
628
|
+
4,
|
|
629
|
+
8,
|
|
630
|
+
10,
|
|
631
|
+
11,
|
|
632
|
+
4,
|
|
633
|
+
9,
|
|
634
|
+
12,
|
|
635
|
+
16,
|
|
636
|
+
4,
|
|
637
|
+
9,
|
|
638
|
+
16,
|
|
639
|
+
16,
|
|
640
|
+
6,
|
|
641
|
+
10,
|
|
642
|
+
12,
|
|
643
|
+
18,
|
|
644
|
+
6,
|
|
645
|
+
10,
|
|
646
|
+
17,
|
|
647
|
+
16,
|
|
648
|
+
6,
|
|
649
|
+
11,
|
|
650
|
+
16,
|
|
651
|
+
19,
|
|
652
|
+
6,
|
|
653
|
+
13,
|
|
654
|
+
18,
|
|
655
|
+
21,
|
|
656
|
+
7,
|
|
657
|
+
14,
|
|
658
|
+
21,
|
|
659
|
+
25,
|
|
660
|
+
8,
|
|
661
|
+
16,
|
|
662
|
+
20,
|
|
663
|
+
25,
|
|
664
|
+
8,
|
|
665
|
+
17,
|
|
666
|
+
23,
|
|
667
|
+
25,
|
|
668
|
+
9,
|
|
669
|
+
17,
|
|
670
|
+
23,
|
|
671
|
+
34,
|
|
672
|
+
9,
|
|
673
|
+
18,
|
|
674
|
+
25,
|
|
675
|
+
30,
|
|
676
|
+
10,
|
|
677
|
+
20,
|
|
678
|
+
27,
|
|
679
|
+
32,
|
|
680
|
+
12,
|
|
681
|
+
21,
|
|
682
|
+
29,
|
|
683
|
+
35,
|
|
684
|
+
12,
|
|
685
|
+
23,
|
|
686
|
+
34,
|
|
687
|
+
37,
|
|
688
|
+
12,
|
|
689
|
+
25,
|
|
690
|
+
34,
|
|
691
|
+
40,
|
|
692
|
+
13,
|
|
693
|
+
26,
|
|
694
|
+
35,
|
|
695
|
+
42,
|
|
696
|
+
14,
|
|
697
|
+
28,
|
|
698
|
+
38,
|
|
699
|
+
45,
|
|
700
|
+
15,
|
|
701
|
+
29,
|
|
702
|
+
40,
|
|
703
|
+
48,
|
|
704
|
+
16,
|
|
705
|
+
31,
|
|
706
|
+
43,
|
|
707
|
+
51,
|
|
708
|
+
17,
|
|
709
|
+
33,
|
|
710
|
+
45,
|
|
711
|
+
54,
|
|
712
|
+
18,
|
|
713
|
+
35,
|
|
714
|
+
48,
|
|
715
|
+
57,
|
|
716
|
+
19,
|
|
717
|
+
37,
|
|
718
|
+
51,
|
|
719
|
+
60,
|
|
720
|
+
19,
|
|
721
|
+
38,
|
|
722
|
+
53,
|
|
723
|
+
63,
|
|
724
|
+
20,
|
|
725
|
+
40,
|
|
726
|
+
56,
|
|
727
|
+
66,
|
|
728
|
+
21,
|
|
729
|
+
43,
|
|
730
|
+
59,
|
|
731
|
+
70,
|
|
732
|
+
22,
|
|
733
|
+
45,
|
|
734
|
+
62,
|
|
735
|
+
74,
|
|
736
|
+
24,
|
|
737
|
+
47,
|
|
738
|
+
65,
|
|
739
|
+
77,
|
|
740
|
+
25,
|
|
741
|
+
49,
|
|
742
|
+
68,
|
|
743
|
+
81
|
|
744
|
+
];
|
|
745
|
+
var EC_CODEWORDS_TABLE = [
|
|
746
|
+
7,
|
|
747
|
+
10,
|
|
748
|
+
13,
|
|
749
|
+
17,
|
|
750
|
+
10,
|
|
751
|
+
16,
|
|
752
|
+
22,
|
|
753
|
+
28,
|
|
754
|
+
15,
|
|
755
|
+
26,
|
|
756
|
+
36,
|
|
757
|
+
44,
|
|
758
|
+
20,
|
|
759
|
+
36,
|
|
760
|
+
52,
|
|
761
|
+
64,
|
|
762
|
+
26,
|
|
763
|
+
48,
|
|
764
|
+
72,
|
|
765
|
+
88,
|
|
766
|
+
36,
|
|
767
|
+
64,
|
|
768
|
+
96,
|
|
769
|
+
112,
|
|
770
|
+
40,
|
|
771
|
+
72,
|
|
772
|
+
108,
|
|
773
|
+
130,
|
|
774
|
+
48,
|
|
775
|
+
88,
|
|
776
|
+
132,
|
|
777
|
+
156,
|
|
778
|
+
60,
|
|
779
|
+
110,
|
|
780
|
+
160,
|
|
781
|
+
192,
|
|
782
|
+
72,
|
|
783
|
+
130,
|
|
784
|
+
192,
|
|
785
|
+
224,
|
|
786
|
+
80,
|
|
787
|
+
150,
|
|
788
|
+
224,
|
|
789
|
+
264,
|
|
790
|
+
96,
|
|
791
|
+
176,
|
|
792
|
+
260,
|
|
793
|
+
308,
|
|
794
|
+
104,
|
|
795
|
+
198,
|
|
796
|
+
288,
|
|
797
|
+
352,
|
|
798
|
+
120,
|
|
799
|
+
216,
|
|
800
|
+
320,
|
|
801
|
+
384,
|
|
802
|
+
132,
|
|
803
|
+
240,
|
|
804
|
+
360,
|
|
805
|
+
432,
|
|
806
|
+
144,
|
|
807
|
+
280,
|
|
808
|
+
408,
|
|
809
|
+
480,
|
|
810
|
+
168,
|
|
811
|
+
308,
|
|
812
|
+
448,
|
|
813
|
+
532,
|
|
814
|
+
180,
|
|
815
|
+
338,
|
|
816
|
+
504,
|
|
817
|
+
588,
|
|
818
|
+
196,
|
|
819
|
+
364,
|
|
820
|
+
546,
|
|
821
|
+
650,
|
|
822
|
+
224,
|
|
823
|
+
416,
|
|
824
|
+
600,
|
|
825
|
+
700,
|
|
826
|
+
224,
|
|
827
|
+
442,
|
|
828
|
+
644,
|
|
829
|
+
750,
|
|
830
|
+
252,
|
|
831
|
+
476,
|
|
832
|
+
690,
|
|
833
|
+
816,
|
|
834
|
+
270,
|
|
835
|
+
504,
|
|
836
|
+
750,
|
|
837
|
+
900,
|
|
838
|
+
300,
|
|
839
|
+
560,
|
|
840
|
+
810,
|
|
841
|
+
960,
|
|
842
|
+
312,
|
|
843
|
+
588,
|
|
844
|
+
870,
|
|
845
|
+
1050,
|
|
846
|
+
336,
|
|
847
|
+
644,
|
|
848
|
+
952,
|
|
849
|
+
1110,
|
|
850
|
+
360,
|
|
851
|
+
700,
|
|
852
|
+
1020,
|
|
853
|
+
1200,
|
|
854
|
+
390,
|
|
855
|
+
728,
|
|
856
|
+
1050,
|
|
857
|
+
1260,
|
|
858
|
+
420,
|
|
859
|
+
784,
|
|
860
|
+
1140,
|
|
861
|
+
1350,
|
|
862
|
+
450,
|
|
863
|
+
812,
|
|
864
|
+
1200,
|
|
865
|
+
1440,
|
|
866
|
+
480,
|
|
867
|
+
868,
|
|
868
|
+
1290,
|
|
869
|
+
1530,
|
|
870
|
+
510,
|
|
871
|
+
924,
|
|
872
|
+
1350,
|
|
873
|
+
1620,
|
|
874
|
+
540,
|
|
875
|
+
980,
|
|
876
|
+
1440,
|
|
877
|
+
1710,
|
|
878
|
+
570,
|
|
879
|
+
1036,
|
|
880
|
+
1530,
|
|
881
|
+
1800,
|
|
882
|
+
570,
|
|
883
|
+
1064,
|
|
884
|
+
1590,
|
|
885
|
+
1890,
|
|
886
|
+
600,
|
|
887
|
+
1120,
|
|
888
|
+
1680,
|
|
889
|
+
1980,
|
|
890
|
+
630,
|
|
891
|
+
1204,
|
|
892
|
+
1770,
|
|
893
|
+
2100,
|
|
894
|
+
660,
|
|
895
|
+
1260,
|
|
896
|
+
1860,
|
|
897
|
+
2220,
|
|
898
|
+
720,
|
|
899
|
+
1316,
|
|
900
|
+
1950,
|
|
901
|
+
2310,
|
|
902
|
+
750,
|
|
903
|
+
1372,
|
|
904
|
+
2040,
|
|
905
|
+
2430
|
|
906
|
+
];
|
|
907
|
+
/**
|
|
908
|
+
* Returns the number of error correction block that the QR Code should contain
|
|
909
|
+
* for the specified version and error correction level.
|
|
910
|
+
*
|
|
911
|
+
* @param {Number} version QR Code version
|
|
912
|
+
* @param {Number} errorCorrectionLevel Error correction level
|
|
913
|
+
* @return {Number} Number of error correction blocks
|
|
914
|
+
*/
|
|
915
|
+
exports.getBlocksCount = function getBlocksCount(version, errorCorrectionLevel) {
|
|
916
|
+
switch (errorCorrectionLevel) {
|
|
917
|
+
case ECLevel.L: return EC_BLOCKS_TABLE[(version - 1) * 4 + 0];
|
|
918
|
+
case ECLevel.M: return EC_BLOCKS_TABLE[(version - 1) * 4 + 1];
|
|
919
|
+
case ECLevel.Q: return EC_BLOCKS_TABLE[(version - 1) * 4 + 2];
|
|
920
|
+
case ECLevel.H: return EC_BLOCKS_TABLE[(version - 1) * 4 + 3];
|
|
921
|
+
default: return;
|
|
922
|
+
}
|
|
923
|
+
};
|
|
924
|
+
/**
|
|
925
|
+
* Returns the number of error correction codewords to use for the specified
|
|
926
|
+
* version and error correction level.
|
|
927
|
+
*
|
|
928
|
+
* @param {Number} version QR Code version
|
|
929
|
+
* @param {Number} errorCorrectionLevel Error correction level
|
|
930
|
+
* @return {Number} Number of error correction codewords
|
|
931
|
+
*/
|
|
932
|
+
exports.getTotalCodewordsCount = function getTotalCodewordsCount(version, errorCorrectionLevel) {
|
|
933
|
+
switch (errorCorrectionLevel) {
|
|
934
|
+
case ECLevel.L: return EC_CODEWORDS_TABLE[(version - 1) * 4 + 0];
|
|
935
|
+
case ECLevel.M: return EC_CODEWORDS_TABLE[(version - 1) * 4 + 1];
|
|
936
|
+
case ECLevel.Q: return EC_CODEWORDS_TABLE[(version - 1) * 4 + 2];
|
|
937
|
+
case ECLevel.H: return EC_CODEWORDS_TABLE[(version - 1) * 4 + 3];
|
|
938
|
+
default: return;
|
|
939
|
+
}
|
|
940
|
+
};
|
|
941
|
+
}));
|
|
942
|
+
//#endregion
|
|
943
|
+
//#region ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/galois-field.js
|
|
944
|
+
var require_galois_field = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
945
|
+
var EXP_TABLE = new Uint8Array(512);
|
|
946
|
+
var LOG_TABLE = new Uint8Array(256);
|
|
947
|
+
(function initTables() {
|
|
948
|
+
let x = 1;
|
|
949
|
+
for (let i = 0; i < 255; i++) {
|
|
950
|
+
EXP_TABLE[i] = x;
|
|
951
|
+
LOG_TABLE[x] = i;
|
|
952
|
+
x <<= 1;
|
|
953
|
+
if (x & 256) x ^= 285;
|
|
954
|
+
}
|
|
955
|
+
for (let i = 255; i < 512; i++) EXP_TABLE[i] = EXP_TABLE[i - 255];
|
|
956
|
+
})();
|
|
957
|
+
/**
|
|
958
|
+
* Returns log value of n inside Galois Field
|
|
959
|
+
*
|
|
960
|
+
* @param {Number} n
|
|
961
|
+
* @return {Number}
|
|
962
|
+
*/
|
|
963
|
+
exports.log = function log(n) {
|
|
964
|
+
if (n < 1) throw new Error("log(" + n + ")");
|
|
965
|
+
return LOG_TABLE[n];
|
|
966
|
+
};
|
|
967
|
+
/**
|
|
968
|
+
* Returns anti-log value of n inside Galois Field
|
|
969
|
+
*
|
|
970
|
+
* @param {Number} n
|
|
971
|
+
* @return {Number}
|
|
972
|
+
*/
|
|
973
|
+
exports.exp = function exp(n) {
|
|
974
|
+
return EXP_TABLE[n];
|
|
975
|
+
};
|
|
976
|
+
/**
|
|
977
|
+
* Multiplies two number inside Galois Field
|
|
978
|
+
*
|
|
979
|
+
* @param {Number} x
|
|
980
|
+
* @param {Number} y
|
|
981
|
+
* @return {Number}
|
|
982
|
+
*/
|
|
983
|
+
exports.mul = function mul(x, y) {
|
|
984
|
+
if (x === 0 || y === 0) return 0;
|
|
985
|
+
return EXP_TABLE[LOG_TABLE[x] + LOG_TABLE[y]];
|
|
986
|
+
};
|
|
987
|
+
}));
|
|
988
|
+
//#endregion
|
|
989
|
+
//#region ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/polynomial.js
|
|
990
|
+
var require_polynomial = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
991
|
+
var GF = require_galois_field();
|
|
992
|
+
/**
|
|
993
|
+
* Multiplies two polynomials inside Galois Field
|
|
994
|
+
*
|
|
995
|
+
* @param {Uint8Array} p1 Polynomial
|
|
996
|
+
* @param {Uint8Array} p2 Polynomial
|
|
997
|
+
* @return {Uint8Array} Product of p1 and p2
|
|
998
|
+
*/
|
|
999
|
+
exports.mul = function mul(p1, p2) {
|
|
1000
|
+
const coeff = new Uint8Array(p1.length + p2.length - 1);
|
|
1001
|
+
for (let i = 0; i < p1.length; i++) for (let j = 0; j < p2.length; j++) coeff[i + j] ^= GF.mul(p1[i], p2[j]);
|
|
1002
|
+
return coeff;
|
|
1003
|
+
};
|
|
1004
|
+
/**
|
|
1005
|
+
* Calculate the remainder of polynomials division
|
|
1006
|
+
*
|
|
1007
|
+
* @param {Uint8Array} divident Polynomial
|
|
1008
|
+
* @param {Uint8Array} divisor Polynomial
|
|
1009
|
+
* @return {Uint8Array} Remainder
|
|
1010
|
+
*/
|
|
1011
|
+
exports.mod = function mod(divident, divisor) {
|
|
1012
|
+
let result = new Uint8Array(divident);
|
|
1013
|
+
while (result.length - divisor.length >= 0) {
|
|
1014
|
+
const coeff = result[0];
|
|
1015
|
+
for (let i = 0; i < divisor.length; i++) result[i] ^= GF.mul(divisor[i], coeff);
|
|
1016
|
+
let offset = 0;
|
|
1017
|
+
while (offset < result.length && result[offset] === 0) offset++;
|
|
1018
|
+
result = result.slice(offset);
|
|
1019
|
+
}
|
|
1020
|
+
return result;
|
|
1021
|
+
};
|
|
1022
|
+
/**
|
|
1023
|
+
* Generate an irreducible generator polynomial of specified degree
|
|
1024
|
+
* (used by Reed-Solomon encoder)
|
|
1025
|
+
*
|
|
1026
|
+
* @param {Number} degree Degree of the generator polynomial
|
|
1027
|
+
* @return {Uint8Array} Buffer containing polynomial coefficients
|
|
1028
|
+
*/
|
|
1029
|
+
exports.generateECPolynomial = function generateECPolynomial(degree) {
|
|
1030
|
+
let poly = new Uint8Array([1]);
|
|
1031
|
+
for (let i = 0; i < degree; i++) poly = exports.mul(poly, new Uint8Array([1, GF.exp(i)]));
|
|
1032
|
+
return poly;
|
|
1033
|
+
};
|
|
1034
|
+
}));
|
|
1035
|
+
//#endregion
|
|
1036
|
+
//#region ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/reed-solomon-encoder.js
|
|
1037
|
+
var require_reed_solomon_encoder = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1038
|
+
var Polynomial = require_polynomial();
|
|
1039
|
+
function ReedSolomonEncoder(degree) {
|
|
1040
|
+
this.genPoly = void 0;
|
|
1041
|
+
this.degree = degree;
|
|
1042
|
+
if (this.degree) this.initialize(this.degree);
|
|
1043
|
+
}
|
|
1044
|
+
/**
|
|
1045
|
+
* Initialize the encoder.
|
|
1046
|
+
* The input param should correspond to the number of error correction codewords.
|
|
1047
|
+
*
|
|
1048
|
+
* @param {Number} degree
|
|
1049
|
+
*/
|
|
1050
|
+
ReedSolomonEncoder.prototype.initialize = function initialize(degree) {
|
|
1051
|
+
this.degree = degree;
|
|
1052
|
+
this.genPoly = Polynomial.generateECPolynomial(this.degree);
|
|
1053
|
+
};
|
|
1054
|
+
/**
|
|
1055
|
+
* Encodes a chunk of data
|
|
1056
|
+
*
|
|
1057
|
+
* @param {Uint8Array} data Buffer containing input data
|
|
1058
|
+
* @return {Uint8Array} Buffer containing encoded data
|
|
1059
|
+
*/
|
|
1060
|
+
ReedSolomonEncoder.prototype.encode = function encode(data) {
|
|
1061
|
+
if (!this.genPoly) throw new Error("Encoder not initialized");
|
|
1062
|
+
const paddedData = new Uint8Array(data.length + this.degree);
|
|
1063
|
+
paddedData.set(data);
|
|
1064
|
+
const remainder = Polynomial.mod(paddedData, this.genPoly);
|
|
1065
|
+
const start = this.degree - remainder.length;
|
|
1066
|
+
if (start > 0) {
|
|
1067
|
+
const buff = new Uint8Array(this.degree);
|
|
1068
|
+
buff.set(remainder, start);
|
|
1069
|
+
return buff;
|
|
1070
|
+
}
|
|
1071
|
+
return remainder;
|
|
1072
|
+
};
|
|
1073
|
+
module.exports = ReedSolomonEncoder;
|
|
1074
|
+
}));
|
|
1075
|
+
//#endregion
|
|
1076
|
+
//#region ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/version-check.js
|
|
1077
|
+
var require_version_check = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1078
|
+
/**
|
|
1079
|
+
* Check if QR Code version is valid
|
|
1080
|
+
*
|
|
1081
|
+
* @param {Number} version QR Code version
|
|
1082
|
+
* @return {Boolean} true if valid version, false otherwise
|
|
1083
|
+
*/
|
|
1084
|
+
exports.isValid = function isValid(version) {
|
|
1085
|
+
return !isNaN(version) && version >= 1 && version <= 40;
|
|
1086
|
+
};
|
|
1087
|
+
}));
|
|
1088
|
+
//#endregion
|
|
1089
|
+
//#region ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/regex.js
|
|
1090
|
+
var require_regex = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1091
|
+
var numeric = "[0-9]+";
|
|
1092
|
+
var alphanumeric = "[A-Z $%*+\\-./:]+";
|
|
1093
|
+
var kanji = "(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";
|
|
1094
|
+
kanji = kanji.replace(/u/g, "\\u");
|
|
1095
|
+
var byte = "(?:(?![A-Z0-9 $%*+\\-./:]|" + kanji + ")(?:.|[\r\n]))+";
|
|
1096
|
+
exports.KANJI = new RegExp(kanji, "g");
|
|
1097
|
+
exports.BYTE_KANJI = /* @__PURE__ */ new RegExp("[^A-Z0-9 $%*+\\-./:]+", "g");
|
|
1098
|
+
exports.BYTE = new RegExp(byte, "g");
|
|
1099
|
+
exports.NUMERIC = new RegExp(numeric, "g");
|
|
1100
|
+
exports.ALPHANUMERIC = new RegExp(alphanumeric, "g");
|
|
1101
|
+
var TEST_KANJI = new RegExp("^" + kanji + "$");
|
|
1102
|
+
var TEST_NUMERIC = new RegExp("^" + numeric + "$");
|
|
1103
|
+
var TEST_ALPHANUMERIC = /* @__PURE__ */ new RegExp("^[A-Z0-9 $%*+\\-./:]+$");
|
|
1104
|
+
exports.testKanji = function testKanji(str) {
|
|
1105
|
+
return TEST_KANJI.test(str);
|
|
1106
|
+
};
|
|
1107
|
+
exports.testNumeric = function testNumeric(str) {
|
|
1108
|
+
return TEST_NUMERIC.test(str);
|
|
1109
|
+
};
|
|
1110
|
+
exports.testAlphanumeric = function testAlphanumeric(str) {
|
|
1111
|
+
return TEST_ALPHANUMERIC.test(str);
|
|
1112
|
+
};
|
|
1113
|
+
}));
|
|
1114
|
+
//#endregion
|
|
1115
|
+
//#region ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/mode.js
|
|
1116
|
+
var require_mode = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1117
|
+
var VersionCheck = require_version_check();
|
|
1118
|
+
var Regex = require_regex();
|
|
1119
|
+
/**
|
|
1120
|
+
* Numeric mode encodes data from the decimal digit set (0 - 9)
|
|
1121
|
+
* (byte values 30HEX to 39HEX).
|
|
1122
|
+
* Normally, 3 data characters are represented by 10 bits.
|
|
1123
|
+
*
|
|
1124
|
+
* @type {Object}
|
|
1125
|
+
*/
|
|
1126
|
+
exports.NUMERIC = {
|
|
1127
|
+
id: "Numeric",
|
|
1128
|
+
bit: 1,
|
|
1129
|
+
ccBits: [
|
|
1130
|
+
10,
|
|
1131
|
+
12,
|
|
1132
|
+
14
|
|
1133
|
+
]
|
|
1134
|
+
};
|
|
1135
|
+
/**
|
|
1136
|
+
* Alphanumeric mode encodes data from a set of 45 characters,
|
|
1137
|
+
* i.e. 10 numeric digits (0 - 9),
|
|
1138
|
+
* 26 alphabetic characters (A - Z),
|
|
1139
|
+
* and 9 symbols (SP, $, %, *, +, -, ., /, :).
|
|
1140
|
+
* Normally, two input characters are represented by 11 bits.
|
|
1141
|
+
*
|
|
1142
|
+
* @type {Object}
|
|
1143
|
+
*/
|
|
1144
|
+
exports.ALPHANUMERIC = {
|
|
1145
|
+
id: "Alphanumeric",
|
|
1146
|
+
bit: 2,
|
|
1147
|
+
ccBits: [
|
|
1148
|
+
9,
|
|
1149
|
+
11,
|
|
1150
|
+
13
|
|
1151
|
+
]
|
|
1152
|
+
};
|
|
1153
|
+
/**
|
|
1154
|
+
* In byte mode, data is encoded at 8 bits per character.
|
|
1155
|
+
*
|
|
1156
|
+
* @type {Object}
|
|
1157
|
+
*/
|
|
1158
|
+
exports.BYTE = {
|
|
1159
|
+
id: "Byte",
|
|
1160
|
+
bit: 4,
|
|
1161
|
+
ccBits: [
|
|
1162
|
+
8,
|
|
1163
|
+
16,
|
|
1164
|
+
16
|
|
1165
|
+
]
|
|
1166
|
+
};
|
|
1167
|
+
/**
|
|
1168
|
+
* The Kanji mode efficiently encodes Kanji characters in accordance with
|
|
1169
|
+
* the Shift JIS system based on JIS X 0208.
|
|
1170
|
+
* The Shift JIS values are shifted from the JIS X 0208 values.
|
|
1171
|
+
* JIS X 0208 gives details of the shift coded representation.
|
|
1172
|
+
* Each two-byte character value is compacted to a 13-bit binary codeword.
|
|
1173
|
+
*
|
|
1174
|
+
* @type {Object}
|
|
1175
|
+
*/
|
|
1176
|
+
exports.KANJI = {
|
|
1177
|
+
id: "Kanji",
|
|
1178
|
+
bit: 8,
|
|
1179
|
+
ccBits: [
|
|
1180
|
+
8,
|
|
1181
|
+
10,
|
|
1182
|
+
12
|
|
1183
|
+
]
|
|
1184
|
+
};
|
|
1185
|
+
/**
|
|
1186
|
+
* Mixed mode will contain a sequences of data in a combination of any of
|
|
1187
|
+
* the modes described above
|
|
1188
|
+
*
|
|
1189
|
+
* @type {Object}
|
|
1190
|
+
*/
|
|
1191
|
+
exports.MIXED = { bit: -1 };
|
|
1192
|
+
/**
|
|
1193
|
+
* Returns the number of bits needed to store the data length
|
|
1194
|
+
* according to QR Code specifications.
|
|
1195
|
+
*
|
|
1196
|
+
* @param {Mode} mode Data mode
|
|
1197
|
+
* @param {Number} version QR Code version
|
|
1198
|
+
* @return {Number} Number of bits
|
|
1199
|
+
*/
|
|
1200
|
+
exports.getCharCountIndicator = function getCharCountIndicator(mode, version) {
|
|
1201
|
+
if (!mode.ccBits) throw new Error("Invalid mode: " + mode);
|
|
1202
|
+
if (!VersionCheck.isValid(version)) throw new Error("Invalid version: " + version);
|
|
1203
|
+
if (version >= 1 && version < 10) return mode.ccBits[0];
|
|
1204
|
+
else if (version < 27) return mode.ccBits[1];
|
|
1205
|
+
return mode.ccBits[2];
|
|
1206
|
+
};
|
|
1207
|
+
/**
|
|
1208
|
+
* Returns the most efficient mode to store the specified data
|
|
1209
|
+
*
|
|
1210
|
+
* @param {String} dataStr Input data string
|
|
1211
|
+
* @return {Mode} Best mode
|
|
1212
|
+
*/
|
|
1213
|
+
exports.getBestModeForData = function getBestModeForData(dataStr) {
|
|
1214
|
+
if (Regex.testNumeric(dataStr)) return exports.NUMERIC;
|
|
1215
|
+
else if (Regex.testAlphanumeric(dataStr)) return exports.ALPHANUMERIC;
|
|
1216
|
+
else if (Regex.testKanji(dataStr)) return exports.KANJI;
|
|
1217
|
+
else return exports.BYTE;
|
|
1218
|
+
};
|
|
1219
|
+
/**
|
|
1220
|
+
* Return mode name as string
|
|
1221
|
+
*
|
|
1222
|
+
* @param {Mode} mode Mode object
|
|
1223
|
+
* @returns {String} Mode name
|
|
1224
|
+
*/
|
|
1225
|
+
exports.toString = function toString(mode) {
|
|
1226
|
+
if (mode && mode.id) return mode.id;
|
|
1227
|
+
throw new Error("Invalid mode");
|
|
1228
|
+
};
|
|
1229
|
+
/**
|
|
1230
|
+
* Check if input param is a valid mode object
|
|
1231
|
+
*
|
|
1232
|
+
* @param {Mode} mode Mode object
|
|
1233
|
+
* @returns {Boolean} True if valid mode, false otherwise
|
|
1234
|
+
*/
|
|
1235
|
+
exports.isValid = function isValid(mode) {
|
|
1236
|
+
return mode && mode.bit && mode.ccBits;
|
|
1237
|
+
};
|
|
1238
|
+
/**
|
|
1239
|
+
* Get mode object from its name
|
|
1240
|
+
*
|
|
1241
|
+
* @param {String} string Mode name
|
|
1242
|
+
* @returns {Mode} Mode object
|
|
1243
|
+
*/
|
|
1244
|
+
function fromString(string) {
|
|
1245
|
+
if (typeof string !== "string") throw new Error("Param is not a string");
|
|
1246
|
+
switch (string.toLowerCase()) {
|
|
1247
|
+
case "numeric": return exports.NUMERIC;
|
|
1248
|
+
case "alphanumeric": return exports.ALPHANUMERIC;
|
|
1249
|
+
case "kanji": return exports.KANJI;
|
|
1250
|
+
case "byte": return exports.BYTE;
|
|
1251
|
+
default: throw new Error("Unknown mode: " + string);
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
/**
|
|
1255
|
+
* Returns mode from a value.
|
|
1256
|
+
* If value is not a valid mode, returns defaultValue
|
|
1257
|
+
*
|
|
1258
|
+
* @param {Mode|String} value Encoding mode
|
|
1259
|
+
* @param {Mode} defaultValue Fallback value
|
|
1260
|
+
* @return {Mode} Encoding mode
|
|
1261
|
+
*/
|
|
1262
|
+
exports.from = function from(value, defaultValue) {
|
|
1263
|
+
if (exports.isValid(value)) return value;
|
|
1264
|
+
try {
|
|
1265
|
+
return fromString(value);
|
|
1266
|
+
} catch (e) {
|
|
1267
|
+
return defaultValue;
|
|
1268
|
+
}
|
|
1269
|
+
};
|
|
1270
|
+
}));
|
|
1271
|
+
//#endregion
|
|
1272
|
+
//#region ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/version.js
|
|
1273
|
+
var require_version = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1274
|
+
var Utils = require_utils$1();
|
|
1275
|
+
var ECCode = require_error_correction_code();
|
|
1276
|
+
var ECLevel = require_error_correction_level();
|
|
1277
|
+
var Mode = require_mode();
|
|
1278
|
+
var VersionCheck = require_version_check();
|
|
1279
|
+
var G18 = 7973;
|
|
1280
|
+
var G18_BCH = Utils.getBCHDigit(G18);
|
|
1281
|
+
function getBestVersionForDataLength(mode, length, errorCorrectionLevel) {
|
|
1282
|
+
for (let currentVersion = 1; currentVersion <= 40; currentVersion++) if (length <= exports.getCapacity(currentVersion, errorCorrectionLevel, mode)) return currentVersion;
|
|
1283
|
+
}
|
|
1284
|
+
function getReservedBitsCount(mode, version) {
|
|
1285
|
+
return Mode.getCharCountIndicator(mode, version) + 4;
|
|
1286
|
+
}
|
|
1287
|
+
function getTotalBitsFromDataArray(segments, version) {
|
|
1288
|
+
let totalBits = 0;
|
|
1289
|
+
segments.forEach(function(data) {
|
|
1290
|
+
const reservedBits = getReservedBitsCount(data.mode, version);
|
|
1291
|
+
totalBits += reservedBits + data.getBitsLength();
|
|
1292
|
+
});
|
|
1293
|
+
return totalBits;
|
|
1294
|
+
}
|
|
1295
|
+
function getBestVersionForMixedData(segments, errorCorrectionLevel) {
|
|
1296
|
+
for (let currentVersion = 1; currentVersion <= 40; currentVersion++) if (getTotalBitsFromDataArray(segments, currentVersion) <= exports.getCapacity(currentVersion, errorCorrectionLevel, Mode.MIXED)) return currentVersion;
|
|
1297
|
+
}
|
|
1298
|
+
/**
|
|
1299
|
+
* Returns version number from a value.
|
|
1300
|
+
* If value is not a valid version, returns defaultValue
|
|
1301
|
+
*
|
|
1302
|
+
* @param {Number|String} value QR Code version
|
|
1303
|
+
* @param {Number} defaultValue Fallback value
|
|
1304
|
+
* @return {Number} QR Code version number
|
|
1305
|
+
*/
|
|
1306
|
+
exports.from = function from(value, defaultValue) {
|
|
1307
|
+
if (VersionCheck.isValid(value)) return parseInt(value, 10);
|
|
1308
|
+
return defaultValue;
|
|
1309
|
+
};
|
|
1310
|
+
/**
|
|
1311
|
+
* Returns how much data can be stored with the specified QR code version
|
|
1312
|
+
* and error correction level
|
|
1313
|
+
*
|
|
1314
|
+
* @param {Number} version QR Code version (1-40)
|
|
1315
|
+
* @param {Number} errorCorrectionLevel Error correction level
|
|
1316
|
+
* @param {Mode} mode Data mode
|
|
1317
|
+
* @return {Number} Quantity of storable data
|
|
1318
|
+
*/
|
|
1319
|
+
exports.getCapacity = function getCapacity(version, errorCorrectionLevel, mode) {
|
|
1320
|
+
if (!VersionCheck.isValid(version)) throw new Error("Invalid QR Code version");
|
|
1321
|
+
if (typeof mode === "undefined") mode = Mode.BYTE;
|
|
1322
|
+
const dataTotalCodewordsBits = (Utils.getSymbolTotalCodewords(version) - ECCode.getTotalCodewordsCount(version, errorCorrectionLevel)) * 8;
|
|
1323
|
+
if (mode === Mode.MIXED) return dataTotalCodewordsBits;
|
|
1324
|
+
const usableBits = dataTotalCodewordsBits - getReservedBitsCount(mode, version);
|
|
1325
|
+
switch (mode) {
|
|
1326
|
+
case Mode.NUMERIC: return Math.floor(usableBits / 10 * 3);
|
|
1327
|
+
case Mode.ALPHANUMERIC: return Math.floor(usableBits / 11 * 2);
|
|
1328
|
+
case Mode.KANJI: return Math.floor(usableBits / 13);
|
|
1329
|
+
case Mode.BYTE:
|
|
1330
|
+
default: return Math.floor(usableBits / 8);
|
|
1331
|
+
}
|
|
1332
|
+
};
|
|
1333
|
+
/**
|
|
1334
|
+
* Returns the minimum version needed to contain the amount of data
|
|
1335
|
+
*
|
|
1336
|
+
* @param {Segment} data Segment of data
|
|
1337
|
+
* @param {Number} [errorCorrectionLevel=H] Error correction level
|
|
1338
|
+
* @param {Mode} mode Data mode
|
|
1339
|
+
* @return {Number} QR Code version
|
|
1340
|
+
*/
|
|
1341
|
+
exports.getBestVersionForData = function getBestVersionForData(data, errorCorrectionLevel) {
|
|
1342
|
+
let seg;
|
|
1343
|
+
const ecl = ECLevel.from(errorCorrectionLevel, ECLevel.M);
|
|
1344
|
+
if (Array.isArray(data)) {
|
|
1345
|
+
if (data.length > 1) return getBestVersionForMixedData(data, ecl);
|
|
1346
|
+
if (data.length === 0) return 1;
|
|
1347
|
+
seg = data[0];
|
|
1348
|
+
} else seg = data;
|
|
1349
|
+
return getBestVersionForDataLength(seg.mode, seg.getLength(), ecl);
|
|
1350
|
+
};
|
|
1351
|
+
/**
|
|
1352
|
+
* Returns version information with relative error correction bits
|
|
1353
|
+
*
|
|
1354
|
+
* The version information is included in QR Code symbols of version 7 or larger.
|
|
1355
|
+
* It consists of an 18-bit sequence containing 6 data bits,
|
|
1356
|
+
* with 12 error correction bits calculated using the (18, 6) Golay code.
|
|
1357
|
+
*
|
|
1358
|
+
* @param {Number} version QR Code version
|
|
1359
|
+
* @return {Number} Encoded version info bits
|
|
1360
|
+
*/
|
|
1361
|
+
exports.getEncodedBits = function getEncodedBits(version) {
|
|
1362
|
+
if (!VersionCheck.isValid(version) || version < 7) throw new Error("Invalid QR Code version");
|
|
1363
|
+
let d = version << 12;
|
|
1364
|
+
while (Utils.getBCHDigit(d) - G18_BCH >= 0) d ^= G18 << Utils.getBCHDigit(d) - G18_BCH;
|
|
1365
|
+
return version << 12 | d;
|
|
1366
|
+
};
|
|
1367
|
+
}));
|
|
1368
|
+
//#endregion
|
|
1369
|
+
//#region ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/format-info.js
|
|
1370
|
+
var require_format_info = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1371
|
+
var Utils = require_utils$1();
|
|
1372
|
+
var G15 = 1335;
|
|
1373
|
+
var G15_MASK = 21522;
|
|
1374
|
+
var G15_BCH = Utils.getBCHDigit(G15);
|
|
1375
|
+
/**
|
|
1376
|
+
* Returns format information with relative error correction bits
|
|
1377
|
+
*
|
|
1378
|
+
* The format information is a 15-bit sequence containing 5 data bits,
|
|
1379
|
+
* with 10 error correction bits calculated using the (15, 5) BCH code.
|
|
1380
|
+
*
|
|
1381
|
+
* @param {Number} errorCorrectionLevel Error correction level
|
|
1382
|
+
* @param {Number} mask Mask pattern
|
|
1383
|
+
* @return {Number} Encoded format information bits
|
|
1384
|
+
*/
|
|
1385
|
+
exports.getEncodedBits = function getEncodedBits(errorCorrectionLevel, mask) {
|
|
1386
|
+
const data = errorCorrectionLevel.bit << 3 | mask;
|
|
1387
|
+
let d = data << 10;
|
|
1388
|
+
while (Utils.getBCHDigit(d) - G15_BCH >= 0) d ^= G15 << Utils.getBCHDigit(d) - G15_BCH;
|
|
1389
|
+
return (data << 10 | d) ^ G15_MASK;
|
|
1390
|
+
};
|
|
1391
|
+
}));
|
|
1392
|
+
//#endregion
|
|
1393
|
+
//#region ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/numeric-data.js
|
|
1394
|
+
var require_numeric_data = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1395
|
+
var Mode = require_mode();
|
|
1396
|
+
function NumericData(data) {
|
|
1397
|
+
this.mode = Mode.NUMERIC;
|
|
1398
|
+
this.data = data.toString();
|
|
1399
|
+
}
|
|
1400
|
+
NumericData.getBitsLength = function getBitsLength(length) {
|
|
1401
|
+
return 10 * Math.floor(length / 3) + (length % 3 ? length % 3 * 3 + 1 : 0);
|
|
1402
|
+
};
|
|
1403
|
+
NumericData.prototype.getLength = function getLength() {
|
|
1404
|
+
return this.data.length;
|
|
1405
|
+
};
|
|
1406
|
+
NumericData.prototype.getBitsLength = function getBitsLength() {
|
|
1407
|
+
return NumericData.getBitsLength(this.data.length);
|
|
1408
|
+
};
|
|
1409
|
+
NumericData.prototype.write = function write(bitBuffer) {
|
|
1410
|
+
let i, group, value;
|
|
1411
|
+
for (i = 0; i + 3 <= this.data.length; i += 3) {
|
|
1412
|
+
group = this.data.substr(i, 3);
|
|
1413
|
+
value = parseInt(group, 10);
|
|
1414
|
+
bitBuffer.put(value, 10);
|
|
1415
|
+
}
|
|
1416
|
+
const remainingNum = this.data.length - i;
|
|
1417
|
+
if (remainingNum > 0) {
|
|
1418
|
+
group = this.data.substr(i);
|
|
1419
|
+
value = parseInt(group, 10);
|
|
1420
|
+
bitBuffer.put(value, remainingNum * 3 + 1);
|
|
1421
|
+
}
|
|
1422
|
+
};
|
|
1423
|
+
module.exports = NumericData;
|
|
1424
|
+
}));
|
|
1425
|
+
//#endregion
|
|
1426
|
+
//#region ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/alphanumeric-data.js
|
|
1427
|
+
var require_alphanumeric_data = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1428
|
+
var Mode = require_mode();
|
|
1429
|
+
/**
|
|
1430
|
+
* Array of characters available in alphanumeric mode
|
|
1431
|
+
*
|
|
1432
|
+
* As per QR Code specification, to each character
|
|
1433
|
+
* is assigned a value from 0 to 44 which in this case coincides
|
|
1434
|
+
* with the array index
|
|
1435
|
+
*
|
|
1436
|
+
* @type {Array}
|
|
1437
|
+
*/
|
|
1438
|
+
var ALPHA_NUM_CHARS = [
|
|
1439
|
+
"0",
|
|
1440
|
+
"1",
|
|
1441
|
+
"2",
|
|
1442
|
+
"3",
|
|
1443
|
+
"4",
|
|
1444
|
+
"5",
|
|
1445
|
+
"6",
|
|
1446
|
+
"7",
|
|
1447
|
+
"8",
|
|
1448
|
+
"9",
|
|
1449
|
+
"A",
|
|
1450
|
+
"B",
|
|
1451
|
+
"C",
|
|
1452
|
+
"D",
|
|
1453
|
+
"E",
|
|
1454
|
+
"F",
|
|
1455
|
+
"G",
|
|
1456
|
+
"H",
|
|
1457
|
+
"I",
|
|
1458
|
+
"J",
|
|
1459
|
+
"K",
|
|
1460
|
+
"L",
|
|
1461
|
+
"M",
|
|
1462
|
+
"N",
|
|
1463
|
+
"O",
|
|
1464
|
+
"P",
|
|
1465
|
+
"Q",
|
|
1466
|
+
"R",
|
|
1467
|
+
"S",
|
|
1468
|
+
"T",
|
|
1469
|
+
"U",
|
|
1470
|
+
"V",
|
|
1471
|
+
"W",
|
|
1472
|
+
"X",
|
|
1473
|
+
"Y",
|
|
1474
|
+
"Z",
|
|
1475
|
+
" ",
|
|
1476
|
+
"$",
|
|
1477
|
+
"%",
|
|
1478
|
+
"*",
|
|
1479
|
+
"+",
|
|
1480
|
+
"-",
|
|
1481
|
+
".",
|
|
1482
|
+
"/",
|
|
1483
|
+
":"
|
|
1484
|
+
];
|
|
1485
|
+
function AlphanumericData(data) {
|
|
1486
|
+
this.mode = Mode.ALPHANUMERIC;
|
|
1487
|
+
this.data = data;
|
|
1488
|
+
}
|
|
1489
|
+
AlphanumericData.getBitsLength = function getBitsLength(length) {
|
|
1490
|
+
return 11 * Math.floor(length / 2) + 6 * (length % 2);
|
|
1491
|
+
};
|
|
1492
|
+
AlphanumericData.prototype.getLength = function getLength() {
|
|
1493
|
+
return this.data.length;
|
|
1494
|
+
};
|
|
1495
|
+
AlphanumericData.prototype.getBitsLength = function getBitsLength() {
|
|
1496
|
+
return AlphanumericData.getBitsLength(this.data.length);
|
|
1497
|
+
};
|
|
1498
|
+
AlphanumericData.prototype.write = function write(bitBuffer) {
|
|
1499
|
+
let i;
|
|
1500
|
+
for (i = 0; i + 2 <= this.data.length; i += 2) {
|
|
1501
|
+
let value = ALPHA_NUM_CHARS.indexOf(this.data[i]) * 45;
|
|
1502
|
+
value += ALPHA_NUM_CHARS.indexOf(this.data[i + 1]);
|
|
1503
|
+
bitBuffer.put(value, 11);
|
|
1504
|
+
}
|
|
1505
|
+
if (this.data.length % 2) bitBuffer.put(ALPHA_NUM_CHARS.indexOf(this.data[i]), 6);
|
|
1506
|
+
};
|
|
1507
|
+
module.exports = AlphanumericData;
|
|
1508
|
+
}));
|
|
1509
|
+
//#endregion
|
|
1510
|
+
//#region ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/byte-data.js
|
|
1511
|
+
var require_byte_data = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1512
|
+
var Mode = require_mode();
|
|
1513
|
+
function ByteData(data) {
|
|
1514
|
+
this.mode = Mode.BYTE;
|
|
1515
|
+
if (typeof data === "string") this.data = new TextEncoder().encode(data);
|
|
1516
|
+
else this.data = new Uint8Array(data);
|
|
1517
|
+
}
|
|
1518
|
+
ByteData.getBitsLength = function getBitsLength(length) {
|
|
1519
|
+
return length * 8;
|
|
1520
|
+
};
|
|
1521
|
+
ByteData.prototype.getLength = function getLength() {
|
|
1522
|
+
return this.data.length;
|
|
1523
|
+
};
|
|
1524
|
+
ByteData.prototype.getBitsLength = function getBitsLength() {
|
|
1525
|
+
return ByteData.getBitsLength(this.data.length);
|
|
1526
|
+
};
|
|
1527
|
+
ByteData.prototype.write = function(bitBuffer) {
|
|
1528
|
+
for (let i = 0, l = this.data.length; i < l; i++) bitBuffer.put(this.data[i], 8);
|
|
1529
|
+
};
|
|
1530
|
+
module.exports = ByteData;
|
|
1531
|
+
}));
|
|
1532
|
+
//#endregion
|
|
1533
|
+
//#region ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/kanji-data.js
|
|
1534
|
+
var require_kanji_data = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1535
|
+
var Mode = require_mode();
|
|
1536
|
+
var Utils = require_utils$1();
|
|
1537
|
+
function KanjiData(data) {
|
|
1538
|
+
this.mode = Mode.KANJI;
|
|
1539
|
+
this.data = data;
|
|
1540
|
+
}
|
|
1541
|
+
KanjiData.getBitsLength = function getBitsLength(length) {
|
|
1542
|
+
return length * 13;
|
|
1543
|
+
};
|
|
1544
|
+
KanjiData.prototype.getLength = function getLength() {
|
|
1545
|
+
return this.data.length;
|
|
1546
|
+
};
|
|
1547
|
+
KanjiData.prototype.getBitsLength = function getBitsLength() {
|
|
1548
|
+
return KanjiData.getBitsLength(this.data.length);
|
|
1549
|
+
};
|
|
1550
|
+
KanjiData.prototype.write = function(bitBuffer) {
|
|
1551
|
+
let i;
|
|
1552
|
+
for (i = 0; i < this.data.length; i++) {
|
|
1553
|
+
let value = Utils.toSJIS(this.data[i]);
|
|
1554
|
+
if (value >= 33088 && value <= 40956) value -= 33088;
|
|
1555
|
+
else if (value >= 57408 && value <= 60351) value -= 49472;
|
|
1556
|
+
else throw new Error("Invalid SJIS character: " + this.data[i] + "\nMake sure your charset is UTF-8");
|
|
1557
|
+
value = (value >>> 8 & 255) * 192 + (value & 255);
|
|
1558
|
+
bitBuffer.put(value, 13);
|
|
1559
|
+
}
|
|
1560
|
+
};
|
|
1561
|
+
module.exports = KanjiData;
|
|
1562
|
+
}));
|
|
1563
|
+
//#endregion
|
|
1564
|
+
//#region ../../node_modules/.pnpm/dijkstrajs@1.0.3/node_modules/dijkstrajs/dijkstra.js
|
|
1565
|
+
var require_dijkstra = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1566
|
+
/******************************************************************************
|
|
1567
|
+
* Created 2008-08-19.
|
|
1568
|
+
*
|
|
1569
|
+
* Dijkstra path-finding functions. Adapted from the Dijkstar Python project.
|
|
1570
|
+
*
|
|
1571
|
+
* Copyright (C) 2008
|
|
1572
|
+
* Wyatt Baldwin <self@wyattbaldwin.com>
|
|
1573
|
+
* All rights reserved
|
|
1574
|
+
*
|
|
1575
|
+
* Licensed under the MIT license.
|
|
1576
|
+
*
|
|
1577
|
+
* http://www.opensource.org/licenses/mit-license.php
|
|
1578
|
+
*
|
|
1579
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
1580
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
1581
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
1582
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
1583
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
1584
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
1585
|
+
* THE SOFTWARE.
|
|
1586
|
+
*****************************************************************************/
|
|
1587
|
+
var dijkstra = {
|
|
1588
|
+
single_source_shortest_paths: function(graph, s, d) {
|
|
1589
|
+
var predecessors = {};
|
|
1590
|
+
var costs = {};
|
|
1591
|
+
costs[s] = 0;
|
|
1592
|
+
var open = dijkstra.PriorityQueue.make();
|
|
1593
|
+
open.push(s, 0);
|
|
1594
|
+
var closest, u, v, cost_of_s_to_u, adjacent_nodes, cost_of_e, cost_of_s_to_u_plus_cost_of_e, cost_of_s_to_v, first_visit;
|
|
1595
|
+
while (!open.empty()) {
|
|
1596
|
+
closest = open.pop();
|
|
1597
|
+
u = closest.value;
|
|
1598
|
+
cost_of_s_to_u = closest.cost;
|
|
1599
|
+
adjacent_nodes = graph[u] || {};
|
|
1600
|
+
for (v in adjacent_nodes) if (adjacent_nodes.hasOwnProperty(v)) {
|
|
1601
|
+
cost_of_e = adjacent_nodes[v];
|
|
1602
|
+
cost_of_s_to_u_plus_cost_of_e = cost_of_s_to_u + cost_of_e;
|
|
1603
|
+
cost_of_s_to_v = costs[v];
|
|
1604
|
+
first_visit = typeof costs[v] === "undefined";
|
|
1605
|
+
if (first_visit || cost_of_s_to_v > cost_of_s_to_u_plus_cost_of_e) {
|
|
1606
|
+
costs[v] = cost_of_s_to_u_plus_cost_of_e;
|
|
1607
|
+
open.push(v, cost_of_s_to_u_plus_cost_of_e);
|
|
1608
|
+
predecessors[v] = u;
|
|
1609
|
+
}
|
|
1610
|
+
}
|
|
1611
|
+
}
|
|
1612
|
+
if (typeof d !== "undefined" && typeof costs[d] === "undefined") {
|
|
1613
|
+
var msg = [
|
|
1614
|
+
"Could not find a path from ",
|
|
1615
|
+
s,
|
|
1616
|
+
" to ",
|
|
1617
|
+
d,
|
|
1618
|
+
"."
|
|
1619
|
+
].join("");
|
|
1620
|
+
throw new Error(msg);
|
|
1621
|
+
}
|
|
1622
|
+
return predecessors;
|
|
1623
|
+
},
|
|
1624
|
+
extract_shortest_path_from_predecessor_list: function(predecessors, d) {
|
|
1625
|
+
var nodes = [];
|
|
1626
|
+
var u = d;
|
|
1627
|
+
while (u) {
|
|
1628
|
+
nodes.push(u);
|
|
1629
|
+
predecessors[u];
|
|
1630
|
+
u = predecessors[u];
|
|
1631
|
+
}
|
|
1632
|
+
nodes.reverse();
|
|
1633
|
+
return nodes;
|
|
1634
|
+
},
|
|
1635
|
+
find_path: function(graph, s, d) {
|
|
1636
|
+
var predecessors = dijkstra.single_source_shortest_paths(graph, s, d);
|
|
1637
|
+
return dijkstra.extract_shortest_path_from_predecessor_list(predecessors, d);
|
|
1638
|
+
},
|
|
1639
|
+
PriorityQueue: {
|
|
1640
|
+
make: function(opts) {
|
|
1641
|
+
var T = dijkstra.PriorityQueue, t = {}, key;
|
|
1642
|
+
opts = opts || {};
|
|
1643
|
+
for (key in T) if (T.hasOwnProperty(key)) t[key] = T[key];
|
|
1644
|
+
t.queue = [];
|
|
1645
|
+
t.sorter = opts.sorter || T.default_sorter;
|
|
1646
|
+
return t;
|
|
1647
|
+
},
|
|
1648
|
+
default_sorter: function(a, b) {
|
|
1649
|
+
return a.cost - b.cost;
|
|
1650
|
+
},
|
|
1651
|
+
push: function(value, cost) {
|
|
1652
|
+
var item = {
|
|
1653
|
+
value,
|
|
1654
|
+
cost
|
|
1655
|
+
};
|
|
1656
|
+
this.queue.push(item);
|
|
1657
|
+
this.queue.sort(this.sorter);
|
|
1658
|
+
},
|
|
1659
|
+
pop: function() {
|
|
1660
|
+
return this.queue.shift();
|
|
1661
|
+
},
|
|
1662
|
+
empty: function() {
|
|
1663
|
+
return this.queue.length === 0;
|
|
1664
|
+
}
|
|
1665
|
+
}
|
|
1666
|
+
};
|
|
1667
|
+
if (typeof module !== "undefined") module.exports = dijkstra;
|
|
1668
|
+
}));
|
|
1669
|
+
//#endregion
|
|
1670
|
+
//#region ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/segments.js
|
|
1671
|
+
var require_segments = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1672
|
+
var Mode = require_mode();
|
|
1673
|
+
var NumericData = require_numeric_data();
|
|
1674
|
+
var AlphanumericData = require_alphanumeric_data();
|
|
1675
|
+
var ByteData = require_byte_data();
|
|
1676
|
+
var KanjiData = require_kanji_data();
|
|
1677
|
+
var Regex = require_regex();
|
|
1678
|
+
var Utils = require_utils$1();
|
|
1679
|
+
var dijkstra = require_dijkstra();
|
|
1680
|
+
/**
|
|
1681
|
+
* Returns UTF8 byte length
|
|
1682
|
+
*
|
|
1683
|
+
* @param {String} str Input string
|
|
1684
|
+
* @return {Number} Number of byte
|
|
1685
|
+
*/
|
|
1686
|
+
function getStringByteLength(str) {
|
|
1687
|
+
return unescape(encodeURIComponent(str)).length;
|
|
1688
|
+
}
|
|
1689
|
+
/**
|
|
1690
|
+
* Get a list of segments of the specified mode
|
|
1691
|
+
* from a string
|
|
1692
|
+
*
|
|
1693
|
+
* @param {Mode} mode Segment mode
|
|
1694
|
+
* @param {String} str String to process
|
|
1695
|
+
* @return {Array} Array of object with segments data
|
|
1696
|
+
*/
|
|
1697
|
+
function getSegments(regex, mode, str) {
|
|
1698
|
+
const segments = [];
|
|
1699
|
+
let result;
|
|
1700
|
+
while ((result = regex.exec(str)) !== null) segments.push({
|
|
1701
|
+
data: result[0],
|
|
1702
|
+
index: result.index,
|
|
1703
|
+
mode,
|
|
1704
|
+
length: result[0].length
|
|
1705
|
+
});
|
|
1706
|
+
return segments;
|
|
1707
|
+
}
|
|
1708
|
+
/**
|
|
1709
|
+
* Extracts a series of segments with the appropriate
|
|
1710
|
+
* modes from a string
|
|
1711
|
+
*
|
|
1712
|
+
* @param {String} dataStr Input string
|
|
1713
|
+
* @return {Array} Array of object with segments data
|
|
1714
|
+
*/
|
|
1715
|
+
function getSegmentsFromString(dataStr) {
|
|
1716
|
+
const numSegs = getSegments(Regex.NUMERIC, Mode.NUMERIC, dataStr);
|
|
1717
|
+
const alphaNumSegs = getSegments(Regex.ALPHANUMERIC, Mode.ALPHANUMERIC, dataStr);
|
|
1718
|
+
let byteSegs;
|
|
1719
|
+
let kanjiSegs;
|
|
1720
|
+
if (Utils.isKanjiModeEnabled()) {
|
|
1721
|
+
byteSegs = getSegments(Regex.BYTE, Mode.BYTE, dataStr);
|
|
1722
|
+
kanjiSegs = getSegments(Regex.KANJI, Mode.KANJI, dataStr);
|
|
1723
|
+
} else {
|
|
1724
|
+
byteSegs = getSegments(Regex.BYTE_KANJI, Mode.BYTE, dataStr);
|
|
1725
|
+
kanjiSegs = [];
|
|
1726
|
+
}
|
|
1727
|
+
return numSegs.concat(alphaNumSegs, byteSegs, kanjiSegs).sort(function(s1, s2) {
|
|
1728
|
+
return s1.index - s2.index;
|
|
1729
|
+
}).map(function(obj) {
|
|
1730
|
+
return {
|
|
1731
|
+
data: obj.data,
|
|
1732
|
+
mode: obj.mode,
|
|
1733
|
+
length: obj.length
|
|
1734
|
+
};
|
|
1735
|
+
});
|
|
1736
|
+
}
|
|
1737
|
+
/**
|
|
1738
|
+
* Returns how many bits are needed to encode a string of
|
|
1739
|
+
* specified length with the specified mode
|
|
1740
|
+
*
|
|
1741
|
+
* @param {Number} length String length
|
|
1742
|
+
* @param {Mode} mode Segment mode
|
|
1743
|
+
* @return {Number} Bit length
|
|
1744
|
+
*/
|
|
1745
|
+
function getSegmentBitsLength(length, mode) {
|
|
1746
|
+
switch (mode) {
|
|
1747
|
+
case Mode.NUMERIC: return NumericData.getBitsLength(length);
|
|
1748
|
+
case Mode.ALPHANUMERIC: return AlphanumericData.getBitsLength(length);
|
|
1749
|
+
case Mode.KANJI: return KanjiData.getBitsLength(length);
|
|
1750
|
+
case Mode.BYTE: return ByteData.getBitsLength(length);
|
|
1751
|
+
}
|
|
1752
|
+
}
|
|
1753
|
+
/**
|
|
1754
|
+
* Merges adjacent segments which have the same mode
|
|
1755
|
+
*
|
|
1756
|
+
* @param {Array} segs Array of object with segments data
|
|
1757
|
+
* @return {Array} Array of object with segments data
|
|
1758
|
+
*/
|
|
1759
|
+
function mergeSegments(segs) {
|
|
1760
|
+
return segs.reduce(function(acc, curr) {
|
|
1761
|
+
const prevSeg = acc.length - 1 >= 0 ? acc[acc.length - 1] : null;
|
|
1762
|
+
if (prevSeg && prevSeg.mode === curr.mode) {
|
|
1763
|
+
acc[acc.length - 1].data += curr.data;
|
|
1764
|
+
return acc;
|
|
1765
|
+
}
|
|
1766
|
+
acc.push(curr);
|
|
1767
|
+
return acc;
|
|
1768
|
+
}, []);
|
|
1769
|
+
}
|
|
1770
|
+
/**
|
|
1771
|
+
* Generates a list of all possible nodes combination which
|
|
1772
|
+
* will be used to build a segments graph.
|
|
1773
|
+
*
|
|
1774
|
+
* Nodes are divided by groups. Each group will contain a list of all the modes
|
|
1775
|
+
* in which is possible to encode the given text.
|
|
1776
|
+
*
|
|
1777
|
+
* For example the text '12345' can be encoded as Numeric, Alphanumeric or Byte.
|
|
1778
|
+
* The group for '12345' will contain then 3 objects, one for each
|
|
1779
|
+
* possible encoding mode.
|
|
1780
|
+
*
|
|
1781
|
+
* Each node represents a possible segment.
|
|
1782
|
+
*
|
|
1783
|
+
* @param {Array} segs Array of object with segments data
|
|
1784
|
+
* @return {Array} Array of object with segments data
|
|
1785
|
+
*/
|
|
1786
|
+
function buildNodes(segs) {
|
|
1787
|
+
const nodes = [];
|
|
1788
|
+
for (let i = 0; i < segs.length; i++) {
|
|
1789
|
+
const seg = segs[i];
|
|
1790
|
+
switch (seg.mode) {
|
|
1791
|
+
case Mode.NUMERIC:
|
|
1792
|
+
nodes.push([
|
|
1793
|
+
seg,
|
|
1794
|
+
{
|
|
1795
|
+
data: seg.data,
|
|
1796
|
+
mode: Mode.ALPHANUMERIC,
|
|
1797
|
+
length: seg.length
|
|
1798
|
+
},
|
|
1799
|
+
{
|
|
1800
|
+
data: seg.data,
|
|
1801
|
+
mode: Mode.BYTE,
|
|
1802
|
+
length: seg.length
|
|
1803
|
+
}
|
|
1804
|
+
]);
|
|
1805
|
+
break;
|
|
1806
|
+
case Mode.ALPHANUMERIC:
|
|
1807
|
+
nodes.push([seg, {
|
|
1808
|
+
data: seg.data,
|
|
1809
|
+
mode: Mode.BYTE,
|
|
1810
|
+
length: seg.length
|
|
1811
|
+
}]);
|
|
1812
|
+
break;
|
|
1813
|
+
case Mode.KANJI:
|
|
1814
|
+
nodes.push([seg, {
|
|
1815
|
+
data: seg.data,
|
|
1816
|
+
mode: Mode.BYTE,
|
|
1817
|
+
length: getStringByteLength(seg.data)
|
|
1818
|
+
}]);
|
|
1819
|
+
break;
|
|
1820
|
+
case Mode.BYTE: nodes.push([{
|
|
1821
|
+
data: seg.data,
|
|
1822
|
+
mode: Mode.BYTE,
|
|
1823
|
+
length: getStringByteLength(seg.data)
|
|
1824
|
+
}]);
|
|
1825
|
+
}
|
|
1826
|
+
}
|
|
1827
|
+
return nodes;
|
|
1828
|
+
}
|
|
1829
|
+
/**
|
|
1830
|
+
* Builds a graph from a list of nodes.
|
|
1831
|
+
* All segments in each node group will be connected with all the segments of
|
|
1832
|
+
* the next group and so on.
|
|
1833
|
+
*
|
|
1834
|
+
* At each connection will be assigned a weight depending on the
|
|
1835
|
+
* segment's byte length.
|
|
1836
|
+
*
|
|
1837
|
+
* @param {Array} nodes Array of object with segments data
|
|
1838
|
+
* @param {Number} version QR Code version
|
|
1839
|
+
* @return {Object} Graph of all possible segments
|
|
1840
|
+
*/
|
|
1841
|
+
function buildGraph(nodes, version) {
|
|
1842
|
+
const table = {};
|
|
1843
|
+
const graph = { start: {} };
|
|
1844
|
+
let prevNodeIds = ["start"];
|
|
1845
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
1846
|
+
const nodeGroup = nodes[i];
|
|
1847
|
+
const currentNodeIds = [];
|
|
1848
|
+
for (let j = 0; j < nodeGroup.length; j++) {
|
|
1849
|
+
const node = nodeGroup[j];
|
|
1850
|
+
const key = "" + i + j;
|
|
1851
|
+
currentNodeIds.push(key);
|
|
1852
|
+
table[key] = {
|
|
1853
|
+
node,
|
|
1854
|
+
lastCount: 0
|
|
1855
|
+
};
|
|
1856
|
+
graph[key] = {};
|
|
1857
|
+
for (let n = 0; n < prevNodeIds.length; n++) {
|
|
1858
|
+
const prevNodeId = prevNodeIds[n];
|
|
1859
|
+
if (table[prevNodeId] && table[prevNodeId].node.mode === node.mode) {
|
|
1860
|
+
graph[prevNodeId][key] = getSegmentBitsLength(table[prevNodeId].lastCount + node.length, node.mode) - getSegmentBitsLength(table[prevNodeId].lastCount, node.mode);
|
|
1861
|
+
table[prevNodeId].lastCount += node.length;
|
|
1862
|
+
} else {
|
|
1863
|
+
if (table[prevNodeId]) table[prevNodeId].lastCount = node.length;
|
|
1864
|
+
graph[prevNodeId][key] = getSegmentBitsLength(node.length, node.mode) + 4 + Mode.getCharCountIndicator(node.mode, version);
|
|
1865
|
+
}
|
|
1866
|
+
}
|
|
1867
|
+
}
|
|
1868
|
+
prevNodeIds = currentNodeIds;
|
|
1869
|
+
}
|
|
1870
|
+
for (let n = 0; n < prevNodeIds.length; n++) graph[prevNodeIds[n]].end = 0;
|
|
1871
|
+
return {
|
|
1872
|
+
map: graph,
|
|
1873
|
+
table
|
|
1874
|
+
};
|
|
1875
|
+
}
|
|
1876
|
+
/**
|
|
1877
|
+
* Builds a segment from a specified data and mode.
|
|
1878
|
+
* If a mode is not specified, the more suitable will be used.
|
|
1879
|
+
*
|
|
1880
|
+
* @param {String} data Input data
|
|
1881
|
+
* @param {Mode | String} modesHint Data mode
|
|
1882
|
+
* @return {Segment} Segment
|
|
1883
|
+
*/
|
|
1884
|
+
function buildSingleSegment(data, modesHint) {
|
|
1885
|
+
let mode;
|
|
1886
|
+
const bestMode = Mode.getBestModeForData(data);
|
|
1887
|
+
mode = Mode.from(modesHint, bestMode);
|
|
1888
|
+
if (mode !== Mode.BYTE && mode.bit < bestMode.bit) throw new Error("\"" + data + "\" cannot be encoded with mode " + Mode.toString(mode) + ".\n Suggested mode is: " + Mode.toString(bestMode));
|
|
1889
|
+
if (mode === Mode.KANJI && !Utils.isKanjiModeEnabled()) mode = Mode.BYTE;
|
|
1890
|
+
switch (mode) {
|
|
1891
|
+
case Mode.NUMERIC: return new NumericData(data);
|
|
1892
|
+
case Mode.ALPHANUMERIC: return new AlphanumericData(data);
|
|
1893
|
+
case Mode.KANJI: return new KanjiData(data);
|
|
1894
|
+
case Mode.BYTE: return new ByteData(data);
|
|
1895
|
+
}
|
|
1896
|
+
}
|
|
1897
|
+
/**
|
|
1898
|
+
* Builds a list of segments from an array.
|
|
1899
|
+
* Array can contain Strings or Objects with segment's info.
|
|
1900
|
+
*
|
|
1901
|
+
* For each item which is a string, will be generated a segment with the given
|
|
1902
|
+
* string and the more appropriate encoding mode.
|
|
1903
|
+
*
|
|
1904
|
+
* For each item which is an object, will be generated a segment with the given
|
|
1905
|
+
* data and mode.
|
|
1906
|
+
* Objects must contain at least the property "data".
|
|
1907
|
+
* If property "mode" is not present, the more suitable mode will be used.
|
|
1908
|
+
*
|
|
1909
|
+
* @param {Array} array Array of objects with segments data
|
|
1910
|
+
* @return {Array} Array of Segments
|
|
1911
|
+
*/
|
|
1912
|
+
exports.fromArray = function fromArray(array) {
|
|
1913
|
+
return array.reduce(function(acc, seg) {
|
|
1914
|
+
if (typeof seg === "string") acc.push(buildSingleSegment(seg, null));
|
|
1915
|
+
else if (seg.data) acc.push(buildSingleSegment(seg.data, seg.mode));
|
|
1916
|
+
return acc;
|
|
1917
|
+
}, []);
|
|
1918
|
+
};
|
|
1919
|
+
/**
|
|
1920
|
+
* Builds an optimized sequence of segments from a string,
|
|
1921
|
+
* which will produce the shortest possible bitstream.
|
|
1922
|
+
*
|
|
1923
|
+
* @param {String} data Input string
|
|
1924
|
+
* @param {Number} version QR Code version
|
|
1925
|
+
* @return {Array} Array of segments
|
|
1926
|
+
*/
|
|
1927
|
+
exports.fromString = function fromString(data, version) {
|
|
1928
|
+
const graph = buildGraph(buildNodes(getSegmentsFromString(data, Utils.isKanjiModeEnabled())), version);
|
|
1929
|
+
const path = dijkstra.find_path(graph.map, "start", "end");
|
|
1930
|
+
const optimizedSegs = [];
|
|
1931
|
+
for (let i = 1; i < path.length - 1; i++) optimizedSegs.push(graph.table[path[i]].node);
|
|
1932
|
+
return exports.fromArray(mergeSegments(optimizedSegs));
|
|
1933
|
+
};
|
|
1934
|
+
/**
|
|
1935
|
+
* Splits a string in various segments with the modes which
|
|
1936
|
+
* best represent their content.
|
|
1937
|
+
* The produced segments are far from being optimized.
|
|
1938
|
+
* The output of this function is only used to estimate a QR Code version
|
|
1939
|
+
* which may contain the data.
|
|
1940
|
+
*
|
|
1941
|
+
* @param {string} data Input string
|
|
1942
|
+
* @return {Array} Array of segments
|
|
1943
|
+
*/
|
|
1944
|
+
exports.rawSplit = function rawSplit(data) {
|
|
1945
|
+
return exports.fromArray(getSegmentsFromString(data, Utils.isKanjiModeEnabled()));
|
|
1946
|
+
};
|
|
1947
|
+
}));
|
|
1948
|
+
//#endregion
|
|
1949
|
+
//#region ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/qrcode.js
|
|
1950
|
+
var require_qrcode = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1951
|
+
var Utils = require_utils$1();
|
|
1952
|
+
var ECLevel = require_error_correction_level();
|
|
1953
|
+
var BitBuffer = require_bit_buffer();
|
|
1954
|
+
var BitMatrix = require_bit_matrix();
|
|
1955
|
+
var AlignmentPattern = require_alignment_pattern();
|
|
1956
|
+
var FinderPattern = require_finder_pattern();
|
|
1957
|
+
var MaskPattern = require_mask_pattern();
|
|
1958
|
+
var ECCode = require_error_correction_code();
|
|
1959
|
+
var ReedSolomonEncoder = require_reed_solomon_encoder();
|
|
1960
|
+
var Version = require_version();
|
|
1961
|
+
var FormatInfo = require_format_info();
|
|
1962
|
+
var Mode = require_mode();
|
|
1963
|
+
var Segments = require_segments();
|
|
1964
|
+
/**
|
|
1965
|
+
* QRCode for JavaScript
|
|
1966
|
+
*
|
|
1967
|
+
* modified by Ryan Day for nodejs support
|
|
1968
|
+
* Copyright (c) 2011 Ryan Day
|
|
1969
|
+
*
|
|
1970
|
+
* Licensed under the MIT license:
|
|
1971
|
+
* http://www.opensource.org/licenses/mit-license.php
|
|
1972
|
+
*
|
|
1973
|
+
//---------------------------------------------------------------------
|
|
1974
|
+
// QRCode for JavaScript
|
|
1975
|
+
//
|
|
1976
|
+
// Copyright (c) 2009 Kazuhiko Arase
|
|
1977
|
+
//
|
|
1978
|
+
// URL: http://www.d-project.com/
|
|
1979
|
+
//
|
|
1980
|
+
// Licensed under the MIT license:
|
|
1981
|
+
// http://www.opensource.org/licenses/mit-license.php
|
|
1982
|
+
//
|
|
1983
|
+
// The word "QR Code" is registered trademark of
|
|
1984
|
+
// DENSO WAVE INCORPORATED
|
|
1985
|
+
// http://www.denso-wave.com/qrcode/faqpatent-e.html
|
|
1986
|
+
//
|
|
1987
|
+
//---------------------------------------------------------------------
|
|
1988
|
+
*/
|
|
1989
|
+
/**
|
|
1990
|
+
* Add finder patterns bits to matrix
|
|
1991
|
+
*
|
|
1992
|
+
* @param {BitMatrix} matrix Modules matrix
|
|
1993
|
+
* @param {Number} version QR Code version
|
|
1994
|
+
*/
|
|
1995
|
+
function setupFinderPattern(matrix, version) {
|
|
1996
|
+
const size = matrix.size;
|
|
1997
|
+
const pos = FinderPattern.getPositions(version);
|
|
1998
|
+
for (let i = 0; i < pos.length; i++) {
|
|
1999
|
+
const row = pos[i][0];
|
|
2000
|
+
const col = pos[i][1];
|
|
2001
|
+
for (let r = -1; r <= 7; r++) {
|
|
2002
|
+
if (row + r <= -1 || size <= row + r) continue;
|
|
2003
|
+
for (let c = -1; c <= 7; c++) {
|
|
2004
|
+
if (col + c <= -1 || size <= col + c) continue;
|
|
2005
|
+
if (r >= 0 && r <= 6 && (c === 0 || c === 6) || c >= 0 && c <= 6 && (r === 0 || r === 6) || r >= 2 && r <= 4 && c >= 2 && c <= 4) matrix.set(row + r, col + c, true, true);
|
|
2006
|
+
else matrix.set(row + r, col + c, false, true);
|
|
2007
|
+
}
|
|
2008
|
+
}
|
|
2009
|
+
}
|
|
2010
|
+
}
|
|
2011
|
+
/**
|
|
2012
|
+
* Add timing pattern bits to matrix
|
|
2013
|
+
*
|
|
2014
|
+
* Note: this function must be called before {@link setupAlignmentPattern}
|
|
2015
|
+
*
|
|
2016
|
+
* @param {BitMatrix} matrix Modules matrix
|
|
2017
|
+
*/
|
|
2018
|
+
function setupTimingPattern(matrix) {
|
|
2019
|
+
const size = matrix.size;
|
|
2020
|
+
for (let r = 8; r < size - 8; r++) {
|
|
2021
|
+
const value = r % 2 === 0;
|
|
2022
|
+
matrix.set(r, 6, value, true);
|
|
2023
|
+
matrix.set(6, r, value, true);
|
|
2024
|
+
}
|
|
2025
|
+
}
|
|
2026
|
+
/**
|
|
2027
|
+
* Add alignment patterns bits to matrix
|
|
2028
|
+
*
|
|
2029
|
+
* Note: this function must be called after {@link setupTimingPattern}
|
|
2030
|
+
*
|
|
2031
|
+
* @param {BitMatrix} matrix Modules matrix
|
|
2032
|
+
* @param {Number} version QR Code version
|
|
2033
|
+
*/
|
|
2034
|
+
function setupAlignmentPattern(matrix, version) {
|
|
2035
|
+
const pos = AlignmentPattern.getPositions(version);
|
|
2036
|
+
for (let i = 0; i < pos.length; i++) {
|
|
2037
|
+
const row = pos[i][0];
|
|
2038
|
+
const col = pos[i][1];
|
|
2039
|
+
for (let r = -2; r <= 2; r++) for (let c = -2; c <= 2; c++) if (r === -2 || r === 2 || c === -2 || c === 2 || r === 0 && c === 0) matrix.set(row + r, col + c, true, true);
|
|
2040
|
+
else matrix.set(row + r, col + c, false, true);
|
|
2041
|
+
}
|
|
2042
|
+
}
|
|
2043
|
+
/**
|
|
2044
|
+
* Add version info bits to matrix
|
|
2045
|
+
*
|
|
2046
|
+
* @param {BitMatrix} matrix Modules matrix
|
|
2047
|
+
* @param {Number} version QR Code version
|
|
2048
|
+
*/
|
|
2049
|
+
function setupVersionInfo(matrix, version) {
|
|
2050
|
+
const size = matrix.size;
|
|
2051
|
+
const bits = Version.getEncodedBits(version);
|
|
2052
|
+
let row, col, mod;
|
|
2053
|
+
for (let i = 0; i < 18; i++) {
|
|
2054
|
+
row = Math.floor(i / 3);
|
|
2055
|
+
col = i % 3 + size - 8 - 3;
|
|
2056
|
+
mod = (bits >> i & 1) === 1;
|
|
2057
|
+
matrix.set(row, col, mod, true);
|
|
2058
|
+
matrix.set(col, row, mod, true);
|
|
2059
|
+
}
|
|
2060
|
+
}
|
|
2061
|
+
/**
|
|
2062
|
+
* Add format info bits to matrix
|
|
2063
|
+
*
|
|
2064
|
+
* @param {BitMatrix} matrix Modules matrix
|
|
2065
|
+
* @param {ErrorCorrectionLevel} errorCorrectionLevel Error correction level
|
|
2066
|
+
* @param {Number} maskPattern Mask pattern reference value
|
|
2067
|
+
*/
|
|
2068
|
+
function setupFormatInfo(matrix, errorCorrectionLevel, maskPattern) {
|
|
2069
|
+
const size = matrix.size;
|
|
2070
|
+
const bits = FormatInfo.getEncodedBits(errorCorrectionLevel, maskPattern);
|
|
2071
|
+
let i, mod;
|
|
2072
|
+
for (i = 0; i < 15; i++) {
|
|
2073
|
+
mod = (bits >> i & 1) === 1;
|
|
2074
|
+
if (i < 6) matrix.set(i, 8, mod, true);
|
|
2075
|
+
else if (i < 8) matrix.set(i + 1, 8, mod, true);
|
|
2076
|
+
else matrix.set(size - 15 + i, 8, mod, true);
|
|
2077
|
+
if (i < 8) matrix.set(8, size - i - 1, mod, true);
|
|
2078
|
+
else if (i < 9) matrix.set(8, 15 - i - 1 + 1, mod, true);
|
|
2079
|
+
else matrix.set(8, 15 - i - 1, mod, true);
|
|
2080
|
+
}
|
|
2081
|
+
matrix.set(size - 8, 8, 1, true);
|
|
2082
|
+
}
|
|
2083
|
+
/**
|
|
2084
|
+
* Add encoded data bits to matrix
|
|
2085
|
+
*
|
|
2086
|
+
* @param {BitMatrix} matrix Modules matrix
|
|
2087
|
+
* @param {Uint8Array} data Data codewords
|
|
2088
|
+
*/
|
|
2089
|
+
function setupData(matrix, data) {
|
|
2090
|
+
const size = matrix.size;
|
|
2091
|
+
let inc = -1;
|
|
2092
|
+
let row = size - 1;
|
|
2093
|
+
let bitIndex = 7;
|
|
2094
|
+
let byteIndex = 0;
|
|
2095
|
+
for (let col = size - 1; col > 0; col -= 2) {
|
|
2096
|
+
if (col === 6) col--;
|
|
2097
|
+
while (true) {
|
|
2098
|
+
for (let c = 0; c < 2; c++) if (!matrix.isReserved(row, col - c)) {
|
|
2099
|
+
let dark = false;
|
|
2100
|
+
if (byteIndex < data.length) dark = (data[byteIndex] >>> bitIndex & 1) === 1;
|
|
2101
|
+
matrix.set(row, col - c, dark);
|
|
2102
|
+
bitIndex--;
|
|
2103
|
+
if (bitIndex === -1) {
|
|
2104
|
+
byteIndex++;
|
|
2105
|
+
bitIndex = 7;
|
|
2106
|
+
}
|
|
2107
|
+
}
|
|
2108
|
+
row += inc;
|
|
2109
|
+
if (row < 0 || size <= row) {
|
|
2110
|
+
row -= inc;
|
|
2111
|
+
inc = -inc;
|
|
2112
|
+
break;
|
|
2113
|
+
}
|
|
2114
|
+
}
|
|
2115
|
+
}
|
|
2116
|
+
}
|
|
2117
|
+
/**
|
|
2118
|
+
* Create encoded codewords from data input
|
|
2119
|
+
*
|
|
2120
|
+
* @param {Number} version QR Code version
|
|
2121
|
+
* @param {ErrorCorrectionLevel} errorCorrectionLevel Error correction level
|
|
2122
|
+
* @param {ByteData} data Data input
|
|
2123
|
+
* @return {Uint8Array} Buffer containing encoded codewords
|
|
2124
|
+
*/
|
|
2125
|
+
function createData(version, errorCorrectionLevel, segments) {
|
|
2126
|
+
const buffer = new BitBuffer();
|
|
2127
|
+
segments.forEach(function(data) {
|
|
2128
|
+
buffer.put(data.mode.bit, 4);
|
|
2129
|
+
buffer.put(data.getLength(), Mode.getCharCountIndicator(data.mode, version));
|
|
2130
|
+
data.write(buffer);
|
|
2131
|
+
});
|
|
2132
|
+
const dataTotalCodewordsBits = (Utils.getSymbolTotalCodewords(version) - ECCode.getTotalCodewordsCount(version, errorCorrectionLevel)) * 8;
|
|
2133
|
+
if (buffer.getLengthInBits() + 4 <= dataTotalCodewordsBits) buffer.put(0, 4);
|
|
2134
|
+
while (buffer.getLengthInBits() % 8 !== 0) buffer.putBit(0);
|
|
2135
|
+
const remainingByte = (dataTotalCodewordsBits - buffer.getLengthInBits()) / 8;
|
|
2136
|
+
for (let i = 0; i < remainingByte; i++) buffer.put(i % 2 ? 17 : 236, 8);
|
|
2137
|
+
return createCodewords(buffer, version, errorCorrectionLevel);
|
|
2138
|
+
}
|
|
2139
|
+
/**
|
|
2140
|
+
* Encode input data with Reed-Solomon and return codewords with
|
|
2141
|
+
* relative error correction bits
|
|
2142
|
+
*
|
|
2143
|
+
* @param {BitBuffer} bitBuffer Data to encode
|
|
2144
|
+
* @param {Number} version QR Code version
|
|
2145
|
+
* @param {ErrorCorrectionLevel} errorCorrectionLevel Error correction level
|
|
2146
|
+
* @return {Uint8Array} Buffer containing encoded codewords
|
|
2147
|
+
*/
|
|
2148
|
+
function createCodewords(bitBuffer, version, errorCorrectionLevel) {
|
|
2149
|
+
const totalCodewords = Utils.getSymbolTotalCodewords(version);
|
|
2150
|
+
const dataTotalCodewords = totalCodewords - ECCode.getTotalCodewordsCount(version, errorCorrectionLevel);
|
|
2151
|
+
const ecTotalBlocks = ECCode.getBlocksCount(version, errorCorrectionLevel);
|
|
2152
|
+
const blocksInGroup1 = ecTotalBlocks - totalCodewords % ecTotalBlocks;
|
|
2153
|
+
const totalCodewordsInGroup1 = Math.floor(totalCodewords / ecTotalBlocks);
|
|
2154
|
+
const dataCodewordsInGroup1 = Math.floor(dataTotalCodewords / ecTotalBlocks);
|
|
2155
|
+
const dataCodewordsInGroup2 = dataCodewordsInGroup1 + 1;
|
|
2156
|
+
const ecCount = totalCodewordsInGroup1 - dataCodewordsInGroup1;
|
|
2157
|
+
const rs = new ReedSolomonEncoder(ecCount);
|
|
2158
|
+
let offset = 0;
|
|
2159
|
+
const dcData = new Array(ecTotalBlocks);
|
|
2160
|
+
const ecData = new Array(ecTotalBlocks);
|
|
2161
|
+
let maxDataSize = 0;
|
|
2162
|
+
const buffer = new Uint8Array(bitBuffer.buffer);
|
|
2163
|
+
for (let b = 0; b < ecTotalBlocks; b++) {
|
|
2164
|
+
const dataSize = b < blocksInGroup1 ? dataCodewordsInGroup1 : dataCodewordsInGroup2;
|
|
2165
|
+
dcData[b] = buffer.slice(offset, offset + dataSize);
|
|
2166
|
+
ecData[b] = rs.encode(dcData[b]);
|
|
2167
|
+
offset += dataSize;
|
|
2168
|
+
maxDataSize = Math.max(maxDataSize, dataSize);
|
|
2169
|
+
}
|
|
2170
|
+
const data = new Uint8Array(totalCodewords);
|
|
2171
|
+
let index = 0;
|
|
2172
|
+
let i, r;
|
|
2173
|
+
for (i = 0; i < maxDataSize; i++) for (r = 0; r < ecTotalBlocks; r++) if (i < dcData[r].length) data[index++] = dcData[r][i];
|
|
2174
|
+
for (i = 0; i < ecCount; i++) for (r = 0; r < ecTotalBlocks; r++) data[index++] = ecData[r][i];
|
|
2175
|
+
return data;
|
|
2176
|
+
}
|
|
2177
|
+
/**
|
|
2178
|
+
* Build QR Code symbol
|
|
2179
|
+
*
|
|
2180
|
+
* @param {String} data Input string
|
|
2181
|
+
* @param {Number} version QR Code version
|
|
2182
|
+
* @param {ErrorCorretionLevel} errorCorrectionLevel Error level
|
|
2183
|
+
* @param {MaskPattern} maskPattern Mask pattern
|
|
2184
|
+
* @return {Object} Object containing symbol data
|
|
2185
|
+
*/
|
|
2186
|
+
function createSymbol(data, version, errorCorrectionLevel, maskPattern) {
|
|
2187
|
+
let segments;
|
|
2188
|
+
if (Array.isArray(data)) segments = Segments.fromArray(data);
|
|
2189
|
+
else if (typeof data === "string") {
|
|
2190
|
+
let estimatedVersion = version;
|
|
2191
|
+
if (!estimatedVersion) {
|
|
2192
|
+
const rawSegments = Segments.rawSplit(data);
|
|
2193
|
+
estimatedVersion = Version.getBestVersionForData(rawSegments, errorCorrectionLevel);
|
|
2194
|
+
}
|
|
2195
|
+
segments = Segments.fromString(data, estimatedVersion || 40);
|
|
2196
|
+
} else throw new Error("Invalid data");
|
|
2197
|
+
const bestVersion = Version.getBestVersionForData(segments, errorCorrectionLevel);
|
|
2198
|
+
if (!bestVersion) throw new Error("The amount of data is too big to be stored in a QR Code");
|
|
2199
|
+
if (!version) version = bestVersion;
|
|
2200
|
+
else if (version < bestVersion) throw new Error("\nThe chosen QR Code version cannot contain this amount of data.\nMinimum version required to store current data is: " + bestVersion + ".\n");
|
|
2201
|
+
const dataBits = createData(version, errorCorrectionLevel, segments);
|
|
2202
|
+
const modules = new BitMatrix(Utils.getSymbolSize(version));
|
|
2203
|
+
setupFinderPattern(modules, version);
|
|
2204
|
+
setupTimingPattern(modules);
|
|
2205
|
+
setupAlignmentPattern(modules, version);
|
|
2206
|
+
setupFormatInfo(modules, errorCorrectionLevel, 0);
|
|
2207
|
+
if (version >= 7) setupVersionInfo(modules, version);
|
|
2208
|
+
setupData(modules, dataBits);
|
|
2209
|
+
if (isNaN(maskPattern)) maskPattern = MaskPattern.getBestMask(modules, setupFormatInfo.bind(null, modules, errorCorrectionLevel));
|
|
2210
|
+
MaskPattern.applyMask(maskPattern, modules);
|
|
2211
|
+
setupFormatInfo(modules, errorCorrectionLevel, maskPattern);
|
|
2212
|
+
return {
|
|
2213
|
+
modules,
|
|
2214
|
+
version,
|
|
2215
|
+
errorCorrectionLevel,
|
|
2216
|
+
maskPattern,
|
|
2217
|
+
segments
|
|
2218
|
+
};
|
|
2219
|
+
}
|
|
2220
|
+
/**
|
|
2221
|
+
* QR Code
|
|
2222
|
+
*
|
|
2223
|
+
* @param {String | Array} data Input data
|
|
2224
|
+
* @param {Object} options Optional configurations
|
|
2225
|
+
* @param {Number} options.version QR Code version
|
|
2226
|
+
* @param {String} options.errorCorrectionLevel Error correction level
|
|
2227
|
+
* @param {Function} options.toSJISFunc Helper func to convert utf8 to sjis
|
|
2228
|
+
*/
|
|
2229
|
+
exports.create = function create(data, options) {
|
|
2230
|
+
if (typeof data === "undefined" || data === "") throw new Error("No input text");
|
|
2231
|
+
let errorCorrectionLevel = ECLevel.M;
|
|
2232
|
+
let version;
|
|
2233
|
+
let mask;
|
|
2234
|
+
if (typeof options !== "undefined") {
|
|
2235
|
+
errorCorrectionLevel = ECLevel.from(options.errorCorrectionLevel, ECLevel.M);
|
|
2236
|
+
version = Version.from(options.version);
|
|
2237
|
+
mask = MaskPattern.from(options.maskPattern);
|
|
2238
|
+
if (options.toSJISFunc) Utils.setToSJISFunction(options.toSJISFunc);
|
|
2239
|
+
}
|
|
2240
|
+
return createSymbol(data, version, errorCorrectionLevel, mask);
|
|
2241
|
+
};
|
|
2242
|
+
}));
|
|
2243
|
+
//#endregion
|
|
2244
|
+
//#region ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/utils.js
|
|
2245
|
+
var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2246
|
+
function hex2rgba(hex) {
|
|
2247
|
+
if (typeof hex === "number") hex = hex.toString();
|
|
2248
|
+
if (typeof hex !== "string") throw new Error("Color should be defined as hex string");
|
|
2249
|
+
let hexCode = hex.slice().replace("#", "").split("");
|
|
2250
|
+
if (hexCode.length < 3 || hexCode.length === 5 || hexCode.length > 8) throw new Error("Invalid hex color: " + hex);
|
|
2251
|
+
if (hexCode.length === 3 || hexCode.length === 4) hexCode = Array.prototype.concat.apply([], hexCode.map(function(c) {
|
|
2252
|
+
return [c, c];
|
|
2253
|
+
}));
|
|
2254
|
+
if (hexCode.length === 6) hexCode.push("F", "F");
|
|
2255
|
+
const hexValue = parseInt(hexCode.join(""), 16);
|
|
2256
|
+
return {
|
|
2257
|
+
r: hexValue >> 24 & 255,
|
|
2258
|
+
g: hexValue >> 16 & 255,
|
|
2259
|
+
b: hexValue >> 8 & 255,
|
|
2260
|
+
a: hexValue & 255,
|
|
2261
|
+
hex: "#" + hexCode.slice(0, 6).join("")
|
|
2262
|
+
};
|
|
2263
|
+
}
|
|
2264
|
+
exports.getOptions = function getOptions(options) {
|
|
2265
|
+
if (!options) options = {};
|
|
2266
|
+
if (!options.color) options.color = {};
|
|
2267
|
+
const margin = typeof options.margin === "undefined" || options.margin === null || options.margin < 0 ? 4 : options.margin;
|
|
2268
|
+
const width = options.width && options.width >= 21 ? options.width : void 0;
|
|
2269
|
+
const scale = options.scale || 4;
|
|
2270
|
+
return {
|
|
2271
|
+
width,
|
|
2272
|
+
scale: width ? 4 : scale,
|
|
2273
|
+
margin,
|
|
2274
|
+
color: {
|
|
2275
|
+
dark: hex2rgba(options.color.dark || "#000000ff"),
|
|
2276
|
+
light: hex2rgba(options.color.light || "#ffffffff")
|
|
2277
|
+
},
|
|
2278
|
+
type: options.type,
|
|
2279
|
+
rendererOpts: options.rendererOpts || {}
|
|
2280
|
+
};
|
|
2281
|
+
};
|
|
2282
|
+
exports.getScale = function getScale(qrSize, opts) {
|
|
2283
|
+
return opts.width && opts.width >= qrSize + opts.margin * 2 ? opts.width / (qrSize + opts.margin * 2) : opts.scale;
|
|
2284
|
+
};
|
|
2285
|
+
exports.getImageWidth = function getImageWidth(qrSize, opts) {
|
|
2286
|
+
const scale = exports.getScale(qrSize, opts);
|
|
2287
|
+
return Math.floor((qrSize + opts.margin * 2) * scale);
|
|
2288
|
+
};
|
|
2289
|
+
exports.qrToImageData = function qrToImageData(imgData, qr, opts) {
|
|
2290
|
+
const size = qr.modules.size;
|
|
2291
|
+
const data = qr.modules.data;
|
|
2292
|
+
const scale = exports.getScale(size, opts);
|
|
2293
|
+
const symbolSize = Math.floor((size + opts.margin * 2) * scale);
|
|
2294
|
+
const scaledMargin = opts.margin * scale;
|
|
2295
|
+
const palette = [opts.color.light, opts.color.dark];
|
|
2296
|
+
for (let i = 0; i < symbolSize; i++) for (let j = 0; j < symbolSize; j++) {
|
|
2297
|
+
let posDst = (i * symbolSize + j) * 4;
|
|
2298
|
+
let pxColor = opts.color.light;
|
|
2299
|
+
if (i >= scaledMargin && j >= scaledMargin && i < symbolSize - scaledMargin && j < symbolSize - scaledMargin) {
|
|
2300
|
+
const iSrc = Math.floor((i - scaledMargin) / scale);
|
|
2301
|
+
const jSrc = Math.floor((j - scaledMargin) / scale);
|
|
2302
|
+
pxColor = palette[data[iSrc * size + jSrc] ? 1 : 0];
|
|
2303
|
+
}
|
|
2304
|
+
imgData[posDst++] = pxColor.r;
|
|
2305
|
+
imgData[posDst++] = pxColor.g;
|
|
2306
|
+
imgData[posDst++] = pxColor.b;
|
|
2307
|
+
imgData[posDst] = pxColor.a;
|
|
2308
|
+
}
|
|
2309
|
+
};
|
|
2310
|
+
}));
|
|
2311
|
+
//#endregion
|
|
2312
|
+
//#region ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/canvas.js
|
|
2313
|
+
var require_canvas = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2314
|
+
var Utils = require_utils();
|
|
2315
|
+
function clearCanvas(ctx, canvas, size) {
|
|
2316
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
2317
|
+
if (!canvas.style) canvas.style = {};
|
|
2318
|
+
canvas.height = size;
|
|
2319
|
+
canvas.width = size;
|
|
2320
|
+
canvas.style.height = size + "px";
|
|
2321
|
+
canvas.style.width = size + "px";
|
|
2322
|
+
}
|
|
2323
|
+
function getCanvasElement() {
|
|
2324
|
+
try {
|
|
2325
|
+
return document.createElement("canvas");
|
|
2326
|
+
} catch (e) {
|
|
2327
|
+
throw new Error("You need to specify a canvas element");
|
|
2328
|
+
}
|
|
2329
|
+
}
|
|
2330
|
+
exports.render = function render(qrData, canvas, options) {
|
|
2331
|
+
let opts = options;
|
|
2332
|
+
let canvasEl = canvas;
|
|
2333
|
+
if (typeof opts === "undefined" && (!canvas || !canvas.getContext)) {
|
|
2334
|
+
opts = canvas;
|
|
2335
|
+
canvas = void 0;
|
|
2336
|
+
}
|
|
2337
|
+
if (!canvas) canvasEl = getCanvasElement();
|
|
2338
|
+
opts = Utils.getOptions(opts);
|
|
2339
|
+
const size = Utils.getImageWidth(qrData.modules.size, opts);
|
|
2340
|
+
const ctx = canvasEl.getContext("2d");
|
|
2341
|
+
const image = ctx.createImageData(size, size);
|
|
2342
|
+
Utils.qrToImageData(image.data, qrData, opts);
|
|
2343
|
+
clearCanvas(ctx, canvasEl, size);
|
|
2344
|
+
ctx.putImageData(image, 0, 0);
|
|
2345
|
+
return canvasEl;
|
|
2346
|
+
};
|
|
2347
|
+
exports.renderToDataURL = function renderToDataURL(qrData, canvas, options) {
|
|
2348
|
+
let opts = options;
|
|
2349
|
+
if (typeof opts === "undefined" && (!canvas || !canvas.getContext)) {
|
|
2350
|
+
opts = canvas;
|
|
2351
|
+
canvas = void 0;
|
|
2352
|
+
}
|
|
2353
|
+
if (!opts) opts = {};
|
|
2354
|
+
const canvasEl = exports.render(qrData, canvas, opts);
|
|
2355
|
+
const type = opts.type || "image/png";
|
|
2356
|
+
const rendererOpts = opts.rendererOpts || {};
|
|
2357
|
+
return canvasEl.toDataURL(type, rendererOpts.quality);
|
|
2358
|
+
};
|
|
2359
|
+
}));
|
|
2360
|
+
//#endregion
|
|
2361
|
+
//#region ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/svg-tag.js
|
|
2362
|
+
var require_svg_tag = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2363
|
+
var Utils = require_utils();
|
|
2364
|
+
function getColorAttrib(color, attrib) {
|
|
2365
|
+
const alpha = color.a / 255;
|
|
2366
|
+
const str = attrib + "=\"" + color.hex + "\"";
|
|
2367
|
+
return alpha < 1 ? str + " " + attrib + "-opacity=\"" + alpha.toFixed(2).slice(1) + "\"" : str;
|
|
2368
|
+
}
|
|
2369
|
+
function svgCmd(cmd, x, y) {
|
|
2370
|
+
let str = cmd + x;
|
|
2371
|
+
if (typeof y !== "undefined") str += " " + y;
|
|
2372
|
+
return str;
|
|
2373
|
+
}
|
|
2374
|
+
function qrToPath(data, size, margin) {
|
|
2375
|
+
let path = "";
|
|
2376
|
+
let moveBy = 0;
|
|
2377
|
+
let newRow = false;
|
|
2378
|
+
let lineLength = 0;
|
|
2379
|
+
for (let i = 0; i < data.length; i++) {
|
|
2380
|
+
const col = Math.floor(i % size);
|
|
2381
|
+
const row = Math.floor(i / size);
|
|
2382
|
+
if (!col && !newRow) newRow = true;
|
|
2383
|
+
if (data[i]) {
|
|
2384
|
+
lineLength++;
|
|
2385
|
+
if (!(i > 0 && col > 0 && data[i - 1])) {
|
|
2386
|
+
path += newRow ? svgCmd("M", col + margin, .5 + row + margin) : svgCmd("m", moveBy, 0);
|
|
2387
|
+
moveBy = 0;
|
|
2388
|
+
newRow = false;
|
|
2389
|
+
}
|
|
2390
|
+
if (!(col + 1 < size && data[i + 1])) {
|
|
2391
|
+
path += svgCmd("h", lineLength);
|
|
2392
|
+
lineLength = 0;
|
|
2393
|
+
}
|
|
2394
|
+
} else moveBy++;
|
|
2395
|
+
}
|
|
2396
|
+
return path;
|
|
2397
|
+
}
|
|
2398
|
+
exports.render = function render(qrData, options, cb) {
|
|
2399
|
+
const opts = Utils.getOptions(options);
|
|
2400
|
+
const size = qrData.modules.size;
|
|
2401
|
+
const data = qrData.modules.data;
|
|
2402
|
+
const qrcodesize = size + opts.margin * 2;
|
|
2403
|
+
const bg = !opts.color.light.a ? "" : "<path " + getColorAttrib(opts.color.light, "fill") + " d=\"M0 0h" + qrcodesize + "v" + qrcodesize + "H0z\"/>";
|
|
2404
|
+
const path = "<path " + getColorAttrib(opts.color.dark, "stroke") + " d=\"" + qrToPath(data, size, opts.margin) + "\"/>";
|
|
2405
|
+
const viewBox = "viewBox=\"0 0 " + qrcodesize + " " + qrcodesize + "\"";
|
|
2406
|
+
const svgTag = "<svg xmlns=\"http://www.w3.org/2000/svg\" " + (!opts.width ? "" : "width=\"" + opts.width + "\" height=\"" + opts.width + "\" ") + viewBox + " shape-rendering=\"crispEdges\">" + bg + path + "</svg>\n";
|
|
2407
|
+
if (typeof cb === "function") cb(null, svgTag);
|
|
2408
|
+
return svgTag;
|
|
2409
|
+
};
|
|
2410
|
+
}));
|
|
2411
|
+
//#endregion
|
|
2412
|
+
//#region src/modules/redirect-to-mobile/qrCode.tsx
|
|
2413
|
+
var import_browser = (/* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2414
|
+
var canPromise = require_can_promise();
|
|
2415
|
+
var QRCode = require_qrcode();
|
|
2416
|
+
var CanvasRenderer = require_canvas();
|
|
2417
|
+
var SvgRenderer = require_svg_tag();
|
|
2418
|
+
function renderCanvas(renderFunc, canvas, text, opts, cb) {
|
|
2419
|
+
const args = [].slice.call(arguments, 1);
|
|
2420
|
+
const argsNum = args.length;
|
|
2421
|
+
const isLastArgCb = typeof args[argsNum - 1] === "function";
|
|
2422
|
+
if (!isLastArgCb && !canPromise()) throw new Error("Callback required as last argument");
|
|
2423
|
+
if (isLastArgCb) {
|
|
2424
|
+
if (argsNum < 2) throw new Error("Too few arguments provided");
|
|
2425
|
+
if (argsNum === 2) {
|
|
2426
|
+
cb = text;
|
|
2427
|
+
text = canvas;
|
|
2428
|
+
canvas = opts = void 0;
|
|
2429
|
+
} else if (argsNum === 3) if (canvas.getContext && typeof cb === "undefined") {
|
|
2430
|
+
cb = opts;
|
|
2431
|
+
opts = void 0;
|
|
2432
|
+
} else {
|
|
2433
|
+
cb = opts;
|
|
2434
|
+
opts = text;
|
|
2435
|
+
text = canvas;
|
|
2436
|
+
canvas = void 0;
|
|
2437
|
+
}
|
|
2438
|
+
} else {
|
|
2439
|
+
if (argsNum < 1) throw new Error("Too few arguments provided");
|
|
2440
|
+
if (argsNum === 1) {
|
|
2441
|
+
text = canvas;
|
|
2442
|
+
canvas = opts = void 0;
|
|
2443
|
+
} else if (argsNum === 2 && !canvas.getContext) {
|
|
2444
|
+
opts = text;
|
|
2445
|
+
text = canvas;
|
|
2446
|
+
canvas = void 0;
|
|
2447
|
+
}
|
|
2448
|
+
return new Promise(function(resolve, reject) {
|
|
2449
|
+
try {
|
|
2450
|
+
resolve(renderFunc(QRCode.create(text, opts), canvas, opts));
|
|
2451
|
+
} catch (e) {
|
|
2452
|
+
reject(e);
|
|
2453
|
+
}
|
|
2454
|
+
});
|
|
2455
|
+
}
|
|
2456
|
+
try {
|
|
2457
|
+
const data = QRCode.create(text, opts);
|
|
2458
|
+
cb(null, renderFunc(data, canvas, opts));
|
|
2459
|
+
} catch (e) {
|
|
2460
|
+
cb(e);
|
|
2461
|
+
}
|
|
2462
|
+
}
|
|
2463
|
+
exports.create = QRCode.create;
|
|
2464
|
+
exports.toCanvas = renderCanvas.bind(null, CanvasRenderer.render);
|
|
2465
|
+
exports.toDataURL = renderCanvas.bind(null, CanvasRenderer.renderToDataURL);
|
|
2466
|
+
exports.toString = renderCanvas.bind(null, function(data, _, opts) {
|
|
2467
|
+
return SvgRenderer.render(data, opts);
|
|
2468
|
+
});
|
|
2469
|
+
})))();
|
|
2470
|
+
var QrCode = ({ value, size = 150, bgColor = "#ffffff", fgColor = "#000000" }) => {
|
|
2471
|
+
const { t } = useTranslation();
|
|
2472
|
+
const [svgString, setSvgString] = d("");
|
|
2473
|
+
y(() => {
|
|
2474
|
+
if (!value) return;
|
|
2475
|
+
(0, import_browser.toString)(value, {
|
|
2476
|
+
type: "svg",
|
|
2477
|
+
width: size,
|
|
2478
|
+
margin: 0,
|
|
2479
|
+
color: {
|
|
2480
|
+
dark: fgColor,
|
|
2481
|
+
light: bgColor
|
|
2482
|
+
}
|
|
2483
|
+
}).then(setSvgString).catch(() => setSvgString(""));
|
|
2484
|
+
}, [
|
|
2485
|
+
value,
|
|
2486
|
+
size,
|
|
2487
|
+
bgColor,
|
|
2488
|
+
fgColor
|
|
2489
|
+
]);
|
|
2490
|
+
if (!svgString) return null;
|
|
2491
|
+
return /* @__PURE__ */ u("div", {
|
|
2492
|
+
class: "IncodeRedirectQrCode",
|
|
2493
|
+
role: "img",
|
|
2494
|
+
"aria-label": t("v2.redirectToMobile.qr.description"),
|
|
2495
|
+
dangerouslySetInnerHTML: { __html: svgString }
|
|
2496
|
+
});
|
|
2497
|
+
};
|
|
2498
|
+
//#endregion
|
|
2499
|
+
//#region src/modules/redirect-to-mobile/qrTabContent.tsx
|
|
2500
|
+
var QrTabContent = ({ redirectUrl }) => {
|
|
2501
|
+
const { t } = useTranslation();
|
|
2502
|
+
return /* @__PURE__ */ u(k, { children: [/* @__PURE__ */ u("p", {
|
|
2503
|
+
class: "IncodeRedirectTabDescription",
|
|
2504
|
+
children: t("v2.redirectToMobile.qr.description")
|
|
2505
|
+
}), /* @__PURE__ */ u("div", {
|
|
2506
|
+
class: "IncodeRedirectQrWrapper",
|
|
2507
|
+
children: /* @__PURE__ */ u(QrCode, {
|
|
2508
|
+
value: redirectUrl,
|
|
2509
|
+
size: 186
|
|
2510
|
+
})
|
|
2511
|
+
})] });
|
|
2512
|
+
};
|
|
2513
|
+
//#endregion
|
|
2514
|
+
//#region src/modules/redirect-to-mobile/smsSentView.tsx
|
|
2515
|
+
var SmsSentView = ({ formattedPhone, onResend, onChangePhone }) => {
|
|
2516
|
+
const { t } = useTranslation();
|
|
2517
|
+
return /* @__PURE__ */ u("div", {
|
|
2518
|
+
class: "IncodeRedirectLinkSent",
|
|
2519
|
+
children: [
|
|
2520
|
+
/* @__PURE__ */ u(SuccessIcon, { size: 32 }),
|
|
2521
|
+
/* @__PURE__ */ u(Spacer, { size: 16 }),
|
|
2522
|
+
/* @__PURE__ */ u(AutoFocusTitle, {
|
|
2523
|
+
className: "IncodeRedirectLinkSentTitle",
|
|
2524
|
+
children: t("redirect.linkSent")
|
|
2525
|
+
}),
|
|
2526
|
+
/* @__PURE__ */ u(Spacer, { size: 12 }),
|
|
2527
|
+
/* @__PURE__ */ u("p", {
|
|
2528
|
+
class: "IncodeRedirectLinkSentPhone",
|
|
2529
|
+
children: t("redirect.linkSentTo", { phone: formattedPhone })
|
|
2530
|
+
}),
|
|
2531
|
+
/* @__PURE__ */ u(Spacer, { size: 32 }),
|
|
2532
|
+
/* @__PURE__ */ u("div", {
|
|
2533
|
+
class: "IncodeRedirectLinkSentActions",
|
|
2534
|
+
children: /* @__PURE__ */ u(Trans, {
|
|
2535
|
+
i18nKey: "redirect.didntReceiveLinkActions",
|
|
2536
|
+
defaultValue: "Didn't receive the link? <resend>Resend</resend> or <changePhone>Change phone number</changePhone>",
|
|
2537
|
+
components: {
|
|
2538
|
+
resend: /* @__PURE__ */ u(Button, {
|
|
2539
|
+
variant: "link",
|
|
2540
|
+
onClick: onResend
|
|
2541
|
+
}),
|
|
2542
|
+
changePhone: /* @__PURE__ */ u(Button, {
|
|
2543
|
+
variant: "link",
|
|
2544
|
+
onClick: onChangePhone
|
|
2545
|
+
})
|
|
2546
|
+
}
|
|
2547
|
+
})
|
|
2548
|
+
})
|
|
2549
|
+
]
|
|
2550
|
+
});
|
|
2551
|
+
};
|
|
2552
|
+
//#endregion
|
|
2553
|
+
//#region src/modules/redirect-to-mobile/smsForm.tsx
|
|
2554
|
+
var SmsForm = ({ countryCode, error, isSending, isPhoneValid, onPhoneChange, onSendSms }) => {
|
|
2555
|
+
const { t } = useTranslation();
|
|
2556
|
+
return /* @__PURE__ */ u(k, { children: [/* @__PURE__ */ u(PhoneInputComposed, {
|
|
2557
|
+
id: "sms-phone",
|
|
2558
|
+
countryCode,
|
|
2559
|
+
error,
|
|
2560
|
+
disabled: isSending,
|
|
2561
|
+
autoFocus: true,
|
|
2562
|
+
onChange: onPhoneChange
|
|
2563
|
+
}), /* @__PURE__ */ u(Button, {
|
|
2564
|
+
onClick: onSendSms,
|
|
2565
|
+
disabled: !isPhoneValid || isSending,
|
|
2566
|
+
isLoading: isSending,
|
|
2567
|
+
class: "IncodeRedirectSmsSendButton",
|
|
2568
|
+
children: t("redirect.sendLinkViaSms")
|
|
2569
|
+
})] });
|
|
2570
|
+
};
|
|
2571
|
+
//#endregion
|
|
2572
|
+
//#region src/modules/redirect-to-mobile/smsTabContent.tsx
|
|
2573
|
+
var formatPhoneNumber = (phone, prefix) => {
|
|
2574
|
+
if (!phone.startsWith(prefix)) return phone;
|
|
2575
|
+
return `${prefix} ${phone.slice(prefix.length).replace(/(\d{3})(?=\d)/g, "$1 ")}`;
|
|
2576
|
+
};
|
|
2577
|
+
var SmsTabContent = ({ phonePrefix, smsSent, error, manager, onResend }) => {
|
|
2578
|
+
const { t } = useTranslation();
|
|
2579
|
+
const [phoneNumber, setPhoneNumber] = d(phonePrefix);
|
|
2580
|
+
const [isPhoneValid, setIsPhoneValid] = d(false);
|
|
2581
|
+
const [isSending, setIsSending] = d(false);
|
|
2582
|
+
const countryCode = getCountryByCallingCode(phonePrefix)?.code ?? "";
|
|
2583
|
+
const formattedPhone = formatPhoneNumber(phoneNumber, phonePrefix);
|
|
2584
|
+
const handlePhoneChange = q((phone, valid) => {
|
|
2585
|
+
setPhoneNumber(phone);
|
|
2586
|
+
setIsPhoneValid(valid);
|
|
2587
|
+
}, []);
|
|
2588
|
+
const handleSendSms = q(() => {
|
|
2589
|
+
setIsSending(true);
|
|
2590
|
+
manager.sendSms(phoneNumber);
|
|
2591
|
+
setIsSending(false);
|
|
2592
|
+
}, [manager, phoneNumber]);
|
|
2593
|
+
const handleResend = q(() => {
|
|
2594
|
+
handleSendSms();
|
|
2595
|
+
onResend();
|
|
2596
|
+
}, [handleSendSms, onResend]);
|
|
2597
|
+
const handleChangePhone = q(() => {
|
|
2598
|
+
setPhoneNumber(phonePrefix);
|
|
2599
|
+
setIsPhoneValid(false);
|
|
2600
|
+
manager.resetSms();
|
|
2601
|
+
}, [manager, phonePrefix]);
|
|
2602
|
+
return /* @__PURE__ */ u(k, { children: [/* @__PURE__ */ u("p", {
|
|
2603
|
+
class: "IncodeRedirectTabDescription",
|
|
2604
|
+
children: t("v2.redirectToMobile.sms.description")
|
|
2605
|
+
}), smsSent ? /* @__PURE__ */ u(SmsSentView, {
|
|
2606
|
+
formattedPhone,
|
|
2607
|
+
onResend: handleResend,
|
|
2608
|
+
onChangePhone: handleChangePhone
|
|
2609
|
+
}) : /* @__PURE__ */ u(SmsForm, {
|
|
2610
|
+
countryCode,
|
|
2611
|
+
phonePrefix,
|
|
2612
|
+
error,
|
|
2613
|
+
isSending,
|
|
2614
|
+
isPhoneValid,
|
|
2615
|
+
onPhoneChange: handlePhoneChange,
|
|
2616
|
+
onSendSms: handleSendSms
|
|
2617
|
+
})] });
|
|
2618
|
+
};
|
|
2619
|
+
//#endregion
|
|
2620
|
+
//#region src/modules/redirect-to-mobile/qrScreen.tsx
|
|
2621
|
+
var QrScreen = ({ redirectUrl, phonePrefix, smsSent, disableSmsOption, addContinueToDesktop, error, manager, logoSrc }) => {
|
|
2622
|
+
const { t } = useTranslation();
|
|
2623
|
+
const [showResendToast, setShowResendToast] = d(false);
|
|
2624
|
+
const handleResend = q(() => {
|
|
2625
|
+
setShowResendToast(true);
|
|
2626
|
+
setTimeout(() => setShowResendToast(false), 3e3);
|
|
2627
|
+
}, []);
|
|
2628
|
+
const handleContinueOnDesktop = q(() => {
|
|
2629
|
+
manager.continueOnDesktop();
|
|
2630
|
+
}, [manager]);
|
|
2631
|
+
return /* @__PURE__ */ u("div", {
|
|
2632
|
+
class: "IncodeRedirectContainer",
|
|
2633
|
+
children: [/* @__PURE__ */ u(ResendToast, { visible: showResendToast }), /* @__PURE__ */ u("div", {
|
|
2634
|
+
class: "IncodeRedirectCard",
|
|
2635
|
+
children: [disableSmsOption ? /* @__PURE__ */ u(k, { children: [/* @__PURE__ */ u(RedirectHeader, { logoSrc }), /* @__PURE__ */ u("div", {
|
|
2636
|
+
class: "IncodeRedirectOptions",
|
|
2637
|
+
children: /* @__PURE__ */ u(QrTabContent, { redirectUrl })
|
|
2638
|
+
})] }) : /* @__PURE__ */ u(Tabs, {
|
|
2639
|
+
defaultValue: "qr",
|
|
2640
|
+
listClassName: "IncodeRedirectTabs",
|
|
2641
|
+
triggerClassName: "IncodeRedirectTab",
|
|
2642
|
+
activeTriggerClassName: "IncodeRedirectTabActive",
|
|
2643
|
+
children: [/* @__PURE__ */ u("div", {
|
|
2644
|
+
class: "IncodeRedirectTopGroup",
|
|
2645
|
+
children: [/* @__PURE__ */ u(RedirectHeader, { logoSrc }), /* @__PURE__ */ u(Tabs.List, {
|
|
2646
|
+
label: t("v2.redirectToMobile.tabs.label"),
|
|
2647
|
+
children: [/* @__PURE__ */ u(Tabs.Trigger, {
|
|
2648
|
+
value: "qr",
|
|
2649
|
+
children: t("v2.redirectToMobile.tabs.0")
|
|
2650
|
+
}), /* @__PURE__ */ u(Tabs.Trigger, {
|
|
2651
|
+
value: "sms",
|
|
2652
|
+
children: t("v2.redirectToMobile.tabs.1")
|
|
2653
|
+
})]
|
|
2654
|
+
})]
|
|
2655
|
+
}), /* @__PURE__ */ u("div", {
|
|
2656
|
+
class: "IncodeRedirectOptions",
|
|
2657
|
+
children: [/* @__PURE__ */ u(Tabs.Content, {
|
|
2658
|
+
value: "qr",
|
|
2659
|
+
children: /* @__PURE__ */ u(QrTabContent, { redirectUrl })
|
|
2660
|
+
}), /* @__PURE__ */ u(Tabs.Content, {
|
|
2661
|
+
value: "sms",
|
|
2662
|
+
children: /* @__PURE__ */ u(SmsTabContent, {
|
|
2663
|
+
phonePrefix,
|
|
2664
|
+
smsSent,
|
|
2665
|
+
error,
|
|
2666
|
+
manager,
|
|
2667
|
+
onResend: handleResend
|
|
2668
|
+
})
|
|
2669
|
+
})]
|
|
2670
|
+
})]
|
|
2671
|
+
}), /* @__PURE__ */ u(RedirectFooter, {
|
|
2672
|
+
addContinueToDesktop,
|
|
2673
|
+
onContinueOnDesktop: handleContinueOnDesktop
|
|
2674
|
+
})]
|
|
2675
|
+
})]
|
|
2676
|
+
});
|
|
2677
|
+
};
|
|
2678
|
+
//#endregion
|
|
2679
|
+
//#region src/modules/redirect-to-mobile/waitingScreen.tsx
|
|
2680
|
+
var WaitingScreen = ({ title, subtitle, logoSrc }) => {
|
|
2681
|
+
const { t } = useTranslation();
|
|
2682
|
+
const displayTitle = title ?? t("verificationComplete.title");
|
|
2683
|
+
const displaySubtitle = subtitle ?? t("verificationComplete.message");
|
|
2684
|
+
return /* @__PURE__ */ u("div", {
|
|
2685
|
+
class: "IncodeRedirectFinishedContainer",
|
|
2686
|
+
children: [
|
|
2687
|
+
/* @__PURE__ */ u("img", {
|
|
2688
|
+
src: logoSrc,
|
|
2689
|
+
alt: "",
|
|
2690
|
+
"aria-hidden": "true",
|
|
2691
|
+
class: "IncodeRedirectLogo"
|
|
2692
|
+
}),
|
|
2693
|
+
displayTitle ? /* @__PURE__ */ u(AutoFocusTitle, {
|
|
2694
|
+
className: "IncodeRedirectFinishedTitle",
|
|
2695
|
+
children: displayTitle
|
|
2696
|
+
}) : null,
|
|
2697
|
+
displaySubtitle ? /* @__PURE__ */ u("p", {
|
|
2698
|
+
class: "IncodeRedirectFinishedSubtitle",
|
|
2699
|
+
children: displaySubtitle
|
|
2700
|
+
}) : null
|
|
2701
|
+
]
|
|
2702
|
+
});
|
|
2703
|
+
};
|
|
2704
|
+
//#endregion
|
|
2705
|
+
//#region src/modules/redirect-to-mobile/redirect-to-mobile.tsx
|
|
2706
|
+
var RedirectToMobileContent = ({ config, manager: externalManager, services, onFinish, onContinue, onError }) => {
|
|
2707
|
+
const [state, manager] = useManager(() => {
|
|
2708
|
+
if (externalManager) return externalManager;
|
|
2709
|
+
if (!config) throw new Error("RedirectToMobile config is required when no manager is provided");
|
|
2710
|
+
return createRedirectToMobileManager({
|
|
2711
|
+
config,
|
|
2712
|
+
services
|
|
2713
|
+
});
|
|
2714
|
+
}, { manageLifecycle: !externalManager });
|
|
2715
|
+
const { logoSrc, logoHeightPx } = usePageUiConfig({
|
|
2716
|
+
hideHeader: void 0,
|
|
2717
|
+
hideFooterBranding: void 0,
|
|
2718
|
+
logo: void 0,
|
|
2719
|
+
defaultLogoSrc: incode_logo_default
|
|
2720
|
+
});
|
|
2721
|
+
useModuleTerminalCallbacks({
|
|
2722
|
+
status: state.status,
|
|
2723
|
+
onFinish,
|
|
2724
|
+
onError,
|
|
2725
|
+
error: state.status === "error" ? state.error : void 0
|
|
2726
|
+
});
|
|
2727
|
+
const continueFiredRef = A(false);
|
|
2728
|
+
y(() => {
|
|
2729
|
+
if (continueFiredRef.current) return;
|
|
2730
|
+
if (state.status === "continue") {
|
|
2731
|
+
continueFiredRef.current = true;
|
|
2732
|
+
onContinue?.();
|
|
2733
|
+
}
|
|
2734
|
+
}, [state.status, onContinue]);
|
|
2735
|
+
const content = (() => {
|
|
2736
|
+
if (state.status === "idle" || state.status === "loading") return /* @__PURE__ */ u(TransitionSpinner, { hideText: true });
|
|
2737
|
+
if (state.status === "redirecting") return /* @__PURE__ */ u(QrScreen, {
|
|
2738
|
+
redirectUrl: state.redirectUrl,
|
|
2739
|
+
phonePrefix: state.phonePrefix,
|
|
2740
|
+
smsSent: state.smsSent,
|
|
2741
|
+
disableSmsOption: config?.disableSmsOption ?? false,
|
|
2742
|
+
addContinueToDesktop: config?.addContinueToDesktop ?? false,
|
|
2743
|
+
error: state.error,
|
|
2744
|
+
manager,
|
|
2745
|
+
logoSrc
|
|
2746
|
+
});
|
|
2747
|
+
if (state.status === "finished") return /* @__PURE__ */ u(WaitingScreen, { logoSrc });
|
|
2748
|
+
return null;
|
|
2749
|
+
})();
|
|
2750
|
+
return /* @__PURE__ */ u("main", {
|
|
2751
|
+
class: "IncodeRedirectRoot",
|
|
2752
|
+
style: { "--logo-height": `${logoHeightPx}px` },
|
|
2753
|
+
children: content
|
|
2754
|
+
});
|
|
2755
|
+
};
|
|
2756
|
+
var RedirectToMobile = ({ config, manager, services, onFinish, onContinue, onError }) => {
|
|
2757
|
+
return /* @__PURE__ */ u(IncodeComponent, { children: config || manager ? /* @__PURE__ */ u(RedirectToMobileContent, {
|
|
2758
|
+
config,
|
|
2759
|
+
manager,
|
|
2760
|
+
services,
|
|
2761
|
+
onFinish,
|
|
2762
|
+
onContinue,
|
|
2763
|
+
onError
|
|
2764
|
+
}) : null });
|
|
2765
|
+
};
|
|
2766
|
+
registerIncodeElement(RedirectToMobile, "incode-redirect-to-mobile", [
|
|
2767
|
+
"config",
|
|
2768
|
+
"services",
|
|
2769
|
+
"onFinish",
|
|
2770
|
+
"onContinue",
|
|
2771
|
+
"onError"
|
|
2772
|
+
]);
|
|
2773
|
+
//#endregion
|
|
2774
|
+
export { RedirectToMobile };
|