idmission-web-sdk 2.2.163 → 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 -1935
  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 -1936
  48. package/dist/sdk2.esm.js.map +1 -1
  49. package/dist/sdk2.umd.development.js +5702 -5610
  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
@@ -9,12 +9,12 @@ var tusJsClient = require('tus-js-client');
9
9
  var SparkMD5 = require('spark-md5');
10
10
  var tasksVision = require('@mediapipe/tasks-vision');
11
11
  var zustand = require('zustand');
12
+ var LanguageDetector = require('i18next-browser-languagedetector');
13
+ var i18n = require('i18next');
12
14
  var useDebounce = require('use-debounce');
13
15
  var middleware = require('zustand/middleware');
14
16
  var shallow = require('zustand/react/shallow');
15
17
  var reactDom = require('react-dom');
16
- var LanguageDetector = require('i18next-browser-languagedetector');
17
- var i18n = require('i18next');
18
18
  var SignatureCanvas = require('react-signature-canvas');
19
19
 
20
20
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
@@ -233,7 +233,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
233
233
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
234
234
  };
235
235
 
236
- var webSdkVersion = '2.2.163';
236
+ var webSdkVersion = '2.2.164';
237
237
 
238
238
  function getPlatform() {
239
239
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -394,7 +394,7 @@ function videoDataUrlToB64(url) {
394
394
  });
395
395
  }
396
396
 
397
- var PageContainerDiv = styled__default.default.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) {
397
+ var PageContainerDiv = styled__default.default.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) {
398
398
  var _a;
399
399
  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 ");
400
400
  }, function (props) {
@@ -434,7 +434,7 @@ var PageContainer = /*#__PURE__*/React.forwardRef(function (_a, ref) {
434
434
  }, dimensionsCalculated && children);
435
435
  });
436
436
  PageContainer.displayName = 'PageContainer';
437
- var templateObject_1$M;
437
+ var templateObject_1$N;
438
438
 
439
439
  var LoaderButton = function LoaderButton(_a) {
440
440
  var children = _a.children,
@@ -491,18 +491,18 @@ var LoaderButton = function LoaderButton(_a) {
491
491
  className: "ladda-label"
492
492
  }, children));
493
493
  };
494
- var StyledButton = styled__default.default.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) {
494
+ var StyledButton = styled__default.default.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) {
495
495
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
496
496
  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 ");
497
497
  });
498
- var templateObject_1$L;
498
+ var templateObject_1$M;
499
499
 
500
- var OverlayContainer = styled__default.default(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) {
500
+ var OverlayContainer = styled__default.default(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) {
501
501
  return props.theme.background ? "".concat(props.theme.background) : "white";
502
502
  }, function (props) {
503
503
  return props.theme.textColor ? "color: ".concat(props.theme.textColor, ";") : "";
504
504
  });
505
- var OverlayInner$2 = styled__default.default.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) {
505
+ var OverlayInner$2 = styled__default.default.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) {
506
506
  var _a;
507
507
  return (_a = props.theme.textAlign) !== null && _a !== void 0 ? _a : 'center';
508
508
  }, function (props) {
@@ -523,7 +523,7 @@ var WideBorderButton = styled__default.default(WideButton)(templateObject_8$4 ||
523
523
  var _a, _b;
524
524
  return (_b = (_a = props.colors) === null || _a === void 0 ? void 0 : _a.borderColor) !== null && _b !== void 0 ? _b : 'var(--idm-color-secondary-500)';
525
525
  });
526
- 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;
526
+ 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;
527
527
 
528
528
  var GeolocationAccessDeniedOverlay = function GeolocationAccessDeniedOverlay(_a) {
529
529
  var accessBlockedImageUrl = _a.accessBlockedImageUrl;
@@ -770,13 +770,13 @@ var SessionValidationErrorOverlay = function SessionValidationErrorOverlay(_a) {
770
770
  }, retryText)))));
771
771
  };
772
772
 
773
- var wavesAnimation = styled.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"])));
774
- var progressBarAnimation = styled.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"])));
773
+ var wavesAnimation = styled.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"])));
774
+ var progressBarAnimation = styled.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"])));
775
775
  var dualRingSpinnerAnimation = styled.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"])));
776
776
  var progressBorderAnimation = styled.keyframes(templateObject_4$l || (templateObject_4$l = __makeTemplateObject(["\n to {\n stroke-dashoffset: 0;\n }\n"], ["\n to {\n stroke-dashoffset: 0;\n }\n"])));
777
- var templateObject_1$J, templateObject_2$A, templateObject_3$r, templateObject_4$l;
777
+ var templateObject_1$K, templateObject_2$B, templateObject_3$r, templateObject_4$l;
778
778
 
