idmission-web-sdk 2.2.162 → 2.2.164

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.
Files changed (54) hide show
  1. package/dist/components/CompositeWizard.d.ts +2 -1
  2. package/dist/components/CompositeWizard.d.ts.map +1 -1
  3. package/dist/components/customer_flows/CustomerBiometricsEnrollment.d.ts +2 -0
  4. package/dist/components/customer_flows/CustomerBiometricsEnrollment.d.ts.map +1 -1
  5. package/dist/components/customer_flows/CustomerIdAndBiometricsEnrollment.d.ts +2 -0
  6. package/dist/components/customer_flows/CustomerIdAndBiometricsEnrollment.d.ts.map +1 -1
  7. package/dist/components/customer_flows/CustomerIdentification.d.ts +2 -0
  8. package/dist/components/customer_flows/CustomerIdentification.d.ts.map +1 -1
  9. package/dist/components/customer_flows/CustomerVerification.d.ts +2 -0
  10. package/dist/components/customer_flows/CustomerVerification.d.ts.map +1 -1
  11. package/dist/components/customer_flows/DocumentCapture.d.ts +2 -0
  12. package/dist/components/customer_flows/DocumentCapture.d.ts.map +1 -1
  13. package/dist/components/customer_flows/FaceValidation.d.ts +2 -0
  14. package/dist/components/customer_flows/FaceValidation.d.ts.map +1 -1
  15. package/dist/components/customer_flows/IdAndFaceValidation.d.ts +2 -0
  16. package/dist/components/customer_flows/IdAndFaceValidation.d.ts.map +1 -1
  17. package/dist/components/customer_flows/IdValidation.d.ts +2 -0
  18. package/dist/components/customer_flows/IdValidation.d.ts.map +1 -1
  19. package/dist/components/customer_flows/SignatureKYC.d.ts +2 -0
  20. package/dist/components/customer_flows/SignatureKYC.d.ts.map +1 -1
  21. package/dist/components/customer_flows/VideoIdValidation.d.ts +2 -0
  22. package/dist/components/customer_flows/VideoIdValidation.d.ts.map +1 -1
  23. package/dist/components/customer_identification/CustomerIdentificationWizard.d.ts +3 -0
  24. package/dist/components/customer_identification/CustomerIdentificationWizard.d.ts.map +1 -1
  25. package/dist/components/customer_verification/CustomerVerificationWizard.d.ts +3 -0
  26. package/dist/components/customer_verification/CustomerVerificationWizard.d.ts.map +1 -1
  27. package/dist/components/document_capture/DocumentCaptureWizard.d.ts +7 -2
  28. package/dist/components/document_capture/DocumentCaptureWizard.d.ts.map +1 -1
  29. package/dist/components/face_liveness/FaceLivenessWizard.d.ts +3 -0
  30. package/dist/components/face_liveness/FaceLivenessWizard.d.ts.map +1 -1
  31. package/dist/components/id_capture/IdCaptureWizard.d.ts +3 -0
  32. package/dist/components/id_capture/IdCaptureWizard.d.ts.map +1 -1
  33. package/dist/components/video_id/IdVideoCaptureWizard.d.ts +5 -1
  34. package/dist/components/video_id/IdVideoCaptureWizard.d.ts.map +1 -1
  35. package/dist/components/video_signature_capture/VideoSignatureWizard.d.ts +4 -0
  36. package/dist/components/video_signature_capture/VideoSignatureWizard.d.ts.map +1 -1
  37. package/dist/lib/camera/cameraStore.d.ts +21 -1
  38. package/dist/lib/camera/cameraStore.d.ts.map +1 -1
  39. package/dist/lib/locales/es.d.ts +2 -0
  40. package/dist/lib/locales/es.d.ts.map +1 -1
  41. package/dist/lib/locales/index.d.ts +2 -0
  42. package/dist/lib/locales/index.d.ts.map +1 -1
  43. package/dist/sdk2.cjs.development.js +2027 -1932
  44. package/dist/sdk2.cjs.development.js.map +1 -1
  45. package/dist/sdk2.cjs.production.js +1 -1
  46. package/dist/sdk2.cjs.production.js.map +1 -1
  47. package/dist/sdk2.esm.js +2028 -1933
  48. package/dist/sdk2.esm.js.map +1 -1
  49. package/dist/sdk2.umd.development.js +5715 -5620
  50. package/dist/sdk2.umd.development.js.map +1 -1
  51. package/dist/sdk2.umd.production.js +1 -1
  52. package/dist/sdk2.umd.production.js.map +1 -1
  53. package/dist/version.d.ts +1 -1
  54. package/package.json +1 -1
package/dist/sdk2.esm.js CHANGED
@@ -7,13 +7,13 @@ import { useTranslation, initReactI18next } from 'react-i18next';
7
7
  import { Upload } from 'tus-js-client';
8
8
  import SparkMD5 from 'spark-md5';
9
9
  import { ImageSegmenter, FilesetResolver, ImageClassifier, FaceDetector, ObjectDetector } from '@mediapipe/tasks-vision';
10
- import { createStore, useStore, create } from 'zustand';
10
+ import { useStore, createStore, create } from 'zustand';
11
+ import LanguageDetector from 'i18next-browser-languagedetector';
12
+ import i18n from 'i18next';
11
13
  import { useDebouncedCallback, useThrottledCallback } from 'use-debounce';
12
14
  import { devtools } from 'zustand/middleware';
13
15
  import { useShallow } from 'zustand/react/shallow';
14
16
  import { createPortal } from 'react-dom';
15
- import LanguageDetector from 'i18next-browser-languagedetector';
16
- import i18n from 'i18next';
17
17
  import SignatureCanvas from 'react-signature-canvas';
18
18
 
19
19
  /******************************************************************************
@@ -203,7 +203,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
203
203
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
204
204
  };
205
205
 
206
- var webSdkVersion = '2.2.162';
206
+ var webSdkVersion = '2.2.164';
207
207
 
208
208
  function getPlatform() {
209
209
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -364,7 +364,7 @@ function videoDataUrlToB64(url) {
364
364
  });
365
365
  }
366
366
 
367
- var PageContainerDiv = styled.div(templateObject_1$M || (templateObject_1$M = __makeTemplateObject(["\n ", "\n\n ", "\n\n &.flex {\n display: flex;\n }\n\n &.padded {\n box-sizing: border-box;\n padding: 16px 24px;\n }\n"], ["\n ", "\n\n ", "\n\n &.flex {\n display: flex;\n }\n\n &.padded {\n box-sizing: border-box;\n padding: 16px 24px;\n }\n"])), function (props) {
367
+ var PageContainerDiv = styled.div(templateObject_1$N || (templateObject_1$N = __makeTemplateObject(["\n ", "\n\n ", "\n\n &.flex {\n display: flex;\n }\n\n &.padded {\n box-sizing: border-box;\n padding: 16px 24px;\n }\n"], ["\n ", "\n\n ", "\n\n &.flex {\n display: flex;\n }\n\n &.padded {\n box-sizing: border-box;\n padding: 16px 24px;\n }\n"])), function (props) {
368
368
  var _a;
369
369
  return props.theme.isFullscreen === false ? "" : "\n position: fixed;\n top: 0;\n left: 0;\n width: var(--app-width);\n height: calc(\n var(--app-height) - ".concat((_a = props.$heightOffset) !== null && _a !== void 0 ? _a : 0, "px\n );\n overflow-x: hidden;\n overflow-y: auto;\n ");
370
370
  }, function (props) {
@@ -404,7 +404,7 @@ var PageContainer = /*#__PURE__*/forwardRef(function (_a, ref) {
404
404
  }, dimensionsCalculated && children);
405
405
  });
406
406
  PageContainer.displayName = 'PageContainer';
407
- var templateObject_1$M;
407
+ var templateObject_1$N;
408
408
 
409
409
  var LoaderButton = function LoaderButton(_a) {
410
410
  var children = _a.children,
@@ -461,18 +461,18 @@ var LoaderButton = function LoaderButton(_a) {
461
461
  className: "ladda-label"
462
462
  }, children));
463
463
  };
