@burdenoff/microfe-auth 2026.510.127
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/README.md +12 -0
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/auth/AuthRoot.d.ts +30 -0
- package/dist/auth/AuthRoot.d.ts.map +1 -0
- package/dist/auth/AuthRoot.js +82 -0
- package/dist/auth/AuthRoot.js.map +1 -0
- package/dist/auth/AuthRoutes.d.ts +29 -0
- package/dist/auth/AuthRoutes.d.ts.map +1 -0
- package/dist/auth/AuthRoutes.js +271 -0
- package/dist/auth/AuthRoutes.js.map +1 -0
- package/dist/auth/components/AuthIcons.d.ts +17 -0
- package/dist/auth/components/AuthIcons.d.ts.map +1 -0
- package/dist/auth/components/AuthIcons.js +197 -0
- package/dist/auth/components/AuthIcons.js.map +1 -0
- package/dist/auth/components/AuthLayout.d.ts +17 -0
- package/dist/auth/components/AuthLayout.d.ts.map +1 -0
- package/dist/auth/components/AuthLayout.js +237 -0
- package/dist/auth/components/AuthLayout.js.map +1 -0
- package/dist/auth/components/CaptchaV2.d.ts +16 -0
- package/dist/auth/components/CaptchaV2.d.ts.map +1 -0
- package/dist/auth/components/CaptchaV2.js +47 -0
- package/dist/auth/components/CaptchaV2.js.map +1 -0
- package/dist/auth/components/ConfirmActionDialog.d.ts +16 -0
- package/dist/auth/components/ConfirmActionDialog.d.ts.map +1 -0
- package/dist/auth/components/ConfirmActionDialog.js +68 -0
- package/dist/auth/components/ConfirmActionDialog.js.map +1 -0
- package/dist/auth/components/index.d.ts +4 -0
- package/dist/auth/components/index.d.ts.map +1 -0
- package/dist/auth/components/profile/UserProfileMenu.d.ts +42 -0
- package/dist/auth/components/profile/UserProfileMenu.d.ts.map +1 -0
- package/dist/auth/components/profile/UserProfileMenu.js +91 -0
- package/dist/auth/components/profile/UserProfileMenu.js.map +1 -0
- package/dist/auth/components/workspace/WorkspaceSelector.d.ts +76 -0
- package/dist/auth/components/workspace/WorkspaceSelector.d.ts.map +1 -0
- package/dist/auth/components/workspace/WorkspaceSelector.js +240 -0
- package/dist/auth/components/workspace/WorkspaceSelector.js.map +1 -0
- package/dist/auth/constants/permissions.d.ts +30 -0
- package/dist/auth/constants/permissions.d.ts.map +1 -0
- package/dist/auth/constants/permissions.js +18 -0
- package/dist/auth/constants/permissions.js.map +1 -0
- package/dist/auth/constants/sessionKeys.d.ts +18 -0
- package/dist/auth/constants/sessionKeys.d.ts.map +1 -0
- package/dist/auth/constants/sessionKeys.js +6 -0
- package/dist/auth/constants/sessionKeys.js.map +1 -0
- package/dist/auth/hooks/index.d.ts +18 -0
- package/dist/auth/hooks/index.d.ts.map +1 -0
- package/dist/auth/hooks/index.js +16 -0
- package/dist/auth/hooks/useAccountOperations.d.ts +19 -0
- package/dist/auth/hooks/useAccountOperations.d.ts.map +1 -0
- package/dist/auth/hooks/useAccountOperations.js +52 -0
- package/dist/auth/hooks/useAccountOperations.js.map +1 -0
- package/dist/auth/hooks/useApiKeyOperations.d.ts +22 -0
- package/dist/auth/hooks/useApiKeyOperations.d.ts.map +1 -0
- package/dist/auth/hooks/useApiKeyOperations.js +4 -0
- package/dist/auth/hooks/useAppOperations.d.ts +26 -0
- package/dist/auth/hooks/useAppOperations.d.ts.map +1 -0
- package/dist/auth/hooks/useAppOperations.js +4 -0
- package/dist/auth/hooks/useAuthOperations.d.ts +57 -0
- package/dist/auth/hooks/useAuthOperations.d.ts.map +1 -0
- package/dist/auth/hooks/useAuthOperations.js +236 -0
- package/dist/auth/hooks/useAuthOperations.js.map +1 -0
- package/dist/auth/hooks/useAuthPermissions.d.ts +20 -0
- package/dist/auth/hooks/useAuthPermissions.d.ts.map +1 -0
- package/dist/auth/hooks/useAuthPermissions.js +22 -0
- package/dist/auth/hooks/useAuthPermissions.js.map +1 -0
- package/dist/auth/hooks/useCaptchaV3.d.ts +13 -0
- package/dist/auth/hooks/useCaptchaV3.d.ts.map +1 -0
- package/dist/auth/hooks/useCaptchaV3.js +19 -0
- package/dist/auth/hooks/useCaptchaV3.js.map +1 -0
- package/dist/auth/hooks/useContextSwitcherData.d.ts +106 -0
- package/dist/auth/hooks/useContextSwitcherData.d.ts.map +1 -0
- package/dist/auth/hooks/useContextSwitcherData.js +466 -0
- package/dist/auth/hooks/useContextSwitcherData.js.map +1 -0
- package/dist/auth/hooks/useDelegationOperations.d.ts +25 -0
- package/dist/auth/hooks/useDelegationOperations.d.ts.map +1 -0
- package/dist/auth/hooks/useDelegationOperations.js +4 -0
- package/dist/auth/hooks/useMfaOperations.d.ts +18 -0
- package/dist/auth/hooks/useMfaOperations.d.ts.map +1 -0
- package/dist/auth/hooks/useMfaOperations.js +103 -0
- package/dist/auth/hooks/useMfaOperations.js.map +1 -0
- package/dist/auth/hooks/useMyWorkspaces.d.ts +45 -0
- package/dist/auth/hooks/useMyWorkspaces.d.ts.map +1 -0
- package/dist/auth/hooks/useMyWorkspaces.js +140 -0
- package/dist/auth/hooks/useMyWorkspaces.js.map +1 -0
- package/dist/auth/hooks/useOAuthOperations.d.ts +19 -0
- package/dist/auth/hooks/useOAuthOperations.d.ts.map +1 -0
- package/dist/auth/hooks/useOAuthOperations.js +103 -0
- package/dist/auth/hooks/useOAuthOperations.js.map +1 -0
- package/dist/auth/hooks/usePasswordOperations.d.ts +13 -0
- package/dist/auth/hooks/usePasswordOperations.d.ts.map +1 -0
- package/dist/auth/hooks/usePasswordOperations.js +56 -0
- package/dist/auth/hooks/usePasswordOperations.js.map +1 -0
- package/dist/auth/hooks/useSessionOperations.d.ts +41 -0
- package/dist/auth/hooks/useSessionOperations.d.ts.map +1 -0
- package/dist/auth/hooks/useSessionOperations.js +59 -0
- package/dist/auth/hooks/useSessionOperations.js.map +1 -0
- package/dist/auth/hooks/useSsoOperations.d.ts +65 -0
- package/dist/auth/hooks/useSsoOperations.d.ts.map +1 -0
- package/dist/auth/hooks/useSsoOperations.js +236 -0
- package/dist/auth/hooks/useSsoOperations.js.map +1 -0
- package/dist/auth/hooks/useTokenRefresh.d.ts +56 -0
- package/dist/auth/hooks/useTokenRefresh.d.ts.map +1 -0
- package/dist/auth/hooks/useTokenRefresh.js +53 -0
- package/dist/auth/hooks/useTokenRefresh.js.map +1 -0
- package/dist/auth/hooks/useUserOperations.d.ts +32 -0
- package/dist/auth/hooks/useUserOperations.d.ts.map +1 -0
- package/dist/auth/hooks/useUserOperations.js +100 -0
- package/dist/auth/hooks/useUserOperations.js.map +1 -0
- package/dist/auth/hooks/useWorkspaceOperations.d.ts +35 -0
- package/dist/auth/hooks/useWorkspaceOperations.d.ts.map +1 -0
- package/dist/auth/hooks/useWorkspaceOperations.js +35 -0
- package/dist/auth/hooks/useWorkspaceOperations.js.map +1 -0
- package/dist/auth/hooks/useWorkspaceToken.d.ts +56 -0
- package/dist/auth/hooks/useWorkspaceToken.d.ts.map +1 -0
- package/dist/auth/hooks/useWorkspaceToken.js +94 -0
- package/dist/auth/hooks/useWorkspaceToken.js.map +1 -0
- package/dist/auth/index.d.ts +63 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +18 -0
- package/dist/auth/pages/ApiKeysPage.d.ts +5 -0
- package/dist/auth/pages/ApiKeysPage.d.ts.map +1 -0
- package/dist/auth/pages/AppsPage.d.ts +5 -0
- package/dist/auth/pages/AppsPage.d.ts.map +1 -0
- package/dist/auth/pages/AuditLogPage.d.ts +5 -0
- package/dist/auth/pages/AuditLogPage.d.ts.map +1 -0
- package/dist/auth/pages/AuditLogPage.js +129 -0
- package/dist/auth/pages/AuditLogPage.js.map +1 -0
- package/dist/auth/pages/DelegationsPage.d.ts +5 -0
- package/dist/auth/pages/DelegationsPage.d.ts.map +1 -0
- package/dist/auth/pages/EmailVerifyPage.d.ts +5 -0
- package/dist/auth/pages/EmailVerifyPage.d.ts.map +1 -0
- package/dist/auth/pages/EmailVerifyPage.js +166 -0
- package/dist/auth/pages/EmailVerifyPage.js.map +1 -0
- package/dist/auth/pages/LoginPage.d.ts +6 -0
- package/dist/auth/pages/LoginPage.d.ts.map +1 -0
- package/dist/auth/pages/LoginPage.js +575 -0
- package/dist/auth/pages/LoginPage.js.map +1 -0
- package/dist/auth/pages/MagicLinkPage.d.ts +6 -0
- package/dist/auth/pages/MagicLinkPage.d.ts.map +1 -0
- package/dist/auth/pages/MagicLinkPage.js +219 -0
- package/dist/auth/pages/MagicLinkPage.js.map +1 -0
- package/dist/auth/pages/MfaSetupPage.d.ts +5 -0
- package/dist/auth/pages/MfaSetupPage.d.ts.map +1 -0
- package/dist/auth/pages/MfaSetupPage.js +341 -0
- package/dist/auth/pages/MfaSetupPage.js.map +1 -0
- package/dist/auth/pages/MfaVerifyPage.d.ts +7 -0
- package/dist/auth/pages/MfaVerifyPage.d.ts.map +1 -0
- package/dist/auth/pages/MfaVerifyPage.js +189 -0
- package/dist/auth/pages/MfaVerifyPage.js.map +1 -0
- package/dist/auth/pages/OAuthCallbackPage.d.ts +7 -0
- package/dist/auth/pages/OAuthCallbackPage.d.ts.map +1 -0
- package/dist/auth/pages/OAuthCallbackPage.js +100 -0
- package/dist/auth/pages/OAuthCallbackPage.js.map +1 -0
- package/dist/auth/pages/PasswordResetPage.d.ts +6 -0
- package/dist/auth/pages/PasswordResetPage.d.ts.map +1 -0
- package/dist/auth/pages/PasswordResetPage.js +352 -0
- package/dist/auth/pages/PasswordResetPage.js.map +1 -0
- package/dist/auth/pages/ReactivatePage.d.ts +6 -0
- package/dist/auth/pages/ReactivatePage.d.ts.map +1 -0
- package/dist/auth/pages/ReactivatePage.js +217 -0
- package/dist/auth/pages/ReactivatePage.js.map +1 -0
- package/dist/auth/pages/RegisterPage.d.ts +5 -0
- package/dist/auth/pages/RegisterPage.d.ts.map +1 -0
- package/dist/auth/pages/RegisterPage.js +439 -0
- package/dist/auth/pages/RegisterPage.js.map +1 -0
- package/dist/auth/pages/SSORelayCallbackPage.d.ts +8 -0
- package/dist/auth/pages/SSORelayCallbackPage.d.ts.map +1 -0
- package/dist/auth/pages/SSORelayCallbackPage.js +48 -0
- package/dist/auth/pages/SSORelayCallbackPage.js.map +1 -0
- package/dist/auth/pages/SSORelayPage.d.ts +18 -0
- package/dist/auth/pages/SSORelayPage.d.ts.map +1 -0
- package/dist/auth/pages/SSORelayPage.js +134 -0
- package/dist/auth/pages/SSORelayPage.js.map +1 -0
- package/dist/auth/pages/SecurityPage.d.ts +5 -0
- package/dist/auth/pages/SecurityPage.d.ts.map +1 -0
- package/dist/auth/pages/SecurityPage.js +587 -0
- package/dist/auth/pages/SecurityPage.js.map +1 -0
- package/dist/auth/pages/SessionBridgePage.d.ts +14 -0
- package/dist/auth/pages/SessionBridgePage.d.ts.map +1 -0
- package/dist/auth/pages/SessionBridgePage.js +231 -0
- package/dist/auth/pages/SessionBridgePage.js.map +1 -0
- package/dist/auth/pages/SessionsPage.d.ts +5 -0
- package/dist/auth/pages/SessionsPage.d.ts.map +1 -0
- package/dist/auth/pages/SessionsPage.js +258 -0
- package/dist/auth/pages/SessionsPage.js.map +1 -0
- package/dist/auth/pages/SsoCallbackPage.d.ts +8 -0
- package/dist/auth/pages/SsoCallbackPage.d.ts.map +1 -0
- package/dist/auth/pages/SsoCallbackPage.js +188 -0
- package/dist/auth/pages/SsoCallbackPage.js.map +1 -0
- package/dist/auth/pages/SsoConfigPage.d.ts +6 -0
- package/dist/auth/pages/SsoConfigPage.d.ts.map +1 -0
- package/dist/auth/pages/SsoConfigPage.js +1144 -0
- package/dist/auth/pages/SsoConfigPage.js.map +1 -0
- package/dist/auth/pages/SsoLoginPage.d.ts +7 -0
- package/dist/auth/pages/SsoLoginPage.d.ts.map +1 -0
- package/dist/auth/pages/SsoLoginPage.js +236 -0
- package/dist/auth/pages/SsoLoginPage.js.map +1 -0
- package/dist/auth/pages/UserDetailsPage.d.ts +11 -0
- package/dist/auth/pages/UserDetailsPage.d.ts.map +1 -0
- package/dist/auth/pages/UserDetailsPage.js +338 -0
- package/dist/auth/pages/UserDetailsPage.js.map +1 -0
- package/dist/auth/pages/UserProfilePage.d.ts +5 -0
- package/dist/auth/pages/UserProfilePage.d.ts.map +1 -0
- package/dist/auth/pages/UserProfilePage.js +445 -0
- package/dist/auth/pages/UserProfilePage.js.map +1 -0
- package/dist/auth/pages/UsersPage.d.ts +5 -0
- package/dist/auth/pages/UsersPage.d.ts.map +1 -0
- package/dist/auth/pages/UsersPage.js +899 -0
- package/dist/auth/pages/UsersPage.js.map +1 -0
- package/dist/auth/providers/AuthProvider.d.ts +18 -0
- package/dist/auth/providers/AuthProvider.d.ts.map +1 -0
- package/dist/auth/providers/AuthProvider.js +36 -0
- package/dist/auth/providers/AuthProvider.js.map +1 -0
- package/dist/auth/providers/CaptchaProvider.d.ts +13 -0
- package/dist/auth/providers/CaptchaProvider.d.ts.map +1 -0
- package/dist/auth/providers/CaptchaProvider.js +21 -0
- package/dist/auth/providers/CaptchaProvider.js.map +1 -0
- package/dist/auth/store/authStore.d.ts +91 -0
- package/dist/auth/store/authStore.d.ts.map +1 -0
- package/dist/auth/store/authStore.js +314 -0
- package/dist/auth/store/authStore.js.map +1 -0
- package/dist/auth/types/index.d.ts +636 -0
- package/dist/auth/types/index.d.ts.map +1 -0
- package/dist/auth/utils/captchaConfig.d.ts +4 -0
- package/dist/auth/utils/captchaConfig.d.ts.map +1 -0
- package/dist/auth/utils/captchaConfig.js +13 -0
- package/dist/auth/utils/captchaConfig.js.map +1 -0
- package/dist/auth/utils/formatters.d.ts +37 -0
- package/dist/auth/utils/formatters.d.ts.map +1 -0
- package/dist/auth/utils/formatters.js +48 -0
- package/dist/auth/utils/formatters.js.map +1 -0
- package/dist/auth/utils/gatewayBaseUrls.d.ts +6 -0
- package/dist/auth/utils/gatewayBaseUrls.d.ts.map +1 -0
- package/dist/auth/utils/gatewayBaseUrls.js +18 -0
- package/dist/auth/utils/gatewayBaseUrls.js.map +1 -0
- package/dist/auth/utils/index.d.ts +3 -0
- package/dist/auth/utils/index.d.ts.map +1 -0
- package/dist/auth/utils/validation.d.ts +30 -0
- package/dist/auth/utils/validation.d.ts.map +1 -0
- package/dist/auth/utils/validation.js +15 -0
- package/dist/auth/utils/validation.js.map +1 -0
- package/dist/dev/main.d.ts +2 -0
- package/dist/dev/main.d.ts.map +1 -0
- package/dist/generated/global-operations.d.ts +2978 -0
- package/dist/generated/global-operations.d.ts.map +1 -0
- package/dist/generated/global-operations.js +944 -0
- package/dist/generated/global-operations.js.map +1 -0
- package/dist/generated/global-types.d.ts +21253 -0
- package/dist/generated/global-types.d.ts.map +1 -0
- package/dist/generated/wspace-operations.d.ts +2 -0
- package/dist/generated/wspace-operations.d.ts.map +1 -0
- package/dist/generated/wspace-types.d.ts +55214 -0
- package/dist/generated/wspace-types.d.ts.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/microfe-auth.css +3 -0
- package/dist/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js +70 -0
- package/dist/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js.map +1 -0
- package/dist/node_modules/object-assign/index.js +41 -0
- package/dist/node_modules/object-assign/index.js.map +1 -0
- package/dist/node_modules/prop-types/checkPropTypes.js +46 -0
- package/dist/node_modules/prop-types/checkPropTypes.js.map +1 -0
- package/dist/node_modules/prop-types/factoryWithThrowingShims.js +49 -0
- package/dist/node_modules/prop-types/factoryWithThrowingShims.js.map +1 -0
- package/dist/node_modules/prop-types/factoryWithTypeCheckers.js +272 -0
- package/dist/node_modules/prop-types/factoryWithTypeCheckers.js.map +1 -0
- package/dist/node_modules/prop-types/index.js +16 -0
- package/dist/node_modules/prop-types/index.js.map +1 -0
- package/dist/node_modules/prop-types/lib/ReactPropTypesSecret.js +10 -0
- package/dist/node_modules/prop-types/lib/ReactPropTypesSecret.js.map +1 -0
- package/dist/node_modules/prop-types/lib/has.js +10 -0
- package/dist/node_modules/prop-types/lib/has.js.map +1 -0
- package/dist/node_modules/qrcode.react/lib/esm/index.js +959 -0
- package/dist/node_modules/qrcode.react/lib/esm/index.js.map +1 -0
- package/dist/node_modules/react-async-script/lib/esm/async-script-loader.js +114 -0
- package/dist/node_modules/react-async-script/lib/esm/async-script-loader.js.map +1 -0
- package/dist/node_modules/react-google-recaptcha/lib/esm/index.js +8 -0
- package/dist/node_modules/react-google-recaptcha/lib/esm/index.js.map +1 -0
- package/dist/node_modules/react-google-recaptcha/lib/esm/recaptcha-wrapper.js +20 -0
- package/dist/node_modules/react-google-recaptcha/lib/esm/recaptcha-wrapper.js.map +1 -0
- package/dist/node_modules/react-google-recaptcha/lib/esm/recaptcha.js +148 -0
- package/dist/node_modules/react-google-recaptcha/lib/esm/recaptcha.js.map +1 -0
- package/dist/node_modules/react-google-recaptcha-v3/dist/react-google-recaptcha-v3.esm.js +445 -0
- package/dist/node_modules/react-google-recaptcha-v3/dist/react-google-recaptcha-v3.esm.js.map +1 -0
- package/dist/node_modules/react-is/cjs/react-is.development.js +84 -0
- package/dist/node_modules/react-is/cjs/react-is.development.js.map +1 -0
- package/dist/node_modules/react-is/cjs/react-is.production.min.js +64 -0
- package/dist/node_modules/react-is/cjs/react-is.production.min.js.map +1 -0
- package/dist/node_modules/react-is/index.js +12 -0
- package/dist/node_modules/react-is/index.js.map +1 -0
- package/dist/shared/hooks/index.d.ts +7 -0
- package/dist/shared/hooks/index.d.ts.map +1 -0
- package/dist/shared/index.d.ts +6 -0
- package/dist/shared/index.d.ts.map +1 -0
- package/dist/shared/types/index.d.ts +109 -0
- package/dist/shared/types/index.d.ts.map +1 -0
- package/dist/utils/nativeBridge.d.ts +3 -0
- package/dist/utils/nativeBridge.d.ts.map +1 -0
- package/dist/utils/nativeBridge.js +2 -0
- package/package.json +114 -0
|
@@ -0,0 +1,959 @@
|
|
|
1
|
+
import e from "react";
|
|
2
|
+
//#region node_modules/qrcode.react/lib/esm/index.js
|
|
3
|
+
var t = Object.defineProperty, n = Object.getOwnPropertySymbols, r = Object.prototype.hasOwnProperty, i = Object.prototype.propertyIsEnumerable, a = (e, n, r) => n in e ? t(e, n, {
|
|
4
|
+
enumerable: !0,
|
|
5
|
+
configurable: !0,
|
|
6
|
+
writable: !0,
|
|
7
|
+
value: r
|
|
8
|
+
}) : e[n] = r, o = (e, t) => {
|
|
9
|
+
for (var o in t ||= {}) r.call(t, o) && a(e, o, t[o]);
|
|
10
|
+
if (n) for (var o of n(t)) i.call(t, o) && a(e, o, t[o]);
|
|
11
|
+
return e;
|
|
12
|
+
}, s = (e, t) => {
|
|
13
|
+
var a = {};
|
|
14
|
+
for (var o in e) r.call(e, o) && t.indexOf(o) < 0 && (a[o] = e[o]);
|
|
15
|
+
if (e != null && n) for (var o of n(e)) t.indexOf(o) < 0 && i.call(e, o) && (a[o] = e[o]);
|
|
16
|
+
return a;
|
|
17
|
+
}, c;
|
|
18
|
+
((e) => {
|
|
19
|
+
let t = class t {
|
|
20
|
+
constructor(e, n, r, a) {
|
|
21
|
+
if (this.version = e, this.errorCorrectionLevel = n, this.modules = [], this.isFunction = [], e < t.MIN_VERSION || e > t.MAX_VERSION) throw RangeError("Version value out of range");
|
|
22
|
+
if (a < -1 || a > 7) throw RangeError("Mask value out of range");
|
|
23
|
+
this.size = e * 4 + 17;
|
|
24
|
+
let o = [];
|
|
25
|
+
for (let e = 0; e < this.size; e++) o.push(!1);
|
|
26
|
+
for (let e = 0; e < this.size; e++) this.modules.push(o.slice()), this.isFunction.push(o.slice());
|
|
27
|
+
this.drawFunctionPatterns();
|
|
28
|
+
let s = this.addEccAndInterleave(r);
|
|
29
|
+
if (this.drawCodewords(s), a == -1) {
|
|
30
|
+
let e = 1e9;
|
|
31
|
+
for (let t = 0; t < 8; t++) {
|
|
32
|
+
this.applyMask(t), this.drawFormatBits(t);
|
|
33
|
+
let n = this.getPenaltyScore();
|
|
34
|
+
n < e && (a = t, e = n), this.applyMask(t);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
i(0 <= a && a <= 7), this.mask = a, this.applyMask(a), this.drawFormatBits(a), this.isFunction = [];
|
|
38
|
+
}
|
|
39
|
+
static encodeText(n, r) {
|
|
40
|
+
let i = e.QrSegment.makeSegments(n);
|
|
41
|
+
return t.encodeSegments(i, r);
|
|
42
|
+
}
|
|
43
|
+
static encodeBinary(n, r) {
|
|
44
|
+
let i = e.QrSegment.makeBytes(n);
|
|
45
|
+
return t.encodeSegments([i], r);
|
|
46
|
+
}
|
|
47
|
+
static encodeSegments(e, r, a = 1, s = 40, c = -1, l = !0) {
|
|
48
|
+
if (!(t.MIN_VERSION <= a && a <= s && s <= t.MAX_VERSION) || c < -1 || c > 7) throw RangeError("Invalid value");
|
|
49
|
+
let u, d;
|
|
50
|
+
for (u = a;; u++) {
|
|
51
|
+
let n = t.getNumDataCodewords(u, r) * 8, i = o.getTotalBits(e, u);
|
|
52
|
+
if (i <= n) {
|
|
53
|
+
d = i;
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
if (u >= s) throw RangeError("Data too long");
|
|
57
|
+
}
|
|
58
|
+
for (let e of [
|
|
59
|
+
t.Ecc.MEDIUM,
|
|
60
|
+
t.Ecc.QUARTILE,
|
|
61
|
+
t.Ecc.HIGH
|
|
62
|
+
]) l && d <= t.getNumDataCodewords(u, e) * 8 && (r = e);
|
|
63
|
+
let f = [];
|
|
64
|
+
for (let t of e) {
|
|
65
|
+
n(t.mode.modeBits, 4, f), n(t.numChars, t.mode.numCharCountBits(u), f);
|
|
66
|
+
for (let e of t.getData()) f.push(e);
|
|
67
|
+
}
|
|
68
|
+
i(f.length == d);
|
|
69
|
+
let p = t.getNumDataCodewords(u, r) * 8;
|
|
70
|
+
i(f.length <= p), n(0, Math.min(4, p - f.length), f), n(0, (8 - f.length % 8) % 8, f), i(f.length % 8 == 0);
|
|
71
|
+
for (let e = 236; f.length < p; e ^= 253) n(e, 8, f);
|
|
72
|
+
let m = [];
|
|
73
|
+
for (; m.length * 8 < f.length;) m.push(0);
|
|
74
|
+
return f.forEach((e, t) => m[t >>> 3] |= e << 7 - (t & 7)), new t(u, r, m, c);
|
|
75
|
+
}
|
|
76
|
+
getModule(e, t) {
|
|
77
|
+
return 0 <= e && e < this.size && 0 <= t && t < this.size && this.modules[t][e];
|
|
78
|
+
}
|
|
79
|
+
getModules() {
|
|
80
|
+
return this.modules;
|
|
81
|
+
}
|
|
82
|
+
drawFunctionPatterns() {
|
|
83
|
+
for (let e = 0; e < this.size; e++) this.setFunctionModule(6, e, e % 2 == 0), this.setFunctionModule(e, 6, e % 2 == 0);
|
|
84
|
+
this.drawFinderPattern(3, 3), this.drawFinderPattern(this.size - 4, 3), this.drawFinderPattern(3, this.size - 4);
|
|
85
|
+
let e = this.getAlignmentPatternPositions(), t = e.length;
|
|
86
|
+
for (let n = 0; n < t; n++) for (let r = 0; r < t; r++) n == 0 && r == 0 || n == 0 && r == t - 1 || n == t - 1 && r == 0 || this.drawAlignmentPattern(e[n], e[r]);
|
|
87
|
+
this.drawFormatBits(0), this.drawVersion();
|
|
88
|
+
}
|
|
89
|
+
drawFormatBits(e) {
|
|
90
|
+
let t = this.errorCorrectionLevel.formatBits << 3 | e, n = t;
|
|
91
|
+
for (let e = 0; e < 10; e++) n = n << 1 ^ (n >>> 9) * 1335;
|
|
92
|
+
let a = (t << 10 | n) ^ 21522;
|
|
93
|
+
i(a >>> 15 == 0);
|
|
94
|
+
for (let e = 0; e <= 5; e++) this.setFunctionModule(8, e, r(a, e));
|
|
95
|
+
this.setFunctionModule(8, 7, r(a, 6)), this.setFunctionModule(8, 8, r(a, 7)), this.setFunctionModule(7, 8, r(a, 8));
|
|
96
|
+
for (let e = 9; e < 15; e++) this.setFunctionModule(14 - e, 8, r(a, e));
|
|
97
|
+
for (let e = 0; e < 8; e++) this.setFunctionModule(this.size - 1 - e, 8, r(a, e));
|
|
98
|
+
for (let e = 8; e < 15; e++) this.setFunctionModule(8, this.size - 15 + e, r(a, e));
|
|
99
|
+
this.setFunctionModule(8, this.size - 8, !0);
|
|
100
|
+
}
|
|
101
|
+
drawVersion() {
|
|
102
|
+
if (this.version < 7) return;
|
|
103
|
+
let e = this.version;
|
|
104
|
+
for (let t = 0; t < 12; t++) e = e << 1 ^ (e >>> 11) * 7973;
|
|
105
|
+
let t = this.version << 12 | e;
|
|
106
|
+
i(t >>> 18 == 0);
|
|
107
|
+
for (let e = 0; e < 18; e++) {
|
|
108
|
+
let n = r(t, e), i = this.size - 11 + e % 3, a = Math.floor(e / 3);
|
|
109
|
+
this.setFunctionModule(i, a, n), this.setFunctionModule(a, i, n);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
drawFinderPattern(e, t) {
|
|
113
|
+
for (let n = -4; n <= 4; n++) for (let r = -4; r <= 4; r++) {
|
|
114
|
+
let i = Math.max(Math.abs(r), Math.abs(n)), a = e + r, o = t + n;
|
|
115
|
+
0 <= a && a < this.size && 0 <= o && o < this.size && this.setFunctionModule(a, o, i != 2 && i != 4);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
drawAlignmentPattern(e, t) {
|
|
119
|
+
for (let n = -2; n <= 2; n++) for (let r = -2; r <= 2; r++) this.setFunctionModule(e + r, t + n, Math.max(Math.abs(r), Math.abs(n)) != 1);
|
|
120
|
+
}
|
|
121
|
+
setFunctionModule(e, t, n) {
|
|
122
|
+
this.modules[t][e] = n, this.isFunction[t][e] = !0;
|
|
123
|
+
}
|
|
124
|
+
addEccAndInterleave(e) {
|
|
125
|
+
let n = this.version, r = this.errorCorrectionLevel;
|
|
126
|
+
if (e.length != t.getNumDataCodewords(n, r)) throw RangeError("Invalid argument");
|
|
127
|
+
let a = t.NUM_ERROR_CORRECTION_BLOCKS[r.ordinal][n], o = t.ECC_CODEWORDS_PER_BLOCK[r.ordinal][n], s = Math.floor(t.getNumRawDataModules(n) / 8), c = a - s % a, l = Math.floor(s / a), u = [], d = t.reedSolomonComputeDivisor(o);
|
|
128
|
+
for (let n = 0, r = 0; n < a; n++) {
|
|
129
|
+
let i = e.slice(r, r + l - o + (n < c ? 0 : 1));
|
|
130
|
+
r += i.length;
|
|
131
|
+
let a = t.reedSolomonComputeRemainder(i, d);
|
|
132
|
+
n < c && i.push(0), u.push(i.concat(a));
|
|
133
|
+
}
|
|
134
|
+
let f = [];
|
|
135
|
+
for (let e = 0; e < u[0].length; e++) u.forEach((t, n) => {
|
|
136
|
+
(e != l - o || n >= c) && f.push(t[e]);
|
|
137
|
+
});
|
|
138
|
+
return i(f.length == s), f;
|
|
139
|
+
}
|
|
140
|
+
drawCodewords(e) {
|
|
141
|
+
if (e.length != Math.floor(t.getNumRawDataModules(this.version) / 8)) throw RangeError("Invalid argument");
|
|
142
|
+
let n = 0;
|
|
143
|
+
for (let t = this.size - 1; t >= 1; t -= 2) {
|
|
144
|
+
t == 6 && (t = 5);
|
|
145
|
+
for (let i = 0; i < this.size; i++) for (let a = 0; a < 2; a++) {
|
|
146
|
+
let o = t - a, s = t + 1 & 2 ? i : this.size - 1 - i;
|
|
147
|
+
!this.isFunction[s][o] && n < e.length * 8 && (this.modules[s][o] = r(e[n >>> 3], 7 - (n & 7)), n++);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
i(n == e.length * 8);
|
|
151
|
+
}
|
|
152
|
+
applyMask(e) {
|
|
153
|
+
if (e < 0 || e > 7) throw RangeError("Mask value out of range");
|
|
154
|
+
for (let t = 0; t < this.size; t++) for (let n = 0; n < this.size; n++) {
|
|
155
|
+
let r;
|
|
156
|
+
switch (e) {
|
|
157
|
+
case 0:
|
|
158
|
+
r = (n + t) % 2 == 0;
|
|
159
|
+
break;
|
|
160
|
+
case 1:
|
|
161
|
+
r = t % 2 == 0;
|
|
162
|
+
break;
|
|
163
|
+
case 2:
|
|
164
|
+
r = n % 3 == 0;
|
|
165
|
+
break;
|
|
166
|
+
case 3:
|
|
167
|
+
r = (n + t) % 3 == 0;
|
|
168
|
+
break;
|
|
169
|
+
case 4:
|
|
170
|
+
r = (Math.floor(n / 3) + Math.floor(t / 2)) % 2 == 0;
|
|
171
|
+
break;
|
|
172
|
+
case 5:
|
|
173
|
+
r = n * t % 2 + n * t % 3 == 0;
|
|
174
|
+
break;
|
|
175
|
+
case 6:
|
|
176
|
+
r = (n * t % 2 + n * t % 3) % 2 == 0;
|
|
177
|
+
break;
|
|
178
|
+
case 7:
|
|
179
|
+
r = ((n + t) % 2 + n * t % 3) % 2 == 0;
|
|
180
|
+
break;
|
|
181
|
+
default: throw Error("Unreachable");
|
|
182
|
+
}
|
|
183
|
+
!this.isFunction[t][n] && r && (this.modules[t][n] = !this.modules[t][n]);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
getPenaltyScore() {
|
|
187
|
+
let e = 0;
|
|
188
|
+
for (let n = 0; n < this.size; n++) {
|
|
189
|
+
let r = !1, i = 0, a = [
|
|
190
|
+
0,
|
|
191
|
+
0,
|
|
192
|
+
0,
|
|
193
|
+
0,
|
|
194
|
+
0,
|
|
195
|
+
0,
|
|
196
|
+
0
|
|
197
|
+
];
|
|
198
|
+
for (let o = 0; o < this.size; o++) this.modules[n][o] == r ? (i++, i == 5 ? e += t.PENALTY_N1 : i > 5 && e++) : (this.finderPenaltyAddHistory(i, a), r || (e += this.finderPenaltyCountPatterns(a) * t.PENALTY_N3), r = this.modules[n][o], i = 1);
|
|
199
|
+
e += this.finderPenaltyTerminateAndCount(r, i, a) * t.PENALTY_N3;
|
|
200
|
+
}
|
|
201
|
+
for (let n = 0; n < this.size; n++) {
|
|
202
|
+
let r = !1, i = 0, a = [
|
|
203
|
+
0,
|
|
204
|
+
0,
|
|
205
|
+
0,
|
|
206
|
+
0,
|
|
207
|
+
0,
|
|
208
|
+
0,
|
|
209
|
+
0
|
|
210
|
+
];
|
|
211
|
+
for (let o = 0; o < this.size; o++) this.modules[o][n] == r ? (i++, i == 5 ? e += t.PENALTY_N1 : i > 5 && e++) : (this.finderPenaltyAddHistory(i, a), r || (e += this.finderPenaltyCountPatterns(a) * t.PENALTY_N3), r = this.modules[o][n], i = 1);
|
|
212
|
+
e += this.finderPenaltyTerminateAndCount(r, i, a) * t.PENALTY_N3;
|
|
213
|
+
}
|
|
214
|
+
for (let n = 0; n < this.size - 1; n++) for (let r = 0; r < this.size - 1; r++) {
|
|
215
|
+
let i = this.modules[n][r];
|
|
216
|
+
i == this.modules[n][r + 1] && i == this.modules[n + 1][r] && i == this.modules[n + 1][r + 1] && (e += t.PENALTY_N2);
|
|
217
|
+
}
|
|
218
|
+
let n = 0;
|
|
219
|
+
for (let e of this.modules) n = e.reduce((e, t) => e + +!!t, n);
|
|
220
|
+
let r = this.size * this.size, a = Math.ceil(Math.abs(n * 20 - r * 10) / r) - 1;
|
|
221
|
+
return i(0 <= a && a <= 9), e += a * t.PENALTY_N4, i(0 <= e && e <= 2568888), e;
|
|
222
|
+
}
|
|
223
|
+
getAlignmentPatternPositions() {
|
|
224
|
+
if (this.version == 1) return [];
|
|
225
|
+
{
|
|
226
|
+
let e = Math.floor(this.version / 7) + 2, t = this.version == 32 ? 26 : Math.ceil((this.version * 4 + 4) / (e * 2 - 2)) * 2, n = [6];
|
|
227
|
+
for (let r = this.size - 7; n.length < e; r -= t) n.splice(1, 0, r);
|
|
228
|
+
return n;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
static getNumRawDataModules(e) {
|
|
232
|
+
if (e < t.MIN_VERSION || e > t.MAX_VERSION) throw RangeError("Version number out of range");
|
|
233
|
+
let n = (16 * e + 128) * e + 64;
|
|
234
|
+
if (e >= 2) {
|
|
235
|
+
let t = Math.floor(e / 7) + 2;
|
|
236
|
+
n -= (25 * t - 10) * t - 55, e >= 7 && (n -= 36);
|
|
237
|
+
}
|
|
238
|
+
return i(208 <= n && n <= 29648), n;
|
|
239
|
+
}
|
|
240
|
+
static getNumDataCodewords(e, n) {
|
|
241
|
+
return Math.floor(t.getNumRawDataModules(e) / 8) - t.ECC_CODEWORDS_PER_BLOCK[n.ordinal][e] * t.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][e];
|
|
242
|
+
}
|
|
243
|
+
static reedSolomonComputeDivisor(e) {
|
|
244
|
+
if (e < 1 || e > 255) throw RangeError("Degree out of range");
|
|
245
|
+
let n = [];
|
|
246
|
+
for (let t = 0; t < e - 1; t++) n.push(0);
|
|
247
|
+
n.push(1);
|
|
248
|
+
let r = 1;
|
|
249
|
+
for (let i = 0; i < e; i++) {
|
|
250
|
+
for (let e = 0; e < n.length; e++) n[e] = t.reedSolomonMultiply(n[e], r), e + 1 < n.length && (n[e] ^= n[e + 1]);
|
|
251
|
+
r = t.reedSolomonMultiply(r, 2);
|
|
252
|
+
}
|
|
253
|
+
return n;
|
|
254
|
+
}
|
|
255
|
+
static reedSolomonComputeRemainder(e, n) {
|
|
256
|
+
let r = n.map((e) => 0);
|
|
257
|
+
for (let i of e) {
|
|
258
|
+
let e = i ^ r.shift();
|
|
259
|
+
r.push(0), n.forEach((n, i) => r[i] ^= t.reedSolomonMultiply(n, e));
|
|
260
|
+
}
|
|
261
|
+
return r;
|
|
262
|
+
}
|
|
263
|
+
static reedSolomonMultiply(e, t) {
|
|
264
|
+
if (e >>> 8 || t >>> 8) throw RangeError("Byte out of range");
|
|
265
|
+
let n = 0;
|
|
266
|
+
for (let r = 7; r >= 0; r--) n = n << 1 ^ (n >>> 7) * 285, n ^= (t >>> r & 1) * e;
|
|
267
|
+
return i(n >>> 8 == 0), n;
|
|
268
|
+
}
|
|
269
|
+
finderPenaltyCountPatterns(e) {
|
|
270
|
+
let t = e[1];
|
|
271
|
+
i(t <= this.size * 3);
|
|
272
|
+
let n = t > 0 && e[2] == t && e[3] == t * 3 && e[4] == t && e[5] == t;
|
|
273
|
+
return (n && e[0] >= t * 4 && e[6] >= t ? 1 : 0) + (n && e[6] >= t * 4 && e[0] >= t ? 1 : 0);
|
|
274
|
+
}
|
|
275
|
+
finderPenaltyTerminateAndCount(e, t, n) {
|
|
276
|
+
return e && (this.finderPenaltyAddHistory(t, n), t = 0), t += this.size, this.finderPenaltyAddHistory(t, n), this.finderPenaltyCountPatterns(n);
|
|
277
|
+
}
|
|
278
|
+
finderPenaltyAddHistory(e, t) {
|
|
279
|
+
t[0] == 0 && (e += this.size), t.pop(), t.unshift(e);
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
t.MIN_VERSION = 1, t.MAX_VERSION = 40, t.PENALTY_N1 = 3, t.PENALTY_N2 = 3, t.PENALTY_N3 = 40, t.PENALTY_N4 = 10, t.ECC_CODEWORDS_PER_BLOCK = [
|
|
283
|
+
[
|
|
284
|
+
-1,
|
|
285
|
+
7,
|
|
286
|
+
10,
|
|
287
|
+
15,
|
|
288
|
+
20,
|
|
289
|
+
26,
|
|
290
|
+
18,
|
|
291
|
+
20,
|
|
292
|
+
24,
|
|
293
|
+
30,
|
|
294
|
+
18,
|
|
295
|
+
20,
|
|
296
|
+
24,
|
|
297
|
+
26,
|
|
298
|
+
30,
|
|
299
|
+
22,
|
|
300
|
+
24,
|
|
301
|
+
28,
|
|
302
|
+
30,
|
|
303
|
+
28,
|
|
304
|
+
28,
|
|
305
|
+
28,
|
|
306
|
+
28,
|
|
307
|
+
30,
|
|
308
|
+
30,
|
|
309
|
+
26,
|
|
310
|
+
28,
|
|
311
|
+
30,
|
|
312
|
+
30,
|
|
313
|
+
30,
|
|
314
|
+
30,
|
|
315
|
+
30,
|
|
316
|
+
30,
|
|
317
|
+
30,
|
|
318
|
+
30,
|
|
319
|
+
30,
|
|
320
|
+
30,
|
|
321
|
+
30,
|
|
322
|
+
30,
|
|
323
|
+
30,
|
|
324
|
+
30
|
|
325
|
+
],
|
|
326
|
+
[
|
|
327
|
+
-1,
|
|
328
|
+
10,
|
|
329
|
+
16,
|
|
330
|
+
26,
|
|
331
|
+
18,
|
|
332
|
+
24,
|
|
333
|
+
16,
|
|
334
|
+
18,
|
|
335
|
+
22,
|
|
336
|
+
22,
|
|
337
|
+
26,
|
|
338
|
+
30,
|
|
339
|
+
22,
|
|
340
|
+
22,
|
|
341
|
+
24,
|
|
342
|
+
24,
|
|
343
|
+
28,
|
|
344
|
+
28,
|
|
345
|
+
26,
|
|
346
|
+
26,
|
|
347
|
+
26,
|
|
348
|
+
26,
|
|
349
|
+
28,
|
|
350
|
+
28,
|
|
351
|
+
28,
|
|
352
|
+
28,
|
|
353
|
+
28,
|
|
354
|
+
28,
|
|
355
|
+
28,
|
|
356
|
+
28,
|
|
357
|
+
28,
|
|
358
|
+
28,
|
|
359
|
+
28,
|
|
360
|
+
28,
|
|
361
|
+
28,
|
|
362
|
+
28,
|
|
363
|
+
28,
|
|
364
|
+
28,
|
|
365
|
+
28,
|
|
366
|
+
28,
|
|
367
|
+
28
|
|
368
|
+
],
|
|
369
|
+
[
|
|
370
|
+
-1,
|
|
371
|
+
13,
|
|
372
|
+
22,
|
|
373
|
+
18,
|
|
374
|
+
26,
|
|
375
|
+
18,
|
|
376
|
+
24,
|
|
377
|
+
18,
|
|
378
|
+
22,
|
|
379
|
+
20,
|
|
380
|
+
24,
|
|
381
|
+
28,
|
|
382
|
+
26,
|
|
383
|
+
24,
|
|
384
|
+
20,
|
|
385
|
+
30,
|
|
386
|
+
24,
|
|
387
|
+
28,
|
|
388
|
+
28,
|
|
389
|
+
26,
|
|
390
|
+
30,
|
|
391
|
+
28,
|
|
392
|
+
30,
|
|
393
|
+
30,
|
|
394
|
+
30,
|
|
395
|
+
30,
|
|
396
|
+
28,
|
|
397
|
+
30,
|
|
398
|
+
30,
|
|
399
|
+
30,
|
|
400
|
+
30,
|
|
401
|
+
30,
|
|
402
|
+
30,
|
|
403
|
+
30,
|
|
404
|
+
30,
|
|
405
|
+
30,
|
|
406
|
+
30,
|
|
407
|
+
30,
|
|
408
|
+
30,
|
|
409
|
+
30,
|
|
410
|
+
30
|
|
411
|
+
],
|
|
412
|
+
[
|
|
413
|
+
-1,
|
|
414
|
+
17,
|
|
415
|
+
28,
|
|
416
|
+
22,
|
|
417
|
+
16,
|
|
418
|
+
22,
|
|
419
|
+
28,
|
|
420
|
+
26,
|
|
421
|
+
26,
|
|
422
|
+
24,
|
|
423
|
+
28,
|
|
424
|
+
24,
|
|
425
|
+
28,
|
|
426
|
+
22,
|
|
427
|
+
24,
|
|
428
|
+
24,
|
|
429
|
+
30,
|
|
430
|
+
28,
|
|
431
|
+
28,
|
|
432
|
+
26,
|
|
433
|
+
28,
|
|
434
|
+
30,
|
|
435
|
+
24,
|
|
436
|
+
30,
|
|
437
|
+
30,
|
|
438
|
+
30,
|
|
439
|
+
30,
|
|
440
|
+
30,
|
|
441
|
+
30,
|
|
442
|
+
30,
|
|
443
|
+
30,
|
|
444
|
+
30,
|
|
445
|
+
30,
|
|
446
|
+
30,
|
|
447
|
+
30,
|
|
448
|
+
30,
|
|
449
|
+
30,
|
|
450
|
+
30,
|
|
451
|
+
30,
|
|
452
|
+
30,
|
|
453
|
+
30
|
|
454
|
+
]
|
|
455
|
+
], t.NUM_ERROR_CORRECTION_BLOCKS = [
|
|
456
|
+
[
|
|
457
|
+
-1,
|
|
458
|
+
1,
|
|
459
|
+
1,
|
|
460
|
+
1,
|
|
461
|
+
1,
|
|
462
|
+
1,
|
|
463
|
+
2,
|
|
464
|
+
2,
|
|
465
|
+
2,
|
|
466
|
+
2,
|
|
467
|
+
4,
|
|
468
|
+
4,
|
|
469
|
+
4,
|
|
470
|
+
4,
|
|
471
|
+
4,
|
|
472
|
+
6,
|
|
473
|
+
6,
|
|
474
|
+
6,
|
|
475
|
+
6,
|
|
476
|
+
7,
|
|
477
|
+
8,
|
|
478
|
+
8,
|
|
479
|
+
9,
|
|
480
|
+
9,
|
|
481
|
+
10,
|
|
482
|
+
12,
|
|
483
|
+
12,
|
|
484
|
+
12,
|
|
485
|
+
13,
|
|
486
|
+
14,
|
|
487
|
+
15,
|
|
488
|
+
16,
|
|
489
|
+
17,
|
|
490
|
+
18,
|
|
491
|
+
19,
|
|
492
|
+
19,
|
|
493
|
+
20,
|
|
494
|
+
21,
|
|
495
|
+
22,
|
|
496
|
+
24,
|
|
497
|
+
25
|
|
498
|
+
],
|
|
499
|
+
[
|
|
500
|
+
-1,
|
|
501
|
+
1,
|
|
502
|
+
1,
|
|
503
|
+
1,
|
|
504
|
+
2,
|
|
505
|
+
2,
|
|
506
|
+
4,
|
|
507
|
+
4,
|
|
508
|
+
4,
|
|
509
|
+
5,
|
|
510
|
+
5,
|
|
511
|
+
5,
|
|
512
|
+
8,
|
|
513
|
+
9,
|
|
514
|
+
9,
|
|
515
|
+
10,
|
|
516
|
+
10,
|
|
517
|
+
11,
|
|
518
|
+
13,
|
|
519
|
+
14,
|
|
520
|
+
16,
|
|
521
|
+
17,
|
|
522
|
+
17,
|
|
523
|
+
18,
|
|
524
|
+
20,
|
|
525
|
+
21,
|
|
526
|
+
23,
|
|
527
|
+
25,
|
|
528
|
+
26,
|
|
529
|
+
28,
|
|
530
|
+
29,
|
|
531
|
+
31,
|
|
532
|
+
33,
|
|
533
|
+
35,
|
|
534
|
+
37,
|
|
535
|
+
38,
|
|
536
|
+
40,
|
|
537
|
+
43,
|
|
538
|
+
45,
|
|
539
|
+
47,
|
|
540
|
+
49
|
|
541
|
+
],
|
|
542
|
+
[
|
|
543
|
+
-1,
|
|
544
|
+
1,
|
|
545
|
+
1,
|
|
546
|
+
2,
|
|
547
|
+
2,
|
|
548
|
+
4,
|
|
549
|
+
4,
|
|
550
|
+
6,
|
|
551
|
+
6,
|
|
552
|
+
8,
|
|
553
|
+
8,
|
|
554
|
+
8,
|
|
555
|
+
10,
|
|
556
|
+
12,
|
|
557
|
+
16,
|
|
558
|
+
12,
|
|
559
|
+
17,
|
|
560
|
+
16,
|
|
561
|
+
18,
|
|
562
|
+
21,
|
|
563
|
+
20,
|
|
564
|
+
23,
|
|
565
|
+
23,
|
|
566
|
+
25,
|
|
567
|
+
27,
|
|
568
|
+
29,
|
|
569
|
+
34,
|
|
570
|
+
34,
|
|
571
|
+
35,
|
|
572
|
+
38,
|
|
573
|
+
40,
|
|
574
|
+
43,
|
|
575
|
+
45,
|
|
576
|
+
48,
|
|
577
|
+
51,
|
|
578
|
+
53,
|
|
579
|
+
56,
|
|
580
|
+
59,
|
|
581
|
+
62,
|
|
582
|
+
65,
|
|
583
|
+
68
|
|
584
|
+
],
|
|
585
|
+
[
|
|
586
|
+
-1,
|
|
587
|
+
1,
|
|
588
|
+
1,
|
|
589
|
+
2,
|
|
590
|
+
4,
|
|
591
|
+
4,
|
|
592
|
+
4,
|
|
593
|
+
5,
|
|
594
|
+
6,
|
|
595
|
+
8,
|
|
596
|
+
8,
|
|
597
|
+
11,
|
|
598
|
+
11,
|
|
599
|
+
16,
|
|
600
|
+
16,
|
|
601
|
+
18,
|
|
602
|
+
16,
|
|
603
|
+
19,
|
|
604
|
+
21,
|
|
605
|
+
25,
|
|
606
|
+
25,
|
|
607
|
+
25,
|
|
608
|
+
34,
|
|
609
|
+
30,
|
|
610
|
+
32,
|
|
611
|
+
35,
|
|
612
|
+
37,
|
|
613
|
+
40,
|
|
614
|
+
42,
|
|
615
|
+
45,
|
|
616
|
+
48,
|
|
617
|
+
51,
|
|
618
|
+
54,
|
|
619
|
+
57,
|
|
620
|
+
60,
|
|
621
|
+
63,
|
|
622
|
+
66,
|
|
623
|
+
70,
|
|
624
|
+
74,
|
|
625
|
+
77,
|
|
626
|
+
81
|
|
627
|
+
]
|
|
628
|
+
], e.QrCode = t;
|
|
629
|
+
function n(e, t, n) {
|
|
630
|
+
if (t < 0 || t > 31 || e >>> t) throw RangeError("Value out of range");
|
|
631
|
+
for (let r = t - 1; r >= 0; r--) n.push(e >>> r & 1);
|
|
632
|
+
}
|
|
633
|
+
function r(e, t) {
|
|
634
|
+
return (e >>> t & 1) != 0;
|
|
635
|
+
}
|
|
636
|
+
function i(e) {
|
|
637
|
+
if (!e) throw Error("Assertion error");
|
|
638
|
+
}
|
|
639
|
+
let a = class e {
|
|
640
|
+
constructor(e, t, n) {
|
|
641
|
+
if (this.mode = e, this.numChars = t, this.bitData = n, t < 0) throw RangeError("Invalid argument");
|
|
642
|
+
this.bitData = n.slice();
|
|
643
|
+
}
|
|
644
|
+
static makeBytes(t) {
|
|
645
|
+
let r = [];
|
|
646
|
+
for (let e of t) n(e, 8, r);
|
|
647
|
+
return new e(e.Mode.BYTE, t.length, r);
|
|
648
|
+
}
|
|
649
|
+
static makeNumeric(t) {
|
|
650
|
+
if (!e.isNumeric(t)) throw RangeError("String contains non-numeric characters");
|
|
651
|
+
let r = [];
|
|
652
|
+
for (let e = 0; e < t.length;) {
|
|
653
|
+
let i = Math.min(t.length - e, 3);
|
|
654
|
+
n(parseInt(t.substring(e, e + i), 10), i * 3 + 1, r), e += i;
|
|
655
|
+
}
|
|
656
|
+
return new e(e.Mode.NUMERIC, t.length, r);
|
|
657
|
+
}
|
|
658
|
+
static makeAlphanumeric(t) {
|
|
659
|
+
if (!e.isAlphanumeric(t)) throw RangeError("String contains unencodable characters in alphanumeric mode");
|
|
660
|
+
let r = [], i;
|
|
661
|
+
for (i = 0; i + 2 <= t.length; i += 2) {
|
|
662
|
+
let a = e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i)) * 45;
|
|
663
|
+
a += e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i + 1)), n(a, 11, r);
|
|
664
|
+
}
|
|
665
|
+
return i < t.length && n(e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i)), 6, r), new e(e.Mode.ALPHANUMERIC, t.length, r);
|
|
666
|
+
}
|
|
667
|
+
static makeSegments(t) {
|
|
668
|
+
return t == "" ? [] : e.isNumeric(t) ? [e.makeNumeric(t)] : e.isAlphanumeric(t) ? [e.makeAlphanumeric(t)] : [e.makeBytes(e.toUtf8ByteArray(t))];
|
|
669
|
+
}
|
|
670
|
+
static makeEci(t) {
|
|
671
|
+
let r = [];
|
|
672
|
+
if (t < 0) throw RangeError("ECI assignment value out of range");
|
|
673
|
+
if (t < 128) n(t, 8, r);
|
|
674
|
+
else if (t < 16384) n(2, 2, r), n(t, 14, r);
|
|
675
|
+
else if (t < 1e6) n(6, 3, r), n(t, 21, r);
|
|
676
|
+
else throw RangeError("ECI assignment value out of range");
|
|
677
|
+
return new e(e.Mode.ECI, 0, r);
|
|
678
|
+
}
|
|
679
|
+
static isNumeric(t) {
|
|
680
|
+
return e.NUMERIC_REGEX.test(t);
|
|
681
|
+
}
|
|
682
|
+
static isAlphanumeric(t) {
|
|
683
|
+
return e.ALPHANUMERIC_REGEX.test(t);
|
|
684
|
+
}
|
|
685
|
+
getData() {
|
|
686
|
+
return this.bitData.slice();
|
|
687
|
+
}
|
|
688
|
+
static getTotalBits(e, t) {
|
|
689
|
+
let n = 0;
|
|
690
|
+
for (let r of e) {
|
|
691
|
+
let e = r.mode.numCharCountBits(t);
|
|
692
|
+
if (r.numChars >= 1 << e) return Infinity;
|
|
693
|
+
n += 4 + e + r.bitData.length;
|
|
694
|
+
}
|
|
695
|
+
return n;
|
|
696
|
+
}
|
|
697
|
+
static toUtf8ByteArray(e) {
|
|
698
|
+
e = encodeURI(e);
|
|
699
|
+
let t = [];
|
|
700
|
+
for (let n = 0; n < e.length; n++) e.charAt(n) == "%" ? (t.push(parseInt(e.substring(n + 1, n + 3), 16)), n += 2) : t.push(e.charCodeAt(n));
|
|
701
|
+
return t;
|
|
702
|
+
}
|
|
703
|
+
};
|
|
704
|
+
a.NUMERIC_REGEX = /^[0-9]*$/, a.ALPHANUMERIC_REGEX = /^[A-Z0-9 $%*+.\/:-]*$/, a.ALPHANUMERIC_CHARSET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";
|
|
705
|
+
let o = a;
|
|
706
|
+
e.QrSegment = a;
|
|
707
|
+
})(c ||= {}), ((e) => {
|
|
708
|
+
((e) => {
|
|
709
|
+
let t = class {
|
|
710
|
+
constructor(e, t) {
|
|
711
|
+
this.ordinal = e, this.formatBits = t;
|
|
712
|
+
}
|
|
713
|
+
};
|
|
714
|
+
t.LOW = new t(0, 1), t.MEDIUM = new t(1, 0), t.QUARTILE = new t(2, 3), t.HIGH = new t(3, 2), e.Ecc = t;
|
|
715
|
+
})(e.QrCode ||= {});
|
|
716
|
+
})(c ||= {}), ((e) => {
|
|
717
|
+
((e) => {
|
|
718
|
+
let t = class {
|
|
719
|
+
constructor(e, t) {
|
|
720
|
+
this.modeBits = e, this.numBitsCharCount = t;
|
|
721
|
+
}
|
|
722
|
+
numCharCountBits(e) {
|
|
723
|
+
return this.numBitsCharCount[Math.floor((e + 7) / 17)];
|
|
724
|
+
}
|
|
725
|
+
};
|
|
726
|
+
t.NUMERIC = new t(1, [
|
|
727
|
+
10,
|
|
728
|
+
12,
|
|
729
|
+
14
|
|
730
|
+
]), t.ALPHANUMERIC = new t(2, [
|
|
731
|
+
9,
|
|
732
|
+
11,
|
|
733
|
+
13
|
|
734
|
+
]), t.BYTE = new t(4, [
|
|
735
|
+
8,
|
|
736
|
+
16,
|
|
737
|
+
16
|
|
738
|
+
]), t.KANJI = new t(8, [
|
|
739
|
+
8,
|
|
740
|
+
10,
|
|
741
|
+
12
|
|
742
|
+
]), t.ECI = new t(7, [
|
|
743
|
+
0,
|
|
744
|
+
0,
|
|
745
|
+
0
|
|
746
|
+
]), e.Mode = t;
|
|
747
|
+
})(e.QrSegment ||= {});
|
|
748
|
+
})(c ||= {});
|
|
749
|
+
var l = c, u = {
|
|
750
|
+
L: l.QrCode.Ecc.LOW,
|
|
751
|
+
M: l.QrCode.Ecc.MEDIUM,
|
|
752
|
+
Q: l.QrCode.Ecc.QUARTILE,
|
|
753
|
+
H: l.QrCode.Ecc.HIGH
|
|
754
|
+
}, d = 128, f = "L", p = "#FFFFFF", m = "#000000", h = !1, g = 1, _ = 4, v = 0, y = .1;
|
|
755
|
+
function b(e, t = 0) {
|
|
756
|
+
let n = [];
|
|
757
|
+
return e.forEach(function(e, r) {
|
|
758
|
+
let i = null;
|
|
759
|
+
e.forEach(function(a, o) {
|
|
760
|
+
if (!a && i !== null) {
|
|
761
|
+
n.push(`M${i + t} ${r + t}h${o - i}v1H${i + t}z`), i = null;
|
|
762
|
+
return;
|
|
763
|
+
}
|
|
764
|
+
if (o === e.length - 1) {
|
|
765
|
+
if (!a) return;
|
|
766
|
+
i === null ? n.push(`M${o + t},${r + t} h1v1H${o + t}z`) : n.push(`M${i + t},${r + t} h${o + 1 - i}v1H${i + t}z`);
|
|
767
|
+
return;
|
|
768
|
+
}
|
|
769
|
+
a && i === null && (i = o);
|
|
770
|
+
});
|
|
771
|
+
}), n.join("");
|
|
772
|
+
}
|
|
773
|
+
function x(e, t) {
|
|
774
|
+
return e.slice().map((e, n) => n < t.y || n >= t.y + t.h ? e : e.map((e, n) => n < t.x || n >= t.x + t.w ? e : !1));
|
|
775
|
+
}
|
|
776
|
+
function S(e, t, n, r) {
|
|
777
|
+
if (r == null) return null;
|
|
778
|
+
let i = e.length + n * 2, a = Math.floor(t * y), o = i / t, s = (r.width || a) * o, c = (r.height || a) * o, l = r.x == null ? e.length / 2 - s / 2 : r.x * o, u = r.y == null ? e.length / 2 - c / 2 : r.y * o, d = r.opacity == null ? 1 : r.opacity, f = null;
|
|
779
|
+
if (r.excavate) {
|
|
780
|
+
let e = Math.floor(l), t = Math.floor(u);
|
|
781
|
+
f = {
|
|
782
|
+
x: e,
|
|
783
|
+
y: t,
|
|
784
|
+
w: Math.ceil(s + l - e),
|
|
785
|
+
h: Math.ceil(c + u - t)
|
|
786
|
+
};
|
|
787
|
+
}
|
|
788
|
+
let p = r.crossOrigin;
|
|
789
|
+
return {
|
|
790
|
+
x: l,
|
|
791
|
+
y: u,
|
|
792
|
+
h: c,
|
|
793
|
+
w: s,
|
|
794
|
+
excavation: f,
|
|
795
|
+
opacity: d,
|
|
796
|
+
crossOrigin: p
|
|
797
|
+
};
|
|
798
|
+
}
|
|
799
|
+
function C(e, t) {
|
|
800
|
+
return t == null ? e ? _ : v : Math.max(Math.floor(t), 0);
|
|
801
|
+
}
|
|
802
|
+
function w({ value: t, level: n, minVersion: r, includeMargin: i, marginSize: a, imageSettings: o, size: s, boostLevel: c }) {
|
|
803
|
+
let d = e.useMemo(() => {
|
|
804
|
+
let e = (Array.isArray(t) ? t : [t]).reduce((e, t) => (e.push(...l.QrSegment.makeSegments(t)), e), []);
|
|
805
|
+
return l.QrCode.encodeSegments(e, u[n], r, void 0, void 0, c);
|
|
806
|
+
}, [
|
|
807
|
+
t,
|
|
808
|
+
n,
|
|
809
|
+
r,
|
|
810
|
+
c
|
|
811
|
+
]), { cells: f, margin: p, numCells: m, calculatedImageSettings: h } = e.useMemo(() => {
|
|
812
|
+
let e = d.getModules(), t = C(i, a);
|
|
813
|
+
return {
|
|
814
|
+
cells: e,
|
|
815
|
+
margin: t,
|
|
816
|
+
numCells: e.length + t * 2,
|
|
817
|
+
calculatedImageSettings: S(e, s, t, o)
|
|
818
|
+
};
|
|
819
|
+
}, [
|
|
820
|
+
d,
|
|
821
|
+
s,
|
|
822
|
+
o,
|
|
823
|
+
i,
|
|
824
|
+
a
|
|
825
|
+
]);
|
|
826
|
+
return {
|
|
827
|
+
qrcode: d,
|
|
828
|
+
margin: p,
|
|
829
|
+
cells: f,
|
|
830
|
+
numCells: m,
|
|
831
|
+
calculatedImageSettings: h
|
|
832
|
+
};
|
|
833
|
+
}
|
|
834
|
+
var T = function() {
|
|
835
|
+
try {
|
|
836
|
+
new Path2D().addPath(new Path2D());
|
|
837
|
+
} catch {
|
|
838
|
+
return !1;
|
|
839
|
+
}
|
|
840
|
+
return !0;
|
|
841
|
+
}(), E = e.forwardRef(function(t, n) {
|
|
842
|
+
let r = t, { value: i, size: a = d, level: c = f, bgColor: l = p, fgColor: u = m, includeMargin: _ = h, minVersion: v = g, boostLevel: y, marginSize: S, imageSettings: C } = r, E = s(r, [
|
|
843
|
+
"value",
|
|
844
|
+
"size",
|
|
845
|
+
"level",
|
|
846
|
+
"bgColor",
|
|
847
|
+
"fgColor",
|
|
848
|
+
"includeMargin",
|
|
849
|
+
"minVersion",
|
|
850
|
+
"boostLevel",
|
|
851
|
+
"marginSize",
|
|
852
|
+
"imageSettings"
|
|
853
|
+
]), { style: D } = E, O = s(E, ["style"]), k = C?.src, A = e.useRef(null), j = e.useRef(null), M = e.useCallback((e) => {
|
|
854
|
+
A.current = e, typeof n == "function" ? n(e) : n && (n.current = e);
|
|
855
|
+
}, [n]), [N, P] = e.useState(!1), { margin: F, cells: I, numCells: L, calculatedImageSettings: R } = w({
|
|
856
|
+
value: i,
|
|
857
|
+
level: c,
|
|
858
|
+
minVersion: v,
|
|
859
|
+
boostLevel: y,
|
|
860
|
+
includeMargin: _,
|
|
861
|
+
marginSize: S,
|
|
862
|
+
imageSettings: C,
|
|
863
|
+
size: a
|
|
864
|
+
});
|
|
865
|
+
e.useEffect(() => {
|
|
866
|
+
if (A.current != null) {
|
|
867
|
+
let e = A.current, t = e.getContext("2d");
|
|
868
|
+
if (!t) return;
|
|
869
|
+
let n = I, r = j.current, i = R != null && r !== null && r.complete && r.naturalHeight !== 0 && r.naturalWidth !== 0;
|
|
870
|
+
i && R.excavation != null && (n = x(I, R.excavation));
|
|
871
|
+
let o = window.devicePixelRatio || 1;
|
|
872
|
+
e.height = e.width = a * o;
|
|
873
|
+
let s = a / L * o;
|
|
874
|
+
t.scale(s, s), t.fillStyle = l, t.fillRect(0, 0, L, L), t.fillStyle = u, T ? t.fill(new Path2D(b(n, F))) : I.forEach(function(e, n) {
|
|
875
|
+
e.forEach(function(e, r) {
|
|
876
|
+
e && t.fillRect(r + F, n + F, 1, 1);
|
|
877
|
+
});
|
|
878
|
+
}), R && (t.globalAlpha = R.opacity), i && t.drawImage(r, R.x + F, R.y + F, R.w, R.h);
|
|
879
|
+
}
|
|
880
|
+
}), e.useEffect(() => {
|
|
881
|
+
P(!1);
|
|
882
|
+
}, [k]);
|
|
883
|
+
let z = o({
|
|
884
|
+
height: a,
|
|
885
|
+
width: a
|
|
886
|
+
}, D), B = null;
|
|
887
|
+
return k != null && (B = /* @__PURE__ */ e.createElement("img", {
|
|
888
|
+
src: k,
|
|
889
|
+
key: k,
|
|
890
|
+
style: { display: "none" },
|
|
891
|
+
onLoad: () => {
|
|
892
|
+
P(!0);
|
|
893
|
+
},
|
|
894
|
+
ref: j,
|
|
895
|
+
crossOrigin: R?.crossOrigin
|
|
896
|
+
})), /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("canvas", o({
|
|
897
|
+
style: z,
|
|
898
|
+
height: a,
|
|
899
|
+
width: a,
|
|
900
|
+
ref: M,
|
|
901
|
+
role: "img"
|
|
902
|
+
}, O)), B);
|
|
903
|
+
});
|
|
904
|
+
E.displayName = "QRCodeCanvas";
|
|
905
|
+
var D = e.forwardRef(function(t, n) {
|
|
906
|
+
let r = t, { value: i, size: a = d, level: c = f, bgColor: l = p, fgColor: u = m, includeMargin: _ = h, minVersion: v = g, boostLevel: y, title: S, marginSize: C, imageSettings: T } = r, E = s(r, [
|
|
907
|
+
"value",
|
|
908
|
+
"size",
|
|
909
|
+
"level",
|
|
910
|
+
"bgColor",
|
|
911
|
+
"fgColor",
|
|
912
|
+
"includeMargin",
|
|
913
|
+
"minVersion",
|
|
914
|
+
"boostLevel",
|
|
915
|
+
"title",
|
|
916
|
+
"marginSize",
|
|
917
|
+
"imageSettings"
|
|
918
|
+
]), { margin: D, cells: O, numCells: k, calculatedImageSettings: A } = w({
|
|
919
|
+
value: i,
|
|
920
|
+
level: c,
|
|
921
|
+
minVersion: v,
|
|
922
|
+
boostLevel: y,
|
|
923
|
+
includeMargin: _,
|
|
924
|
+
marginSize: C,
|
|
925
|
+
imageSettings: T,
|
|
926
|
+
size: a
|
|
927
|
+
}), j = O, M = null;
|
|
928
|
+
T != null && A != null && (A.excavation != null && (j = x(O, A.excavation)), M = /* @__PURE__ */ e.createElement("image", {
|
|
929
|
+
href: T.src,
|
|
930
|
+
height: A.h,
|
|
931
|
+
width: A.w,
|
|
932
|
+
x: A.x + D,
|
|
933
|
+
y: A.y + D,
|
|
934
|
+
preserveAspectRatio: "none",
|
|
935
|
+
opacity: A.opacity,
|
|
936
|
+
crossOrigin: A.crossOrigin
|
|
937
|
+
}));
|
|
938
|
+
let N = b(j, D);
|
|
939
|
+
return /* @__PURE__ */ e.createElement("svg", o({
|
|
940
|
+
height: a,
|
|
941
|
+
width: a,
|
|
942
|
+
viewBox: `0 0 ${k} ${k}`,
|
|
943
|
+
ref: n,
|
|
944
|
+
role: "img"
|
|
945
|
+
}, E), !!S && /* @__PURE__ */ e.createElement("title", null, S), /* @__PURE__ */ e.createElement("path", {
|
|
946
|
+
fill: l,
|
|
947
|
+
d: `M0,0 h${k}v${k}H0z`,
|
|
948
|
+
shapeRendering: "crispEdges"
|
|
949
|
+
}), /* @__PURE__ */ e.createElement("path", {
|
|
950
|
+
fill: u,
|
|
951
|
+
d: N,
|
|
952
|
+
shapeRendering: "crispEdges"
|
|
953
|
+
}), M);
|
|
954
|
+
});
|
|
955
|
+
D.displayName = "QRCodeSVG";
|
|
956
|
+
//#endregion
|
|
957
|
+
export { D as QRCodeSVG };
|
|
958
|
+
|
|
959
|
+
//# sourceMappingURL=index.js.map
|