779
- var Spinner = styled__default.default.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) {
779
+ var Spinner = styled__default.default.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) {
780
780
  var $size = _a.$size;
781
781
  return $size !== null && $size !== void 0 ? $size : 80;
782
782
  }, function (_a) {
@@ -801,7 +801,7 @@ var Spinner = styled__default.default.div(templateObject_1$I || (templateObject_
801
801
  var $color = _a.$color;
802
802
  return $color !== null && $color !== void 0 ? $color : '#888';
803
803
  }, dualRingSpinnerAnimation);
804
- var templateObject_1$I;
804
+ var templateObject_1$J;
805
805
 
806
806
  exports.defaultAuthUrl = 'https://portal-api.idmission.com';
807
807
  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'];
@@ -2091,7 +2091,7 @@ function getFrameDimensions(frame) {
2091
2091
  return [frameWidth, frameHeight];
2092
2092
  }
2093
2093
 
2094
- var InvisibleCanvas = styled__default.default.canvas(templateObject_1$H || (templateObject_1$H = __makeTemplateObject(["\n display: none;\n"], ["\n display: none;\n"])));
2094
+ var InvisibleCanvas = styled__default.default.canvas(templateObject_1$I || (templateObject_1$I = __makeTemplateObject(["\n display: none;\n"], ["\n display: none;\n"])));
2095
2095
  function drawToCanvas(canvas, frame, width, height) {
2096
2096
  if (!canvas) return;
2097
2097
  var ctx = canvas.getContext('2d');
@@ -2111,7 +2111,7 @@ function clearCanvas(canvas) {
2111
2111
  var _a;
2112
2112
  (_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);
2113
2113
  }
2114
- var templateObject_1$H;
2114
+ var templateObject_1$I;
2115
2115
 
2116
2116
  function cropToShoulders(rawCanvas, cropCanvas, resizeCanvas, frame, face, quality, maxHeight) {
2117
2117
  if (quality === void 0) {
@@ -3534,1693 +3534,133 @@ function releaseCameraAccess() {
3534
3534
  currentCamera = undefined;
3535
3535
  }
3536
3536
 
3537
- var initialState$5 = {
3538
- videoRef: {
3539
- current: null
3540
- },
3541
- videoLoaded: false,
3542
- videoStream: null,
3543
- videoDevice: null,
3544
- isRearFacing: false,
3545
- camera: null,
3546
- cameraReady: false,
3547
- cameraAccessDenied: false,
3548
- iphoneContinuityCameraAvailable: false,
3549
- iphoneContinuityCameraDenied: false,
3550
- preferIphoneContinuityCamera: true,
3551
- audioStream: null,
3552
- microphoneReady: false,
3553
- microphoneAccessDenied: false
3554
- };
3555
- var createCameraStore = function createCameraStore(config) {
3556
- var store = zustand.createStore(function (set, get) {
3557
- return _assign(_assign(_assign({}, initialState$5), config), {
3558
- reset: function reset() {
3559
- return set(_assign(_assign({}, initialState$5), config));
3560
- },
3561
- setConfig: function setConfig(config) {
3562
- return set(config);
3563
- },
3564
- onVideoMounted: function onVideoMounted(e) {
3565
- var _a;
3566
- var selectedVideoStreamId = (_a = get().videoStream) === null || _a === void 0 ? void 0 : _a.id;
3567
- if (!selectedVideoStreamId) return;
3568
- var srcObject = e.currentTarget.srcObject;
3569
- if (srcObject.id !== selectedVideoStreamId) {
3570
- warn('camera tampering detected, reloading the page.');
3571
- window.location.reload();
3572
- return;
3573
- }
3574
- set({
3575
- videoLoaded: true
3576
- });
3577
- },
3578
- setIphoneContinuityCameraAllowed: function setIphoneContinuityCameraAllowed(value) {
3579
- return set({
3580
- preferIphoneContinuityCamera: value
3581
- });
3582
- },
3583
- requestCameraAccess: function requestCameraAccess() {
3584
- return __awaiter(this, void 0, void 0, function () {
3585
- 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;
3586
- var _b, _c, _d;
3587
- return __generator(this, function (_e) {
3588
- switch (_e.label) {
3589
- case 0:
3590
- _a = get(), videoRef = _a.videoRef, releaseCameraAccess = _a.releaseCameraAccess, preferFrontFacingCamera = _a.preferFrontFacingCamera, preferIphoneContinuityCamera = _a.preferIphoneContinuityCamera, iphoneContinuityCameraDenied = _a.iphoneContinuityCameraDenied;
3591
- releaseCameraAccess();
3592
- _e.label = 1;
3593
- case 1:
3594
- _e.trys.push([1, 11,, 12]);
3595
- return [4 /*yield*/, listAvailableCameras()];
3596
- case 2:
3597
- availableCameras = _e.sent();
3598
- selectedCamera = void 0;
3599
- debug('availableCameras', availableCameras);
3600
- platform_1 = getPlatform();
3601
- debug('platformDetails', platform_1);
3602
- if (!iphoneContinuityCameraDenied && (!(platform_1 === null || platform_1 === void 0 ? void 0 : platform_1.os) || platform_1.os.family === 'OS X')) {
3603
- iphoneContinuityCamera = availableCameras.find(function (deviceInfo) {
3604
- return cameraLabelMatches(deviceInfo, 'iphone');
3605
- });
3606
- set({
3607
- iphoneContinuityCameraAvailable: !!iphoneContinuityCamera
3608
- });
3609
- if (iphoneContinuityCamera && preferIphoneContinuityCamera) {
3610
- selectedCamera = iphoneContinuityCamera;
3611
- }
3612
- } 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) {
3613
- return c.label.startsWith('camera2 ');
3614
- })) {
3615
- availableCameras = availableCameras.sort(function (a, b) {
3616
- return a.label.toLowerCase().localeCompare(b.label.toLowerCase());
3617
- });
3618
- debug('cameras have been sorted', availableCameras);
3619
- }
3620
- if (preferFrontFacingCamera) {
3621
- selectedCamera = availableCameras.find(function (deviceInfo) {
3622
- return cameraLabelMatches(deviceInfo, frontCameraLabels);
3623
- });
3624
- }
3625
- selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
3626
- return cameraLabelMatches(deviceInfo, 'backtriplecamera');
3627
- }));
3628
- selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
3629
- return cameraLabelMatches(deviceInfo, 'backdualcamera');
3630
- }));
3631
- selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
3632
- return cameraLabelMatches(deviceInfo, rearCameraLabels) && !cameraLabelMatches(deviceInfo, backUltraWideCameraLabels);
3633
- }));
3634
- selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
3635
- return cameraLabelMatches(deviceInfo, rearCameraLabels);
3636
- }));
3637
- // on iOS, the front facing camera always is at the first position in the list, so we skip it if all else fails.
3638
- 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) {
3639
- selectedCamera || (selectedCamera = availableCameras[1]);
3640
- }
3641
- selectedCamera || (selectedCamera = availableCameras[0]);
3642
- debug('selectedCamera', selectedCamera);
3643
- set({
3644
- videoDevice: selectedCamera
3645
- });
3646
- constraints = {
3647
- audio: false,
3648
- video: {
3649
- deviceId: {
3650
- exact: selectedCamera.deviceId
3651
- },
3652
- width: {
3653
- ideal: config.maxVideoWidth
3654
- },
3655
- aspectRatio: 1.777777778,
3656
- frameRate: {}
3657
- }
3658
- };
3659
- if (config.maxFps) {
3660
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
3661
- // @ts-ignore
3662
- constraints.video.frameRate = {
3663
- max: config.maxFps
3664
- };
3665
- }
3666
- stream_1 = null;
3667
- _e.label = 3;
3668
- case 3:
3669
- _e.trys.push([3, 5,, 6]);
3670
- debug('obtaining camera access with constraints', constraints);
3671
- return [4 /*yield*/, navigator.mediaDevices.getUserMedia(constraints)];
3672
- case 4:
3673
- stream_1 = _e.sent();
3674
- return [3 /*break*/, 6];
3675
- case 5:
3676
- e_1 = _e.sent();
3677
- if (e_1.name === 'NotAllowedError') {
3678
- if (preferIphoneContinuityCamera) {
3679
- set({
3680
- iphoneContinuityCameraAvailable: false,
3681
- iphoneContinuityCameraDenied: true
3682
- });
3683
- } else {
3684
- set({
3685
- cameraAccessDenied: true
3686
- });
3687
- }
3688
- return [2 /*return*/];
3689
- }
3690
- return [3 /*break*/, 6];
3691
- case 6:
3692
- if (!!stream_1) return [3 /*break*/, 10];
3693
- _e.label = 7;
3694
- case 7:
3695
- _e.trys.push([7, 9,, 10]);
3696
- return [4 /*yield*/, navigator.mediaDevices.getUserMedia({
3697
- audio: false,
3698
- video: true
3699
- })];
3700
- case 8:
3701
- stream_1 = _e.sent();
3702
- debug('opened stream with no width and height constraints');
3703
- return [3 /*break*/, 10];
3704
- case 9:
3705
- e_2 = _e.sent();
3706
- debug('cannot open stream at all', e_2);
3707
- return [3 /*break*/, 10];
3708
- case 10:
3709
- if (!stream_1) {
3710
- error('failed to open camera');
3711
- throw new Error('failed to open camera: ');
3712
- }
3713
- debug('camera access granted with constraints', constraints);
3714
- handleStreamEnded_1 = function handleStreamEnded_1() {
3715
- if (preferIphoneContinuityCamera && get().iphoneContinuityCameraAvailable) {
3716
- debug('someone unplugged the continuity camera');
3717
- set({
3718
- videoStream: null,
3719
- videoDevice: null,
3720
- cameraReady: false,
3721
- iphoneContinuityCameraAvailable: false,
3722
- iphoneContinuityCameraDenied: true
3723
- });
3724
- get().requestCameraAccess();
3725
- } else {
3726
- debug('someone unplugged the webcam');
3727
- releaseCameraAccess();
3728
- set({
3729
- videoStream: null,
3730
- videoDevice: null,
3731
- videoLoaded: false,
3732
- cameraReady: false,
3733
- cameraAccessDenied: true
3734
- });
3735
- }
3736
- };
3737
- (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.addEventListener('ended', handleStreamEnded_1);
3738
- videoTrack_1 = stream_1.getVideoTracks()[0];
3739
- videoTrack_1.onended = handleStreamEnded_1;
3740
- camera_1 = obtainCameraAccess(stream_1, selectedCamera.label, videoRef.current);
3741
- setTimeout(function () {
3742
- // iOS 17 has a strange behavior where the video track flickers between muted and unmuted
3743
- // when the camera access is being requested. This delay is a workaround for that.
3744
- videoTrack_1.onmute = function () {
3745
- if (videoTrack_1.readyState !== 'live') handleStreamEnded_1();
3746
- };
3747
- set({
3748
- camera: camera_1,
3749
- cameraReady: true,
3750
- cameraAccessDenied: false,
3751
- isRearFacing: camera_1.isRearFacing,
3752
- videoStream: stream_1
3753
- });
3754
- }, 500);
3755
- return [3 /*break*/, 12];
3756
- case 11:
3757
- e_3 = _e.sent();
3758
- if (e_3.name === 'NotAllowedError') {
3759
- error('camera access has been blocked by the user', e_3);
3760
- set({
3761
- cameraAccessDenied: true
3762
- });
3763
- } else {
3764
- error('camera access encountered some other error', e_3);
3765
- throw e_3;
3766
- }
3767
- return [3 /*break*/, 12];
3768
- case 12:
3769
- return [2 /*return*/];
3770
- }
3771
- });
3772
- });
3773
- },
3774
- releaseCameraAccess: function releaseCameraAccess() {
3775
- return __awaiter(this, void 0, void 0, function () {
3776
- var camera;
3777
- return __generator(this, function (_a) {
3778
- camera = get().camera;
3779
- if (!camera) return [2 /*return*/];
3780
- camera.release();
3781
- set({
3782
- camera: null,
3783
- cameraReady: false,
3784
- cameraAccessDenied: false,
3785
- videoDevice: null,
3786
- videoStream: null,
3787
- videoLoaded: false
3788
- });
3789
- return [2 /*return*/];
3790
- });
3791
- });
3792
- },
3793
- requestMicrophoneAccess: function requestMicrophoneAccess() {
3794
- return __awaiter(this, void 0, void 0, function () {
3795
- var stream_2, e_4;
3796
- return __generator(this, function (_a) {
3797
- switch (_a.label) {
3798
- case 0:
3799
- get().releaseMicrophoneAccess();
3800
- _a.label = 1;
3801
- case 1:
3802
- _a.trys.push([1, 3,, 4]);
3803
- return [4 /*yield*/, navigator.mediaDevices.getUserMedia({
3804
- audio: true,
3805
- video: false
3806
- })
3807
- // iOS 17 has a strange behavior where the video track flickers between muted and unmuted
3808
- // when the camera access is being requested. This delay is a workaround for that.
3809
- ];
3810
- case 2:
3811
- stream_2 = _a.sent();
3812
- // iOS 17 has a strange behavior where the video track flickers between muted and unmuted
3813
- // when the camera access is being requested. This delay is a workaround for that.
3814
- setTimeout(function () {
3815
- set({
3816
- audioStream: stream_2,
3817
- microphoneReady: true,
3818
- microphoneAccessDenied: false
3819
- });
3820
- var handleStreamEnded = function handleStreamEnded() {
3821
- set({
3822
- microphoneReady: false,
3823
- microphoneAccessDenied: true
3824
- });
3825
- };
3826
- var track = stream_2.getAudioTracks()[0];
3827
- track.onended = handleStreamEnded;
3828
- track.onmute = function () {
3829
- if (track.readyState !== 'live') handleStreamEnded();
3830
- };
3831
- }, 500);
3832
- return [3 /*break*/, 4];
3833
- case 3:
3834
- e_4 = _a.sent();
3835
- debug('failed to open microphone', e_4);
3836
- set({
3837
- microphoneAccessDenied: true
3838
- });
3839
- return [3 /*break*/, 4];
3840
- case 4:
3841
- return [2 /*return*/];
3842
- }
3843
- });
3844
- });
3845
- },
3846
- releaseMicrophoneAccess: function releaseMicrophoneAccess() {
3847
- var _a;
3848
- var audioStream = get().audioStream;
3849
- (_a = audioStream === null || audioStream === void 0 ? void 0 : audioStream.stop) === null || _a === void 0 ? void 0 : _a.call(audioStream);
3850
- audioStream === null || audioStream === void 0 ? void 0 : audioStream.getAudioTracks().forEach(function (track) {
3851
- var _a;
3852
- (_a = track.stop) === null || _a === void 0 ? void 0 : _a.call(track);
3853
- });
3854
- set({
3855
- audioStream: null,
3856
- microphoneReady: false,
3857
- microphoneAccessDenied: false
3858
- });
3859
- }
3860
- });
3861
- });
3862
- if (config.requestAccessAutomatically) {
3863
- void store.getState().requestCameraAccess();
3864
- }
3865
- return _assign(_assign({}, store), {
3866
- destroy: function destroy() {
3867
- store.getState().releaseCameraAccess();
3868
- store.getState().releaseMicrophoneAccess();
3869
- }
3870
- });
3871
- };
3872
- var CameraStoreContext = /*#__PURE__*/React.createContext(undefined);
3873
- function CameraStoreProvider(_a) {
3874
- var children = _a.children,
3875
- _b = _a.requestAccessAutomatically,
3876
- requestAccessAutomatically = _b === void 0 ? true : _b,
3877
- _c = _a.preferIphoneContinuityCamera,
3878
- preferIphoneContinuityCamera = _c === void 0 ? true : _c,
3879
- _d = _a.preferFrontFacingCamera,
3880
- preferFrontFacingCamera = _d === void 0 ? false : _d,
3881
- _e = _a.maxVideoWidth,
3882
- maxVideoWidth = _e === void 0 ? 1920 : _e,
3883
- maxFps = _a.maxFps,
3884
- onCameraAccessDenied = _a.onCameraAccessDenied,
3885
- onMicrophoneAccessDenied = _a.onMicrophoneAccessDenied,
3886
- _f = _a.requireMicrophoneAccess,
3887
- requireMicrophoneAccess = _f === void 0 ? false : _f;
3888
- var videoRef = React.useRef(null);
3889
- var store = React.useRef();
3890
- store.current || (store.current = createCameraStore({
3891
- videoRef: videoRef,
3892
- requestAccessAutomatically: requestAccessAutomatically,
3893
- preferIphoneContinuityCamera: preferIphoneContinuityCamera,
3894
- preferFrontFacingCamera: preferFrontFacingCamera,
3895
- maxVideoWidth: maxVideoWidth,
3896
- maxFps: maxFps,
3897
- onCameraAccessDenied: onCameraAccessDenied,
3898
- onMicrophoneAccessDenied: onMicrophoneAccessDenied,
3899
- requireMicrophoneAccess: requireMicrophoneAccess
3900
- }));
3901
- React.useEffect(function () {
3902
- var _a, _b, _c;
3903
- var state = (_a = store.current) === null || _a === void 0 ? void 0 : _a.getState();
3904
- if (!state) return;
3905
- if (preferIphoneContinuityCamera !== (state === null || state === void 0 ? void 0 : state.preferIphoneContinuityCamera) || preferFrontFacingCamera !== (state === null || state === void 0 ? void 0 : state.preferFrontFacingCamera)) {
3906
- (_b = store.current) === null || _b === void 0 ? void 0 : _b.setState({
3907
- preferIphoneContinuityCamera: preferIphoneContinuityCamera,
3908
- preferFrontFacingCamera: preferFrontFacingCamera
3909
- });
3910
- (_c = store.current) === null || _c === void 0 ? void 0 : _c.getState().requestCameraAccess();
3911
- }
3912
- }, [preferFrontFacingCamera, preferIphoneContinuityCamera]);
3913
- React.useEffect(function () {
3914
- var _a;
3915
- if (requireMicrophoneAccess) {
3916
- (_a = store.current) === null || _a === void 0 ? void 0 : _a.getState().requestMicrophoneAccess();
3917
- }
3918
- }, [requireMicrophoneAccess]);
3919
- React.useEffect(function () {
3920
- return function () {
3921
- var _a;
3922
- return (_a = store.current) === null || _a === void 0 ? void 0 : _a.destroy();
3923
- };
3924
- }, []);
3925
- return /*#__PURE__*/React__namespace.default.createElement(CameraStoreContext.Provider, {
3926
- value: store.current
3927
- }, children);
3928
- }
3929
- function useCameraStore(selector) {
3930
- var store = React.useContext(CameraStoreContext);
3931
- if (!store) throw new Error('useCameraStore cannot be used without Provider');
3932
- return zustand.useStore(store, selector);
3933
- }
3934
-
3935
- var DocumentDetectionModelContext = /*#__PURE__*/React.createContext({
3936
- startDocumentDetection: function startDocumentDetection() {
3937
- return null;
3938
- },
3939
- stopDocumentDetection: function stopDocumentDetection() {
3940
- return null;
3941
- },
3942
- loadDocumentDetectionModel: function loadDocumentDetectionModel() {
3943
- return null;
3944
- },
3945
- documentDetectionModelReady: false,
3946
- documentDetectionModelDownloadProgress: 0,
3947
- documentDetectionModelError: null,
3948
- onDocumentDetected: function onDocumentDetected() {
3949
- return null;
3950
- },
3951
- detectionTime: 0,
3952
- documentDetectionThresholds: {},
3953
- setDocumentDetectionThresholds: function setDocumentDetectionThresholds() {
3954
- return null;
3955
- },
3956
- documentDetectionBoundaries: defaultDocumentDetectionBoundaries,
3957
- setDocumentDetectionBoundaries: function setDocumentDetectionBoundaries() {
3958
- return null;
3959
- },
3960
- documentDetectionLastPredictionCanvas: {
3961
- current: null
3962
- },
3963
- clearDocumentDetectionLastPredictionCanvas: function clearDocumentDetectionLastPredictionCanvas() {
3964
- return null;
3965
- }
3966
- });
3967
- function DocumentDetectionModelProvider(_a) {
3968
- var _this = this;
3969
- var _b = _a.autoStart,
3970
- autoStart = _b === void 0 ? true : _b,
3971
- children = _a.children,
3972
- _c = _a.throttleMs,
3973
- throttleMs = _c === void 0 ? 16 : _c,
3974
- _d = _a.delayAfterStartMs,
3975
- delayAfterStartMs = _d === void 0 ? 0 : _d,
3976
- _e = _a.documentDetectionModelPath,
3977
- documentDetectionModelPath = _e === void 0 ? defaultDocumentDetectorModelPath : _e,
3978
- _f = _a.documentDetectionModelScoreThreshold,
3979
- documentDetectionModelScoreThreshold = _f === void 0 ? defaultDocumentDetectionScoreThreshold : _f,
3980
- _g = _a.documentDetectionModelLoadTimeoutMs,
3981
- documentDetectionModelLoadTimeoutMs = _g === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _g,
3982
- onDocumentDetectionModelError = _a.onDocumentDetectionModelError,
3983
- _h = _a.shouldLoadModels,
3984
- shouldLoadModelsProp = _h === void 0 ? true : _h;
3985
- var _j = useCameraStore(),
3986
- videoRef = _j.videoRef,
3987
- videoLoaded = _j.videoLoaded,
3988
- cameraReady = _j.cameraReady;
3989
- var lastPredictionCanvas = React.useRef(null);
3990
- var onPredictionHandler = React.useRef();
3991
- var _k = React.useState({}),
3992
- documentDetectionThresholds = _k[0],
3993
- setDocumentDetectionThresholds = _k[1];
3994
- var _l = React.useState(defaultDocumentDetectionBoundaries),
3995
- documentDetectionBoundaries = _l[0],
3996
- setDocumentDetectionBoundaries = _l[1];
3997
- var _m = React.useState(0),
3998
- timesAllZero = _m[0],
3999
- setTimesAllZero = _m[1];
4000
- var _o = React.useState(0),
4001
- canvasKey = _o[0],
4002
- setCanvasKey = _o[1];
4003
- var stopDetection = React.useRef(0);
4004
- var _p = React.useState(shouldLoadModelsProp),
4005
- shouldLoadModels = _p[0],
4006
- setShouldLoadModels = _p[1];
4007
- var load = React.useCallback(function () {
4008
- return setShouldLoadModels(true);
4009
- }, []);
4010
- var _q = useLoadDocumentDetector({
4011
- modelPath: documentDetectionModelPath,
4012
- modelLoadTimeoutMs: documentDetectionModelLoadTimeoutMs,
4013
- scoreThreshold: documentDetectionModelScoreThreshold,
4014
- onModelError: onDocumentDetectionModelError,
4015
- videoRef: videoRef,
4016
- shouldLoadModels: shouldLoadModels
4017
- }),
4018
- ready = _q.ready,
4019
- modelDownloadProgress = _q.modelDownloadProgress,
4020
- modelError = _q.modelError,
4021
- setModelError = _q.setModelError;
4022
- var _r = useFrameLoop(React.useCallback(function (frameId, timeRunning) {
4023
- return __awaiter(_this, void 0, void 0, function () {
4024
- var stopDetectionAtStart, vw, vh, ctx, prediction, processedPrediction;
4025
- var _a;
4026
- return __generator(this, function (_b) {
4027
- switch (_b.label) {
4028
- case 0:
4029
- if (!videoLoaded || !cameraReady || !ready || !videoRef.current || !lastPredictionCanvas.current) return [2 /*return*/];
4030
- stopDetectionAtStart = stopDetection.current;
4031
- vw = videoRef.current.videoWidth;
4032
- vh = videoRef.current.videoHeight;
4033
- lastPredictionCanvas.current.width = vw;
4034
- lastPredictionCanvas.current.height = vh;
4035
- ctx = lastPredictionCanvas.current.getContext('2d');
4036
- if (!(ctx && videoRef.current.readyState === 4)) return [3 /*break*/, 3];
4037
- if (stopDetectionAtStart !== stopDetection.current) return [2 /*return*/];
4038
- ctx.drawImage(videoRef.current, 0, 0, vw, vh);
4039
- return [4 /*yield*/, makeDocumentDetectorPrediction(lastPredictionCanvas.current)];
4040
- case 1:
4041
- prediction = _b.sent();
4042
- if (!prediction) return [3 /*break*/, 3];
4043
- processedPrediction = processDocumentDetectorPrediction(prediction, documentDetectionThresholds, documentDetectionBoundaries);
4044
- processedPrediction.frameId = frameId;
4045
- setLastDetectionAt(new Date().getTime());
4046
- debug(processedPrediction);
4047
- if (processedPrediction.allZero) setTimesAllZero(function (n) {
4048
- return n + 1;
4049
- });
4050
- if (stopDetectionAtStart !== stopDetection.current) return [2 /*return*/];
4051
- if (timeRunning < delayAfterStartMs) return [2 /*return*/];
4052
- return [4 /*yield*/, (_a = onPredictionHandler.current) === null || _a === void 0 ? void 0 : _a.call(onPredictionHandler, processedPrediction)];
4053
- case 2:
4054
- _b.sent();
4055
- _b.label = 3;
4056
- case 3:
4057
- return [2 /*return*/];
4058
- }
4059
- });
4060
- });
4061
- }, [cameraReady, delayAfterStartMs, documentDetectionBoundaries, documentDetectionThresholds, ready, videoLoaded, videoRef]), {
4062
- throttleMs: throttleMs,
4063
- autoStart: autoStart
4064
- }),
4065
- start = _r.start,
4066
- stop = _r.stop;
4067
- React.useEffect(function setErrorIfAllZero() {
4068
- if (timesAllZero >= 2) {
4069
- setModelError(new Error('model is returning all zeroes'));
4070
- }
4071
- }, [setModelError, timesAllZero]);
4072
- var onDocumentDetected = React.useCallback(function (handler) {
4073
- onPredictionHandler.current = handler;
4074
- }, []);
4075
- var clearDocumentDetectionLastPredictionCanvas = React.useCallback(function () {
4076
- stopDetection.current += 1;
4077
- setCanvasKey(function (n) {
4078
- return n + 1;
4079
- });
4080
- }, []);
4081
- var value = React.useMemo(function () {
4082
- return {
4083
- startDocumentDetection: start,
4084
- stopDocumentDetection: stop,
4085
- loadDocumentDetectionModel: load,
4086
- documentDetectionModelReady: ready,
4087
- documentDetectionModelError: modelError,
4088
- documentDetectionModelDownloadProgress: modelDownloadProgress,
4089
- onDocumentDetected: onDocumentDetected,
4090
- detectionTime: lastDetectionTime,
4091
- documentDetectionThresholds: documentDetectionThresholds,
4092
- setDocumentDetectionThresholds: setDocumentDetectionThresholds,
4093
- documentDetectionBoundaries: documentDetectionBoundaries,
4094
- setDocumentDetectionBoundaries: setDocumentDetectionBoundaries,
4095
- documentDetectionLastPredictionCanvas: lastPredictionCanvas,
4096
- clearDocumentDetectionLastPredictionCanvas: clearDocumentDetectionLastPredictionCanvas
4097
- };
4098
- }, [start, stop, load, ready, modelError, modelDownloadProgress, onDocumentDetected, documentDetectionThresholds, documentDetectionBoundaries, clearDocumentDetectionLastPredictionCanvas]);
4099
- return /*#__PURE__*/React__namespace.createElement(DocumentDetectionModelContext.Provider, {
4100
- value: value
4101
- }, /*#__PURE__*/React__namespace.createElement(InvisibleCanvas, {
4102
- key: canvasKey,
4103
- ref: lastPredictionCanvas
4104
- }), children);
4105
- }
4106
-
4107
- var FocusModelContext = /*#__PURE__*/React.createContext({
4108
- loadFocusModel: function loadFocusModel() {
4109
- return null;
4110
- },
4111
- focusModelReady: false,
4112
- focusModelDownloadProgress: 0,
4113
- focusModelError: null,
4114
- focusThresholds: {},
4115
- setFocusThresholds: function setFocusThresholds() {
4116
- return null;
4117
- },
4118
- makeFocusPrediction: function makeFocusPrediction() {
4119
- return null;
4120
- },
4121
- focusPredictionTime: 0
4122
- });
4123
- function FocusModelProvider(_a) {
4124
- var children = _a.children,
4125
- _b = _a.focusModelPath,
4126
- focusModelPath = _b === void 0 ? defaultFocusModelPath : _b,
4127
- _c = _a.focusModelLoadTimeoutMs,
4128
- focusModelLoadTimeoutMs = _c === void 0 ? defaultFocusModelLoadTimeoutMs : _c,
4129
- onFocusModelError = _a.onFocusModelError,
4130
- _d = _a.showCanvases,
4131
- showCanvases = _d === void 0 ? false : _d,
4132
- _e = _a.shouldLoadModels,
4133
- shouldLoadModelsProp = _e === void 0 ? true : _e;
4134
- var cropCanvas = React.useRef(null);
4135
- var rotateCanvas = React.useRef(null);
4136
- var _f = React.useState({}),
4137
- focusThresholds = _f[0],
4138
- setFocusThresholds = _f[1];
4139
- var videoRef = useCameraStore().videoRef;
4140
- var _g = React.useState(shouldLoadModelsProp),
4141
- shouldLoadModels = _g[0],
4142
- setShouldLoadModels = _g[1];
4143
- var load = React.useCallback(function () {
4144
- return setShouldLoadModels(true);
4145
- }, []);
4146
- var _h = useLoadFocusModel({
4147
- modelPath: focusModelPath,
4148
- modelLoadTimeoutMs: focusModelLoadTimeoutMs,
4149
- onModelError: onFocusModelError,
4150
- videoRef: videoRef,
4151
- shouldLoadModels: shouldLoadModels
4152
- }),
4153
- ready = _h.ready,
4154
- modelDownloadProgress = _h.modelDownloadProgress,
4155
- modelError = _h.modelError;
4156
- var makeFocusPrediction = React.useCallback(function (imageData, box) {
4157
- if (!ready) return null;
4158
- var prediction = makeFocusModelPrediction(imageData, cropCanvas.current, rotateCanvas.current, box);
4159
- if (!prediction) return null;
4160
- setLastFocusPredictionAt(prediction.predictionTime);
4161
- return prediction;
4162
- }, [ready]);
4163
- var value = React.useMemo(function () {
4164
- return {
4165
- loadFocusModel: load,
4166
- focusModelReady: ready,
4167
- focusModelDownloadProgress: modelDownloadProgress,
4168
- focusModelError: modelError,
4169
- makeFocusPrediction: makeFocusPrediction,
4170
- focusPredictionTime: lastFocusPredictionTime,
4171
- focusThresholds: focusThresholds,
4172
- setFocusThresholds: setFocusThresholds
4173
- };
4174
- }, [focusThresholds, load, makeFocusPrediction, modelDownloadProgress, modelError, ready]);
4175
- return /*#__PURE__*/React__namespace.default.createElement(FocusModelContext.Provider, {
4176
- value: value
4177
- }, /*#__PURE__*/React__namespace.default.createElement(InvisibleCanvas, {
4178
- ref: rotateCanvas,
4179
- style: showCanvases ? {
4180
- display: 'block'
4181
- } : undefined
4182
- }), /*#__PURE__*/React__namespace.default.createElement(InvisibleCanvas, {
4183
- ref: cropCanvas,
4184
- style: showCanvases ? {
4185
- display: 'block'
4186
- } : undefined
4187
- }), children);
4188
- }
4189
-
4190
- function _isNavigatorDefined() {
4191
- return typeof navigator !== 'undefined' && navigator != null;
4192
- }
4193
- var isMobileCache;
4194
- function isMobile() {
4195
- if (isMobileCache !== undefined) return isMobileCache;
4196
- isMobileCache = evaluateIsMobile();
4197
- return isMobileCache;
4198
- }
4199
- function evaluateIsMobile(nav) {
4200
- if (nav || _isNavigatorDefined()) {
4201
- if (!nav) {
4202
- nav = navigator;
4203
- }
4204
- if (nav.product === 'ReactNative') {
4205
- return true;
4206
- }
4207
- var a = nav.userAgent || nav.vendor || (
4208
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
4209
- // @ts-ignore
4210
- typeof window !== 'undefined' ? window.opera : '');
4211
- if (!a) {
4212
- var navAny = nav;
4213
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
4214
- // @ts-ignore
4215
- return navAny.userAgentData && navAny.userAgentData.mobile;
4216
- }
4217
- 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));
4218
- }
4219
- return false;
4220
- }
4221
-
4222
- var onMobile = isMobile();
4223
- var defaultIdCaptureThresholds = {
4224
- detection: defaultDocumentDetectionThresholds,
4225
- focus: defaultFocusThresholds
4226
- };
4227
- var IdCaptureModelsContext = /*#__PURE__*/React.createContext({
4228
- ready: false,
4229
- start: function start() {
4230
- return null;
4231
- },
4232
- stop: function stop() {
4233
- return null;
4234
- },
4235
- load: function load() {
4236
- return null;
4237
- },
4238
- modelDownloadProgress: 0,
4239
- modelError: null,
4240
- thresholds: defaultIdCaptureThresholds,
4241
- setThresholds: function setThresholds() {
4242
- return null;
4243
- },
4244
- documentDetectionBoundaries: defaultDocumentDetectionBoundaries,
4245
- setDocumentDetectionBoundaries: function setDocumentDetectionBoundaries() {
4246
- return null;
4247
- },
4248
- onPredictionMade: function onPredictionMade() {
4249
- return null;
4250
- },
4251
- detectionTime: 0,
4252
- focusPredictionTime: 0,
4253
- bestFrameDetails: {
4254
- current: null
4255
- },
4256
- getBestFrame: function getBestFrame() {
4257
- return null;
4258
- },
4259
- resetBestFrame: function resetBestFrame() {
4260
- return null;
4261
- },
4262
- requiredDocumentType: 'none',
4263
- setRequiredDocumentType: function setRequiredDocumentType() {
4264
- return null;
4265
- }
4266
- });
4267
- function IdCaptureModelsProviderInner(_a) {
4268
- var children = _a.children,
4269
- onModelError = _a.onModelError,
4270
- _b = _a.allowSinglePageIdCapture,
4271
- allowSinglePageIdCapture = _b === void 0 ? false : _b;
4272
- var _c = React.useContext(DocumentDetectionModelContext),
4273
- documentDetectionModelReady = _c.documentDetectionModelReady,
4274
- documentDetectionModelDownloadProgress = _c.documentDetectionModelDownloadProgress,
4275
- startDocumentDetection = _c.startDocumentDetection,
4276
- stopDocumentDetection = _c.stopDocumentDetection,
4277
- loadDocumentDetectionModel = _c.loadDocumentDetectionModel,
4278
- lastPredictionCanvas = _c.documentDetectionLastPredictionCanvas,
4279
- clearDocumentDetectionLastPredictionCanvas = _c.clearDocumentDetectionLastPredictionCanvas,
4280
- onDocumentDetected = _c.onDocumentDetected,
4281
- detectionTime = _c.detectionTime,
4282
- documentDetectionThresholds = _c.documentDetectionThresholds,
4283
- setDocumentDetectionThresholds = _c.setDocumentDetectionThresholds,
4284
- documentDetectionBoundaries = _c.documentDetectionBoundaries,
4285
- setDocumentDetectionBoundaries = _c.setDocumentDetectionBoundaries,
4286
- documentDetectionModelError = _c.documentDetectionModelError;
4287
- var _d = React.useContext(FocusModelContext),
4288
- loadFocusModel = _d.loadFocusModel,
4289
- focusModelReady = _d.focusModelReady,
4290
- focusModelDownloadProgress = _d.focusModelDownloadProgress,
4291
- makeFocusPrediction = _d.makeFocusPrediction,
4292
- focusThresholds = _d.focusThresholds,
4293
- setFocusThresholds = _d.setFocusThresholds,
4294
- focusPredictionTime = _d.focusPredictionTime,
4295
- focusModelError = _d.focusModelError;
4296
- var onPredictionHandler = React.useRef();
4297
- var bestFrameDetails = React.useRef(null);
4298
- var bestPredictionCanvas = React.useRef(null);
4299
- var bestFocusScore = React.useRef(0);
4300
- var stopDetection = React.useRef(0);
4301
- var _e = React.useState('none'),
4302
- requiredDocumentType = _e[0],
4303
- setRequiredDocumentType = _e[1];
4304
- var thresholds = React.useMemo(function () {
4305
- return _assign(_assign({}, documentDetectionThresholds), {
4306
- focus: focusThresholds
4307
- });
4308
- }, [documentDetectionThresholds, focusThresholds]);
4309
- var setThresholds = React.useCallback(function (thresholds) {
4310
- if (thresholds.detection) {
4311
- setDocumentDetectionThresholds(thresholds.detection);
4312
- }
4313
- if (thresholds.focus) {
4314
- setFocusThresholds(thresholds.focus);
4315
- }
4316
- }, [setDocumentDetectionThresholds, setFocusThresholds]);
4317
- React.useEffect(function handleDetections() {
4318
- var _this = this;
4319
- onDocumentDetected(function (prediction) {
4320
- return __awaiter(_this, void 0, void 0, function () {
4321
- var stopDetectionAtStart, focusPredictionTime, focusScore, focusThresholdMet, isSinglePage, isRequiredDocumentType, focusPrediction, focusThresholdSet, focusThreshold;
4322
- var _a, _b, _c, _d, _e, _f, _g;
4323
- return __generator(this, function (_h) {
4324
- if (!lastPredictionCanvas.current) return [2 /*return*/];
4325
- stopDetectionAtStart = stopDetection.current;
4326
- focusPredictionTime = 0, focusScore = 0, focusThresholdMet = false;
4327
- isSinglePage = prediction.detectedDocumentType === 'singlePage';
4328
- if (!allowSinglePageIdCapture && isSinglePage) {
4329
- prediction.detectedDocumentType = 'passport';
4330
- prediction.passportDetectionScore = prediction.singlePageDetectionScore;
4331
- prediction.passportDetectionThresholdMet = prediction.singlePageDetectionThresholdMet;
4332
- prediction.singlePageDetectionScore = 0;
4333
- prediction.singlePageDetectionThresholdMet = false;
4334
- }
4335
- 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'));
4336
- if (isRequiredDocumentType && prediction.detectedDocumentType !== 'none' && prediction.detectionThresholdMet && prediction.documentInBounds && !prediction.documentTooClose && prediction.documentIsStable) {
4337
- focusPrediction = makeFocusPrediction(lastPredictionCanvas.current, (_c = prediction.bestDocument) === null || _c === void 0 ? void 0 : _c.box);
4338
- if (focusPrediction) {
4339
- focusScore = focusPrediction.score;
4340
- focusPredictionTime = focusPrediction.predictionTime;
4341
- }
4342
- focusThresholdSet = (_d = thresholds.focus) === null || _d === void 0 ? void 0 : _d[prediction.detectedDocumentType];
4343
- 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;
4344
- focusThresholdMet = focusScore >= focusThreshold;
4345
- if (bestFocusScore.current <= focusScore && stopDetectionAtStart === stopDetection.current) {
4346
- bestFocusScore.current = focusScore;
4347
- drawToCanvas(bestPredictionCanvas.current, lastPredictionCanvas.current);
4348
- bestFrameDetails.current = {
4349
- boundingBox: (_f = prediction.bestDocument) === null || _f === void 0 ? void 0 : _f.box,
4350
- documentType: prediction.detectedDocumentType,
4351
- detectionScore: prediction.detectionScore,
4352
- focusScore: focusScore
4353
- };
4354
- }
4355
- }
4356
- (_g = onPredictionHandler.current) === null || _g === void 0 ? void 0 : _g.call(onPredictionHandler, _assign(_assign({}, prediction), {
4357
- focusScore: focusScore,
4358
- focusPredictionTime: focusPredictionTime,
4359
- focusThresholdMet: focusThresholdMet
4360
- }));
4361
- return [2 /*return*/];
4362
- });
4363
- });
4364
- });
4365
- }, [allowSinglePageIdCapture, lastPredictionCanvas, makeFocusPrediction, onDocumentDetected, requiredDocumentType, thresholds.focus]);
4366
- var modelError = documentDetectionModelError !== null && documentDetectionModelError !== void 0 ? documentDetectionModelError : focusModelError;
4367
- React.useEffect(function handleModelErrors() {
4368
- if (modelError) onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError);
4369
- }, [modelError, onModelError]);
4370
- var onPredictionMade = React.useCallback(function (handler) {
4371
- onPredictionHandler.current = handler;
4372
- }, []);
4373
- var getBestFrame = React.useCallback(function () {
4374
- if (!bestFrameDetails.current || !bestPredictionCanvas.current) return null;
4375
- return _assign(_assign({}, bestFrameDetails.current), {
4376
- canvas: bestPredictionCanvas.current
4377
- });
4378
- }, []);
4379
- var _f = React.useState(0),
4380
- canvasKey = _f[0],
4381
- setCanvasKey = _f[1];
4382
- var resetBestFrame = React.useCallback(function () {
4383
- stopDetection.current += 1;
4384
- setCanvasKey(function (n) {
4385
- return n + 1;
4386
- });
4387
- clearDocumentDetectionLastPredictionCanvas();
4388
- bestFrameDetails.current = null;
4389
- bestFocusScore.current = 0;
4390
- }, [clearDocumentDetectionLastPredictionCanvas]);
4391
- React.useEffect(function () {
4392
- if (requiredDocumentType) resetBestFrame();
4393
- }, [requiredDocumentType, resetBestFrame]);
4394
- var load = React.useCallback(function () {
4395
- loadDocumentDetectionModel();
4396
- loadFocusModel();
4397
- }, [loadDocumentDetectionModel, loadFocusModel]);
4398
- var value = React.useMemo(function () {
4399
- return {
4400
- ready: documentDetectionModelReady && focusModelReady,
4401
- modelDownloadProgress: (documentDetectionModelDownloadProgress + focusModelDownloadProgress) / 2,
4402
- modelError: modelError,
4403
- start: startDocumentDetection,
4404
- stop: stopDocumentDetection,
4405
- load: load,
4406
- thresholds: thresholds,
4407
- setThresholds: setThresholds,
4408
- documentDetectionBoundaries: documentDetectionBoundaries,
4409
- setDocumentDetectionBoundaries: setDocumentDetectionBoundaries,
4410
- onPredictionMade: onPredictionMade,
4411
- detectionTime: detectionTime,
4412
- focusPredictionTime: focusPredictionTime,
4413
- getBestFrame: getBestFrame,
4414
- resetBestFrame: resetBestFrame,
4415
- bestFrameDetails: bestFrameDetails,
4416
- requiredDocumentType: requiredDocumentType,
4417
- setRequiredDocumentType: setRequiredDocumentType
4418
- };
4419
- }, [detectionTime, documentDetectionBoundaries, documentDetectionModelDownloadProgress, documentDetectionModelReady, focusModelDownloadProgress, focusModelReady, focusPredictionTime, getBestFrame, load, modelError, onPredictionMade, requiredDocumentType, resetBestFrame, setDocumentDetectionBoundaries, setThresholds, startDocumentDetection, stopDocumentDetection, thresholds]);
4420
- return /*#__PURE__*/React__namespace.default.createElement(IdCaptureModelsContext.Provider, {
4421
- value: value
4422
- }, /*#__PURE__*/React__namespace.default.createElement(InvisibleCanvas, {
4423
- key: canvasKey,
4424
- ref: bestPredictionCanvas
4425
- }), children);
4426
- }
4427
- function IdCaptureModelsProvider(_a) {
4428
- var children = _a.children,
4429
- props = __rest(_a, ["children"]);
4430
- return /*#__PURE__*/React__namespace.default.createElement(DocumentDetectionModelProvider, _assign({}, props), /*#__PURE__*/React__namespace.default.createElement(FocusModelProvider, _assign({}, props), /*#__PURE__*/React__namespace.default.createElement(IdCaptureModelsProviderInner, _assign({}, props), children)));
4431
- }
4432
-
4433
- var CapturedDocumentTypeValues = ['idCardFront', 'idCardBack', 'passport', 'singlePage', 'selfie'];
4434
-
4435
- var acceptedDocumentTypesForIdCaptureRequirementOption = {
4436
- idCardFront: ['idCardFront'],
4437
- idCardBack: ['idCardBack'],
4438
- passport: ['passport'],
4439
- idCard: ['idCardFront', 'idCardBack'],
4440
- idCardAndPassport: ['idCardFront', 'idCardBack', 'passport'],
4441
- idCardOrPassport: ['idCardFront', 'idCardBack', 'passport'] // this one is so weird
4442
- };
4443
- function minImageCountForIdCaptureRequirementOption(idCaptureRequirement) {
4444
- if (idCaptureRequirement === 'idCardOrPassport') return 1;
4445
- return acceptedDocumentTypesForIdCaptureRequirementOption[idCaptureRequirement].length;
4446
- }
4447
- function maxImageCountForIdCaptureRequirementOption(idCaptureRequirement) {
4448
- if (idCaptureRequirement === 'idCardOrPassport') return 2;
4449
- return minImageCountForIdCaptureRequirementOption(idCaptureRequirement);
4450
- }
4451
- function remainingIdCaptureRequirements(captureRequirement, capturedDocuments, requestedDocumentType) {
4452
- var isIdCardOrPassport = captureRequirement === 'idCardOrPassport';
4453
- if (isIdCardOrPassport && requestedDocumentType === 'passport') return [];
4454
- var acceptedTypes = acceptedDocumentTypesForIdCaptureRequirementOption[captureRequirement];
4455
- if (captureRequirement.includes('idCard') && 'singlePage' in capturedDocuments) {
4456
- acceptedTypes = acceptedTypes.filter(function (v) {
4457
- return !v.includes('idCard');
4458
- });
4459
- }
4460
- if (isIdCardOrPassport) {
4461
- acceptedTypes = acceptedTypes.filter(function (v) {
4462
- return v !== 'passport';
4463
- });
4464
- }
4465
- return acceptedTypes.filter(function (v) {
4466
- return !(v in capturedDocuments);
4467
- });
4468
- }
4469
-
4470
- var initialState$4 = {
4471
- initialDrawComplete: false,
4472
- redrawing: false,
4473
- guideRectX: 0,
4474
- guideRectY: 0,
4475
- guideRectWidth: 0,
4476
- guideRectHeight: 0,
4477
- guideRectOffsetTop: 0,
4478
- guideImageWidth: 0,
4479
- guideImageHeight: 0,
4480
- pageWidth: 0,
4481
- pageHeight: 0,
4482
- videoWidth: 0,
4483
- videoHeight: 0,
4484
- detectedObjects: [],
4485
- bestDocument: undefined,
4486
- detectedDocumentType: 'none',
4487
- detectionThresholdMet: false,
4488
- documentInBounds: false,
4489
- documentTooClose: false,
4490
- documentIsStable: false,
4491
- flipRequired: false,
4492
- backDetectedFirst: false,
4493
- idCardDetectedButNotAllowed: false,
4494
- passportDetectedButNotAllowed: false,
4495
- enableOverrideWrongDocumentTypeDialog: false,
4496
- allowOverrideWrongDocumentTypeAfterMs: 8000,
4497
- allowOverrideWrongDocumentTypeGuidance: false,
4498
- overrideWrongDocumentTypeGuidance: false,
4499
- wrongDocumentTypePredictions: 0,
4500
- idCardFrontDetectionScore: 0,
4501
- idCardFrontDetectionThresholdMet: false,
4502
- idCardBackDetectionScore: 0,
4503
- idCardBackDetectionThresholdMet: false,
4504
- passportDetectionScore: 0,
4505
- passportDetectionThresholdMet: false,
4506
- singlePageDetectionScore: 0,
4507
- singlePageDetectionThresholdMet: false,
4508
- focusScore: 0,
4509
- focusThresholdMet: false,
4510
- isGoodFrame: false,
4511
- goodFramesCount: 0,
4512
- goodFramesThreshold: 3,
4513
- goodFramesThresholdMet: false,
4514
- lastFrameCapturedAt: null,
4515
- frameCaptureRate: 0,
4516
- capturing: false,
4517
- captureFailed: false,
4518
- imageUrl: null,
4519
- captureState: 'initializing',
4520
- capturedDocuments: {},
4521
- captureRequirement: 'idCardOrPassport',
4522
- requestedDocumentType: 'idCardFront',
4523
- allowSinglePageIdCapture: false,
4524
- allowIdCardBackToFrontCapture: false,
4525
- allowUploadingDocumentsFromStorage: false,
4526
- isUploadingDocumentsFromStorage: false,
4527
- uploadingDocumentsType: null,
4528
- operationStartedAt: null,
4529
- captureStartedAt: null,
4530
- dispatch: function dispatch() {
4531
- return null;
4532
- }
4533
- };
4534
- var _reducer = function reducer(state, action) {
4535
- var _a;
4536
- switch (action.type) {
4537
- case 'configureWizard':
4538
- {
4539
- var _b = action.payload,
4540
- captureRequirement = _b.captureRequirement,
4541
- precapturedDocuments = _b.precapturedDocuments,
4542
- allowSinglePageIdCapture = _b.allowSinglePageIdCapture,
4543
- allowIdCardBackToFrontCapture = _b.allowIdCardBackToFrontCapture,
4544
- enableOverrideWrongDocumentTypeDialog = _b.enableOverrideWrongDocumentTypeDialog,
4545
- allowOverrideWrongDocumentTypeAfterMs = _b.allowOverrideWrongDocumentTypeAfterMs,
4546
- allowUploadingDocumentsFromStorage = _b.allowUploadingDocumentsFromStorage;
4547
- var newState = _assign(_assign({}, state), {
4548
- captureRequirement: captureRequirement,
4549
- allowSinglePageIdCapture: allowSinglePageIdCapture !== null && allowSinglePageIdCapture !== void 0 ? allowSinglePageIdCapture : false,
4550
- allowIdCardBackToFrontCapture: allowIdCardBackToFrontCapture !== null && allowIdCardBackToFrontCapture !== void 0 ? allowIdCardBackToFrontCapture : false,
4551
- enableOverrideWrongDocumentTypeDialog: enableOverrideWrongDocumentTypeDialog,
4552
- allowOverrideWrongDocumentTypeAfterMs: allowOverrideWrongDocumentTypeAfterMs,
4553
- allowUploadingDocumentsFromStorage: allowUploadingDocumentsFromStorage
4554
- });
4555
- if (captureRequirement === 'idCardBack') newState.requestedDocumentType = 'idCardBack';
4556
- if (captureRequirement === 'passport') newState.requestedDocumentType = 'passport';
4557
- if (precapturedDocuments) {
4558
- for (var _i = 0, CapturedDocumentTypeValues_1 = CapturedDocumentTypeValues; _i < CapturedDocumentTypeValues_1.length; _i++) {
4559
- var k = CapturedDocumentTypeValues_1[_i];
4560
- var payload = precapturedDocuments[k];
4561
- if (payload) {
4562
- newState.requestedDocumentType = k;
4563
- newState = _reducer(newState, {
4564
- type: 'documentCaptured',
4565
- payload: payload
4566
- });
4567
- }
4568
- }
4569
- }
4570
- if (newState.captureState === 'initializing' && !allowUploadingDocumentsFromStorage) {
4571
- newState.captureState = 'capturing';
4572
- }
4573
- return newState;
4574
- }
4575
- case 'setRequiredDocumentType':
4576
- return _assign(_assign({}, state), {
4577
- requiredDocumentType: action.payload
4578
- });
4579
- case 'redrawRequested':
4580
- return _assign(_assign({}, state), {
4581
- redrawing: true,
4582
- guideRectX: 0,
4583
- guideRectY: 0,
4584
- guideRectWidth: 0,
4585
- guideRectHeight: 0,
4586
- guideRectOffsetTop: 0
4587
- });
4588
- case 'redrawInProgress':
4589
- return _assign(_assign({}, state), {
4590
- redrawing: false,
4591
- guideRectX: 0,
4592
- guideRectY: 0,
4593
- guideRectWidth: 0,
4594
- guideRectHeight: 0,
4595
- guideRectOffsetTop: 0
4596
- });
4597
- case 'redrawCompleted':
4598
- return _assign(_assign(_assign({}, state), action.payload), {
4599
- initialDrawComplete: true
4600
- });
4601
- case 'pageRendered':
4602
- return _assign(_assign({}, state), action.payload);
4603
- case 'guideImageLoaded':
4604
- return _assign(_assign({}, state), {
4605
- guideImageWidth: action.payload.width,
4606
- guideImageHeight: action.payload.height
4607
- });
4608
- case 'objectsDetected':
4609
- {
4610
- var _c = action.payload.prediction,
4611
- detectedObjects = _c.detectedObjects,
4612
- detectionThresholdMet = _c.detectionThresholdMet,
4613
- detectedDocumentType = _c.detectedDocumentType,
4614
- idCardFrontDetectionScore = _c.idCardFrontDetectionScore,
4615
- idCardFrontDetectionThresholdMet = _c.idCardFrontDetectionThresholdMet,
4616
- idCardBackDetectionScore = _c.idCardBackDetectionScore,
4617
- idCardBackDetectionThresholdMet = _c.idCardBackDetectionThresholdMet,
4618
- passportDetectionScore = _c.passportDetectionScore,
4619
- passportDetectionThresholdMet = _c.passportDetectionThresholdMet,
4620
- singlePageDetectionScore = _c.singlePageDetectionScore,
4621
- singlePageDetectionThresholdMet = _c.singlePageDetectionThresholdMet,
4622
- bestDocument = _c.bestDocument,
4623
- documentInBounds = _c.documentInBounds,
4624
- documentTooClose = _c.documentTooClose,
4625
- documentIsStable = _c.documentIsStable,
4626
- focusScore = _c.focusScore,
4627
- focusThresholdMet = _c.focusThresholdMet,
4628
- frameWidth = _c.frameWidth,
4629
- frameHeight = _c.frameHeight;
4630
- var frameCapturedAt = new Date();
4631
- var frameCaptureRate = 0;
4632
- var goodFramesThreshold = state.goodFramesThreshold;
4633
- if (state.lastFrameCapturedAt) {
4634
- var frameTime = frameCapturedAt.getTime() - state.lastFrameCapturedAt.getTime();
4635
- if (frameTime > 0) {
4636
- frameCaptureRate = 1000.0 / frameTime;
4637
- if (frameCaptureRate > 0) {
4638
- goodFramesThreshold = Math.ceil(3 * frameCaptureRate);
4639
- }
4640
- }
4641
- }
4642
- var idCardDetected = detectedDocumentType.includes('idCard') || detectedDocumentType === 'singlePage';
4643
- var idCardDetectedButNotAllowed = idCardDetected && !state.captureRequirement.includes('idCard');
4644
- var passportNotAllowed = !state.captureRequirement.toLowerCase().includes('passport');
4645
- var idCardFrontWasCaptured = 'idCardFront' in state.capturedDocuments;
4646
- var idCardBackWasCaptured = 'idCardBack' in state.capturedDocuments;
4647
- var idCardBeingCaptured = idCardFrontWasCaptured && !idCardBackWasCaptured || !idCardFrontWasCaptured && idCardBackWasCaptured;
4648
- var passportDetectedButNotAllowed = detectedDocumentType === 'passport' && (passportNotAllowed || idCardBeingCaptured);
4649
- var flipRequired = !state.overrideWrongDocumentTypeGuidance && (state.allowIdCardBackToFrontCapture ? idCardFrontWasCaptured && detectedDocumentType === 'idCardFront' : state.requestedDocumentType === 'idCardBack' && detectedDocumentType === 'idCardFront');
4650
- var backDetectedFirst = !state.overrideWrongDocumentTypeGuidance && (state.allowIdCardBackToFrontCapture ? idCardBackWasCaptured && detectedDocumentType === 'idCardBack' : state.requestedDocumentType === 'idCardFront' && detectedDocumentType === 'idCardBack');
4651
- var wrongDocumentTypePredictions = state.wrongDocumentTypePredictions;
4652
- if (state.captureState === 'capturing' && (flipRequired || backDetectedFirst)) {
4653
- wrongDocumentTypePredictions += 1;
4654
- }
4655
- var isGoodFrame = detectionThresholdMet && documentInBounds && !documentTooClose && !flipRequired && !backDetectedFirst && focusThresholdMet && !idCardDetectedButNotAllowed && !passportDetectedButNotAllowed && documentIsStable;
4656
- var captureStartedAt = state.captureStartedAt;
4657
- var goodFramesCount = state.goodFramesCount;
4658
- if (isGoodFrame) {
4659
- goodFramesCount += 1;
4660
- captureStartedAt || (captureStartedAt = new Date());
4661
- }
4662
- var goodFramesThresholdMet = goodFramesCount >= goodFramesThreshold;
4663
- var requestedDocumentType = state.requestedDocumentType;
4664
- if (state.captureRequirement.includes('idCard') && state.allowIdCardBackToFrontCapture) {
4665
- if (detectedDocumentType === 'idCardFront' && state.requestedDocumentType !== 'idCardFront' && !idCardFrontWasCaptured) {
4666
- requestedDocumentType = 'idCardFront';
4667
- } else if (detectedDocumentType === 'idCardBack' && state.requestedDocumentType !== 'idCardBack' && !idCardBackWasCaptured) {
4668
- requestedDocumentType = 'idCardBack';
4669
- }
4670
- }
4671
- if (state.captureRequirement === 'idCardOrPassport') {
4672
- if (detectedDocumentType === 'passport' && state.requestedDocumentType !== 'passport') {
4673
- requestedDocumentType = 'passport';
4674
- }
4675
- if (requestedDocumentType === 'passport' && passportDetectionScore < 0.3) {
4676
- requestedDocumentType = idCardFrontWasCaptured ? 'idCardBack' : 'idCardFront';
4677
- }
4678
- }
4679
- var hasBeenRunningForLongEnough = !!state.operationStartedAt && new Date().getTime() - state.operationStartedAt.getTime() > 1000;
4680
- var overrideFlipRequirementThreshold = Math.ceil(state.allowOverrideWrongDocumentTypeAfterMs / 1000 * frameCaptureRate);
4681
- var allowOverrideFlipRequirement = state.enableOverrideWrongDocumentTypeDialog && hasBeenRunningForLongEnough && !state.overrideWrongDocumentTypeGuidance && overrideFlipRequirementThreshold > 0 && (state.allowOverrideWrongDocumentTypeGuidance || wrongDocumentTypePredictions >= overrideFlipRequirementThreshold);
4682
- return _assign(_assign({}, state), {
4683
- videoWidth: frameWidth,
4684
- videoHeight: frameHeight,
4685
- detectedObjects: detectedObjects,
4686
- bestDocument: bestDocument,
4687
- requestedDocumentType: requestedDocumentType,
4688
- detectedDocumentType: detectedDocumentType,
4689
- detectionThresholdMet: detectionThresholdMet,
4690
- documentInBounds: documentInBounds,
4691
- documentTooClose: documentTooClose,
4692
- documentIsStable: documentIsStable,
4693
- flipRequired: flipRequired,
4694
- backDetectedFirst: backDetectedFirst,
4695
- idCardDetectedButNotAllowed: idCardDetectedButNotAllowed,
4696
- passportDetectedButNotAllowed: passportDetectedButNotAllowed,
4697
- allowOverrideWrongDocumentTypeGuidance: allowOverrideFlipRequirement,
4698
- wrongDocumentTypePredictions: wrongDocumentTypePredictions,
4699
- idCardFrontDetectionScore: idCardFrontDetectionScore,
4700
- idCardFrontDetectionThresholdMet: idCardFrontDetectionThresholdMet,
4701
- idCardBackDetectionScore: idCardBackDetectionScore,
4702
- idCardBackDetectionThresholdMet: idCardBackDetectionThresholdMet,
4703
- passportDetectionScore: passportDetectionScore,
4704
- passportDetectionThresholdMet: passportDetectionThresholdMet,
4705
- singlePageDetectionScore: singlePageDetectionScore,
4706
- singlePageDetectionThresholdMet: singlePageDetectionThresholdMet,
4707
- focusScore: focusScore,
4708
- focusThresholdMet: focusThresholdMet,
4709
- isGoodFrame: isGoodFrame,
4710
- goodFramesCount: goodFramesCount,
4711
- goodFramesThreshold: goodFramesThreshold,
4712
- goodFramesThresholdMet: goodFramesThresholdMet,
4713
- captureStartedAt: captureStartedAt,
4714
- lastFrameCapturedAt: frameCapturedAt,
4715
- frameCaptureRate: frameCaptureRate
4716
- });
4717
- }
4718
- case 'captureInitialized':
4719
- return _assign(_assign({}, state), {
4720
- captureState: 'capturing',
4721
- isUploadingDocumentsFromStorage: false
4722
- });
4723
- case 'captureStarted':
4724
- return _assign(_assign({}, state), {
4725
- operationStartedAt: new Date(),
4726
- captureStartedAt: null,
4727
- capturing: false,
4728
- captureFailed: false
4729
- });
4730
- case 'capturing':
4731
- return _assign(_assign({}, state), {
4732
- capturing: true,
4733
- captureFailed: false
4734
- });
4735
- case 'captured':
4736
- return _assign(_assign({}, state), {
4737
- capturing: false,
4738
- captureFailed: false
4739
- });
4740
- case 'frameCaptured':
4741
- return _assign(_assign({}, state), {
4742
- imageUrl: action.payload.imageUrl
4743
- });
4744
- case 'captureFailed':
4745
- return _assign(_assign({}, state), {
4746
- capturing: false,
4747
- captureFailed: true
4748
- });
4749
- case 'documentCaptured':
4750
- {
4751
- var newState = _assign(_assign({}, state), {
4752
- capturing: false,
4753
- captureFailed: false,
4754
- allowOverrideFlipRequirement: false,
4755
- overrideFlipRequirement: false,
4756
- goodFramesCount: 0,
4757
- wrongDocumentTypePredictions: 0,
4758
- capturedDocuments: _assign(_assign({}, state.capturedDocuments), (_a = {}, _a[action.payload.documentType] = action.payload, _a))
4759
- });
4760
- var remainingRequirements = remainingIdCaptureRequirements(state.captureRequirement, newState.capturedDocuments, state.requestedDocumentType);
4761
- if (remainingRequirements.length === 0) {
4762
- newState.captureState = 'complete';
4763
- } else {
4764
- newState.requestedDocumentType = remainingRequirements[0];
4765
- if (state.requestedDocumentType === 'idCardFront' && newState.requestedDocumentType === 'idCardBack' || state.requestedDocumentType === 'idCardBack' && newState.requestedDocumentType === 'idCardFront') {
4766
- if (!newState.isUploadingDocumentsFromStorage) {
4767
- newState.captureState = 'requestingFlip';
4768
- }
4769
- newState.idCardFrontDetectionThresholdMet = false;
4770
- newState.idCardBackDetectionThresholdMet = false;
4771
- newState.passportDetectionThresholdMet = false;
4772
- newState.wrongDocumentTypePredictions = 0;
4773
- }
4774
- }
4775
- return newState;
4776
- }
4777
- case 'documentCapturedManually':
4778
- return _reducer(state, {
4779
- type: 'documentCaptured',
4780
- payload: _assign(_assign({}, action.payload), {
4781
- documentType: state.requestedDocumentType,
4782
- width: 0,
4783
- height: 0
4784
- })
4785
- });
4786
- case 'documentsCaptured':
4787
- {
4788
- var newState = _assign({}, state);
4789
- for (var _d = 0, _e = action.payload; _d < _e.length; _d++) {
4790
- var doc = _e[_d];
4791
- newState = _reducer(newState, {
4792
- type: 'documentCaptured',
4793
- payload: doc
4794
- });
4795
- }
4796
- return newState;
4797
- }
4798
- case 'flipRequestCompleted':
4799
- return _assign(_assign({}, state), {
4800
- captureState: 'capturing',
4801
- allowOverrideWrongDocumentTypeGuidance: false,
4802
- overrideWrongDocumentTypeGuidance: false,
4803
- wrongDocumentTypePredictions: 0
4804
- });
4805
- case 'allowOverrideFlipRequirement':
4806
- return _assign(_assign({}, state), {
4807
- allowOverrideWrongDocumentTypeGuidance: true
4808
- });
4809
- case 'overrideFlipRequirement':
4810
- return _assign(_assign({}, state), {
4811
- allowOverrideWrongDocumentTypeGuidance: false,
4812
- overrideWrongDocumentTypeGuidance: true
4813
- });
4814
- case 'setUploadingDocumentsFromStorage':
4815
- return _assign(_assign({}, state), {
4816
- isUploadingDocumentsFromStorage: action.payload,
4817
- captureState: action.payload ? 'initializing' : 'capturing'
4818
- });
4819
- case 'setUploadingDocumentsType':
4820
- {
4821
- var requestedDocumentType = !action.payload || action.payload === 'idCard' ? 'idCardFront' : action.payload;
4822
- var uploadingDocumentsType = action.payload === 'singlePage' ? 'idCard' : action.payload;
4823
- return _assign(_assign({}, state), {
4824
- captureState: action.payload ? 'uploading' : 'initializing',
4825
- uploadingDocumentsType: uploadingDocumentsType,
4826
- requestedDocumentType: requestedDocumentType
4827
- });
4828
- }
4829
- case 'resetWizard':
4830
- return _assign(_assign({}, initialState$4), {
4831
- dispatch: state.dispatch,
4832
- allowUploadingDocumentsFromStorage: state.allowUploadingDocumentsFromStorage,
4833
- captureState: state.allowUploadingDocumentsFromStorage ? 'initializing' : 'capturing',
4834
- captureRequirement: state.captureRequirement,
4835
- allowIdCardBackToFrontCapture: state.allowIdCardBackToFrontCapture
4836
- });
4837
- default:
4838
- return state;
4839
- }
4840
- };
4841
- var useIdCaptureStore = zustand.create()(middleware.devtools(function (set) {
4842
- return _assign(_assign({}, initialState$4), {
4843
- dispatch: function dispatch(action) {
4844
- return set(function (state) {
4845
- return _reducer(state, action);
4846
- }, undefined, action);
4847
- }
4848
- });
4849
- }));
4850
- function IdCaptureStateProvider(_a) {
4851
- var children = _a.children;
4852
- var overrideWrongDocumentTypeGuidance = useIdCaptureStore(shallow.useShallow(function (state) {
4853
- return state.overrideWrongDocumentTypeGuidance;
4854
- }));
4855
- var setRequiredDocumentType = React.useContext(IdCaptureModelsContext).setRequiredDocumentType;
4856
- React.useEffect(function () {
4857
- if (overrideWrongDocumentTypeGuidance) setRequiredDocumentType('none');
4858
- }, [overrideWrongDocumentTypeGuidance, setRequiredDocumentType]);
4859
- var onResize = useDebounce.useDebouncedCallback(function () {
4860
- dispatchIdCaptureAction({
4861
- type: 'redrawRequested'
4862
- });
4863
- }, 500);
4864
- React.useLayoutEffect(function () {
4865
- if (typeof window === 'undefined') return;
4866
- window.addEventListener('resize', onResize);
4867
- return function () {
4868
- return window.removeEventListener('resize', onResize);
4869
- };
4870
- }, [onResize]);
4871
- React.useEffect(function resetWhenProviderUnmounts() {
4872
- return function () {
4873
- return useIdCaptureStore.getState().dispatch({
4874
- type: 'resetWizard'
4875
- });
4876
- };
4877
- }, []);
4878
- return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, children);
4879
- }
4880
- var dispatchIdCaptureAction = function dispatchIdCaptureAction(action) {
4881
- return useIdCaptureStore.getState().dispatch(action);
4882
- };
4883
-
4884
- function DebugStatsPane(_a) {
4885
- var children = _a.children;
4886
- var element = /*#__PURE__*/React__namespace.default.createElement(DebugStatsPaneDiv, null, children);
4887
- var portalLocation = document.getElementById('idmission-above-guides-content');
4888
- if (!portalLocation) return element;
4889
- return /*#__PURE__*/reactDom.createPortal(element, portalLocation);
4890
- }
4891
- var DebugStatsPaneDiv = styled__default.default.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"])));
4892
- var ObjectDetectionDebugOverlayDiv = styled__default.default.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) {
4893
- var $flipX = _a.$flipX;
4894
- return $flipX ? 'transform: scaleX(-1);' : '';
4895
- });
4896
- var ObjectDetectionDebugBox = styled__default.default.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) {
4897
- var $color = _a.$color;
4898
- return $color !== null && $color !== void 0 ? $color : 'green';
4899
- }, function (_a) {
4900
- var $color = _a.$color;
4901
- return $color !== null && $color !== void 0 ? $color : 'green';
4902
- }, function (_a) {
4903
- var $flipX = _a.$flipX;
4904
- return $flipX ? 'transform: scaleX(-1);' : '';
4905
- });
4906
- var FaceDetectionKeypointMarker = styled__default.default.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) {
4907
- var $color = _a.$color;
4908
- return $color !== null && $color !== void 0 ? $color : 'red';
4909
- }, function (_a) {
4910
- var $color = _a.$color;
4911
- return $color !== null && $color !== void 0 ? $color : 'red';
4912
- }, function (_a) {
4913
- var $flipX = _a.$flipX;
4914
- return $flipX ? 'transform: scaleX(-1);' : '';
4915
- });
4916
- function useDebugScalingDetails(_a) {
4917
- var _b = _a.enabled,
4918
- enabled = _b === void 0 ? true : _b,
4919
- pageWidth = _a.pageWidth,
4920
- pageHeight = _a.pageHeight,
4921
- videoWidth = _a.videoWidth,
4922
- videoHeight = _a.videoHeight;
4923
- return React.useMemo(function () {
4924
- var horizontal = false,
4925
- scaledWidth = 0,
4926
- scaledHeight = 0,
4927
- xOffset = 0,
4928
- yOffset = 0;
4929
- if (enabled) {
4930
- horizontal = pageWidth / pageHeight < videoWidth / videoHeight;
4931
- if (horizontal) {
4932
- scaledWidth = videoWidth * (pageHeight / videoHeight);
4933
- xOffset = (scaledWidth - pageWidth) / 2;
4934
- } else {
4935
- scaledHeight = videoHeight * (pageWidth / videoWidth);
4936
- yOffset = (scaledHeight - pageHeight) / 2;
4937
- }
4938
- }
4939
- return {
4940
- horizontal: horizontal,
4941
- pageWidth: pageWidth,
4942
- pageHeight: pageHeight,
4943
- videoWidth: videoWidth,
4944
- videoHeight: videoHeight,
4945
- scaledWidth: scaledWidth,
4946
- scaledHeight: scaledHeight,
4947
- xOffset: xOffset,
4948
- yOffset: yOffset
4949
- };
4950
- }, [enabled, pageHeight, pageWidth, videoHeight, videoWidth]);
4951
- }
4952
- var DebugBoundingBoxOverlay = function DebugBoundingBoxOverlay(_a) {
4953
- var scaling = _a.scaling,
4954
- $flipX = _a.$flipX,
4955
- children = _a.children;
4956
- var _b = useIdCaptureStore(),
4957
- guideRectWidth = _b.guideRectWidth,
4958
- guideRectHeight = _b.guideRectHeight,
4959
- guideRectX = _b.guideRectX,
4960
- guideRectY = _b.guideRectY;
4961
- return /*#__PURE__*/React__namespace.default.createElement(ObjectDetectionDebugOverlayDiv, {
4962
- id: "debug-overlay-div",
4963
- "$flipX": $flipX,
4964
- style: {
4965
- top: guideRectY,
4966
- left: guideRectX,
4967
- width: guideRectWidth || (scaling === null || scaling === void 0 ? void 0 : scaling.pageWidth),
4968
- height: guideRectHeight || (scaling === null || scaling === void 0 ? void 0 : scaling.pageHeight)
4969
- }
4970
- }, children);
4971
- };
4972
- function IdCaptureDetectedObjectDebugBox(_a) {
4973
- var obj = _a.obj,
4974
- flipX = _a.flipX,
4975
- _b = _a.color,
4976
- color = _b === void 0 ? 'green' : _b,
4977
- scaling = _a.scaling;
4978
- var horizontal = scaling.horizontal,
4979
- pageWidth = scaling.pageWidth,
4980
- pageHeight = scaling.pageHeight,
4981
- videoWidth = scaling.videoWidth,
4982
- videoHeight = scaling.videoHeight,
4983
- scaledWidth = scaling.scaledWidth,
4984
- scaledHeight = scaling.scaledHeight,
4985
- xOffset = scaling.xOffset,
4986
- yOffset = scaling.yOffset;
4987
- if (!videoWidth || !videoHeight || !pageWidth || !pageHeight) return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null);
4988
- var top;
4989
- var left;
4990
- var width;
4991
- var height;
4992
- if (horizontal) {
4993
- top = obj.box.yMin / videoHeight * pageHeight;
4994
- left = obj.box.xMin / videoWidth * scaledWidth - xOffset;
4995
- width = obj.box.width / videoWidth * scaledWidth;
4996
- height = obj.box.height / videoHeight * pageHeight;
4997
- } else {
4998
- top = obj.box.yMin / videoHeight * scaledHeight - yOffset;
4999
- left = obj.box.xMin / videoWidth * pageWidth;
5000
- width = obj.box.width / videoWidth * pageWidth;
5001
- height = obj.box.height / videoHeight * scaledHeight;
5002
- }
5003
- return /*#__PURE__*/React__namespace.default.createElement(ObjectDetectionDebugBox, {
5004
- "$flipX": flipX,
5005
- "$color": color,
5006
- style: {
5007
- top: top,
5008
- left: left,
5009
- width: width,
5010
- height: height
5011
- }
5012
- });
5013
- }
5014
- function SelfieCaptureFaceDebugBox(_a) {
5015
- var face = _a.face,
5016
- flipX = _a.flipX,
5017
- _b = _a.color,
5018
- color = _b === void 0 ? 'green' : _b,
5019
- scaling = _a.scaling;
5020
- var horizontal = scaling.horizontal,
5021
- pageWidth = scaling.pageWidth,
5022
- pageHeight = scaling.pageHeight,
5023
- videoWidth = scaling.videoWidth,
5024
- videoHeight = scaling.videoHeight,
5025
- scaledWidth = scaling.scaledWidth,
5026
- scaledHeight = scaling.scaledHeight,
5027
- xOffset = scaling.xOffset,
5028
- yOffset = scaling.yOffset;
5029
- if (!videoWidth || !videoHeight || !pageWidth || !pageHeight) return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null);
5030
- var top;
5031
- var left;
5032
- var width;
5033
- var height;
5034
- if (horizontal) {
5035
- top = face.box.yMin / videoHeight * pageHeight;
5036
- left = face.box.xMin / videoWidth * scaledWidth - xOffset;
5037
- width = face.box.width / videoWidth * scaledWidth;
5038
- height = face.box.height / videoHeight * pageHeight;
5039
- } else {
5040
- top = face.box.yMin / videoHeight * scaledHeight - yOffset;
5041
- left = face.box.xMin / videoWidth * pageWidth;
5042
- width = face.box.width / videoWidth * pageWidth;
5043
- height = face.box.height / videoHeight * scaledHeight;
5044
- }
5045
- return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, /*#__PURE__*/React__namespace.default.createElement(ObjectDetectionDebugBox, {
5046
- "$flipX": flipX,
5047
- "$color": color,
5048
- style: {
5049
- top: top,
5050
- left: left,
5051
- width: width,
5052
- height: height
5053
- }
5054
- }), face.keypoints.map(function (point, ii) {
5055
- return /*#__PURE__*/React__namespace.default.createElement(SelfieCaptureFaceKeypoint, {
5056
- key: ii,
5057
- point: point,
5058
- scaling: scaling,
5059
- flipX: flipX
5060
- });
5061
- }));
5062
- }
5063
- function SelfieCaptureFaceKeypoint(_a) {
5064
- var point = _a.point,
5065
- flipX = _a.flipX,
5066
- _b = _a.color,
5067
- color = _b === void 0 ? 'red' : _b,
5068
- _c = _a.scaling,
5069
- horizontal = _c.horizontal,
5070
- pageWidth = _c.pageWidth,
5071
- pageHeight = _c.pageHeight,
5072
- videoWidth = _c.videoWidth,
5073
- videoHeight = _c.videoHeight,
5074
- scaledWidth = _c.scaledWidth,
5075
- scaledHeight = _c.scaledHeight,
5076
- xOffset = _c.xOffset,
5077
- yOffset = _c.yOffset;
5078
- var left, top;
5079
- if (horizontal) {
5080
- left = point.x / videoWidth * scaledWidth - xOffset;
5081
- top = point.y / videoHeight * pageHeight;
5082
- } else {
5083
- left = point.x / videoWidth * pageWidth;
5084
- top = point.y / videoHeight * scaledHeight - yOffset;
5085
- }
5086
- top -= 2;
5087
- left -= 2;
5088
- return /*#__PURE__*/React__namespace.default.createElement(FaceDetectionKeypointMarker, {
5089
- "$flipX": flipX,
5090
- "$color": color,
5091
- style: {
5092
- top: top,
5093
- left: left
5094
- }
5095
- });
5096
- }
5097
- var templateObject_1$G, templateObject_2$z, templateObject_3$q, templateObject_4$k;
5098
-
5099
- var en = {};
5100
-
5101
- var es = {
5102
- 'English - en': 'Spanish - es',
5103
- 'Use your device camera to capture your ID': 'Hay que utilizar la cámara del dispositivo para capturar la identificación',
5104
- 'Use your iPhone as a webcam': 'Hay que usar el iPhone como cámara web',
5105
- 'Models warming up...': 'Preparando modelos...',
5106
- 'Camera initializing...': 'Inicializando la cámara...',
5107
- 'Camera access blocked': 'Acceso bloqueado a la cámara',
5108
- 'Location access blocked': 'Acceso bloqueado a la localización',
5109
- Continue: 'Continuar',
5110
- 'Processing...': 'Procesando…',
5111
- 'Your camera permission is disabled': 'El permiso de la cámara está desactivado',
5112
- '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.',
5113
- 'Your microphone permission is disabled': 'El permiso del micrófono está desactivado',
5114
- '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.',
5115
- 'Your location permission is disabled': 'El permiso de la localización está desactivado',
5116
- '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.',
5117
- Retry: 'Reintentar',
5118
- 'Scan the front of ID': 'Escanear el frente de la ID',
5119
- 'Scan the back of ID': 'Escanear el reverso de la ID',
5120
- 'Scan the ID page of passport': 'Escanear la página de identificación del pasaporte',
5121
- 'ID Card Front': 'Frente de la identificación',
5122
- 'ID Card Back': 'Reverso de la identificación',
5123
- Passport: 'Pasaporte',
5124
- 'Document not detected': 'No se ha detectado el documento',
5125
- 'Document is not centered': 'Documento no centrado',
5126
- 'Document too close please back up': 'Documento muy cerca, favor de alejarse',
5127
- 'Please hold your ID document steady': 'Por favor, hay que mantener firme su identificación',
5128
- 'Document out of focus – try improving the lighting': 'Documento no enfocado, hay que tratar de mejorar la iluminación',
5129
- 'ID card front detected - please flip your ID card': 'Frente de la ID detectado, por favor hay que voltearla',
5130
- 'ID card back detected - please flip your ID card': 'Reverso de la ID detectado, por favor hay que voltearla',
5131
- 'ID card detected please scan a passport instead': 'Se ha detectado una credencial, por favor hay que escanear un pasaporte',
5132
- 'Passport detected please scan an ID card instead': 'Se ha detectado un pasaporte, por favor hay que escanear una credencial',
5133
- 'Document detected, hold still...': 'Se ha detectado el documento, no moverse por favor...',
5134
- 'ID card front detected, hold still...': 'Frente de la ID detectado, no moverse...',
5135
- 'ID card back detected, hold still...': 'Reverso de la ID detectado, no moverse...',
5136
- 'Passport detected, hold still...': 'Pasaporte detectado, no moverse...',
5137
- 'Capturing...': 'Capturando...',
5138
- 'Capture failed!': '¡Error de captura!',
5139
- 'Please flip your ID card...': 'Por favor, hay que voltear la identificación...',
5140
- 'ID card front captured.': 'Se ha capturado el frente de la ID',
5141
- 'ID card back captured.': 'Se ha capturado el reverso de la ID',
5142
- 'ID Capture Successful': 'La captura de la identificación se ha realizado correctamente',
5143
- '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.',
5144
- Submit: 'Enviar',
5145
- 'Submitting...': 'Enviando...',
5146
- 'Use your device camera to capture your face': 'Hay que utilizar la cámara del dispositivo para capturar el rostro',
5147
- 'Remove Sunglasses & Hat': 'Hay que quitarse los lentes y la gorra',
5148
- 'Avoid Excessive Backlighting': 'Hay que evitar tanta luz por detrás',
5149
- 'Hold still for a few seconds...': 'Hay que quedarse quieto unos segundos...',
5150
- 'Please hold still...': 'Favor de no moverse...',
5151
- 'Look straight into the camera...': 'Hay que mirar directamente a la cámara...',
5152
- 'Move back...': 'Hay que moverse hacia atrás...',
5153
- 'Move forward...': 'Hay que moverse hacia adelante...',
5154
- 'Move to the center...': 'Hay que moverse hacia el centro...',
5155
- 'Waiting for face to be detected...': 'Esperando que se detecte la cara...',
5156
- 'Please remove your eye coverings (sunglasses eye patch etc.)...': 'Hay que quitarse lo que cubre los ojos (lentes, parche, etc.)...',
5157
- 'Please remove your head coverings (hat scarf etc.)...': 'Hay que quitarse lo que cubre la cabeza (gorra, mascada, etc.)...',
5158
- 'Please remove your mask...': 'Hay que quitarse el cubrebocas...',
5159
- 'Live face not detected, please try again': 'Rostro vivo no detectado. Por favor, hay que intentar de nuevo.',
5160
- Exit: 'Salir',
5161
- 'Face liveness has been verified!': 'Se ha verificado la prueba de vida.',
5162
- Done: 'Terminar',
5163
- 'Could not verify your face.': 'No se pudo verificar el rostro.',
5164
- 'An error occurred while verifying your face.': 'Se ha producido un error al verificar el rostro.',
5165
- 'Customer has been identified!': '¡Se ha identificado al cliente!',
5166
- 'Customer not found': 'Cliente no encontrado',
5167
- 'Additional document capture': 'Captura adicional de documentos',
5168
- Next: 'Siguiente',
5169
- 'Please sign the box below': 'Hay que firmar en el siguiente cuadro',
5170
- Accept: 'Aceptar',
5171
- Clear: 'Borrar',
5172
- 'Video signature has been successfully captured!': 'La video firma se ha capturado correctamente.',
5173
- 'Network unreachable': 'No hay conexión a internet.',
5174
- "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.`',
5175
- "We're sorry an unexpected error has occurred.": '`Lo sentimos, se ha producido un error inesperado.`',
5176
- 'Document Capture': 'Captura de documento',
5177
- Capture: 'Capturar',
5178
- 'Retry capture': 'Reintentar la captura',
5179
- Upload: 'Enviar',
5180
- 'Uploading...': 'Procesando...',
5181
- 'Upload succeeded!': '¡Proceso completo!',
5182
- 'Performing facial recognition, please hold still...': 'Realizando el reconocimiento facial, por favor no hay que moverse',
5183
- 'Display the front of your ID card...': 'Hay que mostrar el frente de la ID...',
5184
- 'Display the back of your ID card...': 'Hay que mostrar el reverso de la ID...',
5185
- 'Display the ID page of your passport...': 'Hay que mostrar la página de datos del pasaporte...',
5186
- 'Please move your face to the center...': 'Por favor, hay que mover la cabeza hacia el centro...',
5187
- 'Searching for ID card...': 'Localizando la identificación...',
5188
- 'Please read the following text aloud': 'Hay que leer el siguiente texto en voz alta',
5189
- 'Video ID has been successfully captured!': '¡Video ID capturado exitosamente!',
5190
- 'ID Front Image': 'Frente de la ID',
5191
- 'ID Back Image': 'Reverso de la ID',
5192
- "We're having some trouble.": 'Se ha presentado un problema.',
5193
- '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.',
5194
- 'Verifying...': 'Verificando....',
5195
- 'Please capture the front of your ID card.': 'Hay que capturar el frente de la identificación.',
5196
- 'Please capture the back of your ID card.': 'Hay que capturar el reverso de la identificación.',
5197
- '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.',
5198
- '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.',
5199
- 'Please capture the ID page of your passport.': 'Hay que capturar la página de datos del pasaporte.',
5200
- '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.',
5201
- '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.',
5202
- '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.',
5203
- '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.',
5204
- 'Capture ID page of passport': 'Captura pasaporte (página de la foto)',
5205
- 'Capture back of ID card': 'Captura del reverso',
5206
- 'Downloading...': 'Descargando...',
5207
- 'Accessing camera...': 'Accediendo a la cámara',
5208
- 'Camera ready': 'Cámara lista',
5209
- 'Loading guided capture experience...': 'Cargando la experiencia guiada para la captura....',
5210
- 'Guided capture experience ready': 'Experiencia guiada lista',
5211
- "Let's Go!": '¡Vamos!',
5212
- '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?',
5213
- OK: 'Sí',
5214
- 'Capture with Camera': 'Capturar con la cámara',
5215
- OR: 'O',
5216
- 'Upload from Storage': 'Adjuntar del almacenamiento',
5217
- 'Select ID Type': 'Seleccionar el tipo de ID',
5218
- 'ID Card': 'Identificación',
5219
- 'Upload Passport': 'Adjuntar pasaporte',
5220
- 'Upload ID Front': 'Adjuntar el frente de la ID',
5221
- 'Upload ID Back': 'Adjuntar el reverso de la ID',
5222
- Cancel: 'Cancelar',
5223
- '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'
3537
+ var en = {};
3538
+
3539
+ var es = {
3540
+ 'English - en': 'Spanish - es',
3541
+ 'Use your device camera to capture your ID': 'Hay que utilizar la cámara del dispositivo para capturar la identificación',
3542
+ 'Use your iPhone as a webcam': 'Hay que usar el iPhone como cámara web',
3543
+ 'Models warming up...': 'Preparando modelos...',
3544
+ 'Camera initializing...': 'Inicializando la cámara...',
3545
+ 'Camera access blocked': 'Acceso bloqueado a la cámara',
3546
+ 'Location access blocked': 'Acceso bloqueado a la localización',
3547
+ Continue: 'Continuar',
3548
+ 'Processing...': 'Procesando…',
3549
+ 'Your camera permission is disabled': 'El permiso de la cámara está desactivado',
3550
+ '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.',
3551
+ 'Your microphone permission is disabled': 'El permiso del micrófono está desactivado',
3552
+ '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.',
3553
+ 'Your location permission is disabled': 'El permiso de la localización está desactivado',
3554
+ '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.',
3555
+ Retry: 'Reintentar',
3556
+ 'Scan the front of ID': 'Escanear el frente de la ID',
3557
+ 'Scan the back of ID': 'Escanear el reverso de la ID',
3558
+ 'Scan the ID page of passport': 'Escanear la página de identificación del pasaporte',
3559
+ 'ID Card Front': 'Frente de la identificación',
3560
+ 'ID Card Back': 'Reverso de la identificación',
3561
+ Passport: 'Pasaporte',
3562
+ 'Document not detected': 'No se ha detectado el documento',
3563
+ 'Document is not centered': 'Documento no centrado',
3564
+ 'Document too close please back up': 'Documento muy cerca, favor de alejarse',
3565
+ 'Please hold your ID document steady': 'Por favor, hay que mantener firme su identificación',
3566
+ 'Document out of focus try improving the lighting': 'Documento no enfocado, hay que tratar de mejorar la iluminación',
3567
+ 'ID card front detected - please flip your ID card': 'Frente de la ID detectado, por favor hay que voltearla',
3568
+ 'ID card back detected - please flip your ID card': 'Reverso de la ID detectado, por favor hay que voltearla',
3569
+ 'ID card detected please scan a passport instead': 'Se ha detectado una credencial, por favor hay que escanear un pasaporte',
3570
+ 'Passport detected please scan an ID card instead': 'Se ha detectado un pasaporte, por favor hay que escanear una credencial',
3571
+ 'Document detected, hold still...': 'Se ha detectado el documento, no moverse por favor...',
3572
+ 'ID card front detected, hold still...': 'Frente de la ID detectado, no moverse...',
3573
+ 'ID card back detected, hold still...': 'Reverso de la ID detectado, no moverse...',
3574
+ 'Passport detected, hold still...': 'Pasaporte detectado, no moverse...',
3575
+ 'Capturing...': 'Capturando...',
3576
+ 'Capture failed!': '¡Error de captura!',
3577
+ 'Please flip your ID card...': 'Por favor, hay que voltear la identificación...',
3578
+ 'ID card front captured.': 'Se ha capturado el frente de la ID',
3579
+ 'ID card back captured.': 'Se ha capturado el reverso de la ID',
3580
+ 'ID Capture Successful': 'La captura de la identificación se ha realizado correctamente',
3581
+ '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.',
3582
+ Submit: 'Enviar',
3583
+ 'Submitting...': 'Enviando...',
3584
+ 'Use your device camera to capture your face': 'Hay que utilizar la cámara del dispositivo para capturar el rostro',
3585
+ 'Remove Sunglasses & Hat': 'Hay que quitarse los lentes y la gorra',
3586
+ 'Avoid Excessive Backlighting': 'Hay que evitar tanta luz por detrás',
3587
+ 'Hold still for a few seconds...': 'Hay que quedarse quieto unos segundos...',
3588
+ 'Please hold still...': 'Favor de no moverse...',
3589
+ 'Look straight into the camera...': 'Hay que mirar directamente a la cámara...',
3590
+ 'Move back...': 'Hay que moverse hacia atrás...',
3591
+ 'Move forward...': 'Hay que moverse hacia adelante...',
3592
+ 'Move to the center...': 'Hay que moverse hacia el centro...',
3593
+ 'Waiting for face to be detected...': 'Esperando que se detecte la cara...',
3594
+ 'Please remove your eye coverings (sunglasses eye patch etc.)...': 'Hay que quitarse lo que cubre los ojos (lentes, parche, etc.)...',
3595
+ 'Please remove your head coverings (hat scarf etc.)...': 'Hay que quitarse lo que cubre la cabeza (gorra, mascada, etc.)...',
3596
+ 'Please remove your mask...': 'Hay que quitarse el cubrebocas...',
3597
+ 'Live face not detected, please try again': 'Rostro vivo no detectado. Por favor, hay que intentar de nuevo.',
3598
+ Exit: 'Salir',
3599
+ 'Face liveness has been verified!': 'Se ha verificado la prueba de vida.',
3600
+ Done: 'Terminar',
3601
+ 'Could not verify your face.': 'No se pudo verificar el rostro.',
3602
+ 'An error occurred while verifying your face.': 'Se ha producido un error al verificar el rostro.',
3603
+ 'Customer has been identified!': '¡Se ha identificado al cliente!',
3604
+ 'Customer not found': 'Cliente no encontrado',
3605
+ 'Additional document capture': 'Captura adicional de documentos',
3606
+ Next: 'Siguiente',
3607
+ 'Please sign the box below': 'Hay que firmar en el siguiente cuadro',
3608
+ Accept: 'Aceptar',
3609
+ Clear: 'Borrar',
3610
+ 'Video signature has been successfully captured!': 'La video firma se ha capturado correctamente.',
3611
+ 'Network unreachable': 'No hay conexión a internet.',
3612
+ "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.`',
3613
+ "We're sorry an unexpected error has occurred.": '`Lo sentimos, se ha producido un error inesperado.`',
3614
+ 'Document Capture': 'Captura de documento',
3615
+ Capture: 'Capturar',
3616
+ 'Retry capture': 'Reintentar la captura',
3617
+ Upload: 'Enviar',
3618
+ 'Uploading...': 'Procesando...',
3619
+ 'Upload succeeded!': '¡Proceso completo!',
3620
+ 'Performing facial recognition, please hold still...': 'Realizando el reconocimiento facial, por favor no hay que moverse',
3621
+ 'Display the front of your ID card...': 'Hay que mostrar el frente de la ID...',
3622
+ 'Display the back of your ID card...': 'Hay que mostrar el reverso de la ID...',
3623
+ 'Display the ID page of your passport...': 'Hay que mostrar la página de datos del pasaporte...',
3624
+ 'Please move your face to the center...': 'Por favor, hay que mover la cabeza hacia el centro...',
3625
+ 'Searching for ID card...': 'Localizando la identificación...',
3626
+ 'Please read the following text aloud': 'Hay que leer el siguiente texto en voz alta',
3627
+ 'Video ID has been successfully captured!': '¡Video ID capturado exitosamente!',
3628
+ 'ID Front Image': 'Frente de la ID',
3629
+ 'ID Back Image': 'Reverso de la ID',
3630
+ "We're having some trouble.": 'Se ha presentado un problema.',
3631
+ '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.',
3632
+ 'Verifying...': 'Verificando....',
3633
+ 'Please capture the front of your ID card.': 'Hay que capturar el frente de la identificación.',
3634
+ 'Please capture the back of your ID card.': 'Hay que capturar el reverso de la identificación.',
3635
+ '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.',
3636
+ '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.',
3637
+ 'Please capture the ID page of your passport.': 'Hay que capturar la página de datos del pasaporte.',
3638
+ '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.',
3639
+ '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.',
3640
+ '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.',
3641
+ '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.',
3642
+ 'Capture ID page of passport': 'Captura pasaporte (página de la foto)',
3643
+ 'Capture back of ID card': 'Captura del reverso',
3644
+ 'Downloading...': 'Descargando...',
3645
+ 'Accessing camera...': 'Accediendo a la cámara',
3646
+ 'Camera ready': 'Cámara lista',
3647
+ 'Loading guided capture experience...': 'Cargando la experiencia guiada para la captura....',
3648
+ 'Guided capture experience ready': 'Experiencia guiada lista',
3649
+ "Let's Go!": '¡Vamos!',
3650
+ '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?',
3651
+ OK: 'Sí',
3652
+ 'Capture with Camera': 'Capturar con la cámara',
3653
+ OR: 'O',
3654
+ 'Upload from Storage': 'Adjuntar del almacenamiento',
3655
+ 'Select ID Type': 'Seleccionar el tipo de ID',
3656
+ 'ID Card': 'Identificación',
3657
+ 'Upload Passport': 'Adjuntar pasaporte',
3658
+ 'Upload ID Front': 'Adjuntar el frente de la ID',
3659
+ 'Upload ID Back': 'Adjuntar el reverso de la ID',
3660
+ Cancel: 'Cancelar',
3661
+ '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',
3662
+ 'Camera tampering detected': 'Se ha detectado un intento de manipulación de la cámara',
3663
+ "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.'
5224
3664
  };
5225
3665
 
5226
3666
  var de = {
@@ -5973,212 +4413,1821 @@ var ru = {
5973
4413
  'Upload the back of the ID if it is not included in the front image.': 'Загрузите заднюю сторону удостоверения, если она не включена в изображение передней стороны.\r\n'
5974
4414
  };
5975
4415
 
5976
- var zh = {
5977
- 'English - en': 'Chinese (Traditional) - zh',
5978
- 'Use your device camera to capture your ID': '使用裝置相機拍攝證件',
5979
- 'Use your iPhone as a webcam': '將 iPhone 當作網路攝影機使用',
5980
- 'Models warming up...': '正在暖機...',
5981
- 'Camera initializing...': '相機正在初始化...',
5982
- 'Camera access blocked': '相機存取遭封鎖',
5983
- 'Location access blocked': '位置存取遭封鎖',
5984
- Continue: '繼續',
5985
- 'Processing...': '正在處理...',
5986
- 'Your camera permission is disabled': '已停用相機權限',
5987
- '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.': '此應用程式需要存取相機才能繼續。瀏覽器提示後,請接受權限。如果瀏覽器未提示相機權限,必須前往設定並為目前瀏覽器提供相機存取權限。',
5988
- 'Your microphone permission is disabled': '已停用麥克風權限',
5989
- '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.': '此應用程式需要存取麥克風才能繼續。瀏覽器提示後,請接受權限。如果瀏覽器未提示麥克風權限,必須前往設定並為目前瀏覽器提供麥克風存取權限。',
5990
- 'Your location permission is disabled': '已停用位置權限',
5991
- '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.': '此應用程式需要存取位置才能繼續。瀏覽器提示後,請接受權限。如果瀏覽器未提示位置權限,必須前往設定並為目前瀏覽器提供位置存取權限。',
5992
- Retry: '重試',
5993
- 'Scan the front of ID': '掃描證件正面',
5994
- 'Scan the back of ID': '掃描證件背面',
5995
- 'Scan the ID page of passport': '掃描護照的 ID 頁面',
5996
- 'ID Card Front': '證件正面',
5997
- 'ID Card Back': '證件背面',
5998
- Passport: '護照',
5999
- 'Document not detected': '未偵測到文件',
6000
- 'Document is not centered': '文件未置中',
6001
- 'Document too close please back up': '文件太近,請後退',
6002
- 'Please hold your ID document steady': '請拿穩證件',
6003
- 'Document out of focus – try improving the lighting': '文件失焦 – 請嘗試改善燈光',
6004
- 'ID card front detected - please flip your ID card': '偵測到證件正面 - 請將證件翻面',
6005
- 'ID card back detected - please flip your ID card': '偵測到證件背面 - 請將證件翻面',
6006
- 'ID card detected please scan a passport instead': '偵測到證件,請掃描護照',
6007
- 'Passport detected please scan an ID card instead': '偵測到護照,請掃描證件',
6008
- 'Document detected, hold still...': '偵測到的文件保持不動...',
6009
- 'ID card front detected, hold still...': '偵測到的證件正面保持不動...',
6010
- 'ID card back detected, hold still...': '偵測到的證件背面保持不動...',
6011
- 'Passport detected, hold still...': '偵測到的護照保持不動...',
6012
- 'Capturing...': '正在拍攝...',
6013
- 'Capture failed!': '拍攝失敗!',
6014
- 'Please flip your ID card...': '請將證件翻面...',
6015
- 'ID card front captured.': '已拍攝證件正面。',
6016
- 'ID card back captured.': '已拍攝證件背面。',
6017
- 'ID Capture Successful': '證件拍攝成功',
6018
- 'Verify the entire ID was captured clearly with no glare.': '確認是否清楚拍攝整個證件,無眩光。',
6019
- Submit: '提交',
6020
- 'Submitting...': '正在提交...',
6021
- 'Use your device camera to capture your face': '使用裝置相機拍攝您的臉部',
6022
- 'Remove Sunglasses & Hat': '取下太陽眼鏡和帽子',
6023
- 'Avoid Excessive Backlighting': '避免過度背光',
6024
- 'Hold still for a few seconds...': '請保持不動幾秒...',
6025
- 'Please hold still...': '請保持不動...',
6026
- 'Look straight into the camera...': '請直視相機...',
6027
- 'Move back...': '請後退...',
6028
- 'Move forward...': '請前進...',
6029
- 'Move to the center...': '請移至中心...',
6030
- 'Waiting for face to be detected...': '正在等待臉部辨識...',
6031
- 'Please remove your eye coverings (sunglasses eye patch etc.)...': '請取下眼睛遮蓋物(太陽眼鏡、眼罩等)...',
6032
- 'Please remove your head coverings (hat scarf etc.)...': '請取下頭部遮蓋物(帽子、圍巾等)...',
6033
- 'Please remove your mask...': '請脫下口罩...',
6034
- 'Live face not detected, please try again': '未偵測到活體人臉,請再試一次',
6035
- Exit: '退出',
6036
- 'Face liveness has been verified!': '已驗證人臉活體!',
6037
- Done: '完成',
6038
- 'Could not verify your face.': '無法驗證您的臉部。',
6039
- 'An error occurred while verifying your face.': '驗證您的臉部時發生錯誤。',
6040
- 'Customer has been identified!': '已識別客戶!',
6041
- 'Customer not found': '找不到客戶',
6042
- 'Additional document capture': '其他文件拍攝',
6043
- Next: '下一步',
6044
- 'Please sign the box below': '請在下方的方框中簽名',
6045
- Accept: '接受',
6046
- Clear: '清除',
6047
- 'Video signature has been successfully captured!': '已成功拍攝影片簽名!',
6048
- 'Network unreachable': '網路無法連線',
6049
- "We're having trouble reaching our services please check your connection and try again.": '無法與服務連線,請檢查連線並再試一次。',
6050
- "We're sorry an unexpected error has occurred.": '很抱歉,發生非預期錯誤。',
6051
- 'Document Capture': '文件拍攝',
6052
- Capture: '拍攝',
6053
- 'Retry capture': '重試拍攝',
6054
- Upload: '上傳',
6055
- 'Uploading...': '正在上傳...',
6056
- 'Upload succeeded!': '上傳成功!',
6057
- 'Performing facial recognition, please hold still...': '正在進行臉部辨識,請保持不動...',
6058
- 'Display the front of your ID card...': '出示證件正面...',
6059
- 'Display the back of your ID card...': '出示證件背面...',
6060
- 'Display the ID page of your passport...': '出示護照的 ID 頁面...',
6061
- 'Please move your face to the center...': '請將臉部移至中心...',
6062
- 'Searching for ID card...': '正在搜尋證件...',
6063
- 'Please read the following text aloud': '請大聲讀出以下文字',
6064
- 'Video ID has been successfully captured!': '已成功拍攝影片 ID!',
6065
- 'ID Front Image': '證件正面影像',
6066
- 'ID Back Image': '證件背面影像',
6067
- "We're having some trouble.": '發生一些問題。',
6068
- 'On-device capture guidance failed please capture a selfie manually.': '裝置上拍攝引導失敗,請手動拍攝自拍照',
6069
- 'Verifying...': '正在驗證...',
6070
- 'Please capture the front of your ID card.': '請拍攝證件正面。',
6071
- 'Please capture the back of your ID card.': '請拍攝證件背面。',
6072
- 'Please capture the front of your ID card, or the ID page of your passport.': '請拍攝證件正面或護照的 ID 頁面。',
6073
- 'Please capture the back of your ID card, or click Done if submitting a passport.': '請拍攝證件背面,或者如果提交護照,請按一下「完成」。',
6074
- 'Please capture the ID page of your passport.': '請拍攝護照的 ID 頁面。',
6075
- 'On-device capture guidance failed please capture a photo of your ID card manually.': '裝置上拍攝引導失敗,請手動拍攝證件的照片。',
6076
- 'On-device capture guidance failed please capture a photo of your passport manually.': '裝置上拍攝引導失敗,請手動拍攝護照的照片。',
6077
- 'On-device capture guidance failed please capture photos of your ID card and passport manually.': '裝置上拍攝引導失敗,請手動拍攝證件和護照的照片。',
6078
- 'On-device capture guidance failed please capture photos of your ID card or passport manually.': '裝置上拍攝引導失敗,請手動拍攝證件或護照的照片。',
6079
- 'Capture ID page of passport': '拍攝護照的 ID 頁面',
6080
- 'Capture back of ID card': '拍攝證件背面',
6081
- 'Downloading...': '正在下載...',
6082
- 'Accessing camera...': '正在存取相機...',
6083
- 'Camera ready': '相機就緒',
6084
- 'Loading guided capture experience...': '正在載入引導式拍攝體驗...',
6085
- 'Guided capture experience ready': '引導式拍攝體驗就緒',
6086
- "Let's Go!": '開始!',
6087
- 'We are having trouble identifying the correct side of your id do you want to continue with capture anyway?': '無法識別證件的正確一面,是否仍要繼續拍攝?',
6088
- OK: '確定',
6089
- 'Capture with Camera': '使用相机拍摄',
6090
- OR: '或者',
6091
- 'Upload from Storage': '从存储中上传',
6092
- 'Select ID Type': '选择身份证类型',
6093
- 'ID Card': '身份证',
6094
- 'Upload Passport': '上传护照',
6095
- 'Upload ID Front': '上传身份证正面',
6096
- 'Upload ID Back': '上传身份证背面',
6097
- Cancel: '取消',
6098
- 'Upload the back of the ID if it is not included in the front image.': '如果正面照片没有包含身份证背面,请上传背面照片。'
4416
+ var zh = {
4417
+ 'English - en': 'Chinese (Traditional) - zh',
4418
+ 'Use your device camera to capture your ID': '使用裝置相機拍攝證件',
4419
+ 'Use your iPhone as a webcam': '將 iPhone 當作網路攝影機使用',
4420
+ 'Models warming up...': '正在暖機...',
4421
+ 'Camera initializing...': '相機正在初始化...',
4422
+ 'Camera access blocked': '相機存取遭封鎖',
4423
+ 'Location access blocked': '位置存取遭封鎖',
4424
+ Continue: '繼續',
4425
+ 'Processing...': '正在處理...',
4426
+ 'Your camera permission is disabled': '已停用相機權限',
4427
+ '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.': '此應用程式需要存取相機才能繼續。瀏覽器提示後,請接受權限。如果瀏覽器未提示相機權限,必須前往設定並為目前瀏覽器提供相機存取權限。',
4428
+ 'Your microphone permission is disabled': '已停用麥克風權限',
4429
+ '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.': '此應用程式需要存取麥克風才能繼續。瀏覽器提示後,請接受權限。如果瀏覽器未提示麥克風權限,必須前往設定並為目前瀏覽器提供麥克風存取權限。',
4430
+ 'Your location permission is disabled': '已停用位置權限',
4431
+ '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.': '此應用程式需要存取位置才能繼續。瀏覽器提示後,請接受權限。如果瀏覽器未提示位置權限,必須前往設定並為目前瀏覽器提供位置存取權限。',
4432
+ Retry: '重試',
4433
+ 'Scan the front of ID': '掃描證件正面',
4434
+ 'Scan the back of ID': '掃描證件背面',
4435
+ 'Scan the ID page of passport': '掃描護照的 ID 頁面',
4436
+ 'ID Card Front': '證件正面',
4437
+ 'ID Card Back': '證件背面',
4438
+ Passport: '護照',
4439
+ 'Document not detected': '未偵測到文件',
4440
+ 'Document is not centered': '文件未置中',
4441
+ 'Document too close please back up': '文件太近,請後退',
4442
+ 'Please hold your ID document steady': '請拿穩證件',
4443
+ 'Document out of focus – try improving the lighting': '文件失焦 – 請嘗試改善燈光',
4444
+ 'ID card front detected - please flip your ID card': '偵測到證件正面 - 請將證件翻面',
4445
+ 'ID card back detected - please flip your ID card': '偵測到證件背面 - 請將證件翻面',
4446
+ 'ID card detected please scan a passport instead': '偵測到證件,請掃描護照',
4447
+ 'Passport detected please scan an ID card instead': '偵測到護照,請掃描證件',
4448
+ 'Document detected, hold still...': '偵測到的文件保持不動...',
4449
+ 'ID card front detected, hold still...': '偵測到的證件正面保持不動...',
4450
+ 'ID card back detected, hold still...': '偵測到的證件背面保持不動...',
4451
+ 'Passport detected, hold still...': '偵測到的護照保持不動...',
4452
+ 'Capturing...': '正在拍攝...',
4453
+ 'Capture failed!': '拍攝失敗!',
4454
+ 'Please flip your ID card...': '請將證件翻面...',
4455
+ 'ID card front captured.': '已拍攝證件正面。',
4456
+ 'ID card back captured.': '已拍攝證件背面。',
4457
+ 'ID Capture Successful': '證件拍攝成功',
4458
+ 'Verify the entire ID was captured clearly with no glare.': '確認是否清楚拍攝整個證件,無眩光。',
4459
+ Submit: '提交',
4460
+ 'Submitting...': '正在提交...',
4461
+ 'Use your device camera to capture your face': '使用裝置相機拍攝您的臉部',
4462
+ 'Remove Sunglasses & Hat': '取下太陽眼鏡和帽子',
4463
+ 'Avoid Excessive Backlighting': '避免過度背光',
4464
+ 'Hold still for a few seconds...': '請保持不動幾秒...',
4465
+ 'Please hold still...': '請保持不動...',
4466
+ 'Look straight into the camera...': '請直視相機...',
4467
+ 'Move back...': '請後退...',
4468
+ 'Move forward...': '請前進...',
4469
+ 'Move to the center...': '請移至中心...',
4470
+ 'Waiting for face to be detected...': '正在等待臉部辨識...',
4471
+ 'Please remove your eye coverings (sunglasses eye patch etc.)...': '請取下眼睛遮蓋物(太陽眼鏡、眼罩等)...',
4472
+ 'Please remove your head coverings (hat scarf etc.)...': '請取下頭部遮蓋物(帽子、圍巾等)...',
4473
+ 'Please remove your mask...': '請脫下口罩...',
4474
+ 'Live face not detected, please try again': '未偵測到活體人臉,請再試一次',
4475
+ Exit: '退出',
4476
+ 'Face liveness has been verified!': '已驗證人臉活體!',
4477
+ Done: '完成',
4478
+ 'Could not verify your face.': '無法驗證您的臉部。',
4479
+ 'An error occurred while verifying your face.': '驗證您的臉部時發生錯誤。',
4480
+ 'Customer has been identified!': '已識別客戶!',
4481
+ 'Customer not found': '找不到客戶',
4482
+ 'Additional document capture': '其他文件拍攝',
4483
+ Next: '下一步',
4484
+ 'Please sign the box below': '請在下方的方框中簽名',
4485
+ Accept: '接受',
4486
+ Clear: '清除',
4487
+ 'Video signature has been successfully captured!': '已成功拍攝影片簽名!',
4488
+ 'Network unreachable': '網路無法連線',
4489
+ "We're having trouble reaching our services please check your connection and try again.": '無法與服務連線,請檢查連線並再試一次。',
4490
+ "We're sorry an unexpected error has occurred.": '很抱歉,發生非預期錯誤。',
4491
+ 'Document Capture': '文件拍攝',
4492
+ Capture: '拍攝',
4493
+ 'Retry capture': '重試拍攝',
4494
+ Upload: '上傳',
4495
+ 'Uploading...': '正在上傳...',
4496
+ 'Upload succeeded!': '上傳成功!',
4497
+ 'Performing facial recognition, please hold still...': '正在進行臉部辨識,請保持不動...',
4498
+ 'Display the front of your ID card...': '出示證件正面...',
4499
+ 'Display the back of your ID card...': '出示證件背面...',
4500
+ 'Display the ID page of your passport...': '出示護照的 ID 頁面...',
4501
+ 'Please move your face to the center...': '請將臉部移至中心...',
4502
+ 'Searching for ID card...': '正在搜尋證件...',
4503
+ 'Please read the following text aloud': '請大聲讀出以下文字',
4504
+ 'Video ID has been successfully captured!': '已成功拍攝影片 ID!',
4505
+ 'ID Front Image': '證件正面影像',
4506
+ 'ID Back Image': '證件背面影像',
4507
+ "We're having some trouble.": '發生一些問題。',
4508
+ 'On-device capture guidance failed please capture a selfie manually.': '裝置上拍攝引導失敗,請手動拍攝自拍照',
4509
+ 'Verifying...': '正在驗證...',
4510
+ 'Please capture the front of your ID card.': '請拍攝證件正面。',
4511
+ 'Please capture the back of your ID card.': '請拍攝證件背面。',
4512
+ 'Please capture the front of your ID card, or the ID page of your passport.': '請拍攝證件正面或護照的 ID 頁面。',
4513
+ 'Please capture the back of your ID card, or click Done if submitting a passport.': '請拍攝證件背面,或者如果提交護照,請按一下「完成」。',
4514
+ 'Please capture the ID page of your passport.': '請拍攝護照的 ID 頁面。',
4515
+ 'On-device capture guidance failed please capture a photo of your ID card manually.': '裝置上拍攝引導失敗,請手動拍攝證件的照片。',
4516
+ 'On-device capture guidance failed please capture a photo of your passport manually.': '裝置上拍攝引導失敗,請手動拍攝護照的照片。',
4517
+ 'On-device capture guidance failed please capture photos of your ID card and passport manually.': '裝置上拍攝引導失敗,請手動拍攝證件和護照的照片。',
4518
+ 'On-device capture guidance failed please capture photos of your ID card or passport manually.': '裝置上拍攝引導失敗,請手動拍攝證件或護照的照片。',
4519
+ 'Capture ID page of passport': '拍攝護照的 ID 頁面',
4520
+ 'Capture back of ID card': '拍攝證件背面',
4521
+ 'Downloading...': '正在下載...',
4522
+ 'Accessing camera...': '正在存取相機...',
4523
+ 'Camera ready': '相機就緒',
4524
+ 'Loading guided capture experience...': '正在載入引導式拍攝體驗...',
4525
+ 'Guided capture experience ready': '引導式拍攝體驗就緒',
4526
+ "Let's Go!": '開始!',
4527
+ 'We are having trouble identifying the correct side of your id do you want to continue with capture anyway?': '無法識別證件的正確一面,是否仍要繼續拍攝?',
4528
+ OK: '確定',
4529
+ 'Capture with Camera': '使用相机拍摄',
4530
+ OR: '或者',
4531
+ 'Upload from Storage': '从存储中上传',
4532
+ 'Select ID Type': '选择身份证类型',
4533
+ 'ID Card': '身份证',
4534
+ 'Upload Passport': '上传护照',
4535
+ 'Upload ID Front': '上传身份证正面',
4536
+ 'Upload ID Back': '上传身份证背面',
4537
+ Cancel: '取消',
4538
+ 'Upload the back of the ID if it is not included in the front image.': '如果正面照片没有包含身份证背面,请上传背面照片。'
4539
+ };
4540
+
4541
+ var resources = {
4542
+ en: {
4543
+ translation: en
4544
+ },
4545
+ es: {
4546
+ translation: es
4547
+ },
4548
+ de: {
4549
+ translation: de
4550
+ },
4551
+ fr: {
4552
+ translation: fr
4553
+ },
4554
+ it: {
4555
+ translation: it
4556
+ },
4557
+ ja: {
4558
+ translation: ja
4559
+ },
4560
+ pt: {
4561
+ translation: pt
4562
+ },
4563
+ ru: {
4564
+ translation: ru
4565
+ },
4566
+ zh: {
4567
+ translation: zh
4568
+ }
4569
+ };
4570
+ function initializeI18n() {
4571
+ void i18n__default.default.use(LanguageDetector__default.default).use(reactI18next.initReactI18next).init({
4572
+ resources: resources,
4573
+ detection: {
4574
+ caches: []
4575
+ },
4576
+ fallbackLng: 'en',
4577
+ debug: false,
4578
+ interpolation: {
4579
+ escapeValue: false
4580
+ }
4581
+ });
4582
+ }
4583
+ var useLanguage = function useLanguage(lang) {
4584
+ var i18n = reactI18next.useTranslation().i18n;
4585
+ React.useEffect(function () {
4586
+ if (lang !== 'auto') {
4587
+ void i18n.changeLanguage(lang);
4588
+ } else {
4589
+ void i18n.changeLanguage(); // call without argument to use detection
4590
+ }
4591
+ }, [i18n, lang]);
4592
+ };
4593
+ function evaluateVerbiage(t, currentLanguage, verbiage, fallback) {
4594
+ if (typeof verbiage === 'string') return verbiage;
4595
+ if (typeof verbiage === 'object') {
4596
+ var translations = verbiage;
4597
+ if (translations[currentLanguage]) return translations[currentLanguage];
4598
+ var nonLocaleLang = currentLanguage.split('-')[0];
4599
+ if (translations[nonLocaleLang]) return translations[nonLocaleLang];
4600
+ }
4601
+ return t(fallback);
4602
+ }
4603
+ function useVerbiage(verbiage, fallback) {
4604
+ var _a = reactI18next.useTranslation(),
4605
+ t = _a.t,
4606
+ i18n = _a.i18n;
4607
+ return React.useMemo(function () {
4608
+ return evaluateVerbiage(t, i18n.language, verbiage, fallback);
4609
+ }, [fallback, i18n.language, t, verbiage]);
4610
+ }
4611
+ function useTranslations(verbiage, fallbacks) {
4612
+ var _a = reactI18next.useTranslation(),
4613
+ t = _a.t,
4614
+ i18n = _a.i18n;
4615
+ return React.useMemo(function () {
4616
+ return _assign(_assign({}, verbiage), Object.keys(fallbacks).reduce(function (result, key) {
4617
+ var _a;
4618
+ return _assign(_assign({}, result), (_a = {}, _a[key] = evaluateVerbiage(t, i18n.language, verbiage === null || verbiage === void 0 ? void 0 : verbiage[key], fallbacks[key]), _a));
4619
+ }, {}));
4620
+ }, [fallbacks, i18n.language, t, verbiage]);
4621
+ }
4622
+
4623
+ var initialState$5 = {
4624
+ videoRef: {
4625
+ current: null
4626
+ },
4627
+ videoLoaded: false,
4628
+ videoStream: null,
4629
+ videoDevice: null,
4630
+ isRearFacing: false,
4631
+ camera: null,
4632
+ cameraReady: false,
4633
+ cameraAccessDenied: false,
4634
+ iphoneContinuityCameraAvailable: false,
4635
+ iphoneContinuityCameraDenied: false,
4636
+ preferIphoneContinuityCamera: true,
4637
+ cameraTamperingDetected: false,
4638
+ audioStream: null,
4639
+ microphoneReady: false,
4640
+ microphoneAccessDenied: false
4641
+ };
4642
+ var createCameraStore = function createCameraStore(config) {
4643
+ var store = zustand.createStore(function (set, get) {
4644
+ return _assign(_assign(_assign({}, initialState$5), config), {
4645
+ reset: function reset() {
4646
+ return set(_assign(_assign({}, initialState$5), config));
4647
+ },
4648
+ setConfig: function setConfig(config) {
4649
+ return set(config);
4650
+ },
4651
+ onVideoMounted: function onVideoMounted(e) {
4652
+ var _a;
4653
+ var selectedVideoStreamId = (_a = get().videoStream) === null || _a === void 0 ? void 0 : _a.id;
4654
+ if (!selectedVideoStreamId) return;
4655
+ var srcObject = e.currentTarget.srcObject;
4656
+ if (srcObject.id === selectedVideoStreamId) {
4657
+ set({
4658
+ videoLoaded: true
4659
+ });
4660
+ } else {
4661
+ set({
4662
+ cameraTamperingDetected: true
4663
+ });
4664
+ }
4665
+ },
4666
+ setIphoneContinuityCameraAllowed: function setIphoneContinuityCameraAllowed(value) {
4667
+ return set({
4668
+ preferIphoneContinuityCamera: value
4669
+ });
4670
+ },
4671
+ requestCameraAccess: function requestCameraAccess() {
4672
+ return __awaiter(this, void 0, void 0, function () {
4673
+ 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;
4674
+ var _b, _c, _d;
4675
+ return __generator(this, function (_e) {
4676
+ switch (_e.label) {
4677
+ case 0:
4678
+ _a = get(), videoRef = _a.videoRef, releaseCameraAccess = _a.releaseCameraAccess, preferFrontFacingCamera = _a.preferFrontFacingCamera, preferIphoneContinuityCamera = _a.preferIphoneContinuityCamera, iphoneContinuityCameraDenied = _a.iphoneContinuityCameraDenied;
4679
+ releaseCameraAccess();
4680
+ _e.label = 1;
4681
+ case 1:
4682
+ _e.trys.push([1, 11,, 12]);
4683
+ return [4 /*yield*/, listAvailableCameras()];
4684
+ case 2:
4685
+ availableCameras = _e.sent();
4686
+ selectedCamera = void 0;
4687
+ debug('availableCameras', availableCameras);
4688
+ platform_1 = getPlatform();
4689
+ debug('platformDetails', platform_1);
4690
+ if (!iphoneContinuityCameraDenied && (!(platform_1 === null || platform_1 === void 0 ? void 0 : platform_1.os) || platform_1.os.family === 'OS X')) {
4691
+ iphoneContinuityCamera = availableCameras.find(function (deviceInfo) {
4692
+ return cameraLabelMatches(deviceInfo, 'iphone');
4693
+ });
4694
+ set({
4695
+ iphoneContinuityCameraAvailable: !!iphoneContinuityCamera
4696
+ });
4697
+ if (iphoneContinuityCamera && preferIphoneContinuityCamera) {
4698
+ selectedCamera = iphoneContinuityCamera;
4699
+ }
4700
+ } 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) {
4701
+ return c.label.startsWith('camera2 ');
4702
+ })) {
4703
+ availableCameras = availableCameras.sort(function (a, b) {
4704
+ return a.label.toLowerCase().localeCompare(b.label.toLowerCase());
4705
+ });
4706
+ debug('cameras have been sorted', availableCameras);
4707
+ }
4708
+ if (preferFrontFacingCamera) {
4709
+ selectedCamera = availableCameras.find(function (deviceInfo) {
4710
+ return cameraLabelMatches(deviceInfo, frontCameraLabels);
4711
+ });
4712
+ }
4713
+ selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
4714
+ return cameraLabelMatches(deviceInfo, 'backtriplecamera');
4715
+ }));
4716
+ selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
4717
+ return cameraLabelMatches(deviceInfo, 'backdualcamera');
4718
+ }));
4719
+ selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
4720
+ return cameraLabelMatches(deviceInfo, rearCameraLabels) && !cameraLabelMatches(deviceInfo, backUltraWideCameraLabels);
4721
+ }));
4722
+ selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
4723
+ return cameraLabelMatches(deviceInfo, rearCameraLabels);
4724
+ }));
4725
+ // on iOS, the front facing camera always is at the first position in the list, so we skip it if all else fails.
4726
+ 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) {
4727
+ selectedCamera || (selectedCamera = availableCameras[1]);
4728
+ }
4729
+ selectedCamera || (selectedCamera = availableCameras[0]);
4730
+ debug('selectedCamera', selectedCamera);
4731
+ set({
4732
+ videoDevice: selectedCamera
4733
+ });
4734
+ constraints = {
4735
+ audio: false,
4736
+ video: {
4737
+ deviceId: {
4738
+ exact: selectedCamera.deviceId
4739
+ },
4740
+ width: {
4741
+ ideal: config.maxVideoWidth
4742
+ },
4743
+ aspectRatio: 1.777777778,
4744
+ frameRate: {}
4745
+ }
4746
+ };
4747
+ if (config.maxFps) {
4748
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
4749
+ // @ts-ignore
4750
+ constraints.video.frameRate = {
4751
+ max: config.maxFps
4752
+ };
4753
+ }
4754
+ stream_1 = null;
4755
+ _e.label = 3;
4756
+ case 3:
4757
+ _e.trys.push([3, 5,, 6]);
4758
+ debug('obtaining camera access with constraints', constraints);
4759
+ return [4 /*yield*/, navigator.mediaDevices.getUserMedia(constraints)];
4760
+ case 4:
4761
+ stream_1 = _e.sent();
4762
+ return [3 /*break*/, 6];
4763
+ case 5:
4764
+ e_1 = _e.sent();
4765
+ if (e_1.name === 'NotAllowedError') {
4766
+ if (preferIphoneContinuityCamera) {
4767
+ set({
4768
+ iphoneContinuityCameraAvailable: false,
4769
+ iphoneContinuityCameraDenied: true
4770
+ });
4771
+ } else {
4772
+ set({
4773
+ cameraAccessDenied: true
4774
+ });
4775
+ }
4776
+ return [2 /*return*/];
4777
+ }
4778
+ return [3 /*break*/, 6];
4779
+ case 6:
4780
+ if (!!stream_1) return [3 /*break*/, 10];
4781
+ _e.label = 7;
4782
+ case 7:
4783
+ _e.trys.push([7, 9,, 10]);
4784
+ return [4 /*yield*/, navigator.mediaDevices.getUserMedia({
4785
+ audio: false,
4786
+ video: true
4787
+ })];
4788
+ case 8:
4789
+ stream_1 = _e.sent();
4790
+ debug('opened stream with no width and height constraints');
4791
+ return [3 /*break*/, 10];
4792
+ case 9:
4793
+ e_2 = _e.sent();
4794
+ debug('cannot open stream at all', e_2);
4795
+ return [3 /*break*/, 10];
4796
+ case 10:
4797
+ if (!stream_1) {
4798
+ error('failed to open camera');
4799
+ throw new Error('failed to open camera: ');
4800
+ }
4801
+ debug('camera access granted with constraints', constraints);
4802
+ handleStreamEnded_1 = function handleStreamEnded_1() {
4803
+ if (preferIphoneContinuityCamera && get().iphoneContinuityCameraAvailable) {
4804
+ debug('someone unplugged the continuity camera');
4805
+ set({
4806
+ videoStream: null,
4807
+ videoDevice: null,
4808
+ cameraReady: false,
4809
+ iphoneContinuityCameraAvailable: false,
4810
+ iphoneContinuityCameraDenied: true
4811
+ });
4812
+ get().requestCameraAccess();
4813
+ } else {
4814
+ debug('someone unplugged the webcam');
4815
+ releaseCameraAccess();
4816
+ set({
4817
+ videoStream: null,
4818
+ videoDevice: null,
4819
+ videoLoaded: false,
4820
+ cameraReady: false,
4821
+ cameraAccessDenied: true
4822
+ });
4823
+ }
4824
+ };
4825
+ (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.addEventListener('ended', handleStreamEnded_1);
4826
+ videoTrack_1 = stream_1.getVideoTracks()[0];
4827
+ videoTrack_1.onended = handleStreamEnded_1;
4828
+ camera_1 = obtainCameraAccess(stream_1, selectedCamera.label, videoRef.current);
4829
+ setTimeout(function () {
4830
+ // iOS 17 has a strange behavior where the video track flickers between muted and unmuted
4831
+ // when the camera access is being requested. This delay is a workaround for that.
4832
+ videoTrack_1.onmute = function () {
4833
+ if (videoTrack_1.readyState !== 'live') handleStreamEnded_1();
4834
+ };
4835
+ set({
4836
+ camera: camera_1,
4837
+ cameraReady: true,
4838
+ cameraAccessDenied: false,
4839
+ isRearFacing: camera_1.isRearFacing,
4840
+ videoStream: stream_1
4841
+ });
4842
+ }, 500);
4843
+ return [3 /*break*/, 12];
4844
+ case 11:
4845
+ e_3 = _e.sent();
4846
+ if (e_3.name === 'NotAllowedError') {
4847
+ error('camera access has been blocked by the user', e_3);
4848
+ set({
4849
+ cameraAccessDenied: true
4850
+ });
4851
+ } else {
4852
+ error('camera access encountered some other error', e_3);
4853
+ throw e_3;
4854
+ }
4855
+ return [3 /*break*/, 12];
4856
+ case 12:
4857
+ return [2 /*return*/];
4858
+ }
4859
+ });
4860
+ });
4861
+ },
4862
+ releaseCameraAccess: function releaseCameraAccess() {
4863
+ return __awaiter(this, void 0, void 0, function () {
4864
+ var camera;
4865
+ return __generator(this, function (_a) {
4866
+ camera = get().camera;
4867
+ if (!camera) return [2 /*return*/];
4868
+ camera.release();
4869
+ set({
4870
+ camera: null,
4871
+ cameraReady: false,
4872
+ cameraAccessDenied: false,
4873
+ videoDevice: null,
4874
+ videoStream: null,
4875
+ videoLoaded: false
4876
+ });
4877
+ return [2 /*return*/];
4878
+ });
4879
+ });
4880
+ },
4881
+ requestMicrophoneAccess: function requestMicrophoneAccess() {
4882
+ return __awaiter(this, void 0, void 0, function () {
4883
+ var stream_2, e_4;
4884
+ return __generator(this, function (_a) {
4885
+ switch (_a.label) {
4886
+ case 0:
4887
+ get().releaseMicrophoneAccess();
4888
+ _a.label = 1;
4889
+ case 1:
4890
+ _a.trys.push([1, 3,, 4]);
4891
+ return [4 /*yield*/, navigator.mediaDevices.getUserMedia({
4892
+ audio: true,
4893
+ video: false
4894
+ })
4895
+ // iOS 17 has a strange behavior where the video track flickers between muted and unmuted
4896
+ // when the camera access is being requested. This delay is a workaround for that.
4897
+ ];
4898
+ case 2:
4899
+ stream_2 = _a.sent();
4900
+ // iOS 17 has a strange behavior where the video track flickers between muted and unmuted
4901
+ // when the camera access is being requested. This delay is a workaround for that.
4902
+ setTimeout(function () {
4903
+ set({
4904
+ audioStream: stream_2,
4905
+ microphoneReady: true,
4906
+ microphoneAccessDenied: false
4907
+ });
4908
+ var handleStreamEnded = function handleStreamEnded() {
4909
+ set({
4910
+ microphoneReady: false,
4911
+ microphoneAccessDenied: true
4912
+ });
4913
+ };
4914
+ var track = stream_2.getAudioTracks()[0];
4915
+ track.onended = handleStreamEnded;
4916
+ track.onmute = function () {
4917
+ if (track.readyState !== 'live') handleStreamEnded();
4918
+ };
4919
+ }, 500);
4920
+ return [3 /*break*/, 4];
4921
+ case 3:
4922
+ e_4 = _a.sent();
4923
+ debug('failed to open microphone', e_4);
4924
+ set({
4925
+ microphoneAccessDenied: true
4926
+ });
4927
+ return [3 /*break*/, 4];
4928
+ case 4:
4929
+ return [2 /*return*/];
4930
+ }
4931
+ });
4932
+ });
4933
+ },
4934
+ releaseMicrophoneAccess: function releaseMicrophoneAccess() {
4935
+ var _a;
4936
+ var audioStream = get().audioStream;
4937
+ (_a = audioStream === null || audioStream === void 0 ? void 0 : audioStream.stop) === null || _a === void 0 ? void 0 : _a.call(audioStream);
4938
+ audioStream === null || audioStream === void 0 ? void 0 : audioStream.getAudioTracks().forEach(function (track) {
4939
+ var _a;
4940
+ (_a = track.stop) === null || _a === void 0 ? void 0 : _a.call(track);
4941
+ });
4942
+ set({
4943
+ audioStream: null,
4944
+ microphoneReady: false,
4945
+ microphoneAccessDenied: false
4946
+ });
4947
+ }
4948
+ });
4949
+ });
4950
+ if (config.requestAccessAutomatically) {
4951
+ void store.getState().requestCameraAccess();
4952
+ }
4953
+ return _assign(_assign({}, store), {
4954
+ destroy: function destroy() {
4955
+ store.getState().releaseCameraAccess();
4956
+ store.getState().releaseMicrophoneAccess();
4957
+ }
4958
+ });
4959
+ };
4960
+ var CameraStoreContext = /*#__PURE__*/React.createContext(undefined);
4961
+ function CameraStoreProvider(_a) {
4962
+ var children = _a.children,
4963
+ _b = _a.requestAccessAutomatically,
4964
+ requestAccessAutomatically = _b === void 0 ? true : _b,
4965
+ _c = _a.preferIphoneContinuityCamera,
4966
+ preferIphoneContinuityCamera = _c === void 0 ? true : _c,
4967
+ _d = _a.preferFrontFacingCamera,
4968
+ preferFrontFacingCamera = _d === void 0 ? false : _d,
4969
+ _e = _a.maxVideoWidth,
4970
+ maxVideoWidth = _e === void 0 ? 1920 : _e,
4971
+ maxFps = _a.maxFps,
4972
+ onCameraAccessDenied = _a.onCameraAccessDenied,
4973
+ onCameraTamperingDetected = _a.onCameraTamperingDetected,
4974
+ onMicrophoneAccessDenied = _a.onMicrophoneAccessDenied,
4975
+ _f = _a.requireMicrophoneAccess,
4976
+ requireMicrophoneAccess = _f === void 0 ? false : _f,
4977
+ _g = _a.classNames,
4978
+ classNames = _g === void 0 ? {} : _g,
4979
+ _h = _a.verbiage,
4980
+ verbiage = _h === void 0 ? {} : _h;
4981
+ var videoRef = React.useRef(null);
4982
+ var store = React.useRef();
4983
+ store.current || (store.current = createCameraStore({
4984
+ videoRef: videoRef,
4985
+ requestAccessAutomatically: requestAccessAutomatically,
4986
+ preferIphoneContinuityCamera: preferIphoneContinuityCamera,
4987
+ preferFrontFacingCamera: preferFrontFacingCamera,
4988
+ maxVideoWidth: maxVideoWidth,
4989
+ maxFps: maxFps,
4990
+ onCameraAccessDenied: onCameraAccessDenied,
4991
+ onMicrophoneAccessDenied: onMicrophoneAccessDenied,
4992
+ requireMicrophoneAccess: requireMicrophoneAccess
4993
+ }));
4994
+ React.useEffect(function () {
4995
+ var _a, _b, _c;
4996
+ var state = (_a = store.current) === null || _a === void 0 ? void 0 : _a.getState();
4997
+ if (!state) return;
4998
+ if (preferIphoneContinuityCamera !== (state === null || state === void 0 ? void 0 : state.preferIphoneContinuityCamera) || preferFrontFacingCamera !== (state === null || state === void 0 ? void 0 : state.preferFrontFacingCamera)) {
4999
+ (_b = store.current) === null || _b === void 0 ? void 0 : _b.setState({
5000
+ preferIphoneContinuityCamera: preferIphoneContinuityCamera,
5001
+ preferFrontFacingCamera: preferFrontFacingCamera
5002
+ });
5003
+ (_c = store.current) === null || _c === void 0 ? void 0 : _c.getState().requestCameraAccess();
5004
+ }
5005
+ }, [preferFrontFacingCamera, preferIphoneContinuityCamera]);
5006
+ React.useEffect(function () {
5007
+ var _a;
5008
+ if (requireMicrophoneAccess) {
5009
+ (_a = store.current) === null || _a === void 0 ? void 0 : _a.getState().requestMicrophoneAccess();
5010
+ }
5011
+ }, [requireMicrophoneAccess]);
5012
+ React.useEffect(function () {
5013
+ return function () {
5014
+ var _a;
5015
+ return (_a = store.current) === null || _a === void 0 ? void 0 : _a.destroy();
5016
+ };
5017
+ }, []);
5018
+ return /*#__PURE__*/React__namespace.default.createElement(CameraStoreContext.Provider, {
5019
+ value: store.current
5020
+ }, /*#__PURE__*/React__namespace.default.createElement(CameraTamperSeal, {
5021
+ onCameraTamperingDetected: onCameraTamperingDetected,
5022
+ classNames: classNames.cameraTamperSeal,
5023
+ verbiage: verbiage.cameraTamperSeal
5024
+ }, children));
5025
+ }
5026
+ function CameraTamperSeal(_a) {
5027
+ var children = _a.children,
5028
+ onCameraTamperingDetected = _a.onCameraTamperingDetected,
5029
+ _b = _a.classNames,
5030
+ classNames = _b === void 0 ? {} : _b,
5031
+ _c = _a.verbiage,
5032
+ rawVerbiage = _c === void 0 ? {} : _c;
5033
+ var cameraTamperingDetected = useCameraStore().cameraTamperingDetected;
5034
+ var _d = useTranslations(rawVerbiage, {
5035
+ headingText: 'Camera tampering detected',
5036
+ 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."
5037
+ }),
5038
+ headingText = _d.headingText,
5039
+ messageText = _d.messageText;
5040
+ var onCameraTamperingDetectedRef = React.useRef(onCameraTamperingDetected);
5041
+ React.useEffect(function () {
5042
+ onCameraTamperingDetectedRef.current = onCameraTamperingDetected;
5043
+ }, [onCameraTamperingDetected]);
5044
+ React.useEffect(function () {
5045
+ var _a;
5046
+ if (cameraTamperingDetected) (_a = onCameraTamperingDetectedRef.current) === null || _a === void 0 ? void 0 : _a.call(onCameraTamperingDetectedRef);
5047
+ }, [cameraTamperingDetected]);
5048
+ if (!cameraTamperingDetected) return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, children);
5049
+ return /*#__PURE__*/React__namespace.default.createElement(OverlayContainer, {
5050
+ className: classNames.container
5051
+ }, /*#__PURE__*/React__namespace.default.createElement(StyledOverlayInner$4, {
5052
+ className: classNames.inner
5053
+ }, /*#__PURE__*/React__namespace.default.createElement(StyledOverlayHeading, {
5054
+ className: classNames.heading
5055
+ }, headingText), /*#__PURE__*/React__namespace.default.createElement("p", {
5056
+ className: classNames.message
5057
+ }, messageText)));
5058
+ }
5059
+ var StyledOverlayInner$4 = styled__default.default(OverlayInner$2)(templateObject_1$H || (templateObject_1$H = __makeTemplateObject(["\n justify-content: center;\n"], ["\n justify-content: center;\n"])));
5060
+ var StyledOverlayHeading = styled__default.default.h3(templateObject_2$A || (templateObject_2$A = __makeTemplateObject(["\n margin-bottom: 8px;\n"], ["\n margin-bottom: 8px;\n"])));
5061
+ function useCameraStore(selector) {
5062
+ var store = React.useContext(CameraStoreContext);
5063
+ if (!store) throw new Error('useCameraStore cannot be used without Provider');
5064
+ return zustand.useStore(store, selector);
5065
+ }
5066
+ var templateObject_1$H, templateObject_2$A;
5067
+
5068
+ var DocumentDetectionModelContext = /*#__PURE__*/React.createContext({
5069
+ startDocumentDetection: function startDocumentDetection() {
5070
+ return null;
5071
+ },
5072
+ stopDocumentDetection: function stopDocumentDetection() {
5073
+ return null;
5074
+ },
5075
+ loadDocumentDetectionModel: function loadDocumentDetectionModel() {
5076
+ return null;
5077
+ },
5078
+ documentDetectionModelReady: false,
5079
+ documentDetectionModelDownloadProgress: 0,
5080
+ documentDetectionModelError: null,
5081
+ onDocumentDetected: function onDocumentDetected() {
5082
+ return null;
5083
+ },
5084
+ detectionTime: 0,
5085
+ documentDetectionThresholds: {},
5086
+ setDocumentDetectionThresholds: function setDocumentDetectionThresholds() {
5087
+ return null;
5088
+ },
5089
+ documentDetectionBoundaries: defaultDocumentDetectionBoundaries,
5090
+ setDocumentDetectionBoundaries: function setDocumentDetectionBoundaries() {
5091
+ return null;
5092
+ },
5093
+ documentDetectionLastPredictionCanvas: {
5094
+ current: null
5095
+ },
5096
+ clearDocumentDetectionLastPredictionCanvas: function clearDocumentDetectionLastPredictionCanvas() {
5097
+ return null;
5098
+ }
5099
+ });
5100
+ function DocumentDetectionModelProvider(_a) {
5101
+ var _this = this;
5102
+ var _b = _a.autoStart,
5103
+ autoStart = _b === void 0 ? true : _b,
5104
+ children = _a.children,
5105
+ _c = _a.throttleMs,
5106
+ throttleMs = _c === void 0 ? 16 : _c,
5107
+ _d = _a.delayAfterStartMs,
5108
+ delayAfterStartMs = _d === void 0 ? 0 : _d,
5109
+ _e = _a.documentDetectionModelPath,
5110
+ documentDetectionModelPath = _e === void 0 ? defaultDocumentDetectorModelPath : _e,
5111
+ _f = _a.documentDetectionModelScoreThreshold,
5112
+ documentDetectionModelScoreThreshold = _f === void 0 ? defaultDocumentDetectionScoreThreshold : _f,
5113
+ _g = _a.documentDetectionModelLoadTimeoutMs,
5114
+ documentDetectionModelLoadTimeoutMs = _g === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _g,
5115
+ onDocumentDetectionModelError = _a.onDocumentDetectionModelError,
5116
+ _h = _a.shouldLoadModels,
5117
+ shouldLoadModelsProp = _h === void 0 ? true : _h;
5118
+ var _j = useCameraStore(),
5119
+ videoRef = _j.videoRef,
5120
+ videoLoaded = _j.videoLoaded,
5121
+ cameraReady = _j.cameraReady;
5122
+ var lastPredictionCanvas = React.useRef(null);
5123
+ var onPredictionHandler = React.useRef();
5124
+ var _k = React.useState({}),
5125
+ documentDetectionThresholds = _k[0],
5126
+ setDocumentDetectionThresholds = _k[1];
5127
+ var _l = React.useState(defaultDocumentDetectionBoundaries),
5128
+ documentDetectionBoundaries = _l[0],
5129
+ setDocumentDetectionBoundaries = _l[1];
5130
+ var _m = React.useState(0),
5131
+ timesAllZero = _m[0],
5132
+ setTimesAllZero = _m[1];
5133
+ var _o = React.useState(0),
5134
+ canvasKey = _o[0],
5135
+ setCanvasKey = _o[1];
5136
+ var stopDetection = React.useRef(0);
5137
+ var _p = React.useState(shouldLoadModelsProp),
5138
+ shouldLoadModels = _p[0],
5139
+ setShouldLoadModels = _p[1];
5140
+ var load = React.useCallback(function () {
5141
+ return setShouldLoadModels(true);
5142
+ }, []);
5143
+ var _q = useLoadDocumentDetector({
5144
+ modelPath: documentDetectionModelPath,
5145
+ modelLoadTimeoutMs: documentDetectionModelLoadTimeoutMs,
5146
+ scoreThreshold: documentDetectionModelScoreThreshold,
5147
+ onModelError: onDocumentDetectionModelError,
5148
+ videoRef: videoRef,
5149
+ shouldLoadModels: shouldLoadModels
5150
+ }),
5151
+ ready = _q.ready,
5152
+ modelDownloadProgress = _q.modelDownloadProgress,
5153
+ modelError = _q.modelError,
5154
+ setModelError = _q.setModelError;
5155
+ var _r = useFrameLoop(React.useCallback(function (frameId, timeRunning) {
5156
+ return __awaiter(_this, void 0, void 0, function () {
5157
+ var stopDetectionAtStart, vw, vh, ctx, prediction, processedPrediction;
5158
+ var _a;
5159
+ return __generator(this, function (_b) {
5160
+ switch (_b.label) {
5161
+ case 0:
5162
+ if (!videoLoaded || !cameraReady || !ready || !videoRef.current || !lastPredictionCanvas.current) return [2 /*return*/];
5163
+ stopDetectionAtStart = stopDetection.current;
5164
+ vw = videoRef.current.videoWidth;
5165
+ vh = videoRef.current.videoHeight;
5166
+ lastPredictionCanvas.current.width = vw;
5167
+ lastPredictionCanvas.current.height = vh;
5168
+ ctx = lastPredictionCanvas.current.getContext('2d');
5169
+ if (!(ctx && videoRef.current.readyState === 4)) return [3 /*break*/, 3];
5170
+ if (stopDetectionAtStart !== stopDetection.current) return [2 /*return*/];
5171
+ ctx.drawImage(videoRef.current, 0, 0, vw, vh);
5172
+ return [4 /*yield*/, makeDocumentDetectorPrediction(lastPredictionCanvas.current)];
5173
+ case 1:
5174
+ prediction = _b.sent();
5175
+ if (!prediction) return [3 /*break*/, 3];
5176
+ processedPrediction = processDocumentDetectorPrediction(prediction, documentDetectionThresholds, documentDetectionBoundaries);
5177
+ processedPrediction.frameId = frameId;
5178
+ setLastDetectionAt(new Date().getTime());
5179
+ debug(processedPrediction);
5180
+ if (processedPrediction.allZero) setTimesAllZero(function (n) {
5181
+ return n + 1;
5182
+ });
5183
+ if (stopDetectionAtStart !== stopDetection.current) return [2 /*return*/];
5184
+ if (timeRunning < delayAfterStartMs) return [2 /*return*/];
5185
+ return [4 /*yield*/, (_a = onPredictionHandler.current) === null || _a === void 0 ? void 0 : _a.call(onPredictionHandler, processedPrediction)];
5186
+ case 2:
5187
+ _b.sent();
5188
+ _b.label = 3;
5189
+ case 3:
5190
+ return [2 /*return*/];
5191
+ }
5192
+ });
5193
+ });
5194
+ }, [cameraReady, delayAfterStartMs, documentDetectionBoundaries, documentDetectionThresholds, ready, videoLoaded, videoRef]), {
5195
+ throttleMs: throttleMs,
5196
+ autoStart: autoStart
5197
+ }),
5198
+ start = _r.start,
5199
+ stop = _r.stop;
5200
+ React.useEffect(function setErrorIfAllZero() {
5201
+ if (timesAllZero >= 2) {
5202
+ setModelError(new Error('model is returning all zeroes'));
5203
+ }
5204
+ }, [setModelError, timesAllZero]);
5205
+ var onDocumentDetected = React.useCallback(function (handler) {
5206
+ onPredictionHandler.current = handler;
5207
+ }, []);
5208
+ var clearDocumentDetectionLastPredictionCanvas = React.useCallback(function () {
5209
+ stopDetection.current += 1;
5210
+ setCanvasKey(function (n) {
5211
+ return n + 1;
5212
+ });
5213
+ }, []);
5214
+ var value = React.useMemo(function () {
5215
+ return {
5216
+ startDocumentDetection: start,
5217
+ stopDocumentDetection: stop,
5218
+ loadDocumentDetectionModel: load,
5219
+ documentDetectionModelReady: ready,
5220
+ documentDetectionModelError: modelError,
5221
+ documentDetectionModelDownloadProgress: modelDownloadProgress,
5222
+ onDocumentDetected: onDocumentDetected,
5223
+ detectionTime: lastDetectionTime,
5224
+ documentDetectionThresholds: documentDetectionThresholds,
5225
+ setDocumentDetectionThresholds: setDocumentDetectionThresholds,
5226
+ documentDetectionBoundaries: documentDetectionBoundaries,
5227
+ setDocumentDetectionBoundaries: setDocumentDetectionBoundaries,
5228
+ documentDetectionLastPredictionCanvas: lastPredictionCanvas,
5229
+ clearDocumentDetectionLastPredictionCanvas: clearDocumentDetectionLastPredictionCanvas
5230
+ };
5231
+ }, [start, stop, load, ready, modelError, modelDownloadProgress, onDocumentDetected, documentDetectionThresholds, documentDetectionBoundaries, clearDocumentDetectionLastPredictionCanvas]);
5232
+ return /*#__PURE__*/React__namespace.createElement(DocumentDetectionModelContext.Provider, {
5233
+ value: value
5234
+ }, /*#__PURE__*/React__namespace.createElement(InvisibleCanvas, {
5235
+ key: canvasKey,
5236
+ ref: lastPredictionCanvas
5237
+ }), children);
5238
+ }
5239
+
5240
+ var FocusModelContext = /*#__PURE__*/React.createContext({
5241
+ loadFocusModel: function loadFocusModel() {
5242
+ return null;
5243
+ },
5244
+ focusModelReady: false,
5245
+ focusModelDownloadProgress: 0,
5246
+ focusModelError: null,
5247
+ focusThresholds: {},
5248
+ setFocusThresholds: function setFocusThresholds() {
5249
+ return null;
5250
+ },
5251
+ makeFocusPrediction: function makeFocusPrediction() {
5252
+ return null;
5253
+ },
5254
+ focusPredictionTime: 0
5255
+ });
5256
+ function FocusModelProvider(_a) {
5257
+ var children = _a.children,
5258
+ _b = _a.focusModelPath,
5259
+ focusModelPath = _b === void 0 ? defaultFocusModelPath : _b,
5260
+ _c = _a.focusModelLoadTimeoutMs,
5261
+ focusModelLoadTimeoutMs = _c === void 0 ? defaultFocusModelLoadTimeoutMs : _c,
5262
+ onFocusModelError = _a.onFocusModelError,
5263
+ _d = _a.showCanvases,
5264
+ showCanvases = _d === void 0 ? false : _d,
5265
+ _e = _a.shouldLoadModels,
5266
+ shouldLoadModelsProp = _e === void 0 ? true : _e;
5267
+ var cropCanvas = React.useRef(null);
5268
+ var rotateCanvas = React.useRef(null);
5269
+ var _f = React.useState({}),
5270
+ focusThresholds = _f[0],
5271
+ setFocusThresholds = _f[1];
5272
+ var videoRef = useCameraStore().videoRef;
5273
+ var _g = React.useState(shouldLoadModelsProp),
5274
+ shouldLoadModels = _g[0],
5275
+ setShouldLoadModels = _g[1];
5276
+ var load = React.useCallback(function () {
5277
+ return setShouldLoadModels(true);
5278
+ }, []);
5279
+ var _h = useLoadFocusModel({
5280
+ modelPath: focusModelPath,
5281
+ modelLoadTimeoutMs: focusModelLoadTimeoutMs,
5282
+ onModelError: onFocusModelError,
5283
+ videoRef: videoRef,
5284
+ shouldLoadModels: shouldLoadModels
5285
+ }),
5286
+ ready = _h.ready,
5287
+ modelDownloadProgress = _h.modelDownloadProgress,
5288
+ modelError = _h.modelError;
5289
+ var makeFocusPrediction = React.useCallback(function (imageData, box) {
5290
+ if (!ready) return null;
5291
+ var prediction = makeFocusModelPrediction(imageData, cropCanvas.current, rotateCanvas.current, box);
5292
+ if (!prediction) return null;
5293
+ setLastFocusPredictionAt(prediction.predictionTime);
5294
+ return prediction;
5295
+ }, [ready]);
5296
+ var value = React.useMemo(function () {
5297
+ return {
5298
+ loadFocusModel: load,
5299
+ focusModelReady: ready,
5300
+ focusModelDownloadProgress: modelDownloadProgress,
5301
+ focusModelError: modelError,
5302
+ makeFocusPrediction: makeFocusPrediction,
5303
+ focusPredictionTime: lastFocusPredictionTime,
5304
+ focusThresholds: focusThresholds,
5305
+ setFocusThresholds: setFocusThresholds
5306
+ };
5307
+ }, [focusThresholds, load, makeFocusPrediction, modelDownloadProgress, modelError, ready]);
5308
+ return /*#__PURE__*/React__namespace.default.createElement(FocusModelContext.Provider, {
5309
+ value: value
5310
+ }, /*#__PURE__*/React__namespace.default.createElement(InvisibleCanvas, {
5311
+ ref: rotateCanvas,
5312
+ style: showCanvases ? {
5313
+ display: 'block'
5314
+ } : undefined
5315
+ }), /*#__PURE__*/React__namespace.default.createElement(InvisibleCanvas, {
5316
+ ref: cropCanvas,
5317
+ style: showCanvases ? {
5318
+ display: 'block'
5319
+ } : undefined
5320
+ }), children);
5321
+ }
5322
+
5323
+ function _isNavigatorDefined() {
5324
+ return typeof navigator !== 'undefined' && navigator != null;
5325
+ }
5326
+ var isMobileCache;
5327
+ function isMobile() {
5328
+ if (isMobileCache !== undefined) return isMobileCache;
5329
+ isMobileCache = evaluateIsMobile();
5330
+ return isMobileCache;
5331
+ }
5332
+ function evaluateIsMobile(nav) {
5333
+ if (nav || _isNavigatorDefined()) {
5334
+ if (!nav) {
5335
+ nav = navigator;
5336
+ }
5337
+ if (nav.product === 'ReactNative') {
5338
+ return true;
5339
+ }
5340
+ var a = nav.userAgent || nav.vendor || (
5341
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
5342
+ // @ts-ignore
5343
+ typeof window !== 'undefined' ? window.opera : '');
5344
+ if (!a) {
5345
+ var navAny = nav;
5346
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
5347
+ // @ts-ignore
5348
+ return navAny.userAgentData && navAny.userAgentData.mobile;
5349
+ }
5350
+ 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));
5351
+ }
5352
+ return false;
5353
+ }
5354
+
5355
+ var onMobile = isMobile();
5356
+ var defaultIdCaptureThresholds = {
5357
+ detection: defaultDocumentDetectionThresholds,
5358
+ focus: defaultFocusThresholds
5359
+ };
5360
+ var IdCaptureModelsContext = /*#__PURE__*/React.createContext({
5361
+ ready: false,
5362
+ start: function start() {
5363
+ return null;
5364
+ },
5365
+ stop: function stop() {
5366
+ return null;
5367
+ },
5368
+ load: function load() {
5369
+ return null;
5370
+ },
5371
+ modelDownloadProgress: 0,
5372
+ modelError: null,
5373
+ thresholds: defaultIdCaptureThresholds,
5374
+ setThresholds: function setThresholds() {
5375
+ return null;
5376
+ },
5377
+ documentDetectionBoundaries: defaultDocumentDetectionBoundaries,
5378
+ setDocumentDetectionBoundaries: function setDocumentDetectionBoundaries() {
5379
+ return null;
5380
+ },
5381
+ onPredictionMade: function onPredictionMade() {
5382
+ return null;
5383
+ },
5384
+ detectionTime: 0,
5385
+ focusPredictionTime: 0,
5386
+ bestFrameDetails: {
5387
+ current: null
5388
+ },
5389
+ getBestFrame: function getBestFrame() {
5390
+ return null;
5391
+ },
5392
+ resetBestFrame: function resetBestFrame() {
5393
+ return null;
5394
+ },
5395
+ requiredDocumentType: 'none',
5396
+ setRequiredDocumentType: function setRequiredDocumentType() {
5397
+ return null;
5398
+ }
5399
+ });
5400
+ function IdCaptureModelsProviderInner(_a) {
5401
+ var children = _a.children,
5402
+ onModelError = _a.onModelError,
5403
+ _b = _a.allowSinglePageIdCapture,
5404
+ allowSinglePageIdCapture = _b === void 0 ? false : _b;
5405
+ var _c = React.useContext(DocumentDetectionModelContext),
5406
+ documentDetectionModelReady = _c.documentDetectionModelReady,
5407
+ documentDetectionModelDownloadProgress = _c.documentDetectionModelDownloadProgress,
5408
+ startDocumentDetection = _c.startDocumentDetection,
5409
+ stopDocumentDetection = _c.stopDocumentDetection,
5410
+ loadDocumentDetectionModel = _c.loadDocumentDetectionModel,
5411
+ lastPredictionCanvas = _c.documentDetectionLastPredictionCanvas,
5412
+ clearDocumentDetectionLastPredictionCanvas = _c.clearDocumentDetectionLastPredictionCanvas,
5413
+ onDocumentDetected = _c.onDocumentDetected,
5414
+ detectionTime = _c.detectionTime,
5415
+ documentDetectionThresholds = _c.documentDetectionThresholds,
5416
+ setDocumentDetectionThresholds = _c.setDocumentDetectionThresholds,
5417
+ documentDetectionBoundaries = _c.documentDetectionBoundaries,
5418
+ setDocumentDetectionBoundaries = _c.setDocumentDetectionBoundaries,
5419
+ documentDetectionModelError = _c.documentDetectionModelError;
5420
+ var _d = React.useContext(FocusModelContext),
5421
+ loadFocusModel = _d.loadFocusModel,
5422
+ focusModelReady = _d.focusModelReady,
5423
+ focusModelDownloadProgress = _d.focusModelDownloadProgress,
5424
+ makeFocusPrediction = _d.makeFocusPrediction,
5425
+ focusThresholds = _d.focusThresholds,
5426
+ setFocusThresholds = _d.setFocusThresholds,
5427
+ focusPredictionTime = _d.focusPredictionTime,
5428
+ focusModelError = _d.focusModelError;
5429
+ var onPredictionHandler = React.useRef();
5430
+ var bestFrameDetails = React.useRef(null);
5431
+ var bestPredictionCanvas = React.useRef(null);
5432
+ var bestFocusScore = React.useRef(0);
5433
+ var stopDetection = React.useRef(0);
5434
+ var _e = React.useState('none'),
5435
+ requiredDocumentType = _e[0],
5436
+ setRequiredDocumentType = _e[1];
5437
+ var thresholds = React.useMemo(function () {
5438
+ return _assign(_assign({}, documentDetectionThresholds), {
5439
+ focus: focusThresholds
5440
+ });
5441
+ }, [documentDetectionThresholds, focusThresholds]);
5442
+ var setThresholds = React.useCallback(function (thresholds) {
5443
+ if (thresholds.detection) {
5444
+ setDocumentDetectionThresholds(thresholds.detection);
5445
+ }
5446
+ if (thresholds.focus) {
5447
+ setFocusThresholds(thresholds.focus);
5448
+ }
5449
+ }, [setDocumentDetectionThresholds, setFocusThresholds]);
5450
+ React.useEffect(function handleDetections() {
5451
+ var _this = this;
5452
+ onDocumentDetected(function (prediction) {
5453
+ return __awaiter(_this, void 0, void 0, function () {
5454
+ var stopDetectionAtStart, focusPredictionTime, focusScore, focusThresholdMet, isSinglePage, isRequiredDocumentType, focusPrediction, focusThresholdSet, focusThreshold;
5455
+ var _a, _b, _c, _d, _e, _f, _g;
5456
+ return __generator(this, function (_h) {
5457
+ if (!lastPredictionCanvas.current) return [2 /*return*/];
5458
+ stopDetectionAtStart = stopDetection.current;
5459
+ focusPredictionTime = 0, focusScore = 0, focusThresholdMet = false;
5460
+ isSinglePage = prediction.detectedDocumentType === 'singlePage';
5461
+ if (!allowSinglePageIdCapture && isSinglePage) {
5462
+ prediction.detectedDocumentType = 'passport';
5463
+ prediction.passportDetectionScore = prediction.singlePageDetectionScore;
5464
+ prediction.passportDetectionThresholdMet = prediction.singlePageDetectionThresholdMet;
5465
+ prediction.singlePageDetectionScore = 0;
5466
+ prediction.singlePageDetectionThresholdMet = false;
5467
+ }
5468
+ 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'));
5469
+ if (isRequiredDocumentType && prediction.detectedDocumentType !== 'none' && prediction.detectionThresholdMet && prediction.documentInBounds && !prediction.documentTooClose && prediction.documentIsStable) {
5470
+ focusPrediction = makeFocusPrediction(lastPredictionCanvas.current, (_c = prediction.bestDocument) === null || _c === void 0 ? void 0 : _c.box);
5471
+ if (focusPrediction) {
5472
+ focusScore = focusPrediction.score;
5473
+ focusPredictionTime = focusPrediction.predictionTime;
5474
+ }
5475
+ focusThresholdSet = (_d = thresholds.focus) === null || _d === void 0 ? void 0 : _d[prediction.detectedDocumentType];
5476
+ 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;
5477
+ focusThresholdMet = focusScore >= focusThreshold;
5478
+ if (bestFocusScore.current <= focusScore && stopDetectionAtStart === stopDetection.current) {
5479
+ bestFocusScore.current = focusScore;
5480
+ drawToCanvas(bestPredictionCanvas.current, lastPredictionCanvas.current);
5481
+ bestFrameDetails.current = {
5482
+ boundingBox: (_f = prediction.bestDocument) === null || _f === void 0 ? void 0 : _f.box,
5483
+ documentType: prediction.detectedDocumentType,
5484
+ detectionScore: prediction.detectionScore,
5485
+ focusScore: focusScore
5486
+ };
5487
+ }
5488
+ }
5489
+ (_g = onPredictionHandler.current) === null || _g === void 0 ? void 0 : _g.call(onPredictionHandler, _assign(_assign({}, prediction), {
5490
+ focusScore: focusScore,
5491
+ focusPredictionTime: focusPredictionTime,
5492
+ focusThresholdMet: focusThresholdMet
5493
+ }));
5494
+ return [2 /*return*/];
5495
+ });
5496
+ });
5497
+ });
5498
+ }, [allowSinglePageIdCapture, lastPredictionCanvas, makeFocusPrediction, onDocumentDetected, requiredDocumentType, thresholds.focus]);
5499
+ var modelError = documentDetectionModelError !== null && documentDetectionModelError !== void 0 ? documentDetectionModelError : focusModelError;
5500
+ React.useEffect(function handleModelErrors() {
5501
+ if (modelError) onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError);
5502
+ }, [modelError, onModelError]);
5503
+ var onPredictionMade = React.useCallback(function (handler) {
5504
+ onPredictionHandler.current = handler;
5505
+ }, []);
5506
+ var getBestFrame = React.useCallback(function () {
5507
+ if (!bestFrameDetails.current || !bestPredictionCanvas.current) return null;
5508
+ return _assign(_assign({}, bestFrameDetails.current), {
5509
+ canvas: bestPredictionCanvas.current
5510
+ });
5511
+ }, []);
5512
+ var _f = React.useState(0),
5513
+ canvasKey = _f[0],
5514
+ setCanvasKey = _f[1];
5515
+ var resetBestFrame = React.useCallback(function () {
5516
+ stopDetection.current += 1;
5517
+ setCanvasKey(function (n) {
5518
+ return n + 1;
5519
+ });
5520
+ clearDocumentDetectionLastPredictionCanvas();
5521
+ bestFrameDetails.current = null;
5522
+ bestFocusScore.current = 0;
5523
+ }, [clearDocumentDetectionLastPredictionCanvas]);
5524
+ React.useEffect(function () {
5525
+ if (requiredDocumentType) resetBestFrame();
5526
+ }, [requiredDocumentType, resetBestFrame]);
5527
+ var load = React.useCallback(function () {
5528
+ loadDocumentDetectionModel();
5529
+ loadFocusModel();
5530
+ }, [loadDocumentDetectionModel, loadFocusModel]);
5531
+ var value = React.useMemo(function () {
5532
+ return {
5533
+ ready: documentDetectionModelReady && focusModelReady,
5534
+ modelDownloadProgress: (documentDetectionModelDownloadProgress + focusModelDownloadProgress) / 2,
5535
+ modelError: modelError,
5536
+ start: startDocumentDetection,
5537
+ stop: stopDocumentDetection,
5538
+ load: load,
5539
+ thresholds: thresholds,
5540
+ setThresholds: setThresholds,
5541
+ documentDetectionBoundaries: documentDetectionBoundaries,
5542
+ setDocumentDetectionBoundaries: setDocumentDetectionBoundaries,
5543
+ onPredictionMade: onPredictionMade,
5544
+ detectionTime: detectionTime,
5545
+ focusPredictionTime: focusPredictionTime,
5546
+ getBestFrame: getBestFrame,
5547
+ resetBestFrame: resetBestFrame,
5548
+ bestFrameDetails: bestFrameDetails,
5549
+ requiredDocumentType: requiredDocumentType,
5550
+ setRequiredDocumentType: setRequiredDocumentType
5551
+ };
5552
+ }, [detectionTime, documentDetectionBoundaries, documentDetectionModelDownloadProgress, documentDetectionModelReady, focusModelDownloadProgress, focusModelReady, focusPredictionTime, getBestFrame, load, modelError, onPredictionMade, requiredDocumentType, resetBestFrame, setDocumentDetectionBoundaries, setThresholds, startDocumentDetection, stopDocumentDetection, thresholds]);
5553
+ return /*#__PURE__*/React__namespace.default.createElement(IdCaptureModelsContext.Provider, {
5554
+ value: value
5555
+ }, /*#__PURE__*/React__namespace.default.createElement(InvisibleCanvas, {
5556
+ key: canvasKey,
5557
+ ref: bestPredictionCanvas
5558
+ }), children);
5559
+ }
5560
+ function IdCaptureModelsProvider(_a) {
5561
+ var children = _a.children,
5562
+ props = __rest(_a, ["children"]);
5563
+ return /*#__PURE__*/React__namespace.default.createElement(DocumentDetectionModelProvider, _assign({}, props), /*#__PURE__*/React__namespace.default.createElement(FocusModelProvider, _assign({}, props), /*#__PURE__*/React__namespace.default.createElement(IdCaptureModelsProviderInner, _assign({}, props), children)));
5564
+ }
5565
+
5566
+ var CapturedDocumentTypeValues = ['idCardFront', 'idCardBack', 'passport', 'singlePage', 'selfie'];
5567
+
5568
+ var acceptedDocumentTypesForIdCaptureRequirementOption = {
5569
+ idCardFront: ['idCardFront'],
5570
+ idCardBack: ['idCardBack'],
5571
+ passport: ['passport'],
5572
+ idCard: ['idCardFront', 'idCardBack'],
5573
+ idCardAndPassport: ['idCardFront', 'idCardBack', 'passport'],
5574
+ idCardOrPassport: ['idCardFront', 'idCardBack', 'passport'] // this one is so weird
6099
5575
  };