464
- var StyledButton = styled.button(templateObject_1$L || (templateObject_1$L = __makeTemplateObject(["\n ", "\n\n /*!\n * Ladda\n * http://lab.hakim.se/ladda\n * MIT licensed\n *\n * Copyright (C) 2018 Hakim El Hattab, http://hakim.se\n */\n\n position: relative;\n\n .ladda-spinner {\n position: absolute;\n z-index: 2;\n display: inline-block;\n width: 32px;\n top: 50%;\n margin-top: 0;\n opacity: 0;\n pointer-events: none;\n }\n .ladda-label {\n position: relative;\n z-index: 3;\n }\n .ladda-progress {\n position: absolute;\n width: 0;\n height: 100%;\n left: 0;\n top: 0;\n background: rgba(0, 0, 0, 0.2);\n display: none;\n transition: 0.1s linear all !important;\n }\n &[data-loading] .ladda-progress {\n display: block;\n }\n\n transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important;\n\n .ladda-spinner,\n .ladda-label {\n transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important;\n }\n &[data-style='zoom-in'],\n &[data-style='zoom-in'] .ladda-spinner,\n &[data-style='zoom-in'] .ladda-label,\n &[data-style='zoom-out'],\n &[data-style='zoom-out'] .ladda-spinner,\n &[data-style='zoom-out'] .ladda-label {\n transition: 0.3s ease all !important;\n }\n &[data-style='expand-right'] .ladda-spinner {\n right: -6px;\n }\n &[data-style='expand-right'][data-size='s'] .ladda-spinner,\n &[data-style='expand-right'][data-size='xs'] .ladda-spinner {\n right: -12px;\n }\n &[data-style='expand-right'][data-loading] {\n padding-right: 56px;\n }\n &[data-style='expand-right'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n &[data-style='expand-right'][data-loading][data-size='s'],\n &[data-style='expand-right'][data-loading][data-size='xs'] {\n padding-right: 40px;\n }\n &[data-style='expand-left'] .ladda-spinner {\n left: 26px;\n }\n &[data-style='expand-left'][data-size='s'] .ladda-spinner,\n &[data-style='expand-left'][data-size='xs'] .ladda-spinner {\n left: 4px;\n }\n &[data-style='expand-left'][data-loading] {\n padding-left: 56px;\n }\n &[data-style='expand-left'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n &[data-style='expand-left'][data-loading][data-size='s'],\n &[data-style='expand-left'][data-loading][data-size='xs'] {\n padding-left: 40px;\n }\n &[data-style='expand-up'] {\n overflow: hidden;\n }\n &[data-style='expand-up'] .ladda-spinner {\n top: -32px;\n left: 50%;\n margin-left: 0;\n }\n &[data-style='expand-up'][data-loading] {\n padding-top: 54px;\n }\n &[data-style='expand-up'][data-loading] .ladda-spinner {\n opacity: 1;\n top: 26px;\n margin-top: 0;\n }\n &[data-style='expand-up'][data-loading][data-size='s'],\n &[data-style='expand-up'][data-loading][data-size='xs'] {\n padding-top: 32px;\n }\n &[data-style='expand-up'][data-loading][data-size='s'] .ladda-spinner,\n &[data-style='expand-up'][data-loading][data-size='xs'] .ladda-spinner {\n top: 4px;\n }\n &[data-style='expand-down'] {\n overflow: hidden;\n }\n &[data-style='expand-down'] .ladda-spinner {\n top: 62px;\n left: 50%;\n margin-left: 0;\n }\n &[data-style='expand-down'][data-size='s'] .ladda-spinner,\n &[data-style='expand-down'][data-size='xs'] .ladda-spinner {\n top: 40px;\n }\n &[data-style='expand-down'][data-loading] {\n padding-bottom: 54px;\n }\n &[data-style='expand-down'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n &[data-style='expand-down'][data-loading][data-size='s'],\n &[data-style='expand-down'][data-loading][data-size='xs'] {\n padding-bottom: 32px;\n }\n &[data-style='slide-left'] {\n overflow: hidden;\n }\n &[data-style='slide-left'] .ladda-label {\n position: relative;\n }\n &[data-style='slide-left'] .ladda-spinner {\n left: 100%;\n margin-left: 0;\n }\n &[data-style='slide-left'][data-loading] .ladda-label {\n opacity: 0;\n left: -100%;\n }\n &[data-style='slide-left'][data-loading] .ladda-spinner {\n opacity: 1;\n left: 50%;\n }\n &[data-style='slide-right'] {\n overflow: hidden;\n }\n &[data-style='slide-right'] .ladda-label {\n position: relative;\n }\n &[data-style='slide-right'] .ladda-spinner {\n right: 100%;\n margin-left: 0;\n left: 16px;\n }\n [dir='rtl'] &[data-style='slide-right'] .ladda-spinner {\n right: auto;\n }\n &[data-style='slide-right'][data-loading] .ladda-label {\n opacity: 0;\n left: 100%;\n }\n &[data-style='slide-right'][data-loading] .ladda-spinner {\n opacity: 1;\n left: 50%;\n }\n &[data-style='slide-up'] {\n overflow: hidden;\n }\n &[data-style='slide-up'] .ladda-label {\n position: relative;\n }\n &[data-style='slide-up'] .ladda-spinner {\n left: 50%;\n margin-left: 0;\n margin-top: 1em;\n }\n &[data-style='slide-up'][data-loading] .ladda-label {\n opacity: 0;\n top: -1em;\n }\n &[data-style='slide-up'][data-loading] .ladda-spinner {\n opacity: 1;\n margin-top: 0;\n }\n &[data-style='slide-down'] {\n overflow: hidden;\n }\n &[data-style='slide-down'] .ladda-label {\n position: relative;\n }\n &[data-style='slide-down'] .ladda-spinner {\n left: 50%;\n margin-left: 0;\n margin-top: -2em;\n }\n &[data-style='slide-down'][data-loading] .ladda-label {\n opacity: 0;\n top: 1em;\n }\n &[data-style='slide-down'][data-loading] .ladda-spinner {\n opacity: 1;\n margin-top: 0;\n }\n &[data-style='zoom-out'] {\n overflow: hidden;\n }\n &[data-style='zoom-out'] .ladda-spinner {\n left: 50%;\n margin-left: 32px;\n transform: scale(2.5);\n }\n &[data-style='zoom-out'] .ladda-label {\n position: relative;\n display: inline-block;\n }\n &[data-style='zoom-out'][data-loading] .ladda-label {\n opacity: 0;\n transform: scale(0.5);\n }\n &[data-style='zoom-out'][data-loading] .ladda-spinner {\n opacity: 1;\n margin-left: 0;\n transform: none;\n }\n &[data-style='zoom-in'] {\n overflow: hidden;\n }\n &[data-style='zoom-in'] .ladda-spinner {\n left: 50%;\n margin-left: -16px;\n transform: scale(0.2);\n }\n &[data-style='zoom-in'] .ladda-label {\n position: relative;\n display: inline-block;\n }\n &[data-style='zoom-in'][data-loading] .ladda-label {\n opacity: 0;\n transform: scale(2.2);\n }\n &[data-style='zoom-in'][data-loading] .ladda-spinner {\n opacity: 1;\n margin-left: 0;\n transform: none;\n }\n &[data-style='contract'] {\n overflow: hidden;\n width: 100px;\n }\n &[data-style='contract'] .ladda-spinner {\n left: 50%;\n margin-left: 0;\n }\n &[data-style='contract'][data-loading] {\n border-radius: 50%;\n width: 52px;\n }\n &[data-style='contract'][data-loading] .ladda-label {\n opacity: 0;\n }\n &[data-style='contract'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n &[data-style='contract-overlay'] {\n overflow: hidden;\n width: 100px;\n box-shadow: 0px 0px 0px 2000px rgba(0, 0, 0, 0);\n }\n &[data-style='contract-overlay'] .ladda-spinner {\n left: 50%;\n margin-left: 0;\n }\n &[data-style='contract-overlay'][data-loading] {\n border-radius: 50%;\n width: 52px;\n box-shadow: 0px 0px 0px 2000px rgba(0, 0, 0, 0.8);\n }\n &[data-style='contract-overlay'][data-loading] .ladda-label {\n opacity: 0;\n }\n &[data-style='contract-overlay'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n [dir='rtl'] .ladda-spinner > div {\n left: 25% !important;\n }\n"], ["\n ", "\n\n /*!\n * Ladda\n * http://lab.hakim.se/ladda\n * MIT licensed\n *\n * Copyright (C) 2018 Hakim El Hattab, http://hakim.se\n */\n\n position: relative;\n\n .ladda-spinner {\n position: absolute;\n z-index: 2;\n display: inline-block;\n width: 32px;\n top: 50%;\n margin-top: 0;\n opacity: 0;\n pointer-events: none;\n }\n .ladda-label {\n position: relative;\n z-index: 3;\n }\n .ladda-progress {\n position: absolute;\n width: 0;\n height: 100%;\n left: 0;\n top: 0;\n background: rgba(0, 0, 0, 0.2);\n display: none;\n transition: 0.1s linear all !important;\n }\n &[data-loading] .ladda-progress {\n display: block;\n }\n\n transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important;\n\n .ladda-spinner,\n .ladda-label {\n transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important;\n }\n &[data-style='zoom-in'],\n &[data-style='zoom-in'] .ladda-spinner,\n &[data-style='zoom-in'] .ladda-label,\n &[data-style='zoom-out'],\n &[data-style='zoom-out'] .ladda-spinner,\n &[data-style='zoom-out'] .ladda-label {\n transition: 0.3s ease all !important;\n }\n &[data-style='expand-right'] .ladda-spinner {\n right: -6px;\n }\n &[data-style='expand-right'][data-size='s'] .ladda-spinner,\n &[data-style='expand-right'][data-size='xs'] .ladda-spinner {\n right: -12px;\n }\n &[data-style='expand-right'][data-loading] {\n padding-right: 56px;\n }\n &[data-style='expand-right'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n &[data-style='expand-right'][data-loading][data-size='s'],\n &[data-style='expand-right'][data-loading][data-size='xs'] {\n padding-right: 40px;\n }\n &[data-style='expand-left'] .ladda-spinner {\n left: 26px;\n }\n &[data-style='expand-left'][data-size='s'] .ladda-spinner,\n &[data-style='expand-left'][data-size='xs'] .ladda-spinner {\n left: 4px;\n }\n &[data-style='expand-left'][data-loading] {\n padding-left: 56px;\n }\n &[data-style='expand-left'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n &[data-style='expand-left'][data-loading][data-size='s'],\n &[data-style='expand-left'][data-loading][data-size='xs'] {\n padding-left: 40px;\n }\n &[data-style='expand-up'] {\n overflow: hidden;\n }\n &[data-style='expand-up'] .ladda-spinner {\n top: -32px;\n left: 50%;\n margin-left: 0;\n }\n &[data-style='expand-up'][data-loading] {\n padding-top: 54px;\n }\n &[data-style='expand-up'][data-loading] .ladda-spinner {\n opacity: 1;\n top: 26px;\n margin-top: 0;\n }\n &[data-style='expand-up'][data-loading][data-size='s'],\n &[data-style='expand-up'][data-loading][data-size='xs'] {\n padding-top: 32px;\n }\n &[data-style='expand-up'][data-loading][data-size='s'] .ladda-spinner,\n &[data-style='expand-up'][data-loading][data-size='xs'] .ladda-spinner {\n top: 4px;\n }\n &[data-style='expand-down'] {\n overflow: hidden;\n }\n &[data-style='expand-down'] .ladda-spinner {\n top: 62px;\n left: 50%;\n margin-left: 0;\n }\n &[data-style='expand-down'][data-size='s'] .ladda-spinner,\n &[data-style='expand-down'][data-size='xs'] .ladda-spinner {\n top: 40px;\n }\n &[data-style='expand-down'][data-loading] {\n padding-bottom: 54px;\n }\n &[data-style='expand-down'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n &[data-style='expand-down'][data-loading][data-size='s'],\n &[data-style='expand-down'][data-loading][data-size='xs'] {\n padding-bottom: 32px;\n }\n &[data-style='slide-left'] {\n overflow: hidden;\n }\n &[data-style='slide-left'] .ladda-label {\n position: relative;\n }\n &[data-style='slide-left'] .ladda-spinner {\n left: 100%;\n margin-left: 0;\n }\n &[data-style='slide-left'][data-loading] .ladda-label {\n opacity: 0;\n left: -100%;\n }\n &[data-style='slide-left'][data-loading] .ladda-spinner {\n opacity: 1;\n left: 50%;\n }\n &[data-style='slide-right'] {\n overflow: hidden;\n }\n &[data-style='slide-right'] .ladda-label {\n position: relative;\n }\n &[data-style='slide-right'] .ladda-spinner {\n right: 100%;\n margin-left: 0;\n left: 16px;\n }\n [dir='rtl'] &[data-style='slide-right'] .ladda-spinner {\n right: auto;\n }\n &[data-style='slide-right'][data-loading] .ladda-label {\n opacity: 0;\n left: 100%;\n }\n &[data-style='slide-right'][data-loading] .ladda-spinner {\n opacity: 1;\n left: 50%;\n }\n &[data-style='slide-up'] {\n overflow: hidden;\n }\n &[data-style='slide-up'] .ladda-label {\n position: relative;\n }\n &[data-style='slide-up'] .ladda-spinner {\n left: 50%;\n margin-left: 0;\n margin-top: 1em;\n }\n &[data-style='slide-up'][data-loading] .ladda-label {\n opacity: 0;\n top: -1em;\n }\n &[data-style='slide-up'][data-loading] .ladda-spinner {\n opacity: 1;\n margin-top: 0;\n }\n &[data-style='slide-down'] {\n overflow: hidden;\n }\n &[data-style='slide-down'] .ladda-label {\n position: relative;\n }\n &[data-style='slide-down'] .ladda-spinner {\n left: 50%;\n margin-left: 0;\n margin-top: -2em;\n }\n &[data-style='slide-down'][data-loading] .ladda-label {\n opacity: 0;\n top: 1em;\n }\n &[data-style='slide-down'][data-loading] .ladda-spinner {\n opacity: 1;\n margin-top: 0;\n }\n &[data-style='zoom-out'] {\n overflow: hidden;\n }\n &[data-style='zoom-out'] .ladda-spinner {\n left: 50%;\n margin-left: 32px;\n transform: scale(2.5);\n }\n &[data-style='zoom-out'] .ladda-label {\n position: relative;\n display: inline-block;\n }\n &[data-style='zoom-out'][data-loading] .ladda-label {\n opacity: 0;\n transform: scale(0.5);\n }\n &[data-style='zoom-out'][data-loading] .ladda-spinner {\n opacity: 1;\n margin-left: 0;\n transform: none;\n }\n &[data-style='zoom-in'] {\n overflow: hidden;\n }\n &[data-style='zoom-in'] .ladda-spinner {\n left: 50%;\n margin-left: -16px;\n transform: scale(0.2);\n }\n &[data-style='zoom-in'] .ladda-label {\n position: relative;\n display: inline-block;\n }\n &[data-style='zoom-in'][data-loading] .ladda-label {\n opacity: 0;\n transform: scale(2.2);\n }\n &[data-style='zoom-in'][data-loading] .ladda-spinner {\n opacity: 1;\n margin-left: 0;\n transform: none;\n }\n &[data-style='contract'] {\n overflow: hidden;\n width: 100px;\n }\n &[data-style='contract'] .ladda-spinner {\n left: 50%;\n margin-left: 0;\n }\n &[data-style='contract'][data-loading] {\n border-radius: 50%;\n width: 52px;\n }\n &[data-style='contract'][data-loading] .ladda-label {\n opacity: 0;\n }\n &[data-style='contract'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n &[data-style='contract-overlay'] {\n overflow: hidden;\n width: 100px;\n box-shadow: 0px 0px 0px 2000px rgba(0, 0, 0, 0);\n }\n &[data-style='contract-overlay'] .ladda-spinner {\n left: 50%;\n margin-left: 0;\n }\n &[data-style='contract-overlay'][data-loading] {\n border-radius: 50%;\n width: 52px;\n box-shadow: 0px 0px 0px 2000px rgba(0, 0, 0, 0.8);\n }\n &[data-style='contract-overlay'][data-loading] .ladda-label {\n opacity: 0;\n }\n &[data-style='contract-overlay'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n [dir='rtl'] .ladda-spinner > div {\n left: 25% !important;\n }\n"])), function (props) {
464
+ var StyledButton = styled.button(templateObject_1$M || (templateObject_1$M = __makeTemplateObject(["\n ", "\n\n /*!\n * Ladda\n * http://lab.hakim.se/ladda\n * MIT licensed\n *\n * Copyright (C) 2018 Hakim El Hattab, http://hakim.se\n */\n\n position: relative;\n\n .ladda-spinner {\n position: absolute;\n z-index: 2;\n display: inline-block;\n width: 32px;\n top: 50%;\n margin-top: 0;\n opacity: 0;\n pointer-events: none;\n }\n .ladda-label {\n position: relative;\n z-index: 3;\n }\n .ladda-progress {\n position: absolute;\n width: 0;\n height: 100%;\n left: 0;\n top: 0;\n background: rgba(0, 0, 0, 0.2);\n display: none;\n transition: 0.1s linear all !important;\n }\n &[data-loading] .ladda-progress {\n display: block;\n }\n\n transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important;\n\n .ladda-spinner,\n .ladda-label {\n transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important;\n }\n &[data-style='zoom-in'],\n &[data-style='zoom-in'] .ladda-spinner,\n &[data-style='zoom-in'] .ladda-label,\n &[data-style='zoom-out'],\n &[data-style='zoom-out'] .ladda-spinner,\n &[data-style='zoom-out'] .ladda-label {\n transition: 0.3s ease all !important;\n }\n &[data-style='expand-right'] .ladda-spinner {\n right: -6px;\n }\n &[data-style='expand-right'][data-size='s'] .ladda-spinner,\n &[data-style='expand-right'][data-size='xs'] .ladda-spinner {\n right: -12px;\n }\n &[data-style='expand-right'][data-loading] {\n padding-right: 56px;\n }\n &[data-style='expand-right'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n &[data-style='expand-right'][data-loading][data-size='s'],\n &[data-style='expand-right'][data-loading][data-size='xs'] {\n padding-right: 40px;\n }\n &[data-style='expand-left'] .ladda-spinner {\n left: 26px;\n }\n &[data-style='expand-left'][data-size='s'] .ladda-spinner,\n &[data-style='expand-left'][data-size='xs'] .ladda-spinner {\n left: 4px;\n }\n &[data-style='expand-left'][data-loading] {\n padding-left: 56px;\n }\n &[data-style='expand-left'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n &[data-style='expand-left'][data-loading][data-size='s'],\n &[data-style='expand-left'][data-loading][data-size='xs'] {\n padding-left: 40px;\n }\n &[data-style='expand-up'] {\n overflow: hidden;\n }\n &[data-style='expand-up'] .ladda-spinner {\n top: -32px;\n left: 50%;\n margin-left: 0;\n }\n &[data-style='expand-up'][data-loading] {\n padding-top: 54px;\n }\n &[data-style='expand-up'][data-loading] .ladda-spinner {\n opacity: 1;\n top: 26px;\n margin-top: 0;\n }\n &[data-style='expand-up'][data-loading][data-size='s'],\n &[data-style='expand-up'][data-loading][data-size='xs'] {\n padding-top: 32px;\n }\n &[data-style='expand-up'][data-loading][data-size='s'] .ladda-spinner,\n &[data-style='expand-up'][data-loading][data-size='xs'] .ladda-spinner {\n top: 4px;\n }\n &[data-style='expand-down'] {\n overflow: hidden;\n }\n &[data-style='expand-down'] .ladda-spinner {\n top: 62px;\n left: 50%;\n margin-left: 0;\n }\n &[data-style='expand-down'][data-size='s'] .ladda-spinner,\n &[data-style='expand-down'][data-size='xs'] .ladda-spinner {\n top: 40px;\n }\n &[data-style='expand-down'][data-loading] {\n padding-bottom: 54px;\n }\n &[data-style='expand-down'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n &[data-style='expand-down'][data-loading][data-size='s'],\n &[data-style='expand-down'][data-loading][data-size='xs'] {\n padding-bottom: 32px;\n }\n &[data-style='slide-left'] {\n overflow: hidden;\n }\n &[data-style='slide-left'] .ladda-label {\n position: relative;\n }\n &[data-style='slide-left'] .ladda-spinner {\n left: 100%;\n margin-left: 0;\n }\n &[data-style='slide-left'][data-loading] .ladda-label {\n opacity: 0;\n left: -100%;\n }\n &[data-style='slide-left'][data-loading] .ladda-spinner {\n opacity: 1;\n left: 50%;\n }\n &[data-style='slide-right'] {\n overflow: hidden;\n }\n &[data-style='slide-right'] .ladda-label {\n position: relative;\n }\n &[data-style='slide-right'] .ladda-spinner {\n right: 100%;\n margin-left: 0;\n left: 16px;\n }\n [dir='rtl'] &[data-style='slide-right'] .ladda-spinner {\n right: auto;\n }\n &[data-style='slide-right'][data-loading] .ladda-label {\n opacity: 0;\n left: 100%;\n }\n &[data-style='slide-right'][data-loading] .ladda-spinner {\n opacity: 1;\n left: 50%;\n }\n &[data-style='slide-up'] {\n overflow: hidden;\n }\n &[data-style='slide-up'] .ladda-label {\n position: relative;\n }\n &[data-style='slide-up'] .ladda-spinner {\n left: 50%;\n margin-left: 0;\n margin-top: 1em;\n }\n &[data-style='slide-up'][data-loading] .ladda-label {\n opacity: 0;\n top: -1em;\n }\n &[data-style='slide-up'][data-loading] .ladda-spinner {\n opacity: 1;\n margin-top: 0;\n }\n &[data-style='slide-down'] {\n overflow: hidden;\n }\n &[data-style='slide-down'] .ladda-label {\n position: relative;\n }\n &[data-style='slide-down'] .ladda-spinner {\n left: 50%;\n margin-left: 0;\n margin-top: -2em;\n }\n &[data-style='slide-down'][data-loading] .ladda-label {\n opacity: 0;\n top: 1em;\n }\n &[data-style='slide-down'][data-loading] .ladda-spinner {\n opacity: 1;\n margin-top: 0;\n }\n &[data-style='zoom-out'] {\n overflow: hidden;\n }\n &[data-style='zoom-out'] .ladda-spinner {\n left: 50%;\n margin-left: 32px;\n transform: scale(2.5);\n }\n &[data-style='zoom-out'] .ladda-label {\n position: relative;\n display: inline-block;\n }\n &[data-style='zoom-out'][data-loading] .ladda-label {\n opacity: 0;\n transform: scale(0.5);\n }\n &[data-style='zoom-out'][data-loading] .ladda-spinner {\n opacity: 1;\n margin-left: 0;\n transform: none;\n }\n &[data-style='zoom-in'] {\n overflow: hidden;\n }\n &[data-style='zoom-in'] .ladda-spinner {\n left: 50%;\n margin-left: -16px;\n transform: scale(0.2);\n }\n &[data-style='zoom-in'] .ladda-label {\n position: relative;\n display: inline-block;\n }\n &[data-style='zoom-in'][data-loading] .ladda-label {\n opacity: 0;\n transform: scale(2.2);\n }\n &[data-style='zoom-in'][data-loading] .ladda-spinner {\n opacity: 1;\n margin-left: 0;\n transform: none;\n }\n &[data-style='contract'] {\n overflow: hidden;\n width: 100px;\n }\n &[data-style='contract'] .ladda-spinner {\n left: 50%;\n margin-left: 0;\n }\n &[data-style='contract'][data-loading] {\n border-radius: 50%;\n width: 52px;\n }\n &[data-style='contract'][data-loading] .ladda-label {\n opacity: 0;\n }\n &[data-style='contract'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n &[data-style='contract-overlay'] {\n overflow: hidden;\n width: 100px;\n box-shadow: 0px 0px 0px 2000px rgba(0, 0, 0, 0);\n }\n &[data-style='contract-overlay'] .ladda-spinner {\n left: 50%;\n margin-left: 0;\n }\n &[data-style='contract-overlay'][data-loading] {\n border-radius: 50%;\n width: 52px;\n box-shadow: 0px 0px 0px 2000px rgba(0, 0, 0, 0.8);\n }\n &[data-style='contract-overlay'][data-loading] .ladda-label {\n opacity: 0;\n }\n &[data-style='contract-overlay'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n [dir='rtl'] .ladda-spinner > div {\n left: 25% !important;\n }\n"], ["\n ", "\n\n /*!\n * Ladda\n * http://lab.hakim.se/ladda\n * MIT licensed\n *\n * Copyright (C) 2018 Hakim El Hattab, http://hakim.se\n */\n\n position: relative;\n\n .ladda-spinner {\n position: absolute;\n z-index: 2;\n display: inline-block;\n width: 32px;\n top: 50%;\n margin-top: 0;\n opacity: 0;\n pointer-events: none;\n }\n .ladda-label {\n position: relative;\n z-index: 3;\n }\n .ladda-progress {\n position: absolute;\n width: 0;\n height: 100%;\n left: 0;\n top: 0;\n background: rgba(0, 0, 0, 0.2);\n display: none;\n transition: 0.1s linear all !important;\n }\n &[data-loading] .ladda-progress {\n display: block;\n }\n\n transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important;\n\n .ladda-spinner,\n .ladda-label {\n transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important;\n }\n &[data-style='zoom-in'],\n &[data-style='zoom-in'] .ladda-spinner,\n &[data-style='zoom-in'] .ladda-label,\n &[data-style='zoom-out'],\n &[data-style='zoom-out'] .ladda-spinner,\n &[data-style='zoom-out'] .ladda-label {\n transition: 0.3s ease all !important;\n }\n &[data-style='expand-right'] .ladda-spinner {\n right: -6px;\n }\n &[data-style='expand-right'][data-size='s'] .ladda-spinner,\n &[data-style='expand-right'][data-size='xs'] .ladda-spinner {\n right: -12px;\n }\n &[data-style='expand-right'][data-loading] {\n padding-right: 56px;\n }\n &[data-style='expand-right'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n &[data-style='expand-right'][data-loading][data-size='s'],\n &[data-style='expand-right'][data-loading][data-size='xs'] {\n padding-right: 40px;\n }\n &[data-style='expand-left'] .ladda-spinner {\n left: 26px;\n }\n &[data-style='expand-left'][data-size='s'] .ladda-spinner,\n &[data-style='expand-left'][data-size='xs'] .ladda-spinner {\n left: 4px;\n }\n &[data-style='expand-left'][data-loading] {\n padding-left: 56px;\n }\n &[data-style='expand-left'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n &[data-style='expand-left'][data-loading][data-size='s'],\n &[data-style='expand-left'][data-loading][data-size='xs'] {\n padding-left: 40px;\n }\n &[data-style='expand-up'] {\n overflow: hidden;\n }\n &[data-style='expand-up'] .ladda-spinner {\n top: -32px;\n left: 50%;\n margin-left: 0;\n }\n &[data-style='expand-up'][data-loading] {\n padding-top: 54px;\n }\n &[data-style='expand-up'][data-loading] .ladda-spinner {\n opacity: 1;\n top: 26px;\n margin-top: 0;\n }\n &[data-style='expand-up'][data-loading][data-size='s'],\n &[data-style='expand-up'][data-loading][data-size='xs'] {\n padding-top: 32px;\n }\n &[data-style='expand-up'][data-loading][data-size='s'] .ladda-spinner,\n &[data-style='expand-up'][data-loading][data-size='xs'] .ladda-spinner {\n top: 4px;\n }\n &[data-style='expand-down'] {\n overflow: hidden;\n }\n &[data-style='expand-down'] .ladda-spinner {\n top: 62px;\n left: 50%;\n margin-left: 0;\n }\n &[data-style='expand-down'][data-size='s'] .ladda-spinner,\n &[data-style='expand-down'][data-size='xs'] .ladda-spinner {\n top: 40px;\n }\n &[data-style='expand-down'][data-loading] {\n padding-bottom: 54px;\n }\n &[data-style='expand-down'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n &[data-style='expand-down'][data-loading][data-size='s'],\n &[data-style='expand-down'][data-loading][data-size='xs'] {\n padding-bottom: 32px;\n }\n &[data-style='slide-left'] {\n overflow: hidden;\n }\n &[data-style='slide-left'] .ladda-label {\n position: relative;\n }\n &[data-style='slide-left'] .ladda-spinner {\n left: 100%;\n margin-left: 0;\n }\n &[data-style='slide-left'][data-loading] .ladda-label {\n opacity: 0;\n left: -100%;\n }\n &[data-style='slide-left'][data-loading] .ladda-spinner {\n opacity: 1;\n left: 50%;\n }\n &[data-style='slide-right'] {\n overflow: hidden;\n }\n &[data-style='slide-right'] .ladda-label {\n position: relative;\n }\n &[data-style='slide-right'] .ladda-spinner {\n right: 100%;\n margin-left: 0;\n left: 16px;\n }\n [dir='rtl'] &[data-style='slide-right'] .ladda-spinner {\n right: auto;\n }\n &[data-style='slide-right'][data-loading] .ladda-label {\n opacity: 0;\n left: 100%;\n }\n &[data-style='slide-right'][data-loading] .ladda-spinner {\n opacity: 1;\n left: 50%;\n }\n &[data-style='slide-up'] {\n overflow: hidden;\n }\n &[data-style='slide-up'] .ladda-label {\n position: relative;\n }\n &[data-style='slide-up'] .ladda-spinner {\n left: 50%;\n margin-left: 0;\n margin-top: 1em;\n }\n &[data-style='slide-up'][data-loading] .ladda-label {\n opacity: 0;\n top: -1em;\n }\n &[data-style='slide-up'][data-loading] .ladda-spinner {\n opacity: 1;\n margin-top: 0;\n }\n &[data-style='slide-down'] {\n overflow: hidden;\n }\n &[data-style='slide-down'] .ladda-label {\n position: relative;\n }\n &[data-style='slide-down'] .ladda-spinner {\n left: 50%;\n margin-left: 0;\n margin-top: -2em;\n }\n &[data-style='slide-down'][data-loading] .ladda-label {\n opacity: 0;\n top: 1em;\n }\n &[data-style='slide-down'][data-loading] .ladda-spinner {\n opacity: 1;\n margin-top: 0;\n }\n &[data-style='zoom-out'] {\n overflow: hidden;\n }\n &[data-style='zoom-out'] .ladda-spinner {\n left: 50%;\n margin-left: 32px;\n transform: scale(2.5);\n }\n &[data-style='zoom-out'] .ladda-label {\n position: relative;\n display: inline-block;\n }\n &[data-style='zoom-out'][data-loading] .ladda-label {\n opacity: 0;\n transform: scale(0.5);\n }\n &[data-style='zoom-out'][data-loading] .ladda-spinner {\n opacity: 1;\n margin-left: 0;\n transform: none;\n }\n &[data-style='zoom-in'] {\n overflow: hidden;\n }\n &[data-style='zoom-in'] .ladda-spinner {\n left: 50%;\n margin-left: -16px;\n transform: scale(0.2);\n }\n &[data-style='zoom-in'] .ladda-label {\n position: relative;\n display: inline-block;\n }\n &[data-style='zoom-in'][data-loading] .ladda-label {\n opacity: 0;\n transform: scale(2.2);\n }\n &[data-style='zoom-in'][data-loading] .ladda-spinner {\n opacity: 1;\n margin-left: 0;\n transform: none;\n }\n &[data-style='contract'] {\n overflow: hidden;\n width: 100px;\n }\n &[data-style='contract'] .ladda-spinner {\n left: 50%;\n margin-left: 0;\n }\n &[data-style='contract'][data-loading] {\n border-radius: 50%;\n width: 52px;\n }\n &[data-style='contract'][data-loading] .ladda-label {\n opacity: 0;\n }\n &[data-style='contract'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n &[data-style='contract-overlay'] {\n overflow: hidden;\n width: 100px;\n box-shadow: 0px 0px 0px 2000px rgba(0, 0, 0, 0);\n }\n &[data-style='contract-overlay'] .ladda-spinner {\n left: 50%;\n margin-left: 0;\n }\n &[data-style='contract-overlay'][data-loading] {\n border-radius: 50%;\n width: 52px;\n box-shadow: 0px 0px 0px 2000px rgba(0, 0, 0, 0.8);\n }\n &[data-style='contract-overlay'][data-loading] .ladda-label {\n opacity: 0;\n }\n &[data-style='contract-overlay'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n [dir='rtl'] .ladda-spinner > div {\n left: 25% !important;\n }\n"])), function (props) {
465
465
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
466
466
  return ((_a = props.theme.buttons) === null || _a === void 0 ? void 0 : _a.style) === 'bootstrap' && "\n border-radius: 0;\n font-family: inherit;\n font-size: inherit;\n line-height: inherit;\n text-transform: none;\n -webkit-appearance: button;\n \n &:not(:disabled),\n &[type='button']:not(:disabled),\n &[type='reset']:not(:disabled),\n &[type='submit']:not(:disabled) {\n cursor: pointer;\n }\n \n &:focus:not(:focus-visible) {\n outline: 0;\n }\n \n --bs-btn-padding-x: 0.75rem;\n --bs-btn-padding-y: 0.375rem;\n --bs-btn-font-family: ;\n --bs-btn-font-size: 1rem;\n --bs-btn-font-weight: 400;\n --bs-btn-line-height: 1.5;\n --bs-btn-color: var(--bs-body-color);\n --bs-btn-bg: transparent;\n --bs-btn-border-width: var(--bs-border-width);\n --bs-btn-border-color: transparent;\n --bs-btn-border-radius: var(--bs-border-radius);\n --bs-btn-hover-border-color: transparent;\n --bs-btn-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15),\n 0 1px 1px rgba(0, 0, 0, 0.075);\n --bs-btn-disabled-opacity: 0.65;\n --bs-btn-focus-box-shadow: 0 0 0 0.25rem\n rgba(var(--bs-btn-focus-shadow-rgb), 0.5);\n display: inline-block;\n padding: var(--bs-btn-padding-y) var(--bs-btn-padding-x);\n font-family: var(--bs-btn-font-family);\n font-size: var(--bs-btn-font-size);\n font-weight: var(--bs-btn-font-weight);\n line-height: var(--bs-btn-line-height);\n color: var(--bs-btn-color);\n text-align: center;\n text-decoration: none;\n vertical-align: middle;\n cursor: pointer;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n border: var(--bs-btn-border-width) solid var(--bs-btn-border-color);\n border-radius: var(--bs-btn-border-radius);\n background-color: var(--bs-btn-bg);\n //transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out,\n // border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;\n \n @media (prefers-reduced-motion: reduce) {\n transition: none;\n }\n \n &:hover {\n filter: brightness(1.15);\n }\n \n &:focus-visible {\n color: var(--bs-btn-hover-color);\n background-color: var(--bs-btn-hover-bg);\n border-color: var(--bs-btn-hover-border-color);\n outline: 0;\n box-shadow: var(--bs-btn-focus-box-shadow);\n }\n \n &:disabled,\n &.disabled,\n fieldset:disabled & {\n color: var(--bs-btn-disabled-color);\n pointer-events: none;\n background-color: var(--bs-btn-disabled-bg);\n border-color: var(--bs-btn-disabled-border-color);\n opacity: var(--bs-btn-disabled-opacity);\n }\n \n --bs-btn-color: ".concat((_f = (_b = props.$textColor) !== null && _b !== void 0 ? _b : (_e = (_c = props.theme.buttons) === null || _c === void 0 ? void 0 : _c[(_d = props.$variant) !== null && _d !== void 0 ? _d : 'primary']) === null || _e === void 0 ? void 0 : _e.textColor) !== null && _f !== void 0 ? _f : '#fff', ";\n --bs-btn-bg: ").concat((_l = (_g = props.$backgroundColor) !== null && _g !== void 0 ? _g : (_k = (_h = props.theme.buttons) === null || _h === void 0 ? void 0 : _h[(_j = props.$variant) !== null && _j !== void 0 ? _j : 'primary']) === null || _k === void 0 ? void 0 : _k.backgroundColor) !== null && _l !== void 0 ? _l : '#0d6efd', ";\n --bs-btn-border-color: var(--bs-btn-bg);\n --bs-btn-focus-shadow-rgb: 49, 132, 253;\n --bs-btn-active-color: #fff;\n --bs-btn-active-bg: #0a58ca;\n --bs-btn-active-border-color: #0a53be;\n --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);\n --bs-btn-disabled-color: ").concat((_q = (_m = props.$disabledTextColor) !== null && _m !== void 0 ? _m : (_p = (_o = props.theme.buttons) === null || _o === void 0 ? void 0 : _o.loading) === null || _p === void 0 ? void 0 : _p.textColor) !== null && _q !== void 0 ? _q : '#fff', ";\n --bs-btn-disabled-bg: ").concat((_u = (_r = props.$disabledBackgroundColor) !== null && _r !== void 0 ? _r : (_t = (_s = props.theme.buttons) === null || _s === void 0 ? void 0 : _s.loading) === null || _t === void 0 ? void 0 : _t.backgroundColor) !== null && _u !== void 0 ? _u : 'gray', ";\n --bs-btn-disabled-border-color: ").concat((_v = props.$disabledBackgroundColor) !== null && _v !== void 0 ? _v : '#0d6efd', ";\n \n --bs-btn-padding-y: 14px;\n --bs-btn-padding-x: 1rem;\n --bs-btn-font-size: 18px;\n --bs-btn-border-radius: 4px;\n ");
467
467
  });
468
- var templateObject_1$L;
468
+ var templateObject_1$M;
469
469
 
470
- var OverlayContainer = styled(PageContainer)(templateObject_1$K || (templateObject_1$K = __makeTemplateObject(["\n background: ", ";\n ", "\n z-index: 10000;\n"], ["\n background: ", ";\n ", "\n z-index: 10000;\n"])), function (props) {
470
+ var OverlayContainer = styled(PageContainer)(templateObject_1$L || (templateObject_1$L = __makeTemplateObject(["\n background: ", ";\n ", "\n z-index: 10000;\n"], ["\n background: ", ";\n ", "\n z-index: 10000;\n"])), function (props) {
471
471
  return props.theme.background ? "".concat(props.theme.background) : "white";
472
472
  }, function (props) {
473
473
  return props.theme.textColor ? "color: ".concat(props.theme.textColor, ";") : "";
474
474
  });
475
- var OverlayInner$2 = styled.div(templateObject_2$B || (templateObject_2$B = __makeTemplateObject(["\n text-align: ", ";\n display: flex;\n flex-direction: column;\n flex-wrap: nowrap;\n max-width: 100dvw;\n max-height: 100dvh;\n width: 100%;\n height: 100%;\n ", "\n"], ["\n text-align: ", ";\n display: flex;\n flex-direction: column;\n flex-wrap: nowrap;\n max-width: 100dvw;\n max-height: 100dvh;\n width: 100%;\n height: 100%;\n ", "\n"])), function (props) {
475
+ var OverlayInner$2 = styled.div(templateObject_2$C || (templateObject_2$C = __makeTemplateObject(["\n text-align: ", ";\n display: flex;\n flex-direction: column;\n flex-wrap: nowrap;\n max-width: 100dvw;\n max-height: 100dvh;\n width: 100%;\n height: 100%;\n ", "\n"], ["\n text-align: ", ";\n display: flex;\n flex-direction: column;\n flex-wrap: nowrap;\n max-width: 100dvw;\n max-height: 100dvh;\n width: 100%;\n height: 100%;\n ", "\n"])), function (props) {
476
476
  var _a;
477
477
  return (_a = props.theme.textAlign) !== null && _a !== void 0 ? _a : 'center';
478
478
  }, function (props) {
@@ -493,7 +493,7 @@ var WideBorderButton = styled(WideButton)(templateObject_8$4 || (templateObject_
493
493
  var _a, _b;
494
494
  return (_b = (_a = props.colors) === null || _a === void 0 ? void 0 : _a.borderColor) !== null && _b !== void 0 ? _b : 'var(--idm-color-secondary-500)';
495
495
  });
496
- var templateObject_1$K, templateObject_2$B, templateObject_3$s, templateObject_4$m, templateObject_5$d, templateObject_6$a, templateObject_7$7, templateObject_8$4;
496
+ var templateObject_1$L, templateObject_2$C, templateObject_3$s, templateObject_4$m, templateObject_5$d, templateObject_6$a, templateObject_7$7, templateObject_8$4;
497
497
 
498
498
  var GeolocationAccessDeniedOverlay = function GeolocationAccessDeniedOverlay(_a) {
499
499
  var accessBlockedImageUrl = _a.accessBlockedImageUrl;
@@ -740,13 +740,13 @@ var SessionValidationErrorOverlay = function SessionValidationErrorOverlay(_a) {
740
740
  }, retryText)))));
741
741
  };
742
742
 
743
- var wavesAnimation = keyframes(templateObject_1$J || (templateObject_1$J = __makeTemplateObject(["\n 0% {\n opacity: 0;\n transform: scale3d(1, 1, 1);\n }\n 80% {\n opacity: 1;\n }\n 100% {\n transform: scale3d(2, 2, 1);\n opacity: 0;\n }\n"], ["\n 0% {\n opacity: 0;\n transform: scale3d(1, 1, 1);\n }\n 80% {\n opacity: 1;\n }\n 100% {\n transform: scale3d(2, 2, 1);\n opacity: 0;\n }\n"])));
744
- var progressBarAnimation = keyframes(templateObject_2$A || (templateObject_2$A = __makeTemplateObject(["\n 0% {\n width: 0;\n }\n 100% {\n width: 100%;\n }\n"], ["\n 0% {\n width: 0;\n }\n 100% {\n width: 100%;\n }\n"])));
743
+ var wavesAnimation = keyframes(templateObject_1$K || (templateObject_1$K = __makeTemplateObject(["\n 0% {\n opacity: 0;\n transform: scale3d(1, 1, 1);\n }\n 80% {\n opacity: 1;\n }\n 100% {\n transform: scale3d(2, 2, 1);\n opacity: 0;\n }\n"], ["\n 0% {\n opacity: 0;\n transform: scale3d(1, 1, 1);\n }\n 80% {\n opacity: 1;\n }\n 100% {\n transform: scale3d(2, 2, 1);\n opacity: 0;\n }\n"])));
744
+ var progressBarAnimation = keyframes(templateObject_2$B || (templateObject_2$B = __makeTemplateObject(["\n 0% {\n width: 0;\n }\n 100% {\n width: 100%;\n }\n"], ["\n 0% {\n width: 0;\n }\n 100% {\n width: 100%;\n }\n"])));
745
745
  var dualRingSpinnerAnimation = keyframes(templateObject_3$r || (templateObject_3$r = __makeTemplateObject(["\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n"], ["\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n"])));
746
746
  var progressBorderAnimation = keyframes(templateObject_4$l || (templateObject_4$l = __makeTemplateObject(["\n to {\n stroke-dashoffset: 0;\n }\n"], ["\n to {\n stroke-dashoffset: 0;\n }\n"])));
747
- var templateObject_1$J, templateObject_2$A, templateObject_3$r, templateObject_4$l;
747
+ var templateObject_1$K, templateObject_2$B, templateObject_3$r, templateObject_4$l;
748
748
 
749
- var Spinner = styled.div(templateObject_1$I || (templateObject_1$I = __makeTemplateObject(["\n display: inline-block;\n width: ", "px;\n height: ", "px;\n margin: auto;\n\n &:after {\n content: ' ';\n display: block;\n width: ", "px;\n height: ", "px;\n margin: 8px;\n border-radius: 50%;\n border: ", "px solid\n ", ";\n border-color: ", " transparent\n ", " transparent;\n animation: ", " 1.2s linear infinite;\n box-sizing: content-box;\n }\n"], ["\n display: inline-block;\n width: ", "px;\n height: ", "px;\n margin: auto;\n\n &:after {\n content: ' ';\n display: block;\n width: ", "px;\n height: ", "px;\n margin: 8px;\n border-radius: 50%;\n border: ", "px solid\n ", ";\n border-color: ", " transparent\n ", " transparent;\n animation: ", " 1.2s linear infinite;\n box-sizing: content-box;\n }\n"])), function (_a) {
749
+ var Spinner = styled.div(templateObject_1$J || (templateObject_1$J = __makeTemplateObject(["\n display: inline-block;\n width: ", "px;\n height: ", "px;\n margin: auto;\n\n &:after {\n content: ' ';\n display: block;\n width: ", "px;\n height: ", "px;\n margin: 8px;\n border-radius: 50%;\n border: ", "px solid\n ", ";\n border-color: ", " transparent\n ", " transparent;\n animation: ", " 1.2s linear infinite;\n box-sizing: content-box;\n }\n"], ["\n display: inline-block;\n width: ", "px;\n height: ", "px;\n margin: auto;\n\n &:after {\n content: ' ';\n display: block;\n width: ", "px;\n height: ", "px;\n margin: 8px;\n border-radius: 50%;\n border: ", "px solid\n ", ";\n border-color: ", " transparent\n ", " transparent;\n animation: ", " 1.2s linear infinite;\n box-sizing: content-box;\n }\n"])), function (_a) {
750
750
  var $size = _a.$size;
751
751
  return $size !== null && $size !== void 0 ? $size : 80;
752
752
  }, function (_a) {
@@ -771,7 +771,7 @@ var Spinner = styled.div(templateObject_1$I || (templateObject_1$I = __makeTempl
771
771
  var $color = _a.$color;
772
772
  return $color !== null && $color !== void 0 ? $color : '#888';
773
773
  }, dualRingSpinnerAnimation);
774
- var templateObject_1$I;
774
+ var templateObject_1$J;
775
775
 
776
776
  var defaultAuthUrl = 'https://portal-api.idmission.com';
777
777
  var allowedAuthUrls = ['https://portal-api.idmission.com', 'https://portal-api-uat.idmission.com', 'https://portal-api-demo.idmission.com', 'https://portal-api-dev.idmission.com', 'http://localhost:10000'];
@@ -2061,7 +2061,7 @@ function getFrameDimensions(frame) {
2061
2061
  return [frameWidth, frameHeight];
2062
2062
  }
2063
2063
 
2064
- var InvisibleCanvas = styled.canvas(templateObject_1$H || (templateObject_1$H = __makeTemplateObject(["\n display: none;\n"], ["\n display: none;\n"])));
2064
+ var InvisibleCanvas = styled.canvas(templateObject_1$I || (templateObject_1$I = __makeTemplateObject(["\n display: none;\n"], ["\n display: none;\n"])));
2065
2065
  function drawToCanvas(canvas, frame, width, height) {
2066
2066
  if (!canvas) return;
2067
2067
  var ctx = canvas.getContext('2d');
@@ -2081,7 +2081,7 @@ function clearCanvas(canvas) {
2081
2081
  var _a;
2082
2082
  (_a = canvas === null || canvas === void 0 ? void 0 : canvas.getContext('2d')) === null || _a === void 0 ? void 0 : _a.clearRect(0, 0, canvas === null || canvas === void 0 ? void 0 : canvas.width, canvas === null || canvas === void 0 ? void 0 : canvas.height);
2083
2083
  }
2084
- var templateObject_1$H;
2084
+ var templateObject_1$I;
2085
2085
 
2086
2086
  function cropToShoulders(rawCanvas, cropCanvas, resizeCanvas, frame, face, quality, maxHeight) {
2087
2087
  if (quality === void 0) {
@@ -3504,1690 +3504,133 @@ function releaseCameraAccess() {
3504
3504
  currentCamera = undefined;
3505
3505
  }
3506
3506
 
3507
- var initialState$5 = {
3508
- videoRef: {
3509
- current: null
3510
- },
3511
- videoLoaded: false,
3512
- videoStream: null,
3513
- videoDevice: null,
3514
- isRearFacing: false,
3515
- camera: null,
3516
- cameraReady: false,
3517
- cameraAccessDenied: false,
3518
- iphoneContinuityCameraAvailable: false,
3519
- iphoneContinuityCameraDenied: false,
3520
- preferIphoneContinuityCamera: true,
3521
- audioStream: null,
3522
- microphoneReady: false,
3523
- microphoneAccessDenied: false
3524
- };
3525
- var createCameraStore = function createCameraStore(config) {
3526
- var store = createStore(function (set, get) {
3527
- return _assign(_assign(_assign({}, initialState$5), config), {
3528
- reset: function reset() {
3529
- return set(_assign(_assign({}, initialState$5), config));
3530
- },
3531
- setConfig: function setConfig(config) {
3532
- return set(config);
3533
- },
3534
- onVideoMounted: function onVideoMounted(e) {
3535
- var _a;
3536
- var selectedVideoStreamId = (_a = get().videoStream) === null || _a === void 0 ? void 0 : _a.id;
3537
- if (!selectedVideoStreamId) return;
3538
- var srcObject = e.currentTarget.srcObject;
3539
- if (srcObject.id !== selectedVideoStreamId) {
3540
- warn('camera tampering detected, reloading the page.');
3541
- window.location.reload();
3542
- return;
3543
- }
3544
- set({
3545
- videoLoaded: true
3546
- });
3547
- },
3548
- setIphoneContinuityCameraAllowed: function setIphoneContinuityCameraAllowed(value) {
3549
- return set({
3550
- preferIphoneContinuityCamera: value
3551
- });
3552
- },
3553
- requestCameraAccess: function requestCameraAccess() {
3554
- return __awaiter(this, void 0, void 0, function () {
3555
- var _a, videoRef, releaseCameraAccess, preferFrontFacingCamera, preferIphoneContinuityCamera, iphoneContinuityCameraDenied, availableCameras, selectedCamera, platform_1, iphoneContinuityCamera, constraints, stream_1, e_1, e_2, handleStreamEnded_1, videoTrack_1, camera_1, e_3;
3556
- var _b, _c, _d;
3557
- return __generator(this, function (_e) {
3558
- switch (_e.label) {
3559
- case 0:
3560
- _a = get(), videoRef = _a.videoRef, releaseCameraAccess = _a.releaseCameraAccess, preferFrontFacingCamera = _a.preferFrontFacingCamera, preferIphoneContinuityCamera = _a.preferIphoneContinuityCamera, iphoneContinuityCameraDenied = _a.iphoneContinuityCameraDenied;
3561
- releaseCameraAccess();
3562
- _e.label = 1;
3563
- case 1:
3564
- _e.trys.push([1, 11,, 12]);
3565
- return [4 /*yield*/, listAvailableCameras()];
3566
- case 2:
3567
- availableCameras = _e.sent();
3568
- selectedCamera = void 0;
3569
- debug('availableCameras', availableCameras);
3570
- platform_1 = getPlatform();
3571
- debug('platformDetails', platform_1);
3572
- if (!iphoneContinuityCameraDenied && (!(platform_1 === null || platform_1 === void 0 ? void 0 : platform_1.os) || platform_1.os.family === 'OS X')) {
3573
- iphoneContinuityCamera = availableCameras.find(function (deviceInfo) {
3574
- return cameraLabelMatches(deviceInfo, 'iphone');
3575
- });
3576
- set({
3577
- iphoneContinuityCameraAvailable: !!iphoneContinuityCamera
3578
- });
3579
- if (iphoneContinuityCamera && preferIphoneContinuityCamera) {
3580
- selectedCamera = iphoneContinuityCamera;
3581
- }
3582
- } else if (((_b = platform_1 === null || platform_1 === void 0 ? void 0 : platform_1.os) === null || _b === void 0 ? void 0 : _b.family) === 'Android' || availableCameras.every(function (c) {
3583
- return c.label.startsWith('camera2 ');
3584
- })) {
3585
- availableCameras = availableCameras.sort(function (a, b) {
3586
- return a.label.toLowerCase().localeCompare(b.label.toLowerCase());
3587
- });
3588
- debug('cameras have been sorted', availableCameras);
3589
- }
3590
- if (preferFrontFacingCamera) {
3591
- selectedCamera = availableCameras.find(function (deviceInfo) {
3592
- return cameraLabelMatches(deviceInfo, frontCameraLabels);
3593
- });
3594
- }
3595
- selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
3596
- return cameraLabelMatches(deviceInfo, 'backtriplecamera');
3597
- }));
3598
- selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
3599
- return cameraLabelMatches(deviceInfo, 'backdualcamera');
3600
- }));
3601
- selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
3602
- return cameraLabelMatches(deviceInfo, rearCameraLabels) && !cameraLabelMatches(deviceInfo, backUltraWideCameraLabels);
3603
- }));
3604
- selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
3605
- return cameraLabelMatches(deviceInfo, rearCameraLabels);
3606
- }));
3607
- // on iOS, the front facing camera always is at the first position in the list, so we skip it if all else fails.
3608
- if (!preferFrontFacingCamera && ((_c = platform_1 === null || platform_1 === void 0 ? void 0 : platform_1.os) === null || _c === void 0 ? void 0 : _c.family) === 'iOS' && availableCameras.length > 0) {
3609
- selectedCamera || (selectedCamera = availableCameras[1]);
3610
- }
3611
- selectedCamera || (selectedCamera = availableCameras[0]);
3612
- debug('selectedCamera', selectedCamera);
3613
- set({
3614
- videoDevice: selectedCamera
3615
- });
3616
- constraints = {
3617
- audio: false,
3618
- video: {
3619
- deviceId: {
3620
- exact: selectedCamera.deviceId
3621
- },
3622
- width: {
3623
- ideal: config.maxVideoWidth
3624
- },
3625
- aspectRatio: 1.777777778,
3626
- frameRate: {}
3627
- }
3628
- };
3629
- if (config.maxFps) {
3630
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
3631
- // @ts-ignore
3632
- constraints.video.frameRate = {
3633
- max: config.maxFps
3634
- };
3635
- }
3636
- stream_1 = null;
3637
- _e.label = 3;
3638
- case 3:
3639
- _e.trys.push([3, 5,, 6]);
3640
- debug('obtaining camera access with constraints', constraints);
3641
- return [4 /*yield*/, navigator.mediaDevices.getUserMedia(constraints)];
3642
- case 4:
3643
- stream_1 = _e.sent();
3644
- return [3 /*break*/, 6];
3645
- case 5:
3646
- e_1 = _e.sent();
3647
- if (e_1.name === 'NotAllowedError') {
3648
- if (preferIphoneContinuityCamera) {
3649
- set({
3650
- iphoneContinuityCameraAvailable: false,
3651
- iphoneContinuityCameraDenied: true
3652
- });
3653
- } else {
3654
- set({
3655
- cameraAccessDenied: true
3656
- });
3657
- }
3658
- return [2 /*return*/];
3659
- }
3660
- return [3 /*break*/, 6];
3661
- case 6:
3662
- if (!!stream_1) return [3 /*break*/, 10];
3663
- _e.label = 7;
3664
- case 7:
3665
- _e.trys.push([7, 9,, 10]);
3666
- return [4 /*yield*/, navigator.mediaDevices.getUserMedia({
3667
- audio: false,
3668
- video: true
3669
- })];
3670
- case 8:
3671
- stream_1 = _e.sent();
3672
- debug('opened stream with no width and height constraints');
3673
- return [3 /*break*/, 10];
3674
- case 9:
3675
- e_2 = _e.sent();
3676
- debug('cannot open stream at all', e_2);
3677
- return [3 /*break*/, 10];
3678
- case 10:
3679
- if (!stream_1) {
3680
- error('failed to open camera');
3681
- throw new Error('failed to open camera: ');
3682
- }
3683
- debug('camera access granted with constraints', constraints);
3684
- handleStreamEnded_1 = function handleStreamEnded_1() {
3685
- if (preferIphoneContinuityCamera && get().iphoneContinuityCameraAvailable) {
3686
- debug('someone unplugged the continuity camera');
3687
- set({
3688
- videoStream: null,
3689
- videoDevice: null,
3690
- cameraReady: false,
3691
- iphoneContinuityCameraAvailable: false,
3692
- iphoneContinuityCameraDenied: true
3693
- });
3694
- get().requestCameraAccess();
3695
- } else {
3696
- debug('someone unplugged the webcam');
3697
- releaseCameraAccess();
3698
- set({
3699
- videoStream: null,
3700
- videoDevice: null,
3701
- videoLoaded: false,
3702
- cameraReady: false,
3703
- cameraAccessDenied: true
3704
- });
3705
- }
3706
- };
3707
- (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.addEventListener('ended', handleStreamEnded_1);
3708
- videoTrack_1 = stream_1.getVideoTracks()[0];
3709
- videoTrack_1.onended = handleStreamEnded_1;
3710
- camera_1 = obtainCameraAccess(stream_1, selectedCamera.label, videoRef.current);
3711
- setTimeout(function () {
3712
- // iOS 17 has a strange behavior where the video track flickers between muted and unmuted
3713
- // when the camera access is being requested. This delay is a workaround for that.
3714
- videoTrack_1.onmute = function () {
3715
- if (videoTrack_1.readyState !== 'live') handleStreamEnded_1();
3716
- };
3717
- set({
3718
- camera: camera_1,
3719
- cameraReady: true,
3720
- cameraAccessDenied: false,
3721
- isRearFacing: camera_1.isRearFacing,
3722
- videoStream: stream_1
3723
- });
3724
- }, 500);
3725
- return [3 /*break*/, 12];
3726
- case 11:
3727
- e_3 = _e.sent();
3728
- if (e_3.name === 'NotAllowedError') {
3729
- error('camera access has been blocked by the user', e_3);
3730
- set({
3731
- cameraAccessDenied: true
3732
- });
3733
- } else {
3734
- error('camera access encountered some other error', e_3);
3735
- throw e_3;
3736
- }
3737
- return [3 /*break*/, 12];
3738
- case 12:
3739
- return [2 /*return*/];
3740
- }
3741
- });
3742
- });
3743
- },
3744
- releaseCameraAccess: function releaseCameraAccess() {
3745
- return __awaiter(this, void 0, void 0, function () {
3746
- var camera;
3747
- return __generator(this, function (_a) {
3748
- camera = get().camera;
3749
- if (!camera) return [2 /*return*/];
3750
- camera.release();
3751
- set({
3752
- camera: null,
3753
- cameraReady: false,
3754
- cameraAccessDenied: false
3755
- });
3756
- return [2 /*return*/];
3757
- });
3758
- });
3759
- },
3760
- requestMicrophoneAccess: function requestMicrophoneAccess() {
3761
- return __awaiter(this, void 0, void 0, function () {
3762
- var stream_2, e_4;
3763
- return __generator(this, function (_a) {
3764
- switch (_a.label) {
3765
- case 0:
3766
- get().releaseMicrophoneAccess();
3767
- _a.label = 1;
3768
- case 1:
3769
- _a.trys.push([1, 3,, 4]);
3770
- return [4 /*yield*/, navigator.mediaDevices.getUserMedia({
3771
- audio: true,
3772
- video: false
3773
- })
3774
- // iOS 17 has a strange behavior where the video track flickers between muted and unmuted
3775
- // when the camera access is being requested. This delay is a workaround for that.
3776
- ];
3777
- case 2:
3778
- stream_2 = _a.sent();
3779
- // iOS 17 has a strange behavior where the video track flickers between muted and unmuted
3780
- // when the camera access is being requested. This delay is a workaround for that.
3781
- setTimeout(function () {
3782
- set({
3783
- audioStream: stream_2,
3784
- microphoneReady: true,
3785
- microphoneAccessDenied: false
3786
- });
3787
- var handleStreamEnded = function handleStreamEnded() {
3788
- set({
3789
- microphoneReady: false,
3790
- microphoneAccessDenied: true
3791
- });
3792
- };
3793
- var track = stream_2.getAudioTracks()[0];
3794
- track.onended = handleStreamEnded;
3795
- track.onmute = function () {
3796
- if (track.readyState !== 'live') handleStreamEnded();
3797
- };
3798
- }, 500);
3799
- return [3 /*break*/, 4];
3800
- case 3:
3801
- e_4 = _a.sent();
3802
- debug('failed to open microphone', e_4);
3803
- set({
3804
- microphoneAccessDenied: true
3805
- });
3806
- return [3 /*break*/, 4];
3807
- case 4:
3808
- return [2 /*return*/];
3809
- }
3810
- });
3811
- });
3812
- },
3813
- releaseMicrophoneAccess: function releaseMicrophoneAccess() {
3814
- var _a;
3815
- var audioStream = get().audioStream;
3816
- (_a = audioStream === null || audioStream === void 0 ? void 0 : audioStream.stop) === null || _a === void 0 ? void 0 : _a.call(audioStream);
3817
- audioStream === null || audioStream === void 0 ? void 0 : audioStream.getAudioTracks().forEach(function (track) {
3818
- var _a;
3819
- (_a = track.stop) === null || _a === void 0 ? void 0 : _a.call(track);
3820
- });
3821
- set({
3822
- audioStream: null,
3823
- microphoneReady: false,
3824
- microphoneAccessDenied: false
3825
- });
3826
- }
3827
- });
3828
- });
3829
- if (config.requestAccessAutomatically) {
3830
- void store.getState().requestCameraAccess();
3831
- }
3832
- return _assign(_assign({}, store), {
3833
- destroy: function destroy() {
3834
- store.getState().releaseCameraAccess();
3835
- store.getState().releaseMicrophoneAccess();
3836
- }
3837
- });
3838
- };
3839
- var CameraStoreContext = /*#__PURE__*/createContext(undefined);
3840
- function CameraStoreProvider(_a) {
3841
- var children = _a.children,
3842
- _b = _a.requestAccessAutomatically,
3843
- requestAccessAutomatically = _b === void 0 ? true : _b,
3844
- _c = _a.preferIphoneContinuityCamera,
3845
- preferIphoneContinuityCamera = _c === void 0 ? true : _c,
3846
- _d = _a.preferFrontFacingCamera,
3847
- preferFrontFacingCamera = _d === void 0 ? false : _d,
3848
- _e = _a.maxVideoWidth,
3849
- maxVideoWidth = _e === void 0 ? 1920 : _e,
3850
- maxFps = _a.maxFps,
3851
- onCameraAccessDenied = _a.onCameraAccessDenied,
3852
- onMicrophoneAccessDenied = _a.onMicrophoneAccessDenied,
3853
- _f = _a.requireMicrophoneAccess,
3854
- requireMicrophoneAccess = _f === void 0 ? false : _f;
3855
- var videoRef = useRef(null);
3856
- var store = useRef();
3857
- store.current || (store.current = createCameraStore({
3858
- videoRef: videoRef,
3859
- requestAccessAutomatically: requestAccessAutomatically,
3860
- preferIphoneContinuityCamera: preferIphoneContinuityCamera,
3861
- preferFrontFacingCamera: preferFrontFacingCamera,
3862
- maxVideoWidth: maxVideoWidth,
3863
- maxFps: maxFps,
3864
- onCameraAccessDenied: onCameraAccessDenied,
3865
- onMicrophoneAccessDenied: onMicrophoneAccessDenied,
3866
- requireMicrophoneAccess: requireMicrophoneAccess
3867
- }));
3868
- useEffect(function () {
3869
- var _a, _b, _c;
3870
- var state = (_a = store.current) === null || _a === void 0 ? void 0 : _a.getState();
3871
- if (!state) return;
3872
- if (preferIphoneContinuityCamera !== (state === null || state === void 0 ? void 0 : state.preferIphoneContinuityCamera) || preferFrontFacingCamera !== (state === null || state === void 0 ? void 0 : state.preferFrontFacingCamera)) {
3873
- (_b = store.current) === null || _b === void 0 ? void 0 : _b.setState({
3874
- preferIphoneContinuityCamera: preferIphoneContinuityCamera,
3875
- preferFrontFacingCamera: preferFrontFacingCamera
3876
- });
3877
- (_c = store.current) === null || _c === void 0 ? void 0 : _c.getState().requestCameraAccess();
3878
- }
3879
- }, [preferFrontFacingCamera, preferIphoneContinuityCamera]);
3880
- useEffect(function () {
3881
- var _a;
3882
- if (requireMicrophoneAccess) {
3883
- (_a = store.current) === null || _a === void 0 ? void 0 : _a.getState().requestMicrophoneAccess();
3884
- }
3885
- }, [requireMicrophoneAccess]);
3886
- useEffect(function () {
3887
- return function () {
3888
- var _a;
3889
- return (_a = store.current) === null || _a === void 0 ? void 0 : _a.destroy();
3890
- };
3891
- }, []);
3892
- return /*#__PURE__*/React__default.createElement(CameraStoreContext.Provider, {
3893
- value: store.current
3894
- }, children);
3895
- }
3896
- function useCameraStore(selector) {
3897
- var store = useContext(CameraStoreContext);
3898
- if (!store) throw new Error('useCameraStore cannot be used without Provider');
3899
- return useStore(store, selector);
3900
- }
3901
-
3902
- var DocumentDetectionModelContext = /*#__PURE__*/createContext({
3903
- startDocumentDetection: function startDocumentDetection() {
3904
- return null;
3905
- },
3906
- stopDocumentDetection: function stopDocumentDetection() {
3907
- return null;
3908
- },
3909
- loadDocumentDetectionModel: function loadDocumentDetectionModel() {
3910
- return null;
3911
- },
3912
- documentDetectionModelReady: false,
3913
- documentDetectionModelDownloadProgress: 0,
3914
- documentDetectionModelError: null,
3915
- onDocumentDetected: function onDocumentDetected() {
3916
- return null;
3917
- },
3918
- detectionTime: 0,
3919
- documentDetectionThresholds: {},
3920
- setDocumentDetectionThresholds: function setDocumentDetectionThresholds() {
3921
- return null;
3922
- },
3923
- documentDetectionBoundaries: defaultDocumentDetectionBoundaries,
3924
- setDocumentDetectionBoundaries: function setDocumentDetectionBoundaries() {
3925
- return null;
3926
- },
3927
- documentDetectionLastPredictionCanvas: {
3928
- current: null
3929
- },
3930
- clearDocumentDetectionLastPredictionCanvas: function clearDocumentDetectionLastPredictionCanvas() {
3931
- return null;
3932
- }
3933
- });
3934
- function DocumentDetectionModelProvider(_a) {
3935
- var _this = this;
3936
- var _b = _a.autoStart,
3937
- autoStart = _b === void 0 ? true : _b,
3938
- children = _a.children,
3939
- _c = _a.throttleMs,
3940
- throttleMs = _c === void 0 ? 16 : _c,
3941
- _d = _a.delayAfterStartMs,
3942
- delayAfterStartMs = _d === void 0 ? 0 : _d,
3943
- _e = _a.documentDetectionModelPath,
3944
- documentDetectionModelPath = _e === void 0 ? defaultDocumentDetectorModelPath : _e,
3945
- _f = _a.documentDetectionModelScoreThreshold,
3946
- documentDetectionModelScoreThreshold = _f === void 0 ? defaultDocumentDetectionScoreThreshold : _f,
3947
- _g = _a.documentDetectionModelLoadTimeoutMs,
3948
- documentDetectionModelLoadTimeoutMs = _g === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _g,
3949
- onDocumentDetectionModelError = _a.onDocumentDetectionModelError,
3950
- _h = _a.shouldLoadModels,
3951
- shouldLoadModelsProp = _h === void 0 ? true : _h;
3952
- var _j = useCameraStore(),
3953
- videoRef = _j.videoRef,
3954
- videoLoaded = _j.videoLoaded,
3955
- cameraReady = _j.cameraReady;
3956
- var lastPredictionCanvas = useRef(null);
3957
- var onPredictionHandler = useRef();
3958
- var _k = useState({}),
3959
- documentDetectionThresholds = _k[0],
3960
- setDocumentDetectionThresholds = _k[1];
3961
- var _l = useState(defaultDocumentDetectionBoundaries),
3962
- documentDetectionBoundaries = _l[0],
3963
- setDocumentDetectionBoundaries = _l[1];
3964
- var _m = useState(0),
3965
- timesAllZero = _m[0],
3966
- setTimesAllZero = _m[1];
3967
- var _o = useState(0),
3968
- canvasKey = _o[0],
3969
- setCanvasKey = _o[1];
3970
- var stopDetection = useRef(0);
3971
- var _p = useState(shouldLoadModelsProp),
3972
- shouldLoadModels = _p[0],
3973
- setShouldLoadModels = _p[1];
3974
- var load = useCallback(function () {
3975
- return setShouldLoadModels(true);
3976
- }, []);
3977
- var _q = useLoadDocumentDetector({
3978
- modelPath: documentDetectionModelPath,
3979
- modelLoadTimeoutMs: documentDetectionModelLoadTimeoutMs,
3980
- scoreThreshold: documentDetectionModelScoreThreshold,
3981
- onModelError: onDocumentDetectionModelError,
3982
- videoRef: videoRef,
3983
- shouldLoadModels: shouldLoadModels
3984
- }),
3985
- ready = _q.ready,
3986
- modelDownloadProgress = _q.modelDownloadProgress,
3987
- modelError = _q.modelError,
3988
- setModelError = _q.setModelError;
3989
- var _r = useFrameLoop(useCallback(function (frameId, timeRunning) {
3990
- return __awaiter(_this, void 0, void 0, function () {
3991
- var stopDetectionAtStart, vw, vh, ctx, prediction, processedPrediction;
3992
- var _a;
3993
- return __generator(this, function (_b) {
3994
- switch (_b.label) {
3995
- case 0:
3996
- if (!videoLoaded || !cameraReady || !ready || !videoRef.current || !lastPredictionCanvas.current) return [2 /*return*/];
3997
- stopDetectionAtStart = stopDetection.current;
3998
- vw = videoRef.current.videoWidth;
3999
- vh = videoRef.current.videoHeight;
4000
- lastPredictionCanvas.current.width = vw;
4001
- lastPredictionCanvas.current.height = vh;
4002
- ctx = lastPredictionCanvas.current.getContext('2d');
4003
- if (!(ctx && videoRef.current.readyState === 4)) return [3 /*break*/, 3];
4004
- if (stopDetectionAtStart !== stopDetection.current) return [2 /*return*/];
4005
- ctx.drawImage(videoRef.current, 0, 0, vw, vh);
4006
- return [4 /*yield*/, makeDocumentDetectorPrediction(lastPredictionCanvas.current)];
4007
- case 1:
4008
- prediction = _b.sent();
4009
- if (!prediction) return [3 /*break*/, 3];
4010
- processedPrediction = processDocumentDetectorPrediction(prediction, documentDetectionThresholds, documentDetectionBoundaries);
4011
- processedPrediction.frameId = frameId;
4012
- setLastDetectionAt(new Date().getTime());
4013
- debug(processedPrediction);
4014
- if (processedPrediction.allZero) setTimesAllZero(function (n) {
4015
- return n + 1;
4016
- });
4017
- if (stopDetectionAtStart !== stopDetection.current) return [2 /*return*/];
4018
- if (timeRunning < delayAfterStartMs) return [2 /*return*/];
4019
- return [4 /*yield*/, (_a = onPredictionHandler.current) === null || _a === void 0 ? void 0 : _a.call(onPredictionHandler, processedPrediction)];
4020
- case 2:
4021
- _b.sent();
4022
- _b.label = 3;
4023
- case 3:
4024
- return [2 /*return*/];
4025
- }
4026
- });
4027
- });
4028
- }, [cameraReady, delayAfterStartMs, documentDetectionBoundaries, documentDetectionThresholds, ready, videoLoaded, videoRef]), {
4029
- throttleMs: throttleMs,
4030
- autoStart: autoStart
4031
- }),
4032
- start = _r.start,
4033
- stop = _r.stop;
4034
- useEffect(function setErrorIfAllZero() {
4035
- if (timesAllZero >= 2) {
4036
- setModelError(new Error('model is returning all zeroes'));
4037
- }
4038
- }, [setModelError, timesAllZero]);
4039
- var onDocumentDetected = useCallback(function (handler) {
4040
- onPredictionHandler.current = handler;
4041
- }, []);
4042
- var clearDocumentDetectionLastPredictionCanvas = useCallback(function () {
4043
- stopDetection.current += 1;
4044
- setCanvasKey(function (n) {
4045
- return n + 1;
4046
- });
4047
- }, []);
4048
- var value = useMemo(function () {
4049
- return {
4050
- startDocumentDetection: start,
4051
- stopDocumentDetection: stop,
4052
- loadDocumentDetectionModel: load,
4053
- documentDetectionModelReady: ready,
4054
- documentDetectionModelError: modelError,
4055
- documentDetectionModelDownloadProgress: modelDownloadProgress,
4056
- onDocumentDetected: onDocumentDetected,
4057
- detectionTime: lastDetectionTime,
4058
- documentDetectionThresholds: documentDetectionThresholds,
4059
- setDocumentDetectionThresholds: setDocumentDetectionThresholds,
4060
- documentDetectionBoundaries: documentDetectionBoundaries,
4061
- setDocumentDetectionBoundaries: setDocumentDetectionBoundaries,
4062
- documentDetectionLastPredictionCanvas: lastPredictionCanvas,
4063
- clearDocumentDetectionLastPredictionCanvas: clearDocumentDetectionLastPredictionCanvas
4064
- };
4065
- }, [start, stop, load, ready, modelError, modelDownloadProgress, onDocumentDetected, documentDetectionThresholds, documentDetectionBoundaries, clearDocumentDetectionLastPredictionCanvas]);
4066
- return /*#__PURE__*/React.createElement(DocumentDetectionModelContext.Provider, {
4067
- value: value
4068
- }, /*#__PURE__*/React.createElement(InvisibleCanvas, {
4069
- key: canvasKey,
4070
- ref: lastPredictionCanvas
4071
- }), children);
4072
- }
4073
-
4074
- var FocusModelContext = /*#__PURE__*/createContext({
4075
- loadFocusModel: function loadFocusModel() {
4076
- return null;
4077
- },
4078
- focusModelReady: false,
4079
- focusModelDownloadProgress: 0,
4080
- focusModelError: null,
4081
- focusThresholds: {},
4082
- setFocusThresholds: function setFocusThresholds() {
4083
- return null;
4084
- },
4085
- makeFocusPrediction: function makeFocusPrediction() {
4086
- return null;
4087
- },
4088
- focusPredictionTime: 0
4089
- });
4090
- function FocusModelProvider(_a) {
4091
- var children = _a.children,
4092
- _b = _a.focusModelPath,
4093
- focusModelPath = _b === void 0 ? defaultFocusModelPath : _b,
4094
- _c = _a.focusModelLoadTimeoutMs,
4095
- focusModelLoadTimeoutMs = _c === void 0 ? defaultFocusModelLoadTimeoutMs : _c,
4096
- onFocusModelError = _a.onFocusModelError,
4097
- _d = _a.showCanvases,
4098
- showCanvases = _d === void 0 ? false : _d,
4099
- _e = _a.shouldLoadModels,
4100
- shouldLoadModelsProp = _e === void 0 ? true : _e;
4101
- var cropCanvas = useRef(null);
4102
- var rotateCanvas = useRef(null);
4103
- var _f = useState({}),
4104
- focusThresholds = _f[0],
4105
- setFocusThresholds = _f[1];
4106
- var videoRef = useCameraStore().videoRef;
4107
- var _g = useState(shouldLoadModelsProp),
4108
- shouldLoadModels = _g[0],
4109
- setShouldLoadModels = _g[1];
4110
- var load = useCallback(function () {
4111
- return setShouldLoadModels(true);
4112
- }, []);
4113
- var _h = useLoadFocusModel({
4114
- modelPath: focusModelPath,
4115
- modelLoadTimeoutMs: focusModelLoadTimeoutMs,
4116
- onModelError: onFocusModelError,
4117
- videoRef: videoRef,
4118
- shouldLoadModels: shouldLoadModels
4119
- }),
4120
- ready = _h.ready,
4121
- modelDownloadProgress = _h.modelDownloadProgress,
4122
- modelError = _h.modelError;
4123
- var makeFocusPrediction = useCallback(function (imageData, box) {
4124
- if (!ready) return null;
4125
- var prediction = makeFocusModelPrediction(imageData, cropCanvas.current, rotateCanvas.current, box);
4126
- if (!prediction) return null;
4127
- setLastFocusPredictionAt(prediction.predictionTime);
4128
- return prediction;
4129
- }, [ready]);
4130
- var value = useMemo(function () {
4131
- return {
4132
- loadFocusModel: load,
4133
- focusModelReady: ready,
4134
- focusModelDownloadProgress: modelDownloadProgress,
4135
- focusModelError: modelError,
4136
- makeFocusPrediction: makeFocusPrediction,
4137
- focusPredictionTime: lastFocusPredictionTime,
4138
- focusThresholds: focusThresholds,
4139
- setFocusThresholds: setFocusThresholds
4140
- };
4141
- }, [focusThresholds, load, makeFocusPrediction, modelDownloadProgress, modelError, ready]);
4142
- return /*#__PURE__*/React__default.createElement(FocusModelContext.Provider, {
4143
- value: value
4144
- }, /*#__PURE__*/React__default.createElement(InvisibleCanvas, {
4145
- ref: rotateCanvas,
4146
- style: showCanvases ? {
4147
- display: 'block'
4148
- } : undefined
4149
- }), /*#__PURE__*/React__default.createElement(InvisibleCanvas, {
4150
- ref: cropCanvas,
4151
- style: showCanvases ? {
4152
- display: 'block'
4153
- } : undefined
4154
- }), children);
4155
- }
4156
-
4157
- function _isNavigatorDefined() {
4158
- return typeof navigator !== 'undefined' && navigator != null;
4159
- }
4160
- var isMobileCache;
4161
- function isMobile() {
4162
- if (isMobileCache !== undefined) return isMobileCache;
4163
- isMobileCache = evaluateIsMobile();
4164
- return isMobileCache;
4165
- }
4166
- function evaluateIsMobile(nav) {
4167
- if (nav || _isNavigatorDefined()) {
4168
- if (!nav) {
4169
- nav = navigator;
4170
- }
4171
- if (nav.product === 'ReactNative') {
4172
- return true;
4173
- }
4174
- var a = nav.userAgent || nav.vendor || (
4175
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
4176
- // @ts-ignore
4177
- typeof window !== 'undefined' ? window.opera : '');
4178
- if (!a) {
4179
- var navAny = nav;
4180
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
4181
- // @ts-ignore
4182
- return navAny.userAgentData && navAny.userAgentData.mobile;
4183
- }
4184
- return /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4));
4185
- }
4186
- return false;
4187
- }
4188
-
4189
- var onMobile = isMobile();
4190
- var defaultIdCaptureThresholds = {
4191
- detection: defaultDocumentDetectionThresholds,
4192
- focus: defaultFocusThresholds
4193
- };
4194
- var IdCaptureModelsContext = /*#__PURE__*/createContext({
4195
- ready: false,
4196
- start: function start() {
4197
- return null;
4198
- },
4199
- stop: function stop() {
4200
- return null;
4201
- },
4202
- load: function load() {
4203
- return null;
4204
- },
4205
- modelDownloadProgress: 0,
4206
- modelError: null,
4207
- thresholds: defaultIdCaptureThresholds,
4208
- setThresholds: function setThresholds() {
4209
- return null;
4210
- },
4211
- documentDetectionBoundaries: defaultDocumentDetectionBoundaries,
4212
- setDocumentDetectionBoundaries: function setDocumentDetectionBoundaries() {
4213
- return null;
4214
- },
4215
- onPredictionMade: function onPredictionMade() {
4216
- return null;
4217
- },
4218
- detectionTime: 0,
4219
- focusPredictionTime: 0,
4220
- bestFrameDetails: {
4221
- current: null
4222
- },
4223
- getBestFrame: function getBestFrame() {
4224
- return null;
4225
- },
4226
- resetBestFrame: function resetBestFrame() {
4227
- return null;
4228
- },
4229
- requiredDocumentType: 'none',
4230
- setRequiredDocumentType: function setRequiredDocumentType() {
4231
- return null;
4232
- }
4233
- });
4234
- function IdCaptureModelsProviderInner(_a) {
4235
- var children = _a.children,
4236
- onModelError = _a.onModelError,
4237
- _b = _a.allowSinglePageIdCapture,
4238
- allowSinglePageIdCapture = _b === void 0 ? false : _b;
4239
- var _c = useContext(DocumentDetectionModelContext),
4240
- documentDetectionModelReady = _c.documentDetectionModelReady,
4241
- documentDetectionModelDownloadProgress = _c.documentDetectionModelDownloadProgress,
4242
- startDocumentDetection = _c.startDocumentDetection,
4243
- stopDocumentDetection = _c.stopDocumentDetection,
4244
- loadDocumentDetectionModel = _c.loadDocumentDetectionModel,
4245
- lastPredictionCanvas = _c.documentDetectionLastPredictionCanvas,
4246
- clearDocumentDetectionLastPredictionCanvas = _c.clearDocumentDetectionLastPredictionCanvas,
4247
- onDocumentDetected = _c.onDocumentDetected,
4248
- detectionTime = _c.detectionTime,
4249
- documentDetectionThresholds = _c.documentDetectionThresholds,
4250
- setDocumentDetectionThresholds = _c.setDocumentDetectionThresholds,
4251
- documentDetectionBoundaries = _c.documentDetectionBoundaries,
4252
- setDocumentDetectionBoundaries = _c.setDocumentDetectionBoundaries,
4253
- documentDetectionModelError = _c.documentDetectionModelError;
4254
- var _d = useContext(FocusModelContext),
4255
- loadFocusModel = _d.loadFocusModel,
4256
- focusModelReady = _d.focusModelReady,
4257
- focusModelDownloadProgress = _d.focusModelDownloadProgress,
4258
- makeFocusPrediction = _d.makeFocusPrediction,
4259
- focusThresholds = _d.focusThresholds,
4260
- setFocusThresholds = _d.setFocusThresholds,
4261
- focusPredictionTime = _d.focusPredictionTime,
4262
- focusModelError = _d.focusModelError;
4263
- var onPredictionHandler = useRef();
4264
- var bestFrameDetails = useRef(null);
4265
- var bestPredictionCanvas = useRef(null);
4266
- var bestFocusScore = useRef(0);
4267
- var stopDetection = useRef(0);
4268
- var _e = useState('none'),
4269
- requiredDocumentType = _e[0],
4270
- setRequiredDocumentType = _e[1];
4271
- var thresholds = useMemo(function () {
4272
- return _assign(_assign({}, documentDetectionThresholds), {
4273
- focus: focusThresholds
4274
- });
4275
- }, [documentDetectionThresholds, focusThresholds]);
4276
- var setThresholds = useCallback(function (thresholds) {
4277
- if (thresholds.detection) {
4278
- setDocumentDetectionThresholds(thresholds.detection);
4279
- }
4280
- if (thresholds.focus) {
4281
- setFocusThresholds(thresholds.focus);
4282
- }
4283
- }, [setDocumentDetectionThresholds, setFocusThresholds]);
4284
- useEffect(function handleDetections() {
4285
- var _this = this;
4286
- onDocumentDetected(function (prediction) {
4287
- return __awaiter(_this, void 0, void 0, function () {
4288
- var stopDetectionAtStart, focusPredictionTime, focusScore, focusThresholdMet, isSinglePage, isRequiredDocumentType, focusPrediction, focusThresholdSet, focusThreshold;
4289
- var _a, _b, _c, _d, _e, _f, _g;
4290
- return __generator(this, function (_h) {
4291
- if (!lastPredictionCanvas.current) return [2 /*return*/];
4292
- stopDetectionAtStart = stopDetection.current;
4293
- focusPredictionTime = 0, focusScore = 0, focusThresholdMet = false;
4294
- isSinglePage = prediction.detectedDocumentType === 'singlePage';
4295
- if (!allowSinglePageIdCapture && isSinglePage) {
4296
- prediction.detectedDocumentType = 'passport';
4297
- prediction.passportDetectionScore = prediction.singlePageDetectionScore;
4298
- prediction.passportDetectionThresholdMet = prediction.singlePageDetectionThresholdMet;
4299
- prediction.singlePageDetectionScore = 0;
4300
- prediction.singlePageDetectionThresholdMet = false;
4301
- }
4302
- isRequiredDocumentType = requiredDocumentType === 'none' || prediction.detectedDocumentType === requiredDocumentType || ((_a = requiredDocumentType.includes) === null || _a === void 0 ? void 0 : _a.call(requiredDocumentType, prediction.detectedDocumentType)) || allowSinglePageIdCapture && isSinglePage && ((_b = requiredDocumentType.includes) === null || _b === void 0 ? void 0 : _b.call(requiredDocumentType, 'idCardFront'));
4303
- if (isRequiredDocumentType && prediction.detectedDocumentType !== 'none' && prediction.detectionThresholdMet && prediction.documentInBounds && !prediction.documentTooClose && prediction.documentIsStable) {
4304
- focusPrediction = makeFocusPrediction(lastPredictionCanvas.current, (_c = prediction.bestDocument) === null || _c === void 0 ? void 0 : _c.box);
4305
- if (focusPrediction) {
4306
- focusScore = focusPrediction.score;
4307
- focusPredictionTime = focusPrediction.predictionTime;
4308
- }
4309
- focusThresholdSet = (_d = thresholds.focus) === null || _d === void 0 ? void 0 : _d[prediction.detectedDocumentType];
4310
- focusThreshold = (_e = onMobile ? focusThresholdSet === null || focusThresholdSet === void 0 ? void 0 : focusThresholdSet.mobile : focusThresholdSet === null || focusThresholdSet === void 0 ? void 0 : focusThresholdSet.desktop) !== null && _e !== void 0 ? _e : 0;
4311
- focusThresholdMet = focusScore >= focusThreshold;
4312
- if (bestFocusScore.current <= focusScore && stopDetectionAtStart === stopDetection.current) {
4313
- bestFocusScore.current = focusScore;
4314
- drawToCanvas(bestPredictionCanvas.current, lastPredictionCanvas.current);
4315
- bestFrameDetails.current = {
4316
- boundingBox: (_f = prediction.bestDocument) === null || _f === void 0 ? void 0 : _f.box,
4317
- documentType: prediction.detectedDocumentType,
4318
- detectionScore: prediction.detectionScore,
4319
- focusScore: focusScore
4320
- };
4321
- }
4322
- }
4323
- (_g = onPredictionHandler.current) === null || _g === void 0 ? void 0 : _g.call(onPredictionHandler, _assign(_assign({}, prediction), {
4324
- focusScore: focusScore,
4325
- focusPredictionTime: focusPredictionTime,
4326
- focusThresholdMet: focusThresholdMet
4327
- }));
4328
- return [2 /*return*/];
4329
- });
4330
- });
4331
- });
4332
- }, [allowSinglePageIdCapture, lastPredictionCanvas, makeFocusPrediction, onDocumentDetected, requiredDocumentType, thresholds.focus]);
4333
- var modelError = documentDetectionModelError !== null && documentDetectionModelError !== void 0 ? documentDetectionModelError : focusModelError;
4334
- useEffect(function handleModelErrors() {
4335
- if (modelError) onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError);
4336
- }, [modelError, onModelError]);
4337
- var onPredictionMade = useCallback(function (handler) {
4338
- onPredictionHandler.current = handler;
4339
- }, []);
4340
- var getBestFrame = useCallback(function () {
4341
- if (!bestFrameDetails.current || !bestPredictionCanvas.current) return null;
4342
- return _assign(_assign({}, bestFrameDetails.current), {
4343
- canvas: bestPredictionCanvas.current
4344
- });
4345
- }, []);
4346
- var _f = useState(0),
4347
- canvasKey = _f[0],
4348
- setCanvasKey = _f[1];
4349
- var resetBestFrame = useCallback(function () {
4350
- stopDetection.current += 1;
4351
- setCanvasKey(function (n) {
4352
- return n + 1;
4353
- });
4354
- clearDocumentDetectionLastPredictionCanvas();
4355
- bestFrameDetails.current = null;
4356
- bestFocusScore.current = 0;
4357
- }, [clearDocumentDetectionLastPredictionCanvas]);
4358
- useEffect(function () {
4359
- if (requiredDocumentType) resetBestFrame();
4360
- }, [requiredDocumentType, resetBestFrame]);
4361
- var load = useCallback(function () {
4362
- loadDocumentDetectionModel();
4363
- loadFocusModel();
4364
- }, [loadDocumentDetectionModel, loadFocusModel]);
4365
- var value = useMemo(function () {
4366
- return {
4367
- ready: documentDetectionModelReady && focusModelReady,
4368
- modelDownloadProgress: (documentDetectionModelDownloadProgress + focusModelDownloadProgress) / 2,
4369
- modelError: modelError,
4370
- start: startDocumentDetection,
4371
- stop: stopDocumentDetection,
4372
- load: load,
4373
- thresholds: thresholds,
4374
- setThresholds: setThresholds,
4375
- documentDetectionBoundaries: documentDetectionBoundaries,
4376
- setDocumentDetectionBoundaries: setDocumentDetectionBoundaries,
4377
- onPredictionMade: onPredictionMade,
4378
- detectionTime: detectionTime,
4379
- focusPredictionTime: focusPredictionTime,
4380
- getBestFrame: getBestFrame,
4381
- resetBestFrame: resetBestFrame,
4382
- bestFrameDetails: bestFrameDetails,
4383
- requiredDocumentType: requiredDocumentType,
4384
- setRequiredDocumentType: setRequiredDocumentType
4385
- };
4386
- }, [detectionTime, documentDetectionBoundaries, documentDetectionModelDownloadProgress, documentDetectionModelReady, focusModelDownloadProgress, focusModelReady, focusPredictionTime, getBestFrame, load, modelError, onPredictionMade, requiredDocumentType, resetBestFrame, setDocumentDetectionBoundaries, setThresholds, startDocumentDetection, stopDocumentDetection, thresholds]);
4387
- return /*#__PURE__*/React__default.createElement(IdCaptureModelsContext.Provider, {
4388
- value: value
4389
- }, /*#__PURE__*/React__default.createElement(InvisibleCanvas, {
4390
- key: canvasKey,
4391
- ref: bestPredictionCanvas
4392
- }), children);
4393
- }
4394
- function IdCaptureModelsProvider(_a) {
4395
- var children = _a.children,
4396
- props = __rest(_a, ["children"]);
4397
- return /*#__PURE__*/React__default.createElement(DocumentDetectionModelProvider, _assign({}, props), /*#__PURE__*/React__default.createElement(FocusModelProvider, _assign({}, props), /*#__PURE__*/React__default.createElement(IdCaptureModelsProviderInner, _assign({}, props), children)));
4398
- }
4399
-
4400
- var CapturedDocumentTypeValues = ['idCardFront', 'idCardBack', 'passport', 'singlePage', 'selfie'];
4401
-
4402
- var acceptedDocumentTypesForIdCaptureRequirementOption = {
4403
- idCardFront: ['idCardFront'],
4404
- idCardBack: ['idCardBack'],
4405
- passport: ['passport'],
4406
- idCard: ['idCardFront', 'idCardBack'],
4407
- idCardAndPassport: ['idCardFront', 'idCardBack', 'passport'],
4408
- idCardOrPassport: ['idCardFront', 'idCardBack', 'passport'] // this one is so weird
4409
- };
4410
- function minImageCountForIdCaptureRequirementOption(idCaptureRequirement) {
4411
- if (idCaptureRequirement === 'idCardOrPassport') return 1;
4412
- return acceptedDocumentTypesForIdCaptureRequirementOption[idCaptureRequirement].length;
4413
- }
4414
- function maxImageCountForIdCaptureRequirementOption(idCaptureRequirement) {
4415
- if (idCaptureRequirement === 'idCardOrPassport') return 2;
4416
- return minImageCountForIdCaptureRequirementOption(idCaptureRequirement);
4417
- }
4418
- function remainingIdCaptureRequirements(captureRequirement, capturedDocuments, requestedDocumentType) {
4419
- var isIdCardOrPassport = captureRequirement === 'idCardOrPassport';
4420
- if (isIdCardOrPassport && requestedDocumentType === 'passport') return [];
4421
- var acceptedTypes = acceptedDocumentTypesForIdCaptureRequirementOption[captureRequirement];
4422
- if (captureRequirement.includes('idCard') && 'singlePage' in capturedDocuments) {
4423
- acceptedTypes = acceptedTypes.filter(function (v) {
4424
- return !v.includes('idCard');
4425
- });
4426
- }
4427
- if (isIdCardOrPassport) {
4428
- acceptedTypes = acceptedTypes.filter(function (v) {
4429
- return v !== 'passport';
4430
- });
4431
- }
4432
- return acceptedTypes.filter(function (v) {
4433
- return !(v in capturedDocuments);
4434
- });
4435
- }
4436
-
4437
- var initialState$4 = {
4438
- initialDrawComplete: false,
4439
- redrawing: false,
4440
- guideRectX: 0,
4441
- guideRectY: 0,
4442
- guideRectWidth: 0,
4443
- guideRectHeight: 0,
4444
- guideRectOffsetTop: 0,
4445
- guideImageWidth: 0,
4446
- guideImageHeight: 0,
4447
- pageWidth: 0,
4448
- pageHeight: 0,
4449
- videoWidth: 0,
4450
- videoHeight: 0,
4451
- detectedObjects: [],
4452
- bestDocument: undefined,
4453
- detectedDocumentType: 'none',
4454
- detectionThresholdMet: false,
4455
- documentInBounds: false,
4456
- documentTooClose: false,
4457
- documentIsStable: false,
4458
- flipRequired: false,
4459
- backDetectedFirst: false,
4460
- idCardDetectedButNotAllowed: false,
4461
- passportDetectedButNotAllowed: false,
4462
- enableOverrideWrongDocumentTypeDialog: false,
4463
- allowOverrideWrongDocumentTypeAfterMs: 8000,
4464
- allowOverrideWrongDocumentTypeGuidance: false,
4465
- overrideWrongDocumentTypeGuidance: false,
4466
- wrongDocumentTypePredictions: 0,
4467
- idCardFrontDetectionScore: 0,
4468
- idCardFrontDetectionThresholdMet: false,
4469
- idCardBackDetectionScore: 0,
4470
- idCardBackDetectionThresholdMet: false,
4471
- passportDetectionScore: 0,
4472
- passportDetectionThresholdMet: false,
4473
- singlePageDetectionScore: 0,
4474
- singlePageDetectionThresholdMet: false,
4475
- focusScore: 0,
4476
- focusThresholdMet: false,
4477
- isGoodFrame: false,
4478
- goodFramesCount: 0,
4479
- goodFramesThreshold: 3,
4480
- goodFramesThresholdMet: false,
4481
- lastFrameCapturedAt: null,
4482
- frameCaptureRate: 0,
4483
- capturing: false,
4484
- captureFailed: false,
4485
- imageUrl: null,
4486
- captureState: 'initializing',
4487
- capturedDocuments: {},
4488
- captureRequirement: 'idCardOrPassport',
4489
- requestedDocumentType: 'idCardFront',
4490
- allowSinglePageIdCapture: false,
4491
- allowIdCardBackToFrontCapture: false,
4492
- allowUploadingDocumentsFromStorage: false,
4493
- isUploadingDocumentsFromStorage: false,
4494
- uploadingDocumentsType: null,
4495
- operationStartedAt: null,
4496
- captureStartedAt: null,
4497
- dispatch: function dispatch() {
4498
- return null;
4499
- }
4500
- };
4501
- var _reducer = function reducer(state, action) {
4502
- var _a;
4503
- switch (action.type) {
4504
- case 'configureWizard':
4505
- {
4506
- var _b = action.payload,
4507
- captureRequirement = _b.captureRequirement,
4508
- precapturedDocuments = _b.precapturedDocuments,
4509
- allowSinglePageIdCapture = _b.allowSinglePageIdCapture,
4510
- allowIdCardBackToFrontCapture = _b.allowIdCardBackToFrontCapture,
4511
- enableOverrideWrongDocumentTypeDialog = _b.enableOverrideWrongDocumentTypeDialog,
4512
- allowOverrideWrongDocumentTypeAfterMs = _b.allowOverrideWrongDocumentTypeAfterMs,
4513
- allowUploadingDocumentsFromStorage = _b.allowUploadingDocumentsFromStorage;
4514
- var newState = _assign(_assign({}, state), {
4515
- captureRequirement: captureRequirement,
4516
- allowSinglePageIdCapture: allowSinglePageIdCapture !== null && allowSinglePageIdCapture !== void 0 ? allowSinglePageIdCapture : false,
4517
- allowIdCardBackToFrontCapture: allowIdCardBackToFrontCapture !== null && allowIdCardBackToFrontCapture !== void 0 ? allowIdCardBackToFrontCapture : false,
4518
- enableOverrideWrongDocumentTypeDialog: enableOverrideWrongDocumentTypeDialog,
4519
- allowOverrideWrongDocumentTypeAfterMs: allowOverrideWrongDocumentTypeAfterMs,
4520
- allowUploadingDocumentsFromStorage: allowUploadingDocumentsFromStorage
4521
- });
4522
- if (captureRequirement === 'idCardBack') newState.requestedDocumentType = 'idCardBack';
4523
- if (captureRequirement === 'passport') newState.requestedDocumentType = 'passport';
4524
- if (precapturedDocuments) {
4525
- for (var _i = 0, CapturedDocumentTypeValues_1 = CapturedDocumentTypeValues; _i < CapturedDocumentTypeValues_1.length; _i++) {
4526
- var k = CapturedDocumentTypeValues_1[_i];
4527
- var payload = precapturedDocuments[k];
4528
- if (payload) {
4529
- newState.requestedDocumentType = k;
4530
- newState = _reducer(newState, {
4531
- type: 'documentCaptured',
4532
- payload: payload
4533
- });
4534
- }
4535
- }
4536
- }
4537
- if (newState.captureState === 'initializing' && !allowUploadingDocumentsFromStorage) {
4538
- newState.captureState = 'capturing';
4539
- }
4540
- return newState;
4541
- }
4542
- case 'setRequiredDocumentType':
4543
- return _assign(_assign({}, state), {
4544
- requiredDocumentType: action.payload
4545
- });
4546
- case 'redrawRequested':
4547
- return _assign(_assign({}, state), {
4548
- redrawing: true,
4549
- guideRectX: 0,
4550
- guideRectY: 0,
4551
- guideRectWidth: 0,
4552
- guideRectHeight: 0,
4553
- guideRectOffsetTop: 0
4554
- });
4555
- case 'redrawInProgress':
4556
- return _assign(_assign({}, state), {
4557
- redrawing: false,
4558
- guideRectX: 0,
4559
- guideRectY: 0,
4560
- guideRectWidth: 0,
4561
- guideRectHeight: 0,
4562
- guideRectOffsetTop: 0
4563
- });
4564
- case 'redrawCompleted':
4565
- return _assign(_assign(_assign({}, state), action.payload), {
4566
- initialDrawComplete: true
4567
- });
4568
- case 'pageRendered':
4569
- return _assign(_assign({}, state), action.payload);
4570
- case 'guideImageLoaded':
4571
- return _assign(_assign({}, state), {
4572
- guideImageWidth: action.payload.width,
4573
- guideImageHeight: action.payload.height
4574
- });
4575
- case 'objectsDetected':
4576
- {
4577
- var _c = action.payload.prediction,
4578
- detectedObjects = _c.detectedObjects,
4579
- detectionThresholdMet = _c.detectionThresholdMet,
4580
- detectedDocumentType = _c.detectedDocumentType,
4581
- idCardFrontDetectionScore = _c.idCardFrontDetectionScore,
4582
- idCardFrontDetectionThresholdMet = _c.idCardFrontDetectionThresholdMet,
4583
- idCardBackDetectionScore = _c.idCardBackDetectionScore,
4584
- idCardBackDetectionThresholdMet = _c.idCardBackDetectionThresholdMet,
4585
- passportDetectionScore = _c.passportDetectionScore,
4586
- passportDetectionThresholdMet = _c.passportDetectionThresholdMet,
4587
- singlePageDetectionScore = _c.singlePageDetectionScore,
4588
- singlePageDetectionThresholdMet = _c.singlePageDetectionThresholdMet,
4589
- bestDocument = _c.bestDocument,
4590
- documentInBounds = _c.documentInBounds,
4591
- documentTooClose = _c.documentTooClose,
4592
- documentIsStable = _c.documentIsStable,
4593
- focusScore = _c.focusScore,
4594
- focusThresholdMet = _c.focusThresholdMet,
4595
- frameWidth = _c.frameWidth,
4596
- frameHeight = _c.frameHeight;
4597
- var frameCapturedAt = new Date();
4598
- var frameCaptureRate = 0;
4599
- var goodFramesThreshold = state.goodFramesThreshold;
4600
- if (state.lastFrameCapturedAt) {
4601
- var frameTime = frameCapturedAt.getTime() - state.lastFrameCapturedAt.getTime();
4602
- if (frameTime > 0) {
4603
- frameCaptureRate = 1000.0 / frameTime;
4604
- if (frameCaptureRate > 0) {
4605
- goodFramesThreshold = Math.ceil(3 * frameCaptureRate);
4606
- }
4607
- }
4608
- }
4609
- var idCardDetected = detectedDocumentType.includes('idCard') || detectedDocumentType === 'singlePage';
4610
- var idCardDetectedButNotAllowed = idCardDetected && !state.captureRequirement.includes('idCard');
4611
- var passportNotAllowed = !state.captureRequirement.toLowerCase().includes('passport');
4612
- var idCardFrontWasCaptured = 'idCardFront' in state.capturedDocuments;
4613
- var idCardBackWasCaptured = 'idCardBack' in state.capturedDocuments;
4614
- var idCardBeingCaptured = idCardFrontWasCaptured && !idCardBackWasCaptured || !idCardFrontWasCaptured && idCardBackWasCaptured;
4615
- var passportDetectedButNotAllowed = detectedDocumentType === 'passport' && (passportNotAllowed || idCardBeingCaptured);
4616
- var flipRequired = !state.overrideWrongDocumentTypeGuidance && (state.allowIdCardBackToFrontCapture ? idCardFrontWasCaptured && detectedDocumentType === 'idCardFront' : state.requestedDocumentType === 'idCardBack' && detectedDocumentType === 'idCardFront');
4617
- var backDetectedFirst = !state.overrideWrongDocumentTypeGuidance && (state.allowIdCardBackToFrontCapture ? idCardBackWasCaptured && detectedDocumentType === 'idCardBack' : state.requestedDocumentType === 'idCardFront' && detectedDocumentType === 'idCardBack');
4618
- var wrongDocumentTypePredictions = state.wrongDocumentTypePredictions;
4619
- if (state.captureState === 'capturing' && (flipRequired || backDetectedFirst)) {
4620
- wrongDocumentTypePredictions += 1;
4621
- }
4622
- var isGoodFrame = detectionThresholdMet && documentInBounds && !documentTooClose && !flipRequired && !backDetectedFirst && focusThresholdMet && !idCardDetectedButNotAllowed && !passportDetectedButNotAllowed && documentIsStable;
4623
- var captureStartedAt = state.captureStartedAt;
4624
- var goodFramesCount = state.goodFramesCount;
4625
- if (isGoodFrame) {
4626
- goodFramesCount += 1;
4627
- captureStartedAt || (captureStartedAt = new Date());
4628
- }
4629
- var goodFramesThresholdMet = goodFramesCount >= goodFramesThreshold;
4630
- var requestedDocumentType = state.requestedDocumentType;
4631
- if (state.captureRequirement.includes('idCard') && state.allowIdCardBackToFrontCapture) {
4632
- if (detectedDocumentType === 'idCardFront' && state.requestedDocumentType !== 'idCardFront' && !idCardFrontWasCaptured) {
4633
- requestedDocumentType = 'idCardFront';
4634
- } else if (detectedDocumentType === 'idCardBack' && state.requestedDocumentType !== 'idCardBack' && !idCardBackWasCaptured) {
4635
- requestedDocumentType = 'idCardBack';
4636
- }
4637
- }
4638
- if (state.captureRequirement === 'idCardOrPassport') {
4639
- if (detectedDocumentType === 'passport' && state.requestedDocumentType !== 'passport') {
4640
- requestedDocumentType = 'passport';
4641
- }
4642
- if (requestedDocumentType === 'passport' && passportDetectionScore < 0.3) {
4643
- requestedDocumentType = idCardFrontWasCaptured ? 'idCardBack' : 'idCardFront';
4644
- }
4645
- }
4646
- var hasBeenRunningForLongEnough = !!state.operationStartedAt && new Date().getTime() - state.operationStartedAt.getTime() > 1000;
4647
- var overrideFlipRequirementThreshold = Math.ceil(state.allowOverrideWrongDocumentTypeAfterMs / 1000 * frameCaptureRate);
4648
- var allowOverrideFlipRequirement = state.enableOverrideWrongDocumentTypeDialog && hasBeenRunningForLongEnough && !state.overrideWrongDocumentTypeGuidance && overrideFlipRequirementThreshold > 0 && (state.allowOverrideWrongDocumentTypeGuidance || wrongDocumentTypePredictions >= overrideFlipRequirementThreshold);
4649
- return _assign(_assign({}, state), {
4650
- videoWidth: frameWidth,
4651
- videoHeight: frameHeight,
4652
- detectedObjects: detectedObjects,
4653
- bestDocument: bestDocument,
4654
- requestedDocumentType: requestedDocumentType,
4655
- detectedDocumentType: detectedDocumentType,
4656
- detectionThresholdMet: detectionThresholdMet,
4657
- documentInBounds: documentInBounds,
4658
- documentTooClose: documentTooClose,
4659
- documentIsStable: documentIsStable,
4660
- flipRequired: flipRequired,
4661
- backDetectedFirst: backDetectedFirst,
4662
- idCardDetectedButNotAllowed: idCardDetectedButNotAllowed,
4663
- passportDetectedButNotAllowed: passportDetectedButNotAllowed,
4664
- allowOverrideWrongDocumentTypeGuidance: allowOverrideFlipRequirement,
4665
- wrongDocumentTypePredictions: wrongDocumentTypePredictions,
4666
- idCardFrontDetectionScore: idCardFrontDetectionScore,
4667
- idCardFrontDetectionThresholdMet: idCardFrontDetectionThresholdMet,
4668
- idCardBackDetectionScore: idCardBackDetectionScore,
4669
- idCardBackDetectionThresholdMet: idCardBackDetectionThresholdMet,
4670
- passportDetectionScore: passportDetectionScore,
4671
- passportDetectionThresholdMet: passportDetectionThresholdMet,
4672
- singlePageDetectionScore: singlePageDetectionScore,
4673
- singlePageDetectionThresholdMet: singlePageDetectionThresholdMet,
4674
- focusScore: focusScore,
4675
- focusThresholdMet: focusThresholdMet,
4676
- isGoodFrame: isGoodFrame,
4677
- goodFramesCount: goodFramesCount,
4678
- goodFramesThreshold: goodFramesThreshold,
4679
- goodFramesThresholdMet: goodFramesThresholdMet,
4680
- captureStartedAt: captureStartedAt,
4681
- lastFrameCapturedAt: frameCapturedAt,
4682
- frameCaptureRate: frameCaptureRate
4683
- });
4684
- }
4685
- case 'captureInitialized':
4686
- return _assign(_assign({}, state), {
4687
- captureState: 'capturing',
4688
- isUploadingDocumentsFromStorage: false
4689
- });
4690
- case 'captureStarted':
4691
- return _assign(_assign({}, state), {
4692
- operationStartedAt: new Date(),
4693
- captureStartedAt: null,
4694
- capturing: false,
4695
- captureFailed: false
4696
- });
4697
- case 'capturing':
4698
- return _assign(_assign({}, state), {
4699
- capturing: true,
4700
- captureFailed: false
4701
- });
4702
- case 'captured':
4703
- return _assign(_assign({}, state), {
4704
- capturing: false,
4705
- captureFailed: false
4706
- });
4707
- case 'frameCaptured':
4708
- return _assign(_assign({}, state), {
4709
- imageUrl: action.payload.imageUrl
4710
- });
4711
- case 'captureFailed':
4712
- return _assign(_assign({}, state), {
4713
- capturing: false,
4714
- captureFailed: true
4715
- });
4716
- case 'documentCaptured':
4717
- {
4718
- var newState = _assign(_assign({}, state), {
4719
- capturing: false,
4720
- captureFailed: false,
4721
- allowOverrideFlipRequirement: false,
4722
- overrideFlipRequirement: false,
4723
- goodFramesCount: 0,
4724
- wrongDocumentTypePredictions: 0,
4725
- capturedDocuments: _assign(_assign({}, state.capturedDocuments), (_a = {}, _a[action.payload.documentType] = action.payload, _a))
4726
- });
4727
- var remainingRequirements = remainingIdCaptureRequirements(state.captureRequirement, newState.capturedDocuments, state.requestedDocumentType);
4728
- if (remainingRequirements.length === 0) {
4729
- newState.captureState = 'complete';
4730
- } else {
4731
- newState.requestedDocumentType = remainingRequirements[0];
4732
- if (state.requestedDocumentType === 'idCardFront' && newState.requestedDocumentType === 'idCardBack' || state.requestedDocumentType === 'idCardBack' && newState.requestedDocumentType === 'idCardFront') {
4733
- if (!newState.isUploadingDocumentsFromStorage) {
4734
- newState.captureState = 'requestingFlip';
4735
- }
4736
- newState.idCardFrontDetectionThresholdMet = false;
4737
- newState.idCardBackDetectionThresholdMet = false;
4738
- newState.passportDetectionThresholdMet = false;
4739
- newState.wrongDocumentTypePredictions = 0;
4740
- }
4741
- }
4742
- return newState;
4743
- }
4744
- case 'documentCapturedManually':
4745
- return _reducer(state, {
4746
- type: 'documentCaptured',
4747
- payload: _assign(_assign({}, action.payload), {
4748
- documentType: state.requestedDocumentType,
4749
- width: 0,
4750
- height: 0
4751
- })
4752
- });
4753
- case 'documentsCaptured':
4754
- {
4755
- var newState = _assign({}, state);
4756
- for (var _d = 0, _e = action.payload; _d < _e.length; _d++) {
4757
- var doc = _e[_d];
4758
- newState = _reducer(newState, {
4759
- type: 'documentCaptured',
4760
- payload: doc
4761
- });
4762
- }
4763
- return newState;
4764
- }
4765
- case 'flipRequestCompleted':
4766
- return _assign(_assign({}, state), {
4767
- captureState: 'capturing',
4768
- allowOverrideWrongDocumentTypeGuidance: false,
4769
- overrideWrongDocumentTypeGuidance: false,
4770
- wrongDocumentTypePredictions: 0
4771
- });
4772
- case 'allowOverrideFlipRequirement':
4773
- return _assign(_assign({}, state), {
4774
- allowOverrideWrongDocumentTypeGuidance: true
4775
- });
4776
- case 'overrideFlipRequirement':
4777
- return _assign(_assign({}, state), {
4778
- allowOverrideWrongDocumentTypeGuidance: false,
4779
- overrideWrongDocumentTypeGuidance: true
4780
- });
4781
- case 'setUploadingDocumentsFromStorage':
4782
- return _assign(_assign({}, state), {
4783
- isUploadingDocumentsFromStorage: action.payload,
4784
- captureState: action.payload ? 'initializing' : 'capturing'
4785
- });
4786
- case 'setUploadingDocumentsType':
4787
- {
4788
- var requestedDocumentType = !action.payload || action.payload === 'idCard' ? 'idCardFront' : action.payload;
4789
- var uploadingDocumentsType = action.payload === 'singlePage' ? 'idCard' : action.payload;
4790
- return _assign(_assign({}, state), {
4791
- captureState: action.payload ? 'uploading' : 'initializing',
4792
- uploadingDocumentsType: uploadingDocumentsType,
4793
- requestedDocumentType: requestedDocumentType
4794
- });
4795
- }
4796
- case 'resetWizard':
4797
- return _assign(_assign({}, initialState$4), {
4798
- dispatch: state.dispatch,
4799
- allowUploadingDocumentsFromStorage: state.allowUploadingDocumentsFromStorage,
4800
- captureState: state.allowUploadingDocumentsFromStorage ? 'initializing' : 'capturing',
4801
- captureRequirement: state.captureRequirement,
4802
- allowIdCardBackToFrontCapture: state.allowIdCardBackToFrontCapture
4803
- });
4804
- default:
4805
- return state;
4806
- }
4807
- };
4808
- var useIdCaptureStore = create()(devtools(function (set) {
4809
- return _assign(_assign({}, initialState$4), {
4810
- dispatch: function dispatch(action) {
4811
- return set(function (state) {
4812
- return _reducer(state, action);
4813
- }, undefined, action);
4814
- }
4815
- });
4816
- }));
4817
- function IdCaptureStateProvider(_a) {
4818
- var children = _a.children;
4819
- var overrideWrongDocumentTypeGuidance = useIdCaptureStore(useShallow(function (state) {
4820
- return state.overrideWrongDocumentTypeGuidance;
4821
- }));
4822
- var setRequiredDocumentType = useContext(IdCaptureModelsContext).setRequiredDocumentType;
4823
- useEffect(function () {
4824
- if (overrideWrongDocumentTypeGuidance) setRequiredDocumentType('none');
4825
- }, [overrideWrongDocumentTypeGuidance, setRequiredDocumentType]);
4826
- var onResize = useDebouncedCallback(function () {
4827
- dispatchIdCaptureAction({
4828
- type: 'redrawRequested'
4829
- });
4830
- }, 500);
4831
- useLayoutEffect(function () {
4832
- if (typeof window === 'undefined') return;
4833
- window.addEventListener('resize', onResize);
4834
- return function () {
4835
- return window.removeEventListener('resize', onResize);
4836
- };
4837
- }, [onResize]);
4838
- useEffect(function resetWhenProviderUnmounts() {
4839
- return function () {
4840
- return useIdCaptureStore.getState().dispatch({
4841
- type: 'resetWizard'
4842
- });
4843
- };
4844
- }, []);
4845
- return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, children);
4846
- }
4847
- var dispatchIdCaptureAction = function dispatchIdCaptureAction(action) {
4848
- return useIdCaptureStore.getState().dispatch(action);
4849
- };
4850
-
4851
- function DebugStatsPane(_a) {
4852
- var children = _a.children;
4853
- var element = /*#__PURE__*/React__default.createElement(DebugStatsPaneDiv, null, children);
4854
- var portalLocation = document.getElementById('idmission-above-guides-content');
4855
- if (!portalLocation) return element;
4856
- return /*#__PURE__*/createPortal(element, portalLocation);
4857
- }
4858
- var DebugStatsPaneDiv = styled.span(templateObject_1$G || (templateObject_1$G = __makeTemplateObject(["\n font-size: 16px;\n font-family: monospace;\n position: absolute;\n left: 20px;\n bottom: 20px;\n margin-right: 20px;\n padding: 8px;\n color: limegreen;\n background: rgba(0, 0, 0, 0.5);\n z-index: 10002;\n"], ["\n font-size: 16px;\n font-family: monospace;\n position: absolute;\n left: 20px;\n bottom: 20px;\n margin-right: 20px;\n padding: 8px;\n color: limegreen;\n background: rgba(0, 0, 0, 0.5);\n z-index: 10002;\n"])));
4859
- var ObjectDetectionDebugOverlayDiv = styled.div(templateObject_2$z || (templateObject_2$z = __makeTemplateObject(["\n position: absolute;\n z-index: 1001;\n width: 100%;\n height: 100%;\n max-width: 100%;\n max-height: 100%;\n overflow: hidden;\n ", "\n transform-style: preserve-3d;\n"], ["\n position: absolute;\n z-index: 1001;\n width: 100%;\n height: 100%;\n max-width: 100%;\n max-height: 100%;\n overflow: hidden;\n ", "\n transform-style: preserve-3d;\n"])), function (_a) {
4860
- var $flipX = _a.$flipX;
4861
- return $flipX ? 'transform: scaleX(-1);' : '';
4862
- });
4863
- var ObjectDetectionDebugBox = styled.div(templateObject_3$q || (templateObject_3$q = __makeTemplateObject(["\n font: 10px monospace;\n position: absolute;\n border: 3px solid ", ";\n color: ", ";\n ", "\n transform-style: preserve-3d;\n"], ["\n font: 10px monospace;\n position: absolute;\n border: 3px solid ", ";\n color: ", ";\n ", "\n transform-style: preserve-3d;\n"])), function (_a) {
4864
- var $color = _a.$color;
4865
- return $color !== null && $color !== void 0 ? $color : 'green';
4866
- }, function (_a) {
4867
- var $color = _a.$color;
4868
- return $color !== null && $color !== void 0 ? $color : 'green';
4869
- }, function (_a) {
4870
- var $flipX = _a.$flipX;
4871
- return $flipX ? 'transform: scaleX(-1);' : '';
4872
- });
4873
- var FaceDetectionKeypointMarker = styled.div(templateObject_4$k || (templateObject_4$k = __makeTemplateObject(["\n position: absolute;\n width: 4px;\n height: 4px;\n border: 2px solid ", ";\n font: 10px monospace;\n color: ", ";\n border-radius: 50%;\n ", "\n transform-style: preserve-3d;\n"], ["\n position: absolute;\n width: 4px;\n height: 4px;\n border: 2px solid ", ";\n font: 10px monospace;\n color: ", ";\n border-radius: 50%;\n ", "\n transform-style: preserve-3d;\n"])), function (_a) {
4874
- var $color = _a.$color;
4875
- return $color !== null && $color !== void 0 ? $color : 'red';
4876
- }, function (_a) {
4877
- var $color = _a.$color;
4878
- return $color !== null && $color !== void 0 ? $color : 'red';
4879
- }, function (_a) {
4880
- var $flipX = _a.$flipX;
4881
- return $flipX ? 'transform: scaleX(-1);' : '';
4882
- });
4883
- function useDebugScalingDetails(_a) {
4884
- var _b = _a.enabled,
4885
- enabled = _b === void 0 ? true : _b,
4886
- pageWidth = _a.pageWidth,
4887
- pageHeight = _a.pageHeight,
4888
- videoWidth = _a.videoWidth,
4889
- videoHeight = _a.videoHeight;
4890
- return useMemo(function () {
4891
- var horizontal = false,
4892
- scaledWidth = 0,
4893
- scaledHeight = 0,
4894
- xOffset = 0,
4895
- yOffset = 0;
4896
- if (enabled) {
4897
- horizontal = pageWidth / pageHeight < videoWidth / videoHeight;
4898
- if (horizontal) {
4899
- scaledWidth = videoWidth * (pageHeight / videoHeight);
4900
- xOffset = (scaledWidth - pageWidth) / 2;
4901
- } else {
4902
- scaledHeight = videoHeight * (pageWidth / videoWidth);
4903
- yOffset = (scaledHeight - pageHeight) / 2;
4904
- }
4905
- }
4906
- return {
4907
- horizontal: horizontal,
4908
- pageWidth: pageWidth,
4909
- pageHeight: pageHeight,
4910
- videoWidth: videoWidth,
4911
- videoHeight: videoHeight,
4912
- scaledWidth: scaledWidth,
4913
- scaledHeight: scaledHeight,
4914
- xOffset: xOffset,
4915
- yOffset: yOffset
4916
- };
4917
- }, [enabled, pageHeight, pageWidth, videoHeight, videoWidth]);
4918
- }
4919
- var DebugBoundingBoxOverlay = function DebugBoundingBoxOverlay(_a) {
4920
- var scaling = _a.scaling,
4921
- $flipX = _a.$flipX,
4922
- children = _a.children;
4923
- var _b = useIdCaptureStore(),
4924
- guideRectWidth = _b.guideRectWidth,
4925
- guideRectHeight = _b.guideRectHeight,
4926
- guideRectX = _b.guideRectX,
4927
- guideRectY = _b.guideRectY;
4928
- return /*#__PURE__*/React__default.createElement(ObjectDetectionDebugOverlayDiv, {
4929
- id: "debug-overlay-div",
4930
- "$flipX": $flipX,
4931
- style: {
4932
- top: guideRectY,
4933
- left: guideRectX,
4934
- width: guideRectWidth || (scaling === null || scaling === void 0 ? void 0 : scaling.pageWidth),
4935
- height: guideRectHeight || (scaling === null || scaling === void 0 ? void 0 : scaling.pageHeight)
4936
- }
4937
- }, children);
4938
- };
4939
- function IdCaptureDetectedObjectDebugBox(_a) {
4940
- var obj = _a.obj,
4941
- flipX = _a.flipX,
4942
- _b = _a.color,
4943
- color = _b === void 0 ? 'green' : _b,
4944
- scaling = _a.scaling;
4945
- var horizontal = scaling.horizontal,
4946
- pageWidth = scaling.pageWidth,
4947
- pageHeight = scaling.pageHeight,
4948
- videoWidth = scaling.videoWidth,
4949
- videoHeight = scaling.videoHeight,
4950
- scaledWidth = scaling.scaledWidth,
4951
- scaledHeight = scaling.scaledHeight,
4952
- xOffset = scaling.xOffset,
4953
- yOffset = scaling.yOffset;
4954
- if (!videoWidth || !videoHeight || !pageWidth || !pageHeight) return /*#__PURE__*/React__default.createElement(React__default.Fragment, null);
4955
- var top;
4956
- var left;
4957
- var width;
4958
- var height;
4959
- if (horizontal) {
4960
- top = obj.box.yMin / videoHeight * pageHeight;
4961
- left = obj.box.xMin / videoWidth * scaledWidth - xOffset;
4962
- width = obj.box.width / videoWidth * scaledWidth;
4963
- height = obj.box.height / videoHeight * pageHeight;
4964
- } else {
4965
- top = obj.box.yMin / videoHeight * scaledHeight - yOffset;
4966
- left = obj.box.xMin / videoWidth * pageWidth;
4967
- width = obj.box.width / videoWidth * pageWidth;
4968
- height = obj.box.height / videoHeight * scaledHeight;
4969
- }
4970
- return /*#__PURE__*/React__default.createElement(ObjectDetectionDebugBox, {
4971
- "$flipX": flipX,
4972
- "$color": color,
4973
- style: {
4974
- top: top,
4975
- left: left,
4976
- width: width,
4977
- height: height
4978
- }
4979
- });
4980
- }
4981
- function SelfieCaptureFaceDebugBox(_a) {
4982
- var face = _a.face,
4983
- flipX = _a.flipX,
4984
- _b = _a.color,
4985
- color = _b === void 0 ? 'green' : _b,
4986
- scaling = _a.scaling;
4987
- var horizontal = scaling.horizontal,
4988
- pageWidth = scaling.pageWidth,
4989
- pageHeight = scaling.pageHeight,
4990
- videoWidth = scaling.videoWidth,
4991
- videoHeight = scaling.videoHeight,
4992
- scaledWidth = scaling.scaledWidth,
4993
- scaledHeight = scaling.scaledHeight,
4994
- xOffset = scaling.xOffset,
4995
- yOffset = scaling.yOffset;
4996
- if (!videoWidth || !videoHeight || !pageWidth || !pageHeight) return /*#__PURE__*/React__default.createElement(React__default.Fragment, null);
4997
- var top;
4998
- var left;
4999
- var width;
5000
- var height;
5001
- if (horizontal) {
5002
- top = face.box.yMin / videoHeight * pageHeight;
5003
- left = face.box.xMin / videoWidth * scaledWidth - xOffset;
5004
- width = face.box.width / videoWidth * scaledWidth;
5005
- height = face.box.height / videoHeight * pageHeight;
5006
- } else {
5007
- top = face.box.yMin / videoHeight * scaledHeight - yOffset;
5008
- left = face.box.xMin / videoWidth * pageWidth;
5009
- width = face.box.width / videoWidth * pageWidth;
5010
- height = face.box.height / videoHeight * scaledHeight;
5011
- }
5012
- return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(ObjectDetectionDebugBox, {
5013
- "$flipX": flipX,
5014
- "$color": color,
5015
- style: {
5016
- top: top,
5017
- left: left,
5018
- width: width,
5019
- height: height
5020
- }
5021
- }), face.keypoints.map(function (point, ii) {
5022
- return /*#__PURE__*/React__default.createElement(SelfieCaptureFaceKeypoint, {
5023
- key: ii,
5024
- point: point,
5025
- scaling: scaling,
5026
- flipX: flipX
5027
- });
5028
- }));
5029
- }
5030
- function SelfieCaptureFaceKeypoint(_a) {
5031
- var point = _a.point,
5032
- flipX = _a.flipX,
5033
- _b = _a.color,
5034
- color = _b === void 0 ? 'red' : _b,
5035
- _c = _a.scaling,
5036
- horizontal = _c.horizontal,
5037
- pageWidth = _c.pageWidth,
5038
- pageHeight = _c.pageHeight,
5039
- videoWidth = _c.videoWidth,
5040
- videoHeight = _c.videoHeight,
5041
- scaledWidth = _c.scaledWidth,
5042
- scaledHeight = _c.scaledHeight,
5043
- xOffset = _c.xOffset,
5044
- yOffset = _c.yOffset;
5045
- var left, top;
5046
- if (horizontal) {
5047
- left = point.x / videoWidth * scaledWidth - xOffset;
5048
- top = point.y / videoHeight * pageHeight;
5049
- } else {
5050
- left = point.x / videoWidth * pageWidth;
5051
- top = point.y / videoHeight * scaledHeight - yOffset;
5052
- }
5053
- top -= 2;
5054
- left -= 2;
5055
- return /*#__PURE__*/React__default.createElement(FaceDetectionKeypointMarker, {
5056
- "$flipX": flipX,
5057
- "$color": color,
5058
- style: {
5059
- top: top,
5060
- left: left
5061
- }
5062
- });
5063
- }
5064
- var templateObject_1$G, templateObject_2$z, templateObject_3$q, templateObject_4$k;
5065
-
5066
- var en = {};
5067
-
5068
- var es = {
5069
- 'English - en': 'Spanish - es',
5070
- 'Use your device camera to capture your ID': 'Hay que utilizar la cámara del dispositivo para capturar la identificación',
5071
- 'Use your iPhone as a webcam': 'Hay que usar el iPhone como cámara web',
5072
- 'Models warming up...': 'Preparando modelos...',
5073
- 'Camera initializing...': 'Inicializando la cámara...',
5074
- 'Camera access blocked': 'Acceso bloqueado a la cámara',
5075
- 'Location access blocked': 'Acceso bloqueado a la localización',
5076
- Continue: 'Continuar',
5077
- 'Processing...': 'Procesando…',
5078
- 'Your camera permission is disabled': 'El permiso de la cámara está desactivado',
5079
- 'This application requires access to your camera to continue. Please accept the permission once prompted by the browser. If the browser does not prompt for camera permissions you must go to settings and provide camera access to the current browser.': 'Esta aplicación requiere el acceso a la cámara para continuar. Hay que aceptar el permiso una vez que se muestre la ventana en el explorador. Si no aparece la ventana para otorgar permisos entonces hay que dirigirse a Configuración y otorgar el permiso a la cámara en el explorador actual.',
5080
- 'Your microphone permission is disabled': 'El permiso del micrófono está desactivado',
5081
- 'This application requires access to your microphone to continue. Please accept the permission once prompted by the browser. If the browser does not prompt for microphone permissions you must go to settings and provide microphone access to the current browser.': 'Esta aplicación requiere tener acceso al micrófono para continuar. Hay que aceptar el permiso una vez que se muestre la ventana en el explorador. Si no aparece la ventana para otorgar permisos entonces hay que dirigirse a Configuración y otorgar el permiso al micrófono en el explorador actual.',
5082
- 'Your location permission is disabled': 'El permiso de la localización está desactivado',
5083
- 'This application requires access to your location to continue. Please accept the permission once prompted by the browser. If the browser does not prompt for location permissions you must go to settings and provide location access to the current browser.': 'Esta aplicación requiere el acceso a la localización para continuar. Hay que aceptar el permiso una vez que se muestre la ventana en el explorador. Si no aparece la ventana para otorgar permisos entonces hay que dirigirse a Configuración y otorgar el permiso a la localización en el explorador actual.',
5084
- Retry: 'Reintentar',
5085
- 'Scan the front of ID': 'Escanear el frente de la ID',
5086
- 'Scan the back of ID': 'Escanear el reverso de la ID',
5087
- 'Scan the ID page of passport': 'Escanear la página de identificación del pasaporte',
5088
- 'ID Card Front': 'Frente de la identificación',
5089
- 'ID Card Back': 'Reverso de la identificación',
5090
- Passport: 'Pasaporte',
5091
- 'Document not detected': 'No se ha detectado el documento',
5092
- 'Document is not centered': 'Documento no centrado',
5093
- 'Document too close please back up': 'Documento muy cerca, favor de alejarse',
5094
- 'Please hold your ID document steady': 'Por favor, hay que mantener firme su identificación',
5095
- 'Document out of focus – try improving the lighting': 'Documento no enfocado, hay que tratar de mejorar la iluminación',
5096
- 'ID card front detected - please flip your ID card': 'Frente de la ID detectado, por favor hay que voltearla',
5097
- 'ID card back detected - please flip your ID card': 'Reverso de la ID detectado, por favor hay que voltearla',
5098
- 'ID card detected please scan a passport instead': 'Se ha detectado una credencial, por favor hay que escanear un pasaporte',
5099
- 'Passport detected please scan an ID card instead': 'Se ha detectado un pasaporte, por favor hay que escanear una credencial',
5100
- 'Document detected, hold still...': 'Se ha detectado el documento, no moverse por favor...',
5101
- 'ID card front detected, hold still...': 'Frente de la ID detectado, no moverse...',
5102
- 'ID card back detected, hold still...': 'Reverso de la ID detectado, no moverse...',
5103
- 'Passport detected, hold still...': 'Pasaporte detectado, no moverse...',
5104
- 'Capturing...': 'Capturando...',
5105
- 'Capture failed!': '¡Error de captura!',
5106
- 'Please flip your ID card...': 'Por favor, hay que voltear la identificación...',
5107
- 'ID card front captured.': 'Se ha capturado el frente de la ID',
5108
- 'ID card back captured.': 'Se ha capturado el reverso de la ID',
5109
- 'ID Capture Successful': 'La captura de la identificación se ha realizado correctamente',
5110
- 'Verify the entire ID was captured clearly with no glare.': 'Hay que verificar que toda la identificación se haya capturado con nitidez y sin reflejos.',
5111
- Submit: 'Enviar',
5112
- 'Submitting...': 'Enviando...',
5113
- 'Use your device camera to capture your face': 'Hay que utilizar la cámara del dispositivo para capturar el rostro',
5114
- 'Remove Sunglasses & Hat': 'Hay que quitarse los lentes y la gorra',
5115
- 'Avoid Excessive Backlighting': 'Hay que evitar tanta luz por detrás',
5116
- 'Hold still for a few seconds...': 'Hay que quedarse quieto unos segundos...',
5117
- 'Please hold still...': 'Favor de no moverse...',
5118
- 'Look straight into the camera...': 'Hay que mirar directamente a la cámara...',
5119
- 'Move back...': 'Hay que moverse hacia atrás...',
5120
- 'Move forward...': 'Hay que moverse hacia adelante...',
5121
- 'Move to the center...': 'Hay que moverse hacia el centro...',
5122
- 'Waiting for face to be detected...': 'Esperando que se detecte la cara...',
5123
- 'Please remove your eye coverings (sunglasses eye patch etc.)...': 'Hay que quitarse lo que cubre los ojos (lentes, parche, etc.)...',
5124
- 'Please remove your head coverings (hat scarf etc.)...': 'Hay que quitarse lo que cubre la cabeza (gorra, mascada, etc.)...',
5125
- 'Please remove your mask...': 'Hay que quitarse el cubrebocas...',
5126
- 'Live face not detected, please try again': 'Rostro vivo no detectado. Por favor, hay que intentar de nuevo.',
5127
- Exit: 'Salir',
5128
- 'Face liveness has been verified!': 'Se ha verificado la prueba de vida.',
5129
- Done: 'Terminar',
5130
- 'Could not verify your face.': 'No se pudo verificar el rostro.',
5131
- 'An error occurred while verifying your face.': 'Se ha producido un error al verificar el rostro.',
5132
- 'Customer has been identified!': '¡Se ha identificado al cliente!',
5133
- 'Customer not found': 'Cliente no encontrado',
5134
- 'Additional document capture': 'Captura adicional de documentos',
5135
- Next: 'Siguiente',
5136
- 'Please sign the box below': 'Hay que firmar en el siguiente cuadro',
5137
- Accept: 'Aceptar',
5138
- Clear: 'Borrar',
5139
- 'Video signature has been successfully captured!': 'La video firma se ha capturado correctamente.',
5140
- 'Network unreachable': 'No hay conexión a internet.',
5141
- "We're having trouble reaching our services please check your connection and try again.": '`Estamos teniendo problemas para alcanzar nuestros servicios, por favor hay que verificar la conexión a internet e intentar de nuevo.`',
5142
- "We're sorry an unexpected error has occurred.": '`Lo sentimos, se ha producido un error inesperado.`',
5143
- 'Document Capture': 'Captura de documento',
5144
- Capture: 'Capturar',
5145
- 'Retry capture': 'Reintentar la captura',
5146
- Upload: 'Enviar',
5147
- 'Uploading...': 'Procesando...',
5148
- 'Upload succeeded!': '¡Proceso completo!',
5149
- 'Performing facial recognition, please hold still...': 'Realizando el reconocimiento facial, por favor no hay que moverse',
5150
- 'Display the front of your ID card...': 'Hay que mostrar el frente de la ID...',
5151
- 'Display the back of your ID card...': 'Hay que mostrar el reverso de la ID...',
5152
- 'Display the ID page of your passport...': 'Hay que mostrar la página de datos del pasaporte...',
5153
- 'Please move your face to the center...': 'Por favor, hay que mover la cabeza hacia el centro...',
5154
- 'Searching for ID card...': 'Localizando la identificación...',
5155
- 'Please read the following text aloud': 'Hay que leer el siguiente texto en voz alta',
5156
- 'Video ID has been successfully captured!': '¡Video ID capturado exitosamente!',
5157
- 'ID Front Image': 'Frente de la ID',
5158
- 'ID Back Image': 'Reverso de la ID',
5159
- "We're having some trouble.": 'Se ha presentado un problema.',
5160
- 'On-device capture guidance failed, please capture a selfie manually.': 'La captura automática para toma de selfie falló. Por favor, hay que tomarse la selfie manualmente.',
5161
- 'Verifying...': 'Verificando....',
5162
- 'Please capture the front of your ID card.': 'Hay que capturar el frente de la identificación.',
5163
- 'Please capture the back of your ID card.': 'Hay que capturar el reverso de la identificación.',
5164
- 'Please capture the front of your ID card, or the ID page of your passport.': 'Hay que capturar el frente de la identificación o la página de datos del pasaporte.',
5165
- 'Please capture the back of your ID card, or click Done if submitting a passport.': 'Hay que capturar el reverso de la identificación o hay que presionar el botón de Terminar si se trata de un pasaporte.',
5166
- 'Please capture the ID page of your passport.': 'Hay que capturar la página de datos del pasaporte.',
5167
- 'On-device capture guidance failed, please capture a photo of your ID card manually.': 'La captura automática falló. Por favor, hay que tomar una foto de la identificación manualmente.',
5168
- 'On-device capture guidance failed, please capture a photo of your passport manually.': 'La captura automática falló. Por favor, hay que tomar una foto del pasaporte manualmente.',
5169
- 'On-device capture guidance failed, please capture photos of your ID card and passport manually.': 'La captura automática falló. Por favor, hay que tomar una foto de la identificación y del pasaporte manualmente.',
5170
- 'On-device capture guidance failed, please capture photos of your ID card or passport manually.': 'La captura automática falló. Por favor hay que tomar una foto de la identificación o del pasaporte manualmente.',
5171
- 'Capture ID page of passport': 'Captura pasaporte (página de la foto)',
5172
- 'Capture back of ID card': 'Captura del reverso',
5173
- 'Downloading...': 'Descargando...',
5174
- 'Accessing camera...': 'Accediendo a la cámara',
5175
- 'Camera ready': 'Cámara lista',
5176
- 'Loading guided capture experience...': 'Cargando la experiencia guiada para la captura....',
5177
- 'Guided capture experience ready': 'Experiencia guiada lista',
5178
- "Let's Go!": '¡Vamos!',
5179
- 'We are having trouble identifying the correct side of your id do you want to continue with capture anyway?': 'Estamos teniendo problemas para identificar el lado correcto de la identificación,¿continuar con la captura?',
5180
- OK: 'Sí',
5181
- 'Capture with Camera': 'Capturar con la cámara',
5182
- OR: 'O',
5183
- 'Upload from Storage': 'Adjuntar del almacenamiento',
5184
- 'Select ID Type': 'Seleccionar el tipo de ID',
5185
- 'ID Card': 'Identificación',
5186
- 'Upload Passport': 'Adjuntar pasaporte',
5187
- 'Upload ID Front': 'Adjuntar el frente de la ID',
5188
- 'Upload ID Back': 'Adjuntar el reverso de la ID',
5189
- Cancel: 'Cancelar',
5190
- 'Upload the back of the ID if it is not included in the front image.': 'Adjuntar el reverso de la ID si no se incluye en la imagen del frente'
3507
+ var en = {};
3508
+
3509
+ var es = {
3510
+ 'English - en': 'Spanish - es',
3511
+ 'Use your device camera to capture your ID': 'Hay que utilizar la cámara del dispositivo para capturar la identificación',
3512
+ 'Use your iPhone as a webcam': 'Hay que usar el iPhone como cámara web',
3513
+ 'Models warming up...': 'Preparando modelos...',
3514
+ 'Camera initializing...': 'Inicializando la cámara...',
3515
+ 'Camera access blocked': 'Acceso bloqueado a la cámara',
3516
+ 'Location access blocked': 'Acceso bloqueado a la localización',
3517
+ Continue: 'Continuar',
3518
+ 'Processing...': 'Procesando…',
3519
+ 'Your camera permission is disabled': 'El permiso de la cámara está desactivado',
3520
+ 'This application requires access to your camera to continue. Please accept the permission once prompted by the browser. If the browser does not prompt for camera permissions you must go to settings and provide camera access to the current browser.': 'Esta aplicación requiere el acceso a la cámara para continuar. Hay que aceptar el permiso una vez que se muestre la ventana en el explorador. Si no aparece la ventana para otorgar permisos entonces hay que dirigirse a Configuración y otorgar el permiso a la cámara en el explorador actual.',
3521
+ 'Your microphone permission is disabled': 'El permiso del micrófono está desactivado',
3522
+ 'This application requires access to your microphone to continue. Please accept the permission once prompted by the browser. If the browser does not prompt for microphone permissions you must go to settings and provide microphone access to the current browser.': 'Esta aplicación requiere tener acceso al micrófono para continuar. Hay que aceptar el permiso una vez que se muestre la ventana en el explorador. Si no aparece la ventana para otorgar permisos entonces hay que dirigirse a Configuración y otorgar el permiso al micrófono en el explorador actual.',
3523
+ 'Your location permission is disabled': 'El permiso de la localización está desactivado',
3524
+ 'This application requires access to your location to continue. Please accept the permission once prompted by the browser. If the browser does not prompt for location permissions you must go to settings and provide location access to the current browser.': 'Esta aplicación requiere el acceso a la localización para continuar. Hay que aceptar el permiso una vez que se muestre la ventana en el explorador. Si no aparece la ventana para otorgar permisos entonces hay que dirigirse a Configuración y otorgar el permiso a la localización en el explorador actual.',
3525
+ Retry: 'Reintentar',
3526
+ 'Scan the front of ID': 'Escanear el frente de la ID',
3527
+ 'Scan the back of ID': 'Escanear el reverso de la ID',
3528
+ 'Scan the ID page of passport': 'Escanear la página de identificación del pasaporte',
3529
+ 'ID Card Front': 'Frente de la identificación',
3530
+ 'ID Card Back': 'Reverso de la identificación',
3531
+ Passport: 'Pasaporte',
3532
+ 'Document not detected': 'No se ha detectado el documento',
3533
+ 'Document is not centered': 'Documento no centrado',
3534
+ 'Document too close please back up': 'Documento muy cerca, favor de alejarse',
3535
+ 'Please hold your ID document steady': 'Por favor, hay que mantener firme su identificación',
3536
+ 'Document out of focus try improving the lighting': 'Documento no enfocado, hay que tratar de mejorar la iluminación',
3537
+ 'ID card front detected - please flip your ID card': 'Frente de la ID detectado, por favor hay que voltearla',
3538
+ 'ID card back detected - please flip your ID card': 'Reverso de la ID detectado, por favor hay que voltearla',
3539
+ 'ID card detected please scan a passport instead': 'Se ha detectado una credencial, por favor hay que escanear un pasaporte',
3540
+ 'Passport detected please scan an ID card instead': 'Se ha detectado un pasaporte, por favor hay que escanear una credencial',
3541
+ 'Document detected, hold still...': 'Se ha detectado el documento, no moverse por favor...',
3542
+ 'ID card front detected, hold still...': 'Frente de la ID detectado, no moverse...',
3543
+ 'ID card back detected, hold still...': 'Reverso de la ID detectado, no moverse...',
3544
+ 'Passport detected, hold still...': 'Pasaporte detectado, no moverse...',
3545
+ 'Capturing...': 'Capturando...',
3546
+ 'Capture failed!': '¡Error de captura!',
3547
+ 'Please flip your ID card...': 'Por favor, hay que voltear la identificación...',
3548
+ 'ID card front captured.': 'Se ha capturado el frente de la ID',
3549
+ 'ID card back captured.': 'Se ha capturado el reverso de la ID',
3550
+ 'ID Capture Successful': 'La captura de la identificación se ha realizado correctamente',
3551
+ 'Verify the entire ID was captured clearly with no glare.': 'Hay que verificar que toda la identificación se haya capturado con nitidez y sin reflejos.',
3552
+ Submit: 'Enviar',
3553
+ 'Submitting...': 'Enviando...',
3554
+ 'Use your device camera to capture your face': 'Hay que utilizar la cámara del dispositivo para capturar el rostro',
3555
+ 'Remove Sunglasses & Hat': 'Hay que quitarse los lentes y la gorra',
3556
+ 'Avoid Excessive Backlighting': 'Hay que evitar tanta luz por detrás',
3557
+ 'Hold still for a few seconds...': 'Hay que quedarse quieto unos segundos...',
3558
+ 'Please hold still...': 'Favor de no moverse...',
3559
+ 'Look straight into the camera...': 'Hay que mirar directamente a la cámara...',
3560
+ 'Move back...': 'Hay que moverse hacia atrás...',
3561
+ 'Move forward...': 'Hay que moverse hacia adelante...',
3562
+ 'Move to the center...': 'Hay que moverse hacia el centro...',
3563
+ 'Waiting for face to be detected...': 'Esperando que se detecte la cara...',
3564
+ 'Please remove your eye coverings (sunglasses eye patch etc.)...': 'Hay que quitarse lo que cubre los ojos (lentes, parche, etc.)...',
3565
+ 'Please remove your head coverings (hat scarf etc.)...': 'Hay que quitarse lo que cubre la cabeza (gorra, mascada, etc.)...',
3566
+ 'Please remove your mask...': 'Hay que quitarse el cubrebocas...',
3567
+ 'Live face not detected, please try again': 'Rostro vivo no detectado. Por favor, hay que intentar de nuevo.',
3568
+ Exit: 'Salir',
3569
+ 'Face liveness has been verified!': 'Se ha verificado la prueba de vida.',
3570
+ Done: 'Terminar',
3571
+ 'Could not verify your face.': 'No se pudo verificar el rostro.',
3572
+ 'An error occurred while verifying your face.': 'Se ha producido un error al verificar el rostro.',
3573
+ 'Customer has been identified!': '¡Se ha identificado al cliente!',
3574
+ 'Customer not found': 'Cliente no encontrado',
3575
+ 'Additional document capture': 'Captura adicional de documentos',
3576
+ Next: 'Siguiente',
3577
+ 'Please sign the box below': 'Hay que firmar en el siguiente cuadro',
3578
+ Accept: 'Aceptar',
3579
+ Clear: 'Borrar',
3580
+ 'Video signature has been successfully captured!': 'La video firma se ha capturado correctamente.',
3581
+ 'Network unreachable': 'No hay conexión a internet.',
3582
+ "We're having trouble reaching our services please check your connection and try again.": '`Estamos teniendo problemas para alcanzar nuestros servicios, por favor hay que verificar la conexión a internet e intentar de nuevo.`',
3583
+ "We're sorry an unexpected error has occurred.": '`Lo sentimos, se ha producido un error inesperado.`',
3584
+ 'Document Capture': 'Captura de documento',
3585
+ Capture: 'Capturar',
3586
+ 'Retry capture': 'Reintentar la captura',
3587
+ Upload: 'Enviar',
3588
+ 'Uploading...': 'Procesando...',
3589
+ 'Upload succeeded!': '¡Proceso completo!',
3590
+ 'Performing facial recognition, please hold still...': 'Realizando el reconocimiento facial, por favor no hay que moverse',
3591
+ 'Display the front of your ID card...': 'Hay que mostrar el frente de la ID...',
3592
+ 'Display the back of your ID card...': 'Hay que mostrar el reverso de la ID...',
3593
+ 'Display the ID page of your passport...': 'Hay que mostrar la página de datos del pasaporte...',
3594
+ 'Please move your face to the center...': 'Por favor, hay que mover la cabeza hacia el centro...',
3595
+ 'Searching for ID card...': 'Localizando la identificación...',
3596
+ 'Please read the following text aloud': 'Hay que leer el siguiente texto en voz alta',
3597
+ 'Video ID has been successfully captured!': '¡Video ID capturado exitosamente!',
3598
+ 'ID Front Image': 'Frente de la ID',
3599
+ 'ID Back Image': 'Reverso de la ID',
3600
+ "We're having some trouble.": 'Se ha presentado un problema.',
3601
+ 'On-device capture guidance failed, please capture a selfie manually.': 'La captura automática para toma de selfie falló. Por favor, hay que tomarse la selfie manualmente.',
3602
+ 'Verifying...': 'Verificando....',
3603
+ 'Please capture the front of your ID card.': 'Hay que capturar el frente de la identificación.',
3604
+ 'Please capture the back of your ID card.': 'Hay que capturar el reverso de la identificación.',
3605
+ 'Please capture the front of your ID card, or the ID page of your passport.': 'Hay que capturar el frente de la identificación o la página de datos del pasaporte.',
3606
+ 'Please capture the back of your ID card, or click Done if submitting a passport.': 'Hay que capturar el reverso de la identificación o hay que presionar el botón de Terminar si se trata de un pasaporte.',
3607
+ 'Please capture the ID page of your passport.': 'Hay que capturar la página de datos del pasaporte.',
3608
+ 'On-device capture guidance failed, please capture a photo of your ID card manually.': 'La captura automática falló. Por favor, hay que tomar una foto de la identificación manualmente.',
3609
+ 'On-device capture guidance failed, please capture a photo of your passport manually.': 'La captura automática falló. Por favor, hay que tomar una foto del pasaporte manualmente.',
3610
+ 'On-device capture guidance failed, please capture photos of your ID card and passport manually.': 'La captura automática falló. Por favor, hay que tomar una foto de la identificación y del pasaporte manualmente.',
3611
+ 'On-device capture guidance failed, please capture photos of your ID card or passport manually.': 'La captura automática falló. Por favor hay que tomar una foto de la identificación o del pasaporte manualmente.',
3612
+ 'Capture ID page of passport': 'Captura pasaporte (página de la foto)',
3613
+ 'Capture back of ID card': 'Captura del reverso',
3614
+ 'Downloading...': 'Descargando...',
3615
+ 'Accessing camera...': 'Accediendo a la cámara',
3616
+ 'Camera ready': 'Cámara lista',
3617
+ 'Loading guided capture experience...': 'Cargando la experiencia guiada para la captura....',
3618
+ 'Guided capture experience ready': 'Experiencia guiada lista',
3619
+ "Let's Go!": '¡Vamos!',
3620
+ 'We are having trouble identifying the correct side of your id do you want to continue with capture anyway?': 'Estamos teniendo problemas para identificar el lado correcto de la identificación,¿continuar con la captura?',
3621
+ OK: 'Sí',
3622
+ 'Capture with Camera': 'Capturar con la cámara',
3623
+ OR: 'O',
3624
+ 'Upload from Storage': 'Adjuntar del almacenamiento',
3625
+ 'Select ID Type': 'Seleccionar el tipo de ID',
3626
+ 'ID Card': 'Identificación',
3627
+ 'Upload Passport': 'Adjuntar pasaporte',
3628
+ 'Upload ID Front': 'Adjuntar el frente de la ID',
3629
+ 'Upload ID Back': 'Adjuntar el reverso de la ID',
3630
+ Cancel: 'Cancelar',
3631
+ 'Upload the back of the ID if it is not included in the front image.': 'Adjuntar el reverso de la ID si no se incluye en la imagen del frente',
3632
+ 'Camera tampering detected': 'Se ha detectado un intento de manipulación de la cámara',
3633
+ "We're sorry, but it looks like the camera is being tampered with. Please check your device and try again by reloading the page.": 'Lo sentimos, pero parece que la cámara está siendo manipulada. Por favor, verifique su dispositivo y vuelva a intentarlo recargando la página.'
5191
3634
  };
5192
3635
 
5193
3636
  var de = {
@@ -5940,212 +4383,1821 @@ var ru = {
5940
4383
  'Upload the back of the ID if it is not included in the front image.': 'Загрузите заднюю сторону удостоверения, если она не включена в изображение передней стороны.\r\n'
5941
4384
  };
5942
4385
 
5943
- var zh = {
5944
- 'English - en': 'Chinese (Traditional) - zh',
5945
- 'Use your device camera to capture your ID': '使用裝置相機拍攝證件',
5946
- 'Use your iPhone as a webcam': '將 iPhone 當作網路攝影機使用',
5947
- 'Models warming up...': '正在暖機...',
5948
- 'Camera initializing...': '相機正在初始化...',
5949
- 'Camera access blocked': '相機存取遭封鎖',
5950
- 'Location access blocked': '位置存取遭封鎖',
5951
- Continue: '繼續',
5952
- 'Processing...': '正在處理...',
5953
- 'Your camera permission is disabled': '已停用相機權限',
5954
- 'This application requires access to your camera to continue. Please accept the permission once prompted by the browser. If the browser does not prompt for camera permissions you must go to settings and provide camera access to the current browser.': '此應用程式需要存取相機才能繼續。瀏覽器提示後,請接受權限。如果瀏覽器未提示相機權限,必須前往設定並為目前瀏覽器提供相機存取權限。',
5955
- 'Your microphone permission is disabled': '已停用麥克風權限',
5956
- 'This application requires access to your microphone to continue. Please accept the permission once prompted by the browser. If the browser does not prompt for microphone permissions you must go to settings and provide microphone access to the current browser.': '此應用程式需要存取麥克風才能繼續。瀏覽器提示後,請接受權限。如果瀏覽器未提示麥克風權限,必須前往設定並為目前瀏覽器提供麥克風存取權限。',
5957
- 'Your location permission is disabled': '已停用位置權限',
5958
- 'This application requires access to your location to continue. Please accept the permission once prompted by the browser. If the browser does not prompt for location permissions you must go to settings and provide location access to the current browser.': '此應用程式需要存取位置才能繼續。瀏覽器提示後,請接受權限。如果瀏覽器未提示位置權限,必須前往設定並為目前瀏覽器提供位置存取權限。',
5959
- Retry: '重試',
5960
- 'Scan the front of ID': '掃描證件正面',
5961
- 'Scan the back of ID': '掃描證件背面',
5962
- 'Scan the ID page of passport': '掃描護照的 ID 頁面',
5963
- 'ID Card Front': '證件正面',
5964
- 'ID Card Back': '證件背面',
5965
- Passport: '護照',
5966
- 'Document not detected': '未偵測到文件',
5967
- 'Document is not centered': '文件未置中',
5968
- 'Document too close please back up': '文件太近,請後退',
5969
- 'Please hold your ID document steady': '請拿穩證件',
5970
- 'Document out of focus – try improving the lighting': '文件失焦 – 請嘗試改善燈光',
5971
- 'ID card front detected - please flip your ID card': '偵測到證件正面 - 請將證件翻面',
5972
- 'ID card back detected - please flip your ID card': '偵測到證件背面 - 請將證件翻面',
5973
- 'ID card detected please scan a passport instead': '偵測到證件,請掃描護照',
5974
- 'Passport detected please scan an ID card instead': '偵測到護照,請掃描證件',
5975
- 'Document detected, hold still...': '偵測到的文件保持不動...',
5976
- 'ID card front detected, hold still...': '偵測到的證件正面保持不動...',
5977
- 'ID card back detected, hold still...': '偵測到的證件背面保持不動...',
5978
- 'Passport detected, hold still...': '偵測到的護照保持不動...',
5979
- 'Capturing...': '正在拍攝...',
5980
- 'Capture failed!': '拍攝失敗!',
5981
- 'Please flip your ID card...': '請將證件翻面...',
5982
- 'ID card front captured.': '已拍攝證件正面。',
5983
- 'ID card back captured.': '已拍攝證件背面。',
5984
- 'ID Capture Successful': '證件拍攝成功',
5985
- 'Verify the entire ID was captured clearly with no glare.': '確認是否清楚拍攝整個證件,無眩光。',
5986
- Submit: '提交',
5987
- 'Submitting...': '正在提交...',
5988
- 'Use your device camera to capture your face': '使用裝置相機拍攝您的臉部',
5989
- 'Remove Sunglasses & Hat': '取下太陽眼鏡和帽子',
5990
- 'Avoid Excessive Backlighting': '避免過度背光',
5991
- 'Hold still for a few seconds...': '請保持不動幾秒...',
5992
- 'Please hold still...': '請保持不動...',
5993
- 'Look straight into the camera...': '請直視相機...',
5994
- 'Move back...': '請後退...',
5995
- 'Move forward...': '請前進...',
5996
- 'Move to the center...': '請移至中心...',
5997
- 'Waiting for face to be detected...': '正在等待臉部辨識...',
5998
- 'Please remove your eye coverings (sunglasses eye patch etc.)...': '請取下眼睛遮蓋物(太陽眼鏡、眼罩等)...',
5999
- 'Please remove your head coverings (hat scarf etc.)...': '請取下頭部遮蓋物(帽子、圍巾等)...',
6000
- 'Please remove your mask...': '請脫下口罩...',
6001
- 'Live face not detected, please try again': '未偵測到活體人臉,請再試一次',
6002
- Exit: '退出',
6003
- 'Face liveness has been verified!': '已驗證人臉活體!',
6004
- Done: '完成',
6005
- 'Could not verify your face.': '無法驗證您的臉部。',
6006
- 'An error occurred while verifying your face.': '驗證您的臉部時發生錯誤。',
6007
- 'Customer has been identified!': '已識別客戶!',
6008
- 'Customer not found': '找不到客戶',
6009
- 'Additional document capture': '其他文件拍攝',
6010
- Next: '下一步',
6011
- 'Please sign the box below': '請在下方的方框中簽名',
6012
- Accept: '接受',
6013
- Clear: '清除',
6014
- 'Video signature has been successfully captured!': '已成功拍攝影片簽名!',
6015
- 'Network unreachable': '網路無法連線',
6016
- "We're having trouble reaching our services please check your connection and try again.": '無法與服務連線,請檢查連線並再試一次。',
6017
- "We're sorry an unexpected error has occurred.": '很抱歉,發生非預期錯誤。',
6018
- 'Document Capture': '文件拍攝',
6019
- Capture: '拍攝',
6020
- 'Retry capture': '重試拍攝',
6021
- Upload: '上傳',
6022
- 'Uploading...': '正在上傳...',
6023
- 'Upload succeeded!': '上傳成功!',
6024
- 'Performing facial recognition, please hold still...': '正在進行臉部辨識,請保持不動...',
6025
- 'Display the front of your ID card...': '出示證件正面...',
6026
- 'Display the back of your ID card...': '出示證件背面...',
6027
- 'Display the ID page of your passport...': '出示護照的 ID 頁面...',
6028
- 'Please move your face to the center...': '請將臉部移至中心...',
6029
- 'Searching for ID card...': '正在搜尋證件...',
6030
- 'Please read the following text aloud': '請大聲讀出以下文字',
6031
- 'Video ID has been successfully captured!': '已成功拍攝影片 ID!',
6032
- 'ID Front Image': '證件正面影像',
6033
- 'ID Back Image': '證件背面影像',
6034
- "We're having some trouble.": '發生一些問題。',
6035
- 'On-device capture guidance failed please capture a selfie manually.': '裝置上拍攝引導失敗,請手動拍攝自拍照',
6036
- 'Verifying...': '正在驗證...',
6037
- 'Please capture the front of your ID card.': '請拍攝證件正面。',
6038
- 'Please capture the back of your ID card.': '請拍攝證件背面。',
6039
- 'Please capture the front of your ID card, or the ID page of your passport.': '請拍攝證件正面或護照的 ID 頁面。',
6040
- 'Please capture the back of your ID card, or click Done if submitting a passport.': '請拍攝證件背面,或者如果提交護照,請按一下「完成」。',
6041
- 'Please capture the ID page of your passport.': '請拍攝護照的 ID 頁面。',
6042
- 'On-device capture guidance failed please capture a photo of your ID card manually.': '裝置上拍攝引導失敗,請手動拍攝證件的照片。',
6043
- 'On-device capture guidance failed please capture a photo of your passport manually.': '裝置上拍攝引導失敗,請手動拍攝護照的照片。',
6044
- 'On-device capture guidance failed please capture photos of your ID card and passport manually.': '裝置上拍攝引導失敗,請手動拍攝證件和護照的照片。',
6045
- 'On-device capture guidance failed please capture photos of your ID card or passport manually.': '裝置上拍攝引導失敗,請手動拍攝證件或護照的照片。',
6046
- 'Capture ID page of passport': '拍攝護照的 ID 頁面',
6047
- 'Capture back of ID card': '拍攝證件背面',
6048
- 'Downloading...': '正在下載...',
6049
- 'Accessing camera...': '正在存取相機...',
6050
- 'Camera ready': '相機就緒',
6051
- 'Loading guided capture experience...': '正在載入引導式拍攝體驗...',
6052
- 'Guided capture experience ready': '引導式拍攝體驗就緒',
6053
- "Let's Go!": '開始!',
6054
- 'We are having trouble identifying the correct side of your id do you want to continue with capture anyway?': '無法識別證件的正確一面,是否仍要繼續拍攝?',
6055
- OK: '確定',
6056
- 'Capture with Camera': '使用相机拍摄',
6057
- OR: '或者',
6058
- 'Upload from Storage': '从存储中上传',
6059
- 'Select ID Type': '选择身份证类型',
6060
- 'ID Card': '身份证',
6061
- 'Upload Passport': '上传护照',
6062
- 'Upload ID Front': '上传身份证正面',
6063
- 'Upload ID Back': '上传身份证背面',
6064
- Cancel: '取消',
6065
- 'Upload the back of the ID if it is not included in the front image.': '如果正面照片没有包含身份证背面,请上传背面照片。'
4386
+ var zh = {
4387
+ 'English - en': 'Chinese (Traditional) - zh',
4388
+ 'Use your device camera to capture your ID': '使用裝置相機拍攝證件',
4389
+ 'Use your iPhone as a webcam': '將 iPhone 當作網路攝影機使用',
4390
+ 'Models warming up...': '正在暖機...',
4391
+ 'Camera initializing...': '相機正在初始化...',
4392
+ 'Camera access blocked': '相機存取遭封鎖',
4393
+ 'Location access blocked': '位置存取遭封鎖',
4394
+ Continue: '繼續',
4395
+ 'Processing...': '正在處理...',
4396
+ 'Your camera permission is disabled': '已停用相機權限',
4397
+ 'This application requires access to your camera to continue. Please accept the permission once prompted by the browser. If the browser does not prompt for camera permissions you must go to settings and provide camera access to the current browser.': '此應用程式需要存取相機才能繼續。瀏覽器提示後,請接受權限。如果瀏覽器未提示相機權限,必須前往設定並為目前瀏覽器提供相機存取權限。',
4398
+ 'Your microphone permission is disabled': '已停用麥克風權限',
4399
+ 'This application requires access to your microphone to continue. Please accept the permission once prompted by the browser. If the browser does not prompt for microphone permissions you must go to settings and provide microphone access to the current browser.': '此應用程式需要存取麥克風才能繼續。瀏覽器提示後,請接受權限。如果瀏覽器未提示麥克風權限,必須前往設定並為目前瀏覽器提供麥克風存取權限。',
4400
+ 'Your location permission is disabled': '已停用位置權限',
4401
+ 'This application requires access to your location to continue. Please accept the permission once prompted by the browser. If the browser does not prompt for location permissions you must go to settings and provide location access to the current browser.': '此應用程式需要存取位置才能繼續。瀏覽器提示後,請接受權限。如果瀏覽器未提示位置權限,必須前往設定並為目前瀏覽器提供位置存取權限。',
4402
+ Retry: '重試',
4403
+ 'Scan the front of ID': '掃描證件正面',
4404
+ 'Scan the back of ID': '掃描證件背面',
4405
+ 'Scan the ID page of passport': '掃描護照的 ID 頁面',
4406
+ 'ID Card Front': '證件正面',
4407
+ 'ID Card Back': '證件背面',
4408
+ Passport: '護照',
4409
+ 'Document not detected': '未偵測到文件',
4410
+ 'Document is not centered': '文件未置中',
4411
+ 'Document too close please back up': '文件太近,請後退',
4412
+ 'Please hold your ID document steady': '請拿穩證件',
4413
+ 'Document out of focus – try improving the lighting': '文件失焦 – 請嘗試改善燈光',
4414
+ 'ID card front detected - please flip your ID card': '偵測到證件正面 - 請將證件翻面',
4415
+ 'ID card back detected - please flip your ID card': '偵測到證件背面 - 請將證件翻面',
4416
+ 'ID card detected please scan a passport instead': '偵測到證件,請掃描護照',
4417
+ 'Passport detected please scan an ID card instead': '偵測到護照,請掃描證件',
4418
+ 'Document detected, hold still...': '偵測到的文件保持不動...',
4419
+ 'ID card front detected, hold still...': '偵測到的證件正面保持不動...',
4420
+ 'ID card back detected, hold still...': '偵測到的證件背面保持不動...',
4421
+ 'Passport detected, hold still...': '偵測到的護照保持不動...',
4422
+ 'Capturing...': '正在拍攝...',
4423
+ 'Capture failed!': '拍攝失敗!',
4424
+ 'Please flip your ID card...': '請將證件翻面...',
4425
+ 'ID card front captured.': '已拍攝證件正面。',
4426
+ 'ID card back captured.': '已拍攝證件背面。',
4427
+ 'ID Capture Successful': '證件拍攝成功',
4428
+ 'Verify the entire ID was captured clearly with no glare.': '確認是否清楚拍攝整個證件,無眩光。',
4429
+ Submit: '提交',
4430
+ 'Submitting...': '正在提交...',
4431
+ 'Use your device camera to capture your face': '使用裝置相機拍攝您的臉部',
4432
+ 'Remove Sunglasses & Hat': '取下太陽眼鏡和帽子',
4433
+ 'Avoid Excessive Backlighting': '避免過度背光',
4434
+ 'Hold still for a few seconds...': '請保持不動幾秒...',
4435
+ 'Please hold still...': '請保持不動...',
4436
+ 'Look straight into the camera...': '請直視相機...',
4437
+ 'Move back...': '請後退...',
4438
+ 'Move forward...': '請前進...',
4439
+ 'Move to the center...': '請移至中心...',
4440
+ 'Waiting for face to be detected...': '正在等待臉部辨識...',
4441
+ 'Please remove your eye coverings (sunglasses eye patch etc.)...': '請取下眼睛遮蓋物(太陽眼鏡、眼罩等)...',
4442
+ 'Please remove your head coverings (hat scarf etc.)...': '請取下頭部遮蓋物(帽子、圍巾等)...',
4443
+ 'Please remove your mask...': '請脫下口罩...',
4444
+ 'Live face not detected, please try again': '未偵測到活體人臉,請再試一次',
4445
+ Exit: '退出',
4446
+ 'Face liveness has been verified!': '已驗證人臉活體!',
4447
+ Done: '完成',
4448
+ 'Could not verify your face.': '無法驗證您的臉部。',
4449
+ 'An error occurred while verifying your face.': '驗證您的臉部時發生錯誤。',
4450
+ 'Customer has been identified!': '已識別客戶!',
4451
+ 'Customer not found': '找不到客戶',
4452
+ 'Additional document capture': '其他文件拍攝',
4453
+ Next: '下一步',
4454
+ 'Please sign the box below': '請在下方的方框中簽名',
4455
+ Accept: '接受',
4456
+ Clear: '清除',
4457
+ 'Video signature has been successfully captured!': '已成功拍攝影片簽名!',
4458
+ 'Network unreachable': '網路無法連線',
4459
+ "We're having trouble reaching our services please check your connection and try again.": '無法與服務連線,請檢查連線並再試一次。',
4460
+ "We're sorry an unexpected error has occurred.": '很抱歉,發生非預期錯誤。',
4461
+ 'Document Capture': '文件拍攝',
4462
+ Capture: '拍攝',
4463
+ 'Retry capture': '重試拍攝',
4464
+ Upload: '上傳',
4465
+ 'Uploading...': '正在上傳...',
4466
+ 'Upload succeeded!': '上傳成功!',
4467
+ 'Performing facial recognition, please hold still...': '正在進行臉部辨識,請保持不動...',
4468
+ 'Display the front of your ID card...': '出示證件正面...',
4469
+ 'Display the back of your ID card...': '出示證件背面...',
4470
+ 'Display the ID page of your passport...': '出示護照的 ID 頁面...',
4471
+ 'Please move your face to the center...': '請將臉部移至中心...',
4472
+ 'Searching for ID card...': '正在搜尋證件...',
4473
+ 'Please read the following text aloud': '請大聲讀出以下文字',
4474
+ 'Video ID has been successfully captured!': '已成功拍攝影片 ID!',
4475
+ 'ID Front Image': '證件正面影像',
4476
+ 'ID Back Image': '證件背面影像',
4477
+ "We're having some trouble.": '發生一些問題。',
4478
+ 'On-device capture guidance failed please capture a selfie manually.': '裝置上拍攝引導失敗,請手動拍攝自拍照',
4479
+ 'Verifying...': '正在驗證...',
4480
+ 'Please capture the front of your ID card.': '請拍攝證件正面。',
4481
+ 'Please capture the back of your ID card.': '請拍攝證件背面。',
4482
+ 'Please capture the front of your ID card, or the ID page of your passport.': '請拍攝證件正面或護照的 ID 頁面。',
4483
+ 'Please capture the back of your ID card, or click Done if submitting a passport.': '請拍攝證件背面,或者如果提交護照,請按一下「完成」。',
4484
+ 'Please capture the ID page of your passport.': '請拍攝護照的 ID 頁面。',
4485
+ 'On-device capture guidance failed please capture a photo of your ID card manually.': '裝置上拍攝引導失敗,請手動拍攝證件的照片。',
4486
+ 'On-device capture guidance failed please capture a photo of your passport manually.': '裝置上拍攝引導失敗,請手動拍攝護照的照片。',
4487
+ 'On-device capture guidance failed please capture photos of your ID card and passport manually.': '裝置上拍攝引導失敗,請手動拍攝證件和護照的照片。',
4488
+ 'On-device capture guidance failed please capture photos of your ID card or passport manually.': '裝置上拍攝引導失敗,請手動拍攝證件或護照的照片。',
4489
+ 'Capture ID page of passport': '拍攝護照的 ID 頁面',
4490
+ 'Capture back of ID card': '拍攝證件背面',
4491
+ 'Downloading...': '正在下載...',
4492
+ 'Accessing camera...': '正在存取相機...',
4493
+ 'Camera ready': '相機就緒',
4494
+ 'Loading guided capture experience...': '正在載入引導式拍攝體驗...',
4495
+ 'Guided capture experience ready': '引導式拍攝體驗就緒',
4496
+ "Let's Go!": '開始!',
4497
+ 'We are having trouble identifying the correct side of your id do you want to continue with capture anyway?': '無法識別證件的正確一面,是否仍要繼續拍攝?',
4498
+ OK: '確定',
4499
+ 'Capture with Camera': '使用相机拍摄',
4500
+ OR: '或者',
4501
+ 'Upload from Storage': '从存储中上传',
4502
+ 'Select ID Type': '选择身份证类型',
4503
+ 'ID Card': '身份证',
4504
+ 'Upload Passport': '上传护照',
4505
+ 'Upload ID Front': '上传身份证正面',
4506
+ 'Upload ID Back': '上传身份证背面',
4507
+ Cancel: '取消',
4508
+ 'Upload the back of the ID if it is not included in the front image.': '如果正面照片没有包含身份证背面,请上传背面照片。'
4509
+ };
4510
+
4511
+ var resources = {
4512
+ en: {
4513
+ translation: en
4514
+ },
4515
+ es: {
4516
+ translation: es
4517
+ },
4518
+ de: {
4519
+ translation: de
4520
+ },
4521
+ fr: {
4522
+ translation: fr
4523
+ },
4524
+ it: {
4525
+ translation: it
4526
+ },
4527
+ ja: {
4528
+ translation: ja
4529
+ },
4530
+ pt: {
4531
+ translation: pt
4532
+ },
4533
+ ru: {
4534
+ translation: ru
4535
+ },
4536
+ zh: {
4537
+ translation: zh
4538
+ }
4539
+ };
4540
+ function initializeI18n() {
4541
+ void i18n.use(LanguageDetector).use(initReactI18next).init({
4542
+ resources: resources,
4543
+ detection: {
4544
+ caches: []
4545
+ },
4546
+ fallbackLng: 'en',
4547
+ debug: false,
4548
+ interpolation: {
4549
+ escapeValue: false
4550
+ }
4551
+ });
4552
+ }
4553
+ var useLanguage = function useLanguage(lang) {
4554
+ var i18n = useTranslation().i18n;
4555
+ useEffect(function () {
4556
+ if (lang !== 'auto') {
4557
+ void i18n.changeLanguage(lang);
4558
+ } else {
4559
+ void i18n.changeLanguage(); // call without argument to use detection
4560
+ }
4561
+ }, [i18n, lang]);
4562
+ };
4563
+ function evaluateVerbiage(t, currentLanguage, verbiage, fallback) {
4564
+ if (typeof verbiage === 'string') return verbiage;
4565
+ if (typeof verbiage === 'object') {
4566
+ var translations = verbiage;
4567
+ if (translations[currentLanguage]) return translations[currentLanguage];
4568
+ var nonLocaleLang = currentLanguage.split('-')[0];
4569
+ if (translations[nonLocaleLang]) return translations[nonLocaleLang];
4570
+ }
4571
+ return t(fallback);
4572
+ }
4573
+ function useVerbiage(verbiage, fallback) {
4574
+ var _a = useTranslation(),
4575
+ t = _a.t,
4576
+ i18n = _a.i18n;
4577
+ return useMemo(function () {
4578
+ return evaluateVerbiage(t, i18n.language, verbiage, fallback);
4579
+ }, [fallback, i18n.language, t, verbiage]);
4580
+ }
4581
+ function useTranslations(verbiage, fallbacks) {
4582
+ var _a = useTranslation(),
4583
+ t = _a.t,
4584
+ i18n = _a.i18n;
4585
+ return useMemo(function () {
4586
+ return _assign(_assign({}, verbiage), Object.keys(fallbacks).reduce(function (result, key) {
4587
+ var _a;
4588
+ return _assign(_assign({}, result), (_a = {}, _a[key] = evaluateVerbiage(t, i18n.language, verbiage === null || verbiage === void 0 ? void 0 : verbiage[key], fallbacks[key]), _a));
4589
+ }, {}));
4590
+ }, [fallbacks, i18n.language, t, verbiage]);
4591
+ }
4592
+
4593
+ var initialState$5 = {
4594
+ videoRef: {
4595
+ current: null
4596
+ },
4597
+ videoLoaded: false,
4598
+ videoStream: null,
4599
+ videoDevice: null,
4600
+ isRearFacing: false,
4601
+ camera: null,
4602
+ cameraReady: false,
4603
+ cameraAccessDenied: false,
4604
+ iphoneContinuityCameraAvailable: false,
4605
+ iphoneContinuityCameraDenied: false,
4606
+ preferIphoneContinuityCamera: true,
4607
+ cameraTamperingDetected: false,
4608
+ audioStream: null,
4609
+ microphoneReady: false,
4610
+ microphoneAccessDenied: false
4611
+ };
4612
+ var createCameraStore = function createCameraStore(config) {
4613
+ var store = createStore(function (set, get) {
4614
+ return _assign(_assign(_assign({}, initialState$5), config), {
4615
+ reset: function reset() {
4616
+ return set(_assign(_assign({}, initialState$5), config));
4617
+ },
4618
+ setConfig: function setConfig(config) {
4619
+ return set(config);
4620
+ },
4621
+ onVideoMounted: function onVideoMounted(e) {
4622
+ var _a;
4623
+ var selectedVideoStreamId = (_a = get().videoStream) === null || _a === void 0 ? void 0 : _a.id;
4624
+ if (!selectedVideoStreamId) return;
4625
+ var srcObject = e.currentTarget.srcObject;
4626
+ if (srcObject.id === selectedVideoStreamId) {
4627
+ set({
4628
+ videoLoaded: true
4629
+ });
4630
+ } else {
4631
+ set({
4632
+ cameraTamperingDetected: true
4633
+ });
4634
+ }
4635
+ },
4636
+ setIphoneContinuityCameraAllowed: function setIphoneContinuityCameraAllowed(value) {
4637
+ return set({
4638
+ preferIphoneContinuityCamera: value
4639
+ });
4640
+ },
4641
+ requestCameraAccess: function requestCameraAccess() {
4642
+ return __awaiter(this, void 0, void 0, function () {
4643
+ var _a, videoRef, releaseCameraAccess, preferFrontFacingCamera, preferIphoneContinuityCamera, iphoneContinuityCameraDenied, availableCameras, selectedCamera, platform_1, iphoneContinuityCamera, constraints, stream_1, e_1, e_2, handleStreamEnded_1, videoTrack_1, camera_1, e_3;
4644
+ var _b, _c, _d;
4645
+ return __generator(this, function (_e) {
4646
+ switch (_e.label) {
4647
+ case 0:
4648
+ _a = get(), videoRef = _a.videoRef, releaseCameraAccess = _a.releaseCameraAccess, preferFrontFacingCamera = _a.preferFrontFacingCamera, preferIphoneContinuityCamera = _a.preferIphoneContinuityCamera, iphoneContinuityCameraDenied = _a.iphoneContinuityCameraDenied;
4649
+ releaseCameraAccess();
4650
+ _e.label = 1;
4651
+ case 1:
4652
+ _e.trys.push([1, 11,, 12]);
4653
+ return [4 /*yield*/, listAvailableCameras()];
4654
+ case 2:
4655
+ availableCameras = _e.sent();
4656
+ selectedCamera = void 0;
4657
+ debug('availableCameras', availableCameras);
4658
+ platform_1 = getPlatform();
4659
+ debug('platformDetails', platform_1);
4660
+ if (!iphoneContinuityCameraDenied && (!(platform_1 === null || platform_1 === void 0 ? void 0 : platform_1.os) || platform_1.os.family === 'OS X')) {
4661
+ iphoneContinuityCamera = availableCameras.find(function (deviceInfo) {
4662
+ return cameraLabelMatches(deviceInfo, 'iphone');
4663
+ });
4664
+ set({
4665
+ iphoneContinuityCameraAvailable: !!iphoneContinuityCamera
4666
+ });
4667
+ if (iphoneContinuityCamera && preferIphoneContinuityCamera) {
4668
+ selectedCamera = iphoneContinuityCamera;
4669
+ }
4670
+ } else if (((_b = platform_1 === null || platform_1 === void 0 ? void 0 : platform_1.os) === null || _b === void 0 ? void 0 : _b.family) === 'Android' || availableCameras.every(function (c) {
4671
+ return c.label.startsWith('camera2 ');
4672
+ })) {
4673
+ availableCameras = availableCameras.sort(function (a, b) {
4674
+ return a.label.toLowerCase().localeCompare(b.label.toLowerCase());
4675
+ });
4676
+ debug('cameras have been sorted', availableCameras);
4677
+ }
4678
+ if (preferFrontFacingCamera) {
4679
+ selectedCamera = availableCameras.find(function (deviceInfo) {
4680
+ return cameraLabelMatches(deviceInfo, frontCameraLabels);
4681
+ });
4682
+ }
4683
+ selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
4684
+ return cameraLabelMatches(deviceInfo, 'backtriplecamera');
4685
+ }));
4686
+ selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
4687
+ return cameraLabelMatches(deviceInfo, 'backdualcamera');
4688
+ }));
4689
+ selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
4690
+ return cameraLabelMatches(deviceInfo, rearCameraLabels) && !cameraLabelMatches(deviceInfo, backUltraWideCameraLabels);
4691
+ }));
4692
+ selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
4693
+ return cameraLabelMatches(deviceInfo, rearCameraLabels);
4694
+ }));
4695
+ // on iOS, the front facing camera always is at the first position in the list, so we skip it if all else fails.
4696
+ if (!preferFrontFacingCamera && ((_c = platform_1 === null || platform_1 === void 0 ? void 0 : platform_1.os) === null || _c === void 0 ? void 0 : _c.family) === 'iOS' && availableCameras.length > 0) {
4697
+ selectedCamera || (selectedCamera = availableCameras[1]);
4698
+ }
4699
+ selectedCamera || (selectedCamera = availableCameras[0]);
4700
+ debug('selectedCamera', selectedCamera);
4701
+ set({
4702
+ videoDevice: selectedCamera
4703
+ });
4704
+ constraints = {
4705
+ audio: false,
4706
+ video: {
4707
+ deviceId: {
4708
+ exact: selectedCamera.deviceId
4709
+ },
4710
+ width: {
4711
+ ideal: config.maxVideoWidth
4712
+ },
4713
+ aspectRatio: 1.777777778,
4714
+ frameRate: {}
4715
+ }
4716
+ };
4717
+ if (config.maxFps) {
4718
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
4719
+ // @ts-ignore
4720
+ constraints.video.frameRate = {
4721
+ max: config.maxFps
4722
+ };
4723
+ }
4724
+ stream_1 = null;
4725
+ _e.label = 3;
4726
+ case 3:
4727
+ _e.trys.push([3, 5,, 6]);
4728
+ debug('obtaining camera access with constraints', constraints);
4729
+ return [4 /*yield*/, navigator.mediaDevices.getUserMedia(constraints)];
4730
+ case 4:
4731
+ stream_1 = _e.sent();
4732
+ return [3 /*break*/, 6];
4733
+ case 5:
4734
+ e_1 = _e.sent();
4735
+ if (e_1.name === 'NotAllowedError') {
4736
+ if (preferIphoneContinuityCamera) {
4737
+ set({
4738
+ iphoneContinuityCameraAvailable: false,
4739
+ iphoneContinuityCameraDenied: true
4740
+ });
4741
+ } else {
4742
+ set({
4743
+ cameraAccessDenied: true
4744
+ });
4745
+ }
4746
+ return [2 /*return*/];
4747
+ }
4748
+ return [3 /*break*/, 6];
4749
+ case 6:
4750
+ if (!!stream_1) return [3 /*break*/, 10];
4751
+ _e.label = 7;
4752
+ case 7:
4753
+ _e.trys.push([7, 9,, 10]);
4754
+ return [4 /*yield*/, navigator.mediaDevices.getUserMedia({
4755
+ audio: false,
4756
+ video: true
4757
+ })];
4758
+ case 8:
4759
+ stream_1 = _e.sent();
4760
+ debug('opened stream with no width and height constraints');
4761
+ return [3 /*break*/, 10];
4762
+ case 9:
4763
+ e_2 = _e.sent();
4764
+ debug('cannot open stream at all', e_2);
4765
+ return [3 /*break*/, 10];
4766
+ case 10:
4767
+ if (!stream_1) {
4768
+ error('failed to open camera');
4769
+ throw new Error('failed to open camera: ');
4770
+ }
4771
+ debug('camera access granted with constraints', constraints);
4772
+ handleStreamEnded_1 = function handleStreamEnded_1() {
4773
+ if (preferIphoneContinuityCamera && get().iphoneContinuityCameraAvailable) {
4774
+ debug('someone unplugged the continuity camera');
4775
+ set({
4776
+ videoStream: null,
4777
+ videoDevice: null,
4778
+ cameraReady: false,
4779
+ iphoneContinuityCameraAvailable: false,
4780
+ iphoneContinuityCameraDenied: true
4781
+ });
4782
+ get().requestCameraAccess();
4783
+ } else {
4784
+ debug('someone unplugged the webcam');
4785
+ releaseCameraAccess();
4786
+ set({
4787
+ videoStream: null,
4788
+ videoDevice: null,
4789
+ videoLoaded: false,
4790
+ cameraReady: false,
4791
+ cameraAccessDenied: true
4792
+ });
4793
+ }
4794
+ };
4795
+ (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.addEventListener('ended', handleStreamEnded_1);
4796
+ videoTrack_1 = stream_1.getVideoTracks()[0];
4797
+ videoTrack_1.onended = handleStreamEnded_1;
4798
+ camera_1 = obtainCameraAccess(stream_1, selectedCamera.label, videoRef.current);
4799
+ setTimeout(function () {
4800
+ // iOS 17 has a strange behavior where the video track flickers between muted and unmuted
4801
+ // when the camera access is being requested. This delay is a workaround for that.
4802
+ videoTrack_1.onmute = function () {
4803
+ if (videoTrack_1.readyState !== 'live') handleStreamEnded_1();
4804
+ };
4805
+ set({
4806
+ camera: camera_1,
4807
+ cameraReady: true,
4808
+ cameraAccessDenied: false,
4809
+ isRearFacing: camera_1.isRearFacing,
4810
+ videoStream: stream_1
4811
+ });
4812
+ }, 500);
4813
+ return [3 /*break*/, 12];
4814
+ case 11:
4815
+ e_3 = _e.sent();
4816
+ if (e_3.name === 'NotAllowedError') {
4817
+ error('camera access has been blocked by the user', e_3);
4818
+ set({
4819
+ cameraAccessDenied: true
4820
+ });
4821
+ } else {
4822
+ error('camera access encountered some other error', e_3);
4823
+ throw e_3;
4824
+ }
4825
+ return [3 /*break*/, 12];
4826
+ case 12:
4827
+ return [2 /*return*/];
4828
+ }
4829
+ });
4830
+ });
4831
+ },
4832
+ releaseCameraAccess: function releaseCameraAccess() {
4833
+ return __awaiter(this, void 0, void 0, function () {
4834
+ var camera;
4835
+ return __generator(this, function (_a) {
4836
+ camera = get().camera;
4837
+ if (!camera) return [2 /*return*/];
4838
+ camera.release();
4839
+ set({
4840
+ camera: null,
4841
+ cameraReady: false,
4842
+ cameraAccessDenied: false,
4843
+ videoDevice: null,
4844
+ videoStream: null,
4845
+ videoLoaded: false
4846
+ });
4847
+ return [2 /*return*/];
4848
+ });
4849
+ });
4850
+ },
4851
+ requestMicrophoneAccess: function requestMicrophoneAccess() {
4852
+ return __awaiter(this, void 0, void 0, function () {
4853
+ var stream_2, e_4;
4854
+ return __generator(this, function (_a) {
4855
+ switch (_a.label) {
4856
+ case 0:
4857
+ get().releaseMicrophoneAccess();
4858
+ _a.label = 1;
4859
+ case 1:
4860
+ _a.trys.push([1, 3,, 4]);
4861
+ return [4 /*yield*/, navigator.mediaDevices.getUserMedia({
4862
+ audio: true,
4863
+ video: false
4864
+ })
4865
+ // iOS 17 has a strange behavior where the video track flickers between muted and unmuted
4866
+ // when the camera access is being requested. This delay is a workaround for that.
4867
+ ];
4868
+ case 2:
4869
+ stream_2 = _a.sent();
4870
+ // iOS 17 has a strange behavior where the video track flickers between muted and unmuted
4871
+ // when the camera access is being requested. This delay is a workaround for that.
4872
+ setTimeout(function () {
4873
+ set({
4874
+ audioStream: stream_2,
4875
+ microphoneReady: true,
4876
+ microphoneAccessDenied: false
4877
+ });
4878
+ var handleStreamEnded = function handleStreamEnded() {
4879
+ set({
4880
+ microphoneReady: false,
4881
+ microphoneAccessDenied: true
4882
+ });
4883
+ };
4884
+ var track = stream_2.getAudioTracks()[0];
4885
+ track.onended = handleStreamEnded;
4886
+ track.onmute = function () {
4887
+ if (track.readyState !== 'live') handleStreamEnded();
4888
+ };
4889
+ }, 500);
4890
+ return [3 /*break*/, 4];
4891
+ case 3:
4892
+ e_4 = _a.sent();
4893
+ debug('failed to open microphone', e_4);
4894
+ set({
4895
+ microphoneAccessDenied: true
4896
+ });
4897
+ return [3 /*break*/, 4];
4898
+ case 4:
4899
+ return [2 /*return*/];
4900
+ }
4901
+ });
4902
+ });
4903
+ },
4904
+ releaseMicrophoneAccess: function releaseMicrophoneAccess() {
4905
+ var _a;
4906
+ var audioStream = get().audioStream;
4907
+ (_a = audioStream === null || audioStream === void 0 ? void 0 : audioStream.stop) === null || _a === void 0 ? void 0 : _a.call(audioStream);
4908
+ audioStream === null || audioStream === void 0 ? void 0 : audioStream.getAudioTracks().forEach(function (track) {
4909
+ var _a;
4910
+ (_a = track.stop) === null || _a === void 0 ? void 0 : _a.call(track);
4911
+ });
4912
+ set({
4913
+ audioStream: null,
4914
+ microphoneReady: false,
4915
+ microphoneAccessDenied: false
4916
+ });
4917
+ }
4918
+ });
4919
+ });
4920
+ if (config.requestAccessAutomatically) {
4921
+ void store.getState().requestCameraAccess();
4922
+ }
4923
+ return _assign(_assign({}, store), {
4924
+ destroy: function destroy() {
4925
+ store.getState().releaseCameraAccess();
4926
+ store.getState().releaseMicrophoneAccess();
4927
+ }
4928
+ });
4929
+ };
4930
+ var CameraStoreContext = /*#__PURE__*/createContext(undefined);
4931
+ function CameraStoreProvider(_a) {
4932
+ var children = _a.children,
4933
+ _b = _a.requestAccessAutomatically,
4934
+ requestAccessAutomatically = _b === void 0 ? true : _b,
4935
+ _c = _a.preferIphoneContinuityCamera,
4936
+ preferIphoneContinuityCamera = _c === void 0 ? true : _c,
4937
+ _d = _a.preferFrontFacingCamera,
4938
+ preferFrontFacingCamera = _d === void 0 ? false : _d,
4939
+ _e = _a.maxVideoWidth,
4940
+ maxVideoWidth = _e === void 0 ? 1920 : _e,
4941
+ maxFps = _a.maxFps,
4942
+ onCameraAccessDenied = _a.onCameraAccessDenied,
4943
+ onCameraTamperingDetected = _a.onCameraTamperingDetected,
4944
+ onMicrophoneAccessDenied = _a.onMicrophoneAccessDenied,
4945
+ _f = _a.requireMicrophoneAccess,
4946
+ requireMicrophoneAccess = _f === void 0 ? false : _f,
4947
+ _g = _a.classNames,
4948
+ classNames = _g === void 0 ? {} : _g,
4949
+ _h = _a.verbiage,
4950
+ verbiage = _h === void 0 ? {} : _h;
4951
+ var videoRef = useRef(null);
4952
+ var store = useRef();
4953
+ store.current || (store.current = createCameraStore({
4954
+ videoRef: videoRef,
4955
+ requestAccessAutomatically: requestAccessAutomatically,
4956
+ preferIphoneContinuityCamera: preferIphoneContinuityCamera,
4957
+ preferFrontFacingCamera: preferFrontFacingCamera,
4958
+ maxVideoWidth: maxVideoWidth,
4959
+ maxFps: maxFps,
4960
+ onCameraAccessDenied: onCameraAccessDenied,
4961
+ onMicrophoneAccessDenied: onMicrophoneAccessDenied,
4962
+ requireMicrophoneAccess: requireMicrophoneAccess
4963
+ }));
4964
+ useEffect(function () {
4965
+ var _a, _b, _c;
4966
+ var state = (_a = store.current) === null || _a === void 0 ? void 0 : _a.getState();
4967
+ if (!state) return;
4968
+ if (preferIphoneContinuityCamera !== (state === null || state === void 0 ? void 0 : state.preferIphoneContinuityCamera) || preferFrontFacingCamera !== (state === null || state === void 0 ? void 0 : state.preferFrontFacingCamera)) {
4969
+ (_b = store.current) === null || _b === void 0 ? void 0 : _b.setState({
4970
+ preferIphoneContinuityCamera: preferIphoneContinuityCamera,
4971
+ preferFrontFacingCamera: preferFrontFacingCamera
4972
+ });
4973
+ (_c = store.current) === null || _c === void 0 ? void 0 : _c.getState().requestCameraAccess();
4974
+ }
4975
+ }, [preferFrontFacingCamera, preferIphoneContinuityCamera]);
4976
+ useEffect(function () {
4977
+ var _a;
4978
+ if (requireMicrophoneAccess) {
4979
+ (_a = store.current) === null || _a === void 0 ? void 0 : _a.getState().requestMicrophoneAccess();
4980
+ }
4981
+ }, [requireMicrophoneAccess]);
4982
+ useEffect(function () {
4983
+ return function () {
4984
+ var _a;
4985
+ return (_a = store.current) === null || _a === void 0 ? void 0 : _a.destroy();
4986
+ };
4987
+ }, []);
4988
+ return /*#__PURE__*/React__default.createElement(CameraStoreContext.Provider, {
4989
+ value: store.current
4990
+ }, /*#__PURE__*/React__default.createElement(CameraTamperSeal, {
4991
+ onCameraTamperingDetected: onCameraTamperingDetected,
4992
+ classNames: classNames.cameraTamperSeal,
4993
+ verbiage: verbiage.cameraTamperSeal
4994
+ }, children));
4995
+ }
4996
+ function CameraTamperSeal(_a) {
4997
+ var children = _a.children,
4998
+ onCameraTamperingDetected = _a.onCameraTamperingDetected,
4999
+ _b = _a.classNames,
5000
+ classNames = _b === void 0 ? {} : _b,
5001
+ _c = _a.verbiage,
5002
+ rawVerbiage = _c === void 0 ? {} : _c;
5003
+ var cameraTamperingDetected = useCameraStore().cameraTamperingDetected;
5004
+ var _d = useTranslations(rawVerbiage, {
5005
+ headingText: 'Camera tampering detected',
5006
+ messageText: "We're sorry, but it looks like the camera is being tampered with. Please check your device and try again by reloading the page."
5007
+ }),
5008
+ headingText = _d.headingText,
5009
+ messageText = _d.messageText;
5010
+ var onCameraTamperingDetectedRef = useRef(onCameraTamperingDetected);
5011
+ useEffect(function () {
5012
+ onCameraTamperingDetectedRef.current = onCameraTamperingDetected;
5013
+ }, [onCameraTamperingDetected]);
5014
+ useEffect(function () {
5015
+ var _a;
5016
+ if (cameraTamperingDetected) (_a = onCameraTamperingDetectedRef.current) === null || _a === void 0 ? void 0 : _a.call(onCameraTamperingDetectedRef);
5017
+ }, [cameraTamperingDetected]);
5018
+ if (!cameraTamperingDetected) return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, children);
5019
+ return /*#__PURE__*/React__default.createElement(OverlayContainer, {
5020
+ className: classNames.container
5021
+ }, /*#__PURE__*/React__default.createElement(StyledOverlayInner$4, {
5022
+ className: classNames.inner
5023
+ }, /*#__PURE__*/React__default.createElement(StyledOverlayHeading, {
5024
+ className: classNames.heading
5025
+ }, headingText), /*#__PURE__*/React__default.createElement("p", {
5026
+ className: classNames.message
5027
+ }, messageText)));
5028
+ }
5029
+ var StyledOverlayInner$4 = styled(OverlayInner$2)(templateObject_1$H || (templateObject_1$H = __makeTemplateObject(["\n justify-content: center;\n"], ["\n justify-content: center;\n"])));
5030
+ var StyledOverlayHeading = styled.h3(templateObject_2$A || (templateObject_2$A = __makeTemplateObject(["\n margin-bottom: 8px;\n"], ["\n margin-bottom: 8px;\n"])));
5031
+ function useCameraStore(selector) {
5032
+ var store = useContext(CameraStoreContext);
5033
+ if (!store) throw new Error('useCameraStore cannot be used without Provider');
5034
+ return useStore(store, selector);
5035
+ }
5036
+ var templateObject_1$H, templateObject_2$A;
5037
+
5038
+ var DocumentDetectionModelContext = /*#__PURE__*/createContext({
5039
+ startDocumentDetection: function startDocumentDetection() {
5040
+ return null;
5041
+ },
5042
+ stopDocumentDetection: function stopDocumentDetection() {
5043
+ return null;
5044
+ },
5045
+ loadDocumentDetectionModel: function loadDocumentDetectionModel() {
5046
+ return null;
5047
+ },
5048
+ documentDetectionModelReady: false,
5049
+ documentDetectionModelDownloadProgress: 0,
5050
+ documentDetectionModelError: null,
5051
+ onDocumentDetected: function onDocumentDetected() {
5052
+ return null;
5053
+ },
5054
+ detectionTime: 0,
5055
+ documentDetectionThresholds: {},
5056
+ setDocumentDetectionThresholds: function setDocumentDetectionThresholds() {
5057
+ return null;
5058
+ },
5059
+ documentDetectionBoundaries: defaultDocumentDetectionBoundaries,
5060
+ setDocumentDetectionBoundaries: function setDocumentDetectionBoundaries() {
5061
+ return null;
5062
+ },
5063
+ documentDetectionLastPredictionCanvas: {
5064
+ current: null
5065
+ },
5066
+ clearDocumentDetectionLastPredictionCanvas: function clearDocumentDetectionLastPredictionCanvas() {
5067
+ return null;
5068
+ }
5069
+ });
5070
+ function DocumentDetectionModelProvider(_a) {
5071
+ var _this = this;
5072
+ var _b = _a.autoStart,
5073
+ autoStart = _b === void 0 ? true : _b,
5074
+ children = _a.children,
5075
+ _c = _a.throttleMs,
5076
+ throttleMs = _c === void 0 ? 16 : _c,
5077
+ _d = _a.delayAfterStartMs,
5078
+ delayAfterStartMs = _d === void 0 ? 0 : _d,
5079
+ _e = _a.documentDetectionModelPath,
5080
+ documentDetectionModelPath = _e === void 0 ? defaultDocumentDetectorModelPath : _e,
5081
+ _f = _a.documentDetectionModelScoreThreshold,
5082
+ documentDetectionModelScoreThreshold = _f === void 0 ? defaultDocumentDetectionScoreThreshold : _f,
5083
+ _g = _a.documentDetectionModelLoadTimeoutMs,
5084
+ documentDetectionModelLoadTimeoutMs = _g === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _g,
5085
+ onDocumentDetectionModelError = _a.onDocumentDetectionModelError,
5086
+ _h = _a.shouldLoadModels,
5087
+ shouldLoadModelsProp = _h === void 0 ? true : _h;
5088
+ var _j = useCameraStore(),
5089
+ videoRef = _j.videoRef,
5090
+ videoLoaded = _j.videoLoaded,
5091
+ cameraReady = _j.cameraReady;
5092
+ var lastPredictionCanvas = useRef(null);
5093
+ var onPredictionHandler = useRef();
5094
+ var _k = useState({}),
5095
+ documentDetectionThresholds = _k[0],
5096
+ setDocumentDetectionThresholds = _k[1];
5097
+ var _l = useState(defaultDocumentDetectionBoundaries),
5098
+ documentDetectionBoundaries = _l[0],
5099
+ setDocumentDetectionBoundaries = _l[1];
5100
+ var _m = useState(0),
5101
+ timesAllZero = _m[0],
5102
+ setTimesAllZero = _m[1];
5103
+ var _o = useState(0),
5104
+ canvasKey = _o[0],
5105
+ setCanvasKey = _o[1];
5106
+ var stopDetection = useRef(0);
5107
+ var _p = useState(shouldLoadModelsProp),
5108
+ shouldLoadModels = _p[0],
5109
+ setShouldLoadModels = _p[1];
5110
+ var load = useCallback(function () {
5111
+ return setShouldLoadModels(true);
5112
+ }, []);
5113
+ var _q = useLoadDocumentDetector({
5114
+ modelPath: documentDetectionModelPath,
5115
+ modelLoadTimeoutMs: documentDetectionModelLoadTimeoutMs,
5116
+ scoreThreshold: documentDetectionModelScoreThreshold,
5117
+ onModelError: onDocumentDetectionModelError,
5118
+ videoRef: videoRef,
5119
+ shouldLoadModels: shouldLoadModels
5120
+ }),
5121
+ ready = _q.ready,
5122
+ modelDownloadProgress = _q.modelDownloadProgress,
5123
+ modelError = _q.modelError,
5124
+ setModelError = _q.setModelError;
5125
+ var _r = useFrameLoop(useCallback(function (frameId, timeRunning) {
5126
+ return __awaiter(_this, void 0, void 0, function () {
5127
+ var stopDetectionAtStart, vw, vh, ctx, prediction, processedPrediction;
5128
+ var _a;
5129
+ return __generator(this, function (_b) {
5130
+ switch (_b.label) {
5131
+ case 0:
5132
+ if (!videoLoaded || !cameraReady || !ready || !videoRef.current || !lastPredictionCanvas.current) return [2 /*return*/];
5133
+ stopDetectionAtStart = stopDetection.current;
5134
+ vw = videoRef.current.videoWidth;
5135
+ vh = videoRef.current.videoHeight;
5136
+ lastPredictionCanvas.current.width = vw;
5137
+ lastPredictionCanvas.current.height = vh;
5138
+ ctx = lastPredictionCanvas.current.getContext('2d');
5139
+ if (!(ctx && videoRef.current.readyState === 4)) return [3 /*break*/, 3];
5140
+ if (stopDetectionAtStart !== stopDetection.current) return [2 /*return*/];
5141
+ ctx.drawImage(videoRef.current, 0, 0, vw, vh);
5142
+ return [4 /*yield*/, makeDocumentDetectorPrediction(lastPredictionCanvas.current)];
5143
+ case 1:
5144
+ prediction = _b.sent();
5145
+ if (!prediction) return [3 /*break*/, 3];
5146
+ processedPrediction = processDocumentDetectorPrediction(prediction, documentDetectionThresholds, documentDetectionBoundaries);
5147
+ processedPrediction.frameId = frameId;
5148
+ setLastDetectionAt(new Date().getTime());
5149
+ debug(processedPrediction);
5150
+ if (processedPrediction.allZero) setTimesAllZero(function (n) {
5151
+ return n + 1;
5152
+ });
5153
+ if (stopDetectionAtStart !== stopDetection.current) return [2 /*return*/];
5154
+ if (timeRunning < delayAfterStartMs) return [2 /*return*/];
5155
+ return [4 /*yield*/, (_a = onPredictionHandler.current) === null || _a === void 0 ? void 0 : _a.call(onPredictionHandler, processedPrediction)];
5156
+ case 2:
5157
+ _b.sent();
5158
+ _b.label = 3;
5159
+ case 3:
5160
+ return [2 /*return*/];
5161
+ }
5162
+ });
5163
+ });
5164
+ }, [cameraReady, delayAfterStartMs, documentDetectionBoundaries, documentDetectionThresholds, ready, videoLoaded, videoRef]), {
5165
+ throttleMs: throttleMs,
5166
+ autoStart: autoStart
5167
+ }),
5168
+ start = _r.start,
5169
+ stop = _r.stop;
5170
+ useEffect(function setErrorIfAllZero() {
5171
+ if (timesAllZero >= 2) {
5172
+ setModelError(new Error('model is returning all zeroes'));
5173
+ }
5174
+ }, [setModelError, timesAllZero]);
5175
+ var onDocumentDetected = useCallback(function (handler) {
5176
+ onPredictionHandler.current = handler;
5177
+ }, []);
5178
+ var clearDocumentDetectionLastPredictionCanvas = useCallback(function () {
5179
+ stopDetection.current += 1;
5180
+ setCanvasKey(function (n) {
5181
+ return n + 1;
5182
+ });
5183
+ }, []);
5184
+ var value = useMemo(function () {
5185
+ return {
5186
+ startDocumentDetection: start,
5187
+ stopDocumentDetection: stop,
5188
+ loadDocumentDetectionModel: load,
5189
+ documentDetectionModelReady: ready,
5190
+ documentDetectionModelError: modelError,
5191
+ documentDetectionModelDownloadProgress: modelDownloadProgress,
5192
+ onDocumentDetected: onDocumentDetected,
5193
+ detectionTime: lastDetectionTime,
5194
+ documentDetectionThresholds: documentDetectionThresholds,
5195
+ setDocumentDetectionThresholds: setDocumentDetectionThresholds,
5196
+ documentDetectionBoundaries: documentDetectionBoundaries,
5197
+ setDocumentDetectionBoundaries: setDocumentDetectionBoundaries,
5198
+ documentDetectionLastPredictionCanvas: lastPredictionCanvas,
5199
+ clearDocumentDetectionLastPredictionCanvas: clearDocumentDetectionLastPredictionCanvas
5200
+ };
5201
+ }, [start, stop, load, ready, modelError, modelDownloadProgress, onDocumentDetected, documentDetectionThresholds, documentDetectionBoundaries, clearDocumentDetectionLastPredictionCanvas]);
5202
+ return /*#__PURE__*/React.createElement(DocumentDetectionModelContext.Provider, {
5203
+ value: value
5204
+ }, /*#__PURE__*/React.createElement(InvisibleCanvas, {
5205
+ key: canvasKey,
5206
+ ref: lastPredictionCanvas
5207
+ }), children);
5208
+ }
5209
+
5210
+ var FocusModelContext = /*#__PURE__*/createContext({
5211
+ loadFocusModel: function loadFocusModel() {
5212
+ return null;
5213
+ },
5214
+ focusModelReady: false,
5215
+ focusModelDownloadProgress: 0,
5216
+ focusModelError: null,
5217
+ focusThresholds: {},
5218
+ setFocusThresholds: function setFocusThresholds() {
5219
+ return null;
5220
+ },
5221
+ makeFocusPrediction: function makeFocusPrediction() {
5222
+ return null;
5223
+ },
5224
+ focusPredictionTime: 0
5225
+ });
5226
+ function FocusModelProvider(_a) {
5227
+ var children = _a.children,
5228
+ _b = _a.focusModelPath,
5229
+ focusModelPath = _b === void 0 ? defaultFocusModelPath : _b,
5230
+ _c = _a.focusModelLoadTimeoutMs,
5231
+ focusModelLoadTimeoutMs = _c === void 0 ? defaultFocusModelLoadTimeoutMs : _c,
5232
+ onFocusModelError = _a.onFocusModelError,
5233
+ _d = _a.showCanvases,
5234
+ showCanvases = _d === void 0 ? false : _d,
5235
+ _e = _a.shouldLoadModels,
5236
+ shouldLoadModelsProp = _e === void 0 ? true : _e;
5237
+ var cropCanvas = useRef(null);
5238
+ var rotateCanvas = useRef(null);
5239
+ var _f = useState({}),
5240
+ focusThresholds = _f[0],
5241
+ setFocusThresholds = _f[1];
5242
+ var videoRef = useCameraStore().videoRef;
5243
+ var _g = useState(shouldLoadModelsProp),
5244
+ shouldLoadModels = _g[0],
5245
+ setShouldLoadModels = _g[1];
5246
+ var load = useCallback(function () {
5247
+ return setShouldLoadModels(true);
5248
+ }, []);
5249
+ var _h = useLoadFocusModel({
5250
+ modelPath: focusModelPath,
5251
+ modelLoadTimeoutMs: focusModelLoadTimeoutMs,
5252
+ onModelError: onFocusModelError,
5253
+ videoRef: videoRef,
5254
+ shouldLoadModels: shouldLoadModels
5255
+ }),
5256
+ ready = _h.ready,
5257
+ modelDownloadProgress = _h.modelDownloadProgress,
5258
+ modelError = _h.modelError;
5259
+ var makeFocusPrediction = useCallback(function (imageData, box) {
5260
+ if (!ready) return null;
5261
+ var prediction = makeFocusModelPrediction(imageData, cropCanvas.current, rotateCanvas.current, box);
5262
+ if (!prediction) return null;
5263
+ setLastFocusPredictionAt(prediction.predictionTime);
5264
+ return prediction;
5265
+ }, [ready]);
5266
+ var value = useMemo(function () {
5267
+ return {
5268
+ loadFocusModel: load,
5269
+ focusModelReady: ready,
5270
+ focusModelDownloadProgress: modelDownloadProgress,
5271
+ focusModelError: modelError,
5272
+ makeFocusPrediction: makeFocusPrediction,
5273
+ focusPredictionTime: lastFocusPredictionTime,
5274
+ focusThresholds: focusThresholds,
5275
+ setFocusThresholds: setFocusThresholds
5276
+ };
5277
+ }, [focusThresholds, load, makeFocusPrediction, modelDownloadProgress, modelError, ready]);
5278
+ return /*#__PURE__*/React__default.createElement(FocusModelContext.Provider, {
5279
+ value: value
5280
+ }, /*#__PURE__*/React__default.createElement(InvisibleCanvas, {
5281
+ ref: rotateCanvas,
5282
+ style: showCanvases ? {
5283
+ display: 'block'
5284
+ } : undefined
5285
+ }), /*#__PURE__*/React__default.createElement(InvisibleCanvas, {
5286
+ ref: cropCanvas,
5287
+ style: showCanvases ? {
5288
+ display: 'block'
5289
+ } : undefined
5290
+ }), children);
5291
+ }
5292
+
5293
+ function _isNavigatorDefined() {
5294
+ return typeof navigator !== 'undefined' && navigator != null;
5295
+ }
5296
+ var isMobileCache;
5297
+ function isMobile() {
5298
+ if (isMobileCache !== undefined) return isMobileCache;
5299
+ isMobileCache = evaluateIsMobile();
5300
+ return isMobileCache;
5301
+ }
5302
+ function evaluateIsMobile(nav) {
5303
+ if (nav || _isNavigatorDefined()) {
5304
+ if (!nav) {
5305
+ nav = navigator;
5306
+ }
5307
+ if (nav.product === 'ReactNative') {
5308
+ return true;
5309
+ }
5310
+ var a = nav.userAgent || nav.vendor || (
5311
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
5312
+ // @ts-ignore
5313
+ typeof window !== 'undefined' ? window.opera : '');
5314
+ if (!a) {
5315
+ var navAny = nav;
5316
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
5317
+ // @ts-ignore
5318
+ return navAny.userAgentData && navAny.userAgentData.mobile;
5319
+ }
5320
+ return /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4));
5321
+ }
5322
+ return false;
5323
+ }
5324
+
5325
+ var onMobile = isMobile();
5326
+ var defaultIdCaptureThresholds = {
5327
+ detection: defaultDocumentDetectionThresholds,
5328
+ focus: defaultFocusThresholds
5329
+ };
5330
+ var IdCaptureModelsContext = /*#__PURE__*/createContext({
5331
+ ready: false,
5332
+ start: function start() {
5333
+ return null;
5334
+ },
5335
+ stop: function stop() {
5336
+ return null;
5337
+ },
5338
+ load: function load() {
5339
+ return null;
5340
+ },
5341
+ modelDownloadProgress: 0,
5342
+ modelError: null,
5343
+ thresholds: defaultIdCaptureThresholds,
5344
+ setThresholds: function setThresholds() {
5345
+ return null;
5346
+ },
5347
+ documentDetectionBoundaries: defaultDocumentDetectionBoundaries,
5348
+ setDocumentDetectionBoundaries: function setDocumentDetectionBoundaries() {
5349
+ return null;
5350
+ },
5351
+ onPredictionMade: function onPredictionMade() {
5352
+ return null;
5353
+ },
5354
+ detectionTime: 0,
5355
+ focusPredictionTime: 0,
5356
+ bestFrameDetails: {
5357
+ current: null
5358
+ },
5359
+ getBestFrame: function getBestFrame() {
5360
+ return null;
5361
+ },
5362
+ resetBestFrame: function resetBestFrame() {
5363
+ return null;
5364
+ },
5365
+ requiredDocumentType: 'none',
5366
+ setRequiredDocumentType: function setRequiredDocumentType() {
5367
+ return null;
5368
+ }
5369
+ });
5370
+ function IdCaptureModelsProviderInner(_a) {
5371
+ var children = _a.children,
5372
+ onModelError = _a.onModelError,
5373
+ _b = _a.allowSinglePageIdCapture,
5374
+ allowSinglePageIdCapture = _b === void 0 ? false : _b;
5375
+ var _c = useContext(DocumentDetectionModelContext),
5376
+ documentDetectionModelReady = _c.documentDetectionModelReady,
5377
+ documentDetectionModelDownloadProgress = _c.documentDetectionModelDownloadProgress,
5378
+ startDocumentDetection = _c.startDocumentDetection,
5379
+ stopDocumentDetection = _c.stopDocumentDetection,
5380
+ loadDocumentDetectionModel = _c.loadDocumentDetectionModel,
5381
+ lastPredictionCanvas = _c.documentDetectionLastPredictionCanvas,
5382
+ clearDocumentDetectionLastPredictionCanvas = _c.clearDocumentDetectionLastPredictionCanvas,
5383
+ onDocumentDetected = _c.onDocumentDetected,
5384
+ detectionTime = _c.detectionTime,
5385
+ documentDetectionThresholds = _c.documentDetectionThresholds,
5386
+ setDocumentDetectionThresholds = _c.setDocumentDetectionThresholds,
5387
+ documentDetectionBoundaries = _c.documentDetectionBoundaries,
5388
+ setDocumentDetectionBoundaries = _c.setDocumentDetectionBoundaries,
5389
+ documentDetectionModelError = _c.documentDetectionModelError;
5390
+ var _d = useContext(FocusModelContext),
5391
+ loadFocusModel = _d.loadFocusModel,
5392
+ focusModelReady = _d.focusModelReady,
5393
+ focusModelDownloadProgress = _d.focusModelDownloadProgress,
5394
+ makeFocusPrediction = _d.makeFocusPrediction,
5395
+ focusThresholds = _d.focusThresholds,
5396
+ setFocusThresholds = _d.setFocusThresholds,
5397
+ focusPredictionTime = _d.focusPredictionTime,
5398
+ focusModelError = _d.focusModelError;
5399
+ var onPredictionHandler = useRef();
5400
+ var bestFrameDetails = useRef(null);
5401
+ var bestPredictionCanvas = useRef(null);
5402
+ var bestFocusScore = useRef(0);
5403
+ var stopDetection = useRef(0);
5404
+ var _e = useState('none'),
5405
+ requiredDocumentType = _e[0],
5406
+ setRequiredDocumentType = _e[1];
5407
+ var thresholds = useMemo(function () {
5408
+ return _assign(_assign({}, documentDetectionThresholds), {
5409
+ focus: focusThresholds
5410
+ });
5411
+ }, [documentDetectionThresholds, focusThresholds]);
5412
+ var setThresholds = useCallback(function (thresholds) {
5413
+ if (thresholds.detection) {
5414
+ setDocumentDetectionThresholds(thresholds.detection);
5415
+ }
5416
+ if (thresholds.focus) {
5417
+ setFocusThresholds(thresholds.focus);
5418
+ }
5419
+ }, [setDocumentDetectionThresholds, setFocusThresholds]);
5420
+ useEffect(function handleDetections() {
5421
+ var _this = this;
5422
+ onDocumentDetected(function (prediction) {
5423
+ return __awaiter(_this, void 0, void 0, function () {
5424
+ var stopDetectionAtStart, focusPredictionTime, focusScore, focusThresholdMet, isSinglePage, isRequiredDocumentType, focusPrediction, focusThresholdSet, focusThreshold;
5425
+ var _a, _b, _c, _d, _e, _f, _g;
5426
+ return __generator(this, function (_h) {
5427
+ if (!lastPredictionCanvas.current) return [2 /*return*/];
5428
+ stopDetectionAtStart = stopDetection.current;
5429
+ focusPredictionTime = 0, focusScore = 0, focusThresholdMet = false;
5430
+ isSinglePage = prediction.detectedDocumentType === 'singlePage';
5431
+ if (!allowSinglePageIdCapture && isSinglePage) {
5432
+ prediction.detectedDocumentType = 'passport';
5433
+ prediction.passportDetectionScore = prediction.singlePageDetectionScore;
5434
+ prediction.passportDetectionThresholdMet = prediction.singlePageDetectionThresholdMet;
5435
+ prediction.singlePageDetectionScore = 0;
5436
+ prediction.singlePageDetectionThresholdMet = false;
5437
+ }
5438
+ isRequiredDocumentType = requiredDocumentType === 'none' || prediction.detectedDocumentType === requiredDocumentType || ((_a = requiredDocumentType.includes) === null || _a === void 0 ? void 0 : _a.call(requiredDocumentType, prediction.detectedDocumentType)) || allowSinglePageIdCapture && isSinglePage && ((_b = requiredDocumentType.includes) === null || _b === void 0 ? void 0 : _b.call(requiredDocumentType, 'idCardFront'));
5439
+ if (isRequiredDocumentType && prediction.detectedDocumentType !== 'none' && prediction.detectionThresholdMet && prediction.documentInBounds && !prediction.documentTooClose && prediction.documentIsStable) {
5440
+ focusPrediction = makeFocusPrediction(lastPredictionCanvas.current, (_c = prediction.bestDocument) === null || _c === void 0 ? void 0 : _c.box);
5441
+ if (focusPrediction) {
5442
+ focusScore = focusPrediction.score;
5443
+ focusPredictionTime = focusPrediction.predictionTime;
5444
+ }
5445
+ focusThresholdSet = (_d = thresholds.focus) === null || _d === void 0 ? void 0 : _d[prediction.detectedDocumentType];
5446
+ focusThreshold = (_e = onMobile ? focusThresholdSet === null || focusThresholdSet === void 0 ? void 0 : focusThresholdSet.mobile : focusThresholdSet === null || focusThresholdSet === void 0 ? void 0 : focusThresholdSet.desktop) !== null && _e !== void 0 ? _e : 0;
5447
+ focusThresholdMet = focusScore >= focusThreshold;
5448
+ if (bestFocusScore.current <= focusScore && stopDetectionAtStart === stopDetection.current) {
5449
+ bestFocusScore.current = focusScore;
5450
+ drawToCanvas(bestPredictionCanvas.current, lastPredictionCanvas.current);
5451
+ bestFrameDetails.current = {
5452
+ boundingBox: (_f = prediction.bestDocument) === null || _f === void 0 ? void 0 : _f.box,
5453
+ documentType: prediction.detectedDocumentType,
5454
+ detectionScore: prediction.detectionScore,
5455
+ focusScore: focusScore
5456
+ };
5457
+ }
5458
+ }
5459
+ (_g = onPredictionHandler.current) === null || _g === void 0 ? void 0 : _g.call(onPredictionHandler, _assign(_assign({}, prediction), {
5460
+ focusScore: focusScore,
5461
+ focusPredictionTime: focusPredictionTime,
5462
+ focusThresholdMet: focusThresholdMet
5463
+ }));
5464
+ return [2 /*return*/];
5465
+ });
5466
+ });
5467
+ });
5468
+ }, [allowSinglePageIdCapture, lastPredictionCanvas, makeFocusPrediction, onDocumentDetected, requiredDocumentType, thresholds.focus]);
5469
+ var modelError = documentDetectionModelError !== null && documentDetectionModelError !== void 0 ? documentDetectionModelError : focusModelError;
5470
+ useEffect(function handleModelErrors() {
5471
+ if (modelError) onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError);
5472
+ }, [modelError, onModelError]);
5473
+ var onPredictionMade = useCallback(function (handler) {
5474
+ onPredictionHandler.current = handler;
5475
+ }, []);
5476
+ var getBestFrame = useCallback(function () {
5477
+ if (!bestFrameDetails.current || !bestPredictionCanvas.current) return null;
5478
+ return _assign(_assign({}, bestFrameDetails.current), {
5479
+ canvas: bestPredictionCanvas.current
5480
+ });
5481
+ }, []);
5482
+ var _f = useState(0),
5483
+ canvasKey = _f[0],
5484
+ setCanvasKey = _f[1];
5485
+ var resetBestFrame = useCallback(function () {
5486
+ stopDetection.current += 1;
5487
+ setCanvasKey(function (n) {
5488
+ return n + 1;
5489
+ });
5490
+ clearDocumentDetectionLastPredictionCanvas();
5491
+ bestFrameDetails.current = null;
5492
+ bestFocusScore.current = 0;
5493
+ }, [clearDocumentDetectionLastPredictionCanvas]);
5494
+ useEffect(function () {
5495
+ if (requiredDocumentType) resetBestFrame();
5496
+ }, [requiredDocumentType, resetBestFrame]);
5497
+ var load = useCallback(function () {
5498
+ loadDocumentDetectionModel();
5499
+ loadFocusModel();
5500
+ }, [loadDocumentDetectionModel, loadFocusModel]);
5501
+ var value = useMemo(function () {
5502
+ return {
5503
+ ready: documentDetectionModelReady && focusModelReady,
5504
+ modelDownloadProgress: (documentDetectionModelDownloadProgress + focusModelDownloadProgress) / 2,
5505
+ modelError: modelError,
5506
+ start: startDocumentDetection,
5507
+ stop: stopDocumentDetection,
5508
+ load: load,
5509
+ thresholds: thresholds,
5510
+ setThresholds: setThresholds,
5511
+ documentDetectionBoundaries: documentDetectionBoundaries,
5512
+ setDocumentDetectionBoundaries: setDocumentDetectionBoundaries,
5513
+ onPredictionMade: onPredictionMade,
5514
+ detectionTime: detectionTime,
5515
+ focusPredictionTime: focusPredictionTime,
5516
+ getBestFrame: getBestFrame,
5517
+ resetBestFrame: resetBestFrame,
5518
+ bestFrameDetails: bestFrameDetails,
5519
+ requiredDocumentType: requiredDocumentType,
5520
+ setRequiredDocumentType: setRequiredDocumentType
5521
+ };
5522
+ }, [detectionTime, documentDetectionBoundaries, documentDetectionModelDownloadProgress, documentDetectionModelReady, focusModelDownloadProgress, focusModelReady, focusPredictionTime, getBestFrame, load, modelError, onPredictionMade, requiredDocumentType, resetBestFrame, setDocumentDetectionBoundaries, setThresholds, startDocumentDetection, stopDocumentDetection, thresholds]);
5523
+ return /*#__PURE__*/React__default.createElement(IdCaptureModelsContext.Provider, {
5524
+ value: value
5525
+ }, /*#__PURE__*/React__default.createElement(InvisibleCanvas, {
5526
+ key: canvasKey,
5527
+ ref: bestPredictionCanvas
5528
+ }), children);
5529
+ }
5530
+ function IdCaptureModelsProvider(_a) {
5531
+ var children = _a.children,
5532
+ props = __rest(_a, ["children"]);
5533
+ return /*#__PURE__*/React__default.createElement(DocumentDetectionModelProvider, _assign({}, props), /*#__PURE__*/React__default.createElement(FocusModelProvider, _assign({}, props), /*#__PURE__*/React__default.createElement(IdCaptureModelsProviderInner, _assign({}, props), children)));
5534
+ }
5535
+
5536
+ var CapturedDocumentTypeValues = ['idCardFront', 'idCardBack', 'passport', 'singlePage', 'selfie'];
5537
+
5538
+ var acceptedDocumentTypesForIdCaptureRequirementOption = {
5539
+ idCardFront: ['idCardFront'],
5540
+ idCardBack: ['idCardBack'],
5541
+ passport: ['passport'],
5542
+ idCard: ['idCardFront', 'idCardBack'],
5543
+ idCardAndPassport: ['idCardFront', 'idCardBack', 'passport'],
5544
+ idCardOrPassport: ['idCardFront', 'idCardBack', 'passport'] // this one is so weird
6066
5545
  };
5546
+ function minImageCountForIdCaptureRequirementOption(idCaptureRequirement) {
5547
+ if (idCaptureRequirement === 'idCardOrPassport') return 1;
5548
+ return acceptedDocumentTypesForIdCaptureRequirementOption[idCaptureRequirement].length;
5549
+ }
5550
+ function maxImageCountForIdCaptureRequirementOption(idCaptureRequirement) {
5551
+ if (idCaptureRequirement === 'idCardOrPassport') return 2;
5552
+ return minImageCountForIdCaptureRequirementOption(idCaptureRequirement);
5553
+ }
5554
+ function remainingIdCaptureRequirements(captureRequirement, capturedDocuments, requestedDocumentType) {
5555
+ var isIdCardOrPassport = captureRequirement === 'idCardOrPassport';
5556
+ if (isIdCardOrPassport && requestedDocumentType === 'passport') return [];
5557
+ var acceptedTypes = acceptedDocumentTypesForIdCaptureRequirementOption[captureRequirement];
5558
+ if (captureRequirement.includes('idCard') && 'singlePage' in capturedDocuments) {
5559
+ acceptedTypes = acceptedTypes.filter(function (v) {
5560
+ return !v.includes('idCard');
5561
+ });
5562
+ }
5563
+ if (isIdCardOrPassport) {
5564
+ acceptedTypes = acceptedTypes.filter(function (v) {
5565
+ return v !== 'passport';
5566
+ });
5567
+ }
5568
+ return acceptedTypes.filter(function (v) {
5569
+ return !(v in capturedDocuments);
5570
+ });
5571
+ }
6067
5572
 