5576
+ function minImageCountForIdCaptureRequirementOption(idCaptureRequirement) {
5577
+ if (idCaptureRequirement === 'idCardOrPassport') return 1;
5578
+ return acceptedDocumentTypesForIdCaptureRequirementOption[idCaptureRequirement].length;
5579
+ }
5580
+ function maxImageCountForIdCaptureRequirementOption(idCaptureRequirement) {
5581
+ if (idCaptureRequirement === 'idCardOrPassport') return 2;
5582
+ return minImageCountForIdCaptureRequirementOption(idCaptureRequirement);
5583
+ }
5584
+ function remainingIdCaptureRequirements(captureRequirement, capturedDocuments, requestedDocumentType) {
5585
+ var isIdCardOrPassport = captureRequirement === 'idCardOrPassport';
5586
+ if (isIdCardOrPassport && requestedDocumentType === 'passport') return [];
5587
+ var acceptedTypes = acceptedDocumentTypesForIdCaptureRequirementOption[captureRequirement];
5588
+ if (captureRequirement.includes('idCard') && 'singlePage' in capturedDocuments) {
5589
+ acceptedTypes = acceptedTypes.filter(function (v) {
5590
+ return !v.includes('idCard');
5591
+ });
5592
+ }
5593
+ if (isIdCardOrPassport) {
5594
+ acceptedTypes = acceptedTypes.filter(function (v) {
5595
+ return v !== 'passport';
5596
+ });
5597
+ }
5598
+ return acceptedTypes.filter(function (v) {
5599
+ return !(v in capturedDocuments);
5600
+ });
5601
+ }
6100
5602
 