6068
- var resources = {
6069
- en: {
6070
- translation: en
6071
- },
6072
- es: {
6073
- translation: es
6074
- },
6075
- de: {
6076
- translation: de
6077
- },
6078
- fr: {
6079
- translation: fr
6080
- },
6081
- it: {
6082
- translation: it
6083
- },
6084
- ja: {
6085
- translation: ja
6086
- },
6087
- pt: {
6088
- translation: pt
6089
- },
6090
- ru: {
6091
- translation: ru
6092
- },
6093
- zh: {
6094
- translation: zh
5573
+ var initialState$4 = {
5574
+ initialDrawComplete: false,
5575
+ redrawing: false,
5576
+ guideRectX: 0,
5577
+ guideRectY: 0,
5578
+ guideRectWidth: 0,
5579
+ guideRectHeight: 0,
5580
+ guideRectOffsetTop: 0,
5581
+ guideImageWidth: 0,
5582
+ guideImageHeight: 0,
5583
+ pageWidth: 0,
5584
+ pageHeight: 0,
5585
+ videoWidth: 0,
5586
+ videoHeight: 0,
5587
+ detectedObjects: [],
5588
+ bestDocument: undefined,
5589
+ detectedDocumentType: 'none',
5590
+ detectionThresholdMet: false,
5591
+ documentInBounds: false,
5592
+ documentTooClose: false,
5593
+ documentIsStable: false,
5594
+ flipRequired: false,
5595
+ backDetectedFirst: false,
5596
+ idCardDetectedButNotAllowed: false,
5597
+ passportDetectedButNotAllowed: false,
5598
+ enableOverrideWrongDocumentTypeDialog: false,
5599
+ allowOverrideWrongDocumentTypeAfterMs: 8000,
5600
+ allowOverrideWrongDocumentTypeGuidance: false,
5601
+ overrideWrongDocumentTypeGuidance: false,
5602
+ wrongDocumentTypePredictions: 0,
5603
+ idCardFrontDetectionScore: 0,
5604
+ idCardFrontDetectionThresholdMet: false,
5605
+ idCardBackDetectionScore: 0,
5606
+ idCardBackDetectionThresholdMet: false,
5607
+ passportDetectionScore: 0,
5608
+ passportDetectionThresholdMet: false,
5609
+ singlePageDetectionScore: 0,
5610
+ singlePageDetectionThresholdMet: false,
5611
+ focusScore: 0,
5612
+ focusThresholdMet: false,
5613
+ isGoodFrame: false,
5614
+ goodFramesCount: 0,
5615
+ goodFramesThreshold: 3,
5616
+ goodFramesThresholdMet: false,
5617
+ lastFrameCapturedAt: null,
5618
+ frameCaptureRate: 0,
5619
+ capturing: false,
5620
+ captureFailed: false,
5621
+ imageUrl: null,
5622
+ captureState: 'initializing',
5623
+ capturedDocuments: {},
5624
+ captureRequirement: 'idCardOrPassport',
5625
+ requestedDocumentType: 'idCardFront',
5626
+ allowSinglePageIdCapture: false,
5627
+ allowIdCardBackToFrontCapture: false,
5628
+ allowUploadingDocumentsFromStorage: false,
5629
+ isUploadingDocumentsFromStorage: false,
5630
+ uploadingDocumentsType: null,
5631
+ operationStartedAt: null,
5632
+ captureStartedAt: null,
5633
+ dispatch: function dispatch() {
5634
+ return null;
5635
+ }
5636
+ };
5637
+ var _reducer = function reducer(state, action) {
5638
+ var _a;
5639
+ switch (action.type) {
5640
+ case 'configureWizard':
5641
+ {
5642
+ var _b = action.payload,
5643
+ captureRequirement = _b.captureRequirement,
5644
+ precapturedDocuments = _b.precapturedDocuments,
5645
+ allowSinglePageIdCapture = _b.allowSinglePageIdCapture,
5646
+ allowIdCardBackToFrontCapture = _b.allowIdCardBackToFrontCapture,
5647
+ enableOverrideWrongDocumentTypeDialog = _b.enableOverrideWrongDocumentTypeDialog,
5648
+ allowOverrideWrongDocumentTypeAfterMs = _b.allowOverrideWrongDocumentTypeAfterMs,
5649
+ allowUploadingDocumentsFromStorage = _b.allowUploadingDocumentsFromStorage;
5650
+ var newState = _assign(_assign({}, state), {
5651
+ captureRequirement: captureRequirement,
5652
+ allowSinglePageIdCapture: allowSinglePageIdCapture !== null && allowSinglePageIdCapture !== void 0 ? allowSinglePageIdCapture : false,
5653
+ allowIdCardBackToFrontCapture: allowIdCardBackToFrontCapture !== null && allowIdCardBackToFrontCapture !== void 0 ? allowIdCardBackToFrontCapture : false,
5654
+ enableOverrideWrongDocumentTypeDialog: enableOverrideWrongDocumentTypeDialog,
5655
+ allowOverrideWrongDocumentTypeAfterMs: allowOverrideWrongDocumentTypeAfterMs,
5656
+ allowUploadingDocumentsFromStorage: allowUploadingDocumentsFromStorage
5657
+ });
5658
+ if (captureRequirement === 'idCardBack') newState.requestedDocumentType = 'idCardBack';
5659
+ if (captureRequirement === 'passport') newState.requestedDocumentType = 'passport';
5660
+ if (precapturedDocuments) {
5661
+ for (var _i = 0, CapturedDocumentTypeValues_1 = CapturedDocumentTypeValues; _i < CapturedDocumentTypeValues_1.length; _i++) {
5662
+ var k = CapturedDocumentTypeValues_1[_i];
5663
+ var payload = precapturedDocuments[k];
5664
+ if (payload) {
5665
+ newState.requestedDocumentType = k;
5666
+ newState = _reducer(newState, {
5667
+ type: 'documentCaptured',
5668
+ payload: payload
5669
+ });
5670
+ }
5671
+ }
5672
+ }
5673
+ if (newState.captureState === 'initializing' && !allowUploadingDocumentsFromStorage) {
5674
+ newState.captureState = 'capturing';
5675
+ }
5676
+ return newState;
5677
+ }
5678
+ case 'setRequiredDocumentType':
5679
+ return _assign(_assign({}, state), {
5680
+ requiredDocumentType: action.payload
5681
+ });
5682
+ case 'redrawRequested':
5683
+ return _assign(_assign({}, state), {
5684
+ redrawing: true,
5685
+ guideRectX: 0,
5686
+ guideRectY: 0,
5687
+ guideRectWidth: 0,
5688
+ guideRectHeight: 0,
5689
+ guideRectOffsetTop: 0
5690
+ });
5691
+ case 'redrawInProgress':
5692
+ return _assign(_assign({}, state), {
5693
+ redrawing: false,
5694
+ guideRectX: 0,
5695
+ guideRectY: 0,
5696
+ guideRectWidth: 0,
5697
+ guideRectHeight: 0,
5698
+ guideRectOffsetTop: 0
5699
+ });
5700
+ case 'redrawCompleted':
5701
+ return _assign(_assign(_assign({}, state), action.payload), {
5702
+ initialDrawComplete: true
5703
+ });
5704
+ case 'pageRendered':
5705
+ return _assign(_assign({}, state), action.payload);
5706
+ case 'guideImageLoaded':
5707
+ return _assign(_assign({}, state), {
5708
+ guideImageWidth: action.payload.width,
5709
+ guideImageHeight: action.payload.height
5710
+ });
5711
+ case 'objectsDetected':
5712
+ {
5713
+ var _c = action.payload.prediction,
5714
+ detectedObjects = _c.detectedObjects,
5715
+ detectionThresholdMet = _c.detectionThresholdMet,
5716
+ detectedDocumentType = _c.detectedDocumentType,
5717
+ idCardFrontDetectionScore = _c.idCardFrontDetectionScore,
5718
+ idCardFrontDetectionThresholdMet = _c.idCardFrontDetectionThresholdMet,
5719
+ idCardBackDetectionScore = _c.idCardBackDetectionScore,
5720
+ idCardBackDetectionThresholdMet = _c.idCardBackDetectionThresholdMet,
5721
+ passportDetectionScore = _c.passportDetectionScore,
5722
+ passportDetectionThresholdMet = _c.passportDetectionThresholdMet,
5723
+ singlePageDetectionScore = _c.singlePageDetectionScore,
5724
+ singlePageDetectionThresholdMet = _c.singlePageDetectionThresholdMet,
5725
+ bestDocument = _c.bestDocument,
5726
+ documentInBounds = _c.documentInBounds,
5727
+ documentTooClose = _c.documentTooClose,
5728
+ documentIsStable = _c.documentIsStable,
5729
+ focusScore = _c.focusScore,
5730
+ focusThresholdMet = _c.focusThresholdMet,
5731
+ frameWidth = _c.frameWidth,
5732
+ frameHeight = _c.frameHeight;
5733
+ var frameCapturedAt = new Date();
5734
+ var frameCaptureRate = 0;
5735
+ var goodFramesThreshold = state.goodFramesThreshold;
5736
+ if (state.lastFrameCapturedAt) {
5737
+ var frameTime = frameCapturedAt.getTime() - state.lastFrameCapturedAt.getTime();
5738
+ if (frameTime > 0) {
5739
+ frameCaptureRate = 1000.0 / frameTime;
5740
+ if (frameCaptureRate > 0) {
5741
+ goodFramesThreshold = Math.ceil(3 * frameCaptureRate);
5742
+ }
5743
+ }
5744
+ }
5745
+ var idCardDetected = detectedDocumentType.includes('idCard') || detectedDocumentType === 'singlePage';
5746
+ var idCardDetectedButNotAllowed = idCardDetected && !state.captureRequirement.includes('idCard');
5747
+ var passportNotAllowed = !state.captureRequirement.toLowerCase().includes('passport');
5748
+ var idCardFrontWasCaptured = 'idCardFront' in state.capturedDocuments;
5749
+ var idCardBackWasCaptured = 'idCardBack' in state.capturedDocuments;
5750
+ var idCardBeingCaptured = idCardFrontWasCaptured && !idCardBackWasCaptured || !idCardFrontWasCaptured && idCardBackWasCaptured;
5751
+ var passportDetectedButNotAllowed = detectedDocumentType === 'passport' && (passportNotAllowed || idCardBeingCaptured);
5752
+ var flipRequired = !state.overrideWrongDocumentTypeGuidance && (state.allowIdCardBackToFrontCapture ? idCardFrontWasCaptured && detectedDocumentType === 'idCardFront' : state.requestedDocumentType === 'idCardBack' && detectedDocumentType === 'idCardFront');
5753
+ var backDetectedFirst = !state.overrideWrongDocumentTypeGuidance && (state.allowIdCardBackToFrontCapture ? idCardBackWasCaptured && detectedDocumentType === 'idCardBack' : state.requestedDocumentType === 'idCardFront' && detectedDocumentType === 'idCardBack');
5754
+ var wrongDocumentTypePredictions = state.wrongDocumentTypePredictions;
5755
+ if (state.captureState === 'capturing' && (flipRequired || backDetectedFirst)) {
5756
+ wrongDocumentTypePredictions += 1;
5757
+ }
5758
+ var isGoodFrame = detectionThresholdMet && documentInBounds && !documentTooClose && !flipRequired && !backDetectedFirst && focusThresholdMet && !idCardDetectedButNotAllowed && !passportDetectedButNotAllowed && documentIsStable;
5759
+ var captureStartedAt = state.captureStartedAt;
5760
+ var goodFramesCount = state.goodFramesCount;
5761
+ if (isGoodFrame) {
5762
+ goodFramesCount += 1;
5763
+ captureStartedAt || (captureStartedAt = new Date());
5764
+ }
5765
+ var goodFramesThresholdMet = goodFramesCount >= goodFramesThreshold;
5766
+ var requestedDocumentType = state.requestedDocumentType;
5767
+ if (state.captureRequirement.includes('idCard') && state.allowIdCardBackToFrontCapture) {
5768
+ if (detectedDocumentType === 'idCardFront' && state.requestedDocumentType !== 'idCardFront' && !idCardFrontWasCaptured) {
5769
+ requestedDocumentType = 'idCardFront';
5770
+ } else if (detectedDocumentType === 'idCardBack' && state.requestedDocumentType !== 'idCardBack' && !idCardBackWasCaptured) {
5771
+ requestedDocumentType = 'idCardBack';
5772
+ }
5773
+ }
5774
+ if (state.captureRequirement === 'idCardOrPassport') {
5775
+ if (detectedDocumentType === 'passport' && state.requestedDocumentType !== 'passport') {
5776
+ requestedDocumentType = 'passport';
5777
+ }
5778
+ if (requestedDocumentType === 'passport' && passportDetectionScore < 0.3) {
5779
+ requestedDocumentType = idCardFrontWasCaptured ? 'idCardBack' : 'idCardFront';
5780
+ }
5781
+ }
5782
+ var hasBeenRunningForLongEnough = !!state.operationStartedAt && new Date().getTime() - state.operationStartedAt.getTime() > 1000;
5783
+ var overrideFlipRequirementThreshold = Math.ceil(state.allowOverrideWrongDocumentTypeAfterMs / 1000 * frameCaptureRate);
5784
+ var allowOverrideFlipRequirement = state.enableOverrideWrongDocumentTypeDialog && hasBeenRunningForLongEnough && !state.overrideWrongDocumentTypeGuidance && overrideFlipRequirementThreshold > 0 && (state.allowOverrideWrongDocumentTypeGuidance || wrongDocumentTypePredictions >= overrideFlipRequirementThreshold);
5785
+ return _assign(_assign({}, state), {
5786
+ videoWidth: frameWidth,
5787
+ videoHeight: frameHeight,
5788
+ detectedObjects: detectedObjects,
5789
+ bestDocument: bestDocument,
5790
+ requestedDocumentType: requestedDocumentType,
5791
+ detectedDocumentType: detectedDocumentType,
5792
+ detectionThresholdMet: detectionThresholdMet,
5793
+ documentInBounds: documentInBounds,
5794
+ documentTooClose: documentTooClose,
5795
+ documentIsStable: documentIsStable,
5796
+ flipRequired: flipRequired,
5797
+ backDetectedFirst: backDetectedFirst,
5798
+ idCardDetectedButNotAllowed: idCardDetectedButNotAllowed,
5799
+ passportDetectedButNotAllowed: passportDetectedButNotAllowed,
5800
+ allowOverrideWrongDocumentTypeGuidance: allowOverrideFlipRequirement,
5801
+ wrongDocumentTypePredictions: wrongDocumentTypePredictions,
5802
+ idCardFrontDetectionScore: idCardFrontDetectionScore,
5803
+ idCardFrontDetectionThresholdMet: idCardFrontDetectionThresholdMet,
5804
+ idCardBackDetectionScore: idCardBackDetectionScore,
5805
+ idCardBackDetectionThresholdMet: idCardBackDetectionThresholdMet,
5806
+ passportDetectionScore: passportDetectionScore,
5807
+ passportDetectionThresholdMet: passportDetectionThresholdMet,
5808
+ singlePageDetectionScore: singlePageDetectionScore,
5809
+ singlePageDetectionThresholdMet: singlePageDetectionThresholdMet,
5810
+ focusScore: focusScore,
5811
+ focusThresholdMet: focusThresholdMet,
5812
+ isGoodFrame: isGoodFrame,
5813
+ goodFramesCount: goodFramesCount,
5814
+ goodFramesThreshold: goodFramesThreshold,
5815
+ goodFramesThresholdMet: goodFramesThresholdMet,
5816
+ captureStartedAt: captureStartedAt,
5817
+ lastFrameCapturedAt: frameCapturedAt,
5818
+ frameCaptureRate: frameCaptureRate
5819
+ });
5820
+ }
5821
+ case 'captureInitialized':
5822
+ return _assign(_assign({}, state), {
5823
+ captureState: 'capturing',
5824
+ isUploadingDocumentsFromStorage: false
5825
+ });
5826
+ case 'captureStarted':
5827
+ return _assign(_assign({}, state), {
5828
+ operationStartedAt: new Date(),
5829
+ captureStartedAt: null,
5830
+ capturing: false,
5831
+ captureFailed: false
5832
+ });
5833
+ case 'capturing':
5834
+ return _assign(_assign({}, state), {
5835
+ capturing: true,
5836
+ captureFailed: false
5837
+ });
5838
+ case 'captured':
5839
+ return _assign(_assign({}, state), {
5840
+ capturing: false,
5841
+ captureFailed: false
5842
+ });
5843
+ case 'frameCaptured':
5844
+ return _assign(_assign({}, state), {
5845
+ imageUrl: action.payload.imageUrl
5846
+ });
5847
+ case 'captureFailed':
5848
+ return _assign(_assign({}, state), {
5849
+ capturing: false,
5850
+ captureFailed: true
5851
+ });
5852
+ case 'documentCaptured':
5853
+ {
5854
+ var newState = _assign(_assign({}, state), {
5855
+ capturing: false,
5856
+ captureFailed: false,
5857
+ allowOverrideFlipRequirement: false,
5858
+ overrideFlipRequirement: false,
5859
+ goodFramesCount: 0,
5860
+ wrongDocumentTypePredictions: 0,
5861
+ capturedDocuments: _assign(_assign({}, state.capturedDocuments), (_a = {}, _a[action.payload.documentType] = action.payload, _a))
5862
+ });
5863
+ var remainingRequirements = remainingIdCaptureRequirements(state.captureRequirement, newState.capturedDocuments, state.requestedDocumentType);
5864
+ if (remainingRequirements.length === 0) {
5865
+ newState.captureState = 'complete';
5866
+ } else {
5867
+ newState.requestedDocumentType = remainingRequirements[0];
5868
+ if (state.requestedDocumentType === 'idCardFront' && newState.requestedDocumentType === 'idCardBack' || state.requestedDocumentType === 'idCardBack' && newState.requestedDocumentType === 'idCardFront') {
5869
+ if (!newState.isUploadingDocumentsFromStorage) {
5870
+ newState.captureState = 'requestingFlip';
5871
+ }
5872
+ newState.idCardFrontDetectionThresholdMet = false;
5873
+ newState.idCardBackDetectionThresholdMet = false;
5874
+ newState.passportDetectionThresholdMet = false;
5875
+ newState.wrongDocumentTypePredictions = 0;
5876
+ }
5877
+ }
5878
+ return newState;
5879
+ }
5880
+ case 'documentCapturedManually':
5881
+ return _reducer(state, {
5882
+ type: 'documentCaptured',
5883
+ payload: _assign(_assign({}, action.payload), {
5884
+ documentType: state.requestedDocumentType,
5885
+ width: 0,
5886
+ height: 0
5887
+ })
5888
+ });
5889
+ case 'documentsCaptured':
5890
+ {
5891
+ var newState = _assign({}, state);
5892
+ for (var _d = 0, _e = action.payload; _d < _e.length; _d++) {
5893
+ var doc = _e[_d];
5894
+ newState = _reducer(newState, {
5895
+ type: 'documentCaptured',
5896
+ payload: doc
5897
+ });
5898
+ }
5899
+ return newState;
5900
+ }
5901
+ case 'flipRequestCompleted':
5902
+ return _assign(_assign({}, state), {
5903
+ captureState: 'capturing',
5904
+ allowOverrideWrongDocumentTypeGuidance: false,
5905
+ overrideWrongDocumentTypeGuidance: false,
5906
+ wrongDocumentTypePredictions: 0
5907
+ });
5908
+ case 'allowOverrideFlipRequirement':
5909
+ return _assign(_assign({}, state), {
5910
+ allowOverrideWrongDocumentTypeGuidance: true
5911
+ });
5912
+ case 'overrideFlipRequirement':
5913
+ return _assign(_assign({}, state), {
5914
+ allowOverrideWrongDocumentTypeGuidance: false,
5915
+ overrideWrongDocumentTypeGuidance: true
5916
+ });
5917
+ case 'setUploadingDocumentsFromStorage':
5918
+ return _assign(_assign({}, state), {
5919
+ isUploadingDocumentsFromStorage: action.payload,
5920
+ captureState: action.payload ? 'initializing' : 'capturing'
5921
+ });
5922
+ case 'setUploadingDocumentsType':
5923
+ {
5924
+ var requestedDocumentType = !action.payload || action.payload === 'idCard' ? 'idCardFront' : action.payload;
5925
+ var uploadingDocumentsType = action.payload === 'singlePage' ? 'idCard' : action.payload;
5926
+ return _assign(_assign({}, state), {
5927
+ captureState: action.payload ? 'uploading' : 'initializing',
5928
+ uploadingDocumentsType: uploadingDocumentsType,
5929
+ requestedDocumentType: requestedDocumentType
5930
+ });
5931
+ }
5932
+ case 'resetWizard':
5933
+ return _assign(_assign({}, initialState$4), {
5934
+ dispatch: state.dispatch,
5935
+ allowUploadingDocumentsFromStorage: state.allowUploadingDocumentsFromStorage,
5936
+ captureState: state.allowUploadingDocumentsFromStorage ? 'initializing' : 'capturing',
5937
+ captureRequirement: state.captureRequirement,
5938
+ allowIdCardBackToFrontCapture: state.allowIdCardBackToFrontCapture
5939
+ });
5940
+ default:
5941
+ return state;
6095
5942
  }
6096
5943
  };
6097
- function initializeI18n() {
6098
- void i18n.use(LanguageDetector).use(initReactI18next).init({
6099
- resources: resources,
6100
- detection: {
6101
- caches: []
6102
- },
6103
- fallbackLng: 'en',
6104
- debug: false,
6105
- interpolation: {
6106
- escapeValue: false
5944
+ var useIdCaptureStore = create()(devtools(function (set) {
5945
+ return _assign(_assign({}, initialState$4), {
5946
+ dispatch: function dispatch(action) {
5947
+ return set(function (state) {
5948
+ return _reducer(state, action);
5949
+ }, undefined, action);
5950
+ }
5951
+ });
5952
+ }));
5953
+ function IdCaptureStateProvider(_a) {
5954
+ var children = _a.children;
5955
+ var overrideWrongDocumentTypeGuidance = useIdCaptureStore(useShallow(function (state) {
5956
+ return state.overrideWrongDocumentTypeGuidance;
5957
+ }));
5958
+ var setRequiredDocumentType = useContext(IdCaptureModelsContext).setRequiredDocumentType;
5959
+ useEffect(function () {
5960
+ if (overrideWrongDocumentTypeGuidance) setRequiredDocumentType('none');
5961
+ }, [overrideWrongDocumentTypeGuidance, setRequiredDocumentType]);
5962
+ var onResize = useDebouncedCallback(function () {
5963
+ dispatchIdCaptureAction({
5964
+ type: 'redrawRequested'
5965
+ });
5966
+ }, 500);
5967
+ useLayoutEffect(function () {
5968
+ if (typeof window === 'undefined') return;
5969
+ window.addEventListener('resize', onResize);
5970
+ return function () {
5971
+ return window.removeEventListener('resize', onResize);
5972
+ };
5973
+ }, [onResize]);
5974
+ useEffect(function resetWhenProviderUnmounts() {
5975
+ return function () {
5976
+ return useIdCaptureStore.getState().dispatch({
5977
+ type: 'resetWizard'
5978
+ });
5979
+ };
5980
+ }, []);
5981
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, children);
5982
+ }
5983
+ var dispatchIdCaptureAction = function dispatchIdCaptureAction(action) {
5984
+ return useIdCaptureStore.getState().dispatch(action);
5985
+ };
5986
+
5987
+ function DebugStatsPane(_a) {
5988
+ var children = _a.children;
5989
+ var element = /*#__PURE__*/React__default.createElement(DebugStatsPaneDiv, null, children);
5990
+ var portalLocation = document.getElementById('idmission-above-guides-content');
5991
+ if (!portalLocation) return element;
5992
+ return /*#__PURE__*/createPortal(element, portalLocation);
5993
+ }
5994
+ var DebugStatsPaneDiv = styled.span(templateObject_1$G || (templateObject_1$G = __makeTemplateObject(["\n font-size: 16px;\n font-family: monospace;\n position: absolute;\n left: 20px;\n bottom: 20px;\n margin-right: 20px;\n padding: 8px;\n color: limegreen;\n background: rgba(0, 0, 0, 0.5);\n z-index: 10002;\n"], ["\n font-size: 16px;\n font-family: monospace;\n position: absolute;\n left: 20px;\n bottom: 20px;\n margin-right: 20px;\n padding: 8px;\n color: limegreen;\n background: rgba(0, 0, 0, 0.5);\n z-index: 10002;\n"])));
5995
+ var ObjectDetectionDebugOverlayDiv = styled.div(templateObject_2$z || (templateObject_2$z = __makeTemplateObject(["\n position: absolute;\n z-index: 1001;\n width: 100%;\n height: 100%;\n max-width: 100%;\n max-height: 100%;\n overflow: hidden;\n ", "\n transform-style: preserve-3d;\n"], ["\n position: absolute;\n z-index: 1001;\n width: 100%;\n height: 100%;\n max-width: 100%;\n max-height: 100%;\n overflow: hidden;\n ", "\n transform-style: preserve-3d;\n"])), function (_a) {
5996
+ var $flipX = _a.$flipX;
5997
+ return $flipX ? 'transform: scaleX(-1);' : '';
5998
+ });
5999
+ var ObjectDetectionDebugBox = styled.div(templateObject_3$q || (templateObject_3$q = __makeTemplateObject(["\n font: 10px monospace;\n position: absolute;\n border: 3px solid ", ";\n color: ", ";\n ", "\n transform-style: preserve-3d;\n"], ["\n font: 10px monospace;\n position: absolute;\n border: 3px solid ", ";\n color: ", ";\n ", "\n transform-style: preserve-3d;\n"])), function (_a) {
6000
+ var $color = _a.$color;
6001
+ return $color !== null && $color !== void 0 ? $color : 'green';
6002
+ }, function (_a) {
6003
+ var $color = _a.$color;
6004
+ return $color !== null && $color !== void 0 ? $color : 'green';
6005
+ }, function (_a) {
6006
+ var $flipX = _a.$flipX;
6007
+ return $flipX ? 'transform: scaleX(-1);' : '';
6008
+ });
6009
+ var FaceDetectionKeypointMarker = styled.div(templateObject_4$k || (templateObject_4$k = __makeTemplateObject(["\n position: absolute;\n width: 4px;\n height: 4px;\n border: 2px solid ", ";\n font: 10px monospace;\n color: ", ";\n border-radius: 50%;\n ", "\n transform-style: preserve-3d;\n"], ["\n position: absolute;\n width: 4px;\n height: 4px;\n border: 2px solid ", ";\n font: 10px monospace;\n color: ", ";\n border-radius: 50%;\n ", "\n transform-style: preserve-3d;\n"])), function (_a) {
6010
+ var $color = _a.$color;
6011
+ return $color !== null && $color !== void 0 ? $color : 'red';
6012
+ }, function (_a) {
6013
+ var $color = _a.$color;
6014
+ return $color !== null && $color !== void 0 ? $color : 'red';
6015
+ }, function (_a) {
6016
+ var $flipX = _a.$flipX;
6017
+ return $flipX ? 'transform: scaleX(-1);' : '';
6018
+ });
6019
+ function useDebugScalingDetails(_a) {
6020
+ var _b = _a.enabled,
6021
+ enabled = _b === void 0 ? true : _b,
6022
+ pageWidth = _a.pageWidth,
6023
+ pageHeight = _a.pageHeight,
6024
+ videoWidth = _a.videoWidth,
6025
+ videoHeight = _a.videoHeight;
6026
+ return useMemo(function () {
6027
+ var horizontal = false,
6028
+ scaledWidth = 0,
6029
+ scaledHeight = 0,
6030
+ xOffset = 0,
6031
+ yOffset = 0;
6032
+ if (enabled) {
6033
+ horizontal = pageWidth / pageHeight < videoWidth / videoHeight;
6034
+ if (horizontal) {
6035
+ scaledWidth = videoWidth * (pageHeight / videoHeight);
6036
+ xOffset = (scaledWidth - pageWidth) / 2;
6037
+ } else {
6038
+ scaledHeight = videoHeight * (pageWidth / videoWidth);
6039
+ yOffset = (scaledHeight - pageHeight) / 2;
6040
+ }
6107
6041
  }
6108
- });
6042
+ return {
6043
+ horizontal: horizontal,
6044
+ pageWidth: pageWidth,
6045
+ pageHeight: pageHeight,
6046
+ videoWidth: videoWidth,
6047
+ videoHeight: videoHeight,
6048
+ scaledWidth: scaledWidth,
6049
+ scaledHeight: scaledHeight,
6050
+ xOffset: xOffset,
6051
+ yOffset: yOffset
6052
+ };
6053
+ }, [enabled, pageHeight, pageWidth, videoHeight, videoWidth]);
6109
6054
  }
6110
- var useLanguage = function useLanguage(lang) {
6111
- var i18n = useTranslation().i18n;
6112
- useEffect(function () {
6113
- if (lang !== 'auto') {
6114
- void i18n.changeLanguage(lang);
6115
- } else {
6116
- void i18n.changeLanguage(); // call without argument to use detection
6055
+ var DebugBoundingBoxOverlay = function DebugBoundingBoxOverlay(_a) {
6056
+ var scaling = _a.scaling,
6057
+ $flipX = _a.$flipX,
6058
+ children = _a.children;
6059
+ var _b = useIdCaptureStore(),
6060
+ guideRectWidth = _b.guideRectWidth,
6061
+ guideRectHeight = _b.guideRectHeight,
6062
+ guideRectX = _b.guideRectX,
6063
+ guideRectY = _b.guideRectY;
6064
+ return /*#__PURE__*/React__default.createElement(ObjectDetectionDebugOverlayDiv, {
6065
+ id: "debug-overlay-div",
6066
+ "$flipX": $flipX,
6067
+ style: {
6068
+ top: guideRectY,
6069
+ left: guideRectX,
6070
+ width: guideRectWidth || (scaling === null || scaling === void 0 ? void 0 : scaling.pageWidth),
6071
+ height: guideRectHeight || (scaling === null || scaling === void 0 ? void 0 : scaling.pageHeight)
6117
6072
  }
6118
- }, [i18n, lang]);
6073
+ }, children);
6119
6074
  };
6120
- function evaluateVerbiage(t, currentLanguage, verbiage, fallback) {
6121
- if (typeof verbiage === 'string') return verbiage;
6122
- if (typeof verbiage === 'object') {
6123
- var translations = verbiage;
6124
- if (translations[currentLanguage]) return translations[currentLanguage];
6125
- var nonLocaleLang = currentLanguage.split('-')[0];
6126
- if (translations[nonLocaleLang]) return translations[nonLocaleLang];
6075
+ function IdCaptureDetectedObjectDebugBox(_a) {
6076
+ var obj = _a.obj,
6077
+ flipX = _a.flipX,
6078
+ _b = _a.color,
6079
+ color = _b === void 0 ? 'green' : _b,
6080
+ scaling = _a.scaling;
6081
+ var horizontal = scaling.horizontal,
6082
+ pageWidth = scaling.pageWidth,
6083
+ pageHeight = scaling.pageHeight,
6084
+ videoWidth = scaling.videoWidth,
6085
+ videoHeight = scaling.videoHeight,
6086
+ scaledWidth = scaling.scaledWidth,
6087
+ scaledHeight = scaling.scaledHeight,
6088
+ xOffset = scaling.xOffset,
6089
+ yOffset = scaling.yOffset;
6090
+ if (!videoWidth || !videoHeight || !pageWidth || !pageHeight) return /*#__PURE__*/React__default.createElement(React__default.Fragment, null);
6091
+ var top;
6092
+ var left;
6093
+ var width;
6094
+ var height;
6095
+ if (horizontal) {
6096
+ top = obj.box.yMin / videoHeight * pageHeight;
6097
+ left = obj.box.xMin / videoWidth * scaledWidth - xOffset;
6098
+ width = obj.box.width / videoWidth * scaledWidth;
6099
+ height = obj.box.height / videoHeight * pageHeight;
6100
+ } else {
6101
+ top = obj.box.yMin / videoHeight * scaledHeight - yOffset;
6102
+ left = obj.box.xMin / videoWidth * pageWidth;
6103
+ width = obj.box.width / videoWidth * pageWidth;
6104
+ height = obj.box.height / videoHeight * scaledHeight;
6127
6105
  }
6128
- return t(fallback);
6106
+ return /*#__PURE__*/React__default.createElement(ObjectDetectionDebugBox, {
6107
+ "$flipX": flipX,
6108
+ "$color": color,
6109
+ style: {
6110
+ top: top,
6111
+ left: left,
6112
+ width: width,
6113
+ height: height
6114
+ }
6115
+ });
6129
6116
  }
6130
- function useVerbiage(verbiage, fallback) {
6131
- var _a = useTranslation(),
6132
- t = _a.t,
6133
- i18n = _a.i18n;
6134
- return useMemo(function () {
6135
- return evaluateVerbiage(t, i18n.language, verbiage, fallback);
6136
- }, [fallback, i18n.language, t, verbiage]);
6117
+ function SelfieCaptureFaceDebugBox(_a) {
6118
+ var face = _a.face,
6119
+ flipX = _a.flipX,
6120
+ _b = _a.color,
6121
+ color = _b === void 0 ? 'green' : _b,
6122
+ scaling = _a.scaling;
6123
+ var horizontal = scaling.horizontal,
6124
+ pageWidth = scaling.pageWidth,
6125
+ pageHeight = scaling.pageHeight,
6126
+ videoWidth = scaling.videoWidth,
6127
+ videoHeight = scaling.videoHeight,
6128
+ scaledWidth = scaling.scaledWidth,
6129
+ scaledHeight = scaling.scaledHeight,
6130
+ xOffset = scaling.xOffset,
6131
+ yOffset = scaling.yOffset;
6132
+ if (!videoWidth || !videoHeight || !pageWidth || !pageHeight) return /*#__PURE__*/React__default.createElement(React__default.Fragment, null);
6133
+ var top;
6134
+ var left;
6135
+ var width;
6136
+ var height;
6137
+ if (horizontal) {
6138
+ top = face.box.yMin / videoHeight * pageHeight;
6139
+ left = face.box.xMin / videoWidth * scaledWidth - xOffset;
6140
+ width = face.box.width / videoWidth * scaledWidth;
6141
+ height = face.box.height / videoHeight * pageHeight;
6142
+ } else {
6143
+ top = face.box.yMin / videoHeight * scaledHeight - yOffset;
6144
+ left = face.box.xMin / videoWidth * pageWidth;
6145
+ width = face.box.width / videoWidth * pageWidth;
6146
+ height = face.box.height / videoHeight * scaledHeight;
6147
+ }
6148
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(ObjectDetectionDebugBox, {
6149
+ "$flipX": flipX,
6150
+ "$color": color,
6151
+ style: {
6152
+ top: top,
6153
+ left: left,
6154
+ width: width,
6155
+ height: height
6156
+ }
6157
+ }), face.keypoints.map(function (point, ii) {
6158
+ return /*#__PURE__*/React__default.createElement(SelfieCaptureFaceKeypoint, {
6159
+ key: ii,
6160
+ point: point,
6161
+ scaling: scaling,
6162
+ flipX: flipX
6163
+ });
6164
+ }));
6137
6165
  }
6138
- function useTranslations(verbiage, fallbacks) {
6139
- var _a = useTranslation(),
6140
- t = _a.t,
6141
- i18n = _a.i18n;
6142
- return useMemo(function () {
6143
- return _assign(_assign({}, verbiage), Object.keys(fallbacks).reduce(function (result, key) {
6144
- var _a;
6145
- return _assign(_assign({}, result), (_a = {}, _a[key] = evaluateVerbiage(t, i18n.language, verbiage === null || verbiage === void 0 ? void 0 : verbiage[key], fallbacks[key]), _a));
6146
- }, {}));
6147
- }, [fallbacks, i18n.language, t, verbiage]);
6166
+ function SelfieCaptureFaceKeypoint(_a) {
6167
+ var point = _a.point,
6168
+ flipX = _a.flipX,
6169
+ _b = _a.color,
6170
+ color = _b === void 0 ? 'red' : _b,
6171
+ _c = _a.scaling,
6172
+ horizontal = _c.horizontal,
6173
+ pageWidth = _c.pageWidth,
6174
+ pageHeight = _c.pageHeight,
6175
+ videoWidth = _c.videoWidth,
6176
+ videoHeight = _c.videoHeight,
6177
+ scaledWidth = _c.scaledWidth,
6178
+ scaledHeight = _c.scaledHeight,
6179
+ xOffset = _c.xOffset,
6180
+ yOffset = _c.yOffset;
6181
+ var left, top;
6182
+ if (horizontal) {
6183
+ left = point.x / videoWidth * scaledWidth - xOffset;
6184
+ top = point.y / videoHeight * pageHeight;
6185
+ } else {
6186
+ left = point.x / videoWidth * pageWidth;
6187
+ top = point.y / videoHeight * scaledHeight - yOffset;
6188
+ }
6189
+ top -= 2;
6190
+ left -= 2;
6191
+ return /*#__PURE__*/React__default.createElement(FaceDetectionKeypointMarker, {
6192
+ "$flipX": flipX,
6193
+ "$color": color,
6194
+ style: {
6195
+ top: top,
6196
+ left: left
6197
+ }
6198
+ });
6148
6199
  }
6200
+ var templateObject_1$G, templateObject_2$z, templateObject_3$q, templateObject_4$k;
6149
6201
 
6150
6202
  var GuidanceMessageContainerDiv = styled.div(templateObject_1$F || (templateObject_1$F = __makeTemplateObject(["\n position: absolute;\n top: calc(", ");\n ", "\n font-weight: bold;\n width: 100%;\n display: flex;\n"], ["\n position: absolute;\n top: calc(", ");\n ", "\n font-weight: bold;\n width: 100%;\n display: flex;\n"])), function (_a) {
6151
6203
  var $top = _a.$top;
@@ -13749,9 +13801,10 @@ function VideoSignatureWizardGuides(_a) {
13749
13801
  });
13750
13802
  }
13751
13803
  var VideoSignatureWizardWithProviders = function VideoSignatureWizardWithProviders(props) {
13752
- var _a = useState(0),
13753
- attempts = _a[0],
13754
- setAttempts = _a[1];
13804
+ var _a, _b;
13805
+ var _c = useState(0),
13806
+ attempts = _c[0],
13807
+ setAttempts = _c[1];
13755
13808
  var onRetryClickedProp = props.onRetryClicked;
13756
13809
  var onRetryClicked = useCallback(function () {
13757
13810
  setAttempts(function (n) {
@@ -13767,7 +13820,10 @@ var VideoSignatureWizardWithProviders = function VideoSignatureWizardWithProvide
13767
13820
  maxVideoWidth: 1280,
13768
13821
  maxFps: 30,
13769
13822
  onCameraAccessDenied: props.onCameraAccessDenied,
13770
- onMicrophoneAccessDenied: props.onMicrophoneAccessDenied
13823
+ onCameraTamperingDetected: props.onCameraTamperingDetected,
13824
+ onMicrophoneAccessDenied: props.onMicrophoneAccessDenied,
13825
+ classNames: (_a = props.classNames) === null || _a === void 0 ? void 0 : _a.cameraStoreProvider,
13826
+ verbiage: (_b = props.verbiage) === null || _b === void 0 ? void 0 : _b.cameraStoreProvider
13771
13827
  }, /*#__PURE__*/React__default.createElement(SelfieGuidanceModelsProvider, {
13772
13828
  autoStart: false,
13773
13829
  throttleMs: 250,
@@ -14606,6 +14662,7 @@ var VideoIdWizard = function VideoIdWizard(_a) {
14606
14662
  onUserCancel = _a.onUserCancel,
14607
14663
  onIdCaptureModelError = _a.onIdCaptureModelError,
14608
14664
  onCameraAccessDenied = _a.onCameraAccessDenied,
14665
+ onCameraTamperingDetected = _a.onCameraTamperingDetected,
14609
14666
  onMicrophoneAccessDenied = _a.onMicrophoneAccessDenied,
14610
14667
  _l = _a.idCaptureProps,
14611
14668
  idCaptureProps = _l === void 0 ? {} : _l,
@@ -14764,7 +14821,10 @@ var VideoIdWizard = function VideoIdWizard(_a) {
14764
14821
  maxVideoWidth: isCapturingId ? 1920 : 1280,
14765
14822
  maxFps: isCapturingId ? 60 : 30,
14766
14823
  onCameraAccessDenied: onCameraAccessDenied,
14767
- onMicrophoneAccessDenied: onMicrophoneAccessDenied
14824
+ onCameraTamperingDetected: onCameraTamperingDetected,
14825
+ onMicrophoneAccessDenied: onMicrophoneAccessDenied,
14826
+ classNames: classNames === null || classNames === void 0 ? void 0 : classNames.cameraStoreProvider,
14827
+ verbiage: verbiage === null || verbiage === void 0 ? void 0 : verbiage.cameraStoreProvider
14768
14828
  }, /*#__PURE__*/React__default.createElement(IdCaptureModelsProvider, {
14769
14829
  autoStart: false,
14770
14830
  documentDetectionModelUrl: (_g = (_f = idCaptureProps.assets) === null || _f === void 0 ? void 0 : _f.documentDetectionModelUrl) !== null && _g !== void 0 ? _g : '',
@@ -14875,35 +14935,36 @@ var VideoIdWizard = function VideoIdWizard(_a) {
14875
14935
  };
14876
14936
 
14877
14937
  function CompositeWizard(_a) {
14878
- var _b, _c, _d, _e, _f;
14938
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k;
14879
14939
  var userChecks = _a.checks,
14880
- _g = _a.idCaptureProps,
14881
- idCaptureProps = _g === void 0 ? {} : _g,
14882
- _h = _a.faceLivenessProps,
14883
- faceLivenessProps = _h === void 0 ? {} : _h,
14940
+ _l = _a.idCaptureProps,
14941
+ idCaptureProps = _l === void 0 ? {} : _l,
14942
+ _m = _a.faceLivenessProps,
14943
+ faceLivenessProps = _m === void 0 ? {} : _m,
14884
14944
  additionalDocumentCaptureProps = _a.additionalDocumentCaptureProps,
14885
- _j = _a.signatureCaptureProps,
14886
- signatureCaptureProps = _j === void 0 ? {} : _j,
14887
- _k = _a.videoSignatureCaptureProps,
14888
- videoSignatureCaptureProps = _k === void 0 ? {} : _k,
14889
- _l = _a.videoIdCaptureProps,
14890
- videoIdCaptureProps = _l === void 0 ? {} : _l,
14891
- _m = _a.captureSignature,
14892
- captureSignature = _m === void 0 ? false : _m,
14893
- _o = _a.captureSignatureVideo,
14894
- captureSignatureVideo = _o === void 0 ? false : _o,
14945
+ _o = _a.signatureCaptureProps,
14946
+ signatureCaptureProps = _o === void 0 ? {} : _o,
14947
+ _p = _a.videoSignatureCaptureProps,
14948
+ videoSignatureCaptureProps = _p === void 0 ? {} : _p,
14949
+ _q = _a.videoIdCaptureProps,
14950
+ videoIdCaptureProps = _q === void 0 ? {} : _q,
14951
+ _r = _a.captureSignature,
14952
+ captureSignature = _r === void 0 ? false : _r,
14953
+ _s = _a.captureSignatureVideo,
14954
+ captureSignatureVideo = _s === void 0 ? false : _s,
14895
14955
  onCameraAccessDenied = _a.onCameraAccessDenied,
14956
+ onCameraTamperingDetected = _a.onCameraTamperingDetected,
14896
14957
  onMicrophoneAccessDenied = _a.onMicrophoneAccessDenied,
14897
- _p = _a.debugMode,
14898
- debugMode = _p === void 0 ? false : _p;
14899
- var _q = useContext(SubmissionContext),
14900
- submit = _q.submit,
14901
- submissionStatus = _q.submissionStatus,
14902
- setSignatureData = _q.setSignatureData,
14903
- setAdditionalDocuments = _q.setAdditionalDocuments;
14904
- var _r = useState(0),
14905
- checkIndex = _r[0],
14906
- setCheckIndex = _r[1];
14958
+ _t = _a.debugMode,
14959
+ debugMode = _t === void 0 ? false : _t;
14960
+ var _u = useContext(SubmissionContext),
14961
+ submit = _u.submit,
14962
+ submissionStatus = _u.submissionStatus,
14963
+ setSignatureData = _u.setSignatureData,
14964
+ setAdditionalDocuments = _u.setAdditionalDocuments;
14965
+ var _v = useState(0),
14966
+ checkIndex = _v[0],
14967
+ setCheckIndex = _v[1];
14907
14968
  var checks = useMemo(function () {
14908
14969
  var _a, _b;
14909
14970
  var checks = __spreadArray([], userChecks, true);
@@ -15014,13 +15075,16 @@ function CompositeWizard(_a) {
15014
15075
  case 'IdCapture':
15015
15076
  return /*#__PURE__*/React__default.createElement(CameraStoreProvider, {
15016
15077
  onCameraAccessDenied: onCameraAccessDenied,
15078
+ onCameraTamperingDetected: onCameraTamperingDetected,
15017
15079
  onMicrophoneAccessDenied: onMicrophoneAccessDenied,
15018
- requestAccessAutomatically: shouldLoadIdCaptureModels
15080
+ requestAccessAutomatically: shouldLoadIdCaptureModels,
15081
+ classNames: (_c = idCaptureProps.classNames) === null || _c === void 0 ? void 0 : _c.cameraStoreProvider,
15082
+ verbiage: (_d = idCaptureProps.verbiage) === null || _d === void 0 ? void 0 : _d.cameraStoreProvider
15019
15083
  }, /*#__PURE__*/React__default.createElement(IdCaptureModelsProvider, {
15020
15084
  autoStart: false,
15021
15085
  shouldLoadModels: shouldLoadIdCaptureModels,
15022
- documentDetectionModelUrl: (_d = (_c = idCaptureProps.assets) === null || _c === void 0 ? void 0 : _c.documentDetectionModelUrl) !== null && _d !== void 0 ? _d : '',
15023
- focusModelUrl: (_f = (_e = idCaptureProps.assets) === null || _e === void 0 ? void 0 : _e.focusModelUrl) !== null && _f !== void 0 ? _f : '',
15086
+ documentDetectionModelUrl: (_f = (_e = idCaptureProps.assets) === null || _e === void 0 ? void 0 : _e.documentDetectionModelUrl) !== null && _f !== void 0 ? _f : '',
15087
+ focusModelUrl: (_h = (_g = idCaptureProps.assets) === null || _g === void 0 ? void 0 : _g.focusModelUrl) !== null && _h !== void 0 ? _h : '',
15024
15088
  onModelError: idCaptureProps.onModelError,
15025
15089
  modelLoadTimeoutMs: idCaptureProps.modelLoadTimeoutMs,
15026
15090
  allowSinglePageIdCapture: idCaptureProps.allowSinglePageIdCapture
@@ -15031,6 +15095,7 @@ function CompositeWizard(_a) {
15031
15095
  return /*#__PURE__*/React__default.createElement(VideoIdWizard, _assign({}, videoIdCaptureProps, {
15032
15096
  onComplete: onVideoIdCaptureComplete,
15033
15097
  onCameraAccessDenied: onCameraAccessDenied,
15098
+ onCameraTamperingDetected: onCameraTamperingDetected,
15034
15099
  onMicrophoneAccessDenied: onMicrophoneAccessDenied
15035
15100
  }));
15036
15101
  case 'FaceLiveness':
@@ -15038,7 +15103,10 @@ function CompositeWizard(_a) {
15038
15103
  preferFrontFacingCamera: true,
15039
15104
  preferIphoneContinuityCamera: false,
15040
15105
  onCameraAccessDenied: onCameraAccessDenied,
15041
- onMicrophoneAccessDenied: onMicrophoneAccessDenied
15106
+ onCameraTamperingDetected: onCameraTamperingDetected,
15107
+ onMicrophoneAccessDenied: onMicrophoneAccessDenied,
15108
+ classNames: (_j = faceLivenessProps.classNames) === null || _j === void 0 ? void 0 : _j.cameraStoreProvider,
15109
+ verbiage: (_k = faceLivenessProps.verbiage) === null || _k === void 0 ? void 0 : _k.cameraStoreProvider
15042
15110
  }, /*#__PURE__*/React__default.createElement(SelfieGuidanceModelsProvider, {
15043
15111
  autoStart: false,
15044
15112
  onModelError: faceLivenessProps.onModelError,
@@ -15054,6 +15122,7 @@ function CompositeWizard(_a) {
15054
15122
  return /*#__PURE__*/React__default.createElement(VideoSignatureWizardWithProviders, _assign({}, videoSignatureCaptureProps, {
15055
15123
  onComplete: onVideoSignatureComplete,
15056
15124
  onCameraAccessDenied: onCameraAccessDenied,
15125
+ onCameraTamperingDetected: onCameraTamperingDetected,
15057
15126
  onMicrophoneAccessDenied: onMicrophoneAccessDenied
15058
15127
  }));
15059
15128
  case 'AdditionalDocumentCapture':
@@ -15383,6 +15452,7 @@ var IdValidation = function IdValidation(_a) {
15383
15452
  onUserCancel = _a.onUserCancel,
15384
15453
  onModelError = _a.onModelError,
15385
15454
  onCameraAccessDenied = _a.onCameraAccessDenied,
15455
+ onCameraTamperingDetected = _a.onCameraTamperingDetected,
15386
15456
  _u = _a.theme,
15387
15457
  theme = _u === void 0 ? 'default' : _u,
15388
15458
  _v = _a.assets,
@@ -15524,6 +15594,7 @@ var IdValidation = function IdValidation(_a) {
15524
15594
  captureSignature: captureSignature,
15525
15595
  captureSignatureVideo: captureSignatureVideo,
15526
15596
  onCameraAccessDenied: onCameraAccessDenied,
15597
+ onCameraTamperingDetected: onCameraTamperingDetected,
15527
15598
  debugMode: debugMode
15528
15599
  }))));
15529
15600
  };
@@ -15578,6 +15649,7 @@ var FaceValidation = function FaceValidation(_a) {
15578
15649
  onUserCancel = _a.onUserCancel,
15579
15650
  onModelError = _a.onModelError,
15580
15651
  onCameraAccessDenied = _a.onCameraAccessDenied,
15652
+ onCameraTamperingDetected = _a.onCameraTamperingDetected,
15581
15653
  _j = _a.theme,
15582
15654
  theme = _j === void 0 ? 'default' : _j,
15583
15655
  assets = _a.assets,
@@ -15653,6 +15725,7 @@ var FaceValidation = function FaceValidation(_a) {
15653
15725
  }, []),
15654
15726
  faceLivenessProps: faceLivenessProps,
15655
15727
  onCameraAccessDenied: onCameraAccessDenied,
15728
+ onCameraTamperingDetected: onCameraTamperingDetected,
15656
15729
  debugMode: debugMode
15657
15730
  }))));
15658
15731
  };
@@ -15749,6 +15822,7 @@ var IdAndFaceValidation = function IdAndFaceValidation(_a) {
15749
15822
  onIdCaptureModelError = _a.onIdCaptureModelError,
15750
15823
  onSelfieCaptureModelError = _a.onSelfieCaptureModelError,
15751
15824
  onCameraAccessDenied = _a.onCameraAccessDenied,
15825
+ onCameraTamperingDetected = _a.onCameraTamperingDetected,
15752
15826
  _y = _a.captureSignature,
15753
15827
  captureSignature = _y === void 0 ? false : _y,
15754
15828
  _z = _a.captureSignatureVideo,
@@ -15912,6 +15986,7 @@ var IdAndFaceValidation = function IdAndFaceValidation(_a) {
15912
15986
  captureSignature: captureSignature,
15913
15987
  captureSignatureVideo: captureSignatureVideo,
15914
15988
  onCameraAccessDenied: onCameraAccessDenied,
15989
+ onCameraTamperingDetected: onCameraTamperingDetected,
15915
15990
  debugMode: debugMode
15916
15991
  }))));
15917
15992
  };
@@ -16011,6 +16086,7 @@ var CustomerIdAndBiometricsEnrollment = function CustomerIdAndBiometricsEnrollme
16011
16086
  onIdCaptureModelError = _a.onIdCaptureModelError,
16012
16087
  onSelfieCaptureModelError = _a.onSelfieCaptureModelError,
16013
16088
  onCameraAccessDenied = _a.onCameraAccessDenied,
16089
+ onCameraTamperingDetected = _a.onCameraTamperingDetected,
16014
16090
  _y = _a.captureSignature,
16015
16091
  captureSignature = _y === void 0 ? false : _y,
16016
16092
  _z = _a.captureSignatureVideo,
@@ -16196,6 +16272,7 @@ var CustomerIdAndBiometricsEnrollment = function CustomerIdAndBiometricsEnrollme
16196
16272
  captureSignature: captureSignature,
16197
16273
  captureSignatureVideo: captureSignatureVideo,
16198
16274
  onCameraAccessDenied: onCameraAccessDenied,
16275
+ onCameraTamperingDetected: onCameraTamperingDetected,
16199
16276
  debugMode: debugMode
16200
16277
  }))));
16201
16278
  };
@@ -16705,6 +16782,7 @@ var CustomerVerification = function CustomerVerification(_a) {
16705
16782
  onUserCancel = _a.onUserCancel,
16706
16783
  onModelError = _a.onModelError,
16707
16784
  onCameraAccessDenied = _a.onCameraAccessDenied,
16785
+ onCameraTamperingDetected = _a.onCameraTamperingDetected,
16708
16786
  _h = _a.geolocationEnabled,
16709
16787
  geolocationEnabled = _h === void 0 ? true : _h,
16710
16788
  _j = _a.geolocationRequired,
@@ -16746,7 +16824,10 @@ var CustomerVerification = function CustomerVerification(_a) {
16746
16824
  useDocumentServiceForLivenessChecks: useDocumentServiceForLivenessChecks
16747
16825
  }, /*#__PURE__*/React__default.createElement(CameraStoreProvider, {
16748
16826
  preferFrontFacingCamera: true,
16749
- onCameraAccessDenied: onCameraAccessDenied
16827
+ onCameraAccessDenied: onCameraAccessDenied,
16828
+ onCameraTamperingDetected: onCameraTamperingDetected,
16829
+ classNames: classNames === null || classNames === void 0 ? void 0 : classNames.cameraStoreProvider,
16830
+ verbiage: verbiage === null || verbiage === void 0 ? void 0 : verbiage.cameraStoreProvider
16750
16831
  }, /*#__PURE__*/React__default.createElement(SelfieGuidanceModelsProvider, {
16751
16832
  autoStart: false,
16752
16833
  onModelError: onModelError,
@@ -17266,6 +17347,7 @@ var CustomerIdentification = function CustomerIdentification(_a) {
17266
17347
  onUserCancel = _a.onUserCancel,
17267
17348
  onModelError = _a.onModelError,
17268
17349
  onCameraAccessDenied = _a.onCameraAccessDenied,
17350
+ onCameraTamperingDetected = _a.onCameraTamperingDetected,
17269
17351
  _g = _a.theme,
17270
17352
  theme = _g === void 0 ? 'default' : _g,
17271
17353
  assets = _a.assets,
@@ -17311,7 +17393,10 @@ var CustomerIdentification = function CustomerIdentification(_a) {
17311
17393
  useDocumentServiceForLivenessChecks: useDocumentServiceForLivenessChecks
17312
17394
  }, /*#__PURE__*/React__default.createElement(CameraStoreProvider, {
17313
17395
  preferFrontFacingCamera: true,
17314
- onCameraAccessDenied: onCameraAccessDenied
17396
+ onCameraAccessDenied: onCameraAccessDenied,
17397
+ onCameraTamperingDetected: onCameraTamperingDetected,
17398
+ classNames: classNames === null || classNames === void 0 ? void 0 : classNames.cameraStoreProvider,
17399
+ verbiage: verbiage === null || verbiage === void 0 ? void 0 : verbiage.cameraStoreProvider
17315
17400
  }, /*#__PURE__*/React__default.createElement(SelfieGuidanceModelsProvider, {
17316
17401
  autoStart: false,
17317
17402
  modelLoadTimeoutMs: modelLoadTimeoutMs,
@@ -17359,6 +17444,7 @@ var SignatureKYC = function SignatureKYC(_a) {
17359
17444
  onUserCancel = _a.onUserCancel,
17360
17445
  onModelError = _a.onModelError,
17361
17446
  onCameraAccessDenied = _a.onCameraAccessDenied,
17447
+ onCameraTamperingDetected = _a.onCameraTamperingDetected,
17362
17448
  onLoadingOverlayDismissed = _a.onLoadingOverlayDismissed,
17363
17449
  _c = _a.loadingOverlayMode,
17364
17450
  loadingOverlayMode = _c === void 0 ? 'default' : _c,
@@ -17417,6 +17503,7 @@ var SignatureKYC = function SignatureKYC(_a) {
17417
17503
  return ['VideoSignatureCapture'];
17418
17504
  }, []),
17419
17505
  onCameraAccessDenied: onCameraAccessDenied,
17506
+ onCameraTamperingDetected: onCameraTamperingDetected,
17420
17507
  videoSignatureCaptureProps: useMemo(function () {
17421
17508
  return {
17422
17509
  customOverlayContent: customOverlayContent,
@@ -17485,6 +17572,7 @@ var VideoIdValidation = function VideoIdValidation(_a) {
17485
17572
  onExitAfterFailure = _a.onExitAfterFailure,
17486
17573
  onUserCancel = _a.onUserCancel,
17487
17574
  onCameraAccessDenied = _a.onCameraAccessDenied,
17575
+ onCameraTamperingDetected = _a.onCameraTamperingDetected,
17488
17576
  onMicrophoneAccessDenied = _a.onMicrophoneAccessDenied,
17489
17577
  idCaptureProps = _a.idCaptureProps,
17490
17578
  faceLivenessProps = _a.faceLivenessProps,
@@ -17668,6 +17756,7 @@ var VideoIdValidation = function VideoIdValidation(_a) {
17668
17756
  captureSignature: captureSignature,
17669
17757
  captureSignatureVideo: captureSignatureVideo,
17670
17758
  onCameraAccessDenied: onCameraAccessDenied,
17759
+ onCameraTamperingDetected: onCameraTamperingDetected,
17671
17760
  onMicrophoneAccessDenied: onMicrophoneAccessDenied,
17672
17761
  debugMode: debugMode
17673
17762
  }))));
@@ -17723,6 +17812,7 @@ var CustomerBiometricsEnrollment = function CustomerBiometricsEnrollment(_a) {
17723
17812
  onUserCancel = _a.onUserCancel,
17724
17813
  onModelError = _a.onModelError,
17725
17814
  onCameraAccessDenied = _a.onCameraAccessDenied,
17815
+ onCameraTamperingDetected = _a.onCameraTamperingDetected,
17726
17816
  _h = _a.captureAdditionalDocuments,
17727
17817
  captureAdditionalDocuments = _h === void 0 ? [] : _h,
17728
17818
  _j = _a.captureSignature,
@@ -17844,6 +17934,7 @@ var CustomerBiometricsEnrollment = function CustomerBiometricsEnrollment(_a) {
17844
17934
  captureSignature: captureSignature,
17845
17935
  captureSignatureVideo: captureSignatureVideo,
17846
17936
  onCameraAccessDenied: onCameraAccessDenied,
17937
+ onCameraTamperingDetected: onCameraTamperingDetected,
17847
17938
  debugMode: debugMode
17848
17939
  }))));
17849
17940
  };
@@ -17871,6 +17962,7 @@ var DocumentCapture = function DocumentCapture(_a) {
17871
17962
  onExitCapture = _a.onExitCapture,
17872
17963
  onUserCancel = _a.onUserCancel,
17873
17964
  onCameraAccessDenied = _a.onCameraAccessDenied,
17965
+ onCameraTamperingDetected = _a.onCameraTamperingDetected,
17874
17966
  _c = _a.documents,
17875
17967
  documents = _c === void 0 ? [] : _c,
17876
17968
  aspectRatio = _a.aspectRatio,
@@ -17913,7 +18005,10 @@ var DocumentCapture = function DocumentCapture(_a) {
17913
18005
  }, /*#__PURE__*/React__default.createElement(CameraStoreProvider, {
17914
18006
  requestAccessAutomatically: false,
17915
18007
  preferIphoneContinuityCamera: true,
17916
- onCameraAccessDenied: onCameraAccessDenied
18008
+ onCameraAccessDenied: onCameraAccessDenied,
18009
+ onCameraTamperingDetected: onCameraTamperingDetected,
18010
+ classNames: classNames === null || classNames === void 0 ? void 0 : classNames.cameraStoreProvider,
18011
+ verbiage: verbiage === null || verbiage === void 0 ? void 0 : verbiage.cameraStoreProvider
17917
18012
  }, /*#__PURE__*/React__default.createElement(DocumentCaptureWizard, {
17918
18013
  onSuccess: onComplete,
17919
18014
  onExitCapture: onExitCapture,