6101
- var resources = {
6102
- en: {
6103
- translation: en
6104
- },
6105
- es: {
6106
- translation: es
6107
- },
6108
- de: {
6109
- translation: de
6110
- },
6111
- fr: {
6112
- translation: fr
6113
- },
6114
- it: {
6115
- translation: it
6116
- },
6117
- ja: {
6118
- translation: ja
6119
- },
6120
- pt: {
6121
- translation: pt
6122
- },
6123
- ru: {
6124
- translation: ru
6125
- },
6126
- zh: {
6127
- translation: zh
5603
+ var initialState$4 = {
5604
+ initialDrawComplete: false,
5605
+ redrawing: false,
5606
+ guideRectX: 0,
5607
+ guideRectY: 0,
5608
+ guideRectWidth: 0,
5609
+ guideRectHeight: 0,
5610
+ guideRectOffsetTop: 0,
5611
+ guideImageWidth: 0,
5612
+ guideImageHeight: 0,
5613
+ pageWidth: 0,
5614
+ pageHeight: 0,
5615
+ videoWidth: 0,
5616
+ videoHeight: 0,
5617
+ detectedObjects: [],
5618
+ bestDocument: undefined,
5619
+ detectedDocumentType: 'none',
5620
+ detectionThresholdMet: false,
5621
+ documentInBounds: false,
5622
+ documentTooClose: false,
5623
+ documentIsStable: false,
5624
+ flipRequired: false,
5625
+ backDetectedFirst: false,
5626
+ idCardDetectedButNotAllowed: false,
5627
+ passportDetectedButNotAllowed: false,
5628
+ enableOverrideWrongDocumentTypeDialog: false,
5629
+ allowOverrideWrongDocumentTypeAfterMs: 8000,
5630
+ allowOverrideWrongDocumentTypeGuidance: false,
5631
+ overrideWrongDocumentTypeGuidance: false,
5632
+ wrongDocumentTypePredictions: 0,
5633
+ idCardFrontDetectionScore: 0,
5634
+ idCardFrontDetectionThresholdMet: false,
5635
+ idCardBackDetectionScore: 0,
5636
+ idCardBackDetectionThresholdMet: false,
5637
+ passportDetectionScore: 0,
5638
+ passportDetectionThresholdMet: false,
5639
+ singlePageDetectionScore: 0,
5640
+ singlePageDetectionThresholdMet: false,
5641
+ focusScore: 0,
5642
+ focusThresholdMet: false,
5643
+ isGoodFrame: false,
5644
+ goodFramesCount: 0,
5645
+ goodFramesThreshold: 3,
5646
+ goodFramesThresholdMet: false,
5647
+ lastFrameCapturedAt: null,
5648
+ frameCaptureRate: 0,
5649
+ capturing: false,
5650
+ captureFailed: false,
5651
+ imageUrl: null,
5652
+ captureState: 'initializing',
5653
+ capturedDocuments: {},
5654
+ captureRequirement: 'idCardOrPassport',
5655
+ requestedDocumentType: 'idCardFront',
5656
+ allowSinglePageIdCapture: false,
5657
+ allowIdCardBackToFrontCapture: false,
5658
+ allowUploadingDocumentsFromStorage: false,
5659
+ isUploadingDocumentsFromStorage: false,
5660
+ uploadingDocumentsType: null,
5661
+ operationStartedAt: null,
5662
+ captureStartedAt: null,
5663
+ dispatch: function dispatch() {
5664
+ return null;
5665
+ }
5666
+ };
5667
+ var _reducer = function reducer(state, action) {
5668
+ var _a;
5669
+ switch (action.type) {
5670
+ case 'configureWizard':
5671
+ {
5672
+ var _b = action.payload,
5673
+ captureRequirement = _b.captureRequirement,
5674
+ precapturedDocuments = _b.precapturedDocuments,
5675
+ allowSinglePageIdCapture = _b.allowSinglePageIdCapture,
5676
+ allowIdCardBackToFrontCapture = _b.allowIdCardBackToFrontCapture,
5677
+ enableOverrideWrongDocumentTypeDialog = _b.enableOverrideWrongDocumentTypeDialog,
5678
+ allowOverrideWrongDocumentTypeAfterMs = _b.allowOverrideWrongDocumentTypeAfterMs,
5679
+ allowUploadingDocumentsFromStorage = _b.allowUploadingDocumentsFromStorage;
5680
+ var newState = _assign(_assign({}, state), {
5681
+ captureRequirement: captureRequirement,
5682
+ allowSinglePageIdCapture: allowSinglePageIdCapture !== null && allowSinglePageIdCapture !== void 0 ? allowSinglePageIdCapture : false,
5683
+ allowIdCardBackToFrontCapture: allowIdCardBackToFrontCapture !== null && allowIdCardBackToFrontCapture !== void 0 ? allowIdCardBackToFrontCapture : false,
5684
+ enableOverrideWrongDocumentTypeDialog: enableOverrideWrongDocumentTypeDialog,
5685
+ allowOverrideWrongDocumentTypeAfterMs: allowOverrideWrongDocumentTypeAfterMs,
5686
+ allowUploadingDocumentsFromStorage: allowUploadingDocumentsFromStorage
5687
+ });
5688
+ if (captureRequirement === 'idCardBack') newState.requestedDocumentType = 'idCardBack';
5689
+ if (captureRequirement === 'passport') newState.requestedDocumentType = 'passport';
5690
+ if (precapturedDocuments) {
5691
+ for (var _i = 0, CapturedDocumentTypeValues_1 = CapturedDocumentTypeValues; _i < CapturedDocumentTypeValues_1.length; _i++) {
5692
+ var k = CapturedDocumentTypeValues_1[_i];
5693
+ var payload = precapturedDocuments[k];
5694
+ if (payload) {
5695
+ newState.requestedDocumentType = k;
5696
+ newState = _reducer(newState, {
5697
+ type: 'documentCaptured',
5698
+ payload: payload
5699
+ });
5700
+ }
5701
+ }
5702
+ }
5703
+ if (newState.captureState === 'initializing' && !allowUploadingDocumentsFromStorage) {
5704
+ newState.captureState = 'capturing';
5705
+ }
5706
+ return newState;
5707
+ }
5708
+ case 'setRequiredDocumentType':
5709
+ return _assign(_assign({}, state), {
5710
+ requiredDocumentType: action.payload
5711
+ });
5712
+ case 'redrawRequested':
5713
+ return _assign(_assign({}, state), {
5714
+ redrawing: true,
5715
+ guideRectX: 0,
5716
+ guideRectY: 0,
5717
+ guideRectWidth: 0,
5718
+ guideRectHeight: 0,
5719
+ guideRectOffsetTop: 0
5720
+ });
5721
+ case 'redrawInProgress':
5722
+ return _assign(_assign({}, state), {
5723
+ redrawing: false,
5724
+ guideRectX: 0,
5725
+ guideRectY: 0,
5726
+ guideRectWidth: 0,
5727
+ guideRectHeight: 0,
5728
+ guideRectOffsetTop: 0
5729
+ });
5730
+ case 'redrawCompleted':
5731
+ return _assign(_assign(_assign({}, state), action.payload), {
5732
+ initialDrawComplete: true
5733
+ });
5734
+ case 'pageRendered':
5735
+ return _assign(_assign({}, state), action.payload);
5736
+ case 'guideImageLoaded':
5737
+ return _assign(_assign({}, state), {
5738
+ guideImageWidth: action.payload.width,
5739
+ guideImageHeight: action.payload.height
5740
+ });
5741
+ case 'objectsDetected':
5742
+ {
5743
+ var _c = action.payload.prediction,
5744
+ detectedObjects = _c.detectedObjects,
5745
+ detectionThresholdMet = _c.detectionThresholdMet,
5746
+ detectedDocumentType = _c.detectedDocumentType,
5747
+ idCardFrontDetectionScore = _c.idCardFrontDetectionScore,
5748
+ idCardFrontDetectionThresholdMet = _c.idCardFrontDetectionThresholdMet,
5749
+ idCardBackDetectionScore = _c.idCardBackDetectionScore,
5750
+ idCardBackDetectionThresholdMet = _c.idCardBackDetectionThresholdMet,
5751
+ passportDetectionScore = _c.passportDetectionScore,
5752
+ passportDetectionThresholdMet = _c.passportDetectionThresholdMet,
5753
+ singlePageDetectionScore = _c.singlePageDetectionScore,
5754
+ singlePageDetectionThresholdMet = _c.singlePageDetectionThresholdMet,
5755
+ bestDocument = _c.bestDocument,
5756
+ documentInBounds = _c.documentInBounds,
5757
+ documentTooClose = _c.documentTooClose,
5758
+ documentIsStable = _c.documentIsStable,
5759
+ focusScore = _c.focusScore,
5760
+ focusThresholdMet = _c.focusThresholdMet,
5761
+ frameWidth = _c.frameWidth,
5762
+ frameHeight = _c.frameHeight;
5763
+ var frameCapturedAt = new Date();
5764
+ var frameCaptureRate = 0;
5765
+ var goodFramesThreshold = state.goodFramesThreshold;
5766
+ if (state.lastFrameCapturedAt) {
5767
+ var frameTime = frameCapturedAt.getTime() - state.lastFrameCapturedAt.getTime();
5768
+ if (frameTime > 0) {
5769
+ frameCaptureRate = 1000.0 / frameTime;
5770
+ if (frameCaptureRate > 0) {
5771
+ goodFramesThreshold = Math.ceil(3 * frameCaptureRate);
5772
+ }
5773
+ }
5774
+ }
5775
+ var idCardDetected = detectedDocumentType.includes('idCard') || detectedDocumentType === 'singlePage';
5776
+ var idCardDetectedButNotAllowed = idCardDetected && !state.captureRequirement.includes('idCard');
5777
+ var passportNotAllowed = !state.captureRequirement.toLowerCase().includes('passport');
5778
+ var idCardFrontWasCaptured = 'idCardFront' in state.capturedDocuments;
5779
+ var idCardBackWasCaptured = 'idCardBack' in state.capturedDocuments;
5780
+ var idCardBeingCaptured = idCardFrontWasCaptured && !idCardBackWasCaptured || !idCardFrontWasCaptured && idCardBackWasCaptured;
5781
+ var passportDetectedButNotAllowed = detectedDocumentType === 'passport' && (passportNotAllowed || idCardBeingCaptured);
5782
+ var flipRequired = !state.overrideWrongDocumentTypeGuidance && (state.allowIdCardBackToFrontCapture ? idCardFrontWasCaptured && detectedDocumentType === 'idCardFront' : state.requestedDocumentType === 'idCardBack' && detectedDocumentType === 'idCardFront');
5783
+ var backDetectedFirst = !state.overrideWrongDocumentTypeGuidance && (state.allowIdCardBackToFrontCapture ? idCardBackWasCaptured && detectedDocumentType === 'idCardBack' : state.requestedDocumentType === 'idCardFront' && detectedDocumentType === 'idCardBack');
5784
+ var wrongDocumentTypePredictions = state.wrongDocumentTypePredictions;
5785
+ if (state.captureState === 'capturing' && (flipRequired || backDetectedFirst)) {
5786
+ wrongDocumentTypePredictions += 1;
5787
+ }
5788
+ var isGoodFrame = detectionThresholdMet && documentInBounds && !documentTooClose && !flipRequired && !backDetectedFirst && focusThresholdMet && !idCardDetectedButNotAllowed && !passportDetectedButNotAllowed && documentIsStable;
5789
+ var captureStartedAt = state.captureStartedAt;
5790
+ var goodFramesCount = state.goodFramesCount;
5791
+ if (isGoodFrame) {
5792
+ goodFramesCount += 1;
5793
+ captureStartedAt || (captureStartedAt = new Date());
5794
+ }
5795
+ var goodFramesThresholdMet = goodFramesCount >= goodFramesThreshold;
5796
+ var requestedDocumentType = state.requestedDocumentType;
5797
+ if (state.captureRequirement.includes('idCard') && state.allowIdCardBackToFrontCapture) {
5798
+ if (detectedDocumentType === 'idCardFront' && state.requestedDocumentType !== 'idCardFront' && !idCardFrontWasCaptured) {
5799
+ requestedDocumentType = 'idCardFront';
5800
+ } else if (detectedDocumentType === 'idCardBack' && state.requestedDocumentType !== 'idCardBack' && !idCardBackWasCaptured) {
5801
+ requestedDocumentType = 'idCardBack';
5802
+ }
5803
+ }
5804
+ if (state.captureRequirement === 'idCardOrPassport') {
5805
+ if (detectedDocumentType === 'passport' && state.requestedDocumentType !== 'passport') {
5806
+ requestedDocumentType = 'passport';
5807
+ }
5808
+ if (requestedDocumentType === 'passport' && passportDetectionScore < 0.3) {
5809
+ requestedDocumentType = idCardFrontWasCaptured ? 'idCardBack' : 'idCardFront';
5810
+ }
5811
+ }
5812
+ var hasBeenRunningForLongEnough = !!state.operationStartedAt && new Date().getTime() - state.operationStartedAt.getTime() > 1000;
5813
+ var overrideFlipRequirementThreshold = Math.ceil(state.allowOverrideWrongDocumentTypeAfterMs / 1000 * frameCaptureRate);
5814
+ var allowOverrideFlipRequirement = state.enableOverrideWrongDocumentTypeDialog && hasBeenRunningForLongEnough && !state.overrideWrongDocumentTypeGuidance && overrideFlipRequirementThreshold > 0 && (state.allowOverrideWrongDocumentTypeGuidance || wrongDocumentTypePredictions >= overrideFlipRequirementThreshold);
5815
+ return _assign(_assign({}, state), {
5816
+ videoWidth: frameWidth,
5817
+ videoHeight: frameHeight,
5818
+ detectedObjects: detectedObjects,
5819
+ bestDocument: bestDocument,
5820
+ requestedDocumentType: requestedDocumentType,
5821
+ detectedDocumentType: detectedDocumentType,
5822
+ detectionThresholdMet: detectionThresholdMet,
5823
+ documentInBounds: documentInBounds,
5824
+ documentTooClose: documentTooClose,
5825
+ documentIsStable: documentIsStable,
5826
+ flipRequired: flipRequired,
5827
+ backDetectedFirst: backDetectedFirst,
5828
+ idCardDetectedButNotAllowed: idCardDetectedButNotAllowed,
5829
+ passportDetectedButNotAllowed: passportDetectedButNotAllowed,
5830
+ allowOverrideWrongDocumentTypeGuidance: allowOverrideFlipRequirement,
5831
+ wrongDocumentTypePredictions: wrongDocumentTypePredictions,
5832
+ idCardFrontDetectionScore: idCardFrontDetectionScore,
5833
+ idCardFrontDetectionThresholdMet: idCardFrontDetectionThresholdMet,
5834
+ idCardBackDetectionScore: idCardBackDetectionScore,
5835
+ idCardBackDetectionThresholdMet: idCardBackDetectionThresholdMet,
5836
+ passportDetectionScore: passportDetectionScore,
5837
+ passportDetectionThresholdMet: passportDetectionThresholdMet,
5838
+ singlePageDetectionScore: singlePageDetectionScore,
5839
+ singlePageDetectionThresholdMet: singlePageDetectionThresholdMet,
5840
+ focusScore: focusScore,
5841
+ focusThresholdMet: focusThresholdMet,
5842
+ isGoodFrame: isGoodFrame,
5843
+ goodFramesCount: goodFramesCount,
5844
+ goodFramesThreshold: goodFramesThreshold,
5845
+ goodFramesThresholdMet: goodFramesThresholdMet,
5846
+ captureStartedAt: captureStartedAt,
5847
+ lastFrameCapturedAt: frameCapturedAt,
5848
+ frameCaptureRate: frameCaptureRate
5849
+ });
5850
+ }
5851
+ case 'captureInitialized':
5852
+ return _assign(_assign({}, state), {
5853
+ captureState: 'capturing',
5854
+ isUploadingDocumentsFromStorage: false
5855
+ });
5856
+ case 'captureStarted':
5857
+ return _assign(_assign({}, state), {
5858
+ operationStartedAt: new Date(),
5859
+ captureStartedAt: null,
5860
+ capturing: false,
5861
+ captureFailed: false
5862
+ });
5863
+ case 'capturing':
5864
+ return _assign(_assign({}, state), {
5865
+ capturing: true,
5866
+ captureFailed: false
5867
+ });
5868
+ case 'captured':
5869
+ return _assign(_assign({}, state), {
5870
+ capturing: false,
5871
+ captureFailed: false
5872
+ });
5873
+ case 'frameCaptured':
5874
+ return _assign(_assign({}, state), {
5875
+ imageUrl: action.payload.imageUrl
5876
+ });
5877
+ case 'captureFailed':
5878
+ return _assign(_assign({}, state), {
5879
+ capturing: false,
5880
+ captureFailed: true
5881
+ });
5882
+ case 'documentCaptured':
5883
+ {
5884
+ var newState = _assign(_assign({}, state), {
5885
+ capturing: false,
5886
+ captureFailed: false,
5887
+ allowOverrideFlipRequirement: false,
5888
+ overrideFlipRequirement: false,
5889
+ goodFramesCount: 0,
5890
+ wrongDocumentTypePredictions: 0,
5891
+ capturedDocuments: _assign(_assign({}, state.capturedDocuments), (_a = {}, _a[action.payload.documentType] = action.payload, _a))
5892
+ });
5893
+ var remainingRequirements = remainingIdCaptureRequirements(state.captureRequirement, newState.capturedDocuments, state.requestedDocumentType);
5894
+ if (remainingRequirements.length === 0) {
5895
+ newState.captureState = 'complete';
5896
+ } else {
5897
+ newState.requestedDocumentType = remainingRequirements[0];
5898
+ if (state.requestedDocumentType === 'idCardFront' && newState.requestedDocumentType === 'idCardBack' || state.requestedDocumentType === 'idCardBack' && newState.requestedDocumentType === 'idCardFront') {
5899
+ if (!newState.isUploadingDocumentsFromStorage) {
5900
+ newState.captureState = 'requestingFlip';
5901
+ }
5902
+ newState.idCardFrontDetectionThresholdMet = false;
5903
+ newState.idCardBackDetectionThresholdMet = false;
5904
+ newState.passportDetectionThresholdMet = false;
5905
+ newState.wrongDocumentTypePredictions = 0;
5906
+ }
5907
+ }
5908
+ return newState;
5909
+ }
5910
+ case 'documentCapturedManually':
5911
+ return _reducer(state, {
5912
+ type: 'documentCaptured',
5913
+ payload: _assign(_assign({}, action.payload), {
5914
+ documentType: state.requestedDocumentType,
5915
+ width: 0,
5916
+ height: 0
5917
+ })
5918
+ });
5919
+ case 'documentsCaptured':
5920
+ {
5921
+ var newState = _assign({}, state);
5922
+ for (var _d = 0, _e = action.payload; _d < _e.length; _d++) {
5923
+ var doc = _e[_d];
5924
+ newState = _reducer(newState, {
5925
+ type: 'documentCaptured',
5926
+ payload: doc
5927
+ });
5928
+ }
5929
+ return newState;
5930
+ }
5931
+ case 'flipRequestCompleted':
5932
+ return _assign(_assign({}, state), {
5933
+ captureState: 'capturing',
5934
+ allowOverrideWrongDocumentTypeGuidance: false,
5935
+ overrideWrongDocumentTypeGuidance: false,
5936
+ wrongDocumentTypePredictions: 0
5937
+ });
5938
+ case 'allowOverrideFlipRequirement':
5939
+ return _assign(_assign({}, state), {
5940
+ allowOverrideWrongDocumentTypeGuidance: true
5941
+ });
5942
+ case 'overrideFlipRequirement':
5943
+ return _assign(_assign({}, state), {
5944
+ allowOverrideWrongDocumentTypeGuidance: false,
5945
+ overrideWrongDocumentTypeGuidance: true
5946
+ });
5947
+ case 'setUploadingDocumentsFromStorage':
5948
+ return _assign(_assign({}, state), {
5949
+ isUploadingDocumentsFromStorage: action.payload,
5950
+ captureState: action.payload ? 'initializing' : 'capturing'
5951
+ });
5952
+ case 'setUploadingDocumentsType':
5953
+ {
5954
+ var requestedDocumentType = !action.payload || action.payload === 'idCard' ? 'idCardFront' : action.payload;
5955
+ var uploadingDocumentsType = action.payload === 'singlePage' ? 'idCard' : action.payload;
5956
+ return _assign(_assign({}, state), {
5957
+ captureState: action.payload ? 'uploading' : 'initializing',
5958
+ uploadingDocumentsType: uploadingDocumentsType,
5959
+ requestedDocumentType: requestedDocumentType
5960
+ });
5961
+ }
5962
+ case 'resetWizard':
5963
+ return _assign(_assign({}, initialState$4), {
5964
+ dispatch: state.dispatch,
5965
+ allowUploadingDocumentsFromStorage: state.allowUploadingDocumentsFromStorage,
5966
+ captureState: state.allowUploadingDocumentsFromStorage ? 'initializing' : 'capturing',
5967
+ captureRequirement: state.captureRequirement,
5968
+ allowIdCardBackToFrontCapture: state.allowIdCardBackToFrontCapture
5969
+ });
5970
+ default:
5971
+ return state;
6128
5972
  }
6129
5973
  };
6130
- function initializeI18n() {
6131
- void i18n__default.default.use(LanguageDetector__default.default).use(reactI18next.initReactI18next).init({
6132
- resources: resources,
6133
- detection: {
6134
- caches: []
6135
- },
6136
- fallbackLng: 'en',
6137
- debug: false,
6138
- interpolation: {
6139
- escapeValue: false
5974
+ var useIdCaptureStore = zustand.create()(middleware.devtools(function (set) {
5975
+ return _assign(_assign({}, initialState$4), {
5976
+ dispatch: function dispatch(action) {
5977
+ return set(function (state) {
5978
+ return _reducer(state, action);
5979
+ }, undefined, action);
5980
+ }
5981
+ });
5982
+ }));
5983
+ function IdCaptureStateProvider(_a) {
5984
+ var children = _a.children;
5985
+ var overrideWrongDocumentTypeGuidance = useIdCaptureStore(shallow.useShallow(function (state) {
5986
+ return state.overrideWrongDocumentTypeGuidance;
5987
+ }));
5988
+ var setRequiredDocumentType = React.useContext(IdCaptureModelsContext).setRequiredDocumentType;
5989
+ React.useEffect(function () {
5990
+ if (overrideWrongDocumentTypeGuidance) setRequiredDocumentType('none');
5991
+ }, [overrideWrongDocumentTypeGuidance, setRequiredDocumentType]);
5992
+ var onResize = useDebounce.useDebouncedCallback(function () {
5993
+ dispatchIdCaptureAction({
5994
+ type: 'redrawRequested'
5995
+ });
5996
+ }, 500);
5997
+ React.useLayoutEffect(function () {
5998
+ if (typeof window === 'undefined') return;
5999
+ window.addEventListener('resize', onResize);
6000
+ return function () {
6001
+ return window.removeEventListener('resize', onResize);
6002
+ };
6003
+ }, [onResize]);
6004
+ React.useEffect(function resetWhenProviderUnmounts() {
6005
+ return function () {
6006
+ return useIdCaptureStore.getState().dispatch({
6007
+ type: 'resetWizard'
6008
+ });
6009
+ };
6010
+ }, []);
6011
+ return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, children);
6012
+ }
6013
+ var dispatchIdCaptureAction = function dispatchIdCaptureAction(action) {
6014
+ return useIdCaptureStore.getState().dispatch(action);
6015
+ };
6016
+
6017
+ function DebugStatsPane(_a) {
6018
+ var children = _a.children;
6019
+ var element = /*#__PURE__*/React__namespace.default.createElement(DebugStatsPaneDiv, null, children);
6020
+ var portalLocation = document.getElementById('idmission-above-guides-content');
6021
+ if (!portalLocation) return element;
6022
+ return /*#__PURE__*/reactDom.createPortal(element, portalLocation);
6023
+ }
6024
+ var DebugStatsPaneDiv = styled__default.default.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"])));
6025
+ var ObjectDetectionDebugOverlayDiv = styled__default.default.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) {
6026
+ var $flipX = _a.$flipX;
6027
+ return $flipX ? 'transform: scaleX(-1);' : '';
6028
+ });
6029
+ var ObjectDetectionDebugBox = styled__default.default.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) {
6030
+ var $color = _a.$color;
6031
+ return $color !== null && $color !== void 0 ? $color : 'green';
6032
+ }, function (_a) {
6033
+ var $color = _a.$color;
6034
+ return $color !== null && $color !== void 0 ? $color : 'green';
6035
+ }, function (_a) {
6036
+ var $flipX = _a.$flipX;
6037
+ return $flipX ? 'transform: scaleX(-1);' : '';
6038
+ });
6039
+ var FaceDetectionKeypointMarker = styled__default.default.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) {
6040
+ var $color = _a.$color;
6041
+ return $color !== null && $color !== void 0 ? $color : 'red';
6042
+ }, function (_a) {
6043
+ var $color = _a.$color;
6044
+ return $color !== null && $color !== void 0 ? $color : 'red';
6045
+ }, function (_a) {
6046
+ var $flipX = _a.$flipX;
6047
+ return $flipX ? 'transform: scaleX(-1);' : '';
6048
+ });
6049
+ function useDebugScalingDetails(_a) {
6050
+ var _b = _a.enabled,
6051
+ enabled = _b === void 0 ? true : _b,
6052
+ pageWidth = _a.pageWidth,
6053
+ pageHeight = _a.pageHeight,
6054
+ videoWidth = _a.videoWidth,
6055
+ videoHeight = _a.videoHeight;
6056
+ return React.useMemo(function () {
6057
+ var horizontal = false,
6058
+ scaledWidth = 0,
6059
+ scaledHeight = 0,
6060
+ xOffset = 0,
6061
+ yOffset = 0;
6062
+ if (enabled) {
6063
+ horizontal = pageWidth / pageHeight < videoWidth / videoHeight;
6064
+ if (horizontal) {
6065
+ scaledWidth = videoWidth * (pageHeight / videoHeight);
6066
+ xOffset = (scaledWidth - pageWidth) / 2;
6067
+ } else {
6068
+ scaledHeight = videoHeight * (pageWidth / videoWidth);
6069
+ yOffset = (scaledHeight - pageHeight) / 2;
6070
+ }
6140
6071
  }
6141
- });
6072
+ return {
6073
+ horizontal: horizontal,
6074
+ pageWidth: pageWidth,
6075
+ pageHeight: pageHeight,
6076
+ videoWidth: videoWidth,
6077
+ videoHeight: videoHeight,
6078
+ scaledWidth: scaledWidth,
6079
+ scaledHeight: scaledHeight,
6080
+ xOffset: xOffset,
6081
+ yOffset: yOffset
6082
+ };
6083
+ }, [enabled, pageHeight, pageWidth, videoHeight, videoWidth]);
6142
6084
  }
6143
- var useLanguage = function useLanguage(lang) {
6144
- var i18n = reactI18next.useTranslation().i18n;
6145
- React.useEffect(function () {
6146
- if (lang !== 'auto') {
6147
- void i18n.changeLanguage(lang);
6148
- } else {
6149
- void i18n.changeLanguage(); // call without argument to use detection
6085
+ var DebugBoundingBoxOverlay = function DebugBoundingBoxOverlay(_a) {
6086
+ var scaling = _a.scaling,
6087
+ $flipX = _a.$flipX,
6088
+ children = _a.children;
6089
+ var _b = useIdCaptureStore(),
6090
+ guideRectWidth = _b.guideRectWidth,
6091
+ guideRectHeight = _b.guideRectHeight,
6092
+ guideRectX = _b.guideRectX,
6093
+ guideRectY = _b.guideRectY;
6094
+ return /*#__PURE__*/React__namespace.default.createElement(ObjectDetectionDebugOverlayDiv, {
6095
+ id: "debug-overlay-div",
6096
+ "$flipX": $flipX,
6097
+ style: {
6098
+ top: guideRectY,
6099
+ left: guideRectX,
6100
+ width: guideRectWidth || (scaling === null || scaling === void 0 ? void 0 : scaling.pageWidth),
6101
+ height: guideRectHeight || (scaling === null || scaling === void 0 ? void 0 : scaling.pageHeight)
6150
6102
  }
6151
- }, [i18n, lang]);
6103
+ }, children);
6152
6104
  };
6153
- function evaluateVerbiage(t, currentLanguage, verbiage, fallback) {
6154
- if (typeof verbiage === 'string') return verbiage;
6155
- if (typeof verbiage === 'object') {
6156
- var translations = verbiage;
6157
- if (translations[currentLanguage]) return translations[currentLanguage];
6158
- var nonLocaleLang = currentLanguage.split('-')[0];
6159
- if (translations[nonLocaleLang]) return translations[nonLocaleLang];
6105
+ function IdCaptureDetectedObjectDebugBox(_a) {
6106
+ var obj = _a.obj,
6107
+ flipX = _a.flipX,
6108
+ _b = _a.color,
6109
+ color = _b === void 0 ? 'green' : _b,
6110
+ scaling = _a.scaling;
6111
+ var horizontal = scaling.horizontal,
6112
+ pageWidth = scaling.pageWidth,
6113
+ pageHeight = scaling.pageHeight,
6114
+ videoWidth = scaling.videoWidth,
6115
+ videoHeight = scaling.videoHeight,
6116
+ scaledWidth = scaling.scaledWidth,
6117
+ scaledHeight = scaling.scaledHeight,
6118
+ xOffset = scaling.xOffset,
6119
+ yOffset = scaling.yOffset;
6120
+ if (!videoWidth || !videoHeight || !pageWidth || !pageHeight) return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null);
6121
+ var top;
6122
+ var left;
6123
+ var width;
6124
+ var height;
6125
+ if (horizontal) {
6126
+ top = obj.box.yMin / videoHeight * pageHeight;
6127
+ left = obj.box.xMin / videoWidth * scaledWidth - xOffset;
6128
+ width = obj.box.width / videoWidth * scaledWidth;
6129
+ height = obj.box.height / videoHeight * pageHeight;
6130
+ } else {
6131
+ top = obj.box.yMin / videoHeight * scaledHeight - yOffset;
6132
+ left = obj.box.xMin / videoWidth * pageWidth;
6133
+ width = obj.box.width / videoWidth * pageWidth;
6134
+ height = obj.box.height / videoHeight * scaledHeight;
6160
6135
  }
6161
- return t(fallback);
6136
+ return /*#__PURE__*/React__namespace.default.createElement(ObjectDetectionDebugBox, {
6137
+ "$flipX": flipX,
6138
+ "$color": color,
6139
+ style: {
6140
+ top: top,
6141
+ left: left,
6142
+ width: width,
6143
+ height: height
6144
+ }
6145
+ });
6162
6146
  }
6163
- function useVerbiage(verbiage, fallback) {
6164
- var _a = reactI18next.useTranslation(),
6165
- t = _a.t,
6166
- i18n = _a.i18n;
6167
- return React.useMemo(function () {
6168
- return evaluateVerbiage(t, i18n.language, verbiage, fallback);
6169
- }, [fallback, i18n.language, t, verbiage]);
6147
+ function SelfieCaptureFaceDebugBox(_a) {
6148
+ var face = _a.face,
6149
+ flipX = _a.flipX,
6150
+ _b = _a.color,
6151
+ color = _b === void 0 ? 'green' : _b,
6152
+ scaling = _a.scaling;
6153
+ var horizontal = scaling.horizontal,
6154
+ pageWidth = scaling.pageWidth,
6155
+ pageHeight = scaling.pageHeight,
6156
+ videoWidth = scaling.videoWidth,
6157
+ videoHeight = scaling.videoHeight,
6158
+ scaledWidth = scaling.scaledWidth,
6159
+ scaledHeight = scaling.scaledHeight,
6160
+ xOffset = scaling.xOffset,
6161
+ yOffset = scaling.yOffset;
6162
+ if (!videoWidth || !videoHeight || !pageWidth || !pageHeight) return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null);
6163
+ var top;
6164
+ var left;
6165
+ var width;
6166
+ var height;
6167
+ if (horizontal) {
6168
+ top = face.box.yMin / videoHeight * pageHeight;
6169
+ left = face.box.xMin / videoWidth * scaledWidth - xOffset;
6170
+ width = face.box.width / videoWidth * scaledWidth;
6171
+ height = face.box.height / videoHeight * pageHeight;
6172
+ } else {
6173
+ top = face.box.yMin / videoHeight * scaledHeight - yOffset;
6174
+ left = face.box.xMin / videoWidth * pageWidth;
6175
+ width = face.box.width / videoWidth * pageWidth;
6176
+ height = face.box.height / videoHeight * scaledHeight;
6177
+ }
6178
+ return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, /*#__PURE__*/React__namespace.default.createElement(ObjectDetectionDebugBox, {
6179
+ "$flipX": flipX,
6180
+ "$color": color,
6181
+ style: {
6182
+ top: top,
6183
+ left: left,
6184
+ width: width,
6185
+ height: height
6186
+ }
6187
+ }), face.keypoints.map(function (point, ii) {
6188
+ return /*#__PURE__*/React__namespace.default.createElement(SelfieCaptureFaceKeypoint, {
6189
+ key: ii,
6190
+ point: point,
6191
+ scaling: scaling,
6192
+ flipX: flipX
6193
+ });
6194
+ }));
6170
6195
  }
6171
- function useTranslations(verbiage, fallbacks) {
6172
- var _a = reactI18next.useTranslation(),
6173
- t = _a.t,
6174
- i18n = _a.i18n;
6175
- return React.useMemo(function () {
6176
- return _assign(_assign({}, verbiage), Object.keys(fallbacks).reduce(function (result, key) {
6177
- var _a;
6178
- return _assign(_assign({}, result), (_a = {}, _a[key] = evaluateVerbiage(t, i18n.language, verbiage === null || verbiage === void 0 ? void 0 : verbiage[key], fallbacks[key]), _a));
6179
- }, {}));
6180
- }, [fallbacks, i18n.language, t, verbiage]);
6196
+ function SelfieCaptureFaceKeypoint(_a) {
6197
+ var point = _a.point,
6198
+ flipX = _a.flipX,
6199
+ _b = _a.color,
6200
+ color = _b === void 0 ? 'red' : _b,
6201
+ _c = _a.scaling,
6202
+ horizontal = _c.horizontal,
6203
+ pageWidth = _c.pageWidth,
6204
+ pageHeight = _c.pageHeight,
6205
+ videoWidth = _c.videoWidth,
6206
+ videoHeight = _c.videoHeight,
6207
+ scaledWidth = _c.scaledWidth,
6208
+ scaledHeight = _c.scaledHeight,
6209
+ xOffset = _c.xOffset,
6210
+ yOffset = _c.yOffset;
6211
+ var left, top;
6212
+ if (horizontal) {
6213
+ left = point.x / videoWidth * scaledWidth - xOffset;
6214
+ top = point.y / videoHeight * pageHeight;
6215
+ } else {
6216
+ left = point.x / videoWidth * pageWidth;
6217
+ top = point.y / videoHeight * scaledHeight - yOffset;
6218
+ }
6219
+ top -= 2;
6220
+ left -= 2;
6221
+ return /*#__PURE__*/React__namespace.default.createElement(FaceDetectionKeypointMarker, {
6222
+ "$flipX": flipX,
6223
+ "$color": color,
6224
+ style: {
6225
+ top: top,
6226
+ left: left
6227
+ }
6228
+ });
6181
6229
  }
6230
+ var templateObject_1$G, templateObject_2$z, templateObject_3$q, templateObject_4$k;
6182
6231
 
6183
6232
  var GuidanceMessageContainerDiv = styled__default.default.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) {
6184
6233
  var $top = _a.$top;
@@ -13782,9 +13831,10 @@ function VideoSignatureWizardGuides(_a) {
13782
13831
  });
13783
13832
  }
13784
13833
  var VideoSignatureWizardWithProviders = function VideoSignatureWizardWithProviders(props) {
13785
- var _a = React.useState(0),
13786
- attempts = _a[0],
13787
- setAttempts = _a[1];
13834
+ var _a, _b;
13835
+ var _c = React.useState(0),
13836
+ attempts = _c[0],
13837
+ setAttempts = _c[1];
13788
13838
  var onRetryClickedProp = props.onRetryClicked;
13789
13839
  var onRetryClicked = React.useCallback(function () {
13790
13840
  setAttempts(function (n) {
@@ -13800,7 +13850,10 @@ var VideoSignatureWizardWithProviders = function VideoSignatureWizardWithProvide
13800
13850
  maxVideoWidth: 1280,
13801
13851
  maxFps: 30,
13802
13852
  onCameraAccessDenied: props.onCameraAccessDenied,
13803
- onMicrophoneAccessDenied: props.onMicrophoneAccessDenied
13853
+ onCameraTamperingDetected: props.onCameraTamperingDetected,
13854
+ onMicrophoneAccessDenied: props.onMicrophoneAccessDenied,
13855
+ classNames: (_a = props.classNames) === null || _a === void 0 ? void 0 : _a.cameraStoreProvider,
13856
+ verbiage: (_b = props.verbiage) === null || _b === void 0 ? void 0 : _b.cameraStoreProvider
13804
13857
  }, /*#__PURE__*/React__namespace.default.createElement(SelfieGuidanceModelsProvider, {
13805
13858
  autoStart: false,
13806
13859
  throttleMs: 250,
@@ -14639,6 +14692,7 @@ var VideoIdWizard = function VideoIdWizard(_a) {
14639
14692
  onUserCancel = _a.onUserCancel,
14640
14693
  onIdCaptureModelError = _a.onIdCaptureModelError,
14641
14694
  onCameraAccessDenied = _a.onCameraAccessDenied,
14695
+ onCameraTamperingDetected = _a.onCameraTamperingDetected,
14642
14696
  onMicrophoneAccessDenied = _a.onMicrophoneAccessDenied,
14643
14697
  _l = _a.idCaptureProps,
14644
14698
  idCaptureProps = _l === void 0 ? {} : _l,
@@ -14797,7 +14851,10 @@ var VideoIdWizard = function VideoIdWizard(_a) {
14797
14851
  maxVideoWidth: isCapturingId ? 1920 : 1280,
14798
14852
  maxFps: isCapturingId ? 60 : 30,
14799
14853
  onCameraAccessDenied: onCameraAccessDenied,
14800
- onMicrophoneAccessDenied: onMicrophoneAccessDenied
14854
+ onCameraTamperingDetected: onCameraTamperingDetected,
14855
+ onMicrophoneAccessDenied: onMicrophoneAccessDenied,
14856
+ classNames: classNames === null || classNames === void 0 ? void 0 : classNames.cameraStoreProvider,
14857
+ verbiage: verbiage === null || verbiage === void 0 ? void 0 : verbiage.cameraStoreProvider
14801
14858
  }, /*#__PURE__*/React__namespace.default.createElement(IdCaptureModelsProvider, {
14802
14859
  autoStart: false,
14803
14860
  documentDetectionModelUrl: (_g = (_f = idCaptureProps.assets) === null || _f === void 0 ? void 0 : _f.documentDetectionModelUrl) !== null && _g !== void 0 ? _g : '',
@@ -14908,35 +14965,36 @@ var VideoIdWizard = function VideoIdWizard(_a) {
14908
14965
  };
14909
14966
 
14910
14967
  function CompositeWizard(_a) {
14911
- var _b, _c, _d, _e, _f;
14968
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k;
14912
14969
  var userChecks = _a.checks,
14913
- _g = _a.idCaptureProps,
14914
- idCaptureProps = _g === void 0 ? {} : _g,
14915
- _h = _a.faceLivenessProps,
14916
- faceLivenessProps = _h === void 0 ? {} : _h,
14970
+ _l = _a.idCaptureProps,
14971
+ idCaptureProps = _l === void 0 ? {} : _l,
14972
+ _m = _a.faceLivenessProps,
14973
+ faceLivenessProps = _m === void 0 ? {} : _m,
14917
14974
  additionalDocumentCaptureProps = _a.additionalDocumentCaptureProps,
14918
- _j = _a.signatureCaptureProps,
14919
- signatureCaptureProps = _j === void 0 ? {} : _j,
14920
- _k = _a.videoSignatureCaptureProps,
14921
- videoSignatureCaptureProps = _k === void 0 ? {} : _k,
14922
- _l = _a.videoIdCaptureProps,
14923
- videoIdCaptureProps = _l === void 0 ? {} : _l,
14924
- _m = _a.captureSignature,
14925
- captureSignature = _m === void 0 ? false : _m,
14926
- _o = _a.captureSignatureVideo,
14927
- captureSignatureVideo = _o === void 0 ? false : _o,
14975
+ _o = _a.signatureCaptureProps,
14976
+ signatureCaptureProps = _o === void 0 ? {} : _o,
14977
+ _p = _a.videoSignatureCaptureProps,
14978
+ videoSignatureCaptureProps = _p === void 0 ? {} : _p,
14979
+ _q = _a.videoIdCaptureProps,
14980
+ videoIdCaptureProps = _q === void 0 ? {} : _q,
14981
+ _r = _a.captureSignature,
14982
+ captureSignature = _r === void 0 ? false : _r,
14983
+ _s = _a.captureSignatureVideo,
14984
+ captureSignatureVideo = _s === void 0 ? false : _s,
14928
14985
  onCameraAccessDenied = _a.onCameraAccessDenied,
14986
+ onCameraTamperingDetected = _a.onCameraTamperingDetected,
14929
14987
  onMicrophoneAccessDenied = _a.onMicrophoneAccessDenied,
14930
- _p = _a.debugMode,
14931
- debugMode = _p === void 0 ? false : _p;
14932
- var _q = React.useContext(SubmissionContext),
14933
- submit = _q.submit,
14934
- submissionStatus = _q.submissionStatus,
14935
- setSignatureData = _q.setSignatureData,
14936
- setAdditionalDocuments = _q.setAdditionalDocuments;
14937
- var _r = React.useState(0),
14938
- checkIndex = _r[0],
14939
- setCheckIndex = _r[1];
14988
+ _t = _a.debugMode,
14989
+ debugMode = _t === void 0 ? false : _t;
14990
+ var _u = React.useContext(SubmissionContext),
14991
+ submit = _u.submit,
14992
+ submissionStatus = _u.submissionStatus,
14993
+ setSignatureData = _u.setSignatureData,
14994
+ setAdditionalDocuments = _u.setAdditionalDocuments;
14995
+ var _v = React.useState(0),
14996
+ checkIndex = _v[0],
14997
+ setCheckIndex = _v[1];
14940
14998
  var checks = React.useMemo(function () {
14941
14999
  var _a, _b;
14942
15000
  var checks = __spreadArray([], userChecks, true);
@@ -15047,13 +15105,16 @@ function CompositeWizard(_a) {
15047
15105
  case 'IdCapture':
15048
15106
  return /*#__PURE__*/React__namespace.default.createElement(CameraStoreProvider, {
15049
15107
  onCameraAccessDenied: onCameraAccessDenied,
15108
+ onCameraTamperingDetected: onCameraTamperingDetected,
15050
15109
  onMicrophoneAccessDenied: onMicrophoneAccessDenied,
15051
- requestAccessAutomatically: shouldLoadIdCaptureModels
15110
+ requestAccessAutomatically: shouldLoadIdCaptureModels,
15111
+ classNames: (_c = idCaptureProps.classNames) === null || _c === void 0 ? void 0 : _c.cameraStoreProvider,
15112
+ verbiage: (_d = idCaptureProps.verbiage) === null || _d === void 0 ? void 0 : _d.cameraStoreProvider
15052
15113
  }, /*#__PURE__*/React__namespace.default.createElement(IdCaptureModelsProvider, {
15053
15114
  autoStart: false,
15054
15115
  shouldLoadModels: shouldLoadIdCaptureModels,
15055
- documentDetectionModelUrl: (_d = (_c = idCaptureProps.assets) === null || _c === void 0 ? void 0 : _c.documentDetectionModelUrl) !== null && _d !== void 0 ? _d : '',
15056
- focusModelUrl: (_f = (_e = idCaptureProps.assets) === null || _e === void 0 ? void 0 : _e.focusModelUrl) !== null && _f !== void 0 ? _f : '',
15116
+ documentDetectionModelUrl: (_f = (_e = idCaptureProps.assets) === null || _e === void 0 ? void 0 : _e.documentDetectionModelUrl) !== null && _f !== void 0 ? _f : '',
15117
+ focusModelUrl: (_h = (_g = idCaptureProps.assets) === null || _g === void 0 ? void 0 : _g.focusModelUrl) !== null && _h !== void 0 ? _h : '',
15057
15118
  onModelError: idCaptureProps.onModelError,
15058
15119
  modelLoadTimeoutMs: idCaptureProps.modelLoadTimeoutMs,
15059
15120
  allowSinglePageIdCapture: idCaptureProps.allowSinglePageIdCapture
@@ -15064,6 +15125,7 @@ function CompositeWizard(_a) {
15064
15125
  return /*#__PURE__*/React__namespace.default.createElement(VideoIdWizard, _assign({}, videoIdCaptureProps, {
15065
15126
  onComplete: onVideoIdCaptureComplete,
15066
15127
  onCameraAccessDenied: onCameraAccessDenied,
15128
+ onCameraTamperingDetected: onCameraTamperingDetected,
15067
15129
  onMicrophoneAccessDenied: onMicrophoneAccessDenied
15068
15130
  }));
15069
15131
  case 'FaceLiveness':
@@ -15071,7 +15133,10 @@ function CompositeWizard(_a) {
15071
15133
  preferFrontFacingCamera: true,
15072
15134
  preferIphoneContinuityCamera: false,
15073
15135
  onCameraAccessDenied: onCameraAccessDenied,
15074
- onMicrophoneAccessDenied: onMicrophoneAccessDenied
15136
+ onCameraTamperingDetected: onCameraTamperingDetected,
15137
+ onMicrophoneAccessDenied: onMicrophoneAccessDenied,
15138
+ classNames: (_j = faceLivenessProps.classNames) === null || _j === void 0 ? void 0 : _j.cameraStoreProvider,
15139
+ verbiage: (_k = faceLivenessProps.verbiage) === null || _k === void 0 ? void 0 : _k.cameraStoreProvider
15075
15140
  }, /*#__PURE__*/React__namespace.default.createElement(SelfieGuidanceModelsProvider, {
15076
15141
  autoStart: false,
15077
15142
  onModelError: faceLivenessProps.onModelError,
@@ -15087,6 +15152,7 @@ function CompositeWizard(_a) {
15087
15152
  return /*#__PURE__*/React__namespace.default.createElement(VideoSignatureWizardWithProviders, _assign({}, videoSignatureCaptureProps, {
15088
15153
  onComplete: onVideoSignatureComplete,
15089
15154
  onCameraAccessDenied: onCameraAccessDenied,
15155
+ onCameraTamperingDetected: onCameraTamperingDetected,
15090
15156
  onMicrophoneAccessDenied: onMicrophoneAccessDenied
15091
15157
  }));
15092
15158
  case 'AdditionalDocumentCapture':
@@ -15416,6 +15482,7 @@ var IdValidation = function IdValidation(_a) {
15416
15482
  onUserCancel = _a.onUserCancel,
15417
15483
  onModelError = _a.onModelError,
15418
15484
  onCameraAccessDenied = _a.onCameraAccessDenied,
15485
+ onCameraTamperingDetected = _a.onCameraTamperingDetected,
15419
15486
  _u = _a.theme,
15420
15487
  theme = _u === void 0 ? 'default' : _u,
15421
15488
  _v = _a.assets,
@@ -15557,6 +15624,7 @@ var IdValidation = function IdValidation(_a) {
15557
15624
  captureSignature: captureSignature,
15558
15625
  captureSignatureVideo: captureSignatureVideo,
15559
15626
  onCameraAccessDenied: onCameraAccessDenied,
15627
+ onCameraTamperingDetected: onCameraTamperingDetected,
15560
15628
  debugMode: debugMode
15561
15629
  }))));
15562
15630
  };
@@ -15611,6 +15679,7 @@ var FaceValidation = function FaceValidation(_a) {
15611
15679
  onUserCancel = _a.onUserCancel,
15612
15680
  onModelError = _a.onModelError,
15613
15681
  onCameraAccessDenied = _a.onCameraAccessDenied,
15682
+ onCameraTamperingDetected = _a.onCameraTamperingDetected,
15614
15683
  _j = _a.theme,
15615
15684
  theme = _j === void 0 ? 'default' : _j,
15616
15685
  assets = _a.assets,
@@ -15686,6 +15755,7 @@ var FaceValidation = function FaceValidation(_a) {
15686
15755
  }, []),
15687
15756
  faceLivenessProps: faceLivenessProps,
15688
15757
  onCameraAccessDenied: onCameraAccessDenied,
15758
+ onCameraTamperingDetected: onCameraTamperingDetected,
15689
15759
  debugMode: debugMode
15690
15760
  }))));
15691
15761
  };
@@ -15782,6 +15852,7 @@ var IdAndFaceValidation = function IdAndFaceValidation(_a) {
15782
15852
  onIdCaptureModelError = _a.onIdCaptureModelError,
15783
15853
  onSelfieCaptureModelError = _a.onSelfieCaptureModelError,
15784
15854
  onCameraAccessDenied = _a.onCameraAccessDenied,
15855
+ onCameraTamperingDetected = _a.onCameraTamperingDetected,
15785
15856
  _y = _a.captureSignature,
15786
15857
  captureSignature = _y === void 0 ? false : _y,
15787
15858
  _z = _a.captureSignatureVideo,
@@ -15945,6 +16016,7 @@ var IdAndFaceValidation = function IdAndFaceValidation(_a) {
15945
16016
  captureSignature: captureSignature,
15946
16017
  captureSignatureVideo: captureSignatureVideo,
15947
16018
  onCameraAccessDenied: onCameraAccessDenied,
16019
+ onCameraTamperingDetected: onCameraTamperingDetected,
15948
16020
  debugMode: debugMode
15949
16021
  }))));
15950
16022
  };
@@ -16044,6 +16116,7 @@ var CustomerIdAndBiometricsEnrollment = function CustomerIdAndBiometricsEnrollme
16044
16116
  onIdCaptureModelError = _a.onIdCaptureModelError,
16045
16117
  onSelfieCaptureModelError = _a.onSelfieCaptureModelError,
16046
16118
  onCameraAccessDenied = _a.onCameraAccessDenied,
16119
+ onCameraTamperingDetected = _a.onCameraTamperingDetected,
16047
16120
  _y = _a.captureSignature,
16048
16121
  captureSignature = _y === void 0 ? false : _y,
16049
16122
  _z = _a.captureSignatureVideo,
@@ -16229,6 +16302,7 @@ var CustomerIdAndBiometricsEnrollment = function CustomerIdAndBiometricsEnrollme
16229
16302
  captureSignature: captureSignature,
16230
16303
  captureSignatureVideo: captureSignatureVideo,
16231
16304
  onCameraAccessDenied: onCameraAccessDenied,
16305
+ onCameraTamperingDetected: onCameraTamperingDetected,
16232
16306
  debugMode: debugMode
16233
16307
  }))));
16234
16308
  };
@@ -16738,6 +16812,7 @@ var CustomerVerification = function CustomerVerification(_a) {
16738
16812
  onUserCancel = _a.onUserCancel,
16739
16813
  onModelError = _a.onModelError,
16740
16814
  onCameraAccessDenied = _a.onCameraAccessDenied,
16815
+ onCameraTamperingDetected = _a.onCameraTamperingDetected,
16741
16816
  _h = _a.geolocationEnabled,
16742
16817
  geolocationEnabled = _h === void 0 ? true : _h,
16743
16818
  _j = _a.geolocationRequired,
@@ -16779,7 +16854,10 @@ var CustomerVerification = function CustomerVerification(_a) {
16779
16854
  useDocumentServiceForLivenessChecks: useDocumentServiceForLivenessChecks
16780
16855
  }, /*#__PURE__*/React__namespace.default.createElement(CameraStoreProvider, {
16781
16856
  preferFrontFacingCamera: true,
16782
- onCameraAccessDenied: onCameraAccessDenied
16857
+ onCameraAccessDenied: onCameraAccessDenied,
16858
+ onCameraTamperingDetected: onCameraTamperingDetected,
16859
+ classNames: classNames === null || classNames === void 0 ? void 0 : classNames.cameraStoreProvider,
16860
+ verbiage: verbiage === null || verbiage === void 0 ? void 0 : verbiage.cameraStoreProvider
16783
16861
  }, /*#__PURE__*/React__namespace.default.createElement(SelfieGuidanceModelsProvider, {
16784
16862
  autoStart: false,
16785
16863
  onModelError: onModelError,
@@ -17299,6 +17377,7 @@ var CustomerIdentification = function CustomerIdentification(_a) {
17299
17377
  onUserCancel = _a.onUserCancel,
17300
17378
  onModelError = _a.onModelError,
17301
17379
  onCameraAccessDenied = _a.onCameraAccessDenied,
17380
+ onCameraTamperingDetected = _a.onCameraTamperingDetected,
17302
17381
  _g = _a.theme,
17303
17382
  theme = _g === void 0 ? 'default' : _g,
17304
17383
  assets = _a.assets,
@@ -17344,7 +17423,10 @@ var CustomerIdentification = function CustomerIdentification(_a) {
17344
17423
  useDocumentServiceForLivenessChecks: useDocumentServiceForLivenessChecks
17345
17424
  }, /*#__PURE__*/React__namespace.default.createElement(CameraStoreProvider, {
17346
17425
  preferFrontFacingCamera: true,
17347
- onCameraAccessDenied: onCameraAccessDenied
17426
+ onCameraAccessDenied: onCameraAccessDenied,
17427
+ onCameraTamperingDetected: onCameraTamperingDetected,
17428
+ classNames: classNames === null || classNames === void 0 ? void 0 : classNames.cameraStoreProvider,
17429
+ verbiage: verbiage === null || verbiage === void 0 ? void 0 : verbiage.cameraStoreProvider
17348
17430
  }, /*#__PURE__*/React__namespace.default.createElement(SelfieGuidanceModelsProvider, {
17349
17431
  autoStart: false,
17350
17432
  modelLoadTimeoutMs: modelLoadTimeoutMs,
@@ -17392,6 +17474,7 @@ var SignatureKYC = function SignatureKYC(_a) {
17392
17474
  onUserCancel = _a.onUserCancel,
17393
17475
  onModelError = _a.onModelError,
17394
17476
  onCameraAccessDenied = _a.onCameraAccessDenied,
17477
+ onCameraTamperingDetected = _a.onCameraTamperingDetected,
17395
17478
  onLoadingOverlayDismissed = _a.onLoadingOverlayDismissed,
17396
17479
  _c = _a.loadingOverlayMode,
17397
17480
  loadingOverlayMode = _c === void 0 ? 'default' : _c,
@@ -17450,6 +17533,7 @@ var SignatureKYC = function SignatureKYC(_a) {
17450
17533
  return ['VideoSignatureCapture'];
17451
17534
  }, []),
17452
17535
  onCameraAccessDenied: onCameraAccessDenied,
17536
+ onCameraTamperingDetected: onCameraTamperingDetected,
17453
17537
  videoSignatureCaptureProps: React.useMemo(function () {
17454
17538
  return {
17455
17539
  customOverlayContent: customOverlayContent,
@@ -17518,6 +17602,7 @@ var VideoIdValidation = function VideoIdValidation(_a) {
17518
17602
  onExitAfterFailure = _a.onExitAfterFailure,
17519
17603
  onUserCancel = _a.onUserCancel,
17520
17604
  onCameraAccessDenied = _a.onCameraAccessDenied,
17605
+ onCameraTamperingDetected = _a.onCameraTamperingDetected,
17521
17606
  onMicrophoneAccessDenied = _a.onMicrophoneAccessDenied,
17522
17607
  idCaptureProps = _a.idCaptureProps,
17523
17608
  faceLivenessProps = _a.faceLivenessProps,
@@ -17701,6 +17786,7 @@ var VideoIdValidation = function VideoIdValidation(_a) {
17701
17786
  captureSignature: captureSignature,
17702
17787
  captureSignatureVideo: captureSignatureVideo,
17703
17788
  onCameraAccessDenied: onCameraAccessDenied,
17789
+ onCameraTamperingDetected: onCameraTamperingDetected,
17704
17790
  onMicrophoneAccessDenied: onMicrophoneAccessDenied,
17705
17791
  debugMode: debugMode
17706
17792
  }))));
@@ -17756,6 +17842,7 @@ var CustomerBiometricsEnrollment = function CustomerBiometricsEnrollment(_a) {
17756
17842
  onUserCancel = _a.onUserCancel,
17757
17843
  onModelError = _a.onModelError,
17758
17844
  onCameraAccessDenied = _a.onCameraAccessDenied,
17845
+ onCameraTamperingDetected = _a.onCameraTamperingDetected,
17759
17846
  _h = _a.captureAdditionalDocuments,
17760
17847
  captureAdditionalDocuments = _h === void 0 ? [] : _h,
17761
17848
  _j = _a.captureSignature,
@@ -17877,6 +17964,7 @@ var CustomerBiometricsEnrollment = function CustomerBiometricsEnrollment(_a) {
17877
17964
  captureSignature: captureSignature,
17878
17965
  captureSignatureVideo: captureSignatureVideo,
17879
17966
  onCameraAccessDenied: onCameraAccessDenied,
17967
+ onCameraTamperingDetected: onCameraTamperingDetected,
17880
17968
  debugMode: debugMode
17881
17969
  }))));
17882
17970
  };
@@ -17904,6 +17992,7 @@ var DocumentCapture = function DocumentCapture(_a) {
17904
17992
  onExitCapture = _a.onExitCapture,
17905
17993
  onUserCancel = _a.onUserCancel,
17906
17994
  onCameraAccessDenied = _a.onCameraAccessDenied,
17995
+ onCameraTamperingDetected = _a.onCameraTamperingDetected,
17907
17996
  _c = _a.documents,
17908
17997
  documents = _c === void 0 ? [] : _c,
17909
17998
  aspectRatio = _a.aspectRatio,
@@ -17946,7 +18035,10 @@ var DocumentCapture = function DocumentCapture(_a) {
17946
18035
  }, /*#__PURE__*/React__namespace.default.createElement(CameraStoreProvider, {
17947
18036
  requestAccessAutomatically: false,
17948
18037
  preferIphoneContinuityCamera: true,
17949
- onCameraAccessDenied: onCameraAccessDenied
18038
+ onCameraAccessDenied: onCameraAccessDenied,
18039
+ onCameraTamperingDetected: onCameraTamperingDetected,
18040
+ classNames: classNames === null || classNames === void 0 ? void 0 : classNames.cameraStoreProvider,
18041
+ verbiage: verbiage === null || verbiage === void 0 ? void 0 : verbiage.cameraStoreProvider
17950
18042
  }, /*#__PURE__*/React__namespace.default.createElement(DocumentCaptureWizard, {
17951
18043
  onSuccess: onComplete,
17952
18044
  onExitCapture: onExitCapture,