idmission-web-sdk 1.0.309 → 1.0.310
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/video_id/IdVideoCapture.d.ts +3 -0
- package/dist/components/video_id/IdVideoCaptureFlipIdPrompt.d.ts +3 -9
- package/dist/components/video_id/IdVideoCaptureGuides.d.ts +551 -1
- package/dist/sdk2.cjs.development.js +192 -309
- package/dist/sdk2.cjs.development.js.map +1 -1
- package/dist/sdk2.cjs.production.js +1 -1
- package/dist/sdk2.cjs.production.js.map +1 -1
- package/dist/sdk2.esm.js +192 -309
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +192 -309
- package/dist/sdk2.umd.development.js.map +1 -1
- package/dist/sdk2.umd.production.js +1 -1
- package/dist/sdk2.umd.production.js.map +1 -1
- package/dist/stories/Components/{VideoIdCaptureGuideOverlay/IdCardFront.stories.d.ts → VideoIdCaptureGuideOverlay.stories.d.ts} +19 -3
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
- package/dist/stories/Components/VideoIdCaptureGuideOverlay/FlipIdCard.stories.d.ts +0 -34
- package/dist/stories/Components/VideoIdCaptureGuideOverlay/IdCardBack.stories.d.ts +0 -21
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-dom/client"),require("platform"),require("styled-components"),require("@tensorflow/tfjs"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","react-dom/client","platform","styled-components","@tensorflow/tfjs","react-dom"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Sdk2={},e.React,e.ReactDOM,e.platform,e.styled,e.tf,e.ReactDOM)}(this,(function(e,t,n,a,r,i,o){"use strict";function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function l(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,a.get?a:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var u=s(t),d=l(t),c=l(n),f=s(a),h=s(r),p=l(i),m=function(e,t){return m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},m(e,t)};function g(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}m(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var v=function(){return v=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},v.apply(this,arguments)};function y(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(a=Object.getOwnPropertySymbols(e);r<a.length;r++)t.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(e,a[r])&&(n[a[r]]=e[a[r]])}return n}function b(e,t,n,a){return new(n||(n=Promise))((function(r,i){function o(e){try{l(a.next(e))}catch(e){i(e)}}function s(e){try{l(a.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}l((a=a.apply(e,t||[])).next())}))}function x(e,t){var n,a,r,i,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(l){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(o=0)),o;)try{if(n=1,a&&(r=2&s[0]?a.return:s[0]?a.throw||((r=a.return)&&r.call(a),0):a.next)&&!(r=r.call(a,s[1])).done)return r;switch(a=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,a=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],a=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}function C(e,t,n){if(n||2===arguments.length)for(var a,r=0,i=t.length;r<i;r++)!a&&r in t||(a||(a=Array.prototype.slice.call(t,0,r)),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}function w(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var E,k,T="1.0.309";function M(){return"undefined"!=typeof window&&void 0!==window.platform?window.platform:f.default}function I(e){return b(this,void 0,void 0,(function(){return x(this,(function(t){return[2,e.replace(/^data:image\/(png|jpeg);base64,/,"")]}))}))}function S(e){return e.replace(/^data:.*;base64,/,"")}function D(e){var t,n;return null!==(n=null===(t=e.match(/^(data:.*;base64),/))||void 0===t?void 0:t[1])&&void 0!==n?n:""}!function(e){e.NONE="NONE",e.ENROLL="ENROLL",e.IDENTIFY="IDENTIFY",e.VALIDATE="VALIDATE",e.VERIFY="VERIFY"}(E||(E={})),function(e){e.READY="READY",e.SUBMITTING="SUBMITTING",e.SUBMITTED="SUBMITTED",e.FAILED="FAILED"}(k||(k={}));var N={prod:"https://api.idmission.com",demo:"https://apidemo.idmission.com"};function A(e){var t=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),n=decodeURIComponent(window.atob(t).split("").map((function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)})).join(""));return JSON.parse(n)}function L(e,t){if(t)switch(A(t).iss){case"https://auth.idmission.com/auth/realms/identity":return N.prod;case"https://demoauth.idmission.com/auth/realms/identity":return N.demo}var n=N[e];if(!n)throw new Error("unrecognized SubmissionEnvironment ".concat(e));return n}function R(e){var t={"Content-Type":"application/json",Origin:"*"};return e&&(t.Authorization="Bearer ".concat(e)),t}function O(e,t){var n,a,r=t.geolocationResult,i={selfie:t.selfieCaptureAttempts,front:t.idFrontCaptureAttempts,back:t.idBackCaptureAttempts,isRealIDCheckRequired:"false",sdkVersion:"WebSDK_".concat(T),Resolution:"undefined"!=typeof window?"".concat(window.innerWidth," x ").concat(window.innerHeight):"unknown"},o=M();o&&(i.os=null===(n=o.os)||void 0===n?void 0:n.family,i.osVersion=null===(a=o.os)||void 0===a?void 0:a.version,i.browserVersion="".concat(o.name," ").concat(o.version)),r&&(i.GeoLocation=JSON.stringify(r)),e.additionalData.metadata=JSON.stringify(i)}function F(e){return new Promise((function(t){var n=new FileReader;n.onloadend=function(){t(S(n.result))},fetch(e).then((function(e){return e.blob()})).then((function(e){return n.readAsDataURL(e)}))}))}var j,P=h.default.div(j||(j=w(["\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(e){var t;return!1===e.theme.isFullscreen?"":"\n position: fixed;\n top: 0;\n left: 0;\n width: var(--app-width);\n height: calc(\n var(--app-height) - ".concat(null!==(t=e.$heightOffset)&&void 0!==t?t:0,"px\n );\n overflow-x: hidden;\n overflow-y: auto;\n ")}),(function(e){return e.theme.fontFamily?"font-family: ".concat(e.theme.fontFamily,";"):""})),B=t.forwardRef((function(e,n){var a=e.children,r=e.className,i=e.heightOffset,o=void 0===i?0:i,s=e.style,l=e.onClick,d=t.useState(!1),c=d[0],f=d[1];return t.useEffect((function(){if("undefined"!=typeof window){f(!1);var e=function(){var e=document.documentElement;e.style.setProperty("--app-width","".concat(window.innerWidth,"px")),e.style.setProperty("--app-height","".concat(window.innerHeight,"px"))};return window.addEventListener("resize",e),e(),f(!0),function(){window.removeEventListener("resize",e)}}}),[]),u.default.createElement(P,{ref:n,style:s,onClick:l,className:r,$heightOffset:o},c&&a)}));B.displayName="PageContainer";var _,U,z,G,W=h.default(B)(_||(_=w(["\n background: ",";\n ","\n z-index: 10000;\n"],["\n background: ",";\n ","\n z-index: 10000;\n"])),(function(e){return e.theme.background?"".concat(e.theme.background):"white"}),(function(e){return e.theme.textColor?"color: ".concat(e.theme.textColor,";"):""})),V=h.default.div(U||(U=w(["\n text-align: ",";\n display: flex;\n flex-direction: column;\n flex-wrap: nowrap;\n max-height: var(--app-height);\n height: 100%;\n ","\n"],["\n text-align: ",";\n display: flex;\n flex-direction: column;\n flex-wrap: nowrap;\n max-height: var(--app-height);\n height: 100%;\n ","\n"])),(function(e){var t;return null!==(t=e.theme.textAlign)&&void 0!==t?t:"center"}),(function(e){return e.theme.padding?"box-sizing: border-box; padding: ".concat(e.theme.padding,";"):""})),$=h.default.div(z||(z=w(["\n position: relative;\n display: flex;\n flex-grow: 1;\n padding-bottom: 25px;\n max-width: var(--app-width);\n max-height: var(--app-height);\n overflow: hidden;\n\n & > img,\n & > svg {\n margin: 0 auto;\n width: max-content;\n max-width: 100%;\n max-height: 100%;\n aspect-ratio: initial;\n object-fit: contain;\n display: block;\n }\n"],["\n position: relative;\n display: flex;\n flex-grow: 1;\n padding-bottom: 25px;\n max-width: var(--app-width);\n max-height: var(--app-height);\n overflow: hidden;\n\n & > img,\n & > svg {\n margin: 0 auto;\n width: max-content;\n max-width: 100%;\n max-height: 100%;\n aspect-ratio: initial;\n object-fit: contain;\n display: block;\n }\n"]))),q=h.default.div(G||(G=w(["\n display: flex;\n margin: auto;\n\n & > div {\n max-height: calc(100vh - 320px);\n\n & > img {\n width: 100%;\n max-height: 100%;\n height: auto;\n object-fit: contain;\n }\n }\n"],["\n display: flex;\n margin: auto;\n\n & > div {\n max-height: calc(100vh - 320px);\n\n & > img {\n width: 100%;\n max-height: 100%;\n height: auto;\n object-fit: contain;\n }\n }\n"])));"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function H(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Y(e,t){return e(t={exports:{}},t.exports),t.exports}const Z={};function Q(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];"string"==typeof t[0]&&Z[t[0]]||("string"==typeof t[0]&&(Z[t[0]]=new Date),function(){if(console&&console.warn){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];"string"==typeof t[0]&&(t[0]=`react-i18next:: ${t[0]}`),console.warn(...t)}}(...t))}const X=(e,t)=>()=>{if(e.isInitialized)t();else{const n=()=>{setTimeout((()=>{e.off("initialized",n)}),0),t()};e.on("initialized",n)}};function K(e,t,n){e.loadNamespaces(t,X(e,n))}function J(e,t,n,a){"string"==typeof n&&(n=[n]),n.forEach((t=>{e.options.ns.indexOf(t)<0&&e.options.ns.push(t)})),e.loadLanguages(t,X(e,a))}const ee=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,te={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},ne=e=>te[e];let ae,re={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:e=>e.replace(ee,ne)};const ie={type:"3rdParty",init(e){!function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};re={...re,...e}}(e.options.react),function(e){ae=e}(e)}},oe=t.createContext();class se{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach((e=>{this.usedNamespaces[e]||(this.usedNamespaces[e]=!0)}))}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const le=(e,n)=>{const a=t.useRef();return t.useEffect((()=>{a.current=n?a.current:e}),[e,n]),a.current};function ue(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{i18n:a}=n,{i18n:r,defaultNS:i}=t.useContext(oe)||{},o=a||r||ae;if(o&&!o.reportNamespaces&&(o.reportNamespaces=new se),!o){Q("You will need to pass in an i18next instance by using initReactI18next");const e=(e,t)=>"string"==typeof t?t:t&&"object"==typeof t&&"string"==typeof t.defaultValue?t.defaultValue:Array.isArray(e)?e[e.length-1]:e,t=[e,{},!1];return t.t=e,t.i18n={},t.ready=!1,t}o.options.react&&void 0!==o.options.react.wait&&Q("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const s={...re,...o.options.react,...n},{useSuspense:l,keyPrefix:u}=s;let d=e||i||o.options&&o.options.defaultNS;d="string"==typeof d?[d]:d||["translation"],o.reportNamespaces.addUsedNamespaces&&o.reportNamespaces.addUsedNamespaces(d);const c=(o.isInitialized||o.initializedStoreOnce)&&d.every((e=>function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t.languages&&t.languages.length?void 0!==t.options.ignoreJSONStructure?t.hasLoadedNamespace(e,{lng:n.lng,precheck:(t,a)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!a(t.isLanguageChangingTo,e))return!1}}):function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const a=t.languages[0],r=!!t.options&&t.options.fallbackLng,i=t.languages[t.languages.length-1];if("cimode"===a.toLowerCase())return!0;const o=(e,n)=>{const a=t.services.backendConnector.state[`${e}|${n}`];return-1===a||2===a};return!(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!o(t.isLanguageChangingTo,e)||!t.hasResourceBundle(a,e)&&t.services.backendConnector.backend&&(!t.options.resources||t.options.partialBundledLanguages)&&(!o(a,e)||r&&!o(i,e)))}(e,t,n):(Q("i18n.languages were undefined or empty",t.languages),!0)}(e,o,s)));function f(){return o.getFixedT(n.lng||null,"fallback"===s.nsMode?d:d[0],u)}const[h,p]=t.useState(f);let m=d.join();n.lng&&(m=`${n.lng}${m}`);const g=le(m),v=t.useRef(!0);t.useEffect((()=>{const{bindI18n:e,bindI18nStore:t}=s;function a(){v.current&&p(f)}return v.current=!0,c||l||(n.lng?J(o,n.lng,d,(()=>{v.current&&p(f)})):K(o,d,(()=>{v.current&&p(f)}))),c&&g&&g!==m&&v.current&&p(f),e&&o&&o.on(e,a),t&&o&&o.store.on(t,a),()=>{v.current=!1,e&&o&&e.split(" ").forEach((e=>o.off(e,a))),t&&o&&t.split(" ").forEach((e=>o.store.off(e,a)))}}),[o,m]);const y=t.useRef(!0);t.useEffect((()=>{v.current&&!y.current&&p(f),y.current=!1}),[o,u]);const b=[h,o,c];if(b.t=h,b.i18n=o,b.ready=c,c)return b;if(!c&&!l)return b;throw new Promise((e=>{n.lng?J(o,n.lng,d,(()=>e())):K(o,d,(()=>e()))}))}var de,ce=function(e){var n=e.children,a=e.className,r=e.colors,i=void 0===r?{}:r,o=e.disabled,s=e.finished,l=e.onClick,d=e.style,c=e.variant,f=void 0===c?"primary":c,h=t.useRef(null),p=t.useRef(null),m=t.useState(!1),g=m[0],v=m[1];return t.useEffect((function(){var e;return Promise.resolve().then((function(){return Uw})).then((function(t){if(h.current){p.current=t.create(h.current),p.current.start(),v(!0);var n=0;e=setInterval((function(){var e;n<.9&&(n+=.1),null===(e=p.current)||void 0===e||e.setProgress(n)}),250)}})),function(){var t;null===(t=p.current)||void 0===t||t.remove(),clearInterval(e)}}),[]),t.useEffect((function(){var e;g&&s&&(null===(e=p.current)||void 0===e||e.stop())}),[s,g]),u.default.createElement(fe,{className:"ladda-button ".concat(a),"data-style":"expand-right",disabled:o,ref:h,onClick:l,$backgroundColor:i.backgroundColor,$textColor:i.textColor,$disabledBackgroundColor:i.loadingBackgroundColor,$disabledTextColor:i.loadingTextColor,$variant:f,style:d},u.default.createElement("span",{className:"ladda-label"},n))},fe=h.default.button(de||(de=w(["\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 @keyframes ladda-spinner-line-fade {\n 0%,\n 100% {\n opacity: 0.22;\n }\n 1% {\n opacity: 1;\n }\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 @keyframes ladda-spinner-line-fade {\n 0%,\n 100% {\n opacity: 0.22;\n }\n 1% {\n opacity: 1;\n }\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(e){var t,n,a,r,i,o,s,l,u,d,c,f,h,p,m,g,v,y,b,x;return"bootstrap"===(null===(t=e.theme.buttons)||void 0===t?void 0:t.style)&&"\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(null!==(o=null!==(n=e.$textColor)&&void 0!==n?n:null===(i=null===(a=e.theme.buttons)||void 0===a?void 0:a[null!==(r=e.$variant)&&void 0!==r?r:"primary"])||void 0===i?void 0:i.textColor)&&void 0!==o?o:"#fff",";\n --bs-btn-bg: ").concat(null!==(c=null!==(s=e.$backgroundColor)&&void 0!==s?s:null===(d=null===(l=e.theme.buttons)||void 0===l?void 0:l[null!==(u=e.$variant)&&void 0!==u?u:"primary"])||void 0===d?void 0:d.backgroundColor)&&void 0!==c?c:"#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(null!==(m=null!==(f=e.$disabledTextColor)&&void 0!==f?f:null===(p=null===(h=e.theme.buttons)||void 0===h?void 0:h.loading)||void 0===p?void 0:p.textColor)&&void 0!==m?m:"#fff",";\n --bs-btn-disabled-bg: ").concat(null!==(b=null!==(g=e.$disabledBackgroundColor)&&void 0!==g?g:null===(y=null===(v=e.theme.buttons)||void 0===v?void 0:v.loading)||void 0===y?void 0:y.backgroundColor)&&void 0!==b?b:"gray",";\n --bs-btn-disabled-border-color: ").concat(null!==(x=e.$disabledBackgroundColor)&&void 0!==x?x:"#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 ")})),he=function(e){var n=e.accessBlockedImageUrl,a=ue().t,r=t.useContext(Ie).retryLocationAccess;return u.default.createElement(W,null,u.default.createElement("div",{style:{display:"flex",height:"100%"}},u.default.createElement(V,{style:{maxWidth:500,height:"auto",margin:"auto"}},u.default.createElement($,{style:{flexGrow:0}},u.default.createElement("img",{src:n,alt:""})),u.default.createElement("h3",null,a("Your location access is disabled")),u.default.createElement("p",{style:{lineHeight:1.5,marginBottom:50}},a("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.")),u.default.createElement(ce,{variant:"primary",onClick:r,style:{width:200,marginLeft:"auto",marginRight:"auto"},finished:!0},a("Retry")))))},pe=function(e){function t(t){var n=e.call(this,t.statusMessage)||this;return n.status=t,n}return g(t,e),t}(Error),me=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return g(t,e),t}(Error),ge=function(e){function t(t,n){var a=e.call(this,t.message)||this;return a.err=t,a.host=n,a}return g(t,e),t}(Error),ve=function(e){var t=e.error;return u.default.createElement(W,null,u.default.createElement(V,{style:{justifyContent:"center"}},t instanceof me?u.default.createElement(be,{error:t,onRetry:e.onRetry}):u.default.createElement(ye,{error:t})))},ye=function(e){var t=e.error,n=(0,ue().t)("We're sorry, an unexpected error has occurred.");return u.default.createElement(u.default.Fragment,null,u.default.createElement("h3",{style:{marginBottom:8}},n),t.status.statusCode&&u.default.createElement("p",{style:{marginBottom:0}},u.default.createElement("code",null,"Status: ",t.status.statusCode)),u.default.createElement("p",{style:{marginBottom:0}},"Message: ",u.default.createElement("code",null,t.message)),t.status.errorData&&u.default.createElement("p",{style:{marginBottom:0}},"Data: ",u.default.createElement("code",null,t.status.errorData)))},be=function(e){var t=e.onRetry,n=ue().t,a=n("Network unreachable"),r=n("We're having trouble reaching our services, please check your connection and try again."),i=n("Retry");return u.default.createElement(u.default.Fragment,null,u.default.createElement("h3",{style:{marginBottom:8}},a),u.default.createElement("p",{style:{marginBottom:0}},r),t&&u.default.createElement("div",{style:{marginTop:32}},u.default.createElement(ce,{variant:"warning",finished:!0,onClick:t},i)))},xe=function(){return u.default.createElement(W,null,u.default.createElement(V,{style:{justifyContent:"center"}},u.default.createElement("h3",{style:{marginBottom:8}},"IDmission WebSDK failed to load"),u.default.createElement("p",{style:{marginBottom:0}},"Required property ",u.default.createElement("code",null,"submissionToken")," is missing."),u.default.createElement("p",{style:{lineHeight:"1.5rem"}},"Please refer to the"," ",u.default.createElement("a",{href:"https://www.npmjs.com/package/idmission-web-sdk#getting-started",target:"_blank",rel:"noreferrer"},"Getting Started")," ","section of the documentation for information on how to use your credentials to generate a valid"," ",u.default.createElement("a",{href:"https://jwt.io",target:"_blank",rel:"noreferrer"},"JSON Web Token")," ","for your IDmission account. Every usage of the IDmission WebSDK must be authorized with a valid JWT from IDmission's servers.")))},Ce=function(){return u.default.createElement(W,null,u.default.createElement(V,{style:{justifyContent:"center"}},u.default.createElement("h3",{style:{marginBottom:8}},"IDmission WebSDK failed to load"),u.default.createElement("p",{style:{marginBottom:0}},"Required property ",u.default.createElement("code",null,"submissionToken")," is invalid."),u.default.createElement("p",null,"JSON Web Tokens consist of three parts separated by dots (",u.default.createElement("code",null,"."),"), which are:"),u.default.createElement("div",{style:{display:"flex"}},u.default.createElement("ul",{style:{display:"inline",margin:"0 auto"}},u.default.createElement("li",null,"Header"),u.default.createElement("li",null,"Payload"),u.default.createElement("li",null,"Signature"))),u.default.createElement("p",null,"Therefore, a JWT typically looks like the following:"," ",u.default.createElement("code",null,"xxxxx.yyyyy.zzzzz")),u.default.createElement("p",{style:{lineHeight:"1.5rem"}},"Please refer to the"," ",u.default.createElement("a",{href:"https://www.npmjs.com/package/idmission-web-sdk#getting-started",target:"_blank",rel:"noreferrer"},"Getting Started")," ","section of the documentation for information on how to use your credentials to generate a valid"," ",u.default.createElement("a",{href:"https://jwt.io",target:"_blank",rel:"noreferrer"},"JSON Web Token")," ","for your IDmission account. Every usage of the IDmission WebSDK must be authorized with a valid JWT from IDmission's servers.")))},we=function(){return u.default.createElement(W,null,u.default.createElement(V,{style:{justifyContent:"center"}},u.default.createElement("h3",{style:{marginBottom:8}},"IDmission WebSDK failed to load"),u.default.createElement("p",{style:{marginBottom:0}},"Required property ",u.default.createElement("code",null,"submissionToken")," could not be validated."),u.default.createElement("p",{style:{marginBottom:0,lineHeight:"1.5rem"}},"The signature of your token could not be validated. Check your token generation routine, it's possible that some malicious behavior is at play. This can also happen if you attempt to manually modify your token before passing it to the IDmission WebSDK."),u.default.createElement("p",{style:{marginBottom:0,lineHeight:"1.5rem"}},"If you believe you have reached this page in error, please contact us at ",u.default.createElement("a",{href:"mailto:support@idmission.com"},"support@idmission.com"),".")))},Ee=function(){return u.default.createElement(W,null,u.default.createElement(V,{style:{justifyContent:"center"}},u.default.createElement("h3",{style:{marginBottom:8}},"IDmission WebSDK failed to load"),u.default.createElement("p",{style:{marginBottom:0}},"Required property ",u.default.createElement("code",null,"submissionToken")," is expired."),u.default.createElement("p",{style:{marginBottom:0,lineHeight:"1.5rem"}},"Ensure you are generating a fresh token for each request to the IDmission WebSDK."),u.default.createElement("p",{style:{lineHeight:"1.5rem"}},"Please refer to the"," ",u.default.createElement("a",{href:"https://www.npmjs.com/package/idmission-web-sdk#getting-started",target:"_blank",rel:"noreferrer"},"Getting Started")," ","section of the documentation for information on how to use your credentials to generate a valid"," ",u.default.createElement("a",{href:"https://jwt.io",target:"_blank",rel:"noreferrer"},"JSON Web Token")," ","for your IDmission account. Every usage of the IDmission WebSDK must be authorized with a valid JWT from IDmission's servers.")))},ke=function(e){var t=e.error;return u.default.createElement(W,null,u.default.createElement(V,{style:{justifyContent:"center"}},u.default.createElement("h3",{style:{marginBottom:8}},"IDmission WebSDK failed to load"),u.default.createElement("p",{style:{marginBottom:0}},(null==t?void 0:t.host)?u.default.createElement(u.default.Fragment,null,"Failed to reach ",u.default.createElement("code",null,t.host),"."):u.default.createElement(u.default.Fragment,null,"Failed to obtain public key for ",u.default.createElement("code",null,"submissionToken"),".")),(null==t?void 0:t.message)&&u.default.createElement("p",{style:{marginBottom:0,lineHeight:"1.5rem"}},u.default.createElement("code",null,t.message)),u.default.createElement("p",{style:{marginBottom:0,lineHeight:"1.5rem"}},"Please ensure that IDmission's servers can be reached. If you believe you have reached this page in error, please contact us at"," ",u.default.createElement("a",{href:"mailto:support@idmission.com"},"support@idmission.com"),".")))},Te=function(){return u.default.createElement(W,null,u.default.createElement(V,{style:{justifyContent:"center"}},u.default.createElement("h3",{style:{marginBottom:8}},"IDmission WebSDK failed to load"),u.default.createElement("p",{style:{marginBottom:0}},"Required property ",u.default.createElement("code",null,"submissionToken")," comes from an unrecognized issuer."),u.default.createElement("p",{style:{marginBottom:0,lineHeight:"1.5rem"}},"Ensure you are generating a fresh token for each request to the IDmission WebSDK."),u.default.createElement("p",{style:{lineHeight:"1.5rem"}},"Please refer to the"," ",u.default.createElement("a",{href:"https://www.npmjs.com/package/idmission-web-sdk#getting-started",target:"_blank",rel:"noreferrer"},"Getting Started")," ","section of the documentation for information on how to use your credentials to generate a valid"," ",u.default.createElement("a",{href:"https://jwt.io",target:"_blank",rel:"noreferrer"},"JSON Web Token")," ","for your IDmission account. Every usage of the IDmission WebSDK must be authorized with a valid JWT from IDmission's servers.")))},Me=["https://demoauth.idmission.com/","https://uatauth.idmission.com/","https://auth.idmission.com/"],Ie=t.createContext({submit:function(){return b(void 0,void 0,void 0,(function(){return x(this,(function(e){return[2,null]}))}))},submissionStatus:k.READY,submissionRequest:null,submissionResponse:null,submissionError:null,submissionEnvironment:"prod",idFrontImage:null,idBackImage:null,passportImage:null,selfieImage:null,signatureData:null,signatureVideoUrl:null,idCaptureVideoUrl:null,idCaptureVideoIdFrontImage:null,idCaptureVideoIdBackImage:null,additionalDocuments:null,setIdFrontImage:function(){return null},setIdBackImage:function(){return null},setPassportImage:function(){return null},setSelfieImage:function(){return null},setSignatureData:function(){return null},setSignatureVideoUrl:function(){return null},setIdCaptureVideoUrl:function(){return null},setIdCaptureVideoIdFrontImage:function(){return null},setIdCaptureVideoIdBackImage:function(){return null},setAdditionalDocuments:function(){return null},uploadDocument:Promise.resolve,logIdFrontCaptureAttempt:function(){return null},logIdBackCaptureAttempt:function(){return null},logSelfieCaptureAttempt:function(){return null},livenessCheckRequest:null,checkLiveness:function(){return b(void 0,void 0,void 0,(function(){return x(this,(function(e){throw new Error("checkLiveness is not implemented")}))}))},retryLocationAccess:function(){return null}}),Se=function(e){var n=e.action,a=e.children,r=e.url,i=e.environment,o=void 0===i?"prod":i,s=e.token,l=e.companyId,d=e.enrollmentId,c=e.personalData,f=e.cardData,h=e.bypassAgeValidation,p=void 0!==h&&h,m=e.bypassNameMatching,g=void 0===m||m,y=e.needImmediateResponse,w=void 0!==y&&y,T=e.manualReviewRequired,M=void 0!==T&&T,D=e.idBackImageRequired,N=void 0===D||D,j=e.idImageResolutionCheck,P=void 0===j||j,B=e.verifyIdWithExternalDatabases,_=void 0!==B&&B,U=e.deduplicationEnabled,z=void 0!==U&&U,G=e.deduplicationSynchronous,W=void 0!==G&&G,V=e.geolocationEnabled,$=void 0===V||V,q=e.geolocationRequired,H=void 0!==q&&q,Y=e.webhooksEnabled,Z=void 0!==Y&&Y,Q=e.webhooksClientTraceId,X=e.webhooksStripSpecialCharacters,K=void 0===X||X,J=e.webhooksSendInputImages,ee=void 0!==J&&J,te=e.webhooksSendProcessedImages,ne=void 0!==te&&te,ae=e.webhooksFireOnReview,re=void 0!==ae&&ae,ie=e.precapturedDocuments,oe=e.documentServiceUrl,se=void 0===oe?"https://portal-api-dev.idmission.com/files/":oe,le=e.onSubmit,ue=e.onBeforeSubmit,de=e.onBeforeLivenessCheck,ce=e.onResponseReceived,fe=e.onRequestFailure,ye=t.useState(k.READY),be=ye[0],Se=ye[1],Ae=t.useState(null),Le=Ae[0],Re=Ae[1],Oe=t.useState(null),Fe=Oe[0],je=Oe[1],Pe=t.useState(null),Be=Pe[0],_e=Pe[1],Ue=t.useState(null),ze=Ue[0],Ge=Ue[1],We=t.useState(null),Ve=We[0],$e=We[1],qe=t.useState(null),He=qe[0],Ye=qe[1],Ze=t.useState(null),Qe=Ze[0],Xe=Ze[1],Ke=t.useState(null),Je=Ke[0],et=Ke[1],tt=t.useState(null),nt=tt[0],at=tt[1],rt=t.useState(null),it=rt[0],ot=rt[1],st=t.useState(null),lt=st[0],ut=st[1],dt=t.useState(null),ct=dt[0],ft=dt[1],ht=t.useState(null),pt=ht[0],mt=ht[1],gt=t.useState(null),vt=gt[0],yt=gt[1],bt=t.useState(null),xt=bt[0],Ct=bt[1],wt=t.useState(null),Et=wt[0],kt=wt[1],Tt=t.useState(0),Mt=Tt[0],It=Tt[1],St=t.useState(!1),Dt=St[0],Nt=St[1],At=t.useState([]),Lt=At[0],Rt=At[1],Ot=t.useState([]),Ft=Ot[0],jt=Ot[1],Pt=t.useState([]),Bt=Pt[0],_t=Pt[1],Ut=t.useCallback((function(e){Rt((function(t){return C(C([],t,!0),[e],!1)}))}),[]),zt=t.useCallback((function(e){jt((function(t){return C(C([],t,!0),[e],!1)}))}),[]),Gt=t.useCallback((function(e){_t((function(t){return C(C([],t,!0),[e],!1)}))}),[]);t.useEffect((function(){(null==ie?void 0:ie.selfie)&&at(S(ie.selfie.imageData))}),[null==ie?void 0:ie.selfie]);var Wt=t.useCallback((function(){return b(void 0,void 0,void 0,(function(){var e,t,a,r,i,o;return x(this,(function(s){switch(s.label){case 0:return e={securityData:{userName:"",password:"",merchantId:0},customerData:{idData:{idType:"NSP",idCountry:"NSP",idState:""}},additionalData:{uniqueRequestId:(new Date).getTime().toString(),manualReviewRequired:M?"Y":"N",bypassAgeValidation:p?"Y":"N",bypassNameMatching:g?"Y":"N",postDataAPIRequired:Z?"Y":"N",postDataOnReviewRequired:re?"Y":"N",sendInputImagesInPost:ee?"Y":"N",sendProcessedImagesInPost:ne?"Y":"N",needImmediateResponse:w?"Y":"N",deDuplicationRequired:z?"Y":"N",deduplicationSynchronous:W?"Y":"N",verifyDataWithHost:_?"Y":"N",idBackImageRequired:N?"Y":"N",stripSpecialCharacters:K?"Y":"N",idImageResolutionCheck:P?"Y":"N"}},He&&(e.customerData.idData.idImageFront=He),Qe&&(e.customerData.idData.idImageBack=Qe),Je&&(e.customerData.idData.idImageFront=Je),nt&&(n===E.IDENTIFY&&(e.biometricData={selfie:nt}),e.customerData.biometricData={selfie:nt}),l&&(e.employee={companyId:l}),c&&(e.customerData.personalData=c),f&&(e.customerData.cardData=f),d&&((i=e.customerData).personalData||(i.personalData={}),e.customerData.personalData.uniqueNumber=d),Q&&(e.additionalData.clientTraceId=Q),it?(e.customerData.signatureData={signatureImage:JSON.stringify(it)},lt?(t=e.customerData.signatureData,[4,F(lt)]):[3,2]):[3,2];case 1:t.signatureVideo=s.sent(),s.label=2;case 2:return xt&&(e.customerData.additionalDocuments=xt.map((function(t){return v(v({},t),{additionalDocument:JSON.stringify(v(v({},t.additionalDocument),{uniqueId:e.additionalData.uniqueRequestId}))})}))),ct?((o=e.customerData).biometricData||(o.biometricData={}),a=e.customerData.biometricData,[4,F(ct)]):[3,4];case 3:a.videoData=s.sent(),s.label=4;case 4:return pt&&(e.customerData.idData.videoIdImageFront=pt),vt&&(e.customerData.idData.videoIdImageBack=vt),O(e,{selfieCaptureAttempts:Bt,idFrontCaptureAttempts:Lt,idBackCaptureAttempts:Ft,geolocationResult:Et}),ue?[4,ue(e)]:[3,6];case 5:(r=s.sent())&&(e=r),s.label=6;case 6:return[2,e]}}))}))}),[n,xt,p,g,f,l,z,W,d,Et,Ft,Qe,N,vt,pt,ct,Lt,He,P,M,w,ue,Je,c,Bt,nt,it,lt,_,Q,Z,re,ee,ne,K]),Vt=t.useCallback((function(){return b(void 0,void 0,void 0,(function(){var e,t,a,i,l,u,d,c,f,h;return x(this,(function(p){switch(p.label){case 0:if(n===E.NONE)return e={status:{statusCode:"000"},resultData:{}},Se(k.SUBMITTED),je(e),[2,e];Se(k.SUBMITTING),p.label=1;case 1:return p.trys.push([1,7,,8]),[4,Wt()];case 2:return t=p.sent(),a=r||L(o,s),i=function(e,t,n,a){var r=a?"v4":"v3";switch(e){case E.ENROLL:return"/".concat(r,t?"/customer/enroll":"/customer/enroll-biometrics");case E.IDENTIFY:return"/".concat(r,"/customer/identify");case E.VALIDATE:return"/".concat(r,n?"/customer/validate-id-match-face":"/customer/validate-id");case E.VERIFY:return"/".concat(r,"/customer/verify");default:throw new Error("unrecognized SubmissionAction ".concat(e))}}(n,!!(He||Qe||Je),!!nt,!!s),[4,fetch(a+i,{method:"POST",headers:R(s),body:JSON.stringify(t)}).catch((function(e){throw new me(e.message)}))];case 3:return(l=p.sent())&&l.ok?[3,5]:[4,null==l?void 0:l.text()];case 4:if(!(u=p.sent())||"Load failed"===u)throw new me(u);throw new pe({statusCode:null!==(h=null==l?void 0:l.statusText)&&void 0!==h?h:"???",statusMessage:u});case 5:return[4,l.json()];case 6:if("000"!==(d=p.sent()).status.statusCode)throw new pe(d.status);return Re(t),je(d),Se(k.SUBMITTED),null==ce||ce(d,t),[2,d];case 7:throw c=p.sent(),f=c,Se(k.FAILED),_e(c instanceof pe||c instanceof me?c:"Load failed"===f.message?new me:new pe({statusCode:"",statusMessage:f.message})),Ge((function(){return["VERIFY","IDENTIFY"].includes(n)?function(){return null}:Vt})),null==fe||fe(f),f;case 8:return[2]}}))}))}),[n,Wt,o,Qe,He,fe,ce,Je,nt,s,r]),$t=t.useCallback((function(){return b(void 0,void 0,void 0,(function(){var e;return x(this,(function(t){switch(t.label){case 0:return le?(e=le,[4,Wt()]):[3,2];case 1:return[2,e.apply(void 0,[t.sent()])];case 2:return[4,Vt()];case 3:return[2,t.sent()]}}))}))}),[Wt,Vt,le]),qt=t.useCallback((function(e){return b(void 0,void 0,void 0,(function(){var t,n,a,i,l,u,d,c,f,h,p,m;return x(this,(function(g){switch(g.label){case 0:return g.trys.push([0,8,,9]),h={securityData:{userName:"",password:"",merchantId:0}},p={},m={},[4,I(e)];case 1:return h.customerData=(p.biometricData=(m.selfie=g.sent(),m),p),h.additionalData={uniqueRequestId:(new Date).getTime().toString(),stripSpecialCharacters:K?"Y":"N",estimateAge:"N",predictGender:"N"},O(t=h,{selfieCaptureAttempts:Bt,idFrontCaptureAttempts:Lt,idBackCaptureAttempts:Ft,geolocationResult:Et}),$e(t),de?[4,de(t)]:[3,3];case 2:(n=g.sent())&&(t=n),g.label=3;case 3:return a=r||L(o,s),i="/".concat(!!s?"v4":"v3","/customer/live-check"),[4,fetch(a+i,{method:"POST",headers:R(s),body:JSON.stringify(t)}).catch((function(e){throw new me(e.message)}))];case 4:return(l=g.sent()).ok?[3,6]:[4,l.text()];case 5:if(!(u=g.sent())||"Load failed"===u)throw new me(u);throw new pe({statusCode:l.statusText,statusMessage:u});case 6:return[4,l.json()];case 7:if("000"!==(d=g.sent()).status.statusCode)throw new pe(d.status);return je(d),[2,d];case 8:throw c=g.sent(),f=c,Se(k.FAILED),_e(c instanceof pe||c instanceof me?c:"Load failed"===f.message?new me:new pe({statusCode:"",statusMessage:f.message})),Ge((function(){return function(){return null}})),null==fe||fe(f),f;case 9:return[2]}}))}))}),[o,Et,Ft,Lt,de,fe,Bt,s,r,K]),Ht=t.useCallback((function(){It((function(e){return e+1}))}),[]);t.useEffect((function(){$&&(console.log("making geolocation attempt",Mt),navigator.geolocation.getCurrentPosition((function(e){kt(e),Nt(!1)}),(function(e){if(1!==e.code)throw new Error(e.message);Nt(!0)})))}),[Mt,$,H]);var Yt=t.useCallback((function(){ze&&(_e(null),Se(k.READY),ze())}),[ze]),Zt=t.useState("NOT_PARSED"),Qt=Zt[0],Xt=Zt[1],Kt=t.useState(null),Jt=Kt[0],en=Kt[1];t.useEffect((function(){"undefined"!=typeof window&&b(void 0,void 0,void 0,(function(){var e,t,n,a,r,i,o,l,u;return x(this,(function(d){switch(d.label){case 0:if(Xt("PARSING"),!s)return[2,Xt("MISSING")];try{e=A(s)}catch(e){return console.error("error parsing token",e),[2,Xt("INVALID_FORMAT")]}if(t=e.iss,!Me.some((function(e){return t.startsWith(e)})))return console.error("issuer is not allowed",t),[2,Xt("ISSUER_NOT_ALLOWED")];d.label=1;case 1:return d.trys.push([1,4,,5]),[4,fetch(t).then((function(e){return e.json()}))];case 2:return a=d.sent(),[4,Ne("-----BEGIN PUBLIC KEY-----\n".concat(a.public_key,"\n-----END PUBLIC KEY-----"))];case 3:return n=d.sent(),[3,5];case 4:return r=d.sent(),console.error("error fetching public key",r),en(new ge(r,t)),[2,Xt("PUBLIC_KEY_LOAD_FAILED")];case 5:i=!1,d.label=6;case 6:return d.trys.push([6,8,,9]),o=s.split("."),[4,window.crypto.subtle.verify({name:"RSASSA-PKCS1-v1_5"},n,De(o[1]),De(o[2]))];case 7:return d.sent(),i=!0,[3,9];case 8:return l=d.sent(),console.error("error validating token",l),[3,9];case 9:return i?(u=e.exp,Date.now()>=1e3*u?[2,Xt("EXPIRED")]:(Xt("GOOD"),[2])):[2,Xt("INVALID_SIGNATURE")]}}))}))}),[s]);var tn=t.useCallback((function(e){return new Promise((function(t,n){import("tus-js-client").then((function(a){var r=new a.Upload(e,{endpoint:se,retryDelays:[0,3e3,5e3,1e4,2e4],metadata:{filename:"My File",filetype:"image/jpeg"},headers:{Authorization:"Bearer ".concat(s)},onProgress:function(e,t){var n=(e/t*100).toFixed(2);console.log(e,t,n+"%")},onSuccess:function(){var e;console.log("Download from %s",r.url),t("urn:documentsv1:"+(null===(e=r.url.split("/files/").pop())||void 0===e?void 0:e.split("+").shift()))},onError:function(e){console.log("Failed because: "+e),n(e)}});r.findPreviousUploads().then((function(e){e.length&&r.resumeFromPreviousUpload(e[0]),r.start()}))}))}))}),[se,s]),nn={submit:$t,submissionStatus:be,submissionRequest:Le,submissionResponse:Fe,submissionError:Be,submissionEnvironment:o,idFrontImage:He,idBackImage:Qe,passportImage:Je,selfieImage:nt,signatureData:it,signatureVideoUrl:lt,idCaptureVideoUrl:ct,idCaptureVideoIdFrontImage:pt,idCaptureVideoIdBackImage:vt,additionalDocuments:xt,setIdFrontImage:Ye,setIdBackImage:Xe,setPassportImage:et,setSelfieImage:at,setSignatureData:ot,setSignatureVideoUrl:ut,setIdCaptureVideoUrl:ft,setIdCaptureVideoIdFrontImage:mt,setIdCaptureVideoIdBackImage:yt,setAdditionalDocuments:Ct,uploadDocument:tn,logIdFrontCaptureAttempt:Ut,logIdBackCaptureAttempt:zt,logSelfieCaptureAttempt:Gt,livenessCheckRequest:Ve,checkLiveness:qt,retryLocationAccess:Ht};return"MISSING"===Qt?u.default.createElement(xe,null):"INVALID_FORMAT"===Qt?u.default.createElement(Ce,null):"INVALID_SIGNATURE"===Qt?u.default.createElement(we,null):"EXPIRED"===Qt?u.default.createElement(Ee,null):"PUBLIC_KEY_LOAD_FAILED"===Qt?u.default.createElement(ke,{error:Jt}):"ISSUER_NOT_ALLOWED"===Qt?u.default.createElement(Te,null):u.default.createElement(Ie.Provider,{value:nn},H&&Dt?u.default.createElement(he,null):a,Be&&u.default.createElement(ve,{error:Be,onRetry:Yt}))};function De(e){for(var t=new ArrayBuffer(e.length),n=new Uint8Array(t),a=0,r=e.length;a<r;a++)n[a]=e.charCodeAt(a);return t}function Ne(e){if("undefined"==typeof window)throw new Error("window cannot be undefined");var t=e.substring("-----BEGIN PUBLIC KEY-----".length,e.length-"-----END PUBLIC KEY-----".length-1),n=De(window.atob(t));return window.crypto.subtle.importKey("spki",n,{name:"RSASSA-PKCS1-v1_5",hash:"SHA-256"},!0,["verify"])}function Ae(e,t,n){return e[t]?e[t][0]?e[t][0][n]:e[t][n]:"contentBoxSize"===t?e.contentRect["inlineSize"===n?"width":"height"]:void 0}function Le(e){void 0===e&&(e={});var n=e.onResize,a=t.useRef(void 0);a.current=n;var r=e.round||Math.round,i=t.useRef(),o=t.useState({width:void 0,height:void 0}),s=o[0],l=o[1],u=t.useRef(!1);t.useEffect((function(){return u.current=!1,function(){u.current=!0}}),[]);var d=t.useRef({width:void 0,height:void 0}),c=function(e,n){var a=t.useRef(null),r=t.useRef(null);r.current=n;var i=t.useRef(null);t.useEffect((function(){o()}));var o=t.useCallback((function(){var t=r.current,n=i.current||(t?t instanceof Element?t:t.current:null);a.current&&a.current.element===n&&a.current.subscriber===e||(a.current&&a.current.cleanup&&a.current.cleanup(),a.current={element:n,subscriber:e,cleanup:n?e(n):void 0})}),[e]);return t.useEffect((function(){return function(){a.current&&a.current.cleanup&&(a.current.cleanup(),a.current=null)}}),[]),t.useCallback((function(e){i.current=e,o()}),[o])}(t.useCallback((function(t){return i.current&&i.current.box===e.box&&i.current.round===r||(i.current={box:e.box,round:r,instance:new ResizeObserver((function(t){var n=t[0],i="border-box"===e.box?"borderBoxSize":"device-pixel-content-box"===e.box?"devicePixelContentBoxSize":"contentBoxSize",o=Ae(n,i,"inlineSize"),s=Ae(n,i,"blockSize"),c=o?r(o):void 0,f=s?r(s):void 0;if(d.current.width!==c||d.current.height!==f){var h={width:c,height:f};d.current.width=c,d.current.height=f,a.current?a.current(h):u.current||l(h)}}))}),i.current.instance.observe(t,{box:e.box}),function(){i.current&&i.current.instance.unobserve(t)}}),[e.box,r]),e.ref);return t.useMemo((function(){return{ref:c,width:s.width,height:s.height}}),[c,s.width,s.height])}function Re(e){return b(this,void 0,void 0,(function(){var t;return x(this,(function(n){switch(n.label){case 0:return"BarcodeDetector"in window?(t=new BarcodeDetector({formats:["pdf417"]}),console.log("this is a real native result!"),[4,t.detect(e)]):[2,[]];case 1:return[2,n.sent()]}}))}))}function Oe(e,t){return void 0===t&&(t=!1),b(this,void 0,void 0,(function(){var n,a,r,i,o,s,l,u,d;return x(this,(function(c){switch(c.label){case 0:return[4,new Promise((function(o){if(r=e.naturalWidth,i=e.naturalHeight,n=document.createElement("canvas"),!(a=n.getContext("2d")))return[];if(t){console.log("rotating!!"),n.width=i,n.height=r,a.setTransform(0,1,-1,0,n.width,0),a.drawImage(e,0,0,r,i);var s=new Image;s.width=n.width,s.height=n.height,s.onload=function(){o(s)},n.toBlob((function(e){e&&(s.src=URL.createObjectURL(e))}))}else a.drawImage(e,0,0,n.width,n.height),o(e)}))];case 1:return o=c.sent(),s=new ZXing.BitmapLuminanceSource(a,o),l=new ZXing.Common.HybridBinarizer(s),u=new ZXing.BinaryBitmap(l),d=ZXing.PDF417.PDF417Reader.decode(u,null,!1),a.clearRect(0,0,n.width,n.height),n.remove(),[2,d]}}))}))}function Fe(){return"BarcodeDetector"in window}function je(e,t){var n=this;return new Promise((function(a){var r=new Image;r.onload=function(){return b(n,void 0,void 0,(function(){var e,n,i,o;return x(this,(function(s){switch(s.label){case 0:return Fe()?[4,Re(r)]:[3,2];case 1:return n=s.sent(),console.log("native result",n,"".concat(r.width,"x").concat(r.height)),a(n.length>0?v(v({},n[0]),{Source:"native"}):null),[3,4];case 2:return e=(null!==(i=null==t?void 0:t[2])&&void 0!==i?i:0)<(null!==(o=null==t?void 0:t[3])&&void 0!==o?o:0),[4,Oe(r,e)];case 3:n=s.sent(),console.log("zxing result",n),a(n.length>0?v(v({},n[0]),{Source:"zxing"}):null),s.label=4;case 4:return[2]}}))}))},r.src=URL.createObjectURL(e)}))}function Pe(e){var t=e.width,n=e.height;return e instanceof HTMLImageElement&&(t=e.naturalWidth,n=e.naturalHeight),e instanceof HTMLVideoElement&&(t=e.videoWidth,n=e.videoHeight),[t,n]}var Be,_e=h.default.canvas(Be||(Be=w(["\n display: none;\n"],["\n display: none;\n"])));function Ue(e,t,n,a){if(e){var r=e.getContext("2d");if(r){if(!n||!a){var i=Pe(t);n||(n=i[0]),a||(a=i[1])}e.width=n,e.height=a,r.drawImage(t,0,0,n,a)}}}function ze(e){if(e){var t=e.getContext("2d");t&&t.clearRect(0,0,e.width,e.height)}}var Ge,We=["front","avant","anteriore","cameraaanvoorzijde","kamerapåframsidan","forsidekamera","kamerapåforsiden","aparatprzedni","etukamera","kameradepan","ÖnKamera","cameramặttrước","camerăfață","prednákamera","prednjakamera","előlapikamera","přednífotoaparát","μπροστινήκάμερα","переднякамера","передняякамера","преднакамера","алдыңғыкамера","מצלמה קדמית","الكاميرا الأمامية","फ़्रंटकैमरा","前置相机","前置鏡頭","前面カメラ","전면카메라","กล้องด้านหน้า"].map((function(e){return e.toLocaleLowerCase().split(" ").join("")})),Ve=["back","rear","posterior","trasera","traseira","arrière","rückkamera","fotocamera(posteriore)","cameraaanachterzijde","kamerapåbaksidan","kamerapåbaksiden","bagsidekamera","aparattylny","takakamera","arkakamera","kamerabelakang","cameramặtsau","camerăspate","stražnjakamera","zadnákamera","hátoldalikamera","zadnífotoaparát","πίσωκάμερα","заднякамера","Задняякамера","заднакамера","артқыкамера","מצלמה אחורית","الكاميرا الخلفية","बैककैमरा","后置相机","後置鏡頭","背面カメラ","후면카메라","กล้องด้านหลัง"].map((function(e){return e.toLocaleLowerCase().split(" ").join("")})),$e=["backdualwidecamera","backultrawidecamera","ultraampliaposterior","ultra-angulartraseira","ultragrandeangulartraseira","ultragrandangle","ultragranangular","ultra-weitwinkelkamera","ultra-grandangolo","ultrabredecameraaanachterzijde","ultravidvinkelkamerapåbaksidan","ultravidvinkelkameraetpåbagsiden","ultravidvinkelkamerabak","ultragenişkameraarkayüzü","ultralaajakulmainentakakamera","tylnyaparatultraszerokokątny","cameracựcrộngmặtsau","camerăcuobiectivultra‑superangularspate","ultraszéleslátószögűkamera","kameraultralebarbelakang","stražnjaultraširokakamera","zadníultraširokoúhlýfotoaparát","ultraširokouhlá","πίσωυπερευρείακάμερα","заднянадширококутнакамера","Задняясверхширокоугольнаякамера","Задна свръх широкоъгълна камера","артқыультракеңбұрыштыкамера","מצלמה אולטרה רחבה אחורית","كاميرا خلفية عريضة جدًا","बैकअल्ट्रावाइडकैमरा","后置超广角相机","後置超廣角鏡頭相機","背面超広角カメラ","후면울트라와이드카메라","กล้องด้านหลังอัลตร้าไวด์"].map((function(e){return e.toLocaleLowerCase().split(" ").join("")})),qe=function(e,t){var n=e instanceof MediaDeviceInfo?He(e):e;return("string"==typeof t?[t]:t).some((function(e){return n.includes(e)}))},He=function(e){return e.label.toLocaleLowerCase().split(" ").join("")};function Ye(){Ge&&(console.log("releasing camera access..."),Ge.release(),Ge=void 0)}var Ze,Qe=function(e){var n=void 0===e?{preferFrontFacingCamera:!1,preferContinuityCamera:!0,requestMicrophoneAccess:!1,maxVideoWidth:1920,debugMode:!1}:e,a=n.preferFrontFacingCamera,r=void 0!==a&&a,i=n.preferContinuityCamera,o=void 0===i||i,s=n.requestMicrophoneAccess,l=void 0!==s&&s,u=n.maxVideoWidth,d=n.maxFps,c=n.debugMode,f=void 0!==c&&c,h=t.useRef(null),p=t.useRef(null),m=t.useState(!1),g=m[0],v=m[1],y=t.useState(null),w=y[0],E=y[1],k=t.useState(!1),T=k[0],I=k[1],S=t.useState(!1),D=S[0],N=S[1],A=t.useState(o),L=A[0],R=A[1],O=t.useState(!1),F=O[0],j=O[1],P=t.useState(!1),B=P[0],_=P[1];t.useEffect((function(){f&&console.log("iphone continuity camera allowed changed",L),Ye(),p.current=null,I(!1)}),[f,L]);var U=t.useCallback((function(){_(!1)}),[]);t.useEffect((function(){B||(v(!1),function(e,t){return void 0===t&&(t=!1),b(this,void 0,void 0,(function(){var n,a;return x(this,(function(r){switch(r.label){case 0:return[4,navigator.mediaDevices.getUserMedia({video:{facingMode:{exact:e}},audio:t})];case 1:return n=r.sent(),[4,navigator.mediaDevices.enumerateDevices()];case 2:return a=r.sent().filter((function(e){return"videoinput"===e.kind})),n.getVideoTracks().forEach((function(e){e.enabled=!1,e.stop()})),n=null,[2,a]}}))}))}().then((function(e){var t,n,a;f&&console.log("availableCameras",e);var i=M();if(f&&console.log("platformDetails",i),F||(null==i?void 0:i.os)&&"OS X"!==i.os.family)("Android"===(null===(t=null==i?void 0:i.os)||void 0===t?void 0:t.family)||e.every((function(e){return e.label.startsWith("camera2 ")})))&&(e=e.sort((function(e,t){return e.label.toLowerCase().localeCompare(t.label.toLowerCase())})),f&&console.log("cameras have been sorted",e));else{var o=e.find((function(e){return qe(e,"iphone")}));N(!!o),o&&L&&(a=o)}r&&(a=e.find((function(e){return qe(e,We)}))),a||(a=e.find((function(e){return qe(e,"backtriplecamera")}))),a||(a=e.find((function(e){return qe(e,"backdualcamera")}))),a||(a=e.find((function(e){return qe(e,Ve)&&!qe(e,$e)}))),a||(a=e.find((function(e){return qe(e,Ve)}))),!r&&"iOS"===(null===(n=null==i?void 0:i.os)||void 0===n?void 0:n.family)&&e.length>0&&(a||(a=e[1])),a||(a=e[0]),f&&console.log("selectedCamera",a),E(a)})).catch((function(e){if("NotAllowedError"!==e.name)throw console.error("camera access encountered some other error",e),e;console.error("camera access has been blocked by the user",e),_(!0)})))}),[B,L,F,r]),t.useEffect((function(){var e;if(w){var t=function(){Ye(),p.current=null,I(!1)};return(null===(e=navigator.mediaDevices)||void 0===e?void 0:e.getUserMedia)?(b(void 0,void 0,void 0,(function(){var e,t,n,a;return x(this,(function(r){switch(r.label){case 0:e={audio:l,video:{deviceId:{exact:w.deviceId},width:{ideal:u},aspectRatio:1.777777778,frameRate:{}}},d&&(e.video.frameRate={max:d}),t=null,r.label=1;case 1:return r.trys.push([1,3,,4]),[4,navigator.mediaDevices.getUserMedia(e)];case 2:return t=r.sent(),[3,4];case 3:return"NotAllowedError"===r.sent().name?(L?(N(!1),j(!0)):_(!0),[2]):[3,4];case 4:if(t)return[3,8];r.label=5;case 5:return r.trys.push([5,7,,8]),[4,navigator.mediaDevices.getUserMedia({audio:!1,video:!0})];case 6:return t=r.sent(),console.log("opened stream with no width and height constraints"),[3,8];case 7:return r.sent(),console.log("cannot open stream at all"),[3,8];case 8:if(!t)throw new Error("failed to open camera");return n=function(){D&&L?(console.log("someone unplugged the continuity camera"),Ye(),p.current=null,N(!1),j(!0),E(null)):(console.log("someone unplugged the webcam"),Ye(),p.current=null,I(!1),_(!0))},null===(a=h.current)||void 0===a||a.addEventListener("ended",n),t.getVideoTracks().forEach((function(e){e.onended=n})),p.current=function(e,t,n){Ye(),console.log("obtaining camera access...");var a=e.getVideoTracks()[0].getSettings(),r=a.width,i=a.height,o=t.toLocaleLowerCase().split(" ").join(""),s=qe(o,C(C(C([],Ve,!0),$e,!0),["iphone"],!1));return r||(r=0),i||(i=0),Ge={label:t,stream:e,width:r,height:i,isRearFacing:s,release:function(){e.getTracks().forEach((function(e){e.enabled=!1,e.stop()})),n&&(n.pause(),n.srcObject=null,n.src="")}},n&&(n.srcObject=e),Ge}(t,w.label,h.current),[2]}}))})),t):t}}),[L,D,d,u,l,w]),t.useEffect((function(){v(!1),w&&T&&v(!0)}),[T,w]);var z=t.useCallback((function(){return b(void 0,void 0,void 0,(function(){var e;return x(this,(function(t){switch(t.label){case 0:return p.current?"undefined"==typeof ImageCapture?[3,2]:[4,new ImageCapture(p.current.stream.getTracks()[0]).takePhoto()]:[2,null];case 1:return[2,t.sent()];case 2:return h.current?(Ue(e=document.createElement("canvas"),h.current),[2,new Promise((function(t){return e.toBlob(t)}))]):[2,null]}}))}))}),[]);return{videoRef:h,videoDevice:w,videoLoaded:T,setVideoLoaded:I,cameraRef:p,cameraReady:g,cameraAccessDenied:B,retryCameraAccess:U,releaseCameraAccess:Ye,iphoneContinuityCameraAvailable:D,iphoneContinuityCameraAllowed:L,setIphoneContinuityCameraAllowed:R,takePhoto:z}},Xe=t.createContext({videoRef:{current:null},videoLoaded:!1,cameraRef:{current:null},cameraReady:!1,cameraAccessDenied:!1,retryCameraAccess:function(){return null},releaseCameraAccess:function(){return null},iphoneContinuityCameraAvailable:!1,iphoneContinuityCameraAllowed:!0,setIphoneContinuityCameraAllowed:function(){return null},takePhoto:function(){return Promise.resolve(null)},setVideoLoaded:function(){return null}}),Ke=function(e){var n=e.children,a=e.preferFrontFacingCamera,r=e.preferContinuityCamera,i=e.requestMicrophoneAccess,o=e.maxVideoWidth,s=e.debugMode,l=Qe({preferFrontFacingCamera:void 0!==a&&a,preferContinuityCamera:void 0===r||r,requestMicrophoneAccess:void 0!==i&&i,maxVideoWidth:void 0===o?1920:o,maxFps:e.maxFps,debugMode:void 0!==s&&s}),d=l.videoRef,c=l.videoLoaded,f=l.setVideoLoaded,h=l.cameraRef,p=l.cameraReady,m=l.cameraAccessDenied,g=l.retryCameraAccess,v=l.releaseCameraAccess,y=l.iphoneContinuityCameraAvailable,b=l.iphoneContinuityCameraAllowed,x=l.setIphoneContinuityCameraAllowed,C=l.takePhoto;return t.useEffect((function(){return function(){v()}}),[v]),u.default.createElement(Xe.Provider,{value:{videoRef:d,videoLoaded:c,setVideoLoaded:f,cameraRef:h,cameraReady:p,cameraAccessDenied:m,releaseCameraAccess:v,retryCameraAccess:g,iphoneContinuityCameraAvailable:y,iphoneContinuityCameraAllowed:b,setIphoneContinuityCameraAllowed:x,takePhoto:C}},n)};function Je(e){return b(this,void 0,void 0,(function(){var t,n,a,r,i,o,s;return x(this,(function(l){switch(l.label){case 0:return Ze?[2,Ze]:[4,p.loadGraphModel(e)];case 1:return Ze=l.sent(),[4,p.ready()];case 2:return l.sent(),t=p.zeros([448,448,3]),n=p.cast(t,"int32"),a=p.tensor4d(Array.from(n.dataSync()),[1,448,448,3]),r=p.cast(a,"int32"),o=(i=p).dispose,[4,Ze.executeAsync(r)];case 3:return o.apply(i,[l.sent()]),n.dispose(),r.dispose(),a.dispose(),p.dispose(t),s=Ze.outputs.map((function(e){return e.name})),Ze.outputPositions={boxes:s.indexOf("Identity_1"),scores:s.indexOf("Identity_4"),labels:s.indexOf("Identity_2")},[2,Ze]}}))}))}var et,tt={1:"Document",2:"MRZ",3:"PDF417",4:"Primary face",5:"Secondary face",6:"Glare",7:"Punch Hole",8:"Passport Page"};function nt(e){return b(this,void 0,void 0,(function(){var t,n,a,r,i,o,s,l,u;return x(this,(function(d){switch(d.label){case 0:return et?[2,et]:[4,p.loadLayersModel(e)];case 1:return et=d.sent(),[4,p.ready()];case 2:return d.sent(),t=p.zeros([448,448,3]),n=p.cast(t,"float32"),i=(r=p).tensor4d,s=(o=Array).from,[4,n.data()];case 3:return a=i.apply(r,[s.apply(o,[d.sent()]),[1,448,448,3]]),l=p.cast(a,"float32"),[4,et.predict(l)];case 4:return[4,(u=d.sent()).data()];case 5:return d.sent(),p.dispose(u),n.dispose(),l.dispose(),a.dispose(),p.dispose(t),[2,et]}}))}))}class at{refCount(e){return rt("refCount")}incRef(e){return rt("incRef")}timerAvailable(){return!0}time(e){return rt("time")}read(e){return rt("read")}readSync(e){return rt("readSync")}readToGPU(e,t){return rt("readToGPU")}numDataIds(){return rt("numDataIds")}disposeData(e,t){return rt("disposeData")}write(e,t,n){return rt("write")}move(e,t,n,a,r){return rt("move")}createTensorFromGPUData(e,t,n){return rt("createTensorFromGPUData")}memory(){return rt("memory")}floatPrecision(){return rt("floatPrecision")}epsilon(){return 32===this.floatPrecision()?1e-7:1e-4}dispose(){return rt("dispose")}}function rt(e){throw new Error(`'${e}' not yet implemented or not found in the registry. This kernel may not be supported by the tfjs backend you have chosen`)}function it(e,t){if(!e)throw new Error("string"==typeof t?t:t())}function ot(e){if(0===e.length)return 1;let t=e[0];for(let n=1;n<e.length;n++)t*=e[n];return t}function st(e,t){if(e===t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function lt(e,t){return t<=e.length?e:e+" ".repeat(t-e.length)}function ut(e){if("float32"===e||"int32"===e)return 4;if("complex64"===e)return 8;if("bool"===e)return 1;throw new Error(`Unknown dtype ${e}`)}function dt(e){return"string"==typeof e||e instanceof String}function ct(e){return Array.isArray(e)?ct(e[0]):e instanceof Float32Array?"float32":e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray?"int32":"number"==typeof e?"float32":dt(e)?"string":function(e){return"boolean"==typeof e}(e)?"bool":"float32"}function ft(e){return!!(e&&e.constructor&&e.call&&e.apply)}function ht(e){const t=e.length;if(t<2)return[];const n=new Array(t-1);n[t-2]=e[t-1];for(let a=t-3;a>=0;--a)n[a]=n[a+1]*e[a+1];return n}function pt(e,t,n,a=!1){const r=new Array;if(1===t.length){const i=t[0]*(a?2:1);for(let t=0;t<i;t++)r[t]=n[e+t]}else{const i=t[0],o=t.slice(1),s=o.reduce(((e,t)=>e*t))*(a?2:1);for(let t=0;t<i;t++)r[t]=pt(e+t*s,o,n,a)}return r}function mt(e,t,n=!1){if(0===e.length)return t[0];const a=e.reduce(((e,t)=>e*t))*(n?2:1);if(0===a)return[];if(a!==t.length)throw new Error(`[${e}] does not match the input size ${t.length}${n?" for a complex tensor":""}.`);return pt(0,e,t,n)}function gt(e,t){if(null==t||"float32"===t||"complex64"===t)return new Float32Array(e);if("int32"===t)return new Int32Array(e);if("bool"===t)return new Uint8Array(e);throw new Error(`Unknown data type ${t}`)}function vt(e){e.forEach((t=>{it(Number.isInteger(t)&&t>=0,(()=>`Tensor must have a shape comprised of positive integers but got shape [${e}].`))}))}function yt(e){return e&&e.then&&"function"==typeof e.then}const bt="tfjsflags";class xt{constructor(e){this.global=e,this.flags={},this.flagRegistry={},this.urlFlags={},this.getQueryParams=Ct,this.populateURLFlags()}setPlatform(e,t){null!=this.platform&&(wt().getBool("IS_TEST")||wt().getBool("PROD")||console.warn(`Platform ${this.platformName} has already been set. Overwriting the platform with ${e}.`)),this.platformName=e,this.platform=t}registerFlag(e,t,n){if(this.flagRegistry[e]={evaluationFn:t,setHook:n},null!=this.urlFlags[e]){const t=this.urlFlags[e];wt().getBool("IS_TEST")||wt().getBool("PROD")||console.warn(`Setting feature override from URL ${e}: ${t}.`),this.set(e,t)}}async getAsync(e){return e in this.flags||(this.flags[e]=await this.evaluateFlag(e)),this.flags[e]}get(e){if(e in this.flags)return this.flags[e];const t=this.evaluateFlag(e);if(yt(t))throw new Error(`Flag ${e} cannot be synchronously evaluated. Please use getAsync() instead.`);return this.flags[e]=t,this.flags[e]}getNumber(e){return this.get(e)}getBool(e){return this.get(e)}getString(e){return this.get(e)}getFlags(){return this.flags}get features(){return this.flags}set(e,t){if(null==this.flagRegistry[e])throw new Error(`Cannot set flag ${e} as it has not been registered.`);this.flags[e]=t,null!=this.flagRegistry[e].setHook&&this.flagRegistry[e].setHook(t)}evaluateFlag(e){if(null==this.flagRegistry[e])throw new Error(`Cannot evaluate flag '${e}': no evaluation function found.`);return this.flagRegistry[e].evaluationFn()}setFlags(e){this.flags=Object.assign({},e)}reset(){this.flags={},this.urlFlags={},this.populateURLFlags()}populateURLFlags(){if(void 0===this.global||void 0===this.global.location||void 0===this.global.location.search)return;const e=this.getQueryParams(this.global.location.search);if(bt in e){e[bt].split(",").forEach((e=>{const[t,n]=e.split(":");this.urlFlags[t]=function(e,t){const n=t.toLowerCase();return"true"===n||"false"===n?"true"===n:""+ +n===n?+n:t}(0,n)}))}}}function Ct(e){const t={};return e.replace(/[?&]([^=?&]+)(?:=([^&]*))?/g,((e,...n)=>(function(e,t,n){e[decodeURIComponent(t)]=decodeURIComponent(n||"")}(t,n[0],n[1]),n.join("=")))),t}function wt(){return kt}let Et,kt=null;function Tt(){if(null==Et){let e;if("undefined"!=typeof window)e=window;else if("undefined"!=typeof global)e=global;else if("undefined"!=typeof process)e=process;else{if("undefined"==typeof self)throw new Error("Could not find a global object");e=self}Et=e}return Et}function Mt(e,t){const n=function(){const e=Tt();return null==e._tfGlobals&&(e._tfGlobals=new Map),e._tfGlobals}();if(n.has(e))return n.get(e);{const a=t();return n.set(e,a),n.get(e)}}const It="Add",St="Cast",Dt="Identity";function Nt(...e){wt().getBool("IS_TEST")||wt().getBool("PROD")||console.warn(...e)}const At=Mt("kernelRegistry",(()=>new Map)),Lt=Mt("gradRegistry",(()=>new Map));function Rt(e,t){const n=function(e,t){return`${t}_${e}`}(e,t);return At.get(n)}function Ot(e){return Lt.get(e)}function Ft(e){const t=At.entries(),n=[];for(;;){const{done:a,value:r}=t.next();if(a)break;const[i,o]=r,[s]=i.split("_");s===e&&n.push(o)}return n}function jt(e){return e instanceof Float32Array||e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray}function Pt(e,t){if("string"===t)throw new Error("Cannot convert a string[] to a TypedArray");if(Array.isArray(e)&&(e=zt(e)),wt().getBool("DEBUG")&&function(e,t){for(let n=0;n<e.length;n++){const a=e[n];if(isNaN(a)||!isFinite(a))throw Error(`A tensor of type ${t} being uploaded contains ${a}.`)}}(e,t),function(e,t){return e instanceof Float32Array&&"float32"===t||e instanceof Int32Array&&"int32"===t||e instanceof Uint8Array&&"bool"===t}(e,t))return e;if(null==t||"float32"===t||"complex64"===t)return new Float32Array(e);if("int32"===t)return new Int32Array(e);if("bool"===t){const t=new Uint8Array(e.length);for(let n=0;n<t.length;++n)0!==Math.round(e[n])&&(t[n]=1);return t}throw new Error(`Unknown data type ${t}`)}function Bt(){return wt().platform.now()}function _t(e,t="utf-8"){return t=t||"utf-8",wt().platform.decode(e,t)}function Ut(e){return null!=wt().platform.isTypedArray?wt().platform.isTypedArray(e):jt(e)}function zt(e,t=[],n=!1){if(null==t&&(t=[]),"boolean"==typeof e||"number"==typeof e||"string"==typeof e||yt(e)||null==e||Ut(e)&&n)t.push(e);else if(Array.isArray(e)||Ut(e))for(let a=0;a<e.length;++a)zt(e[a],t,n);else{let a=-1;for(const t of Object.keys(e))/^([1-9]+[0-9]*|0)$/.test(t)&&(a=Math.max(a,Number(t)));for(let r=0;r<=a;r++)zt(e[r],t,n)}return t}class Gt{constructor(e,t){this.backendTimer=e,this.logger=t,null==t&&(this.logger=new Vt)}profileKernel(e,t,n){let a;const r=()=>{a=n()};let i;const o=Bt();if(this.backendTimer.timerAvailable())i=this.backendTimer.time(r);else{r();for(const e of a)e.dataSync();i=Promise.resolve({kernelMs:Bt()-o})}if(wt().getBool("CHECK_COMPUTATION_FOR_ERRORS"))for(let t=0;t<a.length;t++){const n=a[t];n.data().then((t=>{Wt(t,n.dtype,e)}))}return{kernelName:e,outputs:a,inputs:t,timeMs:i.then((e=>e.kernelMs)),extraInfo:i.then((e=>null!=e.getExtraProfileInfo?e.getExtraProfileInfo():""))}}logKernelProfile(e){const{kernelName:t,outputs:n,timeMs:a,inputs:r,extraInfo:i}=e;n.forEach((e=>{Promise.all([e.data(),a,i]).then((n=>{this.logger.logKernelProfile(t,e,n[0],n[1],r,n[2])}))}))}}function Wt(e,t,n){if("float32"!==t)return!1;for(let t=0;t<e.length;t++){const a=e[t];if(isNaN(a)||!isFinite(a))return console.warn(`Found ${a} in the result of '${n}'`),!0}return!1}class Vt{logKernelProfile(e,t,n,a,r,i){const o="number"==typeof a?lt(`${a}ms`,9):a.error,s=lt(e,25),l=t.rank,u=t.size,d=lt(t.shape.toString(),14);let c="";for(const e in r){const n=r[e];if(null!=n){const a=n.shape||t.shape,r=a.length;c+=`${e}: ${r}D ${r>0?a:""} `}}console.log(`%c${s}\t%c${o}\t%c${l}D ${d}\t%c${u}\t%c${c}\t%c${i}`,"font-weight:bold","color:red","color:blue","color: orange","color: green","color: steelblue")}}const $t=20,qt=3,Ht=7;function Yt(e,t,n,a){const r=ht(t),i=function(e,t,n,a){const r=ot(t),i=a[a.length-1],o=new Array(i).fill(0),s=t.length,l="complex64"===n?Kt(e):e;if(s>1)for(let e=0;e<r/i;e++){const t=e*i;for(let e=0;e<i;e++)o[e]=Math.max(o[e],Zt(l[t+e],0,n).length)}return o}(e,t,n,r),o=t.length,s=Xt(e,t,n,r,i),l=["Tensor"];return a&&(l.push(` dtype: ${n}`),l.push(` rank: ${o}`),l.push(` shape: [${t}]`),l.push(" values:")),l.push(s.map((e=>" "+e)).join("\n")),l.join("\n")}function Zt(e,t,n){let a;return a=Array.isArray(e)?`${parseFloat(e[0].toFixed(Ht))} + ${parseFloat(e[1].toFixed(Ht))}j`:dt(e)?`'${e}'`:"bool"===n?Qt(e):parseFloat(e.toFixed(Ht)).toString(),lt(a,t)}function Qt(e){return 0===e?"false":"true"}function Xt(e,t,n,a,r,i=!0){const o="complex64"===n?2:1,s=t[0],l=t.length;if(0===l){if("complex64"===n){return[Zt(Kt(e)[0],0,n)]}return"bool"===n?[Qt(e[0])]:[e[0].toString()]}if(1===l){if(s>$t){let t=Array.from(e.slice(0,qt*o)),a=Array.from(e.slice((s-qt)*o,s*o));return"complex64"===n&&(t=Kt(t),a=Kt(a)),["["+t.map(((e,t)=>Zt(e,r[t],n))).join(", ")+", ..., "+a.map(((e,t)=>Zt(e,r[s-qt+t],n))).join(", ")+"]"]}return["["+("complex64"===n?Kt(e):Array.from(e)).map(((e,t)=>Zt(e,r[t],n))).join(", ")+"]"]}const u=t.slice(1),d=a.slice(1),c=a[0]*o,f=[];if(s>$t){for(let t=0;t<qt;t++){const a=t*c;f.push(...Xt(e.slice(a,a+c),u,n,d,r,!1))}f.push("...");for(let t=s-qt;t<s;t++){const a=t*c;f.push(...Xt(e.slice(a,a+c),u,n,d,r,t===s-1))}}else for(let t=0;t<s;t++){const a=t*c;f.push(...Xt(e.slice(a,a+c),u,n,d,r,t===s-1))}const h=2===l?",":"";f[0]="["+(s>0?f[0]+h:"");for(let e=1;e<f.length-1;e++)f[e]=" "+f[e]+h;let p=",\n";for(let e=2;e<l;e++)p+="\n";return f[f.length-1]=" "+f[f.length-1]+"]"+(i?"":p),f}function Kt(e){const t=[];for(let n=0;n<e.length;n+=2)t.push([e[n],e[n+1]]);return t}class Jt{constructor(e,t,n){if(this.dtype=t,this.shape=e.slice(),this.size=ot(e),null!=n){const e=n.length;it(e===this.size,(()=>`Length of values '${e}' does not match the size inferred by the shape '${this.size}'.`))}if("complex64"===t)throw new Error("complex64 dtype TensorBuffers are not supported. Please create a TensorBuffer for the real and imaginary parts separately and call tf.complex(real, imag).");this.values=n||function(e,t){let n=null;if(null==e||"float32"===e)n=new Float32Array(t);else if("int32"===e)n=new Int32Array(t);else if("bool"===e)n=new Uint8Array(t);else{if("string"!==e)throw new Error(`Unknown data type ${e}`);n=new Array(t)}return n}(t,this.size),this.strides=ht(e)}set(e,...t){0===t.length&&(t=[0]),it(t.length===this.rank,(()=>`The number of provided coordinates (${t.length}) must match the rank (${this.rank})`));const n=this.locToIndex(t);this.values[n]=e}get(...e){0===e.length&&(e=[0]);let t=0;for(const n of e){if(n<0||n>=this.shape[t]){throw new Error(`Requested out of range element at ${e}. Buffer shape=${this.shape}`)}t++}let n=e[e.length-1];for(let t=0;t<e.length-1;++t)n+=this.strides[t]*e[t];return this.values[n]}locToIndex(e){if(0===this.rank)return 0;if(1===this.rank)return e[0];let t=e[e.length-1];for(let n=0;n<e.length-1;++n)t+=this.strides[n]*e[n];return t}indexToLoc(e){if(0===this.rank)return[];if(1===this.rank)return[e];const t=new Array(this.shape.length);for(let n=0;n<t.length-1;++n)t[n]=Math.floor(e/this.strides[n]),e-=t[n]*this.strides[n];return t[t.length-1]=e,t}get rank(){return this.shape.length}toTensor(){return en().makeTensor(this.values,this.shape,this.dtype)}}let en=null,tn=null;class nn{constructor(e,t,n,a){this.kept=!1,this.isDisposedInternal=!1,this.shape=e.slice(),this.dtype=t||"float32",this.size=ot(e),this.strides=ht(e),this.dataId=n,this.id=a,this.rankType=this.rank<5?this.rank.toString():"higher"}get rank(){return this.shape.length}async buffer(){const e=await this.data();return tn.buffer(this.shape,this.dtype,e)}bufferSync(){return tn.buffer(this.shape,this.dtype,this.dataSync())}async array(){const e=await this.data();return mt(this.shape,e,"complex64"===this.dtype)}arraySync(){return mt(this.shape,this.dataSync(),"complex64"===this.dtype)}async data(){this.throwIfDisposed();const e=en().read(this.dataId);if("string"===this.dtype){const t=await e;try{return t.map((e=>_t(e)))}catch(e){throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}}return e}dataToGPU(e){return this.throwIfDisposed(),en().readToGPU(this.dataId,e)}dataSync(){this.throwIfDisposed();const e=en().readSync(this.dataId);if("string"===this.dtype)try{return e.map((e=>_t(e)))}catch(e){throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}return e}async bytes(){this.throwIfDisposed();const e=await en().read(this.dataId);return"string"===this.dtype?e:new Uint8Array(e.buffer)}dispose(){this.isDisposed||(en().disposeTensor(this),this.isDisposedInternal=!0)}get isDisposed(){return this.isDisposedInternal}throwIfDisposed(){if(this.isDisposed)throw new Error("Tensor is disposed.")}print(e=!1){return tn.print(this,e)}clone(){return this.throwIfDisposed(),tn.clone(this)}toString(e=!1){return Yt(this.dataSync(),this.shape,this.dtype,e)}cast(e){return this.throwIfDisposed(),tn.cast(this,e)}variable(e=!0,t,n){return this.throwIfDisposed(),en().makeVariable(this,e,t,n)}}Object.defineProperty(nn,Symbol.hasInstance,{value:e=>!!e&&null!=e.data&&null!=e.dataSync&&null!=e.throwIfDisposed}),Mt("Tensor",(()=>nn));class an extends nn{constructor(e,t,n,a){super(e.shape,e.dtype,e.dataId,a),this.trainable=t,this.name=n}assign(e){if(e.dtype!==this.dtype)throw new Error(`dtype of the new value (${e.dtype}) and previous value (${this.dtype}) must match`);if(!st(e.shape,this.shape))throw new Error(`shape of the new value (${e.shape}) and previous value (${this.shape}) must match`);en().disposeTensor(this),this.dataId=e.dataId,en().incRef(this,null)}dispose(){en().disposeVariable(this),this.isDisposedInternal=!0}}var rn,on,sn,ln,un;Object.defineProperty(an,Symbol.hasInstance,{value:e=>e instanceof nn&&null!=e.assign&&e.assign instanceof Function}),function(e){e.R0="R0",e.R1="R1",e.R2="R2",e.R3="R3",e.R4="R4",e.R5="R5",e.R6="R6"}(rn||(rn={})),function(e){e.float32="float32",e.int32="int32",e.bool="int32",e.complex64="complex64"}(on||(on={})),function(e){e.float32="float32",e.int32="int32",e.bool="bool",e.complex64="complex64"}(sn||(sn={})),function(e){e.float32="float32",e.int32="float32",e.bool="float32",e.complex64="complex64"}(ln||(ln={})),function(e){e.float32="complex64",e.int32="complex64",e.bool="complex64",e.complex64="complex64"}(un||(un={}));const dn={float32:ln,int32:on,bool:sn,complex64:un};function cn(e){return null!=e&&"object"==typeof e&&"texture"in e&&e.texture instanceof WebGLTexture}function fn(e){return"undefined"!=typeof GPUBuffer&&null!=e&&"object"==typeof e&&"buffer"in e&&e.buffer instanceof GPUBuffer}function hn(e,t){if(e.dtype===t.dtype)return[e,t];const n=function(e,t){if("string"===e||"string"===t){if("string"===e&&"string"===t)return"string";throw new Error(`Can not upcast ${e} with ${t}`)}return dn[e][t]}(e.dtype,t.dtype);return[e.cast(n),t.cast(n)]}function pn(e){const t=[];return mn(e,t,new Set),t}function mn(e,t,n){if(null==e)return;if(e instanceof nn)return void t.push(e);if(a=e,!Array.isArray(a)&&"object"!=typeof a)return;var a;const r=e;for(const e in r){const a=r[e];n.has(a)||(n.add(a),mn(a,t,n))}}function gn(e){return null!=e.kernelName}class vn{constructor(){this.registeredVariables={},this.nextTapeNodeId=0,this.numBytes=0,this.numTensors=0,this.numStringTensors=0,this.numDataBuffers=0,this.gradientDepth=0,this.kernelDepth=0,this.scopeStack=[],this.numDataMovesStack=[],this.nextScopeId=0,this.tensorInfo=new WeakMap,this.profiling=!1,this.activeProfile={newBytes:0,newTensors:0,peakBytes:0,kernels:[],result:null,get kernelNames(){return Array.from(new Set(this.kernels.map((e=>e.name))))}}}dispose(){for(const e in this.registeredVariables)this.registeredVariables[e].dispose()}}class yn{constructor(e){this.ENV=e,this.registry={},this.registryFactory={},this.pendingBackendInitId=0,this.state=new vn}async ready(){if(null!=this.pendingBackendInit)return this.pendingBackendInit.then((()=>{}));if(null!=this.backendInstance)return;const e=this.getSortedBackends();for(let t=0;t<e.length;t++){const n=e[t];if(await this.initializeBackend(n).success)return void await this.setBackend(n)}throw new Error("Could not initialize any backends, all backend initializations failed.")}get backend(){if(null!=this.pendingBackendInit)throw new Error(`Backend '${this.backendName}' has not yet been initialized. Make sure to await tf.ready() or await tf.setBackend() before calling other methods`);if(null==this.backendInstance){const{name:e,asyncInit:t}=this.initializeBackendsAndReturnBest();if(t)throw new Error(`The highest priority backend '${e}' has not yet been initialized. Make sure to await tf.ready() or await tf.setBackend() before calling other methods`);this.setBackend(e)}return this.backendInstance}backendNames(){return Object.keys(this.registryFactory)}findBackend(e){if(!(e in this.registry)){if(!(e in this.registryFactory))return null;{const{asyncInit:t}=this.initializeBackend(e);if(t)return null}}return this.registry[e]}findBackendFactory(e){return e in this.registryFactory?this.registryFactory[e].factory:null}registerBackend(e,t,n=1){return e in this.registryFactory?(Nt(`${e} backend was already registered. Reusing existing backend factory.`),!1):(this.registryFactory[e]={factory:t,priority:n},!0)}async setBackend(e){if(null==this.registryFactory[e])throw new Error(`Backend name '${e}' not found in registry`);if(this.backendName=e,null==this.registry[e]){this.backendInstance=null;const{success:t,asyncInit:n}=this.initializeBackend(e);if(!(n?await t:t))return!1}return this.backendInstance=this.registry[e],this.setupRegisteredKernels(),this.profiler=new Gt(this.backendInstance),!0}setupRegisteredKernels(){Ft(this.backendName).forEach((e=>{null!=e.setupFunc&&e.setupFunc(this.backendInstance)}))}disposeRegisteredKernels(e){Ft(e).forEach((t=>{null!=t.disposeFunc&&t.disposeFunc(this.registry[e])}))}initializeBackend(e){const t=this.registryFactory[e];if(null==t)throw new Error(`Cannot initialize backend ${e}, no registration found.`);try{const n=t.factory();if(!n||n instanceof at||"function"!=typeof n.then)return this.registry[e]=n,{success:!0,asyncInit:!1};{const t=++this.pendingBackendInitId,a=n.then((n=>!(t<this.pendingBackendInitId)&&(this.registry[e]=n,this.pendingBackendInit=null,!0))).catch((n=>(t<this.pendingBackendInitId||(this.pendingBackendInit=null,Nt(`Initialization of backend ${e} failed`),Nt(n.stack||n.message)),!1)));return this.pendingBackendInit=a,{success:a,asyncInit:!0}}}catch(t){return Nt(`Initialization of backend ${e} failed`),Nt(t.stack||t.message),{success:!1,asyncInit:!1}}}removeBackend(e){if(!(e in this.registryFactory))throw new Error(`${e} backend not found in registry`);this.backendName===e&&null!=this.pendingBackendInit&&this.pendingBackendInitId++,e in this.registry&&(this.disposeRegisteredKernels(e),this.registry[e].dispose(),delete this.registry[e]),delete this.registryFactory[e],this.backendName===e&&(this.pendingBackendInit=null,this.backendName=null,this.backendInstance=null)}getSortedBackends(){if(0===Object.keys(this.registryFactory).length)throw new Error("No backend found in registry.");return Object.keys(this.registryFactory).sort(((e,t)=>this.registryFactory[t].priority-this.registryFactory[e].priority))}initializeBackendsAndReturnBest(){const e=this.getSortedBackends();for(let t=0;t<e.length;t++){const n=e[t],{success:a,asyncInit:r}=this.initializeBackend(n);if(r||a)return{name:n,asyncInit:r}}throw new Error("Could not initialize any backends, all backend initializations failed.")}moveData(e,t){const n=this.state.tensorInfo.get(t),a=n.backend,r=this.readSync(t),i=a.refCount(t);a.disposeData(t,!0),n.backend=e,e.move(t,r,n.shape,n.dtype,i),this.shouldCheckForMemLeaks()&&this.state.numDataMovesStack[this.state.numDataMovesStack.length-1]++}tidy(e,t){let n,a=null;if(null==t){if("function"!=typeof e)throw new Error("Please provide a function to tidy()");t=e}else{if("string"!=typeof e&&!(e instanceof String))throw new Error("When calling with two arguments, the first argument to tidy() must be a string");if("function"!=typeof t)throw new Error("When calling with two arguments, the 2nd argument to tidy() must be a function");a=e}return this.scopedRun((()=>this.startScope(a)),(()=>this.endScope(n)),(()=>(n=t(),n instanceof Promise&&console.error("Cannot return a Promise inside of tidy."),n)))}scopedRun(e,t,n){e();try{const e=n();return t(),e}catch(e){throw t(),e}}nextTensorId(){return yn.nextTensorId++}nextVariableId(){return yn.nextVariableId++}clone(e){const t=xn.runKernel(Dt,{x:e});return this.addTapeNode(this.state.activeScope.name,{x:e},[t],(e=>({x:()=>xn.runKernel(St,{x:e},{dtype:"float32"})})),[],{}),t}runKernel(e,t,n){if(!(null!=Rt(e,this.backendName)))throw new Error(`Kernel '${e}' not registered for backend '${this.backendName}'`);return this.runKernelFunc({kernelName:e,inputs:t,attrs:n})}shouldCheckForMemLeaks(){return this.ENV.getBool("IS_TEST")}checkKernelForMemLeak(e,t,n){const a=this.backend.numDataIds();let r=0;n.forEach((e=>{r+="complex64"===e.dtype?3:1}));const i=a-t-r-this.state.numDataMovesStack[this.state.numDataMovesStack.length-1];if(i>0)throw new Error(`Backend '${this.backendName}' has an internal memory leak (${i} data ids) after running '${e}'`)}runKernelFunc(e){let t,n=[];const a=this.isTapeOn(),r=this.state.numBytes,i=this.state.numTensors;let o,s;this.shouldCheckForMemLeaks()&&this.state.numDataMovesStack.push(0);const l=gn(e)?e.kernelName:null!=this.state.activeScope?this.state.activeScope.name:"";if(gn(e)){const{kernelName:t,inputs:r,attrs:i}=e,l=Rt(t,this.backendName);it(null!=l,(()=>`Cannot find registered kernel '${t}' for backend '${this.backendName}'`)),o=()=>{const e=this.backend.numDataIds();s=l.kernelFunc({inputs:r,attrs:i,backend:this.backend});const o=Array.isArray(s)?s:[s];this.shouldCheckForMemLeaks()&&this.checkKernelForMemLeak(t,e,o);const u=o.map((e=>null!=e.rank?e:this.makeTensorFromTensorInfo(e)));if(a){const e=this.getTensorsForGradient(t,r,u);n=this.saveTensorsForBackwardMode(e)}return u}}else{const{forwardFunc:t}=e,r=e=>{a&&(n=e.map((e=>this.keep(this.clone(e)))))};o=()=>{const e=this.backend.numDataIds();s=this.tidy((()=>t(this.backend,r)));const n=Array.isArray(s)?s:[s];return this.shouldCheckForMemLeaks()&&this.checkKernelForMemLeak(l,e,n),n}}const{inputs:u,attrs:d}=e,c=gn(e)?null:e.backwardsFunc;let f;return this.scopedRun((()=>this.state.kernelDepth++),(()=>this.state.kernelDepth--),(()=>{this.ENV.getBool("DEBUG")||this.state.profiling?(f=this.profiler.profileKernel(l,u,(()=>o())),this.ENV.getBool("DEBUG")&&this.profiler.logKernelProfile(f),t=f.outputs):t=o()})),a&&this.addTapeNode(l,u,t,c,n,d),this.state.profiling&&this.state.activeProfile.kernels.push({name:l,bytesAdded:this.state.numBytes-r,totalBytesSnapshot:this.state.numBytes,tensorsAdded:this.state.numTensors-i,totalTensorsSnapshot:this.state.numTensors,inputShapes:Object.keys(u).map((e=>null!=u[e]?u[e].shape:null)),outputShapes:t.map((e=>e.shape)),kernelTimeMs:f.timeMs,extraInfo:f.extraInfo}),Array.isArray(s)?t:t[0]}saveTensorsForBackwardMode(e){return e.map((e=>this.keep(this.clone(e))))}getTensorsForGradient(e,t,n){const a=Ot(e);if(null!=a){const e=a.inputsToSave||[],r=a.outputsToSave||[];let i;a.saveAllInputs?(it(Array.isArray(t),(()=>"saveAllInputs is true, expected inputs to be an array.")),i=Object.keys(t).map((e=>t[e]))):i=e.map((e=>t[e]));const o=n.filter(((e,t)=>r[t]));return i.concat(o)}return[]}makeTensor(e,t,n,a){if(null==e)throw new Error("Values passed to engine.makeTensor() are null");a=a||this.backend;let r=e;"string"===(n=n||"float32")&&dt(e[0])&&(r=e.map((e=>function(e,t="utf-8"){return t=t||"utf-8",wt().platform.encode(e,t)}(e))));const i=a.write(r,t,n),o=new nn(t,n,i,this.nextTensorId());if(this.trackTensor(o,a),"string"===n){const e=this.state.tensorInfo.get(i),t=function(e){if(null==e)return 0;let t=0;return e.forEach((e=>t+=e.length)),t}(r);this.state.numBytes+=t-e.bytes,e.bytes=t}return o}makeTensorFromDataId(e,t,n,a){return this.makeTensorFromTensorInfo({dataId:e,shape:t,dtype:n=n||"float32"},a)}makeTensorFromTensorInfo(e,t){const{dataId:n,shape:a,dtype:r}=e,i=new nn(a,r,n,this.nextTensorId());return this.trackTensor(i,t),i}makeVariable(e,t=!0,n,a){n=n||this.nextVariableId().toString(),null!=a&&a!==e.dtype&&(e=e.cast(a));const r=new an(e,t,n,this.nextTensorId());if(null!=this.state.registeredVariables[r.name])throw new Error(`Variable with name ${r.name} was already registered`);return this.state.registeredVariables[r.name]=r,this.incRef(r,this.backend),r}trackTensor(e,t){this.state.numTensors++,"string"===e.dtype&&this.state.numStringTensors++;let n=0;"complex64"!==e.dtype&&"string"!==e.dtype&&(n=e.size*ut(e.dtype)),this.state.numBytes+=n,this.state.tensorInfo.has(e.dataId)||(this.state.numDataBuffers++,this.state.tensorInfo.set(e.dataId,{backend:t||this.backend,dtype:e.dtype,shape:e.shape,bytes:n})),e instanceof an||this.track(e)}incRef(e,t){this.trackTensor(e,t),this.backend.incRef(e.dataId)}removeDataId(e,t){this.state.tensorInfo.has(e)&&this.state.tensorInfo.get(e).backend===t&&(this.state.tensorInfo.delete(e),this.state.numDataBuffers--)}disposeTensor(e){if(!this.state.tensorInfo.has(e.dataId))return;const t=this.state.tensorInfo.get(e.dataId);if(this.state.numTensors--,"string"===e.dtype&&(this.state.numStringTensors--,this.state.numBytes-=t.bytes),"complex64"!==e.dtype&&"string"!==e.dtype){const t=e.size*ut(e.dtype);this.state.numBytes-=t}t.backend.disposeData(e.dataId)&&this.removeDataId(e.dataId,t.backend)}disposeVariables(){for(const e in this.state.registeredVariables){this.disposeVariable(this.state.registeredVariables[e])}}disposeVariable(e){this.disposeTensor(e),null!=this.state.registeredVariables[e.name]&&delete this.state.registeredVariables[e.name]}memory(){const e=this.backend.memory();return e.numTensors=this.state.numTensors,e.numDataBuffers=this.state.numDataBuffers,e.numBytes=this.state.numBytes,this.state.numStringTensors>0&&(e.unreliable=!0,null==e.reasons&&(e.reasons=[]),e.reasons.push("Memory usage by string tensors is approximate (2 bytes per character)")),e}async profile(e){this.state.profiling=!0;const t=this.state.numBytes,n=this.state.numTensors;this.state.activeProfile.kernels=[],this.state.activeProfile.result=await e(),this.state.profiling=!1,this.state.activeProfile.peakBytes=Math.max(...this.state.activeProfile.kernels.map((e=>e.totalBytesSnapshot))),this.state.activeProfile.newBytes=this.state.numBytes-t,this.state.activeProfile.newTensors=this.state.numTensors-n;for(const e of this.state.activeProfile.kernels)e.kernelTimeMs=await e.kernelTimeMs,e.extraInfo=await e.extraInfo;return this.state.activeProfile}isTapeOn(){return this.state.gradientDepth>0&&0===this.state.kernelDepth}addTapeNode(e,t,n,a,r,i){const o={id:this.state.nextTapeNodeId++,kernelName:e,inputs:t,outputs:n,saved:r},s=Ot(e);null!=s&&(a=s.gradFunc),null!=a&&(o.gradient=e=>(e=e.map(((e,t)=>{if(null==e){const e=n[t],a=gt(e.size,e.dtype);return this.makeTensor(a,e.shape,e.dtype)}return e})),a(e.length>1?e:e[0],r,i))),this.state.activeTape.push(o)}keep(e){return e.kept=!0,e}startTape(){0===this.state.gradientDepth&&(this.state.activeTape=[]),this.state.gradientDepth++}endTape(){this.state.gradientDepth--}startScope(e){const t={track:[],name:"unnamed scope",id:this.state.nextScopeId++};e&&(t.name=e),this.state.scopeStack.push(t),this.state.activeScope=t}endScope(e){const t=pn(e),n=new Set(t.map((e=>e.id)));for(let e=0;e<this.state.activeScope.track.length;e++){const t=this.state.activeScope.track[e];t.kept||n.has(t.id)||t.dispose()}const a=this.state.scopeStack.pop();this.state.activeScope=0===this.state.scopeStack.length?null:this.state.scopeStack[this.state.scopeStack.length-1],t.forEach((e=>{e.kept||e.scopeId!==a.id||this.track(e)}))}gradients(e,t,n,a=!1){if(it(t.length>0,(()=>"gradients() received an empty list of xs.")),null!=n&&"float32"!==n.dtype)throw new Error(`dy must have 'float32' dtype, but has '${n.dtype}'`);const r=this.scopedRun((()=>this.startTape()),(()=>this.endTape()),(()=>this.tidy("forward",e)));it(r instanceof nn,(()=>"The result y returned by f() must be a tensor."));const i=function(e,t,n){const a={},r={};for(let e=0;e<t.length;e++)a[t[e].id]=!0;for(let n=0;n<e.length;n++){const i=e[n],o=i.inputs;for(const e in o){const n=o[e];let s=!1;for(let e=0;e<t.length;e++)if(a[n.id]){i.outputs.forEach((e=>a[e.id]=!0)),s=!0,r[i.id]=!0;break}if(s)break}}const i={};i[n.id]=!0;const o={};for(let t=e.length-1;t>=0;t--){const n=e[t],a=n.inputs;for(let e=0;e<n.outputs.length;e++)if(i[n.outputs[e].id]){for(const e in a)i[a[e].id]=!0,o[n.id]=!0;break}}const s=[];for(let t=0;t<e.length;t++){const n=e[t];if(r[n.id]&&o[n.id]){const e={};for(const t in n.inputs){const r=n.inputs[t];a[r.id]&&(e[t]=r)}const t=Object.assign({},n);t.inputs=e,t.outputs=n.outputs,s.push(t)}}return s}(this.state.activeTape,t,r);if(!a&&0===i.length&&t.length>0)throw new Error("Cannot compute gradient of y=f(x) with respect to x. Make sure that the f you passed encloses all operations that lead from x to y.");return this.tidy("backward",(()=>{const e={};e[r.id]=null==n?function(e){const t=function(e,t){const n=gt(e,t);for(let e=0;e<n.length;e++)n[e]=1;return n}(ot(e),"float32");return xn.makeTensor(t,e,"float32")}(r.shape):n,function(e,t,n,a){for(let r=t.length-1;r>=0;r--){const i=t[r],o=[];if(i.outputs.forEach((t=>{const n=e[t.id];o.push(null!=n?n:null)})),null==i.gradient)throw new Error(`Cannot compute gradient: gradient function not found for ${i.kernelName}.`);const s=i.gradient(o);for(const t in i.inputs){if(!(t in s))throw new Error(`Cannot backprop through input ${t}. Available gradients found: ${Object.keys(s)}.`);const r=n((()=>s[t]()));if("float32"!==r.dtype)throw new Error(`Error in gradient for op ${i.kernelName}. The gradient of input ${t} must have 'float32' dtype, but has '${r.dtype}'`);const o=i.inputs[t];if(!st(r.shape,o.shape))throw new Error(`Error in gradient for op ${i.kernelName}. The gradient of input '${t}' has shape '${r.shape}', which does not match the shape of the input '${o.shape}'`);if(null==e[o.id])e[o.id]=r;else{const t=e[o.id];e[o.id]=a(t,r),t.dispose()}}}}(e,i,(e=>this.tidy(e)),Cn);const a=t.map((t=>e[t.id]));return 0===this.state.gradientDepth&&(this.state.activeTape.forEach((e=>{for(const t of e.saved)t.dispose()})),this.state.activeTape=null),{value:r,grads:a}}))}customGrad(e){return it(ft(e),(()=>"The f passed in customGrad(f) must be a function.")),(...t)=>{let n;it(t.every((e=>e instanceof nn)),(()=>"The args passed in customGrad(f)(x1, x2,...) must all be tensors"));const a={};t.forEach(((e,t)=>{a[t]=e}));return this.runKernelFunc({forwardFunc:(a,r)=>(n=e(...t,r),it(n.value instanceof nn,(()=>"The function f passed in customGrad(f) must return an object where `obj.value` is a tensor")),it(ft(n.gradFunc),(()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function.")),n.value),backwardsFunc:(e,a)=>{const r=n.gradFunc(e,a),i=Array.isArray(r)?r:[r];it(i.length===t.length,(()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns the same number of tensors as inputs passed to f(...).")),it(i.every((e=>e instanceof nn)),(()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns a list of only tensors."));const o={};return i.forEach(((e,t)=>{o[t]=()=>e})),o},inputs:a})}}readSync(e){return this.state.tensorInfo.get(e).backend.readSync(e)}read(e){return this.state.tensorInfo.get(e).backend.read(e)}readToGPU(e,t){return this.state.tensorInfo.get(e).backend.readToGPU(e,t)}async time(e){const t=Bt(),n=await this.backend.time(e);return n.wallMs=Bt()-t,n}track(e){return null!=this.state.activeScope&&(e.scopeId=this.state.activeScope.id,this.state.activeScope.track.push(e)),e}get registeredVariables(){return this.state.registeredVariables}reset(){this.pendingBackendInitId++,this.state.dispose(),this.ENV.reset(),this.state=new vn;for(const e in this.registry)this.disposeRegisteredKernels(e),this.registry[e].dispose(),delete this.registry[e];this.backendName=null,this.backendInstance=null,this.pendingBackendInit=null}}function bn(){const e=Tt();if(null==e._tfengine){const t=new xt(e);e._tfengine=new yn(t)}return kt=e._tfengine.ENV,function(e){en=e}((()=>e._tfengine)),e._tfengine}yn.nextTensorId=0,yn.nextVariableId=0;const xn=bn();function Cn(e,t){return xn.runKernel(It,{a:e,b:t})}let wn;function En(e){if(void 0!==wn)return wn;if(e||"undefined"!=typeof navigator&&null!=navigator){if(e||(e=navigator),"ReactNative"===e.product)return!0;const t=e.userAgent||e.vendor||("undefined"!=typeof window?window.opera:"");if(!t){return e.userAgentData&&e.userAgentData.mobile}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(t)||/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(t.substr(0,4))}return!1}const kn=wt();function Tn(e,t){let n=e;if(Ut(e))return"string"===t?[]:[e.length];if(cn(e)){return[e.height,e.width*(e.channels||"RGBA").length]}if(fn(e))return[e.buffer.size/(null==t?4:ut(t))];if(!Array.isArray(e))return[];const a=[];for(;Array.isArray(n)||Ut(n)&&"string"!==t;)a.push(n.length),n=n[0];return Array.isArray(e)&&wt().getBool("TENSORLIKE_CHECK_SHAPE_CONSISTENCY")&&Mn(e,a,[]),a}function Mn(e,t,n){if(n=n||[],!Array.isArray(e)&&!Ut(e))return void it(0===t.length,(()=>`Element arr[${n.join("][")}] is a primitive, but should be an array/TypedArray of ${t[0]} elements`));it(t.length>0,(()=>`Element arr[${n.join("][")}] should be a primitive, but is an array of ${e.length} elements`)),it(e.length===t[0],(()=>`Element arr[${n.join("][")}] should have ${t[0]} elements, but has ${e.length} elements`));const a=t.slice(1);for(let t=0;t<e.length;++t)Mn(e[t],a,n.concat(t))}function In(e,t,n,a){if("string_or_numeric"!==e){if(null==e)throw new Error("Expected dtype cannot be null.");if("numeric"!==e&&e!==t||"numeric"===e&&"string"===t)throw new Error(`Argument '${n}' passed to '${a}' must be ${e} tensor, but got ${t} tensor`)}}function Sn(e,t,n,a="numeric"){if(e instanceof nn)return In(a,e.dtype,t,n),e;let r=ct(e);if("string"!==r&&["bool","int32","float32"].indexOf(a)>=0&&(r=a),In(a,r,t,n),null==e||!Ut(e)&&!Array.isArray(e)&&"number"!=typeof e&&"boolean"!=typeof e&&"string"!=typeof e){throw new Error(`Argument '${t}' passed to '${n}' must be a Tensor or TensorLike, but got '${null==e?"null":e.constructor.name}'`)}const i=Tn(e,r);Ut(e)||Array.isArray(e)||(e=[e]);const o="string"!==r?Pt(e,r):zt(e,[],!0);return xn.makeTensor(o,i,r)}kn.registerFlag("DEBUG",(()=>!1),(e=>{e&&console.warn("Debugging mode is ON. The output of every math call will be downloaded to CPU and checked for NaNs. This significantly impacts performance.")})),kn.registerFlag("IS_BROWSER",(()=>"undefined"!=typeof window&&null!=window.document||"undefined"!=typeof WorkerGlobalScope)),kn.registerFlag("IS_NODE",(()=>"undefined"!=typeof process&&void 0!==process.versions&&void 0!==process.versions.node)),kn.registerFlag("IS_CHROME",(()=>"undefined"!=typeof navigator&&null!=navigator&&null!=navigator.userAgent&&/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor))),kn.registerFlag("IS_SAFARI",(()=>"undefined"!=typeof navigator&&null!=navigator&&null!=navigator.userAgent&&/Safari/.test(navigator.userAgent)&&/Apple/.test(navigator.vendor))),kn.registerFlag("PROD",(()=>!1)),kn.registerFlag("TENSORLIKE_CHECK_SHAPE_CONSISTENCY",(()=>kn.getBool("DEBUG"))),kn.registerFlag("DEPRECATION_WARNINGS_ENABLED",(()=>!0)),kn.registerFlag("IS_TEST",(()=>!1)),kn.registerFlag("CHECK_COMPUTATION_FOR_ERRORS",(()=>kn.getBool("DEBUG"))),kn.registerFlag("WRAP_TO_IMAGEBITMAP",(()=>!1)),kn.registerFlag("CANVAS2D_WILL_READ_FREQUENTLY_FOR_GPU",(()=>!1)),kn.registerFlag("USE_SETTIMEOUTCUSTOM",(()=>!1));function Dn(e){const t=Object.keys(e);if(1!==t.length)throw new Error(`Please provide an object with a single key (operation name) mapping to a function. Got an object with ${t.length} keys.`);let n=t[0];const a=e[n];n.endsWith("_")&&(n=n.substring(0,n.length-1)),n+="__op";const r=(...e)=>{xn.startScope(n);try{const t=a(...e);return yt(t)&&console.error("Cannot return a Promise inside of tidy."),xn.endScope(t),t}catch(e){throw xn.endScope(null),e}};return Object.defineProperty(r,"name",{value:n,configurable:!0}),r}class Nn{static join(e){return new Nn(e).slice()}constructor(e){if(this.shards=[],this.previousShardIndex=0,null==e)return;if(e instanceof Array||(e=[e]),0===(e=e.map((e=>Ut(e)?e.buffer:e))).length)return;this.bufferUniformSize=e[0].byteLength;let t=0;for(let n=0;n<e.length;n++){const a=e[n];n!==e.length-1&&a.byteLength!==this.bufferUniformSize&&(this.bufferUniformSize=void 0);const r=t+a.byteLength;this.shards.push({buffer:a,start:t,end:r}),t=r}0===this.shards.length&&(this.byteLength=0),this.byteLength=this.shards[this.shards.length-1].end}slice(e=0,t=this.byteLength){if(0===this.shards.length)return new ArrayBuffer(0);if(e=isNaN(Number(e))?0:e,t=isNaN(Number(t))?0:t,e=Math.max(0,e),(t=Math.min(this.byteLength,t))<=e)return new ArrayBuffer(0);const n=this.findShardForByte(e);if(-1===n)throw new Error(`Could not find start shard for byte ${e}`);const a=new ArrayBuffer(t-e),r=new Uint8Array(a);let i=0;for(let a=n;a<this.shards.length;a++){const n=this.shards[a],o=e+i-n.start,s=i,l=Math.min(t,n.end),u=new Uint8Array(n.buffer,o,l-n.start-o);if(r.set(u,s),i+=u.length,t<n.end)break}return a}findShardForByte(e){if(0===this.shards.length||e<0||e>=this.byteLength)return-1;if(null!=this.bufferUniformSize)return this.previousShardIndex=Math.floor(e/this.bufferUniformSize),this.previousShardIndex;function t(t){return e<t.start?-1:e>=t.end?1:0}if(0===t(this.shards[this.previousShardIndex]))return this.previousShardIndex;const n=function(e,t){let n=0,a=e.length;for(;n<=a;){const r=Math.floor((a-n)/2)+n,i=t(e[r]);if(0===i)return r;i<0?a=r:n=r+1}return-1}(this.shards,t);return-1===n?-1:(this.previousShardIndex=n,this.previousShardIndex)}}const An="undefined"!=typeof Buffer&&("undefined"==typeof Blob||"undefined"==typeof atob||"undefined"==typeof btoa);function Ln(e){return An?Buffer.byteLength(e,"utf8"):new Blob([e]).size}function Rn(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("Expected JSON model topology, received ArrayBuffer.");return{dateSaved:new Date,modelTopologyType:"JSON",modelTopologyBytes:null==e.modelTopology?0:Ln(JSON.stringify(e.modelTopology)),weightSpecsBytes:null==e.weightSpecs?0:Ln(JSON.stringify(e.weightSpecs)),weightDataBytes:null==e.weightData?0:new Nn(e.weightData).byteLength}}class On{constructor(){this.saveRouters=[],this.loadRouters=[]}static getInstance(){return null==On.instance&&(On.instance=new On),On.instance}static registerSaveRouter(e){On.getInstance().saveRouters.push(e)}static registerLoadRouter(e){On.getInstance().loadRouters.push(e)}static getSaveHandlers(e){return On.getHandlers(e,"save")}static getLoadHandlers(e,t){return On.getHandlers(e,"load",t)}static getHandlers(e,t,n){const a=[];return("load"===t?On.getInstance().loadRouters:On.getInstance().saveRouters).forEach((t=>{const r=t(e,n);null!==r&&a.push(r)})),a}}const Fn="tensorflowjs",jn="models_store",Pn="model_info_store";function Bn(){if(!wt().getBool("IS_BROWSER"))throw new Error("Failed to obtain IndexedDB factory because the current environmentis not a web browser.");const e="undefined"==typeof window?self:window,t=e.indexedDB||e.mozIndexedDB||e.webkitIndexedDB||e.msIndexedDB||e.shimIndexedDB;if(null==t)throw new Error("The current browser does not appear to support IndexedDB.");return t}function _n(e){const t=e.result;t.createObjectStore(jn,{keyPath:"modelPath"}),t.createObjectStore(Pn,{keyPath:"modelPath"})}class Un{constructor(e){if(this.indexedDB=Bn(),null==e||!e)throw new Error("For IndexedDB, modelPath must not be null, undefined or empty.");this.modelPath=e}async save(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");return this.databaseAction(this.modelPath,e)}async load(){return this.databaseAction(this.modelPath)}databaseAction(e,t){return new Promise(((e,n)=>{const a=this.indexedDB.open(Fn,1);a.onupgradeneeded=()=>_n(a),a.onsuccess=()=>{const r=a.result;if(null==t){const t=r.transaction(jn,"readonly"),a=t.objectStore(jn).get(this.modelPath);a.onsuccess=()=>{if(null==a.result)return r.close(),n(new Error(`Cannot find model with path '${this.modelPath}' in IndexedDB.`));e(a.result.modelArtifacts)},a.onerror=e=>(r.close(),n(a.error)),t.oncomplete=()=>r.close()}else{const a=Rn(t),i=r.transaction(Pn,"readwrite");let o,s,l=i.objectStore(Pn);try{o=l.put({modelPath:this.modelPath,modelArtifactsInfo:a})}catch(e){return n(e)}o.onsuccess=()=>{s=r.transaction(jn,"readwrite");const o=s.objectStore(jn);let u;try{u=o.put({modelPath:this.modelPath,modelArtifacts:t,modelArtifactsInfo:a})}catch(e){return n(e)}u.onsuccess=()=>e({modelArtifactsInfo:a}),u.onerror=e=>{l=i.objectStore(Pn);const t=l.delete(this.modelPath);t.onsuccess=()=>(r.close(),n(u.error)),t.onerror=e=>(r.close(),n(u.error))}},o.onerror=e=>(r.close(),n(o.error)),i.oncomplete=()=>{null==s?r.close():s.oncomplete=()=>r.close()}}},a.onerror=e=>n(a.error)}))}}Un.URL_SCHEME="indexeddb://";const zn=e=>{return wt().getBool("IS_BROWSER")&&!Array.isArray(e)&&e.startsWith(Un.URL_SCHEME)?(t=e.slice(Un.URL_SCHEME.length),new Un(t)):null;var t};On.registerSaveRouter(zn),On.registerLoadRouter(zn);class Gn{constructor(){this.indexedDB=Bn()}async listModels(){return new Promise(((e,t)=>{const n=this.indexedDB.open(Fn,1);n.onupgradeneeded=()=>_n(n),n.onsuccess=()=>{const a=n.result,r=a.transaction(Pn,"readonly"),i=r.objectStore(Pn).getAll();i.onsuccess=()=>{const t={};for(const e of i.result)t[e.modelPath]=e.modelArtifactsInfo;e(t)},i.onerror=e=>(a.close(),t(i.error)),r.oncomplete=()=>a.close()},n.onerror=e=>t(n.error)}))}async removeModel(e){var t;return e=(t=e).startsWith(Un.URL_SCHEME)?t.slice(Un.URL_SCHEME.length):t,new Promise(((t,n)=>{const a=this.indexedDB.open(Fn,1);a.onupgradeneeded=()=>_n(a),a.onsuccess=()=>{const r=a.result,i=r.transaction(Pn,"readwrite"),o=i.objectStore(Pn),s=o.get(e);let l;s.onsuccess=()=>{if(null==s.result)return r.close(),n(new Error(`Cannot find model with path '${e}' in IndexedDB.`));{const a=o.delete(e),i=()=>{l=r.transaction(jn,"readwrite");const a=l.objectStore(jn).delete(e);a.onsuccess=()=>t(s.result.modelArtifactsInfo),a.onerror=e=>n(s.error)};a.onsuccess=i,a.onerror=e=>(i(),r.close(),n(s.error))}},s.onerror=e=>(r.close(),n(s.error)),i.oncomplete=()=>{null==l?r.close():l.oncomplete=()=>r.close()}},a.onerror=e=>n(a.error)}))}}const Wn="/",Vn="tensorflowjs_models",$n="info",qn="model_topology",Hn="weight_specs",Yn="weight_data",Zn="model_metadata";function Qn(e){return{info:[Vn,e,$n].join(Wn),topology:[Vn,e,qn].join(Wn),weightSpecs:[Vn,e,Hn].join(Wn),weightData:[Vn,e,Yn].join(Wn),modelMetadata:[Vn,e,Zn].join(Wn)}}function Xn(e){for(const t of Object.values(e))window.localStorage.removeItem(t)}function Kn(e){const t=e.split(Wn);if(t.length<3)throw new Error(`Invalid key format: ${e}`);return t.slice(1,t.length-1).join(Wn)}class Jn{constructor(e){if(!wt().getBool("IS_BROWSER")||"undefined"==typeof window||void 0===window.localStorage)throw new Error("The current environment does not support local storage.");if(this.LS=window.localStorage,null==e||!e)throw new Error("For local storage, modelPath must not be null, undefined or empty.");this.modelPath=e,this.keys=Qn(this.modelPath)}async save(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");{const t=JSON.stringify(e.modelTopology),n=JSON.stringify(e.weightSpecs),a=Rn(e),r=Nn.join(e.weightData);try{this.LS.setItem(this.keys.info,JSON.stringify(a)),this.LS.setItem(this.keys.topology,t),this.LS.setItem(this.keys.weightSpecs,n),this.LS.setItem(this.keys.weightData,function(e){if(An)return Buffer.from(e).toString("base64");const t=new Uint8Array(e);let n="";for(let e=0,a=t.length;e<a;e++)n+=String.fromCharCode(t[e]);return btoa(n)}(r));return this.LS.setItem(this.keys.modelMetadata,JSON.stringify({format:e.format,generatedBy:e.generatedBy,convertedBy:e.convertedBy,signature:null!=e.signature?e.signature:void 0,userDefinedMetadata:null!=e.userDefinedMetadata?e.userDefinedMetadata:void 0,modelInitializer:null!=e.modelInitializer?e.modelInitializer:void 0,initializerSignature:null!=e.initializerSignature?e.initializerSignature:void 0,trainingConfig:null!=e.trainingConfig?e.trainingConfig:void 0})),{modelArtifactsInfo:a}}catch(e){throw Xn(this.keys),new Error(`Failed to save model '${this.modelPath}' to local storage: size quota being exceeded is a possible cause of this failure: modelTopologyBytes=${a.modelTopologyBytes}, weightSpecsBytes=${a.weightSpecsBytes}, weightDataBytes=${a.weightDataBytes}.`)}}}async load(){const e=JSON.parse(this.LS.getItem(this.keys.info));if(null==e)throw new Error(`In local storage, there is no model with name '${this.modelPath}'`);if("JSON"!==e.modelTopologyType)throw new Error("BrowserLocalStorage does not support loading non-JSON model topology yet.");const t={},n=JSON.parse(this.LS.getItem(this.keys.topology));if(null==n)throw new Error(`In local storage, the topology of model '${this.modelPath}' is missing.`);t.modelTopology=n;const a=JSON.parse(this.LS.getItem(this.keys.weightSpecs));if(null==a)throw new Error(`In local storage, the weight specs of model '${this.modelPath}' are missing.`);t.weightSpecs=a;const r=this.LS.getItem(this.keys.modelMetadata);if(null!=r){const e=JSON.parse(r);t.format=e.format,t.generatedBy=e.generatedBy,t.convertedBy=e.convertedBy,null!=e.signature&&(t.signature=e.signature),null!=e.userDefinedMetadata&&(t.userDefinedMetadata=e.userDefinedMetadata),null!=e.modelInitializer&&(t.modelInitializer=e.modelInitializer),null!=e.initializerSignature&&(t.initializerSignature=e.initializerSignature),null!=e.trainingConfig&&(t.trainingConfig=e.trainingConfig)}const i=this.LS.getItem(this.keys.weightData);if(null==i)throw new Error(`In local storage, the binary weight values of model '${this.modelPath}' are missing.`);return t.weightData=function(e){if(An){const t=Buffer.from(e,"base64");return t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}const t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;++e)n.set([t.charCodeAt(e)],e);return n.buffer}(i),t}}Jn.URL_SCHEME="localstorage://";const ea=e=>{return wt().getBool("IS_BROWSER")&&!Array.isArray(e)&&e.startsWith(Jn.URL_SCHEME)?(t=e.slice(Jn.URL_SCHEME.length),new Jn(t)):null;var t};On.registerSaveRouter(ea),On.registerLoadRouter(ea);class ta{constructor(){it(wt().getBool("IS_BROWSER"),(()=>"Current environment is not a web browser")),it("undefined"==typeof window||void 0!==window.localStorage,(()=>"Current browser does not appear to support localStorage")),this.LS=window.localStorage}async listModels(){const e={},t=Vn+Wn,n=Wn+$n;for(let a=0;a<this.LS.length;++a){const r=this.LS.key(a);if(r.startsWith(t)&&r.endsWith(n)){e[Kn(r)]=JSON.parse(this.LS.getItem(r))}}return e}async removeModel(e){var t;const n=Qn(e=(t=e).startsWith(Jn.URL_SCHEME)?t.slice(Jn.URL_SCHEME.length):t);if(null==this.LS.getItem(n.info))throw new Error(`Cannot find model at path '${e}'`);const a=JSON.parse(this.LS.getItem(n.info));return Xn(n),a}}class na{constructor(){this.managers={}}static getInstance(){return null==na.instance&&(na.instance=new na),na.instance}static registerManager(e,t){it(null!=e,(()=>"scheme must not be undefined or null.")),e.endsWith("://")&&(e=e.slice(0,e.indexOf("://"))),it(e.length>0,(()=>"scheme must not be an empty string."));const n=na.getInstance();it(null==n.managers[e],(()=>`A model store manager is already registered for scheme '${e}'.`)),n.managers[e]=t}static getManager(e){const t=na.getInstance().managers[e];if(null==t)throw new Error(`Cannot find model manager for scheme '${e}'`);return t}static getSchemes(){return Object.keys(na.getInstance().managers)}}class aa{constructor(){this.messageName="setTimeoutCustom",this.functionRefs=[],this.handledMessageCount=0,this.hasEventListener=!1}fetch(e,t){return fetch(e,t)}now(){return performance.now()}encode(e,t){if("utf-8"!==t&&"utf8"!==t)throw new Error(`Browser's encoder only supports utf-8, but got ${t}`);return null==this.textEncoder&&(this.textEncoder=new TextEncoder),this.textEncoder.encode(e)}decode(e,t){return new TextDecoder(t).decode(e)}setTimeoutCustom(e,t){"undefined"!=typeof window&&wt().getBool("USE_SETTIMEOUTCUSTOM")?(this.functionRefs.push(e),setTimeout((()=>{window.postMessage({name:this.messageName,index:this.functionRefs.length-1},"*")}),t),this.hasEventListener||(this.hasEventListener=!0,window.addEventListener("message",(e=>{if(e.source===window&&e.data.name===this.messageName){e.stopPropagation();(0,this.functionRefs[e.data.index])(),this.handledMessageCount++,this.handledMessageCount===this.functionRefs.length&&(this.functionRefs=[],this.handledMessageCount=0)}}),!0))):setTimeout(e,t)}isTypedArray(e){return jt(e)}}if(wt().get("IS_BROWSER")){wt().setPlatform("browser",new aa);try{na.registerManager(Jn.URL_SCHEME,new ta)}catch(e){}try{na.registerManager(Un.URL_SCHEME,new Gn)}catch(e){}}const ra=()=>require("node-fetch");let ia;class oa{constructor(){this.util=require("util"),this.textEncoder=new this.util.TextEncoder}fetch(e,t){return null!=wt().global.fetch?wt().global.fetch(e,t):(null==ia&&(ia=ra()),ia(e,t))}now(){const e=process.hrtime();return 1e3*e[0]+e[1]/1e6}encode(e,t){if("utf-8"!==t&&"utf8"!==t)throw new Error(`Node built-in encoder only supports utf-8, but got ${t}`);return this.textEncoder.encode(e)}decode(e,t){return 0===e.length?"":new this.util.TextDecoder(t).decode(e)}isTypedArray(e){return this.util.types.isFloat32Array(e)||this.util.types.isInt32Array(e)||this.util.types.isUint8Array(e)||this.util.types.isUint8ClampedArray(e)}}wt().get("IS_NODE")&&!wt().get("IS_BROWSER")&&wt().setPlatform("node",new oa);const sa=Dn({cast_:function(e,t){const n=Sn(e,"x","cast");if(!function(e){return"bool"===e||"complex64"===e||"float32"===e||"int32"===e||"string"===e}(t))throw new Error(`Failed to cast to unknown dtype ${t}`);if("string"===t&&"string"!==n.dtype||"string"!==t&&"string"===n.dtype)throw new Error("Only strings can be casted to strings");return xn.runKernel(St,{x:n},{dtype:t})}});const la=Dn({clone_:function(e){const t=Sn(e,"x","clone","string_or_numeric");return xn.runKernel(Dt,{x:t})}});bn();const ua={buffer:function(e,t="float32",n){return t=t||"float32",vt(e),new Jt(e,t,n)},cast:sa,clone:la,print:function(e,t=!1){console.log(e.toString(t))}};function da(e,t){return xn.tidy(e,t)}function ca(e){pn(e).forEach((e=>e.dispose()))}tn=ua;const fa=Dn({add_:function(e,t){let n=Sn(e,"a","add"),a=Sn(t,"b","add");return[n,a]=hn(n,a),xn.runKernel(It,{a:n,b:a})}});const ha=Dn({floorDiv_:function(e,t){let n=Sn(e,"a","floorDiv"),a=Sn(t,"b","floorDiv");return[n,a]=hn(n,a),xn.runKernel("FloorDiv",{a:n,b:a})}});const pa=Dn({div_:function(e,t){let n=Sn(e,"a","div"),a=Sn(t,"b","div");return[n,a]=hn(n,a),"int32"===n.dtype&&"int32"===a.dtype?ha(n,a):xn.runKernel("RealDiv",{a:n,b:a},{})}});const ma=Dn({mul_:function(e,t){let n=Sn(e,"a","mul"),a=Sn(t,"b","mul");return[n,a]=hn(n,a),xn.runKernel("Multiply",{a:n,b:a})}});const ga=Dn({abs_:function(e){const t=Sn(e,"x","abs");if("complex64"===t.dtype){return xn.runKernel("ComplexAbs",{x:t})}return xn.runKernel("Abs",{x:t})}});const va=Dn({zerosLike_:function(e){const t=Sn(e,"x","zerosLike");return xn.runKernel("ZerosLike",{x:t})}});const ya=Dn({pow_:function(e,t){let n=Sn(e,"base","pow"),a=Sn(t,"exp","pow");return[n,a]=hn(n,a),xn.runKernel("Pow",{a:n,b:a})}});function ba(e,t){if((Ut(e)&&"string"!==t||Array.isArray(e))&&"complex64"!==t)throw new Error("Error creating a new Scalar: value must be a primitive (number|boolean|string)");if("string"===t&&Ut(e)&&!(e instanceof Uint8Array))throw new Error("When making a scalar from encoded string, the value must be `Uint8Array`.");return function(e,t,n,a){if(null==a)a=ct(e);else if("complex64"===a)throw new Error("Cannot construct a complex64 tensor directly. Please use tf.complex(real, imag).");if(fn(e)||cn(e)){if("float32"!==a&&"int32"!==a)throw new Error(`Creating tensor from GPU data only supports 'float32'|'int32' dtype, while the dtype is ${a}.`);return xn.backend.createTensorFromGPUData(e,t||n,a)}if(!Ut(e)&&!Array.isArray(e)&&"number"!=typeof e&&"boolean"!=typeof e&&"string"!=typeof e)throw new Error("values passed to tensor(values) must be a number/boolean/string or an array of numbers/booleans/strings, or a TypedArray");if(null!=t){vt(t);const e=ot(t),a=ot(n);it(e===a,(()=>`Based on the provided shape, [${t}], the tensor should have ${e} values but has ${a}`));for(let e=0;e<n.length;++e){const a=e!==n.length-1||n[e]!==ot(t.slice(e));it(n[e]===t[e]||!a,(()=>`Error creating a new Tensor. Inferred shape (${n}) does not match the provided shape (${t}). `))}}return Ut(e)||Array.isArray(e)||(e=[e]),t=t||n,e="string"!==a?Pt(e,a):zt(e,[],!0),xn.makeTensor(e,t,a)}(e,[],[],t)}const xa=Dn({sqrt_:function(e){const t=Sn(e,"x","sqrt","float32");return xn.runKernel("Sqrt",{x:t})}});const Ca=Dn({square_:function(e){const t=Sn(e,"x","square");return xn.runKernel("Square",{x:t},{})}});const wa=Dn({sub_:function(e,t){let n=Sn(e,"a","sub"),a=Sn(t,"b","sub");return[n,a]=hn(n,a),xn.runKernel("Sub",{a:n,b:a})}});const Ea=Dn({maximum_:function(e,t){let n=Sn(e,"a","maximum"),a=Sn(t,"b","maximum");return[n,a]=hn(n,a),"bool"===n.dtype&&(n=sa(n,"int32"),a=sa(a,"int32")),function(e,t){const n=Math.max(e.length,t.length),a=new Array(n);for(let r=0;r<n;r++){let i=e[e.length-r-1];null==i&&(i=1);let o=t[t.length-r-1];if(null==o&&(o=1),1===i)a[n-r-1]=o;else if(1===o)a[n-r-1]=i;else{if(i!==o)throw Error(`Operands could not be broadcast together with shapes ${e} and ${t}.`);a[n-r-1]=i}}}(n.shape,a.shape),xn.runKernel("Maximum",{a:n,b:a})}});class ka{getClassName(){return this.constructor.className}static fromConfig(e,t){return new e(t)}}class Ta{constructor(){this.classNameMap={}}static getMap(){return null==Ta.instance&&(Ta.instance=new Ta),Ta.instance}static register(e){Ta.getMap().classNameMap[e.className]=[e,e.fromConfig]}}function Ma(e){it(null!=e.className,(()=>"Class being registered does not have the static className property defined.")),it("string"==typeof e.className,(()=>"className is required to be a string, but got type "+typeof e.className)),it(e.className.length>0,(()=>"Class being registered has an empty-string as its className, which is disallowed.")),Ta.register(e)}class Ia extends ka{minimize(e,t=!1,n){const{value:a,grads:r}=this.computeGradients(e,n);if(null!=n){const e=n.map((e=>({name:e.name,tensor:r[e.name]})));this.applyGradients(e)}else this.applyGradients(r);return ca(r),t?a:(a.dispose(),null)}get iterations(){return null==this.iterations_&&(this.iterations_=0),this.iterations_}incrementIterations(){this.iterations_=this.iterations+1}computeGradients(e,t){return function(e,t){it(ft(e),(()=>"The f passed in variableGrads(f) must be a function")),it(null==t||Array.isArray(t)&&t.every((e=>e instanceof an)),(()=>"The varList passed in variableGrads(f, varList) must be an array of variables"));const n=null!=t;if(!n){t=[];for(const e in xn.registeredVariables)t.push(xn.registeredVariables[e])}const a=n?t.filter((e=>!e.trainable)):null,r=t.length;it((t=t.filter((e=>e.trainable))).length>0,(()=>`variableGrads() expects at least one of the input variables to be trainable, but none of the ${r} variables is trainable.`));const{value:i,grads:o}=xn.gradients(e,t,null,!0);it(o.some((e=>null!=e)),(()=>"Cannot find a connection between any variable and the result of the loss function y=f(x). Please make sure the operations that use variables are inside the function f passed to minimize().")),it(0===i.rank,(()=>`The f passed in variableGrads(f) must return a scalar, but it returned a rank-${i.rank} tensor`));const s={};return t.forEach(((e,t)=>{null!=o[t]&&(s[e.name]=o[t])})),null!=a&&a.forEach((e=>s[e.name]=null)),{value:i,grads:s}}(e,t)}dispose(){null!=this.iterations_&&ca(this.iterations_)}async saveIterations(){return null==this.iterations_&&(this.iterations_=0),{name:"iter",tensor:ba(this.iterations_,"int32")}}async getWeights(){throw new Error("getWeights() is not implemented for this optimizer yet.")}async setWeights(e){throw new Error(`setWeights() is not implemented for this optimizer class ${this.getClassName()}`)}async extractIterations(e){return this.iterations_=(await e[0].tensor.data())[0],e.slice(1)}}Object.defineProperty(Ia,Symbol.hasInstance,{value:e=>null!=e.minimize&&null!=e.computeGradients&&null!=e.applyGradients});class Sa extends Ia{static get className(){return"SGD"}constructor(e){super(),this.learningRate=e,this.setLearningRate(e)}applyGradients(e){const t=Array.isArray(e)?e.map((e=>e.name)):Object.keys(e);t.forEach(((t,n)=>{const a=Array.isArray(e)?e[n].tensor:e[t];if(null==a)return;const r=xn.registeredVariables[t];da((()=>{const e=fa(ma(this.c,a),r);r.assign(e)}))})),this.incrementIterations()}setLearningRate(e){var t;this.learningRate=e,null!=this.c&&this.c.dispose(),this.c=(t=ba(-e),xn.keep(t))}dispose(){this.c.dispose()}async getWeights(){return[await this.saveIterations()]}async setWeights(e){if(0!==(e=await this.extractIterations(e)).length)throw new Error("SGD optimizer does not have settable weights.")}getConfig(){return{learningRate:this.learningRate}}static fromConfig(e,t){return new e(t.learningRate)}}const Da=[class extends Ia{static get className(){return"Adadelta"}constructor(e,t,n=null){super(),this.learningRate=e,this.rho=t,this.epsilon=n,this.accumulatedGrads=[],this.accumulatedUpdates=[],null==n&&(this.epsilon=xn.backend.epsilon())}applyGradients(e){(Array.isArray(e)?e.map((e=>e.name)):Object.keys(e)).forEach(((t,n)=>{const a=xn.registeredVariables[t];null==this.accumulatedGrads[n]&&(this.accumulatedGrads[n]={originalName:`${t}/accum_grad`,variable:da((()=>va(a).variable(false)))}),null==this.accumulatedUpdates[n]&&(this.accumulatedUpdates[n]={originalName:`${t}/accum_var`,variable:da((()=>va(a).variable(false)))});const r=Array.isArray(e)?e[n].tensor:e[t];if(null==r)return;const i=this.accumulatedGrads[n].variable,o=this.accumulatedUpdates[n].variable;da((()=>{const e=fa(ma(i,this.rho),ma(Ca(r),1-this.rho)),t=ma(pa(xa(fa(o,this.epsilon)),xa(fa(i,this.epsilon))),r),n=fa(ma(o,this.rho),ma(Ca(t),1-this.rho));i.assign(e),o.assign(n);const s=fa(ma(t,-this.learningRate),a);a.assign(s)}))})),this.incrementIterations()}dispose(){null!=this.accumulatedUpdates&&(ca(this.accumulatedGrads.map((e=>e.variable))),ca(this.accumulatedUpdates.map((e=>e.variable))))}async getWeights(){const e=[...this.accumulatedGrads,...this.accumulatedUpdates];return[await this.saveIterations()].concat(e.map((e=>({name:e.originalName,tensor:e.variable}))))}async setWeights(e){const t=(e=await this.extractIterations(e)).length/2;this.accumulatedGrads=e.slice(0,t).map((e=>({originalName:e.name,variable:e.tensor.variable(false)}))),this.accumulatedUpdates=e.slice(t,2*t).map((e=>({originalName:e.name,variable:e.tensor.variable(false)})))}getConfig(){return{learningRate:this.learningRate,rho:this.rho,epsilon:this.epsilon}}static fromConfig(e,t){return new e(t.learningRate,t.rho,t.epsilon)}},class extends Ia{static get className(){return"Adagrad"}constructor(e,t=.1){super(),this.learningRate=e,this.initialAccumulatorValue=t,this.accumulatedGrads=[]}applyGradients(e){(Array.isArray(e)?e.map((e=>e.name)):Object.keys(e)).forEach(((t,n)=>{const a=xn.registeredVariables[t];if(null==this.accumulatedGrads[n]){const e=!1;this.accumulatedGrads[n]={originalName:`${t}/accumulator`,variable:da((()=>function(e,t,n){return vt(e),n=n||ct(t),xn.runKernel("Fill",{},{shape:e,value:t,dtype:n})}(a.shape,this.initialAccumulatorValue).variable(e)))}}const r=Array.isArray(e)?e[n].tensor:e[t];if(null==r)return;const i=this.accumulatedGrads[n].variable;da((()=>{const e=fa(i,Ca(r));i.assign(e);const t=fa(ma(pa(r,xa(fa(e,xn.backend.epsilon()))),-this.learningRate),a);a.assign(t)}))})),this.incrementIterations()}dispose(){null!=this.accumulatedGrads&&ca(this.accumulatedGrads.map((e=>e.variable)))}async getWeights(){return[await this.saveIterations()].concat(this.accumulatedGrads.map((e=>({name:e.originalName,tensor:e.variable}))))}async setWeights(e){e=await this.extractIterations(e);this.accumulatedGrads=e.map((e=>({originalName:e.name,variable:e.tensor.variable(false)})))}getConfig(){return{learningRate:this.learningRate,initialAccumulatorValue:this.initialAccumulatorValue}}static fromConfig(e,t){return new e(t.learningRate,t.initialAccumulatorValue)}},class extends Ia{static get className(){return"Adam"}constructor(e,t,n,a=null){super(),this.learningRate=e,this.beta1=t,this.beta2=n,this.epsilon=a,this.accumulatedFirstMoment=[],this.accumulatedSecondMoment=[],da((()=>{this.accBeta1=ba(t).variable(),this.accBeta2=ba(n).variable()})),null==a&&(this.epsilon=xn.backend.epsilon())}applyGradients(e){const t=Array.isArray(e)?e.map((e=>e.name)):Object.keys(e);da((()=>{const n=wa(1,this.accBeta1),a=wa(1,this.accBeta2);t.forEach(((t,r)=>{const i=xn.registeredVariables[t];null==this.accumulatedFirstMoment[r]&&(this.accumulatedFirstMoment[r]={originalName:`${t}/m`,variable:da((()=>va(i).variable(false)))}),null==this.accumulatedSecondMoment[r]&&(this.accumulatedSecondMoment[r]={originalName:`${t}/v`,variable:da((()=>va(i).variable(false)))});const o=Array.isArray(e)?e[r].tensor:e[t];if(null==o)return;const s=this.accumulatedFirstMoment[r].variable,l=this.accumulatedSecondMoment[r].variable,u=fa(ma(s,this.beta1),ma(o,1-this.beta1)),d=fa(ma(l,this.beta2),ma(Ca(o),1-this.beta2)),c=pa(u,n),f=pa(d,a);s.assign(u),l.assign(d);const h=fa(ma(pa(c,fa(xa(f),this.epsilon)),-this.learningRate),i);i.assign(h)})),this.accBeta1.assign(ma(this.accBeta1,this.beta1)),this.accBeta2.assign(ma(this.accBeta2,this.beta2))})),this.incrementIterations()}dispose(){this.accBeta1.dispose(),this.accBeta2.dispose(),null!=this.accumulatedFirstMoment&&ca(this.accumulatedFirstMoment.map((e=>e.variable))),null!=this.accumulatedSecondMoment&&ca(this.accumulatedSecondMoment.map((e=>e.variable)))}async getWeights(){const e=[...this.accumulatedFirstMoment,...this.accumulatedSecondMoment];return[await this.saveIterations()].concat(e.map((e=>({name:e.originalName,tensor:e.variable}))))}async setWeights(e){e=await this.extractIterations(e),da((()=>{this.accBeta1.assign(ya(this.beta1,this.iterations_+1)),this.accBeta2.assign(ya(this.beta2,this.iterations_+1))}));const t=e.length/2;this.accumulatedFirstMoment=e.slice(0,t).map((e=>({originalName:e.name,variable:e.tensor.variable(false)}))),this.accumulatedSecondMoment=e.slice(t,2*t).map((e=>({originalName:e.name,variable:e.tensor.variable(false)})))}getConfig(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon}}static fromConfig(e,t){return new e(t.learningRate,t.beta1,t.beta2,t.epsilon)}},class extends Ia{static get className(){return"Adamax"}constructor(e,t,n,a=null,r=0){super(),this.learningRate=e,this.beta1=t,this.beta2=n,this.epsilon=a,this.decay=r,this.accumulatedFirstMoment=[],this.accumulatedWeightedInfNorm=[],da((()=>{this.iteration=ba(0).variable(),this.accBeta1=ba(t).variable()})),null==a&&(this.epsilon=xn.backend.epsilon())}applyGradients(e){const t=Array.isArray(e)?e.map((e=>e.name)):Object.keys(e);da((()=>{const n=wa(1,this.accBeta1),a=pa(-this.learningRate,fa(ma(this.iteration,this.decay),1));t.forEach(((t,r)=>{const i=xn.registeredVariables[t];null==this.accumulatedFirstMoment[r]&&(this.accumulatedFirstMoment[r]={originalName:`${t}/m`,variable:va(i).variable(false)}),null==this.accumulatedWeightedInfNorm[r]&&(this.accumulatedWeightedInfNorm[r]={originalName:`${t}/v`,variable:va(i).variable(false)});const o=Array.isArray(e)?e[r].tensor:e[t];if(null==o)return;const s=this.accumulatedFirstMoment[r].variable,l=this.accumulatedWeightedInfNorm[r].variable,u=fa(ma(s,this.beta1),ma(o,1-this.beta1)),d=ma(l,this.beta2),c=ga(o),f=Ea(d,c);s.assign(u),l.assign(f);const h=fa(ma(pa(a,n),pa(u,fa(f,this.epsilon))),i);i.assign(h)})),this.iteration.assign(fa(this.iteration,1)),this.accBeta1.assign(ma(this.accBeta1,this.beta1))})),this.incrementIterations()}dispose(){this.accBeta1.dispose(),this.iteration.dispose(),null!=this.accumulatedFirstMoment&&ca(this.accumulatedFirstMoment.map((e=>e.variable))),null!=this.accumulatedWeightedInfNorm&&ca(this.accumulatedWeightedInfNorm.map((e=>e.variable)))}async getWeights(){throw new Error("getWeights() is not implemented for Adamax yet.")}async setWeights(e){throw new Error("setWeights() is not implemented for Adamax yet.")}getConfig(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon,decay:this.decay}}static fromConfig(e,t){return new e(t.learningRate,t.beta1,t.beta2,t.epsilon,t.decay)}},class extends Sa{static get className(){return"Momentum"}constructor(e,t,n=!1){super(e),this.learningRate=e,this.momentum=t,this.useNesterov=n,this.accumulations=[],this.m=ba(this.momentum)}applyGradients(e){(Array.isArray(e)?e.map((e=>e.name)):Object.keys(e)).forEach(((t,n)=>{const a=xn.registeredVariables[t];if(null==this.accumulations[n]){const e=!1;this.accumulations[n]={originalName:`${t}/momentum`,variable:da((()=>va(a).variable(e)))}}const r=this.accumulations[n].variable,i=Array.isArray(e)?e[n].tensor:e[t];null!=i&&da((()=>{let e;const t=fa(ma(this.m,r),i);e=fa(ma(this.c,this.useNesterov?fa(i,ma(t,this.m)):t),a),r.assign(t),a.assign(e)}))})),this.incrementIterations()}dispose(){this.m.dispose(),null!=this.accumulations&&ca(this.accumulations.map((e=>e.variable)))}setMomentum(e){this.momentum=e}async getWeights(){return[await this.saveIterations()].concat(this.accumulations.map((e=>({name:e.originalName,tensor:e.variable}))))}async setWeights(e){e=await this.extractIterations(e);this.accumulations=e.map((e=>({originalName:e.name,variable:e.tensor.variable(false)})))}getConfig(){return{learningRate:this.learningRate,momentum:this.momentum,useNesterov:this.useNesterov}}static fromConfig(e,t){return new e(t.learningRate,t.momentum,t.useNesterov)}},class extends Ia{static get className(){return"RMSProp"}constructor(e,t=.9,n=0,a=null,r=!1){if(super(),this.learningRate=e,this.decay=t,this.momentum=n,this.epsilon=a,this.accumulatedMeanSquares=[],this.accumulatedMoments=[],this.accumulatedMeanGrads=[],this.centered=r,null==a&&(this.epsilon=xn.backend.epsilon()),null==e)throw new Error("learningRate for RMSPropOptimizer must be defined.")}applyGradients(e){(Array.isArray(e)?e.map((e=>e.name)):Object.keys(e)).forEach(((t,n)=>{const a=xn.registeredVariables[t],r=!1;null==this.accumulatedMeanSquares[n]&&(this.accumulatedMeanSquares[n]={originalName:`${t}/rms`,variable:da((()=>va(a).variable(r)))}),null==this.accumulatedMoments[n]&&(this.accumulatedMoments[n]={originalName:`${t}/momentum`,variable:da((()=>va(a).variable(r)))}),null==this.accumulatedMeanGrads[n]&&this.centered&&(this.accumulatedMeanGrads[n]={originalName:`${t}/mg`,variable:da((()=>va(a).variable(r)))});const i=Array.isArray(e)?e[n].tensor:e[t];if(null==i)return;const o=this.accumulatedMeanSquares[n].variable,s=this.accumulatedMoments[n].variable;da((()=>{const e=fa(ma(o,this.decay),ma(Ca(i),1-this.decay));if(this.centered){const t=this.accumulatedMeanGrads[n].variable,r=fa(ma(t,this.decay),ma(i,1-this.decay)),l=pa(ma(i,this.learningRate),xa(wa(e,fa(Ca(r),this.epsilon)))),u=fa(ma(s,this.momentum),l);o.assign(e),t.assign(r),s.assign(u);const d=wa(a,u);a.assign(d)}else{const e=fa(ma(o,this.decay),ma(Ca(i),1-this.decay)),t=fa(ma(s,this.momentum),pa(ma(i,this.learningRate),xa(fa(e,this.epsilon))));o.assign(e),s.assign(t);const n=wa(a,t);a.assign(n)}}))})),this.incrementIterations()}dispose(){null!=this.accumulatedMeanSquares&&ca(this.accumulatedMeanSquares.map((e=>e.variable))),null!=this.accumulatedMeanGrads&&this.centered&&ca(this.accumulatedMeanGrads.map((e=>e.variable))),null!=this.accumulatedMoments&&ca(this.accumulatedMoments.map((e=>e.variable)))}async getWeights(){const e=[...this.accumulatedMeanSquares,...this.accumulatedMoments];return this.centered&&e.push(...this.accumulatedMeanGrads),[await this.saveIterations()].concat(e.map((e=>({name:e.originalName,tensor:e.variable}))))}async setWeights(e){e=await this.extractIterations(e);const t=this.centered?e.length/3:e.length/2,n=!1;this.accumulatedMeanSquares=e.slice(0,t).map((e=>({originalName:e.name,variable:e.tensor.variable(n)}))),this.accumulatedMoments=e.slice(t,2*t).map((e=>({originalName:e.name,variable:e.tensor.variable(n)}))),this.centered&&(this.accumulatedMeanGrads=e.slice(2*t,3*t).map((e=>({originalName:e.name,variable:e.tensor.variable(n)}))))}getConfig(){return{learningRate:this.learningRate,decay:this.decay,momentum:this.momentum,epsilon:this.epsilon,centered:this.centered}}static fromConfig(e,t){return new e(t.learningRate,t.decay,t.momentum,t.epsilon,t.centered)}},Sa];!function(){for(const e of Da)Ma(e)}();const Na={},Aa={alpha:!1,antialias:!1,premultipliedAlpha:!1,preserveDrawingBuffer:!1,depth:!1,stencil:!1,failIfMajorPerformanceCaveat:!0};function La(e,t){if(!(e in Na)||null!=t){const n=function(e,t){if(1!==e&&2!==e)throw new Error("Cannot get WebGL rendering context, WebGL is disabled.");const n=null==t?function(e){if(wt().getBool("IS_SAFARI")||"undefined"==typeof OffscreenCanvas||2!==e){if("undefined"!=typeof document)return document.createElement("canvas");throw new Error("Cannot create a canvas in this context")}return new OffscreenCanvas(300,150)}(e):t;n.addEventListener("webglcontextlost",(t=>{t.preventDefault(),delete Na[e]}),!1),wt().getBool("SOFTWARE_WEBGL_ENABLED")&&(Aa.failIfMajorPerformanceCaveat=!1);if(1===e)return n.getContext("webgl",Aa)||n.getContext("experimental-webgl",Aa);return n.getContext("webgl2",Aa)}(e,t);if(null===n)return console.log("Could not get context for WebGL version",e),null;Na[e]=n}const n=Na[e];return null==n||n.isContextLost()?(delete Na[e],La(e)):(n.disable(n.DEPTH_TEST),n.disable(n.STENCIL_TEST),n.disable(n.BLEND),n.disable(n.DITHER),n.disable(n.POLYGON_OFFSET_FILL),n.disable(n.SAMPLE_COVERAGE),n.enable(n.SCISSOR_TEST),n.enable(n.CULL_FACE),n.cullFace(n.BACK),Na[e])}var Ra="https://websdk-cdn-dev.idmission.com/assets";function Oa(e,t,n,a){if(!e||!t)return"";var r=e.getContext("2d"),i=t.getContext("2d");if(!r||!i)throw new Error("could not get 2d context");e.width=n.width,e.height=n.height,r.putImageData(n,0,0);var o=a.box,s=o.width,l=.6*n.height-s,u=Math.max(0,o.xMin-l/2);En()?(t.width=n.width,t.height=n.height,i.drawImage(e,0,0,t.width,t.height)):(t.width=s+l,t.height=n.height,i.drawImage(e,u,0,t.width,t.height,0,0,t.width,t.height));var d=t.toDataURL("image/jpeg",.92);return ze(e),ze(t),d}function Fa(e,t,n){n||(n=document.createElement("canvas"));var a=n.getContext("2d");if(!a)throw new Error("could not get 2d context");var r=Pe(e),i=r[0],o=r[1],s=t[0],l=t[1],u=t[2],d=t[3];return n.width=u*i,n.height=d*o,a.drawImage(e,s*i,l*o,u*i,d*o,0,0,u*i,d*o),n}var ja=self;function Pa(){throw Error("Invalid UTF8")}function Ba(e,t){return t=String.fromCharCode.apply(null,t),null==e?t:e+t}let _a,Ua;const za="undefined"!=typeof TextDecoder;let Ga;const Wa="undefined"!=typeof TextEncoder;function Va(e){if(Wa)e=(Ga||=new TextEncoder).encode(e);else{let n=0;const a=new Uint8Array(3*e.length);for(let r=0;r<e.length;r++){var t=e.charCodeAt(r);if(128>t)a[n++]=t;else{if(2048>t)a[n++]=t>>6|192;else{if(55296<=t&&57343>=t){if(56319>=t&&r<e.length){const i=e.charCodeAt(++r);if(56320<=i&&57343>=i){a[n++]=(t=1024*(t-55296)+i-56320+65536)>>18|240,a[n++]=t>>12&63|128,a[n++]=t>>6&63|128,a[n++]=63&t|128;continue}r--}t=65533}a[n++]=t>>12|224,a[n++]=t>>6&63|128}a[n++]=63&t|128}}e=n===a.length?a:a.subarray(0,n)}return e}var $a,qa;e:{for(var Ha=["CLOSURE_FLAGS"],Ya=ja,Za=0;Za<Ha.length;Za++)if(null==(Ya=Ya[Ha[Za]])){qa=null;break e}qa=Ya}var Qa,Xa=qa&&qa[610401301];$a=null!=Xa&&Xa;const Ka=ja.navigator;function Ja(e){return!!$a&&!!Qa&&Qa.brands.some((({brand:t})=>t&&-1!=t.indexOf(e)))}function er(e){var t;return(t=ja.navigator)&&(t=t.userAgent)||(t=""),-1!=t.indexOf(e)}function tr(){return!!$a&&!!Qa&&0<Qa.brands.length}function nr(){return tr()?Ja("Chromium"):(er("Chrome")||er("CriOS"))&&!(!tr()&&er("Edge"))||er("Silk")}Qa=Ka&&Ka.userAgentData||null;var ar=!tr()&&(er("Trident")||er("MSIE"));!er("Android")||nr(),nr(),er("Safari")&&(nr()||!tr()&&er("Coast")||!tr()&&er("Opera")||!tr()&&er("Edge")||(tr()?Ja("Microsoft Edge"):er("Edg/"))||tr()&&Ja("Opera"));var rr={},ir=null;function or(){if(!ir){ir={};for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),t=["+/=","+/","-_=","-_.","-_"],n=0;5>n;n++){var a=e.concat(t[n].split(""));rr[n]=a;for(var r=0;r<a.length;r++){var i=a[r];void 0===ir[i]&&(ir[i]=r)}}}}var sr="undefined"!=typeof Uint8Array,lr=!ar&&"function"==typeof btoa;function ur(e){if(!lr){var t;void 0===t&&(t=0),or(),t=rr[t];var n=Array(Math.floor(e.length/3)),a=t[64]||"";let l=0,u=0;for(;l<e.length-2;l+=3){var r=e[l],i=e[l+1],o=e[l+2],s=t[r>>2];n[u++]=s+(r=t[(3&r)<<4|i>>4])+(i=t[(15&i)<<2|o>>6])+(o=t[63&o])}switch(s=0,o=a,e.length-l){case 2:o=t[(15&(s=e[l+1]))<<2]||a;case 1:n[u]=t[(e=e[l])>>2]+t[(3&e)<<4|s>>4]+o+a}return n.join("")}for(t="",n=0,a=e.length-10240;n<a;)t+=String.fromCharCode.apply(null,e.subarray(n,n+=10240));return t+=String.fromCharCode.apply(null,n?e.subarray(n):e),btoa(t)}const dr=/[-_.]/g,cr={"-":"+",_:"/",".":"="};function fr(e){return cr[e]||""}function hr(e){if(!lr)return function(e){var t=e.length,n=3*t/4;n%3?n=Math.floor(n):-1!="=.".indexOf(e[t-1])&&(n=-1!="=.".indexOf(e[t-2])?n-2:n-1);var a=new Uint8Array(n),r=0;return function(e,t){function n(t){for(;a<e.length;){var n=e.charAt(a++),r=ir[n];if(null!=r)return r;if(!/^[\s\xa0]*$/.test(n))throw Error("Unknown base64 encoding at char: "+n)}return t}or();for(var a=0;;){var r=n(-1),i=n(0),o=n(64),s=n(64);if(64===s&&-1===r)break;t(r<<2|i>>4),64!=o&&(t(i<<4&240|o>>2),64!=s&&t(o<<6&192|s))}}(e,(function(e){a[r++]=e})),r!==n?a.subarray(0,r):a}(e);dr.test(e)&&(e=e.replace(dr,fr)),e=atob(e);const t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}function pr(e){return sr&&null!=e&&e instanceof Uint8Array}let mr;function gr(){return mr||=new Uint8Array(0)}var vr={};let yr;function br(e){if(e!==vr)throw Error("illegal external caller")}function xr(){return yr||=new wr(null,vr)}function Cr(e){br(vr);var t=e.N;return null==(t=null==t||pr(t)?t:"string"==typeof t?hr(t):null)?t:e.N=t}var wr=class{constructor(e,t){if(br(t),this.N=e,null!=e&&0===e.length)throw Error("ByteString should be constructed with non-empty values")}ha(){const e=Cr(this);return e?new Uint8Array(e):gr()}};function Er(e,t){return Error(`Invalid wire type: ${e} (at position ${t})`)}function kr(){return Error("Failed to read varint, encoding is invalid.")}function Tr(e,t){return Error(`Tried to read past the end of the data ${t} > ${e}`)}function Mr(e){return 0==e.length?xr():new wr(e,vr)}function Ir(e){if("string"==typeof e)return{buffer:hr(e),H:!1};if(Array.isArray(e))return{buffer:new Uint8Array(e),H:!1};if(e.constructor===Uint8Array)return{buffer:e,H:!1};if(e.constructor===ArrayBuffer)return{buffer:new Uint8Array(e),H:!1};if(e.constructor===wr)return{buffer:Cr(e)||gr(),H:!0};if(e instanceof Uint8Array)return{buffer:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),H:!1};throw Error("Type not convertible to a Uint8Array, expected a Uint8Array, an ArrayBuffer, a base64 encoded string, a ByteString or an Array of numbers")}const Sr="function"==typeof Uint8Array.prototype.slice;let Dr,Nr=0,Ar=0;function Lr(e){const t=0>e;let n=(e=Math.abs(e))>>>0;if(e=Math.floor((e-n)/4294967296),t){const[t,a]=Pr(n,e);e=a,n=t}Nr=n>>>0,Ar=e>>>0}function Rr(e){const t=Dr||=new DataView(new ArrayBuffer(8));t.setFloat32(0,+e,!0),Ar=0,Nr=t.getUint32(0,!0)}function Or(e,t){return 4294967296*t+(e>>>0)}function Fr(e,t){const n=2147483648&t;return n&&(t=~t>>>0,0==(e=1+~e>>>0)&&(t=t+1>>>0)),e=Or(e,t),n?-e:e}function jr(e){if(16>e.length)Lr(Number(e));else if("function"==typeof BigInt)e=BigInt(e),Nr=Number(e&BigInt(4294967295))>>>0,Ar=Number(e>>BigInt(32)&BigInt(4294967295));else{const t=+("-"===e[0]);Ar=Nr=0;const n=e.length;for(let a=t,r=(n-t)%6+t;r<=n;a=r,r+=6){const t=Number(e.slice(a,r));Ar*=1e6,Nr=1e6*Nr+t,4294967296<=Nr&&(Ar+=Math.trunc(Nr/4294967296),Ar>>>=0,Nr>>>=0)}if(t){const[e,t]=Pr(Nr,Ar);Nr=e,Ar=t}}}function Pr(e,t){return t=~t,e?e=1+~e:t+=1,[e,t]}function Br(e,t,{R:n=!1}={}){e.R=n,t&&(t=Ir(t),e.h=t.buffer,e.s=t.H,e.v=0,e.l=e.h.length,e.g=e.v)}function _r(e,t){if(e.g=t,t>e.l)throw Tr(e.l,t)}function Ur(e,t){let n,a=0,r=0,i=0;const o=e.h;let s=e.g;do{n=o[s++],a|=(127&n)<<i,i+=7}while(32>i&&128&n);for(32<i&&(r|=(127&n)>>4),i=3;32>i&&128&n;i+=7)n=o[s++],r|=(127&n)<<i;if(_r(e,s),128>n)return t(a>>>0,r>>>0);throw kr()}function zr(e){let t=0,n=e.g;const a=n+10,r=e.h;for(;n<a;){const a=r[n++];if(t|=a,0==(128&a))return _r(e,n),!!(127&t)}throw kr()}function Gr(e){var t=e.h;const n=e.g,a=t[n],r=t[n+1],i=t[n+2];return t=t[n+3],_r(e,e.g+4),(a<<0|r<<8|i<<16|t<<24)>>>0}function Wr(e,t){if(0>t)throw Error(`Tried to read a negative byte length: ${t}`);const n=e.g,a=n+t;if(a>e.l)throw Tr(t,e.l-n);return e.g=a,n}function Vr(e,t){if(0==t)return xr();var n=Wr(e,t);return e.R&&e.s?n=e.h.subarray(n,n+t):(e=e.h,n=n===(t=n+t)?gr():Sr?e.slice(n,t):new Uint8Array(e.subarray(n,t))),Mr(n)}var $r=class{constructor(e,t){this.h=null,this.s=!1,this.g=this.l=this.v=0,Br(this,e,t)}m(){const e=this.h;let t=this.g,n=e[t++],a=127&n;if(128&n&&(n=e[t++],a|=(127&n)<<7,128&n&&(n=e[t++],a|=(127&n)<<14,128&n&&(n=e[t++],a|=(127&n)<<21,128&n&&(n=e[t++],a|=n<<28,128&n&&128&e[t++]&&128&e[t++]&&128&e[t++]&&128&e[t++]&&128&e[t++])))))throw kr();return _r(this,t),a}j(){return this.m()>>>0}A(){var e=Gr(this);const t=2*(e>>31)+1,n=e>>>23&255;return e&=8388607,255==n?e?NaN:1/0*t:0==n?t*Math.pow(2,-149)*e:t*Math.pow(2,n-150)*(e+Math.pow(2,23))}C(){return this.m()}},qr=[];function Hr(e){var t=e.g;if(t.g==t.l)return!1;e.l=e.g.g;var n=e.g.j();if(t=n>>>3,!(0<=(n&=7)&&5>=n))throw Er(n,e.l);if(1>t)throw Error(`Invalid field number: ${t} (at position ${e.l})`);return e.m=t,e.h=n,!0}function Yr(e){switch(e.h){case 0:0!=e.h?Yr(e):zr(e.g);break;case 1:_r(e=e.g,e.g+8);break;case 2:if(2!=e.h)Yr(e);else{var t=e.g.j();_r(e=e.g,e.g+t)}break;case 5:_r(e=e.g,e.g+4);break;case 3:for(t=e.m;;){if(!Hr(e))throw Error("Unmatched start-group tag: stream EOF");if(4==e.h){if(e.m!=t)throw Error("Unmatched end-group tag");break}Yr(e)}break;default:throw Er(e.h,e.l)}}function Zr(e,t,n){const a=e.g.l,r=e.g.j(),i=e.g.g+r;let o=i-a;if(0>=o&&(e.g.l=i,n(t,e,void 0,void 0,void 0),o=i-e.g.g),o)throw Error(`Message parsing ended unexpectedly. Expected to read ${r} bytes, instead read ${r-o} bytes, either the data ended unexpectedly or the message misreported its own length`);return e.g.g=i,e.g.l=a,t}function Qr(e){var t=e.g.j(),n=Wr(e=e.g,t);if(e=e.h,za){var a,r=e;(a=Ua)||(a=Ua=new TextDecoder("utf-8",{fatal:!0})),e=n+t,r=0===n&&e===r.length?r:r.subarray(n,e);try{var i=a.decode(r)}catch(e){if(void 0===_a){try{a.decode(new Uint8Array([128]))}catch(e){}try{a.decode(new Uint8Array([97])),_a=!0}catch(e){_a=!1}}throw!_a&&(Ua=void 0),e}}else{t=(i=n)+t,n=[];let s,l=null;for(;i<t;){var o=e[i++];128>o?n.push(o):224>o?i>=t?Pa():(s=e[i++],194>o||128!=(192&s)?(i--,Pa()):n.push((31&o)<<6|63&s)):240>o?i>=t-1?Pa():(s=e[i++],128!=(192&s)||224===o&&160>s||237===o&&160<=s||128!=(192&(r=e[i++]))?(i--,Pa()):n.push((15&o)<<12|(63&s)<<6|63&r)):244>=o?i>=t-2?Pa():(s=e[i++],128!=(192&s)||0!=s-144+(o<<28)>>30||128!=(192&(r=e[i++]))||128!=(192&(a=e[i++]))?(i--,Pa()):(o=(7&o)<<18|(63&s)<<12|(63&r)<<6|63&a,n.push(55296+((o-=65536)>>10&1023),56320+(1023&o)))):Pa(),8192<=n.length&&(l=Ba(l,n),n.length=0)}i=Ba(l,n)}return i}function Xr(e){const t=e.g.j();return Vr(e.g,t)}function Kr(e,t,n){var a=e.g.j();for(a=e.g.g+a;e.g.g<a;)n.push(t.call(e.g))}var Jr=[];function ei(e){return e?/^\d+$/.test(e)?(jr(e),new ti(Nr,Ar)):null:ni||=new ti(0,0)}var ti=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}};let ni;function ai(e){return e?/^-?\d+$/.test(e)?(jr(e),new ri(Nr,Ar)):null:ii||=new ri(0,0)}var ri=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}};let ii;function oi(e,t,n){for(;0<n||127<t;)e.g.push(127&t|128),t=(t>>>7|n<<25)>>>0,n>>>=7;e.g.push(t)}function si(e,t){for(;127<t;)e.g.push(127&t|128),t>>>=7;e.g.push(t)}function li(e,t){if(0<=t)si(e,t);else{for(let n=0;9>n;n++)e.g.push(127&t|128),t>>=7;e.g.push(1)}}function ui(e,t){e.g.push(t>>>0&255),e.g.push(t>>>8&255),e.g.push(t>>>16&255),e.g.push(t>>>24&255)}function di(e,t){0!==t.length&&(e.l.push(t),e.h+=t.length)}function ci(e,t,n){si(e.g,8*t+n)}function fi(e,t){return ci(e,t,2),t=e.g.end(),di(e,t),t.push(e.h),t}function hi(e,t){var n=t.pop();for(n=e.h+e.g.length()-n;127<n;)t.push(127&n|128),n>>>=7,e.h++;t.push(n),e.h++}function pi(e,t,n){ci(e,t,2),si(e.g,n.length),di(e,e.g.end()),di(e,n)}function mi(e,t,n,a){null!=n&&(t=fi(e,t),a(n,e),hi(e,t))}class gi{constructor(e,t,n){this.g=e,this.h=t,this.l=n}}function vi(e){return Array.prototype.slice.call(e)}const yi="function"==typeof Symbol&&"symbol"==typeof Symbol()?Symbol():void 0;var bi=yi?(e,t)=>{e[yi]|=t}:(e,t)=>{void 0!==e.D?e.D|=t:Object.defineProperties(e,{D:{value:t,configurable:!0,writable:!0,enumerable:!1}})};function xi(e){const t=wi(e);1!=(1&t)&&(Object.isFrozen(e)&&(e=vi(e)),ki(e,1|t))}var Ci=yi?(e,t)=>{e[yi]&=~t}:(e,t)=>{void 0!==e.D&&(e.D&=~t)},wi=yi?e=>0|e[yi]:e=>0|e.D,Ei=yi?e=>e[yi]:e=>e.D,ki=yi?(e,t)=>{e[yi]=t}:(e,t)=>{void 0!==e.D?e.D=t:Object.defineProperties(e,{D:{value:t,configurable:!0,writable:!0,enumerable:!1}})};function Ti(){var e=[];return bi(e,1),e}function Mi(e){return bi(e,34),e}function Ii(e,t){ki(t,-255&(0|e))}function Si(e,t){ki(t,-221&(34|e))}function Di(e){return 0==(e=e>>11&1023)?536870912:e}var Ni,Ai={};function Li(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)&&e.constructor===Object}function Ri(e,t,n){if(null!=e)if("string"==typeof e)e=e?new wr(e,vr):xr();else if(e.constructor!==wr)if(pr(e))e=n?Mr(e):e.length?new wr(new Uint8Array(e),vr):xr();else{if(!t)throw Error();e=void 0}return e}const Oi=[];function Fi(e){if(2&e)throw Error()}ki(Oi,55),Ni=Object.freeze(Oi);class ji{constructor(e,t,n){this.l=0,this.g=e,this.h=t,this.m=n}next(){if(this.l<this.g.length){const e=this.g[this.l++];return{done:!1,value:this.h?this.h.call(this.m,e):e}}return{done:!0,value:void 0}}[Symbol.iterator](){return new ji(this.g,this.h,this.m)}}var Pi={};let Bi,_i;function Ui(e,t){(t=Bi?t[Bi]:void 0)&&(e[Bi]=vi(t))}function zi(e,t){e.__closure__error__context__984382||(e.__closure__error__context__984382={}),e.__closure__error__context__984382.severity=t}function Gi(e){return null==e?e:"number"==typeof e||"NaN"===e||"Infinity"===e||"-Infinity"===e?Number(e):void 0}function Wi(e){return null==e?e:"boolean"==typeof e||"number"==typeof e?!!e:void 0}function Vi(e){return"number"==typeof e&&Number.isFinite(e)||!!e&&"string"==typeof e&&isFinite(e)}function $i(e){if(null==e)return e;if("string"==typeof e){if(!e)return;e=+e}return"number"==typeof e?e:void 0}function qi(e){if(null==e)return e;if("string"==typeof e){if(!e)return;e=+e}return"number"==typeof e?e:void 0}function Hi(e){if("string"!=typeof e)throw Error();return e}function Yi(e){if(null!=e&&"string"!=typeof e)throw Error();return e}function Zi(e){return null==e||"string"==typeof e?e:void 0}function Qi(e,t,n,a){var r=!1;return null==e||"object"!=typeof e||(r=Array.isArray(e))||e.M!==Ai?r?(0===(r=n=wi(e))&&(r|=32&a),(r|=2&a)!==n&&ki(e,r),new t(e)):(n?2&a?(e=t[Xi])?t=e:(Mi((e=new t).u),t=t[Xi]=e):t=new t:t=void 0,t):e}const Xi="function"==typeof Symbol&&"symbol"==typeof Symbol()?Symbol():"di";function Ki(e){return e}function Ji(e,t,n){return"string"==typeof(e="number"==(t=typeof e)||"string"===t?e:n?0:void 0)&&(n=+e,Number.isSafeInteger(n))?n:e}let eo,to,no;function ao(e){switch(typeof e){case"boolean":return to||=[0,void 0,!0];case"number":return 0<e?void 0:0===e?no||=[0,void 0]:[-e,void 0];case"string":return[0,e];case"object":return e}}function ro(e,t){return io(e,t[0],t[1])}function io(e,t,n){if(null==e&&(e=eo),eo=void 0,null==e){var a=96;n?(e=[n],a|=512):e=[],t&&(a=-2095105&a|(1023&t)<<11)}else{if(!Array.isArray(e))throw Error();if(64&(a=wi(e)))return _i&&delete e[_i],e;if(a|=64,n&&(a|=512,n!==e[0]))throw Error();e:{var r=(n=e).length;if(r){const e=r-1;var i=n[e];if(Li(i)){1024<=(r=e-(t=+!!(512&(a|=256))-1))&&(oo(n,t,i),r=1023),a=-2095105&a|(1023&r)<<11;break e}}t&&(i=+!!(512&a)-1,1024<(t=Math.max(t,r-i))&&(oo(n,i,{}),a|=256,t=1023),a=-2095105&a|(1023&t)<<11)}}return ki(e,a),e}function oo(e,t,n){const a=1023+t,r=e.length;for(let i=a;i<r;i++){const a=e[i];null!=a&&a!==n&&(n[i-t]=a)}e.length=a+1,e[a]=n}function so(e){if(2&e.g)throw Error("Cannot mutate an immutable Map")}var lo=class extends Map{constructor(e,t,n=Ki,a=Ki){super();let r=wi(e);r|=64,ki(e,r),this.g=r,this.l=t,this.h=n||Ki,this.j=this.l?uo:a||Ki;for(let i=0;i<e.length;i++){const o=e[i],s=n(o[0],!1,!0);let l=o[1];t?void 0===l&&(l=null):l=a(o[1],!1,!0,void 0,void 0,r),super.set(s,l)}}s(e=co){return this.m(e)}m(e=co){const t=[],n=super.entries();for(var a;!(a=n.next()).done;)(a=a.value)[0]=e(a[0]),a[1]=e(a[1]),t.push(a);return t}clear(){so(this),super.clear()}delete(e){return so(this),super.delete(this.h(e,!0,!1))}entries(){var e=this.A();return new ji(e,fo,this)}keys(){return this.C()}values(){var e=this.A();return new ji(e,lo.prototype.get,this)}forEach(e,t){super.forEach(((n,a)=>{e.call(t,this.get(a),a,this)}))}set(e,t){return so(this),null==(e=this.h(e,!0,!1))?this:null==t?(super.delete(e),this):super.set(e,this.j(t,!0,!0,this.l,!1,this.g))}I(e){const t=this.h(e[0],!1,!0);e=e[1],e=this.l?void 0===e?null:e:this.j(e,!1,!0,void 0,!1,this.g),super.set(t,e)}has(e){return super.has(this.h(e,!1,!1))}get(e){e=this.h(e,!1,!1);const t=super.get(e);if(void 0!==t){var n=this.l;return n?((n=this.j(t,!1,!0,n,this.v,this.g))!==t&&super.set(e,n),n):t}}A(){return Array.from(super.keys())}C(){return super.keys()}[Symbol.iterator](){return this.entries()}};function uo(e,t,n,a,r,i){return e=Qi(e,a,n,i),r&&(e=xo(e)),e}function co(e){return e}function fo(e){return[e,this.get(e)]}function ho(e,t,n,a,r,i){if(null!=e){if(Array.isArray(e))e=r&&0==e.length&&1&wi(e)?void 0:i&&2&wi(e)?e:po(e,t,n,void 0!==a,r,i);else if(Li(e)){const o={};for(let s in e)o[s]=ho(e[s],t,n,a,r,i);e=o}else e=t(e,a);return e}}function po(e,t,n,a,r,i){const o=a||n?wi(e):0;a=a?!!(32&o):void 0;const s=vi(e);for(let e=0;e<s.length;e++)s[e]=ho(s[e],t,n,a,r,i);return n&&(Ui(s,e),n(o,s)),s}function mo(e){return ho(e,go,void 0,void 0,!1,!1)}function go(e){return e.M===Ai?e.toJSON():e instanceof lo?e.s(mo):function(e){switch(typeof e){case"number":return isFinite(e)?e:String(e);case"boolean":return e?1:0;case"object":if(e&&!Array.isArray(e)){if(pr(e))return ur(e);if(e instanceof wr){const t=e.N;return null==t?"":"string"==typeof t?t:e.N=ur(t)}if(e instanceof lo)return e.s()}}return e}(e)}function vo(e,t,n=Si){if(null!=e){if(sr&&e instanceof Uint8Array)return t?e:new Uint8Array(e);if(Array.isArray(e)){var a=wi(e);return 2&a?e:(t&&=0===a||!!(32&a)&&!(64&a||!(16&a)),t?(ki(e,34|a),4&a&&Object.freeze(e),e):po(e,vo,4&a?Si:n,!0,!1,!0))}return e.M===Ai?e=2&(a=Ei(n=e.u))?e:yo(e,n,a,!0):e instanceof lo&&(n=Mi(e.m(vo)),e=new lo(n,e.l,e.h,e.j)),e}}function yo(e,t,n,a){return e=e.constructor,eo=t=bo(t,n,a),t=new e(t),eo=void 0,t}function bo(e,t,n){const a=n||2&t?Si:Ii,r=!!(32&t);return e=function(e,t,n){const a=vi(e);var r=a.length;const i=256&t?a[r-1]:void 0;for(r+=i?-1:0,t=512&t?1:0;t<r;t++)a[t]=n(a[t]);if(i){t=a[t]={};for(const e in i)t[e]=n(i[e])}return Ui(a,e),a}(e,t,(e=>vo(e,r,a))),bi(e,32|(n?2:0)),e}function xo(e){const t=e.u,n=Ei(t);return 2&n?yo(e,t,n,!1):e}function Co(e,t){return wo(e=e.u,Ei(e),t)}function wo(e,t,n,a){if(-1===n)return null;if(n>=Di(t)){if(256&t)return e[e.length-1][n]}else{var r=e.length;if(a&&256&t&&null!=(a=e[r-1][n]))return a;if((t=n+(+!!(512&t)-1))<r)return e[t]}}function Eo(e,t,n,a){const r=e.u,i=Ei(r);return Fi(i),ko(r,i,t,n,a),e}function ko(e,t,n,a,r){var i=Di(t);if(n>=i||r){if(r=t,256&t)i=e[e.length-1];else{if(null==a)return;i=e[i+(+!!(512&t)-1)]={},r|=256}i[n]=a,r!==t&&ki(e,r)}else e[n+(+!!(512&t)-1)]=a,256&t&&n in(e=e[e.length-1])&&delete e[n]}function To(e,t,n,a,r){var i=2&t;let o=wo(e,t,n,r);Array.isArray(o)||(o=Ni);const s=!(2&a),l=!(1&a);a=!!(32&t);let u=wi(o);return 0!==u||!a||i||s?1&u||(u|=1,ki(o,u)):(u|=33,ki(o,u)),i?(2&u||Mi(o),l&&Object.freeze(o)):(i=2&u,l&&i?(o=vi(o),i=1,a&&!s&&(i|=32),ki(o,i),ko(e,t,n,o,r)):s&&32&u&&!i&&Ci(o,32)),o}function Mo(e,t){const n=Ei(e=e.u),a=wo(e,n,t),r=Gi(a);return null!=r&&r!==a&&ko(e,n,t,r),r}function Io(e){const t=Ei(e=e.u),n=wo(e,t,1),a=Ri(n,!0,!!(34&t));return null!=a&&a!==n&&ko(e,t,1,a),a}function So(e,t,n){const a=Ei(e=e.u),r=2&a;let i=To(e,a,t,1),o=wi(i);if(!(4&o)){Object.isFrozen(i)&&(i=vi(i),ki(i,o=-3&o|32),ko(e,a,t,i));let s=0,l=0;for(;s<i.length;s++){const e=n(i[s]);null!=e&&(i[l++]=e)}l<s&&(i.length=l),o|=21,r?o|=34:o&=-33,ki(i,o),2&o&&Object.freeze(i)}return!r&&(2&o||Object.isFrozen(i))&&(i=vi(i),ki(i,-35&o),ko(e,a,t,i)),i}let Do;function No(){return Do??=new lo(Mi([]),void 0,void 0,void 0,Pi)}function Ao(e){e=vi(e);for(let t=0;t<e.length;t++){const n=e[t]=vi(e[t]);Array.isArray(n[1])&&(n[1]=Mi(n[1]))}return e}function Lo(e,t,n){{const a=Ei(e=e.u);if(Fi(a),null==n)ko(e,a,t);else{if(!(4&wi(n))){Object.isFrozen(n)&&(n=vi(n));for(let e=0;e<n.length;e++)n[e]=Hi(n[e]);ki(n,5)}ko(e,a,t,n)}}}function Ro(e,t){return Oo(e=e.u,Ei(e),Eu)===t?t:-1}function Oo(e,t,n){let a=0;for(let r=0;r<n.length;r++){const i=n[r];null!=wo(e,t,i)&&(0!==a&&ko(e,t,a),a=i)}return a}function Fo(e,t,n,a){const r=Ei(e);Fi(r);const i=wo(e,r,n,a);let o;if(null!=i&&i.M===Ai)return(t=xo(i))!==i&&ko(e,r,n,t,a),t.u;if(Array.isArray(i)){const e=wi(i);o=2&e?bo(i,e,!1):i,o=ro(o,t)}else o=ro(void 0,t);return o!==i&&ko(e,r,n,o,a),o}function jo(e,t,n,a){const r=Ei(e=e.u),i=wo(e,r,n,a);return(t=Qi(i,t,!1,r))!==i&&null!=t&&ko(e,r,n,t,a),t}function Po(e,t,n,a=!1){if(null==(t=jo(e,t,n,a)))return t;const r=Ei(e=e.u);if(!(2&r)){const i=xo(t);i!==t&&ko(e,r,n,t=i,a)}return t}function Bo(e,t,n,a,r){var i=!!(2&t),o=To(e,t,a,1),s=o===Ni;if(s&&2!==r)return o;if(s||!(4&wi(o))){var l=o;o=!!(2&t),s=!!(2&wi(l)),i=l,!o&&s&&(l=vi(l));var u=t|((s=s||void 0)?2:0),d=s;s=!1;let c=0,f=0;for(;c<l.length;c++){const e=Qi(l[c],n,!1,u);if(null==e)continue;const t=!!(2&wi(e.u));d=d||t,s=s||!t,l[f++]=e}return f<c&&(l.length=f),u=5|(l=wi(n=l)),d=d?-9&u:8|u,l!=(d=s?-17&d:16|d)&&(Object.isFrozen(n)&&(n=vi(n)),ki(n,d)),i!==(l=n)&&ko(e,t,a,l),(o&&2!==r||1===r)&&Object.freeze(l),l}return 3===r||(i?2===r&&(r=wi(o),o=vi(o),ki(o,r),ko(e,t,a,o)):(i=Object.isFrozen(o),1===r?i||Object.freeze(o):(n=-33&(r=wi(o)),i||2&r?(o=vi(o),ki(o,-3&n),ko(e,t,a,o)):r!==n&&ki(o,n)))),o}function _o(e,t,n){var a=e.u;const r=Ei(a);if(t=Bo(a,r,t,n,(e=!!(2&r))?1:2),!(e||8&wi(t))){for(n=0;n<t.length;n++)(e=t[n])!==(a=xo(e))&&(t[n]=a);bi(t,8)}return t}function Uo(e,t,n,a,r){return null==a&&(a=void 0),Eo(e,n,a,r)}function zo(e,t,n,a){null==a&&(a=void 0);const r=Ei(e=e.u);Fi(r),(n=Oo(e,r,n))&&n!==t&&null!=a&&ko(e,r,n),ko(e,r,t,a)}function Go(e,t,n){const a=Ei(e=e.u);Fi(a),e=Bo(e,a,t,1,2),t=null!=n?n:new t,e.push(t),2&wi(t.u)?Ci(e,8):Ci(e,16)}function Wo(e,t){return $i(Co(e,t))}function Vo(e){return null==(e=Co(e,2))||Vi(e)?e:void 0}function $o(e,t){return Zi(Co(e,t))}function qo(e){return e??0}function Ho(e,t){return qo(Mo(e,t))}function Yo(e,t,n){if(null!=n){if("boolean"!=typeof n)throw e=typeof n,Error(`Expected boolean but got ${"object"!=e?e:n?Array.isArray(n)?"array":e:"null"}: ${n}`);n=!!n}Eo(e,t,n)}function Zo(e,t,n){if(null!=n){if("number"!=typeof n)throw zi(e=Error(),"warning"),e;if(!Number.isFinite(n)){const e=Error();zi(e,"incident"),function(e){ja.setTimeout((()=>{throw e}),0)}(e)}}Eo(e,t,n)}function Qo(e,t,n){if(null!=n&&"number"!=typeof n)throw Error(`Value of float/double field must be a number, found ${typeof n}: ${n}`);Eo(e,t,n)}function Xo(e,t,n){n=Hi(n);const a=Ei(e=e.u);Fi(a),To(e,a,t,2).push(n)}function Ko(e,t,n){t.g?t.m(e,t.g,t.h,n,!0):t.m(e,t.h,n,!0)}lo.prototype.toJSON=void 0;var Jo=class{constructor(e,t){this.u=io(e,t)}toJSON(){return es(this,po(this.u,go,void 0,void 0,!1,!1),!0)}l(){var e=bd;return e.g?e.l(this,e.g,e.h,!0):e.l(this,e.h,e.defaultValue,!0)}clone(){const e=this.u;return yo(this,e,Ei(e),!1)}H(){return!!(2&wi(this.u))}};function es(e,t,n){var a=e.constructor.B,r=Di(Ei(n?e.u:t)),i=!1;if(a){if(!n){var o;if((t=vi(t)).length&&Li(o=t[t.length-1]))for(i=0;i<a.length;i++)if(a[i]>=r){Object.assign(t[t.length-1]={},o);break}i=!0}var s;r=t,n=!n,e=Di(o=Ei(e.u)),o=+!!(512&o)-1;for(let t=0;t<a.length;t++){var l=a[t];if(l<e){var u=r[l+=o];null==u?r[l]=n?Ni:Ti():n&&u!==Ni&&xi(u)}else{if(!s){var d=void 0;r.length&&Li(d=r[r.length-1])?s=d:r.push(s={})}u=s[l],null==s[l]?s[l]=n?Ni:Ti():n&&u!==Ni&&xi(u)}}}if(!(a=t.length))return t;let c,f;if(Li(s=t[a-1])){e:{var h=s;d={},r=!1;for(let e in h)n=h[e],Array.isArray(n)&&n!=n&&(r=!0),null!=n?d[e]=n:r=!0;if(r){for(let e in d){h=d;break e}h=null}}h!=s&&(c=!0),a--}for(;0<a&&null==(s=t[a-1]);a--)f=!0;return c||f?(t=i?t:Array.prototype.slice.call(t,0,a),i&&(t.length=a),h&&t.push(h),t):t}function ts(e){return{ca:Qs,U:e}}function ns(e,t){if(Array.isArray(t)){var n=wi(t);if(4&n)return t;for(var a=0,r=0;a<t.length;a++){const n=e(t[a]);null!=n&&(t[r++]=n)}return r<a&&(t.length=r),ki(t,5|n),2&n&&Object.freeze(t),t}}Jo.prototype.M=Ai,Jo.prototype.toString=function(){return es(this,this.u,!1).toString()};const as=Symbol();function rs(e){let t=e[as];if(!t){const n=ds(e),a=Cs(e),r=a.h;t=r?(e,t)=>r(e,t,a):(e,t)=>{for(;Hr(t)&&4!=t.h;){var r=t.m,i=a[r];if(!i){var o=a.g;o&&(o=o[r])&&(i=a[r]=is(o))}i&&i(t,e,r)||(r=(i=t).l,Yr(i),i.aa?i=void 0:(o=i.g.g-r,i.g.g=r,i=Vr(i.g,o)),r=e,i&&(Bi||=Symbol(),(o=r[Bi])?o.push(i):r[Bi]=[i]))}for(const t in n){e[_i||=Symbol()]=n;break}},e[as]=t}return t}function is(e){const t=function(e){if(e=e.U)return rs(e)}(e),n=e.ca.g;if(t){const a=Cs(e.U).L;return(e,r,i)=>n(e,r,i,a,t)}return(e,t,a)=>n(e,t,a)}const os=Symbol();function ss(e,t,n,a){let r;if(a){const t=a[os];r=t?t.L:ao(a[0]),n[e]=t??a}r&&r===to?((t=n.xa)||(n.xa=t=[]),t.push(e)):t.l&&((t=n.Ba)||(n.Ba=t=[]),t.push(e))}function ls(e,t,n,a){ss(e,t,a)}function us(e,t,n,a,r){ss(e,t,r,n)}function ds(e){let t=e[os];return t||(t=e[os]={},cs(e,t,ls,us,t))}function cs(e,t,n,a,r){t.L=ao(e[0]);let i=1;if(e.length>i&&!(e[i]instanceof gi)){var o=e[i++];if(Array.isArray(o))return t.h=o[0],t.g=o[1],t;t.g=o}for(o=0;i<e.length;){var s=e[i++],l=e[i];for("number"==typeof l?(i++,o+=l):o++,l=i;l<e.length&&!(e[l]instanceof gi);)l++;if(l-=i){var u=e,d=i,c=u[d];if("function"==typeof c&&(c=c(),u[d]=c),(u=Array.isArray(c))&&!(u=ys in c||ps in c)&&(u=0<c.length)){const e=ao(d=(u=c)[0]);null!=e&&e!==d&&(u[0]=e),u=null!=e}(c=u?c:void 0)?(i++,1===l?void 0!==(s=a(o,s,c,void 0,r))&&(t[o]=s):void 0!==(s=a(o,s,c,e[i++],r))&&(t[o]=s)):void 0!==(s=n(o,s,e[i++],r))&&(t[o]=s)}else void 0!==(s=n(o,s,void 0,r))&&(t[o]=s)}return t}const fs=Symbol();function hs(e){let t=e[fs];if(!t){const n=vs(e);t=(e,t)=>Es(e,t,n),e[fs]=t}return t}const ps=Symbol();function ms(e,t){return t.h}function gs(e,t,n){let a,r;const i=t.h;return(e,t,o)=>i(e,t,o,r||=vs(n).L,a||=hs(n))}function vs(e){let t=e[ps];return t||(t=cs(e,e[ps]={},ms,gs),ys in e&&ps in e&&(e.length=0),t)}const ys=Symbol();function bs(e,t,n){const a=t.g;return n?(e,t,r)=>a(e,t,r,n):a}function xs(e,t,n,a){const r=t.g;let i,o;return(e,t,s)=>r(e,t,s,o||=Cs(n).L,i||=rs(n),a)}function Cs(e){let t=e[ys];return t||(ds(e),t=cs(e,e[ys]={},bs,xs),ys in e&&ps in e&&(e.length=0),t)}function ws(e,t){var n=e[t];if(n)return n;if((n=e.g)&&(n=n[t])){var a=n.U,r=n.ca.h;if(a){const e=hs(a),t=vs(a).L;n=(n,a,i)=>r(n,a,i,t,e)}else n=r;return e[t]=n}}function Es(e,t,n){for(var a=Ei(e),r=+!!(512&a)-1,i=e.length,o=512&a?1:0,s=i+(256&a?-1:0);o<s;o++){const a=e[o];if(null==a)continue;const i=o-r,s=ws(n,i);s&&s(t,a,i)}if(256&a){a=e[i-1];for(let e in a)r=+e,Number.isNaN(r)||null!=(i=a[e])&&(s=ws(n,r))&&s(t,i,r)}if(e=Bi?e[Bi]:void 0)for(di(t,t.g.end()),n=0;n<e.length;n++)di(t,Cr(e[n])||gr())}function ks(e,t){return new gi(e,t,!1)}function Ts(e,t){return new gi(e,t,!0)}function Ms(e,t,n){ko(e,Ei(e),t,n)}var Is=ks((function(e,t,n,a,r){return 2===e.h&&(e=Zr(e,ro([void 0,void 0],a),r),Fi(a=Ei(t)),(r=wo(t,a,n))instanceof lo?0!=(2&r.g)?((r=r.m()).push(e),ko(t,a,n,r)):r.I(e):Array.isArray(r)?(2&wi(r)&&ko(t,a,n,r=Ao(r)),r.push(e)):ko(t,a,n,[e]),!0)}),(function(e,t,n,a,r){if(t instanceof lo)t.forEach(((t,i)=>{mi(e,n,ro([i,t],a),r)}));else if(Array.isArray(t))for(let i=0;i<t.length;i++){const o=t[i];Array.isArray(o)&&mi(e,n,ro(o,a),r)}}));function Ss(e,t,n){e:if(null!=t){if(Vi(t)){if("string"==typeof t)break e;if("number"==typeof t)break e}t=void 0}null!=t&&("string"==typeof t&&ai(t),null!=t&&(ci(e,n,0),"number"==typeof t?(e=e.g,Lr(t),oi(e,Nr,Ar)):(n=ai(t),oi(e.g,n.h,n.g))))}function Ds(e,t,n){null!=(t=$i(t))&&null!=t&&(ci(e,n,0),li(e.g,t))}function Ns(e,t,n){null!=(t=Wi(t))&&(ci(e,n,0),e.g.g.push(t?1:0))}function As(e,t,n){null!=(t=Zi(t))&&pi(e,n,Va(t))}function Ls(e,t,n,a,r){mi(e,n,t instanceof Jo?t.u:Array.isArray(t)?ro(t,a):void 0,r)}function Rs(e,t,n){null!=(t=null==t||"string"==typeof t||pr(t)||t instanceof wr?t:void 0)&&pi(e,n,Ir(t).buffer)}function Os(e,t,n){return(5===e.h||2===e.h)&&(t=To(t,Ei(t),n,2,!1),2==e.h?Kr(e,$r.prototype.A,t):t.push(e.g.A()),!0)}var Fs=ks((function(e,t,n){if(1!==e.h)return!1;var a=e.g;e=Gr(a);const r=Gr(a);a=2*(r>>31)+1;const i=r>>>20&2047;return e=4294967296*(1048575&r)+e,Ms(t,n,2047==i?e?NaN:1/0*a:0==i?a*Math.pow(2,-1074)*e:a*Math.pow(2,i-1075)*(e+4503599627370496)),!0}),(function(e,t,n){null!=(t=Gi(t))&&(ci(e,n,1),e=e.g,(n=Dr||=new DataView(new ArrayBuffer(8))).setFloat64(0,+t,!0),Nr=n.getUint32(0,!0),Ar=n.getUint32(4,!0),ui(e,Nr),ui(e,Ar))})),js=ks((function(e,t,n){return 5===e.h&&(Ms(t,n,e.g.A()),!0)}),(function(e,t,n){null!=(t=Gi(t))&&(ci(e,n,5),e=e.g,Rr(t),ui(e,Nr))})),Ps=Ts(Os,(function(e,t,n){if(null!=(t=ns(Gi,t)))for(let i=0;i<t.length;i++){var a=e,r=t[i];null!=r&&(ci(a,n,5),a=a.g,Rr(r),ui(a,Nr))}})),Bs=Ts(Os,(function(e,t,n){if(null!=(t=ns(Gi,t))&&t.length){ci(e,n,2),si(e.g,4*t.length);for(let a=0;a<t.length;a++)n=e.g,Rr(t[a]),ui(n,Nr)}})),_s=ks((function(e,t,n){return 0===e.h&&(Ms(t,n,Ur(e.g,Fr)),!0)}),Ss),Us=ks((function(e,t,n){return 0===e.h&&(Ms(t,n,0===(e=Ur(e.g,Fr))?void 0:e),!0)}),Ss),zs=ks((function(e,t,n){return 0===e.h&&(Ms(t,n,Ur(e.g,Or)),!0)}),(function(e,t,n){e:if(null!=t){if(Vi(t)){if("string"==typeof t)break e;if("number"==typeof t)break e}t=void 0}null!=t&&("string"==typeof t&&ei(t),null!=t&&(ci(e,n,0),"number"==typeof t?(e=e.g,Lr(t),oi(e,Nr,Ar)):(n=ei(t),oi(e.g,n.h,n.g))))})),Gs=ks((function(e,t,n){return 0===e.h&&(Ms(t,n,e.g.m()),!0)}),Ds),Ws=Ts((function(e,t,n){return(0===e.h||2===e.h)&&(t=To(t,Ei(t),n,2,!1),2==e.h?Kr(e,$r.prototype.m,t):t.push(e.g.m()),!0)}),(function(e,t,n){if(null!=(t=ns($i,t))&&t.length){n=fi(e,n);for(let n=0;n<t.length;n++)li(e.g,t[n]);hi(e,n)}})),Vs=ks((function(e,t,n){return 0===e.h&&(Ms(t,n,0===(e=e.g.m())?void 0:e),!0)}),Ds),$s=ks((function(e,t,n){return 0===e.h&&(Ms(t,n,zr(e.g)),!0)}),Ns),qs=ks((function(e,t,n){return 0===e.h&&(Ms(t,n,!1===(e=zr(e.g))?void 0:e),!0)}),Ns),Hs=Ts((function(e,t,n){if(2!==e.h)return!1;e=Qr(e);const a=Ei(t);return Fi(a),To(t,a,n,2).push(e),!0}),(function(e,t,n){if(null!=(t=ns(Zi,t)))for(let r=0;r<t.length;r++){var a=t[r];null!=a&&pi(e,n,Va(a))}})),Ys=ks((function(e,t,n){return 2===e.h&&(Ms(t,n,""===(e=Qr(e))?void 0:e),!0)}),As),Zs=ks((function(e,t,n){return 2===e.h&&(Ms(t,n,Qr(e)),!0)}),As),Qs=ks((function(e,t,n,a,r){return 2===e.h&&(Zr(e,Fo(t,a,n,!0),r),!0)}),Ls),Xs=ks((function(e,t,n,a,r){return 2===e.h&&(Zr(e,Fo(t,a,n),r),!0)}),Ls),Ks=Ts((function(e,t,n,a,r){if(2!==e.h)return!1;a=ro(void 0,a);const i=Ei(t);Fi(i);let o=To(t,i,n,3);return(Object.isFrozen(o)||4&wi(o))&&(o=vi(o),ko(t,i,n,o)),o.push(a),Zr(e,a,r),!0}),(function(e,t,n,a,r){if(Array.isArray(t))for(let i=0;i<t.length;i++)Ls(e,t[i],n,a,r)})),Js=ks((function(e,t,n,a,r,i){if(2!==e.h)return!1;const o=Ei(t);return Fi(o),(i=Oo(t,o,i))&&n!==i&&ko(t,o,i),Zr(e,t=Fo(t,a,n),r),!0}),Ls),el=ks((function(e,t,n){return 2===e.h&&(Ms(t,n,Xr(e)),!0)}),Rs),tl=Ts((function(e,t,n){return(0===e.h||2===e.h)&&(t=To(t,Ei(t),n,2,!1),2==e.h?Kr(e,$r.prototype.j,t):t.push(e.g.j()),!0)}),(function(e,t,n){if(null!=(t=ns(qi,t)))for(let i=0;i<t.length;i++){var a=e,r=t[i];null!=r&&(ci(a,n,0),si(a.g,r))}})),nl=ks((function(e,t,n){return 0===e.h&&(Ms(t,n,e.g.m()),!0)}),(function(e,t,n){null!=(t=$i(t))&&(t=parseInt(t,10),ci(e,n,0),li(e.g,t))})),al=Ts((function(e,t,n){return(0===e.h||2===e.h)&&(t=To(t,Ei(t),n,2,!1),2==e.h?Kr(e,$r.prototype.C,t):t.push(e.g.m()),!0)}),(function(e,t,n){if(null!=(t=ns($i,t))&&t.length){n=fi(e,n);for(let n=0;n<t.length;n++)li(e.g,t[n]);hi(e,n)}}));class rl{constructor(e,t){this.h=e,this.g=t,this.l=Po,this.m=Uo,this.defaultValue=void 0}}function il(e,t){return new rl(e,t)}function ol(e,t){return(n,a)=>{e:{if(Jr.length){const e=Jr.pop();e.o(a),Br(e.g,n,a),n=e}else n=new class{constructor(e,t){if(qr.length){const n=qr.pop();Br(n,e,t),e=n}else e=new $r(e,t);this.g=e,this.l=this.g.g,this.h=this.m=-1,this.o(t)}o({aa:e=!1}={}){this.aa=e}}(n,a);try{var r=new e;const a=r.u;rs(t)(a,n),_i&&delete a[_i];var i=r;break e}finally{(r=n.g).h=null,r.s=!1,r.v=0,r.l=0,r.g=0,r.R=!1,n.m=-1,n.h=-1,100>Jr.length&&Jr.push(n)}i=void 0}return i}}function sl(e){return function(){const t=new class{constructor(){this.l=[],this.h=0,this.g=new class{constructor(){this.g=[]}length(){return this.g.length}end(){const e=this.g;return this.g=[],e}}}};Es(this.u,t,vs(e)),di(t,t.g.end());const n=new Uint8Array(t.h),a=t.l,r=a.length;let i=0;for(let e=0;e<r;e++){const t=a[e];n.set(t,i),i+=t.length}return t.l=[n],n}}var ll=[0,Ys,ks((function(e,t,n){return 2===e.h&&(Ms(t,n,(e=Xr(e))===xr()?void 0:e),!0)}),(function(e,t,n){if(null!=t){if(t instanceof Jo){const a=t.Ea;return void(a&&(t=a(t),null!=t&&pi(e,n,Ir(t).buffer)))}if(Array.isArray(t))return}Rs(e,t,n)}))],ul=[0,Zs],dl=[0,Gs,nl,$s,$s,Ws,nl,nl],cl=[0,$s,$s],fl=class extends Jo{constructor(){super()}};fl.B=[6];var hl=[0,$s,Zs,$s,nl,nl,al,Zs,Zs,Xs,cl,nl],pl=[0,Zs,Zs,Zs],ml=class extends Jo{constructor(){super()}},gl=[0],vl=[0,Gs],yl=[1,2,3,4,5],bl=class extends Jo{constructor(e){super(e,2)}},xl={},Cl=[-2,xl,$s];xl[336783863]=ts([0,Zs,$s,$s,Gs,Xs,[0,Js,gl,yl,Js,hl,yl,Js,pl,yl,Js,vl,yl,Js,dl,yl],Xs,ul]);var wl=[0,Ys,qs],El=[0,Us,Us,qs,qs,qs,qs,Us,Ws,Ys,Vs,Us,Us,qs,Vs,qs,qs,qs,Ys],kl=[-1,{}],Tl=[0,Zs,Xs,2,kl],Ml=[0,Zs,Hs,Xs,kl];function Il(e,t){t=Yi(t);const n=Ei(e=e.u);Fi(n),ko(e,n,2,""===t?void 0:t)}function Sl(e,t){Xo(e,3,t)}function Dl(e,t){Xo(e,4,t)}var Nl=class extends Jo{constructor(e){super(e,500)}o(e){return Uo(this,0,7,e)}};Nl.B=[3,4,5,6,8,13,17,1005];var Al=[-500,Ys,Ys,Hs,Hs,Hs,Hs,Xs,Cl,Ks,ll,Vs,Vs,Xs,Tl,Xs,Ml,Ks,wl,Ys,Xs,El,Vs,Hs,Hs,988],Ll=[0,Ys,Ys,Xs,kl],Rl=[-500,Zs,Zs,Xs,[-1,{}],Zs,999],Ol=[-500,Zs,Hs,Hs,Xs,[-2,{},$s],Hs,998,Hs],Fl=[-500,Zs,Hs,Xs,kl,Hs,999];function jl(e,t){Go(e,Nl,t)}function Pl(e,t){Xo(e,10,t)}function Bl(e,t){Xo(e,15,t)}var _l=class extends Jo{constructor(e){super(e,500)}o(e){return Uo(this,0,1001,e)}};_l.B=[1,6,7,9,10,15,16,17,14,1002];var Ul=[-500,Ks,Al,Ks,5,Rl,Ks,Ol,Vs,Ks,Fl,Hs,Vs,Xs,Tl,Xs,Ml,Ks,Ll,Hs,Hs,Hs,Xs,El,Ys,Ys,qs,Xs,980,kl,Ks,ll],zl=ol(_l,Ul);_l.prototype.g=sl(Ul);var Gl=[0,Ks,[0,Gs,Gs,Gs]],Wl=class extends Jo{constructor(e){super(e)}},Vl=[0,Gs,js,Zs,Zs],$l=class extends Jo{constructor(e){super(e)}g(){return _o(this,Wl,1)}};$l.B=[1];var ql=[0,Ks,Vl],Hl=ol($l,ql),Yl=[0,Gs,js],Zl=[0,Gs,Gs,Xs,Gl],Ql=class extends Jo{constructor(e){super(e)}},Xl=[0,Gs,Gs,Gs,Gs],Kl=[0,js,js,js,js],Jl=class extends Jo{constructor(e){super(e)}},eu=[0,js,js,Zs,js],tu=class extends Jo{constructor(e){super(e)}h(){return Po(this,Ql,2)}g(){return _o(this,Jl,5)}};tu.B=[5];var nu=[0,nl,Xs,Xl,Xs,Kl,Xs,Zl,Ks,eu],au=class extends Jo{constructor(e){super(e)}};au.B=[1,2,3,8,9];var ru=ol(au,[0,Hs,Ws,Bs,Xs,nu,Zs,Zs,_s,Ks,Yl,Hs,_s]),iu=class extends Jo{constructor(e){super(e)}},ou=[0,js,js,js,js,js],su=class extends Jo{constructor(e){super(e)}};su.B=[1];var lu=ol(su,[0,Ks,ou]),uu=class extends Jo{constructor(e){super(e)}},du=[0,js,js,js,js,js],cu=class extends Jo{constructor(e){super(e)}};cu.B=[1];var fu=ol(cu,[0,Ks,du]),hu=class extends Jo{constructor(e){super(e)}};hu.B=[3];var pu=[0,Gs,Gs,Bs,nl],mu=class extends Jo{constructor(){super()}};mu.prototype.g=sl([0,js,js,js,js,js,_s]);var gu=class extends Jo{constructor(e){super(e)}},vu=[0,Gs,2,Zs,Xs,ql],yu=class extends Jo{constructor(e){super(e)}};yu.B=[1];var bu=ol(yu,[0,Ks,vu,_s]),xu=class extends Jo{constructor(e){super(e)}};xu.B=[1];var Cu=class extends Jo{constructor(e){super(e)}fa(){const e=Io(this);return null==e?xr():e}},wu=class extends Jo{constructor(e){super(e)}},Eu=[1,2],ku=[0,Js,[0,Bs],Eu,Js,[0,el],Eu,Gs,Zs],Tu=class extends Jo{constructor(e){super(e)}};Tu.B=[1];var Mu=ol(Tu,[0,Ks,ku,_s]),Iu=class extends Jo{constructor(e){super(e)}};Iu.B=[4,5];var Su=[0,Zs,Gs,js,Hs,Hs],Du=class extends Jo{constructor(e){super(e)}},Nu=[0,$s,$s],Au=class extends Jo{constructor(e){super(e)}},Lu=[1,2,3,4,5],Ru=class extends Jo{constructor(e){super(e)}g(){return null!=Io(this)}h(){return null!=$o(this,2)}},Ou=[0,el,Zs,Xs,[0,Gs,_s,_s],Xs,[0,zs,_s]],Fu=class extends Jo{constructor(e){super(e)}g(){return Wi(Co(this,2))??!1}},ju=[0,Xs,Ou,$s,Xs,[0,Js,vl,Lu,Js,hl,Lu,Js,dl,Lu,Js,gl,Lu,Js,pl,Lu]],Pu=class extends Jo{constructor(e){super(e)}},Bu=[0,Xs,ju,js,js,Gs],_u=il(502141897,Pu);xl[502141897]=ts(Bu);var Uu=[0,Xs,Ou];xl[512499200]=ts(Uu);var zu=[0,Xs,Uu];xl[515723506]=ts(zu);var Gu=ol(class extends Jo{constructor(e){super(e)}},[0,Xs,[0,nl,nl,Ps,tl],Xs,pu]),Wu=[0,Xs,ju];xl[508981768]=ts(Wu);var Vu=class extends Jo{constructor(e){super(e)}},$u=[0,Xs,ju,js,Xs,Wu,$s],qu=class extends Jo{constructor(e){super(e)}},Hu=[0,Xs,ju,Xs,Bu,Xs,$u,js,Xs,zu];xl[508968149]=ts($u);var Yu=il(508968150,qu);xl[508968150]=ts(Hu);var Zu=class extends Jo{constructor(e){super(e)}},Qu=il(513916220,Zu);xl[513916220]=ts([0,Xs,ju,Xs,Hu,Gs]);var Xu=class extends Jo{constructor(e){super(e)}h(){return Po(this,Iu,2)}g(){Eo(this,2)}},Ku=[0,Xs,ju,Xs,Su];xl[478825465]=ts(Ku);var Ju=[0,Xs,ju];xl[478825422]=ts(Ju);var ed=class extends Jo{constructor(e){super(e)}},td=[0,Xs,ju,Xs,Ju,Xs,Ku,Xs,Ku],nd=class extends Jo{constructor(e){super(e)}},ad=[0,Xs,ju,js,Gs],rd=class extends Jo{constructor(e){super(e)}},id=[0,Xs,ju,js],od=class extends Jo{constructor(e){super(e)}},sd=[0,Xs,ju,Xs,ad,Xs,id,js],ld=class extends Jo{constructor(e){super(e)}},ud=[0,Xs,ju,Xs,sd,Xs,td];xl[463370452]=ts(td),xl[464864288]=ts(ad),xl[474472470]=ts(id);var dd=il(462713202,od);xl[462713202]=ts(sd);var cd=il(479097054,ld);xl[479097054]=ts(ud);var fd=class extends Jo{constructor(e){super(e)}},hd=il(456383383,fd);xl[456383383]=ts([0,Xs,ju,Xs,Su]);var pd=class extends Jo{constructor(e){super(e)}},md=il(476348187,pd);xl[476348187]=ts([0,Xs,ju,Xs,Nu]);var gd=class extends Jo{constructor(e){super(e)}},vd=[0,nl,nl],yd=class extends Jo{constructor(e){super(e)}};yd.B=[3];var bd=il(458105876,class extends Jo{constructor(e){super(e)}g(){var e=this.u;const t=Ei(e);var n=2&t;return e=function(e,t,n){var a=yd;const r=2&t;let i=!1;if(null==n){if(r)return No();n=[]}else if(n.constructor===lo){if(0==(2&n.g)||r)return n;n=n.m()}else Array.isArray(n)?i=!!(2&wi(n)):n=[];if(r){if(!n.length)return No();i||(i=!0,Mi(n))}else i&&(i=!1,n=Ao(n));return i||(64&wi(n)?Ci(n,32):32&t&&bi(n,32)),ko(e,t,2,a=new lo(n,a,Ji,void 0),!1),a}(e,t,wo(e,t,2)),null==e||!n&&yd&&(e.v=!0),e}});xl[458105876]=ts([0,Xs,vd,Is,[!0,_s,Xs,[0,Zs,Zs,Hs]]]);var xd=class extends Jo{constructor(e){super(e)}},Cd=il(458105758,xd);xl[458105758]=ts([0,Xs,ju,Zs,Xs,vd]);var wd=class extends Jo{constructor(e){super(e)}};wd.B=[5,6];var Ed=il(443442058,wd);xl[443442058]=ts([0,Xs,ju,Zs,Gs,js,Hs,Hs]);var kd=class extends Jo{constructor(e){super(e)}},Td=[0,Xs,ju,js,js,Gs];xl[514774813]=ts(Td);var Md=class extends Jo{constructor(e){super(e)}},Id=[0,Xs,ju,js,$s],Sd=class extends Jo{constructor(e){super(e)}},Dd=[0,Xs,ju,Xs,Td,Xs,Id,js];xl[518928384]=ts(Id);var Nd=il(516587230,Sd);function Ad(e,t){return t=t?t.clone():new Iu,void 0!==e.displayNamesLocale?Eo(t,1,Yi(e.displayNamesLocale)):void 0===e.displayNamesLocale&&Eo(t,1),void 0!==e.maxResults?Zo(t,2,e.maxResults):"maxResults"in e&&Eo(t,2),void 0!==e.scoreThreshold?Qo(t,3,e.scoreThreshold):"scoreThreshold"in e&&Eo(t,3),void 0!==e.categoryAllowlist?Lo(t,4,e.categoryAllowlist):"categoryAllowlist"in e&&Eo(t,4),void 0!==e.categoryDenylist?Lo(t,5,e.categoryDenylist):"categoryDenylist"in e&&Eo(t,5),t}function Ld(e,t=-1,n=""){return{categories:e.map((e=>({index:qo(Wo(e,1))??-1,score:Ho(e,2)??0,categoryName:$o(e,3)??""??"",displayName:$o(e,4)??""??""}))),headIndex:t,headName:n}}function Rd(e){var t=So(e,3,Gi),n=So(e,2,$i);const a=So(e,1,Zi),r=So(e,9,Zi),i={categories:[],keypoints:[]};for(let e=0;e<t.length;e++)i.categories.push({score:t[e],index:n[e]??-1,categoryName:a[e]??"",displayName:r[e]??""});if((t=Po(e,tu,4)?.h())&&(i.boundingBox={originX:Wo(t,1)??0,originY:Wo(t,2)??0,width:Wo(t,3)??0,height:Wo(t,4)??0,angle:0}),Po(e,tu,4)?.g().length)for(const t of Po(e,tu,4).g())i.keypoints.push({x:Mo(t,1)??0,y:Mo(t,2)??0,score:Mo(t,4)??0,label:$o(t,3)??""});return i}function Od(e){const t=[];for(const n of _o(e,uu,1))t.push({x:Ho(n,1)??0,y:Ho(n,2)??0,z:Ho(n,3)??0});return t}function Fd(e){const t=[];for(const n of _o(e,iu,1))t.push({x:Ho(n,1)??0,y:Ho(n,2)??0,z:Ho(n,3)??0});return t}function jd(e){return Array.from(e,(e=>127<e?e-256:e))}function Pd(e,t){if(e.length!==t.length)throw Error(`Cannot compute cosine similarity between embeddings of different sizes (${e.length} vs. ${t.length}).`);let n=0,a=0,r=0;for(let i=0;i<e.length;i++)n+=e[i]*t[i],a+=e[i]*e[i],r+=t[i]*t[i];if(0>=a||0>=r)throw Error("Cannot compute cosine similarity on embedding with 0 norm.");return n/Math.sqrt(a*r)}let Bd;xl[516587230]=ts(Dd);const _d=new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]);async function Ud(){if(void 0===Bd)try{await WebAssembly.instantiate(_d),Bd=!0}catch{Bd=!1}return Bd}async function zd(e,t=""){const n=await Ud()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${t}/${e}_${n}.js`,wasmBinaryPath:`${t}/${e}_${n}.wasm`}}var Gd=class{};function Wd(){const e=navigator.userAgent;return e.includes("Safari")&&!e.includes("Chrome")}async function Vd(e){if("function"!=typeof importScripts){const t=document.createElement("script");return t.src=e.toString(),t.crossOrigin="anonymous",new Promise(((e,n)=>{t.addEventListener("load",(()=>{e()}),!1),t.addEventListener("error",(e=>{n(e)}),!1),document.body.appendChild(t)}))}importScripts(e.toString())}function $d(e,t,n){e.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target"),n(t=e.i.stringToNewUTF8(t)),e.i._free(t)}function qd(e,t,n){if(!e.i.canvas)throw Error("No OpenGL canvas configured.");if(n?e.i._bindTextureToStream(n):e.i._bindTextureToCanvas(),!(n=e.i.canvas.getContext("webgl2")||e.i.canvas.getContext("webgl")))throw Error("Failed to obtain WebGL context from the provided canvas. `getContext()` should only be invoked with `webgl` or `webgl2`.");return e.i.gpuOriginForWebTexturesIsBottomLeft&&n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!0),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,t),e.i.gpuOriginForWebTexturesIsBottomLeft&&n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!1),t.videoWidth?(n=t.videoWidth,t=t.videoHeight):t.naturalWidth?(n=t.naturalWidth,t=t.naturalHeight):(n=t.width,t=t.height),!e.l||n===e.i.canvas.width&&t===e.i.canvas.height||(e.i.canvas.width=n,e.i.canvas.height=t),[n,t]}function Hd(e,t,n){e.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");const a=new Uint32Array(t.length);for(let n=0;n<t.length;n++)a[n]=e.i.stringToNewUTF8(t[n]);t=e.i._malloc(4*a.length),e.i.HEAPU32.set(a,t>>2),n(t);for(const t of a)e.i._free(t);e.i._free(t)}function Yd(e,t,n){e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=n}function Zd(e,t,n){let a=[];e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=(e,t,r)=>{t?(n(a,r),a=[]):a.push(e)}}function Qd(e,t){const n=Po(e.baseOptions,Ru,1)||new Ru;"string"==typeof t?(Eo(n,2,Yi(t)),Eo(n,1)):t instanceof Uint8Array&&(Eo(n,1,Ri(t,!1,!1)),Eo(n,2)),Uo(e.baseOptions,0,1,n)}function Xd(e){try{const t=e.J.length;if(1===t)throw Error(e.J[0].message);if(1<t)throw Error("Encountered multiple errors: "+e.J.map((e=>e.message)).join(", "))}finally{e.J=[]}}function Kd(e,t){e.I=Math.max(e.I,t)}function Jd(e,t){e.A=new Nl,Il(e.A,"PassThroughCalculator"),Sl(e.A,"free_memory"),Dl(e.A,"free_memory_unused_out"),Pl(t,"free_memory"),jl(t,e.A)}function ec(e,t){Sl(e.A,t),Dl(e.A,t+"_unused_out")}function tc(e){e.g.addBoolToStream(!0,"free_memory",e.I)}Gd.forVisionTasks=function(e){return zd("vision",e)},Gd.forTextTasks=function(e){return zd("text",e)},Gd.forAudioTasks=function(e){return zd("audio",e)},Gd.isSimdSupported=function(){return Ud()};var nc=class{constructor(e){this.g=e,this.J=[],this.I=0,this.g.setAutoRenderToScreen(!1)}l(e,t=!0){if(t){const t=e.baseOptions||{};if(e.baseOptions?.modelAssetBuffer&&e.baseOptions?.modelAssetPath)throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!(Po(this.baseOptions,Ru,1)?.g()||Po(this.baseOptions,Ru,1)?.h()||e.baseOptions?.modelAssetBuffer||e.baseOptions?.modelAssetPath))throw Error("Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set");if(function(e,t){let n=Po(e.baseOptions,Au,3);if(!n){var a=n=new Au,r=new ml;zo(a,4,Lu,r)}"delegate"in t&&("GPU"===t.delegate?(t=n,a=new fl,zo(t,2,Lu,a)):(t=n,a=new ml,zo(t,4,Lu,a))),Uo(e.baseOptions,0,3,n)}(this,t),t.modelAssetPath)return fetch(t.modelAssetPath.toString()).then((e=>{if(e.ok)return e.arrayBuffer();throw Error(`Failed to fetch model: ${t.modelAssetPath} (${e.status})`)})).then((e=>{try{this.g.i.FS_unlink("/model.dat")}catch{}this.g.i.FS_createDataFile("/","model.dat",new Uint8Array(e),!0,!1,!1),Qd(this,"/model.dat"),this.m(),this.P()}));Qd(this,t.modelAssetBuffer)}return this.m(),this.P(),Promise.resolve()}P(){}W(){let e;if(this.g.W((t=>{e=zl(t)})),!e)throw Error("Failed to retrieve CalculatorGraphConfig");return e}setGraph(e,t){this.g.attachErrorListener(((e,t)=>{this.J.push(Error(t))})),this.g.Aa(),this.g.setGraph(e,t),this.A=void 0,Xd(this)}finishProcessing(){this.g.finishProcessing(),Xd(this)}close(){this.A=void 0,this.g.closeGraph()}};function ac(e,t){if(null===e)throw Error(`Unable to obtain required WebGL resource: ${t}`);return e}nc.prototype.close=nc.prototype.close;class rc{constructor(e,t,n,a){this.g=e,this.h=t,this.m=n,this.l=a}bind(){this.g.bindVertexArray(this.h)}close(){this.g.deleteVertexArray(this.h),this.g.deleteBuffer(this.m),this.g.deleteBuffer(this.l)}}function ic(e,t,n){const a=e.h;if(n=ac(a.createShader(n),"Failed to create WebGL shader"),a.shaderSource(n,t),a.compileShader(n),!a.getShaderParameter(n,a.COMPILE_STATUS))throw Error(`Could not compile WebGL shader: ${a.getShaderInfoLog(n)}`);return a.attachShader(e.g,n),n}function oc(e,t){const n=e.h,a=ac(n.createVertexArray(),"Failed to create vertex array");n.bindVertexArray(a);const r=ac(n.createBuffer(),"Failed to create buffer");n.bindBuffer(n.ARRAY_BUFFER,r),n.enableVertexAttribArray(e.s),n.vertexAttribPointer(e.s,2,n.FLOAT,!1,0,0),n.bufferData(n.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,1,1,1,-1]),n.STATIC_DRAW);const i=ac(n.createBuffer(),"Failed to create buffer");return n.bindBuffer(n.ARRAY_BUFFER,i),n.enableVertexAttribArray(e.A),n.vertexAttribPointer(e.A,2,n.FLOAT,!1,0,0),n.bufferData(n.ARRAY_BUFFER,new Float32Array(t?[0,1,0,0,1,0,1,1]:[0,0,0,1,1,1,1,0]),n.STATIC_DRAW),n.bindBuffer(n.ARRAY_BUFFER,null),n.bindVertexArray(null),new rc(n,a,r,i)}function sc(e,t){if(e.h){if(t!==e.h)throw Error("Cannot change GL context once initialized")}else e.h=t}function lc(e,t,n,a){if(sc(e,t),!e.g){const t=e.h;if(e.g=ac(t.createProgram(),"Failed to create WebGL program"),e.C=ic(e,"\n attribute vec2 aVertex;\n attribute vec2 aTex;\n varying vec2 vTex;\n void main(void) {\n gl_Position = vec4(aVertex, 0.0, 1.0);\n vTex = aTex;\n }",t.VERTEX_SHADER),e.v=ic(e,"\n precision mediump float;\n varying vec2 vTex;\n uniform sampler2D inputTexture;\n void main() {\n gl_FragColor = texture2D(inputTexture, vTex);\n }\n ",t.FRAGMENT_SHADER),t.linkProgram(e.g),!t.getProgramParameter(e.g,t.LINK_STATUS))throw Error(`Error during program linking: ${t.getProgramInfoLog(e.g)}`);e.s=t.getAttribLocation(e.g,"aVertex"),e.A=t.getAttribLocation(e.g,"aTex")}return n?(e.m||(e.m=oc(e,!0)),n=e.m):(e.j||(e.j=oc(e,!1)),n=e.j),t.useProgram(e.g),n.bind(),e=a(),n.g.bindVertexArray(null),e}function uc(e,t,n){sc(e,t),e.l||(e.l=ac(t.createFramebuffer(),"Failed to create framebuffe.")),t.bindFramebuffer(t.FRAMEBUFFER,e.l),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,n,0)}function dc(e){e.h?.bindFramebuffer(e.h.FRAMEBUFFER,null)}var cc=class{close(){if(this.g){const e=this.h;e.deleteProgram(this.g),e.deleteShader(this.C),e.deleteShader(this.v)}this.l&&this.h.deleteFramebuffer(this.l),this.j&&this.j.close(),this.m&&this.m.close()}};function fc(e,t){switch(t){case 0:return e.g.find((e=>e instanceof ImageData));case 1:return e.g.find((e=>"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap));case 2:return e.g.find((e=>"undefined"!=typeof WebGLTexture&&e instanceof WebGLTexture));default:throw Error(`Type is not supported: ${t}`)}}function hc(e){var t=fc(e,0);if(!t){t=mc(e);const n=gc(e),a=new Uint8Array(e.width*e.height*4);uc(n,t,pc(e)),t.readPixels(0,0,e.width,e.height,t.RGBA,t.UNSIGNED_BYTE,a),dc(n),t=new ImageData(new Uint8ClampedArray(a.buffer),e.width,e.height),e.g.push(t)}return t}function pc(e){let t=fc(e,2);if(!t){const n=mc(e);t=yc(e);const a=fc(e,1)||hc(e);n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,a),bc(e)}return t}function mc(e){if(!e.canvas)throw Error("Conversion to different image formats require that a canvas is passed when iniitializing the image.");return e.h||(e.h=ac(e.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),e.h}function gc(e){return e.l||(e.l=new cc),e.l}function vc(e){(e=mc(e)).texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR)}function yc(e){const t=mc(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let n=fc(e,2);return n?t.bindTexture(t.TEXTURE_2D,n):(n=ac(t.createTexture(),"Failed to create texture"),e.g.push(n),e.m=!0,t.bindTexture(t.TEXTURE_2D,n),vc(e)),n}function bc(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}function xc(e){const t=mc(e);return lc(gc(e),t,!0,(()=>function(e,t){const n=e.canvas;if(n.width===e.width&&n.height===e.height)return t();const a=n.width,r=n.height;return n.width=e.width,n.height=e.height,e=t(),n.width=a,n.height=r,e}(e,(()=>{if(t.bindFramebuffer(t.FRAMEBUFFER,null),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.TRIANGLE_FAN,0,4),!(e.canvas instanceof OffscreenCanvas))throw Error("Conversion to ImageBitmap requires that the MediaPipe Tasks is initialized with an OffscreenCanvas");return e.canvas.transferToImageBitmap()}))))}var Cc=class{constructor(e,t,n,a,r,i,o){this.g=e,this.j=t,this.m=n,this.canvas=a,this.l=r,this.width=i,this.height=o,(this.j||this.m)&&0==--wc&&console.error("You seem to be creating MPImage instances without invoking .close(). This leaks resources.")}va(){return!!fc(this,0)}ba(){return!!fc(this,1)}K(){return!!fc(this,2)}ra(){return hc(this)}qa(){var e=fc(this,1);return e||(pc(this),yc(this),e=xc(this),bc(this),this.g.push(e),this.j=!0),e}V(){return pc(this)}clone(){const e=[];for(const t of this.g){let n;if(t instanceof ImageData)n=new ImageData(t.data,this.width,this.height);else if(t instanceof WebGLTexture){const e=mc(this),t=gc(this);e.activeTexture(e.TEXTURE1),n=ac(e.createTexture(),"Failed to create texture"),e.bindTexture(e.TEXTURE_2D,n),vc(this),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,this.width,this.height,0,e.RGBA,e.UNSIGNED_BYTE,null),e.bindTexture(e.TEXTURE_2D,null),uc(t,e,n),lc(t,e,!1,(()=>{yc(this),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.drawArrays(e.TRIANGLE_FAN,0,4),bc(this)})),dc(t),bc(this)}else{if(!(t instanceof ImageBitmap))throw Error(`Type is not supported: ${t}`);pc(this),yc(this),n=xc(this),bc(this)}e.push(n)}return new Cc(e,this.ba(),this.K(),this.canvas,this.l,this.width,this.height)}close(){this.j&&fc(this,1).close(),this.m&&mc(this).deleteTexture(fc(this,2)),wc=-1}};Cc.prototype.close=Cc.prototype.close,Cc.prototype.clone=Cc.prototype.clone,Cc.prototype.getAsWebGLTexture=Cc.prototype.V,Cc.prototype.getAsImageBitmap=Cc.prototype.qa,Cc.prototype.getAsImageData=Cc.prototype.ra,Cc.prototype.hasWebGLTexture=Cc.prototype.K,Cc.prototype.hasImageBitmap=Cc.prototype.ba,Cc.prototype.hasImageData=Cc.prototype.va;var wc=250;function Ec(e,t){switch(t){case 0:return e.g.find((e=>e instanceof Uint8Array));case 1:return e.g.find((e=>e instanceof Float32Array));case 2:return e.g.find((e=>"undefined"!=typeof WebGLTexture&&e instanceof WebGLTexture));default:throw Error(`Type is not supported: ${t}`)}}function kc(e){var t=Ec(e,1);if(!t){if(t=Ec(e,0))t=new Float32Array(t).map((e=>e/255));else{t=new Float32Array(e.width*e.height);const a=Mc(e);var n=Sc(e);if(uc(n,a,Tc(e)),"iPad Simulator;iPhone Simulator;iPod Simulator;iPad;iPhone;iPod".split(";").includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document){n=new Float32Array(e.width*e.height*4),a.readPixels(0,0,e.width,e.height,a.RGBA,a.FLOAT,n);for(let e=0,a=0;e<t.length;++e,a+=4)t[e]=n[a]}else a.readPixels(0,0,e.width,e.height,a.RED,a.FLOAT,t)}e.g.push(t)}return t}function Tc(e){let t=Ec(e,2);if(!t){const n=Mc(e);t=Nc(e);const a=kc(e),r=Ic(e);n.texImage2D(n.TEXTURE_2D,0,r,e.width,e.height,0,n.RED,n.FLOAT,a),Ac(e)}return t}function Mc(e){if(!e.canvas)throw Error("Conversion to different image formats require that a canvas is passed when initializing the image.");return e.h||(e.h=ac(e.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),e.h}function Ic(e){if(e=Mc(e),!Lc)if(e.getExtension("EXT_color_buffer_float")&&e.getExtension("OES_texture_float_linear")&&e.getExtension("EXT_float_blend"))Lc=e.R32F;else{if(!e.getExtension("EXT_color_buffer_half_float"))throw Error("GPU does not fully support 4-channel float32 or float16 formats");Lc=e.R16F}return Lc}function Sc(e){return e.l||(e.l=new cc),e.l}function Dc(e){(e=Mc(e)).texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST)}function Nc(e){const t=Mc(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let n=Ec(e,2);return n?t.bindTexture(t.TEXTURE_2D,n):(n=ac(t.createTexture(),"Failed to create texture"),e.g.push(n),e.m=!0,t.bindTexture(t.TEXTURE_2D,n),Dc(e)),n}function Ac(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}var Lc,Rc=class{constructor(e,t,n,a,r,i){this.g=e,this.m=t,this.canvas=n,this.l=a,this.width=r,this.height=i,this.m&&0==--Oc&&console.error("You seem to be creating MPMask instances without invoking .close(). This leaks resources.")}wa(){return!!Ec(this,0)}ua(){return!!Ec(this,1)}K(){return!!Ec(this,2)}sa(){return(e=Ec(this,0))||(e=kc(this),e=new Uint8Array(e.map((e=>255*e))),this.g.push(e)),e;var e}pa(){return kc(this)}V(){return Tc(this)}clone(){const e=[];for(const t of this.g){let n;if(t instanceof Uint8Array)n=new Uint8Array(t);else if(t instanceof Float32Array)n=new Float32Array(t);else{if(!(t instanceof WebGLTexture))throw Error(`Type is not supported: ${t}`);{const e=Mc(this),t=Sc(this);e.activeTexture(e.TEXTURE1),n=ac(e.createTexture(),"Failed to create texture"),e.bindTexture(e.TEXTURE_2D,n),Dc(this);const a=Ic(this);e.texImage2D(e.TEXTURE_2D,0,a,this.width,this.height,0,e.RED,e.FLOAT,null),e.bindTexture(e.TEXTURE_2D,null),uc(t,e,n),lc(t,e,!1,(()=>{Nc(this),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.drawArrays(e.TRIANGLE_FAN,0,4),Ac(this)})),dc(t),Ac(this)}}e.push(n)}return new Rc(e,this.K(),this.canvas,this.l,this.width,this.height)}close(){this.m&&Mc(this).deleteTexture(Ec(this,2)),Oc=-1}};Rc.prototype.close=Rc.prototype.close,Rc.prototype.clone=Rc.prototype.clone,Rc.prototype.getAsWebGLTexture=Rc.prototype.V,Rc.prototype.getAsFloat32Array=Rc.prototype.pa,Rc.prototype.getAsUint8Array=Rc.prototype.sa,Rc.prototype.hasWebGLTexture=Rc.prototype.K,Rc.prototype.hasFloat32Array=Rc.prototype.ua,Rc.prototype.hasUint8Array=Rc.prototype.wa;var Oc=250;function Fc(...e){return e.map((([e,t])=>({start:e,end:t})))}const jc=function(e){return class extends e{Aa(){this.i._registerModelResourcesGraphService()}}}((Pc=class{constructor(e,t){this.l=!0,this.i=e,this.g=null,this.h=0,this.m="function"==typeof this.i._addIntToInputStream,void 0!==t?this.i.canvas=t:"undefined"==typeof OffscreenCanvas||Wd()?(console.warn("OffscreenCanvas not supported and GraphRunner constructor glCanvas parameter is undefined. Creating backup canvas."),this.i.canvas=document.createElement("canvas")):this.i.canvas=new OffscreenCanvas(1,1)}async initializeGraph(e){const t=await(await fetch(e)).arrayBuffer();e=!(e.endsWith(".pbtxt")||e.endsWith(".textproto")),this.setGraph(new Uint8Array(t),e)}setGraphFromString(e){this.setGraph((new TextEncoder).encode(e),!1)}setGraph(e,t){const n=e.length,a=this.i._malloc(n);this.i.HEAPU8.set(e,a),t?this.i._changeBinaryGraph(n,a):this.i._changeTextGraph(n,a),this.i._free(a)}configureAudio(e,t,n,a,r){this.i._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),$d(this,a||"input_audio",(a=>{$d(this,r=r||"audio_header",(r=>{this.i._configureAudio(a,r,e,t,n)}))}))}setAutoResizeCanvas(e){this.l=e}setAutoRenderToScreen(e){this.i._setAutoRenderToScreen(e)}setGpuBufferVerticalFlip(e){this.i.gpuOriginForWebTexturesIsBottomLeft=e}W(e){Yd(this,"__graph_config__",(t=>{e(t)})),$d(this,"__graph_config__",(e=>{this.i._getGraphConfig(e,void 0)})),delete this.i.simpleListeners.__graph_config__}attachErrorListener(e){this.i.errorListener=e}attachEmptyPacketListener(e,t){this.i.emptyPacketListeners=this.i.emptyPacketListeners||{},this.i.emptyPacketListeners[e]=t}addAudioToStream(e,t,n){this.addAudioToStreamWithShape(e,0,0,t,n)}addAudioToStreamWithShape(e,t,n,a,r){const i=4*e.length;this.h!==i&&(this.g&&this.i._free(this.g),this.g=this.i._malloc(i),this.h=i),this.i.HEAPF32.set(e,this.g/4),$d(this,a,(e=>{this.i._addAudioToInputStream(this.g,t,n,e,r)}))}addGpuBufferToStream(e,t,n){$d(this,t,(t=>{const[a,r]=qd(this,e,t);this.i._addBoundTextureToStream(t,a,r,n)}))}addBoolToStream(e,t,n){$d(this,t,(t=>{this.i._addBoolToInputStream(e,t,n)}))}addDoubleToStream(e,t,n){$d(this,t,(t=>{this.i._addDoubleToInputStream(e,t,n)}))}addFloatToStream(e,t,n){$d(this,t,(t=>{this.i._addFloatToInputStream(e,t,n)}))}addIntToStream(e,t,n){$d(this,t,(t=>{this.i._addIntToInputStream(e,t,n)}))}addStringToStream(e,t,n){$d(this,t,(t=>{$d(this,e,(e=>{this.i._addStringToInputStream(e,t,n)}))}))}addStringRecordToStream(e,t,n){$d(this,t,(t=>{Hd(this,Object.keys(e),(a=>{Hd(this,Object.values(e),(r=>{this.i._addFlatHashMapToInputStream(a,r,Object.keys(e).length,t,n)}))}))}))}addProtoToStream(e,t,n,a){$d(this,n,(n=>{$d(this,t,(t=>{const r=this.i._malloc(e.length);this.i.HEAPU8.set(e,r),this.i._addProtoToInputStream(r,e.length,t,n,a),this.i._free(r)}))}))}addEmptyPacketToStream(e,t){$d(this,e,(e=>{this.i._addEmptyPacketToInputStream(e,t)}))}addBoolToInputSidePacket(e,t){$d(this,t,(t=>{this.i._addBoolToInputSidePacket(e,t)}))}addDoubleToInputSidePacket(e,t){$d(this,t,(t=>{this.i._addDoubleToInputSidePacket(e,t)}))}addFloatToInputSidePacket(e,t){$d(this,t,(t=>{this.i._addFloatToInputSidePacket(e,t)}))}addIntToInputSidePacket(e,t){$d(this,t,(t=>{this.i._addIntToInputSidePacket(e,t)}))}addStringToInputSidePacket(e,t){$d(this,t,(t=>{$d(this,e,(e=>{this.i._addStringToInputSidePacket(e,t)}))}))}addProtoToInputSidePacket(e,t,n){$d(this,n,(n=>{$d(this,t,(t=>{const a=this.i._malloc(e.length);this.i.HEAPU8.set(e,a),this.i._addProtoToInputSidePacket(a,e.length,t,n),this.i._free(a)}))}))}attachBoolListener(e,t){Yd(this,e,t),$d(this,e,(e=>{this.i._attachBoolListener(e)}))}attachBoolVectorListener(e,t){Zd(this,e,t),$d(this,e,(e=>{this.i._attachBoolVectorListener(e)}))}attachIntListener(e,t){Yd(this,e,t),$d(this,e,(e=>{this.i._attachIntListener(e)}))}attachIntVectorListener(e,t){Zd(this,e,t),$d(this,e,(e=>{this.i._attachIntVectorListener(e)}))}attachDoubleListener(e,t){Yd(this,e,t),$d(this,e,(e=>{this.i._attachDoubleListener(e)}))}attachDoubleVectorListener(e,t){Zd(this,e,t),$d(this,e,(e=>{this.i._attachDoubleVectorListener(e)}))}attachFloatListener(e,t){Yd(this,e,t),$d(this,e,(e=>{this.i._attachFloatListener(e)}))}attachFloatVectorListener(e,t){Zd(this,e,t),$d(this,e,(e=>{this.i._attachFloatVectorListener(e)}))}attachStringListener(e,t){Yd(this,e,t),$d(this,e,(e=>{this.i._attachStringListener(e)}))}attachStringVectorListener(e,t){Zd(this,e,t),$d(this,e,(e=>{this.i._attachStringVectorListener(e)}))}attachProtoListener(e,t,n){Yd(this,e,t),$d(this,e,(e=>{this.i._attachProtoListener(e,n||!1)}))}attachProtoVectorListener(e,t,n){Zd(this,e,t),$d(this,e,(e=>{this.i._attachProtoVectorListener(e,n||!1)}))}attachAudioListener(e,t,n){this.i._attachAudioListener||console.warn('Attempting to use attachAudioListener without support for output audio. Is build dep ":gl_graph_runner_audio_out" missing?'),Yd(this,e,((e,n)=>{e=new Float32Array(e.buffer,e.byteOffset,e.length/4),t(e,n)})),$d(this,e,(e=>{this.i._attachAudioListener(e,n||!1)}))}finishProcessing(){this.i._waitUntilIdle()}closeGraph(){this.i._closeGraph(),this.i.simpleListeners=void 0,this.i.emptyPacketListeners=void 0}},class extends Pc{get Y(){return this.i}ga(e,t,n){$d(this,t,(t=>{const[a,r]=qd(this,e,t);this.Y._addBoundTextureAsImageToStream(t,a,r,n)}))}S(e,t){Yd(this,e,t),$d(this,e,(e=>{this.Y._attachImageListener(e)}))}T(e,t){Zd(this,e,t),$d(this,e,(e=>{this.Y._attachImageVectorListener(e)}))}}));var Pc,Bc=class extends jc{};async function _c(e,t,n){return async function(e,t,n,a){return async function(e,t,n,a){return e=await(async(e,t,n,a,r)=>{if(t&&await Vd(t),!self.ModuleFactory)throw Error("ModuleFactory not set.");if(n&&(await Vd(n),!self.ModuleFactory))throw Error("ModuleFactory not set.");return self.Module&&r&&((t=self.Module).locateFile=r.locateFile,r.mainScriptUrlOrBlob&&(t.mainScriptUrlOrBlob=r.mainScriptUrlOrBlob)),r=await self.ModuleFactory(self.Module||r),self.ModuleFactory=self.Module=void 0,new e(r,a)})(e,n.wasmLoaderPath,n.assetLoaderPath,t,{locateFile:e=>e.endsWith(".wasm")?n.wasmBinaryPath.toString():n.assetBinaryPath&&e.endsWith(".data")?n.assetBinaryPath.toString():e}),await e.o(a),e}(e,t,n,a)}(e,n.canvas??("undefined"==typeof OffscreenCanvas||Wd()?document.createElement("canvas"):void 0),t,n)}function Uc(e,t,n,a){if(e.Z){const i=new mu;if(n?.regionOfInterest){if(!e.ea)throw Error("This task doesn't support region-of-interest.");var r=n.regionOfInterest;if(r.left>=r.right||r.top>=r.bottom)throw Error("Expected RectF with left < right and top < bottom.");if(0>r.left||0>r.top||1<r.right||1<r.bottom)throw Error("Expected RectF values to be in [0,1].");Qo(i,1,(r.left+r.right)/2),Qo(i,2,(r.top+r.bottom)/2),Qo(i,4,r.right-r.left),Qo(i,3,r.bottom-r.top)}else Qo(i,1,.5),Qo(i,2,.5),Qo(i,4,1),Qo(i,3,1);if(n?.rotationDegrees){if(0!=n?.rotationDegrees%90)throw Error("Expected rotation to be a multiple of 90°.");if(Qo(i,5,-Math.PI*n.rotationDegrees/180),0!=n?.rotationDegrees%180){const[e,a]=void 0!==t.videoWidth?[t.videoWidth,t.videoHeight]:void 0!==t.naturalWidth?[t.naturalWidth,t.naturalHeight]:[t.width,t.height];n=Ho(i,3)*a/e,r=Ho(i,4)*e/a,Qo(i,4,n),Qo(i,3,r)}}e.g.addProtoToStream(i.g(),"mediapipe.NormalizedRect",e.Z,a)}e.g.ga(t,e.da,a??performance.now()),e.finishProcessing()}function zc(e,t,n){if(e.baseOptions?.g())throw Error("Task is not initialized with image mode. 'runningMode' must be set to 'IMAGE'.");Uc(e,t,n,e.I+1)}function Gc(e,t,n,a){if(!e.baseOptions?.g())throw Error("Task is not initialized with video mode. 'runningMode' must be set to 'VIDEO'.");Uc(e,t,n,a)}function Wc(e,t,n){var a=t.data;const r=t.width,i=r*(t=t.height);if((a instanceof Uint8Array||a instanceof Float32Array)&&a.length!==i)throw Error("Unsupported channel count: "+a.length/i);return e=new Rc([a],!1,e.g.i.canvas,e.O,r,t),n?e.clone():e}var Vc=class extends nc{constructor(e,t,n,a){super(e),this.g=e,this.da=t,this.Z=n,this.ea=a,this.O=new cc}l(e,t=!0){if("runningMode"in e&&Yo(this.baseOptions,2,!!e.runningMode&&"IMAGE"!==e.runningMode),void 0!==e.canvas&&this.g.i.canvas!==e.canvas)throw Error("You must create a new task to reset the canvas.");return super.l(e,t)}close(){this.O.close(),super.close()}};Vc.prototype.close=Vc.prototype.close;var $c=class extends Vc{constructor(e,t){super(new Bc(e,t),"image_in","norm_rect_in",!1),this.j={detections:[]},this.h=new Pu,e=new Fu,Uo(this.h,0,1,e),Qo(this.h,2,.5),Qo(this.h,3,.3)}get baseOptions(){return Po(this.h,Fu,1)}set baseOptions(e){Uo(this.h,0,1,e)}o(e){return"minDetectionConfidence"in e&&Qo(this.h,2,e.minDetectionConfidence??.5),"minSuppressionThreshold"in e&&Qo(this.h,3,e.minSuppressionThreshold??.3),this.l(e)}F(e,t){return this.j={detections:[]},zc(this,e,t),this.j}G(e,t,n){return this.j={detections:[]},Gc(this,e,n,t),this.j}m(){var e=new _l;Pl(e,"image_in"),Pl(e,"norm_rect_in"),Bl(e,"detections");const t=new bl;Ko(t,_u,this.h);const n=new Nl;Il(n,"mediapipe.tasks.vision.face_detector.FaceDetectorGraph"),Sl(n,"IMAGE:image_in"),Sl(n,"NORM_RECT:norm_rect_in"),Dl(n,"DETECTIONS:detections"),n.o(t),jl(e,n),this.g.attachProtoVectorListener("detections",((e,t)=>{for(const t of e)e=ru(t),this.j.detections.push(Rd(e));Kd(this,t)})),this.g.attachEmptyPacketListener("detections",(e=>{Kd(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};$c.prototype.detectForVideo=$c.prototype.G,$c.prototype.detect=$c.prototype.F,$c.prototype.setOptions=$c.prototype.o,$c.createFromModelPath=async function(e,t){return _c($c,e,{baseOptions:{modelAssetPath:t}})},$c.createFromModelBuffer=function(e,t){return _c($c,e,{baseOptions:{modelAssetBuffer:t}})},$c.createFromOptions=function(e,t){return _c($c,e,t)};var qc=Fc([61,146],[146,91],[91,181],[181,84],[84,17],[17,314],[314,405],[405,321],[321,375],[375,291],[61,185],[185,40],[40,39],[39,37],[37,0],[0,267],[267,269],[269,270],[270,409],[409,291],[78,95],[95,88],[88,178],[178,87],[87,14],[14,317],[317,402],[402,318],[318,324],[324,308],[78,191],[191,80],[80,81],[81,82],[82,13],[13,312],[312,311],[311,310],[310,415],[415,308]),Hc=Fc([263,249],[249,390],[390,373],[373,374],[374,380],[380,381],[381,382],[382,362],[263,466],[466,388],[388,387],[387,386],[386,385],[385,384],[384,398],[398,362]),Yc=Fc([276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]),Zc=Fc([474,475],[475,476],[476,477],[477,474]),Qc=Fc([33,7],[7,163],[163,144],[144,145],[145,153],[153,154],[154,155],[155,133],[33,246],[246,161],[161,160],[160,159],[159,158],[158,157],[157,173],[173,133]),Xc=Fc([46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]),Kc=Fc([469,470],[470,471],[471,472],[472,469]),Jc=Fc([10,338],[338,297],[297,332],[332,284],[284,251],[251,389],[389,356],[356,454],[454,323],[323,361],[361,288],[288,397],[397,365],[365,379],[379,378],[378,400],[400,377],[377,152],[152,148],[148,176],[176,149],[149,150],[150,136],[136,172],[172,58],[58,132],[132,93],[93,234],[234,127],[127,162],[162,21],[21,54],[54,103],[103,67],[67,109],[109,10]),ef=[...qc,...Hc,...Yc,...Qc,...Xc,...Jc],tf=Fc([127,34],[34,139],[139,127],[11,0],[0,37],[37,11],[232,231],[231,120],[120,232],[72,37],[37,39],[39,72],[128,121],[121,47],[47,128],[232,121],[121,128],[128,232],[104,69],[69,67],[67,104],[175,171],[171,148],[148,175],[118,50],[50,101],[101,118],[73,39],[39,40],[40,73],[9,151],[151,108],[108,9],[48,115],[115,131],[131,48],[194,204],[204,211],[211,194],[74,40],[40,185],[185,74],[80,42],[42,183],[183,80],[40,92],[92,186],[186,40],[230,229],[229,118],[118,230],[202,212],[212,214],[214,202],[83,18],[18,17],[17,83],[76,61],[61,146],[146,76],[160,29],[29,30],[30,160],[56,157],[157,173],[173,56],[106,204],[204,194],[194,106],[135,214],[214,192],[192,135],[203,165],[165,98],[98,203],[21,71],[71,68],[68,21],[51,45],[45,4],[4,51],[144,24],[24,23],[23,144],[77,146],[146,91],[91,77],[205,50],[50,187],[187,205],[201,200],[200,18],[18,201],[91,106],[106,182],[182,91],[90,91],[91,181],[181,90],[85,84],[84,17],[17,85],[206,203],[203,36],[36,206],[148,171],[171,140],[140,148],[92,40],[40,39],[39,92],[193,189],[189,244],[244,193],[159,158],[158,28],[28,159],[247,246],[246,161],[161,247],[236,3],[3,196],[196,236],[54,68],[68,104],[104,54],[193,168],[168,8],[8,193],[117,228],[228,31],[31,117],[189,193],[193,55],[55,189],[98,97],[97,99],[99,98],[126,47],[47,100],[100,126],[166,79],[79,218],[218,166],[155,154],[154,26],[26,155],[209,49],[49,131],[131,209],[135,136],[136,150],[150,135],[47,126],[126,217],[217,47],[223,52],[52,53],[53,223],[45,51],[51,134],[134,45],[211,170],[170,140],[140,211],[67,69],[69,108],[108,67],[43,106],[106,91],[91,43],[230,119],[119,120],[120,230],[226,130],[130,247],[247,226],[63,53],[53,52],[52,63],[238,20],[20,242],[242,238],[46,70],[70,156],[156,46],[78,62],[62,96],[96,78],[46,53],[53,63],[63,46],[143,34],[34,227],[227,143],[123,117],[117,111],[111,123],[44,125],[125,19],[19,44],[236,134],[134,51],[51,236],[216,206],[206,205],[205,216],[154,153],[153,22],[22,154],[39,37],[37,167],[167,39],[200,201],[201,208],[208,200],[36,142],[142,100],[100,36],[57,212],[212,202],[202,57],[20,60],[60,99],[99,20],[28,158],[158,157],[157,28],[35,226],[226,113],[113,35],[160,159],[159,27],[27,160],[204,202],[202,210],[210,204],[113,225],[225,46],[46,113],[43,202],[202,204],[204,43],[62,76],[76,77],[77,62],[137,123],[123,116],[116,137],[41,38],[38,72],[72,41],[203,129],[129,142],[142,203],[64,98],[98,240],[240,64],[49,102],[102,64],[64,49],[41,73],[73,74],[74,41],[212,216],[216,207],[207,212],[42,74],[74,184],[184,42],[169,170],[170,211],[211,169],[170,149],[149,176],[176,170],[105,66],[66,69],[69,105],[122,6],[6,168],[168,122],[123,147],[147,187],[187,123],[96,77],[77,90],[90,96],[65,55],[55,107],[107,65],[89,90],[90,180],[180,89],[101,100],[100,120],[120,101],[63,105],[105,104],[104,63],[93,137],[137,227],[227,93],[15,86],[86,85],[85,15],[129,102],[102,49],[49,129],[14,87],[87,86],[86,14],[55,8],[8,9],[9,55],[100,47],[47,121],[121,100],[145,23],[23,22],[22,145],[88,89],[89,179],[179,88],[6,122],[122,196],[196,6],[88,95],[95,96],[96,88],[138,172],[172,136],[136,138],[215,58],[58,172],[172,215],[115,48],[48,219],[219,115],[42,80],[80,81],[81,42],[195,3],[3,51],[51,195],[43,146],[146,61],[61,43],[171,175],[175,199],[199,171],[81,82],[82,38],[38,81],[53,46],[46,225],[225,53],[144,163],[163,110],[110,144],[52,65],[65,66],[66,52],[229,228],[228,117],[117,229],[34,127],[127,234],[234,34],[107,108],[108,69],[69,107],[109,108],[108,151],[151,109],[48,64],[64,235],[235,48],[62,78],[78,191],[191,62],[129,209],[209,126],[126,129],[111,35],[35,143],[143,111],[117,123],[123,50],[50,117],[222,65],[65,52],[52,222],[19,125],[125,141],[141,19],[221,55],[55,65],[65,221],[3,195],[195,197],[197,3],[25,7],[7,33],[33,25],[220,237],[237,44],[44,220],[70,71],[71,139],[139,70],[122,193],[193,245],[245,122],[247,130],[130,33],[33,247],[71,21],[21,162],[162,71],[170,169],[169,150],[150,170],[188,174],[174,196],[196,188],[216,186],[186,92],[92,216],[2,97],[97,167],[167,2],[141,125],[125,241],[241,141],[164,167],[167,37],[37,164],[72,38],[38,12],[12,72],[38,82],[82,13],[13,38],[63,68],[68,71],[71,63],[226,35],[35,111],[111,226],[101,50],[50,205],[205,101],[206,92],[92,165],[165,206],[209,198],[198,217],[217,209],[165,167],[167,97],[97,165],[220,115],[115,218],[218,220],[133,112],[112,243],[243,133],[239,238],[238,241],[241,239],[214,135],[135,169],[169,214],[190,173],[173,133],[133,190],[171,208],[208,32],[32,171],[125,44],[44,237],[237,125],[86,87],[87,178],[178,86],[85,86],[86,179],[179,85],[84,85],[85,180],[180,84],[83,84],[84,181],[181,83],[201,83],[83,182],[182,201],[137,93],[93,132],[132,137],[76,62],[62,183],[183,76],[61,76],[76,184],[184,61],[57,61],[61,185],[185,57],[212,57],[57,186],[186,212],[214,207],[207,187],[187,214],[34,143],[143,156],[156,34],[79,239],[239,237],[237,79],[123,137],[137,177],[177,123],[44,1],[1,4],[4,44],[201,194],[194,32],[32,201],[64,102],[102,129],[129,64],[213,215],[215,138],[138,213],[59,166],[166,219],[219,59],[242,99],[99,97],[97,242],[2,94],[94,141],[141,2],[75,59],[59,235],[235,75],[24,110],[110,228],[228,24],[25,130],[130,226],[226,25],[23,24],[24,229],[229,23],[22,23],[23,230],[230,22],[26,22],[22,231],[231,26],[112,26],[26,232],[232,112],[189,190],[190,243],[243,189],[221,56],[56,190],[190,221],[28,56],[56,221],[221,28],[27,28],[28,222],[222,27],[29,27],[27,223],[223,29],[30,29],[29,224],[224,30],[247,30],[30,225],[225,247],[238,79],[79,20],[20,238],[166,59],[59,75],[75,166],[60,75],[75,240],[240,60],[147,177],[177,215],[215,147],[20,79],[79,166],[166,20],[187,147],[147,213],[213,187],[112,233],[233,244],[244,112],[233,128],[128,245],[245,233],[128,114],[114,188],[188,128],[114,217],[217,174],[174,114],[131,115],[115,220],[220,131],[217,198],[198,236],[236,217],[198,131],[131,134],[134,198],[177,132],[132,58],[58,177],[143,35],[35,124],[124,143],[110,163],[163,7],[7,110],[228,110],[110,25],[25,228],[356,389],[389,368],[368,356],[11,302],[302,267],[267,11],[452,350],[350,349],[349,452],[302,303],[303,269],[269,302],[357,343],[343,277],[277,357],[452,453],[453,357],[357,452],[333,332],[332,297],[297,333],[175,152],[152,377],[377,175],[347,348],[348,330],[330,347],[303,304],[304,270],[270,303],[9,336],[336,337],[337,9],[278,279],[279,360],[360,278],[418,262],[262,431],[431,418],[304,408],[408,409],[409,304],[310,415],[415,407],[407,310],[270,409],[409,410],[410,270],[450,348],[348,347],[347,450],[422,430],[430,434],[434,422],[313,314],[314,17],[17,313],[306,307],[307,375],[375,306],[387,388],[388,260],[260,387],[286,414],[414,398],[398,286],[335,406],[406,418],[418,335],[364,367],[367,416],[416,364],[423,358],[358,327],[327,423],[251,284],[284,298],[298,251],[281,5],[5,4],[4,281],[373,374],[374,253],[253,373],[307,320],[320,321],[321,307],[425,427],[427,411],[411,425],[421,313],[313,18],[18,421],[321,405],[405,406],[406,321],[320,404],[404,405],[405,320],[315,16],[16,17],[17,315],[426,425],[425,266],[266,426],[377,400],[400,369],[369,377],[322,391],[391,269],[269,322],[417,465],[465,464],[464,417],[386,257],[257,258],[258,386],[466,260],[260,388],[388,466],[456,399],[399,419],[419,456],[284,332],[332,333],[333,284],[417,285],[285,8],[8,417],[346,340],[340,261],[261,346],[413,441],[441,285],[285,413],[327,460],[460,328],[328,327],[355,371],[371,329],[329,355],[392,439],[439,438],[438,392],[382,341],[341,256],[256,382],[429,420],[420,360],[360,429],[364,394],[394,379],[379,364],[277,343],[343,437],[437,277],[443,444],[444,283],[283,443],[275,440],[440,363],[363,275],[431,262],[262,369],[369,431],[297,338],[338,337],[337,297],[273,375],[375,321],[321,273],[450,451],[451,349],[349,450],[446,342],[342,467],[467,446],[293,334],[334,282],[282,293],[458,461],[461,462],[462,458],[276,353],[353,383],[383,276],[308,324],[324,325],[325,308],[276,300],[300,293],[293,276],[372,345],[345,447],[447,372],[352,345],[345,340],[340,352],[274,1],[1,19],[19,274],[456,248],[248,281],[281,456],[436,427],[427,425],[425,436],[381,256],[256,252],[252,381],[269,391],[391,393],[393,269],[200,199],[199,428],[428,200],[266,330],[330,329],[329,266],[287,273],[273,422],[422,287],[250,462],[462,328],[328,250],[258,286],[286,384],[384,258],[265,353],[353,342],[342,265],[387,259],[259,257],[257,387],[424,431],[431,430],[430,424],[342,353],[353,276],[276,342],[273,335],[335,424],[424,273],[292,325],[325,307],[307,292],[366,447],[447,345],[345,366],[271,303],[303,302],[302,271],[423,266],[266,371],[371,423],[294,455],[455,460],[460,294],[279,278],[278,294],[294,279],[271,272],[272,304],[304,271],[432,434],[434,427],[427,432],[272,407],[407,408],[408,272],[394,430],[430,431],[431,394],[395,369],[369,400],[400,395],[334,333],[333,299],[299,334],[351,417],[417,168],[168,351],[352,280],[280,411],[411,352],[325,319],[319,320],[320,325],[295,296],[296,336],[336,295],[319,403],[403,404],[404,319],[330,348],[348,349],[349,330],[293,298],[298,333],[333,293],[323,454],[454,447],[447,323],[15,16],[16,315],[315,15],[358,429],[429,279],[279,358],[14,15],[15,316],[316,14],[285,336],[336,9],[9,285],[329,349],[349,350],[350,329],[374,380],[380,252],[252,374],[318,402],[402,403],[403,318],[6,197],[197,419],[419,6],[318,319],[319,325],[325,318],[367,364],[364,365],[365,367],[435,367],[367,397],[397,435],[344,438],[438,439],[439,344],[272,271],[271,311],[311,272],[195,5],[5,281],[281,195],[273,287],[287,291],[291,273],[396,428],[428,199],[199,396],[311,271],[271,268],[268,311],[283,444],[444,445],[445,283],[373,254],[254,339],[339,373],[282,334],[334,296],[296,282],[449,347],[347,346],[346,449],[264,447],[447,454],[454,264],[336,296],[296,299],[299,336],[338,10],[10,151],[151,338],[278,439],[439,455],[455,278],[292,407],[407,415],[415,292],[358,371],[371,355],[355,358],[340,345],[345,372],[372,340],[346,347],[347,280],[280,346],[442,443],[443,282],[282,442],[19,94],[94,370],[370,19],[441,442],[442,295],[295,441],[248,419],[419,197],[197,248],[263,255],[255,359],[359,263],[440,275],[275,274],[274,440],[300,383],[383,368],[368,300],[351,412],[412,465],[465,351],[263,467],[467,466],[466,263],[301,368],[368,389],[389,301],[395,378],[378,379],[379,395],[412,351],[351,419],[419,412],[436,426],[426,322],[322,436],[2,164],[164,393],[393,2],[370,462],[462,461],[461,370],[164,0],[0,267],[267,164],[302,11],[11,12],[12,302],[268,12],[12,13],[13,268],[293,300],[300,301],[301,293],[446,261],[261,340],[340,446],[330,266],[266,425],[425,330],[426,423],[423,391],[391,426],[429,355],[355,437],[437,429],[391,327],[327,326],[326,391],[440,457],[457,438],[438,440],[341,382],[382,362],[362,341],[459,457],[457,461],[461,459],[434,430],[430,394],[394,434],[414,463],[463,362],[362,414],[396,369],[369,262],[262,396],[354,461],[461,457],[457,354],[316,403],[403,402],[402,316],[315,404],[404,403],[403,315],[314,405],[405,404],[404,314],[313,406],[406,405],[405,313],[421,418],[418,406],[406,421],[366,401],[401,361],[361,366],[306,408],[408,407],[407,306],[291,409],[409,408],[408,291],[287,410],[410,409],[409,287],[432,436],[436,410],[410,432],[434,416],[416,411],[411,434],[264,368],[368,383],[383,264],[309,438],[438,457],[457,309],[352,376],[376,401],[401,352],[274,275],[275,4],[4,274],[421,428],[428,262],[262,421],[294,327],[327,358],[358,294],[433,416],[416,367],[367,433],[289,455],[455,439],[439,289],[462,370],[370,326],[326,462],[2,326],[326,370],[370,2],[305,460],[460,455],[455,305],[254,449],[449,448],[448,254],[255,261],[261,446],[446,255],[253,450],[450,449],[449,253],[252,451],[451,450],[450,252],[256,452],[452,451],[451,256],[341,453],[453,452],[452,341],[413,464],[464,463],[463,413],[441,413],[413,414],[414,441],[258,442],[442,441],[441,258],[257,443],[443,442],[442,257],[259,444],[444,443],[443,259],[260,445],[445,444],[444,260],[467,342],[342,445],[445,467],[459,458],[458,250],[250,459],[289,392],[392,290],[290,289],[290,328],[328,460],[460,290],[376,433],[433,435],[435,376],[250,290],[290,392],[392,250],[411,416],[416,433],[433,411],[341,463],[463,464],[464,341],[453,464],[464,465],[465,453],[357,465],[465,412],[412,357],[343,412],[412,399],[399,343],[360,363],[363,440],[440,360],[437,399],[399,456],[456,437],[420,456],[456,363],[363,420],[401,435],[435,288],[288,401],[372,383],[383,353],[353,372],[339,255],[255,249],[249,339],[448,261],[261,255],[255,448],[133,243],[243,190],[190,133],[133,155],[155,112],[112,133],[33,246],[246,247],[247,33],[33,130],[130,25],[25,33],[398,384],[384,286],[286,398],[362,398],[398,414],[414,362],[362,463],[463,341],[341,362],[263,359],[359,467],[467,263],[263,249],[249,255],[255,263],[466,467],[467,260],[260,466],[75,60],[60,166],[166,75],[238,239],[239,79],[79,238],[162,127],[127,139],[139,162],[72,11],[11,37],[37,72],[121,232],[232,120],[120,121],[73,72],[72,39],[39,73],[114,128],[128,47],[47,114],[233,232],[232,128],[128,233],[103,104],[104,67],[67,103],[152,175],[175,148],[148,152],[119,118],[118,101],[101,119],[74,73],[73,40],[40,74],[107,9],[9,108],[108,107],[49,48],[48,131],[131,49],[32,194],[194,211],[211,32],[184,74],[74,185],[185,184],[191,80],[80,183],[183,191],[185,40],[40,186],[186,185],[119,230],[230,118],[118,119],[210,202],[202,214],[214,210],[84,83],[83,17],[17,84],[77,76],[76,146],[146,77],[161,160],[160,30],[30,161],[190,56],[56,173],[173,190],[182,106],[106,194],[194,182],[138,135],[135,192],[192,138],[129,203],[203,98],[98,129],[54,21],[21,68],[68,54],[5,51],[51,4],[4,5],[145,144],[144,23],[23,145],[90,77],[77,91],[91,90],[207,205],[205,187],[187,207],[83,201],[201,18],[18,83],[181,91],[91,182],[182,181],[180,90],[90,181],[181,180],[16,85],[85,17],[17,16],[205,206],[206,36],[36,205],[176,148],[148,140],[140,176],[165,92],[92,39],[39,165],[245,193],[193,244],[244,245],[27,159],[159,28],[28,27],[30,247],[247,161],[161,30],[174,236],[236,196],[196,174],[103,54],[54,104],[104,103],[55,193],[193,8],[8,55],[111,117],[117,31],[31,111],[221,189],[189,55],[55,221],[240,98],[98,99],[99,240],[142,126],[126,100],[100,142],[219,166],[166,218],[218,219],[112,155],[155,26],[26,112],[198,209],[209,131],[131,198],[169,135],[135,150],[150,169],[114,47],[47,217],[217,114],[224,223],[223,53],[53,224],[220,45],[45,134],[134,220],[32,211],[211,140],[140,32],[109,67],[67,108],[108,109],[146,43],[43,91],[91,146],[231,230],[230,120],[120,231],[113,226],[226,247],[247,113],[105,63],[63,52],[52,105],[241,238],[238,242],[242,241],[124,46],[46,156],[156,124],[95,78],[78,96],[96,95],[70,46],[46,63],[63,70],[116,143],[143,227],[227,116],[116,123],[123,111],[111,116],[1,44],[44,19],[19,1],[3,236],[236,51],[51,3],[207,216],[216,205],[205,207],[26,154],[154,22],[22,26],[165,39],[39,167],[167,165],[199,200],[200,208],[208,199],[101,36],[36,100],[100,101],[43,57],[57,202],[202,43],[242,20],[20,99],[99,242],[56,28],[28,157],[157,56],[124,35],[35,113],[113,124],[29,160],[160,27],[27,29],[211,204],[204,210],[210,211],[124,113],[113,46],[46,124],[106,43],[43,204],[204,106],[96,62],[62,77],[77,96],[227,137],[137,116],[116,227],[73,41],[41,72],[72,73],[36,203],[203,142],[142,36],[235,64],[64,240],[240,235],[48,49],[49,64],[64,48],[42,41],[41,74],[74,42],[214,212],[212,207],[207,214],[183,42],[42,184],[184,183],[210,169],[169,211],[211,210],[140,170],[170,176],[176,140],[104,105],[105,69],[69,104],[193,122],[122,168],[168,193],[50,123],[123,187],[187,50],[89,96],[96,90],[90,89],[66,65],[65,107],[107,66],[179,89],[89,180],[180,179],[119,101],[101,120],[120,119],[68,63],[63,104],[104,68],[234,93],[93,227],[227,234],[16,15],[15,85],[85,16],[209,129],[129,49],[49,209],[15,14],[14,86],[86,15],[107,55],[55,9],[9,107],[120,100],[100,121],[121,120],[153,145],[145,22],[22,153],[178,88],[88,179],[179,178],[197,6],[6,196],[196,197],[89,88],[88,96],[96,89],[135,138],[138,136],[136,135],[138,215],[215,172],[172,138],[218,115],[115,219],[219,218],[41,42],[42,81],[81,41],[5,195],[195,51],[51,5],[57,43],[43,61],[61,57],[208,171],[171,199],[199,208],[41,81],[81,38],[38,41],[224,53],[53,225],[225,224],[24,144],[144,110],[110,24],[105,52],[52,66],[66,105],[118,229],[229,117],[117,118],[227,34],[34,234],[234,227],[66,107],[107,69],[69,66],[10,109],[109,151],[151,10],[219,48],[48,235],[235,219],[183,62],[62,191],[191,183],[142,129],[129,126],[126,142],[116,111],[111,143],[143,116],[118,117],[117,50],[50,118],[223,222],[222,52],[52,223],[94,19],[19,141],[141,94],[222,221],[221,65],[65,222],[196,3],[3,197],[197,196],[45,220],[220,44],[44,45],[156,70],[70,139],[139,156],[188,122],[122,245],[245,188],[139,71],[71,162],[162,139],[149,170],[170,150],[150,149],[122,188],[188,196],[196,122],[206,216],[216,92],[92,206],[164,2],[2,167],[167,164],[242,141],[141,241],[241,242],[0,164],[164,37],[37,0],[11,72],[72,12],[12,11],[12,38],[38,13],[13,12],[70,63],[63,71],[71,70],[31,226],[226,111],[111,31],[36,101],[101,205],[205,36],[203,206],[206,165],[165,203],[126,209],[209,217],[217,126],[98,165],[165,97],[97,98],[237,220],[220,218],[218,237],[237,239],[239,241],[241,237],[210,214],[214,169],[169,210],[140,171],[171,32],[32,140],[241,125],[125,237],[237,241],[179,86],[86,178],[178,179],[180,85],[85,179],[179,180],[181,84],[84,180],[180,181],[182,83],[83,181],[181,182],[194,201],[201,182],[182,194],[177,137],[137,132],[132,177],[184,76],[76,183],[183,184],[185,61],[61,184],[184,185],[186,57],[57,185],[185,186],[216,212],[212,186],[186,216],[192,214],[214,187],[187,192],[139,34],[34,156],[156,139],[218,79],[79,237],[237,218],[147,123],[123,177],[177,147],[45,44],[44,4],[4,45],[208,201],[201,32],[32,208],[98,64],[64,129],[129,98],[192,213],[213,138],[138,192],[235,59],[59,219],[219,235],[141,242],[242,97],[97,141],[97,2],[2,141],[141,97],[240,75],[75,235],[235,240],[229,24],[24,228],[228,229],[31,25],[25,226],[226,31],[230,23],[23,229],[229,230],[231,22],[22,230],[230,231],[232,26],[26,231],[231,232],[233,112],[112,232],[232,233],[244,189],[189,243],[243,244],[189,221],[221,190],[190,189],[222,28],[28,221],[221,222],[223,27],[27,222],[222,223],[224,29],[29,223],[223,224],[225,30],[30,224],[224,225],[113,247],[247,225],[225,113],[99,60],[60,240],[240,99],[213,147],[147,215],[215,213],[60,20],[20,166],[166,60],[192,187],[187,213],[213,192],[243,112],[112,244],[244,243],[244,233],[233,245],[245,244],[245,128],[128,188],[188,245],[188,114],[114,174],[174,188],[134,131],[131,220],[220,134],[174,217],[217,236],[236,174],[236,198],[198,134],[134,236],[215,177],[177,58],[58,215],[156,143],[143,124],[124,156],[25,110],[110,7],[7,25],[31,228],[228,25],[25,31],[264,356],[356,368],[368,264],[0,11],[11,267],[267,0],[451,452],[452,349],[349,451],[267,302],[302,269],[269,267],[350,357],[357,277],[277,350],[350,452],[452,357],[357,350],[299,333],[333,297],[297,299],[396,175],[175,377],[377,396],[280,347],[347,330],[330,280],[269,303],[303,270],[270,269],[151,9],[9,337],[337,151],[344,278],[278,360],[360,344],[424,418],[418,431],[431,424],[270,304],[304,409],[409,270],[272,310],[310,407],[407,272],[322,270],[270,410],[410,322],[449,450],[450,347],[347,449],[432,422],[422,434],[434,432],[18,313],[313,17],[17,18],[291,306],[306,375],[375,291],[259,387],[387,260],[260,259],[424,335],[335,418],[418,424],[434,364],[364,416],[416,434],[391,423],[423,327],[327,391],[301,251],[251,298],[298,301],[275,281],[281,4],[4,275],[254,373],[373,253],[253,254],[375,307],[307,321],[321,375],[280,425],[425,411],[411,280],[200,421],[421,18],[18,200],[335,321],[321,406],[406,335],[321,320],[320,405],[405,321],[314,315],[315,17],[17,314],[423,426],[426,266],[266,423],[396,377],[377,369],[369,396],[270,322],[322,269],[269,270],[413,417],[417,464],[464,413],[385,386],[386,258],[258,385],[248,456],[456,419],[419,248],[298,284],[284,333],[333,298],[168,417],[417,8],[8,168],[448,346],[346,261],[261,448],[417,413],[413,285],[285,417],[326,327],[327,328],[328,326],[277,355],[355,329],[329,277],[309,392],[392,438],[438,309],[381,382],[382,256],[256,381],[279,429],[429,360],[360,279],[365,364],[364,379],[379,365],[355,277],[277,437],[437,355],[282,443],[443,283],[283,282],[281,275],[275,363],[363,281],[395,431],[431,369],[369,395],[299,297],[297,337],[337,299],[335,273],[273,321],[321,335],[348,450],[450,349],[349,348],[359,446],[446,467],[467,359],[283,293],[293,282],[282,283],[250,458],[458,462],[462,250],[300,276],[276,383],[383,300],[292,308],[308,325],[325,292],[283,276],[276,293],[293,283],[264,372],[372,447],[447,264],[346,352],[352,340],[340,346],[354,274],[274,19],[19,354],[363,456],[456,281],[281,363],[426,436],[436,425],[425,426],[380,381],[381,252],[252,380],[267,269],[269,393],[393,267],[421,200],[200,428],[428,421],[371,266],[266,329],[329,371],[432,287],[287,422],[422,432],[290,250],[250,328],[328,290],[385,258],[258,384],[384,385],[446,265],[265,342],[342,446],[386,387],[387,257],[257,386],[422,424],[424,430],[430,422],[445,342],[342,276],[276,445],[422,273],[273,424],[424,422],[306,292],[292,307],[307,306],[352,366],[366,345],[345,352],[268,271],[271,302],[302,268],[358,423],[423,371],[371,358],[327,294],[294,460],[460,327],[331,279],[279,294],[294,331],[303,271],[271,304],[304,303],[436,432],[432,427],[427,436],[304,272],[272,408],[408,304],[395,394],[394,431],[431,395],[378,395],[395,400],[400,378],[296,334],[334,299],[299,296],[6,351],[351,168],[168,6],[376,352],[352,411],[411,376],[307,325],[325,320],[320,307],[285,295],[295,336],[336,285],[320,319],[319,404],[404,320],[329,330],[330,349],[349,329],[334,293],[293,333],[333,334],[366,323],[323,447],[447,366],[316,15],[15,315],[315,316],[331,358],[358,279],[279,331],[317,14],[14,316],[316,317],[8,285],[285,9],[9,8],[277,329],[329,350],[350,277],[253,374],[374,252],[252,253],[319,318],[318,403],[403,319],[351,6],[6,419],[419,351],[324,318],[318,325],[325,324],[397,367],[367,365],[365,397],[288,435],[435,397],[397,288],[278,344],[344,439],[439,278],[310,272],[272,311],[311,310],[248,195],[195,281],[281,248],[375,273],[273,291],[291,375],[175,396],[396,199],[199,175],[312,311],[311,268],[268,312],[276,283],[283,445],[445,276],[390,373],[373,339],[339,390],[295,282],[282,296],[296,295],[448,449],[449,346],[346,448],[356,264],[264,454],[454,356],[337,336],[336,299],[299,337],[337,338],[338,151],[151,337],[294,278],[278,455],[455,294],[308,292],[292,415],[415,308],[429,358],[358,355],[355,429],[265,340],[340,372],[372,265],[352,346],[346,280],[280,352],[295,442],[442,282],[282,295],[354,19],[19,370],[370,354],[285,441],[441,295],[295,285],[195,248],[248,197],[197,195],[457,440],[440,274],[274,457],[301,300],[300,368],[368,301],[417,351],[351,465],[465,417],[251,301],[301,389],[389,251],[394,395],[395,379],[379,394],[399,412],[412,419],[419,399],[410,436],[436,322],[322,410],[326,2],[2,393],[393,326],[354,370],[370,461],[461,354],[393,164],[164,267],[267,393],[268,302],[302,12],[12,268],[312,268],[268,13],[13,312],[298,293],[293,301],[301,298],[265,446],[446,340],[340,265],[280,330],[330,425],[425,280],[322,426],[426,391],[391,322],[420,429],[429,437],[437,420],[393,391],[391,326],[326,393],[344,440],[440,438],[438,344],[458,459],[459,461],[461,458],[364,434],[434,394],[394,364],[428,396],[396,262],[262,428],[274,354],[354,457],[457,274],[317,316],[316,402],[402,317],[316,315],[315,403],[403,316],[315,314],[314,404],[404,315],[314,313],[313,405],[405,314],[313,421],[421,406],[406,313],[323,366],[366,361],[361,323],[292,306],[306,407],[407,292],[306,291],[291,408],[408,306],[291,287],[287,409],[409,291],[287,432],[432,410],[410,287],[427,434],[434,411],[411,427],[372,264],[264,383],[383,372],[459,309],[309,457],[457,459],[366,352],[352,401],[401,366],[1,274],[274,4],[4,1],[418,421],[421,262],[262,418],[331,294],[294,358],[358,331],[435,433],[433,367],[367,435],[392,289],[289,439],[439,392],[328,462],[462,326],[326,328],[94,2],[2,370],[370,94],[289,305],[305,455],[455,289],[339,254],[254,448],[448,339],[359,255],[255,446],[446,359],[254,253],[253,449],[449,254],[253,252],[252,450],[450,253],[252,256],[256,451],[451,252],[256,341],[341,452],[452,256],[414,413],[413,463],[463,414],[286,441],[441,414],[414,286],[286,258],[258,441],[441,286],[258,257],[257,442],[442,258],[257,259],[259,443],[443,257],[259,260],[260,444],[444,259],[260,467],[467,445],[445,260],[309,459],[459,250],[250,309],[305,289],[289,290],[290,305],[305,290],[290,460],[460,305],[401,376],[376,435],[435,401],[309,250],[250,392],[392,309],[376,411],[411,433],[433,376],[453,341],[341,464],[464,453],[357,453],[453,465],[465,357],[343,357],[357,412],[412,343],[437,343],[343,399],[399,437],[344,360],[360,440],[440,344],[420,437],[437,456],[456,420],[360,420],[420,363],[363,360],[361,401],[401,288],[288,361],[265,372],[372,353],[353,265],[390,339],[339,249],[249,390],[339,448],[448,255],[255,339]);function nf(e){e.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]}}var af=class extends Vc{constructor(e,t){super(new Bc(e,t),"image_in","norm_rect",!1),this.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]},this.outputFacialTransformationMatrixes=this.outputFaceBlendshapes=!1,this.h=new qu,e=new Fu,Uo(this.h,0,1,e),this.v=new Vu,Uo(this.h,0,3,this.v),this.s=new Pu,Uo(this.h,0,2,this.s),Zo(this.s,4,1),Qo(this.s,2,.5),Qo(this.v,2,.5),Qo(this.h,4,.5)}get baseOptions(){return Po(this.h,Fu,1)}set baseOptions(e){Uo(this.h,0,1,e)}o(e){return"numFaces"in e&&Zo(this.s,4,e.numFaces??1),"minFaceDetectionConfidence"in e&&Qo(this.s,2,e.minFaceDetectionConfidence??.5),"minTrackingConfidence"in e&&Qo(this.h,4,e.minTrackingConfidence??.5),"minFacePresenceConfidence"in e&&Qo(this.v,2,e.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),"outputFacialTransformationMatrixes"in e&&(this.outputFacialTransformationMatrixes=!!e.outputFacialTransformationMatrixes),this.l(e)}F(e,t){return nf(this),zc(this,e,t),this.j}G(e,t,n){return nf(this),Gc(this,e,n,t),this.j}m(){var e=new _l;Pl(e,"image_in"),Pl(e,"norm_rect"),Bl(e,"face_landmarks");const t=new bl;Ko(t,Yu,this.h);const n=new Nl;Il(n,"mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph"),Sl(n,"IMAGE:image_in"),Sl(n,"NORM_RECT:norm_rect"),Dl(n,"NORM_LANDMARKS:face_landmarks"),n.o(t),jl(e,n),this.g.attachProtoVectorListener("face_landmarks",((e,t)=>{for(const t of e)e=fu(t),this.j.faceLandmarks.push(Od(e));Kd(this,t)})),this.g.attachEmptyPacketListener("face_landmarks",(e=>{Kd(this,e)})),this.outputFaceBlendshapes&&(Bl(e,"blendshapes"),Dl(n,"BLENDSHAPES:blendshapes"),this.g.attachProtoVectorListener("blendshapes",((e,t)=>{if(this.outputFaceBlendshapes)for(const t of e)e=Hl(t),this.j.faceBlendshapes.push(Ld(e.g()??[]));Kd(this,t)})),this.g.attachEmptyPacketListener("blendshapes",(e=>{Kd(this,e)}))),this.outputFacialTransformationMatrixes&&(Bl(e,"face_geometry"),Dl(n,"FACE_GEOMETRY:face_geometry"),this.g.attachProtoVectorListener("face_geometry",((e,t)=>{if(this.outputFacialTransformationMatrixes)for(const t of e)(e=Po(Gu(t),hu,2))&&this.j.facialTransformationMatrixes.push({rows:qo(Wo(e,1))??0,columns:qo(Wo(e,2))??0,data:So(e,3,Gi)??[]});Kd(this,t)})),this.g.attachEmptyPacketListener("face_geometry",(e=>{Kd(this,e)}))),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};af.prototype.detectForVideo=af.prototype.G,af.prototype.detect=af.prototype.F,af.prototype.setOptions=af.prototype.o,af.createFromModelPath=function(e,t){return _c(af,e,{baseOptions:{modelAssetPath:t}})},af.createFromModelBuffer=function(e,t){return _c(af,e,{baseOptions:{modelAssetBuffer:t}})},af.createFromOptions=function(e,t){return _c(af,e,t)},af.FACE_LANDMARKS_LIPS=qc,af.FACE_LANDMARKS_LEFT_EYE=Hc,af.FACE_LANDMARKS_LEFT_EYEBROW=Yc,af.FACE_LANDMARKS_LEFT_IRIS=Zc,af.FACE_LANDMARKS_RIGHT_EYE=Qc,af.FACE_LANDMARKS_RIGHT_EYEBROW=Xc,af.FACE_LANDMARKS_RIGHT_IRIS=Kc,af.FACE_LANDMARKS_FACE_OVAL=Jc,af.FACE_LANDMARKS_CONTOURS=ef,af.FACE_LANDMARKS_TESSELATION=tf;var rf=class extends Vc{constructor(e,t){super(new Bc(e,t),"image_in","norm_rect",!0),this.j=new Zu,e=new Fu,Uo(this.j,0,1,e)}get baseOptions(){return Po(this.j,Fu,1)}set baseOptions(e){Uo(this.j,0,1,e)}o(e){return super.l(e)}Da(e,t,n){const a="function"!=typeof t?t:{};if(this.h="function"==typeof t?t:n,zc(this,e,a??{}),!this.h)return this.s}m(){var e=new _l;Pl(e,"image_in"),Pl(e,"norm_rect"),Bl(e,"stylized_image");const t=new bl;Ko(t,Qu,this.j);const n=new Nl;Il(n,"mediapipe.tasks.vision.face_stylizer.FaceStylizerGraph"),Sl(n,"IMAGE:image_in"),Sl(n,"NORM_RECT:norm_rect"),Dl(n,"STYLIZED_IMAGE:stylized_image"),n.o(t),jl(e,n),this.g.S("stylized_image",((e,t)=>{var n=!this.h,a=e.data,r=e.width;const i=r*(e=e.height);if(a instanceof Uint8Array)if(a.length===3*i){const t=new Uint8ClampedArray(4*i);for(let e=0;e<i;++e)t[4*e]=a[3*e],t[4*e+1]=a[3*e+1],t[4*e+2]=a[3*e+2],t[4*e+3]=255;a=new ImageData(t,r,e)}else{if(a.length!==4*i)throw Error("Unsupported channel count: "+a.length/i);a=new ImageData(new Uint8ClampedArray(a.buffer,a.byteOffset,a.length),r,e)}else if(!(a instanceof WebGLTexture))throw Error(`Unsupported format: ${a.constructor.name}`);r=new Cc([a],!1,!1,this.g.i.canvas,this.O,r,e),this.s=n=n?r.clone():r,this.h&&this.h(n),Kd(this,t)})),this.g.attachEmptyPacketListener("stylized_image",(e=>{this.s=null,this.h&&this.h(null),Kd(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};rf.prototype.stylize=rf.prototype.Da,rf.prototype.setOptions=rf.prototype.o,rf.createFromModelPath=function(e,t){return _c(rf,e,{baseOptions:{modelAssetPath:t}})},rf.createFromModelBuffer=function(e,t){return _c(rf,e,{baseOptions:{modelAssetBuffer:t}})},rf.createFromOptions=function(e,t){return _c(rf,e,t)};var of=Fc([0,1],[1,2],[2,3],[3,4],[0,5],[5,6],[6,7],[7,8],[5,9],[9,10],[10,11],[11,12],[9,13],[13,14],[14,15],[15,16],[13,17],[0,17],[17,18],[18,19],[19,20]);function sf(e){e.gestures=[],e.landmarks=[],e.worldLandmarks=[],e.handedness=[]}function lf(e){return 0===e.gestures.length?{gestures:[],landmarks:[],worldLandmarks:[],handedness:[],handednesses:[]}:{gestures:e.gestures,landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handedness:e.handedness,handednesses:e.handedness}}function uf(e,t=!0){const n=[];for(const r of e){var a=Hl(r);e=[];for(const n of a.g())a=t&&null!=Wo(n,1)?qo(Wo(n,1)):-1,e.push({score:Ho(n,2)??0,index:a,categoryName:$o(n,3)??""??"",displayName:$o(n,4)??""??""});n.push(e)}return n}var df=class extends Vc{constructor(e,t){super(new Bc(e,t),"image_in","norm_rect",!1),this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handedness=[],this.v=new ld,e=new Fu,Uo(this.v,0,1,e),this.C=new od,Uo(this.v,0,2,this.C),this.s=new rd,Uo(this.C,0,3,this.s),this.h=new nd,Uo(this.C,0,2,this.h),this.j=new ed,Uo(this.v,0,3,this.j),Qo(this.h,2,.5),Qo(this.C,4,.5),Qo(this.s,2,.5)}get baseOptions(){return Po(this.v,Fu,1)}set baseOptions(e){Uo(this.v,0,1,e)}o(e){if(Zo(this.h,3,e.numHands??1),"minHandDetectionConfidence"in e&&Qo(this.h,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&Qo(this.C,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&Qo(this.s,2,e.minHandPresenceConfidence??.5),e.cannedGesturesClassifierOptions){var t=new Xu,n=Ad(e.cannedGesturesClassifierOptions,Po(this.j,Xu,3)?.h());Uo(t,0,2,n),Uo(this.j,0,3,t)}else void 0===e.cannedGesturesClassifierOptions&&Po(this.j,Xu,3)?.g();return e.customGesturesClassifierOptions?(Uo(t=new Xu,0,2,n=Ad(e.customGesturesClassifierOptions,Po(this.j,Xu,4)?.h())),Uo(this.j,0,4,t)):void 0===e.customGesturesClassifierOptions&&Po(this.j,Xu,4)?.g(),this.l(e)}ya(e,t){return sf(this),zc(this,e,t),lf(this)}za(e,t,n){return sf(this),Gc(this,e,n,t),lf(this)}m(){var e=new _l;Pl(e,"image_in"),Pl(e,"norm_rect"),Bl(e,"hand_gestures"),Bl(e,"hand_landmarks"),Bl(e,"world_hand_landmarks"),Bl(e,"handedness");const t=new bl;Ko(t,cd,this.v);const n=new Nl;Il(n,"mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph"),Sl(n,"IMAGE:image_in"),Sl(n,"NORM_RECT:norm_rect"),Dl(n,"HAND_GESTURES:hand_gestures"),Dl(n,"LANDMARKS:hand_landmarks"),Dl(n,"WORLD_LANDMARKS:world_hand_landmarks"),Dl(n,"HANDEDNESS:handedness"),n.o(t),jl(e,n),this.g.attachProtoVectorListener("hand_landmarks",((e,t)=>{for(const t of e){e=fu(t);const n=[];for(const t of _o(e,uu,1))n.push({x:Ho(t,1)??0,y:Ho(t,2)??0,z:Ho(t,3)??0});this.landmarks.push(n)}Kd(this,t)})),this.g.attachEmptyPacketListener("hand_landmarks",(e=>{Kd(this,e)})),this.g.attachProtoVectorListener("world_hand_landmarks",((e,t)=>{for(const t of e){e=lu(t);const n=[];for(const t of _o(e,iu,1))n.push({x:Ho(t,1)??0,y:Ho(t,2)??0,z:Ho(t,3)??0});this.worldLandmarks.push(n)}Kd(this,t)})),this.g.attachEmptyPacketListener("world_hand_landmarks",(e=>{Kd(this,e)})),this.g.attachProtoVectorListener("hand_gestures",((e,t)=>{this.gestures.push(...uf(e,!1)),Kd(this,t)})),this.g.attachEmptyPacketListener("hand_gestures",(e=>{Kd(this,e)})),this.g.attachProtoVectorListener("handedness",((e,t)=>{this.handedness.push(...uf(e)),Kd(this,t)})),this.g.attachEmptyPacketListener("handedness",(e=>{Kd(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};function cf(e){return{landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handednesses:e.handedness,handedness:e.handedness}}df.prototype.recognizeForVideo=df.prototype.za,df.prototype.recognize=df.prototype.ya,df.prototype.setOptions=df.prototype.o,df.createFromModelPath=function(e,t){return _c(df,e,{baseOptions:{modelAssetPath:t}})},df.createFromModelBuffer=function(e,t){return _c(df,e,{baseOptions:{modelAssetBuffer:t}})},df.createFromOptions=function(e,t){return _c(df,e,t)},df.HAND_CONNECTIONS=of;var ff=class extends Vc{constructor(e,t){super(new Bc(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.handedness=[],this.j=new od,e=new Fu,Uo(this.j,0,1,e),this.s=new rd,Uo(this.j,0,3,this.s),this.h=new nd,Uo(this.j,0,2,this.h),Zo(this.h,3,1),Qo(this.h,2,.5),Qo(this.s,2,.5),Qo(this.j,4,.5)}get baseOptions(){return Po(this.j,Fu,1)}set baseOptions(e){Uo(this.j,0,1,e)}o(e){return"numHands"in e&&Zo(this.h,3,e.numHands??1),"minHandDetectionConfidence"in e&&Qo(this.h,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&Qo(this.j,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&Qo(this.s,2,e.minHandPresenceConfidence??.5),this.l(e)}F(e,t){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],zc(this,e,t),cf(this)}G(e,t,n){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],Gc(this,e,n,t),cf(this)}m(){var e=new _l;Pl(e,"image_in"),Pl(e,"norm_rect"),Bl(e,"hand_landmarks"),Bl(e,"world_hand_landmarks"),Bl(e,"handedness");const t=new bl;Ko(t,dd,this.j);const n=new Nl;Il(n,"mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph"),Sl(n,"IMAGE:image_in"),Sl(n,"NORM_RECT:norm_rect"),Dl(n,"LANDMARKS:hand_landmarks"),Dl(n,"WORLD_LANDMARKS:world_hand_landmarks"),Dl(n,"HANDEDNESS:handedness"),n.o(t),jl(e,n),this.g.attachProtoVectorListener("hand_landmarks",((e,t)=>{for(const t of e)e=fu(t),this.landmarks.push(Od(e));Kd(this,t)})),this.g.attachEmptyPacketListener("hand_landmarks",(e=>{Kd(this,e)})),this.g.attachProtoVectorListener("world_hand_landmarks",((e,t)=>{for(const t of e)e=lu(t),this.worldLandmarks.push(Fd(e));Kd(this,t)})),this.g.attachEmptyPacketListener("world_hand_landmarks",(e=>{Kd(this,e)})),this.g.attachProtoVectorListener("handedness",((e,t)=>{var n=this.handedness,a=n.push;const r=[];for(const t of e){e=Hl(t);const n=[];for(const t of e.g())n.push({score:Ho(t,2)??0,index:qo(Wo(t,1))??-1,categoryName:$o(t,3)??""??"",displayName:$o(t,4)??""??""});r.push(n)}a.call(n,...r),Kd(this,t)})),this.g.attachEmptyPacketListener("handedness",(e=>{Kd(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};ff.prototype.detectForVideo=ff.prototype.G,ff.prototype.detect=ff.prototype.F,ff.prototype.setOptions=ff.prototype.o,ff.createFromModelPath=function(e,t){return _c(ff,e,{baseOptions:{modelAssetPath:t}})},ff.createFromModelBuffer=function(e,t){return _c(ff,e,{baseOptions:{modelAssetBuffer:t}})},ff.createFromOptions=function(e,t){return _c(ff,e,t)},ff.HAND_CONNECTIONS=of;var hf=class extends Vc{constructor(e,t){super(new Bc(e,t),"input_image","norm_rect",!0),this.j={classifications:[]},this.h=new fd,e=new Fu,Uo(this.h,0,1,e)}get baseOptions(){return Po(this.h,Fu,1)}set baseOptions(e){Uo(this.h,0,1,e)}o(e){var t=Ad(e,Po(this.h,Iu,2));return Uo(this.h,0,2,t),this.l(e)}ia(e,t){return this.j={classifications:[]},zc(this,e,t),this.j}ja(e,t,n){return this.j={classifications:[]},Gc(this,e,n,t),this.j}m(){var e=new _l;Pl(e,"input_image"),Pl(e,"norm_rect"),Bl(e,"classifications");const t=new bl;Ko(t,hd,this.h);const n=new Nl;Il(n,"mediapipe.tasks.vision.image_classifier.ImageClassifierGraph"),Sl(n,"IMAGE:input_image"),Sl(n,"NORM_RECT:norm_rect"),Dl(n,"CLASSIFICATIONS:classifications"),n.o(t),jl(e,n),this.g.attachProtoListener("classifications",((e,t)=>{this.j=function(e){const t={classifications:_o(e,gu,1).map((e=>Ld(Po(e,$l,4)?.g()??[],qo(Wo(e,2)),$o(e,3)??"")))};return null!=Vo(e)&&(t.timestampMs=qo(Vo(e))),t}(bu(e)),Kd(this,t)})),this.g.attachEmptyPacketListener("classifications",(e=>{Kd(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};hf.prototype.classifyForVideo=hf.prototype.ja,hf.prototype.classify=hf.prototype.ia,hf.prototype.setOptions=hf.prototype.o,hf.createFromModelPath=function(e,t){return _c(hf,e,{baseOptions:{modelAssetPath:t}})},hf.createFromModelBuffer=function(e,t){return _c(hf,e,{baseOptions:{modelAssetBuffer:t}})},hf.createFromOptions=function(e,t){return _c(hf,e,t)};var pf=class extends Vc{constructor(e,t){super(new Bc(e,t),"image_in","norm_rect",!0),this.h=new pd,this.embeddings={embeddings:[]},e=new Fu,Uo(this.h,0,1,e)}get baseOptions(){return Po(this.h,Fu,1)}set baseOptions(e){Uo(this.h,0,1,e)}o(e){var t=this.h,n=Po(this.h,Du,2);return n=n?n.clone():new Du,void 0!==e.l2Normalize?Yo(n,1,e.l2Normalize):"l2Normalize"in e&&Eo(n,1),void 0!==e.quantize?Yo(n,2,e.quantize):"quantize"in e&&Eo(n,2),Uo(t,0,2,n),this.l(e)}na(e,t){return zc(this,e,t),this.embeddings}oa(e,t,n){return Gc(this,e,n,t),this.embeddings}m(){var e=new _l;Pl(e,"image_in"),Pl(e,"norm_rect"),Bl(e,"embeddings_out");const t=new bl;Ko(t,md,this.h);const n=new Nl;Il(n,"mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph"),Sl(n,"IMAGE:image_in"),Sl(n,"NORM_RECT:norm_rect"),Dl(n,"EMBEDDINGS:embeddings_out"),n.o(t),jl(e,n),this.g.attachProtoListener("embeddings_out",((e,t)=>{e=Mu(e),this.embeddings=function(e){return{embeddings:_o(e,wu,1).map((e=>{const t={headIndex:qo(Wo(e,3))??-1,headName:$o(e,4)??""??""};if(void 0!==jo(e,xu,Ro(e,1)))e=So(e=Po(e,xu,Ro(e,1)),1,Gi),t.floatEmbedding=e;else{const n=new Uint8Array(0);t.quantizedEmbedding=Po(e,Cu,Ro(e,2))?.fa()?.ha()??n}return t})),timestampMs:qo(Vo(e))}}(e),Kd(this,t)})),this.g.attachEmptyPacketListener("embeddings_out",(e=>{Kd(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};pf.cosineSimilarity=function(e,t){if(e.floatEmbedding&&t.floatEmbedding)e=Pd(e.floatEmbedding,t.floatEmbedding);else{if(!e.quantizedEmbedding||!t.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");e=Pd(jd(e.quantizedEmbedding),jd(t.quantizedEmbedding))}return e},pf.prototype.embedForVideo=pf.prototype.oa,pf.prototype.embed=pf.prototype.na,pf.prototype.setOptions=pf.prototype.o,pf.createFromModelPath=function(e,t){return _c(pf,e,{baseOptions:{modelAssetPath:t}})},pf.createFromModelBuffer=function(e,t){return _c(pf,e,{baseOptions:{modelAssetBuffer:t}})},pf.createFromOptions=function(e,t){return _c(pf,e,t)};var mf=class{constructor(e,t,n){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=n}close(){this.confidenceMasks?.forEach((e=>{e.close()})),this.categoryMask?.close()}};function gf(e){e.categoryMask=void 0,e.confidenceMasks=void 0,e.qualityScores=void 0}function vf(e){try{const t=new mf(e.confidenceMasks,e.categoryMask,e.qualityScores);if(!e.j)return t;e.j(t)}finally{tc(e)}}mf.prototype.close=mf.prototype.close;var yf=class extends Vc{constructor(e,t){super(new Bc(e,t),"image_in","norm_rect",!1),this.s=[],this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new xd,this.v=new gd,Uo(this.h,0,3,this.v),e=new Fu,Uo(this.h,0,1,e)}get baseOptions(){return Po(this.h,Fu,1)}set baseOptions(e){Uo(this.h,0,1,e)}o(e){return void 0!==e.displayNamesLocale?Eo(this.h,2,Yi(e.displayNamesLocale)):"displayNamesLocale"in e&&Eo(this.h,2),"outputCategoryMask"in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}P(){!function(e){const t=_o(e.W(),Nl,1).filter((e=>($o(e,1)??"").includes("mediapipe.tasks.TensorsToSegmentationCalculator")));if(e.s=[],1<t.length)throw Error("The graph has more than one mediapipe.tasks.TensorsToSegmentationCalculator.");1===t.length&&(Po(t[0],bl,7)?.l()?.g()??new Map).forEach(((t,n)=>{e.s[Number(n)]=$o(t,1)??""}))}(this)}X(e,t,n){const a="function"!=typeof t?t:{};return this.j="function"==typeof t?t:n,gf(this),zc(this,e,a),vf(this)}Ca(e,t,n,a){const r="function"!=typeof n?n:{};return this.j="function"==typeof n?n:a,gf(this),Gc(this,e,r,t),vf(this)}ta(){return this.s}m(){var e=new _l;Pl(e,"image_in"),Pl(e,"norm_rect");const t=new bl;Ko(t,Cd,this.h);const n=new Nl;Il(n,"mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph"),Sl(n,"IMAGE:image_in"),Sl(n,"NORM_RECT:norm_rect"),n.o(t),jl(e,n),Jd(this,e),this.outputConfidenceMasks&&(Bl(e,"confidence_masks"),Dl(n,"CONFIDENCE_MASKS:confidence_masks"),ec(this,"confidence_masks"),this.g.T("confidence_masks",((e,t)=>{this.confidenceMasks=e.map((e=>Wc(this,e,!this.j))),Kd(this,t)})),this.g.attachEmptyPacketListener("confidence_masks",(e=>{this.confidenceMasks=[],Kd(this,e)}))),this.outputCategoryMask&&(Bl(e,"category_mask"),Dl(n,"CATEGORY_MASK:category_mask"),ec(this,"category_mask"),this.g.S("category_mask",((e,t)=>{this.categoryMask=Wc(this,e,!this.j),Kd(this,t)})),this.g.attachEmptyPacketListener("category_mask",(e=>{this.categoryMask=void 0,Kd(this,e)}))),Bl(e,"quality_scores"),Dl(n,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",((e,t)=>{this.qualityScores=e,Kd(this,t)})),this.g.attachEmptyPacketListener("quality_scores",(e=>{this.categoryMask=void 0,Kd(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};yf.prototype.getLabels=yf.prototype.ta,yf.prototype.segmentForVideo=yf.prototype.Ca,yf.prototype.segment=yf.prototype.X,yf.prototype.setOptions=yf.prototype.o,yf.createFromModelPath=function(e,t){return _c(yf,e,{baseOptions:{modelAssetPath:t}})},yf.createFromModelBuffer=function(e,t){return _c(yf,e,{baseOptions:{modelAssetBuffer:t}})},yf.createFromOptions=function(e,t){return _c(yf,e,t)};var bf=class{constructor(e,t,n){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=n}close(){this.confidenceMasks?.forEach((e=>{e.close()})),this.categoryMask?.close()}};bf.prototype.close=bf.prototype.close;var xf=class extends Jo{constructor(e){super(e)}},Cf=[0,Gs,Gs,Gs],wf=[0,Fs,Fs,Fs,Fs,$s],Ef=[0,Fs,Fs,Fs,Fs,$s,Fs,Fs],kf=[0,Xs,Ef],Tf=[0,Xs,kf,Xs,Cf],Mf=[0,Xs,Ef,Xs,Cf],If=[0,Xs,Ef,Gs,Gs],Sf=[0,Xs,If,Xs,Cf],Df=[0,Fs,Fs,Fs,Fs,$s,Xs,Cf,Xs,Cf],Nf=[0,Fs,Fs,Fs,Fs,$s,nl],Af=class extends Jo{constructor(e){super(e)}},Lf=[0,Fs,Fs,$s],Rf=class extends Jo{constructor(){super()}};Rf.B=[1];var Of=class extends Jo{constructor(e){super(e)}},Ff=[1,2,3,4,5,6,7,8,9,10,14,15],jf=[0,Js,Ef,Ff,Js,Mf,Ff,Js,kf,Ff,Js,Tf,Ff,Js,Lf,Ff,Js,Nf,Ff,Js,wf,Ff,Js,[0,Zs,Fs,Fs,Fs,$s,Gs,$s,$s,Fs,3,Xs,Cf],Ff,Js,If,Ff,Js,Sf,Ff,Fs,Xs,Cf,Zs,Js,Df,Ff,Js,[0,Ks,Lf],Ff],Pf=[0,Zs,Gs,Gs,$s],Bf=class extends Jo{constructor(){super()}};Bf.B=[1],Bf.prototype.g=sl([0,Ks,jf,Zs,Xs,Pf]);var _f=class extends Vc{constructor(e,t){super(new Bc(e,t),"image_in","norm_rect_in",!1),this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new xd,this.v=new gd,Uo(this.h,0,3,this.v),e=new Fu,Uo(this.h,0,1,e)}get baseOptions(){return Po(this.h,Fu,1)}set baseOptions(e){Uo(this.h,0,1,e)}o(e){return"outputCategoryMask"in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}X(e,t,n,a){const r="function"!=typeof n?n:{};this.j="function"==typeof n?n:a,this.qualityScores=this.categoryMask=this.confidenceMasks=void 0,n=this.I+1,a=new Bf;const i=new Of;var o=new xf;if(Zo(o,1,255),Uo(i,0,12,o),t.keypoint&&t.scribble)throw Error("Cannot provide both keypoint and scribble.");if(t.keypoint){var s=new Af;Yo(s,3,!0),Qo(s,1,t.keypoint.x),Qo(s,2,t.keypoint.y),zo(i,5,Ff,s)}else{if(!t.scribble)throw Error("Must provide either a keypoint or a scribble.");for(s of(o=new Rf,t.scribble))Yo(t=new Af,3,!0),Qo(t,1,s.x),Qo(t,2,s.y),Go(o,Af,t);zo(i,15,Ff,o)}Go(a,Of,i),this.g.addProtoToStream(a.g(),"drishti.RenderData","roi_in",n),zc(this,e,r);e:{try{const e=new bf(this.confidenceMasks,this.categoryMask,this.qualityScores);if(!this.j){var l=e;break e}this.j(e)}finally{tc(this)}l=void 0}return l}m(){var e=new _l;Pl(e,"image_in"),Pl(e,"roi_in"),Pl(e,"norm_rect_in");const t=new bl;Ko(t,Cd,this.h);const n=new Nl;Il(n,"mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraph"),Sl(n,"IMAGE:image_in"),Sl(n,"ROI:roi_in"),Sl(n,"NORM_RECT:norm_rect_in"),n.o(t),jl(e,n),Jd(this,e),this.outputConfidenceMasks&&(Bl(e,"confidence_masks"),Dl(n,"CONFIDENCE_MASKS:confidence_masks"),ec(this,"confidence_masks"),this.g.T("confidence_masks",((e,t)=>{this.confidenceMasks=e.map((e=>Wc(this,e,!this.j))),Kd(this,t)})),this.g.attachEmptyPacketListener("confidence_masks",(e=>{this.confidenceMasks=[],Kd(this,e)}))),this.outputCategoryMask&&(Bl(e,"category_mask"),Dl(n,"CATEGORY_MASK:category_mask"),ec(this,"category_mask"),this.g.S("category_mask",((e,t)=>{this.categoryMask=Wc(this,e,!this.j),Kd(this,t)})),this.g.attachEmptyPacketListener("category_mask",(e=>{this.categoryMask=void 0,Kd(this,e)}))),Bl(e,"quality_scores"),Dl(n,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",((e,t)=>{this.qualityScores=e,Kd(this,t)})),this.g.attachEmptyPacketListener("quality_scores",(e=>{this.categoryMask=void 0,Kd(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};_f.prototype.segment=_f.prototype.X,_f.prototype.setOptions=_f.prototype.o,_f.createFromModelPath=function(e,t){return _c(_f,e,{baseOptions:{modelAssetPath:t}})},_f.createFromModelBuffer=function(e,t){return _c(_f,e,{baseOptions:{modelAssetBuffer:t}})},_f.createFromOptions=function(e,t){return _c(_f,e,t)};var Uf=class extends Vc{constructor(e,t){super(new Bc(e,t),"input_frame_gpu","norm_rect",!1),this.j={detections:[]},this.h=new wd,e=new Fu,Uo(this.h,0,1,e)}get baseOptions(){return Po(this.h,Fu,1)}set baseOptions(e){Uo(this.h,0,1,e)}o(e){return void 0!==e.displayNamesLocale?Eo(this.h,2,Yi(e.displayNamesLocale)):"displayNamesLocale"in e&&Eo(this.h,2),void 0!==e.maxResults?Zo(this.h,3,e.maxResults):"maxResults"in e&&Eo(this.h,3),void 0!==e.scoreThreshold?Qo(this.h,4,e.scoreThreshold):"scoreThreshold"in e&&Eo(this.h,4),void 0!==e.categoryAllowlist?Lo(this.h,5,e.categoryAllowlist):"categoryAllowlist"in e&&Eo(this.h,5),void 0!==e.categoryDenylist?Lo(this.h,6,e.categoryDenylist):"categoryDenylist"in e&&Eo(this.h,6),this.l(e)}F(e,t){return this.j={detections:[]},zc(this,e,t),this.j}G(e,t,n){return this.j={detections:[]},Gc(this,e,n,t),this.j}m(){var e=new _l;Pl(e,"input_frame_gpu"),Pl(e,"norm_rect"),Bl(e,"detections");const t=new bl;Ko(t,Ed,this.h);const n=new Nl;Il(n,"mediapipe.tasks.vision.ObjectDetectorGraph"),Sl(n,"IMAGE:input_frame_gpu"),Sl(n,"NORM_RECT:norm_rect"),Dl(n,"DETECTIONS:detections"),n.o(t),jl(e,n),this.g.attachProtoVectorListener("detections",((e,t)=>{for(const t of e)e=ru(t),this.j.detections.push(Rd(e));Kd(this,t)})),this.g.attachEmptyPacketListener("detections",(e=>{Kd(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};function zf(e){e.landmarks=[],e.worldLandmarks=[],e.v=void 0}function Gf(e){try{const t=new class{constructor(e,t,n){this.landmarks=e,this.worldLandmarks=t,this.g=n}close(){this.g?.forEach((e=>{e.close()}))}}(e.landmarks,e.worldLandmarks,e.v);if(!e.s)return t;e.s(t)}finally{tc(e)}}Uf.prototype.detectForVideo=Uf.prototype.G,Uf.prototype.detect=Uf.prototype.F,Uf.prototype.setOptions=Uf.prototype.o,Uf.createFromModelPath=async function(e,t){return _c(Uf,e,{baseOptions:{modelAssetPath:t}})},Uf.createFromModelBuffer=function(e,t){return _c(Uf,e,{baseOptions:{modelAssetBuffer:t}})},Uf.createFromOptions=function(e,t){return _c(Uf,e,t)};var Wf=class extends Vc{constructor(e,t){super(new Bc(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.outputSegmentationMasks=!1,this.h=new Sd,e=new Fu,Uo(this.h,0,1,e),this.C=new Md,Uo(this.h,0,3,this.C),this.j=new kd,Uo(this.h,0,2,this.j),Zo(this.j,4,1),Qo(this.j,2,.5),Qo(this.C,2,.5),Qo(this.h,4,.5)}get baseOptions(){return Po(this.h,Fu,1)}set baseOptions(e){Uo(this.h,0,1,e)}o(e){return"numPoses"in e&&Zo(this.j,4,e.numPoses??1),"minPoseDetectionConfidence"in e&&Qo(this.j,2,e.minPoseDetectionConfidence??.5),"minTrackingConfidence"in e&&Qo(this.h,4,e.minTrackingConfidence??.5),"minPosePresenceConfidence"in e&&Qo(this.C,2,e.minPosePresenceConfidence??.5),"outputSegmentationMasks"in e&&(this.outputSegmentationMasks=e.outputSegmentationMasks??!1),this.l(e)}F(e,t,n){const a="function"!=typeof t?t:{};return this.s="function"==typeof t?t:n,zf(this),zc(this,e,a),Gf(this)}G(e,t,n,a){const r="function"!=typeof n?n:{};return this.s="function"==typeof n?n:a,zf(this),Gc(this,e,r,t),Gf(this)}m(){var e=new _l;Pl(e,"image_in"),Pl(e,"norm_rect"),Bl(e,"normalized_landmarks"),Bl(e,"world_landmarks"),Bl(e,"segmentation_masks");const t=new bl;Ko(t,Nd,this.h);const n=new Nl;Il(n,"mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph"),Sl(n,"IMAGE:image_in"),Sl(n,"NORM_RECT:norm_rect"),Dl(n,"NORM_LANDMARKS:normalized_landmarks"),Dl(n,"WORLD_LANDMARKS:world_landmarks"),n.o(t),jl(e,n),Jd(this,e),this.g.attachProtoVectorListener("normalized_landmarks",((e,t)=>{this.landmarks=[];for(const t of e)e=fu(t),this.landmarks.push(Od(e));Kd(this,t)})),this.g.attachEmptyPacketListener("normalized_landmarks",(e=>{this.landmarks=[],Kd(this,e)})),this.g.attachProtoVectorListener("world_landmarks",((e,t)=>{this.worldLandmarks=[];for(const t of e)e=lu(t),this.worldLandmarks.push(Fd(e));Kd(this,t)})),this.g.attachEmptyPacketListener("world_landmarks",(e=>{this.worldLandmarks=[],Kd(this,e)})),this.outputSegmentationMasks&&(Dl(n,"SEGMENTATION_MASK:segmentation_masks"),ec(this,"segmentation_masks"),this.g.T("segmentation_masks",((e,t)=>{this.v=e.map((e=>Wc(this,e,!this.s))),Kd(this,t)})),this.g.attachEmptyPacketListener("segmentation_masks",(e=>{this.v=[],Kd(this,e)}))),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Wf.prototype.detectForVideo=Wf.prototype.G,Wf.prototype.detect=Wf.prototype.F,Wf.prototype.setOptions=Wf.prototype.o,Wf.createFromModelPath=function(e,t){return _c(Wf,e,{baseOptions:{modelAssetPath:t}})},Wf.createFromModelBuffer=function(e,t){return _c(Wf,e,{baseOptions:{modelAssetBuffer:t}})},Wf.createFromOptions=function(e,t){return _c(Wf,e,t)},Wf.POSE_CONNECTIONS=Fc([0,1],[1,2],[2,3],[3,7],[0,4],[4,5],[5,6],[6,8],[9,10],[11,12],[11,13],[13,15],[15,17],[15,19],[15,21],[17,19],[12,14],[14,16],[16,18],[16,20],[16,22],[18,20],[11,23],[12,24],[23,24],[23,25],[24,26],[25,27],[26,28],[27,29],[28,30],[29,31],[30,32],[27,31],[28,32]);var Vf,$f="https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@0.10.7/wasm",qf="https://websdk-cdn-dev.idmission.com/assets/models/blazeface20240207/blaze_face_short_range.tflite",Hf=45e3;function Yf(e,t,n,a){t.forEach((function(t){var r=t.keypoints.map((function(e){return[e.x,e.y]}));if(n){e.strokeStyle="#FF2C35",e.lineWidth=1;var i=t.box;!function(e,t,n){var a=new Path2D;a.moveTo(t[0][0],t[0][1]);for(var r=1;r<t.length;r++){var i=t[r];a.lineTo(i[0],i[1])}n&&a.closePath(),e.stroke(a)}(e,[[i.xMin,i.yMin],[i.xMax,i.yMin],[i.xMax,i.yMax],[i.xMin,i.yMax]],!0)}if(a){e.fillStyle="#32EEDB";for(var o=0;o<6;o++){var s=r[o][0],l=r[o][1];e.beginPath(),e.arc(s,l,3,0,2*Math.PI),e.fill()}}}))}function Zf(){return b(this,void 0,void 0,(function(){var e;return x(this,(function(t){switch(t.label){case 0:return Vf?[2,Vf]:[4,ih()];case 1:return t.sent(),[4,Gd.forVisionTasks($f)];case 2:return e=t.sent(),[4,$c.createFromOptions(e,{baseOptions:{modelAssetPath:qf,delegate:"GPU"},runningMode:"VIDEO"})];case 3:return[2,Vf=t.sent()]}}))}))}var Qf=t.createContext({start:function(){return null},stop:function(){return null},onPredictionMade:function(){return null},canvasRef:{current:null},ready:!1,error:null,modelDownloadProgress:0}),Xf=function(e){var n=e.autoStart,a=void 0===n||n,r=e.children,i=e.throttleMs,o=e.onModelError,s=e.modelLoadTimeoutMs,l=void 0===s?Hf:s,u=t.useContext(Xe),c=u.videoRef,f=u.videoLoaded,h=u.cameraReady,p=t.useRef(null),m=t.useRef(),g=t.useState(!1),y=g[0],C=g[1],w=t.useState(!1),E=w[0],k=w[1],T=t.useRef(null),M=t.useRef(0),I=t.useRef(0),S=t.useState(null),D=S[0],N=S[1],A=t.useState(0),L=A[0],R=A[1];t.useEffect((function(){b(void 0,void 0,void 0,(function(){function e(e){R(sh(e.detail))}var t,n,a;return x(this,(function(r){switch(r.label){case 0:C(!1),document.addEventListener("idmission.preloadProgress.faceDetection",e),t=setTimeout((function(){N(new Error("Model loading time limit exceeded."))}),l),r.label=1;case 1:return r.trys.push([1,3,4,5]),n=T,[4,Zf()];case 2:return n.current=r.sent(),[3,5];case 3:return a=r.sent(),N(a),[3,5];case 4:return clearInterval(t),[7];case 5:return R(100),C(!0),[2,function(){clearInterval(t),document.removeEventListener("idmission.preloadProgress.faceDetection",e)}]}}))}))}),[l]),t.useEffect((function(){D&&(null==o||o(D))}),[D,o]),t.useEffect((function(){if(f&&h&&E&&y){var e;I.current+=1;var t=I.current;return b(void 0,void 0,void 0,(function(){var n,a,r,o;return x(this,(function(s){switch(s.label){case 0:return c.current&&T.current?(n=null===(a=p.current)||void 0===a?void 0:a.getContext("2d"),p.current&&(p.current.width=null===(r=c.current)||void 0===r?void 0:r.videoWidth,p.current.height=null===(o=c.current)||void 0===o?void 0:o.videoHeight,null==n||n.translate(c.current.videoWidth,0),null==n||n.scale(-1,1)),[4,function n(){var a,r;return b(this,void 0,void 0,(function(){var o,s,l,u,d;return x(this,(function(f){if(!T.current||!c.current||t!==I.current)return[2];if((o=null===(a=p.current)||void 0===a?void 0:a.getContext("2d"))&&4===c.current.readyState){o.drawImage(c.current,0,0,s=c.current.videoWidth,l=c.current.videoHeight),u=void 0;try{(u=T.current.detectForVideo(p.current,performance.now()))&&(d=u.detections.map((function(e){var t,n,a,r,i,o,u,d,c,f,h,p,m,g,y,b;return{keypoints:e.keypoints.map((function(e){var t;return v(v({},e),{x:e.x*s,y:e.y*l,name:null!==(t=e.label)&&void 0!==t?t:""})})),box:{xMin:null!==(n=null===(t=e.boundingBox)||void 0===t?void 0:t.originX)&&void 0!==n?n:0,xMax:(null!==(r=null===(a=e.boundingBox)||void 0===a?void 0:a.originX)&&void 0!==r?r:0)+(null!==(o=null===(i=e.boundingBox)||void 0===i?void 0:i.width)&&void 0!==o?o:0),yMin:null!==(d=null===(u=e.boundingBox)||void 0===u?void 0:u.originY)&&void 0!==d?d:0,yMax:(null!==(f=null===(c=e.boundingBox)||void 0===c?void 0:c.originY)&&void 0!==f?f:0)+(null!==(p=null===(h=e.boundingBox)||void 0===h?void 0:h.height)&&void 0!==p?p:0),width:null!==(g=null===(m=e.boundingBox)||void 0===m?void 0:m.width)&&void 0!==g?g:0,height:null!==(b=null===(y=e.boundingBox)||void 0===y?void 0:y.height)&&void 0!==b?b:0}}})),null===(r=m.current)||void 0===r||r.call(m,d),o&&Yf(o,d,!0,!0))}catch(e){console.error("caught face detection error",e)}}return e=setTimeout((function(){M.current=requestAnimationFrame(n)}),null!=i?i:0),[2]}))}))}()]):[2];case 1:return s.sent(),[2]}}))})),function(){M.current&&cancelAnimationFrame(M.current),e&&clearTimeout(e)}}}),[h,y,E,i,f,c]);var O=t.useCallback((function(){k(!0)}),[]),F=t.useCallback((function(){k(!1)}),[]);t.useEffect((function(){return a&&O(),function(){F()}}),[a,O,F]);var j=t.useCallback((function(e){m.current=e}),[]),P=t.useMemo((function(){return{start:O,stop:F,ready:y,canvasRef:p,onPredictionMade:j,error:D,modelDownloadProgress:L}}),[D,L,j,y,O,F]);return d.createElement(Qf.Provider,{value:P},d.createElement(_e,{ref:p}),r)},Kf=function(e){var t=e.documentDetectionModel,n=void 0===t||t,a=e.focusModel,r=void 0===a||a,i=e.faceDetectionModel,o=void 0===i||i;return b(void 0,void 0,void 0,(function(){return x(this,(function(e){switch(e.label){case 0:return n||r?[4,rh()]:[3,2];case 1:e.sent(),e.label=2;case 2:return o?[4,ih()]:[3,4];case 3:e.sent(),e.label=4;case 4:return[2]}}))}))},Jf={},eh={idCapture:{loaded:0,total:0},faceDetection:{loaded:0,total:0}};function th(e){return b(this,void 0,void 0,(function(){var t;return x(this,(function(n){return t=new XMLHttpRequest,[2,new Promise((function(n){t.addEventListener("progress",(function(t){t.lengthComputable&&(Jf[e]=t,document.dispatchEvent(new CustomEvent("idmission.preloadProgress",{detail:{url:e,loaded:t.loaded,total:t.total}})))})),t.addEventListener("loadend",(function(){n(4===t.readyState&&200===t.status)})),t.open("GET",e,!0),t.send()}))]}))}))}var nh=!1,ah=!1;function rh(){return b(this,void 0,void 0,(function(){function e(e){t.includes(e.detail.url)&&(eh.idCapture=lh(t),document.dispatchEvent(new CustomEvent("idmission.preloadProgress.idCapture",{detail:eh.idCapture})))}var t;return x(this,(function(n){switch(n.label){case 0:return nh?[2,new Promise((function(e){setInterval((function(){nh||e()}),100)}))]:(nh=!0,[4,Promise.all([oh(dh),oh(ch)])]);case 1:t=n.sent().flat(),document.addEventListener("idmission.preloadProgress",e),n.label=2;case 2:return n.trys.push([2,,4,5]),[4,Promise.all(t.map(th))];case 3:return n.sent(),[3,5];case 4:return document.removeEventListener("idmission.preloadProgress",e),nh=!1,[7];case 5:return[2]}}))}))}function ih(){return b(this,void 0,void 0,(function(){function e(e){t.includes(e.detail.url)&&(eh.faceDetection=lh(t),document.dispatchEvent(new CustomEvent("idmission.preloadProgress.faceDetection",{detail:eh.faceDetection})))}var t;return x(this,(function(n){switch(n.label){case 0:if(ah)return[2,new Promise((function(e){setInterval((function(){ah||e()}),100)}))];ah=!0,t=["".concat($f,"/vision_wasm_internal.wasm"),qf],document.addEventListener("idmission.preloadProgress",e),n.label=1;case 1:return n.trys.push([1,,3,4]),[4,Promise.all(t.map(th))];case 2:return n.sent(),[3,4];case 3:return document.removeEventListener("idmission.preloadProgress",e),ah=!1,[7];case 4:return[2]}}))}))}function oh(e){return b(this,void 0,void 0,(function(){var t;return x(this,(function(n){switch(n.label){case 0:return t=e.split("/").slice(0,-1).join("/"),[4,fetch(e)];case 1:return[4,n.sent().json()];case 2:return[2,n.sent().weightsManifest[0].paths.map((function(e){return"".concat(t,"/").concat(e)}))]}}))}))}function sh(e){return e.total>0?Math.round(100*e.loaded/e.total):0}function lh(e){return e.reduce((function(e,t){var n=Jf[t];return n?(e.loaded+=n.loaded,e.total+=n.total,e):e}),{loaded:0,total:0})}var uh=t.createContext({ready:!1,modelDownloadProgress:0,working:{current:!1},modelError:null,thresholds:{},setThresholds:function(){return null},makePrediction:function(){return null},onPredictionMade:function(){return null},detectionTime:0,focusPredictionTime:0,getBestFrame:function(){return Promise.resolve(null)},resetBestFrame:function(){return null},bestFrameDetectionScore:0,bestFrameFocusScore:0}),dh="".concat(Ra,"/models/docdetect20240207/model.json"),ch="".concat(Ra,"/models/focus20240212/model.json"),fh=45e3,hh=function(e){var n=e.children,a=e.documentDetectionModelUrl,r=e.focusModelUrl,i=e.logPredictions,o=void 0!==i&&i,s=e.onModelError,l=e.modelLoadTimeoutMs,d=void 0===l?fh:l,c=t.useState(!1),f=c[0],h=c[1],m=t.useState({}),g=m[0],v=m[1],y=t.useRef(!1),C=t.useRef(),w=t.useRef(null),E=t.useRef(null),k=t.useRef(null),T=t.useState(0),M=T[0],I=T[1],S=t.useState(0),D=S[0],N=S[1],A=t.useState(null),L=A[0],R=A[1],O=t.useState([]),F=O[0],j=O[1],P=t.useState(0),B=P[0],_=P[1],U=t.useState(0),z=U[0],G=U[1],W=t.useState(0),V=W[0],$=W[1];t.useEffect((function(){function e(e){$(sh(e.detail))}h(!1),document.addEventListener("idmission.preloadProgress.idCapture",e);var t=a||dh,n=r||ch;var i=setTimeout((function(){R(new Error("Model loading time limit exceeded."))}),d);function o(){R(new Error("WebGL context was lost."))}(function(){return b(this,void 0,void 0,(function(){return x(this,(function(e){switch(e.label){case 0:return p.ENV.set("WEBGL_DELETE_TEXTURE_THRESHOLD",52428800),[4,p.setBackend("webgl")];case 1:return e.sent(),[4,p.ready()];case 2:return e.sent(),[4,rh()];case 3:return e.sent(),[4,Promise.all([Je(t),nt(n)])];case 4:return e.sent(),[2]}}))}))})().then((function(){$(100),h(!0)})).catch((function(e){R(e)})).finally((function(){clearInterval(i)}));var s=La(2).canvas;return s.addEventListener("webglcontextlost",o),function(){var t;clearInterval(i),null===(t=s.removeEventListener)||void 0===t||t.call(s,"webglcontextlost",o),document.removeEventListener("idmission.preloadProgress.idCapture",e)}}),[a,r,d]),t.useEffect((function(){L&&(null==s||s(L))}),[L,s]);var q=t.useState(0),H=q[0],Y=q[1],Z=t.useRef(null),Q=t.useRef(0),X=t.useCallback((function(e){y.current=!0,b(void 0,void 0,void 0,(function(){var t,n,a,r,i,s;return x(this,(function(l){switch(l.label){case 0:if(!(Ze&&et&&k.current&&w.current&&E.current))return[2];t={lastPredictionCanvas:k.current,cropCanvas:w.current,rotateCanvas:E.current},l.label=1;case 1:return l.trys.push([1,3,,4]),[4,mh(e,g,t,o)];case 2:return n=l.sent(),I(n.detectionTime),N(n.focusPredictionTime),Q.current<=n.focusScore&&(Q.current=n.focusScore,j(null!==(i=null===(r=n.bestDocumentOrPassport)||void 0===r?void 0:r.bbox)&&void 0!==i?i:[]),_(n.detectionScore),G(n.focusScore),Ue(Z.current,k.current)),n.allZero&&Y((function(e){return e+1})),null===(s=C.current)||void 0===s||s.call(C,n),[3,4];case 3:return a=l.sent(),["Requested texture size [0x0] is invalid","The image argument is a canvas element with a width or height of 0","CanvasRenderingContext2D.drawImage: Passed-in canvas is empty","The object is in an invalid state"].some((function(e){return a.toString().includes(e)}))?console.log("ignoring error caught while predicting:",a):(console.log("caught an error while predicting!",a),R(a)),[3,4];case 4:return y.current=!1,[2]}}))}))}),[o,g]);t.useEffect((function(){H>=2&&R(new Error("model is returning all zeroes"))}),[H]);var K=t.useCallback((function(e){C.current=e}),[]),J=t.useCallback((function(){return b(void 0,void 0,void 0,(function(){return x(this,(function(e){return Z.current?[2,{canvas:Z.current,boundingBox:F,detectionScore:B,focusScore:z}]:[2,null]}))}))}),[F,B,z]),ee=t.useCallback((function(){Q.current=0,ze(Z.current),ze(k.current),ze(w.current),ze(E.current),j([]),_(0),G(0)}),[]),te=t.useMemo((function(){return{ready:f,working:y,thresholds:g,setThresholds:v,makePrediction:X,onPredictionMade:K,detectionTime:M,focusPredictionTime:D,getBestFrame:J,resetBestFrame:ee,bestFrameDetectionScore:B,bestFrameFocusScore:z,modelError:L,modelDownloadProgress:V}}),[B,z,M,D,J,L,X,K,f,ee,v,g,V]);return u.default.createElement(uh.Provider,{value:te},n,u.default.createElement(_e,{ref:k}),u.default.createElement(_e,{ref:Z}),u.default.createElement(_e,{ref:w}),u.default.createElement(_e,{ref:E}))},ph=En();function mh(e,t,n,a){var r,i,o,s,l,u,d,c,f,h,p,m;return void 0===a&&(a=!1),b(this,void 0,void 0,(function(){var g,v,y,b,C,w,E,k,T,M,I,S,D,N,A,L,R,O,F,j,P,B,_,U,z,G,W,V,$,q,H,Y,Z,Q,X,K,J,ee,te,ne;return x(this,(function(x){switch(x.label){case 0:return g=Pe(e),v=g[0],y=g[1],Ue(n.lastPredictionCanvas,e),[4,gh(n.lastPredictionCanvas,a)];case 1:return b=x.sent(),w=b.scores,E=b.labels,k=b.time,T=(C=b.boxes).length>0&&!C.some((function(e){return e.some((function(e){return e>0}))})),M=function(e){var t={};return e.forEach((function(e,n){e&&(t[e.label]||(t[e.label]=[0,-1]),e.score>t[e.label][0]&&(t[e.label]=[e.score,n]))})),Object.keys(t).map((function(n){return e[t[n][1]]})).filter((function(e){return!!e}))}(C.map((function(e,t){return function(e,t,n){var a=e[0],r=e[1];return{score:t,bbox:[r,a,e[3]-r,e[2]-a],label:tt[n]}}(e,w[t],E[t])}))),I=M.find((function(e){return"Document"===e.label})),S=M.find((function(e){return"Passport Page"===e.label})),D=null!==(r=null==I?void 0:I.score)&&void 0!==r?r:0,N=null!==(i=null==S?void 0:S.score)&&void 0!==i?i:0,A=N>=(null!==(o=t.passport)&&void 0!==o?o:0),L=D>N?I:S,O=(R=A?N:D)>=(null!==(s=t.document)&&void 0!==s?s:0),F="none",A?F="passport":O&&(F="idCard"),j=M.find((function(e){return"MRZ"===e.label})),P=null!==(l=null==j?void 0:j.score)&&void 0!==l?l:0,B=P>=(null!==(u=t.mrz)&&void 0!==u?u:0),_=M.find((function(e){return"PDF417"===e.label})),U=null!==(d=null==_?void 0:_.score)&&void 0!==d?d:0,z=U>=(null!==(c=t.pdf417)&&void 0!==c?c:0),G=!1,L&&(20,V=(W=L.bbox)[0],$=W[1],q=W[2],H=W[3],V*=v,q*=v,H*=y,G=($*=y)>20&&$+H+20<y&&(V>20||V<20&&V+q>.8*v)&&V+q+20<v),Y=!1,L&&(Q=(Z=[L.bbox[2],L.bbox[3]])[1],Y=Z[0]>.85||Q>.85),X=null,K=0,J=0,ee=!1,O&&G&&!Y?[4,vh(n.lastPredictionCanvas,n,null==L?void 0:L.bbox,a)]:[3,3];case 2:ne=x.sent(),K=ne[1],J=null!==(f=null==(X=ne[0])?void 0:X[1])&&void 0!==f?f:0,te=null!==(m=ph?null===(h=t.focus)||void 0===h?void 0:h.mobile:null===(p=t.focus)||void 0===p?void 0:p.desktop)&&void 0!==m?m:0,ee=J>=te,x.label=3;case 3:return[2,{detectedObjects:M,detectionScore:R,detectionTime:k,detectionThresholdMet:O,detectedDocumentType:F,passportDetectionScore:N,passportDetectionThresholdMet:A,mrzDetectionScore:P,mrzDetectionThresholdMet:B,pdf417DetectionScore:U,pdf417DetectionThresholdMet:z,bestDocumentOrPassport:L,bestMrz:j,bestPdf417:_,documentInBounds:G,documentTooClose:Y,focusScore:J,focusThresholdMet:ee,focusPredictionTime:K,frameWidth:v,frameHeight:y,allZero:T}]}}))}))}function gh(e,t){return void 0===t&&(t=!1),b(this,void 0,void 0,(function(){var n,a,r,i,o,s,l,u,d,c,f,h,m,g,v,y,b;return x(this,(function(x){switch(x.label){case 0:if(!Ze)throw new Error("document detection model is not loaded");n=new Date,x.label=1;case 1:return x.trys.push([1,7,8,9]),p.engine().startScope(),a=p.browser.fromPixels(e),t&&console.time("resize"),r=p.image.resizeBilinear(a,[448,448]),t&&console.timeEnd("resize"),t&&console.time("convert to int32"),i=p.cast(r,"int32"),l=(s=p).tensor4d,d=(u=Array).from,[4,i.data()];case 2:return o=l.apply(s,[d.apply(u,[x.sent()]),[1,448,448,3]]),c=p.cast(o,"int32"),t&&console.timeEnd("convert to int32"),t&&console.time("predictions"),[4,Ze.executeAsync(c)];case 3:return f=x.sent(),t&&console.timeEnd("predictions"),h=f,t&&console.log("predictions made!",h.map((function(e){return e.arraySync()}))),[4,h[Ze.outputPositions.boxes].array()];case 4:return m=x.sent()[0],[4,h[Ze.outputPositions.scores].array()];case 5:return g=x.sent()[0],[4,h[Ze.outputPositions.labels].array()];case 6:return v=(v=x.sent()[0]).map((function(e){return Math.round(e)})),y=(new Date).getTime()-n.getTime(),[2,{boxes:m,scores:g,labels:v,time:y}];case 7:return b=x.sent(),console.error("caught error in makeDocumentDetectionPredictions",b),[2,{boxes:[],scores:[],labels:[],time:0}];case 8:return p.engine().endScope(),[7];case 9:return[2]}}))}))}function vh(e,t,n,a){return void 0===a&&(a=!1),b(this,void 0,void 0,(function(){var r,i,o,s,l,u,d,c,f,h,m,g,v,y,b,C,w,E,k;return x(this,(function(x){switch(x.label){case 0:if(!et)throw new Error("focus model is not loaded");r=new Date,x.label=1;case 1:return x.trys.push([1,5,6,7]),p.engine().startScope(),i=void 0,n?(o=Fa(e,n,t.cropCanvas),s=Pe(e),(d=(l=[n[2]*s[0],n[3]*s[1]])[1])>(u=l[0])&&(f=(c=t.rotateCanvas).getContext("2d"))&&(c.width=d,c.height=u,f.clearRect(0,0,c.width,c.height),f.translate(c.width/2,c.height/2),f.rotate(1.5708),f.drawImage(o,-u/2,-d/2),o=c),i=p.browser.fromPixels(o)):i=p.browser.fromPixels(e),h=p.image.resizeBilinear(i,[448,448]).div(p.scalar(127.5)).sub(p.scalar(1)),m=p.cast(h,"float32"),y=(v=p).tensor4d,C=(b=Array).from,[4,m.data()];case 2:return g=y.apply(v,[C.apply(b,[x.sent()]),[1,448,448,3]]),w=p.cast(g,"float32"),a&&console.time("focus prediction"),[4,et.predict(w)];case 3:return[4,x.sent().array()];case 4:return E=x.sent()[0],a&&console.timeEnd("focus prediction"),k=(new Date).getTime()-r.getTime(),[2,[E,k]];case 5:return x.sent(),[2,[[0,0],0]];case 6:return p.engine().endScope(),[7];case 7:return[2]}}))}))}function yh(e,n,a){var r=this,i=t.useRef(null),o=t.useRef(0),s=t.useRef(null),l=t.useRef([]),u=t.useRef(),d=t.useRef(),c=t.useRef(e),f=t.useRef(!0);c.current=e;var h="undefined"!=typeof window,p=!n&&0!==n&&h;if("function"!=typeof e)throw new TypeError("Expected a function");n=+n||0;var m=!!(a=a||{}).leading,g=!("trailing"in a)||!!a.trailing,v="maxWait"in a,y="debounceOnServer"in a&&!!a.debounceOnServer,b=v?Math.max(+a.maxWait||0,n):null;t.useEffect((function(){return f.current=!0,function(){f.current=!1}}),[]);var x=t.useMemo((function(){var e=function(e){var t=l.current,n=u.current;return l.current=u.current=null,o.current=e,d.current=c.current.apply(n,t)},t=function(e,t){p&&cancelAnimationFrame(s.current),s.current=p?requestAnimationFrame(e):setTimeout(e,t)},a=function(e){if(!f.current)return!1;var t=e-i.current;return!i.current||t>=n||t<0||v&&e-o.current>=b},x=function(t){return s.current=null,g&&l.current?e(t):(l.current=u.current=null,d.current)},C=function e(){var r=Date.now();if(a(r))return x(r);if(f.current){var s=n-(r-i.current),l=v?Math.min(s,b-(r-o.current)):s;t(e,l)}},w=function(){if(h||y){var c=Date.now(),p=a(c);if(l.current=[].slice.call(arguments),u.current=r,i.current=c,p){if(!s.current&&f.current)return o.current=i.current,t(C,n),m?e(i.current):d.current;if(v)return t(C,n),e(i.current)}return s.current||t(C,n),d.current}};return w.cancel=function(){s.current&&(p?cancelAnimationFrame(s.current):clearTimeout(s.current)),o.current=0,l.current=i.current=u.current=s.current=null},w.isPending=function(){return!!s.current},w.flush=function(){return s.current?x(Date.now()):d.current},w}),[m,v,n,b,g,p,h,y]);return x}var bh=["idCardFront","idCardBack","passport","selfie"],xh={passport:["passport"],idCard:["idCardFront","idCardBack"],idCardAndPassport:["idCardFront","idCardBack","passport"],idCardOrPassport:["idCardFront","idCardBack","passport"]};function Ch(e){return"idCardOrPassport"===e?1:xh[e].length}var wh={initialDrawComplete:!1,redrawing:!1,guideRectX:0,guideRectY:0,guideRectWidth:0,guideRectHeight:0,guideRectOffsetTop:0,guideImageWidth:0,guideImageHeight:0,pageWidth:0,pageHeight:0,videoWidth:0,videoHeight:0,detectedObjects:[],bestDocument:void 0,bestMrz:void 0,bestPdf417:void 0,documentType:"none",documentInBounds:!1,documentTooClose:!1,documentDetectionScore:0,documentDetectionThresholdMet:!1,passportPageDetectionScore:0,passportPageDetectionThresholdMet:!1,mrzDetectionScore:0,mrzDetectionThresholdMet:!1,pdf417DetectionScore:0,pdf417DetectionThresholdMet:!1,focusScore:0,focusThresholdMet:!1,barcodeScanningEnabled:!1,barcodeResult:null,waitingForBarcodeScan:!1,shouldScanBarcode:!1,autoCaptureBarcodeRequired:"mobile",barcodeScanFailedAttempts:0,maxBarcodeScanAttempts:10,isGoodFrame:!1,goodFramesCount:0,goodFramesThreshold:3,goodFramesThresholdMet:!1,lastFrameCapturedAt:null,frameCaptureRate:0,capturing:!1,captured:!1,captureFailed:!1,imageUrl:null,captureState:"capturing",capturedDocuments:{},captureRequirement:"idCardOrPassport",requestedDocumentType:"idCardFront",detectedDocumentType:"none",differentDocumentTypeDetections:0},Eh=t.createContext(wh),kh=t.createContext((function(){})),Th=function e(t,n){var a;switch(n.type){case"configureWizard":var r=n.payload,i=r.captureRequirement,o=r.precapturedDocuments,s=v(v({},t),{captureRequirement:i});if("passport"===i&&(s.requestedDocumentType="passport"),o)for(var l=0,u=bh;l<u.length;l++){var d=u[l],c=o[d];c&&(s.requestedDocumentType=d,s=e(s,{type:"documentCaptured",payload:c}))}return s;case"configureCapture":return v(v(v({},t),n.payload),{goodFramesCount:0,capturing:!1,captured:!1,captureFailed:!1});case"redrawRequested":return v(v({},t),{redrawing:!0,guideRectX:0,guideRectY:0,guideRectWidth:0,guideRectHeight:0,guideRectOffsetTop:0});case"redrawInProgress":return v(v({},t),{redrawing:!1,guideRectX:0,guideRectY:0,guideRectWidth:0,guideRectHeight:0,guideRectOffsetTop:0});case"redrawCompleted":return v(v(v({},t),n.payload),{initialDrawComplete:!0});case"pageRendered":return v(v({},t),n.payload);case"guideImageLoaded":return v(v({},t),{guideImageWidth:n.payload.width,guideImageHeight:n.payload.height});case"objectsDetected":var f=n.payload.prediction,h=f.detectedObjects,p=f.detectionScore,m=f.detectionThresholdMet,g=f.detectedDocumentType,y=f.passportDetectionScore,b=f.passportDetectionThresholdMet,x=f.mrzDetectionScore,C=f.mrzDetectionThresholdMet,w=f.pdf417DetectionScore,E=f.pdf417DetectionThresholdMet,k=f.bestDocumentOrPassport,T=f.bestMrz,M=f.bestPdf417,I=f.documentInBounds,S=f.documentTooClose,D=f.focusScore,N=f.focusThresholdMet,A=f.frameWidth,L=f.frameHeight,R=new Date,O=0,F=t.goodFramesThreshold;t.lastFrameCapturedAt&&(O=1e3/(R.getTime()-t.lastFrameCapturedAt.getTime()))>0&&(F=Math.ceil(3*O));var j=!0===t.autoCaptureBarcodeRequired||"mobile"===t.autoCaptureBarcodeRequired&&En(),P=t.barcodeScanningEnabled&&E&&j,B=P&&!t.barcodeResult,_=m&&I&&!S&&N,U=t.goodFramesCount;return _&&(U+=1),v(v({},t),{videoWidth:A,videoHeight:L,detectedObjects:h,bestDocument:k,bestMrz:T,bestPdf417:M,documentType:g,documentInBounds:I,documentTooClose:S,documentDetectionScore:p,documentDetectionThresholdMet:m,mrzDetectionScore:x,mrzDetectionThresholdMet:C,pdf417DetectionScore:w,pdf417DetectionThresholdMet:E,passportPageDetectionScore:y,passportPageDetectionThresholdMet:b,focusScore:D,focusThresholdMet:N,shouldScanBarcode:P,waitingForBarcodeScan:B,isGoodFrame:_,goodFramesCount:U,goodFramesThreshold:F,goodFramesThresholdMet:U>=F,lastFrameCapturedAt:R,frameCaptureRate:O});case"predictionMade":var z=n.payload,G=z.detectedDocumentType,W=z.passportDetectionScore,V=t.requestedDocumentType;s=v(v({},t),{detectedDocumentType:G});if("idCardOrPassport"===t.captureRequirement)V.startsWith(G)&&(s.differentDocumentTypeDetections=0),"passport"===G&&"passport"!==V&&(s.requestedDocumentType="passport"),"passport"===V&&W<.3&&(s.requestedDocumentType="idCardFront"in t.capturedDocuments?"idCardBack":"idCardFront");return s;case"barcodeScanned":return v(v({},t),{barcodeResult:n.payload.result,waitingForBarcodeScan:!1,autoCaptureBarcodeRequired:!1});case"barcodeScanFailed":return(s=v(v({},t),{barcodeScanFailedAttempts:t.barcodeScanFailedAttempts+1})).barcodeScanFailedAttempts>=s.maxBarcodeScanAttempts&&(s.autoCaptureBarcodeRequired=!1,s.shouldScanBarcode=!1,s.waitingForBarcodeScan=!1),s;case"capturing":return v(v({},t),{capturing:!0,captured:!1,captureFailed:!1});case"captured":return v(v({},t),{capturing:!1,captured:!0,captureFailed:!1});case"frameCaptured":return v(v({},t),{imageUrl:n.payload.imageUrl});case"captureFailed":return v(v({},t),{capturing:!1,captured:!1,captureFailed:!0});case"documentCaptured":var $=v(v({},t),{capturedDocuments:v(v({},t.capturedDocuments),(a={},a[t.requestedDocumentType]=n.payload,a))}),q=xh[t.captureRequirement].filter((function(e){return!(e in $.capturedDocuments)}));return"idCardOrPassport"===t.captureRequirement&&(q="passport"===t.requestedDocumentType?[]:q.filter((function(e){return"passport"!==e}))),0===q.length?$.captureState="complete":($.requestedDocumentType=q[0],"idCardFront"===t.requestedDocumentType&&"idCardBack"===$.requestedDocumentType&&($.captureState="requestingFlip",$.documentDetectionThresholdMet=!1,$.passportPageDetectionThresholdMet=!1)),$;case"documentCapturedManually":s=v({},t);var H=v(v({},n.payload),{width:0,height:0});return 0===Object.keys(t.capturedDocuments).length?s.capturedDocuments.passport=H:(s.capturedDocuments={},s.capturedDocuments.idCardFront=t.capturedDocuments.passport,s.capturedDocuments.idCardBack=H),s;case"flipRequestCompleted":return v(v({},t),{captureState:"capturing"});case"resetWizard":return v({},wh);default:return t}},Mh=function(e){var n=e.children,a=t.useReducer(Th,wh),r=a[0],i=a[1],o=yh((function(){i({type:"redrawRequested"})}),500);return t.useLayoutEffect((function(){if("undefined"!=typeof window)return window.addEventListener("resize",o),function(){window.removeEventListener("resize",o)}}),[o]),u.default.createElement(Eh.Provider,{value:r},u.default.createElement(kh.Provider,{value:i},n))},Ih=function(){var e=t.useContext(Eh),n=t.useContext(kh);if(!e||!n)throw new Error("useIdCaptureState cannot be used without IdCaptureStateProvider");return[e,n]},Sh=h.default.span(Rh||(Rh=w(["\n font-size: 16px;\n font-family: monospace;\n position: absolute;\n left: 20px;\n bottom: 20px;\n color: limegreen;\n background: rgba(0, 0, 0, 0.5);\n z-index: 1001;\n"],["\n font-size: 16px;\n font-family: monospace;\n position: absolute;\n left: 20px;\n bottom: 20px;\n color: limegreen;\n background: rgba(0, 0, 0, 0.5);\n z-index: 1001;\n"]))),Dh=h.default.div(Oh||(Oh=w(["\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"],["\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"])),(function(e){return e.$flipX?"transform: scaleX(-1);":""})),Nh=h.default.div(Fh||(Fh=w(["\n font: 10px monospace;\n position: absolute;\n border: 3px solid ",";\n color: ",";\n ","\n"],["\n font: 10px monospace;\n position: absolute;\n border: 3px solid ",";\n color: ",";\n ","\n"])),(function(e){var t=e.$color;return null!=t?t:"green"}),(function(e){var t=e.$color;return null!=t?t:"green"}),(function(e){return e.$flipX?"transform: scaleX(-1);":""})),Ah=h.default.div(jh||(jh=w(["\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"],["\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"])),(function(e){var t=e.$color;return null!=t?t:"red"}),(function(e){var t=e.$color;return null!=t?t:"red"}),(function(e){return e.$flipX?"transform: scaleX(-1);":""}));function Lh(e){var n=e.enabled,a=void 0===n||n,r=e.pageWidth,i=e.pageHeight,o=e.videoWidth,s=e.videoHeight;return t.useMemo((function(){var e=!1,t=0,n=0,l=0,u=0;return a&&((e=r/i<o/s)?l=((t=o*(i/s))-r)/2:u=((n=s*(r/o))-i)/2),{horizontal:e,pageWidth:r,pageHeight:i,videoWidth:o,videoHeight:s,scaledWidth:t,scaledHeight:n,xOffset:l,yOffset:u}}),[a,i,r,s,o])}var Rh,Oh,Fh,jh,Ph=function(e){var t=e.scaling,n=e.$flipX,a=e.children,r=Ih()[0];return u.default.createElement(Dh,{$flipX:n,style:{top:r.guideRectY,left:r.guideRectX,width:r.guideRectWidth||(null==t?void 0:t.pageWidth),height:r.guideRectHeight||(null==t?void 0:t.pageHeight)}},a)};function Bh(e){var t=e.obj,n=e.color,a=[t.bbox[1],t.bbox[0],t.bbox[2],t.bbox[3]],r=a[1],i=a[2],o=a[3];return u.default.createElement(Nh,{$flipX:e.flipX,$color:void 0===n?"green":n,style:{top:"".concat(100*a[0],"%"),left:"".concat(100*r,"%"),width:"".concat(100*i,"%"),height:"".concat(100*o,"%")}},t.label," (",t.score.toFixed(3),")")}function _h(e){var t,n,a,r,i=e.face,o=e.flipX,s=e.color,l=e.scaling,d=l.pageWidth,c=l.pageHeight,f=l.videoWidth,h=l.videoHeight,p=l.scaledWidth,m=l.scaledHeight;return f&&h&&d&&c?(l.horizontal?(t=i.box.yMin/h*c,n=i.box.xMin/f*p-l.xOffset,a=i.box.width/f*p,r=i.box.height/h*c):(t=i.box.yMin/h*m-l.yOffset,n=i.box.xMin/f*d,a=i.box.width/f*d,r=i.box.height/h*m),u.default.createElement(u.default.Fragment,null,u.default.createElement(Nh,{$flipX:o,$color:void 0===s?"green":s,style:{top:t,left:n,width:a,height:r}}),i.keypoints.map((function(e,t){return u.default.createElement(Uh,{key:t,point:e,scaling:l,flipX:o})})))):u.default.createElement(u.default.Fragment,null)}function Uh(e){var t,n,a=e.point,r=e.color,i=e.scaling,o=i.videoWidth,s=i.videoHeight;return i.horizontal?(t=a.x/o*i.scaledWidth-i.xOffset,n=a.y/s*i.pageHeight):(t=a.x/o*i.pageWidth,n=a.y/s*i.scaledHeight-i.yOffset),u.default.createElement(Ah,{$flipX:e.flipX,$color:void 0===r?"red":r,style:{top:n-=2,left:t-=2}})}function zh(e){return zh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},zh(e)}function Gh(e){var t=function(e,t){if("object"!==zh(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var a=n.call(e,t||"default");if("object"!==zh(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===zh(t)?t:String(t)}function Wh(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,Gh(a.key),a)}}var Vh=[],$h=Vh.forEach,qh=Vh.slice;var Hh=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,Yh=function(e,t,n,a){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{path:"/",sameSite:"strict"};n&&(r.expires=new Date,r.expires.setTime(r.expires.getTime()+60*n*1e3)),a&&(r.domain=a),document.cookie=function(e,t,n){var a=n||{};a.path=a.path||"/";var r=encodeURIComponent(t),i="".concat(e,"=").concat(r);if(a.maxAge>0){var o=a.maxAge-0;if(Number.isNaN(o))throw new Error("maxAge should be a Number");i+="; Max-Age=".concat(Math.floor(o))}if(a.domain){if(!Hh.test(a.domain))throw new TypeError("option domain is invalid");i+="; Domain=".concat(a.domain)}if(a.path){if(!Hh.test(a.path))throw new TypeError("option path is invalid");i+="; Path=".concat(a.path)}if(a.expires){if("function"!=typeof a.expires.toUTCString)throw new TypeError("option expires is invalid");i+="; Expires=".concat(a.expires.toUTCString())}if(a.httpOnly&&(i+="; HttpOnly"),a.secure&&(i+="; Secure"),a.sameSite)switch("string"==typeof a.sameSite?a.sameSite.toLowerCase():a.sameSite){case!0:i+="; SameSite=Strict";break;case"lax":i+="; SameSite=Lax";break;case"strict":i+="; SameSite=Strict";break;case"none":i+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return i}(e,encodeURIComponent(t),r)},Zh=function(e){for(var t="".concat(e,"="),n=document.cookie.split(";"),a=0;a<n.length;a++){for(var r=n[a];" "===r.charAt(0);)r=r.substring(1,r.length);if(0===r.indexOf(t))return r.substring(t.length,r.length)}return null},Qh={name:"cookie",lookup:function(e){var t;if(e.lookupCookie&&"undefined"!=typeof document){var n=Zh(e.lookupCookie);n&&(t=n)}return t},cacheUserLanguage:function(e,t){t.lookupCookie&&"undefined"!=typeof document&&Yh(t.lookupCookie,e,t.cookieMinutes,t.cookieDomain,t.cookieOptions)}},Xh={name:"querystring",lookup:function(e){var t;if("undefined"!=typeof window){var n=window.location.search;!window.location.search&&window.location.hash&&window.location.hash.indexOf("?")>-1&&(n=window.location.hash.substring(window.location.hash.indexOf("?")));for(var a=n.substring(1).split("&"),r=0;r<a.length;r++){var i=a[r].indexOf("=");if(i>0)a[r].substring(0,i)===e.lookupQuerystring&&(t=a[r].substring(i+1))}}return t}},Kh=null,Jh=function(){if(null!==Kh)return Kh;try{Kh="undefined"!==window&&null!==window.localStorage;var e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch(e){Kh=!1}return Kh},ep={name:"localStorage",lookup:function(e){var t;if(e.lookupLocalStorage&&Jh()){var n=window.localStorage.getItem(e.lookupLocalStorage);n&&(t=n)}return t},cacheUserLanguage:function(e,t){t.lookupLocalStorage&&Jh()&&window.localStorage.setItem(t.lookupLocalStorage,e)}},tp=null,np=function(){if(null!==tp)return tp;try{tp="undefined"!==window&&null!==window.sessionStorage;var e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch(e){tp=!1}return tp},ap={name:"sessionStorage",lookup:function(e){var t;if(e.lookupSessionStorage&&np()){var n=window.sessionStorage.getItem(e.lookupSessionStorage);n&&(t=n)}return t},cacheUserLanguage:function(e,t){t.lookupSessionStorage&&np()&&window.sessionStorage.setItem(t.lookupSessionStorage,e)}},rp={name:"navigator",lookup:function(e){var t=[];if("undefined"!=typeof navigator){if(navigator.languages)for(var n=0;n<navigator.languages.length;n++)t.push(navigator.languages[n]);navigator.userLanguage&&t.push(navigator.userLanguage),navigator.language&&t.push(navigator.language)}return t.length>0?t:void 0}},ip={name:"htmlTag",lookup:function(e){var t,n=e.htmlTag||("undefined"!=typeof document?document.documentElement:null);return n&&"function"==typeof n.getAttribute&&(t=n.getAttribute("lang")),t}},op={name:"path",lookup:function(e){var t;if("undefined"!=typeof window){var n=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(n instanceof Array)if("number"==typeof e.lookupFromPathIndex){if("string"!=typeof n[e.lookupFromPathIndex])return;t=n[e.lookupFromPathIndex].replace("/","")}else t=n[0].replace("/","")}return t}},sp={name:"subdomain",lookup:function(e){var t="number"==typeof e.lookupFromSubdomainIndex?e.lookupFromSubdomainIndex+1:1,n="undefined"!=typeof window&&window.location&&window.location.hostname&&window.location.hostname.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(n)return n[t]}};var lp=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.type="languageDetector",this.detectors={},this.init(t,n)}var t,n,a;return t=e,n=[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.services=e||{languageUtils:{}},this.options=function(e){return $h.call(qh.call(arguments,1),(function(t){if(t)for(var n in t)void 0===e[n]&&(e[n]=t[n])})),e}(t,this.options||{},{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:function(e){return e}}),"string"==typeof this.options.convertDetectedLanguage&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=function(e){return e.replace("-","_")}),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=n,this.addDetector(Qh),this.addDetector(Xh),this.addDetector(ep),this.addDetector(ap),this.addDetector(rp),this.addDetector(ip),this.addDetector(op),this.addDetector(sp)}},{key:"addDetector",value:function(e){this.detectors[e.name]=e}},{key:"detect",value:function(e){var t=this;e||(e=this.options.order);var n=[];return e.forEach((function(e){if(t.detectors[e]){var a=t.detectors[e].lookup(t.options);a&&"string"==typeof a&&(a=[a]),a&&(n=n.concat(a))}})),n=n.map((function(e){return t.options.convertDetectedLanguage(e)})),this.services.languageUtils.getBestMatchFromCodes?n:n.length>0?n[0]:null}},{key:"cacheUserLanguage",value:function(e,t){var n=this;t||(t=this.options.caches),t&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(e)>-1||t.forEach((function(t){n.detectors[t]&&n.detectors[t].cacheUserLanguage(e,n.options)})))}}],n&&Wh(t.prototype,n),a&&Wh(t,a),Object.defineProperty(t,"prototype",{writable:!1}),e}();lp.type="languageDetector";const up={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console&&console[e]&&console[e].apply(console,t)}};class dp{constructor(e){this.init(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{})}init(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||up,this.options=t,this.debug=t.debug}log(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"log","",!0)}warn(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"warn","",!0)}error(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"error","")}deprecate(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}forward(e,t,n,a){return a&&!this.debug?null:("string"==typeof e[0]&&(e[0]=`${n}${this.prefix} ${e[0]}`),this.logger[t](e))}create(e){return new dp(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return(e=e||this.options).prefix=e.prefix||this.prefix,new dp(this.logger,e)}}var cp=new dp;class fp{constructor(){this.observers={}}on(e,t){return e.split(" ").forEach((e=>{this.observers[e]=this.observers[e]||[],this.observers[e].push(t)})),this}off(e,t){this.observers[e]&&(t?this.observers[e]=this.observers[e].filter((e=>e!==t)):delete this.observers[e])}emit(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];if(this.observers[e]){[].concat(this.observers[e]).forEach((e=>{e(...n)}))}if(this.observers["*"]){[].concat(this.observers["*"]).forEach((t=>{t.apply(t,[e,...n])}))}}}function hp(){let e,t;const n=new Promise(((n,a)=>{e=n,t=a}));return n.resolve=e,n.reject=t,n}function pp(e){return null==e?"":""+e}function mp(e,t,n){function a(e){return e&&e.indexOf("###")>-1?e.replace(/###/g,"."):e}function r(){return!e||"string"==typeof e}const i="string"!=typeof t?[].concat(t):t.split(".");for(;i.length>1;){if(r())return{};const t=a(i.shift());!e[t]&&n&&(e[t]=new n),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{}}return r()?{}:{obj:e,k:a(i.shift())}}function gp(e,t,n){const{obj:a,k:r}=mp(e,t,Object);a[r]=n}function vp(e,t){const{obj:n,k:a}=mp(e,t);if(n)return n[a]}function yp(e,t,n){for(const a in t)"__proto__"!==a&&"constructor"!==a&&(a in e?"string"==typeof e[a]||e[a]instanceof String||"string"==typeof t[a]||t[a]instanceof String?n&&(e[a]=t[a]):yp(e[a],t[a],n):e[a]=t[a]);return e}function bp(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var xp={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function Cp(e){return"string"==typeof e?e.replace(/[&<>"'\/]/g,(e=>xp[e])):e}const wp=[" ",",","?","!",";"];function Ep(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:".";if(!e)return;if(e[t])return e[t];const a=t.split(n);let r=e;for(let e=0;e<a.length;++e){if(!r)return;if("string"==typeof r[a[e]]&&e+1<a.length)return;if(void 0===r[a[e]]){let i=2,o=a.slice(e,e+i).join(n),s=r[o];for(;void 0===s&&a.length>e+i;)i++,o=a.slice(e,e+i).join(n),s=r[o];if(void 0===s)return;if(null===s)return null;if(t.endsWith(o)){if("string"==typeof s)return s;if(o&&"string"==typeof s[o])return s[o]}const l=a.slice(e+i).join(n);return l?Ep(s,l,n):void 0}r=r[a[e]]}return r}function kp(e){return e&&e.indexOf("_")>0?e.replace("_","-"):e}class Tp extends fp{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=e||{},this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),void 0===this.options.ignoreJSONStructure&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const r=void 0!==a.keySeparator?a.keySeparator:this.options.keySeparator,i=void 0!==a.ignoreJSONStructure?a.ignoreJSONStructure:this.options.ignoreJSONStructure;let o=[e,t];n&&"string"!=typeof n&&(o=o.concat(n)),n&&"string"==typeof n&&(o=o.concat(r?n.split(r):n)),e.indexOf(".")>-1&&(o=e.split("."));const s=vp(this.data,o);return s||!i||"string"!=typeof n?s:Ep(this.data&&this.data[e]&&this.data[e][t],n,r)}addResource(e,t,n,a){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1};const i=void 0!==r.keySeparator?r.keySeparator:this.options.keySeparator;let o=[e,t];n&&(o=o.concat(i?n.split(i):n)),e.indexOf(".")>-1&&(o=e.split("."),a=t,t=o[1]),this.addNamespaces(t),gp(this.data,o,a),r.silent||this.emit("added",e,t,n,a)}addResources(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(const a in n)"string"!=typeof n[a]&&"[object Array]"!==Object.prototype.toString.apply(n[a])||this.addResource(e,t,a,n[a],{silent:!0});a.silent||this.emit("added",e,t,n)}addResourceBundle(e,t,n,a,r){let i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1},o=[e,t];e.indexOf(".")>-1&&(o=e.split("."),a=n,n=t,t=o[1]),this.addNamespaces(t);let s=vp(this.data,o)||{};a?yp(s,n,r):s={...s,...n},gp(this.data,o,s),i.silent||this.emit("added",e,t,n)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}hasResourceBundle(e,t){return void 0!==this.getResource(e,t)}getResourceBundle(e,t){return t||(t=this.options.defaultNS),"v1"===this.options.compatibilityAPI?{...this.getResource(e,t)}:this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find((e=>t[e]&&Object.keys(t[e]).length>0))}toJSON(){return this.data}}var Mp={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,a,r){return e.forEach((e=>{this.processors[e]&&(t=this.processors[e].process(t,n,a,r))})),t}};const Ip={};class Sp extends fp{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),function(e,t,n){e.forEach((e=>{t[e]&&(n[e]=t[e])}))}(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),this.logger=cp.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e){if(null==e)return!1;const t=this.resolve(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}});return t&&void 0!==t.res}extractFromKey(e,t){let n=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===n&&(n=":");const a=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator;let r=t.ns||this.options.defaultNS||[];const i=n&&e.indexOf(n)>-1,o=!(this.options.userDefinedKeySeparator||t.keySeparator||this.options.userDefinedNsSeparator||t.nsSeparator||function(e,t,n){t=t||"",n=n||"";const a=wp.filter((e=>t.indexOf(e)<0&&n.indexOf(e)<0));if(0===a.length)return!0;const r=new RegExp(`(${a.map((e=>"?"===e?"\\?":e)).join("|")})`);let i=!r.test(e);if(!i){const t=e.indexOf(n);t>0&&!r.test(e.substring(0,t))&&(i=!0)}return i}(e,n,a));if(i&&!o){const t=e.match(this.interpolator.nestingRegexp);if(t&&t.length>0)return{key:e,namespaces:r};const i=e.split(n);(n!==a||n===a&&this.options.ns.indexOf(i[0])>-1)&&(r=i.shift()),e=i.join(a)}return"string"==typeof r&&(r=[r]),{key:e,namespaces:r}}translate(e,t,n){if("object"!=typeof t&&this.options.overloadTranslationOptionHandler&&(t=this.options.overloadTranslationOptionHandler(arguments)),"object"==typeof t&&(t={...t}),t||(t={}),null==e)return"";Array.isArray(e)||(e=[String(e)]);const a=void 0!==t.returnDetails?t.returnDetails:this.options.returnDetails,r=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,{key:i,namespaces:o}=this.extractFromKey(e[e.length-1],t),s=o[o.length-1],l=t.lng||this.language,u=t.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(l&&"cimode"===l.toLowerCase()){if(u){const e=t.nsSeparator||this.options.nsSeparator;return a?{res:`${s}${e}${i}`,usedKey:i,exactUsedKey:i,usedLng:l,usedNS:s}:`${s}${e}${i}`}return a?{res:i,usedKey:i,exactUsedKey:i,usedLng:l,usedNS:s}:i}const d=this.resolve(e,t);let c=d&&d.res;const f=d&&d.usedKey||i,h=d&&d.exactUsedKey||i,p=Object.prototype.toString.apply(c),m=void 0!==t.joinArrays?t.joinArrays:this.options.joinArrays,g=!this.i18nFormat||this.i18nFormat.handleAsObject;if(g&&c&&("string"!=typeof c&&"boolean"!=typeof c&&"number"!=typeof c)&&["[object Number]","[object Function]","[object RegExp]"].indexOf(p)<0&&("string"!=typeof m||"[object Array]"!==p)){if(!t.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(f,c,{...t,ns:o}):`key '${i} (${this.language})' returned an object instead of string.`;return a?(d.res=e,d):e}if(r){const e="[object Array]"===p,n=e?[]:{},a=e?h:f;for(const e in c)if(Object.prototype.hasOwnProperty.call(c,e)){const i=`${a}${r}${e}`;n[e]=this.translate(i,{...t,joinArrays:!1,ns:o}),n[e]===i&&(n[e]=c[e])}c=n}}else if(g&&"string"==typeof m&&"[object Array]"===p)c=c.join(m),c&&(c=this.extendTranslation(c,e,t,n));else{let a=!1,o=!1;const u=void 0!==t.count&&"string"!=typeof t.count,f=Sp.hasDefaultValue(t),h=u?this.pluralResolver.getSuffix(l,t.count,t):"",p=t.ordinal&&u?this.pluralResolver.getSuffix(l,t.count,{ordinal:!1}):"",m=t[`defaultValue${h}`]||t[`defaultValue${p}`]||t.defaultValue;!this.isValidLookup(c)&&f&&(a=!0,c=m),this.isValidLookup(c)||(o=!0,c=i);const g=(t.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&o?void 0:c,v=f&&m!==c&&this.options.updateMissing;if(o||a||v){if(this.logger.log(v?"updateKey":"missingKey",l,s,i,v?m:c),r){const e=this.resolve(i,{...t,keySeparator:!1});e&&e.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let e=[];const n=this.languageUtils.getFallbackCodes(this.options.fallbackLng,t.lng||this.language);if("fallback"===this.options.saveMissingTo&&n&&n[0])for(let t=0;t<n.length;t++)e.push(n[t]);else"all"===this.options.saveMissingTo?e=this.languageUtils.toResolveHierarchy(t.lng||this.language):e.push(t.lng||this.language);const a=(e,n,a)=>{const r=f&&a!==c?a:g;this.options.missingKeyHandler?this.options.missingKeyHandler(e,s,n,r,v,t):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(e,s,n,r,v,t),this.emit("missingKey",e,s,n,c)};this.options.saveMissing&&(this.options.saveMissingPlurals&&u?e.forEach((e=>{this.pluralResolver.getSuffixes(e,t).forEach((n=>{a([e],i+n,t[`defaultValue${n}`]||m)}))})):a(e,i,m))}c=this.extendTranslation(c,e,t,d,n),o&&c===i&&this.options.appendNamespaceToMissingKey&&(c=`${s}:${i}`),(o||a)&&this.options.parseMissingKeyHandler&&(c="v1"!==this.options.compatibilityAPI?this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${s}:${i}`:i,a?c:void 0):this.options.parseMissingKeyHandler(c))}return a?(d.res=c,d):c}extendTranslation(e,t,n,a,r){var i=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||a.usedLng,a.usedNS,a.usedKey,{resolved:a});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init({...n,interpolation:{...this.options.interpolation,...n.interpolation}});const o="string"==typeof e&&(n&&n.interpolation&&void 0!==n.interpolation.skipOnVariables?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let s;if(o){const t=e.match(this.interpolator.nestingRegexp);s=t&&t.length}let l=n.replace&&"string"!=typeof n.replace?n.replace:n;if(this.options.interpolation.defaultVariables&&(l={...this.options.interpolation.defaultVariables,...l}),e=this.interpolator.interpolate(e,l,n.lng||this.language,n),o){const t=e.match(this.interpolator.nestingRegexp);s<(t&&t.length)&&(n.nest=!1)}!n.lng&&"v1"!==this.options.compatibilityAPI&&a&&a.res&&(n.lng=a.usedLng),!1!==n.nest&&(e=this.interpolator.nest(e,(function(){for(var e=arguments.length,a=new Array(e),o=0;o<e;o++)a[o]=arguments[o];return r&&r[0]===a[0]&&!n.context?(i.logger.warn(`It seems you are nesting recursively key: ${a[0]} in key: ${t[0]}`),null):i.translate(...a,t)}),n)),n.interpolation&&this.interpolator.reset()}const o=n.postProcess||this.options.postProcess,s="string"==typeof o?[o]:o;return null!=e&&s&&s.length&&!1!==n.applyPostProcessor&&(e=Mp.handle(s,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:a,...n}:n,this)),e}resolve(e){let t,n,a,r,i,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return"string"==typeof e&&(e=[e]),e.forEach((e=>{if(this.isValidLookup(t))return;const s=this.extractFromKey(e,o),l=s.key;n=l;let u=s.namespaces;this.options.fallbackNS&&(u=u.concat(this.options.fallbackNS));const d=void 0!==o.count&&"string"!=typeof o.count,c=d&&!o.ordinal&&0===o.count&&this.pluralResolver.shouldUseIntlApi(),f=void 0!==o.context&&("string"==typeof o.context||"number"==typeof o.context)&&""!==o.context,h=o.lngs?o.lngs:this.languageUtils.toResolveHierarchy(o.lng||this.language,o.fallbackLng);u.forEach((e=>{this.isValidLookup(t)||(i=e,!Ip[`${h[0]}-${e}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(i)&&(Ip[`${h[0]}-${e}`]=!0,this.logger.warn(`key "${n}" for languages "${h.join(", ")}" won't get resolved as namespace "${i}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),h.forEach((n=>{if(this.isValidLookup(t))return;r=n;const i=[l];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(i,l,n,e,o);else{let e;d&&(e=this.pluralResolver.getSuffix(n,o.count,o));const t=`${this.options.pluralSeparator}zero`,a=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(d&&(i.push(l+e),o.ordinal&&0===e.indexOf(a)&&i.push(l+e.replace(a,this.options.pluralSeparator)),c&&i.push(l+t)),f){const n=`${l}${this.options.contextSeparator}${o.context}`;i.push(n),d&&(i.push(n+e),o.ordinal&&0===e.indexOf(a)&&i.push(n+e.replace(a,this.options.pluralSeparator)),c&&i.push(n+t))}}let s;for(;s=i.pop();)this.isValidLookup(t)||(a=s,t=this.getResource(n,e,s,o))})))}))})),{res:t,usedKey:n,exactUsedKey:a,usedLng:r,usedNS:i}}isValidLookup(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}getResource(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,t,n,a):this.resourceStore.getResource(e,t,n,a)}static hasDefaultValue(e){const t="defaultValue";for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t===n.substring(0,t.length)&&void 0!==e[n])return!0;return!1}}function Dp(e){return e.charAt(0).toUpperCase()+e.slice(1)}class Np{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=cp.create("languageUtils")}getScriptPartFromCode(e){if(!(e=kp(e))||e.indexOf("-")<0)return null;const t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}getLanguagePartFromCode(e){if(!(e=kp(e))||e.indexOf("-")<0)return e;const t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if("string"==typeof e&&e.indexOf("-")>-1){const t=["hans","hant","latn","cyrl","cans","mong","arab"];let n=e.split("-");return this.options.lowerCaseLng?n=n.map((e=>e.toLowerCase())):2===n.length?(n[0]=n[0].toLowerCase(),n[1]=n[1].toUpperCase(),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=Dp(n[1].toLowerCase()))):3===n.length&&(n[0]=n[0].toLowerCase(),2===n[1].length&&(n[1]=n[1].toUpperCase()),"sgn"!==n[0]&&2===n[2].length&&(n[2]=n[2].toUpperCase()),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=Dp(n[1].toLowerCase())),t.indexOf(n[2].toLowerCase())>-1&&(n[2]=Dp(n[2].toLowerCase()))),n.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach((e=>{if(t)return;const n=this.formatLanguageCode(e);this.options.supportedLngs&&!this.isSupportedCode(n)||(t=n)})),!t&&this.options.supportedLngs&&e.forEach((e=>{if(t)return;const n=this.getLanguagePartFromCode(e);if(this.isSupportedCode(n))return t=n;t=this.options.supportedLngs.find((e=>e===n?e:e.indexOf("-")<0&&n.indexOf("-")<0?void 0:0===e.indexOf(n)?e:void 0))})),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(e,t){if(!e)return[];if("function"==typeof e&&(e=e(t)),"string"==typeof e&&(e=[e]),"[object Array]"===Object.prototype.toString.apply(e))return e;if(!t)return e.default||[];let n=e[t];return n||(n=e[this.getScriptPartFromCode(t)]),n||(n=e[this.formatLanguageCode(t)]),n||(n=e[this.getLanguagePartFromCode(t)]),n||(n=e.default),n||[]}toResolveHierarchy(e,t){const n=this.getFallbackCodes(t||this.options.fallbackLng||[],e),a=[],r=e=>{e&&(this.isSupportedCode(e)?a.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return"string"==typeof e&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?("languageOnly"!==this.options.load&&r(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&r(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&r(this.getLanguagePartFromCode(e))):"string"==typeof e&&r(this.formatLanguageCode(e)),n.forEach((e=>{a.indexOf(e)<0&&r(this.formatLanguageCode(e))})),a}}let Ap=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],Lp={1:function(e){return Number(e>1)},2:function(e){return Number(1!=e)},3:function(e){return 0},4:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},5:function(e){return Number(0==e?0:1==e?1:2==e?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5)},6:function(e){return Number(1==e?0:e>=2&&e<=4?1:2)},7:function(e){return Number(1==e?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},8:function(e){return Number(1==e?0:2==e?1:8!=e&&11!=e?2:3)},9:function(e){return Number(e>=2)},10:function(e){return Number(1==e?0:2==e?1:e<7?2:e<11?3:4)},11:function(e){return Number(1==e||11==e?0:2==e||12==e?1:e>2&&e<20?2:3)},12:function(e){return Number(e%10!=1||e%100==11)},13:function(e){return Number(0!==e)},14:function(e){return Number(1==e?0:2==e?1:3==e?2:3)},15:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2)},16:function(e){return Number(e%10==1&&e%100!=11?0:0!==e?1:2)},17:function(e){return Number(1==e||e%10==1&&e%100!=11?0:1)},18:function(e){return Number(0==e?0:1==e?1:2)},19:function(e){return Number(1==e?0:0==e||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3)},20:function(e){return Number(1==e?0:0==e||e%100>0&&e%100<20?1:2)},21:function(e){return Number(e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0)},22:function(e){return Number(1==e?0:2==e?1:(e<0||e>10)&&e%10==0?2:3)}};const Rp=["v1","v2","v3"],Op=["v4"],Fp={zero:0,one:1,two:2,few:3,many:4,other:5};class jp{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.languageUtils=e,this.options=t,this.logger=cp.create("pluralResolver"),this.options.compatibilityJSON&&!Op.includes(this.options.compatibilityJSON)||"undefined"!=typeof Intl&&Intl.PluralRules||(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=function(){const e={};return Ap.forEach((t=>{t.lngs.forEach((n=>{e[n]={numbers:t.nr,plurals:Lp[t.fc]}}))})),e}()}addRule(e,t){this.rules[e]=t}getRule(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(kp(e),{type:t.ordinal?"ordinal":"cardinal"})}catch{return}return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}needsPlural(e){const t=this.getRule(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{});return this.shouldUseIntlApi()?t&&t.resolvedOptions().pluralCategories.length>1:t&&t.numbers.length>1}getPluralFormsOfKey(e,t){return this.getSuffixes(e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).map((e=>`${t}${e}`))}getSuffixes(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=this.getRule(e,t);return n?this.shouldUseIntlApi()?n.resolvedOptions().pluralCategories.sort(((e,t)=>Fp[e]-Fp[t])).map((e=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${e}`)):n.numbers.map((n=>this.getSuffix(e,n,t))):[]}getSuffix(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const a=this.getRule(e,n);return a?this.shouldUseIntlApi()?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${a.select(t)}`:this.getSuffixRetroCompatible(a,t):(this.logger.warn(`no plural rule found for: ${e}`),"")}getSuffixRetroCompatible(e,t){const n=e.plurals(e.noAbs?t:Math.abs(t));let a=e.numbers[n];this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]&&(2===a?a="plural":1===a&&(a=""));const r=()=>this.options.prepend&&a.toString()?this.options.prepend+a.toString():a.toString();return"v1"===this.options.compatibilityJSON?1===a?"":"number"==typeof a?`_plural_${a.toString()}`:r():"v2"===this.options.compatibilityJSON||this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]?r():this.options.prepend&&n.toString()?this.options.prepend+n.toString():n.toString()}shouldUseIntlApi(){return!Rp.includes(this.options.compatibilityJSON)}}function Pp(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:".",r=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],i=function(e,t,n){const a=vp(e,n);return void 0!==a?a:vp(t,n)}(e,t,n);return!i&&r&&"string"==typeof n&&(i=Ep(e,n,a),void 0===i&&(i=Ep(t,n,a))),i}class Bp{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.logger=cp.create("interpolator"),this.options=e,this.format=e.interpolation&&e.interpolation.format||(e=>e),this.init(e)}init(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});const t=e.interpolation;this.escape=void 0!==t.escape?t.escape:Cp,this.escapeValue=void 0===t.escapeValue||t.escapeValue,this.useRawValueToEscape=void 0!==t.useRawValueToEscape&&t.useRawValueToEscape,this.prefix=t.prefix?bp(t.prefix):t.prefixEscaped||"{{",this.suffix=t.suffix?bp(t.suffix):t.suffixEscaped||"}}",this.formatSeparator=t.formatSeparator?t.formatSeparator:t.formatSeparator||",",this.unescapePrefix=t.unescapeSuffix?"":t.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":t.unescapeSuffix||"",this.nestingPrefix=t.nestingPrefix?bp(t.nestingPrefix):t.nestingPrefixEscaped||bp("$t("),this.nestingSuffix=t.nestingSuffix?bp(t.nestingSuffix):t.nestingSuffixEscaped||bp(")"),this.nestingOptionsSeparator=t.nestingOptionsSeparator?t.nestingOptionsSeparator:t.nestingOptionsSeparator||",",this.maxReplaces=t.maxReplaces?t.maxReplaces:1e3,this.alwaysFormat=void 0!==t.alwaysFormat&&t.alwaysFormat,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){this.regexp=new RegExp(`${this.prefix}(.+?)${this.suffix}`,"g");this.regexpUnescape=new RegExp(`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`,"g");this.nestingRegexp=new RegExp(`${this.nestingPrefix}(.+?)${this.nestingSuffix}`,"g")}interpolate(e,t,n,a){let r,i,o;const s=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function l(e){return e.replace(/\$/g,"$$$$")}const u=e=>{if(e.indexOf(this.formatSeparator)<0){const r=Pp(t,s,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(r,void 0,n,{...a,...t,interpolationkey:e}):r}const r=e.split(this.formatSeparator),i=r.shift().trim(),o=r.join(this.formatSeparator).trim();return this.format(Pp(t,s,i,this.options.keySeparator,this.options.ignoreJSONStructure),o,n,{...a,...t,interpolationkey:i})};this.resetRegExp();const d=a&&a.missingInterpolationHandler||this.options.missingInterpolationHandler,c=a&&a.interpolation&&void 0!==a.interpolation.skipOnVariables?a.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>l(e)},{regex:this.regexp,safeValue:e=>l(this.escapeValue?this.escape(e):e)}].forEach((t=>{for(o=0;r=t.regex.exec(e);){const n=r[1].trim();if(i=u(n),void 0===i)if("function"==typeof d){const t=d(e,r,a);i="string"==typeof t?t:""}else if(a&&Object.prototype.hasOwnProperty.call(a,n))i="";else{if(c){i=r[0];continue}this.logger.warn(`missed to pass in variable ${n} for interpolating ${e}`),i=""}else"string"==typeof i||this.useRawValueToEscape||(i=pp(i));const s=t.safeValue(i);if(e=e.replace(r[0],s),c?(t.regex.lastIndex+=i.length,t.regex.lastIndex-=r[0].length):t.regex.lastIndex=0,o++,o>=this.maxReplaces)break}})),e}nest(e,t){let n,a,r,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};function o(e,t){const n=this.nestingOptionsSeparator;if(e.indexOf(n)<0)return e;const a=e.split(new RegExp(`${n}[ ]*{`));let i=`{${a[1]}`;e=a[0],i=this.interpolate(i,r);const o=i.match(/'/g),s=i.match(/"/g);(o&&o.length%2==0&&!s||s.length%2!=0)&&(i=i.replace(/'/g,'"'));try{r=JSON.parse(i),t&&(r={...t,...r})}catch(t){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,t),`${e}${n}${i}`}return delete r.defaultValue,e}for(;n=this.nestingRegexp.exec(e);){let s=[];r={...i},r=r.replace&&"string"!=typeof r.replace?r.replace:r,r.applyPostProcessor=!1,delete r.defaultValue;let l=!1;if(-1!==n[0].indexOf(this.formatSeparator)&&!/{.*}/.test(n[1])){const e=n[1].split(this.formatSeparator).map((e=>e.trim()));n[1]=e.shift(),s=e,l=!0}if(a=t(o.call(this,n[1].trim(),r),r),a&&n[0]===e&&"string"!=typeof a)return a;"string"!=typeof a&&(a=pp(a)),a||(this.logger.warn(`missed to resolve ${n[1]} for nesting ${e}`),a=""),l&&(a=s.reduce(((e,t)=>this.format(e,t,i.lng,{...i,interpolationkey:n[1].trim()})),a.trim())),e=e.replace(n[0],a),this.regexp.lastIndex=0}return e}}function _p(e){const t={};return function(n,a,r){const i=a+JSON.stringify(r);let o=t[i];return o||(o=e(kp(a),r),t[i]=o),o(n)}}class Up{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.logger=cp.create("formatter"),this.options=e,this.formats={number:_p(((e,t)=>{const n=new Intl.NumberFormat(e,{...t});return e=>n.format(e)})),currency:_p(((e,t)=>{const n=new Intl.NumberFormat(e,{...t,style:"currency"});return e=>n.format(e)})),datetime:_p(((e,t)=>{const n=new Intl.DateTimeFormat(e,{...t});return e=>n.format(e)})),relativetime:_p(((e,t)=>{const n=new Intl.RelativeTimeFormat(e,{...t});return e=>n.format(e,t.range||"day")})),list:_p(((e,t)=>{const n=new Intl.ListFormat(e,{...t});return e=>n.format(e)}))},this.init(e)}init(e){const t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}}).interpolation;this.formatSeparator=t.formatSeparator?t.formatSeparator:t.formatSeparator||","}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=_p(t)}format(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const r=t.split(this.formatSeparator).reduce(((e,t)=>{const{formatName:r,formatOptions:i}=function(e){let t=e.toLowerCase().trim();const n={};if(e.indexOf("(")>-1){const a=e.split("(");t=a[0].toLowerCase().trim();const r=a[1].substring(0,a[1].length-1);"currency"===t&&r.indexOf(":")<0?n.currency||(n.currency=r.trim()):"relativetime"===t&&r.indexOf(":")<0?n.range||(n.range=r.trim()):r.split(";").forEach((e=>{if(!e)return;const[t,...a]=e.split(":"),r=a.join(":").trim().replace(/^'+|'+$/g,"");n[t.trim()]||(n[t.trim()]=r),"false"===r&&(n[t.trim()]=!1),"true"===r&&(n[t.trim()]=!0),isNaN(r)||(n[t.trim()]=parseInt(r,10))}))}return{formatName:t,formatOptions:n}}(t);if(this.formats[r]){let t=e;try{const o=a&&a.formatParams&&a.formatParams[a.interpolationkey]||{};t=this.formats[r](e,o.locale||o.lng||a.locale||a.lng||n,{...i,...a,...o})}catch(e){this.logger.warn(e)}return t}return this.logger.warn(`there was no format function for ${r}`),e}),e);return r}}class zp extends fp{constructor(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};super(),this.backend=e,this.store=t,this.services=n,this.languageUtils=n.languageUtils,this.options=a,this.logger=cp.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=a.maxParallelReads||10,this.readingCalls=0,this.maxRetries=a.maxRetries>=0?a.maxRetries:5,this.retryTimeout=a.retryTimeout>=1?a.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(n,a.backend,a)}queueLoad(e,t,n,a){const r={},i={},o={},s={};return e.forEach((e=>{let a=!0;t.forEach((t=>{const o=`${e}|${t}`;!n.reload&&this.store.hasResourceBundle(e,t)?this.state[o]=2:this.state[o]<0||(1===this.state[o]?void 0===i[o]&&(i[o]=!0):(this.state[o]=1,a=!1,void 0===i[o]&&(i[o]=!0),void 0===r[o]&&(r[o]=!0),void 0===s[t]&&(s[t]=!0)))})),a||(o[e]=!0)})),(Object.keys(r).length||Object.keys(i).length)&&this.queue.push({pending:i,pendingCount:Object.keys(i).length,loaded:{},errors:[],callback:a}),{toLoad:Object.keys(r),pending:Object.keys(i),toLoadLanguages:Object.keys(o),toLoadNamespaces:Object.keys(s)}}loaded(e,t,n){const a=e.split("|"),r=a[0],i=a[1];t&&this.emit("failedLoading",r,i,t),n&&this.store.addResourceBundle(r,i,n),this.state[e]=t?-1:2;const o={};this.queue.forEach((n=>{!function(e,t,n,a){const{obj:r,k:i}=mp(e,t,Object);r[i]=r[i]||[],a&&(r[i]=r[i].concat(n)),a||r[i].push(n)}(n.loaded,[r],i),function(e,t){void 0!==e.pending[t]&&(delete e.pending[t],e.pendingCount--)}(n,e),t&&n.errors.push(t),0!==n.pendingCount||n.done||(Object.keys(n.loaded).forEach((e=>{o[e]||(o[e]={});const t=n.loaded[e];t.length&&t.forEach((t=>{void 0===o[e][t]&&(o[e][t]=!0)}))})),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())})),this.emit("loaded",o),this.queue=this.queue.filter((e=>!e.done))}read(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.retryTimeout,i=arguments.length>5?arguments[5]:void 0;if(!e.length)return i(null,{});if(this.readingCalls>=this.maxParallelReads)return void this.waitingReads.push({lng:e,ns:t,fcName:n,tried:a,wait:r,callback:i});this.readingCalls++;const o=(o,s)=>{if(this.readingCalls--,this.waitingReads.length>0){const e=this.waitingReads.shift();this.read(e.lng,e.ns,e.fcName,e.tried,e.wait,e.callback)}o&&s&&a<this.maxRetries?setTimeout((()=>{this.read.call(this,e,t,n,a+1,2*r,i)}),r):i(o,s)},s=this.backend[n].bind(this.backend);if(2!==s.length)return s(e,t,o);try{const n=s(e,t);n&&"function"==typeof n.then?n.then((e=>o(null,e))).catch(o):o(null,n)}catch(e){o(e)}}prepareLoading(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),a&&a();"string"==typeof e&&(e=this.languageUtils.toResolveHierarchy(e)),"string"==typeof t&&(t=[t]);const r=this.queueLoad(e,t,n,a);if(!r.toLoad.length)return r.pending.length||a(),null;r.toLoad.forEach((e=>{this.loadOne(e)}))}load(e,t,n){this.prepareLoading(e,t,{},n)}reload(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}loadOne(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";const n=e.split("|"),a=n[0],r=n[1];this.read(a,r,"read",void 0,void 0,((n,i)=>{n&&this.logger.warn(`${t}loading namespace ${r} for language ${a} failed`,n),!n&&i&&this.logger.log(`${t}loaded namespace ${r} for language ${a}`,i),this.loaded(e,n,i)}))}saveMissing(e,t,n,a,r){let i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(t))this.logger.warn(`did not save key "${n}" as the namespace "${t}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");else if(null!=n&&""!==n){if(this.backend&&this.backend.create){const s={...i,isUpdate:r},l=this.backend.create.bind(this.backend);if(l.length<6)try{let r;r=5===l.length?l(e,t,n,a,s):l(e,t,n,a),r&&"function"==typeof r.then?r.then((e=>o(null,e))).catch(o):o(null,r)}catch(e){o(e)}else l(e,t,n,a,o,s)}e&&e[0]&&this.store.addResource(e[0],t,n,a)}}}function Gp(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){let t={};if("object"==typeof e[1]&&(t=e[1]),"string"==typeof e[1]&&(t.defaultValue=e[1]),"string"==typeof e[2]&&(t.tDescription=e[2]),"object"==typeof e[2]||"object"==typeof e[3]){const n=e[3]||e[2];Object.keys(n).forEach((e=>{t[e]=n[e]}))}return t},interpolation:{escapeValue:!0,format:(e,t,n,a)=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function Wp(e){return"string"==typeof e.ns&&(e.ns=[e.ns]),"string"==typeof e.fallbackLng&&(e.fallbackLng=[e.fallbackLng]),"string"==typeof e.fallbackNS&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e}function Vp(){}class $p extends fp{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;var n;if(super(),this.options=Wp(e),this.services={},this.logger=cp,this.modules={external:[]},n=this,Object.getOwnPropertyNames(Object.getPrototypeOf(n)).forEach((e=>{"function"==typeof n[e]&&(n[e]=n[e].bind(n))})),t&&!this.isInitialized&&!e.isClone){if(!this.options.initImmediate)return this.init(e,t),this;setTimeout((()=>{this.init(e,t)}),0)}}init(){var e=this;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;"function"==typeof t&&(n=t,t={}),!t.defaultNS&&!1!==t.defaultNS&&t.ns&&("string"==typeof t.ns?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));const a=Gp();function r(e){return e?"function"==typeof e?new e:e:null}if(this.options={...a,...this.options,...Wp(t)},"v1"!==this.options.compatibilityAPI&&(this.options.interpolation={...a.interpolation,...this.options.interpolation}),void 0!==t.keySeparator&&(this.options.userDefinedKeySeparator=t.keySeparator),void 0!==t.nsSeparator&&(this.options.userDefinedNsSeparator=t.nsSeparator),!this.options.isClone){let t;cp.init(this.modules.logger?r(this.modules.logger):null,this.options),this.modules.formatter?t=this.modules.formatter:"undefined"!=typeof Intl&&(t=Up);const n=new Np(this.options);this.store=new Tp(this.options.resources,this.options);const i=this.services;i.logger=cp,i.resourceStore=this.store,i.languageUtils=n,i.pluralResolver=new jp(n,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),!t||this.options.interpolation.format&&this.options.interpolation.format!==a.interpolation.format||(i.formatter=r(t),i.formatter.init(i,this.options),this.options.interpolation.format=i.formatter.format.bind(i.formatter)),i.interpolator=new Bp(this.options),i.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},i.backendConnector=new zp(r(this.modules.backend),i.resourceStore,i,this.options),i.backendConnector.on("*",(function(t){for(var n=arguments.length,a=new Array(n>1?n-1:0),r=1;r<n;r++)a[r-1]=arguments[r];e.emit(t,...a)})),this.modules.languageDetector&&(i.languageDetector=r(this.modules.languageDetector),i.languageDetector.init&&i.languageDetector.init(i,this.options.detection,this.options)),this.modules.i18nFormat&&(i.i18nFormat=r(this.modules.i18nFormat),i.i18nFormat.init&&i.i18nFormat.init(this)),this.translator=new Sp(this.services,this.options),this.translator.on("*",(function(t){for(var n=arguments.length,a=new Array(n>1?n-1:0),r=1;r<n;r++)a[r-1]=arguments[r];e.emit(t,...a)})),this.modules.external.forEach((e=>{e.init&&e.init(this)}))}if(this.format=this.options.interpolation.format,n||(n=Vp),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const e=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);e.length>0&&"dev"!==e[0]&&(this.options.lng=e[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined");["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach((t=>{this[t]=function(){return e.store[t](...arguments)}}));["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach((t=>{this[t]=function(){return e.store[t](...arguments),e}}));const i=hp(),o=()=>{const e=(e,t)=>{this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),i.resolve(t),n(e,t)};if(this.languages&&"v1"!==this.options.compatibilityAPI&&!this.isInitialized)return e(null,this.t.bind(this));this.changeLanguage(this.options.lng,e)};return this.options.resources||!this.options.initImmediate?o():setTimeout(o,0),i}loadResources(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Vp;const n="string"==typeof e?e:this.language;if("function"==typeof e&&(t=e),!this.options.resources||this.options.partialBundledLanguages){if(n&&"cimode"===n.toLowerCase()&&(!this.options.preload||0===this.options.preload.length))return t();const e=[],a=t=>{if(!t)return;if("cimode"===t)return;this.services.languageUtils.toResolveHierarchy(t).forEach((t=>{"cimode"!==t&&e.indexOf(t)<0&&e.push(t)}))};if(n)a(n);else{this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((e=>a(e)))}this.options.preload&&this.options.preload.forEach((e=>a(e))),this.services.backendConnector.load(e,this.options.ns,(e=>{e||this.resolvedLanguage||!this.language||this.setResolvedLanguage(this.language),t(e)}))}else t(null)}reloadResources(e,t,n){const a=hp();return e||(e=this.languages),t||(t=this.options.ns),n||(n=Vp),this.services.backendConnector.reload(e,t,(e=>{a.resolve(),n(e)})),a}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&Mp.addPostProcessor(e),"formatter"===e.type&&(this.modules.formatter=e),"3rdParty"===e.type&&this.modules.external.push(e),this}setResolvedLanguage(e){if(e&&this.languages&&!(["cimode","dev"].indexOf(e)>-1))for(let e=0;e<this.languages.length;e++){const t=this.languages[e];if(!(["cimode","dev"].indexOf(t)>-1)&&this.store.hasLanguageSomeTranslations(t)){this.resolvedLanguage=t;break}}}changeLanguage(e,t){var n=this;this.isLanguageChangingTo=e;const a=hp();this.emit("languageChanging",e);const r=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},i=(e,i)=>{i?(r(i),this.translator.changeLanguage(i),this.isLanguageChangingTo=void 0,this.emit("languageChanged",i),this.logger.log("languageChanged",i)):this.isLanguageChangingTo=void 0,a.resolve((function(){return n.t(...arguments)})),t&&t(e,(function(){return n.t(...arguments)}))},o=t=>{e||t||!this.services.languageDetector||(t=[]);const n="string"==typeof t?t:this.services.languageUtils.getBestMatchFromCodes(t);n&&(this.language||r(n),this.translator.language||this.translator.changeLanguage(n),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(n)),this.loadResources(n,(e=>{i(e,n)}))};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?0===this.services.languageDetector.detect.length?this.services.languageDetector.detect().then(o):this.services.languageDetector.detect(o):o(e):o(this.services.languageDetector.detect()),a}getFixedT(e,t,n){var a=this;const r=function(e,t){let i;if("object"!=typeof t){for(var o=arguments.length,s=new Array(o>2?o-2:0),l=2;l<o;l++)s[l-2]=arguments[l];i=a.options.overloadTranslationOptionHandler([e,t].concat(s))}else i={...t};i.lng=i.lng||r.lng,i.lngs=i.lngs||r.lngs,i.ns=i.ns||r.ns,i.keyPrefix=i.keyPrefix||n||r.keyPrefix;const u=a.options.keySeparator||".";let d;return d=i.keyPrefix&&Array.isArray(e)?e.map((e=>`${i.keyPrefix}${u}${e}`)):i.keyPrefix?`${i.keyPrefix}${u}${e}`:e,a.t(d,i)};return"string"==typeof e?r.lng=e:r.lngs=e,r.ns=t,r.keyPrefix=n,r}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const n=t.lng||this.resolvedLanguage||this.languages[0],a=!!this.options&&this.options.fallbackLng,r=this.languages[this.languages.length-1];if("cimode"===n.toLowerCase())return!0;const i=(e,t)=>{const n=this.services.backendConnector.state[`${e}|${t}`];return-1===n||2===n};if(t.precheck){const e=t.precheck(this,i);if(void 0!==e)return e}return!!this.hasResourceBundle(n,e)||(!(this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages))||!(!i(n,e)||a&&!i(r,e)))}loadNamespaces(e,t){const n=hp();return this.options.ns?("string"==typeof e&&(e=[e]),e.forEach((e=>{this.options.ns.indexOf(e)<0&&this.options.ns.push(e)})),this.loadResources((e=>{n.resolve(),t&&t(e)})),n):(t&&t(),Promise.resolve())}loadLanguages(e,t){const n=hp();"string"==typeof e&&(e=[e]);const a=this.options.preload||[],r=e.filter((e=>a.indexOf(e)<0));return r.length?(this.options.preload=a.concat(r),this.loadResources((e=>{n.resolve(),t&&t(e)})),n):(t&&t(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!e)return"rtl";const t=this.services&&this.services.languageUtils||new Np(Gp());return["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].indexOf(t.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){return new $p(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},arguments.length>1?arguments[1]:void 0)}cloneInstance(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Vp;const n=e.forkResourceStore;n&&delete e.forkResourceStore;const a={...this.options,...e,isClone:!0},r=new $p(a);void 0===e.debug&&void 0===e.prefix||(r.logger=r.logger.clone(e));return["store","services","language"].forEach((e=>{r[e]=this[e]})),r.services={...this.services},r.services.utils={hasLoadedNamespace:r.hasLoadedNamespace.bind(r)},n&&(r.store=new Tp(this.store.data,a),r.services.resourceStore=r.store),r.translator=new Sp(r.services,a),r.translator.on("*",(function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];r.emit(e,...n)})),r.init(a,t),r.translator.options=a,r.translator.backendConnector.services.utils={hasLoadedNamespace:r.hasLoadedNamespace.bind(r)},r}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const qp=$p.createInstance();qp.createInstance=$p.createInstance;var Hp={en:{translation:{}},es:{translation:{"Use your device camera to capture your ID":"Para capturar la identificación hay que utilizar la cámara del dispositivo.","Use your iPhone as a webcam":"Usar el iPhone como cámara web","Models warming up...":"Cargando modelos...","Camera initializing...":"Inicializando la cámara...","Camera access blocked":"Acceso bloqueado a la cámara","Location access blocked":"Acceso bloqueado a la localización",Continue:"Continuar","Processing...":"Procesando...","Your camera permission is disabled":"El permiso de la cámara está desactivado","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.","Your location permission is disabled":"El permiso de la localización está desactivado","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.",Retry:"Reintentar","Scan the front of ID":"Escanear el frente de la ID","Scan the back of ID":"Escanear el reverso de la ID","Scan the ID page of passport":"Escanear la página de datos del pasaporte","ID Card Front":"Frente de la ID","ID Card Back":"Reverso de la ID",Passport:"Pasaporte","Document not detected":"No se ha detectado el documento","Document is not centered":"Documento no centrado","Document too close, please back up":"Documento muy cerca, favor de alejarse","Document out of focus – try improving the lighting":"Documento no enfocado - hay que tratar de mejorar la iluminación","Document detected, hold still...":"Se ha detectado el documento, no moverse por favor...","Capturing...":"Capturando...","Capture failed!":"Falló la captura","Please flip your ID card...":"Por favor voltea la identificación...","ID card front captured.":"Se ha capturado el frente de la identificación.","ID Capture Successful":"Captura Exitosa de ID","Verify the entire ID was captured clearly with no glare.":"Hay que verificar que toda la ID se vea completa y sin reflejos.",Submit:"Enviar","Submitting...":"Enviando...","Use your device camera to capture your face":"Hay que utilizar la cámara del dispositivo para capturar el rostro","Remove Sunglasses & Hat":"Hay que quitarse lentes y/o la gorra","Avoid Excessive Backlighting":"Hay que evitar demasiada luz en el fondo","Hold still for a few seconds...":"Hay que permanecer quieto por unos segundos...","Look straight into the camera...":"Hay que mirar directamente a la cámara...","Move back...":"Hay que hacerse hacia atrás..","Move forward...":"Hay que hacerse hacia adelante...","Move to the center...":"Hay que moverse hacia el centro...","Please remove your eye coverings (sunglasses, eye patch, etc.)...":"Hay que quitarse lo que cubre los ojos (lentes, parche, etc.)...","Please remove your head coverings (hat, scarf, etc.)...":"Hay que quitarse lo que cubre la cabeza (gorra, mascada, etc.)...","Please remove your mask...":"Hay que quitarse el cubrebocas...","Live face not detected, please try again":"Rostro vivo no detectado. Por favor hay que intentar de nuevo.",Exit:"Salir","Face liveness has been verified!":"Se ha verificado la Prueba de Vida en rostro!",Done:"Terminar","Customer has been identified!":"¡Se ha identificado al cliente!","Customer not found":"Cliente no encontrado","Additional document capture":"Captura de otro documento",Next:"Siguiente","Please sign the box below":"Por favor, hay que firmar en el recuadro de abajo",Accept:"Aceptar",Clear:"Borrar","Video signature has been successfully captured!":"La video firma ha sido exitosa.","Network unreachable":"No hay conexión a internet.","We're having trouble reaching our services, please check your connection and try again.":"Estamos teniendo problemas para alcanzar nuestros servicios, por favor verificar la conexión a internet e intentar de nuevo.","We're sorry, an unexpected error has occurred.":"Lo sentimos, se ha producido un error inesperado.","Document Capture":"Captura de documento",Capture:"Capturar","Retry capture":"Reintentar la captura",Upload:"Enviar","Uploading...":"Procesando...","Upload succeeded!":"Proceso completo!","Display the front of your ID card...":"Hay que mostrar el frente de la identificación...","Display the back of your ID card...":"Hay que mostrar el reverso de la identificación...","Please move your face to the center...":"Por favor, hay que mover la cabeza hacia el centro...","Please read the following text aloud":"Hay que leer el siguiente texto en voz alta","Video ID has been successfully captured!":"Video ID capturado exitosamente!","We're having some trouble.":"Se ha presentado un problema.","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.","Verifying...":"Verificando....","Please capture the front of your ID card.":"Hay que capturar el frente de la identificación.","Please capture the back of your ID card.":"Hay que capturar el reverso de la identificación.","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.","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.","Please capture the ID page of your passport.":"Hay que capturar la página de datos del pasaporte.","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.","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 de la pasaporte manualmente.","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.","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.","Downloading...":"Descargando...","Accessing camera...":"Accediendo a la cámara","Camera ready":"Cámara está lista","Loading guided capture experience...":"Cargando la experiencia guiada para la captura....","Guided capture experience ready":"La experiencia guiada está lista","Let's Go!":"Vamos!"}}};var Yp=function(e){var n=ue().i18n;t.useEffect((function(){"auto"!==e?n.changeLanguage(e):n.changeLanguage()}),[n,e])};function Zp(e,t,n,a){if("string"==typeof n)return n;if("object"==typeof n){var r=n;if(r[t])return r[t];var i=t.split("-")[0];if(r[i])return r[i]}return e(a)}function Qp(e,n){var a=ue(),r=a.t,i=a.i18n;return t.useMemo((function(){return Zp(r,i.language,e,n)}),[n,i.language,r,e])}function Xp(e,n){var a=ue(),r=a.t,i=a.i18n;return t.useMemo((function(){return v(v({},e),Object.keys(n).reduce((function(t,a){var o;return v(v({},t),((o={})[a]=Zp(r,i.language,null==e?void 0:e[a],n[a]),o))}),{}))}),[n,i.language,r,e])}var Kp,Jp,em,tm,nm,am,rm,im,om=h.default.div(Kp||(Kp=w(["\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(e){var t=e.$top;return null!=t?t:"10vh"}),(function(e){var t=e.$bottom;return t?"bottom: ".concat(t,";"):""})),sm=function(e){var t=u.default.createElement(om,v({},e)),n=document.getElementById("idmission-above-guides-content");return n?o.createPortal(t,n):t},lm=h.default.div(Jp||(Jp=w(["\n margin-left: auto;\n margin-right: auto;\n background: ",";\n color: ",";\n padding: 10px 12px 8px;\n border-radius: 8px;\n z-index: 10001;\n"],["\n margin-left: auto;\n margin-right: auto;\n background: ",";\n color: ",";\n padding: 10px 12px 8px;\n border-radius: 8px;\n z-index: 10001;\n"])),(function(e){var t,n,a,r,i,o;return null!==(o=null!==(t=e.$background)&&void 0!==t?t:null===(i=null===(a=null===(n=e.theme)||void 0===n?void 0:n.guidanceMessages)||void 0===a?void 0:a[null!==(r=e.$variant)&&void 0!==r?r:"default"])||void 0===i?void 0:i.backgroundColor)&&void 0!==o?o:"#ccc"}),(function(e){var t,n,a,r,i,o;return null!==(o=null!==(t=e.$textColor)&&void 0!==t?t:null===(i=null===(a=null===(n=e.theme)||void 0===n?void 0:n.guidanceMessages)||void 0===a?void 0:a[null!==(r=e.$variant)&&void 0!==r?r:"default"])||void 0===i?void 0:i.textColor)&&void 0!==o?o:"black"})),um=function(e){var n,a,i,o,s,l,d,c,f,h=e.requiredDocumentType,p=e.autoCaptureEnabled,m=void 0===p||p,g=e.autoCaptureScoreThreshold,v=void 0===g?.8:g,y=e.autoCaptureGoodFramesRequired,C=void 0===y?3:y,w=e.autoCaptureBarcodeRequired,E=void 0===w?"mobile":w,k=e.mrzDetectionScoreThreshold,T=void 0===k?.25:k,M=e.passportPageDetectionThreshold,I=void 0===M?.6:M,S=e.pdf417DetectionThreshold,D=void 0===S?.15:S,N=e.focusScoreThreshold,A=void 0===N?.3:N,L=e.barcodeScanningEnabled,R=void 0===L||L,O=e.maxBarcodeScanAttempts,F=void 0===O?10:O,j=e.guidanceMessage,P=e.guidanceSatisfied,_=e.onPrediction,U=e.onBarcodeScanned,z=e.onCapture,G=e.assets,W=void 0===G?{}:G,V=e.classNames,$=void 0===V?{}:V,q=e.colors,H=void 0===q?{}:q,Y=e.verbiage,Z=void 0===Y?{}:Y,Q=e.debugMode,X=void 0!==Q&&Q,K=Le(),J=K.ref,ee=K.width,te=void 0===ee?1:ee,ne=K.height,ae=void 0===ne?1:ne,re=Ih(),ie=re[0],oe=re[1],se=t.useContext(Xe),le=se.cameraRef,ue=se.cameraReady,de=se.takePhoto,ce=se.videoRef,fe=se.videoLoaded,he=t.useRef(),pe=t.useContext(uh),me=pe.ready,ge=pe.working,ve=pe.setThresholds,ye=pe.makePrediction,be=pe.onPredictionMade,xe=pe.detectionTime,Ce=pe.focusPredictionTime,we=pe.getBestFrame,Ee=pe.resetBestFrame;t.useEffect((function(){he.current=new Date}),[]),t.useEffect((function(){oe({type:"configureCapture",payload:{requiredDocumentType:h,goodFramesThreshold:C,autoCaptureBarcodeRequired:E,barcodeScanningEnabled:R,maxBarcodeScanAttempts:F}}),Ee(),ve({document:v,passport:I,mrz:T,pdf417:D,focus:{mobile:A}})}),[h,v,A,T,C,E,R,F,I,D,Ee,ve,oe]),t.useEffect((function(){oe({type:"pageRendered",payload:{pageWidth:te,pageHeight:ae}})}),[oe,ae,te]);var ke=t.useRef(0),Te=t.useRef(!1);t.useEffect((function(){Te.current=fe&&ue&&me&&!ie.capturing&&!ie.captured}),[ue,ie.captured,ie.capturing,me,fe]);var Me=t.useState(null),Ie=Me[0],Se=Me[1];t.useEffect((function(){if(me&&ue&&fe)return ke.current=requestAnimationFrame((function e(){return b(this,void 0,void 0,(function(){var t,n;return x(this,(function(a){switch(a.label){case 0:if(!Te.current||ge.current)return[3,5];a.label=1;case 1:return a.trys.push([1,4,,5]),ie.shouldScanBarcode?[4,de()]:[3,3];case 2:if(!(t=a.sent()))return ke.current=requestAnimationFrame(e),[2];Se(t),a.label=3;case 3:return ce.current&&ye(ce.current),[3,5];case 4:return n=a.sent(),console.error("error capturing frame",n),[3,5];case 5:return ke.current=requestAnimationFrame(e),[2]}}))}))})),function(){cancelAnimationFrame(ke.current)}}),[ue,ye,me,ge,ie.shouldScanBarcode,de,fe,ce]),t.useEffect((function(){be((function(e){oe({type:"objectsDetected",payload:{prediction:e}}),null==_||_(e)}))}),[oe,_,be]),t.useEffect((function(){b(void 0,void 0,void 0,(function(){var e,t;return x(this,(function(n){switch(n.label){case 0:return ie.shouldScanBarcode&&Ie?[4,je(Ie,null===(t=ie.bestPdf417)||void 0===t?void 0:t.bbox)]:[3,2];case 1:(e=n.sent())?(oe({type:"barcodeScanned",payload:{result:e}}),null==U||U(e)):oe({type:"barcodeScanFailed"}),n.label=2;case 2:return[2]}}))}))}),[U,ie.shouldScanBarcode,null===(n=ie.bestPdf417)||void 0===n?void 0:n.bbox,de,Ie,oe]);var De=m&&ie.goodFramesThresholdMet&&!ie.capturing&&!ie.captured&&!ie.waitingForBarcodeScan&&dm(he.current)>=3e3;t.useEffect((function(){b(void 0,void 0,void 0,(function(){var e,t,n,a,r,i,o,s,l,u;return x(this,(function(d){switch(d.label){case 0:return De?(oe({type:"capturing"}),[4,we()]):[2];case 1:if(!(e=d.sent()))return console.log("uh oh, i did not get a photo"),oe({type:"captureFailed"}),[2];if(n=e.boundingBox,a=e.detectionScore,r=e.focusScore,o=(t=e.canvas).height,s=t,((i=t.width)>1920&&o>1080||i>1080&&o>1920)&&ie.barcodeResult){if(s=document.createElement("canvas"),i>o?(s.width=1920,s.height=o*(1920/i)):(s.height=1920,s.width=i*(1920/o)),!(l=s.getContext("2d")))return[2];l.drawImage(t,0,0,s.width,s.height)}return u=s.toDataURL("image/jpeg",.95),oe({type:"frameCaptured",payload:{imageUrl:u}}),setTimeout((function(){var e,t=(new Date).getTime()-(null!==(e=he.current)&&void 0!==e?e:new Date).getTime();null==z||z(u,i,o,{autoCapture:"Y",captureTime:t,boundingBox:n,bestDetectionScore:a,bestFocusScore:r}),oe({type:"captured"})}),0),[2]}}))}))}),[oe,we,z,De,ie.barcodeResult]),W.portraitGuidesImageUrl||(W.portraitGuidesImageUrl="".concat(Ra,"/Shieldout-IDCard-Front-SVG-Portrait-2.svg")),W.landscapeGuidesImageUrl||(W.landscapeGuidesImageUrl="".concat(Ra,"/Shieldout-IDCard-Front-SVG-Landscape-2.svg"));var Ne=r.useTheme();H.guideBoxUnsatisfiedColor||(H.guideBoxUnsatisfiedColor=null!==(o=null===(i=null===(a=Ne.idCapture)||void 0===a?void 0:a.guideBox)||void 0===i?void 0:i.unsatisfiedColor)&&void 0!==o?o:"white"),H.guideBoxSatisfiedColor||(H.guideBoxSatisfiedColor=null!==(d=null===(l=null===(s=Ne.idCapture)||void 0===s?void 0:s.guideBox)||void 0===l?void 0:l.satisfiedColor)&&void 0!==d?d:"green");var Ae=Xp(Z,{instructionText:"Scan the front of ID",processingIdCardText:"ID card front captured.",capturingText:"Capturing...",captureFailedText:"Capture failed!",guidanceSatisfiedText:"Document detected, hold still...",guidanceTooBlurryText:"Document out of focus – try improving the lighting",guidanceNotCenteredText:"Document is not centered",guidanceTooCloseText:"Document too close, please back up",guidanceNotDetectedText:"Document not detected"}),Re=Lh({enabled:X,pageWidth:te,pageHeight:ae,videoWidth:ie.videoWidth,videoHeight:ie.videoHeight}),Oe=ie.isGoodFrame;return"boolean"==typeof P&&(Oe=P),j||(j=Oe?Ae.guidanceSatisfiedText:ie.documentDetectionThresholdMet?ie.documentInBounds?ie.documentTooClose?Ae.guidanceTooCloseText:ie.focusThresholdMet?"":Ae.guidanceTooBlurryText:Ae.guidanceNotCenteredText:Ae.guidanceNotDetectedText),u.default.createElement(B,{ref:J,className:"flex ".concat(null!==(c=$.container)&&void 0!==c?c:"")},""!==j&&u.default.createElement(sm,{$top:"",$bottom:"12.5dvh",className:$.guidanceMessageContainer},u.default.createElement(lm,{$variant:Oe?"positive":"default",className:$.guidanceMessage},j)),X&&ie.detectedObjects.length>0&&u.default.createElement(Ph,{$flipX:!(null===(f=le.current)||void 0===f?void 0:f.isRearFacing),scaling:Re},ie.detectedObjects.map((function(e,t){var n;return u.default.createElement(Bh,{key:t,obj:e,scaling:Re,flipX:!(null===(n=le.current)||void 0===n?void 0:n.isRearFacing)})}))),X&&u.default.createElement(Sh,null,le.current?u.default.createElement(u.default.Fragment,null,"✅ Camera: ",le.current.label," (",le.current.width,"x",le.current.height,")"):"❌ Camera not ready",u.default.createElement("br",null),ie.frameCaptureRate>.75?"✅":"👎"," Frame Rate:"," ",Math.round(1e3*(ie.frameCaptureRate+Number.EPSILON))/1e3," ","fps (",xe,"ms doc detect, ",Ce,"ms focus)",u.default.createElement("br",null),me?u.default.createElement(u.default.Fragment,null,ie.documentDetectionThresholdMet?"✅":"❌"," Document Score: ",ie.documentDetectionScore," (",ie.documentType,")",u.default.createElement("br",null),ie.documentInBounds?"✅":"❌"," Document In Bounds",u.default.createElement("br",null),ie.focusThresholdMet?"✅":"❌"," Focus Score:"," ",ie.focusScore,u.default.createElement("br",null),ie.goodFramesThresholdMet?"✅":"❌"," Good Frame Count:"," ",ie.goodFramesCount,"/",ie.goodFramesThreshold,R&&ie.autoCaptureBarcodeRequired?u.default.createElement(u.default.Fragment,null,u.default.createElement("br",null),ie.barcodeResult?"✅":"❌"," Barcode Scanned (",Fe()?"Native":"ZXing",","," ",ie.barcodeScanFailedAttempts,"/",ie.maxBarcodeScanAttempts," failed attempts)"):null):u.default.createElement(u.default.Fragment,null,"❌ Models not ready")))},dm=function(e){return e?Math.abs((new Date).getTime()-e.getTime()):0},cm=function(e){var n,a=e.assets,r=void 0===a?{}:a,i=e.classNames,o=void 0===i?{}:i,s=e.colors,l=void 0===s?{}:s,d=e.verbiage,c=void 0===d?{}:d,f=t.useContext(Xe).retryCameraAccess;r.imageUrl||(r.imageUrl=Ra+"/camera-disable-icon.png");var h=Xp(c,{headingText:"Your camera permission is disabled",descriptionText:"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.",retryBtnText:"Retry"});return u.default.createElement(W,{className:"flex ".concat(null!==(n=o.container)&&void 0!==n?n:"")},u.default.createElement(fm,{className:o.inner},u.default.createElement(hm,{className:o.imageContainer},u.default.createElement("img",{src:r.imageUrl,alt:"",className:o.image})),u.default.createElement("h3",{className:o.heading},h.headingText),u.default.createElement(pm,{className:o.description},h.descriptionText),u.default.createElement(mm,{variant:"warning",onClick:f,colors:l.retryBtn,className:o.retryBtn,finished:!0},h.retryBtnText)))},fm=h.default(V)(em||(em=w(["\n max-width: 500px;\n height: auto;\n margin: auto;\n"],["\n max-width: 500px;\n height: auto;\n margin: auto;\n"]))),hm=h.default($)(tm||(tm=w(["\n flex-grow: 0;\n"],["\n flex-grow: 0;\n"]))),pm=h.default.p(nm||(nm=w(["\n line-height: 1.5;\n margin-bottom: 50px;\n"],["\n line-height: 1.5;\n margin-bottom: 50px;\n"]))),mm=h.default(ce)(am||(am=w(["\n width: 200px;\n margin: 0 auto;\n"],["\n width: 200px;\n margin: 0 auto;\n"]))),gm=h.default.button(rm||(rm=w(["\n position: absolute;\n top: 12px;\n right: 12px;\n font-size: 20px;\n width: 32px;\n height: 32px;\n font-family: monospace;\n z-index: 1002;\n border: none;\n border-radius: 4px;\n background: #ccc;\n cursor: pointer;\n padding: 8px;\n box-sizing: border-box;\n display: flex;\n\n &:hover {\n background: #ddd;\n }\n\n & > svg {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n }\n"],["\n position: absolute;\n top: 12px;\n right: 12px;\n font-size: 20px;\n width: 32px;\n height: 32px;\n font-family: monospace;\n z-index: 1002;\n border: none;\n border-radius: 4px;\n background: #ccc;\n cursor: pointer;\n padding: 8px;\n box-sizing: border-box;\n display: flex;\n\n &:hover {\n background: #ddd;\n }\n\n & > svg {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n }\n"]))),vm=function(e){return u.default.createElement(gm,{onClick:e.onClick,className:e.className},u.default.createElement("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"19.3 19.3 25.499999999999996 25.499999999999996",enableBackground:"new 0 0 64 64",width:16,height:16},u.default.createElement("g",{id:"close-outline-bot_x5F_s1g1_x5F_s2g2_x5F_s3g1_x5F_s4g1"},u.default.createElement("line",{fill:"none",stroke:"#000000",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"10",x1:"19.75",y1:"44.25",x2:"44.25",y2:"19.75"})),u.default.createElement("g",{id:"close-outline-top_x5F_s1g1_x5F_s2g2_x5F_s3g1_x5F_s4g1"},u.default.createElement("line",{fill:"none",stroke:"#000000",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"10",x1:"44.25",y1:"44.25",x2:"19.75",y2:"19.75"}))))},ym=h.default.div(im||(im=w(["\n display: flex;\n gap: 0 15px;\n justify-content: center;\n"],["\n display: flex;\n gap: 0 15px;\n justify-content: center;\n"])));function bm(e){var t=window.innerHeight>window.innerWidth;return u.default.createElement(t?Cm:xm,v({},e))}function xm(e){var n,a,i,o,s,l,d=e.width,c=void 0===d?698:d,f=e.height,h=void 0===f?452:f,p=e.className,m=t.useState(0),g=m[0],v=m[1];t.useEffect((function(){var e=setInterval((function(){v((function(e){return(e+1)%7}))}),1e3);return function(){clearInterval(e)}}),[]);var y=r.useTheme(),b=null!==(i=null===(a=null===(n=y.idCapture)||void 0===n?void 0:n.loadingOverlay)||void 0===a?void 0:a.loadingGraphicAccentColor)&&void 0!==i?i:"var(--idm-color-positive-600)",x=null!==(l=null===(s=null===(o=y.idCapture)||void 0===o?void 0:o.loadingOverlay)||void 0===s?void 0:s.loadingGraphicAccentOpacity)&&void 0!==l?l:.2;return u.default.createElement("div",{style:{display:"flex",width:"100%",height:"100%"}},u.default.createElement("svg",{className:p,width:c,height:h,viewBox:"0 0 698 452",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{margin:"auto",transform:"scale(".concat(g>1?1:1===g?1.25:.75,")"),transition:"transform 0.2s linear, border-width 0.2s linear",border:"".concat(g>=5?10:0,"px solid ").concat(b)}},u.default.createElement("g",{filter:1===g?"url(#filter0_f_91_884)":void 0},u.default.createElement("path",{d:"M10 0.5L688 0.5C693.247 0.5 697.5 4.75329 697.5 10L697.5 442C697.5 447.246 693.247 451.5 688 451.5L9.99999 451.5C4.75328 451.5 0.5 447.246 0.5 442L0.5 9.99998C0.5 4.75328 4.75329 0.5 10 0.5Z",fill:"#F3F3F3",stroke:"#DCDCDC"}),u.default.createElement("mask",{id:"mask0_91_854",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"30",y:"60",width:"207",height:"266"},u.default.createElement("rect",{x:"30.7754",y:"60.5945",width:"205.426",height:"265.304",rx:"3",fill:"#D9D9D9"})),u.default.createElement("g",{mask:"url(#mask0_91_854)"},u.default.createElement("path",{d:"M161.429 226.164C161.472 226.322 161.474 226.488 161.438 226.647C157.252 244.639 146.071 257.508 132.955 257.508C119.837 257.508 108.632 244.59 104.447 226.595C104.411 226.439 104.413 226.276 104.453 226.121L107.568 214.051L108.337 211.118C108.453 210.678 108.85 210.371 109.305 210.371L156.578 210.371C157.034 210.371 157.432 210.68 157.546 211.122L160.976 224.435L161.305 225.701L161.429 226.164Z",fill:"#D2D4DA"}),u.default.createElement("path",{d:"M185.475 157.408C185.556 157.356 185.628 157.291 185.693 157.219C210.004 130.149 193.715 196.897 180.188 189.065C157.256 175.818 183.525 158.645 185.475 157.408Z",fill:"#F7A69C"}),u.default.createElement("path",{d:"M267.491 324.918C267.577 325.255 267.487 325.608 267.24 325.853C254.85 338.143 225.105 345.481 222.791 346.037C222.686 346.063 222.601 346.067 222.493 346.058C219.509 345.795 174.209 342.097 147.081 357.481C142.849 359.881 122.568 356.455 121.909 356.343C121.888 356.339 121.882 356.339 121.861 356.337L89.946 352.929C89.8715 352.921 89.8068 352.921 89.7323 352.929C87.9869 353.117 64.0883 355.438 45.1808 343.79C29.8522 334.346 9.55527 336.584 -1.36759 325.857C-1.61519 325.614 -1.71005 325.255 -1.62441 324.919L1.46107 312.802C6.33129 293.793 21.3654 279.026 40.5404 274.455L42.6579 273.963L66.162 268.361L72.5851 266.837C75.2907 266.181 77.8788 265.267 80.3256 264.095C82.3725 263.11 84.3253 261.962 86.1605 260.649C88.1368 259.243 89.9955 257.649 91.6659 255.891C96.1597 251.18 99.4771 245.367 101.171 238.827L103.665 229.17L104.324 226.568L104.371 226.357L107.571 214.051L108.319 211.123C108.433 210.681 108.831 210.371 109.288 210.371L156.558 210.371C157.013 210.371 157.411 210.679 157.526 211.12L160.978 224.435L161.308 225.701L161.475 226.325C161.489 226.377 161.496 226.431 161.496 226.486V226.486C161.496 226.54 161.503 226.595 161.517 226.647L162.202 229.193L164.696 238.827C167.025 247.781 172.413 255.446 179.73 260.649C183.729 263.532 188.317 265.665 193.282 266.837L199.211 268.244L225.326 274.455C244.501 279.026 259.535 293.793 264.406 312.802L267.491 324.918Z",fill:"#F7A69C"}),u.default.createElement("path",{d:"M161.429 226.164C161.472 226.322 161.474 226.488 161.438 226.647C157.252 244.639 146.071 257.508 132.955 257.508C119.837 257.508 108.632 244.59 104.447 226.595C104.411 226.439 104.413 226.276 104.453 226.121L107.568 214.051L108.337 211.118C108.453 210.678 108.85 210.371 109.305 210.371L156.578 210.371C157.034 210.371 157.432 210.68 157.546 211.122L160.976 224.435L161.305 225.701L161.429 226.164Z",fill:"#DC968D"}),u.default.createElement("path",{d:"M80.3983 157.408C80.3166 157.356 80.2445 157.291 80.1799 157.219C55.8686 130.149 72.1582 196.897 85.685 189.065C108.616 175.818 82.3476 158.645 80.3983 157.408Z",fill:"#F7A69C"}),u.default.createElement("path",{d:"M189.527 137.873C189.52 137.873 189.515 137.879 189.515 137.885C189.515 139.944 189.397 141.956 189.162 143.968C188.974 145.796 188.15 153.601 186.692 163.54C185.895 169.048 184.865 175.184 183.649 181.346C183.638 181.398 183.635 181.447 183.631 181.5V181.5C183.625 181.607 183.575 181.713 183.554 181.818C180.568 196.836 176.367 211.751 170.881 217.193C164.67 223.381 159.682 229.007 153.988 233.062C148.295 237.14 141.919 239.672 132.978 239.672C124.038 239.672 117.662 237.14 111.968 233.062C106.298 229.007 101.286 223.381 95.0752 217.193C89.5754 211.714 85.367 196.715 82.3561 181.682C82.3499 181.651 82.3467 181.628 82.3467 181.596V181.596C82.3467 181.566 82.3438 181.526 82.338 181.496C81.9648 179.566 81.6147 177.636 81.2645 175.728C81.1233 174.932 80.9821 174.135 80.841 173.338C80.2528 169.962 79.7352 166.657 79.2646 163.563C77.5768 152.19 76.7532 143.609 76.7472 143.546C76.747 143.544 76.7471 143.545 76.7469 143.543C76.5589 141.692 76.4648 139.794 76.4648 137.873C76.4648 137.381 76.4648 136.889 76.4648 136.397C76.5825 131.967 77.1942 127.654 78.3 123.528C78.3471 123.341 78.3941 123.153 78.4412 122.966C84.723 100.089 105.121 83.0011 129.731 81.6416C130.814 81.5713 131.872 81.5479 132.978 81.5479C148.601 81.5479 162.741 87.8531 172.975 98.0494C181.822 106.839 187.75 118.559 189.186 131.615C189.42 133.674 189.538 135.756 189.539 137.862C189.539 137.868 189.533 137.873 189.527 137.873V137.873Z",fill:"#FEAEA5"}),u.default.createElement("path",{d:"M141.871 188.529C141.871 192.42 137.895 195.561 132.977 195.561C128.06 195.561 124.107 192.42 124.107 188.529V188.529C124.107 188.132 124.593 188.105 124.773 188.459C126.079 191.03 129.266 192.842 132.977 192.842C136.689 192.842 139.893 191.03 141.204 188.458C141.381 188.112 141.871 188.14 141.871 188.529V188.529Z",fill:"#F7A69C"}),u.default.createElement("path",{d:"M267.512 325.037C267.599 325.374 267.509 325.727 267.264 325.974C232.886 360.672 133.16 359.767 132.956 359.765C132.95 359.765 132.962 359.765 132.956 359.765C132.752 359.767 33.0007 360.672 -1.3537 325.95C-1.59784 325.703 -1.68748 325.351 -1.60167 325.014L1.48353 312.922C6.35375 293.889 21.3879 279.122 40.5629 274.551L66.2315 268.456L72.6075 266.933C75.2325 266.311 77.7789 265.415 80.1745 264.28C80.5729 264.092 81.0485 264.176 81.3541 264.494C94.359 278.009 112.66 286.435 132.956 286.435C153.253 286.435 171.556 278.008 184.562 264.49C184.865 264.174 185.337 264.088 185.734 264.274C188.127 265.395 190.657 266.311 193.304 266.933L198.88 268.269L225.349 274.551C244.524 279.122 259.558 293.889 264.405 312.922L267.512 325.037Z",fill:"#6E7174"}),u.default.createElement("path",{d:"M197.318 267.895C198.038 268.068 198.334 268.924 197.847 269.481C190.872 277.457 169.982 297.251 132.954 298.717C92.046 300.357 71.408 275.554 67.0543 269.627C66.6418 269.065 66.9505 268.284 67.6281 268.122L72.606 266.933C75.231 266.311 77.7773 265.415 80.173 264.28C80.5713 264.092 81.0469 264.176 81.3526 264.494C94.3575 278.009 112.659 286.435 132.954 286.435C153.252 286.435 171.555 278.008 184.56 264.49C184.864 264.174 185.336 264.088 185.732 264.274C188.126 265.395 190.655 266.311 193.303 266.933L197.318 267.895Z",fill:"#555A5E"}),u.default.createElement("path",{d:"M75.4663 140.851C75.4663 152.603 78.3795 166.091 80.4253 174.114C80.713 175.242 82.458 175.01 82.5156 173.848C83.0875 162.287 85.7494 140.134 97.4904 130.033C108.545 120.523 117.526 131.201 132.13 131.201C145.353 131.201 157.695 120.704 168.836 130.033C181.053 140.264 183.463 159.992 183.739 171.736C183.767 172.936 185.717 173.218 186.003 172.053C187.986 163.959 190.429 151.77 190.429 140.851C190.429 100.426 174.665 81.3704 132.13 81.3704C93.3928 81.3704 75.4663 100.225 75.4663 140.851Z",fill:"#525252"})),u.default.createElement("rect",{x:"30.7754",y:"360.29",width:"640.93",height:"40.942",rx:"3",fill:"#C1C1C1"}),u.default.createElement("rect",{x:"267.427",y:"134.29",width:"402.636",height:"40.942",rx:"3",fill:"#C1C1C1"}),u.default.createElement("rect",{x:"267.427",y:"209.623",width:"180.775",height:"40.942",rx:"3",fill:"#C1C1C1"}),u.default.createElement("rect",{x:"481.069",y:"209.623",width:"188.992",height:"40.942",rx:"3",fill:"#C1C1C1"}),u.default.createElement("rect",{x:"267.427",y:"284.956",width:"180.775",height:"40.942",rx:"3",fill:"#C1C1C1"}),u.default.createElement("rect",{x:"481.069",y:"284.956",width:"188.992",height:"40.942",rx:"3",fill:"#C1C1C1"}),u.default.createElement("rect",{x:"266.829",y:"58.3618",width:"402.636",height:"40.942",rx:"3",fill:"#C1C1C1"}),u.default.createElement("g",{fillOpacity:3===g?x:0,style:{transition:"fill-opacity 0.2s linear"}},u.default.createElement("rect",{x:"672",y:"55",width:"47",height:"410",transform:"rotate(90 672 55)",fill:b}),u.default.createElement("rect",{x:"670",y:"206",width:"47",height:"194",transform:"rotate(90 670 206)",fill:b}),u.default.createElement("rect",{x:"242",y:"61",width:"271",height:"218",transform:"rotate(90 242 61)",fill:b}),u.default.createElement("rect",{x:"677",y:"357",width:"47",height:"653",transform:"rotate(90 677 357)",fill:b})),u.default.createElement("g",{fillOpacity:4===g?x:0,style:{transition:"fill-opacity 0.2s linear"}},u.default.createElement("rect",{x:"455",y:"281",width:"47",height:"194",transform:"rotate(90 455 281)",fill:b}),u.default.createElement("rect",{x:"672",y:"131",width:"47",height:"411",transform:"rotate(90 672 131)",fill:b})),u.default.createElement("g",{fillOpacity:g>=5?1:0,style:{transition:"fill-opacity 0.2s linear"}},u.default.createElement("circle",{cx:"360",cy:"215",r:"41",fill:b}),u.default.createElement("path",{d:"M339.937 218.076L350.044 229.83L381.809 201.915",stroke:"white",strokeWidth:"10",strokeOpacity:g>=5?1:0,strokeLinecap:"round",strokeLinejoin:"round",style:{transition:"stroke-opacity 0.2s linear"}}))),u.default.createElement("filter",{id:"filter0_f_91_884",x:"0",y:"0",width:"848",height:"556",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB"},u.default.createElement("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),u.default.createElement("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),u.default.createElement("feGaussianBlur",{stdDeviation:"5",result:"effect1_foregroundBlur_91_884"}))))}function Cm(e){var n,a,i,o,s,l,d=e.width,c=void 0===d?428:d,f=e.height,h=void 0===f?747:f,p=e.className,m=t.useState(0),g=m[0],v=m[1];t.useEffect((function(){var e=setInterval((function(){v((function(e){return(e+1)%7}))}),1e3);return function(){clearInterval(e)}}),[]);var y=r.useTheme(),b=null!==(i=null===(a=null===(n=y.idCapture)||void 0===n?void 0:n.loadingOverlay)||void 0===a?void 0:a.loadingGraphicAccentColor)&&void 0!==i?i:"var(--idm-color-positive-600)",x=null!==(l=null===(s=null===(o=y.idCapture)||void 0===o?void 0:o.loadingOverlay)||void 0===s?void 0:s.loadingGraphicAccentOpacity)&&void 0!==l?l:.2;return u.default.createElement("svg",{className:p,width:c,height:h,viewBox:"0 0 428 747",fill:"none",xmlns:"http://www.w3.org/2000/svg"},u.default.createElement("g",{id:"card",style:{transform:"translate(".concat(g<1?"-500px":"0",", 0)"),transition:"transform 0.3s linear"}},u.default.createElement("path",{d:"M76.5001 181.274C76.5001 176.027 80.7534 171.774 86.0001 171.774L342 171.774C347.247 171.774 351.5 176.027 351.5 181.274L351.5 586C351.5 591.247 347.247 595.5 342 595.5L86.0001 595.5C80.7534 595.5 76.5001 591.247 76.5001 586L76.5001 181.274Z",fill:"#F3F3F3",stroke:"#DCDCDC"}),u.default.createElement("mask",{id:"mask0_29_1815",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"113",y:"452",width:"163",height:"126"},u.default.createElement("rect",{x:"113",y:"577.273",width:"125",height:"162",rx:"3",transform:"rotate(-90 113 577.273)",fill:"#D9D9D9"})),u.default.createElement("g",{mask:"url(#mask0_29_1815)"},u.default.createElement("path",{d:"M214.008 497.796C214.165 497.754 214.33 497.751 214.489 497.788C225.426 500.352 233.24 507.14 233.24 515.098C233.24 523.058 225.395 529.861 214.455 532.423C214.3 532.46 214.138 532.458 213.983 532.418L206.704 530.546L205.204 530.154C204.764 530.039 204.457 529.641 204.457 529.186L204.457 501.028C204.457 500.571 204.766 500.173 205.208 500.059L213.044 498.048L213.817 497.847L214.008 497.796Z",fill:"#D2D4DA"}),u.default.createElement("path",{d:"M172.144 483.183C172.092 483.102 172.027 483.031 171.955 482.966C155.547 468.233 196.225 478.134 191.447 486.357C183.444 500.161 173.096 484.665 172.144 483.183Z",fill:"#F7A69C"}),u.default.createElement("path",{d:"M274.192 433.287C274.528 433.202 274.882 433.292 275.124 433.541C282.444 441.074 286.849 458.59 287.283 460.373C287.308 460.479 287.314 460.558 287.305 460.667C287.111 462.898 284.971 490.135 294.285 506.502C295.735 509.05 293.703 521.155 293.593 521.803C293.589 521.823 293.587 521.84 293.585 521.861L291.51 541.224C291.502 541.299 291.502 541.364 291.509 541.439C291.65 542.782 292.959 557.13 285.925 568.508C280.203 577.763 281.504 589.995 275.126 596.677C274.887 596.927 274.528 597.02 274.193 596.935L267.003 595.111C255.396 592.147 246.379 582.999 243.588 571.332L243.287 570.043L239.866 555.741L238.936 551.833C238.535 550.186 237.977 548.611 237.262 547.123C236.66 545.877 235.959 544.689 235.158 543.572C234.299 542.37 233.326 541.239 232.252 540.222C229.375 537.488 225.826 535.469 221.832 534.438L215.936 532.921L214.347 532.52L214.218 532.491L206.704 530.544L205.21 530.164C204.767 530.051 204.457 529.652 204.457 529.194L204.457 501.04C204.457 500.584 204.765 500.186 205.207 500.071L213.044 498.046L213.817 497.846L214.198 497.744C214.23 497.736 214.263 497.731 214.297 497.731C214.33 497.731 214.363 497.727 214.395 497.718L215.95 497.302L221.832 495.784C227.3 494.367 231.98 491.088 235.158 486.636C236.918 484.202 238.22 481.411 238.936 478.39L239.795 474.782L243.588 458.891C246.379 447.223 255.396 438.075 267.003 435.112L274.192 433.287Z",fill:"#F7A69C"}),u.default.createElement("path",{d:"M214.008 497.796C214.165 497.754 214.33 497.751 214.489 497.788C225.426 500.352 233.24 507.14 233.24 515.098C233.24 523.058 225.395 529.861 214.455 532.423C214.3 532.46 214.138 532.458 213.983 532.418L206.704 530.546L205.204 530.154C204.764 530.039 204.457 529.641 204.457 529.186L204.457 501.028C204.457 500.571 204.766 500.173 205.208 500.059L213.044 498.048L213.817 497.847L214.008 497.796Z",fill:"#DC968D"}),u.default.createElement("path",{d:"M172.144 547.035C172.092 547.117 172.027 547.188 171.955 547.252C155.547 561.986 196.225 552.085 191.447 543.861C183.444 530.057 173.096 545.553 172.144 547.035Z",fill:"#F7A69C"}),u.default.createElement("path",{d:"M160.188 480.675C160.188 480.679 160.191 480.682 160.195 480.682C161.452 480.682 162.681 480.754 163.91 480.897C165.026 481.011 169.792 481.512 175.861 482.4C179.224 482.885 182.971 483.511 186.733 484.252C186.765 484.258 186.795 484.26 186.827 484.262C186.893 484.266 186.958 484.296 187.022 484.309C196.192 486.126 205.299 488.682 208.623 492.02C212.401 495.8 215.836 498.835 218.312 502.3C220.803 505.764 222.348 509.644 222.348 515.084C222.348 520.524 220.803 524.404 218.312 527.869C215.836 531.319 212.401 534.368 208.623 538.148C205.277 541.494 196.118 544.055 186.939 545.887C186.92 545.891 186.906 545.893 186.886 545.893C186.867 545.893 186.844 545.895 186.825 545.898C185.646 546.125 184.468 546.338 183.303 546.551C182.817 546.637 182.33 546.723 181.843 546.809C179.782 547.167 177.764 547.482 175.875 547.768C168.946 548.793 163.714 549.294 163.652 549.3C163.651 549.3 163.651 549.3 163.649 549.3C162.519 549.415 161.361 549.472 160.188 549.472C159.888 549.472 159.587 549.472 159.287 549.472C156.581 549.4 153.948 549.028 151.429 548.355C151.314 548.327 151.2 548.298 151.085 548.269C137.116 544.447 126.682 532.035 125.852 517.06C125.809 516.401 125.795 515.757 125.795 515.084C125.795 505.578 129.645 496.974 135.871 490.746C141.238 485.363 148.395 481.756 156.367 480.882C157.624 480.739 158.895 480.668 160.181 480.668C160.185 480.668 160.188 480.671 160.188 480.675Z",fill:"#FEAEA5"}),u.default.createElement("path",{d:"M191.119 509.673C193.495 509.673 195.413 512.092 195.413 515.084C195.413 518.077 193.495 520.482 191.119 520.482C190.877 520.482 190.861 520.186 191.077 520.077C192.647 519.282 193.753 517.343 193.753 515.084C193.753 512.826 192.647 510.876 191.077 510.079C190.866 509.971 190.883 509.673 191.119 509.673Z",fill:"#F7A69C"}),u.default.createElement("path",{d:"M274.264 433.275C274.6 433.189 274.954 433.278 275.199 433.524C296.217 454.568 295.682 514.893 295.68 515.097C295.68 515.103 295.68 515.092 295.68 515.098C295.682 515.302 296.217 575.643 275.184 596.673C274.939 596.917 274.586 597.007 274.251 596.921L267.076 595.097C255.454 592.134 246.437 582.986 243.646 571.318L239.925 555.699L238.994 551.819C238.638 550.318 238.133 548.86 237.499 547.48C237.314 547.078 237.398 546.602 237.715 546.294C245.845 538.394 250.903 527.342 250.903 515.098C250.903 502.851 245.844 491.798 237.711 483.897C237.396 483.591 237.311 483.119 237.493 482.719C238.122 481.341 238.638 479.89 238.994 478.376L239.81 474.983L243.646 458.877C246.437 447.21 255.454 438.061 267.076 435.112L274.264 433.275Z",fill:"#6E7174"}),u.default.createElement("path",{d:"M239.436 476.54C239.609 475.821 240.466 475.529 241.015 476.024C246.147 480.64 257.535 493.254 258.403 515.098C259.367 539.068 245.359 551.601 241.088 554.862C240.535 555.285 239.753 554.982 239.59 554.305L238.994 551.82C238.638 550.319 238.133 548.86 237.499 547.48C237.314 547.079 237.398 546.603 237.715 546.295C245.845 538.394 250.903 527.343 250.903 515.098C250.903 502.852 245.844 491.799 237.711 483.898C237.396 483.592 237.311 483.119 237.493 482.72C238.122 481.342 238.638 479.891 238.994 478.377L239.436 476.54Z",fill:"#555A5E"}),u.default.createElement("path",{d:"M162.007 550.079C167.945 550.079 174.609 548.865 179.507 547.741C180.642 547.481 180.435 545.695 179.275 545.595C171.872 544.959 160.808 542.941 155.401 536.678C149.594 529.951 156.114 524.486 156.114 515.6C156.114 507.554 149.704 500.044 155.401 493.265C160.661 487.005 170.034 484.976 177.145 484.392C178.342 484.293 178.605 482.241 177.431 481.993C172.848 481.025 167.193 480.126 162.007 480.126C137.322 480.126 125.686 489.718 125.686 515.6C125.686 539.171 137.2 550.079 162.007 550.079Z",fill:"#525252"})),u.default.createElement("rect",{x:"296",y:"577.273",width:"390",height:"25",rx:"3",transform:"rotate(-90 296 577.273)",fill:"#C1C1C1"}),u.default.createElement("rect",{x:"158",y:"433.273",width:"245",height:"25",rx:"3",transform:"rotate(-90 158 433.273)",fill:"#C1C1C1"}),u.default.createElement("rect",{x:"204",y:"433.273",width:"110",height:"25",rx:"3",transform:"rotate(-90 204 433.273)",fill:"#C1C1C1"}),u.default.createElement("rect",{x:"204",y:"303.274",width:"115",height:"25",rx:"3",transform:"rotate(-90 204 303.274)",fill:"#C1C1C1"}),u.default.createElement("rect",{x:"250",y:"433.273",width:"110",height:"25",rx:"3",transform:"rotate(-90 250 433.273)",fill:"#C1C1C1"}),u.default.createElement("rect",{x:"250",y:"303.274",width:"115",height:"25",rx:"3",transform:"rotate(-90 250 303.274)",fill:"#C1C1C1"}),u.default.createElement("rect",{x:"111.637",y:"433.637",width:"245",height:"25",rx:"3",transform:"rotate(-90 111.637 433.637)",fill:"#C1C1C1"}),u.default.createElement("g",{fillOpacity:2===g?x:0,style:{transition:"fill-opacity 0.2s linear"}},u.default.createElement("rect",{x:"200",y:"188",width:"33",height:"118",fill:b}),u.default.createElement("rect",{x:"108",y:"444",width:"171",height:"136",fill:b}),u.default.createElement("rect",{x:"108",y:"187",width:"33",height:"247",fill:b}),u.default.createElement("rect",{x:"293",y:"186",width:"31",height:"394",fill:b})),u.default.createElement("g",{fillOpacity:3===g?x:0,style:{transition:"fill-opacity 0.2s linear"}},u.default.createElement("rect",{x:"154",y:"185",width:"33",height:"249",fill:b}),u.default.createElement("rect",{x:"247",y:"322",width:"31",height:"113",rx:"5",fill:b})),u.default.createElement("g",{fillOpacity:g>=4?1:0,strokeOpacity:g>=4?1:0,style:{transition:"fill-opacity 0.2s linear, stroke-opacity 0.2s linear"}},u.default.createElement("rect",{x:"78.5",y:"171.5",width:"271",height:"426",rx:"2.5",stroke:b,strokeWidth:"5"}),u.default.createElement("circle",{cx:"214.5",cy:"383.5",r:"23.5",fill:b}),u.default.createElement("path",{d:"M203 385.263L208.793 392L227 376",stroke:"white",strokeWidth:"5",strokeLinecap:"round",strokeLinejoin:"round"}))),u.default.createElement("g",{id:"phone",clipPath:"url(#clip0_29_1778)",style:{transform:"translate(".concat(g<1?"40px":"0",", 0)"),transition:"transform 0.3s linear"}},u.default.createElement("rect",{x:"154",y:"693",width:"120",height:"5",rx:"2.5",fill:"#333343"}),u.default.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M372.869 156.244H373.495V156.241C376.342 156.241 378.647 158.551 378.647 161.396V234.788C378.647 237.637 376.339 239.944 373.495 239.944H372.869V677.09C372.869 698.895 355.203 716.571 333.411 716.571H94.2366C72.444 716.571 54.7781 698.895 54.7781 677.09V278.699H54.1523C51.3051 278.699 49 276.39 49 273.544V228.052C49 225.203 51.3082 222.897 54.1523 222.897H54.7781V212.047H54.1523C51.3051 212.047 49 209.737 49 206.892V161.399C49 158.551 51.3082 156.244 54.1523 156.244H54.7781V90.4813C54.7781 68.6761 72.444 51 94.2366 51H333.411C355.203 51 372.869 68.6761 372.869 90.4813V156.244ZM98.3077 60.7649H329.34C347.039 60.7649 361.387 75.1214 361.387 92.8311V674.734C361.387 692.444 347.039 706.8 329.34 706.8H98.3077C80.6082 706.8 66.26 692.444 66.26 674.734V92.8311C66.26 75.1214 80.6082 60.7649 98.3077 60.7649Z",fill:"#333343"}),u.default.createElement("rect",{x:"154",y:"71",width:"120",height:"20",rx:"10",fill:"#333343"})),u.default.createElement("defs",null,u.default.createElement("clipPath",{id:"clip0_29_1778"},u.default.createElement("rect",{width:"428",height:"747",fill:"white"}))))}var wm,Em,km,Tm,Mm,Im,Sm,Dm,Nm,Am,Lm,Rm,Om,Fm,jm,Pm,Bm,_m,Um,zm,Gm,Wm,Vm,$m,qm,Hm,Ym,Zm,Qm,Xm="".concat(Ra,"/WebSDK-Instruction-DL-Capture-3-Portrait.png"),Km=h.default.div(wm||(wm=w(["\n height: 100dvh;\n display: flex;\n flex-direction: column;\n background: ",";\n color: ",";\n"],["\n height: 100dvh;\n display: flex;\n flex-direction: column;\n background: ",";\n color: ",";\n"])),(function(e){var t,n,a,r;return null!==(r=null===(a=null===(n=null===(t=e.theme)||void 0===t?void 0:t.idCapture)||void 0===n?void 0:n.loadingOverlay)||void 0===a?void 0:a.backgroundColor)&&void 0!==r?r:"#ecedf3"}),(function(e){var t,n,a,r;return null!==(r=null===(a=null===(n=null===(t=e.theme)||void 0===t?void 0:t.idCapture)||void 0===n?void 0:n.loadingOverlay)||void 0===a?void 0:a.textColor)&&void 0!==r?r:"black"})),Jm=h.default.div(Em||(Em=w(["\n text-align: ",";\n display: flex;\n flex-direction: column;\n flex-wrap: nowrap;\n ","\n padding-bottom: 0;\n"],["\n text-align: ",";\n display: flex;\n flex-direction: column;\n flex-wrap: nowrap;\n ","\n padding-bottom: 0;\n"])),(function(e){var t;return null!==(t=e.theme.textAlign)&&void 0!==t?t:"center"}),(function(e){return e.theme.padding?"box-sizing: border-box; padding: ".concat(e.theme.padding,";"):""})),eg=h.default(lm)(km||(km=w(["\n padding: 16px 24px;\n margin-top: 16px;\n font-size: 18px;\n font-weight: bold;\n background: white;\n box-shadow:\n 0 1px 3px 0 rgb(0 0 0 / 0.1),\n 0 1px 2px -1px rgb(0 0 0 / 0.1);\n"],["\n padding: 16px 24px;\n margin-top: 16px;\n font-size: 18px;\n font-weight: bold;\n background: white;\n box-shadow:\n 0 1px 3px 0 rgb(0 0 0 / 0.1),\n 0 1px 2px -1px rgb(0 0 0 / 0.1);\n"]))),tg=h.default($)(Tm||(Tm=w(["\n padding: 0 0 100px;\n\n & > svg {\n height: 100%;\n }\n"],["\n padding: 0 0 100px;\n\n & > svg {\n height: 100%;\n }\n"]))),ng=h.default.div(Mm||(Mm=w(["\n position: fixed;\n bottom: 120px;\n width: 100dvw;\n display: flex;\n"],["\n position: fixed;\n bottom: 120px;\n width: 100dvw;\n display: flex;\n"]))),ag=h.default(lm)(Im||(Im=w(["\n padding: 12px 18px;\n margin: 0 auto;\n font-size: 14px;\n font-weight: bold;\n background: white;\n box-shadow:\n 0 1px 3px 0 rgb(0 0 0 / 0.1),\n 0 1px 2px -1px rgb(0 0 0 / 0.1);\n"],["\n padding: 12px 18px;\n margin: 0 auto;\n font-size: 14px;\n font-weight: bold;\n background: white;\n box-shadow:\n 0 1px 3px 0 rgb(0 0 0 / 0.1),\n 0 1px 2px -1px rgb(0 0 0 / 0.1);\n"]))),rg=h.default.input(Sm||(Sm=w(["\n margin-right: 8px;\n"],["\n margin-right: 8px;\n"]))),ig=h.default(ym)(Dm||(Dm=w(["\n display: flex;\n flex-direction: row;\n padding: 15px 25px;\n height: 100px;\n color: ",";\n ","\n position: fixed;\n bottom: 0;\n left: 0;\n width: 100dvw;\n box-sizing: border-box;\n"],["\n display: flex;\n flex-direction: row;\n padding: 15px 25px;\n height: 100px;\n color: ",";\n ","\n position: fixed;\n bottom: 0;\n left: 0;\n width: 100dvw;\n box-sizing: border-box;\n"])),(function(e){var t,n,a,r;return null!==(r=null===(a=null===(n=null===(t=e.theme)||void 0===t?void 0:t.selfieCapture)||void 0===n?void 0:n.loadingOverlay)||void 0===a?void 0:a.progressBarTextColor)&&void 0!==r?r:"white"}),(function(e){var t,n,a,r,i,o;return(null===(a=null===(n=null===(t=e.theme)||void 0===t?void 0:t.idCapture)||void 0===n?void 0:n.loadingOverlay)||void 0===a?void 0:a.progressBarFontSize)?"font-size: ".concat(null===(o=null===(i=null===(r=e.theme)||void 0===r?void 0:r.idCapture)||void 0===i?void 0:i.loadingOverlay)||void 0===o?void 0:o.progressBarFontSize,";"):""})),og=h.default.div(Nm||(Nm=w(["\n display: flex;\n position: relative;\n z-index: 2;\n"],["\n display: flex;\n position: relative;\n z-index: 2;\n"]))),sg=h.default.ul(Am||(Am=w(["\n display: block;\n margin: auto;\n list-style: none;\n padding: 0;\n"],["\n display: block;\n margin: auto;\n list-style: none;\n padding: 0;\n"]))),lg=h.default.li(Lm||(Lm=w(["\n display: inline-flex;\n justify-content: center;\n align-items: center;\n padding: 2px 1.25rem 2px 0;\n line-height: 1rem;\n\n &::before {\n content: '';\n display: inline-block;\n height: 1rem;\n min-width: 1rem;\n vertical-align: middle;\n background-size: cover;\n background-repeat: no-repeat;\n margin: auto 0.5rem auto 0;\n }\n\n &.done::before {\n background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBjbGlwLXBhdGg9InVybCgjY2xpcDBfNDlfMzg1KSI+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xMiAyNEMxOC42Mjc0IDI0IDI0IDE4LjYyNzQgMjQgMTJDMjQgNS4zNzI1OCAxOC42Mjc0IDAgMTIgMEM1LjM3MjU4IDAgMCA1LjM3MjU4IDAgMTJDMCAxOC42Mjc0IDUuMzcyNTggMjQgMTIgMjRaTTE5LjU2NDMgOC4yNzg1MkMxOS45NTQ5IDcuODg3OTkgMTkuOTU0OSA3LjI1NDgzIDE5LjU2NDMgNi44NjQzQzE5LjE3MzggNi40NzM3OCAxOC41NDA2IDYuNDczNzggMTguMTUwMSA2Ljg2NDNMOS40Mjg2NiAxNS41ODU4TDUuODUwMDUgMTIuMDA3MkM1LjQ1OTUzIDExLjYxNjYgNC44MjYzNiAxMS42MTY2IDQuNDM1ODQgMTIuMDA3MkM0LjA0NTMxIDEyLjM5NzcgNC4wNDUzMSAxMy4wMzA5IDQuNDM1ODQgMTMuNDIxNEw4LjcyMTU1IDE3LjcwNzFDOS4xMTIwOCAxOC4wOTc2IDkuNzQ1MjQgMTguMDk3NiAxMC4xMzU4IDE3LjcwNzFMMTkuNTY0MyA4LjI3ODUyWiIgZmlsbD0id2hpdGUiLz48L2c+PGRlZnM+PGNsaXBQYXRoIGlkPSJjbGlwMF80OV8zODUiPjxyZWN0IHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgZmlsbD0id2hpdGUiLz48L2NsaXBQYXRoPjwvZGVmcz48L3N2Zz4=');\n }\n\n &.running::before {\n background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBjbGlwLXBhdGg9InVybCgjY2xpcDBfNDlfMzcwKSI+PG1hc2sgaWQ9InBhdGgtMS1pbnNpZGUtMV80OV8zNzAiIGZpbGw9IndoaXRlIj48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTMuNTE0NzIgMjAuNDg1NUM4LjIwMTAxIDI1LjE3MTggMTUuNzk5IDI1LjE3MTggMjAuNDg1MyAyMC40ODU1QzI1LjE3MTYgMTUuNzk5MiAyNS4xNzE2IDguMjAxMTkgMjAuNDg1MyAzLjUxNDlDMTUuNzk5IC0xLjE3MTM5IDguMjAxMDEgLTEuMTcxMzkgMy41MTQ3MiAzLjUxNDlDLTEuMTcxNTcgOC4yMDExOSAtMS4xNzE1NyAxNS43OTkyIDMuNTE0NzIgMjAuNDg1NVoiLz48L21hc2s+PHBhdGggZD0iTTYuMzk4MTQgMTEuNDU5QzUuODQ1ODYgMTEuNDU5IDUuMzk4MTQgMTEuOTA2NyA1LjM5ODE0IDEyLjQ1OUM1LjM5ODE0IDEzLjAxMTIgNS44NDU4NiAxMy40NTkgNi4zOTgxNCAxMy40NTlWMTEuNDU5Wk0xNy42MDE5IDEzLjQ1OUMxOC4xNTQxIDEzLjQ1OSAxOC42MDE5IDEzLjAxMTIgMTguNjAxOSAxMi40NTlDMTguNjAxOSAxMS45MDY3IDE4LjE1NDEgMTEuNDU5IDE3LjYwMTkgMTEuNDU5VjEzLjQ1OVpNNi4zOTgxNCAxMy40NTlIMTcuNjAxOVYxMS40NTlINi4zOTgxNFYxMy40NTlaTTMuNTE0NzIgMjAuNDg1NUw0LjkyODkzIDE5LjA3MTNMNC45Mjg5MyAxOS4wNzEzTDMuNTE0NzIgMjAuNDg1NVpNMjAuNDg1MyAzLjUxNDlMMTkuMDcxMSA0LjkyOTEyTDE5LjA3MTEgNC45MjkxMkwyMC40ODUzIDMuNTE0OVpNMy41MTQ3MiAzLjUxNDlMNC45Mjg5MyA0LjkyOTEyTDQuOTI4OTMgNC45MjkxMkwzLjUxNDcyIDMuNTE0OVpNMTkuMDcxMSAxOS4wNzEzQzE1LjE2NTggMjIuOTc2NSA4LjgzNDE3IDIyLjk3NjUgNC45Mjg5MyAxOS4wNzEzTDIuMTAwNTEgMjEuODk5N0M3LjU2Nzg0IDI3LjM2NyAxNi40MzIyIDI3LjM2NyAyMS44OTk1IDIxLjg5OTdMMTkuMDcxMSAxOS4wNzEzWk0xOS4wNzExIDQuOTI5MTJDMjIuOTc2MyA4LjgzNDM2IDIyLjk3NjMgMTUuMTY2IDE5LjA3MTEgMTkuMDcxM0wyMS44OTk1IDIxLjg5OTdDMjcuMzY2OCAxNi40MzIzIDI3LjM2NjggNy41NjgwMyAyMS44OTk1IDIuMTAwNjlMMTkuMDcxMSA0LjkyOTEyWk00LjkyODkzIDQuOTI5MTJDOC44MzQxNyAxLjAyMzg3IDE1LjE2NTggMS4wMjM4NyAxOS4wNzExIDQuOTI5MTJMMjEuODk5NSAyLjEwMDY5QzE2LjQzMjIgLTMuMzY2NjUgNy41Njc4NCAtMy4zNjY2NSAyLjEwMDUxIDIuMTAwNjlMNC45Mjg5MyA0LjkyOTEyWk00LjkyODkzIDE5LjA3MTNDMS4wMjM2OSAxNS4xNjYgMS4wMjM2OSA4LjgzNDM2IDQuOTI4OTMgNC45MjkxMkwyLjEwMDUxIDIuMTAwNjlDLTMuMzY2ODMgNy41NjgwMyAtMy4zNjY4MyAxNi40MzIzIDIuMTAwNTEgMjEuODk5N0w0LjkyODkzIDE5LjA3MTNaIiBmaWxsPSJ3aGl0ZSIgbWFzaz0idXJsKCNwYXRoLTEtaW5zaWRlLTFfNDlfMzcwKSIvPjwvZz48ZGVmcz48Y2xpcFBhdGggaWQ9ImNsaXAwXzQ5XzM3MCI+PHJlY3Qgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiBmaWxsPSJ3aGl0ZSIvPjwvY2xpcFBhdGg+PC9kZWZzPjwvc3ZnPg==');\n }\n"],["\n display: inline-flex;\n justify-content: center;\n align-items: center;\n padding: 2px 1.25rem 2px 0;\n line-height: 1rem;\n\n &::before {\n content: '';\n display: inline-block;\n height: 1rem;\n min-width: 1rem;\n vertical-align: middle;\n background-size: cover;\n background-repeat: no-repeat;\n margin: auto 0.5rem auto 0;\n }\n\n &.done::before {\n background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBjbGlwLXBhdGg9InVybCgjY2xpcDBfNDlfMzg1KSI+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xMiAyNEMxOC42Mjc0IDI0IDI0IDE4LjYyNzQgMjQgMTJDMjQgNS4zNzI1OCAxOC42Mjc0IDAgMTIgMEM1LjM3MjU4IDAgMCA1LjM3MjU4IDAgMTJDMCAxOC42Mjc0IDUuMzcyNTggMjQgMTIgMjRaTTE5LjU2NDMgOC4yNzg1MkMxOS45NTQ5IDcuODg3OTkgMTkuOTU0OSA3LjI1NDgzIDE5LjU2NDMgNi44NjQzQzE5LjE3MzggNi40NzM3OCAxOC41NDA2IDYuNDczNzggMTguMTUwMSA2Ljg2NDNMOS40Mjg2NiAxNS41ODU4TDUuODUwMDUgMTIuMDA3MkM1LjQ1OTUzIDExLjYxNjYgNC44MjYzNiAxMS42MTY2IDQuNDM1ODQgMTIuMDA3MkM0LjA0NTMxIDEyLjM5NzcgNC4wNDUzMSAxMy4wMzA5IDQuNDM1ODQgMTMuNDIxNEw4LjcyMTU1IDE3LjcwNzFDOS4xMTIwOCAxOC4wOTc2IDkuNzQ1MjQgMTguMDk3NiAxMC4xMzU4IDE3LjcwNzFMMTkuNTY0MyA4LjI3ODUyWiIgZmlsbD0id2hpdGUiLz48L2c+PGRlZnM+PGNsaXBQYXRoIGlkPSJjbGlwMF80OV8zODUiPjxyZWN0IHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgZmlsbD0id2hpdGUiLz48L2NsaXBQYXRoPjwvZGVmcz48L3N2Zz4=');\n }\n\n &.running::before {\n background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBjbGlwLXBhdGg9InVybCgjY2xpcDBfNDlfMzcwKSI+PG1hc2sgaWQ9InBhdGgtMS1pbnNpZGUtMV80OV8zNzAiIGZpbGw9IndoaXRlIj48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTMuNTE0NzIgMjAuNDg1NUM4LjIwMTAxIDI1LjE3MTggMTUuNzk5IDI1LjE3MTggMjAuNDg1MyAyMC40ODU1QzI1LjE3MTYgMTUuNzk5MiAyNS4xNzE2IDguMjAxMTkgMjAuNDg1MyAzLjUxNDlDMTUuNzk5IC0xLjE3MTM5IDguMjAxMDEgLTEuMTcxMzkgMy41MTQ3MiAzLjUxNDlDLTEuMTcxNTcgOC4yMDExOSAtMS4xNzE1NyAxNS43OTkyIDMuNTE0NzIgMjAuNDg1NVoiLz48L21hc2s+PHBhdGggZD0iTTYuMzk4MTQgMTEuNDU5QzUuODQ1ODYgMTEuNDU5IDUuMzk4MTQgMTEuOTA2NyA1LjM5ODE0IDEyLjQ1OUM1LjM5ODE0IDEzLjAxMTIgNS44NDU4NiAxMy40NTkgNi4zOTgxNCAxMy40NTlWMTEuNDU5Wk0xNy42MDE5IDEzLjQ1OUMxOC4xNTQxIDEzLjQ1OSAxOC42MDE5IDEzLjAxMTIgMTguNjAxOSAxMi40NTlDMTguNjAxOSAxMS45MDY3IDE4LjE1NDEgMTEuNDU5IDE3LjYwMTkgMTEuNDU5VjEzLjQ1OVpNNi4zOTgxNCAxMy40NTlIMTcuNjAxOVYxMS40NTlINi4zOTgxNFYxMy40NTlaTTMuNTE0NzIgMjAuNDg1NUw0LjkyODkzIDE5LjA3MTNMNC45Mjg5MyAxOS4wNzEzTDMuNTE0NzIgMjAuNDg1NVpNMjAuNDg1MyAzLjUxNDlMMTkuMDcxMSA0LjkyOTEyTDE5LjA3MTEgNC45MjkxMkwyMC40ODUzIDMuNTE0OVpNMy41MTQ3MiAzLjUxNDlMNC45Mjg5MyA0LjkyOTEyTDQuOTI4OTMgNC45MjkxMkwzLjUxNDcyIDMuNTE0OVpNMTkuMDcxMSAxOS4wNzEzQzE1LjE2NTggMjIuOTc2NSA4LjgzNDE3IDIyLjk3NjUgNC45Mjg5MyAxOS4wNzEzTDIuMTAwNTEgMjEuODk5N0M3LjU2Nzg0IDI3LjM2NyAxNi40MzIyIDI3LjM2NyAyMS44OTk1IDIxLjg5OTdMMTkuMDcxMSAxOS4wNzEzWk0xOS4wNzExIDQuOTI5MTJDMjIuOTc2MyA4LjgzNDM2IDIyLjk3NjMgMTUuMTY2IDE5LjA3MTEgMTkuMDcxM0wyMS44OTk1IDIxLjg5OTdDMjcuMzY2OCAxNi40MzIzIDI3LjM2NjggNy41NjgwMyAyMS44OTk1IDIuMTAwNjlMMTkuMDcxMSA0LjkyOTEyWk00LjkyODkzIDQuOTI5MTJDOC44MzQxNyAxLjAyMzg3IDE1LjE2NTggMS4wMjM4NyAxOS4wNzExIDQuOTI5MTJMMjEuODk5NSAyLjEwMDY5QzE2LjQzMjIgLTMuMzY2NjUgNy41Njc4NCAtMy4zNjY2NSAyLjEwMDUxIDIuMTAwNjlMNC45Mjg5MyA0LjkyOTEyWk00LjkyODkzIDE5LjA3MTNDMS4wMjM2OSAxNS4xNjYgMS4wMjM2OSA4LjgzNDM2IDQuOTI4OTMgNC45MjkxMkwyLjEwMDUxIDIuMTAwNjlDLTMuMzY2ODMgNy41NjgwMyAtMy4zNjY4MyAxNi40MzIzIDIuMTAwNTEgMjEuODk5N0w0LjkyODkzIDE5LjA3MTNaIiBmaWxsPSJ3aGl0ZSIgbWFzaz0idXJsKCNwYXRoLTEtaW5zaWRlLTFfNDlfMzcwKSIvPjwvZz48ZGVmcz48Y2xpcFBhdGggaWQ9ImNsaXAwXzQ5XzM3MCI+PHJlY3Qgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiBmaWxsPSJ3aGl0ZSIvPjwvY2xpcFBhdGg+PC9kZWZzPjwvc3ZnPg==');\n }\n"]))),ug=h.default.div(Rm||(Rm=w(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n"],["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n"]))),dg=h.default.div(Om||(Om=w(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: ",";\n opacity: ",";\n"],["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: ",";\n opacity: ",";\n"])),(function(e){var t,n,a,r;return null!==(r=null===(a=null===(n=null===(t=e.theme)||void 0===t?void 0:t.idCapture)||void 0===n?void 0:n.loadingOverlay)||void 0===a?void 0:a.progressBarBackgroundColor)&&void 0!==r?r:"var(--idm-color-positive-600)"}),(function(e){var t,n,a,r;return null!==(r=null===(a=null===(n=null===(t=e.theme)||void 0===t?void 0:t.idCapture)||void 0===n?void 0:n.loadingOverlay)||void 0===a?void 0:a.progressBarBackgroundOpacity)&&void 0!==r?r:.75})),cg=h.default.span(Fm||(Fm=w(["\n display: block;\n width: ","%;\n height: 100%;\n"],["\n display: block;\n width: ","%;\n height: 100%;\n"])),(function(e){return e.$progress})),fg=h.default.span(jm||(jm=w(["\n display: block;\n height: 100%;\n background: ",";\n animation: progressBar 3s ease-in-out;\n animation-fill-mode: both;\n\n @keyframes progressBar {\n 0% {\n width: 0;\n }\n 100% {\n width: 100%;\n }\n }\n"],["\n display: block;\n height: 100%;\n background: ",";\n animation: progressBar 3s ease-in-out;\n animation-fill-mode: both;\n\n @keyframes progressBar {\n 0% {\n width: 0;\n }\n 100% {\n width: 100%;\n }\n }\n"])),(function(e){var t,n,a,r;return null!==(r=null===(a=null===(n=null===(t=e.theme)||void 0===t?void 0:t.idCapture)||void 0===n?void 0:n.loadingOverlay)||void 0===a?void 0:a.progressBarIndicatorColor)&&void 0!==r?r:"var(--idm-color-positive-600)"})),hg=h.default.img(Pm||(Pm=w([""],[""]))),pg=h.default.div(Bm||(Bm=w(["\n display: flex;\n"],["\n display: flex;\n"]))),mg=h.default(ce)(_m||(_m=w(["\n margin: auto;\n white-space: nowrap;\n ","\n ","\n"],["\n margin: auto;\n white-space: nowrap;\n ","\n ","\n"])),(function(e){var t,n,a,r,i,o;return(null===(a=null===(n=null===(t=e.theme)||void 0===t?void 0:t.idCapture)||void 0===n?void 0:n.loadingOverlay)||void 0===a?void 0:a.progressBarFontSize)?"font-size: ".concat(null===(o=null===(i=null===(r=e.theme)||void 0===r?void 0:r.idCapture)||void 0===i?void 0:i.loadingOverlay)||void 0===o?void 0:o.progressBarFontSize,";"):""}),(function(e){var t,n,a,r,i,o;return(null===(a=null===(n=null===(t=e.theme)||void 0===t?void 0:t.idCapture)||void 0===n?void 0:n.loadingOverlay)||void 0===a?void 0:a.continueBtnBorder)?"border: ".concat(null===(o=null===(i=null===(r=e.theme)||void 0===r?void 0:r.idCapture)||void 0===i?void 0:i.loadingOverlay)||void 0===o?void 0:o.continueBtnBorder,";"):""})),gg=h.default.div(Um||(Um=w(["\n margin-top: 15px;\n margin-bottom: 15px;\n"],["\n margin-top: 15px;\n margin-bottom: 15px;\n"]))),vg=h.default.input(zm||(zm=w(["\n margin-right: 8px;\n"],["\n margin-right: 8px;\n"]))),yg={default:function(e){var n,a,r,i,o=e.onDismissed,s=e.onUserCancel,l=e.instructions,d=e.rotateImage,c=void 0!==d&&d,f=e.assets,h=void 0===f?{}:f,p=e.classNames,m=void 0===p?{}:p,g=e.colors,v=void 0===g?{}:g,y=e.verbiage,b=void 0===y?{}:y,x=t.useContext(uh),C=x.ready,w=x.modelDownloadProgress,E=t.useContext(Xe),k=E.cameraReady,T=E.cameraAccessDenied,M=E.iphoneContinuityCameraAvailable,I=E.setIphoneContinuityCameraAllowed,S=t.useState(!1),D=S[0],N=S[1];h.instructionImageUrl||(h.instructionImageUrl=Xm);var A=Xp(b,{headingText:"Use your device camera to capture your ID",useContinuityCameraText:"Use your iPhone as a webcam",downloadingText:"Downloading...",modelsWarmingUpText:"Loading guided capture experience...",modelsReadyText:"Guided capture experience ready",cameraInitializingText:"Camera initializing...",cameraInitializedText:"Camera ready",continueText:"Let's Go!"});t.useEffect((function(){if(C&&k)return function(){return null};var e=setTimeout((function(){N(!1)}),500);return function(){clearTimeout(e)}}),[k,C]);var L=t.useRef(null);if(D)return u.default.createElement(u.default.Fragment,null);if(T)return u.default.createElement(cm,{assets:h.cameraAccessDenied,classNames:m.cameraAccessDenied,colors:v.cameraAccessDenied,verbiage:b.cameraAccessDenied});var R={};if(c){var O=null!==(a=null===(n=L.current)||void 0===n?void 0:n.naturalWidth)&&void 0!==a?a:0,F=null!==(i=null===(r=L.current)||void 0===r?void 0:r.naturalHeight)&&void 0!==i?i:0;R={transform:"rotate(-90deg) scale(".concat(O>F?F/O:1,")")}}return u.default.createElement(W,{className:m.container},u.default.createElement(Km,{className:m.inner},u.default.createElement(Jm,null,u.default.createElement(eg,{className:m.heading},A.headingText)),s&&u.default.createElement(vm,{onClick:s,className:m.cancelBtn}),u.default.createElement(tg,{className:m.imageContainer,style:{pointerEvents:"none"}},(null==h?void 0:h.instructionImageUrl)&&h.instructionImageUrl!==Xm?u.default.createElement(hg,{ref:L,alt:A.headingText,src:h.instructionImageUrl,className:m.image,style:R}):u.default.createElement(bm,{className:m.image})),l,u.default.createElement(ng,{className:m.continuityCameraCheckboxContainer},M&&u.default.createElement(ag,{className:m.continuityCameraCheckboxInner},u.default.createElement(rg,{className:m.continuityCameraCheckbox,id:"use-continuity-camera",type:"checkbox",defaultChecked:!0,onChange:function(e){I(e.target.checked)}}),u.default.createElement("label",{htmlFor:"use-continuity-camera",className:m.continuityCameraCheckboxLabel},A.useContinuityCameraText))),u.default.createElement(ig,{className:m.buttonsRow},u.default.createElement(ug,{className:m.progressContainer},u.default.createElement(dg,{className:m.progressBackground}),u.default.createElement(cg,{$progress:w,className:m.progressBar},u.default.createElement(fg,{className:m.progressIndicator}))),u.default.createElement(og,{className:m.loadingListContainer},u.default.createElement(sg,{className:m.loadingList},u.default.createElement(lg,{className:"".concat(m.loadingListItem," ").concat(k?"done":"running")},k?A.cameraInitializedText:A.cameraInitializingText),u.default.createElement(lg,{className:"".concat(m.loadingListItem," ").concat(C?"done":"running")},C?A.modelsReadyText:w>=100?A.modelsWarmingUpText:"".concat(A.downloadingText," (").concat(w,"%)")))),u.default.createElement(pg,{className:m.continueBtnContainer},C&&k&&u.default.createElement(mg,{finished:!0,className:m.continueBtn,variant:"positive",colors:v.continueBtn,onClick:function(){N(!0),null==o||o()}},A.continueText)))))},legacy:function(e){var n,a,r,i,o=e.onDismissed,s=e.onUserCancel,l=e.instructions,d=e.rotateImage,c=void 0!==d&&d,f=e.assets,h=void 0===f?{}:f,p=e.classNames,m=void 0===p?{}:p,g=e.colors,v=void 0===g?{}:g,y=e.verbiage,b=void 0===y?{}:y,x=t.useContext(uh),C=x.ready,w=x.modelDownloadProgress,E=t.useContext(Xe),k=E.cameraReady,T=E.cameraAccessDenied,M=E.iphoneContinuityCameraAvailable,I=E.setIphoneContinuityCameraAllowed,S=t.useState(!1),D=S[0],N=S[1];h.instructionImageUrl||(h.instructionImageUrl="".concat(Ra,"/WebSDK-Instruction-DL-Capture-3-Portrait.png"));var A=Xp(b,{headingText:"Use your device camera to capture your ID",useContinuityCameraText:"Use your iPhone as a webcam",downloadingText:"Downloading...",modelsWarmingUpText:"Models warming up...",cameraInitializingText:"Camera initializing...",continueText:"Continue"});t.useEffect((function(){if(C&&k)return function(){return null};var e=setTimeout((function(){N(!1)}),500);return function(){clearTimeout(e)}}),[k,C]);var L=t.useRef(null);if(D)return u.default.createElement(u.default.Fragment,null);if(T)return u.default.createElement(cm,{assets:h.cameraAccessDenied,classNames:m.cameraAccessDenied,colors:v.cameraAccessDenied,verbiage:b.cameraAccessDenied});var R={};if(c){var O=null!==(a=null===(n=L.current)||void 0===n?void 0:n.naturalWidth)&&void 0!==a?a:0,F=null!==(i=null===(r=L.current)||void 0===r?void 0:r.naturalHeight)&&void 0!==i?i:0;R={transform:"rotate(-90deg) scale(".concat(O>F?F/O:1,")")}}return u.default.createElement(W,{className:m.container},u.default.createElement(V,{className:m.inner},u.default.createElement("h3",{className:m.heading},A.headingText),s&&u.default.createElement(vm,{onClick:s,className:m.cancelBtn}),u.default.createElement($,{className:m.imageContainer,style:{pointerEvents:"none"}},u.default.createElement("img",{ref:L,alt:A.headingText,src:h.instructionImageUrl,className:m.image,style:R})),l,u.default.createElement(gg,{className:m.continuityCameraCheckboxContainer},M&&u.default.createElement(u.default.Fragment,null,u.default.createElement(vg,{className:m.continuityCameraCheckbox,id:"use-continuity-camera",type:"checkbox",defaultChecked:!0,onChange:function(e){I(e.target.checked)}}),u.default.createElement("label",{htmlFor:"use-continuity-camera",className:m.continuityCameraCheckboxLabel},A.useContinuityCameraText))),u.default.createElement(ce,{className:m.continueBtn,variant:"positive",disabled:!k||!C,finished:C&&k,colors:v.continueBtn,onClick:function(){N(!0),null==o||o()}},k&&C?A.continueText:C?A.cameraInitializingText:w>=100?A.modelsWarmingUpText:"".concat(A.downloadingText," (").concat(w,"%)"))))}},bg=function(e){var t,n=e.mode,a=void 0===n?"default":n,r=y(e,["mode"]),i=null!==(t=yg[a])&&void 0!==t?t:yg.default;return u.default.createElement(i,v({},r))},xg=function(e){var n=e.alt,a=e.className,r=e.image,i=t.useState(r.imageData),o=i[0],s=i[1],l=t.useState(!1),d=l[0],c=l[1],f=r.boundingBox,h=t.useRef(null);return u.default.createElement("img",{ref:h,alt:n,className:a,src:o,onLoad:function(){f&&!d&&(c(!0),setTimeout((function(){s(Fa(h.current,f).toDataURL("image/jpeg",.95))}),100))}})},Cg=h.default.p(Gm||(Gm=w(["\n font-size: 18px;\n margin: 30px 0;\n"],["\n font-size: 18px;\n margin: 30px 0;\n"]))),wg=function(e){var n=e.capturedDocuments,a=e.onSubmitClick,r=e.onRetryClick,i=e.classNames,o=void 0===i?{}:i,s=e.colors,l=void 0===s?{}:s,d=e.verbiage,c=void 0===d?{}:d,f=t.useContext(Ie).submissionStatus,h=n.idCardFront,p=n.idCardBack,m=n.passport,g=Xp(c,{headingText:"ID Capture Successful",idCardFrontText:"ID Card Front",idCardBackText:"ID Card Back",passportText:"Passport",instructionText:"Verify the entire ID was captured clearly with no glare.",retryText:"Retry",submittingText:"Submitting...",submitText:"Done"});return u.default.createElement(W,{className:o.container},u.default.createElement(V,{className:o.inner},u.default.createElement(kg,{className:o.imageContainer},u.default.createElement(Tg,{className:o.imageRow},u.default.createElement(Eg,{className:o.heading},g.headingText),h&&u.default.createElement(Mg,{className:o.imageCol},u.default.createElement(Ig,{className:o.imageHeading},g.idCardFrontText),u.default.createElement(Sg,{className:o.imageWrapper},u.default.createElement(Dg,{image:h,className:o.image,alt:g.idCardFrontText}))),p&&u.default.createElement(Mg,{className:o.imageCol},u.default.createElement(Ig,{className:o.imageHeading},g.idCardBackText),u.default.createElement(Sg,{className:o.imageWrapper},u.default.createElement(Dg,{image:p,className:o.image,alt:g.idCardBackText}))),m&&u.default.createElement(Mg,{className:o.imageCol},u.default.createElement(Ig,{className:o.imageHeading},g.passportText),u.default.createElement(Sg,{className:o.imageWrapper},u.default.createElement(Dg,{image:m,className:o.image,alt:g.passportText}))))),u.default.createElement(Cg,{className:o.instruction},g.instructionText),u.default.createElement(ym,{className:o.buttonsRow},u.default.createElement(ce,{className:o.retryBtn,variant:"warning",onClick:r,colors:l.retryBtn,finished:!0},g.retryText),u.default.createElement(ce,{className:o.submitBtn,variant:"positive",onClick:a,disabled:f===k.SUBMITTING,colors:l.doneBtn,finished:!0},f===k.SUBMITTING?g.submittingText:g.submitText))))},Eg=h.default.h1(Wm||(Wm=w(["\n margin-bottom: 12px;\n"],["\n margin-bottom: 12px;\n"]))),kg=h.default($)(Vm||(Vm=w(["\n overflow-y: auto;\n"],["\n overflow-y: auto;\n"]))),Tg=h.default(q)($m||($m=w(["\n flex-direction: column;\n"],["\n flex-direction: column;\n"]))),Mg=h.default.div(qm||(qm=w(["\n max-height: none !important;\n"],["\n max-height: none !important;\n"]))),Ig=h.default.h3(Hm||(Hm=w(["\n text-align: left;\n margin-top: 24px;\n margin-bottom: 8px;\n font-size: 16px;\n font-weight: normal;\n"],["\n text-align: left;\n margin-top: 24px;\n margin-bottom: 8px;\n font-size: 16px;\n font-weight: normal;\n"]))),Sg=h.default.div(Ym||(Ym=w(["\n border: 1px solid\n ",";\n border-radius: 6px;\n padding: 4px;\n background: white;\n display: flex;\n"],["\n border: 1px solid\n ",";\n border-radius: 6px;\n padding: 4px;\n background: white;\n display: flex;\n"])),(function(e){var t,n,a;return null!==(a=null===(n=null===(t=e.theme.idCapture)||void 0===t?void 0:t.success)||void 0===n?void 0:n.imageBorderColor)&&void 0!==a?a:"var(--idm-color-primary-400)"})),Dg=h.default(xg)(Zm||(Zm=w(["\n width: 100%;\n border-radius: 4px;\n"],["\n width: 100%;\n border-radius: 4px;\n"]))),Ng=function(e){var n,a=e.className,r=t.useContext(Xe),i=r.videoRef,o=r.setVideoLoaded,s=r.cameraRef;t.useEffect((function(){o(!1)}),[o]),t.useEffect((function(){var e;i.current&&(null===(e=s.current)||void 0===e?void 0:e.stream)&&(i.current.srcObject=s.current.stream)}),[s,i]);var l=t.useCallback((function(){o(!0)}),[o]);return u.default.createElement(Ag,{className:a,autoPlay:!0,playsInline:!0,muted:!0,ref:i,onLoadedData:l,$isRearFacing:null===(n=s.current)||void 0===n?void 0:n.isRearFacing})},Ag=h.default.video(Qm||(Qm=w(["\n transform: ",";\n min-width: 100%;\n min-height: 100%;\n width: auto;\n height: auto;\n max-width: 100%;\n max-height: 100%;\n object-fit: cover;\n background: black;\n z-index: -2;\n"],["\n transform: ",";\n min-width: 100%;\n min-height: 100%;\n width: auto;\n height: auto;\n max-width: 100%;\n max-height: 100%;\n object-fit: cover;\n background: black;\n z-index: -2;\n"])),(function(e){return e.$isRearFacing?"":"scaleX(-1)"}));function Lg(e,n,a){var r=this,i=t.useState(!1),o=i[0],s=i[1];return t.useEffect((function(){n&&e&&("function"==typeof e?b(r,void 0,void 0,(function(){return x(this,(function(t){switch(t.label){case 0:return[4,e()];case 1:return t.sent()?null==a||a():s(!0),[2]}}))})):null==a||a())}),[n,a,e]),!e||o}var Rg,Og=h.default.div(Rg||(Rg=w(["\n ","\n"],["\n ","\n"])),(function(e){return"snapToGuides"===e.$mode?"display: flex;\n position: absolute;\n left: ".concat(e.$x,"px;\n top: ").concat(e.$y,"px;\n width: ").concat(e.$w,"px;\n height: ").concat(e.$h,"px;"):""}));function Fg(e,t,n){var a,r=1;"undefined"!=typeof window&&(r=window.devicePixelRatio),e.width=t*r,e.height=n*r,e.style.width=t+"px",e.style.height=n+"px",null===(a=e.getContext("2d"))||void 0===a||a.scale(r,r)}function jg(e){e.width=0,e.height=0,e.style.width="0",e.style.height="0"}var Pg,Bg,_g,Ug,zg,Gg,Wg,Vg,$g,qg,Hg,Yg,Zg=t.createContext({orientation:"landscape",wrapperWidth:1,wrapperHeight:1,wrapperAspectRatio:0,imageAspectRatio:0,wrapperRef:null,setDimensions:function(){return null},onImageLoaded:function(){return null}}),Qg=h.default(B)(Pg||(Pg=w(["\n z-index: 1000;\n"],["\n z-index: 1000;\n"]))),Xg=h.default.div(Bg||(Bg=w(["\n display: flex;\n flex-flow: column nowrap;\n width: 100%;\n height: 100%;\n"],["\n display: flex;\n flex-flow: column nowrap;\n width: 100%;\n height: 100%;\n"]))),Kg=h.default.div(_g||(_g=w(["\n position: relative;\n display: flex;\n flex-flow: row nowrap;\n align-items: center;\n justify-items: center;\n box-sizing: border-box;\n max-width: 100%;\n max-height: 100%;\n"],["\n position: relative;\n display: flex;\n flex-flow: row nowrap;\n align-items: center;\n justify-items: center;\n box-sizing: border-box;\n max-width: 100%;\n max-height: 100%;\n"]))),Jg=h.default.div(Ug||(Ug=w(["\n display: flex;\n flex-direction: column;\n justify-content: end;\n width: 100%;\n height: 100%;\n flex-grow: 1;\n position: relative;\n z-index: 1000;\n background: ",";\n color: ",";\n text-align: center;\n ","\n ","\n"],["\n display: flex;\n flex-direction: column;\n justify-content: end;\n width: 100%;\n height: 100%;\n flex-grow: 1;\n position: relative;\n z-index: 1000;\n background: ",";\n color: ",";\n text-align: center;\n ","\n ","\n"])),(function(e){var t,n,a,r,i;return null!==(i=null!==(t=e.$maskColor)&&void 0!==t?t:null===(r=null===(a=null===(n=e.theme)||void 0===n?void 0:n.idCapture)||void 0===a?void 0:a.guideOverlay)||void 0===r?void 0:r.backgroundColor)&&void 0!==i?i:"rgba(0, 0, 0, 0.5)"}),(function(e){var t,n,a,r;return null!==(r=null===(a=null===(n=null===(t=e.theme)||void 0===t?void 0:t.idCapture)||void 0===n?void 0:n.guideOverlay)||void 0===a?void 0:a.textColor)&&void 0!==r?r:"white"}),(function(e){return e.$minWidth?"min-width: ".concat(e.$minWidth,"px;"):""}),(function(e){return e.$minHeight?"min-width: ".concat(e.$minHeight,"px;"):""})),ev=h.default.div(zg||(zg=w(["\n ","\n ","\n box-sizing: border-box;\n"],["\n ","\n ","\n box-sizing: border-box;\n"])),(function(e){return e.$minWidth?"min-width: ".concat(e.$minWidth,"px;"):""}),(function(e){return e.$isMirrored?"transform: scaleX(-1);":""})),tv=h.default.div(Gg||(Gg=w(["\n box-sizing: border-box;\n position: relative;\n border: ",";\n"],["\n box-sizing: border-box;\n position: relative;\n border: ",";\n"])),(function(e){var t,n;return"".concat(null!==(t=e.$borderWidth)&&void 0!==t?t:4,"px solid ").concat(null!==(n=e.$borderColor)&&void 0!==n?n:"white")})),nv=h.default.span(Wg||(Wg=w(["\n align-content: center;\n margin-top: 12px;\n margin-bottom: 12px;\n"],["\n align-content: center;\n margin-top: 12px;\n margin-bottom: 12px;\n"]))),av=h.default.img(Vg||(Vg=w(["\n position: relative;\n z-index: 1;\n display: block;\n padding: ","px;\n box-sizing: border-box;\n ","\n ","\n opacity: ",";\n transition: opacity 0.5s;\n"],["\n position: relative;\n z-index: 1;\n display: block;\n padding: ","px;\n box-sizing: border-box;\n ","\n ","\n opacity: ",";\n transition: opacity 0.5s;\n"])),(function(e){return e.$padding}),(function(e){return e.$width?"width: ".concat(e.$width,"px;\n max-width: ").concat(e.$width,"px;"):"max-width: none;"}),(function(e){return e.$height?"height: ".concat(e.$height,"px;\n max-height: ").concat(e.$height,"px;"):"max-height: none;"}),(function(e){return e.$visible?1:0})),rv=function(e){var n,a,i,o,s,l,d,c,f,h,p,m,g=e.classNames,v=void 0===g?{}:g,y=e.width,b=void 0===y?0:y,x=e.height,C=void 0===x?0:x,w=e.padding,E=e.imagePadding,k=e.imageVisible,T=void 0===k||k,M=e.borderWidth,I=e.borderColor,S=e.maskColor,D=e.isMirrored,N=void 0!==D&&D,A=e.instruction,L=void 0===A?"":A,R=e.portraitGuidesImageUrl,O=e.landscapeGuidesImageUrl,F=e.onClick,j=t.useContext(Zg),P=j.orientation,B=j.wrapperRef,_=j.wrapperWidth,U=j.wrapperHeight,z=j.imageAspectRatio,G=j.wrapperAspectRatio,W=j.onImageLoaded,V=j.setDimensions,$=Ih()[1];var q=r.useTheme();void 0===M&&(M=null!==(i=null===(a=null===(n=q.idCapture)||void 0===n?void 0:n.guideBox)||void 0===a?void 0:a.borderWidth)&&void 0!==i?i:4),0==b&&(b=_),0==C&&(C=U),t.useEffect((function(){V({width:b,height:C})}),[C,V,b]);var H=(null!=w?w:En())?null!==(l=null===(s=null===(o=q.idCapture)||void 0===o?void 0:o.guideBox)||void 0===s?void 0:s.mobilePadding)&&void 0!==l?l:0:null!==(f=null===(c=null===(d=q.idCapture)||void 0===d?void 0:d.guideBox)||void 0===c?void 0:c.desktopPadding)&&void 0!==f?f:50,Y=2*H+2*M,Z="portrait"===P?R:O,Q=null!==(m=null!=E?E:null===(p=null===(h=q.idCapture)||void 0===h?void 0:h.guideBox)||void 0===p?void 0:p.imagePadding)&&void 0!==m?m:0,X=void 0,K=void 0;return z>=G?X=_-Y:K=U-Y,u.default.createElement(Qg,{ref:B,onClick:F,className:v.container},u.default.createElement(Xg,{className:v.inner},u.default.createElement(Jg,{$maskColor:S,$minHeight:H,className:iv(v,"Top")},""!==L&&u.default.createElement(nv,{className:v.guideText},L)),u.default.createElement(Kg,{className:v.centerRow},u.default.createElement(Jg,{$maskColor:S,$minWidth:H,className:iv(v,"Left")}),u.default.createElement(ev,{$minWidth:X,$isMirrored:N,className:v.centerRegion},u.default.createElement(tv,{$borderWidth:M,$borderColor:I,className:v.centerRegionInner},u.default.createElement(av,{src:Z,alt:"",onLoad:function(e){W(e);var t=e.target;$({type:"guideImageLoaded",payload:{width:t.naturalWidth,height:t.naturalHeight}})},className:v.image,$width:X,$height:K,$padding:Q,$visible:T}))),u.default.createElement(Jg,{$maskColor:S,$minWidth:H,className:iv(v,"Right")})),u.default.createElement(Jg,{$maskColor:S,$minHeight:H,className:iv(v,"Bottom")},""!==L&&u.default.createElement(nv,{style:{opacity:0}},L))))},iv=function(e,t){return[e.dimmingRegion,e["dimmingRegion".concat(t)]].filter((function(e){return e})).join(" ")},ov=h.default(av)($g||($g=w(["\n backface-visibility: hidden;\n transform-style: preserve-3d;\n position: relative;\n top: 0;\n left: 0;\n transition: transform ","s;\n transform: ",";\n"],["\n backface-visibility: hidden;\n transform-style: preserve-3d;\n position: relative;\n top: 0;\n left: 0;\n transition: transform ","s;\n transform: ",";\n"])),(function(e){return e.$transitionTime}),(function(e){return e.$transforms})),sv=h.default(ov)(qg||(qg=w(["\n position: absolute;\n"],["\n position: absolute;\n"]))),lv=function(e){var n,a,i,o,s,l,d,c,f,h,p,m,g,v=e.padding,y=e.imagePadding,b=e.borderWidth,x=e.borderColor,C=e.maskColor,w=e.assets,E=void 0===w?{}:w,k=e.classNames,T=void 0===k?{}:k,M=e.verbiage,I=void 0===M?{}:M,S=Le(),D=S.ref,N=S.width,A=void 0===N?1:N,L=S.height,R=void 0===L?1:L,O=t.useContext(Xe).cameraRef,F=r.useTheme();E.frontPortraitGuidesImageUrl||(E.frontPortraitGuidesImageUrl="".concat(Ra,"/Shieldout-IDCard-Front-SVG-Portrait-2.svg")),E.frontLandscapeGuidesImageUrl||(E.frontLandscapeGuidesImageUrl="".concat(Ra,"/Shieldout-IDCard-Front-SVG-Landscape-2.svg")),E.backPortraitGuidesImageUrl||(E.backPortraitGuidesImageUrl="".concat(Ra,"/Shieldout-IDCard-Back-SVG-Portrait-2.svg")),E.backLandscapeGuidesImageUrl||(E.backLandscapeGuidesImageUrl="".concat(Ra,"/Shieldout-IDCard-Back-SVG-Landscape-2.svg"));var j=Qp(I.instructionText,"Please flip your ID card..."),P=(null!=v?v:En())?null!==(i=null===(a=null===(n=F.idCapture)||void 0===n?void 0:n.guideBox)||void 0===a?void 0:a.mobilePadding)&&void 0!==i?i:0:null!==(l=null===(s=null===(o=F.idCapture)||void 0===o?void 0:o.guideBox)||void 0===s?void 0:s.desktopPadding)&&void 0!==l?l:50;void 0===b&&(b=null!==(f=null===(c=null===(d=F.idCapture)||void 0===d?void 0:d.guideBox)||void 0===c?void 0:c.borderWidth)&&void 0!==f?f:4);var _=!(null===(h=O.current)||void 0===h?void 0:h.isRearFacing),U=t.useContext(Zg),z=U.orientation,G=U.wrapperRef,W=U.wrapperWidth,V=U.wrapperHeight,$=U.imageAspectRatio,q=U.wrapperAspectRatio,H=U.onImageLoaded,Y=U.setDimensions;t.useEffect((function(){Y({width:A,height:R})}),[R,Y,A]);var Z=2*P+2*b,Q=null!==(g=null!=y?y:null===(m=null===(p=F.idCapture)||void 0===p?void 0:p.guideBox)||void 0===m?void 0:m.imagePadding)&&void 0!==g?g:0,X=void 0,K=void 0;$>=q?X=W-Z:K=V-Z;var J=t.useState(1),ee=J[0],te=J[1],ne=t.useState(0),ae=ne[0],re=ne[1],ie=["rotateY(".concat(ae,"deg)")];_&&ie.push("scaleX(-1)");var oe=["rotateY(".concat(180-ae,"deg)")];return _&&oe.push("scaleX(-1)"),t.useEffect((function(){var e=function(){te(1),re(180),setTimeout((function(){te(0),re(0)}),1500)};setTimeout(e,250);var t=setInterval(e,2500);return function(){clearInterval(t)}}),[]),u.default.createElement(B,{ref:D,className:T.container},u.default.createElement(Xg,{ref:G,className:T.inner},u.default.createElement(Jg,{$minHeight:P,$maskColor:C,className:uv(T,"Top")},""!==j&&u.default.createElement(nv,{className:T.guideText},j)),u.default.createElement(Kg,{className:T.centerRow},u.default.createElement(Jg,{$minWidth:P,$maskColor:C,className:uv(T,"Left")}),u.default.createElement(ev,null,u.default.createElement(tv,{$borderWidth:b,$borderColor:x,className:T.centerRegion},u.default.createElement(ov,{src:"portrait"===z?E.frontPortraitGuidesImageUrl:E.frontLandscapeGuidesImageUrl,alt:"",className:T.image,$width:X,$height:K,$padding:Q,$transitionTime:ee,$transforms:ie.join(" "),$visible:!0,onLoad:H}),u.default.createElement(sv,{src:"portrait"===z?E.backPortraitGuidesImageUrl:E.backLandscapeGuidesImageUrl,alt:"",className:T.image,$width:X,$height:K,$padding:Q,$transitionTime:ee,$transforms:oe.join(" "),$visible:!0}))),u.default.createElement(Jg,{$minWidth:P,$maskColor:C,className:uv(T,"Right")})),u.default.createElement(Jg,{$minHeight:P,$maskColor:C,className:uv(T,"Bottom")},""!==j&&u.default.createElement(nv,{style:{opacity:0}},j))))},uv=function(e,t){return[e.dimmingRegion,e["dimmingRegion".concat(t)]].filter((function(e){return e})).join(" ")},dv=function(e){var n,a,i,o,s,l,d,c,f,h,p,m,g=e.aspectRatio,v=e.maskColor,y=e.borderRadius,b=void 0===y?33:y,x=e.borderColor,C=e.borderWidth,w=e.padding,E=e.imageUrl,k=e.imageVisible,T=e.frontImageUrl,M=e.backImageUrl,I=e.isMirrored,S=e.instruction,D=e.requestingFlip,N=void 0!==D&&D,A=e.classNames,L=void 0===A?{}:A,R=Ih(),O=R[0],F=O.redrawing,j=O.guideImageWidth,P=O.guideImageHeight,B=R[1],_=t.useRef(null),U=Le(),z=U.ref,G=U.width,W=void 0===G?1:G,V=U.height,$=void 0===V?1:V,q=r.useTheme();return void 0===C&&(C=null!==(i=null===(a=null===(n=q.idCapture)||void 0===n?void 0:n.guideBox)||void 0===a?void 0:a.borderWidth)&&void 0!==i?i:4),void 0===w&&(w=En()?null!==(l=null===(s=null===(o=q.idCapture)||void 0===o?void 0:o.guideBox)||void 0===s?void 0:s.mobilePadding)&&void 0!==l?l:0:null!==(f=null===(c=null===(d=q.idCapture)||void 0===d?void 0:d.guideBox)||void 0===c?void 0:c.desktopPadding)&&void 0!==f?f:0),void 0===g&&0!==j&&(g=j/P),void 0===v&&(v=null!==(m=null===(p=null===(h=q.idCapture)||void 0===h?void 0:h.guideOverlay)||void 0===p?void 0:p.backgroundColor)&&void 0!==m?m:"#708090"),t.useEffect((function(){var e=_.current;if(e){if(F)return jg(e),void setTimeout((function(){B({type:"redrawInProgress"})}),10);var t=W-2*w-2*C,n=$-2*w-2*C,a=[w+C,w+C,t,n],r=a[0],i=a[1],o=a[2],s=a[3];if(void 0!==g){var l=n*g;l<t?r+=(t-(o=l))/2:i+=(n-(s=t/g))/2}Fg(e,W,$);var u=e.getContext("2d");if(u)u.fillStyle=v,u.clearRect(0,0,W,$),u.fillRect(0,0,W,$),u.beginPath(),u.roundRect(r,i,o,s,b),u.lineWidth=C,u.strokeStyle=null!=x?x:"white",(null==x?void 0:x.startsWith("var("))&&(u.strokeStyle=getComputedStyle(document.documentElement).getPropertyValue(x.slice(4,-1))),u.stroke(),u.fillStyle="rgba(0,0,0,1)",u.globalCompositeOperation="destination-out",u.fill(),u.globalCompositeOperation="source-over",B({type:"redrawCompleted",payload:{guideRectX:r,guideRectY:i,guideRectWidth:o,guideRectHeight:s,guideRectOffsetTop:e.offsetTop}})}}),[g,x,b,C,B,v,w,F,$,W]),u.default.createElement(u.default.Fragment,null,u.default.createElement(cv,{ref:z,$maskColor:v,className:L.canvasWrapper},u.default.createElement(fv,{ref:_,className:L.canvas})),N?u.default.createElement(lv,{maskColor:"transparent",borderWidth:0,classNames:L,assets:{frontLandscapeGuidesImageUrl:T,backLandscapeGuidesImageUrl:M}}):u.default.createElement(rv,{landscapeGuidesImageUrl:E,maskColor:"transparent",borderWidth:0,isMirrored:I,instruction:S,classNames:L,imageVisible:k}))},cv=h.default.div(Hg||(Hg=w(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n flex-grow: 1;\n background-clip: padding-box;\n box-shadow: inset 0 0 0 2px ",";\n z-index: -1;\n"],["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n flex-grow: 1;\n background-clip: padding-box;\n box-shadow: inset 0 0 0 2px ",";\n z-index: -1;\n"])),(function(e){return e.$maskColor})),fv=h.default.canvas(Yg||(Yg=w(["\n display: block;\n"],["\n display: block;\n"])));function hv(e){var n,a,r=e.guideType,i=void 0===r?"fit":r,o=e.portraitGuidesOnMobile,s=void 0!==o&&o,l=e.requestingFlip,d=void 0!==l&&l,c=e.flipIdPromptAssets,f=void 0===c?{}:c,h=e.classNames,p=void 0===h?{}:h,m=e.assets,g=void 0===m?{}:m,v=e.colors,y=void 0===v?{}:v,b=e.verbiage,x=void 0===b?{}:b,C=Ih()[0],w=t.useContext(Xe).cameraRef,E=Xp(x,{instructionText:"Scan the front of ID",processingIdCardText:"ID card front captured.",capturingText:"Capturing...",captureFailedText:"Capture failed!",guidanceSatisfiedText:"Document detected, hold still...",guidanceTooBlurryText:"Document out of focus – try improving the lighting",guidanceNotCenteredText:"Document is not centered",guidanceNotDetectedText:"Document not detected"}),k=window.innerWidth<window.innerHeight,T=s&&k?null==f?void 0:f.frontPortraitGuidesImageUrl:null==f?void 0:f.frontLandscapeGuidesImageUrl,M=s&&k?null==f?void 0:f.backPortraitGuidesImageUrl:null==f?void 0:f.backLandscapeGuidesImageUrl;return u.default.createElement(u.default.Fragment,null,"overlay"===i&&u.default.createElement(rv,{classNames:p,width:C.pageWidth,height:C.pageHeight,instruction:C.captureFailed?E.captureFailedText:C.capturing?null==E?void 0:E.capturingText:E.instructionText,portraitGuidesImageUrl:g.portraitGuidesImageUrl,landscapeGuidesImageUrl:g.landscapeGuidesImageUrl,isMirrored:!(null===(n=w.current)||void 0===n?void 0:n.isRearFacing),borderColor:C.isGoodFrame?y.guideBoxSatisfiedColor:y.guideBoxUnsatisfiedColor,imageVisible:d||!C.documentDetectionThresholdMet||!C.documentInBounds||C.documentTooClose}),"fit"===i&&u.default.createElement(dv,{classNames:p,requestingFlip:d,instruction:C.captureFailed?E.captureFailedText:C.capturing?null==E?void 0:E.capturingText:E.instructionText,imageUrl:s&&k?null==g?void 0:g.portraitGuidesImageUrl:null==g?void 0:g.landscapeGuidesImageUrl,frontImageUrl:T,backImageUrl:M,isMirrored:!(null===(a=w.current)||void 0===a?void 0:a.isRearFacing),borderColor:C.isGoodFrame?y.guideBoxSatisfiedColor:y.guideBoxUnsatisfiedColor,imageVisible:d||!C.documentDetectionThresholdMet||!C.documentInBounds||C.documentTooClose}))}var pv,mv,gv,vv,yv,bv,xv,Cv,wv,Ev,kv,Tv,Mv,Iv,Sv,Dv,Nv,Av,Lv,Rv,Ov,Fv,jv,Pv,Bv,_v,Uv,zv,Gv,Wv,Vv,$v=h.default.div(pv||(pv=w(["\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: lds-dual-ring 1.2s linear infinite;\n box-sizing: content-box;\n }\n\n @keyframes lds-dual-ring {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\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: lds-dual-ring 1.2s linear infinite;\n box-sizing: content-box;\n }\n\n @keyframes lds-dual-ring {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n }\n"])),(function(e){var t=e.$size;return null!=t?t:80}),(function(e){var t=e.$size;return null!=t?t:80}),(function(e){var t=e.$size;return(null!=t?t:80)-16}),(function(e){var t=e.$size;return(null!=t?t:80)-16}),(function(e){var t=e.$thickness;return null!=t?t:6}),(function(e){var t=e.$color;return null!=t?t:"#888"}),(function(e){var t=e.$color;return null!=t?t:"#888"}),(function(e){var t=e.$color;return null!=t?t:"#888"})),qv=function(e){var n=e.classNames,a=void 0===n?{}:n,r=e.text,i=e.imageUrl,o=t.useRef(null),s=t.useState(!1),l=s[0],d=s[1],c=t.useState(0),f=c[1];return u.default.createElement(Zv,{className:a.container,style:{aspectRatio:c[0],opacity:l?1:0}},r&&u.default.createElement(Qv,{className:a.text},r),u.default.createElement(Xv,{className:a.imageContainer},u.default.createElement("img",{ref:o,src:i,alt:"",className:a.image,onLoad:function(){f(o.current.naturalWidth/o.current.naturalHeight),d(!0)},onError:function(){console.error("failed to load image from url",i)}})))},Hv=function(e){var n=e.classNames,a=void 0===n?{}:n,r=e.text,i=e.imageUrl,o=t.useRef(null),s=t.useState(!1),l=s[0],d=s[1],c=t.useState(0),f=c[1];return u.default.createElement(Zv,{className:a.container,style:{aspectRatio:c[0],opacity:l?1:0}},u.default.createElement(Qv,{className:a.text},u.default.createElement(Yv,{className:a.spinner,$size:24,$color:"white",$thickness:3}),r),u.default.createElement(Xv,{className:a.imageContainer},u.default.createElement("img",{ref:o,src:i,alt:"",className:a.image,onLoad:function(){f(o.current.naturalWidth/o.current.naturalHeight),d(!0)},onError:function(){console.error("failed to load image from url",i)}})))},Yv=h.default($v)(mv||(mv=w(["\n position: relative;\n top: 4px;\n left: -3px;\n margin: 0 3px 0 -12px;\n"],["\n position: relative;\n top: 4px;\n left: -3px;\n margin: 0 3px 0 -12px;\n"]))),Zv=h.default.div(gv||(gv=w(["\n position: absolute;\n display: flex;\n flex-direction: column;\n height: 33%;\n bottom: 12px;\n right: 12px;\n"],["\n position: absolute;\n display: flex;\n flex-direction: column;\n height: 33%;\n bottom: 12px;\n right: 12px;\n"]))),Qv=h.default.div(vv||(vv=w(["\n display: block;\n position: absolute;\n top: -32px;\n font:\n 14px -apple-system,\n BlinkMacSystemFont,\n 'Segoe UI',\n Roboto,\n Helvetica,\n Arial,\n sans-serif,\n 'Apple Color Emoji',\n 'Segoe UI Emoji',\n 'Segoe UI Symbol';\n color: white;\n text-align: center;\n margin: 0 auto;\n width: 100%;\n"],["\n display: block;\n position: absolute;\n top: -32px;\n font:\n 14px -apple-system,\n BlinkMacSystemFont,\n 'Segoe UI',\n Roboto,\n Helvetica,\n Arial,\n sans-serif,\n 'Apple Color Emoji',\n 'Segoe UI Emoji',\n 'Segoe UI Symbol';\n color: white;\n text-align: center;\n margin: 0 auto;\n width: 100%;\n"]))),Xv=h.default.div(yv||(yv=w(["\n position: relative;\n height: calc(100% - 8px);\n padding: 4px;\n border-radius: 4px;\n background: white;\n\n & > img {\n border-radius: 4px;\n width: auto;\n max-height: 100%;\n }\n"],["\n position: relative;\n height: calc(100% - 8px);\n padding: 4px;\n border-radius: 4px;\n background: white;\n\n & > img {\n border-radius: 4px;\n width: auto;\n max-height: 100%;\n }\n"]))),Kv={documents:[],currentDocumentIndex:0,initialDrawComplete:!1,redrawing:!1,capturing:!1,rectX:0,rectY:0,rectWidth:0,rectHeight:0,rectOffsetTop:0,uploadCapturedDocument:function(){return Promise.resolve()}},Jv=t.createContext(Kv),ey=t.createContext((function(){})),ty=function(e,t){var n,a,r,i,o;switch(t.type){case"setDocuments":return v(v({},e),{documents:t.payload,currentDocumentIndex:0});case"setHooks":return v(v({},e),t.payload);case"redrawRequested":return v(v({},e),{redrawing:!0,rectX:0,rectY:0,rectWidth:0,rectHeight:0,rectOffsetTop:0});case"redrawInProgress":return v(v({},e),{redrawing:!1,rectX:0,rectY:0,rectWidth:0,rectHeight:0,rectOffsetTop:0});case"redrawCompleted":return v(v(v({},e),t.payload),{initialDrawComplete:!0});case"captureRequested":return v(v({},e),{capturing:!0});case"captureCompleted":return(s=v(v({},e),{capturing:!1})).documents[l=e.currentDocumentIndex].content=t.payload.content,s.documents[l].contentUrl=t.payload.contentUrl,null===(n=e.onDocumentCaptured)||void 0===n||n.call(e,s.documents[l]),s;case"retryCapture":return(s=v({},e)).documents[l=e.currentDocumentIndex].content=void 0,s.documents[l].contentUrl=void 0,s;case"uploadStarted":return(s=v({},e)).documents[l=e.currentDocumentIndex].uploadState="in_progress",s;case"uploadCompleted":return(s=v({},e)).documents[l=e.currentDocumentIndex].documentId=t.payload.documentId,s.documents[l].uploadState="succeeded",null===(r=(a=s.documents[l]).onUploaded)||void 0===r||r.call(a,s.documents[l]),null===(i=e.onDocumentUploaded)||void 0===i||i.call(e,s.documents[l]),e.documents.length-1>l?s.currentDocumentIndex+=1:null===(o=e.onAllDocumentsUploaded)||void 0===o||o.call(e,s.documents),s;case"uploadFailed":var s,l;return(s=v({},e)).documents[l=e.currentDocumentIndex].uploadState="failed",s;default:return e}},ny=function(e){var n=e.documents,a=void 0===n?[]:n,r=e.aspectRatio,i=e.cameraFeedMode,o=e.instructions,s=e.onDocumentCaptured,l=e.onDocumentUploaded,d=e.onAllDocumentsUploaded,c=e.children,f=t.useReducer(ty,Kv),h=f[0],p=f[1],m=t.useContext(Xe),g=m.cameraRef,y=m.videoRef,C=t.useContext(Ie).uploadDocument,w=t.useCallback((function(e){return b(void 0,void 0,void 0,(function(){var t;return x(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),p({type:"uploadStarted"}),[4,C(e)];case 1:return t=n.sent(),setTimeout((function(){p({type:"uploadCompleted",payload:{documentId:t}})}),0),[3,3];case 2:return n.sent(),p({type:"uploadFailed"}),[3,3];case 3:return[2]}}))}))}),[C]);t.useEffect((function(){var e,t=(null==a?void 0:a.length)?a.map((function(e){return v(v({title:"Document Capture",aspectRatio:r,cameraFeedMode:"snapToGuides",instructions:o},e),{uploadState:"not_started"})})):[{title:"Document Capture",aspectRatio:r,cameraFeedMode:null!=i?i:"snapToGuides",instructions:o,uploadState:"not_started"}];p({type:"setDocuments",payload:t}),(null===(e=t[0])||void 0===e?void 0:e.content)&&w(t[0].content)}),[r,i,a,o,w]),t.useEffect((function(){p({type:"setHooks",payload:{onDocumentCaptured:s,onDocumentUploaded:l,onAllDocumentsUploaded:d}})}),[s,d,l]);var E=yh((function(){p({type:"redrawRequested"})}),500);t.useLayoutEffect((function(){if("undefined"!=typeof window)return window.addEventListener("resize",E),function(){window.removeEventListener("resize",E)}}),[E]);var k=y.current;t.useEffect((function(){if(h.capturing&&g.current)if("undefined"!=typeof ImageCapture)new ImageCapture(g.current.stream.getTracks()[0]).takePhoto().then(t).catch((function(){}));else if(k){var e=document.createElement("canvas");Ue(e,k),e.toBlob(t)}function t(e){if(e){var t=URL.createObjectURL(e);p({type:"captureCompleted",payload:{content:e,contentUrl:t}})}}}),[g,h.capturing,k]);var T=t.useMemo((function(){return v(v({},h),{uploadCapturedDocument:w})}),[h,w]);return u.default.createElement(Jv.Provider,{value:T},u.default.createElement(ey.Provider,{value:p},c))},ay=function(){var e=t.useContext(Jv),n=t.useContext(ey);if(!e||!n)throw new Error("useDocumentCaptureState cannot be used without DocumentCaptureStateProvider");return[e,n]},ry=function(e){var n,a,i,o,s,l,d,c,f,h=e.aspectRatio,p=e.borderRadius,m=void 0===p?25:p,g=e.borderColor,v=e.borderWidth,y=e.maskColor,b=e.padding,x=e.classNames,C=void 0===x?{}:x,w=Le(),E=w.ref,k=w.width,T=void 0===k?1:k,M=w.height,I=void 0===M?1:M,S=ay(),D=S[0].redrawing,N=S[1],A=t.useRef(null),L=r.useTheme();return void 0===v&&(v=null!==(i=null===(a=null===(n=L.documentCapture)||void 0===n?void 0:n.guideBox)||void 0===a?void 0:a.borderWidth)&&void 0!==i?i:4),void 0===b&&(b=En()?null!==(l=null===(s=null===(o=L.documentCapture)||void 0===o?void 0:o.guideBox)||void 0===s?void 0:s.mobilePadding)&&void 0!==l?l:0:null!==(f=null===(c=null===(d=L.documentCapture)||void 0===d?void 0:d.guideBox)||void 0===c?void 0:c.desktopPadding)&&void 0!==f?f:0),t.useEffect((function(){var e=A.current;if(e){if(D)return jg(e),void setTimeout((function(){N({type:"redrawInProgress"})}),10);var t=T-2*b-2*v,n=I-2*b-2*v,a=[b+v,b+v,t,n],r=a[0],i=a[1],o=a[2],s=a[3];if(void 0!==h){var l=n*h;l<t?r+=(t-(o=l))/2:i+=(n-(s=t/h))/2}Fg(e,T,I);var u=e.getContext("2d");if(u)u.fillStyle=y,u.clearRect(0,0,T,I),u.fillRect(0,0,T,I),u.beginPath(),u.roundRect(r,i,o,s,m),u.lineWidth=v,u.strokeStyle=null!=g?g:"white",u.stroke(),u.fillStyle="rgba(0,0,0,1)",u.globalCompositeOperation="destination-out",u.fill(),u.globalCompositeOperation="source-over",N({type:"redrawCompleted",payload:{rectX:r,rectY:i,rectWidth:o,rectHeight:s,rectOffsetTop:e.offsetTop}})}}),[h,g,m,v,N,y,b,D,I,T]),u.default.createElement(iy,{ref:E,className:C.container,$maskColor:y},u.default.createElement(oy,{ref:A}))},iy=h.default.div(bv||(bv=w(["\n flex-grow: 1;\n background-clip: padding-box;\n box-shadow: inset 0 0 0 2px ",";\n"],["\n flex-grow: 1;\n background-clip: padding-box;\n box-shadow: inset 0 0 0 2px ",";\n"])),(function(e){return e.$maskColor})),oy=h.default.canvas(xv||(xv=w(["\n display: block;\n"],["\n display: block;\n"]))),sy=function(e){var n,a,i,o,s,l=e.onCaptureClicked,d=e.classNames,c=void 0===d?{}:d,f=e.verbiage,h=void 0===f?{}:f,p=ay(),m=p[0],g=m.rectX,v=m.rectY,y=m.rectWidth,C=m.rectHeight,w=m.rectOffsetTop,E=m.capturing,k=m.uploadCapturedDocument,T=p[1],M=null!==(n=m.documents[m.currentDocumentIndex])&&void 0!==n?n:{},I=M.title,S=M.aspectRatio,D=M.cameraFeedMode,N=M.instructions,A=M.contentUrl,L=M.content,R=M.uploadState,O=t.useContext(Xe),F=O.cameraReady,j=O.cameraAccessDenied,P=O.retryCameraAccess,_=null!==(o=null===(i=null===(a=r.useTheme().documentCapture)||void 0===a?void 0:a.guideBox)||void 0===i?void 0:i.maskColor)&&void 0!==o?o:"snapToGuides"===D?"#708090":"rgba(0, 0, 0, 0.5)",U=Xp(h,{headingText:I,loadingBtnText:"Camera initializing...",retryCameraAccessBtnText:"Retry",captureBtnText:"Capture",capturingBtnText:"Capturing...",retryCaptureBtnText:"Retry capture",uploadBtnText:"Upload",uploadingBtnText:"Uploading...",retryUploadBtnText:"Retry",successBtnText:"Upload succeeded!"});function z(){return b(this,void 0,void 0,(function(){return x(this,(function(e){switch(e.label){case 0:return[4,k(L)];case 1:return e.sent(),[2]}}))}))}return u.default.createElement(B,{className:"flex ".concat(null!==(s=c.container)&&void 0!==s?s:"")},u.default.createElement(Og,{className:c.cameraFeedWrapper,$mode:null!=D?D:"snapToGuides",$x:g,$y:v+w,$w:y,$h:C},A?u.default.createElement(py,{alt:"",src:A,className:c.previewImage}):u.default.createElement(Ng,{className:c.cameraFeed})),u.default.createElement(ly,{className:c.captureContainer},u.default.createElement(uy,{$maskColor:_,className:c.headingRow},u.default.createElement(dy,{className:c.heading},U.headingText)),u.default.createElement(ry,{aspectRatio:S,classNames:c,maskColor:_}),u.default.createElement(cy,{$maskColor:_,className:c.footerRow},N&&u.default.createElement(fy,{className:c.instructions},N),u.default.createElement(hy,{className:c.buttonsRow},j?u.default.createElement(ce,{className:c.retryCameraAccessBtn,variant:"negative",finished:!0,onClick:P},U.retryCameraAccessBtnText):A?u.default.createElement(u.default.Fragment,null,"not_started"===R?u.default.createElement(u.default.Fragment,null,u.default.createElement(ce,{className:c.retryCaptureBtn,finished:!0,variant:"warning",onClick:function(){T({type:"retryCapture"})}},U.retryCaptureBtnText),u.default.createElement(ce,{className:c.uploadBtn,finished:!0,variant:"positive",onClick:z},U.uploadBtnText)):u.default.createElement(ce,{className:c.uploadProgressBtn,finished:"in_progress"!==R,variant:"failed"===R?"negative":"positive",onClick:z,disabled:["in_progress","succeeded"].includes(null!=R?R:"")},"succeeded"===R?U.successBtnText:"failed"===R?U.retryUploadBtnText:U.uploadingBtnText)):u.default.createElement(ce,{className:c.captureBtn,finished:F,variant:"primary",onClick:function(){T({type:"captureRequested"}),null==l||l()},disabled:!F||E},F?E?U.capturingBtnText:U.captureBtnText:U.loadingBtnText)))))},ly=h.default.div(Cv||(Cv=w(["\n display: flex;\n flex-direction: column;\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: var(--app-height);\n"],["\n display: flex;\n flex-direction: column;\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: var(--app-height);\n"]))),uy=h.default.div(wv||(wv=w(["\n background: ",";\n text-align: center;\n color: white;\n"],["\n background: ",";\n text-align: center;\n color: white;\n"])),(function(e){return e.$maskColor})),dy=h.default.h1(Ev||(Ev=w(["\n font-size: 22px;\n"],["\n font-size: 22px;\n"]))),cy=h.default.div(kv||(kv=w(["\n background: ",";\n display: flex;\n flex-direction: column;\n justify-content: center;\n padding: 0 20px 20px;\n height: auto;\n color: white;\n"],["\n background: ",";\n display: flex;\n flex-direction: column;\n justify-content: center;\n padding: 0 20px 20px;\n height: auto;\n color: white;\n"])),(function(e){return e.$maskColor})),fy=h.default.div(Tv||(Tv=w(["\n max-height: ",";\n overflow-y: auto;\n"],["\n max-height: ",";\n overflow-y: auto;\n"])),(function(e){var t,n,a;return null!==(a=null===(n=null===(t=e.theme.documentCapture)||void 0===t?void 0:t.instructions)||void 0===n?void 0:n.maxHeight)&&void 0!==a?a:"8rem"})),hy=h.default(ym)(Mv||(Mv=w(["\n padding-top: 20px;\n"],["\n padding-top: 20px;\n"]))),py=h.default.img(Iv||(Iv=w(["\n width: 100%;\n height: 100%;\n object-fit: cover;\n"],["\n width: 100%;\n height: 100%;\n object-fit: cover;\n"]))),my=function(e){var t=e.documents,n=e.classNames,a=e.verbiage;return u.default.createElement(ny,{documents:void 0===t?[]:t,aspectRatio:e.aspectRatio,cameraFeedMode:e.cameraFeedMode,instructions:e.instructions,onDocumentCaptured:e.onDocumentCaptured,onDocumentUploaded:e.onDocumentUploaded,onAllDocumentsUploaded:e.onSuccess},u.default.createElement(sy,{classNames:void 0===n?{}:n,verbiage:void 0===a?{}:a}))},gy=function(e){var n=e.idCaptureRequirement,a=void 0===n?"idCardOrPassport":n,r=e.onCapture,i=e.onFinished,o=e.classNames,s=void 0===o?{}:o,l=e.colors,d=void 0===l?{}:l,c=e.verbiage,f=void 0===c?{}:c,h=t.useRef(null),p=t.useState([]),m=p[0],g=p[1],v=function(e){return"idCardOrPassport"===e?2:Ch(e)}(a),y=Ch(a),b="idCard"===a?"ID card":"passport"===a?"passport":"idCardOrPassport"===a?"ID card or passport":"ID card and passport",x="idCard"===a||"idCardAndPassport"===a?"Please capture the front of your ID card.":"passport"===a?"Please capture the ID page of your passport.":"Please capture the front of your ID card, or the ID page of your passport.",w="idCardOrPassport"===a?"Please capture the back of your ID card, or click Done if submitting a passport.":"Please capture the back of your ID card.",E=Xp(f,{headingText:"We're having some trouble.",descriptionText:"On-device capture guidance failed, please capture ".concat(y>1?"photos":" a photo"," of your ").concat(b," manually."),firstInstructionText:x,secondInstructionText:w,thirdInstructionText:"Please capture the ID page of your passport.",captureBtnText:"Capture",captureMoreBtnText:"Capture ".concat(2===m.length?"ID page of passport":"back of ID card"),doneBtnText:"Done"});var k=0===m.length?E.firstInstructionText:1===m.length?E.secondInstructionText:E.thirdInstructionText;console.log({imagesLength:m.length,instructionText:k,idCaptureRequirement:a,requiredImageCount:y});var T=t.useState(),M=T[0],I=T[1];return M?u.default.createElement(my,{documents:[{title:M}],onDocumentCaptured:function(e){var t=e.contentUrl;g((function(e){return C(C([],e,!0),[t],!1)})),null==r||r(t),I(void 0)}}):u.default.createElement(u.default.Fragment,null,u.default.createElement(W,{className:s.container},u.default.createElement(vy,{className:s.inner},u.default.createElement(yy,{className:s.heading},E.headingText),u.default.createElement(by,{className:s.description},E.descriptionText),m.length>0&&u.default.createElement(q,{className:s.imageContainer},m.map((function(e,t){return u.default.createElement(Cy,{key:t,className:s.imageCol},u.default.createElement("img",{src:e,alt:"",className:s.image}))}))),m.length<y&&u.default.createElement(xy,{className:s.instruction},k),u.default.createElement("input",{ref:h,type:"file",accept:"image/*",capture:"environment",onChange:function(e){var t,n=null===(t=e.target.files)||void 0===t?void 0:t[0];if(n){var a=new FileReader;a.addEventListener("load",(function(e){var t,n=null===(t=e.target)||void 0===t?void 0:t.result;g((function(e){return C(C([],e,!0),[n],!1)})),null==r||r(n)})),a.readAsDataURL(n)}},hidden:!0}),u.default.createElement(wy,{className:s.buttonsRow},m.length<v&&u.default.createElement(ce,{variant:m.length>0?"secondary":"positive",className:m.length>0?s.captureMoreBtn:s.captureBtn,colors:m.length>0?d.captureMoreBtn:d.captureBtn,finished:!0,onClick:function(){var e;En()?null===(e=h.current)||void 0===e||e.click():I(k)}},m.length>0?E.captureMoreBtnText:E.captureBtnText),m.length>=y&&u.default.createElement(ce,{variant:"positive",className:s.doneBtn,colors:d.doneBtn,finished:!0,onClick:function(){null==i||i(m)}},E.doneBtnText)))))},vy=h.default(V)(Sv||(Sv=w(["\n justify-content: center;\n"],["\n justify-content: center;\n"]))),yy=h.default.h3(Dv||(Dv=w(["\n margin-bottom: 8px;\n"],["\n margin-bottom: 8px;\n"]))),by=h.default.p(Nv||(Nv=w(["\n margin-bottom: 8px;\n"],["\n margin-bottom: 8px;\n"]))),xy=h.default.p(Av||(Av=w(["\n font-weight: bold;\n"],["\n font-weight: bold;\n"]))),Cy=h.default.div(Lv||(Lv=w(["\n display: flex;\n justify-content: center;\n flex-grow: 1;\n flex-basis: 0;\n"],["\n display: flex;\n justify-content: center;\n flex-grow: 1;\n flex-basis: 0;\n"]))),wy=h.default(ym)(Rv||(Rv=w(["\n margin-top: 32px;\n"],["\n margin-top: 32px;\n"]))),Ey=function(e){var n,a,i,o,s,l,d,c,f,h,p,m,g,v,y,b,x=e.onSuccess,C=e.onExitCapture,w=e.onUserCancel,E=e.loadingOverlayMode,T=void 0===E?"default":E,M=e.precapturedDocuments,I=e.captureRequirement,D=void 0===I?"idCardOrPassport":I,N=e.autoCaptureEnabled,A=void 0===N||N,L=e.autoCaptureGoodFramesRequired,R=void 0===L?3:L,O=e.autoCaptureBarcodeRequired,F=void 0===O?"mobile":O,j=e.barcodeScanningEnabled,P=void 0!==j&&j,_=e.idCardAutoCaptureScoreThreshold,U=void 0===_?.8:_,z=e.passportAutoCaptureScoreThreshold,G=void 0===z?.75:z,W=e.mrzDetectionScoreThreshold,V=void 0===W?.25:W,$=e.idCardFocusScoreThreshold,q=void 0===$?.3:$,H=e.passportFocusScoreThreshold,Y=void 0===H?.3:H,Z=e.skipSuccessScreen,Q=void 0!==Z&&Z,X=e.instructions,K=e.releaseCameraAccessOnExit,J=void 0===K||K,ee=e.guideType,te=void 0===ee?"fit":ee,ne=e.portraitGuidesOnMobile,ae=void 0!==ne&&ne,re=e.rotateLoadingOverlayImageWhenPortrait,ie=void 0===re||re,oe=e.assets,se=void 0===oe?{}:oe,le=e.classNames,ue=void 0===le?{}:le,de=e.colors,ce=void 0===de?{}:de,fe=e.verbiage,he=void 0===fe?{}:fe,pe=e.debugMode,me=void 0!==pe&&pe,ge=Ih(),ve=ge[0],ye=ge[1],be=t.useContext(Xe).releaseCameraAccess,xe=t.useState(!1),Ce=xe[0],we=xe[1],Ee=t.useContext(Ie),ke=Ee.submissionStatus,Te=Ee.setIdFrontImage,Me=Ee.setIdBackImage,Se=Ee.setPassportImage,De=Ee.logIdFrontCaptureAttempt,Ne=Ee.logIdBackCaptureAttempt,Ae=t.useContext(uh).modelError,Le=t.useRef();t.useEffect((function(){ye({type:"configureWizard",payload:{captureRequirement:D,precapturedDocuments:M}})}),[D,ye,M]);var Re=Object.keys(ve.capturedDocuments).length;t.useEffect((function(){Le.current=new Date}),[Re]);var Oe=t.useCallback((function(e){var t;e.operationTime=(new Date).getTime()-(null!==(t=Le.current)&&void 0!==t?t:new Date).getTime(),"idCardBack"===ve.requestedDocumentType?Ne(e):De(e)}),[Ne,De,ve.requestedDocumentType]),Fe=t.useCallback((function(e){ye({type:"predictionMade",payload:e})}),[ye]),je=t.useCallback((function(e,t,n,a){Oe(a),ye({type:"documentCaptured",payload:{imageData:e,width:t,height:n,boundingBox:a.boundingBox}})}),[ye,Oe]),Pe=t.useCallback((function(){var e=ve.capturedDocuments,t=e.idCardFront,n=e.idCardBack,a=e.passport,r=t&&S(t.imageData),i=n&&S(n.imageData),o=a&&S(a.imageData);r&&Te(r),i&&Me(i),o&&Se(o),J&&be(),setTimeout((function(){null==x||x({idFrontImage:r,idBackImage:i,passportImage:o})}),0)}),[x,be,J,Me,Te,Se,ve.capturedDocuments]),Be=Lg(Q,"complete"===ve.captureState,Pe),_e=t.useCallback((function(){ye({type:"resetWizard"})}),[ye]),Ue=t.useState(0),ze=Ue[0],Ge=Ue[1],We=t.useCallback((function(){we(!1),Ge((function(e){return e+1})),ye({type:"resetWizard"}),null==C||C()}),[ye,C]);t.useEffect((function(){ke!==k.READY&&J&&be()}),[be,J,ke]),se.idCardFront||(se.idCardFront={}),(d=se.idCardFront).portraitGuidesImageUrl||(d.portraitGuidesImageUrl="".concat(Ra,"/Shieldout-IDCard-Front-SVG-Portrait-2.svg")),(c=se.idCardFront).landscapeGuidesImageUrl||(c.landscapeGuidesImageUrl="".concat(Ra,"/Shieldout-IDCard-Front-SVG-Landscape-2.svg")),se.idCardBack||(se.idCardBack={}),(f=se.idCardBack).portraitGuidesImageUrl||(f.portraitGuidesImageUrl="".concat(Ra,"/Shieldout-IDCard-Back-SVG-Portrait-2.svg")),(h=se.idCardBack).landscapeGuidesImageUrl||(h.landscapeGuidesImageUrl="".concat(Ra,"/Shieldout-IDCard-Back-SVG-Landscape-2.svg")),se.passport||(se.passport={}),(p=se.passport).portraitGuidesImageUrl||(p.portraitGuidesImageUrl="".concat(Ra,"/Shieldout-Passport-Front-SVG-Portrait-2.svg")),(m=se.passport).landscapeGuidesImageUrl||(m.landscapeGuidesImageUrl="".concat(Ra,"/Shieldout-Passport-Front-SVG-Landscape-2.svg")),se.flipIdPrompt||(se.flipIdPrompt={}),(g=se.flipIdPrompt).frontPortraitGuidesImageUrl||(g.frontPortraitGuidesImageUrl=se.idCardFront.portraitGuidesImageUrl),(v=se.flipIdPrompt).frontLandscapeGuidesImageUrl||(v.frontLandscapeGuidesImageUrl=se.idCardFront.landscapeGuidesImageUrl),(y=se.flipIdPrompt).backPortraitGuidesImageUrl||(y.backPortraitGuidesImageUrl=se.idCardBack.portraitGuidesImageUrl),(b=se.flipIdPrompt).backLandscapeGuidesImageUrl||(b.backLandscapeGuidesImageUrl=se.idCardBack.landscapeGuidesImageUrl);var Ve={idCardFront:Xp(he.idCardFront,{instructionText:"Scan the front of ID",processingIdCardText:"ID card front captured."}),idCardBack:Xp(he.idCardBack,{instructionText:"Scan the back of ID"}),passport:Xp(he.passport,{instructionText:"Scan the ID page of passport"})},$e=r.useTheme(),qe=Ih()[0],He=qe.guideRectX,Ye=qe.guideRectY,Ze=qe.guideRectWidth,Qe=qe.guideRectHeight,Ke=qe.imageUrl,Je=se[ve.requestedDocumentType],et=Ve[ve.requestedDocumentType];return t.useEffect((function(){"requestingFlip"===ve.captureState&&setTimeout((function(){ye({type:"flipRequestCompleted"})}),6e3)}),[ye,ve.captureState]),Ae?u.default.createElement(gy,{idCaptureRequirement:D,onFinished:Pe,onCapture:function(e){ye({type:"documentCapturedManually",payload:{imageData:e}})},classNames:ue.fallback,colors:ce.fallback,verbiage:he.fallback}):u.default.createElement(B,{className:"flex ".concat(null!==(n=null==ue?void 0:ue.container)&&void 0!==n?n:"")},"complete"!==ve.captureState&&u.default.createElement(Og,{$x:He,$y:Ye,$w:Ze,$h:Qe,$mode:"fit"===te?"snapToGuides":"fullscreen"},u.default.createElement(Ng,{className:null==ue?void 0:ue.cameraFeed})),Ce&&"requestingFlip"!==ve.captureState&&function(){var e=Re;switch(ve.requestedDocumentType){case"idCardFront":return u.default.createElement(um,{key:"capture".concat(e),requiredDocumentType:ve.requestedDocumentType,autoCaptureEnabled:A,autoCaptureScoreThreshold:U,autoCaptureGoodFramesRequired:R,autoCaptureBarcodeRequired:F,barcodeScanningEnabled:!1,mrzDetectionScoreThreshold:V,focusScoreThreshold:q,onPrediction:Fe,onCapture:je,assets:Je,classNames:null==ue?void 0:ue.capture,colors:ce,verbiage:et,debugMode:me});case"idCardBack":return u.default.createElement(um,{key:"capture".concat(e),requiredDocumentType:ve.requestedDocumentType,autoCaptureEnabled:A,autoCaptureScoreThreshold:U,autoCaptureGoodFramesRequired:R,autoCaptureBarcodeRequired:F,barcodeScanningEnabled:P,mrzDetectionScoreThreshold:V,focusScoreThreshold:q,onPrediction:Fe,onCapture:je,assets:Je,classNames:null==ue?void 0:ue.capture,colors:ce,verbiage:et,debugMode:me});case"passport":return u.default.createElement(um,{key:"capture".concat(e),requiredDocumentType:ve.requestedDocumentType,autoCaptureEnabled:A,autoCaptureScoreThreshold:G,mrzDetectionScoreThreshold:V,autoCaptureGoodFramesRequired:R,autoCaptureBarcodeRequired:F,barcodeScanningEnabled:!1,focusScoreThreshold:Y,onPrediction:Fe,onCapture:je,assets:Je,classNames:null==ue?void 0:ue.capture,colors:ce,verbiage:et,debugMode:me});default:return null}}(),u.default.createElement(hv,{guideType:te,portraitGuidesOnMobile:ae,requestingFlip:"requestingFlip"===ve.captureState,flipIdPromptAssets:null==se?void 0:se.flipIdPrompt,classNames:ue,assets:Je,colors:ce,verbiage:et}),!(null===(i=null===(a=$e.idCapture)||void 0===a?void 0:a.capturePreview)||void 0===i?void 0:i.disabled)&&"requestingFlip"===ve.captureState&&Ke&&u.default.createElement(qv,{classNames:null===(o=ue.capture)||void 0===o?void 0:o.imagePreview,text:null===(s=null==Ve?void 0:Ve.idCardFront)||void 0===s?void 0:s.processingIdCardText,imageUrl:Ke}),"complete"!==ve.captureState&&u.default.createElement("div",{id:"idmission-above-guides-content"}),u.default.createElement(vm,{onClick:We,className:null===(l=ue.capture)||void 0===l?void 0:l.exitCaptureBtn}),!Ce&&u.default.createElement(bg,{key:ze,mode:T,instructions:X,assets:se.loadingOverlay,classNames:ue.loadingOverlay,colors:ce.loadingOverlay,verbiage:he.loadingOverlay,onUserCancel:w,onDismissed:function(){we(!0)},rotateImage:ie&&ae&&window.innerWidth<window.innerHeight}),"complete"===ve.captureState&&Be&&u.default.createElement(wg,{capturedDocuments:ve.capturedDocuments,barcodeResult:ve.barcodeResult,classNames:ue.success,onSubmitClick:Pe,onRetryClick:_e,colors:ce.success,verbiage:he.success}))},ky=h.default.div(Ov||(Ov=w(["\n position: absolute;\n z-index: 1000;\n width: 100%;\n height: 100%;\n display: flex;\n"],["\n position: absolute;\n z-index: 1000;\n width: 100%;\n height: 100%;\n display: flex;\n"]))),Ty=h.default.div(Fv||(Fv=w(["\n border-width: ","px;\n border-color: ",";\n border-style: solid;\n border-radius: 50%;\n aspect-ratio: 1 / 1.618;\n height: 50%;\n margin: auto;\n"],["\n border-width: ","px;\n border-color: ",";\n border-style: solid;\n border-radius: 50%;\n aspect-ratio: 1 / 1.618;\n height: 50%;\n margin: auto;\n"])),(function(e){return e.$borderWidth}),(function(e){var t,n,a,r;return null!==(r=null!==(t=e.$borderColor)&&void 0!==t?t:null===(a=null===(n=e.theme.selfieCapture)||void 0===n?void 0:n.guides)||void 0===a?void 0:a["".concat(e.$variant,"Color")])&&void 0!==r?r:"white"})),My=function(e){var t=e.classNames,n=void 0===t?{}:t,a=e.variant,r=e.borderWidth;return u.default.createElement(ky,{className:n.container},u.default.createElement(Ty,{className:n.oval,$variant:void 0===a?"unsatisfied":a,$borderWidth:void 0===r?3:r,$borderColor:e.borderColor}))},Iy=function(e,n,a,r,i){void 0===i&&(i=!0);var o=t.useState(!1),s=o[0],l=o[1],u=t.useState(),d=u[0],c=u[1];return t.useEffect((function(){if(e&&i){c(new Date);var t=setTimeout((function(){l(!0)}),e);return function(){t&&clearTimeout(t)}}}),[e,i]),t.useEffect((function(){if(s&&!a){if(r){var e=setTimeout((function(){null==n||n()}),12e4);return function(){clearTimeout(e)}}null==n||n()}}),[n,r,s,a]),{timedOut:s,timeoutStartedAt:d}},Sy=function(e){var n=e.onFinished,a=e.onCapture,r=e.classNames,i=void 0===r?{}:r,o=e.colors,s=void 0===o?{}:o,l=e.verbiage,d=void 0===l?{}:l,c=t.useState(null),f=c[0],h=c[1],p=t.useRef(null),m=t.useState(!1),g=m[0],v=m[1],y=t.useState(!1),b=y[0],x=y[1],C=Xp(d,{headingText:"We're having some trouble.",descriptionText:"On-device capture guidance failed, please capture a selfie manually.",captureBtnText:"Capture",doneBtnText:"Done",doneBtnLoadingText:"Verifying..."});return b?u.default.createElement(my,{documents:[{title:C.descriptionText}],onDocumentCaptured:function(e){var t=e.contentUrl;h(t),null==a||a(t),x(!1)}}):u.default.createElement(W,{className:i.container},u.default.createElement(Dy,{className:i.inner},u.default.createElement(Ny,{className:i.heading},C.headingText),u.default.createElement(Ay,{className:i.description},C.descriptionText),f&&u.default.createElement(Ly,{className:i.imageContainer},u.default.createElement("img",{src:f,alt:"",className:i.image})),u.default.createElement("input",{ref:p,type:"file",accept:"image/*",capture:"user",onChange:function(e){var t,n=null===(t=e.target.files)||void 0===t?void 0:t[0];if(n){var r=new FileReader;r.addEventListener("load",(function(e){var t,n=null===(t=e.target)||void 0===t?void 0:t.result;h(n),null==a||a(n)})),r.readAsDataURL(n)}},hidden:!0}),u.default.createElement(Ry,{className:i.buttonsRow},!f&&u.default.createElement(ce,{variant:"positive",className:i.captureBtn,colors:s.captureBtn,finished:!0,onClick:function(){var e;En()?null===(e=p.current)||void 0===e||e.click():x(!0)}},C.captureBtnText),f&&u.default.createElement(ce,{variant:"positive",key:g?"loading-btn":"ready-btn",className:i.doneBtn,colors:s.doneBtn,finished:!g,onClick:function(){v(!0),null==n||n(f)}},g?C.doneBtnLoadingText:C.doneBtnText))))},Dy=h.default(V)(jv||(jv=w(["\n justify-content: center;\n"],["\n justify-content: center;\n"]))),Ny=h.default.h3(Pv||(Pv=w(["\n margin-bottom: 8px;\n"],["\n margin-bottom: 8px;\n"]))),Ay=h.default.p(Bv||(Bv=w(["\n margin-bottom: 8px;\n"],["\n margin-bottom: 8px;\n"]))),Ly=h.default($)(_v||(_v=w(["\n margin-top: 32px;\n"],["\n margin-top: 32px;\n"]))),Ry=h.default(ym)(Uv||(Uv=w(["\n margin-top: 32px;\n"],["\n margin-top: 32px;\n"]))),Oy={videoWidth:0,videoHeight:0,capturing:!1,captured:!1,captureFailed:!1,frame:null,faces:[],faceNotCentered:!1,faceLookingAway:!1,faceTooClose:!1,faceTooFar:!1,faceReady:!1,faceReadyAt:null,goodFramesCount:0,goodFramesThreshold:1,goodFramesThresholdMet:!1},Fy=function(e,t){switch(t.type){case"configure":return v(v({},e),{videoWidth:t.payload.videoWidth,videoHeight:t.payload.videoHeight});case"capturing":return v(v({},e),{capturing:!0,captured:!1,captureFailed:!1});case"captured":return v(v({},e),{capturing:!1,captured:!0,captureFailed:!1});case"captureFailed":return v(v({},e),{capturing:!1,captured:!1,captureFailed:!0});case"facesDetected":var n=t.payload.faces,a=n[0],r=!0,i=!1,o=!1,s=!1,l=e.faceReadyAt,u=e.goodFramesCount;if(a){var d=e.videoHeight/2,c=(a.box.xMin+a.box.xMax)/2,f=(a.box.yMin+a.box.yMax)/2,h=.125*e.videoWidth,p=.125*e.videoHeight,m=.2*a.box.width,g=.2*a.box.height,y=a.keypoints[2];y&&(r=Math.abs(e.videoWidth/2-c)>h||Math.abs(d+50-f)>p,i=Math.abs(c-y.x)>m||Math.abs(f-y.y)>g);var b=e.videoWidth<e.videoHeight;o=a.box.width>e.videoWidth/(b?2:4.5),s=a.box.width<e.videoWidth/(b?6:7)}var x=!(r||i||o||s);return x?e.faceReady||(l=new Date):(l=null,u=0),v(v({},e),{faces:n,faceNotCentered:r,faceLookingAway:i,faceTooClose:o,faceTooFar:s,faceReady:x,faceReadyAt:l,goodFramesCount:u})}},jy=function(e){var n,a=e.onGuidanceSatisfied,r=e.onGuidanceNotSatisfied,i=e.onSelfieCaptured,o=e.onTimeout,s=e.onExit,l=e.timeoutDurationMs,d=void 0===l?15e3:l,c=e.guidanceMessage,f=e.guidanceSatisfied,h=e.classNames,p=void 0===h?{}:h,m=e.colors,g=void 0===m?{}:m,v=e.verbiage,y=void 0===v?{}:v,C=e.debugMode,w=void 0!==C&&C,E=Le(),k=E.ref,T=E.width,M=void 0===T?1:T,I=E.height,S=void 0===I?1:I,D=t.useReducer(Fy,Oy),N=D[0],A=D[1],L=t.useRef(null),R=t.useContext(Xe),O=R.cameraRef,F=R.cameraReady,j=R.videoRef,P=t.useContext(Qf),_=P.onPredictionMade,U=P.error;t.useEffect((function(){F&&j.current&&0!==j.current.videoWidth&&A({type:"configure",payload:{videoWidth:j.current.videoWidth,videoHeight:j.current.videoHeight}})}),[F,j]),t.useEffect((function(){_((function(e){A({type:"facesDetected",payload:{faces:e}})}))}),[_]);var z=t.useState(!1),G=z[0],W=z[1];t.useEffect((function(){var e;return N.faceReady?(null==a||a(),e=setTimeout((function(){W(!0)}),1e3)):null==r||r(),function(){e&&clearTimeout(e)}}),[r,a,N.faceReady]),t.useEffect((function(){b(void 0,void 0,void 0,(function(){var e,t;return x(this,(function(n){if(G&&j.current&&L.current&&N.faces.length>0){if(Ue(L.current,j.current),!(e=L.current.getContext("2d")))return[2];t=e.getImageData(0,0,j.current.videoWidth,j.current.videoHeight),null==i||i(t,N.faces[0]),ze(L.current)}return[2]}))}))}),[G,i,N.faces,j]);var V=Iy(d,o),$=V.timedOut,q=V.timeoutStartedAt,H=Lh({enabled:w,pageWidth:M,pageHeight:S,videoWidth:N.videoWidth,videoHeight:N.videoHeight});g.guidesUnsatisfiedColor||(g.guidesUnsatisfiedColor="white"),g.guidesSatisfiedColor||(g.guidesSatisfiedColor="green");var Y=Xp(y,{guidanceHoldStillText:"Hold still for a few seconds...",guidanceLookStraightText:"Look straight into the camera...",guidanceMoveBackText:"Move back...",guidanceMoveForwardText:"Move forward...",guidanceMoveToCenterText:"Move to the center..."}),Z=N.faceReady;return"boolean"==typeof f&&(Z=f),c||(c=Z?Y.guidanceHoldStillText:N.faceLookingAway?Y.guidanceLookStraightText:N.faceTooClose?Y.guidanceMoveBackText:N.faceTooFar?Y.guidanceMoveForwardText:N.faceNotCentered?Y.guidanceMoveToCenterText:""),U?u.default.createElement(Sy,{classNames:p.fallback}):u.default.createElement(B,{ref:k,className:"flex ".concat(null!==(n=p.container)&&void 0!==n?n:"")},u.default.createElement(_e,{ref:L}),u.default.createElement(My,{classNames:p.guides,variant:Z?"satisfied":"unsatisfied"}),""!==c&&u.default.createElement(sm,{className:p.guidanceMessageContainer},u.default.createElement(lm,{$variant:Z?"positive":"negative",className:p.guidanceMessage},c)),w&&N.faces.length>0&&u.default.createElement(Dh,null,N.faces.map((function(e,t){return u.default.createElement(_h,{key:t,face:e,scaling:H,color:Z?"green":"red"})}))),w&&u.default.createElement(Sh,null,O.current?u.default.createElement(u.default.Fragment,null,"✅ Camera: ",O.current.label," (",O.current.width,"x",O.current.height,")"):"❌ Camera not ready",u.default.createElement("br",null),N.faceNotCentered?"❌":"✅"," Face Centered",u.default.createElement("br",null),N.faceTooClose||N.faceTooFar?"❌":"✅"," Face"," ",N.faceTooClose?"Too Close":N.faceTooFar?"Too Far":"Distance Correct",u.default.createElement("br",null),N.faceLookingAway?"❌":"✅"," Face Looking Forward",u.default.createElement("br",null),N.goodFramesThresholdMet?"✅":"❌"," ",N.goodFramesCount," ","Good Frames",u.default.createElement("br",null),$?"❌":"✅"," Time Remaining:"," ",Math.max(0,d-((new Date).getTime()-(null!=q?q:new Date).getTime())),"ms"),u.default.createElement(vm,{onClick:s,className:p.exitCaptureBtn}))},Py={frame:null,face:null,requestState:"CAPTURING",requestError:null,imageUrl:null,faceLive:!1,eyeCoveringDetected:!1,maskDetected:!1,headCoveringDetected:!1,phoneDetected:!1,timesLivenessCheckFailed:0},By=function(e,t){var n,a;switch(t.type){case"livenessReady":return["CAPTURING","FAILED","ERROR"].includes(e.requestState)?v(v({},e),{requestState:"CAPTURED",frame:t.payload.frame,face:t.payload.face}):e;case"livenessChecking":return v(v({},e),{requestState:"IN_PROGRESS"});case"livenessChecked":var r=t.payload.response,i=r.status,o=i.statusMessage,s=i.errorData,l=r.resultData;if("000"!==i.statusCode)return v(v({},e),{requestState:"ERROR",requestError:new Error("".concat(o,": ").concat(s))});var u="Live Face Detected"===l.verificationResult,d="true"===l.eyeCovering,c="true"===l.faceMask,f="true"===l.headCovering,h="true"===l.cellPhone,p=u&&!d&&!c&&!f,m=p?"PASSED":"FAILED",g=e.timesLivenessCheckFailed;return p?g=0:g+=1,v(v({},e),{frame:null!==(n=t.payload.frame)&&void 0!==n?n:null,face:null!==(a=t.payload.face)&&void 0!==a?a:null,imageUrl:t.payload.imageUrl,requestState:m,faceLive:u,eyeCoveringDetected:d,maskDetected:c,headCoveringDetected:f,phoneDetected:h,timesLivenessCheckFailed:g});case"livenessCheckFailed":return v(v({},e),{requestState:"ERROR",requestError:t.payload.error});default:return e}},_y=function(e){var n,a,i,o=e.onCapture,s=e.onSuccess,l=e.onTimeout,d=e.onExit,c=e.timeoutDurationMs,f=void 0===c?15e3:c,h=e.classNames,p=void 0===h?{}:h,m=e.colors,g=void 0===m?{}:m,v=e.verbiage,y=void 0===v?{}:v,C=e.debugMode,w=t.useContext(Ie),E=w.checkLiveness,k=w.submissionError,T=t.useContext(Qf).error,M=t.useReducer(By,Py),S=M[0],D=M[1],N=t.useState(null),A=N[0],L=N[1],R=t.useRef(null),O=t.useRef(null),F=r.useTheme(),j=t.useCallback((function(e,t){null==o||o(),D({type:"livenessReady",payload:{frame:e,face:t}})}),[o]),P=S.frame,B=S.face,_="CAPTURED"===S.requestState,U="PASSED"===S.requestState;t.useEffect((function(){P&&B&&_&&!k&&(D({type:"livenessChecking"}),b(void 0,void 0,void 0,(function(){var e,t,n,a;return x(this,(function(r){switch(r.label){case 0:return r.trys.push([0,3,,4]),e=Oa(R.current,O.current,P,B),L(e),n=E,[4,I(e)];case 1:return[4,n.apply(void 0,[r.sent()])];case 2:return t=r.sent(),D({type:"livenessChecked",payload:{frame:P,face:B,imageUrl:e,response:t}}),[3,4];case 3:return a=r.sent(),D({type:"livenessCheckFailed",payload:{error:a}}),[3,4];case 4:return[2]}}))})))}),[E,B,P,_,k]);var z=t.useCallback((function(e){return b(void 0,void 0,void 0,(function(){var t,n,a;return x(this,(function(r){switch(r.label){case 0:D({type:"livenessChecking"}),r.label=1;case 1:return r.trys.push([1,4,,5]),n=E,[4,I(e)];case 2:return[4,n.apply(void 0,[r.sent()])];case 3:return t=r.sent(),D({type:"livenessChecked",payload:{imageUrl:e,response:t}}),[3,5];case 4:return a=r.sent(),D({type:"livenessCheckFailed",payload:{error:a}}),[3,5];case 5:return[2]}}))}))}),[E]);t.useEffect((function(){U&&S.imageUrl&&(null==s||s(S.imageUrl))}),[s,S.imageUrl,U]),t.useEffect((function(){S.timesLivenessCheckFailed>=(T?1:2)&&(null==l||l())}),[T,l,S.timesLivenessCheckFailed]),Iy(f,l,"PASSED"===S.requestState||!!T,"IN_PROGRESS"===S.requestState);var G=Xp(y,{guidanceRemoveEyeCoveringsText:"Please remove your eye coverings (sunglasses, eye patch, etc.)...",guidanceRemoveHeadCoveringsText:"Please remove your head coverings (hat, scarf, etc.)...",guidanceRemoveMaskText:"Please remove your mask...",progressPreviewText:"Processing..."}),W=S.eyeCoveringDetected?G.guidanceRemoveEyeCoveringsText:S.headCoveringDetected?G.guidanceRemoveHeadCoveringsText:S.maskDetected?G.guidanceRemoveMaskText:void 0;return T?u.default.createElement(Sy,{onFinished:z}):u.default.createElement(u.default.Fragment,null,u.default.createElement(_e,{ref:R}),u.default.createElement(_e,{ref:O}),u.default.createElement(jy,{onSelfieCaptured:j,onExit:d,timeoutDurationMs:f,guidanceMessage:W,guidanceSatisfied:!W&&void 0,classNames:p,colors:g,verbiage:G,debugMode:C}),!(null===(a=null===(n=F.selfieCapture)||void 0===n?void 0:n.capturePreview)||void 0===a?void 0:a.disabled)&&A&&u.default.createElement(Hv,{classNames:p.imagePreview,imageUrl:A,text:null!==(i=G.progressPreviewText)&&void 0!==i?i:""}))},Uy=function(e){var t=e.imageUrl,n=e.onDoneClick,a=e.onRetryClick,r=e.classNames,i=void 0===r?{}:r,o=e.colors,s=void 0===o?{}:o,l=e.verbiage,d=Xp(void 0===l?{}:l,{headingText:"Face liveness has been verified!",retryBtnText:"Retry",doneBtnText:"Done"});return u.default.createElement(W,{className:i.container},u.default.createElement(V,{className:i.inner},u.default.createElement(zy,{className:i.heading},d.headingText),u.default.createElement($,{className:i.imageContainer},u.default.createElement("img",{alt:d.headingText,src:t,className:i.image})),u.default.createElement(ym,{className:i.buttonsRow},u.default.createElement(ce,{variant:"warning",onClick:a,colors:s.retryBtn,className:i.retryBtn,finished:!0},d.retryBtnText),u.default.createElement(ce,{variant:"positive",onClick:n,colors:s.doneBtn,className:i.doneBtn,finished:!0},d.doneBtnText))))},zy=h.default.h3(zv||(zv=w(["\n margin-bottom: 24px;\n"],["\n margin-bottom: 24px;\n"]))),Gy=function(e){var t=e.canRetry,n=void 0===t||t,a=e.onRetryClick,r=e.onExitClick,i=e.assets,o=void 0===i?{}:i,s=e.classNames,l=void 0===s?{}:s,d=e.colors,c=void 0===d?{}:d,f=e.verbiage,h=void 0===f?{}:f;o.imageUrl||(o.imageUrl="".concat(Ra,"/manual_capture.png"));var p=Xp(h,{headingText:"Live face not detected, please try again",retryBtnText:"Retry",exitBtnText:"Exit"});return u.default.createElement(W,{className:l.container},u.default.createElement(V,{className:l.inner},u.default.createElement("h3",{className:l.heading},p.headingText),u.default.createElement(Wy,{className:l.imageContainer},u.default.createElement("img",{alt:p.headingText,src:o.imageUrl,className:l.image})),u.default.createElement(ym,{className:l.buttonsRow},n&&u.default.createElement(ce,{variant:"warning",className:l.retryBtn,onClick:a,colors:c.retryBtn,finished:!0},p.retryBtnText),u.default.createElement(ce,{variant:"secondary",className:l.exitBtn,onClick:r,colors:c.exitBtn,finished:!0},p.exitBtnText))))},Wy=h.default($)(Gv||(Gv=w(["\n max-height: calc(100vh - 185px);\n margin: 0 24px;\n"],["\n max-height: calc(100vh - 185px);\n margin: 0 24px;\n"]))),Vy=h.default(lm)(Wv||(Wv=w(["\n padding: 12px 24px;\n font-weight: normal;\n line-height: 1.5;\n margin-bottom: -30px;\n"],["\n padding: 12px 24px;\n font-weight: normal;\n line-height: 1.5;\n margin-bottom: -30px;\n"]))),$y=h.default(ym)(Vv||(Vv=w(["\n flex-direction: column;\n padding-top: 25px;\n"],["\n flex-direction: column;\n padding-top: 25px;\n"])));function qy(e){var n,a,i,o=e.width,s=void 0===o?840:o,l=e.height,d=void 0===l?740:l,c=e.className,f=t.useState(1),h=f[0],p=f[1];t.useEffect((function(){var e=setInterval((function(){p((function(e){return(e+1)%10}))}),750);return function(){clearInterval(e)}}),[]);var m=null!==(i=null===(a=null===(n=r.useTheme().selfieCapture)||void 0===n?void 0:n.loadingOverlay)||void 0===a?void 0:a.loadingGraphicAccentColor)&&void 0!==i?i:"var(--idm-color-positive-600)";return u.default.createElement("svg",{width:s,height:d,className:c,viewBox:"0 0 840 740",fill:"none",preserveAspectRatio:"xMidYMax slice",xmlns:"http://www.w3.org/2000/svg"},u.default.createElement("g",{clipPath:"url(#clip0_428_1188)"},u.default.createElement("mask",{id:"mask0_428_1188",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"840",height:"740"},u.default.createElement("rect",{width:"840",height:"740",fill:"#D9D9D9"})),u.default.createElement("g",{mask:"url(#mask0_428_1188)"},u.default.createElement("path",{d:"M503.781 449.497C491.561 503.154 458.442 541.609 419.561 541.609C380.68 541.609 347.492 503.015 335.272 449.358L344.645 412.916L347.492 402.019H491.561L502.253 443.667L503.225 447.415L503.781 449.497Z",fill:"#D2D4DA"}),u.default.createElement("path",{d:"M574.88 244.97C647.073 163.885 598.921 362.155 558.945 338.928C488.709 298.211 574.88 244.97 574.88 244.97Z",fill:"#F7A69C"}),u.default.createElement("path",{d:"M816.983 742.838C779.698 781.432 736.86 814.612 689.786 841.127C617.161 882.012 534.399 906.862 446.153 911.027C437.335 911.513 428.448 911.721 419.491 911.721C374.986 911.721 331.731 906.446 290.281 896.519C232.514 882.706 178.358 859.8 129.271 829.397C89.9033 805.033 53.9382 775.948 22 742.838L31.512 705.355C45.8842 649.061 90.2505 605.33 146.837 591.795L153.085 590.337L222.447 573.747L241.401 569.235C249.386 567.292 257.023 564.585 264.244 561.114C270.285 558.199 276.047 554.797 281.463 550.91C287.295 546.745 292.78 542.025 297.71 536.819C310.971 522.867 320.761 505.653 325.76 486.286L333.119 457.688L335.064 449.983L335.202 449.358L344.645 412.916L347.422 402.019H491.491L502.253 443.667L503.225 447.415L503.78 449.497V449.983L505.863 457.757L513.223 486.286C520.097 512.802 535.996 535.5 557.589 550.91C569.393 559.448 582.932 565.765 597.581 569.235L615.078 573.4L692.146 591.795C748.732 605.33 793.099 649.061 807.471 705.355L816.983 742.838Z",fill:"#F7A69C"}),u.default.createElement("path",{d:"M503.781 449.497C491.561 503.154 458.442 541.609 419.561 541.609C380.68 541.609 347.492 503.015 335.272 449.358L344.645 412.916L347.492 402.019H491.561L502.253 443.667L503.225 447.415L503.781 449.497Z",fill:"#DC968D"}),u.default.createElement("path",{d:"M264.123 244.97C191.93 163.885 240.082 362.155 280.058 338.928C350.294 298.211 264.123 244.97 264.123 244.97Z",fill:"#F7A69C"}),u.default.createElement("path",{d:"M586.473 187.324C586.473 193.432 586.126 199.402 585.432 205.371C584.876 210.785 582.446 233.9 578.141 263.331C575.781 279.713 572.726 297.969 569.115 316.294C569.115 316.502 569.115 316.78 568.976 316.988C560.159 361.621 547.731 406.045 531.484 422.219C513.154 440.544 498.435 457.203 481.632 469.211C464.83 481.289 446.014 488.786 419.631 488.786C393.247 488.786 374.431 481.289 357.629 469.211C340.896 457.203 326.107 440.544 307.778 422.219C291.531 405.976 279.103 361.482 270.216 316.918C270.216 316.918 270.216 316.71 270.216 316.641C269.105 310.879 268.063 305.118 267.022 299.426C266.605 297.066 266.189 294.706 265.772 292.346C264.036 282.351 262.509 272.563 261.12 263.401C256.121 229.596 253.691 204.122 253.691 204.122C253.136 198.638 252.858 193.016 252.858 187.324C252.858 185.866 252.858 184.408 252.858 182.951C253.205 169.832 255.01 157.06 258.274 144.843C258.412 144.287 258.551 143.732 258.69 143.177C277.228 75.4294 337.425 24.8271 410.049 20.8011C413.243 20.5928 416.368 20.5234 419.631 20.5234C465.733 20.5234 507.461 39.1956 537.663 69.3904C563.769 95.4205 581.266 130.127 585.501 168.79C586.195 174.899 586.542 181.077 586.542 187.324H586.473Z",fill:"#FEAEA5"}),u.default.createElement("path",{d:"M445.867 337.327C445.867 348.849 434.133 358.151 419.622 358.151C405.111 358.151 393.447 348.849 393.447 337.327C393.447 335.939 393.586 334.55 394.002 333.301C396.293 342.88 406.916 350.099 419.622 350.099C432.328 350.099 443.02 342.88 445.312 333.301C445.728 334.62 445.867 335.939 445.867 337.327Z",fill:"#F7A69C"}),u.default.createElement("path",{d:"M817.053 743.187C716.586 847.238 575.642 912 419.561 912C263.481 912 122.467 847.238 22.0698 743.118L31.5818 705.704C45.954 649.34 90.3203 605.61 146.906 592.074L222.655 574.027L241.471 569.515C249.942 567.502 258.135 564.517 265.772 560.699C304.237 601.653 358.879 627.267 419.561 627.267C480.244 627.267 534.886 601.653 573.351 560.699C580.988 564.448 589.111 567.502 597.651 569.515L614.106 573.471L692.216 592.074C748.802 605.61 793.168 649.34 807.471 705.704L817.053 743.187Z",fill:"#6E7174"}),u.default.createElement("path",{d:"M614.106 573.471C597.165 594.018 534.886 659.058 419.561 663.639C286.671 668.984 226.266 579.441 222.655 574.027L241.471 569.515C249.942 567.502 258.134 564.517 265.772 560.699C304.236 601.653 358.879 627.267 419.561 627.267C480.244 627.267 534.886 601.653 573.35 560.699C580.988 564.448 589.111 567.502 597.651 569.515L614.106 573.471Z",fill:"#555A5E"}),u.default.createElement("path",{d:"M249.898 196.144C249.898 249.777 270.317 315.623 270.317 315.623C270.317 315.623 266.862 205.572 314.892 164.108C347.514 135.946 374.019 167.565 417.115 167.565C456.137 167.565 492.558 136.481 525.436 164.108C578.852 208.994 568.738 315.623 568.738 315.623C568.738 315.623 589.157 250.557 589.157 196.144C589.157 76.4319 542.638 20 417.115 20C302.8 20 249.898 75.8365 249.898 196.144Z",fill:"#525252"})),h>=8?u.default.createElement(u.default.Fragment,null,u.default.createElement("path",{d:"M565.5 295C565.5 350.583 549.016 400.803 522.488 437.067C495.958 473.332 459.517 495.5 419.5 495.5C379.483 495.5 343.042 473.332 316.512 437.067C289.984 400.803 273.5 350.583 273.5 295C273.5 239.417 289.984 189.197 316.512 152.933C343.042 116.668 379.483 94.5 419.5 94.5C459.517 94.5 495.958 116.668 522.488 152.933C549.016 189.197 565.5 239.417 565.5 295Z",stroke:m,strokeWidth:"5"}),u.default.createElement("circle",{cx:"518.5",cy:"438.5",r:"25.5",fill:m}),u.default.createElement("path",{d:"M504 440.5L512 448L531 427",stroke:"white",strokeWidth:"5",strokeLinecap:"round",strokeLinejoin:"round"})):u.default.createElement(u.default.Fragment,null,h>2&&u.default.createElement(u.default.Fragment,null,h>3&&u.default.createElement(u.default.Fragment,null,h>4&&u.default.createElement(u.default.Fragment,null,h>5&&u.default.createElement(u.default.Fragment,null,u.default.createElement("path",{d:"M298.5 182.5L419 164.5L540 182",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),u.default.createElement("circle",{cx:"419",cy:"165",r:"7",fill:"white"})),u.default.createElement("path",{d:"M565.5 295C565.5 350.583 549.016 400.803 522.488 437.067C495.958 473.332 459.517 495.5 419.5 495.5C379.483 495.5 343.042 473.332 316.512 437.067C289.984 400.803 273.5 350.583 273.5 295C273.5 239.417 289.984 189.197 316.512 152.933C343.042 116.668 379.483 94.5 419.5 94.5C459.517 94.5 495.958 116.668 522.488 152.933C549.016 189.197 565.5 239.417 565.5 295Z",stroke:"white",strokeOpacity:h>7?.8:h>5?.3:.1,strokeWidth:"5"}),u.default.createElement("path",{d:"M299.939 262.805L419 478.5L538.5 261.5",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),u.default.createElement("path",{d:"M298.5 182.5L418.871 230.054L540 182",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),u.default.createElement("path",{d:"M298.5 182.5L299.939 262.805",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),u.default.createElement("path",{d:"M540.001 182L538.501 261.5",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),u.default.createElement("circle",{cx:"299.914",cy:"182",r:"7",fill:"white"}),u.default.createElement("circle",{cx:"540",cy:"182",r:"7",fill:"white"})),u.default.createElement("path",{d:"M418.828 230L419 342.5",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:h>4&&h<7?.3:1}),u.default.createElement("path",{d:"M300 263.001L419 342.501",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:h>4&&h<7?.3:1}),u.default.createElement("path",{d:"M538.5 261.5L419 342.5",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:h>4&&h<7?.3:1}),u.default.createElement("path",{d:"M301.5 409L419 342.5",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:h>4&&h<7?.3:1}),u.default.createElement("path",{d:"M536.5 410L419 342.5",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:h>4&&h<7?.3:1}),u.default.createElement("path",{d:"M300 263L419 230",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:h>4&&h<7?.3:1}),u.default.createElement("path",{d:"M538.5 261.5L419 230",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:h>4&&h<7?.3:1}),u.default.createElement("circle",{cx:"419",cy:"229.971",r:"7",fill:"white"}),u.default.createElement("circle",{cx:"419",cy:"342.4",r:"7",fill:"white"})),u.default.createElement("path",{d:"M538.5 261.5L536.5 410",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:h>3&&h<7?.3:1}),u.default.createElement("path",{d:"M419 478.5L536.5 410",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:h>3&&h<7?.3:1}),u.default.createElement("circle",{cx:"537",cy:"263",r:"7",fill:"white"}),u.default.createElement("circle",{cx:"537",cy:"409",r:"7",fill:"white"})),h>1&&u.default.createElement(u.default.Fragment,null,u.default.createElement("path",{d:"M301.501 409L300.001 263",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:h>2&&h<7?.3:1}),u.default.createElement("path",{d:"M301.501 409L419.001 478.5",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:h>2&&h<7?.3:1}),u.default.createElement("circle",{cx:"419",cy:"477.576",r:"7",fill:"white"}),u.default.createElement("circle",{cx:"301.914",cy:"263",r:"7",fill:"white"}),u.default.createElement("circle",{cx:"301.444",cy:"409",r:"7",fill:"white"})))),u.default.createElement("defs",null,u.default.createElement("clipPath",{id:"clip0_428_1188"},u.default.createElement("rect",{width:"840",height:"740",fill:"white"}))))}var Hy,Yy,Zy,Qy,Xy,Ky,Jy,eb,tb,nb,ab,rb,ib,ob,sb,lb="".concat(Ra,"/Selfie-Image-1.png"),ub=h.default.div(Hy||(Hy=w(["\n height: 100dvh;\n display: flex;\n flex-direction: column;\n background: ",";\n color: ",";\n"],["\n height: 100dvh;\n display: flex;\n flex-direction: column;\n background: ",";\n color: ",";\n"])),(function(e){var t,n,a,r;return null!==(r=null===(a=null===(n=null===(t=e.theme)||void 0===t?void 0:t.selfieCapture)||void 0===n?void 0:n.loadingOverlay)||void 0===a?void 0:a.backgroundColor)&&void 0!==r?r:"#ecedf3"}),(function(e){var t,n,a,r;return null!==(r=null===(a=null===(n=null===(t=e.theme)||void 0===t?void 0:t.selfieCapture)||void 0===n?void 0:n.loadingOverlay)||void 0===a?void 0:a.textColor)&&void 0!==r?r:"black"})),db=h.default.div(Yy||(Yy=w(["\n text-align: ",";\n display: flex;\n flex-direction: column;\n flex-wrap: nowrap;\n ","\n padding-bottom: 0;\n"],["\n text-align: ",";\n display: flex;\n flex-direction: column;\n flex-wrap: nowrap;\n ","\n padding-bottom: 0;\n"])),(function(e){var t;return null!==(t=e.theme.textAlign)&&void 0!==t?t:"center"}),(function(e){return e.theme.padding?"box-sizing: border-box; padding: ".concat(e.theme.padding,";"):""})),cb=h.default(lm)(Zy||(Zy=w(["\n padding: 16px 24px;\n margin-top: 16px;\n font-size: 18px;\n font-weight: bold;\n background: white;\n box-shadow:\n 0 1px 3px 0 rgb(0 0 0 / 0.1),\n 0 1px 2px -1px rgb(0 0 0 / 0.1);\n"],["\n padding: 16px 24px;\n margin-top: 16px;\n font-size: 18px;\n font-weight: bold;\n background: white;\n box-shadow:\n 0 1px 3px 0 rgb(0 0 0 / 0.1),\n 0 1px 2px -1px rgb(0 0 0 / 0.1);\n"]))),fb=h.default(ym)(Qy||(Qy=w(["\n display: flex;\n flex-direction: row;\n padding: 15px 25px;\n height: 100px;\n color: ",";\n ","\n position: fixed;\n bottom: 0;\n left: 0;\n width: 100dvw;\n box-sizing: border-box;\n"],["\n display: flex;\n flex-direction: row;\n padding: 15px 25px;\n height: 100px;\n color: ",";\n ","\n position: fixed;\n bottom: 0;\n left: 0;\n width: 100dvw;\n box-sizing: border-box;\n"])),(function(e){var t,n,a,r;return null!==(r=null===(a=null===(n=null===(t=e.theme)||void 0===t?void 0:t.selfieCapture)||void 0===n?void 0:n.loadingOverlay)||void 0===a?void 0:a.progressBarTextColor)&&void 0!==r?r:"white"}),(function(e){var t,n,a,r,i,o;return(null===(a=null===(n=null===(t=e.theme)||void 0===t?void 0:t.selfieCapture)||void 0===n?void 0:n.loadingOverlay)||void 0===a?void 0:a.progressBarFontSize)?"font-size: ".concat(null===(o=null===(i=null===(r=e.theme)||void 0===r?void 0:r.selfieCapture)||void 0===i?void 0:i.loadingOverlay)||void 0===o?void 0:o.progressBarFontSize,";"):""})),hb=h.default($)(Xy||(Xy=w(["\n padding: 0;\n\n & > svg {\n height: 100%;\n }\n"],["\n padding: 0;\n\n & > svg {\n height: 100%;\n }\n"]))),pb=h.default.div(Ky||(Ky=w(["\n display: flex;\n position: relative;\n z-index: 2;\n"],["\n display: flex;\n position: relative;\n z-index: 2;\n"]))),mb=h.default.ul(Jy||(Jy=w(["\n display: block;\n margin: auto;\n list-style: none;\n padding: 0;\n"],["\n display: block;\n margin: auto;\n list-style: none;\n padding: 0;\n"]))),gb=h.default.li(eb||(eb=w(["\n display: inline-flex;\n justify-content: center;\n align-items: center;\n padding: 2px 1.25rem 2px 0;\n line-height: 1rem;\n\n &::before {\n content: '';\n display: inline-block;\n height: 1rem;\n min-width: 1rem;\n vertical-align: middle;\n background-size: cover;\n background-repeat: no-repeat;\n margin: auto 0.5rem auto 0;\n }\n\n &.done::before {\n background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBjbGlwLXBhdGg9InVybCgjY2xpcDBfNDlfMzg1KSI+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xMiAyNEMxOC42Mjc0IDI0IDI0IDE4LjYyNzQgMjQgMTJDMjQgNS4zNzI1OCAxOC42Mjc0IDAgMTIgMEM1LjM3MjU4IDAgMCA1LjM3MjU4IDAgMTJDMCAxOC42Mjc0IDUuMzcyNTggMjQgMTIgMjRaTTE5LjU2NDMgOC4yNzg1MkMxOS45NTQ5IDcuODg3OTkgMTkuOTU0OSA3LjI1NDgzIDE5LjU2NDMgNi44NjQzQzE5LjE3MzggNi40NzM3OCAxOC41NDA2IDYuNDczNzggMTguMTUwMSA2Ljg2NDNMOS40Mjg2NiAxNS41ODU4TDUuODUwMDUgMTIuMDA3MkM1LjQ1OTUzIDExLjYxNjYgNC44MjYzNiAxMS42MTY2IDQuNDM1ODQgMTIuMDA3MkM0LjA0NTMxIDEyLjM5NzcgNC4wNDUzMSAxMy4wMzA5IDQuNDM1ODQgMTMuNDIxNEw4LjcyMTU1IDE3LjcwNzFDOS4xMTIwOCAxOC4wOTc2IDkuNzQ1MjQgMTguMDk3NiAxMC4xMzU4IDE3LjcwNzFMMTkuNTY0MyA4LjI3ODUyWiIgZmlsbD0id2hpdGUiLz48L2c+PGRlZnM+PGNsaXBQYXRoIGlkPSJjbGlwMF80OV8zODUiPjxyZWN0IHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgZmlsbD0id2hpdGUiLz48L2NsaXBQYXRoPjwvZGVmcz48L3N2Zz4=');\n }\n\n &.running::before {\n background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBjbGlwLXBhdGg9InVybCgjY2xpcDBfNDlfMzcwKSI+PG1hc2sgaWQ9InBhdGgtMS1pbnNpZGUtMV80OV8zNzAiIGZpbGw9IndoaXRlIj48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTMuNTE0NzIgMjAuNDg1NUM4LjIwMTAxIDI1LjE3MTggMTUuNzk5IDI1LjE3MTggMjAuNDg1MyAyMC40ODU1QzI1LjE3MTYgMTUuNzk5MiAyNS4xNzE2IDguMjAxMTkgMjAuNDg1MyAzLjUxNDlDMTUuNzk5IC0xLjE3MTM5IDguMjAxMDEgLTEuMTcxMzkgMy41MTQ3MiAzLjUxNDlDLTEuMTcxNTcgOC4yMDExOSAtMS4xNzE1NyAxNS43OTkyIDMuNTE0NzIgMjAuNDg1NVoiLz48L21hc2s+PHBhdGggZD0iTTYuMzk4MTQgMTEuNDU5QzUuODQ1ODYgMTEuNDU5IDUuMzk4MTQgMTEuOTA2NyA1LjM5ODE0IDEyLjQ1OUM1LjM5ODE0IDEzLjAxMTIgNS44NDU4NiAxMy40NTkgNi4zOTgxNCAxMy40NTlWMTEuNDU5Wk0xNy42MDE5IDEzLjQ1OUMxOC4xNTQxIDEzLjQ1OSAxOC42MDE5IDEzLjAxMTIgMTguNjAxOSAxMi40NTlDMTguNjAxOSAxMS45MDY3IDE4LjE1NDEgMTEuNDU5IDE3LjYwMTkgMTEuNDU5VjEzLjQ1OVpNNi4zOTgxNCAxMy40NTlIMTcuNjAxOVYxMS40NTlINi4zOTgxNFYxMy40NTlaTTMuNTE0NzIgMjAuNDg1NUw0LjkyODkzIDE5LjA3MTNMNC45Mjg5MyAxOS4wNzEzTDMuNTE0NzIgMjAuNDg1NVpNMjAuNDg1MyAzLjUxNDlMMTkuMDcxMSA0LjkyOTEyTDE5LjA3MTEgNC45MjkxMkwyMC40ODUzIDMuNTE0OVpNMy41MTQ3MiAzLjUxNDlMNC45Mjg5MyA0LjkyOTEyTDQuOTI4OTMgNC45MjkxMkwzLjUxNDcyIDMuNTE0OVpNMTkuMDcxMSAxOS4wNzEzQzE1LjE2NTggMjIuOTc2NSA4LjgzNDE3IDIyLjk3NjUgNC45Mjg5MyAxOS4wNzEzTDIuMTAwNTEgMjEuODk5N0M3LjU2Nzg0IDI3LjM2NyAxNi40MzIyIDI3LjM2NyAyMS44OTk1IDIxLjg5OTdMMTkuMDcxMSAxOS4wNzEzWk0xOS4wNzExIDQuOTI5MTJDMjIuOTc2MyA4LjgzNDM2IDIyLjk3NjMgMTUuMTY2IDE5LjA3MTEgMTkuMDcxM0wyMS44OTk1IDIxLjg5OTdDMjcuMzY2OCAxNi40MzIzIDI3LjM2NjggNy41NjgwMyAyMS44OTk1IDIuMTAwNjlMMTkuMDcxMSA0LjkyOTEyWk00LjkyODkzIDQuOTI5MTJDOC44MzQxNyAxLjAyMzg3IDE1LjE2NTggMS4wMjM4NyAxOS4wNzExIDQuOTI5MTJMMjEuODk5NSAyLjEwMDY5QzE2LjQzMjIgLTMuMzY2NjUgNy41Njc4NCAtMy4zNjY2NSAyLjEwMDUxIDIuMTAwNjlMNC45Mjg5MyA0LjkyOTEyWk00LjkyODkzIDE5LjA3MTNDMS4wMjM2OSAxNS4xNjYgMS4wMjM2OSA4LjgzNDM2IDQuOTI4OTMgNC45MjkxMkwyLjEwMDUxIDIuMTAwNjlDLTMuMzY2ODMgNy41NjgwMyAtMy4zNjY4MyAxNi40MzIzIDIuMTAwNTEgMjEuODk5N0w0LjkyODkzIDE5LjA3MTNaIiBmaWxsPSJ3aGl0ZSIgbWFzaz0idXJsKCNwYXRoLTEtaW5zaWRlLTFfNDlfMzcwKSIvPjwvZz48ZGVmcz48Y2xpcFBhdGggaWQ9ImNsaXAwXzQ5XzM3MCI+PHJlY3Qgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiBmaWxsPSJ3aGl0ZSIvPjwvY2xpcFBhdGg+PC9kZWZzPjwvc3ZnPg==');\n }\n"],["\n display: inline-flex;\n justify-content: center;\n align-items: center;\n padding: 2px 1.25rem 2px 0;\n line-height: 1rem;\n\n &::before {\n content: '';\n display: inline-block;\n height: 1rem;\n min-width: 1rem;\n vertical-align: middle;\n background-size: cover;\n background-repeat: no-repeat;\n margin: auto 0.5rem auto 0;\n }\n\n &.done::before {\n background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBjbGlwLXBhdGg9InVybCgjY2xpcDBfNDlfMzg1KSI+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xMiAyNEMxOC42Mjc0IDI0IDI0IDE4LjYyNzQgMjQgMTJDMjQgNS4zNzI1OCAxOC42Mjc0IDAgMTIgMEM1LjM3MjU4IDAgMCA1LjM3MjU4IDAgMTJDMCAxOC42Mjc0IDUuMzcyNTggMjQgMTIgMjRaTTE5LjU2NDMgOC4yNzg1MkMxOS45NTQ5IDcuODg3OTkgMTkuOTU0OSA3LjI1NDgzIDE5LjU2NDMgNi44NjQzQzE5LjE3MzggNi40NzM3OCAxOC41NDA2IDYuNDczNzggMTguMTUwMSA2Ljg2NDNMOS40Mjg2NiAxNS41ODU4TDUuODUwMDUgMTIuMDA3MkM1LjQ1OTUzIDExLjYxNjYgNC44MjYzNiAxMS42MTY2IDQuNDM1ODQgMTIuMDA3MkM0LjA0NTMxIDEyLjM5NzcgNC4wNDUzMSAxMy4wMzA5IDQuNDM1ODQgMTMuNDIxNEw4LjcyMTU1IDE3LjcwNzFDOS4xMTIwOCAxOC4wOTc2IDkuNzQ1MjQgMTguMDk3NiAxMC4xMzU4IDE3LjcwNzFMMTkuNTY0MyA4LjI3ODUyWiIgZmlsbD0id2hpdGUiLz48L2c+PGRlZnM+PGNsaXBQYXRoIGlkPSJjbGlwMF80OV8zODUiPjxyZWN0IHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgZmlsbD0id2hpdGUiLz48L2NsaXBQYXRoPjwvZGVmcz48L3N2Zz4=');\n }\n\n &.running::before {\n background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBjbGlwLXBhdGg9InVybCgjY2xpcDBfNDlfMzcwKSI+PG1hc2sgaWQ9InBhdGgtMS1pbnNpZGUtMV80OV8zNzAiIGZpbGw9IndoaXRlIj48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTMuNTE0NzIgMjAuNDg1NUM4LjIwMTAxIDI1LjE3MTggMTUuNzk5IDI1LjE3MTggMjAuNDg1MyAyMC40ODU1QzI1LjE3MTYgMTUuNzk5MiAyNS4xNzE2IDguMjAxMTkgMjAuNDg1MyAzLjUxNDlDMTUuNzk5IC0xLjE3MTM5IDguMjAxMDEgLTEuMTcxMzkgMy41MTQ3MiAzLjUxNDlDLTEuMTcxNTcgOC4yMDExOSAtMS4xNzE1NyAxNS43OTkyIDMuNTE0NzIgMjAuNDg1NVoiLz48L21hc2s+PHBhdGggZD0iTTYuMzk4MTQgMTEuNDU5QzUuODQ1ODYgMTEuNDU5IDUuMzk4MTQgMTEuOTA2NyA1LjM5ODE0IDEyLjQ1OUM1LjM5ODE0IDEzLjAxMTIgNS44NDU4NiAxMy40NTkgNi4zOTgxNCAxMy40NTlWMTEuNDU5Wk0xNy42MDE5IDEzLjQ1OUMxOC4xNTQxIDEzLjQ1OSAxOC42MDE5IDEzLjAxMTIgMTguNjAxOSAxMi40NTlDMTguNjAxOSAxMS45MDY3IDE4LjE1NDEgMTEuNDU5IDE3LjYwMTkgMTEuNDU5VjEzLjQ1OVpNNi4zOTgxNCAxMy40NTlIMTcuNjAxOVYxMS40NTlINi4zOTgxNFYxMy40NTlaTTMuNTE0NzIgMjAuNDg1NUw0LjkyODkzIDE5LjA3MTNMNC45Mjg5MyAxOS4wNzEzTDMuNTE0NzIgMjAuNDg1NVpNMjAuNDg1MyAzLjUxNDlMMTkuMDcxMSA0LjkyOTEyTDE5LjA3MTEgNC45MjkxMkwyMC40ODUzIDMuNTE0OVpNMy41MTQ3MiAzLjUxNDlMNC45Mjg5MyA0LjkyOTEyTDQuOTI4OTMgNC45MjkxMkwzLjUxNDcyIDMuNTE0OVpNMTkuMDcxMSAxOS4wNzEzQzE1LjE2NTggMjIuOTc2NSA4LjgzNDE3IDIyLjk3NjUgNC45Mjg5MyAxOS4wNzEzTDIuMTAwNTEgMjEuODk5N0M3LjU2Nzg0IDI3LjM2NyAxNi40MzIyIDI3LjM2NyAyMS44OTk1IDIxLjg5OTdMMTkuMDcxMSAxOS4wNzEzWk0xOS4wNzExIDQuOTI5MTJDMjIuOTc2MyA4LjgzNDM2IDIyLjk3NjMgMTUuMTY2IDE5LjA3MTEgMTkuMDcxM0wyMS44OTk1IDIxLjg5OTdDMjcuMzY2OCAxNi40MzIzIDI3LjM2NjggNy41NjgwMyAyMS44OTk1IDIuMTAwNjlMMTkuMDcxMSA0LjkyOTEyWk00LjkyODkzIDQuOTI5MTJDOC44MzQxNyAxLjAyMzg3IDE1LjE2NTggMS4wMjM4NyAxOS4wNzExIDQuOTI5MTJMMjEuODk5NSAyLjEwMDY5QzE2LjQzMjIgLTMuMzY2NjUgNy41Njc4NCAtMy4zNjY2NSAyLjEwMDUxIDIuMTAwNjlMNC45Mjg5MyA0LjkyOTEyWk00LjkyODkzIDE5LjA3MTNDMS4wMjM2OSAxNS4xNjYgMS4wMjM2OSA4LjgzNDM2IDQuOTI4OTMgNC45MjkxMkwyLjEwMDUxIDIuMTAwNjlDLTMuMzY2ODMgNy41NjgwMyAtMy4zNjY4MyAxNi40MzIzIDIuMTAwNTEgMjEuODk5N0w0LjkyODkzIDE5LjA3MTNaIiBmaWxsPSJ3aGl0ZSIgbWFzaz0idXJsKCNwYXRoLTEtaW5zaWRlLTFfNDlfMzcwKSIvPjwvZz48ZGVmcz48Y2xpcFBhdGggaWQ9ImNsaXAwXzQ5XzM3MCI+PHJlY3Qgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiBmaWxsPSJ3aGl0ZSIvPjwvY2xpcFBhdGg+PC9kZWZzPjwvc3ZnPg==');\n }\n"]))),vb=h.default.div(tb||(tb=w(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n"],["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n"]))),yb=h.default.div(nb||(nb=w(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: ",";\n opacity: ",";\n"],["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: ",";\n opacity: ",";\n"])),(function(e){var t,n,a,r;return null!==(r=null===(a=null===(n=null===(t=e.theme)||void 0===t?void 0:t.selfieCapture)||void 0===n?void 0:n.loadingOverlay)||void 0===a?void 0:a.progressBarBackgroundColor)&&void 0!==r?r:"var(--idm-color-positive-600)"}),(function(e){var t,n,a,r;return null!==(r=null===(a=null===(n=null===(t=e.theme)||void 0===t?void 0:t.selfieCapture)||void 0===n?void 0:n.loadingOverlay)||void 0===a?void 0:a.progressBarBackgroundOpacity)&&void 0!==r?r:.75})),bb=h.default.span(ab||(ab=w(["\n display: block;\n width: ","%;\n height: 100%;\n"],["\n display: block;\n width: ","%;\n height: 100%;\n"])),(function(e){return e.$progress})),xb=h.default.span(rb||(rb=w(["\n display: block;\n height: 100%;\n background: ",";\n animation: progressBar 3s ease-in-out;\n animation-fill-mode: both;\n\n @keyframes progressBar {\n 0% {\n width: 0;\n }\n 100% {\n width: 100%;\n }\n }\n"],["\n display: block;\n height: 100%;\n background: ",";\n animation: progressBar 3s ease-in-out;\n animation-fill-mode: both;\n\n @keyframes progressBar {\n 0% {\n width: 0;\n }\n 100% {\n width: 100%;\n }\n }\n"])),(function(e){var t,n,a,r;return null!==(r=null===(a=null===(n=null===(t=e.theme)||void 0===t?void 0:t.selfieCapture)||void 0===n?void 0:n.loadingOverlay)||void 0===a?void 0:a.progressBarIndicatorColor)&&void 0!==r?r:"var(--idm-color-positive-600)"})),Cb=h.default.img(ib||(ib=w([""],[""]))),wb=h.default.div(ob||(ob=w(["\n display: flex;\n"],["\n display: flex;\n"]))),Eb=h.default(ce)(sb||(sb=w(["\n margin: auto;\n white-space: nowrap;\n ","\n ","\n"],["\n margin: auto;\n white-space: nowrap;\n ","\n ","\n"])),(function(e){var t,n,a,r,i,o;return(null===(a=null===(n=null===(t=e.theme)||void 0===t?void 0:t.selfieCapture)||void 0===n?void 0:n.loadingOverlay)||void 0===a?void 0:a.progressBarFontSize)?"font-size: ".concat(null===(o=null===(i=null===(r=e.theme)||void 0===r?void 0:r.selfieCapture)||void 0===i?void 0:i.loadingOverlay)||void 0===o?void 0:o.progressBarFontSize,";"):""}),(function(e){var t,n,a,r,i,o;return(null===(a=null===(n=null===(t=e.theme)||void 0===t?void 0:t.selfieCapture)||void 0===n?void 0:n.loadingOverlay)||void 0===a?void 0:a.continueBtnBorder)?"border: ".concat(null===(o=null===(i=null===(r=e.theme)||void 0===r?void 0:r.selfieCapture)||void 0===i?void 0:i.loadingOverlay)||void 0===o?void 0:o.continueBtnBorder,";"):""})),kb={default:function(e){var n=e.onDismissed,a=e.onUserCancel,r=e.assets,i=void 0===r?{}:r,o=e.classNames,s=void 0===o?{}:o,l=e.colors,d=void 0===l?{}:l,c=e.verbiage,f=void 0===c?{}:c,h=t.useContext(Xe),p=h.cameraReady,m=h.cameraAccessDenied,g=t.useContext(Qf),v=g.ready,y=g.modelDownloadProgress,b=Xp(f,{headingText:"Use your device camera to capture your face",removeEyeCoveringsText:"Remove Sunglasses & Hat",avoidExcessiveBacklightingText:"Avoid Excessive Backlighting",continueText:"Let's Go!",cameraInitializingText:"Accessing camera...",cameraInitializedText:"Camera ready",downloadingText:"Downloading...",modelsWarmingUpText:"Loading guided capture experience...",modelsReadyText:"Guided capture experience ready"}),x=t.useState(0),C=x[1],w=[b.headingText,b.removeEyeCoveringsText,b.avoidExcessiveBacklightingText][x[0]];t.useEffect((function(){setInterval((function(){C((function(e){return(e+1)%3}))}),3e3)}),[]);var E=t.useState(!1),k=E[1];return E[0]?u.default.createElement(u.default.Fragment,null):m?u.default.createElement(cm,{assets:i.cameraAccessDenied,classNames:s.cameraAccessDenied,colors:d.cameraAccessDenied,verbiage:f.cameraAccessDenied}):u.default.createElement(W,{className:s.container},u.default.createElement(ub,{className:s.inner},a&&u.default.createElement(vm,{onClick:a,className:s.cancelBtn}),u.default.createElement(db,{className:s.headingContainer},u.default.createElement(cb,{className:s.heading},w)),u.default.createElement(hb,{className:s.imageContainer},(null==i?void 0:i.instructionImageUrl)&&i.instructionImageUrl!==lb?u.default.createElement(Cb,{className:s.image,alt:b.headingText,src:i.instructionImageUrl}):u.default.createElement(qy,{className:s.image})),u.default.createElement(fb,{className:s.buttonsRow},u.default.createElement(vb,{className:s.progressContainer},u.default.createElement(yb,{className:s.progressBackground}),u.default.createElement(bb,{$progress:y,className:s.progressBar},u.default.createElement(xb,{className:s.progressIndicator}))),u.default.createElement(pb,{className:s.loadingListContainer},u.default.createElement(mb,{className:s.loadingList},u.default.createElement(gb,{className:"".concat(s.loadingListItem," ").concat(p?"done":"running")},p?b.cameraInitializedText:b.cameraInitializingText),u.default.createElement(gb,{className:"".concat(s.loadingListItem," ").concat(v?"done":"running")},v?b.modelsReadyText:y>=100?b.modelsWarmingUpText:"".concat(b.downloadingText," (").concat(y,"%)")))),u.default.createElement(wb,{className:s.continueBtnContainer},v&&p&&u.default.createElement(Eb,{finished:!0,className:s.continueBtn,variant:"positive",colors:d.continueBtn,onClick:function(){k(!0),null==n||n()}},b.continueText)))))},legacy:function(e){var n=e.onDismissed,a=e.onUserCancel,r=e.assets,i=void 0===r?{}:r,o=e.classNames,s=void 0===o?{}:o,l=e.colors,d=void 0===l?{}:l,c=e.verbiage,f=void 0===c?{}:c,h=t.useContext(Xe),p=h.cameraReady,m=h.cameraAccessDenied,g=t.useContext(Qf),v=g.ready,y=g.modelDownloadProgress;i.instructionImageUrl||(i.instructionImageUrl="".concat(Ra,"/Selfie-Image-1.png"));var b=Xp(f,{headingText:"Use your device camera to capture your face",removeEyeCoveringsText:"Remove Sunglasses & Hat",avoidExcessiveBacklightingText:"Avoid Excessive Backlighting",continueText:"Continue",cameraInitializingText:"Camera initializing...",downloadingText:"Downloading...",modelsWarmingUpText:"Models warming up..."}),x=t.useState(!1),C=x[1];return x[0]?u.default.createElement(u.default.Fragment,null):m?u.default.createElement(cm,{assets:i.cameraAccessDenied,classNames:s.cameraAccessDenied,colors:d.cameraAccessDenied,verbiage:f.cameraAccessDenied}):u.default.createElement(W,{className:s.container},u.default.createElement(V,{className:s.inner},u.default.createElement("h3",{className:s.heading},b.headingText),a&&u.default.createElement(vm,{onClick:a,className:s.cancelBtn}),u.default.createElement(Vy,null,b.removeEyeCoveringsText,u.default.createElement("br",null),b.avoidExcessiveBacklightingText),u.default.createElement($,{className:s.imageContainer},u.default.createElement("img",{className:s.image,alt:b.headingText,src:i.instructionImageUrl})),u.default.createElement($y,{className:s.buttonsRow},u.default.createElement(ce,{variant:"positive",disabled:!p||!v,finished:p&&v,className:s.continueBtn,colors:d.continueBtn,onClick:function(){C(!0),null==n||n()}},p&&v?b.continueText:v?b.cameraInitializingText:y>=100?"".concat(b.modelsWarmingUpText):"".concat(b.downloadingText," (").concat(y,"%)")))))}},Tb=function(e){var t,n=e.mode,a=void 0===n?"default":n,r=y(e,["mode"]),i=null!==(t=kb[a])&&void 0!==t?t:kb.default;return u.default.createElement(i,v({},r))},Mb=function(e){var n,a,r,i=e.onComplete,o=e.onSuccess,s=e.onTimeout,l=e.onExitCapture,d=e.onExitAfterFailure,c=e.onUserCancel,f=e.loadingOverlayMode,h=void 0===f?"default":f,p=e.timeoutDurationMs,m=void 0===p?15e3:p,g=e.maxRetries,v=void 0===g?2:g,y=e.skipSuccessScreen,C=void 0!==y&&y,w=e.renderCameraFeed,E=void 0===w||w,k=e.releaseCameraAccessOnExit,T=void 0===k||k,M=e.assets,S=void 0===M?{}:M,D=e.classNames,N=void 0===D?{}:D,A=e.colors,L=void 0===A?{}:A,R=e.verbiage,O=void 0===R?{}:R,F=e.debugMode,j=void 0!==F&&F,P=t.useContext(Ie),_=P.submissionResponse,U=P.livenessCheckRequest,z=P.setSelfieImage,G=P.logSelfieCaptureAttempt,W=t.useContext(Xe).releaseCameraAccess,V=t.useState(""),$=V[0],q=V[1],H=t.useState(0),Y=H[0],Z=H[1],Q=t.useState("LOADING"),X=Q[0],K=Q[1],J=t.useRef(),ee=t.useRef(),te=t.useRef();t.useEffect((function(){te.current=new Date}),[]),t.useEffect((function(){"CAPTURING"===X&&(J.current=new Date)}),[X]);var ne=t.useCallback((function(){ee.current=new Date}),[]),ae=t.useCallback((function(){var e,t,n;G({autoCapture:"Y",captureTime:(null!==(e=ee.current)&&void 0!==e?e:new Date).getTime()-(null!==(t=J.current)&&void 0!==t?t:new Date).getTime(),operationTime:(new Date).getTime()-(null!==(n=te.current)&&void 0!==n?n:new Date).getTime()}),te.current=new Date}),[G]),re=t.useCallback((function(e){return b(void 0,void 0,void 0,(function(){var t;return x(this,(function(n){switch(n.label){case 0:return U&&_?(K("SUCCESS"),q(e),t=z,[4,I(e)]):[2];case 1:return t.apply(void 0,[n.sent()]),null==o||o(_,U),[2]}}))}))}),[o,z,U,_]),ie=t.useCallback((function(){K("FAILED"),null==s||s(_,U)}),[s,U,_]),oe=t.useState(0),se=oe[0],le=oe[1],ue=t.useCallback((function(){le((function(e){return e+1})),K("LOADING"),null==l||l()}),[l]),de=t.useCallback((function(){ae(),T&&W(),setTimeout((function(){null==i||i(_,U)}),0)}),[ae,i,W,T,U,_]),ce=Lg(C,"SUCCESS"===X,de);return u.default.createElement(u.default.Fragment,null,u.default.createElement(B,{className:"flex ".concat(null!==(a=null===(n=N.capture)||void 0===n?void 0:n.container)&&void 0!==a?a:"")},E&&u.default.createElement(Ng,{className:null===(r=N.capture)||void 0===r?void 0:r.cameraFeed}),"LOADING"!==X&&function(){switch(X){case"CAPTURING":return u.default.createElement(_y,{key:"capture".concat(se),onCapture:ne,onSuccess:re,onTimeout:ie,onExit:ue,timeoutDurationMs:m,classNames:N.capture,colors:L,verbiage:O,debugMode:j});case"SUCCESS":return ce?u.default.createElement(Uy,{key:"success",imageUrl:$,classNames:N.success,colors:L.success,verbiage:O.success,onDoneClick:de,onRetryClick:function(){ae(),K("CAPTURING")}}):null;case"FAILED":return u.default.createElement(Gy,{key:"failure",assets:S.failure,classNames:N.failure,colors:L.failure,verbiage:O.failure,canRetry:v>-1&&Y<v,onRetryClick:function(){ae(),Z((function(e){return e+1})),K("CAPTURING")},onExitClick:function(){T&&W(),setTimeout((function(){null==d||d(_,U)}),0)}});default:return null}}()),u.default.createElement(Tb,{key:se,mode:h,assets:S.loadingOverlay,classNames:N.loadingOverlay,colors:L.loadingOverlay,verbiage:O.loadingOverlay,onUserCancel:c,onDismissed:function(){K("CAPTURING")}}))},Ib=function(e){var n=e.children,a=t.useState({width:1,height:1}),r=a[1],i=t.useState(1),o=i[0],s=i[1],l=Le(),d=l.ref,c=l.width,f=void 0===c?1:c,h=l.height,p=void 0===h?1:h,m=f/p,g=t.useCallback((function(e){var t=e.target;s(t.naturalWidth/t.naturalHeight)}),[]);return u.default.createElement(Zg.Provider,{value:{orientation:"landscape",wrapperWidth:f,wrapperHeight:p,wrapperAspectRatio:m,imageAspectRatio:o,setDimensions:r,wrapperRef:d,onImageLoaded:g}},n)},Sb=function(){var e=t.useContext(Ie),n=e.submissionRequest,a=e.submissionResponse,r=t.useState(!1),i=r[0],o=r[1],s=t.useState(!0),l=s[0],d=s[1],c=t.useMemo((function(){var e,t,a,r,i,o,s=JSON.parse(JSON.stringify(n));return l&&((null===(t=null===(e=null==s?void 0:s.customerData)||void 0===e?void 0:e.idData)||void 0===t?void 0:t.idImageFront)&&(s.customerData.idData.idImageFront=Db(s.customerData.idData.idImageFront,200)),(null===(r=null===(a=null==s?void 0:s.customerData)||void 0===a?void 0:a.idData)||void 0===r?void 0:r.idImageBack)&&(s.customerData.idData.idImageBack=Db(s.customerData.idData.idImageBack,200)),(null===(o=null===(i=null==s?void 0:s.customerData)||void 0===i?void 0:i.biometricData)||void 0===o?void 0:o.selfie)&&(s.customerData.biometricData.selfie=Db(s.customerData.biometricData.selfie,200))),JSON.stringify(s,null,2)}),[n,l]);return u.default.createElement(u.default.Fragment,null,u.default.createElement("h3",null,"Submission completed!"),u.default.createElement("button",{onClick:function(){o(!i)}},i?"Hide":"Show"," request body"),i&&u.default.createElement(u.default.Fragment,null,u.default.createElement("button",{style:{marginLeft:8},onClick:function(){d(!l)}},l?"Display full images":"Truncate images"),u.default.createElement("h5",null,"Request Body"),u.default.createElement("pre",null,c)),u.default.createElement("h5",null,"Response Body"),u.default.createElement("pre",null,JSON.stringify(a,null,2)))};function Db(e,t){var n=e.split("").splice(0,t).join("");return n.length<e.length&&(n+="..."),n}var Nb,Ab,Lb,Rb,Ob=function(e){var n=e.document,a=e.onComplete,r=e.classNames,i=void 0===r?{}:r,o=e.verbiage,s=void 0===o?{}:o,l=t.useRef(null),d=t.useState(null),c=d[0],f=d[1],h=Xp(s,{headingText:"Additional document capture",captureBtnText:"Capture",nextBtnText:"Next"});return u.default.createElement(W,{className:i.container},u.default.createElement(Fb,{className:i.inner},u.default.createElement(jb,{className:i.heading},h.headingText,": ",n.name),n.description&&u.default.createElement(Pb,{className:i.description},n.description),u.default.createElement("input",{ref:l,type:"file",accept:"image/*,.pdf",onChange:function(e){var t,n=null===(t=e.target.files)||void 0===t?void 0:t[0];n&&f(n)},hidden:!0}),u.default.createElement(Bb,{className:i.buttonsRow},c?u.default.createElement(ce,{variant:"positive",className:i.nextBtn,disabled:!c,finished:!0,onClick:function(){if(c){var e=new FileReader;e.onloadend=function(){if(e.result){var t=e.result.toString();null==a||a({documentName:n.name,additionalDocument:{name:c.name,fileContent:S(t),type:D(t),fileUploadType:"Y",isImageControlData:"Y",fieldId:""}})}},e.readAsDataURL(c)}}},h.nextBtnText):u.default.createElement(ce,{variant:"primary",className:i.captureBtn,finished:!0,onClick:function(){var e;null===(e=l.current)||void 0===e||e.click()}},h.captureBtnText))))},Fb=h.default(V)(Nb||(Nb=w(["\n justify-content: center;\n"],["\n justify-content: center;\n"]))),jb=h.default.h3(Ab||(Ab=w(["\n margin-bottom: 8px;\n"],["\n margin-bottom: 8px;\n"]))),Pb=h.default.p(Lb||(Lb=w(["\n margin-bottom: 8px;\n"],["\n margin-bottom: 8px;\n"]))),Bb=h.default(ym)(Rb||(Rb=w(["\n margin-top: 32px;\n"],["\n margin-top: 32px;\n"]))),_b=function(e){var n=e.documents,a=e.onComplete,r=e.classNames,i=void 0===r?{}:r,o=e.verbiage,s=void 0===o?{}:o,l=t.useState([]),d=l[0],c=l[1],f=d.length,h=n[f],p=f>=n.length;return t.useEffect((function(){(null==h?void 0:h.skip)&&b(void 0,void 0,void 0,(function(){var e;return x(this,(function(t){switch(t.label){case 0:return[4,null===(e=h.skip)||void 0===e?void 0:e.call(h)];case 1:return t.sent()&&c((function(e){return C(C([],e,!0),[null],!1)})),[2]}}))}))}),[h]),t.useEffect((function(){p&&(null==a||a(d.filter((function(e){return!!e}))))}),[p,a,d]),p?u.default.createElement(u.default.Fragment,null,"Thanks, your documents have been received."):u.default.createElement(Ob,{key:f,document:h,classNames:i,verbiage:s,onComplete:function(e){c((function(t){return C(C([],t,!0),[e],!1)}))}})},Ub="function"==typeof Symbol&&Symbol.for,zb=Ub?Symbol.for("react.element"):60103,Gb=Ub?Symbol.for("react.portal"):60106,Wb=Ub?Symbol.for("react.fragment"):60107,Vb=Ub?Symbol.for("react.strict_mode"):60108,$b=Ub?Symbol.for("react.profiler"):60114,qb=Ub?Symbol.for("react.provider"):60109,Hb=Ub?Symbol.for("react.context"):60110,Yb=Ub?Symbol.for("react.async_mode"):60111,Zb=Ub?Symbol.for("react.concurrent_mode"):60111,Qb=Ub?Symbol.for("react.forward_ref"):60112,Xb=Ub?Symbol.for("react.suspense"):60113,Kb=Ub?Symbol.for("react.suspense_list"):60120,Jb=Ub?Symbol.for("react.memo"):60115,ex=Ub?Symbol.for("react.lazy"):60116,tx=Ub?Symbol.for("react.block"):60121,nx=Ub?Symbol.for("react.fundamental"):60117,ax=Ub?Symbol.for("react.responder"):60118,rx=Ub?Symbol.for("react.scope"):60119;function ix(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case zb:switch(e=e.type){case Yb:case Zb:case Wb:case $b:case Vb:case Xb:return e;default:switch(e=e&&e.$$typeof){case Hb:case Qb:case ex:case Jb:case qb:return e;default:return t}}case Gb:return t}}}function ox(e){return ix(e)===Zb}var sx={AsyncMode:Yb,ConcurrentMode:Zb,ContextConsumer:Hb,ContextProvider:qb,Element:zb,ForwardRef:Qb,Fragment:Wb,Lazy:ex,Memo:Jb,Portal:Gb,Profiler:$b,StrictMode:Vb,Suspense:Xb,isAsyncMode:function(e){return ox(e)||ix(e)===Yb},isConcurrentMode:ox,isContextConsumer:function(e){return ix(e)===Hb},isContextProvider:function(e){return ix(e)===qb},isElement:function(e){return"object"==typeof e&&null!==e&&e.$$typeof===zb},isForwardRef:function(e){return ix(e)===Qb},isFragment:function(e){return ix(e)===Wb},isLazy:function(e){return ix(e)===ex},isMemo:function(e){return ix(e)===Jb},isPortal:function(e){return ix(e)===Gb},isProfiler:function(e){return ix(e)===$b},isStrictMode:function(e){return ix(e)===Vb},isSuspense:function(e){return ix(e)===Xb},isValidElementType:function(e){return"string"==typeof e||"function"==typeof e||e===Wb||e===Zb||e===$b||e===Vb||e===Xb||e===Kb||"object"==typeof e&&null!==e&&(e.$$typeof===ex||e.$$typeof===Jb||e.$$typeof===qb||e.$$typeof===Hb||e.$$typeof===Qb||e.$$typeof===nx||e.$$typeof===ax||e.$$typeof===rx||e.$$typeof===tx)},typeOf:ix};Y((function(e,t){}));Y((function(e){e.exports=sx}));function lx(){}function ux(){}ux.resetWarningCache=lx;var dx=Y((function(e){e.exports=function(){function e(e,t,n,a,r,i){if("SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"!==i){var o=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw o.name="Invariant Violation",o}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:ux,resetWarningCache:lx};return n.PropTypes=n,n}()}));function cx(e,t,n){this.x=e,this.y=t,this.time=n||(new Date).getTime()}function fx(e,t,n,a){this.startPoint=e,this.control1=t,this.control2=n,this.endPoint=a}function hx(e,t){var n=this,a=t||{};this.velocityFilterWeight=a.velocityFilterWeight||.7,this.minWidth=a.minWidth||.5,this.maxWidth=a.maxWidth||2.5,this.throttle="throttle"in a?a.throttle:16,this.minDistance="minDistance"in a?a.minDistance:5,this._strokeMoveUpdate=this.throttle?function(e,t,n){var a,r,i,o=null,s=0;n||(n={});var l=function(){s=!1===n.leading?0:Date.now(),o=null,i=e.apply(a,r),o||(a=r=null)};return function(){var u=Date.now();s||!1!==n.leading||(s=u);var d=t-(u-s);return a=this,r=arguments,d<=0||d>t?(o&&(clearTimeout(o),o=null),s=u,i=e.apply(a,r),o||(a=r=null)):o||!1===n.trailing||(o=setTimeout(l,d)),i}}(hx.prototype._strokeUpdate,this.throttle):hx.prototype._strokeUpdate,this.dotSize=a.dotSize||function(){return(this.minWidth+this.maxWidth)/2},this.penColor=a.penColor||"black",this.backgroundColor=a.backgroundColor||"rgba(0,0,0,0)",this.onBegin=a.onBegin,this.onEnd=a.onEnd,this._canvas=e,this._ctx=e.getContext("2d"),this.clear(),this._handleMouseDown=function(e){1===e.which&&(n._mouseButtonDown=!0,n._strokeBegin(e))},this._handleMouseMove=function(e){n._mouseButtonDown&&n._strokeMoveUpdate(e)},this._handleMouseUp=function(e){1===e.which&&n._mouseButtonDown&&(n._mouseButtonDown=!1,n._strokeEnd(e))},this._handleTouchStart=function(e){1===e.targetTouches.length&&n._strokeBegin(e.changedTouches[0])},this._handleTouchMove=function(e){e.preventDefault(),n._strokeMoveUpdate(e.targetTouches[0])},this._handleTouchEnd=function(e){e.target===n._canvas&&(e.preventDefault(),n._strokeEnd(e))},this.on()}cx.prototype.velocityFrom=function(e){return this.time!==e.time?this.distanceTo(e)/(this.time-e.time):1},cx.prototype.distanceTo=function(e){return Math.sqrt(Math.pow(this.x-e.x,2)+Math.pow(this.y-e.y,2))},cx.prototype.equals=function(e){return this.x===e.x&&this.y===e.y&&this.time===e.time},fx.prototype.length=function(){for(var e=0,t=void 0,n=void 0,a=0;a<=10;a+=1){var r=a/10,i=this._point(r,this.startPoint.x,this.control1.x,this.control2.x,this.endPoint.x),o=this._point(r,this.startPoint.y,this.control1.y,this.control2.y,this.endPoint.y);if(a>0){var s=i-t,l=o-n;e+=Math.sqrt(s*s+l*l)}t=i,n=o}return e},fx.prototype._point=function(e,t,n,a,r){return t*(1-e)*(1-e)*(1-e)+3*n*(1-e)*(1-e)*e+3*a*(1-e)*e*e+r*e*e*e},hx.prototype.clear=function(){var e=this._ctx,t=this._canvas;e.fillStyle=this.backgroundColor,e.clearRect(0,0,t.width,t.height),e.fillRect(0,0,t.width,t.height),this._data=[],this._reset(),this._isEmpty=!0},hx.prototype.fromDataURL=function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=new Image,r=n.ratio||window.devicePixelRatio||1,i=n.width||this._canvas.width/r,o=n.height||this._canvas.height/r;this._reset(),a.src=e,a.onload=function(){t._ctx.drawImage(a,0,0,i,o)},this._isEmpty=!1},hx.prototype.toDataURL=function(e){var t;if("image/svg+xml"===e)return this._toSVG();for(var n=arguments.length,a=Array(n>1?n-1:0),r=1;r<n;r++)a[r-1]=arguments[r];return(t=this._canvas).toDataURL.apply(t,[e].concat(a))},hx.prototype.on=function(){this._handleMouseEvents(),this._handleTouchEvents()},hx.prototype.off=function(){this._canvas.removeEventListener("mousedown",this._handleMouseDown),this._canvas.removeEventListener("mousemove",this._handleMouseMove),document.removeEventListener("mouseup",this._handleMouseUp),this._canvas.removeEventListener("touchstart",this._handleTouchStart),this._canvas.removeEventListener("touchmove",this._handleTouchMove),this._canvas.removeEventListener("touchend",this._handleTouchEnd)},hx.prototype.isEmpty=function(){return this._isEmpty},hx.prototype._strokeBegin=function(e){this._data.push([]),this._reset(),this._strokeUpdate(e),"function"==typeof this.onBegin&&this.onBegin(e)},hx.prototype._strokeUpdate=function(e){var t=this._createPoint(e.clientX,e.clientY),n=this._data[this._data.length-1],a=n&&n[n.length-1],r=a&&t.distanceTo(a)<this.minDistance;if(!a||!r){var i=this._addPoint(t),o=i.curve,s=i.widths;o&&s&&this._drawCurve(o,s.start,s.end),this._data[this._data.length-1].push({x:t.x,y:t.y,time:t.time,color:this.penColor})}},hx.prototype._strokeEnd=function(e){var t=this.points[0];if(!(this.points.length>2)&&t&&this._drawDot(t),t){var n=this._data[this._data.length-1];t.equals(n[n.length-1])||n.push({x:t.x,y:t.y,time:t.time,color:this.penColor})}"function"==typeof this.onEnd&&this.onEnd(e)},hx.prototype._handleMouseEvents=function(){this._mouseButtonDown=!1,this._canvas.addEventListener("mousedown",this._handleMouseDown),this._canvas.addEventListener("mousemove",this._handleMouseMove),document.addEventListener("mouseup",this._handleMouseUp)},hx.prototype._handleTouchEvents=function(){this._canvas.style.msTouchAction="none",this._canvas.style.touchAction="none",this._canvas.addEventListener("touchstart",this._handleTouchStart),this._canvas.addEventListener("touchmove",this._handleTouchMove),this._canvas.addEventListener("touchend",this._handleTouchEnd)},hx.prototype._reset=function(){this.points=[],this._lastVelocity=0,this._lastWidth=(this.minWidth+this.maxWidth)/2,this._ctx.fillStyle=this.penColor},hx.prototype._createPoint=function(e,t,n){var a=this._canvas.getBoundingClientRect();return new cx(e-a.left,t-a.top,n||(new Date).getTime())},hx.prototype._addPoint=function(e){var t=this.points,n=void 0;if(t.push(e),t.length>2){3===t.length&&t.unshift(t[0]);var a=(n=this._calculateCurveControlPoints(t[0],t[1],t[2])).c2;n=this._calculateCurveControlPoints(t[1],t[2],t[3]);var r=new fx(t[1],a,n.c1,t[2]),i=this._calculateCurveWidths(r);return t.shift(),{curve:r,widths:i}}return{}},hx.prototype._calculateCurveControlPoints=function(e,t,n){var a=e.x-t.x,r=e.y-t.y,i=t.x-n.x,o=t.y-n.y,s=(e.x+t.x)/2,l=(e.y+t.y)/2,u=(t.x+n.x)/2,d=(t.y+n.y)/2,c=Math.sqrt(a*a+r*r),f=Math.sqrt(i*i+o*o),h=f/(c+f),p=t.x-(u+(s-u)*h),m=t.y-(d+(l-d)*h);return{c1:new cx(s+p,l+m),c2:new cx(u+p,d+m)}},hx.prototype._calculateCurveWidths=function(e){var t={start:null,end:null},n=this.velocityFilterWeight*e.endPoint.velocityFrom(e.startPoint)+(1-this.velocityFilterWeight)*this._lastVelocity,a=this._strokeWidth(n);return t.start=this._lastWidth,t.end=a,this._lastVelocity=n,this._lastWidth=a,t},hx.prototype._strokeWidth=function(e){return Math.max(this.maxWidth/(e+1),this.minWidth)},hx.prototype._drawPoint=function(e,t,n){var a=this._ctx;a.moveTo(e,t),a.arc(e,t,n,0,2*Math.PI,!1),this._isEmpty=!1},hx.prototype._drawCurve=function(e,t,n){var a=this._ctx,r=n-t,i=Math.floor(e.length());a.beginPath();for(var o=0;o<i;o+=1){var s=o/i,l=s*s,u=l*s,d=1-s,c=d*d,f=c*d,h=f*e.startPoint.x;h+=3*c*s*e.control1.x,h+=3*d*l*e.control2.x;var p=f*e.startPoint.y;p+=3*c*s*e.control1.y,p+=3*d*l*e.control2.y,this._drawPoint(h+=u*e.endPoint.x,p+=u*e.endPoint.y,t+u*r)}a.closePath(),a.fill()},hx.prototype._drawDot=function(e){var t=this._ctx,n="function"==typeof this.dotSize?this.dotSize():this.dotSize;t.beginPath(),this._drawPoint(e.x,e.y,n),t.closePath(),t.fill()},hx.prototype._fromData=function(e,t,n){for(var a=0;a<e.length;a+=1){var r=e[a];if(r.length>1)for(var i=0;i<r.length;i+=1){var o=r[i],s=new cx(o.x,o.y,o.time),l=o.color;if(0===i)this.penColor=l,this._reset(),this._addPoint(s);else if(i!==r.length-1){var u=this._addPoint(s),d=u.curve,c=u.widths;d&&c&&t(d,c,l)}}else this._reset(),n(r[0])}},hx.prototype._toSVG=function(){var e=this,t=this._data,n=this._canvas,a=Math.max(window.devicePixelRatio||1,1),r=n.width/a,i=n.height/a,o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.setAttributeNS(null,"width",n.width),o.setAttributeNS(null,"height",n.height),this._fromData(t,(function(e,t,n){var a=document.createElement("path");if(!(isNaN(e.control1.x)||isNaN(e.control1.y)||isNaN(e.control2.x)||isNaN(e.control2.y))){var r="M "+e.startPoint.x.toFixed(3)+","+e.startPoint.y.toFixed(3)+" C "+e.control1.x.toFixed(3)+","+e.control1.y.toFixed(3)+" "+e.control2.x.toFixed(3)+","+e.control2.y.toFixed(3)+" "+e.endPoint.x.toFixed(3)+","+e.endPoint.y.toFixed(3);a.setAttribute("d",r),a.setAttribute("stroke-width",(2.25*t.end).toFixed(3)),a.setAttribute("stroke",n),a.setAttribute("fill","none"),a.setAttribute("stroke-linecap","round"),o.appendChild(a)}}),(function(t){var n=document.createElement("circle"),a="function"==typeof e.dotSize?e.dotSize():e.dotSize;n.setAttribute("r",a),n.setAttribute("cx",t.x),n.setAttribute("cy",t.y),n.setAttribute("fill",t.color),o.appendChild(n)}));var s='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 '+r+" "+i+'" width="'+r+'" height="'+i+'">',l=o.innerHTML;if(void 0===l){var u=document.createElement("dummy"),d=o.childNodes;u.innerHTML="";for(var c=0;c<d.length;c+=1)u.appendChild(d[c].cloneNode(!0));l=u.innerHTML}return"data:image/svg+xml;base64,"+btoa(s+l+"</svg>")},hx.prototype.fromData=function(e){var t=this;this.clear(),this._fromData(e,(function(e,n){return t._drawCurve(e,n.start,n.end)}),(function(e){return t._drawDot(e)})),this._data=e},hx.prototype.toData=function(){return this._data};var px=Object.freeze({__proto__:null,default:hx}),mx=Y((function(e,t){e.exports=function(e){function t(a){if(n[a])return n[a].exports;var r=n[a]={exports:{},id:a,loaded:!1};return e[a].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t){function n(e){var t=e.getContext("2d"),n=e.width,a=e.height,r=t.getImageData(0,0,n,a).data,s=i(!0,n,a,r),l=i(!1,n,a,r),u=o(!0,n,a,r),d=o(!1,n,a,r)-u+1,c=l-s+1,f=t.getImageData(u,s,d,c);return e.width=d,e.height=c,t.clearRect(0,0,d,c),t.putImageData(f,0,0),e}function a(e,t,n,a){return{red:a[4*(n*t+e)],green:a[4*(n*t+e)+1],blue:a[4*(n*t+e)+2],alpha:a[4*(n*t+e)+3]}}function r(e,t,n,r){return a(e,t,n,r).alpha}function i(e,t,n,a){for(var i=e?1:-1,o=e?0:n-1;e?o<n:o>-1;o+=i)for(var s=0;s<t;s++)if(r(s,o,t,a))return o;return null}function o(e,t,n,a){for(var i=e?1:-1,o=e?0:t-1;e?o<t:o>-1;o+=i)for(var s=0;s<n;s++)if(r(o,s,t,a))return o;return null}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n}])}));H(mx);var gx=function(e){return e&&e.default||e}(px),vx=Y((function(e,t){e.exports=function(e,t,n,a){return function(e){function t(a){if(n[a])return n[a].exports;var r=n[a]={exports:{},id:a,loaded:!1};return e[a].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){function a(e){return e&&e.__esModule?e:{default:e}}function r(e,t){var n={};for(var a in e)t.indexOf(a)>=0||Object.prototype.hasOwnProperty.call(e,a)&&(n[a]=e[a]);return n}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},u=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),d=a(n(1)),c=n(2),f=a(c),h=a(n(3)),p=a(n(4)),m=function(e){function t(){var e,n,a;i(this,t);for(var s=arguments.length,l=Array(s),u=0;u<s;u++)l[u]=arguments[u];return n=a=o(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(l))),a._sigPad=null,a._excludeOurProps=function(){var e=a.props;return r(e,["canvasProps","clearOnResize"])},a.getCanvas=function(){return a._canvas},a.getTrimmedCanvas=function(){var e=document.createElement("canvas");return e.width=a._canvas.width,e.height=a._canvas.height,e.getContext("2d").drawImage(a._canvas,0,0),(0,p.default)(e)},a.getSignaturePad=function(){return a._sigPad},a._checkClearOnResize=function(){a.props.clearOnResize&&a._resizeCanvas()},a._resizeCanvas=function(){var e=a.props.canvasProps||{},t=e.width,n=e.height;if(!t||!n){var r=a._canvas,i=Math.max(window.devicePixelRatio||1,1);t||(r.width=r.offsetWidth*i),n||(r.height=r.offsetHeight*i),r.getContext("2d").scale(i,i),a.clear()}},a.on=function(){return window.addEventListener("resize",a._checkClearOnResize),a._sigPad.on()},a.off=function(){return window.removeEventListener("resize",a._checkClearOnResize),a._sigPad.off()},a.clear=function(){return a._sigPad.clear()},a.isEmpty=function(){return a._sigPad.isEmpty()},a.fromDataURL=function(e,t){return a._sigPad.fromDataURL(e,t)},a.toDataURL=function(e,t){return a._sigPad.toDataURL(e,t)},a.fromData=function(e){return a._sigPad.fromData(e)},a.toData=function(){return a._sigPad.toData()},o(a,n)}return s(t,e),u(t,[{key:"componentDidMount",value:function(){this._sigPad=new h.default(this._canvas,this._excludeOurProps()),this._resizeCanvas(),this.on()}},{key:"componentWillUnmount",value:function(){this.off()}},{key:"componentDidUpdate",value:function(){Object.assign(this._sigPad,this._excludeOurProps())}},{key:"render",value:function(){var e=this;return f.default.createElement("canvas",l({ref:function(t){e._canvas=t}},this.props.canvasProps))}}]),t}(c.Component);m.propTypes={velocityFilterWeight:d.default.number,minWidth:d.default.number,maxWidth:d.default.number,minDistance:d.default.number,dotSize:d.default.oneOfType([d.default.number,d.default.func]),penColor:d.default.string,throttle:d.default.number,onEnd:d.default.func,onBegin:d.default.func,canvasProps:d.default.object,clearOnResize:d.default.bool},m.defaultProps={clearOnResize:!0},t.default=m},function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t){e.exports=n},function(e,t){e.exports=a}])}(dx,u.default,gx,mx)})),yx=H(vx);function bx(e){var t,n=null!==(t=e.toDataURL())&&void 0!==t?t:null,a={clickX_simple:[],clickY_simple:[],time_simple:[],pressure:"",fileContent:n?S(n):""};return e.toData().forEach((function(e){var t=[],n=[],r=[];e.forEach((function(e){t.push(e.x),n.push(e.y),r.push(new Date(e.time).toString())})),a.clickX_simple.push(t),a.clickY_simple.push(n),a.time_simple.push(r)})),a}var xx,Cx,wx,Ex,kx,Tx,Mx,Ix,Sx,Dx,Nx=h.default.div(xx||(xx=w(["\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n ","\n ","\n ","\n"],["\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n ","\n ","\n ","\n"])),(function(e){var t,n;return(null===(t=e.theme.signatureCapture)||void 0===t?void 0:t.background)?"background: ".concat(null===(n=e.theme.signatureCapture)||void 0===n?void 0:n.background,";"):""}),(function(e){var t,n;return(null===(t=e.theme.signatureCapture)||void 0===t?void 0:t.backgroundSize)?"background-size: ".concat(null===(n=e.theme.signatureCapture)||void 0===n?void 0:n.backgroundSize,";"):""}),(function(e){var t,n;return(null===(t=e.theme.signatureCapture)||void 0===t?void 0:t.backgroundPosition)?"background-position: ".concat(null===(n=e.theme.signatureCapture)||void 0===n?void 0:n.backgroundPosition,";"):""})),Ax=h.default.div(Cx||(Cx=w(["\n position: absolute;\n top: 25%;\n left: 15%;\n width: 70%;\n height: 50%;\n\n @media (max-width: 800px) {\n top: 15%;\n left: 2%;\n width: 96%;\n height: 70%;\n }\n"],["\n position: absolute;\n top: 25%;\n left: 15%;\n width: 70%;\n height: 50%;\n\n @media (max-width: 800px) {\n top: 15%;\n left: 2%;\n width: 96%;\n height: 70%;\n }\n"]))),Lx=h.default.div(wx||(wx=w(["\n position: relative;\n background: ",";\n border: ",";\n border-radius: ",";\n flex-grow: 1;\n z-index: 100;\n height: 100%;\n"],["\n position: relative;\n background: ",";\n border: ",";\n border-radius: ",";\n flex-grow: 1;\n z-index: 100;\n height: 100%;\n"])),(function(e){var t,n,a;return null!==(a=null===(n=null===(t=e.theme.signatureCapture)||void 0===t?void 0:t.canvas)||void 0===n?void 0:n.background)&&void 0!==a?a:"rgba(255, 255, 255, 0.5)"}),(function(e){var t,n,a;return null!==(a=null===(n=null===(t=e.theme.signatureCapture)||void 0===t?void 0:t.canvas)||void 0===n?void 0:n.border)&&void 0!==a?a:"1px solid #dedede"}),(function(e){var t,n,a;return null!==(a=null===(n=null===(t=e.theme.signatureCapture)||void 0===t?void 0:t.canvas)||void 0===n?void 0:n.borderRadius)&&void 0!==a?a:"16px"})),Rx=h.default(ym)(Ex||(Ex=w(["\n flex-grow: 0;\n padding-top: 12px;\n display: flex;\n z-index: 1000;\n position: relative;\n"],["\n flex-grow: 0;\n padding-top: 12px;\n display: flex;\n z-index: 1000;\n position: relative;\n"]))),Ox=function(e){var n,a=e.onAccept,r=e.classNames,i=void 0===r?{}:r,o=e.verbiage,s=void 0===o?{}:o,l=Le(),d=l.ref,c=l.width,f=l.height,h=t.useRef(null),p=Xp(s,{headingText:"Please sign the box below",acceptBtnText:"Accept",clearBtnText:"Clear"});return u.default.createElement(B,{className:i.container},u.default.createElement(Nx,{className:i.inner},u.default.createElement(sm,{className:i.guidanceMessageContainer,$top:"5vh"},u.default.createElement(lm,{className:i.guidanceMessage},p.headingText)),u.default.createElement(Ax,{className:i.canvasContainer},u.default.createElement(Lx,{ref:d,className:i.canvasInner},u.default.createElement(yx,{ref:h,canvasProps:{width:c,height:f,className:i.canvas}})),u.default.createElement(Rx,{className:i.buttonsRow},u.default.createElement(ce,{variant:"secondary",className:i.clearBtn,onClick:null===(n=h.current)||void 0===n?void 0:n.clear,finished:!0},p.clearBtnText),u.default.createElement(Fx,{variant:"positive",className:i.acceptBtn,onClick:function(){if(h.current){var e=bx(h.current);null==a||a(e,h.current.toDataURL())}},finished:!0},p.acceptBtnText)))))},Fx=h.default(ce)(kx||(kx=w(["\n margin-left: auto;\n"],["\n margin-left: auto;\n"]))),jx=function(e){var n=t.useRef(null),a=t.useRef([]),r=t.useState(null),i=r[0],o=r[1],s=t.useState(!1),l=s[0],u=s[1],d=null==e?void 0:e.stream,c=t.useCallback((function(){d&&(a.current=[],u(!0),n.current=new MediaRecorder(d,{videoBitsPerSecond:27e4,audioBitsPerSecond:32e3}),n.current.ondataavailable=function(e){a.current.push(e.data)},n.current.onstop=function(){var t=new Blob(a.current,{type:"video/mp4"});a.current=[],o(URL.createObjectURL(t)),u(!1),null==e||e.release()},n.current.start())}),[e,d]),f=t.useCallback((function(){var e;null===(e=n.current)||void 0===e||e.stop()}),[]);return{isRecording:l,startRecording:c,stopRecording:f,videoUrl:i}},Px=function(e){var n,a,r,i,o=e.onVideoCaptured,s=e.onFaceNotDetected,l=e.onExit,d=e.classNames,c=void 0===d?{}:d,f=e.colors,h=void 0===f?{}:f,p=e.verbiage,m=void 0===p?{}:p,g=e.debugMode,v=void 0!==g&&g,y=t.useContext(Xe),w=y.cameraRef,E=y.videoRef,k=Le(),T=k.ref,M=k.width,I=k.height,S=t.useRef(null),D=t.useRef(null),N=t.useRef([]),A=t.useContext(Qf).onPredictionMade,L=jx(w.current),R=L.isRecording,O=L.startRecording,F=L.stopRecording,j=L.videoUrl,P=t.useState(null),_=P[0],U=P[1],z=t.useState(null),G=z[0],W=z[1],V=t.useState(null),$=V[0],q=V[1];h.guidanceMessageBackgroundColor||(h.guidanceMessageBackgroundColor="#ccc"),h.guidanceMessageTextColor||(h.guidanceMessageTextColor="black");var H=Xp(m,{guidanceMessageText:"Please sign the box below",acceptBtnText:"Accept",clearBtnText:"Clear"}),Y=t.useRef(null);t.useEffect((function(){setTimeout((function(){if(!R&&!j&&Y.current){O();var e=Y.current.captureStream(25);D.current=new MediaRecorder(e,{videoBitsPerSecond:27e4}),D.current.start(),D.current.ondataavailable=function(e){var t;N.current.push(e.data),"recording"===(null===(t=D.current)||void 0===t?void 0:t.state)&&D.current.stop()},D.current.onstop=function(){var e=new Blob(N.current,{type:"video/mp4"});q(e)}}}),100)}),[R,O,j]),t.useEffect((function(){$&&_&&G&&(null==o||o($,_,G))}),[o,_,G,$]);var Z=t.useRef(0);t.useEffect((function(){var e;if(S.current&&E.current&&Y.current&&w.current&&R){var t=[w.current.width,w.current.height],n=t[0],a=t[1],r="undefined"!=typeof window&&window.innerWidth<window.innerHeight;r&&n>a&&(n=(e=[a,n])[0],a=e[1]),Y.current.width=n,Y.current.height=a;var i=Y.current.getContext("2d");if(i)return Z.current=requestAnimationFrame((function e(){return b(this,void 0,void 0,(function(){var t;return x(this,(function(o){return S.current&&E.current&&Y.current?(t=[n*(r?.02:.15),a*(r?.15:.25),n*(r?.96:.7),a*(r?.7:.5)],i.drawImage(E.current,0,0,n,a),i.beginPath(),i.fillStyle="rgba(255,255,255,0.5)",i.roundRect.apply(i,C(C([],t,!1),[16],!1)),i.fill(),i.drawImage.apply(i,C([S.current.getCanvas()],t,!1)),Z.current=requestAnimationFrame(e),[2]):(cancelAnimationFrame(Z.current),[2])}))}))})),function(){cancelAnimationFrame(Z.current)}}}),[w,R,s,E]);var Q=t.useState(0),X=Q[0],K=Q[1];return t.useEffect((function(){A((function(e){K((function(t){return 0===e.length?t+1:0}))}))}),[A]),t.useEffect((function(){X>=2&&(null==s||s())}),[X,s]),u.default.createElement(B,{className:"flex ".concat(null!==(n=c.container)&&void 0!==n?n:"")},H.guidanceMessageText&&u.default.createElement(sm,{$top:"5vh",className:c.guidanceMessageContainer},u.default.createElement(lm,{className:c.guidanceMessage,$background:h.guidanceMessageBackgroundColor,$textColor:h.guidanceMessageTextColor},H.guidanceMessageText)),u.default.createElement(Ax,{className:c.canvasContainer},u.default.createElement(Lx,{ref:T,className:c.canvasInner},u.default.createElement(yx,{ref:S,canvasProps:{width:M,height:I,className:c.canvas}})),u.default.createElement(Rx,{className:c.buttonsRow},u.default.createElement(ce,{variant:"secondary",className:c.clearBtn,onClick:null===(a=S.current)||void 0===a?void 0:a.clear,finished:!0},H.clearBtnText),u.default.createElement(Bx,{variant:"positive",className:c.acceptBtn,style:{marginLeft:"auto"},onClick:function(){var e;if(S.current){var t=bx(S.current);U(t),W(S.current.toDataURL()),F(),null===(e=D.current)||void 0===e||e.stop()}},finished:!0},H.acceptBtnText))),v&&u.default.createElement(Sh,null,"Video: ",null===(r=w.current)||void 0===r?void 0:r.width,"x",null===(i=w.current)||void 0===i?void 0:i.height),u.default.createElement(vm,{onClick:l,className:c.exitCaptureBtn}),u.default.createElement(_e,{ref:Y}))},Bx=h.default(ce)(Tx||(Tx=w(["\n margin-left: auto;\n"],["\n margin-left: auto;\n"]))),_x=function(e){var t=e.videoUrl,n=e.onDoneClick,a=e.onRetryClick,r=e.classNames,i=void 0===r?{}:r,o=e.colors,s=void 0===o?{}:o,l=e.verbiage,d=Xp(void 0===l?{}:l,{headingText:"Video signature has been successfully captured!",retryBtnText:"Retry",doneBtnText:"Done"});return u.default.createElement(W,{className:i.container},u.default.createElement(V,{className:i.inner},u.default.createElement("h1",{className:i.heading},d.headingText),u.default.createElement($,{className:i.videoContainer},u.default.createElement(Ux,{className:i.video,src:t,poster:t+"#t=0.1",controls:!0,preload:"metadata",autoPlay:!0})),u.default.createElement(ym,{className:i.buttonsRow},u.default.createElement(ce,{variant:"warning",className:i.retryBtn,onClick:a,colors:s.retryBtn,finished:!0},d.retryBtnText),u.default.createElement(ce,{variant:"positive",className:i.doneBtn,onClick:n,colors:s.doneBtn,finished:!0},d.doneBtnText))))},Ux=h.default.video(Mx||(Mx=w(["\n margin-left: auto;\n margin-right: auto;\n max-width: 100%;\n"],["\n margin-left: auto;\n margin-right: auto;\n max-width: 100%;\n"]))),zx=function(e){var n,a=e.onComplete,r=e.onVideoCaptured,i=e.onRetryClicked,o=e.onExitCapture,s=e.onUserCancel,l=e.onModelError,d=e.loadingOverlayMode,c=void 0===d?"default":d,f=e.modelLoadTimeoutMs,h=void 0===f?Hf:f,p=e.skipSuccessScreen,m=void 0!==p&&p,g=e.assets,v=void 0===g?{}:g,y=e.classNames,C=void 0===y?{}:y,w=e.colors,E=void 0===w?{}:w,k=e.verbiage,T=void 0===k?{}:k,M=e.debugMode,S=void 0!==M&&M,D=t.useContext(Ie),N=D.submit,A=D.selfieImage,L=D.signatureVideoUrl,R=D.setSelfieImage,O=D.setSignatureData,F=D.setSignatureVideoUrl,j=D.logSelfieCaptureAttempt,P=t.useState("LOADING"),_=P[0],U=P[1],z=t.useRef(),G=t.useRef(),W=t.useRef();t.useEffect((function(){z.current=new Date}),[]),t.useEffect((function(){"CHECKING_LIVENESS"===_&&(G.current=new Date)}),[_]);var V=t.useCallback((function(){var e,t,n;j({autoCapture:"Y",captureTime:(null!==(e=W.current)&&void 0!==e?e:new Date).getTime()-(null!==(t=G.current)&&void 0!==t?t:new Date).getTime(),operationTime:(new Date).getTime()-(null!==(n=z.current)&&void 0!==n?n:new Date).getTime()}),z.current=new Date}),[j]),$=t.useCallback((function(){U("CHECKING_LIVENESS")}),[]),q=t.useCallback((function(e){return b(void 0,void 0,void 0,(function(){var t;return x(this,(function(n){switch(n.label){case 0:return U("CAPTURING_SIGNATURE"),V(),A?[3,2]:(t=R,[4,I(e)]);case 1:t.apply(void 0,[n.sent()]),n.label=2;case 2:return[2]}}))}))}),[V,A,R]),H=t.useCallback((function(e,t,n){O(t),F(URL.createObjectURL(e)),U("SUCCESS"),null==r||r(e,t,n)}),[r,O,F]),Y=t.useCallback((function(){U("CHECKING_LIVENESS")}),[]),Z=t.useState(0),Q=Z[0],X=Z[1],K=t.useCallback((function(){X((function(e){return e+1})),U("LOADING"),null==o||o()}),[o]),J=t.useCallback((function(){null==i||i(),K()}),[K,i]),ee=Lg(m,"SUCCESS"===_,a),te=t.useCallback((function(){return b(void 0,void 0,void 0,(function(){return x(this,(function(e){switch(e.label){case 0:return[4,N()];case 1:return e.sent(),null==a||a(),[2]}}))}))}),[a,N]);return u.default.createElement(Xf,{throttleMs:"CAPTURING_SIGNATURE"===_?250:0,onModelError:l,modelLoadTimeoutMs:h},u.default.createElement(B,{className:"flex ".concat(null!==(n=null==C?void 0:C.container)&&void 0!==n?n:"")},u.default.createElement(Ng,{className:C.cameraFeed}),"LOADING"!==_&&function(){switch(_){case"CHECKING_LIVENESS":return u.default.createElement(_y,{onSuccess:q,onExit:K,classNames:C.faceLiveness,colors:E.faceLiveness,verbiage:T.faceLiveness,debugMode:S});case"CAPTURING_SIGNATURE":return u.default.createElement(Px,{onVideoCaptured:H,onFaceNotDetected:Y,onExit:K,classNames:C,colors:E,verbiage:T,debugMode:S});case"SUCCESS":if(!ee)return;return u.default.createElement(_x,{videoUrl:null!=L?L:"",onDoneClick:te,onRetryClick:J,classNames:C.success,colors:E.success,verbiage:T.success});default:return null}}()),u.default.createElement(Tb,{key:Q,mode:c,assets:v.loadingOverlay,classNames:C.loadingOverlay,colors:E.loadingOverlay,verbiage:T.loadingOverlay,onDismissed:$,onUserCancel:s}))},Gx=function(e){var n,a=e.imageWidth,r=e.imageHeight,i=e.borderWidth,o=void 0===i?4:i,s=e.borderColor,l=void 0===s?"white":s,d=e.style,c=void 0===d?{}:d,f=e.assets,h=void 0===f?{}:f,p=e.verbiage,m=void 0===p?{}:p,g=Le(),y=g.ref,b=g.width,x=void 0===b?1:b,C=g.height,w=void 0===C?1:C,E=t.useContext(Xe).cameraRef;h.frontImageUrl||(h.frontImageUrl="".concat(Ra,"/Shieldout-IDCard-Front-SVG-Landscape-2.svg")),h.backImageUrl||(h.backImageUrl="".concat(Ra,"/Shieldout-IDCard-Back-SVG-Landscape-2.svg"));var k=Qp(m.instructionText,"Please flip your ID card..."),T=!(null===(n=E.current)||void 0===n?void 0:n.isRearFacing),M=t.useCallback((function(){}),[]),I={width:x-0},S=t.useState(1),D=S[0],N=S[1],A=t.useState(0),L=A[0],R=A[1],O=["rotateY(".concat(L,"deg)")];T&&O.push("scaleX(-1)");var F=["rotateY(".concat(180-L,"deg)")];return T&&F.push("scaleX(-1)"),t.useEffect((function(){var e=function(){N(1),R(180),setTimeout((function(){N(0),R(0)}),1500)};setTimeout(e,250);var t=setInterval(e,2500);return function(){clearInterval(t)}}),[]),u.default.createElement("div",{ref:y,style:v(v({},c),{position:"relative",top:-5})},u.default.createElement("div",{style:{display:"flex",flexFlow:"column nowrap",height:"100%"}},u.default.createElement("div",{style:{width:"100%",height:"100%",flexGrow:1,textAlign:"center",color:"white",display:"flex",flexDirection:"column",justifyContent:"end"}},u.default.createElement("span",{style:{alignContent:"center",marginTop:12,marginBottom:12}},k)),u.default.createElement("div",{style:{position:"relative",display:"flex",flexFlow:"row nowrap",alignItems:"center",justifyItems:"center",maxWidth:"calc(100%)",maxHeight:"calc(100% - ".concat(0,"px)")}},u.default.createElement("div",{style:{width:"100%",height:"100%",minWidth:0,flexGrow:1}}),u.default.createElement("div",{style:{maxWidth:"calc(100% - ".concat(0,"px - ").concat(2*o,"px)"),maxHeight:w-0-2*o}},u.default.createElement("div",{style:{position:"relative",border:"".concat(o,"px solid ").concat(l),width:(null!=a?a:0)+2*o}},u.default.createElement("img",{src:h.frontImageUrl,alt:"",width:a,height:r,onLoad:M,style:v({backfaceVisibility:"hidden",transition:"transform ".concat(D,"s"),transform:O.join(" "),transformStyle:"preserve-3d",position:"relative",top:0,left:0,display:"block"},I)}),u.default.createElement("img",{src:h.backImageUrl,alt:"",style:v({backfaceVisibility:"hidden",transition:"transform ".concat(D,"s"),transform:F.join(" "),transformStyle:"preserve-3d",position:"absolute",top:0,left:0,display:"block"},I)}))),u.default.createElement("div",{style:{width:"100%",height:"100%",minWidth:0,flexGrow:1}})),u.default.createElement("div",{style:{width:"100%",height:"100%",flexGrow:1,textAlign:"center",color:"white",display:"flex",flexDirection:"column",justifyContent:"end"}},u.default.createElement("span",{style:{alignContent:"center",marginTop:12,marginBottom:12,opacity:0}},k))))},Wx=function(e){var n,a,i,o,s,l,d,c,f,h,p,m,g,v,y,b,x,C=e.requestedAction,w=void 0===C?"SHOW_ID_FRONT":C,E=e.satisfied,k=void 0!==E&&E,T=e.faceGuideBorderWidth,M=e.faceGuideBorderColor,I=e.idCardGuideBorderWidth,S=e.idCardGuideBorderColor,D=e.assets,N=void 0===D?{}:D,A=e.classNames,L=void 0===A?{}:A,R=e.verbiage,O=void 0===R?{}:R,F=t.useContext(Xe).cameraRef,j=t.useRef(null),P=t.useState(0),B=P[0],_=P[1],U=t.useState(0),z=U[0],G=U[1];N.frontImageUrl||(N.frontImageUrl="".concat(Ra,"/Shieldout-IDCard-Front-SVG-Landscape-2.svg")),N.backImageUrl||(N.backImageUrl="".concat(Ra,"/Shieldout-IDCard-Back-SVG-Landscape-2.svg"));var W=Xp(O,{idFrontInstructionText:"Display the front of your ID card...",idBackInstructionText:"Display the back of your ID card..."}),V="SHOW_ID_FRONT"===w?W.idFrontInstructionText:W.idBackInstructionText,$="undefined"!=typeof window&&window.innerWidth>window.innerHeight?"30%":"75%",q=r.useTheme();return void 0===T&&(T=null!==(i=null===(a=null===(n=q.idVideoCapture)||void 0===n?void 0:n.faceGuides)||void 0===a?void 0:a.borderWidth)&&void 0!==i?i:4),void 0===M&&(M=null!==(c=k?null===(s=null===(o=q.idVideoCapture)||void 0===o?void 0:o.faceGuides)||void 0===s?void 0:s.satisfiedColor:null===(d=null===(l=q.idVideoCapture)||void 0===l?void 0:l.faceGuides)||void 0===d?void 0:d.unsatisfiedColor)&&void 0!==c?c:"white"),void 0===I&&(I=null!==(p=null===(h=null===(f=q.idVideoCapture)||void 0===f?void 0:f.idCardGuides)||void 0===h?void 0:h.borderWidth)&&void 0!==p?p:4),void 0===S&&(S=null!==(b=k?null===(g=null===(m=q.idVideoCapture)||void 0===m?void 0:m.idCardGuides)||void 0===g?void 0:g.satisfiedColor:null===(y=null===(v=q.idVideoCapture)||void 0===v?void 0:v.idCardGuides)||void 0===y?void 0:y.unsatisfiedColor)&&void 0!==b?b:"white"),u.default.createElement(u.default.Fragment,null,u.default.createElement(Vx,{className:L.container},u.default.createElement($x,{className:L.faceGuide,$borderWidth:T,$borderColor:M}),"FLIP_ID"===w?u.default.createElement(Gx,{assets:N,verbiage:{instructionText:W.flipIdInstructionText},imageWidth:B,imageHeight:z,borderWidth:I,borderColor:S,style:{width:$,margin:"2% auto 2%"}}):u.default.createElement("div",{style:{width:$,margin:"2% auto 2%",display:"flex",flexFlow:"column nowrap"}},u.default.createElement("div",{style:{width:"100%",height:"100%",flexGrow:1,textAlign:"center",color:"white",display:"flex",flexDirection:"column",justifyContent:"end"}},u.default.createElement("span",{style:{alignContent:"center",marginTop:12,marginBottom:12}},V)),u.default.createElement("div",{style:{border:"".concat(I,"px solid ").concat(S)}},u.default.createElement(qx,{ref:j,src:"SHOW_ID_BACK"===w?N.backImageUrl:N.frontImageUrl,alt:"",$isMirrored:!(null===(x=F.current)||void 0===x?void 0:x.isRearFacing),onLoad:function(){var e,t,n,a;B||_(null!==(t=null===(e=j.current)||void 0===e?void 0:e.width)&&void 0!==t?t:0),z||G(null!==(a=null===(n=j.current)||void 0===n?void 0:n.height)&&void 0!==a?a:0)}})),u.default.createElement("div",{style:{width:"100%",height:"100%",flexGrow:1,textAlign:"center",color:"white",display:"flex",flexDirection:"column",justifyContent:"end"}},u.default.createElement("span",{style:{alignContent:"center",marginTop:12,marginBottom:12,opacity:0}},V)))))},Vx=h.default.div(Ix||(Ix=w(["\n position: absolute;\n z-index: 1000;\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n"],["\n position: absolute;\n z-index: 1000;\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n"]))),$x=h.default.div(Sx||(Sx=w(["\n border-width: ","px;\n border-color: ",";\n border-style: solid;\n border-radius: 50%;\n aspect-ratio: 1 / 1.618;\n height: 100%;\n margin: 4% auto auto;\n"],["\n border-width: ","px;\n border-color: ",";\n border-style: solid;\n border-radius: 50%;\n aspect-ratio: 1 / 1.618;\n height: 100%;\n margin: 4% auto auto;\n"])),(function(e){var t;return null!==(t=e.$borderWidth)&&void 0!==t?t:0}),(function(e){var t;return null!==(t=e.$borderColor)&&void 0!==t?t:"white"})),qx=h.default.img(Dx||(Dx=w(["\n width: 100%;\n ","\n"],["\n width: 100%;\n ","\n"])),(function(e){return e.$isMirrored?"transform: scaleX(-1);":""})),Hx=function(e){var t=e.text,n=e.onComplete,a=e.startedAt,r=e.durationMs,i=void 0===r?15e3:r,o=e.classNames,s=void 0===o?{}:o,l=e.verbiage,d=void 0===l?{}:l;t=Qp(t,"");var c=Xp(d,{headingText:"Please read the following text aloud",doneBtnText:"Done"}),f=function(e){var t=e%1e3;e=(e-t)/1e3;var n=e%60;e=(e-n)/60;var a=e%60;return a+":"+("00"+(n+=1)).slice(-2)}(Math.max(0,i-((new Date).getTime()-(null!=a?a:new Date).getTime())));return u.default.createElement(bC,{className:s.container},u.default.createElement(xC,{className:s.heading},c.headingText),u.default.createElement(CC,{className:s.prompt},t),u.default.createElement(wC,{className:s.buttonsRow},u.default.createElement(EC,{className:s.timeRemaining},f),u.default.createElement(kC,{variant:"positive",className:s.doneBtn,onClick:n,finished:!0},c.doneBtnText)))};var Yx,Zx,Qx,Xx,Kx,Jx,eC,tC,nC,aC,rC,iC,oC,sC,lC,uC,dC,cC,fC,hC,pC,mC,gC,vC,yC,bC=h.default.div(Yx||(Yx=w(["\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n display: flex;\n flex-direction: column;\n"],["\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n display: flex;\n flex-direction: column;\n"]))),xC=h.default.div(Zx||(Zx=w(["\n padding: 20px;\n font-weight: bold;\n margin: auto auto 32px;\n\n ",";\n ",";\n ",";\n"],["\n padding: 20px;\n font-weight: bold;\n margin: auto auto 32px;\n\n ",";\n ",";\n ",";\n"])),(function(e){var t,n,a,r,i,o;return(null===(a=null===(n=null===(t=e.theme.idVideoCapture)||void 0===t?void 0:t.readTextPrompt)||void 0===n?void 0:n.heading)||void 0===a?void 0:a.backgroundColor)?"background: ".concat(null===(o=null===(i=null===(r=e.theme.idVideoCapture)||void 0===r?void 0:r.readTextPrompt)||void 0===i?void 0:i.heading)||void 0===o?void 0:o.backgroundColor,";"):""}),(function(e){var t,n,a,r,i,o;return(null===(a=null===(n=null===(t=e.theme.idVideoCapture)||void 0===t?void 0:t.readTextPrompt)||void 0===n?void 0:n.heading)||void 0===a?void 0:a.textColor)?"color: ".concat(null===(o=null===(i=null===(r=e.theme.idVideoCapture)||void 0===r?void 0:r.readTextPrompt)||void 0===i?void 0:i.heading)||void 0===o?void 0:o.textColor,";"):""}),(function(e){var t,n,a,r,i,o;return(null===(a=null===(n=null===(t=e.theme.idVideoCapture)||void 0===t?void 0:t.readTextPrompt)||void 0===n?void 0:n.heading)||void 0===a?void 0:a.borderRadius)?"border-radius: ".concat(null===(o=null===(i=null===(r=e.theme.idVideoCapture)||void 0===r?void 0:r.readTextPrompt)||void 0===i?void 0:i.heading)||void 0===o?void 0:o.borderRadius,";"):""})),CC=h.default.div(Qx||(Qx=w(["\n margin: 0 auto;\n text-align: center;\n padding: 50px;\n font-size: 24px;\n max-width: ",";\n\n ",";\n ",";\n ",";\n"],["\n margin: 0 auto;\n text-align: center;\n padding: 50px;\n font-size: 24px;\n max-width: ",";\n\n ",";\n ",";\n ",";\n"])),"undefined"!=typeof window&&window.innerWidth>window.innerHeight?"40%":"90%",(function(e){var t,n,a,r,i,o;return(null===(a=null===(n=null===(t=e.theme.idVideoCapture)||void 0===t?void 0:t.readTextPrompt)||void 0===n?void 0:n.prompt)||void 0===a?void 0:a.backgroundColor)?"background: ".concat(null===(o=null===(i=null===(r=e.theme.idVideoCapture)||void 0===r?void 0:r.readTextPrompt)||void 0===i?void 0:i.prompt)||void 0===o?void 0:o.backgroundColor,";"):""}),(function(e){var t,n,a,r,i,o;return(null===(a=null===(n=null===(t=e.theme.idVideoCapture)||void 0===t?void 0:t.readTextPrompt)||void 0===n?void 0:n.prompt)||void 0===a?void 0:a.textColor)?"color: ".concat(null===(o=null===(i=null===(r=e.theme.idVideoCapture)||void 0===r?void 0:r.readTextPrompt)||void 0===i?void 0:i.prompt)||void 0===o?void 0:o.textColor,";"):""}),(function(e){var t,n,a,r,i,o;return(null===(a=null===(n=null===(t=e.theme.idVideoCapture)||void 0===t?void 0:t.readTextPrompt)||void 0===n?void 0:n.prompt)||void 0===a?void 0:a.borderRadius)?"border-radius: ".concat(null===(o=null===(i=null===(r=e.theme.idVideoCapture)||void 0===r?void 0:r.readTextPrompt)||void 0===i?void 0:i.prompt)||void 0===o?void 0:o.borderRadius,";"):""})),wC=h.default(ym)(Xx||(Xx=w(["\n margin: 32px auto auto;\n gap: 20px;\n"],["\n margin: 32px auto auto;\n gap: 20px;\n"]))),EC=h.default.div(Kx||(Kx=w(["\n padding: 20px;\n\n ",";\n ",";\n ",";\n"],["\n padding: 20px;\n\n ",";\n ",";\n ",";\n"])),(function(e){var t,n,a,r,i,o;return(null===(a=null===(n=null===(t=e.theme.idVideoCapture)||void 0===t?void 0:t.readTextPrompt)||void 0===n?void 0:n.timeRemaining)||void 0===a?void 0:a.backgroundColor)?"background: ".concat(null===(o=null===(i=null===(r=e.theme.idVideoCapture)||void 0===r?void 0:r.readTextPrompt)||void 0===i?void 0:i.timeRemaining)||void 0===o?void 0:o.backgroundColor,";"):""}),(function(e){var t,n,a,r,i,o;return(null===(a=null===(n=null===(t=e.theme.idVideoCapture)||void 0===t?void 0:t.readTextPrompt)||void 0===n?void 0:n.timeRemaining)||void 0===a?void 0:a.textColor)?"color: ".concat(null===(o=null===(i=null===(r=e.theme.idVideoCapture)||void 0===r?void 0:r.readTextPrompt)||void 0===i?void 0:i.timeRemaining)||void 0===o?void 0:o.textColor,";"):""}),(function(e){var t,n,a,r,i,o;return(null===(a=null===(n=null===(t=e.theme.idVideoCapture)||void 0===t?void 0:t.readTextPrompt)||void 0===n?void 0:n.timeRemaining)||void 0===a?void 0:a.borderRadius)?"border-radius: ".concat(null===(o=null===(i=null===(r=e.theme.idVideoCapture)||void 0===r?void 0:r.readTextPrompt)||void 0===i?void 0:i.timeRemaining)||void 0===o?void 0:o.borderRadius,";"):""})),kC=h.default(ce)(Jx||(Jx=w(["\n margin: auto 0;\n"],["\n margin: auto 0;\n"]))),TC=.05,MC=function(e){var n,a,i,o,s,l,d,c,f,h,p,m,g,v,y,C,w,E=e.onComplete,k=e.onIdFrontImageCaptured,T=e.onIdBackImageCaptured,M=e.onFaceNotDetected,I=e.idCaptureModelsEnabled,S=void 0===I||I,D=e.idCardFrontDelay,N=void 0===D?1e3:D,A=e.idCardFrontDetectionThreshold,L=void 0===A?.6:A,R=e.idCardFrontFocusThreshold,O=void 0===R?0:R,F=e.goodIdCardFrontFramesThreshold,j=void 0===F?1:F,P=e.idCardBackDetectionThreshold,_=void 0===P?.6:P,U=e.idCardBackFocusThreshold,z=void 0===U?0:U,G=e.goodIdCardBackFramesThreshold,W=void 0===G?1:G,V=e.skipShowIdCardBack,$=void 0!==V&&V,q=e.captureCountdownSeconds,H=void 0===q?3:q,Y=e.readTextPrompt,Z=e.readTextTimeoutDurationMs,Q=void 0===Z?15e3:Z,X=e.assets,K=void 0===X?{}:X,J=e.classNames,ee=void 0===J?{}:J,te=e.colors,ne=void 0===te?{}:te,ae=e.verbiage,re=void 0===ae?{}:ae,ie=e.debugMode,oe=void 0!==ie&&ie,se=Le(),le=se.ref,ue=se.width,de=void 0===ue?1:ue,ce=se.height,fe=void 0===ce?1:ce,he=t.useContext(Xe),pe=he.cameraRef,me=he.videoRef,ge=he.videoLoaded,ve=he.setVideoLoaded,ye=he.cameraReady,be=he.takePhoto,xe=t.useState([]),Ce=xe[0],we=xe[1],Ee=t.useState([]),ke=Ee[0],Te=Ee[1],Me=t.useContext(uh),Ie=Me.ready,Se=Me.working,De=Me.makePrediction,Ne=Me.onPredictionMade,Ae=Me.setThresholds,Re=Me.bestFrameDetectionScore,Oe=Me.bestFrameFocusScore,Fe=Me.resetBestFrame,je=Me.modelError,Pe=t.useContext(Qf).onPredictionMade,Be=jx(pe.current),_e=Be.isRecording,Ue=Be.startRecording,ze=Be.stopRecording,Ge=Be.videoUrl;t.useEffect((function(){_e||Ge||Ue(),Ge&&(ve(!1),null==E||E(Ge))}),[_e,E,ve,Ue,Ge]);var We=t.useRef(0),Ve=t.useRef(!1);t.useEffect((function(){Ve.current=ge&&ye&&Ie}),[ye,Ie,ge]);var $e=t.useState("SHOW_ID_FRONT"),qe=$e[0],He=$e[1];t.useEffect((function(){if(("SHOW_ID_FRONT"===qe||"SHOW_ID_BACK"===qe)&&S&&Ie&&ye&&ge)return We.current=requestAnimationFrame((function e(){return b(this,void 0,void 0,(function(){return x(this,(function(t){return Ve.current&&!Se.current&&me.current&&De(me.current),We.current=requestAnimationFrame(e),[2]}))}))})),function(){cancelAnimationFrame(We.current)}}),[ye,S,Ie,Se,De,qe,ge,me]),t.useEffect((function(){Ae({document:"SHOW_ID_FRONT"===qe?L:"SHOW_ID_BACK"===qe?_:1,passport:1,focus:{mobile:"SHOW_ID_FRONT"===qe?O:"SHOW_ID_BACK"===qe?z:0}})}),[_,z,L,O,qe,Ae]);var Ye=t.useState(0),Ze=Ye[0],Qe=Ye[1],Ke=t.useState(0),Je=Ke[0],et=Ke[1],tt=t.useState(0),nt=tt[0],at=tt[1],rt="SHOW_ID_FRONT"===qe?j:W,it=nt>=rt;t.useEffect((function(){S&&Ne((function(e){we(e.detectedObjects),Qe(e.detectionScore),et(e.focusScore),at(e.detectionThresholdMet&&e.focusThresholdMet?function(e){return e+1}:0)}))}),[S,L,Ne]);var ot=t.useState(null),st=ot[0],lt=ot[1];t.useEffect((function(){1===nt&<((new Date).getTime())}),[nt]);var ut="SHOW_ID_FRONT"!==qe||null!==st&&(new Date).getTime()>st+N,dt=t.useCallback((function(){Y?He("READ_TEXT"):ze()}),[Y,ze]),ct=null!==(a=null===(n=me.current)||void 0===n?void 0:n.videoWidth)&&void 0!==a?a:0,ft=null!==(o=null===(i=me.current)||void 0===i?void 0:i.videoHeight)&&void 0!==o?o:0,ht=null===(s=null==ke?void 0:ke[0])||void 0===s?void 0:s.box,pt=!ht||!ct||ht.xMin>ct*TC&&ht.yMin>ft*TC&&ht.xMax<.95*ct&&ht.yMax<.95*ft,mt=t.useState(),gt=mt[0],vt=mt[1],yt=t.useRef(!1),bt=t.useCallback((function(){return b(void 0,void 0,void 0,(function(){var e,t,n;return x(this,(function(a){switch(a.label){case 0:return yt.current?[2]:(yt.current=!0,[4,be()]);case 1:if(!(e=a.sent()))return yt.current=!1,[2];a.label=2;case 2:return a.trys.push([2,,10,11]),(n=e)?[4,new Promise((function(t){var n=new FileReader;n.onloadend=function(){return t(n.result)},n.readAsDataURL(e)}))]:[3,4];case 3:n=a.sent(),a.label=4;case 4:return t=n,"SHOW_ID_FRONT"!=qe?[3,8]:(k&&t&&k(t),$?!0!==$?[3,5]:[2,dt()]:[3,7]);case 5:return[4,$()];case 6:if(a.sent())return[2,dt()];a.label=7;case 7:return He("FLIP_ID"),setTimeout((function(){He("SHOW_ID_BACK")}),6e3),[3,9];case 8:"SHOW_ID_BACK"==qe&&(T&&t&&T(t),dt()),a.label=9;case 9:return[3,11];case 10:return we([]),Qe(0),et(0),at(0),vt(void 0),Fe(),yt.current=!1,[7];case 11:return[2]}}))}))}),[dt,T,k,qe,Fe,$,be]),xt=it&&pt&&ut;t.useEffect((function(){xt&&!gt&&vt(new Date)}),[gt,xt]),t.useEffect((function(){if(gt){var e=(new Date).getTime()+1e3*H-gt.getTime(),t=setTimeout(bt,e);return function(){clearTimeout(t)}}}),[H,bt,gt]);var Ct=t.useCallback((function(){ze()}),[ze]),wt=Iy(Q,Ct,"READ_TEXT"!==qe,!1,"READ_TEXT"===qe).timeoutStartedAt,Et=t.useState(0),kt=Et[0],Tt=Et[1];t.useEffect((function(){Pe((function(e){Te(e),Tt((function(t){return 0===e.length?t+1:0}))}))}),[Pe]),t.useEffect((function(){kt>=2&&(null==M||M())}),[kt,M]);var Mt=r.useTheme(),It=Xp(re,{faceNotCenteredText:"Please move your face to the center...",searchingForIdCardText:"Searching for ID card...",captureBtnText:"Capture"}),St=It.captureBtnText,Dt=It.faceNotCenteredText,Nt=It.searchingForIdCardText,At=Lh({enabled:oe,pageWidth:de,pageHeight:fe,videoWidth:null!==(d=null===(l=me.current)||void 0===l?void 0:l.videoWidth)&&void 0!==d?d:0,videoHeight:null!==(f=null===(c=me.current)||void 0===c?void 0:c.videoHeight)&&void 0!==f?f:0}),Lt=["SHOW_ID_FRONT","SHOW_ID_BACK"].includes(qe),Rt=!!gt&&Math.max(0,H-Math.floor(((new Date).getTime()-gt.getTime())/1e3)),Ot=pt?S&&Lt&&!it?Nt:void 0:Dt;return u.default.createElement(B,{ref:le,className:"flex ".concat(null!==(h=ee.container)&&void 0!==h?h:"")},"READ_TEXT"===qe?u.default.createElement(Hx,{text:Y,startedAt:wt||void 0,durationMs:Q,classNames:ee.readTextPrompt,verbiage:re.readTextPrompt,onComplete:ze}):u.default.createElement(u.default.Fragment,null,u.default.createElement(Wx,{assets:K.guides,classNames:ee.guides,verbiage:re.guides,requestedAction:qe,satisfied:xt,faceGuideBorderColor:xt?ne.guidesSatisfiedColor:ne.guidesUnsatisfiedColor,idCardGuideBorderColor:xt?ne.guidesSatisfiedColor:ne.guidesUnsatisfiedColor}),oe&&Lt&&u.default.createElement(u.default.Fragment,null,u.default.createElement(Dh,{$flipX:!(null===(p=pe.current)||void 0===p?void 0:p.isRearFacing)},Ce.map((function(e,t){var n;return u.default.createElement(Bh,{key:t,obj:e,scaling:At,color:"blue",flipX:!(null===(n=pe.current)||void 0===n?void 0:n.isRearFacing)})}))),u.default.createElement(Ph,null,ke.map((function(e,t){return u.default.createElement(_h,{key:t,face:e,scaling:At})}))))),Ot&&u.default.createElement(sm,{className:ee.guidanceMessageContainer},u.default.createElement(lm,{className:ee.guidanceMessage,$background:null!==(v=null===(g=null===(m=Mt.guidanceMessages)||void 0===m?void 0:m.negative)||void 0===g?void 0:g.backgroundColor)&&void 0!==v?v:"red",$textColor:null!==(w=null===(C=null===(y=Mt.guidanceMessages)||void 0===y?void 0:y.negative)||void 0===C?void 0:C.textColor)&&void 0!==w?w:"white"},Ot)),oe&&u.default.createElement(Sh,null,pe.current?u.default.createElement(u.default.Fragment,null,"✅ Camera: ",pe.current.label," (",pe.current.width,"x",pe.current.height,")"):"❌ Camera not ready",u.default.createElement("br",null),_e?"✅ Recording":"❌ Not recording",u.default.createElement("br",null),it?"✅":"❌"," Good Frame Count:"," ",nt,"/",rt,u.default.createElement("br",null),"Detection Score: ",Ze,u.default.createElement("br",null),"Focus Score: ",Je,u.default.createElement("br",null),"Best Frame Detection Score: ",Re,u.default.createElement("br",null),"Best Frame Focus Score: ",Oe),Rt&&Lt&&u.default.createElement(IC,null,u.default.createElement(SC,null,Rt)),(!S||je)&&Lt&&u.default.createElement(DC,null,u.default.createElement(NC,{finished:!0,onClick:function(){return vt(new Date)},disabled:!!gt||yt.current,className:ee.captureBtn},St)))},IC=h.default.div(eC||(eC=w(["\n position: fixed;\n top: 0;\n left: 0;\n width: 100dvw;\n height: 100dvh;\n z-index: 99999;\n display: flex;\n"],["\n position: fixed;\n top: 0;\n left: 0;\n width: 100dvw;\n height: 100dvh;\n z-index: 99999;\n display: flex;\n"]))),SC=h.default.div(tC||(tC=w(["\n color: white;\n font-size: 64px;\n font-weight: bold;\n margin: auto;\n"],["\n color: white;\n font-size: 64px;\n font-weight: bold;\n margin: auto;\n"]))),DC=h.default.div(nC||(nC=w(["\n position: fixed;\n bottom: 0;\n width: 100dvw;\n display: flex;\n z-index: 100000;\n"],["\n position: fixed;\n bottom: 0;\n width: 100dvw;\n display: flex;\n z-index: 100000;\n"]))),NC=h.default(ce)(aC||(aC=w(["\n margin: 0 auto 25px;\n"],["\n margin: 0 auto 25px;\n"]))),AC=function(e){var n=e.videoUrl,a=e.idFrontImageUrl,r=e.idBackImageUrl,i=e.onDoneClick,o=e.onRetryClick,s=e.classNames,l=void 0===s?{}:s,d=e.colors,c=void 0===d?{}:d,f=e.verbiage,h=void 0===f?{}:f,p=t.useState("video"),m=p[0],g=p[1],v=Xp(h,{headingText:"Video ID has been successfully captured!",retryBtnText:"Retry",doneBtnText:"Done"});return u.default.createElement(W,{className:l.container},u.default.createElement(V,{className:l.inner},u.default.createElement("h1",{className:l.heading},v.headingText),u.default.createElement(RC,{className:l.assetSelectorOptions},u.default.createElement(OC,{className:l.assetSelectorOption},u.default.createElement("input",{type:"radio",id:"displayedAssetVideo",value:"video",checked:"video"===m,onChange:function(){return g("video")}}),u.default.createElement("label",{htmlFor:"displayedAssetVideo"},"Video")),u.default.createElement(OC,{className:l.assetSelectorOption},u.default.createElement("input",{type:"radio",id:"displayedAssetIdFrontImage",value:"idFrontImage",checked:"idFrontImage"===m,onChange:function(){return g("idFrontImage")}}),u.default.createElement("label",{htmlFor:"displayedAssetIdFrontImage"},"ID Front Image")),r&&u.default.createElement(OC,{className:l.assetSelectorOption},u.default.createElement("input",{type:"radio",id:"displayedAssetIdBackImage",value:"idBackImage",checked:"idBackImage"===m,onChange:function(){return g("idBackImage")}}),u.default.createElement("label",{htmlFor:"displayedAssetIdBackImage"},"ID Back Image"))),u.default.createElement($,{className:l.videoContainer},"video"===m?u.default.createElement(LC,{src:n,className:l.video,poster:n+"#t=0.1",controls:!0,preload:"metadata",autoPlay:!0}):u.default.createElement("img","idFrontImage"===m?{src:a,alt:"ID Front Image"}:{src:r,alt:"ID Back Image"})),u.default.createElement(ym,{className:l.buttonsRow},u.default.createElement(ce,{variant:"warning",className:l.retryBtn,onClick:o,colors:c.retryBtn,finished:!0},v.retryBtnText),u.default.createElement(ce,{variant:"positive",className:l.doneBtn,onClick:i,colors:c.doneBtn,finished:!0},v.doneBtnText))))},LC=h.default.video(rC||(rC=w(["\n margin-left: auto;\n margin-right: auto;\n max-width: 100%;\n"],["\n margin-left: auto;\n margin-right: auto;\n max-width: 100%;\n"]))),RC=h.default.div(iC||(iC=w(["\n margin-bottom: 15px;\n display: flex;\n justify-content: center;\n"],["\n margin-bottom: 15px;\n display: flex;\n justify-content: center;\n"]))),OC=h.default.div(oC||(oC=w(["\n padding: 0 8px;\n"],["\n padding: 0 8px;\n"]))),FC=function(e){var n,a,r,i,o,s=e.onComplete,l=e.onExitCapture,d=e.onExitAfterFailure,c=e.onUserCancel,f=e.onIdCaptureModelError,h=e.idCaptureProps,p=void 0===h?{}:h,m=e.faceLivenessProps,g=void 0===m?{}:m,y=e.idCaptureModelsEnabled,C=void 0===y||y,w=e.idCardFrontDetectionThreshold,E=e.idCardBackDetectionThreshold,T=e.idCardFrontFocusThreshold,M=e.idCardBackFocusThreshold,I=e.goodIdCardFrontFramesThreshold,S=e.goodIdCardBackFramesThreshold,D=e.readTextPrompt,N=e.readTextTimeoutDurationMs,A=e.skipIdCapture,L=void 0!==A&&A,R=e.skipShowIdCardBack,O=void 0!==R&&R,F=e.skipSuccessScreen,j=void 0!==F&&F,P=e.idCaptureLoadingOverlayMode,_=void 0===P?"default":P,U=e.idCaptureGuideType,z=void 0===U?"fit":U,G=e.idCapturePortraitGuidesOnMobile,W=void 0!==G&&G,V=e.idCaptureRotateLoadingOverlayImageWhenPortrait,$=void 0===V||V,q=e.idCaptureModelLoadTimeoutMs,H=void 0===q?fh:q,Y=e.faceLivenessLoadingOverlayMode,Z=void 0===Y?"default":Y,Q=e.assets,X=void 0===Q?{}:Q,K=e.classNames,J=void 0===K?{}:K,ee=e.colors,te=void 0===ee?{}:ee,ne=e.verbiage,ae=void 0===ne?{}:ne,re=e.debugMode,ie=void 0!==re&&re,oe=t.useContext(Ie),se=oe.submissionStatus,le=oe.idCaptureVideoUrl,ue=oe.idCaptureVideoIdFrontImage,de=oe.idCaptureVideoIdBackImage,ce=oe.setIdCaptureVideoUrl,fe=oe.setIdCaptureVideoIdFrontImage,he=oe.setIdCaptureVideoIdBackImage,pe=t.useState("CAPTURING_ID"),me=pe[0],ge=pe[1];t.useEffect((function(){L&&"CAPTURING_ID"===me&&ge("CHECKING_LIVENESS")}),[me,L]);var ve=p.onSuccess,ye=t.useCallback((function(e){null==ve||ve(e),ge("CHECKING_LIVENESS")}),[ve]),be=t.useCallback((function(){return b(void 0,void 0,void 0,(function(){return x(this,(function(e){return ge("CAPTURING_VIDEO"),[2]}))}))}),[]),xe=t.useCallback((function(e){return b(void 0,void 0,void 0,(function(){return x(this,(function(t){return ce(e),ge("SUCCESS"),j&&(null==s||s()),[2]}))}))}),[s,ce,j]),Ce=t.useCallback((function(){ge("CHECKING_LIVENESS")}),[]),we=t.useState(0),Ee=we[0],ke=we[1],Te=null!=d?d:g.onExitAfterFailure,Me=t.useCallback((function(e,t){null==Te||Te(e,t),ke((function(e){return e+1})),ge("CAPTURING_ID")}),[Te]),Se=t.useCallback((function(){ke((function(e){return e+1})),ge("CAPTURING_ID")}),[]),De=["LOADING","CAPTURING_ID"].includes(me);return t.useEffect((function(){se===k.SUBMITTING&&Ye()}),[se]),se===k.SUBMITTING?u.default.createElement(B,{className:"flex"},u.default.createElement($v,null)):u.default.createElement(hh,{documentDetectionModelUrl:null!==(a=null===(n=p.assets)||void 0===n?void 0:n.documentDetectionModelUrl)&&void 0!==a?a:"",focusModelUrl:null!==(i=null===(r=p.assets)||void 0===r?void 0:r.focusModelUrl)&&void 0!==i?i:"",logPredictions:ie,onModelError:f,modelLoadTimeoutMs:H},u.default.createElement(Ke,{key:De?"id-camera":"selfie-camera",preferContinuityCamera:De,preferFrontFacingCamera:!De,requestMicrophoneAccess:!De&&!!D,maxVideoWidth:De?1920:1280,maxFps:De?60:30,debugMode:ie},u.default.createElement(Xf,{onModelError:null==g?void 0:g.onModelError,modelLoadTimeoutMs:null==g?void 0:g.modelLoadTimeoutMs},u.default.createElement(B,{className:"flex ".concat(null!==(o=J.container)&&void 0!==o?o:"")},["CHECKING_LIVENESS","CAPTURING_VIDEO"].includes(me)&&u.default.createElement(Ng,{className:J.cameraFeed}),function(){switch(me){case"CAPTURING_ID":return u.default.createElement(Mh,null,u.default.createElement(Ib,null,u.default.createElement(Ey,v({key:"id-capture-".concat(Ee),loadingOverlayMode:_},p,{assets:X.idCapture,classNames:J.idCapture,colors:te.idCapture,verbiage:ae.idCapture,onSuccess:ye,onExitCapture:l,onUserCancel:c,skipSuccessScreen:!0,releaseCameraAccessOnExit:!1,guideType:z,portraitGuidesOnMobile:W,rotateLoadingOverlayImageWhenPortrait:$,debugMode:ie}))));case"CHECKING_LIVENESS":return u.default.createElement(Mb,v({key:"face-liveness-".concat(Ee),loadingOverlayMode:Z},g,{onComplete:be,onExitCapture:l,onExitAfterFailure:Me,onUserCancel:c,skipSuccessScreen:!0,renderCameraFeed:!1,releaseCameraAccessOnExit:!1,assets:X.faceLiveness,classNames:J.faceLiveness,colors:te.faceLiveness,verbiage:ae.faceLiveness,debugMode:ie}));case"CAPTURING_VIDEO":return u.default.createElement(MC,{key:"id-video-capture-".concat(Ee),onComplete:xe,onIdFrontImageCaptured:fe,onIdBackImageCaptured:he,onFaceNotDetected:Ce,idCaptureModelsEnabled:C,idCardFrontDetectionThreshold:w,idCardBackDetectionThreshold:E,idCardFrontFocusThreshold:T,idCardBackFocusThreshold:M,goodIdCardFrontFramesThreshold:I,goodIdCardBackFramesThreshold:S,skipShowIdCardBack:O,readTextPrompt:D,readTextTimeoutDurationMs:N,assets:X.idVideoCapture,classNames:J.idVideoCapture,colors:te.idVideoCapture,verbiage:ae.idVideoCapture,debugMode:ie});case"SUCCESS":return u.default.createElement(AC,{videoUrl:null!=le?le:"",idFrontImageUrl:null!=ue?ue:"",idBackImageUrl:null!=de?de:void 0,onDoneClick:s,onRetryClick:Se,classNames:J.success,colors:te.success,verbiage:ae.success});default:return u.default.createElement(u.default.Fragment,null)}}()))))},jC=function(e){var n,a,r,i,o,s=e.checks,l=e.idCaptureProps,d=void 0===l?{}:l,c=e.faceLivenessProps,f=void 0===c?{}:c,h=e.additionalDocumentCaptureProps,p=e.signatureCaptureProps,m=void 0===p?{}:p,g=e.videoSignatureCaptureProps,y=void 0===g?{}:g,b=e.videoIdCaptureProps,x=void 0===b?{}:b,w=e.captureSignature,E=void 0!==w&&w,T=e.captureSignatureVideo,M=void 0!==T&&T,I=e.debugMode,S=void 0!==I&&I,D=t.useContext(Ie),N=D.submit,A=D.submissionStatus,L=D.setSignatureData,R=D.setAdditionalDocuments,O=t.useState(0),F=O[0],j=O[1],P=t.useMemo((function(){var e,t,n=C([],s,!0);if(E&&M)throw new Error("captureSignature and captureSignatureVideo cannot be used together");return E&&n.push("SignatureCapture"),M&&(n.push("VideoSignatureCapture"),n.includes("FaceLiveness")&&n.splice(n.indexOf("FaceLiveness"),1)),null!==(t=null===(e=null==h?void 0:h.documents)||void 0===e?void 0:e.length)&&void 0!==t&&t&&n.push("AdditionalDocumentCapture"),n}),[null===(n=null==h?void 0:h.documents)||void 0===n?void 0:n.length,E,M,s]),_=P[F],U=F>=P.length;t.useEffect((function(){"SignatureCapture"===_&&"function"==typeof E?E().then((function(e){e||j((function(e){return e+1}))})):"VideoSignatureCapture"===_&&"function"==typeof M&&M().then((function(e){e||j((function(e){return e+1}))}))}),[E,M,_]),t.useEffect((function(){U&&N()}),[U,N]);var z=d.onSuccess,G=t.useCallback((function(e){null==z||z(e),j((function(e){return e+1}))}),[z]),W=x.onComplete,V=t.useCallback((function(){null==W||W(),j((function(e){return e+1}))}),[W]),$=f.onComplete,q=t.useCallback((function(e,t){null==$||$(e,t),j((function(e){return e+1}))}),[$]),H=t.useCallback((function(e){L(e),j((function(e){return e+1}))}),[L]),Y=y.onComplete,Z=t.useCallback((function(){null==Y||Y(),j((function(e){return e+1}))}),[Y]),Q=t.useState(0),X=Q[0],K=Q[1],J=y.onRetryClicked,ee=t.useCallback((function(){null==J||J(),K((function(e){return e+1}))}),[J]),te=null==h?void 0:h.onComplete,ne=t.useCallback((function(e){R(e),null==te||te(e),j((function(e){return e+1}))}),[te,R]),ae=t.useMemo((function(){var e;return null!==(e=null==h?void 0:h.documents)&&void 0!==e?e:[]}),[null==h?void 0:h.documents]);if(U)switch(A){case k.SUBMITTING:return u.default.createElement(B,{className:"flex"},u.default.createElement($v,null));case k.SUBMITTED:return u.default.createElement(Sb,null);case k.FAILED:return u.default.createElement(u.default.Fragment,null,"Submission failed!");default:return u.default.createElement(u.default.Fragment,null,"Complete!!")}switch(P[F]){case"IdCapture":return u.default.createElement(hh,{documentDetectionModelUrl:null!==(r=null===(a=d.assets)||void 0===a?void 0:a.documentDetectionModelUrl)&&void 0!==r?r:"",focusModelUrl:null!==(o=null===(i=d.assets)||void 0===i?void 0:i.focusModelUrl)&&void 0!==o?o:"",logPredictions:S,onModelError:d.onModelError,modelLoadTimeoutMs:d.modelLoadTimeoutMs},u.default.createElement(Ke,{key:"IdCaptureCamera",debugMode:S},u.default.createElement(Mh,null,u.default.createElement(Ib,null,u.default.createElement(Ey,v({},d,{onSuccess:G}))))));case"VideoIdCapture":return u.default.createElement(FC,v({},x,{onComplete:V}));case"FaceLiveness":return u.default.createElement(Ke,{key:"FaceLivenessCamera",preferFrontFacingCamera:!0,preferContinuityCamera:!1,debugMode:S},u.default.createElement(Xf,{onModelError:f.onModelError,modelLoadTimeoutMs:f.modelLoadTimeoutMs},u.default.createElement(Mb,v({},f,{onComplete:q}))));case"SignatureCapture":return u.default.createElement(Ox,v({},m,{onAccept:H}));case"VideoSignatureCapture":return u.default.createElement(Ke,{key:"SignatureKycCamera-".concat(X),preferContinuityCamera:!1,preferFrontFacingCamera:!0,maxVideoWidth:1280,maxFps:30,debugMode:S},u.default.createElement(zx,v({},y,{onComplete:Z,onRetryClicked:ee})));case"AdditionalDocumentCapture":return u.default.createElement(_b,v({},h,{documents:ae,onComplete:ne}));default:return u.default.createElement(u.default.Fragment,null)}},PC={default:{fontFamily:"Inter, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif",isFullscreen:!0,background:"white",textColor:"black",textAlign:"center",padding:"25px",colors:{primary:{50:"#eef8ff",100:"#d8eeff",200:"#b9e0ff",300:"#89cfff",400:"#52b4ff",500:"#2a91ff",600:"#0d6efd",700:"#0c5ae9",800:"#1149bc",900:"#144194",950:"#11295a"},secondary:{50:"#f6f6f6",100:"#e7e7e7",200:"#d1d1d1",300:"#b0b0b0",400:"#888888",500:"#666666",600:"#5d5d5d",700:"#4f4f4f",800:"#454545",900:"#3d3d3d",950:"#262626"},positive:{50:"#f1fcf9",100:"#cef9eb",200:"#9df2d8",300:"#65e3c2",400:"#4fd4ad",500:"#1cb090",600:"#16a085",700:"#147160",800:"#155a4f",900:"#164b42",950:"#062d28"},negative:{50:"#fff1f2",100:"#ffe4e6",200:"#fecdd3",300:"#fda4af",400:"#fb7185",500:"#f43f5e",600:"#e11d48",700:"#be123c",800:"#9f1239",900:"#881337",950:"#4c0519"},warning:{50:"#fdf5ef",100:"#fbe7d9",200:"#f6cdb2",300:"#f0ab81",400:"#ea8557",500:"#e35e2c",600:"#d54621",700:"#b1341d",800:"#8d2b1f",900:"#72261c",950:"#3d100d"}},buttons:{style:"bootstrap",primary:{backgroundColor:"var(--idm-color-primary-600)",textColor:"white"},secondary:{backgroundColor:"var(--idm-color-secondary-500)",textColor:"white"},positive:{backgroundColor:"var(--idm-color-positive-600)",textColor:"white"},negative:{backgroundColor:"var(--idm-color-negative-400)",textColor:"white"},warning:{backgroundColor:"var(--idm-color-warning-400)",textColor:"white"},loading:{backgroundColor:"gray",textColor:"white"}},guidanceMessages:{default:{backgroundColor:"var(--idm-color-secondary-200)",textColor:"black"},positive:{backgroundColor:"var(--idm-color-positive-700)",textColor:"white"},negative:{backgroundColor:"var(--idm-color-negative-600)",textColor:"white"}},idCapture:{loadingOverlay:{backgroundColor:"#ecedf3",textColor:"black",loadingGraphicAccentColor:"var(--idm-color-positive-600)",loadingGraphicAccentOpacity:.2,progressBarBackgroundColor:"var(--idm-color-positive-600)",progressBarBackgroundOpacity:.75,progressBarIndicatorColor:"var(--idm-color-positive-600)",progressBarTextColor:"white",continueBtnBorder:"2px solid white"},guideOverlay:{backgroundColor:"#708090",textColor:"white"},guideBox:{unsatisfiedColor:"white",satisfiedColor:"var(--idm-color-positive-500)",borderWidth:4,desktopPadding:50,mobilePadding:0,imagePadding:25}},selfieCapture:{loadingOverlay:{backgroundColor:"#ecedf3",textColor:"black",loadingGraphicAccentColor:"var(--idm-color-positive-600)",progressBarBackgroundColor:"var(--idm-color-positive-600)",progressBarBackgroundOpacity:.75,progressBarIndicatorColor:"var(--idm-color-positive-600)",progressBarTextColor:"white",continueBtnBorder:"2px solid white"},guides:{unsatisfiedColor:"white",satisfiedColor:"var(--idm-color-positive-500)"}},signatureCapture:{background:"radial-gradient(#444cf7 0.5px, transparent 0.5px), radial-gradient(#444cf7 0.5px, #e5e5f7 0.5px)",backgroundSize:"20px 20px",backgroundPosition:"0 0, 10px 10px"},idVideoCapture:{readTextPrompt:{heading:{backgroundColor:"rgba(255, 255, 255, 0.5)",textColor:"black",borderRadius:"8px"},prompt:{backgroundColor:"rgba(255, 255, 255, 0.5)",textColor:"black",borderRadius:"8px"},timeRemaining:{backgroundColor:"rgba(255, 255, 255, 0.5)",textColor:"black",borderRadius:"4px"}}}},none:{}},BC=function(e){var n,a=e.children,i="string"==typeof(n=e.theme)?n in PC?PC[n]:PC.none:n,o=i.colors;return t.useEffect((function(){for(var e in o){var t=o[e];for(var n in t){var a=t[n];document.documentElement.style.setProperty("--idm-color-".concat(e,"-").concat(n),a)}}}),[o]),u.default.createElement(r.ThemeProvider,{theme:i},a)},_C=function(e){var n=e.lang,a=e.submissionToken,r=e.submissionUrl,i=e.companyId,o=e.needImmediateResponse,s=e.manualReviewRequired,l=e.idBackImageRequired,d=e.verifyIdWithExternalDatabases,c=e.bypassAgeValidation,f=e.bypassNameMatching,h=e.personalData,p=e.cardData,m=e.webhooksEnabled,g=e.webhooksClientTraceId,v=e.webhooksStripSpecialCharacters,y=e.webhooksSendInputImages,b=e.webhooksSendProcessedImages,x=e.webhooksFireOnReview,C=e.precapturedDocuments,w=e.loadingOverlayMode,k=void 0===w?"default":w,T=e.idCaptureRequirement,M=void 0===T?"idCardOrPassport":T,I=e.idAutoCaptureEnabled,S=void 0===I||I,D=e.idCardAutoCaptureScoreThreshold,N=void 0===D?.8:D,A=e.passportAutoCaptureScoreThreshold,L=void 0===A?.75:A,R=e.idCardFocusScoreThreshold,O=void 0===R?.3:R,F=e.passportFocusScoreThreshold,j=void 0===F?.3:F,P=e.skipSuccessScreen,B=void 0!==P&&P,_=e.instructions,U=e.guideType,z=void 0===U?"fit":U,G=e.portraitGuidesOnMobile,W=void 0!==G&&G,V=e.rotateLoadingOverlayImageWhenPortrait,$=void 0===V||V,q=e.modelLoadTimeoutMs,H=void 0===q?fh:q,Y=e.onBeforeSubmit,Z=e.onSubmit,Q=e.onComplete,X=e.onApproved,K=e.onDenied,J=e.onExitCapture,ee=e.onUserCancel,te=e.onModelError,ne=e.theme,ae=void 0===ne?"default":ne,re=e.assets,ie=void 0===re?{}:re,oe=e.classNames,se=void 0===oe?{}:oe,le=e.colors,ue=void 0===le?{}:le,de=e.verbiage,ce=void 0===de?{}:de,fe=e.captureSignature,he=void 0!==fe&&fe,pe=e.captureSignatureVideo,me=void 0!==pe&&pe,ge=e.captureAdditionalDocuments,ve=void 0===ge?[]:ge,ye=e.geolocationEnabled,be=void 0===ye||ye,xe=e.geolocationRequired,Ce=void 0!==xe&&xe,we=e.debugMode,Ee=void 0!==we&&we;Yp(void 0===n?"auto":n);var ke=t.useMemo((function(){return{onExitCapture:J,onUserCancel:ee,onModelError:te,precapturedDocuments:C,captureRequirement:M,autoCaptureEnabled:S,idCardAutoCaptureScoreThreshold:N,passportAutoCaptureScoreThreshold:L,mrzDetectionScoreThreshold:.5,idCardFocusScoreThreshold:O,passportFocusScoreThreshold:j,barcodeScanningEnabled:!1,skipSuccessScreen:B,loadingOverlayMode:k,instructions:_,guideType:z,portraitGuidesOnMobile:W,rotateLoadingOverlayImageWhenPortrait:$,modelLoadTimeoutMs:H,assets:ie,classNames:se,colors:ue,verbiage:ce,debugMode:Ee}}),[J,ee,te,C,M,S,N,L,O,j,B,k,_,z,W,$,H,ie,se,ue,ce,Ee]),Te=t.useMemo((function(){return{documents:ve,classNames:se.additionalDocumentCapture,verbiage:ce.additionalDocumentCapture}}),[ve,se.additionalDocumentCapture,ce.additionalDocumentCapture]),Me=t.useMemo((function(){return{classNames:se.signatureCapture,verbiage:ce.signatureCapture}}),[se.signatureCapture,ce.signatureCapture]),Ie=t.useMemo((function(){return{onExitCapture:J,onUserCancel:ee,skipSuccessScreen:B,classNames:se.videoSignatureCapture,colors:ue.videoSignatureCapture,verbiage:ce.videoSignatureCapture,debugMode:Ee}}),[se.videoSignatureCapture,ue.videoSignatureCapture,Ee,J,ee,B,ce.videoSignatureCapture]),De=t.useCallback((function(e,t){null==Q||Q(e,t),"Approved"===e.resultData.verificationResult?null==X||X(e,t):null==K||K(e,t)}),[X,Q,K]);return u.default.createElement(BC,{theme:ae},u.default.createElement(Se,{action:E.VALIDATE,url:r,token:a,companyId:i,needImmediateResponse:o,manualReviewRequired:s,idBackImageRequired:l,verifyIdWithExternalDatabases:d,bypassAgeValidation:c,bypassNameMatching:f,personalData:h,cardData:p,webhooksEnabled:m,webhooksClientTraceId:g,webhooksStripSpecialCharacters:v,webhooksSendInputImages:y,webhooksSendProcessedImages:b,webhooksFireOnReview:x,onBeforeSubmit:Y,onSubmit:Z,onResponseReceived:De,geolocationEnabled:be,geolocationRequired:Ce},u.default.createElement(jC,{checks:t.useMemo((function(){return["IdCapture"]}),[]),idCaptureProps:ke,additionalDocumentCaptureProps:Te,signatureCaptureProps:Me,videoSignatureCaptureProps:Ie,captureSignature:he,captureSignatureVideo:me,debugMode:Ee})))},UC=function(e){var n=e.lang,a=e.submissionToken,r=e.submissionUrl,i=e.companyId,o=e.needImmediateResponse,s=e.webhooksEnabled,l=e.webhooksClientTraceId,d=e.webhooksStripSpecialCharacters,c=e.webhooksSendInputImages,f=e.webhooksSendProcessedImages,h=e.loadingOverlayMode,p=void 0===h?"default":h,m=e.timeoutDurationMs,g=void 0===m?15e3:m,v=e.modelLoadTimeoutMs,y=void 0===v?Hf:v,b=e.skipSuccessScreen,x=void 0!==b&&b,C=e.onBeforeSubmit,w=e.onComplete,k=e.onApproved,T=e.onDenied,M=e.onExitCapture,I=e.onExitAfterFailure,S=e.onUserCancel,D=e.onModelError,N=e.theme,A=void 0===N?"default":N,L=e.assets,R=e.classNames,O=e.colors,F=e.verbiage,j=e.geolocationEnabled,P=void 0===j||j,B=e.geolocationRequired,_=void 0!==B&&B,U=e.debugMode,z=void 0!==U&&U;Yp(void 0===n?"auto":n);var G=t.useMemo((function(){return{loadingOverlayMode:p,timeoutDurationMs:g,modelLoadTimeoutMs:y,skipSuccessScreen:x,onComplete:w,onSuccess:k,onTimeout:T,onExitCapture:M,onExitAfterFailure:I,onModelError:D,onUserCancel:S,assets:L,classNames:R,colors:O,verbiage:F,debugMode:z}}),[L,R,O,z,p,y,k,w,T,I,M,D,S,x,g,F]);return u.default.createElement(BC,{theme:A},u.default.createElement(Se,{action:E.NONE,url:r,token:a,companyId:i,needImmediateResponse:o,webhooksEnabled:s,webhooksClientTraceId:l,webhooksStripSpecialCharacters:d,webhooksSendInputImages:c,webhooksSendProcessedImages:f,onBeforeLivenessCheck:C,geolocationEnabled:P,geolocationRequired:_},u.default.createElement(jC,{checks:t.useMemo((function(){return["FaceLiveness"]}),[]),faceLivenessProps:G,debugMode:z})))},zC=function(e){var n=e.lang,a=e.submissionToken,r=e.submissionUrl,i=e.companyId,o=e.needImmediateResponse,s=e.manualReviewRequired,l=e.idBackImageRequired,d=e.verifyIdWithExternalDatabases,c=e.bypassAgeValidation,f=e.bypassNameMatching,h=e.personalData,p=e.cardData,m=e.webhooksEnabled,g=e.webhooksClientTraceId,v=e.webhooksStripSpecialCharacters,y=e.webhooksSendInputImages,b=e.webhooksSendProcessedImages,x=e.webhooksFireOnReview,C=e.precapturedDocuments,w=e.idCaptureLoadingOverlayMode,k=void 0===w?"default":w,T=e.idCaptureRequirement,M=void 0===T?"idCardOrPassport":T,I=e.idAutoCaptureEnabled,S=void 0===I||I,D=e.idCardAutoCaptureScoreThreshold,N=void 0===D?.8:D,A=e.mrzDetectionScoreThreshold,L=void 0===A?.5:A,R=e.passportAutoCaptureScoreThreshold,O=void 0===R?.75:R,F=e.idCardFocusScoreThreshold,j=void 0===F?.3:F,P=e.passportFocusScoreThreshold,B=void 0===P?.3:P,_=e.faceLivenessLoadingOverlayMode,U=void 0===_?"default":_,z=e.faceLivenessTimeoutDurationMs,G=void 0===z?15e3:z,W=e.skipSuccessScreen,V=void 0!==W&&W,$=e.idCaptureInstructions,q=e.idCaptureGuideType,H=void 0===q?"fit":q,Y=e.idCapturePortraitGuidesOnMobile,Z=void 0!==Y&&Y,Q=e.idCaptureRotateLoadingOverlayImageWhenPortrait,X=void 0===Q||Q,K=e.idCaptureModelLoadTimeoutMs,J=void 0===K?fh:K,ee=e.selfieCaptureModelLoadTimeoutMs,te=void 0===ee?Hf:ee,ne=e.onBeforeLivenessCheck,ae=e.onBeforeSubmit,re=e.onSubmit,ie=e.onComplete,oe=e.onApproved,se=e.onDenied,le=e.onExitCapture,ue=e.onExitAfterFailure,de=e.onUserCancel,ce=e.onIdCaptureModelError,fe=e.onSelfieCaptureModelError,he=e.captureSignature,pe=void 0!==he&&he,me=e.captureSignatureVideo,ge=void 0!==me&&me,ve=e.captureAdditionalDocuments,ye=void 0===ve?[]:ve,be=e.theme,xe=void 0===be?"default":be,Ce=e.assets,we=void 0===Ce?{}:Ce,Ee=e.classNames,ke=void 0===Ee?{}:Ee,Te=e.colors,Me=void 0===Te?{}:Te,Ie=e.verbiage,De=void 0===Ie?{}:Ie,Ne=e.geolocationEnabled,Ae=void 0===Ne||Ne,Le=e.geolocationRequired,Re=void 0!==Le&&Le,Oe=e.debugMode,Fe=void 0!==Oe&&Oe;Yp(void 0===n?"auto":n);var je=t.useMemo((function(){return{onExitCapture:le,onUserCancel:de,onModelError:ce,assets:we.idCapture,classNames:ke.idCapture,colors:Me.idCapture,verbiage:De.idCapture,precapturedDocuments:C,captureRequirement:M,autoCaptureEnabled:S,idCardAutoCaptureScoreThreshold:N,passportAutoCaptureScoreThreshold:O,mrzDetectionScoreThreshold:L,idCardFocusScoreThreshold:j,passportFocusScoreThreshold:B,loadingOverlayMode:k,instructions:$,guideType:H,portraitGuidesOnMobile:Z,rotateLoadingOverlayImageWhenPortrait:X,modelLoadTimeoutMs:J,skipSuccessScreen:V,debugMode:Fe}}),[we.idCapture,ke.idCapture,Me.idCapture,Fe,S,H,$,k,J,Z,M,X,N,j,L,le,ce,de,O,B,C,V,De.idCapture]),Pe=t.useMemo((function(){return{loadingOverlayMode:U,timeoutDurationMs:G,modelLoadTimeoutMs:te,onTimeout:se,onExitCapture:le,onExitAfterFailure:ue,onUserCancel:de,onModelError:fe,skipSuccessScreen:V,assets:we.faceLiveness,classNames:ke.faceLiveness,colors:Me.faceLiveness,verbiage:De.faceLiveness,debugMode:Fe}}),[we.faceLiveness,ke.faceLiveness,Me.faceLiveness,Fe,U,G,se,ue,le,fe,de,te,V,De.faceLiveness]),Be=t.useMemo((function(){return{documents:ye,classNames:ke.additionalDocumentCapture,verbiage:De.additionalDocumentCapture}}),[ye,ke.additionalDocumentCapture,De.additionalDocumentCapture]),_e=t.useMemo((function(){return{classNames:ke.signatureCapture,verbiage:De.signatureCapture}}),[ke.signatureCapture,De.signatureCapture]),Ue=t.useMemo((function(){return{onExitCapture:le,onUserCancel:de,skipSuccessScreen:V,classNames:ke.videoSignatureCapture,colors:Me.videoSignatureCapture,verbiage:De.videoSignatureCapture,debugMode:Fe}}),[ke.videoSignatureCapture,Me.videoSignatureCapture,Fe,le,de,V,De.videoSignatureCapture]),ze=t.useCallback((function(e,t){null==ie||ie(e,t),"Approved"===e.resultData.verificationResult?null==oe||oe(e,t):null==se||se(e,t)}),[oe,ie,se]),Ge=t.useMemo((function(){return(null==C?void 0:C.selfie)?["IdCapture"]:["IdCapture","FaceLiveness"]}),[null==C?void 0:C.selfie]);return u.default.createElement(BC,{theme:xe},u.default.createElement(Se,{action:E.VALIDATE,url:r,token:a,companyId:i,needImmediateResponse:o,manualReviewRequired:s,idBackImageRequired:l,verifyIdWithExternalDatabases:d,bypassAgeValidation:c,bypassNameMatching:f,personalData:h,cardData:p,webhooksEnabled:m,webhooksClientTraceId:g,webhooksStripSpecialCharacters:v,webhooksSendInputImages:y,webhooksSendProcessedImages:b,webhooksFireOnReview:x,precapturedDocuments:C,onBeforeSubmit:ae,onBeforeLivenessCheck:ne,onSubmit:re,onResponseReceived:ze,geolocationEnabled:Ae,geolocationRequired:Re},u.default.createElement(jC,{checks:Ge,idCaptureProps:je,faceLivenessProps:Pe,signatureCaptureProps:_e,videoSignatureCaptureProps:Ue,additionalDocumentCaptureProps:Be,captureSignature:pe,captureSignatureVideo:ge,debugMode:Fe})))},GC=function(e){var n=e.enrollmentId,a=e.lang,r=e.submissionToken,i=e.submissionUrl,o=e.companyId,s=e.needImmediateResponse,l=e.manualReviewRequired,d=e.idBackImageRequired,c=e.idImageResolutionCheck,f=e.verifyIdWithExternalDatabases,h=e.bypassAgeValidation,p=e.bypassNameMatching,m=e.personalData,g=e.cardData,v=e.deduplicationEnabled,y=e.deduplicationSynchronous,b=e.webhooksEnabled,x=e.webhooksClientTraceId,C=e.webhooksStripSpecialCharacters,w=e.webhooksSendInputImages,k=e.webhooksSendProcessedImages,T=e.webhooksFireOnReview,M=e.idCaptureLoadingOverlayMode,I=void 0===M?"default":M,S=e.idCaptureRequirement,D=void 0===S?"idCardOrPassport":S,N=e.idAutoCaptureEnabled,A=void 0===N||N,L=e.idCardAutoCaptureScoreThreshold,R=void 0===L?.8:L,O=e.mrzDetectionScoreThreshold,F=void 0===O?.5:O,j=e.passportAutoCaptureScoreThreshold,P=void 0===j?.75:j,B=e.idCardFocusScoreThreshold,_=void 0===B?.3:B,U=e.passportFocusScoreThreshold,z=void 0===U?.3:U,G=e.faceLivenessTimeoutDurationMs,W=void 0===G?15e3:G,V=e.faceLivenessLoadingOverlayMode,$=void 0===V?"default":V,q=e.skipSuccessScreen,H=void 0!==q&&q,Y=e.idCaptureInstructions,Z=e.idCaptureGuideType,Q=void 0===Z?"fit":Z,X=e.idCapturePortraitGuidesOnMobile,K=void 0!==X&&X,J=e.idCaptureRotateLoadingOverlayImageWhenPortrait,ee=void 0===J||J,te=e.idCaptureModelLoadTimeoutMs,ne=void 0===te?fh:te,ae=e.selfieCaptureModelLoadTimeoutMs,re=void 0===ae?Hf:ae,ie=e.onBeforeSubmit,oe=e.onSubmit,se=e.onComplete,le=e.onEnrolled,ue=e.onDenied,de=e.onExitCapture,ce=e.onExitAfterFailure,fe=e.onUserCancel,he=e.onIdCaptureModelError,pe=e.onSelfieCaptureModelError,me=e.captureSignature,ge=void 0!==me&&me,ve=e.captureSignatureVideo,ye=void 0!==ve&&ve,be=e.captureAdditionalDocuments,xe=void 0===be?[]:be,Ce=e.theme,we=void 0===Ce?"default":Ce,Ee=e.assets,ke=void 0===Ee?{}:Ee,Te=e.classNames,Me=void 0===Te?{}:Te,Ie=e.colors,De=void 0===Ie?{}:Ie,Ne=e.verbiage,Ae=void 0===Ne?{}:Ne,Le=e.geolocationEnabled,Re=void 0===Le||Le,Oe=e.geolocationRequired,Fe=void 0!==Oe&&Oe,je=e.debugMode,Pe=void 0!==je&&je;Yp(void 0===a?"auto":a);var Be=t.useMemo((function(){return{assets:ke.idCapture,classNames:Me.idCapture,colors:De.idCapture,verbiage:Ae.idCapture,captureRequirement:D,autoCaptureEnabled:A,idCardAutoCaptureScoreThreshold:R,passportAutoCaptureScoreThreshold:P,mrzDetectionScoreThreshold:F,idCardFocusScoreThreshold:_,passportFocusScoreThreshold:z,loadingOverlayMode:I,instructions:Y,guideType:Q,portraitGuidesOnMobile:K,rotateLoadingOverlayImageWhenPortrait:ee,modelLoadTimeoutMs:ne,onExitCapture:de,onUserCancel:fe,onModelError:he,skipSuccessScreen:H,debugMode:Pe}}),[ke.idCapture,Me.idCapture,De.idCapture,Pe,A,Q,Y,I,ne,K,D,ee,R,_,F,de,he,fe,P,z,H,Ae.idCapture]),_e=t.useMemo((function(){return{onExitCapture:de,onExitAfterFailure:ce,onUserCancel:fe,onModelError:pe,loadingOverlayMode:$,timeoutDurationMs:W,modelLoadTimeoutMs:re,skipSuccessScreen:H,assets:ke.faceLiveness,classNames:Me.faceLiveness,colors:De.faceLiveness,verbiage:Ae.faceLiveness,debugMode:Pe}}),[ke.faceLiveness,Me.faceLiveness,De.faceLiveness,Pe,$,W,ce,de,pe,fe,re,H,Ae.faceLiveness]),Ue=t.useMemo((function(){return{documents:xe,classNames:Me.additionalDocumentCapture,verbiage:Ae.additionalDocumentCapture}}),[xe,Me.additionalDocumentCapture,Ae.additionalDocumentCapture]),ze=t.useMemo((function(){return{classNames:Me.signatureCapture,verbiage:Ae.signatureCapture}}),[Me.signatureCapture,Ae.signatureCapture]),Ge=t.useMemo((function(){return{onExitCapture:de,onUserCancel:fe,skipSuccessScreen:H,classNames:Me.videoSignatureCapture,colors:De.videoSignatureCapture,verbiage:Ae.videoSignatureCapture,debugMode:Pe}}),[Me.videoSignatureCapture,De.videoSignatureCapture,Pe,de,fe,H,Ae.videoSignatureCapture]),We=t.useCallback((function(e,t){null==se||se(e,t),"Customer Onboarded"===e.resultData.verificationResult?null==le||le(e,t):null==ue||ue(e,t)}),[le,se,ue]);return u.default.createElement(BC,{theme:we},u.default.createElement(Se,{action:E.ENROLL,url:i,token:r,companyId:o,enrollmentId:n,needImmediateResponse:s,manualReviewRequired:l,idBackImageRequired:d,idImageResolutionCheck:c,verifyIdWithExternalDatabases:f,bypassAgeValidation:h,bypassNameMatching:p,personalData:m,cardData:g,deduplicationEnabled:v,deduplicationSynchronous:y,webhooksEnabled:b,webhooksClientTraceId:x,webhooksStripSpecialCharacters:C,webhooksSendInputImages:w,webhooksSendProcessedImages:k,webhooksFireOnReview:T,onBeforeSubmit:ie,onSubmit:oe,onResponseReceived:We,geolocationEnabled:Re,geolocationRequired:Fe},u.default.createElement(jC,{checks:t.useMemo((function(){return["IdCapture","FaceLiveness"]}),[]),idCaptureProps:Be,faceLivenessProps:_e,additionalDocumentCaptureProps:Ue,signatureCaptureProps:ze,videoSignatureCaptureProps:Ge,captureSignature:ge,captureSignatureVideo:ye,debugMode:Pe})))},WC={frame:null,face:null,imageUrl:null,requestState:"CAPTURING",requestError:null,unverifiedTimes:0},VC=function(e,t){switch(t.type){case"verificationReady":return["CAPTURING","ERROR"].includes(e.requestState)?v(v({},e),{requestState:"CAPTURED",frame:t.payload.frame,face:t.payload.face}):e;case"verifying":return v(v({},e),{requestState:"VERIFYING",imageUrl:t.payload.imageUrl});case"verificationCompleted":var n=t.payload.response,a=n.status,r=a.statusMessage,i=a.errorData,o=n.resultData;if("000"!==a.statusCode)return v(v({},e),{requestState:"ERROR",requestError:new Error("".concat(r,": ").concat(i))});var s=e.requestState,l=e.unverifiedTimes;return"00"===o.verificationResultCode?s="VERIFIED":l<0?(s="CAPTURING",l+=1):s="REJECTED",v(v({},e),{requestState:s,unverifiedTimes:l});case"verificationFailed":return v(v({},e),{requestState:"ERROR",requestError:t.payload.error});default:return e}},$C=function(e){var n,a,i=e.onCustomerMatched,o=e.onCustomerNotMatched,s=e.onCaptureGuidanceTimeout,l=e.onExit,d=e.captureGuidanceTimeoutDurationMs,c=e.classNames,f=void 0===c?{}:c,h=e.colors,p=void 0===h?{}:h,m=e.verbiage,g=void 0===m?{}:m,v=e.debugMode,y=void 0!==v&&v,C=t.useReducer(VC,WC),w=C[0],E=C[1],k=w.frame,T=w.face,M=t.useContext(Ie),S=M.submit,D=M.submissionRequest,N=M.submissionResponse,A=M.submissionError,L=M.selfieImage,R=M.setSelfieImage,O=t.useState(null),F=O[0],j=O[1],P=t.useRef(null),B=t.useRef(null),_=t.useCallback((function(e,t){E({type:"verificationReady",payload:{frame:e,face:t}})}),[]),U="CAPTURED"===w.requestState;t.useEffect((function(){if(k&&T&&!A){var e=Oa(P.current,B.current,k,T);j(e),I(e).then((function(e){R(e)}))}}),[T,k,R,A]),t.useEffect((function(){U&&L&&!A&&b(void 0,void 0,void 0,(function(){var e,t;return x(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),E({type:"verifying",payload:{imageUrl:L}}),[4,S()];case 1:if(!(e=n.sent()))throw new Error("submission failed!");return E({type:"verificationCompleted",payload:{response:e}}),[3,3];case 2:return t=n.sent(),E({type:"verificationFailed",payload:{error:t}}),[3,3];case 3:return[2]}}))}))}),[U,i,o,L,w.requestState,A,S]),t.useEffect((function(){D&&N&&("VERIFIED"===w.requestState?null==i||i(N,D):"REJECTED"===w.requestState&&(null==o||o(N,D)))}),[i,o,w.requestState,D,N]),Iy(d,s,["VERIFIED","REJECTED"].includes(w.requestState),"VERIFYING"===w.requestState);var z=Qp(g.progressPreviewText,"Processing..."),G=r.useTheme();return u.default.createElement(u.default.Fragment,null,u.default.createElement(_e,{ref:P}),u.default.createElement(_e,{ref:B}),u.default.createElement(jy,{onSelfieCaptured:_,onExit:l,timeoutDurationMs:d,classNames:f,colors:p,verbiage:g,debugMode:y}),!(null===(a=null===(n=G.selfieCapture)||void 0===n?void 0:n.capturePreview)||void 0===a?void 0:a.disabled)&&F&&u.default.createElement(Hv,{imageUrl:F,text:z,classNames:f.imagePreview}))},qC=function(e){var t=e.imageUrl,n=e.onDoneClick,a=e.onRetryClick,r=e.classNames,i=void 0===r?{}:r,o=e.colors,s=void 0===o?{}:o,l=e.verbiage,d=void 0===l?{}:l;t||(t="".concat(Ra,"/Selfie-Image-1.png"));var c=Xp(d,{headingText:"Customer has been verified!",retryBtnText:"Retry",doneBtnText:"Done"});return u.default.createElement(W,{className:i.container},u.default.createElement(V,{className:i.inner},u.default.createElement(HC,{className:i.heading},c.headingText),u.default.createElement(YC,{className:i.imageContainer},u.default.createElement("img",{alt:c.headingText,src:t,className:i.image})),u.default.createElement(ZC,{className:i.buttonsRow},u.default.createElement(ce,{variant:"warning",className:i.retryBtn,onClick:a,colors:s.retryBtn,finished:!0},c.retryBtnText),u.default.createElement(ce,{variant:"positive",className:i.doneBtn,onClick:n,colors:s.doneBtn,finished:!0},c.doneBtnText))))},HC=h.default.h3(sC||(sC=w(["\n margin-bottom: 24px;\n"],["\n margin-bottom: 24px;\n"]))),YC=h.default(ym)(lC||(lC=w(["\n max-height: calc(100vh - 185px);\n"],["\n max-height: calc(100vh - 185px);\n"]))),ZC=h.default(ym)(uC||(uC=w(["\n margin-top: 24px;\n"],["\n margin-top: 24px;\n"]))),QC=function(e){var t=e.canRetry,n=void 0===t||t,a=e.onRetryClick,r=e.onExitClick,i=e.assets,o=void 0===i?{}:i,s=e.classNames,l=void 0===s?{}:s,d=e.colors,c=void 0===d?{}:d,f=e.verbiage,h=void 0===f?{}:f;o.imageUrl||(o.imageUrl="".concat(Ra,"/manual_capture.png"));var p=Xp(h,{headingText:"Customer not verified",retryBtnText:"Retry",exitBtnText:"Exit"});return u.default.createElement(W,{className:l.container},u.default.createElement(V,{className:l.inner},u.default.createElement(XC,{className:l.heading},p.headingText),u.default.createElement(KC,{className:l.imageContainer},u.default.createElement("img",{alt:p.headingText,src:o.imageUrl,className:l.image})),u.default.createElement(JC,{className:l.buttonsRow},n&&u.default.createElement(ce,{variant:"warning",className:l.retryBtn,onClick:a,colors:c.retryBtn,finished:!0},p.retryBtnText),u.default.createElement(ce,{variant:"secondary",className:l.exitBtn,onClick:r,colors:c.exitBtn,finished:!0},p.exitBtnText))))},XC=h.default.h3(dC||(dC=w(["\n margin-bottom: 24px;\n"],["\n margin-bottom: 24px;\n"]))),KC=h.default(ym)(cC||(cC=w(["\n max-height: calc(100vh - 185px);\n"],["\n max-height: calc(100vh - 185px);\n"]))),JC=h.default(ym)(fC||(fC=w(["\n margin-top: 24px;\n"],["\n margin-top: 24px;\n"]))),ew=function(e){var n,a=e.onComplete,r=e.onCustomerMatched,i=e.onCustomerNotMatched,o=e.onExitCapture,s=e.onExitAfterFailure,l=e.onUserCancel,d=e.onCaptureGuidanceTimeout,c=e.captureGuidanceTimeoutDurationMs,f=e.skipSuccessScreen,h=void 0!==f&&f,p=e.loadingOverlayMode,m=void 0===p?"default":p,g=e.assets,v=void 0===g?{}:g,y=e.classNames,C=void 0===y?{}:y,w=e.colors,E=void 0===w?{}:w,k=e.verbiage,T=void 0===k?{}:k,M=e.debugMode,I=void 0!==M&&M,S=t.useContext(Ie),D=S.submissionRequest,N=S.submissionResponse,A=S.selfieImage,L=t.useState("LOADING"),R=L[0],O=L[1],F=t.useContext(Xe).releaseCameraAccess,j=t.useCallback((function(e,t){return b(void 0,void 0,void 0,(function(){return x(this,(function(n){return O("MATCHED"),null==r||r(e,t),[2]}))}))}),[r]),P=t.useCallback((function(e,t){return b(void 0,void 0,void 0,(function(){return x(this,(function(n){return O("NOT_MATCHED"),null==i||i(e,t),[2]}))}))}),[i]),_=t.useCallback((function(){O("FAILED"),null==d||d()}),[d]),U=t.useState(0),z=U[0],G=U[1],W=t.useCallback((function(){G((function(e){return e+1})),O("LOADING"),null==o||o()}),[o]),V=t.useCallback((function(){F(),D&&N&&(null==a||a(N,D))}),[a,F,D,N]),$=Lg(h,"MATCHED"===R,V);return u.default.createElement(u.default.Fragment,null,u.default.createElement(B,{className:"flex ".concat(null!==(n=C.container)&&void 0!==n?n:"")},u.default.createElement(Ng,{className:C.cameraFeed}),"LOADING"!==R&&function(){switch(R){case"CAPTURING":return u.default.createElement($C,{key:"capture".concat(z),onCustomerMatched:j,onCustomerNotMatched:P,onCaptureGuidanceTimeout:_,onExit:W,captureGuidanceTimeoutDurationMs:c,classNames:C,colors:E,verbiage:T,debugMode:I});case"MATCHED":if(!$)return;return u.default.createElement(qC,{imageUrl:"data:image/png;base64, ".concat(A),classNames:C.success,colors:E.success,verbiage:T.success,onDoneClick:V,onRetryClick:function(){O("CAPTURING"),G(0)}});case"NOT_MATCHED":case"FAILED":return u.default.createElement(QC,{assets:v.failure,classNames:C.failure,colors:E.failure,verbiage:T.failure,canRetry:z<2,onExitClick:function(){F(),null==s||s()},onRetryClick:function(){G((function(e){return e+1}))}});default:return null}}()),u.default.createElement(Tb,{key:z,mode:m,assets:v.loadingOverlay,classNames:C.loadingOverlay,colors:E.loadingOverlay,verbiage:T.loadingOverlay,onUserCancel:l,onDismissed:function(){O("CAPTURING")}}))},tw=function(e){var t=e.lang,n=e.enrollmentId,a=e.submissionToken,r=e.submissionUrl,i=e.companyId,o=e.needImmediateResponse,s=e.webhooksEnabled,l=e.webhooksClientTraceId,d=e.webhooksStripSpecialCharacters,c=e.webhooksSendInputImages,f=e.webhooksSendProcessedImages,h=e.loadingOverlayMode,p=void 0===h?"default":h,m=e.timeoutDurationMs,g=void 0===m?15e3:m,v=e.modelLoadTimeoutMs,y=void 0===v?Hf:v,b=e.skipSuccessScreen,x=void 0!==b&&b,C=e.theme,w=void 0===C?"default":C,k=e.assets,T=e.classNames,M=e.colors,I=e.verbiage,S=e.onBeforeSubmit,D=e.onSubmit,N=e.onComplete,A=e.onCustomerMatched,L=e.onCustomerNotMatched,R=e.onExitCapture,O=e.onExitAfterFailure,F=e.onUserCancel,j=e.onModelError,P=e.geolocationEnabled,B=void 0===P||P,_=e.geolocationRequired,U=void 0!==_&&_,z=e.debugMode,G=void 0!==z&&z;return Yp(void 0===t?"auto":t),u.default.createElement(BC,{theme:w},u.default.createElement(Se,{action:E.VERIFY,url:r,token:a,companyId:i,enrollmentId:n,needImmediateResponse:o,webhooksEnabled:s,webhooksClientTraceId:l,webhooksStripSpecialCharacters:d,webhooksSendInputImages:c,webhooksSendProcessedImages:f,onBeforeSubmit:S,onSubmit:D,geolocationEnabled:B,geolocationRequired:U},u.default.createElement(Ke,{preferFrontFacingCamera:!0,debugMode:G},u.default.createElement(Xf,{onModelError:j,modelLoadTimeoutMs:y},u.default.createElement(ew,{onComplete:N,onCustomerMatched:A,onCustomerNotMatched:L,onExitCapture:R,onExitAfterFailure:O,onUserCancel:F,captureGuidanceTimeoutDurationMs:g,loadingOverlayMode:p,skipSuccessScreen:x,assets:k,classNames:T,colors:M,verbiage:I,debugMode:G})))))},nw={frame:null,face:null,imageUrl:null,requestState:"CAPTURING",requestError:null,notFoundTimes:0},aw=function(e,t){switch(t.type){case"identificationReady":return["CAPTURING","ERROR"].includes(e.requestState)?v(v({},e),{requestState:"CAPTURED",frame:t.payload.frame,face:t.payload.face}):e;case"identifying":return v(v({},e),{requestState:"IDENTIFYING",imageUrl:t.payload.imageUrl});case"identificationCompleted":var n=t.payload.response,a=n.status,r=a.statusMessage,i=a.errorData,o=n.resultData;if("000"!==a.statusCode)return v(v({},e),{requestState:"ERROR",requestError:new Error("".concat(r,": ").concat(i))});var s=e.requestState,l=e.notFoundTimes;return"46"===o.verificationResultCode?s="FOUND":l<0?(s="CAPTURING",l+=1):s="NOT_FOUND",v(v({},e),{requestState:s,notFoundTimes:l});case"identificationFailed":return v(v({},e),{requestState:"ERROR",requestError:t.payload.error});default:return e}},rw=function(e){var n,a,i=e.onCustomerMatched,o=e.onCustomerNotMatched,s=e.onCaptureGuidanceTimeout,l=e.onExit,d=e.captureGuidanceTimeoutDurationMs,c=e.classNames,f=void 0===c?{}:c,h=e.colors,p=void 0===h?{}:h,m=e.verbiage,g=void 0===m?{}:m,v=e.debugMode,y=void 0!==v&&v,C=t.useReducer(aw,nw),w=C[0],E=C[1],k=t.useContext(Ie),T=k.submit,M=k.submissionRequest,S=k.submissionResponse,D=k.submissionError,N=k.selfieImage,A=k.setSelfieImage,L=t.useState(null),R=L[0],O=L[1],F=t.useRef(null),j=t.useRef(null),P=t.useCallback((function(e,t){E({type:"identificationReady",payload:{frame:e,face:t}})}),[]),B=w.frame,_=w.face,U="CAPTURED"===w.requestState;t.useEffect((function(){if(B&&_&&!D){var e=Oa(F.current,j.current,B,_);O(e),I(e).then((function(e){A(e)}))}}),[_,B,A,D]),t.useEffect((function(){U&&N&&!D&&b(void 0,void 0,void 0,(function(){var e,t;return x(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),E({type:"identifying",payload:{imageUrl:N}}),[4,T()];case 1:if(!(e=n.sent()))throw new Error("submission failed!");return E({type:"identificationCompleted",payload:{response:e}}),[3,3];case 2:return t=n.sent(),E({type:"identificationFailed",payload:{error:t}}),[3,3];case 3:return[2]}}))}))}),[U,i,o,N,w.requestState,D,T]),t.useEffect((function(){M&&S&&("FOUND"===w.requestState?null==i||i(S,M):"NOT_FOUND"===w.requestState&&(null==o||o(S,M)))}),[i,o,w.requestState,M,S]),Iy(d,s,["FOUND","NOT_FOUND"].includes(w.requestState),"IDENTIFYING"===w.requestState);var z=Qp(g.progressPreviewText,"Processing..."),G=r.useTheme();return u.default.createElement(u.default.Fragment,null,u.default.createElement(_e,{ref:F}),u.default.createElement(_e,{ref:j}),u.default.createElement(jy,{onSelfieCaptured:P,onExit:l,timeoutDurationMs:d,classNames:f,colors:p,verbiage:g,debugMode:y}),!(null===(a=null===(n=G.selfieCapture)||void 0===n?void 0:n.capturePreview)||void 0===a?void 0:a.disabled)&&R&&u.default.createElement(Hv,{text:z,imageUrl:R,classNames:f.imagePreview}))},iw=function(e){var t=e.imageUrl,n=e.onDoneClick,a=e.onRetryClick,r=e.classNames,i=void 0===r?{}:r,o=e.colors,s=void 0===o?{}:o,l=e.verbiage,d=void 0===l?{}:l;t||(t="".concat(Ra,"/Selfie-Image-1.png"));var c=Xp(d,{headingText:"Customer has been identified!",retryBtnText:"Retry",doneBtnText:"Done"});return u.default.createElement(W,{className:i.container},u.default.createElement(V,{className:i.inner},u.default.createElement(ow,{className:i.heading},c.headingText),u.default.createElement(sw,{className:i.imageContainer},u.default.createElement("img",{alt:c.headingText,src:t,className:i.image})),u.default.createElement(lw,{className:i.buttonsRow},u.default.createElement(ce,{variant:"warning",className:i.retryBtn,onClick:a,colors:s.retryBtn,finished:!0},c.retryBtnText),u.default.createElement(ce,{variant:"positive",className:i.doneBtn,onClick:n,colors:s.doneBtn,finished:!0},c.doneBtnText))))},ow=h.default.h3(hC||(hC=w(["\n margin-bottom: 24px;\n"],["\n margin-bottom: 24px;\n"]))),sw=h.default(ym)(pC||(pC=w(["\n max-height: calc(100vh - 185px);\n"],["\n max-height: calc(100vh - 185px);\n"]))),lw=h.default(ym)(mC||(mC=w(["\n margin-top: 24px;\n"],["\n margin-top: 24px;\n"]))),uw=function(e){var t=e.canRetry,n=void 0===t||t,a=e.onRetryClick,r=e.onExitClick,i=e.assets,o=void 0===i?{}:i,s=e.classNames,l=void 0===s?{}:s,d=e.colors,c=void 0===d?{}:d,f=e.verbiage,h=void 0===f?{}:f;o.imageUrl||(o.imageUrl="".concat(Ra,"/manual_capture.png"));var p=Xp(h,{headingText:"Customer not found",retryBtnText:"Retry",exitBtnText:"Exit"});return u.default.createElement(W,{className:l.container},u.default.createElement(V,{className:l.inner},u.default.createElement(dw,{className:l.heading},p.headingText),u.default.createElement(cw,{className:l.imageContainer},u.default.createElement("img",{alt:p.headingText,src:o.imageUrl,className:l.image})),u.default.createElement(fw,{className:l.buttonsRow},n&&u.default.createElement(ce,{variant:"warning",className:l.retryBtn,onClick:a,colors:c.retryBtn,finished:!0},p.retryBtnText),u.default.createElement(ce,{variant:"secondary",className:l.exitBtn,onClick:r,colors:c.exitBtn,finished:!0},p.exitBtnText))))},dw=h.default.h3(gC||(gC=w(["\n margin-bottom: 24px;\n"],["\n margin-bottom: 24px;\n"]))),cw=h.default(ym)(vC||(vC=w(["\n max-height: calc(100vh - 185px);\n"],["\n max-height: calc(100vh - 185px);\n"]))),fw=h.default(ym)(yC||(yC=w(["\n margin-top: 24px;\n"],["\n margin-top: 24px;\n"]))),hw=function(e){var n,a=e.onComplete,r=e.onCustomerMatched,i=e.onCustomerNotMatched,o=e.onExitCapture,s=e.onExitAfterFailure,l=e.onUserCancel,d=e.onCaptureGuidanceTimeout,c=e.captureGuidanceTimeoutDurationMs,f=e.skipSuccessScreen,h=void 0!==f&&f,p=e.loadingOverlayMode,m=void 0===p?"default":p,g=e.assets,v=void 0===g?{}:g,y=e.classNames,C=void 0===y?{}:y,w=e.colors,E=void 0===w?{}:w,k=e.verbiage,T=void 0===k?{}:k,M=e.debugMode,I=void 0!==M&&M,S=t.useContext(Ie),D=S.submissionResponse,N=S.submissionRequest,A=S.selfieImage,L=t.useState("LOADING"),R=L[0],O=L[1],F=t.useContext(Xe).releaseCameraAccess,j=t.useCallback((function(e,t){return b(void 0,void 0,void 0,(function(){return x(this,(function(n){return O("FOUND"),null==r||r(e,t),[2]}))}))}),[r]),P=t.useCallback((function(e,t){return b(void 0,void 0,void 0,(function(){return x(this,(function(n){return O("NOT_FOUND"),null==i||i(e,t),[2]}))}))}),[i]),_=t.useCallback((function(){O("FAILED"),null==d||d()}),[d]),U=t.useState(0),z=U[0],G=U[1],W=t.useCallback((function(){G((function(e){return e+1})),O("LOADING"),null==o||o()}),[o]),V=t.useCallback((function(){F(),N&&D&&(null==a||a(D,N))}),[a,F,N,D]),$=Lg(h,"FOUND"===R,V);return u.default.createElement(u.default.Fragment,null,u.default.createElement(B,{className:"flex ".concat(null!==(n=C.container)&&void 0!==n?n:"")},u.default.createElement(Ng,{className:C.cameraFeed}),"LOADING"!==R&&function(){switch(R){case"CAPTURING":return u.default.createElement(rw,{key:"capture".concat(z),onCustomerMatched:j,onCustomerNotMatched:P,onCaptureGuidanceTimeout:_,onExit:W,captureGuidanceTimeoutDurationMs:c,classNames:C,colors:E,verbiage:T,debugMode:I});case"FOUND":if(!$)return;return u.default.createElement(iw,{imageUrl:"data:image/png;base64, ".concat(A),classNames:C.success,colors:E.success,verbiage:T.success,onDoneClick:V,onRetryClick:function(){O("CAPTURING"),G(0)}});case"NOT_FOUND":case"FAILED":return u.default.createElement(uw,{assets:v.failure,classNames:C.failure,colors:E.failure,verbiage:T.failure,canRetry:z<2,onExitClick:function(){F(),null==s||s()},onRetryClick:function(){G((function(e){return e+1}))}});default:return null}}()),u.default.createElement(Tb,{key:z,mode:m,assets:v.loadingOverlay,classNames:C.loadingOverlay,colors:E.loadingOverlay,verbiage:T.loadingOverlay,onUserCancel:l,onDismissed:function(){O("CAPTURING")}}))},pw=function(e){var t=e.lang,n=e.submissionToken,a=e.submissionUrl,r=e.companyId,i=e.needImmediateResponse,o=e.webhooksEnabled,s=e.webhooksClientTraceId,l=e.webhooksStripSpecialCharacters,d=e.webhooksSendInputImages,c=e.webhooksSendProcessedImages,f=e.loadingOverlayMode,h=void 0===f?"default":f,p=e.timeoutDurationMs,m=void 0===p?15e3:p,g=e.modelLoadTimeoutMs,v=void 0===g?Hf:g,y=e.skipSuccessScreen,b=void 0!==y&&y,x=e.onBeforeSubmit,C=e.onSubmit,w=e.onComplete,k=e.onCustomerMatched,T=e.onCustomerNotMatched,M=e.onCaptureGuidanceTimeout,I=e.onExitCapture,S=e.onExitAfterFailure,D=e.onUserCancel,N=e.onModelError,A=e.theme,L=void 0===A?"default":A,R=e.assets,O=e.classNames,F=e.colors,j=e.verbiage,P=e.geolocationEnabled,B=e.geolocationRequired,_=void 0!==B&&B,U=e.debugMode,z=void 0!==U&&U;return Yp(void 0===t?"auto":t),u.default.createElement(BC,{theme:L},u.default.createElement(Se,{action:E.IDENTIFY,url:a,token:n,companyId:r,needImmediateResponse:i,webhooksEnabled:o,webhooksClientTraceId:s,webhooksStripSpecialCharacters:l,webhooksSendInputImages:d,webhooksSendProcessedImages:c,onBeforeSubmit:x,onSubmit:C,geolocationEnabled:P,geolocationRequired:_},u.default.createElement(Ke,{preferFrontFacingCamera:!0,debugMode:z},u.default.createElement(Xf,{modelLoadTimeoutMs:v,onModelError:N},u.default.createElement(hw,{onComplete:w,onCustomerMatched:k,onCustomerNotMatched:T,onExitCapture:I,onExitAfterFailure:S,onUserCancel:D,onCaptureGuidanceTimeout:M,captureGuidanceTimeoutDurationMs:m,loadingOverlayMode:h,skipSuccessScreen:b,assets:R,classNames:O,colors:F,verbiage:j,debugMode:z})))))},mw=function(e){var n=e.lang,a=e.submissionToken,r=e.submissionUrl,i=e.onBeforeSubmit,o=e.onSubmit,s=e.onComplete,l=e.onUserCancel,d=e.onModelError,c=e.loadingOverlayMode,f=void 0===c?"default":c,h=e.skipSuccessScreen,p=void 0!==h&&h,m=e.modelLoadTimeoutMs,g=void 0===m?Hf:m,v=e.theme,y=void 0===v?"default":v,b=e.classNames,x=e.colors,C=e.verbiage,w=e.geolocationEnabled,k=e.geolocationRequired,T=e.debugMode;Yp(void 0===n?"auto":n);var M=t.useState(0),I=M[1];return u.default.createElement(BC,{theme:y},u.default.createElement(Se,{action:E.NONE,url:r,token:a,onBeforeSubmit:i,onSubmit:o,onResponseReceived:s,geolocationEnabled:w,geolocationRequired:k},u.default.createElement(Ke,{key:M[0],preferContinuityCamera:!1,preferFrontFacingCamera:!0,debugMode:T},u.default.createElement(zx,{loadingOverlayMode:f,skipSuccessScreen:p,modelLoadTimeoutMs:g,classNames:b,colors:x,debugMode:T,verbiage:C,onModelError:d,onUserCancel:l,onRetryClicked:function(){I((function(e){return e+1}))}}))))},gw=function(e){var n=e.lang,a=e.submissionToken,r=e.submissionUrl,i=e.companyId,o=e.needImmediateResponse,s=e.manualReviewRequired,l=e.idBackImageRequired,d=e.verifyIdWithExternalDatabases,c=e.bypassAgeValidation,f=e.bypassNameMatching,h=e.personalData,p=e.cardData,m=e.webhooksEnabled,g=e.webhooksClientTraceId,v=e.webhooksStripSpecialCharacters,y=e.webhooksSendInputImages,b=e.webhooksSendProcessedImages,x=e.webhooksFireOnReview,C=e.onSubmit,w=e.onBeforeSubmit,k=e.onComplete,T=e.onExitCapture,M=e.onExitAfterFailure,I=e.onUserCancel,S=e.idCaptureProps,D=e.faceLivenessProps,N=e.idCaptureModelsEnabled,A=void 0===N||N,L=e.idCardFrontDetectionThreshold,R=void 0===L?.6:L,O=e.idCardFrontFocusThreshold,F=void 0===O?0:O,j=e.goodIdCardFrontFramesThreshold,P=void 0===j?1:j,B=e.idCardBackDetectionThreshold,_=void 0===B?.6:B,U=e.idCardBackFocusThreshold,z=void 0===U?0:U,G=e.goodIdCardBackFramesThreshold,W=void 0===G?1:G,V=e.readTextPrompt,$=e.readTextTimeoutDurationMs,q=void 0===$?15e3:$,H=e.skipSuccessScreen,Y=void 0!==H&&H,Z=e.skipIdCapture,Q=void 0!==Z&&Z,X=e.skipShowIdCardBack,K=void 0!==X&&X,J=e.idCaptureLoadingOverlayMode,ee=void 0===J?"default":J,te=e.idCaptureGuideType,ne=void 0===te?"fit":te,ae=e.idCapturePortraitGuidesOnMobile,re=void 0!==ae&&ae,ie=e.idCaptureRotateLoadingOverlayImageWhenPortrait,oe=void 0===ie||ie,se=e.faceLivenessLoadingOverlayMode,le=void 0===se?"default":se,ue=e.theme,de=void 0===ue?"default":ue,ce=e.assets,fe=void 0===ce?{}:ce,he=e.classNames,pe=void 0===he?{}:he,me=e.colors,ge=void 0===me?{}:me,ve=e.verbiage,ye=void 0===ve?{}:ve,be=e.captureSignature,xe=void 0!==be&&be,Ce=e.captureSignatureVideo,we=void 0!==Ce&&Ce,Ee=e.captureAdditionalDocuments,ke=void 0===Ee?[]:Ee,Te=e.geolocationEnabled,Me=void 0===Te||Te,Ie=e.geolocationRequired,De=void 0!==Ie&&Ie,Ne=e.debugMode,Ae=void 0!==Ne&&Ne;Yp(void 0===n?"auto":n);var Le=t.useMemo((function(){return{idCaptureProps:S,faceLivenessProps:D,idCaptureModelsEnabled:A,idCardFrontDetectionThreshold:R,idCardFrontFocusThreshold:F,goodIdCardFrontFramesThreshold:P,idCardBackDetectionThreshold:_,idCardBackFocusThreshold:z,goodIdCardBackFramesThreshold:W,readTextPrompt:V,readTextTimeoutDurationMs:q,onExitCapture:T,onExitAfterFailure:M,onUserCancel:I,skipSuccessScreen:Y,skipIdCapture:Q,skipShowIdCardBack:K,idCaptureLoadingOverlayMode:ee,idCaptureGuideType:ne,idCapturePortraitGuidesOnMobile:re,idCaptureRotateLoadingOverlayImageWhenPortrait:oe,faceLivenessLoadingOverlayMode:le,assets:fe,classNames:pe,colors:ge,verbiage:ye,debugMode:Ae}}),[fe,pe,ge,Ae,le,D,W,P,ne,ee,A,re,S,oe,_,z,R,F,M,T,I,V,q,Q,K,Y,ye]),Re=t.useMemo((function(){return{documents:ke,classNames:pe.additionalDocumentCapture,verbiage:ye.additionalDocumentCapture}}),[ke,pe.additionalDocumentCapture,ye.additionalDocumentCapture]),Oe=t.useMemo((function(){return{classNames:pe.signatureCapture,verbiage:ye.signatureCapture}}),[pe.signatureCapture,ye.signatureCapture]),Fe=t.useMemo((function(){return{onExitCapture:T,onUserCancel:I,skipSuccessScreen:Y,classNames:pe.videoSignatureCapture,colors:ge.videoSignatureCapture,verbiage:ye.videoSignatureCapture,debugMode:Ae}}),[pe.videoSignatureCapture,ge.videoSignatureCapture,Ae,T,I,Y,ye.videoSignatureCapture]);return u.default.createElement(BC,{theme:de},u.default.createElement(Se,{action:Q?E.NONE:E.VALIDATE,url:r,token:a,companyId:i,needImmediateResponse:o,manualReviewRequired:s,idBackImageRequired:l,verifyIdWithExternalDatabases:d,bypassAgeValidation:c,bypassNameMatching:f,personalData:h,cardData:p,webhooksEnabled:m,webhooksClientTraceId:g,webhooksStripSpecialCharacters:v,webhooksSendInputImages:y,webhooksSendProcessedImages:b,webhooksFireOnReview:x,onSubmit:C,onBeforeSubmit:w,onResponseReceived:k,geolocationEnabled:Me,geolocationRequired:De},u.default.createElement(jC,{checks:t.useMemo((function(){return["VideoIdCapture"]}),[]),videoIdCaptureProps:Le,additionalDocumentCaptureProps:Re,signatureCaptureProps:Oe,videoSignatureCaptureProps:Fe,captureSignature:xe,captureSignatureVideo:we,debugMode:Ae})))},vw=function(e){var n=e.enrollmentId,a=e.lang,r=e.submissionToken,i=e.submissionUrl,o=e.companyId,s=e.needImmediateResponse,l=e.deduplicationEnabled,d=e.deduplicationSynchronous,c=e.webhooksEnabled,f=e.webhooksClientTraceId,h=e.webhooksStripSpecialCharacters,p=e.webhooksSendInputImages,m=e.webhooksSendProcessedImages,g=e.loadingOverlayMode,v=void 0===g?"default":g,y=e.timeoutDurationMs,b=void 0===y?15e3:y,x=e.modelLoadTimeoutMs,C=void 0===x?Hf:x,w=e.skipSuccessScreen,k=void 0!==w&&w,T=e.onBeforeSubmit,M=e.onSubmit,I=e.onComplete,S=e.onEnrolled,D=e.onDenied,N=e.onExitCapture,A=e.onExitAfterFailure,L=e.onUserCancel,R=e.onModelError,O=e.captureAdditionalDocuments,F=void 0===O?[]:O,j=e.captureSignature,P=void 0!==j&&j,B=e.captureSignatureVideo,_=void 0!==B&&B,U=e.theme,z=void 0===U?"default":U,G=e.assets,W=void 0===G?{}:G,V=e.classNames,$=void 0===V?{}:V,q=e.colors,H=void 0===q?{}:q,Y=e.verbiage,Z=void 0===Y?{}:Y,Q=e.geolocationEnabled,X=void 0===Q||Q,K=e.geolocationRequired,J=void 0!==K&&K,ee=e.debugMode,te=void 0!==ee&ⅇYp(void 0===a?"auto":a);var ne=t.useMemo((function(){return{onExitCapture:N,onUserCancel:L,onExitAfterFailure:A,onModelError:R,timeoutDurationMs:b,modelLoadTimeoutMs:C,loadingOverlayMode:v,skipSuccessScreen:k,assets:W.faceLiveness,classNames:$.faceLiveness,colors:H.faceLiveness,verbiage:Z.faceLiveness,debugMode:te}}),[W.faceLiveness,$.faceLiveness,H.faceLiveness,te,v,C,A,N,R,L,k,b,Z.faceLiveness]),ae=t.useMemo((function(){return{documents:F,classNames:$.additionalDocumentCapture,verbiage:Z.additionalDocumentCapture}}),[F,$.additionalDocumentCapture,Z.additionalDocumentCapture]),re=t.useMemo((function(){return{classNames:$.signatureCapture,verbiage:Z.signatureCapture}}),[$.signatureCapture,Z.signatureCapture]),ie=t.useMemo((function(){return{onExitCapture:N,onUserCancel:L,skipSuccessScreen:k,classNames:$.videoSignatureCapture,colors:H.videoSignatureCapture,verbiage:Z.videoSignatureCapture,debugMode:te}}),[$.videoSignatureCapture,H.videoSignatureCapture,te,N,L,k,Z.videoSignatureCapture]),oe=t.useCallback((function(e,t){null==I||I(e,t),"Customer Onboarded"===e.resultData.verificationResult?null==S||S(e,t):null==D||D(e,t)}),[S,I,D]);return u.default.createElement(BC,{theme:z},u.default.createElement(Se,{action:E.ENROLL,url:i,token:r,companyId:o,enrollmentId:n,needImmediateResponse:s,deduplicationEnabled:l,deduplicationSynchronous:d,webhooksEnabled:c,webhooksClientTraceId:f,webhooksStripSpecialCharacters:h,webhooksSendInputImages:p,webhooksSendProcessedImages:m,onBeforeSubmit:T,onSubmit:M,onResponseReceived:oe,geolocationEnabled:X,geolocationRequired:J},u.default.createElement(jC,{checks:t.useMemo((function(){return["FaceLiveness"]}),[]),faceLivenessProps:ne,additionalDocumentCaptureProps:ae,signatureCaptureProps:re,videoSignatureCaptureProps:ie,captureSignature:P,captureSignatureVideo:_,debugMode:te})))},yw=function(e){var t=e.lang,n=e.submissionToken,a=e.submissionUrl,r=e.documentServiceUrl,i=e.onComplete,o=e.onDocumentUploaded,s=e.onExitCapture,l=e.onUserCancel,d=e.documents,c=void 0===d?[]:d,f=e.aspectRatio,h=e.cameraFeedMode,p=e.instructions,m=e.theme,g=void 0===m?"default":m,v=e.classNames,y=void 0===v?{}:v,b=e.verbiage,x=void 0===b?{}:b,C=e.geolocationEnabled,w=void 0===C||C,k=e.geolocationRequired,T=void 0!==k&&k,M=e.debugMode,I=void 0!==M&&M;return Yp(void 0===t?"auto":t),u.default.createElement(BC,{theme:g},u.default.createElement(Se,{action:E.NONE,url:a,token:n,documentServiceUrl:r,geolocationEnabled:w,geolocationRequired:T},u.default.createElement(Ke,{preferContinuityCamera:!0,debugMode:I},u.default.createElement(my,{onSuccess:i,onDocumentUploaded:o,onExitCapture:s,onUserCancel:l,documents:c,aspectRatio:f,cameraFeedMode:h,instructions:p,classNames:y,verbiage:x}))))};function bw(e,t,n){return n||(n=t,t=void 0),function(e,t){if("string"==typeof t){var n=document.querySelector(t);if(!n)throw new Error("targetElement ".concat(t," not found"));t=n}else t||(t=document.createElement("div"),document.body.append(t));var a=c.createRoot(t);if(a.render(u.default.createElement(W,null,e)),"remove"in t){var r=t.remove;t.remove=function(){try{a.unmount(),r()}catch(e){}}}return t}(u.default.createElement(e,v({},n)),t)}qp.use(lp).use(ie).init({resources:Hp,detection:{caches:[]},fallbackLng:"en",debug:!1,interpolation:{escapeValue:!1}});var xw=function(e,t){return bw(_C,e,t)},Cw=function(e,t){return bw(UC,e,t)},ww=function(e,t){return bw(zC,e,t)},Ew=function(e,t){return bw(GC,e,t)},kw=function(e,t){return bw(vw,e,t)},Tw=function(e,t){return bw(tw,e,t)},Mw=function(e,t){return bw(pw,e,t)},Iw=function(e,t){return bw(mw,e,t)},Sw=function(e,t){return bw(gw,e,t)},Dw=function(e,t){return bw(yw,e,t)};globalThis.IDmissionSDK={renderIdValidation:xw,renderFaceValidation:Cw,renderIdAndFaceValidation:ww,renderCustomerIdAndBiometricsEnrollment:Ew,renderCustomerBiometricsEnrollment:kw,renderCustomerVerification:Tw,renderCustomerIdentification:Mw,renderSignatureKYC:Iw,renderVideoIdValidation:Sw,renderDocumentCapture:Dw,preloadModels:Kf,themes:PC,version:T,ready:!0};var Nw=function(){return Nw=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},Nw.apply(this,arguments)},Aw={lines:12,length:7,width:5,radius:10,scale:1,corners:1,color:"#000",fadeColor:"transparent",animation:"spinner-line-fade-default",rotate:0,direction:1,speed:1,zIndex:2e9,className:"spinner",top:"50%",left:"50%",shadow:"0 0 1px transparent",position:"absolute"},Lw=function(){function e(e){void 0===e&&(e={}),this.opts=Nw(Nw({},Aw),e)}return e.prototype.spin=function(e){return this.stop(),this.el=document.createElement("div"),this.el.className=this.opts.className,this.el.setAttribute("role","progressbar"),Rw(this.el,{position:this.opts.position,width:0,zIndex:this.opts.zIndex,left:this.opts.left,top:this.opts.top,transform:"scale("+this.opts.scale+")"}),e&&e.insertBefore(this.el,e.firstChild||null),function(e,t){var n=Math.round(t.corners*t.width*500)/1e3+"px",a="none";!0===t.shadow?a="0 2px 4px #000":"string"==typeof t.shadow&&(a=t.shadow);for(var r=function(e){for(var t=/^\s*([a-zA-Z]+\s+)?(-?\d+(\.\d+)?)([a-zA-Z]*)\s+(-?\d+(\.\d+)?)([a-zA-Z]*)(.*)$/,n=[],a=0,r=e.split(",");a<r.length;a++){var i=r[a].match(t);if(null!==i){var o=+i[2],s=+i[5],l=i[4],u=i[7];0!==o||l||(l=u),0!==s||u||(u=l),l===u&&n.push({prefix:i[1]||"",x:o,y:s,xUnits:l,yUnits:u,end:i[8]})}}return n}(a),i=0;i<t.lines;i++){var o=~~(360/t.lines*i+t.rotate),s=Rw(document.createElement("div"),{position:"absolute",top:-t.width/2+"px",width:t.length+t.width+"px",height:t.width+"px",background:Ow(t.fadeColor,i),borderRadius:n,transformOrigin:"left",transform:"rotate("+o+"deg) translateX("+t.radius+"px)"}),l=i*t.direction/t.lines/t.speed;l-=1/t.speed;var u=Rw(document.createElement("div"),{width:"100%",height:"100%",background:Ow(t.color,i),borderRadius:n,boxShadow:Fw(r,o),animation:1/t.speed+"s linear "+l+"s infinite "+t.animation});s.appendChild(u),e.appendChild(s)}}(this.el,this.opts),this},e.prototype.stop=function(){return this.el&&("undefined"!=typeof requestAnimationFrame?cancelAnimationFrame(this.animateId):clearTimeout(this.animateId),this.el.parentNode&&this.el.parentNode.removeChild(this.el),this.el=void 0),this},e}();function Rw(e,t){for(var n in t)e.style[n]=t[n];return e}function Ow(e,t){return"string"==typeof e?e:e[t%e.length]}function Fw(e,t){for(var n=[],a=0,r=e;a<r.length;a++){var i=r[a],o=jw(i.x,i.y,t);n.push(i.prefix+o[0]+i.xUnits+" "+o[1]+i.yUnits+i.end)}return n.join(", ")}function jw(e,t,n){var a=n*Math.PI/180,r=Math.sin(a),i=Math.cos(a);return[Math.round(1e3*(e*i+t*r))/1e3,Math.round(1e3*(-e*r+t*i))/1e3]}var Pw=[];function Bw(e){if(void 0!==e){if(e.classList.contains("ladda-button")||e.classList.add("ladda-button"),e.hasAttribute("data-style")||e.setAttribute("data-style","expand-right"),!e.querySelector(".ladda-label")){var t=document.createElement("span");t.className="ladda-label",function(e,t){var n=document.createRange();n.selectNodeContents(e),n.surroundContents(t),e.appendChild(t)}(e,t)}var n,a,r=e.querySelector(".ladda-spinner");r||((r=document.createElement("span")).className="ladda-spinner"),e.appendChild(r);var i={start:function(){return a||(a=function(e){var t,n,a=e.offsetHeight;0===a&&(a=parseFloat(window.getComputedStyle(e).height));a>32&&(a*=.8);e.hasAttribute("data-spinner-size")&&(a=parseInt(e.getAttribute("data-spinner-size"),10));e.hasAttribute("data-spinner-color")&&(t=e.getAttribute("data-spinner-color"));e.hasAttribute("data-spinner-lines")&&(n=parseInt(e.getAttribute("data-spinner-lines"),10));var r=.2*a;return new Lw({color:t||"#fff",lines:n||12,radius:r,length:.6*r,width:r<7?2:3,animation:"ladda-spinner-line-fade",zIndex:"auto",top:"auto",left:"auto",className:""})}(e)),e.disabled=!0,e.setAttribute("data-loading",""),clearTimeout(n),a.spin(r),this.setProgress(0),this},startAfter:function(e){return clearTimeout(n),n=setTimeout((function(){i.start()}),e),this},stop:function(){return i.isLoading()&&(e.disabled=!1,e.removeAttribute("data-loading")),clearTimeout(n),a&&(n=setTimeout((function(){a.stop()}),1e3)),this},toggle:function(){return this.isLoading()?this.stop():this.start()},setProgress:function(t){t=Math.max(Math.min(t,1),0);var n=e.querySelector(".ladda-progress");0===t&&n&&n.parentNode?n.parentNode.removeChild(n):(n||((n=document.createElement("div")).className="ladda-progress",e.appendChild(n)),n.style.width=(t||0)*e.offsetWidth+"px")},isLoading:function(){return e.hasAttribute("data-loading")},remove:function(){clearTimeout(n),e.disabled=!1,e.removeAttribute("data-loading"),a&&(a.stop(),a=null),Pw.splice(Pw.indexOf(i),1)}};return Pw.push(i),i}console.warn("Ladda button target must be defined.")}function _w(e,t){if("function"==typeof e.addEventListener){var n=Bw(e),a=-1;e.addEventListener("click",(function(){var r=!0,i=function(e,t){for(;e.parentNode&&e.tagName!==t;)e=e.parentNode;return t===e.tagName?e:void 0}(e,"FORM");void 0===i||i.hasAttribute("novalidate")||"function"==typeof i.checkValidity&&(r=i.checkValidity()),r&&(n.startAfter(1),"number"==typeof t.timeout&&(clearTimeout(a),a=setTimeout(n.stop,t.timeout)),"function"==typeof t.callback&&t.callback.apply(null,[n]))}),!1)}}var Uw=Object.freeze({__proto__:null,create:Bw,bind:function(e,t){var n;if("string"==typeof e)n=document.querySelectorAll(e);else{if("object"!=typeof e)throw new Error("target must be string or object");n=[e]}t=t||{};for(var a=0;a<n.length;a++)_w(n[a],t)},stopAll:function(){for(var e=0,t=Pw.length;e<t;e++)Pw[e].stop()}});e.CapturedDocumentImg=xg,e.CustomerBiometricsEnrollment=vw,e.CustomerIdAndBiometricsEnrollment=GC,e.CustomerIdentification=pw,e.CustomerVerification=tw,e.DocumentCapture=yw,e.FaceValidation=UC,e.IdAndFaceValidation=zC,e.IdValidation=_C,e.SignatureKYC=mw,e.VideoIdValidation=gw,e.preloadModels=Kf,e.renderCustomerBiometricsEnrollment=kw,e.renderCustomerIdAndBiometricsEnrollment=Ew,e.renderCustomerIdentification=Mw,e.renderCustomerVerification=Tw,e.renderDocumentCapture=Dw,e.renderFaceValidation=Cw,e.renderIdAndFaceValidation=ww,e.renderIdValidation=xw,e.renderSignatureKYC=Iw,e.renderVideoIdValidation=Sw,e.themes=PC,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-dom/client"),require("platform"),require("styled-components"),require("@tensorflow/tfjs"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","react-dom/client","platform","styled-components","@tensorflow/tfjs","react-dom"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Sdk2={},e.React,e.ReactDOM,e.platform,e.styled,e.tf,e.ReactDOM)}(this,(function(e,t,n,a,r,i,o){"use strict";function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function l(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,a.get?a:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var u=s(t),d=l(t),c=l(n),f=s(a),h=s(r),p=l(i),m=function(e,t){return m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},m(e,t)};function g(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}m(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var v=function(){return v=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},v.apply(this,arguments)};function y(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(a=Object.getOwnPropertySymbols(e);r<a.length;r++)t.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(e,a[r])&&(n[a[r]]=e[a[r]])}return n}function b(e,t,n,a){return new(n||(n=Promise))((function(r,i){function o(e){try{l(a.next(e))}catch(e){i(e)}}function s(e){try{l(a.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}l((a=a.apply(e,t||[])).next())}))}function x(e,t){var n,a,r,i,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(l){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(o=0)),o;)try{if(n=1,a&&(r=2&s[0]?a.return:s[0]?a.throw||((r=a.return)&&r.call(a),0):a.next)&&!(r=r.call(a,s[1])).done)return r;switch(a=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,a=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],a=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}function C(e,t,n){if(n||2===arguments.length)for(var a,r=0,i=t.length;r<i;r++)!a&&r in t||(a||(a=Array.prototype.slice.call(t,0,r)),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}function w(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var E,k,T="1.0.310";function M(){return"undefined"!=typeof window&&void 0!==window.platform?window.platform:f.default}function I(e){return b(this,void 0,void 0,(function(){return x(this,(function(t){return[2,e.replace(/^data:image\/(png|jpeg);base64,/,"")]}))}))}function S(e){return e.replace(/^data:.*;base64,/,"")}function D(e){var t,n;return null!==(n=null===(t=e.match(/^(data:.*;base64),/))||void 0===t?void 0:t[1])&&void 0!==n?n:""}!function(e){e.NONE="NONE",e.ENROLL="ENROLL",e.IDENTIFY="IDENTIFY",e.VALIDATE="VALIDATE",e.VERIFY="VERIFY"}(E||(E={})),function(e){e.READY="READY",e.SUBMITTING="SUBMITTING",e.SUBMITTED="SUBMITTED",e.FAILED="FAILED"}(k||(k={}));var N={prod:"https://api.idmission.com",demo:"https://apidemo.idmission.com"};function A(e){var t=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),n=decodeURIComponent(window.atob(t).split("").map((function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)})).join(""));return JSON.parse(n)}function L(e,t){if(t)switch(A(t).iss){case"https://auth.idmission.com/auth/realms/identity":return N.prod;case"https://demoauth.idmission.com/auth/realms/identity":return N.demo}var n=N[e];if(!n)throw new Error("unrecognized SubmissionEnvironment ".concat(e));return n}function R(e){var t={"Content-Type":"application/json",Origin:"*"};return e&&(t.Authorization="Bearer ".concat(e)),t}function O(e,t){var n,a,r=t.geolocationResult,i={selfie:t.selfieCaptureAttempts,front:t.idFrontCaptureAttempts,back:t.idBackCaptureAttempts,isRealIDCheckRequired:"false",sdkVersion:"WebSDK_".concat(T),Resolution:"undefined"!=typeof window?"".concat(window.innerWidth," x ").concat(window.innerHeight):"unknown"},o=M();o&&(i.os=null===(n=o.os)||void 0===n?void 0:n.family,i.osVersion=null===(a=o.os)||void 0===a?void 0:a.version,i.browserVersion="".concat(o.name," ").concat(o.version)),r&&(i.GeoLocation=JSON.stringify(r)),e.additionalData.metadata=JSON.stringify(i)}function F(e){return new Promise((function(t){var n=new FileReader;n.onloadend=function(){t(S(n.result))},fetch(e).then((function(e){return e.blob()})).then((function(e){return n.readAsDataURL(e)}))}))}var j,P=h.default.div(j||(j=w(["\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(e){var t;return!1===e.theme.isFullscreen?"":"\n position: fixed;\n top: 0;\n left: 0;\n width: var(--app-width);\n height: calc(\n var(--app-height) - ".concat(null!==(t=e.$heightOffset)&&void 0!==t?t:0,"px\n );\n overflow-x: hidden;\n overflow-y: auto;\n ")}),(function(e){return e.theme.fontFamily?"font-family: ".concat(e.theme.fontFamily,";"):""})),B=t.forwardRef((function(e,n){var a=e.children,r=e.className,i=e.heightOffset,o=void 0===i?0:i,s=e.style,l=e.onClick,d=t.useState(!1),c=d[0],f=d[1];return t.useEffect((function(){if("undefined"!=typeof window){f(!1);var e=function(){var e=document.documentElement;e.style.setProperty("--app-width","".concat(window.innerWidth,"px")),e.style.setProperty("--app-height","".concat(window.innerHeight,"px"))};return window.addEventListener("resize",e),e(),f(!0),function(){window.removeEventListener("resize",e)}}}),[]),u.default.createElement(P,{ref:n,style:s,onClick:l,className:r,$heightOffset:o},c&&a)}));B.displayName="PageContainer";var _,U,z,G,W=h.default(B)(_||(_=w(["\n background: ",";\n ","\n z-index: 10000;\n"],["\n background: ",";\n ","\n z-index: 10000;\n"])),(function(e){return e.theme.background?"".concat(e.theme.background):"white"}),(function(e){return e.theme.textColor?"color: ".concat(e.theme.textColor,";"):""})),$=h.default.div(U||(U=w(["\n text-align: ",";\n display: flex;\n flex-direction: column;\n flex-wrap: nowrap;\n max-height: var(--app-height);\n height: 100%;\n ","\n"],["\n text-align: ",";\n display: flex;\n flex-direction: column;\n flex-wrap: nowrap;\n max-height: var(--app-height);\n height: 100%;\n ","\n"])),(function(e){var t;return null!==(t=e.theme.textAlign)&&void 0!==t?t:"center"}),(function(e){return e.theme.padding?"box-sizing: border-box; padding: ".concat(e.theme.padding,";"):""})),V=h.default.div(z||(z=w(["\n position: relative;\n display: flex;\n flex-grow: 1;\n padding-bottom: 25px;\n max-width: var(--app-width);\n max-height: var(--app-height);\n overflow: hidden;\n\n & > img,\n & > svg {\n margin: 0 auto;\n width: max-content;\n max-width: 100%;\n max-height: 100%;\n aspect-ratio: initial;\n object-fit: contain;\n display: block;\n }\n"],["\n position: relative;\n display: flex;\n flex-grow: 1;\n padding-bottom: 25px;\n max-width: var(--app-width);\n max-height: var(--app-height);\n overflow: hidden;\n\n & > img,\n & > svg {\n margin: 0 auto;\n width: max-content;\n max-width: 100%;\n max-height: 100%;\n aspect-ratio: initial;\n object-fit: contain;\n display: block;\n }\n"]))),q=h.default.div(G||(G=w(["\n display: flex;\n margin: auto;\n\n & > div {\n max-height: calc(100vh - 320px);\n\n & > img {\n width: 100%;\n max-height: 100%;\n height: auto;\n object-fit: contain;\n }\n }\n"],["\n display: flex;\n margin: auto;\n\n & > div {\n max-height: calc(100vh - 320px);\n\n & > img {\n width: 100%;\n max-height: 100%;\n height: auto;\n object-fit: contain;\n }\n }\n"])));"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function H(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Y(e,t){return e(t={exports:{}},t.exports),t.exports}const Z={};function Q(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];"string"==typeof t[0]&&Z[t[0]]||("string"==typeof t[0]&&(Z[t[0]]=new Date),function(){if(console&&console.warn){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];"string"==typeof t[0]&&(t[0]=`react-i18next:: ${t[0]}`),console.warn(...t)}}(...t))}const X=(e,t)=>()=>{if(e.isInitialized)t();else{const n=()=>{setTimeout((()=>{e.off("initialized",n)}),0),t()};e.on("initialized",n)}};function K(e,t,n){e.loadNamespaces(t,X(e,n))}function J(e,t,n,a){"string"==typeof n&&(n=[n]),n.forEach((t=>{e.options.ns.indexOf(t)<0&&e.options.ns.push(t)})),e.loadLanguages(t,X(e,a))}const ee=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,te={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},ne=e=>te[e];let ae,re={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:e=>e.replace(ee,ne)};const ie={type:"3rdParty",init(e){!function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};re={...re,...e}}(e.options.react),function(e){ae=e}(e)}},oe=t.createContext();class se{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach((e=>{this.usedNamespaces[e]||(this.usedNamespaces[e]=!0)}))}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const le=(e,n)=>{const a=t.useRef();return t.useEffect((()=>{a.current=n?a.current:e}),[e,n]),a.current};function ue(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{i18n:a}=n,{i18n:r,defaultNS:i}=t.useContext(oe)||{},o=a||r||ae;if(o&&!o.reportNamespaces&&(o.reportNamespaces=new se),!o){Q("You will need to pass in an i18next instance by using initReactI18next");const e=(e,t)=>"string"==typeof t?t:t&&"object"==typeof t&&"string"==typeof t.defaultValue?t.defaultValue:Array.isArray(e)?e[e.length-1]:e,t=[e,{},!1];return t.t=e,t.i18n={},t.ready=!1,t}o.options.react&&void 0!==o.options.react.wait&&Q("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const s={...re,...o.options.react,...n},{useSuspense:l,keyPrefix:u}=s;let d=e||i||o.options&&o.options.defaultNS;d="string"==typeof d?[d]:d||["translation"],o.reportNamespaces.addUsedNamespaces&&o.reportNamespaces.addUsedNamespaces(d);const c=(o.isInitialized||o.initializedStoreOnce)&&d.every((e=>function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t.languages&&t.languages.length?void 0!==t.options.ignoreJSONStructure?t.hasLoadedNamespace(e,{lng:n.lng,precheck:(t,a)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!a(t.isLanguageChangingTo,e))return!1}}):function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const a=t.languages[0],r=!!t.options&&t.options.fallbackLng,i=t.languages[t.languages.length-1];if("cimode"===a.toLowerCase())return!0;const o=(e,n)=>{const a=t.services.backendConnector.state[`${e}|${n}`];return-1===a||2===a};return!(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!o(t.isLanguageChangingTo,e)||!t.hasResourceBundle(a,e)&&t.services.backendConnector.backend&&(!t.options.resources||t.options.partialBundledLanguages)&&(!o(a,e)||r&&!o(i,e)))}(e,t,n):(Q("i18n.languages were undefined or empty",t.languages),!0)}(e,o,s)));function f(){return o.getFixedT(n.lng||null,"fallback"===s.nsMode?d:d[0],u)}const[h,p]=t.useState(f);let m=d.join();n.lng&&(m=`${n.lng}${m}`);const g=le(m),v=t.useRef(!0);t.useEffect((()=>{const{bindI18n:e,bindI18nStore:t}=s;function a(){v.current&&p(f)}return v.current=!0,c||l||(n.lng?J(o,n.lng,d,(()=>{v.current&&p(f)})):K(o,d,(()=>{v.current&&p(f)}))),c&&g&&g!==m&&v.current&&p(f),e&&o&&o.on(e,a),t&&o&&o.store.on(t,a),()=>{v.current=!1,e&&o&&e.split(" ").forEach((e=>o.off(e,a))),t&&o&&t.split(" ").forEach((e=>o.store.off(e,a)))}}),[o,m]);const y=t.useRef(!0);t.useEffect((()=>{v.current&&!y.current&&p(f),y.current=!1}),[o,u]);const b=[h,o,c];if(b.t=h,b.i18n=o,b.ready=c,c)return b;if(!c&&!l)return b;throw new Promise((e=>{n.lng?J(o,n.lng,d,(()=>e())):K(o,d,(()=>e()))}))}var de,ce=function(e){var n=e.children,a=e.className,r=e.colors,i=void 0===r?{}:r,o=e.disabled,s=e.finished,l=e.onClick,d=e.style,c=e.variant,f=void 0===c?"primary":c,h=t.useRef(null),p=t.useRef(null),m=t.useState(!1),g=m[0],v=m[1];return t.useEffect((function(){var e;return Promise.resolve().then((function(){return Qw})).then((function(t){if(h.current){p.current=t.create(h.current),p.current.start(),v(!0);var n=0;e=setInterval((function(){var e;n<.9&&(n+=.1),null===(e=p.current)||void 0===e||e.setProgress(n)}),250)}})),function(){var t;null===(t=p.current)||void 0===t||t.remove(),clearInterval(e)}}),[]),t.useEffect((function(){var e;g&&s&&(null===(e=p.current)||void 0===e||e.stop())}),[s,g]),u.default.createElement(fe,{className:"ladda-button ".concat(a),"data-style":"expand-right",disabled:o,ref:h,onClick:l,$backgroundColor:i.backgroundColor,$textColor:i.textColor,$disabledBackgroundColor:i.loadingBackgroundColor,$disabledTextColor:i.loadingTextColor,$variant:f,style:d},u.default.createElement("span",{className:"ladda-label"},n))},fe=h.default.button(de||(de=w(["\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 @keyframes ladda-spinner-line-fade {\n 0%,\n 100% {\n opacity: 0.22;\n }\n 1% {\n opacity: 1;\n }\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 @keyframes ladda-spinner-line-fade {\n 0%,\n 100% {\n opacity: 0.22;\n }\n 1% {\n opacity: 1;\n }\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(e){var t,n,a,r,i,o,s,l,u,d,c,f,h,p,m,g,v,y,b,x;return"bootstrap"===(null===(t=e.theme.buttons)||void 0===t?void 0:t.style)&&"\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(null!==(o=null!==(n=e.$textColor)&&void 0!==n?n:null===(i=null===(a=e.theme.buttons)||void 0===a?void 0:a[null!==(r=e.$variant)&&void 0!==r?r:"primary"])||void 0===i?void 0:i.textColor)&&void 0!==o?o:"#fff",";\n --bs-btn-bg: ").concat(null!==(c=null!==(s=e.$backgroundColor)&&void 0!==s?s:null===(d=null===(l=e.theme.buttons)||void 0===l?void 0:l[null!==(u=e.$variant)&&void 0!==u?u:"primary"])||void 0===d?void 0:d.backgroundColor)&&void 0!==c?c:"#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(null!==(m=null!==(f=e.$disabledTextColor)&&void 0!==f?f:null===(p=null===(h=e.theme.buttons)||void 0===h?void 0:h.loading)||void 0===p?void 0:p.textColor)&&void 0!==m?m:"#fff",";\n --bs-btn-disabled-bg: ").concat(null!==(b=null!==(g=e.$disabledBackgroundColor)&&void 0!==g?g:null===(y=null===(v=e.theme.buttons)||void 0===v?void 0:v.loading)||void 0===y?void 0:y.backgroundColor)&&void 0!==b?b:"gray",";\n --bs-btn-disabled-border-color: ").concat(null!==(x=e.$disabledBackgroundColor)&&void 0!==x?x:"#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 ")})),he=function(e){var n=e.accessBlockedImageUrl,a=ue().t,r=t.useContext(Ie).retryLocationAccess;return u.default.createElement(W,null,u.default.createElement("div",{style:{display:"flex",height:"100%"}},u.default.createElement($,{style:{maxWidth:500,height:"auto",margin:"auto"}},u.default.createElement(V,{style:{flexGrow:0}},u.default.createElement("img",{src:n,alt:""})),u.default.createElement("h3",null,a("Your location access is disabled")),u.default.createElement("p",{style:{lineHeight:1.5,marginBottom:50}},a("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.")),u.default.createElement(ce,{variant:"primary",onClick:r,style:{width:200,marginLeft:"auto",marginRight:"auto"},finished:!0},a("Retry")))))},pe=function(e){function t(t){var n=e.call(this,t.statusMessage)||this;return n.status=t,n}return g(t,e),t}(Error),me=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return g(t,e),t}(Error),ge=function(e){function t(t,n){var a=e.call(this,t.message)||this;return a.err=t,a.host=n,a}return g(t,e),t}(Error),ve=function(e){var t=e.error;return u.default.createElement(W,null,u.default.createElement($,{style:{justifyContent:"center"}},t instanceof me?u.default.createElement(be,{error:t,onRetry:e.onRetry}):u.default.createElement(ye,{error:t})))},ye=function(e){var t=e.error,n=(0,ue().t)("We're sorry, an unexpected error has occurred.");return u.default.createElement(u.default.Fragment,null,u.default.createElement("h3",{style:{marginBottom:8}},n),t.status.statusCode&&u.default.createElement("p",{style:{marginBottom:0}},u.default.createElement("code",null,"Status: ",t.status.statusCode)),u.default.createElement("p",{style:{marginBottom:0}},"Message: ",u.default.createElement("code",null,t.message)),t.status.errorData&&u.default.createElement("p",{style:{marginBottom:0}},"Data: ",u.default.createElement("code",null,t.status.errorData)))},be=function(e){var t=e.onRetry,n=ue().t,a=n("Network unreachable"),r=n("We're having trouble reaching our services, please check your connection and try again."),i=n("Retry");return u.default.createElement(u.default.Fragment,null,u.default.createElement("h3",{style:{marginBottom:8}},a),u.default.createElement("p",{style:{marginBottom:0}},r),t&&u.default.createElement("div",{style:{marginTop:32}},u.default.createElement(ce,{variant:"warning",finished:!0,onClick:t},i)))},xe=function(){return u.default.createElement(W,null,u.default.createElement($,{style:{justifyContent:"center"}},u.default.createElement("h3",{style:{marginBottom:8}},"IDmission WebSDK failed to load"),u.default.createElement("p",{style:{marginBottom:0}},"Required property ",u.default.createElement("code",null,"submissionToken")," is missing."),u.default.createElement("p",{style:{lineHeight:"1.5rem"}},"Please refer to the"," ",u.default.createElement("a",{href:"https://www.npmjs.com/package/idmission-web-sdk#getting-started",target:"_blank",rel:"noreferrer"},"Getting Started")," ","section of the documentation for information on how to use your credentials to generate a valid"," ",u.default.createElement("a",{href:"https://jwt.io",target:"_blank",rel:"noreferrer"},"JSON Web Token")," ","for your IDmission account. Every usage of the IDmission WebSDK must be authorized with a valid JWT from IDmission's servers.")))},Ce=function(){return u.default.createElement(W,null,u.default.createElement($,{style:{justifyContent:"center"}},u.default.createElement("h3",{style:{marginBottom:8}},"IDmission WebSDK failed to load"),u.default.createElement("p",{style:{marginBottom:0}},"Required property ",u.default.createElement("code",null,"submissionToken")," is invalid."),u.default.createElement("p",null,"JSON Web Tokens consist of three parts separated by dots (",u.default.createElement("code",null,"."),"), which are:"),u.default.createElement("div",{style:{display:"flex"}},u.default.createElement("ul",{style:{display:"inline",margin:"0 auto"}},u.default.createElement("li",null,"Header"),u.default.createElement("li",null,"Payload"),u.default.createElement("li",null,"Signature"))),u.default.createElement("p",null,"Therefore, a JWT typically looks like the following:"," ",u.default.createElement("code",null,"xxxxx.yyyyy.zzzzz")),u.default.createElement("p",{style:{lineHeight:"1.5rem"}},"Please refer to the"," ",u.default.createElement("a",{href:"https://www.npmjs.com/package/idmission-web-sdk#getting-started",target:"_blank",rel:"noreferrer"},"Getting Started")," ","section of the documentation for information on how to use your credentials to generate a valid"," ",u.default.createElement("a",{href:"https://jwt.io",target:"_blank",rel:"noreferrer"},"JSON Web Token")," ","for your IDmission account. Every usage of the IDmission WebSDK must be authorized with a valid JWT from IDmission's servers.")))},we=function(){return u.default.createElement(W,null,u.default.createElement($,{style:{justifyContent:"center"}},u.default.createElement("h3",{style:{marginBottom:8}},"IDmission WebSDK failed to load"),u.default.createElement("p",{style:{marginBottom:0}},"Required property ",u.default.createElement("code",null,"submissionToken")," could not be validated."),u.default.createElement("p",{style:{marginBottom:0,lineHeight:"1.5rem"}},"The signature of your token could not be validated. Check your token generation routine, it's possible that some malicious behavior is at play. This can also happen if you attempt to manually modify your token before passing it to the IDmission WebSDK."),u.default.createElement("p",{style:{marginBottom:0,lineHeight:"1.5rem"}},"If you believe you have reached this page in error, please contact us at ",u.default.createElement("a",{href:"mailto:support@idmission.com"},"support@idmission.com"),".")))},Ee=function(){return u.default.createElement(W,null,u.default.createElement($,{style:{justifyContent:"center"}},u.default.createElement("h3",{style:{marginBottom:8}},"IDmission WebSDK failed to load"),u.default.createElement("p",{style:{marginBottom:0}},"Required property ",u.default.createElement("code",null,"submissionToken")," is expired."),u.default.createElement("p",{style:{marginBottom:0,lineHeight:"1.5rem"}},"Ensure you are generating a fresh token for each request to the IDmission WebSDK."),u.default.createElement("p",{style:{lineHeight:"1.5rem"}},"Please refer to the"," ",u.default.createElement("a",{href:"https://www.npmjs.com/package/idmission-web-sdk#getting-started",target:"_blank",rel:"noreferrer"},"Getting Started")," ","section of the documentation for information on how to use your credentials to generate a valid"," ",u.default.createElement("a",{href:"https://jwt.io",target:"_blank",rel:"noreferrer"},"JSON Web Token")," ","for your IDmission account. Every usage of the IDmission WebSDK must be authorized with a valid JWT from IDmission's servers.")))},ke=function(e){var t=e.error;return u.default.createElement(W,null,u.default.createElement($,{style:{justifyContent:"center"}},u.default.createElement("h3",{style:{marginBottom:8}},"IDmission WebSDK failed to load"),u.default.createElement("p",{style:{marginBottom:0}},(null==t?void 0:t.host)?u.default.createElement(u.default.Fragment,null,"Failed to reach ",u.default.createElement("code",null,t.host),"."):u.default.createElement(u.default.Fragment,null,"Failed to obtain public key for ",u.default.createElement("code",null,"submissionToken"),".")),(null==t?void 0:t.message)&&u.default.createElement("p",{style:{marginBottom:0,lineHeight:"1.5rem"}},u.default.createElement("code",null,t.message)),u.default.createElement("p",{style:{marginBottom:0,lineHeight:"1.5rem"}},"Please ensure that IDmission's servers can be reached. If you believe you have reached this page in error, please contact us at"," ",u.default.createElement("a",{href:"mailto:support@idmission.com"},"support@idmission.com"),".")))},Te=function(){return u.default.createElement(W,null,u.default.createElement($,{style:{justifyContent:"center"}},u.default.createElement("h3",{style:{marginBottom:8}},"IDmission WebSDK failed to load"),u.default.createElement("p",{style:{marginBottom:0}},"Required property ",u.default.createElement("code",null,"submissionToken")," comes from an unrecognized issuer."),u.default.createElement("p",{style:{marginBottom:0,lineHeight:"1.5rem"}},"Ensure you are generating a fresh token for each request to the IDmission WebSDK."),u.default.createElement("p",{style:{lineHeight:"1.5rem"}},"Please refer to the"," ",u.default.createElement("a",{href:"https://www.npmjs.com/package/idmission-web-sdk#getting-started",target:"_blank",rel:"noreferrer"},"Getting Started")," ","section of the documentation for information on how to use your credentials to generate a valid"," ",u.default.createElement("a",{href:"https://jwt.io",target:"_blank",rel:"noreferrer"},"JSON Web Token")," ","for your IDmission account. Every usage of the IDmission WebSDK must be authorized with a valid JWT from IDmission's servers.")))},Me=["https://demoauth.idmission.com/","https://uatauth.idmission.com/","https://auth.idmission.com/"],Ie=t.createContext({submit:function(){return b(void 0,void 0,void 0,(function(){return x(this,(function(e){return[2,null]}))}))},submissionStatus:k.READY,submissionRequest:null,submissionResponse:null,submissionError:null,submissionEnvironment:"prod",idFrontImage:null,idBackImage:null,passportImage:null,selfieImage:null,signatureData:null,signatureVideoUrl:null,idCaptureVideoUrl:null,idCaptureVideoIdFrontImage:null,idCaptureVideoIdBackImage:null,additionalDocuments:null,setIdFrontImage:function(){return null},setIdBackImage:function(){return null},setPassportImage:function(){return null},setSelfieImage:function(){return null},setSignatureData:function(){return null},setSignatureVideoUrl:function(){return null},setIdCaptureVideoUrl:function(){return null},setIdCaptureVideoIdFrontImage:function(){return null},setIdCaptureVideoIdBackImage:function(){return null},setAdditionalDocuments:function(){return null},uploadDocument:Promise.resolve,logIdFrontCaptureAttempt:function(){return null},logIdBackCaptureAttempt:function(){return null},logSelfieCaptureAttempt:function(){return null},livenessCheckRequest:null,checkLiveness:function(){return b(void 0,void 0,void 0,(function(){return x(this,(function(e){throw new Error("checkLiveness is not implemented")}))}))},retryLocationAccess:function(){return null}}),Se=function(e){var n=e.action,a=e.children,r=e.url,i=e.environment,o=void 0===i?"prod":i,s=e.token,l=e.companyId,d=e.enrollmentId,c=e.personalData,f=e.cardData,h=e.bypassAgeValidation,p=void 0!==h&&h,m=e.bypassNameMatching,g=void 0===m||m,y=e.needImmediateResponse,w=void 0!==y&&y,T=e.manualReviewRequired,M=void 0!==T&&T,D=e.idBackImageRequired,N=void 0===D||D,j=e.idImageResolutionCheck,P=void 0===j||j,B=e.verifyIdWithExternalDatabases,_=void 0!==B&&B,U=e.deduplicationEnabled,z=void 0!==U&&U,G=e.deduplicationSynchronous,W=void 0!==G&&G,$=e.geolocationEnabled,V=void 0===$||$,q=e.geolocationRequired,H=void 0!==q&&q,Y=e.webhooksEnabled,Z=void 0!==Y&&Y,Q=e.webhooksClientTraceId,X=e.webhooksStripSpecialCharacters,K=void 0===X||X,J=e.webhooksSendInputImages,ee=void 0!==J&&J,te=e.webhooksSendProcessedImages,ne=void 0!==te&&te,ae=e.webhooksFireOnReview,re=void 0!==ae&&ae,ie=e.precapturedDocuments,oe=e.documentServiceUrl,se=void 0===oe?"https://portal-api-dev.idmission.com/files/":oe,le=e.onSubmit,ue=e.onBeforeSubmit,de=e.onBeforeLivenessCheck,ce=e.onResponseReceived,fe=e.onRequestFailure,ye=t.useState(k.READY),be=ye[0],Se=ye[1],Ae=t.useState(null),Le=Ae[0],Re=Ae[1],Oe=t.useState(null),Fe=Oe[0],je=Oe[1],Pe=t.useState(null),Be=Pe[0],_e=Pe[1],Ue=t.useState(null),ze=Ue[0],Ge=Ue[1],We=t.useState(null),$e=We[0],Ve=We[1],qe=t.useState(null),He=qe[0],Ye=qe[1],Ze=t.useState(null),Qe=Ze[0],Xe=Ze[1],Ke=t.useState(null),Je=Ke[0],et=Ke[1],tt=t.useState(null),nt=tt[0],at=tt[1],rt=t.useState(null),it=rt[0],ot=rt[1],st=t.useState(null),lt=st[0],ut=st[1],dt=t.useState(null),ct=dt[0],ft=dt[1],ht=t.useState(null),pt=ht[0],mt=ht[1],gt=t.useState(null),vt=gt[0],yt=gt[1],bt=t.useState(null),xt=bt[0],Ct=bt[1],wt=t.useState(null),Et=wt[0],kt=wt[1],Tt=t.useState(0),Mt=Tt[0],It=Tt[1],St=t.useState(!1),Dt=St[0],Nt=St[1],At=t.useState([]),Lt=At[0],Rt=At[1],Ot=t.useState([]),Ft=Ot[0],jt=Ot[1],Pt=t.useState([]),Bt=Pt[0],_t=Pt[1],Ut=t.useCallback((function(e){Rt((function(t){return C(C([],t,!0),[e],!1)}))}),[]),zt=t.useCallback((function(e){jt((function(t){return C(C([],t,!0),[e],!1)}))}),[]),Gt=t.useCallback((function(e){_t((function(t){return C(C([],t,!0),[e],!1)}))}),[]);t.useEffect((function(){(null==ie?void 0:ie.selfie)&&at(S(ie.selfie.imageData))}),[null==ie?void 0:ie.selfie]);var Wt=t.useCallback((function(){return b(void 0,void 0,void 0,(function(){var e,t,a,r,i,o;return x(this,(function(s){switch(s.label){case 0:return e={securityData:{userName:"",password:"",merchantId:0},customerData:{idData:{idType:"NSP",idCountry:"NSP",idState:""}},additionalData:{uniqueRequestId:(new Date).getTime().toString(),manualReviewRequired:M?"Y":"N",bypassAgeValidation:p?"Y":"N",bypassNameMatching:g?"Y":"N",postDataAPIRequired:Z?"Y":"N",postDataOnReviewRequired:re?"Y":"N",sendInputImagesInPost:ee?"Y":"N",sendProcessedImagesInPost:ne?"Y":"N",needImmediateResponse:w?"Y":"N",deDuplicationRequired:z?"Y":"N",deduplicationSynchronous:W?"Y":"N",verifyDataWithHost:_?"Y":"N",idBackImageRequired:N?"Y":"N",stripSpecialCharacters:K?"Y":"N",idImageResolutionCheck:P?"Y":"N"}},He&&(e.customerData.idData.idImageFront=He),Qe&&(e.customerData.idData.idImageBack=Qe),Je&&(e.customerData.idData.idImageFront=Je),nt&&(n===E.IDENTIFY&&(e.biometricData={selfie:nt}),e.customerData.biometricData={selfie:nt}),l&&(e.employee={companyId:l}),c&&(e.customerData.personalData=c),f&&(e.customerData.cardData=f),d&&((i=e.customerData).personalData||(i.personalData={}),e.customerData.personalData.uniqueNumber=d),Q&&(e.additionalData.clientTraceId=Q),it?(e.customerData.signatureData={signatureImage:JSON.stringify(it)},lt?(t=e.customerData.signatureData,[4,F(lt)]):[3,2]):[3,2];case 1:t.signatureVideo=s.sent(),s.label=2;case 2:return xt&&(e.customerData.additionalDocuments=xt.map((function(t){return v(v({},t),{additionalDocument:JSON.stringify(v(v({},t.additionalDocument),{uniqueId:e.additionalData.uniqueRequestId}))})}))),ct?((o=e.customerData).biometricData||(o.biometricData={}),a=e.customerData.biometricData,[4,F(ct)]):[3,4];case 3:a.videoData=s.sent(),s.label=4;case 4:return pt&&(e.customerData.idData.videoIdImageFront=S(pt)),vt&&(e.customerData.idData.videoIdImageBack=S(vt)),O(e,{selfieCaptureAttempts:Bt,idFrontCaptureAttempts:Lt,idBackCaptureAttempts:Ft,geolocationResult:Et}),ue?[4,ue(e)]:[3,6];case 5:(r=s.sent())&&(e=r),s.label=6;case 6:return[2,e]}}))}))}),[n,xt,p,g,f,l,z,W,d,Et,Ft,Qe,N,vt,pt,ct,Lt,He,P,M,w,ue,Je,c,Bt,nt,it,lt,_,Q,Z,re,ee,ne,K]),$t=t.useCallback((function(){return b(void 0,void 0,void 0,(function(){var e,t,a,i,l,u,d,c,f,h;return x(this,(function(p){switch(p.label){case 0:if(n===E.NONE)return e={status:{statusCode:"000"},resultData:{}},Se(k.SUBMITTED),je(e),[2,e];Se(k.SUBMITTING),p.label=1;case 1:return p.trys.push([1,7,,8]),[4,Wt()];case 2:return t=p.sent(),a=r||L(o,s),i=function(e,t,n,a){var r=a?"v4":"v3";switch(e){case E.ENROLL:return"/".concat(r,t?"/customer/enroll":"/customer/enroll-biometrics");case E.IDENTIFY:return"/".concat(r,"/customer/identify");case E.VALIDATE:return"/".concat(r,n?"/customer/validate-id-match-face":"/customer/validate-id");case E.VERIFY:return"/".concat(r,"/customer/verify");default:throw new Error("unrecognized SubmissionAction ".concat(e))}}(n,!!(He||Qe||Je),!!nt,!!s),[4,fetch(a+i,{method:"POST",headers:R(s),body:JSON.stringify(t)}).catch((function(e){throw new me(e.message)}))];case 3:return(l=p.sent())&&l.ok?[3,5]:[4,null==l?void 0:l.text()];case 4:if(!(u=p.sent())||"Load failed"===u)throw new me(u);throw new pe({statusCode:null!==(h=null==l?void 0:l.statusText)&&void 0!==h?h:"???",statusMessage:u});case 5:return[4,l.json()];case 6:if("000"!==(d=p.sent()).status.statusCode)throw new pe(d.status);return Re(t),je(d),Se(k.SUBMITTED),null==ce||ce(d,t),[2,d];case 7:throw c=p.sent(),f=c,Se(k.FAILED),_e(c instanceof pe||c instanceof me?c:"Load failed"===f.message?new me:new pe({statusCode:"",statusMessage:f.message})),Ge((function(){return["VERIFY","IDENTIFY"].includes(n)?function(){return null}:$t})),null==fe||fe(f),f;case 8:return[2]}}))}))}),[n,Wt,o,Qe,He,fe,ce,Je,nt,s,r]),Vt=t.useCallback((function(){return b(void 0,void 0,void 0,(function(){var e;return x(this,(function(t){switch(t.label){case 0:return le?(e=le,[4,Wt()]):[3,2];case 1:return[2,e.apply(void 0,[t.sent()])];case 2:return[4,$t()];case 3:return[2,t.sent()]}}))}))}),[Wt,$t,le]),qt=t.useCallback((function(e){return b(void 0,void 0,void 0,(function(){var t,n,a,i,l,u,d,c,f,h,p,m;return x(this,(function(g){switch(g.label){case 0:return g.trys.push([0,8,,9]),h={securityData:{userName:"",password:"",merchantId:0}},p={},m={},[4,I(e)];case 1:return h.customerData=(p.biometricData=(m.selfie=g.sent(),m),p),h.additionalData={uniqueRequestId:(new Date).getTime().toString(),stripSpecialCharacters:K?"Y":"N",estimateAge:"N",predictGender:"N"},O(t=h,{selfieCaptureAttempts:Bt,idFrontCaptureAttempts:Lt,idBackCaptureAttempts:Ft,geolocationResult:Et}),Ve(t),de?[4,de(t)]:[3,3];case 2:(n=g.sent())&&(t=n),g.label=3;case 3:return a=r||L(o,s),i="/".concat(!!s?"v4":"v3","/customer/live-check"),[4,fetch(a+i,{method:"POST",headers:R(s),body:JSON.stringify(t)}).catch((function(e){throw new me(e.message)}))];case 4:return(l=g.sent()).ok?[3,6]:[4,l.text()];case 5:if(!(u=g.sent())||"Load failed"===u)throw new me(u);throw new pe({statusCode:l.statusText,statusMessage:u});case 6:return[4,l.json()];case 7:if("000"!==(d=g.sent()).status.statusCode)throw new pe(d.status);return je(d),[2,d];case 8:throw c=g.sent(),f=c,Se(k.FAILED),_e(c instanceof pe||c instanceof me?c:"Load failed"===f.message?new me:new pe({statusCode:"",statusMessage:f.message})),Ge((function(){return function(){return null}})),null==fe||fe(f),f;case 9:return[2]}}))}))}),[o,Et,Ft,Lt,de,fe,Bt,s,r,K]),Ht=t.useCallback((function(){It((function(e){return e+1}))}),[]);t.useEffect((function(){V&&(console.log("making geolocation attempt",Mt),navigator.geolocation.getCurrentPosition((function(e){kt(e),Nt(!1)}),(function(e){if(1!==e.code)throw new Error(e.message);Nt(!0)})))}),[Mt,V,H]);var Yt=t.useCallback((function(){ze&&(_e(null),Se(k.READY),ze())}),[ze]),Zt=t.useState("NOT_PARSED"),Qt=Zt[0],Xt=Zt[1],Kt=t.useState(null),Jt=Kt[0],en=Kt[1];t.useEffect((function(){"undefined"!=typeof window&&b(void 0,void 0,void 0,(function(){var e,t,n,a,r,i,o,l,u;return x(this,(function(d){switch(d.label){case 0:if(Xt("PARSING"),!s)return[2,Xt("MISSING")];try{e=A(s)}catch(e){return console.error("error parsing token",e),[2,Xt("INVALID_FORMAT")]}if(t=e.iss,!Me.some((function(e){return t.startsWith(e)})))return console.error("issuer is not allowed",t),[2,Xt("ISSUER_NOT_ALLOWED")];d.label=1;case 1:return d.trys.push([1,4,,5]),[4,fetch(t).then((function(e){return e.json()}))];case 2:return a=d.sent(),[4,Ne("-----BEGIN PUBLIC KEY-----\n".concat(a.public_key,"\n-----END PUBLIC KEY-----"))];case 3:return n=d.sent(),[3,5];case 4:return r=d.sent(),console.error("error fetching public key",r),en(new ge(r,t)),[2,Xt("PUBLIC_KEY_LOAD_FAILED")];case 5:i=!1,d.label=6;case 6:return d.trys.push([6,8,,9]),o=s.split("."),[4,window.crypto.subtle.verify({name:"RSASSA-PKCS1-v1_5"},n,De(o[1]),De(o[2]))];case 7:return d.sent(),i=!0,[3,9];case 8:return l=d.sent(),console.error("error validating token",l),[3,9];case 9:return i?(u=e.exp,Date.now()>=1e3*u?[2,Xt("EXPIRED")]:(Xt("GOOD"),[2])):[2,Xt("INVALID_SIGNATURE")]}}))}))}),[s]);var tn=t.useCallback((function(e){return new Promise((function(t,n){import("tus-js-client").then((function(a){var r=new a.Upload(e,{endpoint:se,retryDelays:[0,3e3,5e3,1e4,2e4],metadata:{filename:"My File",filetype:"image/jpeg"},headers:{Authorization:"Bearer ".concat(s)},onProgress:function(e,t){var n=(e/t*100).toFixed(2);console.log(e,t,n+"%")},onSuccess:function(){var e;console.log("Download from %s",r.url),t("urn:documentsv1:"+(null===(e=r.url.split("/files/").pop())||void 0===e?void 0:e.split("+").shift()))},onError:function(e){console.log("Failed because: "+e),n(e)}});r.findPreviousUploads().then((function(e){e.length&&r.resumeFromPreviousUpload(e[0]),r.start()}))}))}))}),[se,s]),nn={submit:Vt,submissionStatus:be,submissionRequest:Le,submissionResponse:Fe,submissionError:Be,submissionEnvironment:o,idFrontImage:He,idBackImage:Qe,passportImage:Je,selfieImage:nt,signatureData:it,signatureVideoUrl:lt,idCaptureVideoUrl:ct,idCaptureVideoIdFrontImage:pt,idCaptureVideoIdBackImage:vt,additionalDocuments:xt,setIdFrontImage:Ye,setIdBackImage:Xe,setPassportImage:et,setSelfieImage:at,setSignatureData:ot,setSignatureVideoUrl:ut,setIdCaptureVideoUrl:ft,setIdCaptureVideoIdFrontImage:mt,setIdCaptureVideoIdBackImage:yt,setAdditionalDocuments:Ct,uploadDocument:tn,logIdFrontCaptureAttempt:Ut,logIdBackCaptureAttempt:zt,logSelfieCaptureAttempt:Gt,livenessCheckRequest:$e,checkLiveness:qt,retryLocationAccess:Ht};return"MISSING"===Qt?u.default.createElement(xe,null):"INVALID_FORMAT"===Qt?u.default.createElement(Ce,null):"INVALID_SIGNATURE"===Qt?u.default.createElement(we,null):"EXPIRED"===Qt?u.default.createElement(Ee,null):"PUBLIC_KEY_LOAD_FAILED"===Qt?u.default.createElement(ke,{error:Jt}):"ISSUER_NOT_ALLOWED"===Qt?u.default.createElement(Te,null):u.default.createElement(Ie.Provider,{value:nn},H&&Dt?u.default.createElement(he,null):a,Be&&u.default.createElement(ve,{error:Be,onRetry:Yt}))};function De(e){for(var t=new ArrayBuffer(e.length),n=new Uint8Array(t),a=0,r=e.length;a<r;a++)n[a]=e.charCodeAt(a);return t}function Ne(e){if("undefined"==typeof window)throw new Error("window cannot be undefined");var t=e.substring("-----BEGIN PUBLIC KEY-----".length,e.length-"-----END PUBLIC KEY-----".length-1),n=De(window.atob(t));return window.crypto.subtle.importKey("spki",n,{name:"RSASSA-PKCS1-v1_5",hash:"SHA-256"},!0,["verify"])}function Ae(e,t,n){return e[t]?e[t][0]?e[t][0][n]:e[t][n]:"contentBoxSize"===t?e.contentRect["inlineSize"===n?"width":"height"]:void 0}function Le(e){void 0===e&&(e={});var n=e.onResize,a=t.useRef(void 0);a.current=n;var r=e.round||Math.round,i=t.useRef(),o=t.useState({width:void 0,height:void 0}),s=o[0],l=o[1],u=t.useRef(!1);t.useEffect((function(){return u.current=!1,function(){u.current=!0}}),[]);var d=t.useRef({width:void 0,height:void 0}),c=function(e,n){var a=t.useRef(null),r=t.useRef(null);r.current=n;var i=t.useRef(null);t.useEffect((function(){o()}));var o=t.useCallback((function(){var t=r.current,n=i.current||(t?t instanceof Element?t:t.current:null);a.current&&a.current.element===n&&a.current.subscriber===e||(a.current&&a.current.cleanup&&a.current.cleanup(),a.current={element:n,subscriber:e,cleanup:n?e(n):void 0})}),[e]);return t.useEffect((function(){return function(){a.current&&a.current.cleanup&&(a.current.cleanup(),a.current=null)}}),[]),t.useCallback((function(e){i.current=e,o()}),[o])}(t.useCallback((function(t){return i.current&&i.current.box===e.box&&i.current.round===r||(i.current={box:e.box,round:r,instance:new ResizeObserver((function(t){var n=t[0],i="border-box"===e.box?"borderBoxSize":"device-pixel-content-box"===e.box?"devicePixelContentBoxSize":"contentBoxSize",o=Ae(n,i,"inlineSize"),s=Ae(n,i,"blockSize"),c=o?r(o):void 0,f=s?r(s):void 0;if(d.current.width!==c||d.current.height!==f){var h={width:c,height:f};d.current.width=c,d.current.height=f,a.current?a.current(h):u.current||l(h)}}))}),i.current.instance.observe(t,{box:e.box}),function(){i.current&&i.current.instance.unobserve(t)}}),[e.box,r]),e.ref);return t.useMemo((function(){return{ref:c,width:s.width,height:s.height}}),[c,s.width,s.height])}function Re(e){return b(this,void 0,void 0,(function(){var t;return x(this,(function(n){switch(n.label){case 0:return"BarcodeDetector"in window?(t=new BarcodeDetector({formats:["pdf417"]}),console.log("this is a real native result!"),[4,t.detect(e)]):[2,[]];case 1:return[2,n.sent()]}}))}))}function Oe(e,t){return void 0===t&&(t=!1),b(this,void 0,void 0,(function(){var n,a,r,i,o,s,l,u,d;return x(this,(function(c){switch(c.label){case 0:return[4,new Promise((function(o){if(r=e.naturalWidth,i=e.naturalHeight,n=document.createElement("canvas"),!(a=n.getContext("2d")))return[];if(t){console.log("rotating!!"),n.width=i,n.height=r,a.setTransform(0,1,-1,0,n.width,0),a.drawImage(e,0,0,r,i);var s=new Image;s.width=n.width,s.height=n.height,s.onload=function(){o(s)},n.toBlob((function(e){e&&(s.src=URL.createObjectURL(e))}))}else a.drawImage(e,0,0,n.width,n.height),o(e)}))];case 1:return o=c.sent(),s=new ZXing.BitmapLuminanceSource(a,o),l=new ZXing.Common.HybridBinarizer(s),u=new ZXing.BinaryBitmap(l),d=ZXing.PDF417.PDF417Reader.decode(u,null,!1),a.clearRect(0,0,n.width,n.height),n.remove(),[2,d]}}))}))}function Fe(){return"BarcodeDetector"in window}function je(e,t){var n=this;return new Promise((function(a){var r=new Image;r.onload=function(){return b(n,void 0,void 0,(function(){var e,n,i,o;return x(this,(function(s){switch(s.label){case 0:return Fe()?[4,Re(r)]:[3,2];case 1:return n=s.sent(),console.log("native result",n,"".concat(r.width,"x").concat(r.height)),a(n.length>0?v(v({},n[0]),{Source:"native"}):null),[3,4];case 2:return e=(null!==(i=null==t?void 0:t[2])&&void 0!==i?i:0)<(null!==(o=null==t?void 0:t[3])&&void 0!==o?o:0),[4,Oe(r,e)];case 3:n=s.sent(),console.log("zxing result",n),a(n.length>0?v(v({},n[0]),{Source:"zxing"}):null),s.label=4;case 4:return[2]}}))}))},r.src=URL.createObjectURL(e)}))}function Pe(e){var t=e.width,n=e.height;return e instanceof HTMLImageElement&&(t=e.naturalWidth,n=e.naturalHeight),e instanceof HTMLVideoElement&&(t=e.videoWidth,n=e.videoHeight),[t,n]}var Be,_e=h.default.canvas(Be||(Be=w(["\n display: none;\n"],["\n display: none;\n"])));function Ue(e,t,n,a){if(e){var r=e.getContext("2d");if(r){if(!n||!a){var i=Pe(t);n||(n=i[0]),a||(a=i[1])}e.width=n,e.height=a,r.drawImage(t,0,0,n,a)}}}function ze(e){if(e){var t=e.getContext("2d");t&&t.clearRect(0,0,e.width,e.height)}}var Ge,We=["front","avant","anteriore","cameraaanvoorzijde","kamerapåframsidan","forsidekamera","kamerapåforsiden","aparatprzedni","etukamera","kameradepan","ÖnKamera","cameramặttrước","camerăfață","prednákamera","prednjakamera","előlapikamera","přednífotoaparát","μπροστινήκάμερα","переднякамера","передняякамера","преднакамера","алдыңғыкамера","מצלמה קדמית","الكاميرا الأمامية","फ़्रंटकैमरा","前置相机","前置鏡頭","前面カメラ","전면카메라","กล้องด้านหน้า"].map((function(e){return e.toLocaleLowerCase().split(" ").join("")})),$e=["back","rear","posterior","trasera","traseira","arrière","rückkamera","fotocamera(posteriore)","cameraaanachterzijde","kamerapåbaksidan","kamerapåbaksiden","bagsidekamera","aparattylny","takakamera","arkakamera","kamerabelakang","cameramặtsau","camerăspate","stražnjakamera","zadnákamera","hátoldalikamera","zadnífotoaparát","πίσωκάμερα","заднякамера","Задняякамера","заднакамера","артқыкамера","מצלמה אחורית","الكاميرا الخلفية","बैककैमरा","后置相机","後置鏡頭","背面カメラ","후면카메라","กล้องด้านหลัง"].map((function(e){return e.toLocaleLowerCase().split(" ").join("")})),Ve=["backdualwidecamera","backultrawidecamera","ultraampliaposterior","ultra-angulartraseira","ultragrandeangulartraseira","ultragrandangle","ultragranangular","ultra-weitwinkelkamera","ultra-grandangolo","ultrabredecameraaanachterzijde","ultravidvinkelkamerapåbaksidan","ultravidvinkelkameraetpåbagsiden","ultravidvinkelkamerabak","ultragenişkameraarkayüzü","ultralaajakulmainentakakamera","tylnyaparatultraszerokokątny","cameracựcrộngmặtsau","camerăcuobiectivultra‑superangularspate","ultraszéleslátószögűkamera","kameraultralebarbelakang","stražnjaultraširokakamera","zadníultraširokoúhlýfotoaparát","ultraširokouhlá","πίσωυπερευρείακάμερα","заднянадширококутнакамера","Задняясверхширокоугольнаякамера","Задна свръх широкоъгълна камера","артқыультракеңбұрыштыкамера","מצלמה אולטרה רחבה אחורית","كاميرا خلفية عريضة جدًا","बैकअल्ट्रावाइडकैमरा","后置超广角相机","後置超廣角鏡頭相機","背面超広角カメラ","후면울트라와이드카메라","กล้องด้านหลังอัลตร้าไวด์"].map((function(e){return e.toLocaleLowerCase().split(" ").join("")})),qe=function(e,t){var n=e instanceof MediaDeviceInfo?He(e):e;return("string"==typeof t?[t]:t).some((function(e){return n.includes(e)}))},He=function(e){return e.label.toLocaleLowerCase().split(" ").join("")};function Ye(){Ge&&(console.log("releasing camera access..."),Ge.release(),Ge=void 0)}var Ze,Qe=function(e){var n=void 0===e?{preferFrontFacingCamera:!1,preferContinuityCamera:!0,requestMicrophoneAccess:!1,maxVideoWidth:1920,debugMode:!1}:e,a=n.preferFrontFacingCamera,r=void 0!==a&&a,i=n.preferContinuityCamera,o=void 0===i||i,s=n.requestMicrophoneAccess,l=void 0!==s&&s,u=n.maxVideoWidth,d=n.maxFps,c=n.debugMode,f=void 0!==c&&c,h=t.useRef(null),p=t.useRef(null),m=t.useState(!1),g=m[0],v=m[1],y=t.useState(null),w=y[0],E=y[1],k=t.useState(!1),T=k[0],I=k[1],S=t.useState(!1),D=S[0],N=S[1],A=t.useState(o),L=A[0],R=A[1],O=t.useState(!1),F=O[0],j=O[1],P=t.useState(!1),B=P[0],_=P[1];t.useEffect((function(){f&&console.log("iphone continuity camera allowed changed",L),Ye(),p.current=null,I(!1)}),[f,L]);var U=t.useCallback((function(){_(!1)}),[]);t.useEffect((function(){B||(v(!1),function(e,t){return void 0===t&&(t=!1),b(this,void 0,void 0,(function(){var n,a;return x(this,(function(r){switch(r.label){case 0:return[4,navigator.mediaDevices.getUserMedia({video:{facingMode:{exact:e}},audio:t})];case 1:return n=r.sent(),[4,navigator.mediaDevices.enumerateDevices()];case 2:return a=r.sent().filter((function(e){return"videoinput"===e.kind})),n.getVideoTracks().forEach((function(e){e.enabled=!1,e.stop()})),n=null,[2,a]}}))}))}().then((function(e){var t,n,a;f&&console.log("availableCameras",e);var i=M();if(f&&console.log("platformDetails",i),F||(null==i?void 0:i.os)&&"OS X"!==i.os.family)("Android"===(null===(t=null==i?void 0:i.os)||void 0===t?void 0:t.family)||e.every((function(e){return e.label.startsWith("camera2 ")})))&&(e=e.sort((function(e,t){return e.label.toLowerCase().localeCompare(t.label.toLowerCase())})),f&&console.log("cameras have been sorted",e));else{var o=e.find((function(e){return qe(e,"iphone")}));N(!!o),o&&L&&(a=o)}r&&(a=e.find((function(e){return qe(e,We)}))),a||(a=e.find((function(e){return qe(e,"backtriplecamera")}))),a||(a=e.find((function(e){return qe(e,"backdualcamera")}))),a||(a=e.find((function(e){return qe(e,$e)&&!qe(e,Ve)}))),a||(a=e.find((function(e){return qe(e,$e)}))),!r&&"iOS"===(null===(n=null==i?void 0:i.os)||void 0===n?void 0:n.family)&&e.length>0&&(a||(a=e[1])),a||(a=e[0]),f&&console.log("selectedCamera",a),E(a)})).catch((function(e){if("NotAllowedError"!==e.name)throw console.error("camera access encountered some other error",e),e;console.error("camera access has been blocked by the user",e),_(!0)})))}),[B,L,F,r]),t.useEffect((function(){var e;if(w){var t=function(){Ye(),p.current=null,I(!1)};return(null===(e=navigator.mediaDevices)||void 0===e?void 0:e.getUserMedia)?(b(void 0,void 0,void 0,(function(){var e,t,n,a;return x(this,(function(r){switch(r.label){case 0:e={audio:l,video:{deviceId:{exact:w.deviceId},width:{ideal:u},aspectRatio:1.777777778,frameRate:{}}},d&&(e.video.frameRate={max:d}),t=null,r.label=1;case 1:return r.trys.push([1,3,,4]),[4,navigator.mediaDevices.getUserMedia(e)];case 2:return t=r.sent(),[3,4];case 3:return"NotAllowedError"===r.sent().name?(L?(N(!1),j(!0)):_(!0),[2]):[3,4];case 4:if(t)return[3,8];r.label=5;case 5:return r.trys.push([5,7,,8]),[4,navigator.mediaDevices.getUserMedia({audio:!1,video:!0})];case 6:return t=r.sent(),console.log("opened stream with no width and height constraints"),[3,8];case 7:return r.sent(),console.log("cannot open stream at all"),[3,8];case 8:if(!t)throw new Error("failed to open camera");return n=function(){D&&L?(console.log("someone unplugged the continuity camera"),Ye(),p.current=null,N(!1),j(!0),E(null)):(console.log("someone unplugged the webcam"),Ye(),p.current=null,I(!1),_(!0))},null===(a=h.current)||void 0===a||a.addEventListener("ended",n),t.getVideoTracks().forEach((function(e){e.onended=n})),p.current=function(e,t,n){Ye(),console.log("obtaining camera access...");var a=e.getVideoTracks()[0].getSettings(),r=a.width,i=a.height,o=t.toLocaleLowerCase().split(" ").join(""),s=qe(o,C(C(C([],$e,!0),Ve,!0),["iphone"],!1));return r||(r=0),i||(i=0),Ge={label:t,stream:e,width:r,height:i,isRearFacing:s,release:function(){e.getTracks().forEach((function(e){e.enabled=!1,e.stop()})),n&&(n.pause(),n.srcObject=null,n.src="")}},n&&(n.srcObject=e),Ge}(t,w.label,h.current),[2]}}))})),t):t}}),[L,D,d,u,l,w]),t.useEffect((function(){v(!1),w&&T&&v(!0)}),[T,w]);var z=t.useCallback((function(){return b(void 0,void 0,void 0,(function(){var e;return x(this,(function(t){switch(t.label){case 0:return p.current?"undefined"==typeof ImageCapture?[3,2]:[4,new ImageCapture(p.current.stream.getTracks()[0]).takePhoto()]:[2,null];case 1:return[2,t.sent()];case 2:return h.current?(Ue(e=document.createElement("canvas"),h.current),[2,new Promise((function(t){return e.toBlob(t)}))]):[2,null]}}))}))}),[]);return{videoRef:h,videoDevice:w,videoLoaded:T,setVideoLoaded:I,cameraRef:p,cameraReady:g,cameraAccessDenied:B,retryCameraAccess:U,releaseCameraAccess:Ye,iphoneContinuityCameraAvailable:D,iphoneContinuityCameraAllowed:L,setIphoneContinuityCameraAllowed:R,takePhoto:z}},Xe=t.createContext({videoRef:{current:null},videoLoaded:!1,cameraRef:{current:null},cameraReady:!1,cameraAccessDenied:!1,retryCameraAccess:function(){return null},releaseCameraAccess:function(){return null},iphoneContinuityCameraAvailable:!1,iphoneContinuityCameraAllowed:!0,setIphoneContinuityCameraAllowed:function(){return null},takePhoto:function(){return Promise.resolve(null)},setVideoLoaded:function(){return null}}),Ke=function(e){var n=e.children,a=e.preferFrontFacingCamera,r=e.preferContinuityCamera,i=e.requestMicrophoneAccess,o=e.maxVideoWidth,s=e.debugMode,l=Qe({preferFrontFacingCamera:void 0!==a&&a,preferContinuityCamera:void 0===r||r,requestMicrophoneAccess:void 0!==i&&i,maxVideoWidth:void 0===o?1920:o,maxFps:e.maxFps,debugMode:void 0!==s&&s}),d=l.videoRef,c=l.videoLoaded,f=l.setVideoLoaded,h=l.cameraRef,p=l.cameraReady,m=l.cameraAccessDenied,g=l.retryCameraAccess,v=l.releaseCameraAccess,y=l.iphoneContinuityCameraAvailable,b=l.iphoneContinuityCameraAllowed,x=l.setIphoneContinuityCameraAllowed,C=l.takePhoto;return t.useEffect((function(){return function(){v()}}),[v]),u.default.createElement(Xe.Provider,{value:{videoRef:d,videoLoaded:c,setVideoLoaded:f,cameraRef:h,cameraReady:p,cameraAccessDenied:m,releaseCameraAccess:v,retryCameraAccess:g,iphoneContinuityCameraAvailable:y,iphoneContinuityCameraAllowed:b,setIphoneContinuityCameraAllowed:x,takePhoto:C}},n)};function Je(e){return b(this,void 0,void 0,(function(){var t,n,a,r,i,o,s;return x(this,(function(l){switch(l.label){case 0:return Ze?[2,Ze]:[4,p.loadGraphModel(e)];case 1:return Ze=l.sent(),[4,p.ready()];case 2:return l.sent(),t=p.zeros([448,448,3]),n=p.cast(t,"int32"),a=p.tensor4d(Array.from(n.dataSync()),[1,448,448,3]),r=p.cast(a,"int32"),o=(i=p).dispose,[4,Ze.executeAsync(r)];case 3:return o.apply(i,[l.sent()]),n.dispose(),r.dispose(),a.dispose(),p.dispose(t),s=Ze.outputs.map((function(e){return e.name})),Ze.outputPositions={boxes:s.indexOf("Identity_1"),scores:s.indexOf("Identity_4"),labels:s.indexOf("Identity_2")},[2,Ze]}}))}))}var et,tt={1:"Document",2:"MRZ",3:"PDF417",4:"Primary face",5:"Secondary face",6:"Glare",7:"Punch Hole",8:"Passport Page"};function nt(e){return b(this,void 0,void 0,(function(){var t,n,a,r,i,o,s,l,u;return x(this,(function(d){switch(d.label){case 0:return et?[2,et]:[4,p.loadLayersModel(e)];case 1:return et=d.sent(),[4,p.ready()];case 2:return d.sent(),t=p.zeros([448,448,3]),n=p.cast(t,"float32"),i=(r=p).tensor4d,s=(o=Array).from,[4,n.data()];case 3:return a=i.apply(r,[s.apply(o,[d.sent()]),[1,448,448,3]]),l=p.cast(a,"float32"),[4,et.predict(l)];case 4:return[4,(u=d.sent()).data()];case 5:return d.sent(),p.dispose(u),n.dispose(),l.dispose(),a.dispose(),p.dispose(t),[2,et]}}))}))}class at{refCount(e){return rt("refCount")}incRef(e){return rt("incRef")}timerAvailable(){return!0}time(e){return rt("time")}read(e){return rt("read")}readSync(e){return rt("readSync")}readToGPU(e,t){return rt("readToGPU")}numDataIds(){return rt("numDataIds")}disposeData(e,t){return rt("disposeData")}write(e,t,n){return rt("write")}move(e,t,n,a,r){return rt("move")}createTensorFromGPUData(e,t,n){return rt("createTensorFromGPUData")}memory(){return rt("memory")}floatPrecision(){return rt("floatPrecision")}epsilon(){return 32===this.floatPrecision()?1e-7:1e-4}dispose(){return rt("dispose")}}function rt(e){throw new Error(`'${e}' not yet implemented or not found in the registry. This kernel may not be supported by the tfjs backend you have chosen`)}function it(e,t){if(!e)throw new Error("string"==typeof t?t:t())}function ot(e){if(0===e.length)return 1;let t=e[0];for(let n=1;n<e.length;n++)t*=e[n];return t}function st(e,t){if(e===t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function lt(e,t){return t<=e.length?e:e+" ".repeat(t-e.length)}function ut(e){if("float32"===e||"int32"===e)return 4;if("complex64"===e)return 8;if("bool"===e)return 1;throw new Error(`Unknown dtype ${e}`)}function dt(e){return"string"==typeof e||e instanceof String}function ct(e){return Array.isArray(e)?ct(e[0]):e instanceof Float32Array?"float32":e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray?"int32":"number"==typeof e?"float32":dt(e)?"string":function(e){return"boolean"==typeof e}(e)?"bool":"float32"}function ft(e){return!!(e&&e.constructor&&e.call&&e.apply)}function ht(e){const t=e.length;if(t<2)return[];const n=new Array(t-1);n[t-2]=e[t-1];for(let a=t-3;a>=0;--a)n[a]=n[a+1]*e[a+1];return n}function pt(e,t,n,a=!1){const r=new Array;if(1===t.length){const i=t[0]*(a?2:1);for(let t=0;t<i;t++)r[t]=n[e+t]}else{const i=t[0],o=t.slice(1),s=o.reduce(((e,t)=>e*t))*(a?2:1);for(let t=0;t<i;t++)r[t]=pt(e+t*s,o,n,a)}return r}function mt(e,t,n=!1){if(0===e.length)return t[0];const a=e.reduce(((e,t)=>e*t))*(n?2:1);if(0===a)return[];if(a!==t.length)throw new Error(`[${e}] does not match the input size ${t.length}${n?" for a complex tensor":""}.`);return pt(0,e,t,n)}function gt(e,t){if(null==t||"float32"===t||"complex64"===t)return new Float32Array(e);if("int32"===t)return new Int32Array(e);if("bool"===t)return new Uint8Array(e);throw new Error(`Unknown data type ${t}`)}function vt(e){e.forEach((t=>{it(Number.isInteger(t)&&t>=0,(()=>`Tensor must have a shape comprised of positive integers but got shape [${e}].`))}))}function yt(e){return e&&e.then&&"function"==typeof e.then}const bt="tfjsflags";class xt{constructor(e){this.global=e,this.flags={},this.flagRegistry={},this.urlFlags={},this.getQueryParams=Ct,this.populateURLFlags()}setPlatform(e,t){null!=this.platform&&(wt().getBool("IS_TEST")||wt().getBool("PROD")||console.warn(`Platform ${this.platformName} has already been set. Overwriting the platform with ${e}.`)),this.platformName=e,this.platform=t}registerFlag(e,t,n){if(this.flagRegistry[e]={evaluationFn:t,setHook:n},null!=this.urlFlags[e]){const t=this.urlFlags[e];wt().getBool("IS_TEST")||wt().getBool("PROD")||console.warn(`Setting feature override from URL ${e}: ${t}.`),this.set(e,t)}}async getAsync(e){return e in this.flags||(this.flags[e]=await this.evaluateFlag(e)),this.flags[e]}get(e){if(e in this.flags)return this.flags[e];const t=this.evaluateFlag(e);if(yt(t))throw new Error(`Flag ${e} cannot be synchronously evaluated. Please use getAsync() instead.`);return this.flags[e]=t,this.flags[e]}getNumber(e){return this.get(e)}getBool(e){return this.get(e)}getString(e){return this.get(e)}getFlags(){return this.flags}get features(){return this.flags}set(e,t){if(null==this.flagRegistry[e])throw new Error(`Cannot set flag ${e} as it has not been registered.`);this.flags[e]=t,null!=this.flagRegistry[e].setHook&&this.flagRegistry[e].setHook(t)}evaluateFlag(e){if(null==this.flagRegistry[e])throw new Error(`Cannot evaluate flag '${e}': no evaluation function found.`);return this.flagRegistry[e].evaluationFn()}setFlags(e){this.flags=Object.assign({},e)}reset(){this.flags={},this.urlFlags={},this.populateURLFlags()}populateURLFlags(){if(void 0===this.global||void 0===this.global.location||void 0===this.global.location.search)return;const e=this.getQueryParams(this.global.location.search);if(bt in e){e[bt].split(",").forEach((e=>{const[t,n]=e.split(":");this.urlFlags[t]=function(e,t){const n=t.toLowerCase();return"true"===n||"false"===n?"true"===n:""+ +n===n?+n:t}(0,n)}))}}}function Ct(e){const t={};return e.replace(/[?&]([^=?&]+)(?:=([^&]*))?/g,((e,...n)=>(function(e,t,n){e[decodeURIComponent(t)]=decodeURIComponent(n||"")}(t,n[0],n[1]),n.join("=")))),t}function wt(){return kt}let Et,kt=null;function Tt(){if(null==Et){let e;if("undefined"!=typeof window)e=window;else if("undefined"!=typeof global)e=global;else if("undefined"!=typeof process)e=process;else{if("undefined"==typeof self)throw new Error("Could not find a global object");e=self}Et=e}return Et}function Mt(e,t){const n=function(){const e=Tt();return null==e._tfGlobals&&(e._tfGlobals=new Map),e._tfGlobals}();if(n.has(e))return n.get(e);{const a=t();return n.set(e,a),n.get(e)}}const It="Add",St="Cast",Dt="Identity";function Nt(...e){wt().getBool("IS_TEST")||wt().getBool("PROD")||console.warn(...e)}const At=Mt("kernelRegistry",(()=>new Map)),Lt=Mt("gradRegistry",(()=>new Map));function Rt(e,t){const n=function(e,t){return`${t}_${e}`}(e,t);return At.get(n)}function Ot(e){return Lt.get(e)}function Ft(e){const t=At.entries(),n=[];for(;;){const{done:a,value:r}=t.next();if(a)break;const[i,o]=r,[s]=i.split("_");s===e&&n.push(o)}return n}function jt(e){return e instanceof Float32Array||e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray}function Pt(e,t){if("string"===t)throw new Error("Cannot convert a string[] to a TypedArray");if(Array.isArray(e)&&(e=zt(e)),wt().getBool("DEBUG")&&function(e,t){for(let n=0;n<e.length;n++){const a=e[n];if(isNaN(a)||!isFinite(a))throw Error(`A tensor of type ${t} being uploaded contains ${a}.`)}}(e,t),function(e,t){return e instanceof Float32Array&&"float32"===t||e instanceof Int32Array&&"int32"===t||e instanceof Uint8Array&&"bool"===t}(e,t))return e;if(null==t||"float32"===t||"complex64"===t)return new Float32Array(e);if("int32"===t)return new Int32Array(e);if("bool"===t){const t=new Uint8Array(e.length);for(let n=0;n<t.length;++n)0!==Math.round(e[n])&&(t[n]=1);return t}throw new Error(`Unknown data type ${t}`)}function Bt(){return wt().platform.now()}function _t(e,t="utf-8"){return t=t||"utf-8",wt().platform.decode(e,t)}function Ut(e){return null!=wt().platform.isTypedArray?wt().platform.isTypedArray(e):jt(e)}function zt(e,t=[],n=!1){if(null==t&&(t=[]),"boolean"==typeof e||"number"==typeof e||"string"==typeof e||yt(e)||null==e||Ut(e)&&n)t.push(e);else if(Array.isArray(e)||Ut(e))for(let a=0;a<e.length;++a)zt(e[a],t,n);else{let a=-1;for(const t of Object.keys(e))/^([1-9]+[0-9]*|0)$/.test(t)&&(a=Math.max(a,Number(t)));for(let r=0;r<=a;r++)zt(e[r],t,n)}return t}class Gt{constructor(e,t){this.backendTimer=e,this.logger=t,null==t&&(this.logger=new $t)}profileKernel(e,t,n){let a;const r=()=>{a=n()};let i;const o=Bt();if(this.backendTimer.timerAvailable())i=this.backendTimer.time(r);else{r();for(const e of a)e.dataSync();i=Promise.resolve({kernelMs:Bt()-o})}if(wt().getBool("CHECK_COMPUTATION_FOR_ERRORS"))for(let t=0;t<a.length;t++){const n=a[t];n.data().then((t=>{Wt(t,n.dtype,e)}))}return{kernelName:e,outputs:a,inputs:t,timeMs:i.then((e=>e.kernelMs)),extraInfo:i.then((e=>null!=e.getExtraProfileInfo?e.getExtraProfileInfo():""))}}logKernelProfile(e){const{kernelName:t,outputs:n,timeMs:a,inputs:r,extraInfo:i}=e;n.forEach((e=>{Promise.all([e.data(),a,i]).then((n=>{this.logger.logKernelProfile(t,e,n[0],n[1],r,n[2])}))}))}}function Wt(e,t,n){if("float32"!==t)return!1;for(let t=0;t<e.length;t++){const a=e[t];if(isNaN(a)||!isFinite(a))return console.warn(`Found ${a} in the result of '${n}'`),!0}return!1}class $t{logKernelProfile(e,t,n,a,r,i){const o="number"==typeof a?lt(`${a}ms`,9):a.error,s=lt(e,25),l=t.rank,u=t.size,d=lt(t.shape.toString(),14);let c="";for(const e in r){const n=r[e];if(null!=n){const a=n.shape||t.shape,r=a.length;c+=`${e}: ${r}D ${r>0?a:""} `}}console.log(`%c${s}\t%c${o}\t%c${l}D ${d}\t%c${u}\t%c${c}\t%c${i}`,"font-weight:bold","color:red","color:blue","color: orange","color: green","color: steelblue")}}const Vt=20,qt=3,Ht=7;function Yt(e,t,n,a){const r=ht(t),i=function(e,t,n,a){const r=ot(t),i=a[a.length-1],o=new Array(i).fill(0),s=t.length,l="complex64"===n?Kt(e):e;if(s>1)for(let e=0;e<r/i;e++){const t=e*i;for(let e=0;e<i;e++)o[e]=Math.max(o[e],Zt(l[t+e],0,n).length)}return o}(e,t,n,r),o=t.length,s=Xt(e,t,n,r,i),l=["Tensor"];return a&&(l.push(` dtype: ${n}`),l.push(` rank: ${o}`),l.push(` shape: [${t}]`),l.push(" values:")),l.push(s.map((e=>" "+e)).join("\n")),l.join("\n")}function Zt(e,t,n){let a;return a=Array.isArray(e)?`${parseFloat(e[0].toFixed(Ht))} + ${parseFloat(e[1].toFixed(Ht))}j`:dt(e)?`'${e}'`:"bool"===n?Qt(e):parseFloat(e.toFixed(Ht)).toString(),lt(a,t)}function Qt(e){return 0===e?"false":"true"}function Xt(e,t,n,a,r,i=!0){const o="complex64"===n?2:1,s=t[0],l=t.length;if(0===l){if("complex64"===n){return[Zt(Kt(e)[0],0,n)]}return"bool"===n?[Qt(e[0])]:[e[0].toString()]}if(1===l){if(s>Vt){let t=Array.from(e.slice(0,qt*o)),a=Array.from(e.slice((s-qt)*o,s*o));return"complex64"===n&&(t=Kt(t),a=Kt(a)),["["+t.map(((e,t)=>Zt(e,r[t],n))).join(", ")+", ..., "+a.map(((e,t)=>Zt(e,r[s-qt+t],n))).join(", ")+"]"]}return["["+("complex64"===n?Kt(e):Array.from(e)).map(((e,t)=>Zt(e,r[t],n))).join(", ")+"]"]}const u=t.slice(1),d=a.slice(1),c=a[0]*o,f=[];if(s>Vt){for(let t=0;t<qt;t++){const a=t*c;f.push(...Xt(e.slice(a,a+c),u,n,d,r,!1))}f.push("...");for(let t=s-qt;t<s;t++){const a=t*c;f.push(...Xt(e.slice(a,a+c),u,n,d,r,t===s-1))}}else for(let t=0;t<s;t++){const a=t*c;f.push(...Xt(e.slice(a,a+c),u,n,d,r,t===s-1))}const h=2===l?",":"";f[0]="["+(s>0?f[0]+h:"");for(let e=1;e<f.length-1;e++)f[e]=" "+f[e]+h;let p=",\n";for(let e=2;e<l;e++)p+="\n";return f[f.length-1]=" "+f[f.length-1]+"]"+(i?"":p),f}function Kt(e){const t=[];for(let n=0;n<e.length;n+=2)t.push([e[n],e[n+1]]);return t}class Jt{constructor(e,t,n){if(this.dtype=t,this.shape=e.slice(),this.size=ot(e),null!=n){const e=n.length;it(e===this.size,(()=>`Length of values '${e}' does not match the size inferred by the shape '${this.size}'.`))}if("complex64"===t)throw new Error("complex64 dtype TensorBuffers are not supported. Please create a TensorBuffer for the real and imaginary parts separately and call tf.complex(real, imag).");this.values=n||function(e,t){let n=null;if(null==e||"float32"===e)n=new Float32Array(t);else if("int32"===e)n=new Int32Array(t);else if("bool"===e)n=new Uint8Array(t);else{if("string"!==e)throw new Error(`Unknown data type ${e}`);n=new Array(t)}return n}(t,this.size),this.strides=ht(e)}set(e,...t){0===t.length&&(t=[0]),it(t.length===this.rank,(()=>`The number of provided coordinates (${t.length}) must match the rank (${this.rank})`));const n=this.locToIndex(t);this.values[n]=e}get(...e){0===e.length&&(e=[0]);let t=0;for(const n of e){if(n<0||n>=this.shape[t]){throw new Error(`Requested out of range element at ${e}. Buffer shape=${this.shape}`)}t++}let n=e[e.length-1];for(let t=0;t<e.length-1;++t)n+=this.strides[t]*e[t];return this.values[n]}locToIndex(e){if(0===this.rank)return 0;if(1===this.rank)return e[0];let t=e[e.length-1];for(let n=0;n<e.length-1;++n)t+=this.strides[n]*e[n];return t}indexToLoc(e){if(0===this.rank)return[];if(1===this.rank)return[e];const t=new Array(this.shape.length);for(let n=0;n<t.length-1;++n)t[n]=Math.floor(e/this.strides[n]),e-=t[n]*this.strides[n];return t[t.length-1]=e,t}get rank(){return this.shape.length}toTensor(){return en().makeTensor(this.values,this.shape,this.dtype)}}let en=null,tn=null;class nn{constructor(e,t,n,a){this.kept=!1,this.isDisposedInternal=!1,this.shape=e.slice(),this.dtype=t||"float32",this.size=ot(e),this.strides=ht(e),this.dataId=n,this.id=a,this.rankType=this.rank<5?this.rank.toString():"higher"}get rank(){return this.shape.length}async buffer(){const e=await this.data();return tn.buffer(this.shape,this.dtype,e)}bufferSync(){return tn.buffer(this.shape,this.dtype,this.dataSync())}async array(){const e=await this.data();return mt(this.shape,e,"complex64"===this.dtype)}arraySync(){return mt(this.shape,this.dataSync(),"complex64"===this.dtype)}async data(){this.throwIfDisposed();const e=en().read(this.dataId);if("string"===this.dtype){const t=await e;try{return t.map((e=>_t(e)))}catch(e){throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}}return e}dataToGPU(e){return this.throwIfDisposed(),en().readToGPU(this.dataId,e)}dataSync(){this.throwIfDisposed();const e=en().readSync(this.dataId);if("string"===this.dtype)try{return e.map((e=>_t(e)))}catch(e){throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}return e}async bytes(){this.throwIfDisposed();const e=await en().read(this.dataId);return"string"===this.dtype?e:new Uint8Array(e.buffer)}dispose(){this.isDisposed||(en().disposeTensor(this),this.isDisposedInternal=!0)}get isDisposed(){return this.isDisposedInternal}throwIfDisposed(){if(this.isDisposed)throw new Error("Tensor is disposed.")}print(e=!1){return tn.print(this,e)}clone(){return this.throwIfDisposed(),tn.clone(this)}toString(e=!1){return Yt(this.dataSync(),this.shape,this.dtype,e)}cast(e){return this.throwIfDisposed(),tn.cast(this,e)}variable(e=!0,t,n){return this.throwIfDisposed(),en().makeVariable(this,e,t,n)}}Object.defineProperty(nn,Symbol.hasInstance,{value:e=>!!e&&null!=e.data&&null!=e.dataSync&&null!=e.throwIfDisposed}),Mt("Tensor",(()=>nn));class an extends nn{constructor(e,t,n,a){super(e.shape,e.dtype,e.dataId,a),this.trainable=t,this.name=n}assign(e){if(e.dtype!==this.dtype)throw new Error(`dtype of the new value (${e.dtype}) and previous value (${this.dtype}) must match`);if(!st(e.shape,this.shape))throw new Error(`shape of the new value (${e.shape}) and previous value (${this.shape}) must match`);en().disposeTensor(this),this.dataId=e.dataId,en().incRef(this,null)}dispose(){en().disposeVariable(this),this.isDisposedInternal=!0}}var rn,on,sn,ln,un;Object.defineProperty(an,Symbol.hasInstance,{value:e=>e instanceof nn&&null!=e.assign&&e.assign instanceof Function}),function(e){e.R0="R0",e.R1="R1",e.R2="R2",e.R3="R3",e.R4="R4",e.R5="R5",e.R6="R6"}(rn||(rn={})),function(e){e.float32="float32",e.int32="int32",e.bool="int32",e.complex64="complex64"}(on||(on={})),function(e){e.float32="float32",e.int32="int32",e.bool="bool",e.complex64="complex64"}(sn||(sn={})),function(e){e.float32="float32",e.int32="float32",e.bool="float32",e.complex64="complex64"}(ln||(ln={})),function(e){e.float32="complex64",e.int32="complex64",e.bool="complex64",e.complex64="complex64"}(un||(un={}));const dn={float32:ln,int32:on,bool:sn,complex64:un};function cn(e){return null!=e&&"object"==typeof e&&"texture"in e&&e.texture instanceof WebGLTexture}function fn(e){return"undefined"!=typeof GPUBuffer&&null!=e&&"object"==typeof e&&"buffer"in e&&e.buffer instanceof GPUBuffer}function hn(e,t){if(e.dtype===t.dtype)return[e,t];const n=function(e,t){if("string"===e||"string"===t){if("string"===e&&"string"===t)return"string";throw new Error(`Can not upcast ${e} with ${t}`)}return dn[e][t]}(e.dtype,t.dtype);return[e.cast(n),t.cast(n)]}function pn(e){const t=[];return mn(e,t,new Set),t}function mn(e,t,n){if(null==e)return;if(e instanceof nn)return void t.push(e);if(a=e,!Array.isArray(a)&&"object"!=typeof a)return;var a;const r=e;for(const e in r){const a=r[e];n.has(a)||(n.add(a),mn(a,t,n))}}function gn(e){return null!=e.kernelName}class vn{constructor(){this.registeredVariables={},this.nextTapeNodeId=0,this.numBytes=0,this.numTensors=0,this.numStringTensors=0,this.numDataBuffers=0,this.gradientDepth=0,this.kernelDepth=0,this.scopeStack=[],this.numDataMovesStack=[],this.nextScopeId=0,this.tensorInfo=new WeakMap,this.profiling=!1,this.activeProfile={newBytes:0,newTensors:0,peakBytes:0,kernels:[],result:null,get kernelNames(){return Array.from(new Set(this.kernels.map((e=>e.name))))}}}dispose(){for(const e in this.registeredVariables)this.registeredVariables[e].dispose()}}class yn{constructor(e){this.ENV=e,this.registry={},this.registryFactory={},this.pendingBackendInitId=0,this.state=new vn}async ready(){if(null!=this.pendingBackendInit)return this.pendingBackendInit.then((()=>{}));if(null!=this.backendInstance)return;const e=this.getSortedBackends();for(let t=0;t<e.length;t++){const n=e[t];if(await this.initializeBackend(n).success)return void await this.setBackend(n)}throw new Error("Could not initialize any backends, all backend initializations failed.")}get backend(){if(null!=this.pendingBackendInit)throw new Error(`Backend '${this.backendName}' has not yet been initialized. Make sure to await tf.ready() or await tf.setBackend() before calling other methods`);if(null==this.backendInstance){const{name:e,asyncInit:t}=this.initializeBackendsAndReturnBest();if(t)throw new Error(`The highest priority backend '${e}' has not yet been initialized. Make sure to await tf.ready() or await tf.setBackend() before calling other methods`);this.setBackend(e)}return this.backendInstance}backendNames(){return Object.keys(this.registryFactory)}findBackend(e){if(!(e in this.registry)){if(!(e in this.registryFactory))return null;{const{asyncInit:t}=this.initializeBackend(e);if(t)return null}}return this.registry[e]}findBackendFactory(e){return e in this.registryFactory?this.registryFactory[e].factory:null}registerBackend(e,t,n=1){return e in this.registryFactory?(Nt(`${e} backend was already registered. Reusing existing backend factory.`),!1):(this.registryFactory[e]={factory:t,priority:n},!0)}async setBackend(e){if(null==this.registryFactory[e])throw new Error(`Backend name '${e}' not found in registry`);if(this.backendName=e,null==this.registry[e]){this.backendInstance=null;const{success:t,asyncInit:n}=this.initializeBackend(e);if(!(n?await t:t))return!1}return this.backendInstance=this.registry[e],this.setupRegisteredKernels(),this.profiler=new Gt(this.backendInstance),!0}setupRegisteredKernels(){Ft(this.backendName).forEach((e=>{null!=e.setupFunc&&e.setupFunc(this.backendInstance)}))}disposeRegisteredKernels(e){Ft(e).forEach((t=>{null!=t.disposeFunc&&t.disposeFunc(this.registry[e])}))}initializeBackend(e){const t=this.registryFactory[e];if(null==t)throw new Error(`Cannot initialize backend ${e}, no registration found.`);try{const n=t.factory();if(!n||n instanceof at||"function"!=typeof n.then)return this.registry[e]=n,{success:!0,asyncInit:!1};{const t=++this.pendingBackendInitId,a=n.then((n=>!(t<this.pendingBackendInitId)&&(this.registry[e]=n,this.pendingBackendInit=null,!0))).catch((n=>(t<this.pendingBackendInitId||(this.pendingBackendInit=null,Nt(`Initialization of backend ${e} failed`),Nt(n.stack||n.message)),!1)));return this.pendingBackendInit=a,{success:a,asyncInit:!0}}}catch(t){return Nt(`Initialization of backend ${e} failed`),Nt(t.stack||t.message),{success:!1,asyncInit:!1}}}removeBackend(e){if(!(e in this.registryFactory))throw new Error(`${e} backend not found in registry`);this.backendName===e&&null!=this.pendingBackendInit&&this.pendingBackendInitId++,e in this.registry&&(this.disposeRegisteredKernels(e),this.registry[e].dispose(),delete this.registry[e]),delete this.registryFactory[e],this.backendName===e&&(this.pendingBackendInit=null,this.backendName=null,this.backendInstance=null)}getSortedBackends(){if(0===Object.keys(this.registryFactory).length)throw new Error("No backend found in registry.");return Object.keys(this.registryFactory).sort(((e,t)=>this.registryFactory[t].priority-this.registryFactory[e].priority))}initializeBackendsAndReturnBest(){const e=this.getSortedBackends();for(let t=0;t<e.length;t++){const n=e[t],{success:a,asyncInit:r}=this.initializeBackend(n);if(r||a)return{name:n,asyncInit:r}}throw new Error("Could not initialize any backends, all backend initializations failed.")}moveData(e,t){const n=this.state.tensorInfo.get(t),a=n.backend,r=this.readSync(t),i=a.refCount(t);a.disposeData(t,!0),n.backend=e,e.move(t,r,n.shape,n.dtype,i),this.shouldCheckForMemLeaks()&&this.state.numDataMovesStack[this.state.numDataMovesStack.length-1]++}tidy(e,t){let n,a=null;if(null==t){if("function"!=typeof e)throw new Error("Please provide a function to tidy()");t=e}else{if("string"!=typeof e&&!(e instanceof String))throw new Error("When calling with two arguments, the first argument to tidy() must be a string");if("function"!=typeof t)throw new Error("When calling with two arguments, the 2nd argument to tidy() must be a function");a=e}return this.scopedRun((()=>this.startScope(a)),(()=>this.endScope(n)),(()=>(n=t(),n instanceof Promise&&console.error("Cannot return a Promise inside of tidy."),n)))}scopedRun(e,t,n){e();try{const e=n();return t(),e}catch(e){throw t(),e}}nextTensorId(){return yn.nextTensorId++}nextVariableId(){return yn.nextVariableId++}clone(e){const t=xn.runKernel(Dt,{x:e});return this.addTapeNode(this.state.activeScope.name,{x:e},[t],(e=>({x:()=>xn.runKernel(St,{x:e},{dtype:"float32"})})),[],{}),t}runKernel(e,t,n){if(!(null!=Rt(e,this.backendName)))throw new Error(`Kernel '${e}' not registered for backend '${this.backendName}'`);return this.runKernelFunc({kernelName:e,inputs:t,attrs:n})}shouldCheckForMemLeaks(){return this.ENV.getBool("IS_TEST")}checkKernelForMemLeak(e,t,n){const a=this.backend.numDataIds();let r=0;n.forEach((e=>{r+="complex64"===e.dtype?3:1}));const i=a-t-r-this.state.numDataMovesStack[this.state.numDataMovesStack.length-1];if(i>0)throw new Error(`Backend '${this.backendName}' has an internal memory leak (${i} data ids) after running '${e}'`)}runKernelFunc(e){let t,n=[];const a=this.isTapeOn(),r=this.state.numBytes,i=this.state.numTensors;let o,s;this.shouldCheckForMemLeaks()&&this.state.numDataMovesStack.push(0);const l=gn(e)?e.kernelName:null!=this.state.activeScope?this.state.activeScope.name:"";if(gn(e)){const{kernelName:t,inputs:r,attrs:i}=e,l=Rt(t,this.backendName);it(null!=l,(()=>`Cannot find registered kernel '${t}' for backend '${this.backendName}'`)),o=()=>{const e=this.backend.numDataIds();s=l.kernelFunc({inputs:r,attrs:i,backend:this.backend});const o=Array.isArray(s)?s:[s];this.shouldCheckForMemLeaks()&&this.checkKernelForMemLeak(t,e,o);const u=o.map((e=>null!=e.rank?e:this.makeTensorFromTensorInfo(e)));if(a){const e=this.getTensorsForGradient(t,r,u);n=this.saveTensorsForBackwardMode(e)}return u}}else{const{forwardFunc:t}=e,r=e=>{a&&(n=e.map((e=>this.keep(this.clone(e)))))};o=()=>{const e=this.backend.numDataIds();s=this.tidy((()=>t(this.backend,r)));const n=Array.isArray(s)?s:[s];return this.shouldCheckForMemLeaks()&&this.checkKernelForMemLeak(l,e,n),n}}const{inputs:u,attrs:d}=e,c=gn(e)?null:e.backwardsFunc;let f;return this.scopedRun((()=>this.state.kernelDepth++),(()=>this.state.kernelDepth--),(()=>{this.ENV.getBool("DEBUG")||this.state.profiling?(f=this.profiler.profileKernel(l,u,(()=>o())),this.ENV.getBool("DEBUG")&&this.profiler.logKernelProfile(f),t=f.outputs):t=o()})),a&&this.addTapeNode(l,u,t,c,n,d),this.state.profiling&&this.state.activeProfile.kernels.push({name:l,bytesAdded:this.state.numBytes-r,totalBytesSnapshot:this.state.numBytes,tensorsAdded:this.state.numTensors-i,totalTensorsSnapshot:this.state.numTensors,inputShapes:Object.keys(u).map((e=>null!=u[e]?u[e].shape:null)),outputShapes:t.map((e=>e.shape)),kernelTimeMs:f.timeMs,extraInfo:f.extraInfo}),Array.isArray(s)?t:t[0]}saveTensorsForBackwardMode(e){return e.map((e=>this.keep(this.clone(e))))}getTensorsForGradient(e,t,n){const a=Ot(e);if(null!=a){const e=a.inputsToSave||[],r=a.outputsToSave||[];let i;a.saveAllInputs?(it(Array.isArray(t),(()=>"saveAllInputs is true, expected inputs to be an array.")),i=Object.keys(t).map((e=>t[e]))):i=e.map((e=>t[e]));const o=n.filter(((e,t)=>r[t]));return i.concat(o)}return[]}makeTensor(e,t,n,a){if(null==e)throw new Error("Values passed to engine.makeTensor() are null");a=a||this.backend;let r=e;"string"===(n=n||"float32")&&dt(e[0])&&(r=e.map((e=>function(e,t="utf-8"){return t=t||"utf-8",wt().platform.encode(e,t)}(e))));const i=a.write(r,t,n),o=new nn(t,n,i,this.nextTensorId());if(this.trackTensor(o,a),"string"===n){const e=this.state.tensorInfo.get(i),t=function(e){if(null==e)return 0;let t=0;return e.forEach((e=>t+=e.length)),t}(r);this.state.numBytes+=t-e.bytes,e.bytes=t}return o}makeTensorFromDataId(e,t,n,a){return this.makeTensorFromTensorInfo({dataId:e,shape:t,dtype:n=n||"float32"},a)}makeTensorFromTensorInfo(e,t){const{dataId:n,shape:a,dtype:r}=e,i=new nn(a,r,n,this.nextTensorId());return this.trackTensor(i,t),i}makeVariable(e,t=!0,n,a){n=n||this.nextVariableId().toString(),null!=a&&a!==e.dtype&&(e=e.cast(a));const r=new an(e,t,n,this.nextTensorId());if(null!=this.state.registeredVariables[r.name])throw new Error(`Variable with name ${r.name} was already registered`);return this.state.registeredVariables[r.name]=r,this.incRef(r,this.backend),r}trackTensor(e,t){this.state.numTensors++,"string"===e.dtype&&this.state.numStringTensors++;let n=0;"complex64"!==e.dtype&&"string"!==e.dtype&&(n=e.size*ut(e.dtype)),this.state.numBytes+=n,this.state.tensorInfo.has(e.dataId)||(this.state.numDataBuffers++,this.state.tensorInfo.set(e.dataId,{backend:t||this.backend,dtype:e.dtype,shape:e.shape,bytes:n})),e instanceof an||this.track(e)}incRef(e,t){this.trackTensor(e,t),this.backend.incRef(e.dataId)}removeDataId(e,t){this.state.tensorInfo.has(e)&&this.state.tensorInfo.get(e).backend===t&&(this.state.tensorInfo.delete(e),this.state.numDataBuffers--)}disposeTensor(e){if(!this.state.tensorInfo.has(e.dataId))return;const t=this.state.tensorInfo.get(e.dataId);if(this.state.numTensors--,"string"===e.dtype&&(this.state.numStringTensors--,this.state.numBytes-=t.bytes),"complex64"!==e.dtype&&"string"!==e.dtype){const t=e.size*ut(e.dtype);this.state.numBytes-=t}t.backend.disposeData(e.dataId)&&this.removeDataId(e.dataId,t.backend)}disposeVariables(){for(const e in this.state.registeredVariables){this.disposeVariable(this.state.registeredVariables[e])}}disposeVariable(e){this.disposeTensor(e),null!=this.state.registeredVariables[e.name]&&delete this.state.registeredVariables[e.name]}memory(){const e=this.backend.memory();return e.numTensors=this.state.numTensors,e.numDataBuffers=this.state.numDataBuffers,e.numBytes=this.state.numBytes,this.state.numStringTensors>0&&(e.unreliable=!0,null==e.reasons&&(e.reasons=[]),e.reasons.push("Memory usage by string tensors is approximate (2 bytes per character)")),e}async profile(e){this.state.profiling=!0;const t=this.state.numBytes,n=this.state.numTensors;this.state.activeProfile.kernels=[],this.state.activeProfile.result=await e(),this.state.profiling=!1,this.state.activeProfile.peakBytes=Math.max(...this.state.activeProfile.kernels.map((e=>e.totalBytesSnapshot))),this.state.activeProfile.newBytes=this.state.numBytes-t,this.state.activeProfile.newTensors=this.state.numTensors-n;for(const e of this.state.activeProfile.kernels)e.kernelTimeMs=await e.kernelTimeMs,e.extraInfo=await e.extraInfo;return this.state.activeProfile}isTapeOn(){return this.state.gradientDepth>0&&0===this.state.kernelDepth}addTapeNode(e,t,n,a,r,i){const o={id:this.state.nextTapeNodeId++,kernelName:e,inputs:t,outputs:n,saved:r},s=Ot(e);null!=s&&(a=s.gradFunc),null!=a&&(o.gradient=e=>(e=e.map(((e,t)=>{if(null==e){const e=n[t],a=gt(e.size,e.dtype);return this.makeTensor(a,e.shape,e.dtype)}return e})),a(e.length>1?e:e[0],r,i))),this.state.activeTape.push(o)}keep(e){return e.kept=!0,e}startTape(){0===this.state.gradientDepth&&(this.state.activeTape=[]),this.state.gradientDepth++}endTape(){this.state.gradientDepth--}startScope(e){const t={track:[],name:"unnamed scope",id:this.state.nextScopeId++};e&&(t.name=e),this.state.scopeStack.push(t),this.state.activeScope=t}endScope(e){const t=pn(e),n=new Set(t.map((e=>e.id)));for(let e=0;e<this.state.activeScope.track.length;e++){const t=this.state.activeScope.track[e];t.kept||n.has(t.id)||t.dispose()}const a=this.state.scopeStack.pop();this.state.activeScope=0===this.state.scopeStack.length?null:this.state.scopeStack[this.state.scopeStack.length-1],t.forEach((e=>{e.kept||e.scopeId!==a.id||this.track(e)}))}gradients(e,t,n,a=!1){if(it(t.length>0,(()=>"gradients() received an empty list of xs.")),null!=n&&"float32"!==n.dtype)throw new Error(`dy must have 'float32' dtype, but has '${n.dtype}'`);const r=this.scopedRun((()=>this.startTape()),(()=>this.endTape()),(()=>this.tidy("forward",e)));it(r instanceof nn,(()=>"The result y returned by f() must be a tensor."));const i=function(e,t,n){const a={},r={};for(let e=0;e<t.length;e++)a[t[e].id]=!0;for(let n=0;n<e.length;n++){const i=e[n],o=i.inputs;for(const e in o){const n=o[e];let s=!1;for(let e=0;e<t.length;e++)if(a[n.id]){i.outputs.forEach((e=>a[e.id]=!0)),s=!0,r[i.id]=!0;break}if(s)break}}const i={};i[n.id]=!0;const o={};for(let t=e.length-1;t>=0;t--){const n=e[t],a=n.inputs;for(let e=0;e<n.outputs.length;e++)if(i[n.outputs[e].id]){for(const e in a)i[a[e].id]=!0,o[n.id]=!0;break}}const s=[];for(let t=0;t<e.length;t++){const n=e[t];if(r[n.id]&&o[n.id]){const e={};for(const t in n.inputs){const r=n.inputs[t];a[r.id]&&(e[t]=r)}const t=Object.assign({},n);t.inputs=e,t.outputs=n.outputs,s.push(t)}}return s}(this.state.activeTape,t,r);if(!a&&0===i.length&&t.length>0)throw new Error("Cannot compute gradient of y=f(x) with respect to x. Make sure that the f you passed encloses all operations that lead from x to y.");return this.tidy("backward",(()=>{const e={};e[r.id]=null==n?function(e){const t=function(e,t){const n=gt(e,t);for(let e=0;e<n.length;e++)n[e]=1;return n}(ot(e),"float32");return xn.makeTensor(t,e,"float32")}(r.shape):n,function(e,t,n,a){for(let r=t.length-1;r>=0;r--){const i=t[r],o=[];if(i.outputs.forEach((t=>{const n=e[t.id];o.push(null!=n?n:null)})),null==i.gradient)throw new Error(`Cannot compute gradient: gradient function not found for ${i.kernelName}.`);const s=i.gradient(o);for(const t in i.inputs){if(!(t in s))throw new Error(`Cannot backprop through input ${t}. Available gradients found: ${Object.keys(s)}.`);const r=n((()=>s[t]()));if("float32"!==r.dtype)throw new Error(`Error in gradient for op ${i.kernelName}. The gradient of input ${t} must have 'float32' dtype, but has '${r.dtype}'`);const o=i.inputs[t];if(!st(r.shape,o.shape))throw new Error(`Error in gradient for op ${i.kernelName}. The gradient of input '${t}' has shape '${r.shape}', which does not match the shape of the input '${o.shape}'`);if(null==e[o.id])e[o.id]=r;else{const t=e[o.id];e[o.id]=a(t,r),t.dispose()}}}}(e,i,(e=>this.tidy(e)),Cn);const a=t.map((t=>e[t.id]));return 0===this.state.gradientDepth&&(this.state.activeTape.forEach((e=>{for(const t of e.saved)t.dispose()})),this.state.activeTape=null),{value:r,grads:a}}))}customGrad(e){return it(ft(e),(()=>"The f passed in customGrad(f) must be a function.")),(...t)=>{let n;it(t.every((e=>e instanceof nn)),(()=>"The args passed in customGrad(f)(x1, x2,...) must all be tensors"));const a={};t.forEach(((e,t)=>{a[t]=e}));return this.runKernelFunc({forwardFunc:(a,r)=>(n=e(...t,r),it(n.value instanceof nn,(()=>"The function f passed in customGrad(f) must return an object where `obj.value` is a tensor")),it(ft(n.gradFunc),(()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function.")),n.value),backwardsFunc:(e,a)=>{const r=n.gradFunc(e,a),i=Array.isArray(r)?r:[r];it(i.length===t.length,(()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns the same number of tensors as inputs passed to f(...).")),it(i.every((e=>e instanceof nn)),(()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns a list of only tensors."));const o={};return i.forEach(((e,t)=>{o[t]=()=>e})),o},inputs:a})}}readSync(e){return this.state.tensorInfo.get(e).backend.readSync(e)}read(e){return this.state.tensorInfo.get(e).backend.read(e)}readToGPU(e,t){return this.state.tensorInfo.get(e).backend.readToGPU(e,t)}async time(e){const t=Bt(),n=await this.backend.time(e);return n.wallMs=Bt()-t,n}track(e){return null!=this.state.activeScope&&(e.scopeId=this.state.activeScope.id,this.state.activeScope.track.push(e)),e}get registeredVariables(){return this.state.registeredVariables}reset(){this.pendingBackendInitId++,this.state.dispose(),this.ENV.reset(),this.state=new vn;for(const e in this.registry)this.disposeRegisteredKernels(e),this.registry[e].dispose(),delete this.registry[e];this.backendName=null,this.backendInstance=null,this.pendingBackendInit=null}}function bn(){const e=Tt();if(null==e._tfengine){const t=new xt(e);e._tfengine=new yn(t)}return kt=e._tfengine.ENV,function(e){en=e}((()=>e._tfengine)),e._tfengine}yn.nextTensorId=0,yn.nextVariableId=0;const xn=bn();function Cn(e,t){return xn.runKernel(It,{a:e,b:t})}let wn;function En(e){if(void 0!==wn)return wn;if(e||"undefined"!=typeof navigator&&null!=navigator){if(e||(e=navigator),"ReactNative"===e.product)return!0;const t=e.userAgent||e.vendor||("undefined"!=typeof window?window.opera:"");if(!t){return e.userAgentData&&e.userAgentData.mobile}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(t)||/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(t.substr(0,4))}return!1}const kn=wt();function Tn(e,t){let n=e;if(Ut(e))return"string"===t?[]:[e.length];if(cn(e)){return[e.height,e.width*(e.channels||"RGBA").length]}if(fn(e))return[e.buffer.size/(null==t?4:ut(t))];if(!Array.isArray(e))return[];const a=[];for(;Array.isArray(n)||Ut(n)&&"string"!==t;)a.push(n.length),n=n[0];return Array.isArray(e)&&wt().getBool("TENSORLIKE_CHECK_SHAPE_CONSISTENCY")&&Mn(e,a,[]),a}function Mn(e,t,n){if(n=n||[],!Array.isArray(e)&&!Ut(e))return void it(0===t.length,(()=>`Element arr[${n.join("][")}] is a primitive, but should be an array/TypedArray of ${t[0]} elements`));it(t.length>0,(()=>`Element arr[${n.join("][")}] should be a primitive, but is an array of ${e.length} elements`)),it(e.length===t[0],(()=>`Element arr[${n.join("][")}] should have ${t[0]} elements, but has ${e.length} elements`));const a=t.slice(1);for(let t=0;t<e.length;++t)Mn(e[t],a,n.concat(t))}function In(e,t,n,a){if("string_or_numeric"!==e){if(null==e)throw new Error("Expected dtype cannot be null.");if("numeric"!==e&&e!==t||"numeric"===e&&"string"===t)throw new Error(`Argument '${n}' passed to '${a}' must be ${e} tensor, but got ${t} tensor`)}}function Sn(e,t,n,a="numeric"){if(e instanceof nn)return In(a,e.dtype,t,n),e;let r=ct(e);if("string"!==r&&["bool","int32","float32"].indexOf(a)>=0&&(r=a),In(a,r,t,n),null==e||!Ut(e)&&!Array.isArray(e)&&"number"!=typeof e&&"boolean"!=typeof e&&"string"!=typeof e){throw new Error(`Argument '${t}' passed to '${n}' must be a Tensor or TensorLike, but got '${null==e?"null":e.constructor.name}'`)}const i=Tn(e,r);Ut(e)||Array.isArray(e)||(e=[e]);const o="string"!==r?Pt(e,r):zt(e,[],!0);return xn.makeTensor(o,i,r)}kn.registerFlag("DEBUG",(()=>!1),(e=>{e&&console.warn("Debugging mode is ON. The output of every math call will be downloaded to CPU and checked for NaNs. This significantly impacts performance.")})),kn.registerFlag("IS_BROWSER",(()=>"undefined"!=typeof window&&null!=window.document||"undefined"!=typeof WorkerGlobalScope)),kn.registerFlag("IS_NODE",(()=>"undefined"!=typeof process&&void 0!==process.versions&&void 0!==process.versions.node)),kn.registerFlag("IS_CHROME",(()=>"undefined"!=typeof navigator&&null!=navigator&&null!=navigator.userAgent&&/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor))),kn.registerFlag("IS_SAFARI",(()=>"undefined"!=typeof navigator&&null!=navigator&&null!=navigator.userAgent&&/Safari/.test(navigator.userAgent)&&/Apple/.test(navigator.vendor))),kn.registerFlag("PROD",(()=>!1)),kn.registerFlag("TENSORLIKE_CHECK_SHAPE_CONSISTENCY",(()=>kn.getBool("DEBUG"))),kn.registerFlag("DEPRECATION_WARNINGS_ENABLED",(()=>!0)),kn.registerFlag("IS_TEST",(()=>!1)),kn.registerFlag("CHECK_COMPUTATION_FOR_ERRORS",(()=>kn.getBool("DEBUG"))),kn.registerFlag("WRAP_TO_IMAGEBITMAP",(()=>!1)),kn.registerFlag("CANVAS2D_WILL_READ_FREQUENTLY_FOR_GPU",(()=>!1)),kn.registerFlag("USE_SETTIMEOUTCUSTOM",(()=>!1));function Dn(e){const t=Object.keys(e);if(1!==t.length)throw new Error(`Please provide an object with a single key (operation name) mapping to a function. Got an object with ${t.length} keys.`);let n=t[0];const a=e[n];n.endsWith("_")&&(n=n.substring(0,n.length-1)),n+="__op";const r=(...e)=>{xn.startScope(n);try{const t=a(...e);return yt(t)&&console.error("Cannot return a Promise inside of tidy."),xn.endScope(t),t}catch(e){throw xn.endScope(null),e}};return Object.defineProperty(r,"name",{value:n,configurable:!0}),r}class Nn{static join(e){return new Nn(e).slice()}constructor(e){if(this.shards=[],this.previousShardIndex=0,null==e)return;if(e instanceof Array||(e=[e]),0===(e=e.map((e=>Ut(e)?e.buffer:e))).length)return;this.bufferUniformSize=e[0].byteLength;let t=0;for(let n=0;n<e.length;n++){const a=e[n];n!==e.length-1&&a.byteLength!==this.bufferUniformSize&&(this.bufferUniformSize=void 0);const r=t+a.byteLength;this.shards.push({buffer:a,start:t,end:r}),t=r}0===this.shards.length&&(this.byteLength=0),this.byteLength=this.shards[this.shards.length-1].end}slice(e=0,t=this.byteLength){if(0===this.shards.length)return new ArrayBuffer(0);if(e=isNaN(Number(e))?0:e,t=isNaN(Number(t))?0:t,e=Math.max(0,e),(t=Math.min(this.byteLength,t))<=e)return new ArrayBuffer(0);const n=this.findShardForByte(e);if(-1===n)throw new Error(`Could not find start shard for byte ${e}`);const a=new ArrayBuffer(t-e),r=new Uint8Array(a);let i=0;for(let a=n;a<this.shards.length;a++){const n=this.shards[a],o=e+i-n.start,s=i,l=Math.min(t,n.end),u=new Uint8Array(n.buffer,o,l-n.start-o);if(r.set(u,s),i+=u.length,t<n.end)break}return a}findShardForByte(e){if(0===this.shards.length||e<0||e>=this.byteLength)return-1;if(null!=this.bufferUniformSize)return this.previousShardIndex=Math.floor(e/this.bufferUniformSize),this.previousShardIndex;function t(t){return e<t.start?-1:e>=t.end?1:0}if(0===t(this.shards[this.previousShardIndex]))return this.previousShardIndex;const n=function(e,t){let n=0,a=e.length;for(;n<=a;){const r=Math.floor((a-n)/2)+n,i=t(e[r]);if(0===i)return r;i<0?a=r:n=r+1}return-1}(this.shards,t);return-1===n?-1:(this.previousShardIndex=n,this.previousShardIndex)}}const An="undefined"!=typeof Buffer&&("undefined"==typeof Blob||"undefined"==typeof atob||"undefined"==typeof btoa);function Ln(e){return An?Buffer.byteLength(e,"utf8"):new Blob([e]).size}function Rn(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("Expected JSON model topology, received ArrayBuffer.");return{dateSaved:new Date,modelTopologyType:"JSON",modelTopologyBytes:null==e.modelTopology?0:Ln(JSON.stringify(e.modelTopology)),weightSpecsBytes:null==e.weightSpecs?0:Ln(JSON.stringify(e.weightSpecs)),weightDataBytes:null==e.weightData?0:new Nn(e.weightData).byteLength}}class On{constructor(){this.saveRouters=[],this.loadRouters=[]}static getInstance(){return null==On.instance&&(On.instance=new On),On.instance}static registerSaveRouter(e){On.getInstance().saveRouters.push(e)}static registerLoadRouter(e){On.getInstance().loadRouters.push(e)}static getSaveHandlers(e){return On.getHandlers(e,"save")}static getLoadHandlers(e,t){return On.getHandlers(e,"load",t)}static getHandlers(e,t,n){const a=[];return("load"===t?On.getInstance().loadRouters:On.getInstance().saveRouters).forEach((t=>{const r=t(e,n);null!==r&&a.push(r)})),a}}const Fn="tensorflowjs",jn="models_store",Pn="model_info_store";function Bn(){if(!wt().getBool("IS_BROWSER"))throw new Error("Failed to obtain IndexedDB factory because the current environmentis not a web browser.");const e="undefined"==typeof window?self:window,t=e.indexedDB||e.mozIndexedDB||e.webkitIndexedDB||e.msIndexedDB||e.shimIndexedDB;if(null==t)throw new Error("The current browser does not appear to support IndexedDB.");return t}function _n(e){const t=e.result;t.createObjectStore(jn,{keyPath:"modelPath"}),t.createObjectStore(Pn,{keyPath:"modelPath"})}class Un{constructor(e){if(this.indexedDB=Bn(),null==e||!e)throw new Error("For IndexedDB, modelPath must not be null, undefined or empty.");this.modelPath=e}async save(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");return this.databaseAction(this.modelPath,e)}async load(){return this.databaseAction(this.modelPath)}databaseAction(e,t){return new Promise(((e,n)=>{const a=this.indexedDB.open(Fn,1);a.onupgradeneeded=()=>_n(a),a.onsuccess=()=>{const r=a.result;if(null==t){const t=r.transaction(jn,"readonly"),a=t.objectStore(jn).get(this.modelPath);a.onsuccess=()=>{if(null==a.result)return r.close(),n(new Error(`Cannot find model with path '${this.modelPath}' in IndexedDB.`));e(a.result.modelArtifacts)},a.onerror=e=>(r.close(),n(a.error)),t.oncomplete=()=>r.close()}else{const a=Rn(t),i=r.transaction(Pn,"readwrite");let o,s,l=i.objectStore(Pn);try{o=l.put({modelPath:this.modelPath,modelArtifactsInfo:a})}catch(e){return n(e)}o.onsuccess=()=>{s=r.transaction(jn,"readwrite");const o=s.objectStore(jn);let u;try{u=o.put({modelPath:this.modelPath,modelArtifacts:t,modelArtifactsInfo:a})}catch(e){return n(e)}u.onsuccess=()=>e({modelArtifactsInfo:a}),u.onerror=e=>{l=i.objectStore(Pn);const t=l.delete(this.modelPath);t.onsuccess=()=>(r.close(),n(u.error)),t.onerror=e=>(r.close(),n(u.error))}},o.onerror=e=>(r.close(),n(o.error)),i.oncomplete=()=>{null==s?r.close():s.oncomplete=()=>r.close()}}},a.onerror=e=>n(a.error)}))}}Un.URL_SCHEME="indexeddb://";const zn=e=>{return wt().getBool("IS_BROWSER")&&!Array.isArray(e)&&e.startsWith(Un.URL_SCHEME)?(t=e.slice(Un.URL_SCHEME.length),new Un(t)):null;var t};On.registerSaveRouter(zn),On.registerLoadRouter(zn);class Gn{constructor(){this.indexedDB=Bn()}async listModels(){return new Promise(((e,t)=>{const n=this.indexedDB.open(Fn,1);n.onupgradeneeded=()=>_n(n),n.onsuccess=()=>{const a=n.result,r=a.transaction(Pn,"readonly"),i=r.objectStore(Pn).getAll();i.onsuccess=()=>{const t={};for(const e of i.result)t[e.modelPath]=e.modelArtifactsInfo;e(t)},i.onerror=e=>(a.close(),t(i.error)),r.oncomplete=()=>a.close()},n.onerror=e=>t(n.error)}))}async removeModel(e){var t;return e=(t=e).startsWith(Un.URL_SCHEME)?t.slice(Un.URL_SCHEME.length):t,new Promise(((t,n)=>{const a=this.indexedDB.open(Fn,1);a.onupgradeneeded=()=>_n(a),a.onsuccess=()=>{const r=a.result,i=r.transaction(Pn,"readwrite"),o=i.objectStore(Pn),s=o.get(e);let l;s.onsuccess=()=>{if(null==s.result)return r.close(),n(new Error(`Cannot find model with path '${e}' in IndexedDB.`));{const a=o.delete(e),i=()=>{l=r.transaction(jn,"readwrite");const a=l.objectStore(jn).delete(e);a.onsuccess=()=>t(s.result.modelArtifactsInfo),a.onerror=e=>n(s.error)};a.onsuccess=i,a.onerror=e=>(i(),r.close(),n(s.error))}},s.onerror=e=>(r.close(),n(s.error)),i.oncomplete=()=>{null==l?r.close():l.oncomplete=()=>r.close()}},a.onerror=e=>n(a.error)}))}}const Wn="/",$n="tensorflowjs_models",Vn="info",qn="model_topology",Hn="weight_specs",Yn="weight_data",Zn="model_metadata";function Qn(e){return{info:[$n,e,Vn].join(Wn),topology:[$n,e,qn].join(Wn),weightSpecs:[$n,e,Hn].join(Wn),weightData:[$n,e,Yn].join(Wn),modelMetadata:[$n,e,Zn].join(Wn)}}function Xn(e){for(const t of Object.values(e))window.localStorage.removeItem(t)}function Kn(e){const t=e.split(Wn);if(t.length<3)throw new Error(`Invalid key format: ${e}`);return t.slice(1,t.length-1).join(Wn)}class Jn{constructor(e){if(!wt().getBool("IS_BROWSER")||"undefined"==typeof window||void 0===window.localStorage)throw new Error("The current environment does not support local storage.");if(this.LS=window.localStorage,null==e||!e)throw new Error("For local storage, modelPath must not be null, undefined or empty.");this.modelPath=e,this.keys=Qn(this.modelPath)}async save(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");{const t=JSON.stringify(e.modelTopology),n=JSON.stringify(e.weightSpecs),a=Rn(e),r=Nn.join(e.weightData);try{this.LS.setItem(this.keys.info,JSON.stringify(a)),this.LS.setItem(this.keys.topology,t),this.LS.setItem(this.keys.weightSpecs,n),this.LS.setItem(this.keys.weightData,function(e){if(An)return Buffer.from(e).toString("base64");const t=new Uint8Array(e);let n="";for(let e=0,a=t.length;e<a;e++)n+=String.fromCharCode(t[e]);return btoa(n)}(r));return this.LS.setItem(this.keys.modelMetadata,JSON.stringify({format:e.format,generatedBy:e.generatedBy,convertedBy:e.convertedBy,signature:null!=e.signature?e.signature:void 0,userDefinedMetadata:null!=e.userDefinedMetadata?e.userDefinedMetadata:void 0,modelInitializer:null!=e.modelInitializer?e.modelInitializer:void 0,initializerSignature:null!=e.initializerSignature?e.initializerSignature:void 0,trainingConfig:null!=e.trainingConfig?e.trainingConfig:void 0})),{modelArtifactsInfo:a}}catch(e){throw Xn(this.keys),new Error(`Failed to save model '${this.modelPath}' to local storage: size quota being exceeded is a possible cause of this failure: modelTopologyBytes=${a.modelTopologyBytes}, weightSpecsBytes=${a.weightSpecsBytes}, weightDataBytes=${a.weightDataBytes}.`)}}}async load(){const e=JSON.parse(this.LS.getItem(this.keys.info));if(null==e)throw new Error(`In local storage, there is no model with name '${this.modelPath}'`);if("JSON"!==e.modelTopologyType)throw new Error("BrowserLocalStorage does not support loading non-JSON model topology yet.");const t={},n=JSON.parse(this.LS.getItem(this.keys.topology));if(null==n)throw new Error(`In local storage, the topology of model '${this.modelPath}' is missing.`);t.modelTopology=n;const a=JSON.parse(this.LS.getItem(this.keys.weightSpecs));if(null==a)throw new Error(`In local storage, the weight specs of model '${this.modelPath}' are missing.`);t.weightSpecs=a;const r=this.LS.getItem(this.keys.modelMetadata);if(null!=r){const e=JSON.parse(r);t.format=e.format,t.generatedBy=e.generatedBy,t.convertedBy=e.convertedBy,null!=e.signature&&(t.signature=e.signature),null!=e.userDefinedMetadata&&(t.userDefinedMetadata=e.userDefinedMetadata),null!=e.modelInitializer&&(t.modelInitializer=e.modelInitializer),null!=e.initializerSignature&&(t.initializerSignature=e.initializerSignature),null!=e.trainingConfig&&(t.trainingConfig=e.trainingConfig)}const i=this.LS.getItem(this.keys.weightData);if(null==i)throw new Error(`In local storage, the binary weight values of model '${this.modelPath}' are missing.`);return t.weightData=function(e){if(An){const t=Buffer.from(e,"base64");return t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}const t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;++e)n.set([t.charCodeAt(e)],e);return n.buffer}(i),t}}Jn.URL_SCHEME="localstorage://";const ea=e=>{return wt().getBool("IS_BROWSER")&&!Array.isArray(e)&&e.startsWith(Jn.URL_SCHEME)?(t=e.slice(Jn.URL_SCHEME.length),new Jn(t)):null;var t};On.registerSaveRouter(ea),On.registerLoadRouter(ea);class ta{constructor(){it(wt().getBool("IS_BROWSER"),(()=>"Current environment is not a web browser")),it("undefined"==typeof window||void 0!==window.localStorage,(()=>"Current browser does not appear to support localStorage")),this.LS=window.localStorage}async listModels(){const e={},t=$n+Wn,n=Wn+Vn;for(let a=0;a<this.LS.length;++a){const r=this.LS.key(a);if(r.startsWith(t)&&r.endsWith(n)){e[Kn(r)]=JSON.parse(this.LS.getItem(r))}}return e}async removeModel(e){var t;const n=Qn(e=(t=e).startsWith(Jn.URL_SCHEME)?t.slice(Jn.URL_SCHEME.length):t);if(null==this.LS.getItem(n.info))throw new Error(`Cannot find model at path '${e}'`);const a=JSON.parse(this.LS.getItem(n.info));return Xn(n),a}}class na{constructor(){this.managers={}}static getInstance(){return null==na.instance&&(na.instance=new na),na.instance}static registerManager(e,t){it(null!=e,(()=>"scheme must not be undefined or null.")),e.endsWith("://")&&(e=e.slice(0,e.indexOf("://"))),it(e.length>0,(()=>"scheme must not be an empty string."));const n=na.getInstance();it(null==n.managers[e],(()=>`A model store manager is already registered for scheme '${e}'.`)),n.managers[e]=t}static getManager(e){const t=na.getInstance().managers[e];if(null==t)throw new Error(`Cannot find model manager for scheme '${e}'`);return t}static getSchemes(){return Object.keys(na.getInstance().managers)}}class aa{constructor(){this.messageName="setTimeoutCustom",this.functionRefs=[],this.handledMessageCount=0,this.hasEventListener=!1}fetch(e,t){return fetch(e,t)}now(){return performance.now()}encode(e,t){if("utf-8"!==t&&"utf8"!==t)throw new Error(`Browser's encoder only supports utf-8, but got ${t}`);return null==this.textEncoder&&(this.textEncoder=new TextEncoder),this.textEncoder.encode(e)}decode(e,t){return new TextDecoder(t).decode(e)}setTimeoutCustom(e,t){"undefined"!=typeof window&&wt().getBool("USE_SETTIMEOUTCUSTOM")?(this.functionRefs.push(e),setTimeout((()=>{window.postMessage({name:this.messageName,index:this.functionRefs.length-1},"*")}),t),this.hasEventListener||(this.hasEventListener=!0,window.addEventListener("message",(e=>{if(e.source===window&&e.data.name===this.messageName){e.stopPropagation();(0,this.functionRefs[e.data.index])(),this.handledMessageCount++,this.handledMessageCount===this.functionRefs.length&&(this.functionRefs=[],this.handledMessageCount=0)}}),!0))):setTimeout(e,t)}isTypedArray(e){return jt(e)}}if(wt().get("IS_BROWSER")){wt().setPlatform("browser",new aa);try{na.registerManager(Jn.URL_SCHEME,new ta)}catch(e){}try{na.registerManager(Un.URL_SCHEME,new Gn)}catch(e){}}const ra=()=>require("node-fetch");let ia;class oa{constructor(){this.util=require("util"),this.textEncoder=new this.util.TextEncoder}fetch(e,t){return null!=wt().global.fetch?wt().global.fetch(e,t):(null==ia&&(ia=ra()),ia(e,t))}now(){const e=process.hrtime();return 1e3*e[0]+e[1]/1e6}encode(e,t){if("utf-8"!==t&&"utf8"!==t)throw new Error(`Node built-in encoder only supports utf-8, but got ${t}`);return this.textEncoder.encode(e)}decode(e,t){return 0===e.length?"":new this.util.TextDecoder(t).decode(e)}isTypedArray(e){return this.util.types.isFloat32Array(e)||this.util.types.isInt32Array(e)||this.util.types.isUint8Array(e)||this.util.types.isUint8ClampedArray(e)}}wt().get("IS_NODE")&&!wt().get("IS_BROWSER")&&wt().setPlatform("node",new oa);const sa=Dn({cast_:function(e,t){const n=Sn(e,"x","cast");if(!function(e){return"bool"===e||"complex64"===e||"float32"===e||"int32"===e||"string"===e}(t))throw new Error(`Failed to cast to unknown dtype ${t}`);if("string"===t&&"string"!==n.dtype||"string"!==t&&"string"===n.dtype)throw new Error("Only strings can be casted to strings");return xn.runKernel(St,{x:n},{dtype:t})}});const la=Dn({clone_:function(e){const t=Sn(e,"x","clone","string_or_numeric");return xn.runKernel(Dt,{x:t})}});bn();const ua={buffer:function(e,t="float32",n){return t=t||"float32",vt(e),new Jt(e,t,n)},cast:sa,clone:la,print:function(e,t=!1){console.log(e.toString(t))}};function da(e,t){return xn.tidy(e,t)}function ca(e){pn(e).forEach((e=>e.dispose()))}tn=ua;const fa=Dn({add_:function(e,t){let n=Sn(e,"a","add"),a=Sn(t,"b","add");return[n,a]=hn(n,a),xn.runKernel(It,{a:n,b:a})}});const ha=Dn({floorDiv_:function(e,t){let n=Sn(e,"a","floorDiv"),a=Sn(t,"b","floorDiv");return[n,a]=hn(n,a),xn.runKernel("FloorDiv",{a:n,b:a})}});const pa=Dn({div_:function(e,t){let n=Sn(e,"a","div"),a=Sn(t,"b","div");return[n,a]=hn(n,a),"int32"===n.dtype&&"int32"===a.dtype?ha(n,a):xn.runKernel("RealDiv",{a:n,b:a},{})}});const ma=Dn({mul_:function(e,t){let n=Sn(e,"a","mul"),a=Sn(t,"b","mul");return[n,a]=hn(n,a),xn.runKernel("Multiply",{a:n,b:a})}});const ga=Dn({abs_:function(e){const t=Sn(e,"x","abs");if("complex64"===t.dtype){return xn.runKernel("ComplexAbs",{x:t})}return xn.runKernel("Abs",{x:t})}});const va=Dn({zerosLike_:function(e){const t=Sn(e,"x","zerosLike");return xn.runKernel("ZerosLike",{x:t})}});const ya=Dn({pow_:function(e,t){let n=Sn(e,"base","pow"),a=Sn(t,"exp","pow");return[n,a]=hn(n,a),xn.runKernel("Pow",{a:n,b:a})}});function ba(e,t){if((Ut(e)&&"string"!==t||Array.isArray(e))&&"complex64"!==t)throw new Error("Error creating a new Scalar: value must be a primitive (number|boolean|string)");if("string"===t&&Ut(e)&&!(e instanceof Uint8Array))throw new Error("When making a scalar from encoded string, the value must be `Uint8Array`.");return function(e,t,n,a){if(null==a)a=ct(e);else if("complex64"===a)throw new Error("Cannot construct a complex64 tensor directly. Please use tf.complex(real, imag).");if(fn(e)||cn(e)){if("float32"!==a&&"int32"!==a)throw new Error(`Creating tensor from GPU data only supports 'float32'|'int32' dtype, while the dtype is ${a}.`);return xn.backend.createTensorFromGPUData(e,t||n,a)}if(!Ut(e)&&!Array.isArray(e)&&"number"!=typeof e&&"boolean"!=typeof e&&"string"!=typeof e)throw new Error("values passed to tensor(values) must be a number/boolean/string or an array of numbers/booleans/strings, or a TypedArray");if(null!=t){vt(t);const e=ot(t),a=ot(n);it(e===a,(()=>`Based on the provided shape, [${t}], the tensor should have ${e} values but has ${a}`));for(let e=0;e<n.length;++e){const a=e!==n.length-1||n[e]!==ot(t.slice(e));it(n[e]===t[e]||!a,(()=>`Error creating a new Tensor. Inferred shape (${n}) does not match the provided shape (${t}). `))}}return Ut(e)||Array.isArray(e)||(e=[e]),t=t||n,e="string"!==a?Pt(e,a):zt(e,[],!0),xn.makeTensor(e,t,a)}(e,[],[],t)}const xa=Dn({sqrt_:function(e){const t=Sn(e,"x","sqrt","float32");return xn.runKernel("Sqrt",{x:t})}});const Ca=Dn({square_:function(e){const t=Sn(e,"x","square");return xn.runKernel("Square",{x:t},{})}});const wa=Dn({sub_:function(e,t){let n=Sn(e,"a","sub"),a=Sn(t,"b","sub");return[n,a]=hn(n,a),xn.runKernel("Sub",{a:n,b:a})}});const Ea=Dn({maximum_:function(e,t){let n=Sn(e,"a","maximum"),a=Sn(t,"b","maximum");return[n,a]=hn(n,a),"bool"===n.dtype&&(n=sa(n,"int32"),a=sa(a,"int32")),function(e,t){const n=Math.max(e.length,t.length),a=new Array(n);for(let r=0;r<n;r++){let i=e[e.length-r-1];null==i&&(i=1);let o=t[t.length-r-1];if(null==o&&(o=1),1===i)a[n-r-1]=o;else if(1===o)a[n-r-1]=i;else{if(i!==o)throw Error(`Operands could not be broadcast together with shapes ${e} and ${t}.`);a[n-r-1]=i}}}(n.shape,a.shape),xn.runKernel("Maximum",{a:n,b:a})}});class ka{getClassName(){return this.constructor.className}static fromConfig(e,t){return new e(t)}}class Ta{constructor(){this.classNameMap={}}static getMap(){return null==Ta.instance&&(Ta.instance=new Ta),Ta.instance}static register(e){Ta.getMap().classNameMap[e.className]=[e,e.fromConfig]}}function Ma(e){it(null!=e.className,(()=>"Class being registered does not have the static className property defined.")),it("string"==typeof e.className,(()=>"className is required to be a string, but got type "+typeof e.className)),it(e.className.length>0,(()=>"Class being registered has an empty-string as its className, which is disallowed.")),Ta.register(e)}class Ia extends ka{minimize(e,t=!1,n){const{value:a,grads:r}=this.computeGradients(e,n);if(null!=n){const e=n.map((e=>({name:e.name,tensor:r[e.name]})));this.applyGradients(e)}else this.applyGradients(r);return ca(r),t?a:(a.dispose(),null)}get iterations(){return null==this.iterations_&&(this.iterations_=0),this.iterations_}incrementIterations(){this.iterations_=this.iterations+1}computeGradients(e,t){return function(e,t){it(ft(e),(()=>"The f passed in variableGrads(f) must be a function")),it(null==t||Array.isArray(t)&&t.every((e=>e instanceof an)),(()=>"The varList passed in variableGrads(f, varList) must be an array of variables"));const n=null!=t;if(!n){t=[];for(const e in xn.registeredVariables)t.push(xn.registeredVariables[e])}const a=n?t.filter((e=>!e.trainable)):null,r=t.length;it((t=t.filter((e=>e.trainable))).length>0,(()=>`variableGrads() expects at least one of the input variables to be trainable, but none of the ${r} variables is trainable.`));const{value:i,grads:o}=xn.gradients(e,t,null,!0);it(o.some((e=>null!=e)),(()=>"Cannot find a connection between any variable and the result of the loss function y=f(x). Please make sure the operations that use variables are inside the function f passed to minimize().")),it(0===i.rank,(()=>`The f passed in variableGrads(f) must return a scalar, but it returned a rank-${i.rank} tensor`));const s={};return t.forEach(((e,t)=>{null!=o[t]&&(s[e.name]=o[t])})),null!=a&&a.forEach((e=>s[e.name]=null)),{value:i,grads:s}}(e,t)}dispose(){null!=this.iterations_&&ca(this.iterations_)}async saveIterations(){return null==this.iterations_&&(this.iterations_=0),{name:"iter",tensor:ba(this.iterations_,"int32")}}async getWeights(){throw new Error("getWeights() is not implemented for this optimizer yet.")}async setWeights(e){throw new Error(`setWeights() is not implemented for this optimizer class ${this.getClassName()}`)}async extractIterations(e){return this.iterations_=(await e[0].tensor.data())[0],e.slice(1)}}Object.defineProperty(Ia,Symbol.hasInstance,{value:e=>null!=e.minimize&&null!=e.computeGradients&&null!=e.applyGradients});class Sa extends Ia{static get className(){return"SGD"}constructor(e){super(),this.learningRate=e,this.setLearningRate(e)}applyGradients(e){const t=Array.isArray(e)?e.map((e=>e.name)):Object.keys(e);t.forEach(((t,n)=>{const a=Array.isArray(e)?e[n].tensor:e[t];if(null==a)return;const r=xn.registeredVariables[t];da((()=>{const e=fa(ma(this.c,a),r);r.assign(e)}))})),this.incrementIterations()}setLearningRate(e){var t;this.learningRate=e,null!=this.c&&this.c.dispose(),this.c=(t=ba(-e),xn.keep(t))}dispose(){this.c.dispose()}async getWeights(){return[await this.saveIterations()]}async setWeights(e){if(0!==(e=await this.extractIterations(e)).length)throw new Error("SGD optimizer does not have settable weights.")}getConfig(){return{learningRate:this.learningRate}}static fromConfig(e,t){return new e(t.learningRate)}}const Da=[class extends Ia{static get className(){return"Adadelta"}constructor(e,t,n=null){super(),this.learningRate=e,this.rho=t,this.epsilon=n,this.accumulatedGrads=[],this.accumulatedUpdates=[],null==n&&(this.epsilon=xn.backend.epsilon())}applyGradients(e){(Array.isArray(e)?e.map((e=>e.name)):Object.keys(e)).forEach(((t,n)=>{const a=xn.registeredVariables[t];null==this.accumulatedGrads[n]&&(this.accumulatedGrads[n]={originalName:`${t}/accum_grad`,variable:da((()=>va(a).variable(false)))}),null==this.accumulatedUpdates[n]&&(this.accumulatedUpdates[n]={originalName:`${t}/accum_var`,variable:da((()=>va(a).variable(false)))});const r=Array.isArray(e)?e[n].tensor:e[t];if(null==r)return;const i=this.accumulatedGrads[n].variable,o=this.accumulatedUpdates[n].variable;da((()=>{const e=fa(ma(i,this.rho),ma(Ca(r),1-this.rho)),t=ma(pa(xa(fa(o,this.epsilon)),xa(fa(i,this.epsilon))),r),n=fa(ma(o,this.rho),ma(Ca(t),1-this.rho));i.assign(e),o.assign(n);const s=fa(ma(t,-this.learningRate),a);a.assign(s)}))})),this.incrementIterations()}dispose(){null!=this.accumulatedUpdates&&(ca(this.accumulatedGrads.map((e=>e.variable))),ca(this.accumulatedUpdates.map((e=>e.variable))))}async getWeights(){const e=[...this.accumulatedGrads,...this.accumulatedUpdates];return[await this.saveIterations()].concat(e.map((e=>({name:e.originalName,tensor:e.variable}))))}async setWeights(e){const t=(e=await this.extractIterations(e)).length/2;this.accumulatedGrads=e.slice(0,t).map((e=>({originalName:e.name,variable:e.tensor.variable(false)}))),this.accumulatedUpdates=e.slice(t,2*t).map((e=>({originalName:e.name,variable:e.tensor.variable(false)})))}getConfig(){return{learningRate:this.learningRate,rho:this.rho,epsilon:this.epsilon}}static fromConfig(e,t){return new e(t.learningRate,t.rho,t.epsilon)}},class extends Ia{static get className(){return"Adagrad"}constructor(e,t=.1){super(),this.learningRate=e,this.initialAccumulatorValue=t,this.accumulatedGrads=[]}applyGradients(e){(Array.isArray(e)?e.map((e=>e.name)):Object.keys(e)).forEach(((t,n)=>{const a=xn.registeredVariables[t];if(null==this.accumulatedGrads[n]){const e=!1;this.accumulatedGrads[n]={originalName:`${t}/accumulator`,variable:da((()=>function(e,t,n){return vt(e),n=n||ct(t),xn.runKernel("Fill",{},{shape:e,value:t,dtype:n})}(a.shape,this.initialAccumulatorValue).variable(e)))}}const r=Array.isArray(e)?e[n].tensor:e[t];if(null==r)return;const i=this.accumulatedGrads[n].variable;da((()=>{const e=fa(i,Ca(r));i.assign(e);const t=fa(ma(pa(r,xa(fa(e,xn.backend.epsilon()))),-this.learningRate),a);a.assign(t)}))})),this.incrementIterations()}dispose(){null!=this.accumulatedGrads&&ca(this.accumulatedGrads.map((e=>e.variable)))}async getWeights(){return[await this.saveIterations()].concat(this.accumulatedGrads.map((e=>({name:e.originalName,tensor:e.variable}))))}async setWeights(e){e=await this.extractIterations(e);this.accumulatedGrads=e.map((e=>({originalName:e.name,variable:e.tensor.variable(false)})))}getConfig(){return{learningRate:this.learningRate,initialAccumulatorValue:this.initialAccumulatorValue}}static fromConfig(e,t){return new e(t.learningRate,t.initialAccumulatorValue)}},class extends Ia{static get className(){return"Adam"}constructor(e,t,n,a=null){super(),this.learningRate=e,this.beta1=t,this.beta2=n,this.epsilon=a,this.accumulatedFirstMoment=[],this.accumulatedSecondMoment=[],da((()=>{this.accBeta1=ba(t).variable(),this.accBeta2=ba(n).variable()})),null==a&&(this.epsilon=xn.backend.epsilon())}applyGradients(e){const t=Array.isArray(e)?e.map((e=>e.name)):Object.keys(e);da((()=>{const n=wa(1,this.accBeta1),a=wa(1,this.accBeta2);t.forEach(((t,r)=>{const i=xn.registeredVariables[t];null==this.accumulatedFirstMoment[r]&&(this.accumulatedFirstMoment[r]={originalName:`${t}/m`,variable:da((()=>va(i).variable(false)))}),null==this.accumulatedSecondMoment[r]&&(this.accumulatedSecondMoment[r]={originalName:`${t}/v`,variable:da((()=>va(i).variable(false)))});const o=Array.isArray(e)?e[r].tensor:e[t];if(null==o)return;const s=this.accumulatedFirstMoment[r].variable,l=this.accumulatedSecondMoment[r].variable,u=fa(ma(s,this.beta1),ma(o,1-this.beta1)),d=fa(ma(l,this.beta2),ma(Ca(o),1-this.beta2)),c=pa(u,n),f=pa(d,a);s.assign(u),l.assign(d);const h=fa(ma(pa(c,fa(xa(f),this.epsilon)),-this.learningRate),i);i.assign(h)})),this.accBeta1.assign(ma(this.accBeta1,this.beta1)),this.accBeta2.assign(ma(this.accBeta2,this.beta2))})),this.incrementIterations()}dispose(){this.accBeta1.dispose(),this.accBeta2.dispose(),null!=this.accumulatedFirstMoment&&ca(this.accumulatedFirstMoment.map((e=>e.variable))),null!=this.accumulatedSecondMoment&&ca(this.accumulatedSecondMoment.map((e=>e.variable)))}async getWeights(){const e=[...this.accumulatedFirstMoment,...this.accumulatedSecondMoment];return[await this.saveIterations()].concat(e.map((e=>({name:e.originalName,tensor:e.variable}))))}async setWeights(e){e=await this.extractIterations(e),da((()=>{this.accBeta1.assign(ya(this.beta1,this.iterations_+1)),this.accBeta2.assign(ya(this.beta2,this.iterations_+1))}));const t=e.length/2;this.accumulatedFirstMoment=e.slice(0,t).map((e=>({originalName:e.name,variable:e.tensor.variable(false)}))),this.accumulatedSecondMoment=e.slice(t,2*t).map((e=>({originalName:e.name,variable:e.tensor.variable(false)})))}getConfig(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon}}static fromConfig(e,t){return new e(t.learningRate,t.beta1,t.beta2,t.epsilon)}},class extends Ia{static get className(){return"Adamax"}constructor(e,t,n,a=null,r=0){super(),this.learningRate=e,this.beta1=t,this.beta2=n,this.epsilon=a,this.decay=r,this.accumulatedFirstMoment=[],this.accumulatedWeightedInfNorm=[],da((()=>{this.iteration=ba(0).variable(),this.accBeta1=ba(t).variable()})),null==a&&(this.epsilon=xn.backend.epsilon())}applyGradients(e){const t=Array.isArray(e)?e.map((e=>e.name)):Object.keys(e);da((()=>{const n=wa(1,this.accBeta1),a=pa(-this.learningRate,fa(ma(this.iteration,this.decay),1));t.forEach(((t,r)=>{const i=xn.registeredVariables[t];null==this.accumulatedFirstMoment[r]&&(this.accumulatedFirstMoment[r]={originalName:`${t}/m`,variable:va(i).variable(false)}),null==this.accumulatedWeightedInfNorm[r]&&(this.accumulatedWeightedInfNorm[r]={originalName:`${t}/v`,variable:va(i).variable(false)});const o=Array.isArray(e)?e[r].tensor:e[t];if(null==o)return;const s=this.accumulatedFirstMoment[r].variable,l=this.accumulatedWeightedInfNorm[r].variable,u=fa(ma(s,this.beta1),ma(o,1-this.beta1)),d=ma(l,this.beta2),c=ga(o),f=Ea(d,c);s.assign(u),l.assign(f);const h=fa(ma(pa(a,n),pa(u,fa(f,this.epsilon))),i);i.assign(h)})),this.iteration.assign(fa(this.iteration,1)),this.accBeta1.assign(ma(this.accBeta1,this.beta1))})),this.incrementIterations()}dispose(){this.accBeta1.dispose(),this.iteration.dispose(),null!=this.accumulatedFirstMoment&&ca(this.accumulatedFirstMoment.map((e=>e.variable))),null!=this.accumulatedWeightedInfNorm&&ca(this.accumulatedWeightedInfNorm.map((e=>e.variable)))}async getWeights(){throw new Error("getWeights() is not implemented for Adamax yet.")}async setWeights(e){throw new Error("setWeights() is not implemented for Adamax yet.")}getConfig(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon,decay:this.decay}}static fromConfig(e,t){return new e(t.learningRate,t.beta1,t.beta2,t.epsilon,t.decay)}},class extends Sa{static get className(){return"Momentum"}constructor(e,t,n=!1){super(e),this.learningRate=e,this.momentum=t,this.useNesterov=n,this.accumulations=[],this.m=ba(this.momentum)}applyGradients(e){(Array.isArray(e)?e.map((e=>e.name)):Object.keys(e)).forEach(((t,n)=>{const a=xn.registeredVariables[t];if(null==this.accumulations[n]){const e=!1;this.accumulations[n]={originalName:`${t}/momentum`,variable:da((()=>va(a).variable(e)))}}const r=this.accumulations[n].variable,i=Array.isArray(e)?e[n].tensor:e[t];null!=i&&da((()=>{let e;const t=fa(ma(this.m,r),i);e=fa(ma(this.c,this.useNesterov?fa(i,ma(t,this.m)):t),a),r.assign(t),a.assign(e)}))})),this.incrementIterations()}dispose(){this.m.dispose(),null!=this.accumulations&&ca(this.accumulations.map((e=>e.variable)))}setMomentum(e){this.momentum=e}async getWeights(){return[await this.saveIterations()].concat(this.accumulations.map((e=>({name:e.originalName,tensor:e.variable}))))}async setWeights(e){e=await this.extractIterations(e);this.accumulations=e.map((e=>({originalName:e.name,variable:e.tensor.variable(false)})))}getConfig(){return{learningRate:this.learningRate,momentum:this.momentum,useNesterov:this.useNesterov}}static fromConfig(e,t){return new e(t.learningRate,t.momentum,t.useNesterov)}},class extends Ia{static get className(){return"RMSProp"}constructor(e,t=.9,n=0,a=null,r=!1){if(super(),this.learningRate=e,this.decay=t,this.momentum=n,this.epsilon=a,this.accumulatedMeanSquares=[],this.accumulatedMoments=[],this.accumulatedMeanGrads=[],this.centered=r,null==a&&(this.epsilon=xn.backend.epsilon()),null==e)throw new Error("learningRate for RMSPropOptimizer must be defined.")}applyGradients(e){(Array.isArray(e)?e.map((e=>e.name)):Object.keys(e)).forEach(((t,n)=>{const a=xn.registeredVariables[t],r=!1;null==this.accumulatedMeanSquares[n]&&(this.accumulatedMeanSquares[n]={originalName:`${t}/rms`,variable:da((()=>va(a).variable(r)))}),null==this.accumulatedMoments[n]&&(this.accumulatedMoments[n]={originalName:`${t}/momentum`,variable:da((()=>va(a).variable(r)))}),null==this.accumulatedMeanGrads[n]&&this.centered&&(this.accumulatedMeanGrads[n]={originalName:`${t}/mg`,variable:da((()=>va(a).variable(r)))});const i=Array.isArray(e)?e[n].tensor:e[t];if(null==i)return;const o=this.accumulatedMeanSquares[n].variable,s=this.accumulatedMoments[n].variable;da((()=>{const e=fa(ma(o,this.decay),ma(Ca(i),1-this.decay));if(this.centered){const t=this.accumulatedMeanGrads[n].variable,r=fa(ma(t,this.decay),ma(i,1-this.decay)),l=pa(ma(i,this.learningRate),xa(wa(e,fa(Ca(r),this.epsilon)))),u=fa(ma(s,this.momentum),l);o.assign(e),t.assign(r),s.assign(u);const d=wa(a,u);a.assign(d)}else{const e=fa(ma(o,this.decay),ma(Ca(i),1-this.decay)),t=fa(ma(s,this.momentum),pa(ma(i,this.learningRate),xa(fa(e,this.epsilon))));o.assign(e),s.assign(t);const n=wa(a,t);a.assign(n)}}))})),this.incrementIterations()}dispose(){null!=this.accumulatedMeanSquares&&ca(this.accumulatedMeanSquares.map((e=>e.variable))),null!=this.accumulatedMeanGrads&&this.centered&&ca(this.accumulatedMeanGrads.map((e=>e.variable))),null!=this.accumulatedMoments&&ca(this.accumulatedMoments.map((e=>e.variable)))}async getWeights(){const e=[...this.accumulatedMeanSquares,...this.accumulatedMoments];return this.centered&&e.push(...this.accumulatedMeanGrads),[await this.saveIterations()].concat(e.map((e=>({name:e.originalName,tensor:e.variable}))))}async setWeights(e){e=await this.extractIterations(e);const t=this.centered?e.length/3:e.length/2,n=!1;this.accumulatedMeanSquares=e.slice(0,t).map((e=>({originalName:e.name,variable:e.tensor.variable(n)}))),this.accumulatedMoments=e.slice(t,2*t).map((e=>({originalName:e.name,variable:e.tensor.variable(n)}))),this.centered&&(this.accumulatedMeanGrads=e.slice(2*t,3*t).map((e=>({originalName:e.name,variable:e.tensor.variable(n)}))))}getConfig(){return{learningRate:this.learningRate,decay:this.decay,momentum:this.momentum,epsilon:this.epsilon,centered:this.centered}}static fromConfig(e,t){return new e(t.learningRate,t.decay,t.momentum,t.epsilon,t.centered)}},Sa];!function(){for(const e of Da)Ma(e)}();const Na={},Aa={alpha:!1,antialias:!1,premultipliedAlpha:!1,preserveDrawingBuffer:!1,depth:!1,stencil:!1,failIfMajorPerformanceCaveat:!0};function La(e,t){if(!(e in Na)||null!=t){const n=function(e,t){if(1!==e&&2!==e)throw new Error("Cannot get WebGL rendering context, WebGL is disabled.");const n=null==t?function(e){if(wt().getBool("IS_SAFARI")||"undefined"==typeof OffscreenCanvas||2!==e){if("undefined"!=typeof document)return document.createElement("canvas");throw new Error("Cannot create a canvas in this context")}return new OffscreenCanvas(300,150)}(e):t;n.addEventListener("webglcontextlost",(t=>{t.preventDefault(),delete Na[e]}),!1),wt().getBool("SOFTWARE_WEBGL_ENABLED")&&(Aa.failIfMajorPerformanceCaveat=!1);if(1===e)return n.getContext("webgl",Aa)||n.getContext("experimental-webgl",Aa);return n.getContext("webgl2",Aa)}(e,t);if(null===n)return console.log("Could not get context for WebGL version",e),null;Na[e]=n}const n=Na[e];return null==n||n.isContextLost()?(delete Na[e],La(e)):(n.disable(n.DEPTH_TEST),n.disable(n.STENCIL_TEST),n.disable(n.BLEND),n.disable(n.DITHER),n.disable(n.POLYGON_OFFSET_FILL),n.disable(n.SAMPLE_COVERAGE),n.enable(n.SCISSOR_TEST),n.enable(n.CULL_FACE),n.cullFace(n.BACK),Na[e])}var Ra="https://websdk-cdn-dev.idmission.com/assets";function Oa(e,t,n,a){if(!e||!t)return"";var r=e.getContext("2d"),i=t.getContext("2d");if(!r||!i)throw new Error("could not get 2d context");e.width=n.width,e.height=n.height,r.putImageData(n,0,0);var o=a.box,s=o.width,l=.6*n.height-s,u=Math.max(0,o.xMin-l/2);En()?(t.width=n.width,t.height=n.height,i.drawImage(e,0,0,t.width,t.height)):(t.width=s+l,t.height=n.height,i.drawImage(e,u,0,t.width,t.height,0,0,t.width,t.height));var d=t.toDataURL("image/jpeg",.92);return ze(e),ze(t),d}function Fa(e,t,n){n||(n=document.createElement("canvas"));var a=n.getContext("2d");if(!a)throw new Error("could not get 2d context");var r=Pe(e),i=r[0],o=r[1],s=t[0],l=t[1],u=t[2],d=t[3];return n.width=u*i,n.height=d*o,a.drawImage(e,s*i,l*o,u*i,d*o,0,0,u*i,d*o),n}var ja=self;function Pa(){throw Error("Invalid UTF8")}function Ba(e,t){return t=String.fromCharCode.apply(null,t),null==e?t:e+t}let _a,Ua;const za="undefined"!=typeof TextDecoder;let Ga;const Wa="undefined"!=typeof TextEncoder;function $a(e){if(Wa)e=(Ga||=new TextEncoder).encode(e);else{let n=0;const a=new Uint8Array(3*e.length);for(let r=0;r<e.length;r++){var t=e.charCodeAt(r);if(128>t)a[n++]=t;else{if(2048>t)a[n++]=t>>6|192;else{if(55296<=t&&57343>=t){if(56319>=t&&r<e.length){const i=e.charCodeAt(++r);if(56320<=i&&57343>=i){a[n++]=(t=1024*(t-55296)+i-56320+65536)>>18|240,a[n++]=t>>12&63|128,a[n++]=t>>6&63|128,a[n++]=63&t|128;continue}r--}t=65533}a[n++]=t>>12|224,a[n++]=t>>6&63|128}a[n++]=63&t|128}}e=n===a.length?a:a.subarray(0,n)}return e}var Va,qa;e:{for(var Ha=["CLOSURE_FLAGS"],Ya=ja,Za=0;Za<Ha.length;Za++)if(null==(Ya=Ya[Ha[Za]])){qa=null;break e}qa=Ya}var Qa,Xa=qa&&qa[610401301];Va=null!=Xa&&Xa;const Ka=ja.navigator;function Ja(e){return!!Va&&!!Qa&&Qa.brands.some((({brand:t})=>t&&-1!=t.indexOf(e)))}function er(e){var t;return(t=ja.navigator)&&(t=t.userAgent)||(t=""),-1!=t.indexOf(e)}function tr(){return!!Va&&!!Qa&&0<Qa.brands.length}function nr(){return tr()?Ja("Chromium"):(er("Chrome")||er("CriOS"))&&!(!tr()&&er("Edge"))||er("Silk")}Qa=Ka&&Ka.userAgentData||null;var ar=!tr()&&(er("Trident")||er("MSIE"));!er("Android")||nr(),nr(),er("Safari")&&(nr()||!tr()&&er("Coast")||!tr()&&er("Opera")||!tr()&&er("Edge")||(tr()?Ja("Microsoft Edge"):er("Edg/"))||tr()&&Ja("Opera"));var rr={},ir=null;function or(){if(!ir){ir={};for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),t=["+/=","+/","-_=","-_.","-_"],n=0;5>n;n++){var a=e.concat(t[n].split(""));rr[n]=a;for(var r=0;r<a.length;r++){var i=a[r];void 0===ir[i]&&(ir[i]=r)}}}}var sr="undefined"!=typeof Uint8Array,lr=!ar&&"function"==typeof btoa;function ur(e){if(!lr){var t;void 0===t&&(t=0),or(),t=rr[t];var n=Array(Math.floor(e.length/3)),a=t[64]||"";let l=0,u=0;for(;l<e.length-2;l+=3){var r=e[l],i=e[l+1],o=e[l+2],s=t[r>>2];n[u++]=s+(r=t[(3&r)<<4|i>>4])+(i=t[(15&i)<<2|o>>6])+(o=t[63&o])}switch(s=0,o=a,e.length-l){case 2:o=t[(15&(s=e[l+1]))<<2]||a;case 1:n[u]=t[(e=e[l])>>2]+t[(3&e)<<4|s>>4]+o+a}return n.join("")}for(t="",n=0,a=e.length-10240;n<a;)t+=String.fromCharCode.apply(null,e.subarray(n,n+=10240));return t+=String.fromCharCode.apply(null,n?e.subarray(n):e),btoa(t)}const dr=/[-_.]/g,cr={"-":"+",_:"/",".":"="};function fr(e){return cr[e]||""}function hr(e){if(!lr)return function(e){var t=e.length,n=3*t/4;n%3?n=Math.floor(n):-1!="=.".indexOf(e[t-1])&&(n=-1!="=.".indexOf(e[t-2])?n-2:n-1);var a=new Uint8Array(n),r=0;return function(e,t){function n(t){for(;a<e.length;){var n=e.charAt(a++),r=ir[n];if(null!=r)return r;if(!/^[\s\xa0]*$/.test(n))throw Error("Unknown base64 encoding at char: "+n)}return t}or();for(var a=0;;){var r=n(-1),i=n(0),o=n(64),s=n(64);if(64===s&&-1===r)break;t(r<<2|i>>4),64!=o&&(t(i<<4&240|o>>2),64!=s&&t(o<<6&192|s))}}(e,(function(e){a[r++]=e})),r!==n?a.subarray(0,r):a}(e);dr.test(e)&&(e=e.replace(dr,fr)),e=atob(e);const t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}function pr(e){return sr&&null!=e&&e instanceof Uint8Array}let mr;function gr(){return mr||=new Uint8Array(0)}var vr={};let yr;function br(e){if(e!==vr)throw Error("illegal external caller")}function xr(){return yr||=new wr(null,vr)}function Cr(e){br(vr);var t=e.N;return null==(t=null==t||pr(t)?t:"string"==typeof t?hr(t):null)?t:e.N=t}var wr=class{constructor(e,t){if(br(t),this.N=e,null!=e&&0===e.length)throw Error("ByteString should be constructed with non-empty values")}ha(){const e=Cr(this);return e?new Uint8Array(e):gr()}};function Er(e,t){return Error(`Invalid wire type: ${e} (at position ${t})`)}function kr(){return Error("Failed to read varint, encoding is invalid.")}function Tr(e,t){return Error(`Tried to read past the end of the data ${t} > ${e}`)}function Mr(e){return 0==e.length?xr():new wr(e,vr)}function Ir(e){if("string"==typeof e)return{buffer:hr(e),H:!1};if(Array.isArray(e))return{buffer:new Uint8Array(e),H:!1};if(e.constructor===Uint8Array)return{buffer:e,H:!1};if(e.constructor===ArrayBuffer)return{buffer:new Uint8Array(e),H:!1};if(e.constructor===wr)return{buffer:Cr(e)||gr(),H:!0};if(e instanceof Uint8Array)return{buffer:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),H:!1};throw Error("Type not convertible to a Uint8Array, expected a Uint8Array, an ArrayBuffer, a base64 encoded string, a ByteString or an Array of numbers")}const Sr="function"==typeof Uint8Array.prototype.slice;let Dr,Nr=0,Ar=0;function Lr(e){const t=0>e;let n=(e=Math.abs(e))>>>0;if(e=Math.floor((e-n)/4294967296),t){const[t,a]=Pr(n,e);e=a,n=t}Nr=n>>>0,Ar=e>>>0}function Rr(e){const t=Dr||=new DataView(new ArrayBuffer(8));t.setFloat32(0,+e,!0),Ar=0,Nr=t.getUint32(0,!0)}function Or(e,t){return 4294967296*t+(e>>>0)}function Fr(e,t){const n=2147483648&t;return n&&(t=~t>>>0,0==(e=1+~e>>>0)&&(t=t+1>>>0)),e=Or(e,t),n?-e:e}function jr(e){if(16>e.length)Lr(Number(e));else if("function"==typeof BigInt)e=BigInt(e),Nr=Number(e&BigInt(4294967295))>>>0,Ar=Number(e>>BigInt(32)&BigInt(4294967295));else{const t=+("-"===e[0]);Ar=Nr=0;const n=e.length;for(let a=t,r=(n-t)%6+t;r<=n;a=r,r+=6){const t=Number(e.slice(a,r));Ar*=1e6,Nr=1e6*Nr+t,4294967296<=Nr&&(Ar+=Math.trunc(Nr/4294967296),Ar>>>=0,Nr>>>=0)}if(t){const[e,t]=Pr(Nr,Ar);Nr=e,Ar=t}}}function Pr(e,t){return t=~t,e?e=1+~e:t+=1,[e,t]}function Br(e,t,{R:n=!1}={}){e.R=n,t&&(t=Ir(t),e.h=t.buffer,e.s=t.H,e.v=0,e.l=e.h.length,e.g=e.v)}function _r(e,t){if(e.g=t,t>e.l)throw Tr(e.l,t)}function Ur(e,t){let n,a=0,r=0,i=0;const o=e.h;let s=e.g;do{n=o[s++],a|=(127&n)<<i,i+=7}while(32>i&&128&n);for(32<i&&(r|=(127&n)>>4),i=3;32>i&&128&n;i+=7)n=o[s++],r|=(127&n)<<i;if(_r(e,s),128>n)return t(a>>>0,r>>>0);throw kr()}function zr(e){let t=0,n=e.g;const a=n+10,r=e.h;for(;n<a;){const a=r[n++];if(t|=a,0==(128&a))return _r(e,n),!!(127&t)}throw kr()}function Gr(e){var t=e.h;const n=e.g,a=t[n],r=t[n+1],i=t[n+2];return t=t[n+3],_r(e,e.g+4),(a<<0|r<<8|i<<16|t<<24)>>>0}function Wr(e,t){if(0>t)throw Error(`Tried to read a negative byte length: ${t}`);const n=e.g,a=n+t;if(a>e.l)throw Tr(t,e.l-n);return e.g=a,n}function $r(e,t){if(0==t)return xr();var n=Wr(e,t);return e.R&&e.s?n=e.h.subarray(n,n+t):(e=e.h,n=n===(t=n+t)?gr():Sr?e.slice(n,t):new Uint8Array(e.subarray(n,t))),Mr(n)}var Vr=class{constructor(e,t){this.h=null,this.s=!1,this.g=this.l=this.v=0,Br(this,e,t)}m(){const e=this.h;let t=this.g,n=e[t++],a=127&n;if(128&n&&(n=e[t++],a|=(127&n)<<7,128&n&&(n=e[t++],a|=(127&n)<<14,128&n&&(n=e[t++],a|=(127&n)<<21,128&n&&(n=e[t++],a|=n<<28,128&n&&128&e[t++]&&128&e[t++]&&128&e[t++]&&128&e[t++]&&128&e[t++])))))throw kr();return _r(this,t),a}j(){return this.m()>>>0}A(){var e=Gr(this);const t=2*(e>>31)+1,n=e>>>23&255;return e&=8388607,255==n?e?NaN:1/0*t:0==n?t*Math.pow(2,-149)*e:t*Math.pow(2,n-150)*(e+Math.pow(2,23))}C(){return this.m()}},qr=[];function Hr(e){var t=e.g;if(t.g==t.l)return!1;e.l=e.g.g;var n=e.g.j();if(t=n>>>3,!(0<=(n&=7)&&5>=n))throw Er(n,e.l);if(1>t)throw Error(`Invalid field number: ${t} (at position ${e.l})`);return e.m=t,e.h=n,!0}function Yr(e){switch(e.h){case 0:0!=e.h?Yr(e):zr(e.g);break;case 1:_r(e=e.g,e.g+8);break;case 2:if(2!=e.h)Yr(e);else{var t=e.g.j();_r(e=e.g,e.g+t)}break;case 5:_r(e=e.g,e.g+4);break;case 3:for(t=e.m;;){if(!Hr(e))throw Error("Unmatched start-group tag: stream EOF");if(4==e.h){if(e.m!=t)throw Error("Unmatched end-group tag");break}Yr(e)}break;default:throw Er(e.h,e.l)}}function Zr(e,t,n){const a=e.g.l,r=e.g.j(),i=e.g.g+r;let o=i-a;if(0>=o&&(e.g.l=i,n(t,e,void 0,void 0,void 0),o=i-e.g.g),o)throw Error(`Message parsing ended unexpectedly. Expected to read ${r} bytes, instead read ${r-o} bytes, either the data ended unexpectedly or the message misreported its own length`);return e.g.g=i,e.g.l=a,t}function Qr(e){var t=e.g.j(),n=Wr(e=e.g,t);if(e=e.h,za){var a,r=e;(a=Ua)||(a=Ua=new TextDecoder("utf-8",{fatal:!0})),e=n+t,r=0===n&&e===r.length?r:r.subarray(n,e);try{var i=a.decode(r)}catch(e){if(void 0===_a){try{a.decode(new Uint8Array([128]))}catch(e){}try{a.decode(new Uint8Array([97])),_a=!0}catch(e){_a=!1}}throw!_a&&(Ua=void 0),e}}else{t=(i=n)+t,n=[];let s,l=null;for(;i<t;){var o=e[i++];128>o?n.push(o):224>o?i>=t?Pa():(s=e[i++],194>o||128!=(192&s)?(i--,Pa()):n.push((31&o)<<6|63&s)):240>o?i>=t-1?Pa():(s=e[i++],128!=(192&s)||224===o&&160>s||237===o&&160<=s||128!=(192&(r=e[i++]))?(i--,Pa()):n.push((15&o)<<12|(63&s)<<6|63&r)):244>=o?i>=t-2?Pa():(s=e[i++],128!=(192&s)||0!=s-144+(o<<28)>>30||128!=(192&(r=e[i++]))||128!=(192&(a=e[i++]))?(i--,Pa()):(o=(7&o)<<18|(63&s)<<12|(63&r)<<6|63&a,n.push(55296+((o-=65536)>>10&1023),56320+(1023&o)))):Pa(),8192<=n.length&&(l=Ba(l,n),n.length=0)}i=Ba(l,n)}return i}function Xr(e){const t=e.g.j();return $r(e.g,t)}function Kr(e,t,n){var a=e.g.j();for(a=e.g.g+a;e.g.g<a;)n.push(t.call(e.g))}var Jr=[];function ei(e){return e?/^\d+$/.test(e)?(jr(e),new ti(Nr,Ar)):null:ni||=new ti(0,0)}var ti=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}};let ni;function ai(e){return e?/^-?\d+$/.test(e)?(jr(e),new ri(Nr,Ar)):null:ii||=new ri(0,0)}var ri=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}};let ii;function oi(e,t,n){for(;0<n||127<t;)e.g.push(127&t|128),t=(t>>>7|n<<25)>>>0,n>>>=7;e.g.push(t)}function si(e,t){for(;127<t;)e.g.push(127&t|128),t>>>=7;e.g.push(t)}function li(e,t){if(0<=t)si(e,t);else{for(let n=0;9>n;n++)e.g.push(127&t|128),t>>=7;e.g.push(1)}}function ui(e,t){e.g.push(t>>>0&255),e.g.push(t>>>8&255),e.g.push(t>>>16&255),e.g.push(t>>>24&255)}function di(e,t){0!==t.length&&(e.l.push(t),e.h+=t.length)}function ci(e,t,n){si(e.g,8*t+n)}function fi(e,t){return ci(e,t,2),t=e.g.end(),di(e,t),t.push(e.h),t}function hi(e,t){var n=t.pop();for(n=e.h+e.g.length()-n;127<n;)t.push(127&n|128),n>>>=7,e.h++;t.push(n),e.h++}function pi(e,t,n){ci(e,t,2),si(e.g,n.length),di(e,e.g.end()),di(e,n)}function mi(e,t,n,a){null!=n&&(t=fi(e,t),a(n,e),hi(e,t))}class gi{constructor(e,t,n){this.g=e,this.h=t,this.l=n}}function vi(e){return Array.prototype.slice.call(e)}const yi="function"==typeof Symbol&&"symbol"==typeof Symbol()?Symbol():void 0;var bi=yi?(e,t)=>{e[yi]|=t}:(e,t)=>{void 0!==e.D?e.D|=t:Object.defineProperties(e,{D:{value:t,configurable:!0,writable:!0,enumerable:!1}})};function xi(e){const t=wi(e);1!=(1&t)&&(Object.isFrozen(e)&&(e=vi(e)),ki(e,1|t))}var Ci=yi?(e,t)=>{e[yi]&=~t}:(e,t)=>{void 0!==e.D&&(e.D&=~t)},wi=yi?e=>0|e[yi]:e=>0|e.D,Ei=yi?e=>e[yi]:e=>e.D,ki=yi?(e,t)=>{e[yi]=t}:(e,t)=>{void 0!==e.D?e.D=t:Object.defineProperties(e,{D:{value:t,configurable:!0,writable:!0,enumerable:!1}})};function Ti(){var e=[];return bi(e,1),e}function Mi(e){return bi(e,34),e}function Ii(e,t){ki(t,-255&(0|e))}function Si(e,t){ki(t,-221&(34|e))}function Di(e){return 0==(e=e>>11&1023)?536870912:e}var Ni,Ai={};function Li(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)&&e.constructor===Object}function Ri(e,t,n){if(null!=e)if("string"==typeof e)e=e?new wr(e,vr):xr();else if(e.constructor!==wr)if(pr(e))e=n?Mr(e):e.length?new wr(new Uint8Array(e),vr):xr();else{if(!t)throw Error();e=void 0}return e}const Oi=[];function Fi(e){if(2&e)throw Error()}ki(Oi,55),Ni=Object.freeze(Oi);class ji{constructor(e,t,n){this.l=0,this.g=e,this.h=t,this.m=n}next(){if(this.l<this.g.length){const e=this.g[this.l++];return{done:!1,value:this.h?this.h.call(this.m,e):e}}return{done:!0,value:void 0}}[Symbol.iterator](){return new ji(this.g,this.h,this.m)}}var Pi={};let Bi,_i;function Ui(e,t){(t=Bi?t[Bi]:void 0)&&(e[Bi]=vi(t))}function zi(e,t){e.__closure__error__context__984382||(e.__closure__error__context__984382={}),e.__closure__error__context__984382.severity=t}function Gi(e){return null==e?e:"number"==typeof e||"NaN"===e||"Infinity"===e||"-Infinity"===e?Number(e):void 0}function Wi(e){return null==e?e:"boolean"==typeof e||"number"==typeof e?!!e:void 0}function $i(e){return"number"==typeof e&&Number.isFinite(e)||!!e&&"string"==typeof e&&isFinite(e)}function Vi(e){if(null==e)return e;if("string"==typeof e){if(!e)return;e=+e}return"number"==typeof e?e:void 0}function qi(e){if(null==e)return e;if("string"==typeof e){if(!e)return;e=+e}return"number"==typeof e?e:void 0}function Hi(e){if("string"!=typeof e)throw Error();return e}function Yi(e){if(null!=e&&"string"!=typeof e)throw Error();return e}function Zi(e){return null==e||"string"==typeof e?e:void 0}function Qi(e,t,n,a){var r=!1;return null==e||"object"!=typeof e||(r=Array.isArray(e))||e.M!==Ai?r?(0===(r=n=wi(e))&&(r|=32&a),(r|=2&a)!==n&&ki(e,r),new t(e)):(n?2&a?(e=t[Xi])?t=e:(Mi((e=new t).u),t=t[Xi]=e):t=new t:t=void 0,t):e}const Xi="function"==typeof Symbol&&"symbol"==typeof Symbol()?Symbol():"di";function Ki(e){return e}function Ji(e,t,n){return"string"==typeof(e="number"==(t=typeof e)||"string"===t?e:n?0:void 0)&&(n=+e,Number.isSafeInteger(n))?n:e}let eo,to,no;function ao(e){switch(typeof e){case"boolean":return to||=[0,void 0,!0];case"number":return 0<e?void 0:0===e?no||=[0,void 0]:[-e,void 0];case"string":return[0,e];case"object":return e}}function ro(e,t){return io(e,t[0],t[1])}function io(e,t,n){if(null==e&&(e=eo),eo=void 0,null==e){var a=96;n?(e=[n],a|=512):e=[],t&&(a=-2095105&a|(1023&t)<<11)}else{if(!Array.isArray(e))throw Error();if(64&(a=wi(e)))return _i&&delete e[_i],e;if(a|=64,n&&(a|=512,n!==e[0]))throw Error();e:{var r=(n=e).length;if(r){const e=r-1;var i=n[e];if(Li(i)){1024<=(r=e-(t=+!!(512&(a|=256))-1))&&(oo(n,t,i),r=1023),a=-2095105&a|(1023&r)<<11;break e}}t&&(i=+!!(512&a)-1,1024<(t=Math.max(t,r-i))&&(oo(n,i,{}),a|=256,t=1023),a=-2095105&a|(1023&t)<<11)}}return ki(e,a),e}function oo(e,t,n){const a=1023+t,r=e.length;for(let i=a;i<r;i++){const a=e[i];null!=a&&a!==n&&(n[i-t]=a)}e.length=a+1,e[a]=n}function so(e){if(2&e.g)throw Error("Cannot mutate an immutable Map")}var lo=class extends Map{constructor(e,t,n=Ki,a=Ki){super();let r=wi(e);r|=64,ki(e,r),this.g=r,this.l=t,this.h=n||Ki,this.j=this.l?uo:a||Ki;for(let i=0;i<e.length;i++){const o=e[i],s=n(o[0],!1,!0);let l=o[1];t?void 0===l&&(l=null):l=a(o[1],!1,!0,void 0,void 0,r),super.set(s,l)}}s(e=co){return this.m(e)}m(e=co){const t=[],n=super.entries();for(var a;!(a=n.next()).done;)(a=a.value)[0]=e(a[0]),a[1]=e(a[1]),t.push(a);return t}clear(){so(this),super.clear()}delete(e){return so(this),super.delete(this.h(e,!0,!1))}entries(){var e=this.A();return new ji(e,fo,this)}keys(){return this.C()}values(){var e=this.A();return new ji(e,lo.prototype.get,this)}forEach(e,t){super.forEach(((n,a)=>{e.call(t,this.get(a),a,this)}))}set(e,t){return so(this),null==(e=this.h(e,!0,!1))?this:null==t?(super.delete(e),this):super.set(e,this.j(t,!0,!0,this.l,!1,this.g))}I(e){const t=this.h(e[0],!1,!0);e=e[1],e=this.l?void 0===e?null:e:this.j(e,!1,!0,void 0,!1,this.g),super.set(t,e)}has(e){return super.has(this.h(e,!1,!1))}get(e){e=this.h(e,!1,!1);const t=super.get(e);if(void 0!==t){var n=this.l;return n?((n=this.j(t,!1,!0,n,this.v,this.g))!==t&&super.set(e,n),n):t}}A(){return Array.from(super.keys())}C(){return super.keys()}[Symbol.iterator](){return this.entries()}};function uo(e,t,n,a,r,i){return e=Qi(e,a,n,i),r&&(e=xo(e)),e}function co(e){return e}function fo(e){return[e,this.get(e)]}function ho(e,t,n,a,r,i){if(null!=e){if(Array.isArray(e))e=r&&0==e.length&&1&wi(e)?void 0:i&&2&wi(e)?e:po(e,t,n,void 0!==a,r,i);else if(Li(e)){const o={};for(let s in e)o[s]=ho(e[s],t,n,a,r,i);e=o}else e=t(e,a);return e}}function po(e,t,n,a,r,i){const o=a||n?wi(e):0;a=a?!!(32&o):void 0;const s=vi(e);for(let e=0;e<s.length;e++)s[e]=ho(s[e],t,n,a,r,i);return n&&(Ui(s,e),n(o,s)),s}function mo(e){return ho(e,go,void 0,void 0,!1,!1)}function go(e){return e.M===Ai?e.toJSON():e instanceof lo?e.s(mo):function(e){switch(typeof e){case"number":return isFinite(e)?e:String(e);case"boolean":return e?1:0;case"object":if(e&&!Array.isArray(e)){if(pr(e))return ur(e);if(e instanceof wr){const t=e.N;return null==t?"":"string"==typeof t?t:e.N=ur(t)}if(e instanceof lo)return e.s()}}return e}(e)}function vo(e,t,n=Si){if(null!=e){if(sr&&e instanceof Uint8Array)return t?e:new Uint8Array(e);if(Array.isArray(e)){var a=wi(e);return 2&a?e:(t&&=0===a||!!(32&a)&&!(64&a||!(16&a)),t?(ki(e,34|a),4&a&&Object.freeze(e),e):po(e,vo,4&a?Si:n,!0,!1,!0))}return e.M===Ai?e=2&(a=Ei(n=e.u))?e:yo(e,n,a,!0):e instanceof lo&&(n=Mi(e.m(vo)),e=new lo(n,e.l,e.h,e.j)),e}}function yo(e,t,n,a){return e=e.constructor,eo=t=bo(t,n,a),t=new e(t),eo=void 0,t}function bo(e,t,n){const a=n||2&t?Si:Ii,r=!!(32&t);return e=function(e,t,n){const a=vi(e);var r=a.length;const i=256&t?a[r-1]:void 0;for(r+=i?-1:0,t=512&t?1:0;t<r;t++)a[t]=n(a[t]);if(i){t=a[t]={};for(const e in i)t[e]=n(i[e])}return Ui(a,e),a}(e,t,(e=>vo(e,r,a))),bi(e,32|(n?2:0)),e}function xo(e){const t=e.u,n=Ei(t);return 2&n?yo(e,t,n,!1):e}function Co(e,t){return wo(e=e.u,Ei(e),t)}function wo(e,t,n,a){if(-1===n)return null;if(n>=Di(t)){if(256&t)return e[e.length-1][n]}else{var r=e.length;if(a&&256&t&&null!=(a=e[r-1][n]))return a;if((t=n+(+!!(512&t)-1))<r)return e[t]}}function Eo(e,t,n,a){const r=e.u,i=Ei(r);return Fi(i),ko(r,i,t,n,a),e}function ko(e,t,n,a,r){var i=Di(t);if(n>=i||r){if(r=t,256&t)i=e[e.length-1];else{if(null==a)return;i=e[i+(+!!(512&t)-1)]={},r|=256}i[n]=a,r!==t&&ki(e,r)}else e[n+(+!!(512&t)-1)]=a,256&t&&n in(e=e[e.length-1])&&delete e[n]}function To(e,t,n,a,r){var i=2&t;let o=wo(e,t,n,r);Array.isArray(o)||(o=Ni);const s=!(2&a),l=!(1&a);a=!!(32&t);let u=wi(o);return 0!==u||!a||i||s?1&u||(u|=1,ki(o,u)):(u|=33,ki(o,u)),i?(2&u||Mi(o),l&&Object.freeze(o)):(i=2&u,l&&i?(o=vi(o),i=1,a&&!s&&(i|=32),ki(o,i),ko(e,t,n,o,r)):s&&32&u&&!i&&Ci(o,32)),o}function Mo(e,t){const n=Ei(e=e.u),a=wo(e,n,t),r=Gi(a);return null!=r&&r!==a&&ko(e,n,t,r),r}function Io(e){const t=Ei(e=e.u),n=wo(e,t,1),a=Ri(n,!0,!!(34&t));return null!=a&&a!==n&&ko(e,t,1,a),a}function So(e,t,n){const a=Ei(e=e.u),r=2&a;let i=To(e,a,t,1),o=wi(i);if(!(4&o)){Object.isFrozen(i)&&(i=vi(i),ki(i,o=-3&o|32),ko(e,a,t,i));let s=0,l=0;for(;s<i.length;s++){const e=n(i[s]);null!=e&&(i[l++]=e)}l<s&&(i.length=l),o|=21,r?o|=34:o&=-33,ki(i,o),2&o&&Object.freeze(i)}return!r&&(2&o||Object.isFrozen(i))&&(i=vi(i),ki(i,-35&o),ko(e,a,t,i)),i}let Do;function No(){return Do??=new lo(Mi([]),void 0,void 0,void 0,Pi)}function Ao(e){e=vi(e);for(let t=0;t<e.length;t++){const n=e[t]=vi(e[t]);Array.isArray(n[1])&&(n[1]=Mi(n[1]))}return e}function Lo(e,t,n){{const a=Ei(e=e.u);if(Fi(a),null==n)ko(e,a,t);else{if(!(4&wi(n))){Object.isFrozen(n)&&(n=vi(n));for(let e=0;e<n.length;e++)n[e]=Hi(n[e]);ki(n,5)}ko(e,a,t,n)}}}function Ro(e,t){return Oo(e=e.u,Ei(e),Eu)===t?t:-1}function Oo(e,t,n){let a=0;for(let r=0;r<n.length;r++){const i=n[r];null!=wo(e,t,i)&&(0!==a&&ko(e,t,a),a=i)}return a}function Fo(e,t,n,a){const r=Ei(e);Fi(r);const i=wo(e,r,n,a);let o;if(null!=i&&i.M===Ai)return(t=xo(i))!==i&&ko(e,r,n,t,a),t.u;if(Array.isArray(i)){const e=wi(i);o=2&e?bo(i,e,!1):i,o=ro(o,t)}else o=ro(void 0,t);return o!==i&&ko(e,r,n,o,a),o}function jo(e,t,n,a){const r=Ei(e=e.u),i=wo(e,r,n,a);return(t=Qi(i,t,!1,r))!==i&&null!=t&&ko(e,r,n,t,a),t}function Po(e,t,n,a=!1){if(null==(t=jo(e,t,n,a)))return t;const r=Ei(e=e.u);if(!(2&r)){const i=xo(t);i!==t&&ko(e,r,n,t=i,a)}return t}function Bo(e,t,n,a,r){var i=!!(2&t),o=To(e,t,a,1),s=o===Ni;if(s&&2!==r)return o;if(s||!(4&wi(o))){var l=o;o=!!(2&t),s=!!(2&wi(l)),i=l,!o&&s&&(l=vi(l));var u=t|((s=s||void 0)?2:0),d=s;s=!1;let c=0,f=0;for(;c<l.length;c++){const e=Qi(l[c],n,!1,u);if(null==e)continue;const t=!!(2&wi(e.u));d=d||t,s=s||!t,l[f++]=e}return f<c&&(l.length=f),u=5|(l=wi(n=l)),d=d?-9&u:8|u,l!=(d=s?-17&d:16|d)&&(Object.isFrozen(n)&&(n=vi(n)),ki(n,d)),i!==(l=n)&&ko(e,t,a,l),(o&&2!==r||1===r)&&Object.freeze(l),l}return 3===r||(i?2===r&&(r=wi(o),o=vi(o),ki(o,r),ko(e,t,a,o)):(i=Object.isFrozen(o),1===r?i||Object.freeze(o):(n=-33&(r=wi(o)),i||2&r?(o=vi(o),ki(o,-3&n),ko(e,t,a,o)):r!==n&&ki(o,n)))),o}function _o(e,t,n){var a=e.u;const r=Ei(a);if(t=Bo(a,r,t,n,(e=!!(2&r))?1:2),!(e||8&wi(t))){for(n=0;n<t.length;n++)(e=t[n])!==(a=xo(e))&&(t[n]=a);bi(t,8)}return t}function Uo(e,t,n,a,r){return null==a&&(a=void 0),Eo(e,n,a,r)}function zo(e,t,n,a){null==a&&(a=void 0);const r=Ei(e=e.u);Fi(r),(n=Oo(e,r,n))&&n!==t&&null!=a&&ko(e,r,n),ko(e,r,t,a)}function Go(e,t,n){const a=Ei(e=e.u);Fi(a),e=Bo(e,a,t,1,2),t=null!=n?n:new t,e.push(t),2&wi(t.u)?Ci(e,8):Ci(e,16)}function Wo(e,t){return Vi(Co(e,t))}function $o(e){return null==(e=Co(e,2))||$i(e)?e:void 0}function Vo(e,t){return Zi(Co(e,t))}function qo(e){return e??0}function Ho(e,t){return qo(Mo(e,t))}function Yo(e,t,n){if(null!=n){if("boolean"!=typeof n)throw e=typeof n,Error(`Expected boolean but got ${"object"!=e?e:n?Array.isArray(n)?"array":e:"null"}: ${n}`);n=!!n}Eo(e,t,n)}function Zo(e,t,n){if(null!=n){if("number"!=typeof n)throw zi(e=Error(),"warning"),e;if(!Number.isFinite(n)){const e=Error();zi(e,"incident"),function(e){ja.setTimeout((()=>{throw e}),0)}(e)}}Eo(e,t,n)}function Qo(e,t,n){if(null!=n&&"number"!=typeof n)throw Error(`Value of float/double field must be a number, found ${typeof n}: ${n}`);Eo(e,t,n)}function Xo(e,t,n){n=Hi(n);const a=Ei(e=e.u);Fi(a),To(e,a,t,2).push(n)}function Ko(e,t,n){t.g?t.m(e,t.g,t.h,n,!0):t.m(e,t.h,n,!0)}lo.prototype.toJSON=void 0;var Jo=class{constructor(e,t){this.u=io(e,t)}toJSON(){return es(this,po(this.u,go,void 0,void 0,!1,!1),!0)}l(){var e=bd;return e.g?e.l(this,e.g,e.h,!0):e.l(this,e.h,e.defaultValue,!0)}clone(){const e=this.u;return yo(this,e,Ei(e),!1)}H(){return!!(2&wi(this.u))}};function es(e,t,n){var a=e.constructor.B,r=Di(Ei(n?e.u:t)),i=!1;if(a){if(!n){var o;if((t=vi(t)).length&&Li(o=t[t.length-1]))for(i=0;i<a.length;i++)if(a[i]>=r){Object.assign(t[t.length-1]={},o);break}i=!0}var s;r=t,n=!n,e=Di(o=Ei(e.u)),o=+!!(512&o)-1;for(let t=0;t<a.length;t++){var l=a[t];if(l<e){var u=r[l+=o];null==u?r[l]=n?Ni:Ti():n&&u!==Ni&&xi(u)}else{if(!s){var d=void 0;r.length&&Li(d=r[r.length-1])?s=d:r.push(s={})}u=s[l],null==s[l]?s[l]=n?Ni:Ti():n&&u!==Ni&&xi(u)}}}if(!(a=t.length))return t;let c,f;if(Li(s=t[a-1])){e:{var h=s;d={},r=!1;for(let e in h)n=h[e],Array.isArray(n)&&n!=n&&(r=!0),null!=n?d[e]=n:r=!0;if(r){for(let e in d){h=d;break e}h=null}}h!=s&&(c=!0),a--}for(;0<a&&null==(s=t[a-1]);a--)f=!0;return c||f?(t=i?t:Array.prototype.slice.call(t,0,a),i&&(t.length=a),h&&t.push(h),t):t}function ts(e){return{ca:Qs,U:e}}function ns(e,t){if(Array.isArray(t)){var n=wi(t);if(4&n)return t;for(var a=0,r=0;a<t.length;a++){const n=e(t[a]);null!=n&&(t[r++]=n)}return r<a&&(t.length=r),ki(t,5|n),2&n&&Object.freeze(t),t}}Jo.prototype.M=Ai,Jo.prototype.toString=function(){return es(this,this.u,!1).toString()};const as=Symbol();function rs(e){let t=e[as];if(!t){const n=ds(e),a=Cs(e),r=a.h;t=r?(e,t)=>r(e,t,a):(e,t)=>{for(;Hr(t)&&4!=t.h;){var r=t.m,i=a[r];if(!i){var o=a.g;o&&(o=o[r])&&(i=a[r]=is(o))}i&&i(t,e,r)||(r=(i=t).l,Yr(i),i.aa?i=void 0:(o=i.g.g-r,i.g.g=r,i=$r(i.g,o)),r=e,i&&(Bi||=Symbol(),(o=r[Bi])?o.push(i):r[Bi]=[i]))}for(const t in n){e[_i||=Symbol()]=n;break}},e[as]=t}return t}function is(e){const t=function(e){if(e=e.U)return rs(e)}(e),n=e.ca.g;if(t){const a=Cs(e.U).L;return(e,r,i)=>n(e,r,i,a,t)}return(e,t,a)=>n(e,t,a)}const os=Symbol();function ss(e,t,n,a){let r;if(a){const t=a[os];r=t?t.L:ao(a[0]),n[e]=t??a}r&&r===to?((t=n.xa)||(n.xa=t=[]),t.push(e)):t.l&&((t=n.Ba)||(n.Ba=t=[]),t.push(e))}function ls(e,t,n,a){ss(e,t,a)}function us(e,t,n,a,r){ss(e,t,r,n)}function ds(e){let t=e[os];return t||(t=e[os]={},cs(e,t,ls,us,t))}function cs(e,t,n,a,r){t.L=ao(e[0]);let i=1;if(e.length>i&&!(e[i]instanceof gi)){var o=e[i++];if(Array.isArray(o))return t.h=o[0],t.g=o[1],t;t.g=o}for(o=0;i<e.length;){var s=e[i++],l=e[i];for("number"==typeof l?(i++,o+=l):o++,l=i;l<e.length&&!(e[l]instanceof gi);)l++;if(l-=i){var u=e,d=i,c=u[d];if("function"==typeof c&&(c=c(),u[d]=c),(u=Array.isArray(c))&&!(u=ys in c||ps in c)&&(u=0<c.length)){const e=ao(d=(u=c)[0]);null!=e&&e!==d&&(u[0]=e),u=null!=e}(c=u?c:void 0)?(i++,1===l?void 0!==(s=a(o,s,c,void 0,r))&&(t[o]=s):void 0!==(s=a(o,s,c,e[i++],r))&&(t[o]=s)):void 0!==(s=n(o,s,e[i++],r))&&(t[o]=s)}else void 0!==(s=n(o,s,void 0,r))&&(t[o]=s)}return t}const fs=Symbol();function hs(e){let t=e[fs];if(!t){const n=vs(e);t=(e,t)=>Es(e,t,n),e[fs]=t}return t}const ps=Symbol();function ms(e,t){return t.h}function gs(e,t,n){let a,r;const i=t.h;return(e,t,o)=>i(e,t,o,r||=vs(n).L,a||=hs(n))}function vs(e){let t=e[ps];return t||(t=cs(e,e[ps]={},ms,gs),ys in e&&ps in e&&(e.length=0),t)}const ys=Symbol();function bs(e,t,n){const a=t.g;return n?(e,t,r)=>a(e,t,r,n):a}function xs(e,t,n,a){const r=t.g;let i,o;return(e,t,s)=>r(e,t,s,o||=Cs(n).L,i||=rs(n),a)}function Cs(e){let t=e[ys];return t||(ds(e),t=cs(e,e[ys]={},bs,xs),ys in e&&ps in e&&(e.length=0),t)}function ws(e,t){var n=e[t];if(n)return n;if((n=e.g)&&(n=n[t])){var a=n.U,r=n.ca.h;if(a){const e=hs(a),t=vs(a).L;n=(n,a,i)=>r(n,a,i,t,e)}else n=r;return e[t]=n}}function Es(e,t,n){for(var a=Ei(e),r=+!!(512&a)-1,i=e.length,o=512&a?1:0,s=i+(256&a?-1:0);o<s;o++){const a=e[o];if(null==a)continue;const i=o-r,s=ws(n,i);s&&s(t,a,i)}if(256&a){a=e[i-1];for(let e in a)r=+e,Number.isNaN(r)||null!=(i=a[e])&&(s=ws(n,r))&&s(t,i,r)}if(e=Bi?e[Bi]:void 0)for(di(t,t.g.end()),n=0;n<e.length;n++)di(t,Cr(e[n])||gr())}function ks(e,t){return new gi(e,t,!1)}function Ts(e,t){return new gi(e,t,!0)}function Ms(e,t,n){ko(e,Ei(e),t,n)}var Is=ks((function(e,t,n,a,r){return 2===e.h&&(e=Zr(e,ro([void 0,void 0],a),r),Fi(a=Ei(t)),(r=wo(t,a,n))instanceof lo?0!=(2&r.g)?((r=r.m()).push(e),ko(t,a,n,r)):r.I(e):Array.isArray(r)?(2&wi(r)&&ko(t,a,n,r=Ao(r)),r.push(e)):ko(t,a,n,[e]),!0)}),(function(e,t,n,a,r){if(t instanceof lo)t.forEach(((t,i)=>{mi(e,n,ro([i,t],a),r)}));else if(Array.isArray(t))for(let i=0;i<t.length;i++){const o=t[i];Array.isArray(o)&&mi(e,n,ro(o,a),r)}}));function Ss(e,t,n){e:if(null!=t){if($i(t)){if("string"==typeof t)break e;if("number"==typeof t)break e}t=void 0}null!=t&&("string"==typeof t&&ai(t),null!=t&&(ci(e,n,0),"number"==typeof t?(e=e.g,Lr(t),oi(e,Nr,Ar)):(n=ai(t),oi(e.g,n.h,n.g))))}function Ds(e,t,n){null!=(t=Vi(t))&&null!=t&&(ci(e,n,0),li(e.g,t))}function Ns(e,t,n){null!=(t=Wi(t))&&(ci(e,n,0),e.g.g.push(t?1:0))}function As(e,t,n){null!=(t=Zi(t))&&pi(e,n,$a(t))}function Ls(e,t,n,a,r){mi(e,n,t instanceof Jo?t.u:Array.isArray(t)?ro(t,a):void 0,r)}function Rs(e,t,n){null!=(t=null==t||"string"==typeof t||pr(t)||t instanceof wr?t:void 0)&&pi(e,n,Ir(t).buffer)}function Os(e,t,n){return(5===e.h||2===e.h)&&(t=To(t,Ei(t),n,2,!1),2==e.h?Kr(e,Vr.prototype.A,t):t.push(e.g.A()),!0)}var Fs=ks((function(e,t,n){if(1!==e.h)return!1;var a=e.g;e=Gr(a);const r=Gr(a);a=2*(r>>31)+1;const i=r>>>20&2047;return e=4294967296*(1048575&r)+e,Ms(t,n,2047==i?e?NaN:1/0*a:0==i?a*Math.pow(2,-1074)*e:a*Math.pow(2,i-1075)*(e+4503599627370496)),!0}),(function(e,t,n){null!=(t=Gi(t))&&(ci(e,n,1),e=e.g,(n=Dr||=new DataView(new ArrayBuffer(8))).setFloat64(0,+t,!0),Nr=n.getUint32(0,!0),Ar=n.getUint32(4,!0),ui(e,Nr),ui(e,Ar))})),js=ks((function(e,t,n){return 5===e.h&&(Ms(t,n,e.g.A()),!0)}),(function(e,t,n){null!=(t=Gi(t))&&(ci(e,n,5),e=e.g,Rr(t),ui(e,Nr))})),Ps=Ts(Os,(function(e,t,n){if(null!=(t=ns(Gi,t)))for(let i=0;i<t.length;i++){var a=e,r=t[i];null!=r&&(ci(a,n,5),a=a.g,Rr(r),ui(a,Nr))}})),Bs=Ts(Os,(function(e,t,n){if(null!=(t=ns(Gi,t))&&t.length){ci(e,n,2),si(e.g,4*t.length);for(let a=0;a<t.length;a++)n=e.g,Rr(t[a]),ui(n,Nr)}})),_s=ks((function(e,t,n){return 0===e.h&&(Ms(t,n,Ur(e.g,Fr)),!0)}),Ss),Us=ks((function(e,t,n){return 0===e.h&&(Ms(t,n,0===(e=Ur(e.g,Fr))?void 0:e),!0)}),Ss),zs=ks((function(e,t,n){return 0===e.h&&(Ms(t,n,Ur(e.g,Or)),!0)}),(function(e,t,n){e:if(null!=t){if($i(t)){if("string"==typeof t)break e;if("number"==typeof t)break e}t=void 0}null!=t&&("string"==typeof t&&ei(t),null!=t&&(ci(e,n,0),"number"==typeof t?(e=e.g,Lr(t),oi(e,Nr,Ar)):(n=ei(t),oi(e.g,n.h,n.g))))})),Gs=ks((function(e,t,n){return 0===e.h&&(Ms(t,n,e.g.m()),!0)}),Ds),Ws=Ts((function(e,t,n){return(0===e.h||2===e.h)&&(t=To(t,Ei(t),n,2,!1),2==e.h?Kr(e,Vr.prototype.m,t):t.push(e.g.m()),!0)}),(function(e,t,n){if(null!=(t=ns(Vi,t))&&t.length){n=fi(e,n);for(let n=0;n<t.length;n++)li(e.g,t[n]);hi(e,n)}})),$s=ks((function(e,t,n){return 0===e.h&&(Ms(t,n,0===(e=e.g.m())?void 0:e),!0)}),Ds),Vs=ks((function(e,t,n){return 0===e.h&&(Ms(t,n,zr(e.g)),!0)}),Ns),qs=ks((function(e,t,n){return 0===e.h&&(Ms(t,n,!1===(e=zr(e.g))?void 0:e),!0)}),Ns),Hs=Ts((function(e,t,n){if(2!==e.h)return!1;e=Qr(e);const a=Ei(t);return Fi(a),To(t,a,n,2).push(e),!0}),(function(e,t,n){if(null!=(t=ns(Zi,t)))for(let r=0;r<t.length;r++){var a=t[r];null!=a&&pi(e,n,$a(a))}})),Ys=ks((function(e,t,n){return 2===e.h&&(Ms(t,n,""===(e=Qr(e))?void 0:e),!0)}),As),Zs=ks((function(e,t,n){return 2===e.h&&(Ms(t,n,Qr(e)),!0)}),As),Qs=ks((function(e,t,n,a,r){return 2===e.h&&(Zr(e,Fo(t,a,n,!0),r),!0)}),Ls),Xs=ks((function(e,t,n,a,r){return 2===e.h&&(Zr(e,Fo(t,a,n),r),!0)}),Ls),Ks=Ts((function(e,t,n,a,r){if(2!==e.h)return!1;a=ro(void 0,a);const i=Ei(t);Fi(i);let o=To(t,i,n,3);return(Object.isFrozen(o)||4&wi(o))&&(o=vi(o),ko(t,i,n,o)),o.push(a),Zr(e,a,r),!0}),(function(e,t,n,a,r){if(Array.isArray(t))for(let i=0;i<t.length;i++)Ls(e,t[i],n,a,r)})),Js=ks((function(e,t,n,a,r,i){if(2!==e.h)return!1;const o=Ei(t);return Fi(o),(i=Oo(t,o,i))&&n!==i&&ko(t,o,i),Zr(e,t=Fo(t,a,n),r),!0}),Ls),el=ks((function(e,t,n){return 2===e.h&&(Ms(t,n,Xr(e)),!0)}),Rs),tl=Ts((function(e,t,n){return(0===e.h||2===e.h)&&(t=To(t,Ei(t),n,2,!1),2==e.h?Kr(e,Vr.prototype.j,t):t.push(e.g.j()),!0)}),(function(e,t,n){if(null!=(t=ns(qi,t)))for(let i=0;i<t.length;i++){var a=e,r=t[i];null!=r&&(ci(a,n,0),si(a.g,r))}})),nl=ks((function(e,t,n){return 0===e.h&&(Ms(t,n,e.g.m()),!0)}),(function(e,t,n){null!=(t=Vi(t))&&(t=parseInt(t,10),ci(e,n,0),li(e.g,t))})),al=Ts((function(e,t,n){return(0===e.h||2===e.h)&&(t=To(t,Ei(t),n,2,!1),2==e.h?Kr(e,Vr.prototype.C,t):t.push(e.g.m()),!0)}),(function(e,t,n){if(null!=(t=ns(Vi,t))&&t.length){n=fi(e,n);for(let n=0;n<t.length;n++)li(e.g,t[n]);hi(e,n)}}));class rl{constructor(e,t){this.h=e,this.g=t,this.l=Po,this.m=Uo,this.defaultValue=void 0}}function il(e,t){return new rl(e,t)}function ol(e,t){return(n,a)=>{e:{if(Jr.length){const e=Jr.pop();e.o(a),Br(e.g,n,a),n=e}else n=new class{constructor(e,t){if(qr.length){const n=qr.pop();Br(n,e,t),e=n}else e=new Vr(e,t);this.g=e,this.l=this.g.g,this.h=this.m=-1,this.o(t)}o({aa:e=!1}={}){this.aa=e}}(n,a);try{var r=new e;const a=r.u;rs(t)(a,n),_i&&delete a[_i];var i=r;break e}finally{(r=n.g).h=null,r.s=!1,r.v=0,r.l=0,r.g=0,r.R=!1,n.m=-1,n.h=-1,100>Jr.length&&Jr.push(n)}i=void 0}return i}}function sl(e){return function(){const t=new class{constructor(){this.l=[],this.h=0,this.g=new class{constructor(){this.g=[]}length(){return this.g.length}end(){const e=this.g;return this.g=[],e}}}};Es(this.u,t,vs(e)),di(t,t.g.end());const n=new Uint8Array(t.h),a=t.l,r=a.length;let i=0;for(let e=0;e<r;e++){const t=a[e];n.set(t,i),i+=t.length}return t.l=[n],n}}var ll=[0,Ys,ks((function(e,t,n){return 2===e.h&&(Ms(t,n,(e=Xr(e))===xr()?void 0:e),!0)}),(function(e,t,n){if(null!=t){if(t instanceof Jo){const a=t.Ea;return void(a&&(t=a(t),null!=t&&pi(e,n,Ir(t).buffer)))}if(Array.isArray(t))return}Rs(e,t,n)}))],ul=[0,Zs],dl=[0,Gs,nl,Vs,Vs,Ws,nl,nl],cl=[0,Vs,Vs],fl=class extends Jo{constructor(){super()}};fl.B=[6];var hl=[0,Vs,Zs,Vs,nl,nl,al,Zs,Zs,Xs,cl,nl],pl=[0,Zs,Zs,Zs],ml=class extends Jo{constructor(){super()}},gl=[0],vl=[0,Gs],yl=[1,2,3,4,5],bl=class extends Jo{constructor(e){super(e,2)}},xl={},Cl=[-2,xl,Vs];xl[336783863]=ts([0,Zs,Vs,Vs,Gs,Xs,[0,Js,gl,yl,Js,hl,yl,Js,pl,yl,Js,vl,yl,Js,dl,yl],Xs,ul]);var wl=[0,Ys,qs],El=[0,Us,Us,qs,qs,qs,qs,Us,Ws,Ys,$s,Us,Us,qs,$s,qs,qs,qs,Ys],kl=[-1,{}],Tl=[0,Zs,Xs,2,kl],Ml=[0,Zs,Hs,Xs,kl];function Il(e,t){t=Yi(t);const n=Ei(e=e.u);Fi(n),ko(e,n,2,""===t?void 0:t)}function Sl(e,t){Xo(e,3,t)}function Dl(e,t){Xo(e,4,t)}var Nl=class extends Jo{constructor(e){super(e,500)}o(e){return Uo(this,0,7,e)}};Nl.B=[3,4,5,6,8,13,17,1005];var Al=[-500,Ys,Ys,Hs,Hs,Hs,Hs,Xs,Cl,Ks,ll,$s,$s,Xs,Tl,Xs,Ml,Ks,wl,Ys,Xs,El,$s,Hs,Hs,988],Ll=[0,Ys,Ys,Xs,kl],Rl=[-500,Zs,Zs,Xs,[-1,{}],Zs,999],Ol=[-500,Zs,Hs,Hs,Xs,[-2,{},Vs],Hs,998,Hs],Fl=[-500,Zs,Hs,Xs,kl,Hs,999];function jl(e,t){Go(e,Nl,t)}function Pl(e,t){Xo(e,10,t)}function Bl(e,t){Xo(e,15,t)}var _l=class extends Jo{constructor(e){super(e,500)}o(e){return Uo(this,0,1001,e)}};_l.B=[1,6,7,9,10,15,16,17,14,1002];var Ul=[-500,Ks,Al,Ks,5,Rl,Ks,Ol,$s,Ks,Fl,Hs,$s,Xs,Tl,Xs,Ml,Ks,Ll,Hs,Hs,Hs,Xs,El,Ys,Ys,qs,Xs,980,kl,Ks,ll],zl=ol(_l,Ul);_l.prototype.g=sl(Ul);var Gl=[0,Ks,[0,Gs,Gs,Gs]],Wl=class extends Jo{constructor(e){super(e)}},$l=[0,Gs,js,Zs,Zs],Vl=class extends Jo{constructor(e){super(e)}g(){return _o(this,Wl,1)}};Vl.B=[1];var ql=[0,Ks,$l],Hl=ol(Vl,ql),Yl=[0,Gs,js],Zl=[0,Gs,Gs,Xs,Gl],Ql=class extends Jo{constructor(e){super(e)}},Xl=[0,Gs,Gs,Gs,Gs],Kl=[0,js,js,js,js],Jl=class extends Jo{constructor(e){super(e)}},eu=[0,js,js,Zs,js],tu=class extends Jo{constructor(e){super(e)}h(){return Po(this,Ql,2)}g(){return _o(this,Jl,5)}};tu.B=[5];var nu=[0,nl,Xs,Xl,Xs,Kl,Xs,Zl,Ks,eu],au=class extends Jo{constructor(e){super(e)}};au.B=[1,2,3,8,9];var ru=ol(au,[0,Hs,Ws,Bs,Xs,nu,Zs,Zs,_s,Ks,Yl,Hs,_s]),iu=class extends Jo{constructor(e){super(e)}},ou=[0,js,js,js,js,js],su=class extends Jo{constructor(e){super(e)}};su.B=[1];var lu=ol(su,[0,Ks,ou]),uu=class extends Jo{constructor(e){super(e)}},du=[0,js,js,js,js,js],cu=class extends Jo{constructor(e){super(e)}};cu.B=[1];var fu=ol(cu,[0,Ks,du]),hu=class extends Jo{constructor(e){super(e)}};hu.B=[3];var pu=[0,Gs,Gs,Bs,nl],mu=class extends Jo{constructor(){super()}};mu.prototype.g=sl([0,js,js,js,js,js,_s]);var gu=class extends Jo{constructor(e){super(e)}},vu=[0,Gs,2,Zs,Xs,ql],yu=class extends Jo{constructor(e){super(e)}};yu.B=[1];var bu=ol(yu,[0,Ks,vu,_s]),xu=class extends Jo{constructor(e){super(e)}};xu.B=[1];var Cu=class extends Jo{constructor(e){super(e)}fa(){const e=Io(this);return null==e?xr():e}},wu=class extends Jo{constructor(e){super(e)}},Eu=[1,2],ku=[0,Js,[0,Bs],Eu,Js,[0,el],Eu,Gs,Zs],Tu=class extends Jo{constructor(e){super(e)}};Tu.B=[1];var Mu=ol(Tu,[0,Ks,ku,_s]),Iu=class extends Jo{constructor(e){super(e)}};Iu.B=[4,5];var Su=[0,Zs,Gs,js,Hs,Hs],Du=class extends Jo{constructor(e){super(e)}},Nu=[0,Vs,Vs],Au=class extends Jo{constructor(e){super(e)}},Lu=[1,2,3,4,5],Ru=class extends Jo{constructor(e){super(e)}g(){return null!=Io(this)}h(){return null!=Vo(this,2)}},Ou=[0,el,Zs,Xs,[0,Gs,_s,_s],Xs,[0,zs,_s]],Fu=class extends Jo{constructor(e){super(e)}g(){return Wi(Co(this,2))??!1}},ju=[0,Xs,Ou,Vs,Xs,[0,Js,vl,Lu,Js,hl,Lu,Js,dl,Lu,Js,gl,Lu,Js,pl,Lu]],Pu=class extends Jo{constructor(e){super(e)}},Bu=[0,Xs,ju,js,js,Gs],_u=il(502141897,Pu);xl[502141897]=ts(Bu);var Uu=[0,Xs,Ou];xl[512499200]=ts(Uu);var zu=[0,Xs,Uu];xl[515723506]=ts(zu);var Gu=ol(class extends Jo{constructor(e){super(e)}},[0,Xs,[0,nl,nl,Ps,tl],Xs,pu]),Wu=[0,Xs,ju];xl[508981768]=ts(Wu);var $u=class extends Jo{constructor(e){super(e)}},Vu=[0,Xs,ju,js,Xs,Wu,Vs],qu=class extends Jo{constructor(e){super(e)}},Hu=[0,Xs,ju,Xs,Bu,Xs,Vu,js,Xs,zu];xl[508968149]=ts(Vu);var Yu=il(508968150,qu);xl[508968150]=ts(Hu);var Zu=class extends Jo{constructor(e){super(e)}},Qu=il(513916220,Zu);xl[513916220]=ts([0,Xs,ju,Xs,Hu,Gs]);var Xu=class extends Jo{constructor(e){super(e)}h(){return Po(this,Iu,2)}g(){Eo(this,2)}},Ku=[0,Xs,ju,Xs,Su];xl[478825465]=ts(Ku);var Ju=[0,Xs,ju];xl[478825422]=ts(Ju);var ed=class extends Jo{constructor(e){super(e)}},td=[0,Xs,ju,Xs,Ju,Xs,Ku,Xs,Ku],nd=class extends Jo{constructor(e){super(e)}},ad=[0,Xs,ju,js,Gs],rd=class extends Jo{constructor(e){super(e)}},id=[0,Xs,ju,js],od=class extends Jo{constructor(e){super(e)}},sd=[0,Xs,ju,Xs,ad,Xs,id,js],ld=class extends Jo{constructor(e){super(e)}},ud=[0,Xs,ju,Xs,sd,Xs,td];xl[463370452]=ts(td),xl[464864288]=ts(ad),xl[474472470]=ts(id);var dd=il(462713202,od);xl[462713202]=ts(sd);var cd=il(479097054,ld);xl[479097054]=ts(ud);var fd=class extends Jo{constructor(e){super(e)}},hd=il(456383383,fd);xl[456383383]=ts([0,Xs,ju,Xs,Su]);var pd=class extends Jo{constructor(e){super(e)}},md=il(476348187,pd);xl[476348187]=ts([0,Xs,ju,Xs,Nu]);var gd=class extends Jo{constructor(e){super(e)}},vd=[0,nl,nl],yd=class extends Jo{constructor(e){super(e)}};yd.B=[3];var bd=il(458105876,class extends Jo{constructor(e){super(e)}g(){var e=this.u;const t=Ei(e);var n=2&t;return e=function(e,t,n){var a=yd;const r=2&t;let i=!1;if(null==n){if(r)return No();n=[]}else if(n.constructor===lo){if(0==(2&n.g)||r)return n;n=n.m()}else Array.isArray(n)?i=!!(2&wi(n)):n=[];if(r){if(!n.length)return No();i||(i=!0,Mi(n))}else i&&(i=!1,n=Ao(n));return i||(64&wi(n)?Ci(n,32):32&t&&bi(n,32)),ko(e,t,2,a=new lo(n,a,Ji,void 0),!1),a}(e,t,wo(e,t,2)),null==e||!n&&yd&&(e.v=!0),e}});xl[458105876]=ts([0,Xs,vd,Is,[!0,_s,Xs,[0,Zs,Zs,Hs]]]);var xd=class extends Jo{constructor(e){super(e)}},Cd=il(458105758,xd);xl[458105758]=ts([0,Xs,ju,Zs,Xs,vd]);var wd=class extends Jo{constructor(e){super(e)}};wd.B=[5,6];var Ed=il(443442058,wd);xl[443442058]=ts([0,Xs,ju,Zs,Gs,js,Hs,Hs]);var kd=class extends Jo{constructor(e){super(e)}},Td=[0,Xs,ju,js,js,Gs];xl[514774813]=ts(Td);var Md=class extends Jo{constructor(e){super(e)}},Id=[0,Xs,ju,js,Vs],Sd=class extends Jo{constructor(e){super(e)}},Dd=[0,Xs,ju,Xs,Td,Xs,Id,js];xl[518928384]=ts(Id);var Nd=il(516587230,Sd);function Ad(e,t){return t=t?t.clone():new Iu,void 0!==e.displayNamesLocale?Eo(t,1,Yi(e.displayNamesLocale)):void 0===e.displayNamesLocale&&Eo(t,1),void 0!==e.maxResults?Zo(t,2,e.maxResults):"maxResults"in e&&Eo(t,2),void 0!==e.scoreThreshold?Qo(t,3,e.scoreThreshold):"scoreThreshold"in e&&Eo(t,3),void 0!==e.categoryAllowlist?Lo(t,4,e.categoryAllowlist):"categoryAllowlist"in e&&Eo(t,4),void 0!==e.categoryDenylist?Lo(t,5,e.categoryDenylist):"categoryDenylist"in e&&Eo(t,5),t}function Ld(e,t=-1,n=""){return{categories:e.map((e=>({index:qo(Wo(e,1))??-1,score:Ho(e,2)??0,categoryName:Vo(e,3)??""??"",displayName:Vo(e,4)??""??""}))),headIndex:t,headName:n}}function Rd(e){var t=So(e,3,Gi),n=So(e,2,Vi);const a=So(e,1,Zi),r=So(e,9,Zi),i={categories:[],keypoints:[]};for(let e=0;e<t.length;e++)i.categories.push({score:t[e],index:n[e]??-1,categoryName:a[e]??"",displayName:r[e]??""});if((t=Po(e,tu,4)?.h())&&(i.boundingBox={originX:Wo(t,1)??0,originY:Wo(t,2)??0,width:Wo(t,3)??0,height:Wo(t,4)??0,angle:0}),Po(e,tu,4)?.g().length)for(const t of Po(e,tu,4).g())i.keypoints.push({x:Mo(t,1)??0,y:Mo(t,2)??0,score:Mo(t,4)??0,label:Vo(t,3)??""});return i}function Od(e){const t=[];for(const n of _o(e,uu,1))t.push({x:Ho(n,1)??0,y:Ho(n,2)??0,z:Ho(n,3)??0});return t}function Fd(e){const t=[];for(const n of _o(e,iu,1))t.push({x:Ho(n,1)??0,y:Ho(n,2)??0,z:Ho(n,3)??0});return t}function jd(e){return Array.from(e,(e=>127<e?e-256:e))}function Pd(e,t){if(e.length!==t.length)throw Error(`Cannot compute cosine similarity between embeddings of different sizes (${e.length} vs. ${t.length}).`);let n=0,a=0,r=0;for(let i=0;i<e.length;i++)n+=e[i]*t[i],a+=e[i]*e[i],r+=t[i]*t[i];if(0>=a||0>=r)throw Error("Cannot compute cosine similarity on embedding with 0 norm.");return n/Math.sqrt(a*r)}let Bd;xl[516587230]=ts(Dd);const _d=new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]);async function Ud(){if(void 0===Bd)try{await WebAssembly.instantiate(_d),Bd=!0}catch{Bd=!1}return Bd}async function zd(e,t=""){const n=await Ud()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${t}/${e}_${n}.js`,wasmBinaryPath:`${t}/${e}_${n}.wasm`}}var Gd=class{};function Wd(){const e=navigator.userAgent;return e.includes("Safari")&&!e.includes("Chrome")}async function $d(e){if("function"!=typeof importScripts){const t=document.createElement("script");return t.src=e.toString(),t.crossOrigin="anonymous",new Promise(((e,n)=>{t.addEventListener("load",(()=>{e()}),!1),t.addEventListener("error",(e=>{n(e)}),!1),document.body.appendChild(t)}))}importScripts(e.toString())}function Vd(e,t,n){e.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target"),n(t=e.i.stringToNewUTF8(t)),e.i._free(t)}function qd(e,t,n){if(!e.i.canvas)throw Error("No OpenGL canvas configured.");if(n?e.i._bindTextureToStream(n):e.i._bindTextureToCanvas(),!(n=e.i.canvas.getContext("webgl2")||e.i.canvas.getContext("webgl")))throw Error("Failed to obtain WebGL context from the provided canvas. `getContext()` should only be invoked with `webgl` or `webgl2`.");return e.i.gpuOriginForWebTexturesIsBottomLeft&&n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!0),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,t),e.i.gpuOriginForWebTexturesIsBottomLeft&&n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!1),t.videoWidth?(n=t.videoWidth,t=t.videoHeight):t.naturalWidth?(n=t.naturalWidth,t=t.naturalHeight):(n=t.width,t=t.height),!e.l||n===e.i.canvas.width&&t===e.i.canvas.height||(e.i.canvas.width=n,e.i.canvas.height=t),[n,t]}function Hd(e,t,n){e.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");const a=new Uint32Array(t.length);for(let n=0;n<t.length;n++)a[n]=e.i.stringToNewUTF8(t[n]);t=e.i._malloc(4*a.length),e.i.HEAPU32.set(a,t>>2),n(t);for(const t of a)e.i._free(t);e.i._free(t)}function Yd(e,t,n){e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=n}function Zd(e,t,n){let a=[];e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=(e,t,r)=>{t?(n(a,r),a=[]):a.push(e)}}function Qd(e,t){const n=Po(e.baseOptions,Ru,1)||new Ru;"string"==typeof t?(Eo(n,2,Yi(t)),Eo(n,1)):t instanceof Uint8Array&&(Eo(n,1,Ri(t,!1,!1)),Eo(n,2)),Uo(e.baseOptions,0,1,n)}function Xd(e){try{const t=e.J.length;if(1===t)throw Error(e.J[0].message);if(1<t)throw Error("Encountered multiple errors: "+e.J.map((e=>e.message)).join(", "))}finally{e.J=[]}}function Kd(e,t){e.I=Math.max(e.I,t)}function Jd(e,t){e.A=new Nl,Il(e.A,"PassThroughCalculator"),Sl(e.A,"free_memory"),Dl(e.A,"free_memory_unused_out"),Pl(t,"free_memory"),jl(t,e.A)}function ec(e,t){Sl(e.A,t),Dl(e.A,t+"_unused_out")}function tc(e){e.g.addBoolToStream(!0,"free_memory",e.I)}Gd.forVisionTasks=function(e){return zd("vision",e)},Gd.forTextTasks=function(e){return zd("text",e)},Gd.forAudioTasks=function(e){return zd("audio",e)},Gd.isSimdSupported=function(){return Ud()};var nc=class{constructor(e){this.g=e,this.J=[],this.I=0,this.g.setAutoRenderToScreen(!1)}l(e,t=!0){if(t){const t=e.baseOptions||{};if(e.baseOptions?.modelAssetBuffer&&e.baseOptions?.modelAssetPath)throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!(Po(this.baseOptions,Ru,1)?.g()||Po(this.baseOptions,Ru,1)?.h()||e.baseOptions?.modelAssetBuffer||e.baseOptions?.modelAssetPath))throw Error("Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set");if(function(e,t){let n=Po(e.baseOptions,Au,3);if(!n){var a=n=new Au,r=new ml;zo(a,4,Lu,r)}"delegate"in t&&("GPU"===t.delegate?(t=n,a=new fl,zo(t,2,Lu,a)):(t=n,a=new ml,zo(t,4,Lu,a))),Uo(e.baseOptions,0,3,n)}(this,t),t.modelAssetPath)return fetch(t.modelAssetPath.toString()).then((e=>{if(e.ok)return e.arrayBuffer();throw Error(`Failed to fetch model: ${t.modelAssetPath} (${e.status})`)})).then((e=>{try{this.g.i.FS_unlink("/model.dat")}catch{}this.g.i.FS_createDataFile("/","model.dat",new Uint8Array(e),!0,!1,!1),Qd(this,"/model.dat"),this.m(),this.P()}));Qd(this,t.modelAssetBuffer)}return this.m(),this.P(),Promise.resolve()}P(){}W(){let e;if(this.g.W((t=>{e=zl(t)})),!e)throw Error("Failed to retrieve CalculatorGraphConfig");return e}setGraph(e,t){this.g.attachErrorListener(((e,t)=>{this.J.push(Error(t))})),this.g.Aa(),this.g.setGraph(e,t),this.A=void 0,Xd(this)}finishProcessing(){this.g.finishProcessing(),Xd(this)}close(){this.A=void 0,this.g.closeGraph()}};function ac(e,t){if(null===e)throw Error(`Unable to obtain required WebGL resource: ${t}`);return e}nc.prototype.close=nc.prototype.close;class rc{constructor(e,t,n,a){this.g=e,this.h=t,this.m=n,this.l=a}bind(){this.g.bindVertexArray(this.h)}close(){this.g.deleteVertexArray(this.h),this.g.deleteBuffer(this.m),this.g.deleteBuffer(this.l)}}function ic(e,t,n){const a=e.h;if(n=ac(a.createShader(n),"Failed to create WebGL shader"),a.shaderSource(n,t),a.compileShader(n),!a.getShaderParameter(n,a.COMPILE_STATUS))throw Error(`Could not compile WebGL shader: ${a.getShaderInfoLog(n)}`);return a.attachShader(e.g,n),n}function oc(e,t){const n=e.h,a=ac(n.createVertexArray(),"Failed to create vertex array");n.bindVertexArray(a);const r=ac(n.createBuffer(),"Failed to create buffer");n.bindBuffer(n.ARRAY_BUFFER,r),n.enableVertexAttribArray(e.s),n.vertexAttribPointer(e.s,2,n.FLOAT,!1,0,0),n.bufferData(n.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,1,1,1,-1]),n.STATIC_DRAW);const i=ac(n.createBuffer(),"Failed to create buffer");return n.bindBuffer(n.ARRAY_BUFFER,i),n.enableVertexAttribArray(e.A),n.vertexAttribPointer(e.A,2,n.FLOAT,!1,0,0),n.bufferData(n.ARRAY_BUFFER,new Float32Array(t?[0,1,0,0,1,0,1,1]:[0,0,0,1,1,1,1,0]),n.STATIC_DRAW),n.bindBuffer(n.ARRAY_BUFFER,null),n.bindVertexArray(null),new rc(n,a,r,i)}function sc(e,t){if(e.h){if(t!==e.h)throw Error("Cannot change GL context once initialized")}else e.h=t}function lc(e,t,n,a){if(sc(e,t),!e.g){const t=e.h;if(e.g=ac(t.createProgram(),"Failed to create WebGL program"),e.C=ic(e,"\n attribute vec2 aVertex;\n attribute vec2 aTex;\n varying vec2 vTex;\n void main(void) {\n gl_Position = vec4(aVertex, 0.0, 1.0);\n vTex = aTex;\n }",t.VERTEX_SHADER),e.v=ic(e,"\n precision mediump float;\n varying vec2 vTex;\n uniform sampler2D inputTexture;\n void main() {\n gl_FragColor = texture2D(inputTexture, vTex);\n }\n ",t.FRAGMENT_SHADER),t.linkProgram(e.g),!t.getProgramParameter(e.g,t.LINK_STATUS))throw Error(`Error during program linking: ${t.getProgramInfoLog(e.g)}`);e.s=t.getAttribLocation(e.g,"aVertex"),e.A=t.getAttribLocation(e.g,"aTex")}return n?(e.m||(e.m=oc(e,!0)),n=e.m):(e.j||(e.j=oc(e,!1)),n=e.j),t.useProgram(e.g),n.bind(),e=a(),n.g.bindVertexArray(null),e}function uc(e,t,n){sc(e,t),e.l||(e.l=ac(t.createFramebuffer(),"Failed to create framebuffe.")),t.bindFramebuffer(t.FRAMEBUFFER,e.l),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,n,0)}function dc(e){e.h?.bindFramebuffer(e.h.FRAMEBUFFER,null)}var cc=class{close(){if(this.g){const e=this.h;e.deleteProgram(this.g),e.deleteShader(this.C),e.deleteShader(this.v)}this.l&&this.h.deleteFramebuffer(this.l),this.j&&this.j.close(),this.m&&this.m.close()}};function fc(e,t){switch(t){case 0:return e.g.find((e=>e instanceof ImageData));case 1:return e.g.find((e=>"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap));case 2:return e.g.find((e=>"undefined"!=typeof WebGLTexture&&e instanceof WebGLTexture));default:throw Error(`Type is not supported: ${t}`)}}function hc(e){var t=fc(e,0);if(!t){t=mc(e);const n=gc(e),a=new Uint8Array(e.width*e.height*4);uc(n,t,pc(e)),t.readPixels(0,0,e.width,e.height,t.RGBA,t.UNSIGNED_BYTE,a),dc(n),t=new ImageData(new Uint8ClampedArray(a.buffer),e.width,e.height),e.g.push(t)}return t}function pc(e){let t=fc(e,2);if(!t){const n=mc(e);t=yc(e);const a=fc(e,1)||hc(e);n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,a),bc(e)}return t}function mc(e){if(!e.canvas)throw Error("Conversion to different image formats require that a canvas is passed when iniitializing the image.");return e.h||(e.h=ac(e.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),e.h}function gc(e){return e.l||(e.l=new cc),e.l}function vc(e){(e=mc(e)).texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR)}function yc(e){const t=mc(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let n=fc(e,2);return n?t.bindTexture(t.TEXTURE_2D,n):(n=ac(t.createTexture(),"Failed to create texture"),e.g.push(n),e.m=!0,t.bindTexture(t.TEXTURE_2D,n),vc(e)),n}function bc(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}function xc(e){const t=mc(e);return lc(gc(e),t,!0,(()=>function(e,t){const n=e.canvas;if(n.width===e.width&&n.height===e.height)return t();const a=n.width,r=n.height;return n.width=e.width,n.height=e.height,e=t(),n.width=a,n.height=r,e}(e,(()=>{if(t.bindFramebuffer(t.FRAMEBUFFER,null),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.TRIANGLE_FAN,0,4),!(e.canvas instanceof OffscreenCanvas))throw Error("Conversion to ImageBitmap requires that the MediaPipe Tasks is initialized with an OffscreenCanvas");return e.canvas.transferToImageBitmap()}))))}var Cc=class{constructor(e,t,n,a,r,i,o){this.g=e,this.j=t,this.m=n,this.canvas=a,this.l=r,this.width=i,this.height=o,(this.j||this.m)&&0==--wc&&console.error("You seem to be creating MPImage instances without invoking .close(). This leaks resources.")}va(){return!!fc(this,0)}ba(){return!!fc(this,1)}K(){return!!fc(this,2)}ra(){return hc(this)}qa(){var e=fc(this,1);return e||(pc(this),yc(this),e=xc(this),bc(this),this.g.push(e),this.j=!0),e}V(){return pc(this)}clone(){const e=[];for(const t of this.g){let n;if(t instanceof ImageData)n=new ImageData(t.data,this.width,this.height);else if(t instanceof WebGLTexture){const e=mc(this),t=gc(this);e.activeTexture(e.TEXTURE1),n=ac(e.createTexture(),"Failed to create texture"),e.bindTexture(e.TEXTURE_2D,n),vc(this),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,this.width,this.height,0,e.RGBA,e.UNSIGNED_BYTE,null),e.bindTexture(e.TEXTURE_2D,null),uc(t,e,n),lc(t,e,!1,(()=>{yc(this),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.drawArrays(e.TRIANGLE_FAN,0,4),bc(this)})),dc(t),bc(this)}else{if(!(t instanceof ImageBitmap))throw Error(`Type is not supported: ${t}`);pc(this),yc(this),n=xc(this),bc(this)}e.push(n)}return new Cc(e,this.ba(),this.K(),this.canvas,this.l,this.width,this.height)}close(){this.j&&fc(this,1).close(),this.m&&mc(this).deleteTexture(fc(this,2)),wc=-1}};Cc.prototype.close=Cc.prototype.close,Cc.prototype.clone=Cc.prototype.clone,Cc.prototype.getAsWebGLTexture=Cc.prototype.V,Cc.prototype.getAsImageBitmap=Cc.prototype.qa,Cc.prototype.getAsImageData=Cc.prototype.ra,Cc.prototype.hasWebGLTexture=Cc.prototype.K,Cc.prototype.hasImageBitmap=Cc.prototype.ba,Cc.prototype.hasImageData=Cc.prototype.va;var wc=250;function Ec(e,t){switch(t){case 0:return e.g.find((e=>e instanceof Uint8Array));case 1:return e.g.find((e=>e instanceof Float32Array));case 2:return e.g.find((e=>"undefined"!=typeof WebGLTexture&&e instanceof WebGLTexture));default:throw Error(`Type is not supported: ${t}`)}}function kc(e){var t=Ec(e,1);if(!t){if(t=Ec(e,0))t=new Float32Array(t).map((e=>e/255));else{t=new Float32Array(e.width*e.height);const a=Mc(e);var n=Sc(e);if(uc(n,a,Tc(e)),"iPad Simulator;iPhone Simulator;iPod Simulator;iPad;iPhone;iPod".split(";").includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document){n=new Float32Array(e.width*e.height*4),a.readPixels(0,0,e.width,e.height,a.RGBA,a.FLOAT,n);for(let e=0,a=0;e<t.length;++e,a+=4)t[e]=n[a]}else a.readPixels(0,0,e.width,e.height,a.RED,a.FLOAT,t)}e.g.push(t)}return t}function Tc(e){let t=Ec(e,2);if(!t){const n=Mc(e);t=Nc(e);const a=kc(e),r=Ic(e);n.texImage2D(n.TEXTURE_2D,0,r,e.width,e.height,0,n.RED,n.FLOAT,a),Ac(e)}return t}function Mc(e){if(!e.canvas)throw Error("Conversion to different image formats require that a canvas is passed when initializing the image.");return e.h||(e.h=ac(e.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),e.h}function Ic(e){if(e=Mc(e),!Lc)if(e.getExtension("EXT_color_buffer_float")&&e.getExtension("OES_texture_float_linear")&&e.getExtension("EXT_float_blend"))Lc=e.R32F;else{if(!e.getExtension("EXT_color_buffer_half_float"))throw Error("GPU does not fully support 4-channel float32 or float16 formats");Lc=e.R16F}return Lc}function Sc(e){return e.l||(e.l=new cc),e.l}function Dc(e){(e=Mc(e)).texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST)}function Nc(e){const t=Mc(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let n=Ec(e,2);return n?t.bindTexture(t.TEXTURE_2D,n):(n=ac(t.createTexture(),"Failed to create texture"),e.g.push(n),e.m=!0,t.bindTexture(t.TEXTURE_2D,n),Dc(e)),n}function Ac(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}var Lc,Rc=class{constructor(e,t,n,a,r,i){this.g=e,this.m=t,this.canvas=n,this.l=a,this.width=r,this.height=i,this.m&&0==--Oc&&console.error("You seem to be creating MPMask instances without invoking .close(). This leaks resources.")}wa(){return!!Ec(this,0)}ua(){return!!Ec(this,1)}K(){return!!Ec(this,2)}sa(){return(e=Ec(this,0))||(e=kc(this),e=new Uint8Array(e.map((e=>255*e))),this.g.push(e)),e;var e}pa(){return kc(this)}V(){return Tc(this)}clone(){const e=[];for(const t of this.g){let n;if(t instanceof Uint8Array)n=new Uint8Array(t);else if(t instanceof Float32Array)n=new Float32Array(t);else{if(!(t instanceof WebGLTexture))throw Error(`Type is not supported: ${t}`);{const e=Mc(this),t=Sc(this);e.activeTexture(e.TEXTURE1),n=ac(e.createTexture(),"Failed to create texture"),e.bindTexture(e.TEXTURE_2D,n),Dc(this);const a=Ic(this);e.texImage2D(e.TEXTURE_2D,0,a,this.width,this.height,0,e.RED,e.FLOAT,null),e.bindTexture(e.TEXTURE_2D,null),uc(t,e,n),lc(t,e,!1,(()=>{Nc(this),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.drawArrays(e.TRIANGLE_FAN,0,4),Ac(this)})),dc(t),Ac(this)}}e.push(n)}return new Rc(e,this.K(),this.canvas,this.l,this.width,this.height)}close(){this.m&&Mc(this).deleteTexture(Ec(this,2)),Oc=-1}};Rc.prototype.close=Rc.prototype.close,Rc.prototype.clone=Rc.prototype.clone,Rc.prototype.getAsWebGLTexture=Rc.prototype.V,Rc.prototype.getAsFloat32Array=Rc.prototype.pa,Rc.prototype.getAsUint8Array=Rc.prototype.sa,Rc.prototype.hasWebGLTexture=Rc.prototype.K,Rc.prototype.hasFloat32Array=Rc.prototype.ua,Rc.prototype.hasUint8Array=Rc.prototype.wa;var Oc=250;function Fc(...e){return e.map((([e,t])=>({start:e,end:t})))}const jc=function(e){return class extends e{Aa(){this.i._registerModelResourcesGraphService()}}}((Pc=class{constructor(e,t){this.l=!0,this.i=e,this.g=null,this.h=0,this.m="function"==typeof this.i._addIntToInputStream,void 0!==t?this.i.canvas=t:"undefined"==typeof OffscreenCanvas||Wd()?(console.warn("OffscreenCanvas not supported and GraphRunner constructor glCanvas parameter is undefined. Creating backup canvas."),this.i.canvas=document.createElement("canvas")):this.i.canvas=new OffscreenCanvas(1,1)}async initializeGraph(e){const t=await(await fetch(e)).arrayBuffer();e=!(e.endsWith(".pbtxt")||e.endsWith(".textproto")),this.setGraph(new Uint8Array(t),e)}setGraphFromString(e){this.setGraph((new TextEncoder).encode(e),!1)}setGraph(e,t){const n=e.length,a=this.i._malloc(n);this.i.HEAPU8.set(e,a),t?this.i._changeBinaryGraph(n,a):this.i._changeTextGraph(n,a),this.i._free(a)}configureAudio(e,t,n,a,r){this.i._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),Vd(this,a||"input_audio",(a=>{Vd(this,r=r||"audio_header",(r=>{this.i._configureAudio(a,r,e,t,n)}))}))}setAutoResizeCanvas(e){this.l=e}setAutoRenderToScreen(e){this.i._setAutoRenderToScreen(e)}setGpuBufferVerticalFlip(e){this.i.gpuOriginForWebTexturesIsBottomLeft=e}W(e){Yd(this,"__graph_config__",(t=>{e(t)})),Vd(this,"__graph_config__",(e=>{this.i._getGraphConfig(e,void 0)})),delete this.i.simpleListeners.__graph_config__}attachErrorListener(e){this.i.errorListener=e}attachEmptyPacketListener(e,t){this.i.emptyPacketListeners=this.i.emptyPacketListeners||{},this.i.emptyPacketListeners[e]=t}addAudioToStream(e,t,n){this.addAudioToStreamWithShape(e,0,0,t,n)}addAudioToStreamWithShape(e,t,n,a,r){const i=4*e.length;this.h!==i&&(this.g&&this.i._free(this.g),this.g=this.i._malloc(i),this.h=i),this.i.HEAPF32.set(e,this.g/4),Vd(this,a,(e=>{this.i._addAudioToInputStream(this.g,t,n,e,r)}))}addGpuBufferToStream(e,t,n){Vd(this,t,(t=>{const[a,r]=qd(this,e,t);this.i._addBoundTextureToStream(t,a,r,n)}))}addBoolToStream(e,t,n){Vd(this,t,(t=>{this.i._addBoolToInputStream(e,t,n)}))}addDoubleToStream(e,t,n){Vd(this,t,(t=>{this.i._addDoubleToInputStream(e,t,n)}))}addFloatToStream(e,t,n){Vd(this,t,(t=>{this.i._addFloatToInputStream(e,t,n)}))}addIntToStream(e,t,n){Vd(this,t,(t=>{this.i._addIntToInputStream(e,t,n)}))}addStringToStream(e,t,n){Vd(this,t,(t=>{Vd(this,e,(e=>{this.i._addStringToInputStream(e,t,n)}))}))}addStringRecordToStream(e,t,n){Vd(this,t,(t=>{Hd(this,Object.keys(e),(a=>{Hd(this,Object.values(e),(r=>{this.i._addFlatHashMapToInputStream(a,r,Object.keys(e).length,t,n)}))}))}))}addProtoToStream(e,t,n,a){Vd(this,n,(n=>{Vd(this,t,(t=>{const r=this.i._malloc(e.length);this.i.HEAPU8.set(e,r),this.i._addProtoToInputStream(r,e.length,t,n,a),this.i._free(r)}))}))}addEmptyPacketToStream(e,t){Vd(this,e,(e=>{this.i._addEmptyPacketToInputStream(e,t)}))}addBoolToInputSidePacket(e,t){Vd(this,t,(t=>{this.i._addBoolToInputSidePacket(e,t)}))}addDoubleToInputSidePacket(e,t){Vd(this,t,(t=>{this.i._addDoubleToInputSidePacket(e,t)}))}addFloatToInputSidePacket(e,t){Vd(this,t,(t=>{this.i._addFloatToInputSidePacket(e,t)}))}addIntToInputSidePacket(e,t){Vd(this,t,(t=>{this.i._addIntToInputSidePacket(e,t)}))}addStringToInputSidePacket(e,t){Vd(this,t,(t=>{Vd(this,e,(e=>{this.i._addStringToInputSidePacket(e,t)}))}))}addProtoToInputSidePacket(e,t,n){Vd(this,n,(n=>{Vd(this,t,(t=>{const a=this.i._malloc(e.length);this.i.HEAPU8.set(e,a),this.i._addProtoToInputSidePacket(a,e.length,t,n),this.i._free(a)}))}))}attachBoolListener(e,t){Yd(this,e,t),Vd(this,e,(e=>{this.i._attachBoolListener(e)}))}attachBoolVectorListener(e,t){Zd(this,e,t),Vd(this,e,(e=>{this.i._attachBoolVectorListener(e)}))}attachIntListener(e,t){Yd(this,e,t),Vd(this,e,(e=>{this.i._attachIntListener(e)}))}attachIntVectorListener(e,t){Zd(this,e,t),Vd(this,e,(e=>{this.i._attachIntVectorListener(e)}))}attachDoubleListener(e,t){Yd(this,e,t),Vd(this,e,(e=>{this.i._attachDoubleListener(e)}))}attachDoubleVectorListener(e,t){Zd(this,e,t),Vd(this,e,(e=>{this.i._attachDoubleVectorListener(e)}))}attachFloatListener(e,t){Yd(this,e,t),Vd(this,e,(e=>{this.i._attachFloatListener(e)}))}attachFloatVectorListener(e,t){Zd(this,e,t),Vd(this,e,(e=>{this.i._attachFloatVectorListener(e)}))}attachStringListener(e,t){Yd(this,e,t),Vd(this,e,(e=>{this.i._attachStringListener(e)}))}attachStringVectorListener(e,t){Zd(this,e,t),Vd(this,e,(e=>{this.i._attachStringVectorListener(e)}))}attachProtoListener(e,t,n){Yd(this,e,t),Vd(this,e,(e=>{this.i._attachProtoListener(e,n||!1)}))}attachProtoVectorListener(e,t,n){Zd(this,e,t),Vd(this,e,(e=>{this.i._attachProtoVectorListener(e,n||!1)}))}attachAudioListener(e,t,n){this.i._attachAudioListener||console.warn('Attempting to use attachAudioListener without support for output audio. Is build dep ":gl_graph_runner_audio_out" missing?'),Yd(this,e,((e,n)=>{e=new Float32Array(e.buffer,e.byteOffset,e.length/4),t(e,n)})),Vd(this,e,(e=>{this.i._attachAudioListener(e,n||!1)}))}finishProcessing(){this.i._waitUntilIdle()}closeGraph(){this.i._closeGraph(),this.i.simpleListeners=void 0,this.i.emptyPacketListeners=void 0}},class extends Pc{get Y(){return this.i}ga(e,t,n){Vd(this,t,(t=>{const[a,r]=qd(this,e,t);this.Y._addBoundTextureAsImageToStream(t,a,r,n)}))}S(e,t){Yd(this,e,t),Vd(this,e,(e=>{this.Y._attachImageListener(e)}))}T(e,t){Zd(this,e,t),Vd(this,e,(e=>{this.Y._attachImageVectorListener(e)}))}}));var Pc,Bc=class extends jc{};async function _c(e,t,n){return async function(e,t,n,a){return async function(e,t,n,a){return e=await(async(e,t,n,a,r)=>{if(t&&await $d(t),!self.ModuleFactory)throw Error("ModuleFactory not set.");if(n&&(await $d(n),!self.ModuleFactory))throw Error("ModuleFactory not set.");return self.Module&&r&&((t=self.Module).locateFile=r.locateFile,r.mainScriptUrlOrBlob&&(t.mainScriptUrlOrBlob=r.mainScriptUrlOrBlob)),r=await self.ModuleFactory(self.Module||r),self.ModuleFactory=self.Module=void 0,new e(r,a)})(e,n.wasmLoaderPath,n.assetLoaderPath,t,{locateFile:e=>e.endsWith(".wasm")?n.wasmBinaryPath.toString():n.assetBinaryPath&&e.endsWith(".data")?n.assetBinaryPath.toString():e}),await e.o(a),e}(e,t,n,a)}(e,n.canvas??("undefined"==typeof OffscreenCanvas||Wd()?document.createElement("canvas"):void 0),t,n)}function Uc(e,t,n,a){if(e.Z){const i=new mu;if(n?.regionOfInterest){if(!e.ea)throw Error("This task doesn't support region-of-interest.");var r=n.regionOfInterest;if(r.left>=r.right||r.top>=r.bottom)throw Error("Expected RectF with left < right and top < bottom.");if(0>r.left||0>r.top||1<r.right||1<r.bottom)throw Error("Expected RectF values to be in [0,1].");Qo(i,1,(r.left+r.right)/2),Qo(i,2,(r.top+r.bottom)/2),Qo(i,4,r.right-r.left),Qo(i,3,r.bottom-r.top)}else Qo(i,1,.5),Qo(i,2,.5),Qo(i,4,1),Qo(i,3,1);if(n?.rotationDegrees){if(0!=n?.rotationDegrees%90)throw Error("Expected rotation to be a multiple of 90°.");if(Qo(i,5,-Math.PI*n.rotationDegrees/180),0!=n?.rotationDegrees%180){const[e,a]=void 0!==t.videoWidth?[t.videoWidth,t.videoHeight]:void 0!==t.naturalWidth?[t.naturalWidth,t.naturalHeight]:[t.width,t.height];n=Ho(i,3)*a/e,r=Ho(i,4)*e/a,Qo(i,4,n),Qo(i,3,r)}}e.g.addProtoToStream(i.g(),"mediapipe.NormalizedRect",e.Z,a)}e.g.ga(t,e.da,a??performance.now()),e.finishProcessing()}function zc(e,t,n){if(e.baseOptions?.g())throw Error("Task is not initialized with image mode. 'runningMode' must be set to 'IMAGE'.");Uc(e,t,n,e.I+1)}function Gc(e,t,n,a){if(!e.baseOptions?.g())throw Error("Task is not initialized with video mode. 'runningMode' must be set to 'VIDEO'.");Uc(e,t,n,a)}function Wc(e,t,n){var a=t.data;const r=t.width,i=r*(t=t.height);if((a instanceof Uint8Array||a instanceof Float32Array)&&a.length!==i)throw Error("Unsupported channel count: "+a.length/i);return e=new Rc([a],!1,e.g.i.canvas,e.O,r,t),n?e.clone():e}var $c=class extends nc{constructor(e,t,n,a){super(e),this.g=e,this.da=t,this.Z=n,this.ea=a,this.O=new cc}l(e,t=!0){if("runningMode"in e&&Yo(this.baseOptions,2,!!e.runningMode&&"IMAGE"!==e.runningMode),void 0!==e.canvas&&this.g.i.canvas!==e.canvas)throw Error("You must create a new task to reset the canvas.");return super.l(e,t)}close(){this.O.close(),super.close()}};$c.prototype.close=$c.prototype.close;var Vc=class extends $c{constructor(e,t){super(new Bc(e,t),"image_in","norm_rect_in",!1),this.j={detections:[]},this.h=new Pu,e=new Fu,Uo(this.h,0,1,e),Qo(this.h,2,.5),Qo(this.h,3,.3)}get baseOptions(){return Po(this.h,Fu,1)}set baseOptions(e){Uo(this.h,0,1,e)}o(e){return"minDetectionConfidence"in e&&Qo(this.h,2,e.minDetectionConfidence??.5),"minSuppressionThreshold"in e&&Qo(this.h,3,e.minSuppressionThreshold??.3),this.l(e)}F(e,t){return this.j={detections:[]},zc(this,e,t),this.j}G(e,t,n){return this.j={detections:[]},Gc(this,e,n,t),this.j}m(){var e=new _l;Pl(e,"image_in"),Pl(e,"norm_rect_in"),Bl(e,"detections");const t=new bl;Ko(t,_u,this.h);const n=new Nl;Il(n,"mediapipe.tasks.vision.face_detector.FaceDetectorGraph"),Sl(n,"IMAGE:image_in"),Sl(n,"NORM_RECT:norm_rect_in"),Dl(n,"DETECTIONS:detections"),n.o(t),jl(e,n),this.g.attachProtoVectorListener("detections",((e,t)=>{for(const t of e)e=ru(t),this.j.detections.push(Rd(e));Kd(this,t)})),this.g.attachEmptyPacketListener("detections",(e=>{Kd(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Vc.prototype.detectForVideo=Vc.prototype.G,Vc.prototype.detect=Vc.prototype.F,Vc.prototype.setOptions=Vc.prototype.o,Vc.createFromModelPath=async function(e,t){return _c(Vc,e,{baseOptions:{modelAssetPath:t}})},Vc.createFromModelBuffer=function(e,t){return _c(Vc,e,{baseOptions:{modelAssetBuffer:t}})},Vc.createFromOptions=function(e,t){return _c(Vc,e,t)};var qc=Fc([61,146],[146,91],[91,181],[181,84],[84,17],[17,314],[314,405],[405,321],[321,375],[375,291],[61,185],[185,40],[40,39],[39,37],[37,0],[0,267],[267,269],[269,270],[270,409],[409,291],[78,95],[95,88],[88,178],[178,87],[87,14],[14,317],[317,402],[402,318],[318,324],[324,308],[78,191],[191,80],[80,81],[81,82],[82,13],[13,312],[312,311],[311,310],[310,415],[415,308]),Hc=Fc([263,249],[249,390],[390,373],[373,374],[374,380],[380,381],[381,382],[382,362],[263,466],[466,388],[388,387],[387,386],[386,385],[385,384],[384,398],[398,362]),Yc=Fc([276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]),Zc=Fc([474,475],[475,476],[476,477],[477,474]),Qc=Fc([33,7],[7,163],[163,144],[144,145],[145,153],[153,154],[154,155],[155,133],[33,246],[246,161],[161,160],[160,159],[159,158],[158,157],[157,173],[173,133]),Xc=Fc([46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]),Kc=Fc([469,470],[470,471],[471,472],[472,469]),Jc=Fc([10,338],[338,297],[297,332],[332,284],[284,251],[251,389],[389,356],[356,454],[454,323],[323,361],[361,288],[288,397],[397,365],[365,379],[379,378],[378,400],[400,377],[377,152],[152,148],[148,176],[176,149],[149,150],[150,136],[136,172],[172,58],[58,132],[132,93],[93,234],[234,127],[127,162],[162,21],[21,54],[54,103],[103,67],[67,109],[109,10]),ef=[...qc,...Hc,...Yc,...Qc,...Xc,...Jc],tf=Fc([127,34],[34,139],[139,127],[11,0],[0,37],[37,11],[232,231],[231,120],[120,232],[72,37],[37,39],[39,72],[128,121],[121,47],[47,128],[232,121],[121,128],[128,232],[104,69],[69,67],[67,104],[175,171],[171,148],[148,175],[118,50],[50,101],[101,118],[73,39],[39,40],[40,73],[9,151],[151,108],[108,9],[48,115],[115,131],[131,48],[194,204],[204,211],[211,194],[74,40],[40,185],[185,74],[80,42],[42,183],[183,80],[40,92],[92,186],[186,40],[230,229],[229,118],[118,230],[202,212],[212,214],[214,202],[83,18],[18,17],[17,83],[76,61],[61,146],[146,76],[160,29],[29,30],[30,160],[56,157],[157,173],[173,56],[106,204],[204,194],[194,106],[135,214],[214,192],[192,135],[203,165],[165,98],[98,203],[21,71],[71,68],[68,21],[51,45],[45,4],[4,51],[144,24],[24,23],[23,144],[77,146],[146,91],[91,77],[205,50],[50,187],[187,205],[201,200],[200,18],[18,201],[91,106],[106,182],[182,91],[90,91],[91,181],[181,90],[85,84],[84,17],[17,85],[206,203],[203,36],[36,206],[148,171],[171,140],[140,148],[92,40],[40,39],[39,92],[193,189],[189,244],[244,193],[159,158],[158,28],[28,159],[247,246],[246,161],[161,247],[236,3],[3,196],[196,236],[54,68],[68,104],[104,54],[193,168],[168,8],[8,193],[117,228],[228,31],[31,117],[189,193],[193,55],[55,189],[98,97],[97,99],[99,98],[126,47],[47,100],[100,126],[166,79],[79,218],[218,166],[155,154],[154,26],[26,155],[209,49],[49,131],[131,209],[135,136],[136,150],[150,135],[47,126],[126,217],[217,47],[223,52],[52,53],[53,223],[45,51],[51,134],[134,45],[211,170],[170,140],[140,211],[67,69],[69,108],[108,67],[43,106],[106,91],[91,43],[230,119],[119,120],[120,230],[226,130],[130,247],[247,226],[63,53],[53,52],[52,63],[238,20],[20,242],[242,238],[46,70],[70,156],[156,46],[78,62],[62,96],[96,78],[46,53],[53,63],[63,46],[143,34],[34,227],[227,143],[123,117],[117,111],[111,123],[44,125],[125,19],[19,44],[236,134],[134,51],[51,236],[216,206],[206,205],[205,216],[154,153],[153,22],[22,154],[39,37],[37,167],[167,39],[200,201],[201,208],[208,200],[36,142],[142,100],[100,36],[57,212],[212,202],[202,57],[20,60],[60,99],[99,20],[28,158],[158,157],[157,28],[35,226],[226,113],[113,35],[160,159],[159,27],[27,160],[204,202],[202,210],[210,204],[113,225],[225,46],[46,113],[43,202],[202,204],[204,43],[62,76],[76,77],[77,62],[137,123],[123,116],[116,137],[41,38],[38,72],[72,41],[203,129],[129,142],[142,203],[64,98],[98,240],[240,64],[49,102],[102,64],[64,49],[41,73],[73,74],[74,41],[212,216],[216,207],[207,212],[42,74],[74,184],[184,42],[169,170],[170,211],[211,169],[170,149],[149,176],[176,170],[105,66],[66,69],[69,105],[122,6],[6,168],[168,122],[123,147],[147,187],[187,123],[96,77],[77,90],[90,96],[65,55],[55,107],[107,65],[89,90],[90,180],[180,89],[101,100],[100,120],[120,101],[63,105],[105,104],[104,63],[93,137],[137,227],[227,93],[15,86],[86,85],[85,15],[129,102],[102,49],[49,129],[14,87],[87,86],[86,14],[55,8],[8,9],[9,55],[100,47],[47,121],[121,100],[145,23],[23,22],[22,145],[88,89],[89,179],[179,88],[6,122],[122,196],[196,6],[88,95],[95,96],[96,88],[138,172],[172,136],[136,138],[215,58],[58,172],[172,215],[115,48],[48,219],[219,115],[42,80],[80,81],[81,42],[195,3],[3,51],[51,195],[43,146],[146,61],[61,43],[171,175],[175,199],[199,171],[81,82],[82,38],[38,81],[53,46],[46,225],[225,53],[144,163],[163,110],[110,144],[52,65],[65,66],[66,52],[229,228],[228,117],[117,229],[34,127],[127,234],[234,34],[107,108],[108,69],[69,107],[109,108],[108,151],[151,109],[48,64],[64,235],[235,48],[62,78],[78,191],[191,62],[129,209],[209,126],[126,129],[111,35],[35,143],[143,111],[117,123],[123,50],[50,117],[222,65],[65,52],[52,222],[19,125],[125,141],[141,19],[221,55],[55,65],[65,221],[3,195],[195,197],[197,3],[25,7],[7,33],[33,25],[220,237],[237,44],[44,220],[70,71],[71,139],[139,70],[122,193],[193,245],[245,122],[247,130],[130,33],[33,247],[71,21],[21,162],[162,71],[170,169],[169,150],[150,170],[188,174],[174,196],[196,188],[216,186],[186,92],[92,216],[2,97],[97,167],[167,2],[141,125],[125,241],[241,141],[164,167],[167,37],[37,164],[72,38],[38,12],[12,72],[38,82],[82,13],[13,38],[63,68],[68,71],[71,63],[226,35],[35,111],[111,226],[101,50],[50,205],[205,101],[206,92],[92,165],[165,206],[209,198],[198,217],[217,209],[165,167],[167,97],[97,165],[220,115],[115,218],[218,220],[133,112],[112,243],[243,133],[239,238],[238,241],[241,239],[214,135],[135,169],[169,214],[190,173],[173,133],[133,190],[171,208],[208,32],[32,171],[125,44],[44,237],[237,125],[86,87],[87,178],[178,86],[85,86],[86,179],[179,85],[84,85],[85,180],[180,84],[83,84],[84,181],[181,83],[201,83],[83,182],[182,201],[137,93],[93,132],[132,137],[76,62],[62,183],[183,76],[61,76],[76,184],[184,61],[57,61],[61,185],[185,57],[212,57],[57,186],[186,212],[214,207],[207,187],[187,214],[34,143],[143,156],[156,34],[79,239],[239,237],[237,79],[123,137],[137,177],[177,123],[44,1],[1,4],[4,44],[201,194],[194,32],[32,201],[64,102],[102,129],[129,64],[213,215],[215,138],[138,213],[59,166],[166,219],[219,59],[242,99],[99,97],[97,242],[2,94],[94,141],[141,2],[75,59],[59,235],[235,75],[24,110],[110,228],[228,24],[25,130],[130,226],[226,25],[23,24],[24,229],[229,23],[22,23],[23,230],[230,22],[26,22],[22,231],[231,26],[112,26],[26,232],[232,112],[189,190],[190,243],[243,189],[221,56],[56,190],[190,221],[28,56],[56,221],[221,28],[27,28],[28,222],[222,27],[29,27],[27,223],[223,29],[30,29],[29,224],[224,30],[247,30],[30,225],[225,247],[238,79],[79,20],[20,238],[166,59],[59,75],[75,166],[60,75],[75,240],[240,60],[147,177],[177,215],[215,147],[20,79],[79,166],[166,20],[187,147],[147,213],[213,187],[112,233],[233,244],[244,112],[233,128],[128,245],[245,233],[128,114],[114,188],[188,128],[114,217],[217,174],[174,114],[131,115],[115,220],[220,131],[217,198],[198,236],[236,217],[198,131],[131,134],[134,198],[177,132],[132,58],[58,177],[143,35],[35,124],[124,143],[110,163],[163,7],[7,110],[228,110],[110,25],[25,228],[356,389],[389,368],[368,356],[11,302],[302,267],[267,11],[452,350],[350,349],[349,452],[302,303],[303,269],[269,302],[357,343],[343,277],[277,357],[452,453],[453,357],[357,452],[333,332],[332,297],[297,333],[175,152],[152,377],[377,175],[347,348],[348,330],[330,347],[303,304],[304,270],[270,303],[9,336],[336,337],[337,9],[278,279],[279,360],[360,278],[418,262],[262,431],[431,418],[304,408],[408,409],[409,304],[310,415],[415,407],[407,310],[270,409],[409,410],[410,270],[450,348],[348,347],[347,450],[422,430],[430,434],[434,422],[313,314],[314,17],[17,313],[306,307],[307,375],[375,306],[387,388],[388,260],[260,387],[286,414],[414,398],[398,286],[335,406],[406,418],[418,335],[364,367],[367,416],[416,364],[423,358],[358,327],[327,423],[251,284],[284,298],[298,251],[281,5],[5,4],[4,281],[373,374],[374,253],[253,373],[307,320],[320,321],[321,307],[425,427],[427,411],[411,425],[421,313],[313,18],[18,421],[321,405],[405,406],[406,321],[320,404],[404,405],[405,320],[315,16],[16,17],[17,315],[426,425],[425,266],[266,426],[377,400],[400,369],[369,377],[322,391],[391,269],[269,322],[417,465],[465,464],[464,417],[386,257],[257,258],[258,386],[466,260],[260,388],[388,466],[456,399],[399,419],[419,456],[284,332],[332,333],[333,284],[417,285],[285,8],[8,417],[346,340],[340,261],[261,346],[413,441],[441,285],[285,413],[327,460],[460,328],[328,327],[355,371],[371,329],[329,355],[392,439],[439,438],[438,392],[382,341],[341,256],[256,382],[429,420],[420,360],[360,429],[364,394],[394,379],[379,364],[277,343],[343,437],[437,277],[443,444],[444,283],[283,443],[275,440],[440,363],[363,275],[431,262],[262,369],[369,431],[297,338],[338,337],[337,297],[273,375],[375,321],[321,273],[450,451],[451,349],[349,450],[446,342],[342,467],[467,446],[293,334],[334,282],[282,293],[458,461],[461,462],[462,458],[276,353],[353,383],[383,276],[308,324],[324,325],[325,308],[276,300],[300,293],[293,276],[372,345],[345,447],[447,372],[352,345],[345,340],[340,352],[274,1],[1,19],[19,274],[456,248],[248,281],[281,456],[436,427],[427,425],[425,436],[381,256],[256,252],[252,381],[269,391],[391,393],[393,269],[200,199],[199,428],[428,200],[266,330],[330,329],[329,266],[287,273],[273,422],[422,287],[250,462],[462,328],[328,250],[258,286],[286,384],[384,258],[265,353],[353,342],[342,265],[387,259],[259,257],[257,387],[424,431],[431,430],[430,424],[342,353],[353,276],[276,342],[273,335],[335,424],[424,273],[292,325],[325,307],[307,292],[366,447],[447,345],[345,366],[271,303],[303,302],[302,271],[423,266],[266,371],[371,423],[294,455],[455,460],[460,294],[279,278],[278,294],[294,279],[271,272],[272,304],[304,271],[432,434],[434,427],[427,432],[272,407],[407,408],[408,272],[394,430],[430,431],[431,394],[395,369],[369,400],[400,395],[334,333],[333,299],[299,334],[351,417],[417,168],[168,351],[352,280],[280,411],[411,352],[325,319],[319,320],[320,325],[295,296],[296,336],[336,295],[319,403],[403,404],[404,319],[330,348],[348,349],[349,330],[293,298],[298,333],[333,293],[323,454],[454,447],[447,323],[15,16],[16,315],[315,15],[358,429],[429,279],[279,358],[14,15],[15,316],[316,14],[285,336],[336,9],[9,285],[329,349],[349,350],[350,329],[374,380],[380,252],[252,374],[318,402],[402,403],[403,318],[6,197],[197,419],[419,6],[318,319],[319,325],[325,318],[367,364],[364,365],[365,367],[435,367],[367,397],[397,435],[344,438],[438,439],[439,344],[272,271],[271,311],[311,272],[195,5],[5,281],[281,195],[273,287],[287,291],[291,273],[396,428],[428,199],[199,396],[311,271],[271,268],[268,311],[283,444],[444,445],[445,283],[373,254],[254,339],[339,373],[282,334],[334,296],[296,282],[449,347],[347,346],[346,449],[264,447],[447,454],[454,264],[336,296],[296,299],[299,336],[338,10],[10,151],[151,338],[278,439],[439,455],[455,278],[292,407],[407,415],[415,292],[358,371],[371,355],[355,358],[340,345],[345,372],[372,340],[346,347],[347,280],[280,346],[442,443],[443,282],[282,442],[19,94],[94,370],[370,19],[441,442],[442,295],[295,441],[248,419],[419,197],[197,248],[263,255],[255,359],[359,263],[440,275],[275,274],[274,440],[300,383],[383,368],[368,300],[351,412],[412,465],[465,351],[263,467],[467,466],[466,263],[301,368],[368,389],[389,301],[395,378],[378,379],[379,395],[412,351],[351,419],[419,412],[436,426],[426,322],[322,436],[2,164],[164,393],[393,2],[370,462],[462,461],[461,370],[164,0],[0,267],[267,164],[302,11],[11,12],[12,302],[268,12],[12,13],[13,268],[293,300],[300,301],[301,293],[446,261],[261,340],[340,446],[330,266],[266,425],[425,330],[426,423],[423,391],[391,426],[429,355],[355,437],[437,429],[391,327],[327,326],[326,391],[440,457],[457,438],[438,440],[341,382],[382,362],[362,341],[459,457],[457,461],[461,459],[434,430],[430,394],[394,434],[414,463],[463,362],[362,414],[396,369],[369,262],[262,396],[354,461],[461,457],[457,354],[316,403],[403,402],[402,316],[315,404],[404,403],[403,315],[314,405],[405,404],[404,314],[313,406],[406,405],[405,313],[421,418],[418,406],[406,421],[366,401],[401,361],[361,366],[306,408],[408,407],[407,306],[291,409],[409,408],[408,291],[287,410],[410,409],[409,287],[432,436],[436,410],[410,432],[434,416],[416,411],[411,434],[264,368],[368,383],[383,264],[309,438],[438,457],[457,309],[352,376],[376,401],[401,352],[274,275],[275,4],[4,274],[421,428],[428,262],[262,421],[294,327],[327,358],[358,294],[433,416],[416,367],[367,433],[289,455],[455,439],[439,289],[462,370],[370,326],[326,462],[2,326],[326,370],[370,2],[305,460],[460,455],[455,305],[254,449],[449,448],[448,254],[255,261],[261,446],[446,255],[253,450],[450,449],[449,253],[252,451],[451,450],[450,252],[256,452],[452,451],[451,256],[341,453],[453,452],[452,341],[413,464],[464,463],[463,413],[441,413],[413,414],[414,441],[258,442],[442,441],[441,258],[257,443],[443,442],[442,257],[259,444],[444,443],[443,259],[260,445],[445,444],[444,260],[467,342],[342,445],[445,467],[459,458],[458,250],[250,459],[289,392],[392,290],[290,289],[290,328],[328,460],[460,290],[376,433],[433,435],[435,376],[250,290],[290,392],[392,250],[411,416],[416,433],[433,411],[341,463],[463,464],[464,341],[453,464],[464,465],[465,453],[357,465],[465,412],[412,357],[343,412],[412,399],[399,343],[360,363],[363,440],[440,360],[437,399],[399,456],[456,437],[420,456],[456,363],[363,420],[401,435],[435,288],[288,401],[372,383],[383,353],[353,372],[339,255],[255,249],[249,339],[448,261],[261,255],[255,448],[133,243],[243,190],[190,133],[133,155],[155,112],[112,133],[33,246],[246,247],[247,33],[33,130],[130,25],[25,33],[398,384],[384,286],[286,398],[362,398],[398,414],[414,362],[362,463],[463,341],[341,362],[263,359],[359,467],[467,263],[263,249],[249,255],[255,263],[466,467],[467,260],[260,466],[75,60],[60,166],[166,75],[238,239],[239,79],[79,238],[162,127],[127,139],[139,162],[72,11],[11,37],[37,72],[121,232],[232,120],[120,121],[73,72],[72,39],[39,73],[114,128],[128,47],[47,114],[233,232],[232,128],[128,233],[103,104],[104,67],[67,103],[152,175],[175,148],[148,152],[119,118],[118,101],[101,119],[74,73],[73,40],[40,74],[107,9],[9,108],[108,107],[49,48],[48,131],[131,49],[32,194],[194,211],[211,32],[184,74],[74,185],[185,184],[191,80],[80,183],[183,191],[185,40],[40,186],[186,185],[119,230],[230,118],[118,119],[210,202],[202,214],[214,210],[84,83],[83,17],[17,84],[77,76],[76,146],[146,77],[161,160],[160,30],[30,161],[190,56],[56,173],[173,190],[182,106],[106,194],[194,182],[138,135],[135,192],[192,138],[129,203],[203,98],[98,129],[54,21],[21,68],[68,54],[5,51],[51,4],[4,5],[145,144],[144,23],[23,145],[90,77],[77,91],[91,90],[207,205],[205,187],[187,207],[83,201],[201,18],[18,83],[181,91],[91,182],[182,181],[180,90],[90,181],[181,180],[16,85],[85,17],[17,16],[205,206],[206,36],[36,205],[176,148],[148,140],[140,176],[165,92],[92,39],[39,165],[245,193],[193,244],[244,245],[27,159],[159,28],[28,27],[30,247],[247,161],[161,30],[174,236],[236,196],[196,174],[103,54],[54,104],[104,103],[55,193],[193,8],[8,55],[111,117],[117,31],[31,111],[221,189],[189,55],[55,221],[240,98],[98,99],[99,240],[142,126],[126,100],[100,142],[219,166],[166,218],[218,219],[112,155],[155,26],[26,112],[198,209],[209,131],[131,198],[169,135],[135,150],[150,169],[114,47],[47,217],[217,114],[224,223],[223,53],[53,224],[220,45],[45,134],[134,220],[32,211],[211,140],[140,32],[109,67],[67,108],[108,109],[146,43],[43,91],[91,146],[231,230],[230,120],[120,231],[113,226],[226,247],[247,113],[105,63],[63,52],[52,105],[241,238],[238,242],[242,241],[124,46],[46,156],[156,124],[95,78],[78,96],[96,95],[70,46],[46,63],[63,70],[116,143],[143,227],[227,116],[116,123],[123,111],[111,116],[1,44],[44,19],[19,1],[3,236],[236,51],[51,3],[207,216],[216,205],[205,207],[26,154],[154,22],[22,26],[165,39],[39,167],[167,165],[199,200],[200,208],[208,199],[101,36],[36,100],[100,101],[43,57],[57,202],[202,43],[242,20],[20,99],[99,242],[56,28],[28,157],[157,56],[124,35],[35,113],[113,124],[29,160],[160,27],[27,29],[211,204],[204,210],[210,211],[124,113],[113,46],[46,124],[106,43],[43,204],[204,106],[96,62],[62,77],[77,96],[227,137],[137,116],[116,227],[73,41],[41,72],[72,73],[36,203],[203,142],[142,36],[235,64],[64,240],[240,235],[48,49],[49,64],[64,48],[42,41],[41,74],[74,42],[214,212],[212,207],[207,214],[183,42],[42,184],[184,183],[210,169],[169,211],[211,210],[140,170],[170,176],[176,140],[104,105],[105,69],[69,104],[193,122],[122,168],[168,193],[50,123],[123,187],[187,50],[89,96],[96,90],[90,89],[66,65],[65,107],[107,66],[179,89],[89,180],[180,179],[119,101],[101,120],[120,119],[68,63],[63,104],[104,68],[234,93],[93,227],[227,234],[16,15],[15,85],[85,16],[209,129],[129,49],[49,209],[15,14],[14,86],[86,15],[107,55],[55,9],[9,107],[120,100],[100,121],[121,120],[153,145],[145,22],[22,153],[178,88],[88,179],[179,178],[197,6],[6,196],[196,197],[89,88],[88,96],[96,89],[135,138],[138,136],[136,135],[138,215],[215,172],[172,138],[218,115],[115,219],[219,218],[41,42],[42,81],[81,41],[5,195],[195,51],[51,5],[57,43],[43,61],[61,57],[208,171],[171,199],[199,208],[41,81],[81,38],[38,41],[224,53],[53,225],[225,224],[24,144],[144,110],[110,24],[105,52],[52,66],[66,105],[118,229],[229,117],[117,118],[227,34],[34,234],[234,227],[66,107],[107,69],[69,66],[10,109],[109,151],[151,10],[219,48],[48,235],[235,219],[183,62],[62,191],[191,183],[142,129],[129,126],[126,142],[116,111],[111,143],[143,116],[118,117],[117,50],[50,118],[223,222],[222,52],[52,223],[94,19],[19,141],[141,94],[222,221],[221,65],[65,222],[196,3],[3,197],[197,196],[45,220],[220,44],[44,45],[156,70],[70,139],[139,156],[188,122],[122,245],[245,188],[139,71],[71,162],[162,139],[149,170],[170,150],[150,149],[122,188],[188,196],[196,122],[206,216],[216,92],[92,206],[164,2],[2,167],[167,164],[242,141],[141,241],[241,242],[0,164],[164,37],[37,0],[11,72],[72,12],[12,11],[12,38],[38,13],[13,12],[70,63],[63,71],[71,70],[31,226],[226,111],[111,31],[36,101],[101,205],[205,36],[203,206],[206,165],[165,203],[126,209],[209,217],[217,126],[98,165],[165,97],[97,98],[237,220],[220,218],[218,237],[237,239],[239,241],[241,237],[210,214],[214,169],[169,210],[140,171],[171,32],[32,140],[241,125],[125,237],[237,241],[179,86],[86,178],[178,179],[180,85],[85,179],[179,180],[181,84],[84,180],[180,181],[182,83],[83,181],[181,182],[194,201],[201,182],[182,194],[177,137],[137,132],[132,177],[184,76],[76,183],[183,184],[185,61],[61,184],[184,185],[186,57],[57,185],[185,186],[216,212],[212,186],[186,216],[192,214],[214,187],[187,192],[139,34],[34,156],[156,139],[218,79],[79,237],[237,218],[147,123],[123,177],[177,147],[45,44],[44,4],[4,45],[208,201],[201,32],[32,208],[98,64],[64,129],[129,98],[192,213],[213,138],[138,192],[235,59],[59,219],[219,235],[141,242],[242,97],[97,141],[97,2],[2,141],[141,97],[240,75],[75,235],[235,240],[229,24],[24,228],[228,229],[31,25],[25,226],[226,31],[230,23],[23,229],[229,230],[231,22],[22,230],[230,231],[232,26],[26,231],[231,232],[233,112],[112,232],[232,233],[244,189],[189,243],[243,244],[189,221],[221,190],[190,189],[222,28],[28,221],[221,222],[223,27],[27,222],[222,223],[224,29],[29,223],[223,224],[225,30],[30,224],[224,225],[113,247],[247,225],[225,113],[99,60],[60,240],[240,99],[213,147],[147,215],[215,213],[60,20],[20,166],[166,60],[192,187],[187,213],[213,192],[243,112],[112,244],[244,243],[244,233],[233,245],[245,244],[245,128],[128,188],[188,245],[188,114],[114,174],[174,188],[134,131],[131,220],[220,134],[174,217],[217,236],[236,174],[236,198],[198,134],[134,236],[215,177],[177,58],[58,215],[156,143],[143,124],[124,156],[25,110],[110,7],[7,25],[31,228],[228,25],[25,31],[264,356],[356,368],[368,264],[0,11],[11,267],[267,0],[451,452],[452,349],[349,451],[267,302],[302,269],[269,267],[350,357],[357,277],[277,350],[350,452],[452,357],[357,350],[299,333],[333,297],[297,299],[396,175],[175,377],[377,396],[280,347],[347,330],[330,280],[269,303],[303,270],[270,269],[151,9],[9,337],[337,151],[344,278],[278,360],[360,344],[424,418],[418,431],[431,424],[270,304],[304,409],[409,270],[272,310],[310,407],[407,272],[322,270],[270,410],[410,322],[449,450],[450,347],[347,449],[432,422],[422,434],[434,432],[18,313],[313,17],[17,18],[291,306],[306,375],[375,291],[259,387],[387,260],[260,259],[424,335],[335,418],[418,424],[434,364],[364,416],[416,434],[391,423],[423,327],[327,391],[301,251],[251,298],[298,301],[275,281],[281,4],[4,275],[254,373],[373,253],[253,254],[375,307],[307,321],[321,375],[280,425],[425,411],[411,280],[200,421],[421,18],[18,200],[335,321],[321,406],[406,335],[321,320],[320,405],[405,321],[314,315],[315,17],[17,314],[423,426],[426,266],[266,423],[396,377],[377,369],[369,396],[270,322],[322,269],[269,270],[413,417],[417,464],[464,413],[385,386],[386,258],[258,385],[248,456],[456,419],[419,248],[298,284],[284,333],[333,298],[168,417],[417,8],[8,168],[448,346],[346,261],[261,448],[417,413],[413,285],[285,417],[326,327],[327,328],[328,326],[277,355],[355,329],[329,277],[309,392],[392,438],[438,309],[381,382],[382,256],[256,381],[279,429],[429,360],[360,279],[365,364],[364,379],[379,365],[355,277],[277,437],[437,355],[282,443],[443,283],[283,282],[281,275],[275,363],[363,281],[395,431],[431,369],[369,395],[299,297],[297,337],[337,299],[335,273],[273,321],[321,335],[348,450],[450,349],[349,348],[359,446],[446,467],[467,359],[283,293],[293,282],[282,283],[250,458],[458,462],[462,250],[300,276],[276,383],[383,300],[292,308],[308,325],[325,292],[283,276],[276,293],[293,283],[264,372],[372,447],[447,264],[346,352],[352,340],[340,346],[354,274],[274,19],[19,354],[363,456],[456,281],[281,363],[426,436],[436,425],[425,426],[380,381],[381,252],[252,380],[267,269],[269,393],[393,267],[421,200],[200,428],[428,421],[371,266],[266,329],[329,371],[432,287],[287,422],[422,432],[290,250],[250,328],[328,290],[385,258],[258,384],[384,385],[446,265],[265,342],[342,446],[386,387],[387,257],[257,386],[422,424],[424,430],[430,422],[445,342],[342,276],[276,445],[422,273],[273,424],[424,422],[306,292],[292,307],[307,306],[352,366],[366,345],[345,352],[268,271],[271,302],[302,268],[358,423],[423,371],[371,358],[327,294],[294,460],[460,327],[331,279],[279,294],[294,331],[303,271],[271,304],[304,303],[436,432],[432,427],[427,436],[304,272],[272,408],[408,304],[395,394],[394,431],[431,395],[378,395],[395,400],[400,378],[296,334],[334,299],[299,296],[6,351],[351,168],[168,6],[376,352],[352,411],[411,376],[307,325],[325,320],[320,307],[285,295],[295,336],[336,285],[320,319],[319,404],[404,320],[329,330],[330,349],[349,329],[334,293],[293,333],[333,334],[366,323],[323,447],[447,366],[316,15],[15,315],[315,316],[331,358],[358,279],[279,331],[317,14],[14,316],[316,317],[8,285],[285,9],[9,8],[277,329],[329,350],[350,277],[253,374],[374,252],[252,253],[319,318],[318,403],[403,319],[351,6],[6,419],[419,351],[324,318],[318,325],[325,324],[397,367],[367,365],[365,397],[288,435],[435,397],[397,288],[278,344],[344,439],[439,278],[310,272],[272,311],[311,310],[248,195],[195,281],[281,248],[375,273],[273,291],[291,375],[175,396],[396,199],[199,175],[312,311],[311,268],[268,312],[276,283],[283,445],[445,276],[390,373],[373,339],[339,390],[295,282],[282,296],[296,295],[448,449],[449,346],[346,448],[356,264],[264,454],[454,356],[337,336],[336,299],[299,337],[337,338],[338,151],[151,337],[294,278],[278,455],[455,294],[308,292],[292,415],[415,308],[429,358],[358,355],[355,429],[265,340],[340,372],[372,265],[352,346],[346,280],[280,352],[295,442],[442,282],[282,295],[354,19],[19,370],[370,354],[285,441],[441,295],[295,285],[195,248],[248,197],[197,195],[457,440],[440,274],[274,457],[301,300],[300,368],[368,301],[417,351],[351,465],[465,417],[251,301],[301,389],[389,251],[394,395],[395,379],[379,394],[399,412],[412,419],[419,399],[410,436],[436,322],[322,410],[326,2],[2,393],[393,326],[354,370],[370,461],[461,354],[393,164],[164,267],[267,393],[268,302],[302,12],[12,268],[312,268],[268,13],[13,312],[298,293],[293,301],[301,298],[265,446],[446,340],[340,265],[280,330],[330,425],[425,280],[322,426],[426,391],[391,322],[420,429],[429,437],[437,420],[393,391],[391,326],[326,393],[344,440],[440,438],[438,344],[458,459],[459,461],[461,458],[364,434],[434,394],[394,364],[428,396],[396,262],[262,428],[274,354],[354,457],[457,274],[317,316],[316,402],[402,317],[316,315],[315,403],[403,316],[315,314],[314,404],[404,315],[314,313],[313,405],[405,314],[313,421],[421,406],[406,313],[323,366],[366,361],[361,323],[292,306],[306,407],[407,292],[306,291],[291,408],[408,306],[291,287],[287,409],[409,291],[287,432],[432,410],[410,287],[427,434],[434,411],[411,427],[372,264],[264,383],[383,372],[459,309],[309,457],[457,459],[366,352],[352,401],[401,366],[1,274],[274,4],[4,1],[418,421],[421,262],[262,418],[331,294],[294,358],[358,331],[435,433],[433,367],[367,435],[392,289],[289,439],[439,392],[328,462],[462,326],[326,328],[94,2],[2,370],[370,94],[289,305],[305,455],[455,289],[339,254],[254,448],[448,339],[359,255],[255,446],[446,359],[254,253],[253,449],[449,254],[253,252],[252,450],[450,253],[252,256],[256,451],[451,252],[256,341],[341,452],[452,256],[414,413],[413,463],[463,414],[286,441],[441,414],[414,286],[286,258],[258,441],[441,286],[258,257],[257,442],[442,258],[257,259],[259,443],[443,257],[259,260],[260,444],[444,259],[260,467],[467,445],[445,260],[309,459],[459,250],[250,309],[305,289],[289,290],[290,305],[305,290],[290,460],[460,305],[401,376],[376,435],[435,401],[309,250],[250,392],[392,309],[376,411],[411,433],[433,376],[453,341],[341,464],[464,453],[357,453],[453,465],[465,357],[343,357],[357,412],[412,343],[437,343],[343,399],[399,437],[344,360],[360,440],[440,344],[420,437],[437,456],[456,420],[360,420],[420,363],[363,360],[361,401],[401,288],[288,361],[265,372],[372,353],[353,265],[390,339],[339,249],[249,390],[339,448],[448,255],[255,339]);function nf(e){e.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]}}var af=class extends $c{constructor(e,t){super(new Bc(e,t),"image_in","norm_rect",!1),this.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]},this.outputFacialTransformationMatrixes=this.outputFaceBlendshapes=!1,this.h=new qu,e=new Fu,Uo(this.h,0,1,e),this.v=new $u,Uo(this.h,0,3,this.v),this.s=new Pu,Uo(this.h,0,2,this.s),Zo(this.s,4,1),Qo(this.s,2,.5),Qo(this.v,2,.5),Qo(this.h,4,.5)}get baseOptions(){return Po(this.h,Fu,1)}set baseOptions(e){Uo(this.h,0,1,e)}o(e){return"numFaces"in e&&Zo(this.s,4,e.numFaces??1),"minFaceDetectionConfidence"in e&&Qo(this.s,2,e.minFaceDetectionConfidence??.5),"minTrackingConfidence"in e&&Qo(this.h,4,e.minTrackingConfidence??.5),"minFacePresenceConfidence"in e&&Qo(this.v,2,e.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),"outputFacialTransformationMatrixes"in e&&(this.outputFacialTransformationMatrixes=!!e.outputFacialTransformationMatrixes),this.l(e)}F(e,t){return nf(this),zc(this,e,t),this.j}G(e,t,n){return nf(this),Gc(this,e,n,t),this.j}m(){var e=new _l;Pl(e,"image_in"),Pl(e,"norm_rect"),Bl(e,"face_landmarks");const t=new bl;Ko(t,Yu,this.h);const n=new Nl;Il(n,"mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph"),Sl(n,"IMAGE:image_in"),Sl(n,"NORM_RECT:norm_rect"),Dl(n,"NORM_LANDMARKS:face_landmarks"),n.o(t),jl(e,n),this.g.attachProtoVectorListener("face_landmarks",((e,t)=>{for(const t of e)e=fu(t),this.j.faceLandmarks.push(Od(e));Kd(this,t)})),this.g.attachEmptyPacketListener("face_landmarks",(e=>{Kd(this,e)})),this.outputFaceBlendshapes&&(Bl(e,"blendshapes"),Dl(n,"BLENDSHAPES:blendshapes"),this.g.attachProtoVectorListener("blendshapes",((e,t)=>{if(this.outputFaceBlendshapes)for(const t of e)e=Hl(t),this.j.faceBlendshapes.push(Ld(e.g()??[]));Kd(this,t)})),this.g.attachEmptyPacketListener("blendshapes",(e=>{Kd(this,e)}))),this.outputFacialTransformationMatrixes&&(Bl(e,"face_geometry"),Dl(n,"FACE_GEOMETRY:face_geometry"),this.g.attachProtoVectorListener("face_geometry",((e,t)=>{if(this.outputFacialTransformationMatrixes)for(const t of e)(e=Po(Gu(t),hu,2))&&this.j.facialTransformationMatrixes.push({rows:qo(Wo(e,1))??0,columns:qo(Wo(e,2))??0,data:So(e,3,Gi)??[]});Kd(this,t)})),this.g.attachEmptyPacketListener("face_geometry",(e=>{Kd(this,e)}))),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};af.prototype.detectForVideo=af.prototype.G,af.prototype.detect=af.prototype.F,af.prototype.setOptions=af.prototype.o,af.createFromModelPath=function(e,t){return _c(af,e,{baseOptions:{modelAssetPath:t}})},af.createFromModelBuffer=function(e,t){return _c(af,e,{baseOptions:{modelAssetBuffer:t}})},af.createFromOptions=function(e,t){return _c(af,e,t)},af.FACE_LANDMARKS_LIPS=qc,af.FACE_LANDMARKS_LEFT_EYE=Hc,af.FACE_LANDMARKS_LEFT_EYEBROW=Yc,af.FACE_LANDMARKS_LEFT_IRIS=Zc,af.FACE_LANDMARKS_RIGHT_EYE=Qc,af.FACE_LANDMARKS_RIGHT_EYEBROW=Xc,af.FACE_LANDMARKS_RIGHT_IRIS=Kc,af.FACE_LANDMARKS_FACE_OVAL=Jc,af.FACE_LANDMARKS_CONTOURS=ef,af.FACE_LANDMARKS_TESSELATION=tf;var rf=class extends $c{constructor(e,t){super(new Bc(e,t),"image_in","norm_rect",!0),this.j=new Zu,e=new Fu,Uo(this.j,0,1,e)}get baseOptions(){return Po(this.j,Fu,1)}set baseOptions(e){Uo(this.j,0,1,e)}o(e){return super.l(e)}Da(e,t,n){const a="function"!=typeof t?t:{};if(this.h="function"==typeof t?t:n,zc(this,e,a??{}),!this.h)return this.s}m(){var e=new _l;Pl(e,"image_in"),Pl(e,"norm_rect"),Bl(e,"stylized_image");const t=new bl;Ko(t,Qu,this.j);const n=new Nl;Il(n,"mediapipe.tasks.vision.face_stylizer.FaceStylizerGraph"),Sl(n,"IMAGE:image_in"),Sl(n,"NORM_RECT:norm_rect"),Dl(n,"STYLIZED_IMAGE:stylized_image"),n.o(t),jl(e,n),this.g.S("stylized_image",((e,t)=>{var n=!this.h,a=e.data,r=e.width;const i=r*(e=e.height);if(a instanceof Uint8Array)if(a.length===3*i){const t=new Uint8ClampedArray(4*i);for(let e=0;e<i;++e)t[4*e]=a[3*e],t[4*e+1]=a[3*e+1],t[4*e+2]=a[3*e+2],t[4*e+3]=255;a=new ImageData(t,r,e)}else{if(a.length!==4*i)throw Error("Unsupported channel count: "+a.length/i);a=new ImageData(new Uint8ClampedArray(a.buffer,a.byteOffset,a.length),r,e)}else if(!(a instanceof WebGLTexture))throw Error(`Unsupported format: ${a.constructor.name}`);r=new Cc([a],!1,!1,this.g.i.canvas,this.O,r,e),this.s=n=n?r.clone():r,this.h&&this.h(n),Kd(this,t)})),this.g.attachEmptyPacketListener("stylized_image",(e=>{this.s=null,this.h&&this.h(null),Kd(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};rf.prototype.stylize=rf.prototype.Da,rf.prototype.setOptions=rf.prototype.o,rf.createFromModelPath=function(e,t){return _c(rf,e,{baseOptions:{modelAssetPath:t}})},rf.createFromModelBuffer=function(e,t){return _c(rf,e,{baseOptions:{modelAssetBuffer:t}})},rf.createFromOptions=function(e,t){return _c(rf,e,t)};var of=Fc([0,1],[1,2],[2,3],[3,4],[0,5],[5,6],[6,7],[7,8],[5,9],[9,10],[10,11],[11,12],[9,13],[13,14],[14,15],[15,16],[13,17],[0,17],[17,18],[18,19],[19,20]);function sf(e){e.gestures=[],e.landmarks=[],e.worldLandmarks=[],e.handedness=[]}function lf(e){return 0===e.gestures.length?{gestures:[],landmarks:[],worldLandmarks:[],handedness:[],handednesses:[]}:{gestures:e.gestures,landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handedness:e.handedness,handednesses:e.handedness}}function uf(e,t=!0){const n=[];for(const r of e){var a=Hl(r);e=[];for(const n of a.g())a=t&&null!=Wo(n,1)?qo(Wo(n,1)):-1,e.push({score:Ho(n,2)??0,index:a,categoryName:Vo(n,3)??""??"",displayName:Vo(n,4)??""??""});n.push(e)}return n}var df=class extends $c{constructor(e,t){super(new Bc(e,t),"image_in","norm_rect",!1),this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handedness=[],this.v=new ld,e=new Fu,Uo(this.v,0,1,e),this.C=new od,Uo(this.v,0,2,this.C),this.s=new rd,Uo(this.C,0,3,this.s),this.h=new nd,Uo(this.C,0,2,this.h),this.j=new ed,Uo(this.v,0,3,this.j),Qo(this.h,2,.5),Qo(this.C,4,.5),Qo(this.s,2,.5)}get baseOptions(){return Po(this.v,Fu,1)}set baseOptions(e){Uo(this.v,0,1,e)}o(e){if(Zo(this.h,3,e.numHands??1),"minHandDetectionConfidence"in e&&Qo(this.h,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&Qo(this.C,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&Qo(this.s,2,e.minHandPresenceConfidence??.5),e.cannedGesturesClassifierOptions){var t=new Xu,n=Ad(e.cannedGesturesClassifierOptions,Po(this.j,Xu,3)?.h());Uo(t,0,2,n),Uo(this.j,0,3,t)}else void 0===e.cannedGesturesClassifierOptions&&Po(this.j,Xu,3)?.g();return e.customGesturesClassifierOptions?(Uo(t=new Xu,0,2,n=Ad(e.customGesturesClassifierOptions,Po(this.j,Xu,4)?.h())),Uo(this.j,0,4,t)):void 0===e.customGesturesClassifierOptions&&Po(this.j,Xu,4)?.g(),this.l(e)}ya(e,t){return sf(this),zc(this,e,t),lf(this)}za(e,t,n){return sf(this),Gc(this,e,n,t),lf(this)}m(){var e=new _l;Pl(e,"image_in"),Pl(e,"norm_rect"),Bl(e,"hand_gestures"),Bl(e,"hand_landmarks"),Bl(e,"world_hand_landmarks"),Bl(e,"handedness");const t=new bl;Ko(t,cd,this.v);const n=new Nl;Il(n,"mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph"),Sl(n,"IMAGE:image_in"),Sl(n,"NORM_RECT:norm_rect"),Dl(n,"HAND_GESTURES:hand_gestures"),Dl(n,"LANDMARKS:hand_landmarks"),Dl(n,"WORLD_LANDMARKS:world_hand_landmarks"),Dl(n,"HANDEDNESS:handedness"),n.o(t),jl(e,n),this.g.attachProtoVectorListener("hand_landmarks",((e,t)=>{for(const t of e){e=fu(t);const n=[];for(const t of _o(e,uu,1))n.push({x:Ho(t,1)??0,y:Ho(t,2)??0,z:Ho(t,3)??0});this.landmarks.push(n)}Kd(this,t)})),this.g.attachEmptyPacketListener("hand_landmarks",(e=>{Kd(this,e)})),this.g.attachProtoVectorListener("world_hand_landmarks",((e,t)=>{for(const t of e){e=lu(t);const n=[];for(const t of _o(e,iu,1))n.push({x:Ho(t,1)??0,y:Ho(t,2)??0,z:Ho(t,3)??0});this.worldLandmarks.push(n)}Kd(this,t)})),this.g.attachEmptyPacketListener("world_hand_landmarks",(e=>{Kd(this,e)})),this.g.attachProtoVectorListener("hand_gestures",((e,t)=>{this.gestures.push(...uf(e,!1)),Kd(this,t)})),this.g.attachEmptyPacketListener("hand_gestures",(e=>{Kd(this,e)})),this.g.attachProtoVectorListener("handedness",((e,t)=>{this.handedness.push(...uf(e)),Kd(this,t)})),this.g.attachEmptyPacketListener("handedness",(e=>{Kd(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};function cf(e){return{landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handednesses:e.handedness,handedness:e.handedness}}df.prototype.recognizeForVideo=df.prototype.za,df.prototype.recognize=df.prototype.ya,df.prototype.setOptions=df.prototype.o,df.createFromModelPath=function(e,t){return _c(df,e,{baseOptions:{modelAssetPath:t}})},df.createFromModelBuffer=function(e,t){return _c(df,e,{baseOptions:{modelAssetBuffer:t}})},df.createFromOptions=function(e,t){return _c(df,e,t)},df.HAND_CONNECTIONS=of;var ff=class extends $c{constructor(e,t){super(new Bc(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.handedness=[],this.j=new od,e=new Fu,Uo(this.j,0,1,e),this.s=new rd,Uo(this.j,0,3,this.s),this.h=new nd,Uo(this.j,0,2,this.h),Zo(this.h,3,1),Qo(this.h,2,.5),Qo(this.s,2,.5),Qo(this.j,4,.5)}get baseOptions(){return Po(this.j,Fu,1)}set baseOptions(e){Uo(this.j,0,1,e)}o(e){return"numHands"in e&&Zo(this.h,3,e.numHands??1),"minHandDetectionConfidence"in e&&Qo(this.h,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&Qo(this.j,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&Qo(this.s,2,e.minHandPresenceConfidence??.5),this.l(e)}F(e,t){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],zc(this,e,t),cf(this)}G(e,t,n){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],Gc(this,e,n,t),cf(this)}m(){var e=new _l;Pl(e,"image_in"),Pl(e,"norm_rect"),Bl(e,"hand_landmarks"),Bl(e,"world_hand_landmarks"),Bl(e,"handedness");const t=new bl;Ko(t,dd,this.j);const n=new Nl;Il(n,"mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph"),Sl(n,"IMAGE:image_in"),Sl(n,"NORM_RECT:norm_rect"),Dl(n,"LANDMARKS:hand_landmarks"),Dl(n,"WORLD_LANDMARKS:world_hand_landmarks"),Dl(n,"HANDEDNESS:handedness"),n.o(t),jl(e,n),this.g.attachProtoVectorListener("hand_landmarks",((e,t)=>{for(const t of e)e=fu(t),this.landmarks.push(Od(e));Kd(this,t)})),this.g.attachEmptyPacketListener("hand_landmarks",(e=>{Kd(this,e)})),this.g.attachProtoVectorListener("world_hand_landmarks",((e,t)=>{for(const t of e)e=lu(t),this.worldLandmarks.push(Fd(e));Kd(this,t)})),this.g.attachEmptyPacketListener("world_hand_landmarks",(e=>{Kd(this,e)})),this.g.attachProtoVectorListener("handedness",((e,t)=>{var n=this.handedness,a=n.push;const r=[];for(const t of e){e=Hl(t);const n=[];for(const t of e.g())n.push({score:Ho(t,2)??0,index:qo(Wo(t,1))??-1,categoryName:Vo(t,3)??""??"",displayName:Vo(t,4)??""??""});r.push(n)}a.call(n,...r),Kd(this,t)})),this.g.attachEmptyPacketListener("handedness",(e=>{Kd(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};ff.prototype.detectForVideo=ff.prototype.G,ff.prototype.detect=ff.prototype.F,ff.prototype.setOptions=ff.prototype.o,ff.createFromModelPath=function(e,t){return _c(ff,e,{baseOptions:{modelAssetPath:t}})},ff.createFromModelBuffer=function(e,t){return _c(ff,e,{baseOptions:{modelAssetBuffer:t}})},ff.createFromOptions=function(e,t){return _c(ff,e,t)},ff.HAND_CONNECTIONS=of;var hf=class extends $c{constructor(e,t){super(new Bc(e,t),"input_image","norm_rect",!0),this.j={classifications:[]},this.h=new fd,e=new Fu,Uo(this.h,0,1,e)}get baseOptions(){return Po(this.h,Fu,1)}set baseOptions(e){Uo(this.h,0,1,e)}o(e){var t=Ad(e,Po(this.h,Iu,2));return Uo(this.h,0,2,t),this.l(e)}ia(e,t){return this.j={classifications:[]},zc(this,e,t),this.j}ja(e,t,n){return this.j={classifications:[]},Gc(this,e,n,t),this.j}m(){var e=new _l;Pl(e,"input_image"),Pl(e,"norm_rect"),Bl(e,"classifications");const t=new bl;Ko(t,hd,this.h);const n=new Nl;Il(n,"mediapipe.tasks.vision.image_classifier.ImageClassifierGraph"),Sl(n,"IMAGE:input_image"),Sl(n,"NORM_RECT:norm_rect"),Dl(n,"CLASSIFICATIONS:classifications"),n.o(t),jl(e,n),this.g.attachProtoListener("classifications",((e,t)=>{this.j=function(e){const t={classifications:_o(e,gu,1).map((e=>Ld(Po(e,Vl,4)?.g()??[],qo(Wo(e,2)),Vo(e,3)??"")))};return null!=$o(e)&&(t.timestampMs=qo($o(e))),t}(bu(e)),Kd(this,t)})),this.g.attachEmptyPacketListener("classifications",(e=>{Kd(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};hf.prototype.classifyForVideo=hf.prototype.ja,hf.prototype.classify=hf.prototype.ia,hf.prototype.setOptions=hf.prototype.o,hf.createFromModelPath=function(e,t){return _c(hf,e,{baseOptions:{modelAssetPath:t}})},hf.createFromModelBuffer=function(e,t){return _c(hf,e,{baseOptions:{modelAssetBuffer:t}})},hf.createFromOptions=function(e,t){return _c(hf,e,t)};var pf=class extends $c{constructor(e,t){super(new Bc(e,t),"image_in","norm_rect",!0),this.h=new pd,this.embeddings={embeddings:[]},e=new Fu,Uo(this.h,0,1,e)}get baseOptions(){return Po(this.h,Fu,1)}set baseOptions(e){Uo(this.h,0,1,e)}o(e){var t=this.h,n=Po(this.h,Du,2);return n=n?n.clone():new Du,void 0!==e.l2Normalize?Yo(n,1,e.l2Normalize):"l2Normalize"in e&&Eo(n,1),void 0!==e.quantize?Yo(n,2,e.quantize):"quantize"in e&&Eo(n,2),Uo(t,0,2,n),this.l(e)}na(e,t){return zc(this,e,t),this.embeddings}oa(e,t,n){return Gc(this,e,n,t),this.embeddings}m(){var e=new _l;Pl(e,"image_in"),Pl(e,"norm_rect"),Bl(e,"embeddings_out");const t=new bl;Ko(t,md,this.h);const n=new Nl;Il(n,"mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph"),Sl(n,"IMAGE:image_in"),Sl(n,"NORM_RECT:norm_rect"),Dl(n,"EMBEDDINGS:embeddings_out"),n.o(t),jl(e,n),this.g.attachProtoListener("embeddings_out",((e,t)=>{e=Mu(e),this.embeddings=function(e){return{embeddings:_o(e,wu,1).map((e=>{const t={headIndex:qo(Wo(e,3))??-1,headName:Vo(e,4)??""??""};if(void 0!==jo(e,xu,Ro(e,1)))e=So(e=Po(e,xu,Ro(e,1)),1,Gi),t.floatEmbedding=e;else{const n=new Uint8Array(0);t.quantizedEmbedding=Po(e,Cu,Ro(e,2))?.fa()?.ha()??n}return t})),timestampMs:qo($o(e))}}(e),Kd(this,t)})),this.g.attachEmptyPacketListener("embeddings_out",(e=>{Kd(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};pf.cosineSimilarity=function(e,t){if(e.floatEmbedding&&t.floatEmbedding)e=Pd(e.floatEmbedding,t.floatEmbedding);else{if(!e.quantizedEmbedding||!t.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");e=Pd(jd(e.quantizedEmbedding),jd(t.quantizedEmbedding))}return e},pf.prototype.embedForVideo=pf.prototype.oa,pf.prototype.embed=pf.prototype.na,pf.prototype.setOptions=pf.prototype.o,pf.createFromModelPath=function(e,t){return _c(pf,e,{baseOptions:{modelAssetPath:t}})},pf.createFromModelBuffer=function(e,t){return _c(pf,e,{baseOptions:{modelAssetBuffer:t}})},pf.createFromOptions=function(e,t){return _c(pf,e,t)};var mf=class{constructor(e,t,n){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=n}close(){this.confidenceMasks?.forEach((e=>{e.close()})),this.categoryMask?.close()}};function gf(e){e.categoryMask=void 0,e.confidenceMasks=void 0,e.qualityScores=void 0}function vf(e){try{const t=new mf(e.confidenceMasks,e.categoryMask,e.qualityScores);if(!e.j)return t;e.j(t)}finally{tc(e)}}mf.prototype.close=mf.prototype.close;var yf=class extends $c{constructor(e,t){super(new Bc(e,t),"image_in","norm_rect",!1),this.s=[],this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new xd,this.v=new gd,Uo(this.h,0,3,this.v),e=new Fu,Uo(this.h,0,1,e)}get baseOptions(){return Po(this.h,Fu,1)}set baseOptions(e){Uo(this.h,0,1,e)}o(e){return void 0!==e.displayNamesLocale?Eo(this.h,2,Yi(e.displayNamesLocale)):"displayNamesLocale"in e&&Eo(this.h,2),"outputCategoryMask"in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}P(){!function(e){const t=_o(e.W(),Nl,1).filter((e=>(Vo(e,1)??"").includes("mediapipe.tasks.TensorsToSegmentationCalculator")));if(e.s=[],1<t.length)throw Error("The graph has more than one mediapipe.tasks.TensorsToSegmentationCalculator.");1===t.length&&(Po(t[0],bl,7)?.l()?.g()??new Map).forEach(((t,n)=>{e.s[Number(n)]=Vo(t,1)??""}))}(this)}X(e,t,n){const a="function"!=typeof t?t:{};return this.j="function"==typeof t?t:n,gf(this),zc(this,e,a),vf(this)}Ca(e,t,n,a){const r="function"!=typeof n?n:{};return this.j="function"==typeof n?n:a,gf(this),Gc(this,e,r,t),vf(this)}ta(){return this.s}m(){var e=new _l;Pl(e,"image_in"),Pl(e,"norm_rect");const t=new bl;Ko(t,Cd,this.h);const n=new Nl;Il(n,"mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph"),Sl(n,"IMAGE:image_in"),Sl(n,"NORM_RECT:norm_rect"),n.o(t),jl(e,n),Jd(this,e),this.outputConfidenceMasks&&(Bl(e,"confidence_masks"),Dl(n,"CONFIDENCE_MASKS:confidence_masks"),ec(this,"confidence_masks"),this.g.T("confidence_masks",((e,t)=>{this.confidenceMasks=e.map((e=>Wc(this,e,!this.j))),Kd(this,t)})),this.g.attachEmptyPacketListener("confidence_masks",(e=>{this.confidenceMasks=[],Kd(this,e)}))),this.outputCategoryMask&&(Bl(e,"category_mask"),Dl(n,"CATEGORY_MASK:category_mask"),ec(this,"category_mask"),this.g.S("category_mask",((e,t)=>{this.categoryMask=Wc(this,e,!this.j),Kd(this,t)})),this.g.attachEmptyPacketListener("category_mask",(e=>{this.categoryMask=void 0,Kd(this,e)}))),Bl(e,"quality_scores"),Dl(n,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",((e,t)=>{this.qualityScores=e,Kd(this,t)})),this.g.attachEmptyPacketListener("quality_scores",(e=>{this.categoryMask=void 0,Kd(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};yf.prototype.getLabels=yf.prototype.ta,yf.prototype.segmentForVideo=yf.prototype.Ca,yf.prototype.segment=yf.prototype.X,yf.prototype.setOptions=yf.prototype.o,yf.createFromModelPath=function(e,t){return _c(yf,e,{baseOptions:{modelAssetPath:t}})},yf.createFromModelBuffer=function(e,t){return _c(yf,e,{baseOptions:{modelAssetBuffer:t}})},yf.createFromOptions=function(e,t){return _c(yf,e,t)};var bf=class{constructor(e,t,n){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=n}close(){this.confidenceMasks?.forEach((e=>{e.close()})),this.categoryMask?.close()}};bf.prototype.close=bf.prototype.close;var xf=class extends Jo{constructor(e){super(e)}},Cf=[0,Gs,Gs,Gs],wf=[0,Fs,Fs,Fs,Fs,Vs],Ef=[0,Fs,Fs,Fs,Fs,Vs,Fs,Fs],kf=[0,Xs,Ef],Tf=[0,Xs,kf,Xs,Cf],Mf=[0,Xs,Ef,Xs,Cf],If=[0,Xs,Ef,Gs,Gs],Sf=[0,Xs,If,Xs,Cf],Df=[0,Fs,Fs,Fs,Fs,Vs,Xs,Cf,Xs,Cf],Nf=[0,Fs,Fs,Fs,Fs,Vs,nl],Af=class extends Jo{constructor(e){super(e)}},Lf=[0,Fs,Fs,Vs],Rf=class extends Jo{constructor(){super()}};Rf.B=[1];var Of=class extends Jo{constructor(e){super(e)}},Ff=[1,2,3,4,5,6,7,8,9,10,14,15],jf=[0,Js,Ef,Ff,Js,Mf,Ff,Js,kf,Ff,Js,Tf,Ff,Js,Lf,Ff,Js,Nf,Ff,Js,wf,Ff,Js,[0,Zs,Fs,Fs,Fs,Vs,Gs,Vs,Vs,Fs,3,Xs,Cf],Ff,Js,If,Ff,Js,Sf,Ff,Fs,Xs,Cf,Zs,Js,Df,Ff,Js,[0,Ks,Lf],Ff],Pf=[0,Zs,Gs,Gs,Vs],Bf=class extends Jo{constructor(){super()}};Bf.B=[1],Bf.prototype.g=sl([0,Ks,jf,Zs,Xs,Pf]);var _f=class extends $c{constructor(e,t){super(new Bc(e,t),"image_in","norm_rect_in",!1),this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new xd,this.v=new gd,Uo(this.h,0,3,this.v),e=new Fu,Uo(this.h,0,1,e)}get baseOptions(){return Po(this.h,Fu,1)}set baseOptions(e){Uo(this.h,0,1,e)}o(e){return"outputCategoryMask"in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}X(e,t,n,a){const r="function"!=typeof n?n:{};this.j="function"==typeof n?n:a,this.qualityScores=this.categoryMask=this.confidenceMasks=void 0,n=this.I+1,a=new Bf;const i=new Of;var o=new xf;if(Zo(o,1,255),Uo(i,0,12,o),t.keypoint&&t.scribble)throw Error("Cannot provide both keypoint and scribble.");if(t.keypoint){var s=new Af;Yo(s,3,!0),Qo(s,1,t.keypoint.x),Qo(s,2,t.keypoint.y),zo(i,5,Ff,s)}else{if(!t.scribble)throw Error("Must provide either a keypoint or a scribble.");for(s of(o=new Rf,t.scribble))Yo(t=new Af,3,!0),Qo(t,1,s.x),Qo(t,2,s.y),Go(o,Af,t);zo(i,15,Ff,o)}Go(a,Of,i),this.g.addProtoToStream(a.g(),"drishti.RenderData","roi_in",n),zc(this,e,r);e:{try{const e=new bf(this.confidenceMasks,this.categoryMask,this.qualityScores);if(!this.j){var l=e;break e}this.j(e)}finally{tc(this)}l=void 0}return l}m(){var e=new _l;Pl(e,"image_in"),Pl(e,"roi_in"),Pl(e,"norm_rect_in");const t=new bl;Ko(t,Cd,this.h);const n=new Nl;Il(n,"mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraph"),Sl(n,"IMAGE:image_in"),Sl(n,"ROI:roi_in"),Sl(n,"NORM_RECT:norm_rect_in"),n.o(t),jl(e,n),Jd(this,e),this.outputConfidenceMasks&&(Bl(e,"confidence_masks"),Dl(n,"CONFIDENCE_MASKS:confidence_masks"),ec(this,"confidence_masks"),this.g.T("confidence_masks",((e,t)=>{this.confidenceMasks=e.map((e=>Wc(this,e,!this.j))),Kd(this,t)})),this.g.attachEmptyPacketListener("confidence_masks",(e=>{this.confidenceMasks=[],Kd(this,e)}))),this.outputCategoryMask&&(Bl(e,"category_mask"),Dl(n,"CATEGORY_MASK:category_mask"),ec(this,"category_mask"),this.g.S("category_mask",((e,t)=>{this.categoryMask=Wc(this,e,!this.j),Kd(this,t)})),this.g.attachEmptyPacketListener("category_mask",(e=>{this.categoryMask=void 0,Kd(this,e)}))),Bl(e,"quality_scores"),Dl(n,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",((e,t)=>{this.qualityScores=e,Kd(this,t)})),this.g.attachEmptyPacketListener("quality_scores",(e=>{this.categoryMask=void 0,Kd(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};_f.prototype.segment=_f.prototype.X,_f.prototype.setOptions=_f.prototype.o,_f.createFromModelPath=function(e,t){return _c(_f,e,{baseOptions:{modelAssetPath:t}})},_f.createFromModelBuffer=function(e,t){return _c(_f,e,{baseOptions:{modelAssetBuffer:t}})},_f.createFromOptions=function(e,t){return _c(_f,e,t)};var Uf=class extends $c{constructor(e,t){super(new Bc(e,t),"input_frame_gpu","norm_rect",!1),this.j={detections:[]},this.h=new wd,e=new Fu,Uo(this.h,0,1,e)}get baseOptions(){return Po(this.h,Fu,1)}set baseOptions(e){Uo(this.h,0,1,e)}o(e){return void 0!==e.displayNamesLocale?Eo(this.h,2,Yi(e.displayNamesLocale)):"displayNamesLocale"in e&&Eo(this.h,2),void 0!==e.maxResults?Zo(this.h,3,e.maxResults):"maxResults"in e&&Eo(this.h,3),void 0!==e.scoreThreshold?Qo(this.h,4,e.scoreThreshold):"scoreThreshold"in e&&Eo(this.h,4),void 0!==e.categoryAllowlist?Lo(this.h,5,e.categoryAllowlist):"categoryAllowlist"in e&&Eo(this.h,5),void 0!==e.categoryDenylist?Lo(this.h,6,e.categoryDenylist):"categoryDenylist"in e&&Eo(this.h,6),this.l(e)}F(e,t){return this.j={detections:[]},zc(this,e,t),this.j}G(e,t,n){return this.j={detections:[]},Gc(this,e,n,t),this.j}m(){var e=new _l;Pl(e,"input_frame_gpu"),Pl(e,"norm_rect"),Bl(e,"detections");const t=new bl;Ko(t,Ed,this.h);const n=new Nl;Il(n,"mediapipe.tasks.vision.ObjectDetectorGraph"),Sl(n,"IMAGE:input_frame_gpu"),Sl(n,"NORM_RECT:norm_rect"),Dl(n,"DETECTIONS:detections"),n.o(t),jl(e,n),this.g.attachProtoVectorListener("detections",((e,t)=>{for(const t of e)e=ru(t),this.j.detections.push(Rd(e));Kd(this,t)})),this.g.attachEmptyPacketListener("detections",(e=>{Kd(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};function zf(e){e.landmarks=[],e.worldLandmarks=[],e.v=void 0}function Gf(e){try{const t=new class{constructor(e,t,n){this.landmarks=e,this.worldLandmarks=t,this.g=n}close(){this.g?.forEach((e=>{e.close()}))}}(e.landmarks,e.worldLandmarks,e.v);if(!e.s)return t;e.s(t)}finally{tc(e)}}Uf.prototype.detectForVideo=Uf.prototype.G,Uf.prototype.detect=Uf.prototype.F,Uf.prototype.setOptions=Uf.prototype.o,Uf.createFromModelPath=async function(e,t){return _c(Uf,e,{baseOptions:{modelAssetPath:t}})},Uf.createFromModelBuffer=function(e,t){return _c(Uf,e,{baseOptions:{modelAssetBuffer:t}})},Uf.createFromOptions=function(e,t){return _c(Uf,e,t)};var Wf=class extends $c{constructor(e,t){super(new Bc(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.outputSegmentationMasks=!1,this.h=new Sd,e=new Fu,Uo(this.h,0,1,e),this.C=new Md,Uo(this.h,0,3,this.C),this.j=new kd,Uo(this.h,0,2,this.j),Zo(this.j,4,1),Qo(this.j,2,.5),Qo(this.C,2,.5),Qo(this.h,4,.5)}get baseOptions(){return Po(this.h,Fu,1)}set baseOptions(e){Uo(this.h,0,1,e)}o(e){return"numPoses"in e&&Zo(this.j,4,e.numPoses??1),"minPoseDetectionConfidence"in e&&Qo(this.j,2,e.minPoseDetectionConfidence??.5),"minTrackingConfidence"in e&&Qo(this.h,4,e.minTrackingConfidence??.5),"minPosePresenceConfidence"in e&&Qo(this.C,2,e.minPosePresenceConfidence??.5),"outputSegmentationMasks"in e&&(this.outputSegmentationMasks=e.outputSegmentationMasks??!1),this.l(e)}F(e,t,n){const a="function"!=typeof t?t:{};return this.s="function"==typeof t?t:n,zf(this),zc(this,e,a),Gf(this)}G(e,t,n,a){const r="function"!=typeof n?n:{};return this.s="function"==typeof n?n:a,zf(this),Gc(this,e,r,t),Gf(this)}m(){var e=new _l;Pl(e,"image_in"),Pl(e,"norm_rect"),Bl(e,"normalized_landmarks"),Bl(e,"world_landmarks"),Bl(e,"segmentation_masks");const t=new bl;Ko(t,Nd,this.h);const n=new Nl;Il(n,"mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph"),Sl(n,"IMAGE:image_in"),Sl(n,"NORM_RECT:norm_rect"),Dl(n,"NORM_LANDMARKS:normalized_landmarks"),Dl(n,"WORLD_LANDMARKS:world_landmarks"),n.o(t),jl(e,n),Jd(this,e),this.g.attachProtoVectorListener("normalized_landmarks",((e,t)=>{this.landmarks=[];for(const t of e)e=fu(t),this.landmarks.push(Od(e));Kd(this,t)})),this.g.attachEmptyPacketListener("normalized_landmarks",(e=>{this.landmarks=[],Kd(this,e)})),this.g.attachProtoVectorListener("world_landmarks",((e,t)=>{this.worldLandmarks=[];for(const t of e)e=lu(t),this.worldLandmarks.push(Fd(e));Kd(this,t)})),this.g.attachEmptyPacketListener("world_landmarks",(e=>{this.worldLandmarks=[],Kd(this,e)})),this.outputSegmentationMasks&&(Dl(n,"SEGMENTATION_MASK:segmentation_masks"),ec(this,"segmentation_masks"),this.g.T("segmentation_masks",((e,t)=>{this.v=e.map((e=>Wc(this,e,!this.s))),Kd(this,t)})),this.g.attachEmptyPacketListener("segmentation_masks",(e=>{this.v=[],Kd(this,e)}))),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Wf.prototype.detectForVideo=Wf.prototype.G,Wf.prototype.detect=Wf.prototype.F,Wf.prototype.setOptions=Wf.prototype.o,Wf.createFromModelPath=function(e,t){return _c(Wf,e,{baseOptions:{modelAssetPath:t}})},Wf.createFromModelBuffer=function(e,t){return _c(Wf,e,{baseOptions:{modelAssetBuffer:t}})},Wf.createFromOptions=function(e,t){return _c(Wf,e,t)},Wf.POSE_CONNECTIONS=Fc([0,1],[1,2],[2,3],[3,7],[0,4],[4,5],[5,6],[6,8],[9,10],[11,12],[11,13],[13,15],[15,17],[15,19],[15,21],[17,19],[12,14],[14,16],[16,18],[16,20],[16,22],[18,20],[11,23],[12,24],[23,24],[23,25],[24,26],[25,27],[26,28],[27,29],[28,30],[29,31],[30,32],[27,31],[28,32]);var $f,Vf="https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@0.10.7/wasm",qf="https://websdk-cdn-dev.idmission.com/assets/models/blazeface20240207/blaze_face_short_range.tflite",Hf=45e3;function Yf(e,t,n,a){t.forEach((function(t){var r=t.keypoints.map((function(e){return[e.x,e.y]}));if(n){e.strokeStyle="#FF2C35",e.lineWidth=1;var i=t.box;!function(e,t,n){var a=new Path2D;a.moveTo(t[0][0],t[0][1]);for(var r=1;r<t.length;r++){var i=t[r];a.lineTo(i[0],i[1])}n&&a.closePath(),e.stroke(a)}(e,[[i.xMin,i.yMin],[i.xMax,i.yMin],[i.xMax,i.yMax],[i.xMin,i.yMax]],!0)}if(a){e.fillStyle="#32EEDB";for(var o=0;o<6;o++){var s=r[o][0],l=r[o][1];e.beginPath(),e.arc(s,l,3,0,2*Math.PI),e.fill()}}}))}function Zf(){return b(this,void 0,void 0,(function(){var e;return x(this,(function(t){switch(t.label){case 0:return $f?[2,$f]:[4,ih()];case 1:return t.sent(),[4,Gd.forVisionTasks(Vf)];case 2:return e=t.sent(),[4,Vc.createFromOptions(e,{baseOptions:{modelAssetPath:qf,delegate:"GPU"},runningMode:"VIDEO"})];case 3:return[2,$f=t.sent()]}}))}))}var Qf=t.createContext({start:function(){return null},stop:function(){return null},onPredictionMade:function(){return null},canvasRef:{current:null},ready:!1,error:null,modelDownloadProgress:0}),Xf=function(e){var n=e.autoStart,a=void 0===n||n,r=e.children,i=e.throttleMs,o=e.onModelError,s=e.modelLoadTimeoutMs,l=void 0===s?Hf:s,u=t.useContext(Xe),c=u.videoRef,f=u.videoLoaded,h=u.cameraReady,p=t.useRef(null),m=t.useRef(),g=t.useState(!1),y=g[0],C=g[1],w=t.useState(!1),E=w[0],k=w[1],T=t.useRef(null),M=t.useRef(0),I=t.useRef(0),S=t.useState(null),D=S[0],N=S[1],A=t.useState(0),L=A[0],R=A[1];t.useEffect((function(){b(void 0,void 0,void 0,(function(){function e(e){R(sh(e.detail))}var t,n,a;return x(this,(function(r){switch(r.label){case 0:C(!1),document.addEventListener("idmission.preloadProgress.faceDetection",e),t=setTimeout((function(){N(new Error("Model loading time limit exceeded."))}),l),r.label=1;case 1:return r.trys.push([1,3,4,5]),n=T,[4,Zf()];case 2:return n.current=r.sent(),[3,5];case 3:return a=r.sent(),N(a),[3,5];case 4:return clearInterval(t),[7];case 5:return R(100),C(!0),[2,function(){clearInterval(t),document.removeEventListener("idmission.preloadProgress.faceDetection",e)}]}}))}))}),[l]),t.useEffect((function(){D&&(null==o||o(D))}),[D,o]),t.useEffect((function(){if(f&&h&&E&&y){var e;I.current+=1;var t=I.current;return b(void 0,void 0,void 0,(function(){var n,a,r,o;return x(this,(function(s){switch(s.label){case 0:return c.current&&T.current?(n=null===(a=p.current)||void 0===a?void 0:a.getContext("2d"),p.current&&(p.current.width=null===(r=c.current)||void 0===r?void 0:r.videoWidth,p.current.height=null===(o=c.current)||void 0===o?void 0:o.videoHeight,null==n||n.translate(c.current.videoWidth,0),null==n||n.scale(-1,1)),[4,function n(){var a,r;return b(this,void 0,void 0,(function(){var o,s,l,u,d;return x(this,(function(f){if(!T.current||!c.current||t!==I.current)return[2];if((o=null===(a=p.current)||void 0===a?void 0:a.getContext("2d"))&&4===c.current.readyState){o.drawImage(c.current,0,0,s=c.current.videoWidth,l=c.current.videoHeight),u=void 0;try{(u=T.current.detectForVideo(p.current,performance.now()))&&(d=u.detections.map((function(e){var t,n,a,r,i,o,u,d,c,f,h,p,m,g,y,b;return{keypoints:e.keypoints.map((function(e){var t;return v(v({},e),{x:e.x*s,y:e.y*l,name:null!==(t=e.label)&&void 0!==t?t:""})})),box:{xMin:null!==(n=null===(t=e.boundingBox)||void 0===t?void 0:t.originX)&&void 0!==n?n:0,xMax:(null!==(r=null===(a=e.boundingBox)||void 0===a?void 0:a.originX)&&void 0!==r?r:0)+(null!==(o=null===(i=e.boundingBox)||void 0===i?void 0:i.width)&&void 0!==o?o:0),yMin:null!==(d=null===(u=e.boundingBox)||void 0===u?void 0:u.originY)&&void 0!==d?d:0,yMax:(null!==(f=null===(c=e.boundingBox)||void 0===c?void 0:c.originY)&&void 0!==f?f:0)+(null!==(p=null===(h=e.boundingBox)||void 0===h?void 0:h.height)&&void 0!==p?p:0),width:null!==(g=null===(m=e.boundingBox)||void 0===m?void 0:m.width)&&void 0!==g?g:0,height:null!==(b=null===(y=e.boundingBox)||void 0===y?void 0:y.height)&&void 0!==b?b:0}}})),null===(r=m.current)||void 0===r||r.call(m,d),o&&Yf(o,d,!0,!0))}catch(e){console.error("caught face detection error",e)}}return e=setTimeout((function(){M.current=requestAnimationFrame(n)}),null!=i?i:0),[2]}))}))}()]):[2];case 1:return s.sent(),[2]}}))})),function(){M.current&&cancelAnimationFrame(M.current),e&&clearTimeout(e)}}}),[h,y,E,i,f,c]);var O=t.useCallback((function(){k(!0)}),[]),F=t.useCallback((function(){k(!1)}),[]);t.useEffect((function(){return a&&O(),function(){F()}}),[a,O,F]);var j=t.useCallback((function(e){m.current=e}),[]),P=t.useMemo((function(){return{start:O,stop:F,ready:y,canvasRef:p,onPredictionMade:j,error:D,modelDownloadProgress:L}}),[D,L,j,y,O,F]);return d.createElement(Qf.Provider,{value:P},d.createElement(_e,{ref:p}),r)},Kf=function(e){var t=e.documentDetectionModel,n=void 0===t||t,a=e.focusModel,r=void 0===a||a,i=e.faceDetectionModel,o=void 0===i||i;return b(void 0,void 0,void 0,(function(){return x(this,(function(e){switch(e.label){case 0:return n||r?[4,rh()]:[3,2];case 1:e.sent(),e.label=2;case 2:return o?[4,ih()]:[3,4];case 3:e.sent(),e.label=4;case 4:return[2]}}))}))},Jf={},eh={idCapture:{loaded:0,total:0},faceDetection:{loaded:0,total:0}};function th(e){return b(this,void 0,void 0,(function(){var t;return x(this,(function(n){return t=new XMLHttpRequest,[2,new Promise((function(n){t.addEventListener("progress",(function(t){t.lengthComputable&&(Jf[e]=t,document.dispatchEvent(new CustomEvent("idmission.preloadProgress",{detail:{url:e,loaded:t.loaded,total:t.total}})))})),t.addEventListener("loadend",(function(){n(4===t.readyState&&200===t.status)})),t.open("GET",e,!0),t.send()}))]}))}))}var nh=!1,ah=!1;function rh(){return b(this,void 0,void 0,(function(){function e(e){t.includes(e.detail.url)&&(eh.idCapture=lh(t),document.dispatchEvent(new CustomEvent("idmission.preloadProgress.idCapture",{detail:eh.idCapture})))}var t;return x(this,(function(n){switch(n.label){case 0:return nh?[2,new Promise((function(e){setInterval((function(){nh||e()}),100)}))]:(nh=!0,[4,Promise.all([oh(dh),oh(ch)])]);case 1:t=n.sent().flat(),document.addEventListener("idmission.preloadProgress",e),n.label=2;case 2:return n.trys.push([2,,4,5]),[4,Promise.all(t.map(th))];case 3:return n.sent(),[3,5];case 4:return document.removeEventListener("idmission.preloadProgress",e),nh=!1,[7];case 5:return[2]}}))}))}function ih(){return b(this,void 0,void 0,(function(){function e(e){t.includes(e.detail.url)&&(eh.faceDetection=lh(t),document.dispatchEvent(new CustomEvent("idmission.preloadProgress.faceDetection",{detail:eh.faceDetection})))}var t;return x(this,(function(n){switch(n.label){case 0:if(ah)return[2,new Promise((function(e){setInterval((function(){ah||e()}),100)}))];ah=!0,t=["".concat(Vf,"/vision_wasm_internal.wasm"),qf],document.addEventListener("idmission.preloadProgress",e),n.label=1;case 1:return n.trys.push([1,,3,4]),[4,Promise.all(t.map(th))];case 2:return n.sent(),[3,4];case 3:return document.removeEventListener("idmission.preloadProgress",e),ah=!1,[7];case 4:return[2]}}))}))}function oh(e){return b(this,void 0,void 0,(function(){var t;return x(this,(function(n){switch(n.label){case 0:return t=e.split("/").slice(0,-1).join("/"),[4,fetch(e)];case 1:return[4,n.sent().json()];case 2:return[2,n.sent().weightsManifest[0].paths.map((function(e){return"".concat(t,"/").concat(e)}))]}}))}))}function sh(e){return e.total>0?Math.round(100*e.loaded/e.total):0}function lh(e){return e.reduce((function(e,t){var n=Jf[t];return n?(e.loaded+=n.loaded,e.total+=n.total,e):e}),{loaded:0,total:0})}var uh=t.createContext({ready:!1,modelDownloadProgress:0,working:{current:!1},modelError:null,thresholds:{},setThresholds:function(){return null},makePrediction:function(){return null},onPredictionMade:function(){return null},detectionTime:0,focusPredictionTime:0,getBestFrame:function(){return Promise.resolve(null)},resetBestFrame:function(){return null},bestFrameDetectionScore:0,bestFrameFocusScore:0}),dh="".concat(Ra,"/models/docdetect20240207/model.json"),ch="".concat(Ra,"/models/focus20240212/model.json"),fh=45e3,hh=function(e){var n=e.children,a=e.documentDetectionModelUrl,r=e.focusModelUrl,i=e.logPredictions,o=void 0!==i&&i,s=e.onModelError,l=e.modelLoadTimeoutMs,d=void 0===l?fh:l,c=t.useState(!1),f=c[0],h=c[1],m=t.useState({}),g=m[0],v=m[1],y=t.useRef(!1),C=t.useRef(),w=t.useRef(null),E=t.useRef(null),k=t.useRef(null),T=t.useState(0),M=T[0],I=T[1],S=t.useState(0),D=S[0],N=S[1],A=t.useState(null),L=A[0],R=A[1],O=t.useState([]),F=O[0],j=O[1],P=t.useState(0),B=P[0],_=P[1],U=t.useState(0),z=U[0],G=U[1],W=t.useState(0),$=W[0],V=W[1];t.useEffect((function(){function e(e){V(sh(e.detail))}h(!1),document.addEventListener("idmission.preloadProgress.idCapture",e);var t=a||dh,n=r||ch;var i=setTimeout((function(){R(new Error("Model loading time limit exceeded."))}),d);function o(){R(new Error("WebGL context was lost."))}(function(){return b(this,void 0,void 0,(function(){return x(this,(function(e){switch(e.label){case 0:return p.ENV.set("WEBGL_DELETE_TEXTURE_THRESHOLD",52428800),[4,p.setBackend("webgl")];case 1:return e.sent(),[4,p.ready()];case 2:return e.sent(),[4,rh()];case 3:return e.sent(),[4,Promise.all([Je(t),nt(n)])];case 4:return e.sent(),[2]}}))}))})().then((function(){V(100),h(!0)})).catch((function(e){R(e)})).finally((function(){clearInterval(i)}));var s=La(2).canvas;return s.addEventListener("webglcontextlost",o),function(){var t;clearInterval(i),null===(t=s.removeEventListener)||void 0===t||t.call(s,"webglcontextlost",o),document.removeEventListener("idmission.preloadProgress.idCapture",e)}}),[a,r,d]),t.useEffect((function(){L&&(null==s||s(L))}),[L,s]);var q=t.useState(0),H=q[0],Y=q[1],Z=t.useRef(null),Q=t.useRef(0),X=t.useCallback((function(e){y.current=!0,b(void 0,void 0,void 0,(function(){var t,n,a,r,i,s;return x(this,(function(l){switch(l.label){case 0:if(!(Ze&&et&&k.current&&w.current&&E.current))return[2];t={lastPredictionCanvas:k.current,cropCanvas:w.current,rotateCanvas:E.current},l.label=1;case 1:return l.trys.push([1,3,,4]),[4,mh(e,g,t,o)];case 2:return n=l.sent(),I(n.detectionTime),N(n.focusPredictionTime),Q.current<=n.focusScore&&(Q.current=n.focusScore,j(null!==(i=null===(r=n.bestDocumentOrPassport)||void 0===r?void 0:r.bbox)&&void 0!==i?i:[]),_(n.detectionScore),G(n.focusScore),Ue(Z.current,k.current)),n.allZero&&Y((function(e){return e+1})),null===(s=C.current)||void 0===s||s.call(C,n),[3,4];case 3:return a=l.sent(),["Requested texture size [0x0] is invalid","The image argument is a canvas element with a width or height of 0","CanvasRenderingContext2D.drawImage: Passed-in canvas is empty","The object is in an invalid state"].some((function(e){return a.toString().includes(e)}))?console.log("ignoring error caught while predicting:",a):(console.log("caught an error while predicting!",a),R(a)),[3,4];case 4:return y.current=!1,[2]}}))}))}),[o,g]);t.useEffect((function(){H>=2&&R(new Error("model is returning all zeroes"))}),[H]);var K=t.useCallback((function(e){C.current=e}),[]),J=t.useCallback((function(){return b(void 0,void 0,void 0,(function(){return x(this,(function(e){return Z.current?[2,{canvas:Z.current,boundingBox:F,detectionScore:B,focusScore:z}]:[2,null]}))}))}),[F,B,z]),ee=t.useCallback((function(){Q.current=0,ze(Z.current),ze(k.current),ze(w.current),ze(E.current),j([]),_(0),G(0)}),[]),te=t.useMemo((function(){return{ready:f,working:y,thresholds:g,setThresholds:v,makePrediction:X,onPredictionMade:K,detectionTime:M,focusPredictionTime:D,getBestFrame:J,resetBestFrame:ee,bestFrameDetectionScore:B,bestFrameFocusScore:z,modelError:L,modelDownloadProgress:$}}),[B,z,M,D,J,L,X,K,f,ee,v,g,$]);return u.default.createElement(uh.Provider,{value:te},n,u.default.createElement(_e,{ref:k}),u.default.createElement(_e,{ref:Z}),u.default.createElement(_e,{ref:w}),u.default.createElement(_e,{ref:E}))},ph=En();function mh(e,t,n,a){var r,i,o,s,l,u,d,c,f,h,p,m;return void 0===a&&(a=!1),b(this,void 0,void 0,(function(){var g,v,y,b,C,w,E,k,T,M,I,S,D,N,A,L,R,O,F,j,P,B,_,U,z,G,W,$,V,q,H,Y,Z,Q,X,K,J,ee,te,ne;return x(this,(function(x){switch(x.label){case 0:return g=Pe(e),v=g[0],y=g[1],Ue(n.lastPredictionCanvas,e),[4,gh(n.lastPredictionCanvas,a)];case 1:return b=x.sent(),w=b.scores,E=b.labels,k=b.time,T=(C=b.boxes).length>0&&!C.some((function(e){return e.some((function(e){return e>0}))})),M=function(e){var t={};return e.forEach((function(e,n){e&&(t[e.label]||(t[e.label]=[0,-1]),e.score>t[e.label][0]&&(t[e.label]=[e.score,n]))})),Object.keys(t).map((function(n){return e[t[n][1]]})).filter((function(e){return!!e}))}(C.map((function(e,t){return function(e,t,n){var a=e[0],r=e[1];return{score:t,bbox:[r,a,e[3]-r,e[2]-a],label:tt[n]}}(e,w[t],E[t])}))),I=M.find((function(e){return"Document"===e.label})),S=M.find((function(e){return"Passport Page"===e.label})),D=null!==(r=null==I?void 0:I.score)&&void 0!==r?r:0,N=null!==(i=null==S?void 0:S.score)&&void 0!==i?i:0,A=N>=(null!==(o=t.passport)&&void 0!==o?o:0),L=D>N?I:S,O=(R=A?N:D)>=(null!==(s=t.document)&&void 0!==s?s:0),F="none",A?F="passport":O&&(F="idCard"),j=M.find((function(e){return"MRZ"===e.label})),P=null!==(l=null==j?void 0:j.score)&&void 0!==l?l:0,B=P>=(null!==(u=t.mrz)&&void 0!==u?u:0),_=M.find((function(e){return"PDF417"===e.label})),U=null!==(d=null==_?void 0:_.score)&&void 0!==d?d:0,z=U>=(null!==(c=t.pdf417)&&void 0!==c?c:0),G=!1,L&&(20,$=(W=L.bbox)[0],V=W[1],q=W[2],H=W[3],$*=v,q*=v,H*=y,G=(V*=y)>20&&V+H+20<y&&($>20||$<20&&$+q>.8*v)&&$+q+20<v),Y=!1,L&&(Q=(Z=[L.bbox[2],L.bbox[3]])[1],Y=Z[0]>.85||Q>.85),X=null,K=0,J=0,ee=!1,O&&G&&!Y?[4,vh(n.lastPredictionCanvas,n,null==L?void 0:L.bbox,a)]:[3,3];case 2:ne=x.sent(),K=ne[1],J=null!==(f=null==(X=ne[0])?void 0:X[1])&&void 0!==f?f:0,te=null!==(m=ph?null===(h=t.focus)||void 0===h?void 0:h.mobile:null===(p=t.focus)||void 0===p?void 0:p.desktop)&&void 0!==m?m:0,ee=J>=te,x.label=3;case 3:return[2,{detectedObjects:M,detectionScore:R,detectionTime:k,detectionThresholdMet:O,detectedDocumentType:F,passportDetectionScore:N,passportDetectionThresholdMet:A,mrzDetectionScore:P,mrzDetectionThresholdMet:B,pdf417DetectionScore:U,pdf417DetectionThresholdMet:z,bestDocumentOrPassport:L,bestMrz:j,bestPdf417:_,documentInBounds:G,documentTooClose:Y,focusScore:J,focusThresholdMet:ee,focusPredictionTime:K,frameWidth:v,frameHeight:y,allZero:T}]}}))}))}function gh(e,t){return void 0===t&&(t=!1),b(this,void 0,void 0,(function(){var n,a,r,i,o,s,l,u,d,c,f,h,m,g,v,y,b;return x(this,(function(x){switch(x.label){case 0:if(!Ze)throw new Error("document detection model is not loaded");n=new Date,x.label=1;case 1:return x.trys.push([1,7,8,9]),p.engine().startScope(),a=p.browser.fromPixels(e),t&&console.time("resize"),r=p.image.resizeBilinear(a,[448,448]),t&&console.timeEnd("resize"),t&&console.time("convert to int32"),i=p.cast(r,"int32"),l=(s=p).tensor4d,d=(u=Array).from,[4,i.data()];case 2:return o=l.apply(s,[d.apply(u,[x.sent()]),[1,448,448,3]]),c=p.cast(o,"int32"),t&&console.timeEnd("convert to int32"),t&&console.time("predictions"),[4,Ze.executeAsync(c)];case 3:return f=x.sent(),t&&console.timeEnd("predictions"),h=f,t&&console.log("predictions made!",h.map((function(e){return e.arraySync()}))),[4,h[Ze.outputPositions.boxes].array()];case 4:return m=x.sent()[0],[4,h[Ze.outputPositions.scores].array()];case 5:return g=x.sent()[0],[4,h[Ze.outputPositions.labels].array()];case 6:return v=(v=x.sent()[0]).map((function(e){return Math.round(e)})),y=(new Date).getTime()-n.getTime(),[2,{boxes:m,scores:g,labels:v,time:y}];case 7:return b=x.sent(),console.error("caught error in makeDocumentDetectionPredictions",b),[2,{boxes:[],scores:[],labels:[],time:0}];case 8:return p.engine().endScope(),[7];case 9:return[2]}}))}))}function vh(e,t,n,a){return void 0===a&&(a=!1),b(this,void 0,void 0,(function(){var r,i,o,s,l,u,d,c,f,h,m,g,v,y,b,C,w,E,k;return x(this,(function(x){switch(x.label){case 0:if(!et)throw new Error("focus model is not loaded");r=new Date,x.label=1;case 1:return x.trys.push([1,5,6,7]),p.engine().startScope(),i=void 0,n?(o=Fa(e,n,t.cropCanvas),s=Pe(e),(d=(l=[n[2]*s[0],n[3]*s[1]])[1])>(u=l[0])&&(f=(c=t.rotateCanvas).getContext("2d"))&&(c.width=d,c.height=u,f.clearRect(0,0,c.width,c.height),f.translate(c.width/2,c.height/2),f.rotate(1.5708),f.drawImage(o,-u/2,-d/2),o=c),i=p.browser.fromPixels(o)):i=p.browser.fromPixels(e),h=p.image.resizeBilinear(i,[448,448]).div(p.scalar(127.5)).sub(p.scalar(1)),m=p.cast(h,"float32"),y=(v=p).tensor4d,C=(b=Array).from,[4,m.data()];case 2:return g=y.apply(v,[C.apply(b,[x.sent()]),[1,448,448,3]]),w=p.cast(g,"float32"),a&&console.time("focus prediction"),[4,et.predict(w)];case 3:return[4,x.sent().array()];case 4:return E=x.sent()[0],a&&console.timeEnd("focus prediction"),k=(new Date).getTime()-r.getTime(),[2,[E,k]];case 5:return x.sent(),[2,[[0,0],0]];case 6:return p.engine().endScope(),[7];case 7:return[2]}}))}))}function yh(e,n,a){var r=this,i=t.useRef(null),o=t.useRef(0),s=t.useRef(null),l=t.useRef([]),u=t.useRef(),d=t.useRef(),c=t.useRef(e),f=t.useRef(!0);c.current=e;var h="undefined"!=typeof window,p=!n&&0!==n&&h;if("function"!=typeof e)throw new TypeError("Expected a function");n=+n||0;var m=!!(a=a||{}).leading,g=!("trailing"in a)||!!a.trailing,v="maxWait"in a,y="debounceOnServer"in a&&!!a.debounceOnServer,b=v?Math.max(+a.maxWait||0,n):null;t.useEffect((function(){return f.current=!0,function(){f.current=!1}}),[]);var x=t.useMemo((function(){var e=function(e){var t=l.current,n=u.current;return l.current=u.current=null,o.current=e,d.current=c.current.apply(n,t)},t=function(e,t){p&&cancelAnimationFrame(s.current),s.current=p?requestAnimationFrame(e):setTimeout(e,t)},a=function(e){if(!f.current)return!1;var t=e-i.current;return!i.current||t>=n||t<0||v&&e-o.current>=b},x=function(t){return s.current=null,g&&l.current?e(t):(l.current=u.current=null,d.current)},C=function e(){var r=Date.now();if(a(r))return x(r);if(f.current){var s=n-(r-i.current),l=v?Math.min(s,b-(r-o.current)):s;t(e,l)}},w=function(){if(h||y){var c=Date.now(),p=a(c);if(l.current=[].slice.call(arguments),u.current=r,i.current=c,p){if(!s.current&&f.current)return o.current=i.current,t(C,n),m?e(i.current):d.current;if(v)return t(C,n),e(i.current)}return s.current||t(C,n),d.current}};return w.cancel=function(){s.current&&(p?cancelAnimationFrame(s.current):clearTimeout(s.current)),o.current=0,l.current=i.current=u.current=s.current=null},w.isPending=function(){return!!s.current},w.flush=function(){return s.current?x(Date.now()):d.current},w}),[m,v,n,b,g,p,h,y]);return x}var bh=["idCardFront","idCardBack","passport","selfie"],xh={passport:["passport"],idCard:["idCardFront","idCardBack"],idCardAndPassport:["idCardFront","idCardBack","passport"],idCardOrPassport:["idCardFront","idCardBack","passport"]};function Ch(e){return"idCardOrPassport"===e?1:xh[e].length}var wh={initialDrawComplete:!1,redrawing:!1,guideRectX:0,guideRectY:0,guideRectWidth:0,guideRectHeight:0,guideRectOffsetTop:0,guideImageWidth:0,guideImageHeight:0,pageWidth:0,pageHeight:0,videoWidth:0,videoHeight:0,detectedObjects:[],bestDocument:void 0,bestMrz:void 0,bestPdf417:void 0,documentType:"none",documentInBounds:!1,documentTooClose:!1,documentDetectionScore:0,documentDetectionThresholdMet:!1,passportPageDetectionScore:0,passportPageDetectionThresholdMet:!1,mrzDetectionScore:0,mrzDetectionThresholdMet:!1,pdf417DetectionScore:0,pdf417DetectionThresholdMet:!1,focusScore:0,focusThresholdMet:!1,barcodeScanningEnabled:!1,barcodeResult:null,waitingForBarcodeScan:!1,shouldScanBarcode:!1,autoCaptureBarcodeRequired:"mobile",barcodeScanFailedAttempts:0,maxBarcodeScanAttempts:10,isGoodFrame:!1,goodFramesCount:0,goodFramesThreshold:3,goodFramesThresholdMet:!1,lastFrameCapturedAt:null,frameCaptureRate:0,capturing:!1,captured:!1,captureFailed:!1,imageUrl:null,captureState:"capturing",capturedDocuments:{},captureRequirement:"idCardOrPassport",requestedDocumentType:"idCardFront",detectedDocumentType:"none",differentDocumentTypeDetections:0},Eh=t.createContext(wh),kh=t.createContext((function(){})),Th=function e(t,n){var a;switch(n.type){case"configureWizard":var r=n.payload,i=r.captureRequirement,o=r.precapturedDocuments,s=v(v({},t),{captureRequirement:i});if("passport"===i&&(s.requestedDocumentType="passport"),o)for(var l=0,u=bh;l<u.length;l++){var d=u[l],c=o[d];c&&(s.requestedDocumentType=d,s=e(s,{type:"documentCaptured",payload:c}))}return s;case"configureCapture":return v(v(v({},t),n.payload),{goodFramesCount:0,capturing:!1,captured:!1,captureFailed:!1});case"redrawRequested":return v(v({},t),{redrawing:!0,guideRectX:0,guideRectY:0,guideRectWidth:0,guideRectHeight:0,guideRectOffsetTop:0});case"redrawInProgress":return v(v({},t),{redrawing:!1,guideRectX:0,guideRectY:0,guideRectWidth:0,guideRectHeight:0,guideRectOffsetTop:0});case"redrawCompleted":return v(v(v({},t),n.payload),{initialDrawComplete:!0});case"pageRendered":return v(v({},t),n.payload);case"guideImageLoaded":return v(v({},t),{guideImageWidth:n.payload.width,guideImageHeight:n.payload.height});case"objectsDetected":var f=n.payload.prediction,h=f.detectedObjects,p=f.detectionScore,m=f.detectionThresholdMet,g=f.detectedDocumentType,y=f.passportDetectionScore,b=f.passportDetectionThresholdMet,x=f.mrzDetectionScore,C=f.mrzDetectionThresholdMet,w=f.pdf417DetectionScore,E=f.pdf417DetectionThresholdMet,k=f.bestDocumentOrPassport,T=f.bestMrz,M=f.bestPdf417,I=f.documentInBounds,S=f.documentTooClose,D=f.focusScore,N=f.focusThresholdMet,A=f.frameWidth,L=f.frameHeight,R=new Date,O=0,F=t.goodFramesThreshold;t.lastFrameCapturedAt&&(O=1e3/(R.getTime()-t.lastFrameCapturedAt.getTime()))>0&&(F=Math.ceil(3*O));var j=!0===t.autoCaptureBarcodeRequired||"mobile"===t.autoCaptureBarcodeRequired&&En(),P=t.barcodeScanningEnabled&&E&&j,B=P&&!t.barcodeResult,_=m&&I&&!S&&N,U=t.goodFramesCount;return _&&(U+=1),v(v({},t),{videoWidth:A,videoHeight:L,detectedObjects:h,bestDocument:k,bestMrz:T,bestPdf417:M,documentType:g,documentInBounds:I,documentTooClose:S,documentDetectionScore:p,documentDetectionThresholdMet:m,mrzDetectionScore:x,mrzDetectionThresholdMet:C,pdf417DetectionScore:w,pdf417DetectionThresholdMet:E,passportPageDetectionScore:y,passportPageDetectionThresholdMet:b,focusScore:D,focusThresholdMet:N,shouldScanBarcode:P,waitingForBarcodeScan:B,isGoodFrame:_,goodFramesCount:U,goodFramesThreshold:F,goodFramesThresholdMet:U>=F,lastFrameCapturedAt:R,frameCaptureRate:O});case"predictionMade":var z=n.payload,G=z.detectedDocumentType,W=z.passportDetectionScore,$=t.requestedDocumentType;s=v(v({},t),{detectedDocumentType:G});if("idCardOrPassport"===t.captureRequirement)$.startsWith(G)&&(s.differentDocumentTypeDetections=0),"passport"===G&&"passport"!==$&&(s.requestedDocumentType="passport"),"passport"===$&&W<.3&&(s.requestedDocumentType="idCardFront"in t.capturedDocuments?"idCardBack":"idCardFront");return s;case"barcodeScanned":return v(v({},t),{barcodeResult:n.payload.result,waitingForBarcodeScan:!1,autoCaptureBarcodeRequired:!1});case"barcodeScanFailed":return(s=v(v({},t),{barcodeScanFailedAttempts:t.barcodeScanFailedAttempts+1})).barcodeScanFailedAttempts>=s.maxBarcodeScanAttempts&&(s.autoCaptureBarcodeRequired=!1,s.shouldScanBarcode=!1,s.waitingForBarcodeScan=!1),s;case"capturing":return v(v({},t),{capturing:!0,captured:!1,captureFailed:!1});case"captured":return v(v({},t),{capturing:!1,captured:!0,captureFailed:!1});case"frameCaptured":return v(v({},t),{imageUrl:n.payload.imageUrl});case"captureFailed":return v(v({},t),{capturing:!1,captured:!1,captureFailed:!0});case"documentCaptured":var V=v(v({},t),{capturedDocuments:v(v({},t.capturedDocuments),(a={},a[t.requestedDocumentType]=n.payload,a))}),q=xh[t.captureRequirement].filter((function(e){return!(e in V.capturedDocuments)}));return"idCardOrPassport"===t.captureRequirement&&(q="passport"===t.requestedDocumentType?[]:q.filter((function(e){return"passport"!==e}))),0===q.length?V.captureState="complete":(V.requestedDocumentType=q[0],"idCardFront"===t.requestedDocumentType&&"idCardBack"===V.requestedDocumentType&&(V.captureState="requestingFlip",V.documentDetectionThresholdMet=!1,V.passportPageDetectionThresholdMet=!1)),V;case"documentCapturedManually":s=v({},t);var H=v(v({},n.payload),{width:0,height:0});return 0===Object.keys(t.capturedDocuments).length?s.capturedDocuments.passport=H:(s.capturedDocuments={},s.capturedDocuments.idCardFront=t.capturedDocuments.passport,s.capturedDocuments.idCardBack=H),s;case"flipRequestCompleted":return v(v({},t),{captureState:"capturing"});case"resetWizard":return v({},wh);default:return t}},Mh=function(e){var n=e.children,a=t.useReducer(Th,wh),r=a[0],i=a[1],o=yh((function(){i({type:"redrawRequested"})}),500);return t.useLayoutEffect((function(){if("undefined"!=typeof window)return window.addEventListener("resize",o),function(){window.removeEventListener("resize",o)}}),[o]),u.default.createElement(Eh.Provider,{value:r},u.default.createElement(kh.Provider,{value:i},n))},Ih=function(){var e=t.useContext(Eh),n=t.useContext(kh);if(!e||!n)throw new Error("useIdCaptureState cannot be used without IdCaptureStateProvider");return[e,n]},Sh=h.default.span(Rh||(Rh=w(["\n font-size: 16px;\n font-family: monospace;\n position: absolute;\n left: 20px;\n bottom: 20px;\n color: limegreen;\n background: rgba(0, 0, 0, 0.5);\n z-index: 1001;\n"],["\n font-size: 16px;\n font-family: monospace;\n position: absolute;\n left: 20px;\n bottom: 20px;\n color: limegreen;\n background: rgba(0, 0, 0, 0.5);\n z-index: 1001;\n"]))),Dh=h.default.div(Oh||(Oh=w(["\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"],["\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"])),(function(e){return e.$flipX?"transform: scaleX(-1);":""})),Nh=h.default.div(Fh||(Fh=w(["\n font: 10px monospace;\n position: absolute;\n border: 3px solid ",";\n color: ",";\n ","\n"],["\n font: 10px monospace;\n position: absolute;\n border: 3px solid ",";\n color: ",";\n ","\n"])),(function(e){var t=e.$color;return null!=t?t:"green"}),(function(e){var t=e.$color;return null!=t?t:"green"}),(function(e){return e.$flipX?"transform: scaleX(-1);":""})),Ah=h.default.div(jh||(jh=w(["\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"],["\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"])),(function(e){var t=e.$color;return null!=t?t:"red"}),(function(e){var t=e.$color;return null!=t?t:"red"}),(function(e){return e.$flipX?"transform: scaleX(-1);":""}));function Lh(e){var n=e.enabled,a=void 0===n||n,r=e.pageWidth,i=e.pageHeight,o=e.videoWidth,s=e.videoHeight;return t.useMemo((function(){var e=!1,t=0,n=0,l=0,u=0;return a&&((e=r/i<o/s)?l=((t=o*(i/s))-r)/2:u=((n=s*(r/o))-i)/2),{horizontal:e,pageWidth:r,pageHeight:i,videoWidth:o,videoHeight:s,scaledWidth:t,scaledHeight:n,xOffset:l,yOffset:u}}),[a,i,r,s,o])}var Rh,Oh,Fh,jh,Ph=function(e){var t=e.scaling,n=e.$flipX,a=e.children,r=Ih()[0];return u.default.createElement(Dh,{$flipX:n,style:{top:r.guideRectY,left:r.guideRectX,width:r.guideRectWidth||(null==t?void 0:t.pageWidth),height:r.guideRectHeight||(null==t?void 0:t.pageHeight)}},a)};function Bh(e){var t=e.obj,n=e.color,a=[t.bbox[1],t.bbox[0],t.bbox[2],t.bbox[3]],r=a[1],i=a[2],o=a[3];return u.default.createElement(Nh,{$flipX:e.flipX,$color:void 0===n?"green":n,style:{top:"".concat(100*a[0],"%"),left:"".concat(100*r,"%"),width:"".concat(100*i,"%"),height:"".concat(100*o,"%")}},t.label," (",t.score.toFixed(3),")")}function _h(e){var t,n,a,r,i=e.face,o=e.flipX,s=e.color,l=e.scaling,d=l.pageWidth,c=l.pageHeight,f=l.videoWidth,h=l.videoHeight,p=l.scaledWidth,m=l.scaledHeight;return f&&h&&d&&c?(l.horizontal?(t=i.box.yMin/h*c,n=i.box.xMin/f*p-l.xOffset,a=i.box.width/f*p,r=i.box.height/h*c):(t=i.box.yMin/h*m-l.yOffset,n=i.box.xMin/f*d,a=i.box.width/f*d,r=i.box.height/h*m),u.default.createElement(u.default.Fragment,null,u.default.createElement(Nh,{$flipX:o,$color:void 0===s?"green":s,style:{top:t,left:n,width:a,height:r}}),i.keypoints.map((function(e,t){return u.default.createElement(Uh,{key:t,point:e,scaling:l,flipX:o})})))):u.default.createElement(u.default.Fragment,null)}function Uh(e){var t,n,a=e.point,r=e.color,i=e.scaling,o=i.videoWidth,s=i.videoHeight;return i.horizontal?(t=a.x/o*i.scaledWidth-i.xOffset,n=a.y/s*i.pageHeight):(t=a.x/o*i.pageWidth,n=a.y/s*i.scaledHeight-i.yOffset),u.default.createElement(Ah,{$flipX:e.flipX,$color:void 0===r?"red":r,style:{top:n-=2,left:t-=2}})}function zh(e){return zh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},zh(e)}function Gh(e){var t=function(e,t){if("object"!==zh(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var a=n.call(e,t||"default");if("object"!==zh(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===zh(t)?t:String(t)}function Wh(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,Gh(a.key),a)}}var $h=[],Vh=$h.forEach,qh=$h.slice;var Hh=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,Yh=function(e,t,n,a){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{path:"/",sameSite:"strict"};n&&(r.expires=new Date,r.expires.setTime(r.expires.getTime()+60*n*1e3)),a&&(r.domain=a),document.cookie=function(e,t,n){var a=n||{};a.path=a.path||"/";var r=encodeURIComponent(t),i="".concat(e,"=").concat(r);if(a.maxAge>0){var o=a.maxAge-0;if(Number.isNaN(o))throw new Error("maxAge should be a Number");i+="; Max-Age=".concat(Math.floor(o))}if(a.domain){if(!Hh.test(a.domain))throw new TypeError("option domain is invalid");i+="; Domain=".concat(a.domain)}if(a.path){if(!Hh.test(a.path))throw new TypeError("option path is invalid");i+="; Path=".concat(a.path)}if(a.expires){if("function"!=typeof a.expires.toUTCString)throw new TypeError("option expires is invalid");i+="; Expires=".concat(a.expires.toUTCString())}if(a.httpOnly&&(i+="; HttpOnly"),a.secure&&(i+="; Secure"),a.sameSite)switch("string"==typeof a.sameSite?a.sameSite.toLowerCase():a.sameSite){case!0:i+="; SameSite=Strict";break;case"lax":i+="; SameSite=Lax";break;case"strict":i+="; SameSite=Strict";break;case"none":i+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return i}(e,encodeURIComponent(t),r)},Zh=function(e){for(var t="".concat(e,"="),n=document.cookie.split(";"),a=0;a<n.length;a++){for(var r=n[a];" "===r.charAt(0);)r=r.substring(1,r.length);if(0===r.indexOf(t))return r.substring(t.length,r.length)}return null},Qh={name:"cookie",lookup:function(e){var t;if(e.lookupCookie&&"undefined"!=typeof document){var n=Zh(e.lookupCookie);n&&(t=n)}return t},cacheUserLanguage:function(e,t){t.lookupCookie&&"undefined"!=typeof document&&Yh(t.lookupCookie,e,t.cookieMinutes,t.cookieDomain,t.cookieOptions)}},Xh={name:"querystring",lookup:function(e){var t;if("undefined"!=typeof window){var n=window.location.search;!window.location.search&&window.location.hash&&window.location.hash.indexOf("?")>-1&&(n=window.location.hash.substring(window.location.hash.indexOf("?")));for(var a=n.substring(1).split("&"),r=0;r<a.length;r++){var i=a[r].indexOf("=");if(i>0)a[r].substring(0,i)===e.lookupQuerystring&&(t=a[r].substring(i+1))}}return t}},Kh=null,Jh=function(){if(null!==Kh)return Kh;try{Kh="undefined"!==window&&null!==window.localStorage;var e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch(e){Kh=!1}return Kh},ep={name:"localStorage",lookup:function(e){var t;if(e.lookupLocalStorage&&Jh()){var n=window.localStorage.getItem(e.lookupLocalStorage);n&&(t=n)}return t},cacheUserLanguage:function(e,t){t.lookupLocalStorage&&Jh()&&window.localStorage.setItem(t.lookupLocalStorage,e)}},tp=null,np=function(){if(null!==tp)return tp;try{tp="undefined"!==window&&null!==window.sessionStorage;var e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch(e){tp=!1}return tp},ap={name:"sessionStorage",lookup:function(e){var t;if(e.lookupSessionStorage&&np()){var n=window.sessionStorage.getItem(e.lookupSessionStorage);n&&(t=n)}return t},cacheUserLanguage:function(e,t){t.lookupSessionStorage&&np()&&window.sessionStorage.setItem(t.lookupSessionStorage,e)}},rp={name:"navigator",lookup:function(e){var t=[];if("undefined"!=typeof navigator){if(navigator.languages)for(var n=0;n<navigator.languages.length;n++)t.push(navigator.languages[n]);navigator.userLanguage&&t.push(navigator.userLanguage),navigator.language&&t.push(navigator.language)}return t.length>0?t:void 0}},ip={name:"htmlTag",lookup:function(e){var t,n=e.htmlTag||("undefined"!=typeof document?document.documentElement:null);return n&&"function"==typeof n.getAttribute&&(t=n.getAttribute("lang")),t}},op={name:"path",lookup:function(e){var t;if("undefined"!=typeof window){var n=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(n instanceof Array)if("number"==typeof e.lookupFromPathIndex){if("string"!=typeof n[e.lookupFromPathIndex])return;t=n[e.lookupFromPathIndex].replace("/","")}else t=n[0].replace("/","")}return t}},sp={name:"subdomain",lookup:function(e){var t="number"==typeof e.lookupFromSubdomainIndex?e.lookupFromSubdomainIndex+1:1,n="undefined"!=typeof window&&window.location&&window.location.hostname&&window.location.hostname.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(n)return n[t]}};var lp=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.type="languageDetector",this.detectors={},this.init(t,n)}var t,n,a;return t=e,n=[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.services=e||{languageUtils:{}},this.options=function(e){return Vh.call(qh.call(arguments,1),(function(t){if(t)for(var n in t)void 0===e[n]&&(e[n]=t[n])})),e}(t,this.options||{},{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:function(e){return e}}),"string"==typeof this.options.convertDetectedLanguage&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=function(e){return e.replace("-","_")}),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=n,this.addDetector(Qh),this.addDetector(Xh),this.addDetector(ep),this.addDetector(ap),this.addDetector(rp),this.addDetector(ip),this.addDetector(op),this.addDetector(sp)}},{key:"addDetector",value:function(e){this.detectors[e.name]=e}},{key:"detect",value:function(e){var t=this;e||(e=this.options.order);var n=[];return e.forEach((function(e){if(t.detectors[e]){var a=t.detectors[e].lookup(t.options);a&&"string"==typeof a&&(a=[a]),a&&(n=n.concat(a))}})),n=n.map((function(e){return t.options.convertDetectedLanguage(e)})),this.services.languageUtils.getBestMatchFromCodes?n:n.length>0?n[0]:null}},{key:"cacheUserLanguage",value:function(e,t){var n=this;t||(t=this.options.caches),t&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(e)>-1||t.forEach((function(t){n.detectors[t]&&n.detectors[t].cacheUserLanguage(e,n.options)})))}}],n&&Wh(t.prototype,n),a&&Wh(t,a),Object.defineProperty(t,"prototype",{writable:!1}),e}();lp.type="languageDetector";const up={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console&&console[e]&&console[e].apply(console,t)}};class dp{constructor(e){this.init(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{})}init(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||up,this.options=t,this.debug=t.debug}log(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"log","",!0)}warn(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"warn","",!0)}error(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"error","")}deprecate(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}forward(e,t,n,a){return a&&!this.debug?null:("string"==typeof e[0]&&(e[0]=`${n}${this.prefix} ${e[0]}`),this.logger[t](e))}create(e){return new dp(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return(e=e||this.options).prefix=e.prefix||this.prefix,new dp(this.logger,e)}}var cp=new dp;class fp{constructor(){this.observers={}}on(e,t){return e.split(" ").forEach((e=>{this.observers[e]=this.observers[e]||[],this.observers[e].push(t)})),this}off(e,t){this.observers[e]&&(t?this.observers[e]=this.observers[e].filter((e=>e!==t)):delete this.observers[e])}emit(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];if(this.observers[e]){[].concat(this.observers[e]).forEach((e=>{e(...n)}))}if(this.observers["*"]){[].concat(this.observers["*"]).forEach((t=>{t.apply(t,[e,...n])}))}}}function hp(){let e,t;const n=new Promise(((n,a)=>{e=n,t=a}));return n.resolve=e,n.reject=t,n}function pp(e){return null==e?"":""+e}function mp(e,t,n){function a(e){return e&&e.indexOf("###")>-1?e.replace(/###/g,"."):e}function r(){return!e||"string"==typeof e}const i="string"!=typeof t?[].concat(t):t.split(".");for(;i.length>1;){if(r())return{};const t=a(i.shift());!e[t]&&n&&(e[t]=new n),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{}}return r()?{}:{obj:e,k:a(i.shift())}}function gp(e,t,n){const{obj:a,k:r}=mp(e,t,Object);a[r]=n}function vp(e,t){const{obj:n,k:a}=mp(e,t);if(n)return n[a]}function yp(e,t,n){for(const a in t)"__proto__"!==a&&"constructor"!==a&&(a in e?"string"==typeof e[a]||e[a]instanceof String||"string"==typeof t[a]||t[a]instanceof String?n&&(e[a]=t[a]):yp(e[a],t[a],n):e[a]=t[a]);return e}function bp(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var xp={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function Cp(e){return"string"==typeof e?e.replace(/[&<>"'\/]/g,(e=>xp[e])):e}const wp=[" ",",","?","!",";"];function Ep(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:".";if(!e)return;if(e[t])return e[t];const a=t.split(n);let r=e;for(let e=0;e<a.length;++e){if(!r)return;if("string"==typeof r[a[e]]&&e+1<a.length)return;if(void 0===r[a[e]]){let i=2,o=a.slice(e,e+i).join(n),s=r[o];for(;void 0===s&&a.length>e+i;)i++,o=a.slice(e,e+i).join(n),s=r[o];if(void 0===s)return;if(null===s)return null;if(t.endsWith(o)){if("string"==typeof s)return s;if(o&&"string"==typeof s[o])return s[o]}const l=a.slice(e+i).join(n);return l?Ep(s,l,n):void 0}r=r[a[e]]}return r}function kp(e){return e&&e.indexOf("_")>0?e.replace("_","-"):e}class Tp extends fp{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=e||{},this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),void 0===this.options.ignoreJSONStructure&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const r=void 0!==a.keySeparator?a.keySeparator:this.options.keySeparator,i=void 0!==a.ignoreJSONStructure?a.ignoreJSONStructure:this.options.ignoreJSONStructure;let o=[e,t];n&&"string"!=typeof n&&(o=o.concat(n)),n&&"string"==typeof n&&(o=o.concat(r?n.split(r):n)),e.indexOf(".")>-1&&(o=e.split("."));const s=vp(this.data,o);return s||!i||"string"!=typeof n?s:Ep(this.data&&this.data[e]&&this.data[e][t],n,r)}addResource(e,t,n,a){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1};const i=void 0!==r.keySeparator?r.keySeparator:this.options.keySeparator;let o=[e,t];n&&(o=o.concat(i?n.split(i):n)),e.indexOf(".")>-1&&(o=e.split("."),a=t,t=o[1]),this.addNamespaces(t),gp(this.data,o,a),r.silent||this.emit("added",e,t,n,a)}addResources(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(const a in n)"string"!=typeof n[a]&&"[object Array]"!==Object.prototype.toString.apply(n[a])||this.addResource(e,t,a,n[a],{silent:!0});a.silent||this.emit("added",e,t,n)}addResourceBundle(e,t,n,a,r){let i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1},o=[e,t];e.indexOf(".")>-1&&(o=e.split("."),a=n,n=t,t=o[1]),this.addNamespaces(t);let s=vp(this.data,o)||{};a?yp(s,n,r):s={...s,...n},gp(this.data,o,s),i.silent||this.emit("added",e,t,n)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}hasResourceBundle(e,t){return void 0!==this.getResource(e,t)}getResourceBundle(e,t){return t||(t=this.options.defaultNS),"v1"===this.options.compatibilityAPI?{...this.getResource(e,t)}:this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find((e=>t[e]&&Object.keys(t[e]).length>0))}toJSON(){return this.data}}var Mp={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,a,r){return e.forEach((e=>{this.processors[e]&&(t=this.processors[e].process(t,n,a,r))})),t}};const Ip={};class Sp extends fp{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),function(e,t,n){e.forEach((e=>{t[e]&&(n[e]=t[e])}))}(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),this.logger=cp.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e){if(null==e)return!1;const t=this.resolve(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}});return t&&void 0!==t.res}extractFromKey(e,t){let n=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===n&&(n=":");const a=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator;let r=t.ns||this.options.defaultNS||[];const i=n&&e.indexOf(n)>-1,o=!(this.options.userDefinedKeySeparator||t.keySeparator||this.options.userDefinedNsSeparator||t.nsSeparator||function(e,t,n){t=t||"",n=n||"";const a=wp.filter((e=>t.indexOf(e)<0&&n.indexOf(e)<0));if(0===a.length)return!0;const r=new RegExp(`(${a.map((e=>"?"===e?"\\?":e)).join("|")})`);let i=!r.test(e);if(!i){const t=e.indexOf(n);t>0&&!r.test(e.substring(0,t))&&(i=!0)}return i}(e,n,a));if(i&&!o){const t=e.match(this.interpolator.nestingRegexp);if(t&&t.length>0)return{key:e,namespaces:r};const i=e.split(n);(n!==a||n===a&&this.options.ns.indexOf(i[0])>-1)&&(r=i.shift()),e=i.join(a)}return"string"==typeof r&&(r=[r]),{key:e,namespaces:r}}translate(e,t,n){if("object"!=typeof t&&this.options.overloadTranslationOptionHandler&&(t=this.options.overloadTranslationOptionHandler(arguments)),"object"==typeof t&&(t={...t}),t||(t={}),null==e)return"";Array.isArray(e)||(e=[String(e)]);const a=void 0!==t.returnDetails?t.returnDetails:this.options.returnDetails,r=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,{key:i,namespaces:o}=this.extractFromKey(e[e.length-1],t),s=o[o.length-1],l=t.lng||this.language,u=t.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(l&&"cimode"===l.toLowerCase()){if(u){const e=t.nsSeparator||this.options.nsSeparator;return a?{res:`${s}${e}${i}`,usedKey:i,exactUsedKey:i,usedLng:l,usedNS:s}:`${s}${e}${i}`}return a?{res:i,usedKey:i,exactUsedKey:i,usedLng:l,usedNS:s}:i}const d=this.resolve(e,t);let c=d&&d.res;const f=d&&d.usedKey||i,h=d&&d.exactUsedKey||i,p=Object.prototype.toString.apply(c),m=void 0!==t.joinArrays?t.joinArrays:this.options.joinArrays,g=!this.i18nFormat||this.i18nFormat.handleAsObject;if(g&&c&&("string"!=typeof c&&"boolean"!=typeof c&&"number"!=typeof c)&&["[object Number]","[object Function]","[object RegExp]"].indexOf(p)<0&&("string"!=typeof m||"[object Array]"!==p)){if(!t.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(f,c,{...t,ns:o}):`key '${i} (${this.language})' returned an object instead of string.`;return a?(d.res=e,d):e}if(r){const e="[object Array]"===p,n=e?[]:{},a=e?h:f;for(const e in c)if(Object.prototype.hasOwnProperty.call(c,e)){const i=`${a}${r}${e}`;n[e]=this.translate(i,{...t,joinArrays:!1,ns:o}),n[e]===i&&(n[e]=c[e])}c=n}}else if(g&&"string"==typeof m&&"[object Array]"===p)c=c.join(m),c&&(c=this.extendTranslation(c,e,t,n));else{let a=!1,o=!1;const u=void 0!==t.count&&"string"!=typeof t.count,f=Sp.hasDefaultValue(t),h=u?this.pluralResolver.getSuffix(l,t.count,t):"",p=t.ordinal&&u?this.pluralResolver.getSuffix(l,t.count,{ordinal:!1}):"",m=t[`defaultValue${h}`]||t[`defaultValue${p}`]||t.defaultValue;!this.isValidLookup(c)&&f&&(a=!0,c=m),this.isValidLookup(c)||(o=!0,c=i);const g=(t.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&o?void 0:c,v=f&&m!==c&&this.options.updateMissing;if(o||a||v){if(this.logger.log(v?"updateKey":"missingKey",l,s,i,v?m:c),r){const e=this.resolve(i,{...t,keySeparator:!1});e&&e.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let e=[];const n=this.languageUtils.getFallbackCodes(this.options.fallbackLng,t.lng||this.language);if("fallback"===this.options.saveMissingTo&&n&&n[0])for(let t=0;t<n.length;t++)e.push(n[t]);else"all"===this.options.saveMissingTo?e=this.languageUtils.toResolveHierarchy(t.lng||this.language):e.push(t.lng||this.language);const a=(e,n,a)=>{const r=f&&a!==c?a:g;this.options.missingKeyHandler?this.options.missingKeyHandler(e,s,n,r,v,t):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(e,s,n,r,v,t),this.emit("missingKey",e,s,n,c)};this.options.saveMissing&&(this.options.saveMissingPlurals&&u?e.forEach((e=>{this.pluralResolver.getSuffixes(e,t).forEach((n=>{a([e],i+n,t[`defaultValue${n}`]||m)}))})):a(e,i,m))}c=this.extendTranslation(c,e,t,d,n),o&&c===i&&this.options.appendNamespaceToMissingKey&&(c=`${s}:${i}`),(o||a)&&this.options.parseMissingKeyHandler&&(c="v1"!==this.options.compatibilityAPI?this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${s}:${i}`:i,a?c:void 0):this.options.parseMissingKeyHandler(c))}return a?(d.res=c,d):c}extendTranslation(e,t,n,a,r){var i=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||a.usedLng,a.usedNS,a.usedKey,{resolved:a});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init({...n,interpolation:{...this.options.interpolation,...n.interpolation}});const o="string"==typeof e&&(n&&n.interpolation&&void 0!==n.interpolation.skipOnVariables?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let s;if(o){const t=e.match(this.interpolator.nestingRegexp);s=t&&t.length}let l=n.replace&&"string"!=typeof n.replace?n.replace:n;if(this.options.interpolation.defaultVariables&&(l={...this.options.interpolation.defaultVariables,...l}),e=this.interpolator.interpolate(e,l,n.lng||this.language,n),o){const t=e.match(this.interpolator.nestingRegexp);s<(t&&t.length)&&(n.nest=!1)}!n.lng&&"v1"!==this.options.compatibilityAPI&&a&&a.res&&(n.lng=a.usedLng),!1!==n.nest&&(e=this.interpolator.nest(e,(function(){for(var e=arguments.length,a=new Array(e),o=0;o<e;o++)a[o]=arguments[o];return r&&r[0]===a[0]&&!n.context?(i.logger.warn(`It seems you are nesting recursively key: ${a[0]} in key: ${t[0]}`),null):i.translate(...a,t)}),n)),n.interpolation&&this.interpolator.reset()}const o=n.postProcess||this.options.postProcess,s="string"==typeof o?[o]:o;return null!=e&&s&&s.length&&!1!==n.applyPostProcessor&&(e=Mp.handle(s,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:a,...n}:n,this)),e}resolve(e){let t,n,a,r,i,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return"string"==typeof e&&(e=[e]),e.forEach((e=>{if(this.isValidLookup(t))return;const s=this.extractFromKey(e,o),l=s.key;n=l;let u=s.namespaces;this.options.fallbackNS&&(u=u.concat(this.options.fallbackNS));const d=void 0!==o.count&&"string"!=typeof o.count,c=d&&!o.ordinal&&0===o.count&&this.pluralResolver.shouldUseIntlApi(),f=void 0!==o.context&&("string"==typeof o.context||"number"==typeof o.context)&&""!==o.context,h=o.lngs?o.lngs:this.languageUtils.toResolveHierarchy(o.lng||this.language,o.fallbackLng);u.forEach((e=>{this.isValidLookup(t)||(i=e,!Ip[`${h[0]}-${e}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(i)&&(Ip[`${h[0]}-${e}`]=!0,this.logger.warn(`key "${n}" for languages "${h.join(", ")}" won't get resolved as namespace "${i}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),h.forEach((n=>{if(this.isValidLookup(t))return;r=n;const i=[l];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(i,l,n,e,o);else{let e;d&&(e=this.pluralResolver.getSuffix(n,o.count,o));const t=`${this.options.pluralSeparator}zero`,a=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(d&&(i.push(l+e),o.ordinal&&0===e.indexOf(a)&&i.push(l+e.replace(a,this.options.pluralSeparator)),c&&i.push(l+t)),f){const n=`${l}${this.options.contextSeparator}${o.context}`;i.push(n),d&&(i.push(n+e),o.ordinal&&0===e.indexOf(a)&&i.push(n+e.replace(a,this.options.pluralSeparator)),c&&i.push(n+t))}}let s;for(;s=i.pop();)this.isValidLookup(t)||(a=s,t=this.getResource(n,e,s,o))})))}))})),{res:t,usedKey:n,exactUsedKey:a,usedLng:r,usedNS:i}}isValidLookup(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}getResource(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,t,n,a):this.resourceStore.getResource(e,t,n,a)}static hasDefaultValue(e){const t="defaultValue";for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t===n.substring(0,t.length)&&void 0!==e[n])return!0;return!1}}function Dp(e){return e.charAt(0).toUpperCase()+e.slice(1)}class Np{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=cp.create("languageUtils")}getScriptPartFromCode(e){if(!(e=kp(e))||e.indexOf("-")<0)return null;const t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}getLanguagePartFromCode(e){if(!(e=kp(e))||e.indexOf("-")<0)return e;const t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if("string"==typeof e&&e.indexOf("-")>-1){const t=["hans","hant","latn","cyrl","cans","mong","arab"];let n=e.split("-");return this.options.lowerCaseLng?n=n.map((e=>e.toLowerCase())):2===n.length?(n[0]=n[0].toLowerCase(),n[1]=n[1].toUpperCase(),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=Dp(n[1].toLowerCase()))):3===n.length&&(n[0]=n[0].toLowerCase(),2===n[1].length&&(n[1]=n[1].toUpperCase()),"sgn"!==n[0]&&2===n[2].length&&(n[2]=n[2].toUpperCase()),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=Dp(n[1].toLowerCase())),t.indexOf(n[2].toLowerCase())>-1&&(n[2]=Dp(n[2].toLowerCase()))),n.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach((e=>{if(t)return;const n=this.formatLanguageCode(e);this.options.supportedLngs&&!this.isSupportedCode(n)||(t=n)})),!t&&this.options.supportedLngs&&e.forEach((e=>{if(t)return;const n=this.getLanguagePartFromCode(e);if(this.isSupportedCode(n))return t=n;t=this.options.supportedLngs.find((e=>e===n?e:e.indexOf("-")<0&&n.indexOf("-")<0?void 0:0===e.indexOf(n)?e:void 0))})),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(e,t){if(!e)return[];if("function"==typeof e&&(e=e(t)),"string"==typeof e&&(e=[e]),"[object Array]"===Object.prototype.toString.apply(e))return e;if(!t)return e.default||[];let n=e[t];return n||(n=e[this.getScriptPartFromCode(t)]),n||(n=e[this.formatLanguageCode(t)]),n||(n=e[this.getLanguagePartFromCode(t)]),n||(n=e.default),n||[]}toResolveHierarchy(e,t){const n=this.getFallbackCodes(t||this.options.fallbackLng||[],e),a=[],r=e=>{e&&(this.isSupportedCode(e)?a.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return"string"==typeof e&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?("languageOnly"!==this.options.load&&r(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&r(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&r(this.getLanguagePartFromCode(e))):"string"==typeof e&&r(this.formatLanguageCode(e)),n.forEach((e=>{a.indexOf(e)<0&&r(this.formatLanguageCode(e))})),a}}let Ap=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],Lp={1:function(e){return Number(e>1)},2:function(e){return Number(1!=e)},3:function(e){return 0},4:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},5:function(e){return Number(0==e?0:1==e?1:2==e?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5)},6:function(e){return Number(1==e?0:e>=2&&e<=4?1:2)},7:function(e){return Number(1==e?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},8:function(e){return Number(1==e?0:2==e?1:8!=e&&11!=e?2:3)},9:function(e){return Number(e>=2)},10:function(e){return Number(1==e?0:2==e?1:e<7?2:e<11?3:4)},11:function(e){return Number(1==e||11==e?0:2==e||12==e?1:e>2&&e<20?2:3)},12:function(e){return Number(e%10!=1||e%100==11)},13:function(e){return Number(0!==e)},14:function(e){return Number(1==e?0:2==e?1:3==e?2:3)},15:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2)},16:function(e){return Number(e%10==1&&e%100!=11?0:0!==e?1:2)},17:function(e){return Number(1==e||e%10==1&&e%100!=11?0:1)},18:function(e){return Number(0==e?0:1==e?1:2)},19:function(e){return Number(1==e?0:0==e||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3)},20:function(e){return Number(1==e?0:0==e||e%100>0&&e%100<20?1:2)},21:function(e){return Number(e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0)},22:function(e){return Number(1==e?0:2==e?1:(e<0||e>10)&&e%10==0?2:3)}};const Rp=["v1","v2","v3"],Op=["v4"],Fp={zero:0,one:1,two:2,few:3,many:4,other:5};class jp{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.languageUtils=e,this.options=t,this.logger=cp.create("pluralResolver"),this.options.compatibilityJSON&&!Op.includes(this.options.compatibilityJSON)||"undefined"!=typeof Intl&&Intl.PluralRules||(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=function(){const e={};return Ap.forEach((t=>{t.lngs.forEach((n=>{e[n]={numbers:t.nr,plurals:Lp[t.fc]}}))})),e}()}addRule(e,t){this.rules[e]=t}getRule(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(kp(e),{type:t.ordinal?"ordinal":"cardinal"})}catch{return}return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}needsPlural(e){const t=this.getRule(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{});return this.shouldUseIntlApi()?t&&t.resolvedOptions().pluralCategories.length>1:t&&t.numbers.length>1}getPluralFormsOfKey(e,t){return this.getSuffixes(e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).map((e=>`${t}${e}`))}getSuffixes(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=this.getRule(e,t);return n?this.shouldUseIntlApi()?n.resolvedOptions().pluralCategories.sort(((e,t)=>Fp[e]-Fp[t])).map((e=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${e}`)):n.numbers.map((n=>this.getSuffix(e,n,t))):[]}getSuffix(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const a=this.getRule(e,n);return a?this.shouldUseIntlApi()?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${a.select(t)}`:this.getSuffixRetroCompatible(a,t):(this.logger.warn(`no plural rule found for: ${e}`),"")}getSuffixRetroCompatible(e,t){const n=e.plurals(e.noAbs?t:Math.abs(t));let a=e.numbers[n];this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]&&(2===a?a="plural":1===a&&(a=""));const r=()=>this.options.prepend&&a.toString()?this.options.prepend+a.toString():a.toString();return"v1"===this.options.compatibilityJSON?1===a?"":"number"==typeof a?`_plural_${a.toString()}`:r():"v2"===this.options.compatibilityJSON||this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]?r():this.options.prepend&&n.toString()?this.options.prepend+n.toString():n.toString()}shouldUseIntlApi(){return!Rp.includes(this.options.compatibilityJSON)}}function Pp(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:".",r=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],i=function(e,t,n){const a=vp(e,n);return void 0!==a?a:vp(t,n)}(e,t,n);return!i&&r&&"string"==typeof n&&(i=Ep(e,n,a),void 0===i&&(i=Ep(t,n,a))),i}class Bp{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.logger=cp.create("interpolator"),this.options=e,this.format=e.interpolation&&e.interpolation.format||(e=>e),this.init(e)}init(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});const t=e.interpolation;this.escape=void 0!==t.escape?t.escape:Cp,this.escapeValue=void 0===t.escapeValue||t.escapeValue,this.useRawValueToEscape=void 0!==t.useRawValueToEscape&&t.useRawValueToEscape,this.prefix=t.prefix?bp(t.prefix):t.prefixEscaped||"{{",this.suffix=t.suffix?bp(t.suffix):t.suffixEscaped||"}}",this.formatSeparator=t.formatSeparator?t.formatSeparator:t.formatSeparator||",",this.unescapePrefix=t.unescapeSuffix?"":t.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":t.unescapeSuffix||"",this.nestingPrefix=t.nestingPrefix?bp(t.nestingPrefix):t.nestingPrefixEscaped||bp("$t("),this.nestingSuffix=t.nestingSuffix?bp(t.nestingSuffix):t.nestingSuffixEscaped||bp(")"),this.nestingOptionsSeparator=t.nestingOptionsSeparator?t.nestingOptionsSeparator:t.nestingOptionsSeparator||",",this.maxReplaces=t.maxReplaces?t.maxReplaces:1e3,this.alwaysFormat=void 0!==t.alwaysFormat&&t.alwaysFormat,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){this.regexp=new RegExp(`${this.prefix}(.+?)${this.suffix}`,"g");this.regexpUnescape=new RegExp(`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`,"g");this.nestingRegexp=new RegExp(`${this.nestingPrefix}(.+?)${this.nestingSuffix}`,"g")}interpolate(e,t,n,a){let r,i,o;const s=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function l(e){return e.replace(/\$/g,"$$$$")}const u=e=>{if(e.indexOf(this.formatSeparator)<0){const r=Pp(t,s,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(r,void 0,n,{...a,...t,interpolationkey:e}):r}const r=e.split(this.formatSeparator),i=r.shift().trim(),o=r.join(this.formatSeparator).trim();return this.format(Pp(t,s,i,this.options.keySeparator,this.options.ignoreJSONStructure),o,n,{...a,...t,interpolationkey:i})};this.resetRegExp();const d=a&&a.missingInterpolationHandler||this.options.missingInterpolationHandler,c=a&&a.interpolation&&void 0!==a.interpolation.skipOnVariables?a.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>l(e)},{regex:this.regexp,safeValue:e=>l(this.escapeValue?this.escape(e):e)}].forEach((t=>{for(o=0;r=t.regex.exec(e);){const n=r[1].trim();if(i=u(n),void 0===i)if("function"==typeof d){const t=d(e,r,a);i="string"==typeof t?t:""}else if(a&&Object.prototype.hasOwnProperty.call(a,n))i="";else{if(c){i=r[0];continue}this.logger.warn(`missed to pass in variable ${n} for interpolating ${e}`),i=""}else"string"==typeof i||this.useRawValueToEscape||(i=pp(i));const s=t.safeValue(i);if(e=e.replace(r[0],s),c?(t.regex.lastIndex+=i.length,t.regex.lastIndex-=r[0].length):t.regex.lastIndex=0,o++,o>=this.maxReplaces)break}})),e}nest(e,t){let n,a,r,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};function o(e,t){const n=this.nestingOptionsSeparator;if(e.indexOf(n)<0)return e;const a=e.split(new RegExp(`${n}[ ]*{`));let i=`{${a[1]}`;e=a[0],i=this.interpolate(i,r);const o=i.match(/'/g),s=i.match(/"/g);(o&&o.length%2==0&&!s||s.length%2!=0)&&(i=i.replace(/'/g,'"'));try{r=JSON.parse(i),t&&(r={...t,...r})}catch(t){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,t),`${e}${n}${i}`}return delete r.defaultValue,e}for(;n=this.nestingRegexp.exec(e);){let s=[];r={...i},r=r.replace&&"string"!=typeof r.replace?r.replace:r,r.applyPostProcessor=!1,delete r.defaultValue;let l=!1;if(-1!==n[0].indexOf(this.formatSeparator)&&!/{.*}/.test(n[1])){const e=n[1].split(this.formatSeparator).map((e=>e.trim()));n[1]=e.shift(),s=e,l=!0}if(a=t(o.call(this,n[1].trim(),r),r),a&&n[0]===e&&"string"!=typeof a)return a;"string"!=typeof a&&(a=pp(a)),a||(this.logger.warn(`missed to resolve ${n[1]} for nesting ${e}`),a=""),l&&(a=s.reduce(((e,t)=>this.format(e,t,i.lng,{...i,interpolationkey:n[1].trim()})),a.trim())),e=e.replace(n[0],a),this.regexp.lastIndex=0}return e}}function _p(e){const t={};return function(n,a,r){const i=a+JSON.stringify(r);let o=t[i];return o||(o=e(kp(a),r),t[i]=o),o(n)}}class Up{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.logger=cp.create("formatter"),this.options=e,this.formats={number:_p(((e,t)=>{const n=new Intl.NumberFormat(e,{...t});return e=>n.format(e)})),currency:_p(((e,t)=>{const n=new Intl.NumberFormat(e,{...t,style:"currency"});return e=>n.format(e)})),datetime:_p(((e,t)=>{const n=new Intl.DateTimeFormat(e,{...t});return e=>n.format(e)})),relativetime:_p(((e,t)=>{const n=new Intl.RelativeTimeFormat(e,{...t});return e=>n.format(e,t.range||"day")})),list:_p(((e,t)=>{const n=new Intl.ListFormat(e,{...t});return e=>n.format(e)}))},this.init(e)}init(e){const t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}}).interpolation;this.formatSeparator=t.formatSeparator?t.formatSeparator:t.formatSeparator||","}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=_p(t)}format(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const r=t.split(this.formatSeparator).reduce(((e,t)=>{const{formatName:r,formatOptions:i}=function(e){let t=e.toLowerCase().trim();const n={};if(e.indexOf("(")>-1){const a=e.split("(");t=a[0].toLowerCase().trim();const r=a[1].substring(0,a[1].length-1);"currency"===t&&r.indexOf(":")<0?n.currency||(n.currency=r.trim()):"relativetime"===t&&r.indexOf(":")<0?n.range||(n.range=r.trim()):r.split(";").forEach((e=>{if(!e)return;const[t,...a]=e.split(":"),r=a.join(":").trim().replace(/^'+|'+$/g,"");n[t.trim()]||(n[t.trim()]=r),"false"===r&&(n[t.trim()]=!1),"true"===r&&(n[t.trim()]=!0),isNaN(r)||(n[t.trim()]=parseInt(r,10))}))}return{formatName:t,formatOptions:n}}(t);if(this.formats[r]){let t=e;try{const o=a&&a.formatParams&&a.formatParams[a.interpolationkey]||{};t=this.formats[r](e,o.locale||o.lng||a.locale||a.lng||n,{...i,...a,...o})}catch(e){this.logger.warn(e)}return t}return this.logger.warn(`there was no format function for ${r}`),e}),e);return r}}class zp extends fp{constructor(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};super(),this.backend=e,this.store=t,this.services=n,this.languageUtils=n.languageUtils,this.options=a,this.logger=cp.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=a.maxParallelReads||10,this.readingCalls=0,this.maxRetries=a.maxRetries>=0?a.maxRetries:5,this.retryTimeout=a.retryTimeout>=1?a.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(n,a.backend,a)}queueLoad(e,t,n,a){const r={},i={},o={},s={};return e.forEach((e=>{let a=!0;t.forEach((t=>{const o=`${e}|${t}`;!n.reload&&this.store.hasResourceBundle(e,t)?this.state[o]=2:this.state[o]<0||(1===this.state[o]?void 0===i[o]&&(i[o]=!0):(this.state[o]=1,a=!1,void 0===i[o]&&(i[o]=!0),void 0===r[o]&&(r[o]=!0),void 0===s[t]&&(s[t]=!0)))})),a||(o[e]=!0)})),(Object.keys(r).length||Object.keys(i).length)&&this.queue.push({pending:i,pendingCount:Object.keys(i).length,loaded:{},errors:[],callback:a}),{toLoad:Object.keys(r),pending:Object.keys(i),toLoadLanguages:Object.keys(o),toLoadNamespaces:Object.keys(s)}}loaded(e,t,n){const a=e.split("|"),r=a[0],i=a[1];t&&this.emit("failedLoading",r,i,t),n&&this.store.addResourceBundle(r,i,n),this.state[e]=t?-1:2;const o={};this.queue.forEach((n=>{!function(e,t,n,a){const{obj:r,k:i}=mp(e,t,Object);r[i]=r[i]||[],a&&(r[i]=r[i].concat(n)),a||r[i].push(n)}(n.loaded,[r],i),function(e,t){void 0!==e.pending[t]&&(delete e.pending[t],e.pendingCount--)}(n,e),t&&n.errors.push(t),0!==n.pendingCount||n.done||(Object.keys(n.loaded).forEach((e=>{o[e]||(o[e]={});const t=n.loaded[e];t.length&&t.forEach((t=>{void 0===o[e][t]&&(o[e][t]=!0)}))})),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())})),this.emit("loaded",o),this.queue=this.queue.filter((e=>!e.done))}read(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.retryTimeout,i=arguments.length>5?arguments[5]:void 0;if(!e.length)return i(null,{});if(this.readingCalls>=this.maxParallelReads)return void this.waitingReads.push({lng:e,ns:t,fcName:n,tried:a,wait:r,callback:i});this.readingCalls++;const o=(o,s)=>{if(this.readingCalls--,this.waitingReads.length>0){const e=this.waitingReads.shift();this.read(e.lng,e.ns,e.fcName,e.tried,e.wait,e.callback)}o&&s&&a<this.maxRetries?setTimeout((()=>{this.read.call(this,e,t,n,a+1,2*r,i)}),r):i(o,s)},s=this.backend[n].bind(this.backend);if(2!==s.length)return s(e,t,o);try{const n=s(e,t);n&&"function"==typeof n.then?n.then((e=>o(null,e))).catch(o):o(null,n)}catch(e){o(e)}}prepareLoading(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),a&&a();"string"==typeof e&&(e=this.languageUtils.toResolveHierarchy(e)),"string"==typeof t&&(t=[t]);const r=this.queueLoad(e,t,n,a);if(!r.toLoad.length)return r.pending.length||a(),null;r.toLoad.forEach((e=>{this.loadOne(e)}))}load(e,t,n){this.prepareLoading(e,t,{},n)}reload(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}loadOne(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";const n=e.split("|"),a=n[0],r=n[1];this.read(a,r,"read",void 0,void 0,((n,i)=>{n&&this.logger.warn(`${t}loading namespace ${r} for language ${a} failed`,n),!n&&i&&this.logger.log(`${t}loaded namespace ${r} for language ${a}`,i),this.loaded(e,n,i)}))}saveMissing(e,t,n,a,r){let i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(t))this.logger.warn(`did not save key "${n}" as the namespace "${t}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");else if(null!=n&&""!==n){if(this.backend&&this.backend.create){const s={...i,isUpdate:r},l=this.backend.create.bind(this.backend);if(l.length<6)try{let r;r=5===l.length?l(e,t,n,a,s):l(e,t,n,a),r&&"function"==typeof r.then?r.then((e=>o(null,e))).catch(o):o(null,r)}catch(e){o(e)}else l(e,t,n,a,o,s)}e&&e[0]&&this.store.addResource(e[0],t,n,a)}}}function Gp(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){let t={};if("object"==typeof e[1]&&(t=e[1]),"string"==typeof e[1]&&(t.defaultValue=e[1]),"string"==typeof e[2]&&(t.tDescription=e[2]),"object"==typeof e[2]||"object"==typeof e[3]){const n=e[3]||e[2];Object.keys(n).forEach((e=>{t[e]=n[e]}))}return t},interpolation:{escapeValue:!0,format:(e,t,n,a)=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function Wp(e){return"string"==typeof e.ns&&(e.ns=[e.ns]),"string"==typeof e.fallbackLng&&(e.fallbackLng=[e.fallbackLng]),"string"==typeof e.fallbackNS&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e}function $p(){}class Vp extends fp{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;var n;if(super(),this.options=Wp(e),this.services={},this.logger=cp,this.modules={external:[]},n=this,Object.getOwnPropertyNames(Object.getPrototypeOf(n)).forEach((e=>{"function"==typeof n[e]&&(n[e]=n[e].bind(n))})),t&&!this.isInitialized&&!e.isClone){if(!this.options.initImmediate)return this.init(e,t),this;setTimeout((()=>{this.init(e,t)}),0)}}init(){var e=this;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;"function"==typeof t&&(n=t,t={}),!t.defaultNS&&!1!==t.defaultNS&&t.ns&&("string"==typeof t.ns?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));const a=Gp();function r(e){return e?"function"==typeof e?new e:e:null}if(this.options={...a,...this.options,...Wp(t)},"v1"!==this.options.compatibilityAPI&&(this.options.interpolation={...a.interpolation,...this.options.interpolation}),void 0!==t.keySeparator&&(this.options.userDefinedKeySeparator=t.keySeparator),void 0!==t.nsSeparator&&(this.options.userDefinedNsSeparator=t.nsSeparator),!this.options.isClone){let t;cp.init(this.modules.logger?r(this.modules.logger):null,this.options),this.modules.formatter?t=this.modules.formatter:"undefined"!=typeof Intl&&(t=Up);const n=new Np(this.options);this.store=new Tp(this.options.resources,this.options);const i=this.services;i.logger=cp,i.resourceStore=this.store,i.languageUtils=n,i.pluralResolver=new jp(n,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),!t||this.options.interpolation.format&&this.options.interpolation.format!==a.interpolation.format||(i.formatter=r(t),i.formatter.init(i,this.options),this.options.interpolation.format=i.formatter.format.bind(i.formatter)),i.interpolator=new Bp(this.options),i.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},i.backendConnector=new zp(r(this.modules.backend),i.resourceStore,i,this.options),i.backendConnector.on("*",(function(t){for(var n=arguments.length,a=new Array(n>1?n-1:0),r=1;r<n;r++)a[r-1]=arguments[r];e.emit(t,...a)})),this.modules.languageDetector&&(i.languageDetector=r(this.modules.languageDetector),i.languageDetector.init&&i.languageDetector.init(i,this.options.detection,this.options)),this.modules.i18nFormat&&(i.i18nFormat=r(this.modules.i18nFormat),i.i18nFormat.init&&i.i18nFormat.init(this)),this.translator=new Sp(this.services,this.options),this.translator.on("*",(function(t){for(var n=arguments.length,a=new Array(n>1?n-1:0),r=1;r<n;r++)a[r-1]=arguments[r];e.emit(t,...a)})),this.modules.external.forEach((e=>{e.init&&e.init(this)}))}if(this.format=this.options.interpolation.format,n||(n=$p),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const e=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);e.length>0&&"dev"!==e[0]&&(this.options.lng=e[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined");["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach((t=>{this[t]=function(){return e.store[t](...arguments)}}));["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach((t=>{this[t]=function(){return e.store[t](...arguments),e}}));const i=hp(),o=()=>{const e=(e,t)=>{this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),i.resolve(t),n(e,t)};if(this.languages&&"v1"!==this.options.compatibilityAPI&&!this.isInitialized)return e(null,this.t.bind(this));this.changeLanguage(this.options.lng,e)};return this.options.resources||!this.options.initImmediate?o():setTimeout(o,0),i}loadResources(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$p;const n="string"==typeof e?e:this.language;if("function"==typeof e&&(t=e),!this.options.resources||this.options.partialBundledLanguages){if(n&&"cimode"===n.toLowerCase()&&(!this.options.preload||0===this.options.preload.length))return t();const e=[],a=t=>{if(!t)return;if("cimode"===t)return;this.services.languageUtils.toResolveHierarchy(t).forEach((t=>{"cimode"!==t&&e.indexOf(t)<0&&e.push(t)}))};if(n)a(n);else{this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((e=>a(e)))}this.options.preload&&this.options.preload.forEach((e=>a(e))),this.services.backendConnector.load(e,this.options.ns,(e=>{e||this.resolvedLanguage||!this.language||this.setResolvedLanguage(this.language),t(e)}))}else t(null)}reloadResources(e,t,n){const a=hp();return e||(e=this.languages),t||(t=this.options.ns),n||(n=$p),this.services.backendConnector.reload(e,t,(e=>{a.resolve(),n(e)})),a}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&Mp.addPostProcessor(e),"formatter"===e.type&&(this.modules.formatter=e),"3rdParty"===e.type&&this.modules.external.push(e),this}setResolvedLanguage(e){if(e&&this.languages&&!(["cimode","dev"].indexOf(e)>-1))for(let e=0;e<this.languages.length;e++){const t=this.languages[e];if(!(["cimode","dev"].indexOf(t)>-1)&&this.store.hasLanguageSomeTranslations(t)){this.resolvedLanguage=t;break}}}changeLanguage(e,t){var n=this;this.isLanguageChangingTo=e;const a=hp();this.emit("languageChanging",e);const r=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},i=(e,i)=>{i?(r(i),this.translator.changeLanguage(i),this.isLanguageChangingTo=void 0,this.emit("languageChanged",i),this.logger.log("languageChanged",i)):this.isLanguageChangingTo=void 0,a.resolve((function(){return n.t(...arguments)})),t&&t(e,(function(){return n.t(...arguments)}))},o=t=>{e||t||!this.services.languageDetector||(t=[]);const n="string"==typeof t?t:this.services.languageUtils.getBestMatchFromCodes(t);n&&(this.language||r(n),this.translator.language||this.translator.changeLanguage(n),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(n)),this.loadResources(n,(e=>{i(e,n)}))};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?0===this.services.languageDetector.detect.length?this.services.languageDetector.detect().then(o):this.services.languageDetector.detect(o):o(e):o(this.services.languageDetector.detect()),a}getFixedT(e,t,n){var a=this;const r=function(e,t){let i;if("object"!=typeof t){for(var o=arguments.length,s=new Array(o>2?o-2:0),l=2;l<o;l++)s[l-2]=arguments[l];i=a.options.overloadTranslationOptionHandler([e,t].concat(s))}else i={...t};i.lng=i.lng||r.lng,i.lngs=i.lngs||r.lngs,i.ns=i.ns||r.ns,i.keyPrefix=i.keyPrefix||n||r.keyPrefix;const u=a.options.keySeparator||".";let d;return d=i.keyPrefix&&Array.isArray(e)?e.map((e=>`${i.keyPrefix}${u}${e}`)):i.keyPrefix?`${i.keyPrefix}${u}${e}`:e,a.t(d,i)};return"string"==typeof e?r.lng=e:r.lngs=e,r.ns=t,r.keyPrefix=n,r}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const n=t.lng||this.resolvedLanguage||this.languages[0],a=!!this.options&&this.options.fallbackLng,r=this.languages[this.languages.length-1];if("cimode"===n.toLowerCase())return!0;const i=(e,t)=>{const n=this.services.backendConnector.state[`${e}|${t}`];return-1===n||2===n};if(t.precheck){const e=t.precheck(this,i);if(void 0!==e)return e}return!!this.hasResourceBundle(n,e)||(!(this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages))||!(!i(n,e)||a&&!i(r,e)))}loadNamespaces(e,t){const n=hp();return this.options.ns?("string"==typeof e&&(e=[e]),e.forEach((e=>{this.options.ns.indexOf(e)<0&&this.options.ns.push(e)})),this.loadResources((e=>{n.resolve(),t&&t(e)})),n):(t&&t(),Promise.resolve())}loadLanguages(e,t){const n=hp();"string"==typeof e&&(e=[e]);const a=this.options.preload||[],r=e.filter((e=>a.indexOf(e)<0));return r.length?(this.options.preload=a.concat(r),this.loadResources((e=>{n.resolve(),t&&t(e)})),n):(t&&t(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!e)return"rtl";const t=this.services&&this.services.languageUtils||new Np(Gp());return["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].indexOf(t.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){return new Vp(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},arguments.length>1?arguments[1]:void 0)}cloneInstance(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$p;const n=e.forkResourceStore;n&&delete e.forkResourceStore;const a={...this.options,...e,isClone:!0},r=new Vp(a);void 0===e.debug&&void 0===e.prefix||(r.logger=r.logger.clone(e));return["store","services","language"].forEach((e=>{r[e]=this[e]})),r.services={...this.services},r.services.utils={hasLoadedNamespace:r.hasLoadedNamespace.bind(r)},n&&(r.store=new Tp(this.store.data,a),r.services.resourceStore=r.store),r.translator=new Sp(r.services,a),r.translator.on("*",(function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];r.emit(e,...n)})),r.init(a,t),r.translator.options=a,r.translator.backendConnector.services.utils={hasLoadedNamespace:r.hasLoadedNamespace.bind(r)},r}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const qp=Vp.createInstance();qp.createInstance=Vp.createInstance;var Hp={en:{translation:{}},es:{translation:{"Use your device camera to capture your ID":"Para capturar la identificación hay que utilizar la cámara del dispositivo.","Use your iPhone as a webcam":"Usar el iPhone como cámara web","Models warming up...":"Cargando modelos...","Camera initializing...":"Inicializando la cámara...","Camera access blocked":"Acceso bloqueado a la cámara","Location access blocked":"Acceso bloqueado a la localización",Continue:"Continuar","Processing...":"Procesando...","Your camera permission is disabled":"El permiso de la cámara está desactivado","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.","Your location permission is disabled":"El permiso de la localización está desactivado","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.",Retry:"Reintentar","Scan the front of ID":"Escanear el frente de la ID","Scan the back of ID":"Escanear el reverso de la ID","Scan the ID page of passport":"Escanear la página de datos del pasaporte","ID Card Front":"Frente de la ID","ID Card Back":"Reverso de la ID",Passport:"Pasaporte","Document not detected":"No se ha detectado el documento","Document is not centered":"Documento no centrado","Document too close, please back up":"Documento muy cerca, favor de alejarse","Document out of focus – try improving the lighting":"Documento no enfocado - hay que tratar de mejorar la iluminación","Document detected, hold still...":"Se ha detectado el documento, no moverse por favor...","Capturing...":"Capturando...","Capture failed!":"Falló la captura","Please flip your ID card...":"Por favor voltea la identificación...","ID card front captured.":"Se ha capturado el frente de la identificación.","ID Capture Successful":"Captura Exitosa de ID","Verify the entire ID was captured clearly with no glare.":"Hay que verificar que toda la ID se vea completa y sin reflejos.",Submit:"Enviar","Submitting...":"Enviando...","Use your device camera to capture your face":"Hay que utilizar la cámara del dispositivo para capturar el rostro","Remove Sunglasses & Hat":"Hay que quitarse lentes y/o la gorra","Avoid Excessive Backlighting":"Hay que evitar demasiada luz en el fondo","Hold still for a few seconds...":"Hay que permanecer quieto por unos segundos...","Look straight into the camera...":"Hay que mirar directamente a la cámara...","Move back...":"Hay que hacerse hacia atrás..","Move forward...":"Hay que hacerse hacia adelante...","Move to the center...":"Hay que moverse hacia el centro...","Please remove your eye coverings (sunglasses, eye patch, etc.)...":"Hay que quitarse lo que cubre los ojos (lentes, parche, etc.)...","Please remove your head coverings (hat, scarf, etc.)...":"Hay que quitarse lo que cubre la cabeza (gorra, mascada, etc.)...","Please remove your mask...":"Hay que quitarse el cubrebocas...","Live face not detected, please try again":"Rostro vivo no detectado. Por favor hay que intentar de nuevo.",Exit:"Salir","Face liveness has been verified!":"Se ha verificado la Prueba de Vida en rostro!",Done:"Terminar","Customer has been identified!":"¡Se ha identificado al cliente!","Customer not found":"Cliente no encontrado","Additional document capture":"Captura de otro documento",Next:"Siguiente","Please sign the box below":"Por favor, hay que firmar en el recuadro de abajo",Accept:"Aceptar",Clear:"Borrar","Video signature has been successfully captured!":"La video firma ha sido exitosa.","Network unreachable":"No hay conexión a internet.","We're having trouble reaching our services, please check your connection and try again.":"Estamos teniendo problemas para alcanzar nuestros servicios, por favor verificar la conexión a internet e intentar de nuevo.","We're sorry, an unexpected error has occurred.":"Lo sentimos, se ha producido un error inesperado.","Document Capture":"Captura de documento",Capture:"Capturar","Retry capture":"Reintentar la captura",Upload:"Enviar","Uploading...":"Procesando...","Upload succeeded!":"Proceso completo!","Display the front of your ID card...":"Hay que mostrar el frente de la identificación...","Display the back of your ID card...":"Hay que mostrar el reverso de la identificación...","Please move your face to the center...":"Por favor, hay que mover la cabeza hacia el centro...","Please read the following text aloud":"Hay que leer el siguiente texto en voz alta","Video ID has been successfully captured!":"Video ID capturado exitosamente!","We're having some trouble.":"Se ha presentado un problema.","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.","Verifying...":"Verificando....","Please capture the front of your ID card.":"Hay que capturar el frente de la identificación.","Please capture the back of your ID card.":"Hay que capturar el reverso de la identificación.","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.","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.","Please capture the ID page of your passport.":"Hay que capturar la página de datos del pasaporte.","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.","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 de la pasaporte manualmente.","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.","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.","Downloading...":"Descargando...","Accessing camera...":"Accediendo a la cámara","Camera ready":"Cámara está lista","Loading guided capture experience...":"Cargando la experiencia guiada para la captura....","Guided capture experience ready":"La experiencia guiada está lista","Let's Go!":"Vamos!"}}};var Yp=function(e){var n=ue().i18n;t.useEffect((function(){"auto"!==e?n.changeLanguage(e):n.changeLanguage()}),[n,e])};function Zp(e,t,n,a){if("string"==typeof n)return n;if("object"==typeof n){var r=n;if(r[t])return r[t];var i=t.split("-")[0];if(r[i])return r[i]}return e(a)}function Qp(e,n){var a=ue(),r=a.t,i=a.i18n;return t.useMemo((function(){return Zp(r,i.language,e,n)}),[n,i.language,r,e])}function Xp(e,n){var a=ue(),r=a.t,i=a.i18n;return t.useMemo((function(){return v(v({},e),Object.keys(n).reduce((function(t,a){var o;return v(v({},t),((o={})[a]=Zp(r,i.language,null==e?void 0:e[a],n[a]),o))}),{}))}),[n,i.language,r,e])}var Kp,Jp,em,tm,nm,am,rm,im,om=h.default.div(Kp||(Kp=w(["\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(e){var t=e.$top;return null!=t?t:"10vh"}),(function(e){var t=e.$bottom;return t?"bottom: ".concat(t,";"):""})),sm=function(e){var t=u.default.createElement(om,v({},e)),n=document.getElementById("idmission-above-guides-content");return n?o.createPortal(t,n):t},lm=h.default.div(Jp||(Jp=w(["\n margin-left: auto;\n margin-right: auto;\n background: ",";\n color: ",";\n padding: 10px 12px 8px;\n border-radius: 8px;\n z-index: 10001;\n"],["\n margin-left: auto;\n margin-right: auto;\n background: ",";\n color: ",";\n padding: 10px 12px 8px;\n border-radius: 8px;\n z-index: 10001;\n"])),(function(e){var t,n,a,r,i,o;return null!==(o=null!==(t=e.$background)&&void 0!==t?t:null===(i=null===(a=null===(n=e.theme)||void 0===n?void 0:n.guidanceMessages)||void 0===a?void 0:a[null!==(r=e.$variant)&&void 0!==r?r:"default"])||void 0===i?void 0:i.backgroundColor)&&void 0!==o?o:"#ccc"}),(function(e){var t,n,a,r,i,o;return null!==(o=null!==(t=e.$textColor)&&void 0!==t?t:null===(i=null===(a=null===(n=e.theme)||void 0===n?void 0:n.guidanceMessages)||void 0===a?void 0:a[null!==(r=e.$variant)&&void 0!==r?r:"default"])||void 0===i?void 0:i.textColor)&&void 0!==o?o:"black"})),um=function(e){var n,a,i,o,s,l,d,c,f,h=e.requiredDocumentType,p=e.autoCaptureEnabled,m=void 0===p||p,g=e.autoCaptureScoreThreshold,v=void 0===g?.8:g,y=e.autoCaptureGoodFramesRequired,C=void 0===y?3:y,w=e.autoCaptureBarcodeRequired,E=void 0===w?"mobile":w,k=e.mrzDetectionScoreThreshold,T=void 0===k?.25:k,M=e.passportPageDetectionThreshold,I=void 0===M?.6:M,S=e.pdf417DetectionThreshold,D=void 0===S?.15:S,N=e.focusScoreThreshold,A=void 0===N?.3:N,L=e.barcodeScanningEnabled,R=void 0===L||L,O=e.maxBarcodeScanAttempts,F=void 0===O?10:O,j=e.guidanceMessage,P=e.guidanceSatisfied,_=e.onPrediction,U=e.onBarcodeScanned,z=e.onCapture,G=e.assets,W=void 0===G?{}:G,$=e.classNames,V=void 0===$?{}:$,q=e.colors,H=void 0===q?{}:q,Y=e.verbiage,Z=void 0===Y?{}:Y,Q=e.debugMode,X=void 0!==Q&&Q,K=Le(),J=K.ref,ee=K.width,te=void 0===ee?1:ee,ne=K.height,ae=void 0===ne?1:ne,re=Ih(),ie=re[0],oe=re[1],se=t.useContext(Xe),le=se.cameraRef,ue=se.cameraReady,de=se.takePhoto,ce=se.videoRef,fe=se.videoLoaded,he=t.useRef(),pe=t.useContext(uh),me=pe.ready,ge=pe.working,ve=pe.setThresholds,ye=pe.makePrediction,be=pe.onPredictionMade,xe=pe.detectionTime,Ce=pe.focusPredictionTime,we=pe.getBestFrame,Ee=pe.resetBestFrame;t.useEffect((function(){he.current=new Date}),[]),t.useEffect((function(){oe({type:"configureCapture",payload:{requiredDocumentType:h,goodFramesThreshold:C,autoCaptureBarcodeRequired:E,barcodeScanningEnabled:R,maxBarcodeScanAttempts:F}}),Ee(),ve({document:v,passport:I,mrz:T,pdf417:D,focus:{mobile:A}})}),[h,v,A,T,C,E,R,F,I,D,Ee,ve,oe]),t.useEffect((function(){oe({type:"pageRendered",payload:{pageWidth:te,pageHeight:ae}})}),[oe,ae,te]);var ke=t.useRef(0),Te=t.useRef(!1);t.useEffect((function(){Te.current=fe&&ue&&me&&!ie.capturing&&!ie.captured}),[ue,ie.captured,ie.capturing,me,fe]);var Me=t.useState(null),Ie=Me[0],Se=Me[1];t.useEffect((function(){if(me&&ue&&fe)return ke.current=requestAnimationFrame((function e(){return b(this,void 0,void 0,(function(){var t,n;return x(this,(function(a){switch(a.label){case 0:if(!Te.current||ge.current)return[3,5];a.label=1;case 1:return a.trys.push([1,4,,5]),ie.shouldScanBarcode?[4,de()]:[3,3];case 2:if(!(t=a.sent()))return ke.current=requestAnimationFrame(e),[2];Se(t),a.label=3;case 3:return ce.current&&ye(ce.current),[3,5];case 4:return n=a.sent(),console.error("error capturing frame",n),[3,5];case 5:return ke.current=requestAnimationFrame(e),[2]}}))}))})),function(){cancelAnimationFrame(ke.current)}}),[ue,ye,me,ge,ie.shouldScanBarcode,de,fe,ce]),t.useEffect((function(){be((function(e){oe({type:"objectsDetected",payload:{prediction:e}}),null==_||_(e)}))}),[oe,_,be]),t.useEffect((function(){b(void 0,void 0,void 0,(function(){var e,t;return x(this,(function(n){switch(n.label){case 0:return ie.shouldScanBarcode&&Ie?[4,je(Ie,null===(t=ie.bestPdf417)||void 0===t?void 0:t.bbox)]:[3,2];case 1:(e=n.sent())?(oe({type:"barcodeScanned",payload:{result:e}}),null==U||U(e)):oe({type:"barcodeScanFailed"}),n.label=2;case 2:return[2]}}))}))}),[U,ie.shouldScanBarcode,null===(n=ie.bestPdf417)||void 0===n?void 0:n.bbox,de,Ie,oe]);var De=m&&ie.goodFramesThresholdMet&&!ie.capturing&&!ie.captured&&!ie.waitingForBarcodeScan&&dm(he.current)>=3e3;t.useEffect((function(){b(void 0,void 0,void 0,(function(){var e,t,n,a,r,i,o,s,l,u;return x(this,(function(d){switch(d.label){case 0:return De?(oe({type:"capturing"}),[4,we()]):[2];case 1:if(!(e=d.sent()))return console.log("uh oh, i did not get a photo"),oe({type:"captureFailed"}),[2];if(n=e.boundingBox,a=e.detectionScore,r=e.focusScore,o=(t=e.canvas).height,s=t,((i=t.width)>1920&&o>1080||i>1080&&o>1920)&&ie.barcodeResult){if(s=document.createElement("canvas"),i>o?(s.width=1920,s.height=o*(1920/i)):(s.height=1920,s.width=i*(1920/o)),!(l=s.getContext("2d")))return[2];l.drawImage(t,0,0,s.width,s.height)}return u=s.toDataURL("image/jpeg",.95),oe({type:"frameCaptured",payload:{imageUrl:u}}),setTimeout((function(){var e,t=(new Date).getTime()-(null!==(e=he.current)&&void 0!==e?e:new Date).getTime();null==z||z(u,i,o,{autoCapture:"Y",captureTime:t,boundingBox:n,bestDetectionScore:a,bestFocusScore:r}),oe({type:"captured"})}),0),[2]}}))}))}),[oe,we,z,De,ie.barcodeResult]),W.portraitGuidesImageUrl||(W.portraitGuidesImageUrl="".concat(Ra,"/Shieldout-IDCard-Front-SVG-Portrait-2.svg")),W.landscapeGuidesImageUrl||(W.landscapeGuidesImageUrl="".concat(Ra,"/Shieldout-IDCard-Front-SVG-Landscape-2.svg"));var Ne=r.useTheme();H.guideBoxUnsatisfiedColor||(H.guideBoxUnsatisfiedColor=null!==(o=null===(i=null===(a=Ne.idCapture)||void 0===a?void 0:a.guideBox)||void 0===i?void 0:i.unsatisfiedColor)&&void 0!==o?o:"white"),H.guideBoxSatisfiedColor||(H.guideBoxSatisfiedColor=null!==(d=null===(l=null===(s=Ne.idCapture)||void 0===s?void 0:s.guideBox)||void 0===l?void 0:l.satisfiedColor)&&void 0!==d?d:"green");var Ae=Xp(Z,{instructionText:"Scan the front of ID",processingIdCardText:"ID card front captured.",capturingText:"Capturing...",captureFailedText:"Capture failed!",guidanceSatisfiedText:"Document detected, hold still...",guidanceTooBlurryText:"Document out of focus – try improving the lighting",guidanceNotCenteredText:"Document is not centered",guidanceTooCloseText:"Document too close, please back up",guidanceNotDetectedText:"Document not detected"}),Re=Lh({enabled:X,pageWidth:te,pageHeight:ae,videoWidth:ie.videoWidth,videoHeight:ie.videoHeight}),Oe=ie.isGoodFrame;return"boolean"==typeof P&&(Oe=P),j||(j=Oe?Ae.guidanceSatisfiedText:ie.documentDetectionThresholdMet?ie.documentInBounds?ie.documentTooClose?Ae.guidanceTooCloseText:ie.focusThresholdMet?"":Ae.guidanceTooBlurryText:Ae.guidanceNotCenteredText:Ae.guidanceNotDetectedText),u.default.createElement(B,{ref:J,className:"flex ".concat(null!==(c=V.container)&&void 0!==c?c:"")},""!==j&&u.default.createElement(sm,{$top:"",$bottom:"12.5dvh",className:V.guidanceMessageContainer},u.default.createElement(lm,{$variant:Oe?"positive":"default",className:V.guidanceMessage},j)),X&&ie.detectedObjects.length>0&&u.default.createElement(Ph,{$flipX:!(null===(f=le.current)||void 0===f?void 0:f.isRearFacing),scaling:Re},ie.detectedObjects.map((function(e,t){var n;return u.default.createElement(Bh,{key:t,obj:e,scaling:Re,flipX:!(null===(n=le.current)||void 0===n?void 0:n.isRearFacing)})}))),X&&u.default.createElement(Sh,null,le.current?u.default.createElement(u.default.Fragment,null,"✅ Camera: ",le.current.label," (",le.current.width,"x",le.current.height,")"):"❌ Camera not ready",u.default.createElement("br",null),ie.frameCaptureRate>.75?"✅":"👎"," Frame Rate:"," ",Math.round(1e3*(ie.frameCaptureRate+Number.EPSILON))/1e3," ","fps (",xe,"ms doc detect, ",Ce,"ms focus)",u.default.createElement("br",null),me?u.default.createElement(u.default.Fragment,null,ie.documentDetectionThresholdMet?"✅":"❌"," Document Score: ",ie.documentDetectionScore," (",ie.documentType,")",u.default.createElement("br",null),ie.documentInBounds?"✅":"❌"," Document In Bounds",u.default.createElement("br",null),ie.focusThresholdMet?"✅":"❌"," Focus Score:"," ",ie.focusScore,u.default.createElement("br",null),ie.goodFramesThresholdMet?"✅":"❌"," Good Frame Count:"," ",ie.goodFramesCount,"/",ie.goodFramesThreshold,R&&ie.autoCaptureBarcodeRequired?u.default.createElement(u.default.Fragment,null,u.default.createElement("br",null),ie.barcodeResult?"✅":"❌"," Barcode Scanned (",Fe()?"Native":"ZXing",","," ",ie.barcodeScanFailedAttempts,"/",ie.maxBarcodeScanAttempts," failed attempts)"):null):u.default.createElement(u.default.Fragment,null,"❌ Models not ready")))},dm=function(e){return e?Math.abs((new Date).getTime()-e.getTime()):0},cm=function(e){var n,a=e.assets,r=void 0===a?{}:a,i=e.classNames,o=void 0===i?{}:i,s=e.colors,l=void 0===s?{}:s,d=e.verbiage,c=void 0===d?{}:d,f=t.useContext(Xe).retryCameraAccess;r.imageUrl||(r.imageUrl=Ra+"/camera-disable-icon.png");var h=Xp(c,{headingText:"Your camera permission is disabled",descriptionText:"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.",retryBtnText:"Retry"});return u.default.createElement(W,{className:"flex ".concat(null!==(n=o.container)&&void 0!==n?n:"")},u.default.createElement(fm,{className:o.inner},u.default.createElement(hm,{className:o.imageContainer},u.default.createElement("img",{src:r.imageUrl,alt:"",className:o.image})),u.default.createElement("h3",{className:o.heading},h.headingText),u.default.createElement(pm,{className:o.description},h.descriptionText),u.default.createElement(mm,{variant:"warning",onClick:f,colors:l.retryBtn,className:o.retryBtn,finished:!0},h.retryBtnText)))},fm=h.default($)(em||(em=w(["\n max-width: 500px;\n height: auto;\n margin: auto;\n"],["\n max-width: 500px;\n height: auto;\n margin: auto;\n"]))),hm=h.default(V)(tm||(tm=w(["\n flex-grow: 0;\n"],["\n flex-grow: 0;\n"]))),pm=h.default.p(nm||(nm=w(["\n line-height: 1.5;\n margin-bottom: 50px;\n"],["\n line-height: 1.5;\n margin-bottom: 50px;\n"]))),mm=h.default(ce)(am||(am=w(["\n width: 200px;\n margin: 0 auto;\n"],["\n width: 200px;\n margin: 0 auto;\n"]))),gm=h.default.button(rm||(rm=w(["\n position: absolute;\n top: 12px;\n right: 12px;\n font-size: 20px;\n width: 32px;\n height: 32px;\n font-family: monospace;\n z-index: 1002;\n border: none;\n border-radius: 4px;\n background: #ccc;\n cursor: pointer;\n padding: 8px;\n box-sizing: border-box;\n display: flex;\n\n &:hover {\n background: #ddd;\n }\n\n & > svg {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n }\n"],["\n position: absolute;\n top: 12px;\n right: 12px;\n font-size: 20px;\n width: 32px;\n height: 32px;\n font-family: monospace;\n z-index: 1002;\n border: none;\n border-radius: 4px;\n background: #ccc;\n cursor: pointer;\n padding: 8px;\n box-sizing: border-box;\n display: flex;\n\n &:hover {\n background: #ddd;\n }\n\n & > svg {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n }\n"]))),vm=function(e){return u.default.createElement(gm,{onClick:e.onClick,className:e.className},u.default.createElement("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"19.3 19.3 25.499999999999996 25.499999999999996",enableBackground:"new 0 0 64 64",width:16,height:16},u.default.createElement("g",{id:"close-outline-bot_x5F_s1g1_x5F_s2g2_x5F_s3g1_x5F_s4g1"},u.default.createElement("line",{fill:"none",stroke:"#000000",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"10",x1:"19.75",y1:"44.25",x2:"44.25",y2:"19.75"})),u.default.createElement("g",{id:"close-outline-top_x5F_s1g1_x5F_s2g2_x5F_s3g1_x5F_s4g1"},u.default.createElement("line",{fill:"none",stroke:"#000000",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"10",x1:"44.25",y1:"44.25",x2:"19.75",y2:"19.75"}))))},ym=h.default.div(im||(im=w(["\n display: flex;\n gap: 0 15px;\n justify-content: center;\n"],["\n display: flex;\n gap: 0 15px;\n justify-content: center;\n"])));function bm(e){var t=window.innerHeight>window.innerWidth;return u.default.createElement(t?Cm:xm,v({},e))}function xm(e){var n,a,i,o,s,l,d=e.width,c=void 0===d?698:d,f=e.height,h=void 0===f?452:f,p=e.className,m=t.useState(0),g=m[0],v=m[1];t.useEffect((function(){var e=setInterval((function(){v((function(e){return(e+1)%7}))}),1e3);return function(){clearInterval(e)}}),[]);var y=r.useTheme(),b=null!==(i=null===(a=null===(n=y.idCapture)||void 0===n?void 0:n.loadingOverlay)||void 0===a?void 0:a.loadingGraphicAccentColor)&&void 0!==i?i:"var(--idm-color-positive-600)",x=null!==(l=null===(s=null===(o=y.idCapture)||void 0===o?void 0:o.loadingOverlay)||void 0===s?void 0:s.loadingGraphicAccentOpacity)&&void 0!==l?l:.2;return u.default.createElement("div",{style:{display:"flex",width:"100%",height:"100%"}},u.default.createElement("svg",{className:p,width:c,height:h,viewBox:"0 0 698 452",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{margin:"auto",transform:"scale(".concat(g>1?1:1===g?1.25:.75,")"),transition:"transform 0.2s linear, border-width 0.2s linear",border:"".concat(g>=5?10:0,"px solid ").concat(b)}},u.default.createElement("g",{filter:1===g?"url(#filter0_f_91_884)":void 0},u.default.createElement("path",{d:"M10 0.5L688 0.5C693.247 0.5 697.5 4.75329 697.5 10L697.5 442C697.5 447.246 693.247 451.5 688 451.5L9.99999 451.5C4.75328 451.5 0.5 447.246 0.5 442L0.5 9.99998C0.5 4.75328 4.75329 0.5 10 0.5Z",fill:"#F3F3F3",stroke:"#DCDCDC"}),u.default.createElement("mask",{id:"mask0_91_854",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"30",y:"60",width:"207",height:"266"},u.default.createElement("rect",{x:"30.7754",y:"60.5945",width:"205.426",height:"265.304",rx:"3",fill:"#D9D9D9"})),u.default.createElement("g",{mask:"url(#mask0_91_854)"},u.default.createElement("path",{d:"M161.429 226.164C161.472 226.322 161.474 226.488 161.438 226.647C157.252 244.639 146.071 257.508 132.955 257.508C119.837 257.508 108.632 244.59 104.447 226.595C104.411 226.439 104.413 226.276 104.453 226.121L107.568 214.051L108.337 211.118C108.453 210.678 108.85 210.371 109.305 210.371L156.578 210.371C157.034 210.371 157.432 210.68 157.546 211.122L160.976 224.435L161.305 225.701L161.429 226.164Z",fill:"#D2D4DA"}),u.default.createElement("path",{d:"M185.475 157.408C185.556 157.356 185.628 157.291 185.693 157.219C210.004 130.149 193.715 196.897 180.188 189.065C157.256 175.818 183.525 158.645 185.475 157.408Z",fill:"#F7A69C"}),u.default.createElement("path",{d:"M267.491 324.918C267.577 325.255 267.487 325.608 267.24 325.853C254.85 338.143 225.105 345.481 222.791 346.037C222.686 346.063 222.601 346.067 222.493 346.058C219.509 345.795 174.209 342.097 147.081 357.481C142.849 359.881 122.568 356.455 121.909 356.343C121.888 356.339 121.882 356.339 121.861 356.337L89.946 352.929C89.8715 352.921 89.8068 352.921 89.7323 352.929C87.9869 353.117 64.0883 355.438 45.1808 343.79C29.8522 334.346 9.55527 336.584 -1.36759 325.857C-1.61519 325.614 -1.71005 325.255 -1.62441 324.919L1.46107 312.802C6.33129 293.793 21.3654 279.026 40.5404 274.455L42.6579 273.963L66.162 268.361L72.5851 266.837C75.2907 266.181 77.8788 265.267 80.3256 264.095C82.3725 263.11 84.3253 261.962 86.1605 260.649C88.1368 259.243 89.9955 257.649 91.6659 255.891C96.1597 251.18 99.4771 245.367 101.171 238.827L103.665 229.17L104.324 226.568L104.371 226.357L107.571 214.051L108.319 211.123C108.433 210.681 108.831 210.371 109.288 210.371L156.558 210.371C157.013 210.371 157.411 210.679 157.526 211.12L160.978 224.435L161.308 225.701L161.475 226.325C161.489 226.377 161.496 226.431 161.496 226.486V226.486C161.496 226.54 161.503 226.595 161.517 226.647L162.202 229.193L164.696 238.827C167.025 247.781 172.413 255.446 179.73 260.649C183.729 263.532 188.317 265.665 193.282 266.837L199.211 268.244L225.326 274.455C244.501 279.026 259.535 293.793 264.406 312.802L267.491 324.918Z",fill:"#F7A69C"}),u.default.createElement("path",{d:"M161.429 226.164C161.472 226.322 161.474 226.488 161.438 226.647C157.252 244.639 146.071 257.508 132.955 257.508C119.837 257.508 108.632 244.59 104.447 226.595C104.411 226.439 104.413 226.276 104.453 226.121L107.568 214.051L108.337 211.118C108.453 210.678 108.85 210.371 109.305 210.371L156.578 210.371C157.034 210.371 157.432 210.68 157.546 211.122L160.976 224.435L161.305 225.701L161.429 226.164Z",fill:"#DC968D"}),u.default.createElement("path",{d:"M80.3983 157.408C80.3166 157.356 80.2445 157.291 80.1799 157.219C55.8686 130.149 72.1582 196.897 85.685 189.065C108.616 175.818 82.3476 158.645 80.3983 157.408Z",fill:"#F7A69C"}),u.default.createElement("path",{d:"M189.527 137.873C189.52 137.873 189.515 137.879 189.515 137.885C189.515 139.944 189.397 141.956 189.162 143.968C188.974 145.796 188.15 153.601 186.692 163.54C185.895 169.048 184.865 175.184 183.649 181.346C183.638 181.398 183.635 181.447 183.631 181.5V181.5C183.625 181.607 183.575 181.713 183.554 181.818C180.568 196.836 176.367 211.751 170.881 217.193C164.67 223.381 159.682 229.007 153.988 233.062C148.295 237.14 141.919 239.672 132.978 239.672C124.038 239.672 117.662 237.14 111.968 233.062C106.298 229.007 101.286 223.381 95.0752 217.193C89.5754 211.714 85.367 196.715 82.3561 181.682C82.3499 181.651 82.3467 181.628 82.3467 181.596V181.596C82.3467 181.566 82.3438 181.526 82.338 181.496C81.9648 179.566 81.6147 177.636 81.2645 175.728C81.1233 174.932 80.9821 174.135 80.841 173.338C80.2528 169.962 79.7352 166.657 79.2646 163.563C77.5768 152.19 76.7532 143.609 76.7472 143.546C76.747 143.544 76.7471 143.545 76.7469 143.543C76.5589 141.692 76.4648 139.794 76.4648 137.873C76.4648 137.381 76.4648 136.889 76.4648 136.397C76.5825 131.967 77.1942 127.654 78.3 123.528C78.3471 123.341 78.3941 123.153 78.4412 122.966C84.723 100.089 105.121 83.0011 129.731 81.6416C130.814 81.5713 131.872 81.5479 132.978 81.5479C148.601 81.5479 162.741 87.8531 172.975 98.0494C181.822 106.839 187.75 118.559 189.186 131.615C189.42 133.674 189.538 135.756 189.539 137.862C189.539 137.868 189.533 137.873 189.527 137.873V137.873Z",fill:"#FEAEA5"}),u.default.createElement("path",{d:"M141.871 188.529C141.871 192.42 137.895 195.561 132.977 195.561C128.06 195.561 124.107 192.42 124.107 188.529V188.529C124.107 188.132 124.593 188.105 124.773 188.459C126.079 191.03 129.266 192.842 132.977 192.842C136.689 192.842 139.893 191.03 141.204 188.458C141.381 188.112 141.871 188.14 141.871 188.529V188.529Z",fill:"#F7A69C"}),u.default.createElement("path",{d:"M267.512 325.037C267.599 325.374 267.509 325.727 267.264 325.974C232.886 360.672 133.16 359.767 132.956 359.765C132.95 359.765 132.962 359.765 132.956 359.765C132.752 359.767 33.0007 360.672 -1.3537 325.95C-1.59784 325.703 -1.68748 325.351 -1.60167 325.014L1.48353 312.922C6.35375 293.889 21.3879 279.122 40.5629 274.551L66.2315 268.456L72.6075 266.933C75.2325 266.311 77.7789 265.415 80.1745 264.28C80.5729 264.092 81.0485 264.176 81.3541 264.494C94.359 278.009 112.66 286.435 132.956 286.435C153.253 286.435 171.556 278.008 184.562 264.49C184.865 264.174 185.337 264.088 185.734 264.274C188.127 265.395 190.657 266.311 193.304 266.933L198.88 268.269L225.349 274.551C244.524 279.122 259.558 293.889 264.405 312.922L267.512 325.037Z",fill:"#6E7174"}),u.default.createElement("path",{d:"M197.318 267.895C198.038 268.068 198.334 268.924 197.847 269.481C190.872 277.457 169.982 297.251 132.954 298.717C92.046 300.357 71.408 275.554 67.0543 269.627C66.6418 269.065 66.9505 268.284 67.6281 268.122L72.606 266.933C75.231 266.311 77.7773 265.415 80.173 264.28C80.5713 264.092 81.0469 264.176 81.3526 264.494C94.3575 278.009 112.659 286.435 132.954 286.435C153.252 286.435 171.555 278.008 184.56 264.49C184.864 264.174 185.336 264.088 185.732 264.274C188.126 265.395 190.655 266.311 193.303 266.933L197.318 267.895Z",fill:"#555A5E"}),u.default.createElement("path",{d:"M75.4663 140.851C75.4663 152.603 78.3795 166.091 80.4253 174.114C80.713 175.242 82.458 175.01 82.5156 173.848C83.0875 162.287 85.7494 140.134 97.4904 130.033C108.545 120.523 117.526 131.201 132.13 131.201C145.353 131.201 157.695 120.704 168.836 130.033C181.053 140.264 183.463 159.992 183.739 171.736C183.767 172.936 185.717 173.218 186.003 172.053C187.986 163.959 190.429 151.77 190.429 140.851C190.429 100.426 174.665 81.3704 132.13 81.3704C93.3928 81.3704 75.4663 100.225 75.4663 140.851Z",fill:"#525252"})),u.default.createElement("rect",{x:"30.7754",y:"360.29",width:"640.93",height:"40.942",rx:"3",fill:"#C1C1C1"}),u.default.createElement("rect",{x:"267.427",y:"134.29",width:"402.636",height:"40.942",rx:"3",fill:"#C1C1C1"}),u.default.createElement("rect",{x:"267.427",y:"209.623",width:"180.775",height:"40.942",rx:"3",fill:"#C1C1C1"}),u.default.createElement("rect",{x:"481.069",y:"209.623",width:"188.992",height:"40.942",rx:"3",fill:"#C1C1C1"}),u.default.createElement("rect",{x:"267.427",y:"284.956",width:"180.775",height:"40.942",rx:"3",fill:"#C1C1C1"}),u.default.createElement("rect",{x:"481.069",y:"284.956",width:"188.992",height:"40.942",rx:"3",fill:"#C1C1C1"}),u.default.createElement("rect",{x:"266.829",y:"58.3618",width:"402.636",height:"40.942",rx:"3",fill:"#C1C1C1"}),u.default.createElement("g",{fillOpacity:3===g?x:0,style:{transition:"fill-opacity 0.2s linear"}},u.default.createElement("rect",{x:"672",y:"55",width:"47",height:"410",transform:"rotate(90 672 55)",fill:b}),u.default.createElement("rect",{x:"670",y:"206",width:"47",height:"194",transform:"rotate(90 670 206)",fill:b}),u.default.createElement("rect",{x:"242",y:"61",width:"271",height:"218",transform:"rotate(90 242 61)",fill:b}),u.default.createElement("rect",{x:"677",y:"357",width:"47",height:"653",transform:"rotate(90 677 357)",fill:b})),u.default.createElement("g",{fillOpacity:4===g?x:0,style:{transition:"fill-opacity 0.2s linear"}},u.default.createElement("rect",{x:"455",y:"281",width:"47",height:"194",transform:"rotate(90 455 281)",fill:b}),u.default.createElement("rect",{x:"672",y:"131",width:"47",height:"411",transform:"rotate(90 672 131)",fill:b})),u.default.createElement("g",{fillOpacity:g>=5?1:0,style:{transition:"fill-opacity 0.2s linear"}},u.default.createElement("circle",{cx:"360",cy:"215",r:"41",fill:b}),u.default.createElement("path",{d:"M339.937 218.076L350.044 229.83L381.809 201.915",stroke:"white",strokeWidth:"10",strokeOpacity:g>=5?1:0,strokeLinecap:"round",strokeLinejoin:"round",style:{transition:"stroke-opacity 0.2s linear"}}))),u.default.createElement("filter",{id:"filter0_f_91_884",x:"0",y:"0",width:"848",height:"556",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB"},u.default.createElement("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),u.default.createElement("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),u.default.createElement("feGaussianBlur",{stdDeviation:"5",result:"effect1_foregroundBlur_91_884"}))))}function Cm(e){var n,a,i,o,s,l,d=e.width,c=void 0===d?428:d,f=e.height,h=void 0===f?747:f,p=e.className,m=t.useState(0),g=m[0],v=m[1];t.useEffect((function(){var e=setInterval((function(){v((function(e){return(e+1)%7}))}),1e3);return function(){clearInterval(e)}}),[]);var y=r.useTheme(),b=null!==(i=null===(a=null===(n=y.idCapture)||void 0===n?void 0:n.loadingOverlay)||void 0===a?void 0:a.loadingGraphicAccentColor)&&void 0!==i?i:"var(--idm-color-positive-600)",x=null!==(l=null===(s=null===(o=y.idCapture)||void 0===o?void 0:o.loadingOverlay)||void 0===s?void 0:s.loadingGraphicAccentOpacity)&&void 0!==l?l:.2;return u.default.createElement("svg",{className:p,width:c,height:h,viewBox:"0 0 428 747",fill:"none",xmlns:"http://www.w3.org/2000/svg"},u.default.createElement("g",{id:"card",style:{transform:"translate(".concat(g<1?"-500px":"0",", 0)"),transition:"transform 0.3s linear"}},u.default.createElement("path",{d:"M76.5001 181.274C76.5001 176.027 80.7534 171.774 86.0001 171.774L342 171.774C347.247 171.774 351.5 176.027 351.5 181.274L351.5 586C351.5 591.247 347.247 595.5 342 595.5L86.0001 595.5C80.7534 595.5 76.5001 591.247 76.5001 586L76.5001 181.274Z",fill:"#F3F3F3",stroke:"#DCDCDC"}),u.default.createElement("mask",{id:"mask0_29_1815",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"113",y:"452",width:"163",height:"126"},u.default.createElement("rect",{x:"113",y:"577.273",width:"125",height:"162",rx:"3",transform:"rotate(-90 113 577.273)",fill:"#D9D9D9"})),u.default.createElement("g",{mask:"url(#mask0_29_1815)"},u.default.createElement("path",{d:"M214.008 497.796C214.165 497.754 214.33 497.751 214.489 497.788C225.426 500.352 233.24 507.14 233.24 515.098C233.24 523.058 225.395 529.861 214.455 532.423C214.3 532.46 214.138 532.458 213.983 532.418L206.704 530.546L205.204 530.154C204.764 530.039 204.457 529.641 204.457 529.186L204.457 501.028C204.457 500.571 204.766 500.173 205.208 500.059L213.044 498.048L213.817 497.847L214.008 497.796Z",fill:"#D2D4DA"}),u.default.createElement("path",{d:"M172.144 483.183C172.092 483.102 172.027 483.031 171.955 482.966C155.547 468.233 196.225 478.134 191.447 486.357C183.444 500.161 173.096 484.665 172.144 483.183Z",fill:"#F7A69C"}),u.default.createElement("path",{d:"M274.192 433.287C274.528 433.202 274.882 433.292 275.124 433.541C282.444 441.074 286.849 458.59 287.283 460.373C287.308 460.479 287.314 460.558 287.305 460.667C287.111 462.898 284.971 490.135 294.285 506.502C295.735 509.05 293.703 521.155 293.593 521.803C293.589 521.823 293.587 521.84 293.585 521.861L291.51 541.224C291.502 541.299 291.502 541.364 291.509 541.439C291.65 542.782 292.959 557.13 285.925 568.508C280.203 577.763 281.504 589.995 275.126 596.677C274.887 596.927 274.528 597.02 274.193 596.935L267.003 595.111C255.396 592.147 246.379 582.999 243.588 571.332L243.287 570.043L239.866 555.741L238.936 551.833C238.535 550.186 237.977 548.611 237.262 547.123C236.66 545.877 235.959 544.689 235.158 543.572C234.299 542.37 233.326 541.239 232.252 540.222C229.375 537.488 225.826 535.469 221.832 534.438L215.936 532.921L214.347 532.52L214.218 532.491L206.704 530.544L205.21 530.164C204.767 530.051 204.457 529.652 204.457 529.194L204.457 501.04C204.457 500.584 204.765 500.186 205.207 500.071L213.044 498.046L213.817 497.846L214.198 497.744C214.23 497.736 214.263 497.731 214.297 497.731C214.33 497.731 214.363 497.727 214.395 497.718L215.95 497.302L221.832 495.784C227.3 494.367 231.98 491.088 235.158 486.636C236.918 484.202 238.22 481.411 238.936 478.39L239.795 474.782L243.588 458.891C246.379 447.223 255.396 438.075 267.003 435.112L274.192 433.287Z",fill:"#F7A69C"}),u.default.createElement("path",{d:"M214.008 497.796C214.165 497.754 214.33 497.751 214.489 497.788C225.426 500.352 233.24 507.14 233.24 515.098C233.24 523.058 225.395 529.861 214.455 532.423C214.3 532.46 214.138 532.458 213.983 532.418L206.704 530.546L205.204 530.154C204.764 530.039 204.457 529.641 204.457 529.186L204.457 501.028C204.457 500.571 204.766 500.173 205.208 500.059L213.044 498.048L213.817 497.847L214.008 497.796Z",fill:"#DC968D"}),u.default.createElement("path",{d:"M172.144 547.035C172.092 547.117 172.027 547.188 171.955 547.252C155.547 561.986 196.225 552.085 191.447 543.861C183.444 530.057 173.096 545.553 172.144 547.035Z",fill:"#F7A69C"}),u.default.createElement("path",{d:"M160.188 480.675C160.188 480.679 160.191 480.682 160.195 480.682C161.452 480.682 162.681 480.754 163.91 480.897C165.026 481.011 169.792 481.512 175.861 482.4C179.224 482.885 182.971 483.511 186.733 484.252C186.765 484.258 186.795 484.26 186.827 484.262C186.893 484.266 186.958 484.296 187.022 484.309C196.192 486.126 205.299 488.682 208.623 492.02C212.401 495.8 215.836 498.835 218.312 502.3C220.803 505.764 222.348 509.644 222.348 515.084C222.348 520.524 220.803 524.404 218.312 527.869C215.836 531.319 212.401 534.368 208.623 538.148C205.277 541.494 196.118 544.055 186.939 545.887C186.92 545.891 186.906 545.893 186.886 545.893C186.867 545.893 186.844 545.895 186.825 545.898C185.646 546.125 184.468 546.338 183.303 546.551C182.817 546.637 182.33 546.723 181.843 546.809C179.782 547.167 177.764 547.482 175.875 547.768C168.946 548.793 163.714 549.294 163.652 549.3C163.651 549.3 163.651 549.3 163.649 549.3C162.519 549.415 161.361 549.472 160.188 549.472C159.888 549.472 159.587 549.472 159.287 549.472C156.581 549.4 153.948 549.028 151.429 548.355C151.314 548.327 151.2 548.298 151.085 548.269C137.116 544.447 126.682 532.035 125.852 517.06C125.809 516.401 125.795 515.757 125.795 515.084C125.795 505.578 129.645 496.974 135.871 490.746C141.238 485.363 148.395 481.756 156.367 480.882C157.624 480.739 158.895 480.668 160.181 480.668C160.185 480.668 160.188 480.671 160.188 480.675Z",fill:"#FEAEA5"}),u.default.createElement("path",{d:"M191.119 509.673C193.495 509.673 195.413 512.092 195.413 515.084C195.413 518.077 193.495 520.482 191.119 520.482C190.877 520.482 190.861 520.186 191.077 520.077C192.647 519.282 193.753 517.343 193.753 515.084C193.753 512.826 192.647 510.876 191.077 510.079C190.866 509.971 190.883 509.673 191.119 509.673Z",fill:"#F7A69C"}),u.default.createElement("path",{d:"M274.264 433.275C274.6 433.189 274.954 433.278 275.199 433.524C296.217 454.568 295.682 514.893 295.68 515.097C295.68 515.103 295.68 515.092 295.68 515.098C295.682 515.302 296.217 575.643 275.184 596.673C274.939 596.917 274.586 597.007 274.251 596.921L267.076 595.097C255.454 592.134 246.437 582.986 243.646 571.318L239.925 555.699L238.994 551.819C238.638 550.318 238.133 548.86 237.499 547.48C237.314 547.078 237.398 546.602 237.715 546.294C245.845 538.394 250.903 527.342 250.903 515.098C250.903 502.851 245.844 491.798 237.711 483.897C237.396 483.591 237.311 483.119 237.493 482.719C238.122 481.341 238.638 479.89 238.994 478.376L239.81 474.983L243.646 458.877C246.437 447.21 255.454 438.061 267.076 435.112L274.264 433.275Z",fill:"#6E7174"}),u.default.createElement("path",{d:"M239.436 476.54C239.609 475.821 240.466 475.529 241.015 476.024C246.147 480.64 257.535 493.254 258.403 515.098C259.367 539.068 245.359 551.601 241.088 554.862C240.535 555.285 239.753 554.982 239.59 554.305L238.994 551.82C238.638 550.319 238.133 548.86 237.499 547.48C237.314 547.079 237.398 546.603 237.715 546.295C245.845 538.394 250.903 527.343 250.903 515.098C250.903 502.852 245.844 491.799 237.711 483.898C237.396 483.592 237.311 483.119 237.493 482.72C238.122 481.342 238.638 479.891 238.994 478.377L239.436 476.54Z",fill:"#555A5E"}),u.default.createElement("path",{d:"M162.007 550.079C167.945 550.079 174.609 548.865 179.507 547.741C180.642 547.481 180.435 545.695 179.275 545.595C171.872 544.959 160.808 542.941 155.401 536.678C149.594 529.951 156.114 524.486 156.114 515.6C156.114 507.554 149.704 500.044 155.401 493.265C160.661 487.005 170.034 484.976 177.145 484.392C178.342 484.293 178.605 482.241 177.431 481.993C172.848 481.025 167.193 480.126 162.007 480.126C137.322 480.126 125.686 489.718 125.686 515.6C125.686 539.171 137.2 550.079 162.007 550.079Z",fill:"#525252"})),u.default.createElement("rect",{x:"296",y:"577.273",width:"390",height:"25",rx:"3",transform:"rotate(-90 296 577.273)",fill:"#C1C1C1"}),u.default.createElement("rect",{x:"158",y:"433.273",width:"245",height:"25",rx:"3",transform:"rotate(-90 158 433.273)",fill:"#C1C1C1"}),u.default.createElement("rect",{x:"204",y:"433.273",width:"110",height:"25",rx:"3",transform:"rotate(-90 204 433.273)",fill:"#C1C1C1"}),u.default.createElement("rect",{x:"204",y:"303.274",width:"115",height:"25",rx:"3",transform:"rotate(-90 204 303.274)",fill:"#C1C1C1"}),u.default.createElement("rect",{x:"250",y:"433.273",width:"110",height:"25",rx:"3",transform:"rotate(-90 250 433.273)",fill:"#C1C1C1"}),u.default.createElement("rect",{x:"250",y:"303.274",width:"115",height:"25",rx:"3",transform:"rotate(-90 250 303.274)",fill:"#C1C1C1"}),u.default.createElement("rect",{x:"111.637",y:"433.637",width:"245",height:"25",rx:"3",transform:"rotate(-90 111.637 433.637)",fill:"#C1C1C1"}),u.default.createElement("g",{fillOpacity:2===g?x:0,style:{transition:"fill-opacity 0.2s linear"}},u.default.createElement("rect",{x:"200",y:"188",width:"33",height:"118",fill:b}),u.default.createElement("rect",{x:"108",y:"444",width:"171",height:"136",fill:b}),u.default.createElement("rect",{x:"108",y:"187",width:"33",height:"247",fill:b}),u.default.createElement("rect",{x:"293",y:"186",width:"31",height:"394",fill:b})),u.default.createElement("g",{fillOpacity:3===g?x:0,style:{transition:"fill-opacity 0.2s linear"}},u.default.createElement("rect",{x:"154",y:"185",width:"33",height:"249",fill:b}),u.default.createElement("rect",{x:"247",y:"322",width:"31",height:"113",rx:"5",fill:b})),u.default.createElement("g",{fillOpacity:g>=4?1:0,strokeOpacity:g>=4?1:0,style:{transition:"fill-opacity 0.2s linear, stroke-opacity 0.2s linear"}},u.default.createElement("rect",{x:"78.5",y:"171.5",width:"271",height:"426",rx:"2.5",stroke:b,strokeWidth:"5"}),u.default.createElement("circle",{cx:"214.5",cy:"383.5",r:"23.5",fill:b}),u.default.createElement("path",{d:"M203 385.263L208.793 392L227 376",stroke:"white",strokeWidth:"5",strokeLinecap:"round",strokeLinejoin:"round"}))),u.default.createElement("g",{id:"phone",clipPath:"url(#clip0_29_1778)",style:{transform:"translate(".concat(g<1?"40px":"0",", 0)"),transition:"transform 0.3s linear"}},u.default.createElement("rect",{x:"154",y:"693",width:"120",height:"5",rx:"2.5",fill:"#333343"}),u.default.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M372.869 156.244H373.495V156.241C376.342 156.241 378.647 158.551 378.647 161.396V234.788C378.647 237.637 376.339 239.944 373.495 239.944H372.869V677.09C372.869 698.895 355.203 716.571 333.411 716.571H94.2366C72.444 716.571 54.7781 698.895 54.7781 677.09V278.699H54.1523C51.3051 278.699 49 276.39 49 273.544V228.052C49 225.203 51.3082 222.897 54.1523 222.897H54.7781V212.047H54.1523C51.3051 212.047 49 209.737 49 206.892V161.399C49 158.551 51.3082 156.244 54.1523 156.244H54.7781V90.4813C54.7781 68.6761 72.444 51 94.2366 51H333.411C355.203 51 372.869 68.6761 372.869 90.4813V156.244ZM98.3077 60.7649H329.34C347.039 60.7649 361.387 75.1214 361.387 92.8311V674.734C361.387 692.444 347.039 706.8 329.34 706.8H98.3077C80.6082 706.8 66.26 692.444 66.26 674.734V92.8311C66.26 75.1214 80.6082 60.7649 98.3077 60.7649Z",fill:"#333343"}),u.default.createElement("rect",{x:"154",y:"71",width:"120",height:"20",rx:"10",fill:"#333343"})),u.default.createElement("defs",null,u.default.createElement("clipPath",{id:"clip0_29_1778"},u.default.createElement("rect",{width:"428",height:"747",fill:"white"}))))}var wm,Em,km,Tm,Mm,Im,Sm,Dm,Nm,Am,Lm,Rm,Om,Fm,jm,Pm,Bm,_m,Um,zm,Gm,Wm,$m,Vm,qm,Hm,Ym,Zm,Qm,Xm="".concat(Ra,"/WebSDK-Instruction-DL-Capture-3-Portrait.png"),Km=h.default.div(wm||(wm=w(["\n height: 100dvh;\n display: flex;\n flex-direction: column;\n background: ",";\n color: ",";\n"],["\n height: 100dvh;\n display: flex;\n flex-direction: column;\n background: ",";\n color: ",";\n"])),(function(e){var t,n,a,r;return null!==(r=null===(a=null===(n=null===(t=e.theme)||void 0===t?void 0:t.idCapture)||void 0===n?void 0:n.loadingOverlay)||void 0===a?void 0:a.backgroundColor)&&void 0!==r?r:"#ecedf3"}),(function(e){var t,n,a,r;return null!==(r=null===(a=null===(n=null===(t=e.theme)||void 0===t?void 0:t.idCapture)||void 0===n?void 0:n.loadingOverlay)||void 0===a?void 0:a.textColor)&&void 0!==r?r:"black"})),Jm=h.default.div(Em||(Em=w(["\n text-align: ",";\n display: flex;\n flex-direction: column;\n flex-wrap: nowrap;\n ","\n padding-bottom: 0;\n"],["\n text-align: ",";\n display: flex;\n flex-direction: column;\n flex-wrap: nowrap;\n ","\n padding-bottom: 0;\n"])),(function(e){var t;return null!==(t=e.theme.textAlign)&&void 0!==t?t:"center"}),(function(e){return e.theme.padding?"box-sizing: border-box; padding: ".concat(e.theme.padding,";"):""})),eg=h.default(lm)(km||(km=w(["\n padding: 16px 24px;\n margin-top: 16px;\n font-size: 18px;\n font-weight: bold;\n background: white;\n box-shadow:\n 0 1px 3px 0 rgb(0 0 0 / 0.1),\n 0 1px 2px -1px rgb(0 0 0 / 0.1);\n"],["\n padding: 16px 24px;\n margin-top: 16px;\n font-size: 18px;\n font-weight: bold;\n background: white;\n box-shadow:\n 0 1px 3px 0 rgb(0 0 0 / 0.1),\n 0 1px 2px -1px rgb(0 0 0 / 0.1);\n"]))),tg=h.default(V)(Tm||(Tm=w(["\n padding: 0 0 100px;\n\n & > svg {\n height: 100%;\n }\n"],["\n padding: 0 0 100px;\n\n & > svg {\n height: 100%;\n }\n"]))),ng=h.default.div(Mm||(Mm=w(["\n position: fixed;\n bottom: 120px;\n width: 100dvw;\n display: flex;\n"],["\n position: fixed;\n bottom: 120px;\n width: 100dvw;\n display: flex;\n"]))),ag=h.default(lm)(Im||(Im=w(["\n padding: 12px 18px;\n margin: 0 auto;\n font-size: 14px;\n font-weight: bold;\n background: white;\n box-shadow:\n 0 1px 3px 0 rgb(0 0 0 / 0.1),\n 0 1px 2px -1px rgb(0 0 0 / 0.1);\n"],["\n padding: 12px 18px;\n margin: 0 auto;\n font-size: 14px;\n font-weight: bold;\n background: white;\n box-shadow:\n 0 1px 3px 0 rgb(0 0 0 / 0.1),\n 0 1px 2px -1px rgb(0 0 0 / 0.1);\n"]))),rg=h.default.input(Sm||(Sm=w(["\n margin-right: 8px;\n"],["\n margin-right: 8px;\n"]))),ig=h.default(ym)(Dm||(Dm=w(["\n display: flex;\n flex-direction: row;\n padding: 15px 25px;\n height: 100px;\n color: ",";\n ","\n position: fixed;\n bottom: 0;\n left: 0;\n width: 100dvw;\n box-sizing: border-box;\n"],["\n display: flex;\n flex-direction: row;\n padding: 15px 25px;\n height: 100px;\n color: ",";\n ","\n position: fixed;\n bottom: 0;\n left: 0;\n width: 100dvw;\n box-sizing: border-box;\n"])),(function(e){var t,n,a,r;return null!==(r=null===(a=null===(n=null===(t=e.theme)||void 0===t?void 0:t.selfieCapture)||void 0===n?void 0:n.loadingOverlay)||void 0===a?void 0:a.progressBarTextColor)&&void 0!==r?r:"white"}),(function(e){var t,n,a,r,i,o;return(null===(a=null===(n=null===(t=e.theme)||void 0===t?void 0:t.idCapture)||void 0===n?void 0:n.loadingOverlay)||void 0===a?void 0:a.progressBarFontSize)?"font-size: ".concat(null===(o=null===(i=null===(r=e.theme)||void 0===r?void 0:r.idCapture)||void 0===i?void 0:i.loadingOverlay)||void 0===o?void 0:o.progressBarFontSize,";"):""})),og=h.default.div(Nm||(Nm=w(["\n display: flex;\n position: relative;\n z-index: 2;\n"],["\n display: flex;\n position: relative;\n z-index: 2;\n"]))),sg=h.default.ul(Am||(Am=w(["\n display: block;\n margin: auto;\n list-style: none;\n padding: 0;\n"],["\n display: block;\n margin: auto;\n list-style: none;\n padding: 0;\n"]))),lg=h.default.li(Lm||(Lm=w(["\n display: inline-flex;\n justify-content: center;\n align-items: center;\n padding: 2px 1.25rem 2px 0;\n line-height: 1rem;\n\n &::before {\n content: '';\n display: inline-block;\n height: 1rem;\n min-width: 1rem;\n vertical-align: middle;\n background-size: cover;\n background-repeat: no-repeat;\n margin: auto 0.5rem auto 0;\n }\n\n &.done::before {\n background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBjbGlwLXBhdGg9InVybCgjY2xpcDBfNDlfMzg1KSI+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xMiAyNEMxOC42Mjc0IDI0IDI0IDE4LjYyNzQgMjQgMTJDMjQgNS4zNzI1OCAxOC42Mjc0IDAgMTIgMEM1LjM3MjU4IDAgMCA1LjM3MjU4IDAgMTJDMCAxOC42Mjc0IDUuMzcyNTggMjQgMTIgMjRaTTE5LjU2NDMgOC4yNzg1MkMxOS45NTQ5IDcuODg3OTkgMTkuOTU0OSA3LjI1NDgzIDE5LjU2NDMgNi44NjQzQzE5LjE3MzggNi40NzM3OCAxOC41NDA2IDYuNDczNzggMTguMTUwMSA2Ljg2NDNMOS40Mjg2NiAxNS41ODU4TDUuODUwMDUgMTIuMDA3MkM1LjQ1OTUzIDExLjYxNjYgNC44MjYzNiAxMS42MTY2IDQuNDM1ODQgMTIuMDA3MkM0LjA0NTMxIDEyLjM5NzcgNC4wNDUzMSAxMy4wMzA5IDQuNDM1ODQgMTMuNDIxNEw4LjcyMTU1IDE3LjcwNzFDOS4xMTIwOCAxOC4wOTc2IDkuNzQ1MjQgMTguMDk3NiAxMC4xMzU4IDE3LjcwNzFMMTkuNTY0MyA4LjI3ODUyWiIgZmlsbD0id2hpdGUiLz48L2c+PGRlZnM+PGNsaXBQYXRoIGlkPSJjbGlwMF80OV8zODUiPjxyZWN0IHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgZmlsbD0id2hpdGUiLz48L2NsaXBQYXRoPjwvZGVmcz48L3N2Zz4=');\n }\n\n &.running::before {\n background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBjbGlwLXBhdGg9InVybCgjY2xpcDBfNDlfMzcwKSI+PG1hc2sgaWQ9InBhdGgtMS1pbnNpZGUtMV80OV8zNzAiIGZpbGw9IndoaXRlIj48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTMuNTE0NzIgMjAuNDg1NUM4LjIwMTAxIDI1LjE3MTggMTUuNzk5IDI1LjE3MTggMjAuNDg1MyAyMC40ODU1QzI1LjE3MTYgMTUuNzk5MiAyNS4xNzE2IDguMjAxMTkgMjAuNDg1MyAzLjUxNDlDMTUuNzk5IC0xLjE3MTM5IDguMjAxMDEgLTEuMTcxMzkgMy41MTQ3MiAzLjUxNDlDLTEuMTcxNTcgOC4yMDExOSAtMS4xNzE1NyAxNS43OTkyIDMuNTE0NzIgMjAuNDg1NVoiLz48L21hc2s+PHBhdGggZD0iTTYuMzk4MTQgMTEuNDU5QzUuODQ1ODYgMTEuNDU5IDUuMzk4MTQgMTEuOTA2NyA1LjM5ODE0IDEyLjQ1OUM1LjM5ODE0IDEzLjAxMTIgNS44NDU4NiAxMy40NTkgNi4zOTgxNCAxMy40NTlWMTEuNDU5Wk0xNy42MDE5IDEzLjQ1OUMxOC4xNTQxIDEzLjQ1OSAxOC42MDE5IDEzLjAxMTIgMTguNjAxOSAxMi40NTlDMTguNjAxOSAxMS45MDY3IDE4LjE1NDEgMTEuNDU5IDE3LjYwMTkgMTEuNDU5VjEzLjQ1OVpNNi4zOTgxNCAxMy40NTlIMTcuNjAxOVYxMS40NTlINi4zOTgxNFYxMy40NTlaTTMuNTE0NzIgMjAuNDg1NUw0LjkyODkzIDE5LjA3MTNMNC45Mjg5MyAxOS4wNzEzTDMuNTE0NzIgMjAuNDg1NVpNMjAuNDg1MyAzLjUxNDlMMTkuMDcxMSA0LjkyOTEyTDE5LjA3MTEgNC45MjkxMkwyMC40ODUzIDMuNTE0OVpNMy41MTQ3MiAzLjUxNDlMNC45Mjg5MyA0LjkyOTEyTDQuOTI4OTMgNC45MjkxMkwzLjUxNDcyIDMuNTE0OVpNMTkuMDcxMSAxOS4wNzEzQzE1LjE2NTggMjIuOTc2NSA4LjgzNDE3IDIyLjk3NjUgNC45Mjg5MyAxOS4wNzEzTDIuMTAwNTEgMjEuODk5N0M3LjU2Nzg0IDI3LjM2NyAxNi40MzIyIDI3LjM2NyAyMS44OTk1IDIxLjg5OTdMMTkuMDcxMSAxOS4wNzEzWk0xOS4wNzExIDQuOTI5MTJDMjIuOTc2MyA4LjgzNDM2IDIyLjk3NjMgMTUuMTY2IDE5LjA3MTEgMTkuMDcxM0wyMS44OTk1IDIxLjg5OTdDMjcuMzY2OCAxNi40MzIzIDI3LjM2NjggNy41NjgwMyAyMS44OTk1IDIuMTAwNjlMMTkuMDcxMSA0LjkyOTEyWk00LjkyODkzIDQuOTI5MTJDOC44MzQxNyAxLjAyMzg3IDE1LjE2NTggMS4wMjM4NyAxOS4wNzExIDQuOTI5MTJMMjEuODk5NSAyLjEwMDY5QzE2LjQzMjIgLTMuMzY2NjUgNy41Njc4NCAtMy4zNjY2NSAyLjEwMDUxIDIuMTAwNjlMNC45Mjg5MyA0LjkyOTEyWk00LjkyODkzIDE5LjA3MTNDMS4wMjM2OSAxNS4xNjYgMS4wMjM2OSA4LjgzNDM2IDQuOTI4OTMgNC45MjkxMkwyLjEwMDUxIDIuMTAwNjlDLTMuMzY2ODMgNy41NjgwMyAtMy4zNjY4MyAxNi40MzIzIDIuMTAwNTEgMjEuODk5N0w0LjkyODkzIDE5LjA3MTNaIiBmaWxsPSJ3aGl0ZSIgbWFzaz0idXJsKCNwYXRoLTEtaW5zaWRlLTFfNDlfMzcwKSIvPjwvZz48ZGVmcz48Y2xpcFBhdGggaWQ9ImNsaXAwXzQ5XzM3MCI+PHJlY3Qgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiBmaWxsPSJ3aGl0ZSIvPjwvY2xpcFBhdGg+PC9kZWZzPjwvc3ZnPg==');\n }\n"],["\n display: inline-flex;\n justify-content: center;\n align-items: center;\n padding: 2px 1.25rem 2px 0;\n line-height: 1rem;\n\n &::before {\n content: '';\n display: inline-block;\n height: 1rem;\n min-width: 1rem;\n vertical-align: middle;\n background-size: cover;\n background-repeat: no-repeat;\n margin: auto 0.5rem auto 0;\n }\n\n &.done::before {\n background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBjbGlwLXBhdGg9InVybCgjY2xpcDBfNDlfMzg1KSI+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xMiAyNEMxOC42Mjc0IDI0IDI0IDE4LjYyNzQgMjQgMTJDMjQgNS4zNzI1OCAxOC42Mjc0IDAgMTIgMEM1LjM3MjU4IDAgMCA1LjM3MjU4IDAgMTJDMCAxOC42Mjc0IDUuMzcyNTggMjQgMTIgMjRaTTE5LjU2NDMgOC4yNzg1MkMxOS45NTQ5IDcuODg3OTkgMTkuOTU0OSA3LjI1NDgzIDE5LjU2NDMgNi44NjQzQzE5LjE3MzggNi40NzM3OCAxOC41NDA2IDYuNDczNzggMTguMTUwMSA2Ljg2NDNMOS40Mjg2NiAxNS41ODU4TDUuODUwMDUgMTIuMDA3MkM1LjQ1OTUzIDExLjYxNjYgNC44MjYzNiAxMS42MTY2IDQuNDM1ODQgMTIuMDA3MkM0LjA0NTMxIDEyLjM5NzcgNC4wNDUzMSAxMy4wMzA5IDQuNDM1ODQgMTMuNDIxNEw4LjcyMTU1IDE3LjcwNzFDOS4xMTIwOCAxOC4wOTc2IDkuNzQ1MjQgMTguMDk3NiAxMC4xMzU4IDE3LjcwNzFMMTkuNTY0MyA4LjI3ODUyWiIgZmlsbD0id2hpdGUiLz48L2c+PGRlZnM+PGNsaXBQYXRoIGlkPSJjbGlwMF80OV8zODUiPjxyZWN0IHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgZmlsbD0id2hpdGUiLz48L2NsaXBQYXRoPjwvZGVmcz48L3N2Zz4=');\n }\n\n &.running::before {\n background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBjbGlwLXBhdGg9InVybCgjY2xpcDBfNDlfMzcwKSI+PG1hc2sgaWQ9InBhdGgtMS1pbnNpZGUtMV80OV8zNzAiIGZpbGw9IndoaXRlIj48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTMuNTE0NzIgMjAuNDg1NUM4LjIwMTAxIDI1LjE3MTggMTUuNzk5IDI1LjE3MTggMjAuNDg1MyAyMC40ODU1QzI1LjE3MTYgMTUuNzk5MiAyNS4xNzE2IDguMjAxMTkgMjAuNDg1MyAzLjUxNDlDMTUuNzk5IC0xLjE3MTM5IDguMjAxMDEgLTEuMTcxMzkgMy41MTQ3MiAzLjUxNDlDLTEuMTcxNTcgOC4yMDExOSAtMS4xNzE1NyAxNS43OTkyIDMuNTE0NzIgMjAuNDg1NVoiLz48L21hc2s+PHBhdGggZD0iTTYuMzk4MTQgMTEuNDU5QzUuODQ1ODYgMTEuNDU5IDUuMzk4MTQgMTEuOTA2NyA1LjM5ODE0IDEyLjQ1OUM1LjM5ODE0IDEzLjAxMTIgNS44NDU4NiAxMy40NTkgNi4zOTgxNCAxMy40NTlWMTEuNDU5Wk0xNy42MDE5IDEzLjQ1OUMxOC4xNTQxIDEzLjQ1OSAxOC42MDE5IDEzLjAxMTIgMTguNjAxOSAxMi40NTlDMTguNjAxOSAxMS45MDY3IDE4LjE1NDEgMTEuNDU5IDE3LjYwMTkgMTEuNDU5VjEzLjQ1OVpNNi4zOTgxNCAxMy40NTlIMTcuNjAxOVYxMS40NTlINi4zOTgxNFYxMy40NTlaTTMuNTE0NzIgMjAuNDg1NUw0LjkyODkzIDE5LjA3MTNMNC45Mjg5MyAxOS4wNzEzTDMuNTE0NzIgMjAuNDg1NVpNMjAuNDg1MyAzLjUxNDlMMTkuMDcxMSA0LjkyOTEyTDE5LjA3MTEgNC45MjkxMkwyMC40ODUzIDMuNTE0OVpNMy41MTQ3MiAzLjUxNDlMNC45Mjg5MyA0LjkyOTEyTDQuOTI4OTMgNC45MjkxMkwzLjUxNDcyIDMuNTE0OVpNMTkuMDcxMSAxOS4wNzEzQzE1LjE2NTggMjIuOTc2NSA4LjgzNDE3IDIyLjk3NjUgNC45Mjg5MyAxOS4wNzEzTDIuMTAwNTEgMjEuODk5N0M3LjU2Nzg0IDI3LjM2NyAxNi40MzIyIDI3LjM2NyAyMS44OTk1IDIxLjg5OTdMMTkuMDcxMSAxOS4wNzEzWk0xOS4wNzExIDQuOTI5MTJDMjIuOTc2MyA4LjgzNDM2IDIyLjk3NjMgMTUuMTY2IDE5LjA3MTEgMTkuMDcxM0wyMS44OTk1IDIxLjg5OTdDMjcuMzY2OCAxNi40MzIzIDI3LjM2NjggNy41NjgwMyAyMS44OTk1IDIuMTAwNjlMMTkuMDcxMSA0LjkyOTEyWk00LjkyODkzIDQuOTI5MTJDOC44MzQxNyAxLjAyMzg3IDE1LjE2NTggMS4wMjM4NyAxOS4wNzExIDQuOTI5MTJMMjEuODk5NSAyLjEwMDY5QzE2LjQzMjIgLTMuMzY2NjUgNy41Njc4NCAtMy4zNjY2NSAyLjEwMDUxIDIuMTAwNjlMNC45Mjg5MyA0LjkyOTEyWk00LjkyODkzIDE5LjA3MTNDMS4wMjM2OSAxNS4xNjYgMS4wMjM2OSA4LjgzNDM2IDQuOTI4OTMgNC45MjkxMkwyLjEwMDUxIDIuMTAwNjlDLTMuMzY2ODMgNy41NjgwMyAtMy4zNjY4MyAxNi40MzIzIDIuMTAwNTEgMjEuODk5N0w0LjkyODkzIDE5LjA3MTNaIiBmaWxsPSJ3aGl0ZSIgbWFzaz0idXJsKCNwYXRoLTEtaW5zaWRlLTFfNDlfMzcwKSIvPjwvZz48ZGVmcz48Y2xpcFBhdGggaWQ9ImNsaXAwXzQ5XzM3MCI+PHJlY3Qgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiBmaWxsPSJ3aGl0ZSIvPjwvY2xpcFBhdGg+PC9kZWZzPjwvc3ZnPg==');\n }\n"]))),ug=h.default.div(Rm||(Rm=w(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n"],["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n"]))),dg=h.default.div(Om||(Om=w(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: ",";\n opacity: ",";\n"],["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: ",";\n opacity: ",";\n"])),(function(e){var t,n,a,r;return null!==(r=null===(a=null===(n=null===(t=e.theme)||void 0===t?void 0:t.idCapture)||void 0===n?void 0:n.loadingOverlay)||void 0===a?void 0:a.progressBarBackgroundColor)&&void 0!==r?r:"var(--idm-color-positive-600)"}),(function(e){var t,n,a,r;return null!==(r=null===(a=null===(n=null===(t=e.theme)||void 0===t?void 0:t.idCapture)||void 0===n?void 0:n.loadingOverlay)||void 0===a?void 0:a.progressBarBackgroundOpacity)&&void 0!==r?r:.75})),cg=h.default.span(Fm||(Fm=w(["\n display: block;\n width: ","%;\n height: 100%;\n"],["\n display: block;\n width: ","%;\n height: 100%;\n"])),(function(e){return e.$progress})),fg=h.default.span(jm||(jm=w(["\n display: block;\n height: 100%;\n background: ",";\n animation: progressBar 3s ease-in-out;\n animation-fill-mode: both;\n\n @keyframes progressBar {\n 0% {\n width: 0;\n }\n 100% {\n width: 100%;\n }\n }\n"],["\n display: block;\n height: 100%;\n background: ",";\n animation: progressBar 3s ease-in-out;\n animation-fill-mode: both;\n\n @keyframes progressBar {\n 0% {\n width: 0;\n }\n 100% {\n width: 100%;\n }\n }\n"])),(function(e){var t,n,a,r;return null!==(r=null===(a=null===(n=null===(t=e.theme)||void 0===t?void 0:t.idCapture)||void 0===n?void 0:n.loadingOverlay)||void 0===a?void 0:a.progressBarIndicatorColor)&&void 0!==r?r:"var(--idm-color-positive-600)"})),hg=h.default.img(Pm||(Pm=w([""],[""]))),pg=h.default.div(Bm||(Bm=w(["\n display: flex;\n"],["\n display: flex;\n"]))),mg=h.default(ce)(_m||(_m=w(["\n margin: auto;\n white-space: nowrap;\n ","\n ","\n"],["\n margin: auto;\n white-space: nowrap;\n ","\n ","\n"])),(function(e){var t,n,a,r,i,o;return(null===(a=null===(n=null===(t=e.theme)||void 0===t?void 0:t.idCapture)||void 0===n?void 0:n.loadingOverlay)||void 0===a?void 0:a.progressBarFontSize)?"font-size: ".concat(null===(o=null===(i=null===(r=e.theme)||void 0===r?void 0:r.idCapture)||void 0===i?void 0:i.loadingOverlay)||void 0===o?void 0:o.progressBarFontSize,";"):""}),(function(e){var t,n,a,r,i,o;return(null===(a=null===(n=null===(t=e.theme)||void 0===t?void 0:t.idCapture)||void 0===n?void 0:n.loadingOverlay)||void 0===a?void 0:a.continueBtnBorder)?"border: ".concat(null===(o=null===(i=null===(r=e.theme)||void 0===r?void 0:r.idCapture)||void 0===i?void 0:i.loadingOverlay)||void 0===o?void 0:o.continueBtnBorder,";"):""})),gg=h.default.div(Um||(Um=w(["\n margin-top: 15px;\n margin-bottom: 15px;\n"],["\n margin-top: 15px;\n margin-bottom: 15px;\n"]))),vg=h.default.input(zm||(zm=w(["\n margin-right: 8px;\n"],["\n margin-right: 8px;\n"]))),yg={default:function(e){var n,a,r,i,o=e.onDismissed,s=e.onUserCancel,l=e.instructions,d=e.rotateImage,c=void 0!==d&&d,f=e.assets,h=void 0===f?{}:f,p=e.classNames,m=void 0===p?{}:p,g=e.colors,v=void 0===g?{}:g,y=e.verbiage,b=void 0===y?{}:y,x=t.useContext(uh),C=x.ready,w=x.modelDownloadProgress,E=t.useContext(Xe),k=E.cameraReady,T=E.cameraAccessDenied,M=E.iphoneContinuityCameraAvailable,I=E.setIphoneContinuityCameraAllowed,S=t.useState(!1),D=S[0],N=S[1];h.instructionImageUrl||(h.instructionImageUrl=Xm);var A=Xp(b,{headingText:"Use your device camera to capture your ID",useContinuityCameraText:"Use your iPhone as a webcam",downloadingText:"Downloading...",modelsWarmingUpText:"Loading guided capture experience...",modelsReadyText:"Guided capture experience ready",cameraInitializingText:"Camera initializing...",cameraInitializedText:"Camera ready",continueText:"Let's Go!"});t.useEffect((function(){if(C&&k)return function(){return null};var e=setTimeout((function(){N(!1)}),500);return function(){clearTimeout(e)}}),[k,C]);var L=t.useRef(null);if(D)return u.default.createElement(u.default.Fragment,null);if(T)return u.default.createElement(cm,{assets:h.cameraAccessDenied,classNames:m.cameraAccessDenied,colors:v.cameraAccessDenied,verbiage:b.cameraAccessDenied});var R={};if(c){var O=null!==(a=null===(n=L.current)||void 0===n?void 0:n.naturalWidth)&&void 0!==a?a:0,F=null!==(i=null===(r=L.current)||void 0===r?void 0:r.naturalHeight)&&void 0!==i?i:0;R={transform:"rotate(-90deg) scale(".concat(O>F?F/O:1,")")}}return u.default.createElement(W,{className:m.container},u.default.createElement(Km,{className:m.inner},u.default.createElement(Jm,null,u.default.createElement(eg,{className:m.heading},A.headingText)),s&&u.default.createElement(vm,{onClick:s,className:m.cancelBtn}),u.default.createElement(tg,{className:m.imageContainer,style:{pointerEvents:"none"}},(null==h?void 0:h.instructionImageUrl)&&h.instructionImageUrl!==Xm?u.default.createElement(hg,{ref:L,alt:A.headingText,src:h.instructionImageUrl,className:m.image,style:R}):u.default.createElement(bm,{className:m.image})),l,u.default.createElement(ng,{className:m.continuityCameraCheckboxContainer},M&&u.default.createElement(ag,{className:m.continuityCameraCheckboxInner},u.default.createElement(rg,{className:m.continuityCameraCheckbox,id:"use-continuity-camera",type:"checkbox",defaultChecked:!0,onChange:function(e){I(e.target.checked)}}),u.default.createElement("label",{htmlFor:"use-continuity-camera",className:m.continuityCameraCheckboxLabel},A.useContinuityCameraText))),u.default.createElement(ig,{className:m.buttonsRow},u.default.createElement(ug,{className:m.progressContainer},u.default.createElement(dg,{className:m.progressBackground}),u.default.createElement(cg,{$progress:w,className:m.progressBar},u.default.createElement(fg,{className:m.progressIndicator}))),u.default.createElement(og,{className:m.loadingListContainer},u.default.createElement(sg,{className:m.loadingList},u.default.createElement(lg,{className:"".concat(m.loadingListItem," ").concat(k?"done":"running")},k?A.cameraInitializedText:A.cameraInitializingText),u.default.createElement(lg,{className:"".concat(m.loadingListItem," ").concat(C?"done":"running")},C?A.modelsReadyText:w>=100?A.modelsWarmingUpText:"".concat(A.downloadingText," (").concat(w,"%)")))),u.default.createElement(pg,{className:m.continueBtnContainer},C&&k&&u.default.createElement(mg,{finished:!0,className:m.continueBtn,variant:"positive",colors:v.continueBtn,onClick:function(){N(!0),null==o||o()}},A.continueText)))))},legacy:function(e){var n,a,r,i,o=e.onDismissed,s=e.onUserCancel,l=e.instructions,d=e.rotateImage,c=void 0!==d&&d,f=e.assets,h=void 0===f?{}:f,p=e.classNames,m=void 0===p?{}:p,g=e.colors,v=void 0===g?{}:g,y=e.verbiage,b=void 0===y?{}:y,x=t.useContext(uh),C=x.ready,w=x.modelDownloadProgress,E=t.useContext(Xe),k=E.cameraReady,T=E.cameraAccessDenied,M=E.iphoneContinuityCameraAvailable,I=E.setIphoneContinuityCameraAllowed,S=t.useState(!1),D=S[0],N=S[1];h.instructionImageUrl||(h.instructionImageUrl="".concat(Ra,"/WebSDK-Instruction-DL-Capture-3-Portrait.png"));var A=Xp(b,{headingText:"Use your device camera to capture your ID",useContinuityCameraText:"Use your iPhone as a webcam",downloadingText:"Downloading...",modelsWarmingUpText:"Models warming up...",cameraInitializingText:"Camera initializing...",continueText:"Continue"});t.useEffect((function(){if(C&&k)return function(){return null};var e=setTimeout((function(){N(!1)}),500);return function(){clearTimeout(e)}}),[k,C]);var L=t.useRef(null);if(D)return u.default.createElement(u.default.Fragment,null);if(T)return u.default.createElement(cm,{assets:h.cameraAccessDenied,classNames:m.cameraAccessDenied,colors:v.cameraAccessDenied,verbiage:b.cameraAccessDenied});var R={};if(c){var O=null!==(a=null===(n=L.current)||void 0===n?void 0:n.naturalWidth)&&void 0!==a?a:0,F=null!==(i=null===(r=L.current)||void 0===r?void 0:r.naturalHeight)&&void 0!==i?i:0;R={transform:"rotate(-90deg) scale(".concat(O>F?F/O:1,")")}}return u.default.createElement(W,{className:m.container},u.default.createElement($,{className:m.inner},u.default.createElement("h3",{className:m.heading},A.headingText),s&&u.default.createElement(vm,{onClick:s,className:m.cancelBtn}),u.default.createElement(V,{className:m.imageContainer,style:{pointerEvents:"none"}},u.default.createElement("img",{ref:L,alt:A.headingText,src:h.instructionImageUrl,className:m.image,style:R})),l,u.default.createElement(gg,{className:m.continuityCameraCheckboxContainer},M&&u.default.createElement(u.default.Fragment,null,u.default.createElement(vg,{className:m.continuityCameraCheckbox,id:"use-continuity-camera",type:"checkbox",defaultChecked:!0,onChange:function(e){I(e.target.checked)}}),u.default.createElement("label",{htmlFor:"use-continuity-camera",className:m.continuityCameraCheckboxLabel},A.useContinuityCameraText))),u.default.createElement(ce,{className:m.continueBtn,variant:"positive",disabled:!k||!C,finished:C&&k,colors:v.continueBtn,onClick:function(){N(!0),null==o||o()}},k&&C?A.continueText:C?A.cameraInitializingText:w>=100?A.modelsWarmingUpText:"".concat(A.downloadingText," (").concat(w,"%)"))))}},bg=function(e){var t,n=e.mode,a=void 0===n?"default":n,r=y(e,["mode"]),i=null!==(t=yg[a])&&void 0!==t?t:yg.default;return u.default.createElement(i,v({},r))},xg=function(e){var n=e.alt,a=e.className,r=e.image,i=t.useState(r.imageData),o=i[0],s=i[1],l=t.useState(!1),d=l[0],c=l[1],f=r.boundingBox,h=t.useRef(null);return u.default.createElement("img",{ref:h,alt:n,className:a,src:o,onLoad:function(){f&&!d&&(c(!0),setTimeout((function(){s(Fa(h.current,f).toDataURL("image/jpeg",.95))}),100))}})},Cg=h.default.p(Gm||(Gm=w(["\n font-size: 18px;\n margin: 30px 0;\n"],["\n font-size: 18px;\n margin: 30px 0;\n"]))),wg=function(e){var n=e.capturedDocuments,a=e.onSubmitClick,r=e.onRetryClick,i=e.classNames,o=void 0===i?{}:i,s=e.colors,l=void 0===s?{}:s,d=e.verbiage,c=void 0===d?{}:d,f=t.useContext(Ie).submissionStatus,h=n.idCardFront,p=n.idCardBack,m=n.passport,g=Xp(c,{headingText:"ID Capture Successful",idCardFrontText:"ID Card Front",idCardBackText:"ID Card Back",passportText:"Passport",instructionText:"Verify the entire ID was captured clearly with no glare.",retryText:"Retry",submittingText:"Submitting...",submitText:"Done"});return u.default.createElement(W,{className:o.container},u.default.createElement($,{className:o.inner},u.default.createElement(kg,{className:o.imageContainer},u.default.createElement(Tg,{className:o.imageRow},u.default.createElement(Eg,{className:o.heading},g.headingText),h&&u.default.createElement(Mg,{className:o.imageCol},u.default.createElement(Ig,{className:o.imageHeading},g.idCardFrontText),u.default.createElement(Sg,{className:o.imageWrapper},u.default.createElement(Dg,{image:h,className:o.image,alt:g.idCardFrontText}))),p&&u.default.createElement(Mg,{className:o.imageCol},u.default.createElement(Ig,{className:o.imageHeading},g.idCardBackText),u.default.createElement(Sg,{className:o.imageWrapper},u.default.createElement(Dg,{image:p,className:o.image,alt:g.idCardBackText}))),m&&u.default.createElement(Mg,{className:o.imageCol},u.default.createElement(Ig,{className:o.imageHeading},g.passportText),u.default.createElement(Sg,{className:o.imageWrapper},u.default.createElement(Dg,{image:m,className:o.image,alt:g.passportText}))))),u.default.createElement(Cg,{className:o.instruction},g.instructionText),u.default.createElement(ym,{className:o.buttonsRow},u.default.createElement(ce,{className:o.retryBtn,variant:"warning",onClick:r,colors:l.retryBtn,finished:!0},g.retryText),u.default.createElement(ce,{className:o.submitBtn,variant:"positive",onClick:a,disabled:f===k.SUBMITTING,colors:l.doneBtn,finished:!0},f===k.SUBMITTING?g.submittingText:g.submitText))))},Eg=h.default.h1(Wm||(Wm=w(["\n margin-bottom: 12px;\n"],["\n margin-bottom: 12px;\n"]))),kg=h.default(V)($m||($m=w(["\n overflow-y: auto;\n"],["\n overflow-y: auto;\n"]))),Tg=h.default(q)(Vm||(Vm=w(["\n flex-direction: column;\n"],["\n flex-direction: column;\n"]))),Mg=h.default.div(qm||(qm=w(["\n max-height: none !important;\n"],["\n max-height: none !important;\n"]))),Ig=h.default.h3(Hm||(Hm=w(["\n text-align: left;\n margin-top: 24px;\n margin-bottom: 8px;\n font-size: 16px;\n font-weight: normal;\n"],["\n text-align: left;\n margin-top: 24px;\n margin-bottom: 8px;\n font-size: 16px;\n font-weight: normal;\n"]))),Sg=h.default.div(Ym||(Ym=w(["\n border: 1px solid\n ",";\n border-radius: 6px;\n padding: 4px;\n background: white;\n display: flex;\n"],["\n border: 1px solid\n ",";\n border-radius: 6px;\n padding: 4px;\n background: white;\n display: flex;\n"])),(function(e){var t,n,a;return null!==(a=null===(n=null===(t=e.theme.idCapture)||void 0===t?void 0:t.success)||void 0===n?void 0:n.imageBorderColor)&&void 0!==a?a:"var(--idm-color-primary-400)"})),Dg=h.default(xg)(Zm||(Zm=w(["\n width: 100%;\n border-radius: 4px;\n"],["\n width: 100%;\n border-radius: 4px;\n"]))),Ng=function(e){var n,a=e.className,r=t.useContext(Xe),i=r.videoRef,o=r.setVideoLoaded,s=r.cameraRef;t.useEffect((function(){o(!1)}),[o]),t.useEffect((function(){var e;i.current&&(null===(e=s.current)||void 0===e?void 0:e.stream)&&(i.current.srcObject=s.current.stream)}),[s,i]);var l=t.useCallback((function(){o(!0)}),[o]);return u.default.createElement(Ag,{className:a,autoPlay:!0,playsInline:!0,muted:!0,ref:i,onLoadedData:l,$isRearFacing:null===(n=s.current)||void 0===n?void 0:n.isRearFacing})},Ag=h.default.video(Qm||(Qm=w(["\n transform: ",";\n min-width: 100%;\n min-height: 100%;\n width: auto;\n height: auto;\n max-width: 100%;\n max-height: 100%;\n object-fit: cover;\n background: black;\n z-index: -2;\n"],["\n transform: ",";\n min-width: 100%;\n min-height: 100%;\n width: auto;\n height: auto;\n max-width: 100%;\n max-height: 100%;\n object-fit: cover;\n background: black;\n z-index: -2;\n"])),(function(e){return e.$isRearFacing?"":"scaleX(-1)"}));function Lg(e,n,a){var r=this,i=t.useState(!1),o=i[0],s=i[1];return t.useEffect((function(){n&&e&&("function"==typeof e?b(r,void 0,void 0,(function(){return x(this,(function(t){switch(t.label){case 0:return[4,e()];case 1:return t.sent()?null==a||a():s(!0),[2]}}))})):null==a||a())}),[n,a,e]),!e||o}var Rg,Og=h.default.div(Rg||(Rg=w(["\n ","\n"],["\n ","\n"])),(function(e){return"snapToGuides"===e.$mode?"display: flex;\n position: absolute;\n left: ".concat(e.$x,"px;\n top: ").concat(e.$y,"px;\n width: ").concat(e.$w,"px;\n height: ").concat(e.$h,"px;"):""}));function Fg(e,t,n){var a,r=1;"undefined"!=typeof window&&(r=window.devicePixelRatio),e.width=t*r,e.height=n*r,e.style.width=t+"px",e.style.height=n+"px",null===(a=e.getContext("2d"))||void 0===a||a.scale(r,r)}function jg(e){e.width=0,e.height=0,e.style.width="0",e.style.height="0"}var Pg,Bg,_g,Ug,zg,Gg,Wg,$g,Vg,qg,Hg,Yg,Zg=t.createContext({orientation:"landscape",wrapperWidth:1,wrapperHeight:1,wrapperAspectRatio:0,imageAspectRatio:0,wrapperRef:null,setDimensions:function(){return null},onImageLoaded:function(){return null}}),Qg=h.default(B)(Pg||(Pg=w(["\n z-index: 1000;\n"],["\n z-index: 1000;\n"]))),Xg=h.default.div(Bg||(Bg=w(["\n display: flex;\n flex-flow: column nowrap;\n width: 100%;\n height: 100%;\n"],["\n display: flex;\n flex-flow: column nowrap;\n width: 100%;\n height: 100%;\n"]))),Kg=h.default.div(_g||(_g=w(["\n position: relative;\n display: flex;\n flex-flow: row nowrap;\n align-items: center;\n justify-items: center;\n box-sizing: border-box;\n max-width: 100%;\n max-height: 100%;\n"],["\n position: relative;\n display: flex;\n flex-flow: row nowrap;\n align-items: center;\n justify-items: center;\n box-sizing: border-box;\n max-width: 100%;\n max-height: 100%;\n"]))),Jg=h.default.div(Ug||(Ug=w(["\n display: flex;\n flex-direction: column;\n justify-content: end;\n width: 100%;\n height: 100%;\n flex-grow: 1;\n position: relative;\n z-index: 1000;\n background: ",";\n color: ",";\n text-align: center;\n ","\n ","\n"],["\n display: flex;\n flex-direction: column;\n justify-content: end;\n width: 100%;\n height: 100%;\n flex-grow: 1;\n position: relative;\n z-index: 1000;\n background: ",";\n color: ",";\n text-align: center;\n ","\n ","\n"])),(function(e){var t,n,a,r,i;return null!==(i=null!==(t=e.$maskColor)&&void 0!==t?t:null===(r=null===(a=null===(n=e.theme)||void 0===n?void 0:n.idCapture)||void 0===a?void 0:a.guideOverlay)||void 0===r?void 0:r.backgroundColor)&&void 0!==i?i:"rgba(0, 0, 0, 0.5)"}),(function(e){var t,n,a,r;return null!==(r=null===(a=null===(n=null===(t=e.theme)||void 0===t?void 0:t.idCapture)||void 0===n?void 0:n.guideOverlay)||void 0===a?void 0:a.textColor)&&void 0!==r?r:"white"}),(function(e){return e.$minWidth?"min-width: ".concat(e.$minWidth,"px;"):""}),(function(e){return e.$minHeight?"min-width: ".concat(e.$minHeight,"px;"):""})),ev=h.default.div(zg||(zg=w(["\n ","\n ","\n box-sizing: border-box;\n"],["\n ","\n ","\n box-sizing: border-box;\n"])),(function(e){return e.$minWidth?"min-width: ".concat(e.$minWidth,"px;"):""}),(function(e){return e.$isMirrored?"transform: scaleX(-1);":""})),tv=h.default.div(Gg||(Gg=w(["\n box-sizing: border-box;\n position: relative;\n border: ",";\n"],["\n box-sizing: border-box;\n position: relative;\n border: ",";\n"])),(function(e){var t,n;return"".concat(null!==(t=e.$borderWidth)&&void 0!==t?t:4,"px solid ").concat(null!==(n=e.$borderColor)&&void 0!==n?n:"white")})),nv=h.default.span(Wg||(Wg=w(["\n align-content: center;\n margin-top: 12px;\n margin-bottom: 12px;\n"],["\n align-content: center;\n margin-top: 12px;\n margin-bottom: 12px;\n"]))),av=h.default.img($g||($g=w(["\n position: relative;\n z-index: 1;\n display: block;\n padding: ","px;\n box-sizing: border-box;\n ","\n ","\n opacity: ",";\n transition: opacity 0.5s;\n"],["\n position: relative;\n z-index: 1;\n display: block;\n padding: ","px;\n box-sizing: border-box;\n ","\n ","\n opacity: ",";\n transition: opacity 0.5s;\n"])),(function(e){return e.$padding}),(function(e){return e.$width?"width: ".concat(e.$width,"px;\n max-width: ").concat(e.$width,"px;"):"max-width: none;"}),(function(e){return e.$height?"height: ".concat(e.$height,"px;\n max-height: ").concat(e.$height,"px;"):"max-height: none;"}),(function(e){return e.$visible?1:0})),rv=function(e){var n,a,i,o,s,l,d,c,f,h,p,m,g=e.classNames,v=void 0===g?{}:g,y=e.width,b=void 0===y?0:y,x=e.height,C=void 0===x?0:x,w=e.padding,E=e.imagePadding,k=e.imageVisible,T=void 0===k||k,M=e.borderWidth,I=e.borderColor,S=e.maskColor,D=e.isMirrored,N=void 0!==D&&D,A=e.instruction,L=void 0===A?"":A,R=e.portraitGuidesImageUrl,O=e.landscapeGuidesImageUrl,F=e.onClick,j=t.useContext(Zg),P=j.orientation,B=j.wrapperRef,_=j.wrapperWidth,U=j.wrapperHeight,z=j.imageAspectRatio,G=j.wrapperAspectRatio,W=j.onImageLoaded,$=j.setDimensions,V=Ih()[1];var q=r.useTheme();void 0===M&&(M=null!==(i=null===(a=null===(n=q.idCapture)||void 0===n?void 0:n.guideBox)||void 0===a?void 0:a.borderWidth)&&void 0!==i?i:4),0==b&&(b=_),0==C&&(C=U),t.useEffect((function(){$({width:b,height:C})}),[C,$,b]);var H=(null!=w?w:En())?null!==(l=null===(s=null===(o=q.idCapture)||void 0===o?void 0:o.guideBox)||void 0===s?void 0:s.mobilePadding)&&void 0!==l?l:0:null!==(f=null===(c=null===(d=q.idCapture)||void 0===d?void 0:d.guideBox)||void 0===c?void 0:c.desktopPadding)&&void 0!==f?f:50,Y=2*H+2*M,Z="portrait"===P?R:O,Q=null!==(m=null!=E?E:null===(p=null===(h=q.idCapture)||void 0===h?void 0:h.guideBox)||void 0===p?void 0:p.imagePadding)&&void 0!==m?m:0,X=void 0,K=void 0;return z>=G?X=_-Y:K=U-Y,u.default.createElement(Qg,{ref:B,onClick:F,className:v.container},u.default.createElement(Xg,{className:v.inner},u.default.createElement(Jg,{$maskColor:S,$minHeight:H,className:iv(v,"Top")},""!==L&&u.default.createElement(nv,{className:v.guideText},L)),u.default.createElement(Kg,{className:v.centerRow},u.default.createElement(Jg,{$maskColor:S,$minWidth:H,className:iv(v,"Left")}),u.default.createElement(ev,{$minWidth:X,$isMirrored:N,className:v.centerRegion},u.default.createElement(tv,{$borderWidth:M,$borderColor:I,className:v.centerRegionInner},u.default.createElement(av,{src:Z,alt:"",onLoad:function(e){W(e);var t=e.target;V({type:"guideImageLoaded",payload:{width:t.naturalWidth,height:t.naturalHeight}})},className:v.image,$width:X,$height:K,$padding:Q,$visible:T}))),u.default.createElement(Jg,{$maskColor:S,$minWidth:H,className:iv(v,"Right")})),u.default.createElement(Jg,{$maskColor:S,$minHeight:H,className:iv(v,"Bottom")},""!==L&&u.default.createElement(nv,{style:{opacity:0}},L))))},iv=function(e,t){return[e.dimmingRegion,e["dimmingRegion".concat(t)]].filter((function(e){return e})).join(" ")},ov=h.default(av)(Vg||(Vg=w(["\n backface-visibility: hidden;\n transform-style: preserve-3d;\n position: relative;\n top: 0;\n left: 0;\n transition: transform ","s;\n transform: ",";\n"],["\n backface-visibility: hidden;\n transform-style: preserve-3d;\n position: relative;\n top: 0;\n left: 0;\n transition: transform ","s;\n transform: ",";\n"])),(function(e){return e.$transitionTime}),(function(e){return e.$transforms})),sv=h.default(ov)(qg||(qg=w(["\n position: absolute;\n"],["\n position: absolute;\n"]))),lv=function(e){var n,a,i,o,s,l,d,c,f,h,p,m,g,v=e.padding,y=e.imagePadding,b=e.borderWidth,x=e.borderColor,C=e.maskColor,w=e.assets,E=void 0===w?{}:w,k=e.classNames,T=void 0===k?{}:k,M=e.verbiage,I=void 0===M?{}:M,S=Le(),D=S.ref,N=S.width,A=void 0===N?1:N,L=S.height,R=void 0===L?1:L,O=t.useContext(Xe).cameraRef,F=r.useTheme();E.frontPortraitGuidesImageUrl||(E.frontPortraitGuidesImageUrl="".concat(Ra,"/Shieldout-IDCard-Front-SVG-Portrait-2.svg")),E.frontLandscapeGuidesImageUrl||(E.frontLandscapeGuidesImageUrl="".concat(Ra,"/Shieldout-IDCard-Front-SVG-Landscape-2.svg")),E.backPortraitGuidesImageUrl||(E.backPortraitGuidesImageUrl="".concat(Ra,"/Shieldout-IDCard-Back-SVG-Portrait-2.svg")),E.backLandscapeGuidesImageUrl||(E.backLandscapeGuidesImageUrl="".concat(Ra,"/Shieldout-IDCard-Back-SVG-Landscape-2.svg"));var j=Qp(I.instructionText,"Please flip your ID card..."),P=(null!=v?v:En())?null!==(i=null===(a=null===(n=F.idCapture)||void 0===n?void 0:n.guideBox)||void 0===a?void 0:a.mobilePadding)&&void 0!==i?i:0:null!==(l=null===(s=null===(o=F.idCapture)||void 0===o?void 0:o.guideBox)||void 0===s?void 0:s.desktopPadding)&&void 0!==l?l:50;void 0===b&&(b=null!==(f=null===(c=null===(d=F.idCapture)||void 0===d?void 0:d.guideBox)||void 0===c?void 0:c.borderWidth)&&void 0!==f?f:4);var _=!(null===(h=O.current)||void 0===h?void 0:h.isRearFacing),U=t.useContext(Zg),z=U.orientation,G=U.wrapperRef,W=U.wrapperWidth,$=U.wrapperHeight,V=U.imageAspectRatio,q=U.wrapperAspectRatio,H=U.onImageLoaded,Y=U.setDimensions;t.useEffect((function(){Y({width:A,height:R})}),[R,Y,A]);var Z=2*P+2*b,Q=null!==(g=null!=y?y:null===(m=null===(p=F.idCapture)||void 0===p?void 0:p.guideBox)||void 0===m?void 0:m.imagePadding)&&void 0!==g?g:0,X=void 0,K=void 0;V>=q?X=W-Z:K=$-Z;var J=t.useState(1),ee=J[0],te=J[1],ne=t.useState(0),ae=ne[0],re=ne[1],ie=["rotateY(".concat(ae,"deg)")];_&&ie.push("scaleX(-1)");var oe=["rotateY(".concat(180-ae,"deg)")];return _&&oe.push("scaleX(-1)"),t.useEffect((function(){var e=function(){te(1),re(180),setTimeout((function(){te(0),re(0)}),1500)};setTimeout(e,250);var t=setInterval(e,2500);return function(){clearInterval(t)}}),[]),u.default.createElement(B,{ref:D,className:T.container},u.default.createElement(Xg,{ref:G,className:T.inner},u.default.createElement(Jg,{$minHeight:P,$maskColor:C,className:uv(T,"Top")},""!==j&&u.default.createElement(nv,{className:T.guideText},j)),u.default.createElement(Kg,{className:T.centerRow},u.default.createElement(Jg,{$minWidth:P,$maskColor:C,className:uv(T,"Left")}),u.default.createElement(ev,null,u.default.createElement(tv,{$borderWidth:b,$borderColor:x,className:T.centerRegion},u.default.createElement(ov,{src:"portrait"===z?E.frontPortraitGuidesImageUrl:E.frontLandscapeGuidesImageUrl,alt:"",className:T.image,$width:X,$height:K,$padding:Q,$transitionTime:ee,$transforms:ie.join(" "),$visible:!0,onLoad:H}),u.default.createElement(sv,{src:"portrait"===z?E.backPortraitGuidesImageUrl:E.backLandscapeGuidesImageUrl,alt:"",className:T.image,$width:X,$height:K,$padding:Q,$transitionTime:ee,$transforms:oe.join(" "),$visible:!0}))),u.default.createElement(Jg,{$minWidth:P,$maskColor:C,className:uv(T,"Right")})),u.default.createElement(Jg,{$minHeight:P,$maskColor:C,className:uv(T,"Bottom")},""!==j&&u.default.createElement(nv,{style:{opacity:0}},j))))},uv=function(e,t){return[e.dimmingRegion,e["dimmingRegion".concat(t)]].filter((function(e){return e})).join(" ")},dv=function(e){var n,a,i,o,s,l,d,c,f,h,p,m,g=e.aspectRatio,v=e.maskColor,y=e.borderRadius,b=void 0===y?33:y,x=e.borderColor,C=e.borderWidth,w=e.padding,E=e.imageUrl,k=e.imageVisible,T=e.frontImageUrl,M=e.backImageUrl,I=e.isMirrored,S=e.instruction,D=e.requestingFlip,N=void 0!==D&&D,A=e.classNames,L=void 0===A?{}:A,R=Ih(),O=R[0],F=O.redrawing,j=O.guideImageWidth,P=O.guideImageHeight,B=R[1],_=t.useRef(null),U=Le(),z=U.ref,G=U.width,W=void 0===G?1:G,$=U.height,V=void 0===$?1:$,q=r.useTheme();return void 0===C&&(C=null!==(i=null===(a=null===(n=q.idCapture)||void 0===n?void 0:n.guideBox)||void 0===a?void 0:a.borderWidth)&&void 0!==i?i:4),void 0===w&&(w=En()?null!==(l=null===(s=null===(o=q.idCapture)||void 0===o?void 0:o.guideBox)||void 0===s?void 0:s.mobilePadding)&&void 0!==l?l:0:null!==(f=null===(c=null===(d=q.idCapture)||void 0===d?void 0:d.guideBox)||void 0===c?void 0:c.desktopPadding)&&void 0!==f?f:0),void 0===g&&0!==j&&(g=j/P),void 0===v&&(v=null!==(m=null===(p=null===(h=q.idCapture)||void 0===h?void 0:h.guideOverlay)||void 0===p?void 0:p.backgroundColor)&&void 0!==m?m:"#708090"),t.useEffect((function(){var e=_.current;if(e){if(F)return jg(e),void setTimeout((function(){B({type:"redrawInProgress"})}),10);var t=W-2*w-2*C,n=V-2*w-2*C,a=[w+C,w+C,t,n],r=a[0],i=a[1],o=a[2],s=a[3];if(void 0!==g){var l=n*g;l<t?r+=(t-(o=l))/2:i+=(n-(s=t/g))/2}Fg(e,W,V);var u=e.getContext("2d");if(u)u.fillStyle=v,u.clearRect(0,0,W,V),u.fillRect(0,0,W,V),u.beginPath(),u.roundRect(r,i,o,s,b),u.lineWidth=C,u.strokeStyle=null!=x?x:"white",(null==x?void 0:x.startsWith("var("))&&(u.strokeStyle=getComputedStyle(document.documentElement).getPropertyValue(x.slice(4,-1))),u.stroke(),u.fillStyle="rgba(0,0,0,1)",u.globalCompositeOperation="destination-out",u.fill(),u.globalCompositeOperation="source-over",B({type:"redrawCompleted",payload:{guideRectX:r,guideRectY:i,guideRectWidth:o,guideRectHeight:s,guideRectOffsetTop:e.offsetTop}})}}),[g,x,b,C,B,v,w,F,V,W]),u.default.createElement(u.default.Fragment,null,u.default.createElement(cv,{ref:z,$maskColor:v,className:L.canvasWrapper},u.default.createElement(fv,{ref:_,className:L.canvas})),N?u.default.createElement(lv,{maskColor:"transparent",borderWidth:0,classNames:L,assets:{frontLandscapeGuidesImageUrl:T,backLandscapeGuidesImageUrl:M}}):u.default.createElement(rv,{landscapeGuidesImageUrl:E,maskColor:"transparent",borderWidth:0,isMirrored:I,instruction:S,classNames:L,imageVisible:k}))},cv=h.default.div(Hg||(Hg=w(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n flex-grow: 1;\n background-clip: padding-box;\n box-shadow: inset 0 0 0 2px ",";\n z-index: -1;\n"],["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n flex-grow: 1;\n background-clip: padding-box;\n box-shadow: inset 0 0 0 2px ",";\n z-index: -1;\n"])),(function(e){return e.$maskColor})),fv=h.default.canvas(Yg||(Yg=w(["\n display: block;\n"],["\n display: block;\n"])));function hv(e){var n,a,r=e.guideType,i=void 0===r?"fit":r,o=e.portraitGuidesOnMobile,s=void 0!==o&&o,l=e.requestingFlip,d=void 0!==l&&l,c=e.flipIdPromptAssets,f=void 0===c?{}:c,h=e.classNames,p=void 0===h?{}:h,m=e.assets,g=void 0===m?{}:m,v=e.colors,y=void 0===v?{}:v,b=e.verbiage,x=void 0===b?{}:b,C=Ih()[0],w=t.useContext(Xe).cameraRef,E=Xp(x,{instructionText:"Scan the front of ID",processingIdCardText:"ID card front captured.",capturingText:"Capturing...",captureFailedText:"Capture failed!",guidanceSatisfiedText:"Document detected, hold still...",guidanceTooBlurryText:"Document out of focus – try improving the lighting",guidanceNotCenteredText:"Document is not centered",guidanceNotDetectedText:"Document not detected"}),k=window.innerWidth<window.innerHeight,T=s&&k?null==f?void 0:f.frontPortraitGuidesImageUrl:null==f?void 0:f.frontLandscapeGuidesImageUrl,M=s&&k?null==f?void 0:f.backPortraitGuidesImageUrl:null==f?void 0:f.backLandscapeGuidesImageUrl;return u.default.createElement(u.default.Fragment,null,"overlay"===i&&u.default.createElement(rv,{classNames:p,width:C.pageWidth,height:C.pageHeight,instruction:C.captureFailed?E.captureFailedText:C.capturing?null==E?void 0:E.capturingText:E.instructionText,portraitGuidesImageUrl:g.portraitGuidesImageUrl,landscapeGuidesImageUrl:g.landscapeGuidesImageUrl,isMirrored:!(null===(n=w.current)||void 0===n?void 0:n.isRearFacing),borderColor:C.isGoodFrame?y.guideBoxSatisfiedColor:y.guideBoxUnsatisfiedColor,imageVisible:d||!C.documentDetectionThresholdMet||!C.documentInBounds||C.documentTooClose}),"fit"===i&&u.default.createElement(dv,{classNames:p,requestingFlip:d,instruction:C.captureFailed?E.captureFailedText:C.capturing?null==E?void 0:E.capturingText:E.instructionText,imageUrl:s&&k?null==g?void 0:g.portraitGuidesImageUrl:null==g?void 0:g.landscapeGuidesImageUrl,frontImageUrl:T,backImageUrl:M,isMirrored:!(null===(a=w.current)||void 0===a?void 0:a.isRearFacing),borderColor:C.isGoodFrame?y.guideBoxSatisfiedColor:y.guideBoxUnsatisfiedColor,imageVisible:d||!C.documentDetectionThresholdMet||!C.documentInBounds||C.documentTooClose}))}var pv,mv,gv,vv,yv,bv,xv,Cv,wv,Ev,kv,Tv,Mv,Iv,Sv,Dv,Nv,Av,Lv,Rv,Ov,Fv,jv,Pv,Bv,_v,Uv,zv,Gv,Wv,$v,Vv=h.default.div(pv||(pv=w(["\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: lds-dual-ring 1.2s linear infinite;\n box-sizing: content-box;\n }\n\n @keyframes lds-dual-ring {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\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: lds-dual-ring 1.2s linear infinite;\n box-sizing: content-box;\n }\n\n @keyframes lds-dual-ring {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n }\n"])),(function(e){var t=e.$size;return null!=t?t:80}),(function(e){var t=e.$size;return null!=t?t:80}),(function(e){var t=e.$size;return(null!=t?t:80)-16}),(function(e){var t=e.$size;return(null!=t?t:80)-16}),(function(e){var t=e.$thickness;return null!=t?t:6}),(function(e){var t=e.$color;return null!=t?t:"#888"}),(function(e){var t=e.$color;return null!=t?t:"#888"}),(function(e){var t=e.$color;return null!=t?t:"#888"})),qv=function(e){var n=e.classNames,a=void 0===n?{}:n,r=e.text,i=e.imageUrl,o=t.useRef(null),s=t.useState(!1),l=s[0],d=s[1],c=t.useState(0),f=c[1];return u.default.createElement(Zv,{className:a.container,style:{aspectRatio:c[0],opacity:l?1:0}},r&&u.default.createElement(Qv,{className:a.text},r),u.default.createElement(Xv,{className:a.imageContainer},u.default.createElement("img",{ref:o,src:i,alt:"",className:a.image,onLoad:function(){f(o.current.naturalWidth/o.current.naturalHeight),d(!0)},onError:function(){console.error("failed to load image from url",i)}})))},Hv=function(e){var n=e.classNames,a=void 0===n?{}:n,r=e.text,i=e.imageUrl,o=t.useRef(null),s=t.useState(!1),l=s[0],d=s[1],c=t.useState(0),f=c[1];return u.default.createElement(Zv,{className:a.container,style:{aspectRatio:c[0],opacity:l?1:0}},u.default.createElement(Qv,{className:a.text},u.default.createElement(Yv,{className:a.spinner,$size:24,$color:"white",$thickness:3}),r),u.default.createElement(Xv,{className:a.imageContainer},u.default.createElement("img",{ref:o,src:i,alt:"",className:a.image,onLoad:function(){f(o.current.naturalWidth/o.current.naturalHeight),d(!0)},onError:function(){console.error("failed to load image from url",i)}})))},Yv=h.default(Vv)(mv||(mv=w(["\n position: relative;\n top: 4px;\n left: -3px;\n margin: 0 3px 0 -12px;\n"],["\n position: relative;\n top: 4px;\n left: -3px;\n margin: 0 3px 0 -12px;\n"]))),Zv=h.default.div(gv||(gv=w(["\n position: absolute;\n display: flex;\n flex-direction: column;\n height: 33%;\n bottom: 12px;\n right: 12px;\n"],["\n position: absolute;\n display: flex;\n flex-direction: column;\n height: 33%;\n bottom: 12px;\n right: 12px;\n"]))),Qv=h.default.div(vv||(vv=w(["\n display: block;\n position: absolute;\n top: -32px;\n font:\n 14px -apple-system,\n BlinkMacSystemFont,\n 'Segoe UI',\n Roboto,\n Helvetica,\n Arial,\n sans-serif,\n 'Apple Color Emoji',\n 'Segoe UI Emoji',\n 'Segoe UI Symbol';\n color: white;\n text-align: center;\n margin: 0 auto;\n width: 100%;\n"],["\n display: block;\n position: absolute;\n top: -32px;\n font:\n 14px -apple-system,\n BlinkMacSystemFont,\n 'Segoe UI',\n Roboto,\n Helvetica,\n Arial,\n sans-serif,\n 'Apple Color Emoji',\n 'Segoe UI Emoji',\n 'Segoe UI Symbol';\n color: white;\n text-align: center;\n margin: 0 auto;\n width: 100%;\n"]))),Xv=h.default.div(yv||(yv=w(["\n position: relative;\n height: calc(100% - 8px);\n padding: 4px;\n border-radius: 4px;\n background: white;\n\n & > img {\n border-radius: 4px;\n width: auto;\n max-height: 100%;\n }\n"],["\n position: relative;\n height: calc(100% - 8px);\n padding: 4px;\n border-radius: 4px;\n background: white;\n\n & > img {\n border-radius: 4px;\n width: auto;\n max-height: 100%;\n }\n"]))),Kv={documents:[],currentDocumentIndex:0,initialDrawComplete:!1,redrawing:!1,capturing:!1,rectX:0,rectY:0,rectWidth:0,rectHeight:0,rectOffsetTop:0,uploadCapturedDocument:function(){return Promise.resolve()}},Jv=t.createContext(Kv),ey=t.createContext((function(){})),ty=function(e,t){var n,a,r,i,o;switch(t.type){case"setDocuments":return v(v({},e),{documents:t.payload,currentDocumentIndex:0});case"setHooks":return v(v({},e),t.payload);case"redrawRequested":return v(v({},e),{redrawing:!0,rectX:0,rectY:0,rectWidth:0,rectHeight:0,rectOffsetTop:0});case"redrawInProgress":return v(v({},e),{redrawing:!1,rectX:0,rectY:0,rectWidth:0,rectHeight:0,rectOffsetTop:0});case"redrawCompleted":return v(v(v({},e),t.payload),{initialDrawComplete:!0});case"captureRequested":return v(v({},e),{capturing:!0});case"captureCompleted":return(s=v(v({},e),{capturing:!1})).documents[l=e.currentDocumentIndex].content=t.payload.content,s.documents[l].contentUrl=t.payload.contentUrl,null===(n=e.onDocumentCaptured)||void 0===n||n.call(e,s.documents[l]),s;case"retryCapture":return(s=v({},e)).documents[l=e.currentDocumentIndex].content=void 0,s.documents[l].contentUrl=void 0,s;case"uploadStarted":return(s=v({},e)).documents[l=e.currentDocumentIndex].uploadState="in_progress",s;case"uploadCompleted":return(s=v({},e)).documents[l=e.currentDocumentIndex].documentId=t.payload.documentId,s.documents[l].uploadState="succeeded",null===(r=(a=s.documents[l]).onUploaded)||void 0===r||r.call(a,s.documents[l]),null===(i=e.onDocumentUploaded)||void 0===i||i.call(e,s.documents[l]),e.documents.length-1>l?s.currentDocumentIndex+=1:null===(o=e.onAllDocumentsUploaded)||void 0===o||o.call(e,s.documents),s;case"uploadFailed":var s,l;return(s=v({},e)).documents[l=e.currentDocumentIndex].uploadState="failed",s;default:return e}},ny=function(e){var n=e.documents,a=void 0===n?[]:n,r=e.aspectRatio,i=e.cameraFeedMode,o=e.instructions,s=e.onDocumentCaptured,l=e.onDocumentUploaded,d=e.onAllDocumentsUploaded,c=e.children,f=t.useReducer(ty,Kv),h=f[0],p=f[1],m=t.useContext(Xe),g=m.cameraRef,y=m.videoRef,C=t.useContext(Ie).uploadDocument,w=t.useCallback((function(e){return b(void 0,void 0,void 0,(function(){var t;return x(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),p({type:"uploadStarted"}),[4,C(e)];case 1:return t=n.sent(),setTimeout((function(){p({type:"uploadCompleted",payload:{documentId:t}})}),0),[3,3];case 2:return n.sent(),p({type:"uploadFailed"}),[3,3];case 3:return[2]}}))}))}),[C]);t.useEffect((function(){var e,t=(null==a?void 0:a.length)?a.map((function(e){return v(v({title:"Document Capture",aspectRatio:r,cameraFeedMode:"snapToGuides",instructions:o},e),{uploadState:"not_started"})})):[{title:"Document Capture",aspectRatio:r,cameraFeedMode:null!=i?i:"snapToGuides",instructions:o,uploadState:"not_started"}];p({type:"setDocuments",payload:t}),(null===(e=t[0])||void 0===e?void 0:e.content)&&w(t[0].content)}),[r,i,a,o,w]),t.useEffect((function(){p({type:"setHooks",payload:{onDocumentCaptured:s,onDocumentUploaded:l,onAllDocumentsUploaded:d}})}),[s,d,l]);var E=yh((function(){p({type:"redrawRequested"})}),500);t.useLayoutEffect((function(){if("undefined"!=typeof window)return window.addEventListener("resize",E),function(){window.removeEventListener("resize",E)}}),[E]);var k=y.current;t.useEffect((function(){if(h.capturing&&g.current)if("undefined"!=typeof ImageCapture)new ImageCapture(g.current.stream.getTracks()[0]).takePhoto().then(t).catch((function(){}));else if(k){var e=document.createElement("canvas");Ue(e,k),e.toBlob(t)}function t(e){if(e){var t=URL.createObjectURL(e);p({type:"captureCompleted",payload:{content:e,contentUrl:t}})}}}),[g,h.capturing,k]);var T=t.useMemo((function(){return v(v({},h),{uploadCapturedDocument:w})}),[h,w]);return u.default.createElement(Jv.Provider,{value:T},u.default.createElement(ey.Provider,{value:p},c))},ay=function(){var e=t.useContext(Jv),n=t.useContext(ey);if(!e||!n)throw new Error("useDocumentCaptureState cannot be used without DocumentCaptureStateProvider");return[e,n]},ry=function(e){var n,a,i,o,s,l,d,c,f,h=e.aspectRatio,p=e.borderRadius,m=void 0===p?25:p,g=e.borderColor,v=e.borderWidth,y=e.maskColor,b=e.padding,x=e.classNames,C=void 0===x?{}:x,w=Le(),E=w.ref,k=w.width,T=void 0===k?1:k,M=w.height,I=void 0===M?1:M,S=ay(),D=S[0].redrawing,N=S[1],A=t.useRef(null),L=r.useTheme();return void 0===v&&(v=null!==(i=null===(a=null===(n=L.documentCapture)||void 0===n?void 0:n.guideBox)||void 0===a?void 0:a.borderWidth)&&void 0!==i?i:4),void 0===b&&(b=En()?null!==(l=null===(s=null===(o=L.documentCapture)||void 0===o?void 0:o.guideBox)||void 0===s?void 0:s.mobilePadding)&&void 0!==l?l:0:null!==(f=null===(c=null===(d=L.documentCapture)||void 0===d?void 0:d.guideBox)||void 0===c?void 0:c.desktopPadding)&&void 0!==f?f:0),t.useEffect((function(){var e=A.current;if(e){if(D)return jg(e),void setTimeout((function(){N({type:"redrawInProgress"})}),10);var t=T-2*b-2*v,n=I-2*b-2*v,a=[b+v,b+v,t,n],r=a[0],i=a[1],o=a[2],s=a[3];if(void 0!==h){var l=n*h;l<t?r+=(t-(o=l))/2:i+=(n-(s=t/h))/2}Fg(e,T,I);var u=e.getContext("2d");if(u)u.fillStyle=y,u.clearRect(0,0,T,I),u.fillRect(0,0,T,I),u.beginPath(),u.roundRect(r,i,o,s,m),u.lineWidth=v,u.strokeStyle=null!=g?g:"white",u.stroke(),u.fillStyle="rgba(0,0,0,1)",u.globalCompositeOperation="destination-out",u.fill(),u.globalCompositeOperation="source-over",N({type:"redrawCompleted",payload:{rectX:r,rectY:i,rectWidth:o,rectHeight:s,rectOffsetTop:e.offsetTop}})}}),[h,g,m,v,N,y,b,D,I,T]),u.default.createElement(iy,{ref:E,className:C.container,$maskColor:y},u.default.createElement(oy,{ref:A}))},iy=h.default.div(bv||(bv=w(["\n flex-grow: 1;\n background-clip: padding-box;\n box-shadow: inset 0 0 0 2px ",";\n"],["\n flex-grow: 1;\n background-clip: padding-box;\n box-shadow: inset 0 0 0 2px ",";\n"])),(function(e){return e.$maskColor})),oy=h.default.canvas(xv||(xv=w(["\n display: block;\n"],["\n display: block;\n"]))),sy=function(e){var n,a,i,o,s,l=e.onCaptureClicked,d=e.classNames,c=void 0===d?{}:d,f=e.verbiage,h=void 0===f?{}:f,p=ay(),m=p[0],g=m.rectX,v=m.rectY,y=m.rectWidth,C=m.rectHeight,w=m.rectOffsetTop,E=m.capturing,k=m.uploadCapturedDocument,T=p[1],M=null!==(n=m.documents[m.currentDocumentIndex])&&void 0!==n?n:{},I=M.title,S=M.aspectRatio,D=M.cameraFeedMode,N=M.instructions,A=M.contentUrl,L=M.content,R=M.uploadState,O=t.useContext(Xe),F=O.cameraReady,j=O.cameraAccessDenied,P=O.retryCameraAccess,_=null!==(o=null===(i=null===(a=r.useTheme().documentCapture)||void 0===a?void 0:a.guideBox)||void 0===i?void 0:i.maskColor)&&void 0!==o?o:"snapToGuides"===D?"#708090":"rgba(0, 0, 0, 0.5)",U=Xp(h,{headingText:I,loadingBtnText:"Camera initializing...",retryCameraAccessBtnText:"Retry",captureBtnText:"Capture",capturingBtnText:"Capturing...",retryCaptureBtnText:"Retry capture",uploadBtnText:"Upload",uploadingBtnText:"Uploading...",retryUploadBtnText:"Retry",successBtnText:"Upload succeeded!"});function z(){return b(this,void 0,void 0,(function(){return x(this,(function(e){switch(e.label){case 0:return[4,k(L)];case 1:return e.sent(),[2]}}))}))}return u.default.createElement(B,{className:"flex ".concat(null!==(s=c.container)&&void 0!==s?s:"")},u.default.createElement(Og,{className:c.cameraFeedWrapper,$mode:null!=D?D:"snapToGuides",$x:g,$y:v+w,$w:y,$h:C},A?u.default.createElement(py,{alt:"",src:A,className:c.previewImage}):u.default.createElement(Ng,{className:c.cameraFeed})),u.default.createElement(ly,{className:c.captureContainer},u.default.createElement(uy,{$maskColor:_,className:c.headingRow},u.default.createElement(dy,{className:c.heading},U.headingText)),u.default.createElement(ry,{aspectRatio:S,classNames:c,maskColor:_}),u.default.createElement(cy,{$maskColor:_,className:c.footerRow},N&&u.default.createElement(fy,{className:c.instructions},N),u.default.createElement(hy,{className:c.buttonsRow},j?u.default.createElement(ce,{className:c.retryCameraAccessBtn,variant:"negative",finished:!0,onClick:P},U.retryCameraAccessBtnText):A?u.default.createElement(u.default.Fragment,null,"not_started"===R?u.default.createElement(u.default.Fragment,null,u.default.createElement(ce,{className:c.retryCaptureBtn,finished:!0,variant:"warning",onClick:function(){T({type:"retryCapture"})}},U.retryCaptureBtnText),u.default.createElement(ce,{className:c.uploadBtn,finished:!0,variant:"positive",onClick:z},U.uploadBtnText)):u.default.createElement(ce,{className:c.uploadProgressBtn,finished:"in_progress"!==R,variant:"failed"===R?"negative":"positive",onClick:z,disabled:["in_progress","succeeded"].includes(null!=R?R:"")},"succeeded"===R?U.successBtnText:"failed"===R?U.retryUploadBtnText:U.uploadingBtnText)):u.default.createElement(ce,{className:c.captureBtn,finished:F,variant:"primary",onClick:function(){T({type:"captureRequested"}),null==l||l()},disabled:!F||E},F?E?U.capturingBtnText:U.captureBtnText:U.loadingBtnText)))))},ly=h.default.div(Cv||(Cv=w(["\n display: flex;\n flex-direction: column;\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: var(--app-height);\n"],["\n display: flex;\n flex-direction: column;\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: var(--app-height);\n"]))),uy=h.default.div(wv||(wv=w(["\n background: ",";\n text-align: center;\n color: white;\n"],["\n background: ",";\n text-align: center;\n color: white;\n"])),(function(e){return e.$maskColor})),dy=h.default.h1(Ev||(Ev=w(["\n font-size: 22px;\n"],["\n font-size: 22px;\n"]))),cy=h.default.div(kv||(kv=w(["\n background: ",";\n display: flex;\n flex-direction: column;\n justify-content: center;\n padding: 0 20px 20px;\n height: auto;\n color: white;\n"],["\n background: ",";\n display: flex;\n flex-direction: column;\n justify-content: center;\n padding: 0 20px 20px;\n height: auto;\n color: white;\n"])),(function(e){return e.$maskColor})),fy=h.default.div(Tv||(Tv=w(["\n max-height: ",";\n overflow-y: auto;\n"],["\n max-height: ",";\n overflow-y: auto;\n"])),(function(e){var t,n,a;return null!==(a=null===(n=null===(t=e.theme.documentCapture)||void 0===t?void 0:t.instructions)||void 0===n?void 0:n.maxHeight)&&void 0!==a?a:"8rem"})),hy=h.default(ym)(Mv||(Mv=w(["\n padding-top: 20px;\n"],["\n padding-top: 20px;\n"]))),py=h.default.img(Iv||(Iv=w(["\n width: 100%;\n height: 100%;\n object-fit: cover;\n"],["\n width: 100%;\n height: 100%;\n object-fit: cover;\n"]))),my=function(e){var t=e.documents,n=e.classNames,a=e.verbiage;return u.default.createElement(ny,{documents:void 0===t?[]:t,aspectRatio:e.aspectRatio,cameraFeedMode:e.cameraFeedMode,instructions:e.instructions,onDocumentCaptured:e.onDocumentCaptured,onDocumentUploaded:e.onDocumentUploaded,onAllDocumentsUploaded:e.onSuccess},u.default.createElement(sy,{classNames:void 0===n?{}:n,verbiage:void 0===a?{}:a}))},gy=function(e){var n=e.idCaptureRequirement,a=void 0===n?"idCardOrPassport":n,r=e.onCapture,i=e.onFinished,o=e.classNames,s=void 0===o?{}:o,l=e.colors,d=void 0===l?{}:l,c=e.verbiage,f=void 0===c?{}:c,h=t.useRef(null),p=t.useState([]),m=p[0],g=p[1],v=function(e){return"idCardOrPassport"===e?2:Ch(e)}(a),y=Ch(a),b="idCard"===a?"ID card":"passport"===a?"passport":"idCardOrPassport"===a?"ID card or passport":"ID card and passport",x="idCard"===a||"idCardAndPassport"===a?"Please capture the front of your ID card.":"passport"===a?"Please capture the ID page of your passport.":"Please capture the front of your ID card, or the ID page of your passport.",w="idCardOrPassport"===a?"Please capture the back of your ID card, or click Done if submitting a passport.":"Please capture the back of your ID card.",E=Xp(f,{headingText:"We're having some trouble.",descriptionText:"On-device capture guidance failed, please capture ".concat(y>1?"photos":" a photo"," of your ").concat(b," manually."),firstInstructionText:x,secondInstructionText:w,thirdInstructionText:"Please capture the ID page of your passport.",captureBtnText:"Capture",captureMoreBtnText:"Capture ".concat(2===m.length?"ID page of passport":"back of ID card"),doneBtnText:"Done"});var k=0===m.length?E.firstInstructionText:1===m.length?E.secondInstructionText:E.thirdInstructionText;console.log({imagesLength:m.length,instructionText:k,idCaptureRequirement:a,requiredImageCount:y});var T=t.useState(),M=T[0],I=T[1];return M?u.default.createElement(my,{documents:[{title:M}],onDocumentCaptured:function(e){var t=e.contentUrl;g((function(e){return C(C([],e,!0),[t],!1)})),null==r||r(t),I(void 0)}}):u.default.createElement(u.default.Fragment,null,u.default.createElement(W,{className:s.container},u.default.createElement(vy,{className:s.inner},u.default.createElement(yy,{className:s.heading},E.headingText),u.default.createElement(by,{className:s.description},E.descriptionText),m.length>0&&u.default.createElement(q,{className:s.imageContainer},m.map((function(e,t){return u.default.createElement(Cy,{key:t,className:s.imageCol},u.default.createElement("img",{src:e,alt:"",className:s.image}))}))),m.length<y&&u.default.createElement(xy,{className:s.instruction},k),u.default.createElement("input",{ref:h,type:"file",accept:"image/*",capture:"environment",onChange:function(e){var t,n=null===(t=e.target.files)||void 0===t?void 0:t[0];if(n){var a=new FileReader;a.addEventListener("load",(function(e){var t,n=null===(t=e.target)||void 0===t?void 0:t.result;g((function(e){return C(C([],e,!0),[n],!1)})),null==r||r(n)})),a.readAsDataURL(n)}},hidden:!0}),u.default.createElement(wy,{className:s.buttonsRow},m.length<v&&u.default.createElement(ce,{variant:m.length>0?"secondary":"positive",className:m.length>0?s.captureMoreBtn:s.captureBtn,colors:m.length>0?d.captureMoreBtn:d.captureBtn,finished:!0,onClick:function(){var e;En()?null===(e=h.current)||void 0===e||e.click():I(k)}},m.length>0?E.captureMoreBtnText:E.captureBtnText),m.length>=y&&u.default.createElement(ce,{variant:"positive",className:s.doneBtn,colors:d.doneBtn,finished:!0,onClick:function(){null==i||i(m)}},E.doneBtnText)))))},vy=h.default($)(Sv||(Sv=w(["\n justify-content: center;\n"],["\n justify-content: center;\n"]))),yy=h.default.h3(Dv||(Dv=w(["\n margin-bottom: 8px;\n"],["\n margin-bottom: 8px;\n"]))),by=h.default.p(Nv||(Nv=w(["\n margin-bottom: 8px;\n"],["\n margin-bottom: 8px;\n"]))),xy=h.default.p(Av||(Av=w(["\n font-weight: bold;\n"],["\n font-weight: bold;\n"]))),Cy=h.default.div(Lv||(Lv=w(["\n display: flex;\n justify-content: center;\n flex-grow: 1;\n flex-basis: 0;\n"],["\n display: flex;\n justify-content: center;\n flex-grow: 1;\n flex-basis: 0;\n"]))),wy=h.default(ym)(Rv||(Rv=w(["\n margin-top: 32px;\n"],["\n margin-top: 32px;\n"]))),Ey=function(e){var n,a,i,o,s,l,d,c,f,h,p,m,g,v,y,b,x=e.onSuccess,C=e.onExitCapture,w=e.onUserCancel,E=e.loadingOverlayMode,T=void 0===E?"default":E,M=e.precapturedDocuments,I=e.captureRequirement,D=void 0===I?"idCardOrPassport":I,N=e.autoCaptureEnabled,A=void 0===N||N,L=e.autoCaptureGoodFramesRequired,R=void 0===L?3:L,O=e.autoCaptureBarcodeRequired,F=void 0===O?"mobile":O,j=e.barcodeScanningEnabled,P=void 0!==j&&j,_=e.idCardAutoCaptureScoreThreshold,U=void 0===_?.8:_,z=e.passportAutoCaptureScoreThreshold,G=void 0===z?.75:z,W=e.mrzDetectionScoreThreshold,$=void 0===W?.25:W,V=e.idCardFocusScoreThreshold,q=void 0===V?.3:V,H=e.passportFocusScoreThreshold,Y=void 0===H?.3:H,Z=e.skipSuccessScreen,Q=void 0!==Z&&Z,X=e.instructions,K=e.releaseCameraAccessOnExit,J=void 0===K||K,ee=e.guideType,te=void 0===ee?"fit":ee,ne=e.portraitGuidesOnMobile,ae=void 0!==ne&&ne,re=e.rotateLoadingOverlayImageWhenPortrait,ie=void 0===re||re,oe=e.assets,se=void 0===oe?{}:oe,le=e.classNames,ue=void 0===le?{}:le,de=e.colors,ce=void 0===de?{}:de,fe=e.verbiage,he=void 0===fe?{}:fe,pe=e.debugMode,me=void 0!==pe&&pe,ge=Ih(),ve=ge[0],ye=ge[1],be=t.useContext(Xe).releaseCameraAccess,xe=t.useState(!1),Ce=xe[0],we=xe[1],Ee=t.useContext(Ie),ke=Ee.submissionStatus,Te=Ee.setIdFrontImage,Me=Ee.setIdBackImage,Se=Ee.setPassportImage,De=Ee.logIdFrontCaptureAttempt,Ne=Ee.logIdBackCaptureAttempt,Ae=t.useContext(uh).modelError,Le=t.useRef();t.useEffect((function(){ye({type:"configureWizard",payload:{captureRequirement:D,precapturedDocuments:M}})}),[D,ye,M]);var Re=Object.keys(ve.capturedDocuments).length;t.useEffect((function(){Le.current=new Date}),[Re]);var Oe=t.useCallback((function(e){var t;e.operationTime=(new Date).getTime()-(null!==(t=Le.current)&&void 0!==t?t:new Date).getTime(),"idCardBack"===ve.requestedDocumentType?Ne(e):De(e)}),[Ne,De,ve.requestedDocumentType]),Fe=t.useCallback((function(e){ye({type:"predictionMade",payload:e})}),[ye]),je=t.useCallback((function(e,t,n,a){Oe(a),ye({type:"documentCaptured",payload:{imageData:e,width:t,height:n,boundingBox:a.boundingBox}})}),[ye,Oe]),Pe=t.useCallback((function(){var e=ve.capturedDocuments,t=e.idCardFront,n=e.idCardBack,a=e.passport,r=t&&S(t.imageData),i=n&&S(n.imageData),o=a&&S(a.imageData);r&&Te(r),i&&Me(i),o&&Se(o),J&&be(),setTimeout((function(){null==x||x({idFrontImage:r,idBackImage:i,passportImage:o})}),0)}),[x,be,J,Me,Te,Se,ve.capturedDocuments]),Be=Lg(Q,"complete"===ve.captureState,Pe),_e=t.useCallback((function(){ye({type:"resetWizard"})}),[ye]),Ue=t.useState(0),ze=Ue[0],Ge=Ue[1],We=t.useCallback((function(){we(!1),Ge((function(e){return e+1})),ye({type:"resetWizard"}),null==C||C()}),[ye,C]);t.useEffect((function(){ke!==k.READY&&J&&be()}),[be,J,ke]),se.idCardFront||(se.idCardFront={}),(d=se.idCardFront).portraitGuidesImageUrl||(d.portraitGuidesImageUrl="".concat(Ra,"/Shieldout-IDCard-Front-SVG-Portrait-2.svg")),(c=se.idCardFront).landscapeGuidesImageUrl||(c.landscapeGuidesImageUrl="".concat(Ra,"/Shieldout-IDCard-Front-SVG-Landscape-2.svg")),se.idCardBack||(se.idCardBack={}),(f=se.idCardBack).portraitGuidesImageUrl||(f.portraitGuidesImageUrl="".concat(Ra,"/Shieldout-IDCard-Back-SVG-Portrait-2.svg")),(h=se.idCardBack).landscapeGuidesImageUrl||(h.landscapeGuidesImageUrl="".concat(Ra,"/Shieldout-IDCard-Back-SVG-Landscape-2.svg")),se.passport||(se.passport={}),(p=se.passport).portraitGuidesImageUrl||(p.portraitGuidesImageUrl="".concat(Ra,"/Shieldout-Passport-Front-SVG-Portrait-2.svg")),(m=se.passport).landscapeGuidesImageUrl||(m.landscapeGuidesImageUrl="".concat(Ra,"/Shieldout-Passport-Front-SVG-Landscape-2.svg")),se.flipIdPrompt||(se.flipIdPrompt={}),(g=se.flipIdPrompt).frontPortraitGuidesImageUrl||(g.frontPortraitGuidesImageUrl=se.idCardFront.portraitGuidesImageUrl),(v=se.flipIdPrompt).frontLandscapeGuidesImageUrl||(v.frontLandscapeGuidesImageUrl=se.idCardFront.landscapeGuidesImageUrl),(y=se.flipIdPrompt).backPortraitGuidesImageUrl||(y.backPortraitGuidesImageUrl=se.idCardBack.portraitGuidesImageUrl),(b=se.flipIdPrompt).backLandscapeGuidesImageUrl||(b.backLandscapeGuidesImageUrl=se.idCardBack.landscapeGuidesImageUrl);var $e={idCardFront:Xp(he.idCardFront,{instructionText:"Scan the front of ID",processingIdCardText:"ID card front captured."}),idCardBack:Xp(he.idCardBack,{instructionText:"Scan the back of ID"}),passport:Xp(he.passport,{instructionText:"Scan the ID page of passport"})},Ve=r.useTheme(),qe=Ih()[0],He=qe.guideRectX,Ye=qe.guideRectY,Ze=qe.guideRectWidth,Qe=qe.guideRectHeight,Ke=qe.imageUrl,Je=se[ve.requestedDocumentType],et=$e[ve.requestedDocumentType];return t.useEffect((function(){"requestingFlip"===ve.captureState&&setTimeout((function(){ye({type:"flipRequestCompleted"})}),6e3)}),[ye,ve.captureState]),Ae?u.default.createElement(gy,{idCaptureRequirement:D,onFinished:Pe,onCapture:function(e){ye({type:"documentCapturedManually",payload:{imageData:e}})},classNames:ue.fallback,colors:ce.fallback,verbiage:he.fallback}):u.default.createElement(B,{className:"flex ".concat(null!==(n=null==ue?void 0:ue.container)&&void 0!==n?n:"")},"complete"!==ve.captureState&&u.default.createElement(Og,{$x:He,$y:Ye,$w:Ze,$h:Qe,$mode:"fit"===te?"snapToGuides":"fullscreen"},u.default.createElement(Ng,{className:null==ue?void 0:ue.cameraFeed})),Ce&&"requestingFlip"!==ve.captureState&&function(){var e=Re;switch(ve.requestedDocumentType){case"idCardFront":return u.default.createElement(um,{key:"capture".concat(e),requiredDocumentType:ve.requestedDocumentType,autoCaptureEnabled:A,autoCaptureScoreThreshold:U,autoCaptureGoodFramesRequired:R,autoCaptureBarcodeRequired:F,barcodeScanningEnabled:!1,mrzDetectionScoreThreshold:$,focusScoreThreshold:q,onPrediction:Fe,onCapture:je,assets:Je,classNames:null==ue?void 0:ue.capture,colors:ce,verbiage:et,debugMode:me});case"idCardBack":return u.default.createElement(um,{key:"capture".concat(e),requiredDocumentType:ve.requestedDocumentType,autoCaptureEnabled:A,autoCaptureScoreThreshold:U,autoCaptureGoodFramesRequired:R,autoCaptureBarcodeRequired:F,barcodeScanningEnabled:P,mrzDetectionScoreThreshold:$,focusScoreThreshold:q,onPrediction:Fe,onCapture:je,assets:Je,classNames:null==ue?void 0:ue.capture,colors:ce,verbiage:et,debugMode:me});case"passport":return u.default.createElement(um,{key:"capture".concat(e),requiredDocumentType:ve.requestedDocumentType,autoCaptureEnabled:A,autoCaptureScoreThreshold:G,mrzDetectionScoreThreshold:$,autoCaptureGoodFramesRequired:R,autoCaptureBarcodeRequired:F,barcodeScanningEnabled:!1,focusScoreThreshold:Y,onPrediction:Fe,onCapture:je,assets:Je,classNames:null==ue?void 0:ue.capture,colors:ce,verbiage:et,debugMode:me});default:return null}}(),u.default.createElement(hv,{guideType:te,portraitGuidesOnMobile:ae,requestingFlip:"requestingFlip"===ve.captureState,flipIdPromptAssets:null==se?void 0:se.flipIdPrompt,classNames:ue,assets:Je,colors:ce,verbiage:et}),!(null===(i=null===(a=Ve.idCapture)||void 0===a?void 0:a.capturePreview)||void 0===i?void 0:i.disabled)&&"requestingFlip"===ve.captureState&&Ke&&u.default.createElement(qv,{classNames:null===(o=ue.capture)||void 0===o?void 0:o.imagePreview,text:null===(s=null==$e?void 0:$e.idCardFront)||void 0===s?void 0:s.processingIdCardText,imageUrl:Ke}),"complete"!==ve.captureState&&u.default.createElement("div",{id:"idmission-above-guides-content"}),u.default.createElement(vm,{onClick:We,className:null===(l=ue.capture)||void 0===l?void 0:l.exitCaptureBtn}),!Ce&&u.default.createElement(bg,{key:ze,mode:T,instructions:X,assets:se.loadingOverlay,classNames:ue.loadingOverlay,colors:ce.loadingOverlay,verbiage:he.loadingOverlay,onUserCancel:w,onDismissed:function(){we(!0)},rotateImage:ie&&ae&&window.innerWidth<window.innerHeight}),"complete"===ve.captureState&&Be&&u.default.createElement(wg,{capturedDocuments:ve.capturedDocuments,barcodeResult:ve.barcodeResult,classNames:ue.success,onSubmitClick:Pe,onRetryClick:_e,colors:ce.success,verbiage:he.success}))},ky=h.default.div(Ov||(Ov=w(["\n position: absolute;\n z-index: 1000;\n width: 100%;\n height: 100%;\n display: flex;\n"],["\n position: absolute;\n z-index: 1000;\n width: 100%;\n height: 100%;\n display: flex;\n"]))),Ty=h.default.div(Fv||(Fv=w(["\n border-width: ","px;\n border-color: ",";\n border-style: solid;\n border-radius: 50%;\n aspect-ratio: 1 / 1.618;\n height: 50%;\n margin: auto;\n"],["\n border-width: ","px;\n border-color: ",";\n border-style: solid;\n border-radius: 50%;\n aspect-ratio: 1 / 1.618;\n height: 50%;\n margin: auto;\n"])),(function(e){return e.$borderWidth}),(function(e){var t,n,a,r;return null!==(r=null!==(t=e.$borderColor)&&void 0!==t?t:null===(a=null===(n=e.theme.selfieCapture)||void 0===n?void 0:n.guides)||void 0===a?void 0:a["".concat(e.$variant,"Color")])&&void 0!==r?r:"white"})),My=function(e){var t=e.classNames,n=void 0===t?{}:t,a=e.variant,r=e.borderWidth;return u.default.createElement(ky,{className:n.container},u.default.createElement(Ty,{className:n.oval,$variant:void 0===a?"unsatisfied":a,$borderWidth:void 0===r?3:r,$borderColor:e.borderColor}))},Iy=function(e,n,a,r,i){void 0===i&&(i=!0);var o=t.useState(!1),s=o[0],l=o[1],u=t.useState(),d=u[0],c=u[1];return t.useEffect((function(){if(e&&i){c(new Date);var t=setTimeout((function(){l(!0)}),e);return function(){t&&clearTimeout(t)}}}),[e,i]),t.useEffect((function(){if(s&&!a){if(r){var e=setTimeout((function(){null==n||n()}),12e4);return function(){clearTimeout(e)}}null==n||n()}}),[n,r,s,a]),{timedOut:s,timeoutStartedAt:d}},Sy=function(e){var n=e.onFinished,a=e.onCapture,r=e.classNames,i=void 0===r?{}:r,o=e.colors,s=void 0===o?{}:o,l=e.verbiage,d=void 0===l?{}:l,c=t.useState(null),f=c[0],h=c[1],p=t.useRef(null),m=t.useState(!1),g=m[0],v=m[1],y=t.useState(!1),b=y[0],x=y[1],C=Xp(d,{headingText:"We're having some trouble.",descriptionText:"On-device capture guidance failed, please capture a selfie manually.",captureBtnText:"Capture",doneBtnText:"Done",doneBtnLoadingText:"Verifying..."});return b?u.default.createElement(my,{documents:[{title:C.descriptionText}],onDocumentCaptured:function(e){var t=e.contentUrl;h(t),null==a||a(t),x(!1)}}):u.default.createElement(W,{className:i.container},u.default.createElement(Dy,{className:i.inner},u.default.createElement(Ny,{className:i.heading},C.headingText),u.default.createElement(Ay,{className:i.description},C.descriptionText),f&&u.default.createElement(Ly,{className:i.imageContainer},u.default.createElement("img",{src:f,alt:"",className:i.image})),u.default.createElement("input",{ref:p,type:"file",accept:"image/*",capture:"user",onChange:function(e){var t,n=null===(t=e.target.files)||void 0===t?void 0:t[0];if(n){var r=new FileReader;r.addEventListener("load",(function(e){var t,n=null===(t=e.target)||void 0===t?void 0:t.result;h(n),null==a||a(n)})),r.readAsDataURL(n)}},hidden:!0}),u.default.createElement(Ry,{className:i.buttonsRow},!f&&u.default.createElement(ce,{variant:"positive",className:i.captureBtn,colors:s.captureBtn,finished:!0,onClick:function(){var e;En()?null===(e=p.current)||void 0===e||e.click():x(!0)}},C.captureBtnText),f&&u.default.createElement(ce,{variant:"positive",key:g?"loading-btn":"ready-btn",className:i.doneBtn,colors:s.doneBtn,finished:!g,onClick:function(){v(!0),null==n||n(f)}},g?C.doneBtnLoadingText:C.doneBtnText))))},Dy=h.default($)(jv||(jv=w(["\n justify-content: center;\n"],["\n justify-content: center;\n"]))),Ny=h.default.h3(Pv||(Pv=w(["\n margin-bottom: 8px;\n"],["\n margin-bottom: 8px;\n"]))),Ay=h.default.p(Bv||(Bv=w(["\n margin-bottom: 8px;\n"],["\n margin-bottom: 8px;\n"]))),Ly=h.default(V)(_v||(_v=w(["\n margin-top: 32px;\n"],["\n margin-top: 32px;\n"]))),Ry=h.default(ym)(Uv||(Uv=w(["\n margin-top: 32px;\n"],["\n margin-top: 32px;\n"]))),Oy={videoWidth:0,videoHeight:0,capturing:!1,captured:!1,captureFailed:!1,frame:null,faces:[],faceNotCentered:!1,faceLookingAway:!1,faceTooClose:!1,faceTooFar:!1,faceReady:!1,faceReadyAt:null,goodFramesCount:0,goodFramesThreshold:1,goodFramesThresholdMet:!1},Fy=function(e,t){switch(t.type){case"configure":return v(v({},e),{videoWidth:t.payload.videoWidth,videoHeight:t.payload.videoHeight});case"capturing":return v(v({},e),{capturing:!0,captured:!1,captureFailed:!1});case"captured":return v(v({},e),{capturing:!1,captured:!0,captureFailed:!1});case"captureFailed":return v(v({},e),{capturing:!1,captured:!1,captureFailed:!0});case"facesDetected":var n=t.payload.faces,a=n[0],r=!0,i=!1,o=!1,s=!1,l=e.faceReadyAt,u=e.goodFramesCount;if(a){var d=e.videoHeight/2,c=(a.box.xMin+a.box.xMax)/2,f=(a.box.yMin+a.box.yMax)/2,h=.125*e.videoWidth,p=.125*e.videoHeight,m=.2*a.box.width,g=.2*a.box.height,y=a.keypoints[2];y&&(r=Math.abs(e.videoWidth/2-c)>h||Math.abs(d+50-f)>p,i=Math.abs(c-y.x)>m||Math.abs(f-y.y)>g);var b=e.videoWidth<e.videoHeight;o=a.box.width>e.videoWidth/(b?2:4.5),s=a.box.width<e.videoWidth/(b?6:7)}var x=!(r||i||o||s);return x?e.faceReady||(l=new Date):(l=null,u=0),v(v({},e),{faces:n,faceNotCentered:r,faceLookingAway:i,faceTooClose:o,faceTooFar:s,faceReady:x,faceReadyAt:l,goodFramesCount:u})}},jy=function(e){var n,a=e.onGuidanceSatisfied,r=e.onGuidanceNotSatisfied,i=e.onSelfieCaptured,o=e.onTimeout,s=e.onExit,l=e.timeoutDurationMs,d=void 0===l?15e3:l,c=e.guidanceMessage,f=e.guidanceSatisfied,h=e.classNames,p=void 0===h?{}:h,m=e.colors,g=void 0===m?{}:m,v=e.verbiage,y=void 0===v?{}:v,C=e.debugMode,w=void 0!==C&&C,E=Le(),k=E.ref,T=E.width,M=void 0===T?1:T,I=E.height,S=void 0===I?1:I,D=t.useReducer(Fy,Oy),N=D[0],A=D[1],L=t.useRef(null),R=t.useContext(Xe),O=R.cameraRef,F=R.cameraReady,j=R.videoRef,P=t.useContext(Qf),_=P.onPredictionMade,U=P.error;t.useEffect((function(){F&&j.current&&0!==j.current.videoWidth&&A({type:"configure",payload:{videoWidth:j.current.videoWidth,videoHeight:j.current.videoHeight}})}),[F,j]),t.useEffect((function(){_((function(e){A({type:"facesDetected",payload:{faces:e}})}))}),[_]);var z=t.useState(!1),G=z[0],W=z[1];t.useEffect((function(){var e;return N.faceReady?(null==a||a(),e=setTimeout((function(){W(!0)}),1e3)):null==r||r(),function(){e&&clearTimeout(e)}}),[r,a,N.faceReady]),t.useEffect((function(){b(void 0,void 0,void 0,(function(){var e,t;return x(this,(function(n){if(G&&j.current&&L.current&&N.faces.length>0){if(Ue(L.current,j.current),!(e=L.current.getContext("2d")))return[2];t=e.getImageData(0,0,j.current.videoWidth,j.current.videoHeight),null==i||i(t,N.faces[0]),ze(L.current)}return[2]}))}))}),[G,i,N.faces,j]);var $=Iy(d,o),V=$.timedOut,q=$.timeoutStartedAt,H=Lh({enabled:w,pageWidth:M,pageHeight:S,videoWidth:N.videoWidth,videoHeight:N.videoHeight});g.guidesUnsatisfiedColor||(g.guidesUnsatisfiedColor="white"),g.guidesSatisfiedColor||(g.guidesSatisfiedColor="green");var Y=Xp(y,{guidanceHoldStillText:"Hold still for a few seconds...",guidanceLookStraightText:"Look straight into the camera...",guidanceMoveBackText:"Move back...",guidanceMoveForwardText:"Move forward...",guidanceMoveToCenterText:"Move to the center..."}),Z=N.faceReady;return"boolean"==typeof f&&(Z=f),c||(c=Z?Y.guidanceHoldStillText:N.faceLookingAway?Y.guidanceLookStraightText:N.faceTooClose?Y.guidanceMoveBackText:N.faceTooFar?Y.guidanceMoveForwardText:N.faceNotCentered?Y.guidanceMoveToCenterText:""),U?u.default.createElement(Sy,{classNames:p.fallback}):u.default.createElement(B,{ref:k,className:"flex ".concat(null!==(n=p.container)&&void 0!==n?n:"")},u.default.createElement(_e,{ref:L}),u.default.createElement(My,{classNames:p.guides,variant:Z?"satisfied":"unsatisfied"}),""!==c&&u.default.createElement(sm,{className:p.guidanceMessageContainer},u.default.createElement(lm,{$variant:Z?"positive":"negative",className:p.guidanceMessage},c)),w&&N.faces.length>0&&u.default.createElement(Dh,null,N.faces.map((function(e,t){return u.default.createElement(_h,{key:t,face:e,scaling:H,color:Z?"green":"red"})}))),w&&u.default.createElement(Sh,null,O.current?u.default.createElement(u.default.Fragment,null,"✅ Camera: ",O.current.label," (",O.current.width,"x",O.current.height,")"):"❌ Camera not ready",u.default.createElement("br",null),N.faceNotCentered?"❌":"✅"," Face Centered",u.default.createElement("br",null),N.faceTooClose||N.faceTooFar?"❌":"✅"," Face"," ",N.faceTooClose?"Too Close":N.faceTooFar?"Too Far":"Distance Correct",u.default.createElement("br",null),N.faceLookingAway?"❌":"✅"," Face Looking Forward",u.default.createElement("br",null),N.goodFramesThresholdMet?"✅":"❌"," ",N.goodFramesCount," ","Good Frames",u.default.createElement("br",null),V?"❌":"✅"," Time Remaining:"," ",Math.max(0,d-((new Date).getTime()-(null!=q?q:new Date).getTime())),"ms"),u.default.createElement(vm,{onClick:s,className:p.exitCaptureBtn}))},Py={frame:null,face:null,requestState:"CAPTURING",requestError:null,imageUrl:null,faceLive:!1,eyeCoveringDetected:!1,maskDetected:!1,headCoveringDetected:!1,phoneDetected:!1,timesLivenessCheckFailed:0},By=function(e,t){var n,a;switch(t.type){case"livenessReady":return["CAPTURING","FAILED","ERROR"].includes(e.requestState)?v(v({},e),{requestState:"CAPTURED",frame:t.payload.frame,face:t.payload.face}):e;case"livenessChecking":return v(v({},e),{requestState:"IN_PROGRESS"});case"livenessChecked":var r=t.payload.response,i=r.status,o=i.statusMessage,s=i.errorData,l=r.resultData;if("000"!==i.statusCode)return v(v({},e),{requestState:"ERROR",requestError:new Error("".concat(o,": ").concat(s))});var u="Live Face Detected"===l.verificationResult,d="true"===l.eyeCovering,c="true"===l.faceMask,f="true"===l.headCovering,h="true"===l.cellPhone,p=u&&!d&&!c&&!f,m=p?"PASSED":"FAILED",g=e.timesLivenessCheckFailed;return p?g=0:g+=1,v(v({},e),{frame:null!==(n=t.payload.frame)&&void 0!==n?n:null,face:null!==(a=t.payload.face)&&void 0!==a?a:null,imageUrl:t.payload.imageUrl,requestState:m,faceLive:u,eyeCoveringDetected:d,maskDetected:c,headCoveringDetected:f,phoneDetected:h,timesLivenessCheckFailed:g});case"livenessCheckFailed":return v(v({},e),{requestState:"ERROR",requestError:t.payload.error});default:return e}},_y=function(e){var n,a,i,o=e.onCapture,s=e.onSuccess,l=e.onTimeout,d=e.onExit,c=e.timeoutDurationMs,f=void 0===c?15e3:c,h=e.classNames,p=void 0===h?{}:h,m=e.colors,g=void 0===m?{}:m,v=e.verbiage,y=void 0===v?{}:v,C=e.debugMode,w=t.useContext(Ie),E=w.checkLiveness,k=w.submissionError,T=t.useContext(Qf).error,M=t.useReducer(By,Py),S=M[0],D=M[1],N=t.useState(null),A=N[0],L=N[1],R=t.useRef(null),O=t.useRef(null),F=r.useTheme(),j=t.useCallback((function(e,t){null==o||o(),D({type:"livenessReady",payload:{frame:e,face:t}})}),[o]),P=S.frame,B=S.face,_="CAPTURED"===S.requestState,U="PASSED"===S.requestState;t.useEffect((function(){P&&B&&_&&!k&&(D({type:"livenessChecking"}),b(void 0,void 0,void 0,(function(){var e,t,n,a;return x(this,(function(r){switch(r.label){case 0:return r.trys.push([0,3,,4]),e=Oa(R.current,O.current,P,B),L(e),n=E,[4,I(e)];case 1:return[4,n.apply(void 0,[r.sent()])];case 2:return t=r.sent(),D({type:"livenessChecked",payload:{frame:P,face:B,imageUrl:e,response:t}}),[3,4];case 3:return a=r.sent(),D({type:"livenessCheckFailed",payload:{error:a}}),[3,4];case 4:return[2]}}))})))}),[E,B,P,_,k]);var z=t.useCallback((function(e){return b(void 0,void 0,void 0,(function(){var t,n,a;return x(this,(function(r){switch(r.label){case 0:D({type:"livenessChecking"}),r.label=1;case 1:return r.trys.push([1,4,,5]),n=E,[4,I(e)];case 2:return[4,n.apply(void 0,[r.sent()])];case 3:return t=r.sent(),D({type:"livenessChecked",payload:{imageUrl:e,response:t}}),[3,5];case 4:return a=r.sent(),D({type:"livenessCheckFailed",payload:{error:a}}),[3,5];case 5:return[2]}}))}))}),[E]);t.useEffect((function(){U&&S.imageUrl&&(null==s||s(S.imageUrl))}),[s,S.imageUrl,U]),t.useEffect((function(){S.timesLivenessCheckFailed>=(T?1:2)&&(null==l||l())}),[T,l,S.timesLivenessCheckFailed]),Iy(f,l,"PASSED"===S.requestState||!!T,"IN_PROGRESS"===S.requestState);var G=Xp(y,{guidanceRemoveEyeCoveringsText:"Please remove your eye coverings (sunglasses, eye patch, etc.)...",guidanceRemoveHeadCoveringsText:"Please remove your head coverings (hat, scarf, etc.)...",guidanceRemoveMaskText:"Please remove your mask...",progressPreviewText:"Processing..."}),W=S.eyeCoveringDetected?G.guidanceRemoveEyeCoveringsText:S.headCoveringDetected?G.guidanceRemoveHeadCoveringsText:S.maskDetected?G.guidanceRemoveMaskText:void 0;return T?u.default.createElement(Sy,{onFinished:z}):u.default.createElement(u.default.Fragment,null,u.default.createElement(_e,{ref:R}),u.default.createElement(_e,{ref:O}),u.default.createElement(jy,{onSelfieCaptured:j,onExit:d,timeoutDurationMs:f,guidanceMessage:W,guidanceSatisfied:!W&&void 0,classNames:p,colors:g,verbiage:G,debugMode:C}),!(null===(a=null===(n=F.selfieCapture)||void 0===n?void 0:n.capturePreview)||void 0===a?void 0:a.disabled)&&A&&u.default.createElement(Hv,{classNames:p.imagePreview,imageUrl:A,text:null!==(i=G.progressPreviewText)&&void 0!==i?i:""}))},Uy=function(e){var t=e.imageUrl,n=e.onDoneClick,a=e.onRetryClick,r=e.classNames,i=void 0===r?{}:r,o=e.colors,s=void 0===o?{}:o,l=e.verbiage,d=Xp(void 0===l?{}:l,{headingText:"Face liveness has been verified!",retryBtnText:"Retry",doneBtnText:"Done"});return u.default.createElement(W,{className:i.container},u.default.createElement($,{className:i.inner},u.default.createElement(zy,{className:i.heading},d.headingText),u.default.createElement(V,{className:i.imageContainer},u.default.createElement("img",{alt:d.headingText,src:t,className:i.image})),u.default.createElement(ym,{className:i.buttonsRow},u.default.createElement(ce,{variant:"warning",onClick:a,colors:s.retryBtn,className:i.retryBtn,finished:!0},d.retryBtnText),u.default.createElement(ce,{variant:"positive",onClick:n,colors:s.doneBtn,className:i.doneBtn,finished:!0},d.doneBtnText))))},zy=h.default.h3(zv||(zv=w(["\n margin-bottom: 24px;\n"],["\n margin-bottom: 24px;\n"]))),Gy=function(e){var t=e.canRetry,n=void 0===t||t,a=e.onRetryClick,r=e.onExitClick,i=e.assets,o=void 0===i?{}:i,s=e.classNames,l=void 0===s?{}:s,d=e.colors,c=void 0===d?{}:d,f=e.verbiage,h=void 0===f?{}:f;o.imageUrl||(o.imageUrl="".concat(Ra,"/manual_capture.png"));var p=Xp(h,{headingText:"Live face not detected, please try again",retryBtnText:"Retry",exitBtnText:"Exit"});return u.default.createElement(W,{className:l.container},u.default.createElement($,{className:l.inner},u.default.createElement("h3",{className:l.heading},p.headingText),u.default.createElement(Wy,{className:l.imageContainer},u.default.createElement("img",{alt:p.headingText,src:o.imageUrl,className:l.image})),u.default.createElement(ym,{className:l.buttonsRow},n&&u.default.createElement(ce,{variant:"warning",className:l.retryBtn,onClick:a,colors:c.retryBtn,finished:!0},p.retryBtnText),u.default.createElement(ce,{variant:"secondary",className:l.exitBtn,onClick:r,colors:c.exitBtn,finished:!0},p.exitBtnText))))},Wy=h.default(V)(Gv||(Gv=w(["\n max-height: calc(100vh - 185px);\n margin: 0 24px;\n"],["\n max-height: calc(100vh - 185px);\n margin: 0 24px;\n"]))),$y=h.default(lm)(Wv||(Wv=w(["\n padding: 12px 24px;\n font-weight: normal;\n line-height: 1.5;\n margin-bottom: -30px;\n"],["\n padding: 12px 24px;\n font-weight: normal;\n line-height: 1.5;\n margin-bottom: -30px;\n"]))),Vy=h.default(ym)($v||($v=w(["\n flex-direction: column;\n padding-top: 25px;\n"],["\n flex-direction: column;\n padding-top: 25px;\n"])));function qy(e){var n,a,i,o=e.width,s=void 0===o?840:o,l=e.height,d=void 0===l?740:l,c=e.className,f=t.useState(1),h=f[0],p=f[1];t.useEffect((function(){var e=setInterval((function(){p((function(e){return(e+1)%10}))}),750);return function(){clearInterval(e)}}),[]);var m=null!==(i=null===(a=null===(n=r.useTheme().selfieCapture)||void 0===n?void 0:n.loadingOverlay)||void 0===a?void 0:a.loadingGraphicAccentColor)&&void 0!==i?i:"var(--idm-color-positive-600)";return u.default.createElement("svg",{width:s,height:d,className:c,viewBox:"0 0 840 740",fill:"none",preserveAspectRatio:"xMidYMax slice",xmlns:"http://www.w3.org/2000/svg"},u.default.createElement("g",{clipPath:"url(#clip0_428_1188)"},u.default.createElement("mask",{id:"mask0_428_1188",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"840",height:"740"},u.default.createElement("rect",{width:"840",height:"740",fill:"#D9D9D9"})),u.default.createElement("g",{mask:"url(#mask0_428_1188)"},u.default.createElement("path",{d:"M503.781 449.497C491.561 503.154 458.442 541.609 419.561 541.609C380.68 541.609 347.492 503.015 335.272 449.358L344.645 412.916L347.492 402.019H491.561L502.253 443.667L503.225 447.415L503.781 449.497Z",fill:"#D2D4DA"}),u.default.createElement("path",{d:"M574.88 244.97C647.073 163.885 598.921 362.155 558.945 338.928C488.709 298.211 574.88 244.97 574.88 244.97Z",fill:"#F7A69C"}),u.default.createElement("path",{d:"M816.983 742.838C779.698 781.432 736.86 814.612 689.786 841.127C617.161 882.012 534.399 906.862 446.153 911.027C437.335 911.513 428.448 911.721 419.491 911.721C374.986 911.721 331.731 906.446 290.281 896.519C232.514 882.706 178.358 859.8 129.271 829.397C89.9033 805.033 53.9382 775.948 22 742.838L31.512 705.355C45.8842 649.061 90.2505 605.33 146.837 591.795L153.085 590.337L222.447 573.747L241.401 569.235C249.386 567.292 257.023 564.585 264.244 561.114C270.285 558.199 276.047 554.797 281.463 550.91C287.295 546.745 292.78 542.025 297.71 536.819C310.971 522.867 320.761 505.653 325.76 486.286L333.119 457.688L335.064 449.983L335.202 449.358L344.645 412.916L347.422 402.019H491.491L502.253 443.667L503.225 447.415L503.78 449.497V449.983L505.863 457.757L513.223 486.286C520.097 512.802 535.996 535.5 557.589 550.91C569.393 559.448 582.932 565.765 597.581 569.235L615.078 573.4L692.146 591.795C748.732 605.33 793.099 649.061 807.471 705.355L816.983 742.838Z",fill:"#F7A69C"}),u.default.createElement("path",{d:"M503.781 449.497C491.561 503.154 458.442 541.609 419.561 541.609C380.68 541.609 347.492 503.015 335.272 449.358L344.645 412.916L347.492 402.019H491.561L502.253 443.667L503.225 447.415L503.781 449.497Z",fill:"#DC968D"}),u.default.createElement("path",{d:"M264.123 244.97C191.93 163.885 240.082 362.155 280.058 338.928C350.294 298.211 264.123 244.97 264.123 244.97Z",fill:"#F7A69C"}),u.default.createElement("path",{d:"M586.473 187.324C586.473 193.432 586.126 199.402 585.432 205.371C584.876 210.785 582.446 233.9 578.141 263.331C575.781 279.713 572.726 297.969 569.115 316.294C569.115 316.502 569.115 316.78 568.976 316.988C560.159 361.621 547.731 406.045 531.484 422.219C513.154 440.544 498.435 457.203 481.632 469.211C464.83 481.289 446.014 488.786 419.631 488.786C393.247 488.786 374.431 481.289 357.629 469.211C340.896 457.203 326.107 440.544 307.778 422.219C291.531 405.976 279.103 361.482 270.216 316.918C270.216 316.918 270.216 316.71 270.216 316.641C269.105 310.879 268.063 305.118 267.022 299.426C266.605 297.066 266.189 294.706 265.772 292.346C264.036 282.351 262.509 272.563 261.12 263.401C256.121 229.596 253.691 204.122 253.691 204.122C253.136 198.638 252.858 193.016 252.858 187.324C252.858 185.866 252.858 184.408 252.858 182.951C253.205 169.832 255.01 157.06 258.274 144.843C258.412 144.287 258.551 143.732 258.69 143.177C277.228 75.4294 337.425 24.8271 410.049 20.8011C413.243 20.5928 416.368 20.5234 419.631 20.5234C465.733 20.5234 507.461 39.1956 537.663 69.3904C563.769 95.4205 581.266 130.127 585.501 168.79C586.195 174.899 586.542 181.077 586.542 187.324H586.473Z",fill:"#FEAEA5"}),u.default.createElement("path",{d:"M445.867 337.327C445.867 348.849 434.133 358.151 419.622 358.151C405.111 358.151 393.447 348.849 393.447 337.327C393.447 335.939 393.586 334.55 394.002 333.301C396.293 342.88 406.916 350.099 419.622 350.099C432.328 350.099 443.02 342.88 445.312 333.301C445.728 334.62 445.867 335.939 445.867 337.327Z",fill:"#F7A69C"}),u.default.createElement("path",{d:"M817.053 743.187C716.586 847.238 575.642 912 419.561 912C263.481 912 122.467 847.238 22.0698 743.118L31.5818 705.704C45.954 649.34 90.3203 605.61 146.906 592.074L222.655 574.027L241.471 569.515C249.942 567.502 258.135 564.517 265.772 560.699C304.237 601.653 358.879 627.267 419.561 627.267C480.244 627.267 534.886 601.653 573.351 560.699C580.988 564.448 589.111 567.502 597.651 569.515L614.106 573.471L692.216 592.074C748.802 605.61 793.168 649.34 807.471 705.704L817.053 743.187Z",fill:"#6E7174"}),u.default.createElement("path",{d:"M614.106 573.471C597.165 594.018 534.886 659.058 419.561 663.639C286.671 668.984 226.266 579.441 222.655 574.027L241.471 569.515C249.942 567.502 258.134 564.517 265.772 560.699C304.236 601.653 358.879 627.267 419.561 627.267C480.244 627.267 534.886 601.653 573.35 560.699C580.988 564.448 589.111 567.502 597.651 569.515L614.106 573.471Z",fill:"#555A5E"}),u.default.createElement("path",{d:"M249.898 196.144C249.898 249.777 270.317 315.623 270.317 315.623C270.317 315.623 266.862 205.572 314.892 164.108C347.514 135.946 374.019 167.565 417.115 167.565C456.137 167.565 492.558 136.481 525.436 164.108C578.852 208.994 568.738 315.623 568.738 315.623C568.738 315.623 589.157 250.557 589.157 196.144C589.157 76.4319 542.638 20 417.115 20C302.8 20 249.898 75.8365 249.898 196.144Z",fill:"#525252"})),h>=8?u.default.createElement(u.default.Fragment,null,u.default.createElement("path",{d:"M565.5 295C565.5 350.583 549.016 400.803 522.488 437.067C495.958 473.332 459.517 495.5 419.5 495.5C379.483 495.5 343.042 473.332 316.512 437.067C289.984 400.803 273.5 350.583 273.5 295C273.5 239.417 289.984 189.197 316.512 152.933C343.042 116.668 379.483 94.5 419.5 94.5C459.517 94.5 495.958 116.668 522.488 152.933C549.016 189.197 565.5 239.417 565.5 295Z",stroke:m,strokeWidth:"5"}),u.default.createElement("circle",{cx:"518.5",cy:"438.5",r:"25.5",fill:m}),u.default.createElement("path",{d:"M504 440.5L512 448L531 427",stroke:"white",strokeWidth:"5",strokeLinecap:"round",strokeLinejoin:"round"})):u.default.createElement(u.default.Fragment,null,h>2&&u.default.createElement(u.default.Fragment,null,h>3&&u.default.createElement(u.default.Fragment,null,h>4&&u.default.createElement(u.default.Fragment,null,h>5&&u.default.createElement(u.default.Fragment,null,u.default.createElement("path",{d:"M298.5 182.5L419 164.5L540 182",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),u.default.createElement("circle",{cx:"419",cy:"165",r:"7",fill:"white"})),u.default.createElement("path",{d:"M565.5 295C565.5 350.583 549.016 400.803 522.488 437.067C495.958 473.332 459.517 495.5 419.5 495.5C379.483 495.5 343.042 473.332 316.512 437.067C289.984 400.803 273.5 350.583 273.5 295C273.5 239.417 289.984 189.197 316.512 152.933C343.042 116.668 379.483 94.5 419.5 94.5C459.517 94.5 495.958 116.668 522.488 152.933C549.016 189.197 565.5 239.417 565.5 295Z",stroke:"white",strokeOpacity:h>7?.8:h>5?.3:.1,strokeWidth:"5"}),u.default.createElement("path",{d:"M299.939 262.805L419 478.5L538.5 261.5",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),u.default.createElement("path",{d:"M298.5 182.5L418.871 230.054L540 182",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),u.default.createElement("path",{d:"M298.5 182.5L299.939 262.805",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),u.default.createElement("path",{d:"M540.001 182L538.501 261.5",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),u.default.createElement("circle",{cx:"299.914",cy:"182",r:"7",fill:"white"}),u.default.createElement("circle",{cx:"540",cy:"182",r:"7",fill:"white"})),u.default.createElement("path",{d:"M418.828 230L419 342.5",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:h>4&&h<7?.3:1}),u.default.createElement("path",{d:"M300 263.001L419 342.501",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:h>4&&h<7?.3:1}),u.default.createElement("path",{d:"M538.5 261.5L419 342.5",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:h>4&&h<7?.3:1}),u.default.createElement("path",{d:"M301.5 409L419 342.5",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:h>4&&h<7?.3:1}),u.default.createElement("path",{d:"M536.5 410L419 342.5",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:h>4&&h<7?.3:1}),u.default.createElement("path",{d:"M300 263L419 230",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:h>4&&h<7?.3:1}),u.default.createElement("path",{d:"M538.5 261.5L419 230",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:h>4&&h<7?.3:1}),u.default.createElement("circle",{cx:"419",cy:"229.971",r:"7",fill:"white"}),u.default.createElement("circle",{cx:"419",cy:"342.4",r:"7",fill:"white"})),u.default.createElement("path",{d:"M538.5 261.5L536.5 410",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:h>3&&h<7?.3:1}),u.default.createElement("path",{d:"M419 478.5L536.5 410",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:h>3&&h<7?.3:1}),u.default.createElement("circle",{cx:"537",cy:"263",r:"7",fill:"white"}),u.default.createElement("circle",{cx:"537",cy:"409",r:"7",fill:"white"})),h>1&&u.default.createElement(u.default.Fragment,null,u.default.createElement("path",{d:"M301.501 409L300.001 263",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:h>2&&h<7?.3:1}),u.default.createElement("path",{d:"M301.501 409L419.001 478.5",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:h>2&&h<7?.3:1}),u.default.createElement("circle",{cx:"419",cy:"477.576",r:"7",fill:"white"}),u.default.createElement("circle",{cx:"301.914",cy:"263",r:"7",fill:"white"}),u.default.createElement("circle",{cx:"301.444",cy:"409",r:"7",fill:"white"})))),u.default.createElement("defs",null,u.default.createElement("clipPath",{id:"clip0_428_1188"},u.default.createElement("rect",{width:"840",height:"740",fill:"white"}))))}var Hy,Yy,Zy,Qy,Xy,Ky,Jy,eb,tb,nb,ab,rb,ib,ob,sb,lb="".concat(Ra,"/Selfie-Image-1.png"),ub=h.default.div(Hy||(Hy=w(["\n height: 100dvh;\n display: flex;\n flex-direction: column;\n background: ",";\n color: ",";\n"],["\n height: 100dvh;\n display: flex;\n flex-direction: column;\n background: ",";\n color: ",";\n"])),(function(e){var t,n,a,r;return null!==(r=null===(a=null===(n=null===(t=e.theme)||void 0===t?void 0:t.selfieCapture)||void 0===n?void 0:n.loadingOverlay)||void 0===a?void 0:a.backgroundColor)&&void 0!==r?r:"#ecedf3"}),(function(e){var t,n,a,r;return null!==(r=null===(a=null===(n=null===(t=e.theme)||void 0===t?void 0:t.selfieCapture)||void 0===n?void 0:n.loadingOverlay)||void 0===a?void 0:a.textColor)&&void 0!==r?r:"black"})),db=h.default.div(Yy||(Yy=w(["\n text-align: ",";\n display: flex;\n flex-direction: column;\n flex-wrap: nowrap;\n ","\n padding-bottom: 0;\n"],["\n text-align: ",";\n display: flex;\n flex-direction: column;\n flex-wrap: nowrap;\n ","\n padding-bottom: 0;\n"])),(function(e){var t;return null!==(t=e.theme.textAlign)&&void 0!==t?t:"center"}),(function(e){return e.theme.padding?"box-sizing: border-box; padding: ".concat(e.theme.padding,";"):""})),cb=h.default(lm)(Zy||(Zy=w(["\n padding: 16px 24px;\n margin-top: 16px;\n font-size: 18px;\n font-weight: bold;\n background: white;\n box-shadow:\n 0 1px 3px 0 rgb(0 0 0 / 0.1),\n 0 1px 2px -1px rgb(0 0 0 / 0.1);\n"],["\n padding: 16px 24px;\n margin-top: 16px;\n font-size: 18px;\n font-weight: bold;\n background: white;\n box-shadow:\n 0 1px 3px 0 rgb(0 0 0 / 0.1),\n 0 1px 2px -1px rgb(0 0 0 / 0.1);\n"]))),fb=h.default(ym)(Qy||(Qy=w(["\n display: flex;\n flex-direction: row;\n padding: 15px 25px;\n height: 100px;\n color: ",";\n ","\n position: fixed;\n bottom: 0;\n left: 0;\n width: 100dvw;\n box-sizing: border-box;\n"],["\n display: flex;\n flex-direction: row;\n padding: 15px 25px;\n height: 100px;\n color: ",";\n ","\n position: fixed;\n bottom: 0;\n left: 0;\n width: 100dvw;\n box-sizing: border-box;\n"])),(function(e){var t,n,a,r;return null!==(r=null===(a=null===(n=null===(t=e.theme)||void 0===t?void 0:t.selfieCapture)||void 0===n?void 0:n.loadingOverlay)||void 0===a?void 0:a.progressBarTextColor)&&void 0!==r?r:"white"}),(function(e){var t,n,a,r,i,o;return(null===(a=null===(n=null===(t=e.theme)||void 0===t?void 0:t.selfieCapture)||void 0===n?void 0:n.loadingOverlay)||void 0===a?void 0:a.progressBarFontSize)?"font-size: ".concat(null===(o=null===(i=null===(r=e.theme)||void 0===r?void 0:r.selfieCapture)||void 0===i?void 0:i.loadingOverlay)||void 0===o?void 0:o.progressBarFontSize,";"):""})),hb=h.default(V)(Xy||(Xy=w(["\n padding: 0;\n\n & > svg {\n height: 100%;\n }\n"],["\n padding: 0;\n\n & > svg {\n height: 100%;\n }\n"]))),pb=h.default.div(Ky||(Ky=w(["\n display: flex;\n position: relative;\n z-index: 2;\n"],["\n display: flex;\n position: relative;\n z-index: 2;\n"]))),mb=h.default.ul(Jy||(Jy=w(["\n display: block;\n margin: auto;\n list-style: none;\n padding: 0;\n"],["\n display: block;\n margin: auto;\n list-style: none;\n padding: 0;\n"]))),gb=h.default.li(eb||(eb=w(["\n display: inline-flex;\n justify-content: center;\n align-items: center;\n padding: 2px 1.25rem 2px 0;\n line-height: 1rem;\n\n &::before {\n content: '';\n display: inline-block;\n height: 1rem;\n min-width: 1rem;\n vertical-align: middle;\n background-size: cover;\n background-repeat: no-repeat;\n margin: auto 0.5rem auto 0;\n }\n\n &.done::before {\n background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBjbGlwLXBhdGg9InVybCgjY2xpcDBfNDlfMzg1KSI+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xMiAyNEMxOC42Mjc0IDI0IDI0IDE4LjYyNzQgMjQgMTJDMjQgNS4zNzI1OCAxOC42Mjc0IDAgMTIgMEM1LjM3MjU4IDAgMCA1LjM3MjU4IDAgMTJDMCAxOC42Mjc0IDUuMzcyNTggMjQgMTIgMjRaTTE5LjU2NDMgOC4yNzg1MkMxOS45NTQ5IDcuODg3OTkgMTkuOTU0OSA3LjI1NDgzIDE5LjU2NDMgNi44NjQzQzE5LjE3MzggNi40NzM3OCAxOC41NDA2IDYuNDczNzggMTguMTUwMSA2Ljg2NDNMOS40Mjg2NiAxNS41ODU4TDUuODUwMDUgMTIuMDA3MkM1LjQ1OTUzIDExLjYxNjYgNC44MjYzNiAxMS42MTY2IDQuNDM1ODQgMTIuMDA3MkM0LjA0NTMxIDEyLjM5NzcgNC4wNDUzMSAxMy4wMzA5IDQuNDM1ODQgMTMuNDIxNEw4LjcyMTU1IDE3LjcwNzFDOS4xMTIwOCAxOC4wOTc2IDkuNzQ1MjQgMTguMDk3NiAxMC4xMzU4IDE3LjcwNzFMMTkuNTY0MyA4LjI3ODUyWiIgZmlsbD0id2hpdGUiLz48L2c+PGRlZnM+PGNsaXBQYXRoIGlkPSJjbGlwMF80OV8zODUiPjxyZWN0IHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgZmlsbD0id2hpdGUiLz48L2NsaXBQYXRoPjwvZGVmcz48L3N2Zz4=');\n }\n\n &.running::before {\n background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBjbGlwLXBhdGg9InVybCgjY2xpcDBfNDlfMzcwKSI+PG1hc2sgaWQ9InBhdGgtMS1pbnNpZGUtMV80OV8zNzAiIGZpbGw9IndoaXRlIj48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTMuNTE0NzIgMjAuNDg1NUM4LjIwMTAxIDI1LjE3MTggMTUuNzk5IDI1LjE3MTggMjAuNDg1MyAyMC40ODU1QzI1LjE3MTYgMTUuNzk5MiAyNS4xNzE2IDguMjAxMTkgMjAuNDg1MyAzLjUxNDlDMTUuNzk5IC0xLjE3MTM5IDguMjAxMDEgLTEuMTcxMzkgMy41MTQ3MiAzLjUxNDlDLTEuMTcxNTcgOC4yMDExOSAtMS4xNzE1NyAxNS43OTkyIDMuNTE0NzIgMjAuNDg1NVoiLz48L21hc2s+PHBhdGggZD0iTTYuMzk4MTQgMTEuNDU5QzUuODQ1ODYgMTEuNDU5IDUuMzk4MTQgMTEuOTA2NyA1LjM5ODE0IDEyLjQ1OUM1LjM5ODE0IDEzLjAxMTIgNS44NDU4NiAxMy40NTkgNi4zOTgxNCAxMy40NTlWMTEuNDU5Wk0xNy42MDE5IDEzLjQ1OUMxOC4xNTQxIDEzLjQ1OSAxOC42MDE5IDEzLjAxMTIgMTguNjAxOSAxMi40NTlDMTguNjAxOSAxMS45MDY3IDE4LjE1NDEgMTEuNDU5IDE3LjYwMTkgMTEuNDU5VjEzLjQ1OVpNNi4zOTgxNCAxMy40NTlIMTcuNjAxOVYxMS40NTlINi4zOTgxNFYxMy40NTlaTTMuNTE0NzIgMjAuNDg1NUw0LjkyODkzIDE5LjA3MTNMNC45Mjg5MyAxOS4wNzEzTDMuNTE0NzIgMjAuNDg1NVpNMjAuNDg1MyAzLjUxNDlMMTkuMDcxMSA0LjkyOTEyTDE5LjA3MTEgNC45MjkxMkwyMC40ODUzIDMuNTE0OVpNMy41MTQ3MiAzLjUxNDlMNC45Mjg5MyA0LjkyOTEyTDQuOTI4OTMgNC45MjkxMkwzLjUxNDcyIDMuNTE0OVpNMTkuMDcxMSAxOS4wNzEzQzE1LjE2NTggMjIuOTc2NSA4LjgzNDE3IDIyLjk3NjUgNC45Mjg5MyAxOS4wNzEzTDIuMTAwNTEgMjEuODk5N0M3LjU2Nzg0IDI3LjM2NyAxNi40MzIyIDI3LjM2NyAyMS44OTk1IDIxLjg5OTdMMTkuMDcxMSAxOS4wNzEzWk0xOS4wNzExIDQuOTI5MTJDMjIuOTc2MyA4LjgzNDM2IDIyLjk3NjMgMTUuMTY2IDE5LjA3MTEgMTkuMDcxM0wyMS44OTk1IDIxLjg5OTdDMjcuMzY2OCAxNi40MzIzIDI3LjM2NjggNy41NjgwMyAyMS44OTk1IDIuMTAwNjlMMTkuMDcxMSA0LjkyOTEyWk00LjkyODkzIDQuOTI5MTJDOC44MzQxNyAxLjAyMzg3IDE1LjE2NTggMS4wMjM4NyAxOS4wNzExIDQuOTI5MTJMMjEuODk5NSAyLjEwMDY5QzE2LjQzMjIgLTMuMzY2NjUgNy41Njc4NCAtMy4zNjY2NSAyLjEwMDUxIDIuMTAwNjlMNC45Mjg5MyA0LjkyOTEyWk00LjkyODkzIDE5LjA3MTNDMS4wMjM2OSAxNS4xNjYgMS4wMjM2OSA4LjgzNDM2IDQuOTI4OTMgNC45MjkxMkwyLjEwMDUxIDIuMTAwNjlDLTMuMzY2ODMgNy41NjgwMyAtMy4zNjY4MyAxNi40MzIzIDIuMTAwNTEgMjEuODk5N0w0LjkyODkzIDE5LjA3MTNaIiBmaWxsPSJ3aGl0ZSIgbWFzaz0idXJsKCNwYXRoLTEtaW5zaWRlLTFfNDlfMzcwKSIvPjwvZz48ZGVmcz48Y2xpcFBhdGggaWQ9ImNsaXAwXzQ5XzM3MCI+PHJlY3Qgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiBmaWxsPSJ3aGl0ZSIvPjwvY2xpcFBhdGg+PC9kZWZzPjwvc3ZnPg==');\n }\n"],["\n display: inline-flex;\n justify-content: center;\n align-items: center;\n padding: 2px 1.25rem 2px 0;\n line-height: 1rem;\n\n &::before {\n content: '';\n display: inline-block;\n height: 1rem;\n min-width: 1rem;\n vertical-align: middle;\n background-size: cover;\n background-repeat: no-repeat;\n margin: auto 0.5rem auto 0;\n }\n\n &.done::before {\n background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBjbGlwLXBhdGg9InVybCgjY2xpcDBfNDlfMzg1KSI+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xMiAyNEMxOC42Mjc0IDI0IDI0IDE4LjYyNzQgMjQgMTJDMjQgNS4zNzI1OCAxOC42Mjc0IDAgMTIgMEM1LjM3MjU4IDAgMCA1LjM3MjU4IDAgMTJDMCAxOC42Mjc0IDUuMzcyNTggMjQgMTIgMjRaTTE5LjU2NDMgOC4yNzg1MkMxOS45NTQ5IDcuODg3OTkgMTkuOTU0OSA3LjI1NDgzIDE5LjU2NDMgNi44NjQzQzE5LjE3MzggNi40NzM3OCAxOC41NDA2IDYuNDczNzggMTguMTUwMSA2Ljg2NDNMOS40Mjg2NiAxNS41ODU4TDUuODUwMDUgMTIuMDA3MkM1LjQ1OTUzIDExLjYxNjYgNC44MjYzNiAxMS42MTY2IDQuNDM1ODQgMTIuMDA3MkM0LjA0NTMxIDEyLjM5NzcgNC4wNDUzMSAxMy4wMzA5IDQuNDM1ODQgMTMuNDIxNEw4LjcyMTU1IDE3LjcwNzFDOS4xMTIwOCAxOC4wOTc2IDkuNzQ1MjQgMTguMDk3NiAxMC4xMzU4IDE3LjcwNzFMMTkuNTY0MyA4LjI3ODUyWiIgZmlsbD0id2hpdGUiLz48L2c+PGRlZnM+PGNsaXBQYXRoIGlkPSJjbGlwMF80OV8zODUiPjxyZWN0IHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgZmlsbD0id2hpdGUiLz48L2NsaXBQYXRoPjwvZGVmcz48L3N2Zz4=');\n }\n\n &.running::before {\n background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBjbGlwLXBhdGg9InVybCgjY2xpcDBfNDlfMzcwKSI+PG1hc2sgaWQ9InBhdGgtMS1pbnNpZGUtMV80OV8zNzAiIGZpbGw9IndoaXRlIj48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTMuNTE0NzIgMjAuNDg1NUM4LjIwMTAxIDI1LjE3MTggMTUuNzk5IDI1LjE3MTggMjAuNDg1MyAyMC40ODU1QzI1LjE3MTYgMTUuNzk5MiAyNS4xNzE2IDguMjAxMTkgMjAuNDg1MyAzLjUxNDlDMTUuNzk5IC0xLjE3MTM5IDguMjAxMDEgLTEuMTcxMzkgMy41MTQ3MiAzLjUxNDlDLTEuMTcxNTcgOC4yMDExOSAtMS4xNzE1NyAxNS43OTkyIDMuNTE0NzIgMjAuNDg1NVoiLz48L21hc2s+PHBhdGggZD0iTTYuMzk4MTQgMTEuNDU5QzUuODQ1ODYgMTEuNDU5IDUuMzk4MTQgMTEuOTA2NyA1LjM5ODE0IDEyLjQ1OUM1LjM5ODE0IDEzLjAxMTIgNS44NDU4NiAxMy40NTkgNi4zOTgxNCAxMy40NTlWMTEuNDU5Wk0xNy42MDE5IDEzLjQ1OUMxOC4xNTQxIDEzLjQ1OSAxOC42MDE5IDEzLjAxMTIgMTguNjAxOSAxMi40NTlDMTguNjAxOSAxMS45MDY3IDE4LjE1NDEgMTEuNDU5IDE3LjYwMTkgMTEuNDU5VjEzLjQ1OVpNNi4zOTgxNCAxMy40NTlIMTcuNjAxOVYxMS40NTlINi4zOTgxNFYxMy40NTlaTTMuNTE0NzIgMjAuNDg1NUw0LjkyODkzIDE5LjA3MTNMNC45Mjg5MyAxOS4wNzEzTDMuNTE0NzIgMjAuNDg1NVpNMjAuNDg1MyAzLjUxNDlMMTkuMDcxMSA0LjkyOTEyTDE5LjA3MTEgNC45MjkxMkwyMC40ODUzIDMuNTE0OVpNMy41MTQ3MiAzLjUxNDlMNC45Mjg5MyA0LjkyOTEyTDQuOTI4OTMgNC45MjkxMkwzLjUxNDcyIDMuNTE0OVpNMTkuMDcxMSAxOS4wNzEzQzE1LjE2NTggMjIuOTc2NSA4LjgzNDE3IDIyLjk3NjUgNC45Mjg5MyAxOS4wNzEzTDIuMTAwNTEgMjEuODk5N0M3LjU2Nzg0IDI3LjM2NyAxNi40MzIyIDI3LjM2NyAyMS44OTk1IDIxLjg5OTdMMTkuMDcxMSAxOS4wNzEzWk0xOS4wNzExIDQuOTI5MTJDMjIuOTc2MyA4LjgzNDM2IDIyLjk3NjMgMTUuMTY2IDE5LjA3MTEgMTkuMDcxM0wyMS44OTk1IDIxLjg5OTdDMjcuMzY2OCAxNi40MzIzIDI3LjM2NjggNy41NjgwMyAyMS44OTk1IDIuMTAwNjlMMTkuMDcxMSA0LjkyOTEyWk00LjkyODkzIDQuOTI5MTJDOC44MzQxNyAxLjAyMzg3IDE1LjE2NTggMS4wMjM4NyAxOS4wNzExIDQuOTI5MTJMMjEuODk5NSAyLjEwMDY5QzE2LjQzMjIgLTMuMzY2NjUgNy41Njc4NCAtMy4zNjY2NSAyLjEwMDUxIDIuMTAwNjlMNC45Mjg5MyA0LjkyOTEyWk00LjkyODkzIDE5LjA3MTNDMS4wMjM2OSAxNS4xNjYgMS4wMjM2OSA4LjgzNDM2IDQuOTI4OTMgNC45MjkxMkwyLjEwMDUxIDIuMTAwNjlDLTMuMzY2ODMgNy41NjgwMyAtMy4zNjY4MyAxNi40MzIzIDIuMTAwNTEgMjEuODk5N0w0LjkyODkzIDE5LjA3MTNaIiBmaWxsPSJ3aGl0ZSIgbWFzaz0idXJsKCNwYXRoLTEtaW5zaWRlLTFfNDlfMzcwKSIvPjwvZz48ZGVmcz48Y2xpcFBhdGggaWQ9ImNsaXAwXzQ5XzM3MCI+PHJlY3Qgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiBmaWxsPSJ3aGl0ZSIvPjwvY2xpcFBhdGg+PC9kZWZzPjwvc3ZnPg==');\n }\n"]))),vb=h.default.div(tb||(tb=w(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n"],["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n"]))),yb=h.default.div(nb||(nb=w(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: ",";\n opacity: ",";\n"],["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: ",";\n opacity: ",";\n"])),(function(e){var t,n,a,r;return null!==(r=null===(a=null===(n=null===(t=e.theme)||void 0===t?void 0:t.selfieCapture)||void 0===n?void 0:n.loadingOverlay)||void 0===a?void 0:a.progressBarBackgroundColor)&&void 0!==r?r:"var(--idm-color-positive-600)"}),(function(e){var t,n,a,r;return null!==(r=null===(a=null===(n=null===(t=e.theme)||void 0===t?void 0:t.selfieCapture)||void 0===n?void 0:n.loadingOverlay)||void 0===a?void 0:a.progressBarBackgroundOpacity)&&void 0!==r?r:.75})),bb=h.default.span(ab||(ab=w(["\n display: block;\n width: ","%;\n height: 100%;\n"],["\n display: block;\n width: ","%;\n height: 100%;\n"])),(function(e){return e.$progress})),xb=h.default.span(rb||(rb=w(["\n display: block;\n height: 100%;\n background: ",";\n animation: progressBar 3s ease-in-out;\n animation-fill-mode: both;\n\n @keyframes progressBar {\n 0% {\n width: 0;\n }\n 100% {\n width: 100%;\n }\n }\n"],["\n display: block;\n height: 100%;\n background: ",";\n animation: progressBar 3s ease-in-out;\n animation-fill-mode: both;\n\n @keyframes progressBar {\n 0% {\n width: 0;\n }\n 100% {\n width: 100%;\n }\n }\n"])),(function(e){var t,n,a,r;return null!==(r=null===(a=null===(n=null===(t=e.theme)||void 0===t?void 0:t.selfieCapture)||void 0===n?void 0:n.loadingOverlay)||void 0===a?void 0:a.progressBarIndicatorColor)&&void 0!==r?r:"var(--idm-color-positive-600)"})),Cb=h.default.img(ib||(ib=w([""],[""]))),wb=h.default.div(ob||(ob=w(["\n display: flex;\n"],["\n display: flex;\n"]))),Eb=h.default(ce)(sb||(sb=w(["\n margin: auto;\n white-space: nowrap;\n ","\n ","\n"],["\n margin: auto;\n white-space: nowrap;\n ","\n ","\n"])),(function(e){var t,n,a,r,i,o;return(null===(a=null===(n=null===(t=e.theme)||void 0===t?void 0:t.selfieCapture)||void 0===n?void 0:n.loadingOverlay)||void 0===a?void 0:a.progressBarFontSize)?"font-size: ".concat(null===(o=null===(i=null===(r=e.theme)||void 0===r?void 0:r.selfieCapture)||void 0===i?void 0:i.loadingOverlay)||void 0===o?void 0:o.progressBarFontSize,";"):""}),(function(e){var t,n,a,r,i,o;return(null===(a=null===(n=null===(t=e.theme)||void 0===t?void 0:t.selfieCapture)||void 0===n?void 0:n.loadingOverlay)||void 0===a?void 0:a.continueBtnBorder)?"border: ".concat(null===(o=null===(i=null===(r=e.theme)||void 0===r?void 0:r.selfieCapture)||void 0===i?void 0:i.loadingOverlay)||void 0===o?void 0:o.continueBtnBorder,";"):""})),kb={default:function(e){var n=e.onDismissed,a=e.onUserCancel,r=e.assets,i=void 0===r?{}:r,o=e.classNames,s=void 0===o?{}:o,l=e.colors,d=void 0===l?{}:l,c=e.verbiage,f=void 0===c?{}:c,h=t.useContext(Xe),p=h.cameraReady,m=h.cameraAccessDenied,g=t.useContext(Qf),v=g.ready,y=g.modelDownloadProgress,b=Xp(f,{headingText:"Use your device camera to capture your face",removeEyeCoveringsText:"Remove Sunglasses & Hat",avoidExcessiveBacklightingText:"Avoid Excessive Backlighting",continueText:"Let's Go!",cameraInitializingText:"Accessing camera...",cameraInitializedText:"Camera ready",downloadingText:"Downloading...",modelsWarmingUpText:"Loading guided capture experience...",modelsReadyText:"Guided capture experience ready"}),x=t.useState(0),C=x[1],w=[b.headingText,b.removeEyeCoveringsText,b.avoidExcessiveBacklightingText][x[0]];t.useEffect((function(){setInterval((function(){C((function(e){return(e+1)%3}))}),3e3)}),[]);var E=t.useState(!1),k=E[1];return E[0]?u.default.createElement(u.default.Fragment,null):m?u.default.createElement(cm,{assets:i.cameraAccessDenied,classNames:s.cameraAccessDenied,colors:d.cameraAccessDenied,verbiage:f.cameraAccessDenied}):u.default.createElement(W,{className:s.container},u.default.createElement(ub,{className:s.inner},a&&u.default.createElement(vm,{onClick:a,className:s.cancelBtn}),u.default.createElement(db,{className:s.headingContainer},u.default.createElement(cb,{className:s.heading},w)),u.default.createElement(hb,{className:s.imageContainer},(null==i?void 0:i.instructionImageUrl)&&i.instructionImageUrl!==lb?u.default.createElement(Cb,{className:s.image,alt:b.headingText,src:i.instructionImageUrl}):u.default.createElement(qy,{className:s.image})),u.default.createElement(fb,{className:s.buttonsRow},u.default.createElement(vb,{className:s.progressContainer},u.default.createElement(yb,{className:s.progressBackground}),u.default.createElement(bb,{$progress:y,className:s.progressBar},u.default.createElement(xb,{className:s.progressIndicator}))),u.default.createElement(pb,{className:s.loadingListContainer},u.default.createElement(mb,{className:s.loadingList},u.default.createElement(gb,{className:"".concat(s.loadingListItem," ").concat(p?"done":"running")},p?b.cameraInitializedText:b.cameraInitializingText),u.default.createElement(gb,{className:"".concat(s.loadingListItem," ").concat(v?"done":"running")},v?b.modelsReadyText:y>=100?b.modelsWarmingUpText:"".concat(b.downloadingText," (").concat(y,"%)")))),u.default.createElement(wb,{className:s.continueBtnContainer},v&&p&&u.default.createElement(Eb,{finished:!0,className:s.continueBtn,variant:"positive",colors:d.continueBtn,onClick:function(){k(!0),null==n||n()}},b.continueText)))))},legacy:function(e){var n=e.onDismissed,a=e.onUserCancel,r=e.assets,i=void 0===r?{}:r,o=e.classNames,s=void 0===o?{}:o,l=e.colors,d=void 0===l?{}:l,c=e.verbiage,f=void 0===c?{}:c,h=t.useContext(Xe),p=h.cameraReady,m=h.cameraAccessDenied,g=t.useContext(Qf),v=g.ready,y=g.modelDownloadProgress;i.instructionImageUrl||(i.instructionImageUrl="".concat(Ra,"/Selfie-Image-1.png"));var b=Xp(f,{headingText:"Use your device camera to capture your face",removeEyeCoveringsText:"Remove Sunglasses & Hat",avoidExcessiveBacklightingText:"Avoid Excessive Backlighting",continueText:"Continue",cameraInitializingText:"Camera initializing...",downloadingText:"Downloading...",modelsWarmingUpText:"Models warming up..."}),x=t.useState(!1),C=x[1];return x[0]?u.default.createElement(u.default.Fragment,null):m?u.default.createElement(cm,{assets:i.cameraAccessDenied,classNames:s.cameraAccessDenied,colors:d.cameraAccessDenied,verbiage:f.cameraAccessDenied}):u.default.createElement(W,{className:s.container},u.default.createElement($,{className:s.inner},u.default.createElement("h3",{className:s.heading},b.headingText),a&&u.default.createElement(vm,{onClick:a,className:s.cancelBtn}),u.default.createElement($y,null,b.removeEyeCoveringsText,u.default.createElement("br",null),b.avoidExcessiveBacklightingText),u.default.createElement(V,{className:s.imageContainer},u.default.createElement("img",{className:s.image,alt:b.headingText,src:i.instructionImageUrl})),u.default.createElement(Vy,{className:s.buttonsRow},u.default.createElement(ce,{variant:"positive",disabled:!p||!v,finished:p&&v,className:s.continueBtn,colors:d.continueBtn,onClick:function(){C(!0),null==n||n()}},p&&v?b.continueText:v?b.cameraInitializingText:y>=100?"".concat(b.modelsWarmingUpText):"".concat(b.downloadingText," (").concat(y,"%)")))))}},Tb=function(e){var t,n=e.mode,a=void 0===n?"default":n,r=y(e,["mode"]),i=null!==(t=kb[a])&&void 0!==t?t:kb.default;return u.default.createElement(i,v({},r))},Mb=function(e){var n,a,r,i=e.onComplete,o=e.onSuccess,s=e.onTimeout,l=e.onExitCapture,d=e.onExitAfterFailure,c=e.onUserCancel,f=e.loadingOverlayMode,h=void 0===f?"default":f,p=e.timeoutDurationMs,m=void 0===p?15e3:p,g=e.maxRetries,v=void 0===g?2:g,y=e.skipSuccessScreen,C=void 0!==y&&y,w=e.renderCameraFeed,E=void 0===w||w,k=e.releaseCameraAccessOnExit,T=void 0===k||k,M=e.assets,S=void 0===M?{}:M,D=e.classNames,N=void 0===D?{}:D,A=e.colors,L=void 0===A?{}:A,R=e.verbiage,O=void 0===R?{}:R,F=e.debugMode,j=void 0!==F&&F,P=t.useContext(Ie),_=P.submissionResponse,U=P.livenessCheckRequest,z=P.setSelfieImage,G=P.logSelfieCaptureAttempt,W=t.useContext(Xe).releaseCameraAccess,$=t.useState(""),V=$[0],q=$[1],H=t.useState(0),Y=H[0],Z=H[1],Q=t.useState("LOADING"),X=Q[0],K=Q[1],J=t.useRef(),ee=t.useRef(),te=t.useRef();t.useEffect((function(){te.current=new Date}),[]),t.useEffect((function(){"CAPTURING"===X&&(J.current=new Date)}),[X]);var ne=t.useCallback((function(){ee.current=new Date}),[]),ae=t.useCallback((function(){var e,t,n;G({autoCapture:"Y",captureTime:(null!==(e=ee.current)&&void 0!==e?e:new Date).getTime()-(null!==(t=J.current)&&void 0!==t?t:new Date).getTime(),operationTime:(new Date).getTime()-(null!==(n=te.current)&&void 0!==n?n:new Date).getTime()}),te.current=new Date}),[G]),re=t.useCallback((function(e){return b(void 0,void 0,void 0,(function(){var t;return x(this,(function(n){switch(n.label){case 0:return U&&_?(K("SUCCESS"),q(e),t=z,[4,I(e)]):[2];case 1:return t.apply(void 0,[n.sent()]),null==o||o(_,U),[2]}}))}))}),[o,z,U,_]),ie=t.useCallback((function(){K("FAILED"),null==s||s(_,U)}),[s,U,_]),oe=t.useState(0),se=oe[0],le=oe[1],ue=t.useCallback((function(){le((function(e){return e+1})),K("LOADING"),null==l||l()}),[l]),de=t.useCallback((function(){ae(),T&&W(),setTimeout((function(){null==i||i(_,U)}),0)}),[ae,i,W,T,U,_]),ce=Lg(C,"SUCCESS"===X,de);return u.default.createElement(u.default.Fragment,null,u.default.createElement(B,{className:"flex ".concat(null!==(a=null===(n=N.capture)||void 0===n?void 0:n.container)&&void 0!==a?a:"")},E&&u.default.createElement(Ng,{className:null===(r=N.capture)||void 0===r?void 0:r.cameraFeed}),"LOADING"!==X&&function(){switch(X){case"CAPTURING":return u.default.createElement(_y,{key:"capture".concat(se),onCapture:ne,onSuccess:re,onTimeout:ie,onExit:ue,timeoutDurationMs:m,classNames:N.capture,colors:L,verbiage:O,debugMode:j});case"SUCCESS":return ce?u.default.createElement(Uy,{key:"success",imageUrl:V,classNames:N.success,colors:L.success,verbiage:O.success,onDoneClick:de,onRetryClick:function(){ae(),K("CAPTURING")}}):null;case"FAILED":return u.default.createElement(Gy,{key:"failure",assets:S.failure,classNames:N.failure,colors:L.failure,verbiage:O.failure,canRetry:v>-1&&Y<v,onRetryClick:function(){ae(),Z((function(e){return e+1})),K("CAPTURING")},onExitClick:function(){T&&W(),setTimeout((function(){null==d||d(_,U)}),0)}});default:return null}}()),u.default.createElement(Tb,{key:se,mode:h,assets:S.loadingOverlay,classNames:N.loadingOverlay,colors:L.loadingOverlay,verbiage:O.loadingOverlay,onUserCancel:c,onDismissed:function(){K("CAPTURING")}}))},Ib=function(e){var n=e.children,a=t.useState({width:1,height:1}),r=a[1],i=t.useState(1),o=i[0],s=i[1],l=Le(),d=l.ref,c=l.width,f=void 0===c?1:c,h=l.height,p=void 0===h?1:h,m=f/p,g=t.useCallback((function(e){var t=e.target;s(t.naturalWidth/t.naturalHeight)}),[]);return u.default.createElement(Zg.Provider,{value:{orientation:"landscape",wrapperWidth:f,wrapperHeight:p,wrapperAspectRatio:m,imageAspectRatio:o,setDimensions:r,wrapperRef:d,onImageLoaded:g}},n)},Sb=function(){var e=t.useContext(Ie),n=e.submissionRequest,a=e.submissionResponse,r=t.useState(!1),i=r[0],o=r[1],s=t.useState(!0),l=s[0],d=s[1],c=t.useMemo((function(){var e,t,a,r,i,o,s=JSON.parse(JSON.stringify(n));return l&&((null===(t=null===(e=null==s?void 0:s.customerData)||void 0===e?void 0:e.idData)||void 0===t?void 0:t.idImageFront)&&(s.customerData.idData.idImageFront=Db(s.customerData.idData.idImageFront,200)),(null===(r=null===(a=null==s?void 0:s.customerData)||void 0===a?void 0:a.idData)||void 0===r?void 0:r.idImageBack)&&(s.customerData.idData.idImageBack=Db(s.customerData.idData.idImageBack,200)),(null===(o=null===(i=null==s?void 0:s.customerData)||void 0===i?void 0:i.biometricData)||void 0===o?void 0:o.selfie)&&(s.customerData.biometricData.selfie=Db(s.customerData.biometricData.selfie,200))),JSON.stringify(s,null,2)}),[n,l]);return u.default.createElement(u.default.Fragment,null,u.default.createElement("h3",null,"Submission completed!"),u.default.createElement("button",{onClick:function(){o(!i)}},i?"Hide":"Show"," request body"),i&&u.default.createElement(u.default.Fragment,null,u.default.createElement("button",{style:{marginLeft:8},onClick:function(){d(!l)}},l?"Display full images":"Truncate images"),u.default.createElement("h5",null,"Request Body"),u.default.createElement("pre",null,c)),u.default.createElement("h5",null,"Response Body"),u.default.createElement("pre",null,JSON.stringify(a,null,2)))};function Db(e,t){var n=e.split("").splice(0,t).join("");return n.length<e.length&&(n+="..."),n}var Nb,Ab,Lb,Rb,Ob=function(e){var n=e.document,a=e.onComplete,r=e.classNames,i=void 0===r?{}:r,o=e.verbiage,s=void 0===o?{}:o,l=t.useRef(null),d=t.useState(null),c=d[0],f=d[1],h=Xp(s,{headingText:"Additional document capture",captureBtnText:"Capture",nextBtnText:"Next"});return u.default.createElement(W,{className:i.container},u.default.createElement(Fb,{className:i.inner},u.default.createElement(jb,{className:i.heading},h.headingText,": ",n.name),n.description&&u.default.createElement(Pb,{className:i.description},n.description),u.default.createElement("input",{ref:l,type:"file",accept:"image/*,.pdf",onChange:function(e){var t,n=null===(t=e.target.files)||void 0===t?void 0:t[0];n&&f(n)},hidden:!0}),u.default.createElement(Bb,{className:i.buttonsRow},c?u.default.createElement(ce,{variant:"positive",className:i.nextBtn,disabled:!c,finished:!0,onClick:function(){if(c){var e=new FileReader;e.onloadend=function(){if(e.result){var t=e.result.toString();null==a||a({documentName:n.name,additionalDocument:{name:c.name,fileContent:S(t),type:D(t),fileUploadType:"Y",isImageControlData:"Y",fieldId:""}})}},e.readAsDataURL(c)}}},h.nextBtnText):u.default.createElement(ce,{variant:"primary",className:i.captureBtn,finished:!0,onClick:function(){var e;null===(e=l.current)||void 0===e||e.click()}},h.captureBtnText))))},Fb=h.default($)(Nb||(Nb=w(["\n justify-content: center;\n"],["\n justify-content: center;\n"]))),jb=h.default.h3(Ab||(Ab=w(["\n margin-bottom: 8px;\n"],["\n margin-bottom: 8px;\n"]))),Pb=h.default.p(Lb||(Lb=w(["\n margin-bottom: 8px;\n"],["\n margin-bottom: 8px;\n"]))),Bb=h.default(ym)(Rb||(Rb=w(["\n margin-top: 32px;\n"],["\n margin-top: 32px;\n"]))),_b=function(e){var n=e.documents,a=e.onComplete,r=e.classNames,i=void 0===r?{}:r,o=e.verbiage,s=void 0===o?{}:o,l=t.useState([]),d=l[0],c=l[1],f=d.length,h=n[f],p=f>=n.length;return t.useEffect((function(){(null==h?void 0:h.skip)&&b(void 0,void 0,void 0,(function(){var e;return x(this,(function(t){switch(t.label){case 0:return[4,null===(e=h.skip)||void 0===e?void 0:e.call(h)];case 1:return t.sent()&&c((function(e){return C(C([],e,!0),[null],!1)})),[2]}}))}))}),[h]),t.useEffect((function(){p&&(null==a||a(d.filter((function(e){return!!e}))))}),[p,a,d]),p?u.default.createElement(u.default.Fragment,null,"Thanks, your documents have been received."):u.default.createElement(Ob,{key:f,document:h,classNames:i,verbiage:s,onComplete:function(e){c((function(t){return C(C([],t,!0),[e],!1)}))}})},Ub="function"==typeof Symbol&&Symbol.for,zb=Ub?Symbol.for("react.element"):60103,Gb=Ub?Symbol.for("react.portal"):60106,Wb=Ub?Symbol.for("react.fragment"):60107,$b=Ub?Symbol.for("react.strict_mode"):60108,Vb=Ub?Symbol.for("react.profiler"):60114,qb=Ub?Symbol.for("react.provider"):60109,Hb=Ub?Symbol.for("react.context"):60110,Yb=Ub?Symbol.for("react.async_mode"):60111,Zb=Ub?Symbol.for("react.concurrent_mode"):60111,Qb=Ub?Symbol.for("react.forward_ref"):60112,Xb=Ub?Symbol.for("react.suspense"):60113,Kb=Ub?Symbol.for("react.suspense_list"):60120,Jb=Ub?Symbol.for("react.memo"):60115,ex=Ub?Symbol.for("react.lazy"):60116,tx=Ub?Symbol.for("react.block"):60121,nx=Ub?Symbol.for("react.fundamental"):60117,ax=Ub?Symbol.for("react.responder"):60118,rx=Ub?Symbol.for("react.scope"):60119;function ix(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case zb:switch(e=e.type){case Yb:case Zb:case Wb:case Vb:case $b:case Xb:return e;default:switch(e=e&&e.$$typeof){case Hb:case Qb:case ex:case Jb:case qb:return e;default:return t}}case Gb:return t}}}function ox(e){return ix(e)===Zb}var sx={AsyncMode:Yb,ConcurrentMode:Zb,ContextConsumer:Hb,ContextProvider:qb,Element:zb,ForwardRef:Qb,Fragment:Wb,Lazy:ex,Memo:Jb,Portal:Gb,Profiler:Vb,StrictMode:$b,Suspense:Xb,isAsyncMode:function(e){return ox(e)||ix(e)===Yb},isConcurrentMode:ox,isContextConsumer:function(e){return ix(e)===Hb},isContextProvider:function(e){return ix(e)===qb},isElement:function(e){return"object"==typeof e&&null!==e&&e.$$typeof===zb},isForwardRef:function(e){return ix(e)===Qb},isFragment:function(e){return ix(e)===Wb},isLazy:function(e){return ix(e)===ex},isMemo:function(e){return ix(e)===Jb},isPortal:function(e){return ix(e)===Gb},isProfiler:function(e){return ix(e)===Vb},isStrictMode:function(e){return ix(e)===$b},isSuspense:function(e){return ix(e)===Xb},isValidElementType:function(e){return"string"==typeof e||"function"==typeof e||e===Wb||e===Zb||e===Vb||e===$b||e===Xb||e===Kb||"object"==typeof e&&null!==e&&(e.$$typeof===ex||e.$$typeof===Jb||e.$$typeof===qb||e.$$typeof===Hb||e.$$typeof===Qb||e.$$typeof===nx||e.$$typeof===ax||e.$$typeof===rx||e.$$typeof===tx)},typeOf:ix};Y((function(e,t){}));Y((function(e){e.exports=sx}));function lx(){}function ux(){}ux.resetWarningCache=lx;var dx=Y((function(e){e.exports=function(){function e(e,t,n,a,r,i){if("SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"!==i){var o=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw o.name="Invariant Violation",o}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:ux,resetWarningCache:lx};return n.PropTypes=n,n}()}));function cx(e,t,n){this.x=e,this.y=t,this.time=n||(new Date).getTime()}function fx(e,t,n,a){this.startPoint=e,this.control1=t,this.control2=n,this.endPoint=a}function hx(e,t){var n=this,a=t||{};this.velocityFilterWeight=a.velocityFilterWeight||.7,this.minWidth=a.minWidth||.5,this.maxWidth=a.maxWidth||2.5,this.throttle="throttle"in a?a.throttle:16,this.minDistance="minDistance"in a?a.minDistance:5,this._strokeMoveUpdate=this.throttle?function(e,t,n){var a,r,i,o=null,s=0;n||(n={});var l=function(){s=!1===n.leading?0:Date.now(),o=null,i=e.apply(a,r),o||(a=r=null)};return function(){var u=Date.now();s||!1!==n.leading||(s=u);var d=t-(u-s);return a=this,r=arguments,d<=0||d>t?(o&&(clearTimeout(o),o=null),s=u,i=e.apply(a,r),o||(a=r=null)):o||!1===n.trailing||(o=setTimeout(l,d)),i}}(hx.prototype._strokeUpdate,this.throttle):hx.prototype._strokeUpdate,this.dotSize=a.dotSize||function(){return(this.minWidth+this.maxWidth)/2},this.penColor=a.penColor||"black",this.backgroundColor=a.backgroundColor||"rgba(0,0,0,0)",this.onBegin=a.onBegin,this.onEnd=a.onEnd,this._canvas=e,this._ctx=e.getContext("2d"),this.clear(),this._handleMouseDown=function(e){1===e.which&&(n._mouseButtonDown=!0,n._strokeBegin(e))},this._handleMouseMove=function(e){n._mouseButtonDown&&n._strokeMoveUpdate(e)},this._handleMouseUp=function(e){1===e.which&&n._mouseButtonDown&&(n._mouseButtonDown=!1,n._strokeEnd(e))},this._handleTouchStart=function(e){1===e.targetTouches.length&&n._strokeBegin(e.changedTouches[0])},this._handleTouchMove=function(e){e.preventDefault(),n._strokeMoveUpdate(e.targetTouches[0])},this._handleTouchEnd=function(e){e.target===n._canvas&&(e.preventDefault(),n._strokeEnd(e))},this.on()}cx.prototype.velocityFrom=function(e){return this.time!==e.time?this.distanceTo(e)/(this.time-e.time):1},cx.prototype.distanceTo=function(e){return Math.sqrt(Math.pow(this.x-e.x,2)+Math.pow(this.y-e.y,2))},cx.prototype.equals=function(e){return this.x===e.x&&this.y===e.y&&this.time===e.time},fx.prototype.length=function(){for(var e=0,t=void 0,n=void 0,a=0;a<=10;a+=1){var r=a/10,i=this._point(r,this.startPoint.x,this.control1.x,this.control2.x,this.endPoint.x),o=this._point(r,this.startPoint.y,this.control1.y,this.control2.y,this.endPoint.y);if(a>0){var s=i-t,l=o-n;e+=Math.sqrt(s*s+l*l)}t=i,n=o}return e},fx.prototype._point=function(e,t,n,a,r){return t*(1-e)*(1-e)*(1-e)+3*n*(1-e)*(1-e)*e+3*a*(1-e)*e*e+r*e*e*e},hx.prototype.clear=function(){var e=this._ctx,t=this._canvas;e.fillStyle=this.backgroundColor,e.clearRect(0,0,t.width,t.height),e.fillRect(0,0,t.width,t.height),this._data=[],this._reset(),this._isEmpty=!0},hx.prototype.fromDataURL=function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=new Image,r=n.ratio||window.devicePixelRatio||1,i=n.width||this._canvas.width/r,o=n.height||this._canvas.height/r;this._reset(),a.src=e,a.onload=function(){t._ctx.drawImage(a,0,0,i,o)},this._isEmpty=!1},hx.prototype.toDataURL=function(e){var t;if("image/svg+xml"===e)return this._toSVG();for(var n=arguments.length,a=Array(n>1?n-1:0),r=1;r<n;r++)a[r-1]=arguments[r];return(t=this._canvas).toDataURL.apply(t,[e].concat(a))},hx.prototype.on=function(){this._handleMouseEvents(),this._handleTouchEvents()},hx.prototype.off=function(){this._canvas.removeEventListener("mousedown",this._handleMouseDown),this._canvas.removeEventListener("mousemove",this._handleMouseMove),document.removeEventListener("mouseup",this._handleMouseUp),this._canvas.removeEventListener("touchstart",this._handleTouchStart),this._canvas.removeEventListener("touchmove",this._handleTouchMove),this._canvas.removeEventListener("touchend",this._handleTouchEnd)},hx.prototype.isEmpty=function(){return this._isEmpty},hx.prototype._strokeBegin=function(e){this._data.push([]),this._reset(),this._strokeUpdate(e),"function"==typeof this.onBegin&&this.onBegin(e)},hx.prototype._strokeUpdate=function(e){var t=this._createPoint(e.clientX,e.clientY),n=this._data[this._data.length-1],a=n&&n[n.length-1],r=a&&t.distanceTo(a)<this.minDistance;if(!a||!r){var i=this._addPoint(t),o=i.curve,s=i.widths;o&&s&&this._drawCurve(o,s.start,s.end),this._data[this._data.length-1].push({x:t.x,y:t.y,time:t.time,color:this.penColor})}},hx.prototype._strokeEnd=function(e){var t=this.points[0];if(!(this.points.length>2)&&t&&this._drawDot(t),t){var n=this._data[this._data.length-1];t.equals(n[n.length-1])||n.push({x:t.x,y:t.y,time:t.time,color:this.penColor})}"function"==typeof this.onEnd&&this.onEnd(e)},hx.prototype._handleMouseEvents=function(){this._mouseButtonDown=!1,this._canvas.addEventListener("mousedown",this._handleMouseDown),this._canvas.addEventListener("mousemove",this._handleMouseMove),document.addEventListener("mouseup",this._handleMouseUp)},hx.prototype._handleTouchEvents=function(){this._canvas.style.msTouchAction="none",this._canvas.style.touchAction="none",this._canvas.addEventListener("touchstart",this._handleTouchStart),this._canvas.addEventListener("touchmove",this._handleTouchMove),this._canvas.addEventListener("touchend",this._handleTouchEnd)},hx.prototype._reset=function(){this.points=[],this._lastVelocity=0,this._lastWidth=(this.minWidth+this.maxWidth)/2,this._ctx.fillStyle=this.penColor},hx.prototype._createPoint=function(e,t,n){var a=this._canvas.getBoundingClientRect();return new cx(e-a.left,t-a.top,n||(new Date).getTime())},hx.prototype._addPoint=function(e){var t=this.points,n=void 0;if(t.push(e),t.length>2){3===t.length&&t.unshift(t[0]);var a=(n=this._calculateCurveControlPoints(t[0],t[1],t[2])).c2;n=this._calculateCurveControlPoints(t[1],t[2],t[3]);var r=new fx(t[1],a,n.c1,t[2]),i=this._calculateCurveWidths(r);return t.shift(),{curve:r,widths:i}}return{}},hx.prototype._calculateCurveControlPoints=function(e,t,n){var a=e.x-t.x,r=e.y-t.y,i=t.x-n.x,o=t.y-n.y,s=(e.x+t.x)/2,l=(e.y+t.y)/2,u=(t.x+n.x)/2,d=(t.y+n.y)/2,c=Math.sqrt(a*a+r*r),f=Math.sqrt(i*i+o*o),h=f/(c+f),p=t.x-(u+(s-u)*h),m=t.y-(d+(l-d)*h);return{c1:new cx(s+p,l+m),c2:new cx(u+p,d+m)}},hx.prototype._calculateCurveWidths=function(e){var t={start:null,end:null},n=this.velocityFilterWeight*e.endPoint.velocityFrom(e.startPoint)+(1-this.velocityFilterWeight)*this._lastVelocity,a=this._strokeWidth(n);return t.start=this._lastWidth,t.end=a,this._lastVelocity=n,this._lastWidth=a,t},hx.prototype._strokeWidth=function(e){return Math.max(this.maxWidth/(e+1),this.minWidth)},hx.prototype._drawPoint=function(e,t,n){var a=this._ctx;a.moveTo(e,t),a.arc(e,t,n,0,2*Math.PI,!1),this._isEmpty=!1},hx.prototype._drawCurve=function(e,t,n){var a=this._ctx,r=n-t,i=Math.floor(e.length());a.beginPath();for(var o=0;o<i;o+=1){var s=o/i,l=s*s,u=l*s,d=1-s,c=d*d,f=c*d,h=f*e.startPoint.x;h+=3*c*s*e.control1.x,h+=3*d*l*e.control2.x;var p=f*e.startPoint.y;p+=3*c*s*e.control1.y,p+=3*d*l*e.control2.y,this._drawPoint(h+=u*e.endPoint.x,p+=u*e.endPoint.y,t+u*r)}a.closePath(),a.fill()},hx.prototype._drawDot=function(e){var t=this._ctx,n="function"==typeof this.dotSize?this.dotSize():this.dotSize;t.beginPath(),this._drawPoint(e.x,e.y,n),t.closePath(),t.fill()},hx.prototype._fromData=function(e,t,n){for(var a=0;a<e.length;a+=1){var r=e[a];if(r.length>1)for(var i=0;i<r.length;i+=1){var o=r[i],s=new cx(o.x,o.y,o.time),l=o.color;if(0===i)this.penColor=l,this._reset(),this._addPoint(s);else if(i!==r.length-1){var u=this._addPoint(s),d=u.curve,c=u.widths;d&&c&&t(d,c,l)}}else this._reset(),n(r[0])}},hx.prototype._toSVG=function(){var e=this,t=this._data,n=this._canvas,a=Math.max(window.devicePixelRatio||1,1),r=n.width/a,i=n.height/a,o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.setAttributeNS(null,"width",n.width),o.setAttributeNS(null,"height",n.height),this._fromData(t,(function(e,t,n){var a=document.createElement("path");if(!(isNaN(e.control1.x)||isNaN(e.control1.y)||isNaN(e.control2.x)||isNaN(e.control2.y))){var r="M "+e.startPoint.x.toFixed(3)+","+e.startPoint.y.toFixed(3)+" C "+e.control1.x.toFixed(3)+","+e.control1.y.toFixed(3)+" "+e.control2.x.toFixed(3)+","+e.control2.y.toFixed(3)+" "+e.endPoint.x.toFixed(3)+","+e.endPoint.y.toFixed(3);a.setAttribute("d",r),a.setAttribute("stroke-width",(2.25*t.end).toFixed(3)),a.setAttribute("stroke",n),a.setAttribute("fill","none"),a.setAttribute("stroke-linecap","round"),o.appendChild(a)}}),(function(t){var n=document.createElement("circle"),a="function"==typeof e.dotSize?e.dotSize():e.dotSize;n.setAttribute("r",a),n.setAttribute("cx",t.x),n.setAttribute("cy",t.y),n.setAttribute("fill",t.color),o.appendChild(n)}));var s='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 '+r+" "+i+'" width="'+r+'" height="'+i+'">',l=o.innerHTML;if(void 0===l){var u=document.createElement("dummy"),d=o.childNodes;u.innerHTML="";for(var c=0;c<d.length;c+=1)u.appendChild(d[c].cloneNode(!0));l=u.innerHTML}return"data:image/svg+xml;base64,"+btoa(s+l+"</svg>")},hx.prototype.fromData=function(e){var t=this;this.clear(),this._fromData(e,(function(e,n){return t._drawCurve(e,n.start,n.end)}),(function(e){return t._drawDot(e)})),this._data=e},hx.prototype.toData=function(){return this._data};var px=Object.freeze({__proto__:null,default:hx}),mx=Y((function(e,t){e.exports=function(e){function t(a){if(n[a])return n[a].exports;var r=n[a]={exports:{},id:a,loaded:!1};return e[a].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t){function n(e){var t=e.getContext("2d"),n=e.width,a=e.height,r=t.getImageData(0,0,n,a).data,s=i(!0,n,a,r),l=i(!1,n,a,r),u=o(!0,n,a,r),d=o(!1,n,a,r)-u+1,c=l-s+1,f=t.getImageData(u,s,d,c);return e.width=d,e.height=c,t.clearRect(0,0,d,c),t.putImageData(f,0,0),e}function a(e,t,n,a){return{red:a[4*(n*t+e)],green:a[4*(n*t+e)+1],blue:a[4*(n*t+e)+2],alpha:a[4*(n*t+e)+3]}}function r(e,t,n,r){return a(e,t,n,r).alpha}function i(e,t,n,a){for(var i=e?1:-1,o=e?0:n-1;e?o<n:o>-1;o+=i)for(var s=0;s<t;s++)if(r(s,o,t,a))return o;return null}function o(e,t,n,a){for(var i=e?1:-1,o=e?0:t-1;e?o<t:o>-1;o+=i)for(var s=0;s<n;s++)if(r(o,s,t,a))return o;return null}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n}])}));H(mx);var gx=function(e){return e&&e.default||e}(px),vx=Y((function(e,t){e.exports=function(e,t,n,a){return function(e){function t(a){if(n[a])return n[a].exports;var r=n[a]={exports:{},id:a,loaded:!1};return e[a].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){function a(e){return e&&e.__esModule?e:{default:e}}function r(e,t){var n={};for(var a in e)t.indexOf(a)>=0||Object.prototype.hasOwnProperty.call(e,a)&&(n[a]=e[a]);return n}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},u=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),d=a(n(1)),c=n(2),f=a(c),h=a(n(3)),p=a(n(4)),m=function(e){function t(){var e,n,a;i(this,t);for(var s=arguments.length,l=Array(s),u=0;u<s;u++)l[u]=arguments[u];return n=a=o(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(l))),a._sigPad=null,a._excludeOurProps=function(){var e=a.props;return r(e,["canvasProps","clearOnResize"])},a.getCanvas=function(){return a._canvas},a.getTrimmedCanvas=function(){var e=document.createElement("canvas");return e.width=a._canvas.width,e.height=a._canvas.height,e.getContext("2d").drawImage(a._canvas,0,0),(0,p.default)(e)},a.getSignaturePad=function(){return a._sigPad},a._checkClearOnResize=function(){a.props.clearOnResize&&a._resizeCanvas()},a._resizeCanvas=function(){var e=a.props.canvasProps||{},t=e.width,n=e.height;if(!t||!n){var r=a._canvas,i=Math.max(window.devicePixelRatio||1,1);t||(r.width=r.offsetWidth*i),n||(r.height=r.offsetHeight*i),r.getContext("2d").scale(i,i),a.clear()}},a.on=function(){return window.addEventListener("resize",a._checkClearOnResize),a._sigPad.on()},a.off=function(){return window.removeEventListener("resize",a._checkClearOnResize),a._sigPad.off()},a.clear=function(){return a._sigPad.clear()},a.isEmpty=function(){return a._sigPad.isEmpty()},a.fromDataURL=function(e,t){return a._sigPad.fromDataURL(e,t)},a.toDataURL=function(e,t){return a._sigPad.toDataURL(e,t)},a.fromData=function(e){return a._sigPad.fromData(e)},a.toData=function(){return a._sigPad.toData()},o(a,n)}return s(t,e),u(t,[{key:"componentDidMount",value:function(){this._sigPad=new h.default(this._canvas,this._excludeOurProps()),this._resizeCanvas(),this.on()}},{key:"componentWillUnmount",value:function(){this.off()}},{key:"componentDidUpdate",value:function(){Object.assign(this._sigPad,this._excludeOurProps())}},{key:"render",value:function(){var e=this;return f.default.createElement("canvas",l({ref:function(t){e._canvas=t}},this.props.canvasProps))}}]),t}(c.Component);m.propTypes={velocityFilterWeight:d.default.number,minWidth:d.default.number,maxWidth:d.default.number,minDistance:d.default.number,dotSize:d.default.oneOfType([d.default.number,d.default.func]),penColor:d.default.string,throttle:d.default.number,onEnd:d.default.func,onBegin:d.default.func,canvasProps:d.default.object,clearOnResize:d.default.bool},m.defaultProps={clearOnResize:!0},t.default=m},function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t){e.exports=n},function(e,t){e.exports=a}])}(dx,u.default,gx,mx)})),yx=H(vx);function bx(e){var t,n=null!==(t=e.toDataURL())&&void 0!==t?t:null,a={clickX_simple:[],clickY_simple:[],time_simple:[],pressure:"",fileContent:n?S(n):""};return e.toData().forEach((function(e){var t=[],n=[],r=[];e.forEach((function(e){t.push(e.x),n.push(e.y),r.push(new Date(e.time).toString())})),a.clickX_simple.push(t),a.clickY_simple.push(n),a.time_simple.push(r)})),a}var xx,Cx,wx,Ex,kx,Tx,Mx,Ix,Sx,Dx,Nx,Ax,Lx,Rx,Ox,Fx=h.default.div(xx||(xx=w(["\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n ","\n ","\n ","\n"],["\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n ","\n ","\n ","\n"])),(function(e){var t,n;return(null===(t=e.theme.signatureCapture)||void 0===t?void 0:t.background)?"background: ".concat(null===(n=e.theme.signatureCapture)||void 0===n?void 0:n.background,";"):""}),(function(e){var t,n;return(null===(t=e.theme.signatureCapture)||void 0===t?void 0:t.backgroundSize)?"background-size: ".concat(null===(n=e.theme.signatureCapture)||void 0===n?void 0:n.backgroundSize,";"):""}),(function(e){var t,n;return(null===(t=e.theme.signatureCapture)||void 0===t?void 0:t.backgroundPosition)?"background-position: ".concat(null===(n=e.theme.signatureCapture)||void 0===n?void 0:n.backgroundPosition,";"):""})),jx=h.default.div(Cx||(Cx=w(["\n position: absolute;\n top: 25%;\n left: 15%;\n width: 70%;\n height: 50%;\n\n @media (max-width: 800px) {\n top: 15%;\n left: 2%;\n width: 96%;\n height: 70%;\n }\n"],["\n position: absolute;\n top: 25%;\n left: 15%;\n width: 70%;\n height: 50%;\n\n @media (max-width: 800px) {\n top: 15%;\n left: 2%;\n width: 96%;\n height: 70%;\n }\n"]))),Px=h.default.div(wx||(wx=w(["\n position: relative;\n background: ",";\n border: ",";\n border-radius: ",";\n flex-grow: 1;\n z-index: 100;\n height: 100%;\n"],["\n position: relative;\n background: ",";\n border: ",";\n border-radius: ",";\n flex-grow: 1;\n z-index: 100;\n height: 100%;\n"])),(function(e){var t,n,a;return null!==(a=null===(n=null===(t=e.theme.signatureCapture)||void 0===t?void 0:t.canvas)||void 0===n?void 0:n.background)&&void 0!==a?a:"rgba(255, 255, 255, 0.5)"}),(function(e){var t,n,a;return null!==(a=null===(n=null===(t=e.theme.signatureCapture)||void 0===t?void 0:t.canvas)||void 0===n?void 0:n.border)&&void 0!==a?a:"1px solid #dedede"}),(function(e){var t,n,a;return null!==(a=null===(n=null===(t=e.theme.signatureCapture)||void 0===t?void 0:t.canvas)||void 0===n?void 0:n.borderRadius)&&void 0!==a?a:"16px"})),Bx=h.default(ym)(Ex||(Ex=w(["\n flex-grow: 0;\n padding-top: 12px;\n display: flex;\n z-index: 1000;\n position: relative;\n"],["\n flex-grow: 0;\n padding-top: 12px;\n display: flex;\n z-index: 1000;\n position: relative;\n"]))),_x=function(e){var n,a=e.onAccept,r=e.classNames,i=void 0===r?{}:r,o=e.verbiage,s=void 0===o?{}:o,l=Le(),d=l.ref,c=l.width,f=l.height,h=t.useRef(null),p=Xp(s,{headingText:"Please sign the box below",acceptBtnText:"Accept",clearBtnText:"Clear"});return u.default.createElement(B,{className:i.container},u.default.createElement(Fx,{className:i.inner},u.default.createElement(sm,{className:i.guidanceMessageContainer,$top:"5vh"},u.default.createElement(lm,{className:i.guidanceMessage},p.headingText)),u.default.createElement(jx,{className:i.canvasContainer},u.default.createElement(Px,{ref:d,className:i.canvasInner},u.default.createElement(yx,{ref:h,canvasProps:{width:c,height:f,className:i.canvas}})),u.default.createElement(Bx,{className:i.buttonsRow},u.default.createElement(ce,{variant:"secondary",className:i.clearBtn,onClick:null===(n=h.current)||void 0===n?void 0:n.clear,finished:!0},p.clearBtnText),u.default.createElement(Ux,{variant:"positive",className:i.acceptBtn,onClick:function(){if(h.current){var e=bx(h.current);null==a||a(e,h.current.toDataURL())}},finished:!0},p.acceptBtnText)))))},Ux=h.default(ce)(kx||(kx=w(["\n margin-left: auto;\n"],["\n margin-left: auto;\n"]))),zx=function(e){var n=t.useRef(null),a=t.useRef([]),r=t.useState(null),i=r[0],o=r[1],s=t.useState(!1),l=s[0],u=s[1],d=null==e?void 0:e.stream,c=t.useCallback((function(){d&&(a.current=[],u(!0),n.current=new MediaRecorder(d,{videoBitsPerSecond:27e4,audioBitsPerSecond:32e3}),n.current.ondataavailable=function(e){a.current.push(e.data)},n.current.onstop=function(){var t=new Blob(a.current,{type:"video/mp4"});a.current=[],o(URL.createObjectURL(t)),u(!1),null==e||e.release()},n.current.start())}),[e,d]),f=t.useCallback((function(){var e;null===(e=n.current)||void 0===e||e.stop()}),[]);return{isRecording:l,startRecording:c,stopRecording:f,videoUrl:i}},Gx=function(e){var n,a,r,i,o=e.onVideoCaptured,s=e.onFaceNotDetected,l=e.onExit,d=e.classNames,c=void 0===d?{}:d,f=e.colors,h=void 0===f?{}:f,p=e.verbiage,m=void 0===p?{}:p,g=e.debugMode,v=void 0!==g&&g,y=t.useContext(Xe),w=y.cameraRef,E=y.videoRef,k=Le(),T=k.ref,M=k.width,I=k.height,S=t.useRef(null),D=t.useRef(null),N=t.useRef([]),A=t.useContext(Qf).onPredictionMade,L=zx(w.current),R=L.isRecording,O=L.startRecording,F=L.stopRecording,j=L.videoUrl,P=t.useState(null),_=P[0],U=P[1],z=t.useState(null),G=z[0],W=z[1],$=t.useState(null),V=$[0],q=$[1];h.guidanceMessageBackgroundColor||(h.guidanceMessageBackgroundColor="#ccc"),h.guidanceMessageTextColor||(h.guidanceMessageTextColor="black");var H=Xp(m,{guidanceMessageText:"Please sign the box below",acceptBtnText:"Accept",clearBtnText:"Clear"}),Y=t.useRef(null);t.useEffect((function(){setTimeout((function(){if(!R&&!j&&Y.current){O();var e=Y.current.captureStream(25);D.current=new MediaRecorder(e,{videoBitsPerSecond:27e4}),D.current.start(),D.current.ondataavailable=function(e){var t;N.current.push(e.data),"recording"===(null===(t=D.current)||void 0===t?void 0:t.state)&&D.current.stop()},D.current.onstop=function(){var e=new Blob(N.current,{type:"video/mp4"});q(e)}}}),100)}),[R,O,j]),t.useEffect((function(){V&&_&&G&&(null==o||o(V,_,G))}),[o,_,G,V]);var Z=t.useRef(0);t.useEffect((function(){var e;if(S.current&&E.current&&Y.current&&w.current&&R){var t=[w.current.width,w.current.height],n=t[0],a=t[1],r="undefined"!=typeof window&&window.innerWidth<window.innerHeight;r&&n>a&&(n=(e=[a,n])[0],a=e[1]),Y.current.width=n,Y.current.height=a;var i=Y.current.getContext("2d");if(i)return Z.current=requestAnimationFrame((function e(){return b(this,void 0,void 0,(function(){var t;return x(this,(function(o){return S.current&&E.current&&Y.current?(t=[n*(r?.02:.15),a*(r?.15:.25),n*(r?.96:.7),a*(r?.7:.5)],i.drawImage(E.current,0,0,n,a),i.beginPath(),i.fillStyle="rgba(255,255,255,0.5)",i.roundRect.apply(i,C(C([],t,!1),[16],!1)),i.fill(),i.drawImage.apply(i,C([S.current.getCanvas()],t,!1)),Z.current=requestAnimationFrame(e),[2]):(cancelAnimationFrame(Z.current),[2])}))}))})),function(){cancelAnimationFrame(Z.current)}}}),[w,R,s,E]);var Q=t.useState(0),X=Q[0],K=Q[1];return t.useEffect((function(){A((function(e){K((function(t){return 0===e.length?t+1:0}))}))}),[A]),t.useEffect((function(){X>=2&&(null==s||s())}),[X,s]),u.default.createElement(B,{className:"flex ".concat(null!==(n=c.container)&&void 0!==n?n:"")},H.guidanceMessageText&&u.default.createElement(sm,{$top:"5vh",className:c.guidanceMessageContainer},u.default.createElement(lm,{className:c.guidanceMessage,$background:h.guidanceMessageBackgroundColor,$textColor:h.guidanceMessageTextColor},H.guidanceMessageText)),u.default.createElement(jx,{className:c.canvasContainer},u.default.createElement(Px,{ref:T,className:c.canvasInner},u.default.createElement(yx,{ref:S,canvasProps:{width:M,height:I,className:c.canvas}})),u.default.createElement(Bx,{className:c.buttonsRow},u.default.createElement(ce,{variant:"secondary",className:c.clearBtn,onClick:null===(a=S.current)||void 0===a?void 0:a.clear,finished:!0},H.clearBtnText),u.default.createElement(Wx,{variant:"positive",className:c.acceptBtn,style:{marginLeft:"auto"},onClick:function(){var e;if(S.current){var t=bx(S.current);U(t),W(S.current.toDataURL()),F(),null===(e=D.current)||void 0===e||e.stop()}},finished:!0},H.acceptBtnText))),v&&u.default.createElement(Sh,null,"Video: ",null===(r=w.current)||void 0===r?void 0:r.width,"x",null===(i=w.current)||void 0===i?void 0:i.height),u.default.createElement(vm,{onClick:l,className:c.exitCaptureBtn}),u.default.createElement(_e,{ref:Y}))},Wx=h.default(ce)(Tx||(Tx=w(["\n margin-left: auto;\n"],["\n margin-left: auto;\n"]))),$x=function(e){var t=e.videoUrl,n=e.onDoneClick,a=e.onRetryClick,r=e.classNames,i=void 0===r?{}:r,o=e.colors,s=void 0===o?{}:o,l=e.verbiage,d=Xp(void 0===l?{}:l,{headingText:"Video signature has been successfully captured!",retryBtnText:"Retry",doneBtnText:"Done"});return u.default.createElement(W,{className:i.container},u.default.createElement($,{className:i.inner},u.default.createElement("h1",{className:i.heading},d.headingText),u.default.createElement(V,{className:i.videoContainer},u.default.createElement(Vx,{className:i.video,src:t,poster:t+"#t=0.1",controls:!0,preload:"metadata",autoPlay:!0})),u.default.createElement(ym,{className:i.buttonsRow},u.default.createElement(ce,{variant:"warning",className:i.retryBtn,onClick:a,colors:s.retryBtn,finished:!0},d.retryBtnText),u.default.createElement(ce,{variant:"positive",className:i.doneBtn,onClick:n,colors:s.doneBtn,finished:!0},d.doneBtnText))))},Vx=h.default.video(Mx||(Mx=w(["\n margin-left: auto;\n margin-right: auto;\n max-width: 100%;\n"],["\n margin-left: auto;\n margin-right: auto;\n max-width: 100%;\n"]))),qx=function(e){var n,a=e.onComplete,r=e.onVideoCaptured,i=e.onRetryClicked,o=e.onExitCapture,s=e.onUserCancel,l=e.onModelError,d=e.loadingOverlayMode,c=void 0===d?"default":d,f=e.modelLoadTimeoutMs,h=void 0===f?Hf:f,p=e.skipSuccessScreen,m=void 0!==p&&p,g=e.assets,v=void 0===g?{}:g,y=e.classNames,C=void 0===y?{}:y,w=e.colors,E=void 0===w?{}:w,k=e.verbiage,T=void 0===k?{}:k,M=e.debugMode,S=void 0!==M&&M,D=t.useContext(Ie),N=D.submit,A=D.selfieImage,L=D.signatureVideoUrl,R=D.setSelfieImage,O=D.setSignatureData,F=D.setSignatureVideoUrl,j=D.logSelfieCaptureAttempt,P=t.useState("LOADING"),_=P[0],U=P[1],z=t.useRef(),G=t.useRef(),W=t.useRef();t.useEffect((function(){z.current=new Date}),[]),t.useEffect((function(){"CHECKING_LIVENESS"===_&&(G.current=new Date)}),[_]);var $=t.useCallback((function(){var e,t,n;j({autoCapture:"Y",captureTime:(null!==(e=W.current)&&void 0!==e?e:new Date).getTime()-(null!==(t=G.current)&&void 0!==t?t:new Date).getTime(),operationTime:(new Date).getTime()-(null!==(n=z.current)&&void 0!==n?n:new Date).getTime()}),z.current=new Date}),[j]),V=t.useCallback((function(){U("CHECKING_LIVENESS")}),[]),q=t.useCallback((function(e){return b(void 0,void 0,void 0,(function(){var t;return x(this,(function(n){switch(n.label){case 0:return U("CAPTURING_SIGNATURE"),$(),A?[3,2]:(t=R,[4,I(e)]);case 1:t.apply(void 0,[n.sent()]),n.label=2;case 2:return[2]}}))}))}),[$,A,R]),H=t.useCallback((function(e,t,n){O(t),F(URL.createObjectURL(e)),U("SUCCESS"),null==r||r(e,t,n)}),[r,O,F]),Y=t.useCallback((function(){U("CHECKING_LIVENESS")}),[]),Z=t.useState(0),Q=Z[0],X=Z[1],K=t.useCallback((function(){X((function(e){return e+1})),U("LOADING"),null==o||o()}),[o]),J=t.useCallback((function(){null==i||i(),K()}),[K,i]),ee=Lg(m,"SUCCESS"===_,a),te=t.useCallback((function(){return b(void 0,void 0,void 0,(function(){return x(this,(function(e){switch(e.label){case 0:return[4,N()];case 1:return e.sent(),null==a||a(),[2]}}))}))}),[a,N]);return u.default.createElement(Xf,{throttleMs:"CAPTURING_SIGNATURE"===_?250:0,onModelError:l,modelLoadTimeoutMs:h},u.default.createElement(B,{className:"flex ".concat(null!==(n=null==C?void 0:C.container)&&void 0!==n?n:"")},u.default.createElement(Ng,{className:C.cameraFeed}),"LOADING"!==_&&function(){switch(_){case"CHECKING_LIVENESS":return u.default.createElement(_y,{onSuccess:q,onExit:K,classNames:C.faceLiveness,colors:E.faceLiveness,verbiage:T.faceLiveness,debugMode:S});case"CAPTURING_SIGNATURE":return u.default.createElement(Gx,{onVideoCaptured:H,onFaceNotDetected:Y,onExit:K,classNames:C,colors:E,verbiage:T,debugMode:S});case"SUCCESS":if(!ee)return;return u.default.createElement($x,{videoUrl:null!=L?L:"",onDoneClick:te,onRetryClick:J,classNames:C.success,colors:E.success,verbiage:T.success});default:return null}}()),u.default.createElement(Tb,{key:Q,mode:c,assets:v.loadingOverlay,classNames:C.loadingOverlay,colors:E.loadingOverlay,verbiage:T.loadingOverlay,onDismissed:V,onUserCancel:s}))},Hx=function(e){var n,a=e.className,r=e.imageWidth,i=e.imageHeight,o=e.borderWidth,s=void 0===o?4:o,l=e.assets,d=void 0===l?{}:l,c=t.useContext(Xe).cameraRef;d.frontImageUrl||(d.frontImageUrl="".concat(Ra,"/Shieldout-IDCard-Front-SVG-Landscape-2.svg")),d.backImageUrl||(d.backImageUrl="".concat(Ra,"/Shieldout-IDCard-Back-SVG-Landscape-2.svg"));var f=!(null===(n=c.current)||void 0===n?void 0:n.isRearFacing),h=t.useState(1),p=h[0],m=h[1],g=t.useState(0),v=g[0],y=g[1],b=["rotateY(".concat(v,"deg)")];f&&b.push("scaleX(-1)");var x=["rotateY(".concat(180-v,"deg)")];return f&&x.push("scaleX(-1)"),t.useEffect((function(){var e;function t(){m(1),y(180),e=setTimeout((function(){m(0),y(0)}),1500)}var n=setInterval(t,2500);return e=setTimeout(t,250),function(){clearInterval(n),clearTimeout(e)}}),[]),u.default.createElement(u.default.Fragment,null,u.default.createElement(Yx,{src:d.frontImageUrl,alt:"",className:a,$transforms:b.join(" "),$transitionTime:p,$borderWidth:s,$imageWidth:r,$imageHeight:i}),u.default.createElement(Yx,{src:d.backImageUrl,alt:"",className:a,$transforms:x.join(" "),$transitionTime:p,$borderWidth:s,$imageWidth:r,$imageHeight:i,$isBack:!0}))},Yx=h.default.img(Ix||(Ix=w(["\n backface-visibility: hidden;\n transition: transform ","s;\n transform: ",";\n transform-style: preserve-3d;\n position: ",";\n display: block;\n top: ","px;\n width: ","px;\n height: ","px;\n"],["\n backface-visibility: hidden;\n transition: transform ","s;\n transform: ",";\n transform-style: preserve-3d;\n position: ",";\n display: block;\n top: ","px;\n width: ","px;\n height: ","px;\n"])),(function(e){return e.$transitionTime}),(function(e){return e.$transforms}),(function(e){return e.$isBack?"absolute":"relative"}),(function(e){return-e.$borderWidth/2}),(function(e){return e.$imageWidth}),(function(e){return e.$imageHeight+e.$borderWidth})),Zx=function(e){var n,a,i,o,s,l,d,c,f,h,p,m,g,v,y,b,x,C=e.requestedAction,w=void 0===C?"SHOW_ID_FRONT":C,E=e.satisfied,k=void 0!==E&&E,T=e.faceGuideBorderWidth,M=e.faceGuideBorderColor,I=e.idCardGuideBorderWidth,S=e.idCardGuideBorderColor,D=e.assets,N=void 0===D?{}:D,A=e.classNames,L=void 0===A?{}:A,R=e.verbiage,O=void 0===R?{}:R,F=t.useContext(Xe).cameraRef,j=t.useRef(null),P=t.useState(0),B=P[0],_=P[1],U=t.useState(0),z=U[0],G=U[1];N.frontImageUrl||(N.frontImageUrl="".concat(Ra,"/Shieldout-IDCard-Front-SVG-Landscape-2.svg")),N.backImageUrl||(N.backImageUrl="".concat(Ra,"/Shieldout-IDCard-Back-SVG-Landscape-2.svg"));var W=Xp(O,{idFrontInstructionText:"Display the front of your ID card...",idBackInstructionText:"Display the back of your ID card...",flipIdInstructionText:"Please flip your ID card..."}),$="SHOW_ID_FRONT"===w?W.idFrontInstructionText:"FLIP_ID"===w?W.flipIdInstructionText:W.idBackInstructionText,V="undefined"!=typeof window&&window.innerWidth>window.innerHeight?"30%":"75%",q=r.useTheme();return void 0===T&&(T=null!==(i=null===(a=null===(n=q.idVideoCapture)||void 0===n?void 0:n.faceGuides)||void 0===a?void 0:a.borderWidth)&&void 0!==i?i:4),void 0===M&&(M=null!==(c=k?null===(s=null===(o=q.idVideoCapture)||void 0===o?void 0:o.faceGuides)||void 0===s?void 0:s.satisfiedColor:null===(d=null===(l=q.idVideoCapture)||void 0===l?void 0:l.faceGuides)||void 0===d?void 0:d.unsatisfiedColor)&&void 0!==c?c:"white"),void 0===I&&(I=null!==(p=null===(h=null===(f=q.idVideoCapture)||void 0===f?void 0:f.idCardGuides)||void 0===h?void 0:h.borderWidth)&&void 0!==p?p:4),void 0===S&&(S=null!==(b=k?null===(g=null===(m=q.idVideoCapture)||void 0===m?void 0:m.idCardGuides)||void 0===g?void 0:g.satisfiedColor:null===(y=null===(v=q.idVideoCapture)||void 0===v?void 0:v.idCardGuides)||void 0===y?void 0:y.unsatisfiedColor)&&void 0!==b?b:"white"),u.default.createElement(Qx,{className:L.container},u.default.createElement(Xx,{className:L.faceGuide,$borderWidth:T,$borderColor:M}),u.default.createElement(Kx,{$width:V,className:L.idCardGuideContainer},u.default.createElement(Jx,{className:L.idCardGuideInstructionsContainer},u.default.createElement(eC,{className:L.idCardGuideInstructions},$)),u.default.createElement(tC,{$borderWidth:I,$borderColor:S,className:L.idCardGuideImageContainer},"FLIP_ID"===w?u.default.createElement(Hx,{assets:N,imageWidth:B,imageHeight:z,borderWidth:I,className:L.flipIdPromptImage}):u.default.createElement(nC,{ref:j,src:"SHOW_ID_BACK"===w?N.backImageUrl:N.frontImageUrl,alt:"",className:L.idCardGuideImage,$isMirrored:!(null===(x=F.current)||void 0===x?void 0:x.isRearFacing),onLoad:function(){var e,t,n,a;B||_(null!==(t=null===(e=j.current)||void 0===e?void 0:e.width)&&void 0!==t?t:0),z||G(null!==(a=null===(n=j.current)||void 0===n?void 0:n.height)&&void 0!==a?a:0)}}))))},Qx=h.default.div(Sx||(Sx=w(["\n position: fixed;\n z-index: 1000;\n width: 100dvw;\n height: 100dvh;\n display: flex;\n flex-direction: column;\n font-family: ",";\n"],["\n position: fixed;\n z-index: 1000;\n width: 100dvw;\n height: 100dvh;\n display: flex;\n flex-direction: column;\n font-family: ",";\n"])),(function(e){var t;return null===(t=e.theme)||void 0===t?void 0:t.fontFamily})),Xx=h.default.div(Dx||(Dx=w(["\n border-width: ","px;\n border-color: ",";\n border-style: solid;\n border-radius: 50%;\n aspect-ratio: 1 / 1.618;\n height: 100%;\n min-height: 33dvh;\n margin: 4% auto auto;\n"],["\n border-width: ","px;\n border-color: ",";\n border-style: solid;\n border-radius: 50%;\n aspect-ratio: 1 / 1.618;\n height: 100%;\n min-height: 33dvh;\n margin: 4% auto auto;\n"])),(function(e){var t;return null!==(t=e.$borderWidth)&&void 0!==t?t:0}),(function(e){var t;return null!==(t=e.$borderColor)&&void 0!==t?t:"white"})),Kx=h.default.div(Nx||(Nx=w(["\n width: ",";\n display: flex;\n flex-flow: column nowrap;\n margin: 2% auto;\n"],["\n width: ",";\n display: flex;\n flex-flow: column nowrap;\n margin: 2% auto;\n"])),(function(e){return e.$width})),Jx=h.default.div(Ax||(Ax=w(["\n width: 100%;\n flex-grow: 1;\n text-align: center;\n color: white;\n display: flex;\n flex-direction: column;\n justify-content: end;\n"],["\n width: 100%;\n flex-grow: 1;\n text-align: center;\n color: white;\n display: flex;\n flex-direction: column;\n justify-content: end;\n"]))),eC=h.default.span(Lx||(Lx=w(["\n align-content: center;\n margin-top: 12px;\n margin-bottom: 12px;\n"],["\n align-content: center;\n margin-top: 12px;\n margin-bottom: 12px;\n"]))),tC=h.default.div(Rx||(Rx=w(["\n position: relative;\n border: ","px solid\n ",";\n"],["\n position: relative;\n border: ","px solid\n ",";\n"])),(function(e){return e.$borderWidth}),(function(e){return e.$borderColor})),nC=h.default.img(Ox||(Ox=w(["\n width: 100%;\n max-height: 100%;\n ","\n"],["\n width: 100%;\n max-height: 100%;\n ","\n"])),(function(e){return e.$isMirrored?"transform: scaleX(-1);":""})),aC=function(e){var t=e.text,n=e.onComplete,a=e.startedAt,r=e.durationMs,i=void 0===r?15e3:r,o=e.classNames,s=void 0===o?{}:o,l=e.verbiage,d=void 0===l?{}:l;t=Qp(t,"");var c=Xp(d,{headingText:"Please read the following text aloud",doneBtnText:"Done"}),f=function(e){var t=e%1e3;e=(e-t)/1e3;var n=e%60;e=(e-n)/60;var a=e%60;return a+":"+("00"+(n+=1)).slice(-2)}(Math.max(0,i-((new Date).getTime()-(null!=a?a:new Date).getTime())));return u.default.createElement(DC,{className:s.container},u.default.createElement(NC,{className:s.heading},c.headingText),u.default.createElement(AC,{className:s.prompt},t),u.default.createElement(LC,{className:s.buttonsRow},u.default.createElement(RC,{className:s.timeRemaining},f),u.default.createElement(OC,{variant:"positive",className:s.doneBtn,onClick:n,finished:!0},c.doneBtnText)))};var rC,iC,oC,sC,lC,uC,dC,cC,fC,hC,pC,mC,gC,vC,yC,bC,xC,CC,wC,EC,kC,TC,MC,IC,SC,DC=h.default.div(rC||(rC=w(["\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n display: flex;\n flex-direction: column;\n"],["\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n display: flex;\n flex-direction: column;\n"]))),NC=h.default.div(iC||(iC=w(["\n padding: 20px;\n font-weight: bold;\n margin: auto auto 32px;\n\n ",";\n ",";\n ",";\n"],["\n padding: 20px;\n font-weight: bold;\n margin: auto auto 32px;\n\n ",";\n ",";\n ",";\n"])),(function(e){var t,n,a,r,i,o;return(null===(a=null===(n=null===(t=e.theme.idVideoCapture)||void 0===t?void 0:t.readTextPrompt)||void 0===n?void 0:n.heading)||void 0===a?void 0:a.backgroundColor)?"background: ".concat(null===(o=null===(i=null===(r=e.theme.idVideoCapture)||void 0===r?void 0:r.readTextPrompt)||void 0===i?void 0:i.heading)||void 0===o?void 0:o.backgroundColor,";"):""}),(function(e){var t,n,a,r,i,o;return(null===(a=null===(n=null===(t=e.theme.idVideoCapture)||void 0===t?void 0:t.readTextPrompt)||void 0===n?void 0:n.heading)||void 0===a?void 0:a.textColor)?"color: ".concat(null===(o=null===(i=null===(r=e.theme.idVideoCapture)||void 0===r?void 0:r.readTextPrompt)||void 0===i?void 0:i.heading)||void 0===o?void 0:o.textColor,";"):""}),(function(e){var t,n,a,r,i,o;return(null===(a=null===(n=null===(t=e.theme.idVideoCapture)||void 0===t?void 0:t.readTextPrompt)||void 0===n?void 0:n.heading)||void 0===a?void 0:a.borderRadius)?"border-radius: ".concat(null===(o=null===(i=null===(r=e.theme.idVideoCapture)||void 0===r?void 0:r.readTextPrompt)||void 0===i?void 0:i.heading)||void 0===o?void 0:o.borderRadius,";"):""})),AC=h.default.div(oC||(oC=w(["\n margin: 0 auto;\n text-align: center;\n padding: 50px;\n font-size: 24px;\n max-width: ",";\n\n ",";\n ",";\n ",";\n"],["\n margin: 0 auto;\n text-align: center;\n padding: 50px;\n font-size: 24px;\n max-width: ",";\n\n ",";\n ",";\n ",";\n"])),"undefined"!=typeof window&&window.innerWidth>window.innerHeight?"40%":"90%",(function(e){var t,n,a,r,i,o;return(null===(a=null===(n=null===(t=e.theme.idVideoCapture)||void 0===t?void 0:t.readTextPrompt)||void 0===n?void 0:n.prompt)||void 0===a?void 0:a.backgroundColor)?"background: ".concat(null===(o=null===(i=null===(r=e.theme.idVideoCapture)||void 0===r?void 0:r.readTextPrompt)||void 0===i?void 0:i.prompt)||void 0===o?void 0:o.backgroundColor,";"):""}),(function(e){var t,n,a,r,i,o;return(null===(a=null===(n=null===(t=e.theme.idVideoCapture)||void 0===t?void 0:t.readTextPrompt)||void 0===n?void 0:n.prompt)||void 0===a?void 0:a.textColor)?"color: ".concat(null===(o=null===(i=null===(r=e.theme.idVideoCapture)||void 0===r?void 0:r.readTextPrompt)||void 0===i?void 0:i.prompt)||void 0===o?void 0:o.textColor,";"):""}),(function(e){var t,n,a,r,i,o;return(null===(a=null===(n=null===(t=e.theme.idVideoCapture)||void 0===t?void 0:t.readTextPrompt)||void 0===n?void 0:n.prompt)||void 0===a?void 0:a.borderRadius)?"border-radius: ".concat(null===(o=null===(i=null===(r=e.theme.idVideoCapture)||void 0===r?void 0:r.readTextPrompt)||void 0===i?void 0:i.prompt)||void 0===o?void 0:o.borderRadius,";"):""})),LC=h.default(ym)(sC||(sC=w(["\n margin: 32px auto auto;\n gap: 20px;\n"],["\n margin: 32px auto auto;\n gap: 20px;\n"]))),RC=h.default.div(lC||(lC=w(["\n padding: 20px;\n\n ",";\n ",";\n ",";\n"],["\n padding: 20px;\n\n ",";\n ",";\n ",";\n"])),(function(e){var t,n,a,r,i,o;return(null===(a=null===(n=null===(t=e.theme.idVideoCapture)||void 0===t?void 0:t.readTextPrompt)||void 0===n?void 0:n.timeRemaining)||void 0===a?void 0:a.backgroundColor)?"background: ".concat(null===(o=null===(i=null===(r=e.theme.idVideoCapture)||void 0===r?void 0:r.readTextPrompt)||void 0===i?void 0:i.timeRemaining)||void 0===o?void 0:o.backgroundColor,";"):""}),(function(e){var t,n,a,r,i,o;return(null===(a=null===(n=null===(t=e.theme.idVideoCapture)||void 0===t?void 0:t.readTextPrompt)||void 0===n?void 0:n.timeRemaining)||void 0===a?void 0:a.textColor)?"color: ".concat(null===(o=null===(i=null===(r=e.theme.idVideoCapture)||void 0===r?void 0:r.readTextPrompt)||void 0===i?void 0:i.timeRemaining)||void 0===o?void 0:o.textColor,";"):""}),(function(e){var t,n,a,r,i,o;return(null===(a=null===(n=null===(t=e.theme.idVideoCapture)||void 0===t?void 0:t.readTextPrompt)||void 0===n?void 0:n.timeRemaining)||void 0===a?void 0:a.borderRadius)?"border-radius: ".concat(null===(o=null===(i=null===(r=e.theme.idVideoCapture)||void 0===r?void 0:r.readTextPrompt)||void 0===i?void 0:i.timeRemaining)||void 0===o?void 0:o.borderRadius,";"):""})),OC=h.default(ce)(uC||(uC=w(["\n margin: auto 0;\n"],["\n margin: auto 0;\n"]))),FC=.05,jC=function(e){var n,a,i,o,s,l,d,c,f,h,p,m,g,v,y,C,w,E=e.onComplete,k=e.onIdFrontImageCaptured,T=e.onIdBackImageCaptured,M=e.onFaceNotDetected,I=e.idCaptureModelsEnabled,S=void 0===I||I,D=e.idCardFrontDelay,N=void 0===D?1e3:D,A=e.idCardFrontDetectionThreshold,L=void 0===A?.6:A,R=e.idCardFrontFocusThreshold,O=void 0===R?0:R,F=e.goodIdCardFrontFramesThreshold,j=void 0===F?1:F,P=e.idCardBackDetectionThreshold,_=void 0===P?.6:P,U=e.idCardBackFocusThreshold,z=void 0===U?0:U,G=e.goodIdCardBackFramesThreshold,W=void 0===G?1:G,$=e.skipShowIdCardBack,V=void 0!==$&&$,q=e.captureCountdownSeconds,H=void 0===q?3:q,Y=e.readTextPrompt,Z=e.readTextTimeoutDurationMs,Q=void 0===Z?15e3:Z,X=e.assets,K=void 0===X?{}:X,J=e.classNames,ee=void 0===J?{}:J,te=e.colors,ne=void 0===te?{}:te,ae=e.verbiage,re=void 0===ae?{}:ae,ie=e.debugMode,oe=void 0!==ie&&ie,se=Le(),le=se.ref,ue=se.width,de=void 0===ue?1:ue,ce=se.height,fe=void 0===ce?1:ce,he=t.useContext(Xe),pe=he.cameraRef,me=he.videoRef,ge=he.videoLoaded,ve=he.setVideoLoaded,ye=he.cameraReady,be=he.takePhoto,xe=t.useState([]),Ce=xe[0],we=xe[1],Ee=t.useState([]),ke=Ee[0],Te=Ee[1],Me=t.useContext(uh),Ie=Me.ready,Se=Me.working,De=Me.makePrediction,Ne=Me.onPredictionMade,Ae=Me.setThresholds,Re=Me.bestFrameDetectionScore,Oe=Me.bestFrameFocusScore,Fe=Me.resetBestFrame,je=Me.modelError,Pe=t.useContext(Qf).onPredictionMade,Be=zx(pe.current),_e=Be.isRecording,Ue=Be.startRecording,ze=Be.stopRecording,Ge=Be.videoUrl;t.useEffect((function(){_e||Ge||Ue(),Ge&&(ve(!1),null==E||E(Ge))}),[_e,E,ve,Ue,Ge]);var We=t.useRef(0),$e=t.useRef(!1);t.useEffect((function(){$e.current=ge&&ye&&Ie}),[ye,Ie,ge]);var Ve=t.useState("SHOW_ID_FRONT"),qe=Ve[0],He=Ve[1];t.useEffect((function(){if(("SHOW_ID_FRONT"===qe||"SHOW_ID_BACK"===qe)&&S&&Ie&&ye&&ge)return We.current=requestAnimationFrame((function e(){return b(this,void 0,void 0,(function(){return x(this,(function(t){return $e.current&&!Se.current&&me.current&&De(me.current),We.current=requestAnimationFrame(e),[2]}))}))})),function(){cancelAnimationFrame(We.current)}}),[ye,S,Ie,Se,De,qe,ge,me]),t.useEffect((function(){Ae({document:"SHOW_ID_FRONT"===qe?L:"SHOW_ID_BACK"===qe?_:1,passport:1,focus:{mobile:"SHOW_ID_FRONT"===qe?O:"SHOW_ID_BACK"===qe?z:0}})}),[_,z,L,O,qe,Ae]);var Ye=t.useState(0),Ze=Ye[0],Qe=Ye[1],Ke=t.useState(0),Je=Ke[0],et=Ke[1],tt=t.useState(0),nt=tt[0],at=tt[1],rt="SHOW_ID_FRONT"===qe?j:W,it=nt>=rt;t.useEffect((function(){S&&Ne((function(e){we(e.detectedObjects),Qe(e.detectionScore),et(e.focusScore),at(e.detectionThresholdMet&&e.focusThresholdMet?function(e){return e+1}:0)}))}),[S,L,Ne]);var ot=t.useState(null),st=ot[0],lt=ot[1];t.useEffect((function(){1===nt&<((new Date).getTime())}),[nt]);var ut="SHOW_ID_FRONT"!==qe||null!==st&&(new Date).getTime()>st+N,dt=t.useCallback((function(){Y?He("READ_TEXT"):ze()}),[Y,ze]),ct=null!==(a=null===(n=me.current)||void 0===n?void 0:n.videoWidth)&&void 0!==a?a:0,ft=null!==(o=null===(i=me.current)||void 0===i?void 0:i.videoHeight)&&void 0!==o?o:0,ht=null===(s=null==ke?void 0:ke[0])||void 0===s?void 0:s.box,pt=!ht||!ct||ht.xMin>ct*FC&&ht.yMin>ft*FC&&ht.xMax<.95*ct&&ht.yMax<.95*ft,mt=t.useState(),gt=mt[0],vt=mt[1],yt=t.useRef(!1),bt=t.useCallback((function(){return b(void 0,void 0,void 0,(function(){var e,t,n;return x(this,(function(a){switch(a.label){case 0:return yt.current?[2]:(yt.current=!0,[4,be()]);case 1:if(!(e=a.sent()))return yt.current=!1,[2];a.label=2;case 2:return a.trys.push([2,,10,11]),(n=e)?[4,new Promise((function(t){var n=new FileReader;n.onloadend=function(){return t(n.result)},n.readAsDataURL(e)}))]:[3,4];case 3:n=a.sent(),a.label=4;case 4:return t=n,"SHOW_ID_FRONT"!=qe?[3,8]:(k&&t&&k(t),V?!0!==V?[3,5]:[2,dt()]:[3,7]);case 5:return[4,V()];case 6:if(a.sent())return[2,dt()];a.label=7;case 7:return He("FLIP_ID"),setTimeout((function(){He("SHOW_ID_BACK")}),6e3),[3,9];case 8:"SHOW_ID_BACK"==qe&&(T&&t&&T(t),dt()),a.label=9;case 9:return[3,11];case 10:return we([]),Qe(0),et(0),at(0),vt(void 0),Fe(),yt.current=!1,[7];case 11:return[2]}}))}))}),[dt,T,k,qe,Fe,V,be]),xt=it&&pt&&ut;t.useEffect((function(){xt&&!gt&&vt(new Date)}),[gt,xt]),t.useEffect((function(){if(gt){var e=(new Date).getTime()+1e3*H-gt.getTime(),t=setTimeout(bt,e);return function(){clearTimeout(t)}}}),[H,bt,gt]);var Ct=t.useCallback((function(){ze()}),[ze]),wt=Iy(Q,Ct,"READ_TEXT"!==qe,!1,"READ_TEXT"===qe).timeoutStartedAt,Et=t.useState(0),kt=Et[0],Tt=Et[1];t.useEffect((function(){Pe((function(e){Te(e),Tt((function(t){return 0===e.length?t+1:0}))}))}),[Pe]),t.useEffect((function(){kt>=2&&(null==M||M())}),[kt,M]);var Mt=r.useTheme(),It=Xp(re,{faceNotCenteredText:"Please move your face to the center...",searchingForIdCardText:"Searching for ID card...",captureBtnText:"Capture"}),St=It.captureBtnText,Dt=It.faceNotCenteredText,Nt=It.searchingForIdCardText,At=Lh({enabled:oe,pageWidth:de,pageHeight:fe,videoWidth:null!==(d=null===(l=me.current)||void 0===l?void 0:l.videoWidth)&&void 0!==d?d:0,videoHeight:null!==(f=null===(c=me.current)||void 0===c?void 0:c.videoHeight)&&void 0!==f?f:0}),Lt=["SHOW_ID_FRONT","SHOW_ID_BACK"].includes(qe),Rt=!!gt&&Math.max(0,H-Math.floor(((new Date).getTime()-gt.getTime())/1e3)),Ot=pt?S&&Lt&&!it?Nt:void 0:Dt;return u.default.createElement(B,{ref:le,className:"flex ".concat(null!==(h=ee.container)&&void 0!==h?h:"")},"READ_TEXT"===qe?u.default.createElement(aC,{text:Y,startedAt:wt||void 0,durationMs:Q,classNames:ee.readTextPrompt,verbiage:re.readTextPrompt,onComplete:ze}):u.default.createElement(u.default.Fragment,null,u.default.createElement(Zx,{assets:K.guides,classNames:ee.guides,verbiage:re.guides,requestedAction:qe,satisfied:xt,faceGuideBorderColor:xt?ne.guidesSatisfiedColor:ne.guidesUnsatisfiedColor,idCardGuideBorderColor:xt?ne.guidesSatisfiedColor:ne.guidesUnsatisfiedColor}),oe&&Lt&&u.default.createElement(u.default.Fragment,null,u.default.createElement(Dh,{$flipX:!(null===(p=pe.current)||void 0===p?void 0:p.isRearFacing)},Ce.map((function(e,t){var n;return u.default.createElement(Bh,{key:t,obj:e,scaling:At,color:"blue",flipX:!(null===(n=pe.current)||void 0===n?void 0:n.isRearFacing)})}))),u.default.createElement(Ph,null,ke.map((function(e,t){return u.default.createElement(_h,{key:t,face:e,scaling:At})}))))),Ot&&u.default.createElement(sm,{className:ee.guidanceMessageContainer},u.default.createElement(lm,{className:ee.guidanceMessage,$background:null!==(v=null===(g=null===(m=Mt.guidanceMessages)||void 0===m?void 0:m.negative)||void 0===g?void 0:g.backgroundColor)&&void 0!==v?v:"red",$textColor:null!==(w=null===(C=null===(y=Mt.guidanceMessages)||void 0===y?void 0:y.negative)||void 0===C?void 0:C.textColor)&&void 0!==w?w:"white"},Ot)),oe&&u.default.createElement(Sh,null,pe.current?u.default.createElement(u.default.Fragment,null,"✅ Camera: ",pe.current.label," (",pe.current.width,"x",pe.current.height,")"):"❌ Camera not ready",u.default.createElement("br",null),_e?"✅ Recording":"❌ Not recording",u.default.createElement("br",null),it?"✅":"❌"," Good Frame Count:"," ",nt,"/",rt,u.default.createElement("br",null),"Detection Score: ",Ze,u.default.createElement("br",null),"Focus Score: ",Je,u.default.createElement("br",null),"Best Frame Detection Score: ",Re,u.default.createElement("br",null),"Best Frame Focus Score: ",Oe),Rt&&Lt&&u.default.createElement(PC,{className:ee.countdownContainer},u.default.createElement(BC,{className:ee.countdown},Rt)),(!S||je)&&Lt&&u.default.createElement(_C,{className:ee.captureBtnContainer},u.default.createElement(UC,{finished:!0,onClick:function(){return vt(new Date)},disabled:!!gt||yt.current,className:ee.captureBtn},St)))},PC=h.default.div(dC||(dC=w(["\n position: fixed;\n top: 0;\n left: 0;\n width: 100dvw;\n height: 100dvh;\n z-index: 99999;\n display: flex;\n"],["\n position: fixed;\n top: 0;\n left: 0;\n width: 100dvw;\n height: 100dvh;\n z-index: 99999;\n display: flex;\n"]))),BC=h.default.div(cC||(cC=w(["\n color: white;\n font-size: 64px;\n font-weight: bold;\n margin: auto;\n"],["\n color: white;\n font-size: 64px;\n font-weight: bold;\n margin: auto;\n"]))),_C=h.default.div(fC||(fC=w(["\n position: fixed;\n bottom: 0;\n width: 100dvw;\n display: flex;\n z-index: 100000;\n"],["\n position: fixed;\n bottom: 0;\n width: 100dvw;\n display: flex;\n z-index: 100000;\n"]))),UC=h.default(ce)(hC||(hC=w(["\n margin: 0 auto 25px;\n"],["\n margin: 0 auto 25px;\n"]))),zC=function(e){var n=e.videoUrl,a=e.idFrontImageUrl,r=e.idBackImageUrl,i=e.onDoneClick,o=e.onRetryClick,s=e.classNames,l=void 0===s?{}:s,d=e.colors,c=void 0===d?{}:d,f=e.verbiage,h=void 0===f?{}:f,p=t.useState("video"),m=p[0],g=p[1],v=Xp(h,{headingText:"Video ID has been successfully captured!",retryBtnText:"Retry",doneBtnText:"Done"});return u.default.createElement(W,{className:l.container},u.default.createElement($,{className:l.inner},u.default.createElement("h1",{className:l.heading},v.headingText),u.default.createElement(WC,{className:l.assetSelectorOptions},u.default.createElement($C,{className:l.assetSelectorOption},u.default.createElement("input",{type:"radio",id:"displayedAssetVideo",value:"video",checked:"video"===m,onChange:function(){return g("video")}}),u.default.createElement("label",{htmlFor:"displayedAssetVideo"},"Video")),u.default.createElement($C,{className:l.assetSelectorOption},u.default.createElement("input",{type:"radio",id:"displayedAssetIdFrontImage",value:"idFrontImage",checked:"idFrontImage"===m,onChange:function(){return g("idFrontImage")}}),u.default.createElement("label",{htmlFor:"displayedAssetIdFrontImage"},"ID Front Image")),r&&u.default.createElement($C,{className:l.assetSelectorOption},u.default.createElement("input",{type:"radio",id:"displayedAssetIdBackImage",value:"idBackImage",checked:"idBackImage"===m,onChange:function(){return g("idBackImage")}}),u.default.createElement("label",{htmlFor:"displayedAssetIdBackImage"},"ID Back Image"))),u.default.createElement(V,{className:l.videoContainer},"video"===m?u.default.createElement(GC,{src:n,className:l.video,poster:n+"#t=0.1",controls:!0,preload:"metadata",autoPlay:!0}):u.default.createElement("img","idFrontImage"===m?{src:a,alt:"ID Front Image"}:{src:r,alt:"ID Back Image"})),u.default.createElement(ym,{className:l.buttonsRow},u.default.createElement(ce,{variant:"warning",className:l.retryBtn,onClick:o,colors:c.retryBtn,finished:!0},v.retryBtnText),u.default.createElement(ce,{variant:"positive",className:l.doneBtn,onClick:i,colors:c.doneBtn,finished:!0},v.doneBtnText))))},GC=h.default.video(pC||(pC=w(["\n margin-left: auto;\n margin-right: auto;\n max-width: 100%;\n"],["\n margin-left: auto;\n margin-right: auto;\n max-width: 100%;\n"]))),WC=h.default.div(mC||(mC=w(["\n margin-bottom: 15px;\n display: flex;\n justify-content: center;\n"],["\n margin-bottom: 15px;\n display: flex;\n justify-content: center;\n"]))),$C=h.default.div(gC||(gC=w(["\n padding: 0 8px;\n"],["\n padding: 0 8px;\n"]))),VC=function(e){var n,a,r,i,o,s=e.onComplete,l=e.onExitCapture,d=e.onExitAfterFailure,c=e.onUserCancel,f=e.onIdCaptureModelError,h=e.idCaptureProps,p=void 0===h?{}:h,m=e.faceLivenessProps,g=void 0===m?{}:m,y=e.idCaptureModelsEnabled,C=void 0===y||y,w=e.idCardFrontDetectionThreshold,E=e.idCardBackDetectionThreshold,T=e.idCardFrontFocusThreshold,M=e.idCardBackFocusThreshold,I=e.goodIdCardFrontFramesThreshold,S=e.goodIdCardBackFramesThreshold,D=e.readTextPrompt,N=e.readTextTimeoutDurationMs,A=e.skipIdCapture,L=void 0!==A&&A,R=e.skipShowIdCardBack,O=void 0!==R&&R,F=e.skipSuccessScreen,j=void 0!==F&&F,P=e.idCaptureLoadingOverlayMode,_=void 0===P?"default":P,U=e.idCaptureGuideType,z=void 0===U?"fit":U,G=e.idCapturePortraitGuidesOnMobile,W=void 0!==G&&G,$=e.idCaptureRotateLoadingOverlayImageWhenPortrait,V=void 0===$||$,q=e.idCaptureModelLoadTimeoutMs,H=void 0===q?fh:q,Y=e.faceLivenessLoadingOverlayMode,Z=void 0===Y?"default":Y,Q=e.assets,X=void 0===Q?{}:Q,K=e.classNames,J=void 0===K?{}:K,ee=e.colors,te=void 0===ee?{}:ee,ne=e.verbiage,ae=void 0===ne?{}:ne,re=e.debugMode,ie=void 0!==re&&re,oe=t.useContext(Ie),se=oe.submissionStatus,le=oe.idCaptureVideoUrl,ue=oe.idCaptureVideoIdFrontImage,de=oe.idCaptureVideoIdBackImage,ce=oe.setIdCaptureVideoUrl,fe=oe.setIdCaptureVideoIdFrontImage,he=oe.setIdCaptureVideoIdBackImage,pe=t.useState("CAPTURING_ID"),me=pe[0],ge=pe[1];t.useEffect((function(){L&&"CAPTURING_ID"===me&&ge("CHECKING_LIVENESS")}),[me,L]);var ve=p.onSuccess,ye=t.useCallback((function(e){null==ve||ve(e),ge("CHECKING_LIVENESS")}),[ve]),be=t.useCallback((function(){return b(void 0,void 0,void 0,(function(){return x(this,(function(e){return ge("CAPTURING_VIDEO"),[2]}))}))}),[]),xe=t.useCallback((function(e){return b(void 0,void 0,void 0,(function(){return x(this,(function(t){return ce(e),ge("SUCCESS"),j&&(null==s||s()),[2]}))}))}),[s,ce,j]),Ce=t.useCallback((function(){ge("CHECKING_LIVENESS")}),[]),we=t.useState(0),Ee=we[0],ke=we[1],Te=null!=d?d:g.onExitAfterFailure,Me=t.useCallback((function(e,t){null==Te||Te(e,t),ke((function(e){return e+1})),ge("CAPTURING_ID")}),[Te]),Se=t.useCallback((function(){ke((function(e){return e+1})),ge("CAPTURING_ID")}),[]),De=["LOADING","CAPTURING_ID"].includes(me);return t.useEffect((function(){se===k.SUBMITTING&&Ye()}),[se]),se===k.SUBMITTING?u.default.createElement(B,{className:"flex"},u.default.createElement(Vv,null)):u.default.createElement(hh,{documentDetectionModelUrl:null!==(a=null===(n=p.assets)||void 0===n?void 0:n.documentDetectionModelUrl)&&void 0!==a?a:"",focusModelUrl:null!==(i=null===(r=p.assets)||void 0===r?void 0:r.focusModelUrl)&&void 0!==i?i:"",logPredictions:ie,onModelError:f,modelLoadTimeoutMs:H},u.default.createElement(Ke,{key:De?"id-camera":"selfie-camera",preferContinuityCamera:De,preferFrontFacingCamera:!De,requestMicrophoneAccess:!De&&!!D,maxVideoWidth:De?1920:1280,maxFps:De?60:30,debugMode:ie},u.default.createElement(Xf,{onModelError:null==g?void 0:g.onModelError,modelLoadTimeoutMs:null==g?void 0:g.modelLoadTimeoutMs},u.default.createElement(B,{className:"flex ".concat(null!==(o=J.container)&&void 0!==o?o:"")},["CHECKING_LIVENESS","CAPTURING_VIDEO"].includes(me)&&u.default.createElement(Ng,{className:J.cameraFeed}),function(){switch(me){case"CAPTURING_ID":return u.default.createElement(Mh,null,u.default.createElement(Ib,null,u.default.createElement(Ey,v({key:"id-capture-".concat(Ee),loadingOverlayMode:_},p,{assets:X.idCapture,classNames:J.idCapture,colors:te.idCapture,verbiage:ae.idCapture,onSuccess:ye,onExitCapture:l,onUserCancel:c,skipSuccessScreen:!0,releaseCameraAccessOnExit:!1,guideType:z,portraitGuidesOnMobile:W,rotateLoadingOverlayImageWhenPortrait:V,debugMode:ie}))));case"CHECKING_LIVENESS":return u.default.createElement(Mb,v({key:"face-liveness-".concat(Ee),loadingOverlayMode:Z},g,{onComplete:be,onExitCapture:l,onExitAfterFailure:Me,onUserCancel:c,skipSuccessScreen:!0,renderCameraFeed:!1,releaseCameraAccessOnExit:!1,assets:X.faceLiveness,classNames:J.faceLiveness,colors:te.faceLiveness,verbiage:ae.faceLiveness,debugMode:ie}));case"CAPTURING_VIDEO":return u.default.createElement(jC,{key:"id-video-capture-".concat(Ee),onComplete:xe,onIdFrontImageCaptured:fe,onIdBackImageCaptured:he,onFaceNotDetected:Ce,idCaptureModelsEnabled:C,idCardFrontDetectionThreshold:w,idCardBackDetectionThreshold:E,idCardFrontFocusThreshold:T,idCardBackFocusThreshold:M,goodIdCardFrontFramesThreshold:I,goodIdCardBackFramesThreshold:S,skipShowIdCardBack:O,readTextPrompt:D,readTextTimeoutDurationMs:N,assets:X.idVideoCapture,classNames:J.idVideoCapture,colors:te.idVideoCapture,verbiage:ae.idVideoCapture,debugMode:ie});case"SUCCESS":return u.default.createElement(zC,{videoUrl:null!=le?le:"",idFrontImageUrl:null!=ue?ue:"",idBackImageUrl:null!=de?de:void 0,onDoneClick:s,onRetryClick:Se,classNames:J.success,colors:te.success,verbiage:ae.success});default:return u.default.createElement(u.default.Fragment,null)}}()))))},qC=function(e){var n,a,r,i,o,s=e.checks,l=e.idCaptureProps,d=void 0===l?{}:l,c=e.faceLivenessProps,f=void 0===c?{}:c,h=e.additionalDocumentCaptureProps,p=e.signatureCaptureProps,m=void 0===p?{}:p,g=e.videoSignatureCaptureProps,y=void 0===g?{}:g,b=e.videoIdCaptureProps,x=void 0===b?{}:b,w=e.captureSignature,E=void 0!==w&&w,T=e.captureSignatureVideo,M=void 0!==T&&T,I=e.debugMode,S=void 0!==I&&I,D=t.useContext(Ie),N=D.submit,A=D.submissionStatus,L=D.setSignatureData,R=D.setAdditionalDocuments,O=t.useState(0),F=O[0],j=O[1],P=t.useMemo((function(){var e,t,n=C([],s,!0);if(E&&M)throw new Error("captureSignature and captureSignatureVideo cannot be used together");return E&&n.push("SignatureCapture"),M&&(n.push("VideoSignatureCapture"),n.includes("FaceLiveness")&&n.splice(n.indexOf("FaceLiveness"),1)),null!==(t=null===(e=null==h?void 0:h.documents)||void 0===e?void 0:e.length)&&void 0!==t&&t&&n.push("AdditionalDocumentCapture"),n}),[null===(n=null==h?void 0:h.documents)||void 0===n?void 0:n.length,E,M,s]),_=P[F],U=F>=P.length;t.useEffect((function(){"SignatureCapture"===_&&"function"==typeof E?E().then((function(e){e||j((function(e){return e+1}))})):"VideoSignatureCapture"===_&&"function"==typeof M&&M().then((function(e){e||j((function(e){return e+1}))}))}),[E,M,_]),t.useEffect((function(){U&&N()}),[U,N]);var z=d.onSuccess,G=t.useCallback((function(e){null==z||z(e),j((function(e){return e+1}))}),[z]),W=x.onComplete,$=t.useCallback((function(){null==W||W(),j((function(e){return e+1}))}),[W]),V=f.onComplete,q=t.useCallback((function(e,t){null==V||V(e,t),j((function(e){return e+1}))}),[V]),H=t.useCallback((function(e){L(e),j((function(e){return e+1}))}),[L]),Y=y.onComplete,Z=t.useCallback((function(){null==Y||Y(),j((function(e){return e+1}))}),[Y]),Q=t.useState(0),X=Q[0],K=Q[1],J=y.onRetryClicked,ee=t.useCallback((function(){null==J||J(),K((function(e){return e+1}))}),[J]),te=null==h?void 0:h.onComplete,ne=t.useCallback((function(e){R(e),null==te||te(e),j((function(e){return e+1}))}),[te,R]),ae=t.useMemo((function(){var e;return null!==(e=null==h?void 0:h.documents)&&void 0!==e?e:[]}),[null==h?void 0:h.documents]);if(U)switch(A){case k.SUBMITTING:return u.default.createElement(B,{className:"flex"},u.default.createElement(Vv,null));case k.SUBMITTED:return u.default.createElement(Sb,null);case k.FAILED:return u.default.createElement(u.default.Fragment,null,"Submission failed!");default:return u.default.createElement(u.default.Fragment,null,"Complete!!")}switch(P[F]){case"IdCapture":return u.default.createElement(hh,{documentDetectionModelUrl:null!==(r=null===(a=d.assets)||void 0===a?void 0:a.documentDetectionModelUrl)&&void 0!==r?r:"",focusModelUrl:null!==(o=null===(i=d.assets)||void 0===i?void 0:i.focusModelUrl)&&void 0!==o?o:"",logPredictions:S,onModelError:d.onModelError,modelLoadTimeoutMs:d.modelLoadTimeoutMs},u.default.createElement(Ke,{key:"IdCaptureCamera",debugMode:S},u.default.createElement(Mh,null,u.default.createElement(Ib,null,u.default.createElement(Ey,v({},d,{onSuccess:G}))))));case"VideoIdCapture":return u.default.createElement(VC,v({},x,{onComplete:$}));case"FaceLiveness":return u.default.createElement(Ke,{key:"FaceLivenessCamera",preferFrontFacingCamera:!0,preferContinuityCamera:!1,debugMode:S},u.default.createElement(Xf,{onModelError:f.onModelError,modelLoadTimeoutMs:f.modelLoadTimeoutMs},u.default.createElement(Mb,v({},f,{onComplete:q}))));case"SignatureCapture":return u.default.createElement(_x,v({},m,{onAccept:H}));case"VideoSignatureCapture":return u.default.createElement(Ke,{key:"SignatureKycCamera-".concat(X),preferContinuityCamera:!1,preferFrontFacingCamera:!0,maxVideoWidth:1280,maxFps:30,debugMode:S},u.default.createElement(qx,v({},y,{onComplete:Z,onRetryClicked:ee})));case"AdditionalDocumentCapture":return u.default.createElement(_b,v({},h,{documents:ae,onComplete:ne}));default:return u.default.createElement(u.default.Fragment,null)}},HC={default:{fontFamily:"Inter, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif",isFullscreen:!0,background:"white",textColor:"black",textAlign:"center",padding:"25px",colors:{primary:{50:"#eef8ff",100:"#d8eeff",200:"#b9e0ff",300:"#89cfff",400:"#52b4ff",500:"#2a91ff",600:"#0d6efd",700:"#0c5ae9",800:"#1149bc",900:"#144194",950:"#11295a"},secondary:{50:"#f6f6f6",100:"#e7e7e7",200:"#d1d1d1",300:"#b0b0b0",400:"#888888",500:"#666666",600:"#5d5d5d",700:"#4f4f4f",800:"#454545",900:"#3d3d3d",950:"#262626"},positive:{50:"#f1fcf9",100:"#cef9eb",200:"#9df2d8",300:"#65e3c2",400:"#4fd4ad",500:"#1cb090",600:"#16a085",700:"#147160",800:"#155a4f",900:"#164b42",950:"#062d28"},negative:{50:"#fff1f2",100:"#ffe4e6",200:"#fecdd3",300:"#fda4af",400:"#fb7185",500:"#f43f5e",600:"#e11d48",700:"#be123c",800:"#9f1239",900:"#881337",950:"#4c0519"},warning:{50:"#fdf5ef",100:"#fbe7d9",200:"#f6cdb2",300:"#f0ab81",400:"#ea8557",500:"#e35e2c",600:"#d54621",700:"#b1341d",800:"#8d2b1f",900:"#72261c",950:"#3d100d"}},buttons:{style:"bootstrap",primary:{backgroundColor:"var(--idm-color-primary-600)",textColor:"white"},secondary:{backgroundColor:"var(--idm-color-secondary-500)",textColor:"white"},positive:{backgroundColor:"var(--idm-color-positive-600)",textColor:"white"},negative:{backgroundColor:"var(--idm-color-negative-400)",textColor:"white"},warning:{backgroundColor:"var(--idm-color-warning-400)",textColor:"white"},loading:{backgroundColor:"gray",textColor:"white"}},guidanceMessages:{default:{backgroundColor:"var(--idm-color-secondary-200)",textColor:"black"},positive:{backgroundColor:"var(--idm-color-positive-700)",textColor:"white"},negative:{backgroundColor:"var(--idm-color-negative-600)",textColor:"white"}},idCapture:{loadingOverlay:{backgroundColor:"#ecedf3",textColor:"black",loadingGraphicAccentColor:"var(--idm-color-positive-600)",loadingGraphicAccentOpacity:.2,progressBarBackgroundColor:"var(--idm-color-positive-600)",progressBarBackgroundOpacity:.75,progressBarIndicatorColor:"var(--idm-color-positive-600)",progressBarTextColor:"white",continueBtnBorder:"2px solid white"},guideOverlay:{backgroundColor:"#708090",textColor:"white"},guideBox:{unsatisfiedColor:"white",satisfiedColor:"var(--idm-color-positive-500)",borderWidth:4,desktopPadding:50,mobilePadding:0,imagePadding:25}},selfieCapture:{loadingOverlay:{backgroundColor:"#ecedf3",textColor:"black",loadingGraphicAccentColor:"var(--idm-color-positive-600)",progressBarBackgroundColor:"var(--idm-color-positive-600)",progressBarBackgroundOpacity:.75,progressBarIndicatorColor:"var(--idm-color-positive-600)",progressBarTextColor:"white",continueBtnBorder:"2px solid white"},guides:{unsatisfiedColor:"white",satisfiedColor:"var(--idm-color-positive-500)"}},signatureCapture:{background:"radial-gradient(#444cf7 0.5px, transparent 0.5px), radial-gradient(#444cf7 0.5px, #e5e5f7 0.5px)",backgroundSize:"20px 20px",backgroundPosition:"0 0, 10px 10px"},idVideoCapture:{readTextPrompt:{heading:{backgroundColor:"rgba(255, 255, 255, 0.5)",textColor:"black",borderRadius:"8px"},prompt:{backgroundColor:"rgba(255, 255, 255, 0.5)",textColor:"black",borderRadius:"8px"},timeRemaining:{backgroundColor:"rgba(255, 255, 255, 0.5)",textColor:"black",borderRadius:"4px"}}}},none:{}},YC=function(e){var n,a=e.children,i="string"==typeof(n=e.theme)?n in HC?HC[n]:HC.none:n,o=i.colors;return t.useEffect((function(){for(var e in o){var t=o[e];for(var n in t){var a=t[n];document.documentElement.style.setProperty("--idm-color-".concat(e,"-").concat(n),a)}}}),[o]),u.default.createElement(r.ThemeProvider,{theme:i},a)},ZC=function(e){var n=e.lang,a=e.submissionToken,r=e.submissionUrl,i=e.companyId,o=e.needImmediateResponse,s=e.manualReviewRequired,l=e.idBackImageRequired,d=e.verifyIdWithExternalDatabases,c=e.bypassAgeValidation,f=e.bypassNameMatching,h=e.personalData,p=e.cardData,m=e.webhooksEnabled,g=e.webhooksClientTraceId,v=e.webhooksStripSpecialCharacters,y=e.webhooksSendInputImages,b=e.webhooksSendProcessedImages,x=e.webhooksFireOnReview,C=e.precapturedDocuments,w=e.loadingOverlayMode,k=void 0===w?"default":w,T=e.idCaptureRequirement,M=void 0===T?"idCardOrPassport":T,I=e.idAutoCaptureEnabled,S=void 0===I||I,D=e.idCardAutoCaptureScoreThreshold,N=void 0===D?.8:D,A=e.passportAutoCaptureScoreThreshold,L=void 0===A?.75:A,R=e.idCardFocusScoreThreshold,O=void 0===R?.3:R,F=e.passportFocusScoreThreshold,j=void 0===F?.3:F,P=e.skipSuccessScreen,B=void 0!==P&&P,_=e.instructions,U=e.guideType,z=void 0===U?"fit":U,G=e.portraitGuidesOnMobile,W=void 0!==G&&G,$=e.rotateLoadingOverlayImageWhenPortrait,V=void 0===$||$,q=e.modelLoadTimeoutMs,H=void 0===q?fh:q,Y=e.onBeforeSubmit,Z=e.onSubmit,Q=e.onComplete,X=e.onApproved,K=e.onDenied,J=e.onExitCapture,ee=e.onUserCancel,te=e.onModelError,ne=e.theme,ae=void 0===ne?"default":ne,re=e.assets,ie=void 0===re?{}:re,oe=e.classNames,se=void 0===oe?{}:oe,le=e.colors,ue=void 0===le?{}:le,de=e.verbiage,ce=void 0===de?{}:de,fe=e.captureSignature,he=void 0!==fe&&fe,pe=e.captureSignatureVideo,me=void 0!==pe&&pe,ge=e.captureAdditionalDocuments,ve=void 0===ge?[]:ge,ye=e.geolocationEnabled,be=void 0===ye||ye,xe=e.geolocationRequired,Ce=void 0!==xe&&xe,we=e.debugMode,Ee=void 0!==we&&we;Yp(void 0===n?"auto":n);var ke=t.useMemo((function(){return{onExitCapture:J,onUserCancel:ee,onModelError:te,precapturedDocuments:C,captureRequirement:M,autoCaptureEnabled:S,idCardAutoCaptureScoreThreshold:N,passportAutoCaptureScoreThreshold:L,mrzDetectionScoreThreshold:.5,idCardFocusScoreThreshold:O,passportFocusScoreThreshold:j,barcodeScanningEnabled:!1,skipSuccessScreen:B,loadingOverlayMode:k,instructions:_,guideType:z,portraitGuidesOnMobile:W,rotateLoadingOverlayImageWhenPortrait:V,modelLoadTimeoutMs:H,assets:ie,classNames:se,colors:ue,verbiage:ce,debugMode:Ee}}),[J,ee,te,C,M,S,N,L,O,j,B,k,_,z,W,V,H,ie,se,ue,ce,Ee]),Te=t.useMemo((function(){return{documents:ve,classNames:se.additionalDocumentCapture,verbiage:ce.additionalDocumentCapture}}),[ve,se.additionalDocumentCapture,ce.additionalDocumentCapture]),Me=t.useMemo((function(){return{classNames:se.signatureCapture,verbiage:ce.signatureCapture}}),[se.signatureCapture,ce.signatureCapture]),Ie=t.useMemo((function(){return{onExitCapture:J,onUserCancel:ee,skipSuccessScreen:B,classNames:se.videoSignatureCapture,colors:ue.videoSignatureCapture,verbiage:ce.videoSignatureCapture,debugMode:Ee}}),[se.videoSignatureCapture,ue.videoSignatureCapture,Ee,J,ee,B,ce.videoSignatureCapture]),De=t.useCallback((function(e,t){null==Q||Q(e,t),"Approved"===e.resultData.verificationResult?null==X||X(e,t):null==K||K(e,t)}),[X,Q,K]);return u.default.createElement(YC,{theme:ae},u.default.createElement(Se,{action:E.VALIDATE,url:r,token:a,companyId:i,needImmediateResponse:o,manualReviewRequired:s,idBackImageRequired:l,verifyIdWithExternalDatabases:d,bypassAgeValidation:c,bypassNameMatching:f,personalData:h,cardData:p,webhooksEnabled:m,webhooksClientTraceId:g,webhooksStripSpecialCharacters:v,webhooksSendInputImages:y,webhooksSendProcessedImages:b,webhooksFireOnReview:x,onBeforeSubmit:Y,onSubmit:Z,onResponseReceived:De,geolocationEnabled:be,geolocationRequired:Ce},u.default.createElement(qC,{checks:t.useMemo((function(){return["IdCapture"]}),[]),idCaptureProps:ke,additionalDocumentCaptureProps:Te,signatureCaptureProps:Me,videoSignatureCaptureProps:Ie,captureSignature:he,captureSignatureVideo:me,debugMode:Ee})))},QC=function(e){var n=e.lang,a=e.submissionToken,r=e.submissionUrl,i=e.companyId,o=e.needImmediateResponse,s=e.webhooksEnabled,l=e.webhooksClientTraceId,d=e.webhooksStripSpecialCharacters,c=e.webhooksSendInputImages,f=e.webhooksSendProcessedImages,h=e.loadingOverlayMode,p=void 0===h?"default":h,m=e.timeoutDurationMs,g=void 0===m?15e3:m,v=e.modelLoadTimeoutMs,y=void 0===v?Hf:v,b=e.skipSuccessScreen,x=void 0!==b&&b,C=e.onBeforeSubmit,w=e.onComplete,k=e.onApproved,T=e.onDenied,M=e.onExitCapture,I=e.onExitAfterFailure,S=e.onUserCancel,D=e.onModelError,N=e.theme,A=void 0===N?"default":N,L=e.assets,R=e.classNames,O=e.colors,F=e.verbiage,j=e.geolocationEnabled,P=void 0===j||j,B=e.geolocationRequired,_=void 0!==B&&B,U=e.debugMode,z=void 0!==U&&U;Yp(void 0===n?"auto":n);var G=t.useMemo((function(){return{loadingOverlayMode:p,timeoutDurationMs:g,modelLoadTimeoutMs:y,skipSuccessScreen:x,onComplete:w,onSuccess:k,onTimeout:T,onExitCapture:M,onExitAfterFailure:I,onModelError:D,onUserCancel:S,assets:L,classNames:R,colors:O,verbiage:F,debugMode:z}}),[L,R,O,z,p,y,k,w,T,I,M,D,S,x,g,F]);return u.default.createElement(YC,{theme:A},u.default.createElement(Se,{action:E.NONE,url:r,token:a,companyId:i,needImmediateResponse:o,webhooksEnabled:s,webhooksClientTraceId:l,webhooksStripSpecialCharacters:d,webhooksSendInputImages:c,webhooksSendProcessedImages:f,onBeforeLivenessCheck:C,geolocationEnabled:P,geolocationRequired:_},u.default.createElement(qC,{checks:t.useMemo((function(){return["FaceLiveness"]}),[]),faceLivenessProps:G,debugMode:z})))},XC=function(e){var n=e.lang,a=e.submissionToken,r=e.submissionUrl,i=e.companyId,o=e.needImmediateResponse,s=e.manualReviewRequired,l=e.idBackImageRequired,d=e.verifyIdWithExternalDatabases,c=e.bypassAgeValidation,f=e.bypassNameMatching,h=e.personalData,p=e.cardData,m=e.webhooksEnabled,g=e.webhooksClientTraceId,v=e.webhooksStripSpecialCharacters,y=e.webhooksSendInputImages,b=e.webhooksSendProcessedImages,x=e.webhooksFireOnReview,C=e.precapturedDocuments,w=e.idCaptureLoadingOverlayMode,k=void 0===w?"default":w,T=e.idCaptureRequirement,M=void 0===T?"idCardOrPassport":T,I=e.idAutoCaptureEnabled,S=void 0===I||I,D=e.idCardAutoCaptureScoreThreshold,N=void 0===D?.8:D,A=e.mrzDetectionScoreThreshold,L=void 0===A?.5:A,R=e.passportAutoCaptureScoreThreshold,O=void 0===R?.75:R,F=e.idCardFocusScoreThreshold,j=void 0===F?.3:F,P=e.passportFocusScoreThreshold,B=void 0===P?.3:P,_=e.faceLivenessLoadingOverlayMode,U=void 0===_?"default":_,z=e.faceLivenessTimeoutDurationMs,G=void 0===z?15e3:z,W=e.skipSuccessScreen,$=void 0!==W&&W,V=e.idCaptureInstructions,q=e.idCaptureGuideType,H=void 0===q?"fit":q,Y=e.idCapturePortraitGuidesOnMobile,Z=void 0!==Y&&Y,Q=e.idCaptureRotateLoadingOverlayImageWhenPortrait,X=void 0===Q||Q,K=e.idCaptureModelLoadTimeoutMs,J=void 0===K?fh:K,ee=e.selfieCaptureModelLoadTimeoutMs,te=void 0===ee?Hf:ee,ne=e.onBeforeLivenessCheck,ae=e.onBeforeSubmit,re=e.onSubmit,ie=e.onComplete,oe=e.onApproved,se=e.onDenied,le=e.onExitCapture,ue=e.onExitAfterFailure,de=e.onUserCancel,ce=e.onIdCaptureModelError,fe=e.onSelfieCaptureModelError,he=e.captureSignature,pe=void 0!==he&&he,me=e.captureSignatureVideo,ge=void 0!==me&&me,ve=e.captureAdditionalDocuments,ye=void 0===ve?[]:ve,be=e.theme,xe=void 0===be?"default":be,Ce=e.assets,we=void 0===Ce?{}:Ce,Ee=e.classNames,ke=void 0===Ee?{}:Ee,Te=e.colors,Me=void 0===Te?{}:Te,Ie=e.verbiage,De=void 0===Ie?{}:Ie,Ne=e.geolocationEnabled,Ae=void 0===Ne||Ne,Le=e.geolocationRequired,Re=void 0!==Le&&Le,Oe=e.debugMode,Fe=void 0!==Oe&&Oe;Yp(void 0===n?"auto":n);var je=t.useMemo((function(){return{onExitCapture:le,onUserCancel:de,onModelError:ce,assets:we.idCapture,classNames:ke.idCapture,colors:Me.idCapture,verbiage:De.idCapture,precapturedDocuments:C,captureRequirement:M,autoCaptureEnabled:S,idCardAutoCaptureScoreThreshold:N,passportAutoCaptureScoreThreshold:O,mrzDetectionScoreThreshold:L,idCardFocusScoreThreshold:j,passportFocusScoreThreshold:B,loadingOverlayMode:k,instructions:V,guideType:H,portraitGuidesOnMobile:Z,rotateLoadingOverlayImageWhenPortrait:X,modelLoadTimeoutMs:J,skipSuccessScreen:$,debugMode:Fe}}),[we.idCapture,ke.idCapture,Me.idCapture,Fe,S,H,V,k,J,Z,M,X,N,j,L,le,ce,de,O,B,C,$,De.idCapture]),Pe=t.useMemo((function(){return{loadingOverlayMode:U,timeoutDurationMs:G,modelLoadTimeoutMs:te,onTimeout:se,onExitCapture:le,onExitAfterFailure:ue,onUserCancel:de,onModelError:fe,skipSuccessScreen:$,assets:we.faceLiveness,classNames:ke.faceLiveness,colors:Me.faceLiveness,verbiage:De.faceLiveness,debugMode:Fe}}),[we.faceLiveness,ke.faceLiveness,Me.faceLiveness,Fe,U,G,se,ue,le,fe,de,te,$,De.faceLiveness]),Be=t.useMemo((function(){return{documents:ye,classNames:ke.additionalDocumentCapture,verbiage:De.additionalDocumentCapture}}),[ye,ke.additionalDocumentCapture,De.additionalDocumentCapture]),_e=t.useMemo((function(){return{classNames:ke.signatureCapture,verbiage:De.signatureCapture}}),[ke.signatureCapture,De.signatureCapture]),Ue=t.useMemo((function(){return{onExitCapture:le,onUserCancel:de,skipSuccessScreen:$,classNames:ke.videoSignatureCapture,colors:Me.videoSignatureCapture,verbiage:De.videoSignatureCapture,debugMode:Fe}}),[ke.videoSignatureCapture,Me.videoSignatureCapture,Fe,le,de,$,De.videoSignatureCapture]),ze=t.useCallback((function(e,t){null==ie||ie(e,t),"Approved"===e.resultData.verificationResult?null==oe||oe(e,t):null==se||se(e,t)}),[oe,ie,se]),Ge=t.useMemo((function(){return(null==C?void 0:C.selfie)?["IdCapture"]:["IdCapture","FaceLiveness"]}),[null==C?void 0:C.selfie]);return u.default.createElement(YC,{theme:xe},u.default.createElement(Se,{action:E.VALIDATE,url:r,token:a,companyId:i,needImmediateResponse:o,manualReviewRequired:s,idBackImageRequired:l,verifyIdWithExternalDatabases:d,bypassAgeValidation:c,bypassNameMatching:f,personalData:h,cardData:p,webhooksEnabled:m,webhooksClientTraceId:g,webhooksStripSpecialCharacters:v,webhooksSendInputImages:y,webhooksSendProcessedImages:b,webhooksFireOnReview:x,precapturedDocuments:C,onBeforeSubmit:ae,onBeforeLivenessCheck:ne,onSubmit:re,onResponseReceived:ze,geolocationEnabled:Ae,geolocationRequired:Re},u.default.createElement(qC,{checks:Ge,idCaptureProps:je,faceLivenessProps:Pe,signatureCaptureProps:_e,videoSignatureCaptureProps:Ue,additionalDocumentCaptureProps:Be,captureSignature:pe,captureSignatureVideo:ge,debugMode:Fe})))},KC=function(e){var n=e.enrollmentId,a=e.lang,r=e.submissionToken,i=e.submissionUrl,o=e.companyId,s=e.needImmediateResponse,l=e.manualReviewRequired,d=e.idBackImageRequired,c=e.idImageResolutionCheck,f=e.verifyIdWithExternalDatabases,h=e.bypassAgeValidation,p=e.bypassNameMatching,m=e.personalData,g=e.cardData,v=e.deduplicationEnabled,y=e.deduplicationSynchronous,b=e.webhooksEnabled,x=e.webhooksClientTraceId,C=e.webhooksStripSpecialCharacters,w=e.webhooksSendInputImages,k=e.webhooksSendProcessedImages,T=e.webhooksFireOnReview,M=e.idCaptureLoadingOverlayMode,I=void 0===M?"default":M,S=e.idCaptureRequirement,D=void 0===S?"idCardOrPassport":S,N=e.idAutoCaptureEnabled,A=void 0===N||N,L=e.idCardAutoCaptureScoreThreshold,R=void 0===L?.8:L,O=e.mrzDetectionScoreThreshold,F=void 0===O?.5:O,j=e.passportAutoCaptureScoreThreshold,P=void 0===j?.75:j,B=e.idCardFocusScoreThreshold,_=void 0===B?.3:B,U=e.passportFocusScoreThreshold,z=void 0===U?.3:U,G=e.faceLivenessTimeoutDurationMs,W=void 0===G?15e3:G,$=e.faceLivenessLoadingOverlayMode,V=void 0===$?"default":$,q=e.skipSuccessScreen,H=void 0!==q&&q,Y=e.idCaptureInstructions,Z=e.idCaptureGuideType,Q=void 0===Z?"fit":Z,X=e.idCapturePortraitGuidesOnMobile,K=void 0!==X&&X,J=e.idCaptureRotateLoadingOverlayImageWhenPortrait,ee=void 0===J||J,te=e.idCaptureModelLoadTimeoutMs,ne=void 0===te?fh:te,ae=e.selfieCaptureModelLoadTimeoutMs,re=void 0===ae?Hf:ae,ie=e.onBeforeSubmit,oe=e.onSubmit,se=e.onComplete,le=e.onEnrolled,ue=e.onDenied,de=e.onExitCapture,ce=e.onExitAfterFailure,fe=e.onUserCancel,he=e.onIdCaptureModelError,pe=e.onSelfieCaptureModelError,me=e.captureSignature,ge=void 0!==me&&me,ve=e.captureSignatureVideo,ye=void 0!==ve&&ve,be=e.captureAdditionalDocuments,xe=void 0===be?[]:be,Ce=e.theme,we=void 0===Ce?"default":Ce,Ee=e.assets,ke=void 0===Ee?{}:Ee,Te=e.classNames,Me=void 0===Te?{}:Te,Ie=e.colors,De=void 0===Ie?{}:Ie,Ne=e.verbiage,Ae=void 0===Ne?{}:Ne,Le=e.geolocationEnabled,Re=void 0===Le||Le,Oe=e.geolocationRequired,Fe=void 0!==Oe&&Oe,je=e.debugMode,Pe=void 0!==je&&je;Yp(void 0===a?"auto":a);var Be=t.useMemo((function(){return{assets:ke.idCapture,classNames:Me.idCapture,colors:De.idCapture,verbiage:Ae.idCapture,captureRequirement:D,autoCaptureEnabled:A,idCardAutoCaptureScoreThreshold:R,passportAutoCaptureScoreThreshold:P,mrzDetectionScoreThreshold:F,idCardFocusScoreThreshold:_,passportFocusScoreThreshold:z,loadingOverlayMode:I,instructions:Y,guideType:Q,portraitGuidesOnMobile:K,rotateLoadingOverlayImageWhenPortrait:ee,modelLoadTimeoutMs:ne,onExitCapture:de,onUserCancel:fe,onModelError:he,skipSuccessScreen:H,debugMode:Pe}}),[ke.idCapture,Me.idCapture,De.idCapture,Pe,A,Q,Y,I,ne,K,D,ee,R,_,F,de,he,fe,P,z,H,Ae.idCapture]),_e=t.useMemo((function(){return{onExitCapture:de,onExitAfterFailure:ce,onUserCancel:fe,onModelError:pe,loadingOverlayMode:V,timeoutDurationMs:W,modelLoadTimeoutMs:re,skipSuccessScreen:H,assets:ke.faceLiveness,classNames:Me.faceLiveness,colors:De.faceLiveness,verbiage:Ae.faceLiveness,debugMode:Pe}}),[ke.faceLiveness,Me.faceLiveness,De.faceLiveness,Pe,V,W,ce,de,pe,fe,re,H,Ae.faceLiveness]),Ue=t.useMemo((function(){return{documents:xe,classNames:Me.additionalDocumentCapture,verbiage:Ae.additionalDocumentCapture}}),[xe,Me.additionalDocumentCapture,Ae.additionalDocumentCapture]),ze=t.useMemo((function(){return{classNames:Me.signatureCapture,verbiage:Ae.signatureCapture}}),[Me.signatureCapture,Ae.signatureCapture]),Ge=t.useMemo((function(){return{onExitCapture:de,onUserCancel:fe,skipSuccessScreen:H,classNames:Me.videoSignatureCapture,colors:De.videoSignatureCapture,verbiage:Ae.videoSignatureCapture,debugMode:Pe}}),[Me.videoSignatureCapture,De.videoSignatureCapture,Pe,de,fe,H,Ae.videoSignatureCapture]),We=t.useCallback((function(e,t){null==se||se(e,t),"Customer Onboarded"===e.resultData.verificationResult?null==le||le(e,t):null==ue||ue(e,t)}),[le,se,ue]);return u.default.createElement(YC,{theme:we},u.default.createElement(Se,{action:E.ENROLL,url:i,token:r,companyId:o,enrollmentId:n,needImmediateResponse:s,manualReviewRequired:l,idBackImageRequired:d,idImageResolutionCheck:c,verifyIdWithExternalDatabases:f,bypassAgeValidation:h,bypassNameMatching:p,personalData:m,cardData:g,deduplicationEnabled:v,deduplicationSynchronous:y,webhooksEnabled:b,webhooksClientTraceId:x,webhooksStripSpecialCharacters:C,webhooksSendInputImages:w,webhooksSendProcessedImages:k,webhooksFireOnReview:T,onBeforeSubmit:ie,onSubmit:oe,onResponseReceived:We,geolocationEnabled:Re,geolocationRequired:Fe},u.default.createElement(qC,{checks:t.useMemo((function(){return["IdCapture","FaceLiveness"]}),[]),idCaptureProps:Be,faceLivenessProps:_e,additionalDocumentCaptureProps:Ue,signatureCaptureProps:ze,videoSignatureCaptureProps:Ge,captureSignature:ge,captureSignatureVideo:ye,debugMode:Pe})))},JC={frame:null,face:null,imageUrl:null,requestState:"CAPTURING",requestError:null,unverifiedTimes:0},ew=function(e,t){switch(t.type){case"verificationReady":return["CAPTURING","ERROR"].includes(e.requestState)?v(v({},e),{requestState:"CAPTURED",frame:t.payload.frame,face:t.payload.face}):e;case"verifying":return v(v({},e),{requestState:"VERIFYING",imageUrl:t.payload.imageUrl});case"verificationCompleted":var n=t.payload.response,a=n.status,r=a.statusMessage,i=a.errorData,o=n.resultData;if("000"!==a.statusCode)return v(v({},e),{requestState:"ERROR",requestError:new Error("".concat(r,": ").concat(i))});var s=e.requestState,l=e.unverifiedTimes;return"00"===o.verificationResultCode?s="VERIFIED":l<0?(s="CAPTURING",l+=1):s="REJECTED",v(v({},e),{requestState:s,unverifiedTimes:l});case"verificationFailed":return v(v({},e),{requestState:"ERROR",requestError:t.payload.error});default:return e}},tw=function(e){var n,a,i=e.onCustomerMatched,o=e.onCustomerNotMatched,s=e.onCaptureGuidanceTimeout,l=e.onExit,d=e.captureGuidanceTimeoutDurationMs,c=e.classNames,f=void 0===c?{}:c,h=e.colors,p=void 0===h?{}:h,m=e.verbiage,g=void 0===m?{}:m,v=e.debugMode,y=void 0!==v&&v,C=t.useReducer(ew,JC),w=C[0],E=C[1],k=w.frame,T=w.face,M=t.useContext(Ie),S=M.submit,D=M.submissionRequest,N=M.submissionResponse,A=M.submissionError,L=M.selfieImage,R=M.setSelfieImage,O=t.useState(null),F=O[0],j=O[1],P=t.useRef(null),B=t.useRef(null),_=t.useCallback((function(e,t){E({type:"verificationReady",payload:{frame:e,face:t}})}),[]),U="CAPTURED"===w.requestState;t.useEffect((function(){if(k&&T&&!A){var e=Oa(P.current,B.current,k,T);j(e),I(e).then((function(e){R(e)}))}}),[T,k,R,A]),t.useEffect((function(){U&&L&&!A&&b(void 0,void 0,void 0,(function(){var e,t;return x(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),E({type:"verifying",payload:{imageUrl:L}}),[4,S()];case 1:if(!(e=n.sent()))throw new Error("submission failed!");return E({type:"verificationCompleted",payload:{response:e}}),[3,3];case 2:return t=n.sent(),E({type:"verificationFailed",payload:{error:t}}),[3,3];case 3:return[2]}}))}))}),[U,i,o,L,w.requestState,A,S]),t.useEffect((function(){D&&N&&("VERIFIED"===w.requestState?null==i||i(N,D):"REJECTED"===w.requestState&&(null==o||o(N,D)))}),[i,o,w.requestState,D,N]),Iy(d,s,["VERIFIED","REJECTED"].includes(w.requestState),"VERIFYING"===w.requestState);var z=Qp(g.progressPreviewText,"Processing..."),G=r.useTheme();return u.default.createElement(u.default.Fragment,null,u.default.createElement(_e,{ref:P}),u.default.createElement(_e,{ref:B}),u.default.createElement(jy,{onSelfieCaptured:_,onExit:l,timeoutDurationMs:d,classNames:f,colors:p,verbiage:g,debugMode:y}),!(null===(a=null===(n=G.selfieCapture)||void 0===n?void 0:n.capturePreview)||void 0===a?void 0:a.disabled)&&F&&u.default.createElement(Hv,{imageUrl:F,text:z,classNames:f.imagePreview}))},nw=function(e){var t=e.imageUrl,n=e.onDoneClick,a=e.onRetryClick,r=e.classNames,i=void 0===r?{}:r,o=e.colors,s=void 0===o?{}:o,l=e.verbiage,d=void 0===l?{}:l;t||(t="".concat(Ra,"/Selfie-Image-1.png"));var c=Xp(d,{headingText:"Customer has been verified!",retryBtnText:"Retry",doneBtnText:"Done"});return u.default.createElement(W,{className:i.container},u.default.createElement($,{className:i.inner},u.default.createElement(aw,{className:i.heading},c.headingText),u.default.createElement(rw,{className:i.imageContainer},u.default.createElement("img",{alt:c.headingText,src:t,className:i.image})),u.default.createElement(iw,{className:i.buttonsRow},u.default.createElement(ce,{variant:"warning",className:i.retryBtn,onClick:a,colors:s.retryBtn,finished:!0},c.retryBtnText),u.default.createElement(ce,{variant:"positive",className:i.doneBtn,onClick:n,colors:s.doneBtn,finished:!0},c.doneBtnText))))},aw=h.default.h3(vC||(vC=w(["\n margin-bottom: 24px;\n"],["\n margin-bottom: 24px;\n"]))),rw=h.default(ym)(yC||(yC=w(["\n max-height: calc(100vh - 185px);\n"],["\n max-height: calc(100vh - 185px);\n"]))),iw=h.default(ym)(bC||(bC=w(["\n margin-top: 24px;\n"],["\n margin-top: 24px;\n"]))),ow=function(e){var t=e.canRetry,n=void 0===t||t,a=e.onRetryClick,r=e.onExitClick,i=e.assets,o=void 0===i?{}:i,s=e.classNames,l=void 0===s?{}:s,d=e.colors,c=void 0===d?{}:d,f=e.verbiage,h=void 0===f?{}:f;o.imageUrl||(o.imageUrl="".concat(Ra,"/manual_capture.png"));var p=Xp(h,{headingText:"Customer not verified",retryBtnText:"Retry",exitBtnText:"Exit"});return u.default.createElement(W,{className:l.container},u.default.createElement($,{className:l.inner},u.default.createElement(sw,{className:l.heading},p.headingText),u.default.createElement(lw,{className:l.imageContainer},u.default.createElement("img",{alt:p.headingText,src:o.imageUrl,className:l.image})),u.default.createElement(uw,{className:l.buttonsRow},n&&u.default.createElement(ce,{variant:"warning",className:l.retryBtn,onClick:a,colors:c.retryBtn,finished:!0},p.retryBtnText),u.default.createElement(ce,{variant:"secondary",className:l.exitBtn,onClick:r,colors:c.exitBtn,finished:!0},p.exitBtnText))))},sw=h.default.h3(xC||(xC=w(["\n margin-bottom: 24px;\n"],["\n margin-bottom: 24px;\n"]))),lw=h.default(ym)(CC||(CC=w(["\n max-height: calc(100vh - 185px);\n"],["\n max-height: calc(100vh - 185px);\n"]))),uw=h.default(ym)(wC||(wC=w(["\n margin-top: 24px;\n"],["\n margin-top: 24px;\n"]))),dw=function(e){var n,a=e.onComplete,r=e.onCustomerMatched,i=e.onCustomerNotMatched,o=e.onExitCapture,s=e.onExitAfterFailure,l=e.onUserCancel,d=e.onCaptureGuidanceTimeout,c=e.captureGuidanceTimeoutDurationMs,f=e.skipSuccessScreen,h=void 0!==f&&f,p=e.loadingOverlayMode,m=void 0===p?"default":p,g=e.assets,v=void 0===g?{}:g,y=e.classNames,C=void 0===y?{}:y,w=e.colors,E=void 0===w?{}:w,k=e.verbiage,T=void 0===k?{}:k,M=e.debugMode,I=void 0!==M&&M,S=t.useContext(Ie),D=S.submissionRequest,N=S.submissionResponse,A=S.selfieImage,L=t.useState("LOADING"),R=L[0],O=L[1],F=t.useContext(Xe).releaseCameraAccess,j=t.useCallback((function(e,t){return b(void 0,void 0,void 0,(function(){return x(this,(function(n){return O("MATCHED"),null==r||r(e,t),[2]}))}))}),[r]),P=t.useCallback((function(e,t){return b(void 0,void 0,void 0,(function(){return x(this,(function(n){return O("NOT_MATCHED"),null==i||i(e,t),[2]}))}))}),[i]),_=t.useCallback((function(){O("FAILED"),null==d||d()}),[d]),U=t.useState(0),z=U[0],G=U[1],W=t.useCallback((function(){G((function(e){return e+1})),O("LOADING"),null==o||o()}),[o]),$=t.useCallback((function(){F(),D&&N&&(null==a||a(N,D))}),[a,F,D,N]),V=Lg(h,"MATCHED"===R,$);return u.default.createElement(u.default.Fragment,null,u.default.createElement(B,{className:"flex ".concat(null!==(n=C.container)&&void 0!==n?n:"")},u.default.createElement(Ng,{className:C.cameraFeed}),"LOADING"!==R&&function(){switch(R){case"CAPTURING":return u.default.createElement(tw,{key:"capture".concat(z),onCustomerMatched:j,onCustomerNotMatched:P,onCaptureGuidanceTimeout:_,onExit:W,captureGuidanceTimeoutDurationMs:c,classNames:C,colors:E,verbiage:T,debugMode:I});case"MATCHED":if(!V)return;return u.default.createElement(nw,{imageUrl:"data:image/png;base64, ".concat(A),classNames:C.success,colors:E.success,verbiage:T.success,onDoneClick:$,onRetryClick:function(){O("CAPTURING"),G(0)}});case"NOT_MATCHED":case"FAILED":return u.default.createElement(ow,{assets:v.failure,classNames:C.failure,colors:E.failure,verbiage:T.failure,canRetry:z<2,onExitClick:function(){F(),null==s||s()},onRetryClick:function(){G((function(e){return e+1}))}});default:return null}}()),u.default.createElement(Tb,{key:z,mode:m,assets:v.loadingOverlay,classNames:C.loadingOverlay,colors:E.loadingOverlay,verbiage:T.loadingOverlay,onUserCancel:l,onDismissed:function(){O("CAPTURING")}}))},cw=function(e){var t=e.lang,n=e.enrollmentId,a=e.submissionToken,r=e.submissionUrl,i=e.companyId,o=e.needImmediateResponse,s=e.webhooksEnabled,l=e.webhooksClientTraceId,d=e.webhooksStripSpecialCharacters,c=e.webhooksSendInputImages,f=e.webhooksSendProcessedImages,h=e.loadingOverlayMode,p=void 0===h?"default":h,m=e.timeoutDurationMs,g=void 0===m?15e3:m,v=e.modelLoadTimeoutMs,y=void 0===v?Hf:v,b=e.skipSuccessScreen,x=void 0!==b&&b,C=e.theme,w=void 0===C?"default":C,k=e.assets,T=e.classNames,M=e.colors,I=e.verbiage,S=e.onBeforeSubmit,D=e.onSubmit,N=e.onComplete,A=e.onCustomerMatched,L=e.onCustomerNotMatched,R=e.onExitCapture,O=e.onExitAfterFailure,F=e.onUserCancel,j=e.onModelError,P=e.geolocationEnabled,B=void 0===P||P,_=e.geolocationRequired,U=void 0!==_&&_,z=e.debugMode,G=void 0!==z&&z;return Yp(void 0===t?"auto":t),u.default.createElement(YC,{theme:w},u.default.createElement(Se,{action:E.VERIFY,url:r,token:a,companyId:i,enrollmentId:n,needImmediateResponse:o,webhooksEnabled:s,webhooksClientTraceId:l,webhooksStripSpecialCharacters:d,webhooksSendInputImages:c,webhooksSendProcessedImages:f,onBeforeSubmit:S,onSubmit:D,geolocationEnabled:B,geolocationRequired:U},u.default.createElement(Ke,{preferFrontFacingCamera:!0,debugMode:G},u.default.createElement(Xf,{onModelError:j,modelLoadTimeoutMs:y},u.default.createElement(dw,{onComplete:N,onCustomerMatched:A,onCustomerNotMatched:L,onExitCapture:R,onExitAfterFailure:O,onUserCancel:F,captureGuidanceTimeoutDurationMs:g,loadingOverlayMode:p,skipSuccessScreen:x,assets:k,classNames:T,colors:M,verbiage:I,debugMode:G})))))},fw={frame:null,face:null,imageUrl:null,requestState:"CAPTURING",requestError:null,notFoundTimes:0},hw=function(e,t){switch(t.type){case"identificationReady":return["CAPTURING","ERROR"].includes(e.requestState)?v(v({},e),{requestState:"CAPTURED",frame:t.payload.frame,face:t.payload.face}):e;case"identifying":return v(v({},e),{requestState:"IDENTIFYING",imageUrl:t.payload.imageUrl});case"identificationCompleted":var n=t.payload.response,a=n.status,r=a.statusMessage,i=a.errorData,o=n.resultData;if("000"!==a.statusCode)return v(v({},e),{requestState:"ERROR",requestError:new Error("".concat(r,": ").concat(i))});var s=e.requestState,l=e.notFoundTimes;return"46"===o.verificationResultCode?s="FOUND":l<0?(s="CAPTURING",l+=1):s="NOT_FOUND",v(v({},e),{requestState:s,notFoundTimes:l});case"identificationFailed":return v(v({},e),{requestState:"ERROR",requestError:t.payload.error});default:return e}},pw=function(e){var n,a,i=e.onCustomerMatched,o=e.onCustomerNotMatched,s=e.onCaptureGuidanceTimeout,l=e.onExit,d=e.captureGuidanceTimeoutDurationMs,c=e.classNames,f=void 0===c?{}:c,h=e.colors,p=void 0===h?{}:h,m=e.verbiage,g=void 0===m?{}:m,v=e.debugMode,y=void 0!==v&&v,C=t.useReducer(hw,fw),w=C[0],E=C[1],k=t.useContext(Ie),T=k.submit,M=k.submissionRequest,S=k.submissionResponse,D=k.submissionError,N=k.selfieImage,A=k.setSelfieImage,L=t.useState(null),R=L[0],O=L[1],F=t.useRef(null),j=t.useRef(null),P=t.useCallback((function(e,t){E({type:"identificationReady",payload:{frame:e,face:t}})}),[]),B=w.frame,_=w.face,U="CAPTURED"===w.requestState;t.useEffect((function(){if(B&&_&&!D){var e=Oa(F.current,j.current,B,_);O(e),I(e).then((function(e){A(e)}))}}),[_,B,A,D]),t.useEffect((function(){U&&N&&!D&&b(void 0,void 0,void 0,(function(){var e,t;return x(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),E({type:"identifying",payload:{imageUrl:N}}),[4,T()];case 1:if(!(e=n.sent()))throw new Error("submission failed!");return E({type:"identificationCompleted",payload:{response:e}}),[3,3];case 2:return t=n.sent(),E({type:"identificationFailed",payload:{error:t}}),[3,3];case 3:return[2]}}))}))}),[U,i,o,N,w.requestState,D,T]),t.useEffect((function(){M&&S&&("FOUND"===w.requestState?null==i||i(S,M):"NOT_FOUND"===w.requestState&&(null==o||o(S,M)))}),[i,o,w.requestState,M,S]),Iy(d,s,["FOUND","NOT_FOUND"].includes(w.requestState),"IDENTIFYING"===w.requestState);var z=Qp(g.progressPreviewText,"Processing..."),G=r.useTheme();return u.default.createElement(u.default.Fragment,null,u.default.createElement(_e,{ref:F}),u.default.createElement(_e,{ref:j}),u.default.createElement(jy,{onSelfieCaptured:P,onExit:l,timeoutDurationMs:d,classNames:f,colors:p,verbiage:g,debugMode:y}),!(null===(a=null===(n=G.selfieCapture)||void 0===n?void 0:n.capturePreview)||void 0===a?void 0:a.disabled)&&R&&u.default.createElement(Hv,{text:z,imageUrl:R,classNames:f.imagePreview}))},mw=function(e){var t=e.imageUrl,n=e.onDoneClick,a=e.onRetryClick,r=e.classNames,i=void 0===r?{}:r,o=e.colors,s=void 0===o?{}:o,l=e.verbiage,d=void 0===l?{}:l;t||(t="".concat(Ra,"/Selfie-Image-1.png"));var c=Xp(d,{headingText:"Customer has been identified!",retryBtnText:"Retry",doneBtnText:"Done"});return u.default.createElement(W,{className:i.container},u.default.createElement($,{className:i.inner},u.default.createElement(gw,{className:i.heading},c.headingText),u.default.createElement(vw,{className:i.imageContainer},u.default.createElement("img",{alt:c.headingText,src:t,className:i.image})),u.default.createElement(yw,{className:i.buttonsRow},u.default.createElement(ce,{variant:"warning",className:i.retryBtn,onClick:a,colors:s.retryBtn,finished:!0},c.retryBtnText),u.default.createElement(ce,{variant:"positive",className:i.doneBtn,onClick:n,colors:s.doneBtn,finished:!0},c.doneBtnText))))},gw=h.default.h3(EC||(EC=w(["\n margin-bottom: 24px;\n"],["\n margin-bottom: 24px;\n"]))),vw=h.default(ym)(kC||(kC=w(["\n max-height: calc(100vh - 185px);\n"],["\n max-height: calc(100vh - 185px);\n"]))),yw=h.default(ym)(TC||(TC=w(["\n margin-top: 24px;\n"],["\n margin-top: 24px;\n"]))),bw=function(e){var t=e.canRetry,n=void 0===t||t,a=e.onRetryClick,r=e.onExitClick,i=e.assets,o=void 0===i?{}:i,s=e.classNames,l=void 0===s?{}:s,d=e.colors,c=void 0===d?{}:d,f=e.verbiage,h=void 0===f?{}:f;o.imageUrl||(o.imageUrl="".concat(Ra,"/manual_capture.png"));var p=Xp(h,{headingText:"Customer not found",retryBtnText:"Retry",exitBtnText:"Exit"});return u.default.createElement(W,{className:l.container},u.default.createElement($,{className:l.inner},u.default.createElement(xw,{className:l.heading},p.headingText),u.default.createElement(Cw,{className:l.imageContainer},u.default.createElement("img",{alt:p.headingText,src:o.imageUrl,className:l.image})),u.default.createElement(ww,{className:l.buttonsRow},n&&u.default.createElement(ce,{variant:"warning",className:l.retryBtn,onClick:a,colors:c.retryBtn,finished:!0},p.retryBtnText),u.default.createElement(ce,{variant:"secondary",className:l.exitBtn,onClick:r,colors:c.exitBtn,finished:!0},p.exitBtnText))))},xw=h.default.h3(MC||(MC=w(["\n margin-bottom: 24px;\n"],["\n margin-bottom: 24px;\n"]))),Cw=h.default(ym)(IC||(IC=w(["\n max-height: calc(100vh - 185px);\n"],["\n max-height: calc(100vh - 185px);\n"]))),ww=h.default(ym)(SC||(SC=w(["\n margin-top: 24px;\n"],["\n margin-top: 24px;\n"]))),Ew=function(e){var n,a=e.onComplete,r=e.onCustomerMatched,i=e.onCustomerNotMatched,o=e.onExitCapture,s=e.onExitAfterFailure,l=e.onUserCancel,d=e.onCaptureGuidanceTimeout,c=e.captureGuidanceTimeoutDurationMs,f=e.skipSuccessScreen,h=void 0!==f&&f,p=e.loadingOverlayMode,m=void 0===p?"default":p,g=e.assets,v=void 0===g?{}:g,y=e.classNames,C=void 0===y?{}:y,w=e.colors,E=void 0===w?{}:w,k=e.verbiage,T=void 0===k?{}:k,M=e.debugMode,I=void 0!==M&&M,S=t.useContext(Ie),D=S.submissionResponse,N=S.submissionRequest,A=S.selfieImage,L=t.useState("LOADING"),R=L[0],O=L[1],F=t.useContext(Xe).releaseCameraAccess,j=t.useCallback((function(e,t){return b(void 0,void 0,void 0,(function(){return x(this,(function(n){return O("FOUND"),null==r||r(e,t),[2]}))}))}),[r]),P=t.useCallback((function(e,t){return b(void 0,void 0,void 0,(function(){return x(this,(function(n){return O("NOT_FOUND"),null==i||i(e,t),[2]}))}))}),[i]),_=t.useCallback((function(){O("FAILED"),null==d||d()}),[d]),U=t.useState(0),z=U[0],G=U[1],W=t.useCallback((function(){G((function(e){return e+1})),O("LOADING"),null==o||o()}),[o]),$=t.useCallback((function(){F(),N&&D&&(null==a||a(D,N))}),[a,F,N,D]),V=Lg(h,"FOUND"===R,$);return u.default.createElement(u.default.Fragment,null,u.default.createElement(B,{className:"flex ".concat(null!==(n=C.container)&&void 0!==n?n:"")},u.default.createElement(Ng,{className:C.cameraFeed}),"LOADING"!==R&&function(){switch(R){case"CAPTURING":return u.default.createElement(pw,{key:"capture".concat(z),onCustomerMatched:j,onCustomerNotMatched:P,onCaptureGuidanceTimeout:_,onExit:W,captureGuidanceTimeoutDurationMs:c,classNames:C,colors:E,verbiage:T,debugMode:I});case"FOUND":if(!V)return;return u.default.createElement(mw,{imageUrl:"data:image/png;base64, ".concat(A),classNames:C.success,colors:E.success,verbiage:T.success,onDoneClick:$,onRetryClick:function(){O("CAPTURING"),G(0)}});case"NOT_FOUND":case"FAILED":return u.default.createElement(bw,{assets:v.failure,classNames:C.failure,colors:E.failure,verbiage:T.failure,canRetry:z<2,onExitClick:function(){F(),null==s||s()},onRetryClick:function(){G((function(e){return e+1}))}});default:return null}}()),u.default.createElement(Tb,{key:z,mode:m,assets:v.loadingOverlay,classNames:C.loadingOverlay,colors:E.loadingOverlay,verbiage:T.loadingOverlay,onUserCancel:l,onDismissed:function(){O("CAPTURING")}}))},kw=function(e){var t=e.lang,n=e.submissionToken,a=e.submissionUrl,r=e.companyId,i=e.needImmediateResponse,o=e.webhooksEnabled,s=e.webhooksClientTraceId,l=e.webhooksStripSpecialCharacters,d=e.webhooksSendInputImages,c=e.webhooksSendProcessedImages,f=e.loadingOverlayMode,h=void 0===f?"default":f,p=e.timeoutDurationMs,m=void 0===p?15e3:p,g=e.modelLoadTimeoutMs,v=void 0===g?Hf:g,y=e.skipSuccessScreen,b=void 0!==y&&y,x=e.onBeforeSubmit,C=e.onSubmit,w=e.onComplete,k=e.onCustomerMatched,T=e.onCustomerNotMatched,M=e.onCaptureGuidanceTimeout,I=e.onExitCapture,S=e.onExitAfterFailure,D=e.onUserCancel,N=e.onModelError,A=e.theme,L=void 0===A?"default":A,R=e.assets,O=e.classNames,F=e.colors,j=e.verbiage,P=e.geolocationEnabled,B=e.geolocationRequired,_=void 0!==B&&B,U=e.debugMode,z=void 0!==U&&U;return Yp(void 0===t?"auto":t),u.default.createElement(YC,{theme:L},u.default.createElement(Se,{action:E.IDENTIFY,url:a,token:n,companyId:r,needImmediateResponse:i,webhooksEnabled:o,webhooksClientTraceId:s,webhooksStripSpecialCharacters:l,webhooksSendInputImages:d,webhooksSendProcessedImages:c,onBeforeSubmit:x,onSubmit:C,geolocationEnabled:P,geolocationRequired:_},u.default.createElement(Ke,{preferFrontFacingCamera:!0,debugMode:z},u.default.createElement(Xf,{modelLoadTimeoutMs:v,onModelError:N},u.default.createElement(Ew,{onComplete:w,onCustomerMatched:k,onCustomerNotMatched:T,onExitCapture:I,onExitAfterFailure:S,onUserCancel:D,onCaptureGuidanceTimeout:M,captureGuidanceTimeoutDurationMs:m,loadingOverlayMode:h,skipSuccessScreen:b,assets:R,classNames:O,colors:F,verbiage:j,debugMode:z})))))},Tw=function(e){var n=e.lang,a=e.submissionToken,r=e.submissionUrl,i=e.onBeforeSubmit,o=e.onSubmit,s=e.onComplete,l=e.onUserCancel,d=e.onModelError,c=e.loadingOverlayMode,f=void 0===c?"default":c,h=e.skipSuccessScreen,p=void 0!==h&&h,m=e.modelLoadTimeoutMs,g=void 0===m?Hf:m,v=e.theme,y=void 0===v?"default":v,b=e.classNames,x=e.colors,C=e.verbiage,w=e.geolocationEnabled,k=e.geolocationRequired,T=e.debugMode;Yp(void 0===n?"auto":n);var M=t.useState(0),I=M[1];return u.default.createElement(YC,{theme:y},u.default.createElement(Se,{action:E.NONE,url:r,token:a,onBeforeSubmit:i,onSubmit:o,onResponseReceived:s,geolocationEnabled:w,geolocationRequired:k},u.default.createElement(Ke,{key:M[0],preferContinuityCamera:!1,preferFrontFacingCamera:!0,debugMode:T},u.default.createElement(qx,{loadingOverlayMode:f,skipSuccessScreen:p,modelLoadTimeoutMs:g,classNames:b,colors:x,debugMode:T,verbiage:C,onModelError:d,onUserCancel:l,onRetryClicked:function(){I((function(e){return e+1}))}}))))},Mw=function(e){var n=e.lang,a=e.submissionToken,r=e.submissionUrl,i=e.companyId,o=e.needImmediateResponse,s=e.manualReviewRequired,l=e.idBackImageRequired,d=e.verifyIdWithExternalDatabases,c=e.bypassAgeValidation,f=e.bypassNameMatching,h=e.personalData,p=e.cardData,m=e.webhooksEnabled,g=e.webhooksClientTraceId,v=e.webhooksStripSpecialCharacters,y=e.webhooksSendInputImages,b=e.webhooksSendProcessedImages,x=e.webhooksFireOnReview,C=e.onSubmit,w=e.onBeforeSubmit,k=e.onComplete,T=e.onExitCapture,M=e.onExitAfterFailure,I=e.onUserCancel,S=e.idCaptureProps,D=e.faceLivenessProps,N=e.idCaptureModelsEnabled,A=void 0===N||N,L=e.idCardFrontDetectionThreshold,R=void 0===L?.6:L,O=e.idCardFrontFocusThreshold,F=void 0===O?0:O,j=e.goodIdCardFrontFramesThreshold,P=void 0===j?1:j,B=e.idCardBackDetectionThreshold,_=void 0===B?.6:B,U=e.idCardBackFocusThreshold,z=void 0===U?0:U,G=e.goodIdCardBackFramesThreshold,W=void 0===G?1:G,$=e.readTextPrompt,V=e.readTextTimeoutDurationMs,q=void 0===V?15e3:V,H=e.skipSuccessScreen,Y=void 0!==H&&H,Z=e.skipIdCapture,Q=void 0!==Z&&Z,X=e.skipShowIdCardBack,K=void 0!==X&&X,J=e.idCaptureLoadingOverlayMode,ee=void 0===J?"default":J,te=e.idCaptureGuideType,ne=void 0===te?"fit":te,ae=e.idCapturePortraitGuidesOnMobile,re=void 0!==ae&&ae,ie=e.idCaptureRotateLoadingOverlayImageWhenPortrait,oe=void 0===ie||ie,se=e.faceLivenessLoadingOverlayMode,le=void 0===se?"default":se,ue=e.theme,de=void 0===ue?"default":ue,ce=e.assets,fe=void 0===ce?{}:ce,he=e.classNames,pe=void 0===he?{}:he,me=e.colors,ge=void 0===me?{}:me,ve=e.verbiage,ye=void 0===ve?{}:ve,be=e.captureSignature,xe=void 0!==be&&be,Ce=e.captureSignatureVideo,we=void 0!==Ce&&Ce,Ee=e.captureAdditionalDocuments,ke=void 0===Ee?[]:Ee,Te=e.geolocationEnabled,Me=void 0===Te||Te,Ie=e.geolocationRequired,De=void 0!==Ie&&Ie,Ne=e.debugMode,Ae=void 0!==Ne&&Ne;Yp(void 0===n?"auto":n);var Le=t.useMemo((function(){return{idCaptureProps:S,faceLivenessProps:D,idCaptureModelsEnabled:A,idCardFrontDetectionThreshold:R,idCardFrontFocusThreshold:F,goodIdCardFrontFramesThreshold:P,idCardBackDetectionThreshold:_,idCardBackFocusThreshold:z,goodIdCardBackFramesThreshold:W,readTextPrompt:$,readTextTimeoutDurationMs:q,onExitCapture:T,onExitAfterFailure:M,onUserCancel:I,skipSuccessScreen:Y,skipIdCapture:Q,skipShowIdCardBack:K,idCaptureLoadingOverlayMode:ee,idCaptureGuideType:ne,idCapturePortraitGuidesOnMobile:re,idCaptureRotateLoadingOverlayImageWhenPortrait:oe,faceLivenessLoadingOverlayMode:le,assets:fe,classNames:pe,colors:ge,verbiage:ye,debugMode:Ae}}),[fe,pe,ge,Ae,le,D,W,P,ne,ee,A,re,S,oe,_,z,R,F,M,T,I,$,q,Q,K,Y,ye]),Re=t.useMemo((function(){return{documents:ke,classNames:pe.additionalDocumentCapture,verbiage:ye.additionalDocumentCapture}}),[ke,pe.additionalDocumentCapture,ye.additionalDocumentCapture]),Oe=t.useMemo((function(){return{classNames:pe.signatureCapture,verbiage:ye.signatureCapture}}),[pe.signatureCapture,ye.signatureCapture]),Fe=t.useMemo((function(){return{onExitCapture:T,onUserCancel:I,skipSuccessScreen:Y,classNames:pe.videoSignatureCapture,colors:ge.videoSignatureCapture,verbiage:ye.videoSignatureCapture,debugMode:Ae}}),[pe.videoSignatureCapture,ge.videoSignatureCapture,Ae,T,I,Y,ye.videoSignatureCapture]);return u.default.createElement(YC,{theme:de},u.default.createElement(Se,{action:Q?E.NONE:E.VALIDATE,url:r,token:a,companyId:i,needImmediateResponse:o,manualReviewRequired:s,idBackImageRequired:l,verifyIdWithExternalDatabases:d,bypassAgeValidation:c,bypassNameMatching:f,personalData:h,cardData:p,webhooksEnabled:m,webhooksClientTraceId:g,webhooksStripSpecialCharacters:v,webhooksSendInputImages:y,webhooksSendProcessedImages:b,webhooksFireOnReview:x,onSubmit:C,onBeforeSubmit:w,onResponseReceived:k,geolocationEnabled:Me,geolocationRequired:De},u.default.createElement(qC,{checks:t.useMemo((function(){return["VideoIdCapture"]}),[]),videoIdCaptureProps:Le,additionalDocumentCaptureProps:Re,signatureCaptureProps:Oe,videoSignatureCaptureProps:Fe,captureSignature:xe,captureSignatureVideo:we,debugMode:Ae})))},Iw=function(e){var n=e.enrollmentId,a=e.lang,r=e.submissionToken,i=e.submissionUrl,o=e.companyId,s=e.needImmediateResponse,l=e.deduplicationEnabled,d=e.deduplicationSynchronous,c=e.webhooksEnabled,f=e.webhooksClientTraceId,h=e.webhooksStripSpecialCharacters,p=e.webhooksSendInputImages,m=e.webhooksSendProcessedImages,g=e.loadingOverlayMode,v=void 0===g?"default":g,y=e.timeoutDurationMs,b=void 0===y?15e3:y,x=e.modelLoadTimeoutMs,C=void 0===x?Hf:x,w=e.skipSuccessScreen,k=void 0!==w&&w,T=e.onBeforeSubmit,M=e.onSubmit,I=e.onComplete,S=e.onEnrolled,D=e.onDenied,N=e.onExitCapture,A=e.onExitAfterFailure,L=e.onUserCancel,R=e.onModelError,O=e.captureAdditionalDocuments,F=void 0===O?[]:O,j=e.captureSignature,P=void 0!==j&&j,B=e.captureSignatureVideo,_=void 0!==B&&B,U=e.theme,z=void 0===U?"default":U,G=e.assets,W=void 0===G?{}:G,$=e.classNames,V=void 0===$?{}:$,q=e.colors,H=void 0===q?{}:q,Y=e.verbiage,Z=void 0===Y?{}:Y,Q=e.geolocationEnabled,X=void 0===Q||Q,K=e.geolocationRequired,J=void 0!==K&&K,ee=e.debugMode,te=void 0!==ee&ⅇYp(void 0===a?"auto":a);var ne=t.useMemo((function(){return{onExitCapture:N,onUserCancel:L,onExitAfterFailure:A,onModelError:R,timeoutDurationMs:b,modelLoadTimeoutMs:C,loadingOverlayMode:v,skipSuccessScreen:k,assets:W.faceLiveness,classNames:V.faceLiveness,colors:H.faceLiveness,verbiage:Z.faceLiveness,debugMode:te}}),[W.faceLiveness,V.faceLiveness,H.faceLiveness,te,v,C,A,N,R,L,k,b,Z.faceLiveness]),ae=t.useMemo((function(){return{documents:F,classNames:V.additionalDocumentCapture,verbiage:Z.additionalDocumentCapture}}),[F,V.additionalDocumentCapture,Z.additionalDocumentCapture]),re=t.useMemo((function(){return{classNames:V.signatureCapture,verbiage:Z.signatureCapture}}),[V.signatureCapture,Z.signatureCapture]),ie=t.useMemo((function(){return{onExitCapture:N,onUserCancel:L,skipSuccessScreen:k,classNames:V.videoSignatureCapture,colors:H.videoSignatureCapture,verbiage:Z.videoSignatureCapture,debugMode:te}}),[V.videoSignatureCapture,H.videoSignatureCapture,te,N,L,k,Z.videoSignatureCapture]),oe=t.useCallback((function(e,t){null==I||I(e,t),"Customer Onboarded"===e.resultData.verificationResult?null==S||S(e,t):null==D||D(e,t)}),[S,I,D]);return u.default.createElement(YC,{theme:z},u.default.createElement(Se,{action:E.ENROLL,url:i,token:r,companyId:o,enrollmentId:n,needImmediateResponse:s,deduplicationEnabled:l,deduplicationSynchronous:d,webhooksEnabled:c,webhooksClientTraceId:f,webhooksStripSpecialCharacters:h,webhooksSendInputImages:p,webhooksSendProcessedImages:m,onBeforeSubmit:T,onSubmit:M,onResponseReceived:oe,geolocationEnabled:X,geolocationRequired:J},u.default.createElement(qC,{checks:t.useMemo((function(){return["FaceLiveness"]}),[]),faceLivenessProps:ne,additionalDocumentCaptureProps:ae,signatureCaptureProps:re,videoSignatureCaptureProps:ie,captureSignature:P,captureSignatureVideo:_,debugMode:te})))},Sw=function(e){var t=e.lang,n=e.submissionToken,a=e.submissionUrl,r=e.documentServiceUrl,i=e.onComplete,o=e.onDocumentUploaded,s=e.onExitCapture,l=e.onUserCancel,d=e.documents,c=void 0===d?[]:d,f=e.aspectRatio,h=e.cameraFeedMode,p=e.instructions,m=e.theme,g=void 0===m?"default":m,v=e.classNames,y=void 0===v?{}:v,b=e.verbiage,x=void 0===b?{}:b,C=e.geolocationEnabled,w=void 0===C||C,k=e.geolocationRequired,T=void 0!==k&&k,M=e.debugMode,I=void 0!==M&&M;return Yp(void 0===t?"auto":t),u.default.createElement(YC,{theme:g},u.default.createElement(Se,{action:E.NONE,url:a,token:n,documentServiceUrl:r,geolocationEnabled:w,geolocationRequired:T},u.default.createElement(Ke,{preferContinuityCamera:!0,debugMode:I},u.default.createElement(my,{onSuccess:i,onDocumentUploaded:o,onExitCapture:s,onUserCancel:l,documents:c,aspectRatio:f,cameraFeedMode:h,instructions:p,classNames:y,verbiage:x}))))};function Dw(e,t,n){return n||(n=t,t=void 0),function(e,t){if("string"==typeof t){var n=document.querySelector(t);if(!n)throw new Error("targetElement ".concat(t," not found"));t=n}else t||(t=document.createElement("div"),document.body.append(t));var a=c.createRoot(t);if(a.render(u.default.createElement(W,null,e)),"remove"in t){var r=t.remove;t.remove=function(){try{a.unmount(),r()}catch(e){}}}return t}(u.default.createElement(e,v({},n)),t)}qp.use(lp).use(ie).init({resources:Hp,detection:{caches:[]},fallbackLng:"en",debug:!1,interpolation:{escapeValue:!1}});var Nw=function(e,t){return Dw(ZC,e,t)},Aw=function(e,t){return Dw(QC,e,t)},Lw=function(e,t){return Dw(XC,e,t)},Rw=function(e,t){return Dw(KC,e,t)},Ow=function(e,t){return Dw(Iw,e,t)},Fw=function(e,t){return Dw(cw,e,t)},jw=function(e,t){return Dw(kw,e,t)},Pw=function(e,t){return Dw(Tw,e,t)},Bw=function(e,t){return Dw(Mw,e,t)},_w=function(e,t){return Dw(Sw,e,t)};globalThis.IDmissionSDK={renderIdValidation:Nw,renderFaceValidation:Aw,renderIdAndFaceValidation:Lw,renderCustomerIdAndBiometricsEnrollment:Rw,renderCustomerBiometricsEnrollment:Ow,renderCustomerVerification:Fw,renderCustomerIdentification:jw,renderSignatureKYC:Pw,renderVideoIdValidation:Bw,renderDocumentCapture:_w,preloadModels:Kf,themes:HC,version:T,ready:!0};var Uw=function(){return Uw=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},Uw.apply(this,arguments)},zw={lines:12,length:7,width:5,radius:10,scale:1,corners:1,color:"#000",fadeColor:"transparent",animation:"spinner-line-fade-default",rotate:0,direction:1,speed:1,zIndex:2e9,className:"spinner",top:"50%",left:"50%",shadow:"0 0 1px transparent",position:"absolute"},Gw=function(){function e(e){void 0===e&&(e={}),this.opts=Uw(Uw({},zw),e)}return e.prototype.spin=function(e){return this.stop(),this.el=document.createElement("div"),this.el.className=this.opts.className,this.el.setAttribute("role","progressbar"),Ww(this.el,{position:this.opts.position,width:0,zIndex:this.opts.zIndex,left:this.opts.left,top:this.opts.top,transform:"scale("+this.opts.scale+")"}),e&&e.insertBefore(this.el,e.firstChild||null),function(e,t){var n=Math.round(t.corners*t.width*500)/1e3+"px",a="none";!0===t.shadow?a="0 2px 4px #000":"string"==typeof t.shadow&&(a=t.shadow);for(var r=function(e){for(var t=/^\s*([a-zA-Z]+\s+)?(-?\d+(\.\d+)?)([a-zA-Z]*)\s+(-?\d+(\.\d+)?)([a-zA-Z]*)(.*)$/,n=[],a=0,r=e.split(",");a<r.length;a++){var i=r[a].match(t);if(null!==i){var o=+i[2],s=+i[5],l=i[4],u=i[7];0!==o||l||(l=u),0!==s||u||(u=l),l===u&&n.push({prefix:i[1]||"",x:o,y:s,xUnits:l,yUnits:u,end:i[8]})}}return n}(a),i=0;i<t.lines;i++){var o=~~(360/t.lines*i+t.rotate),s=Ww(document.createElement("div"),{position:"absolute",top:-t.width/2+"px",width:t.length+t.width+"px",height:t.width+"px",background:$w(t.fadeColor,i),borderRadius:n,transformOrigin:"left",transform:"rotate("+o+"deg) translateX("+t.radius+"px)"}),l=i*t.direction/t.lines/t.speed;l-=1/t.speed;var u=Ww(document.createElement("div"),{width:"100%",height:"100%",background:$w(t.color,i),borderRadius:n,boxShadow:Vw(r,o),animation:1/t.speed+"s linear "+l+"s infinite "+t.animation});s.appendChild(u),e.appendChild(s)}}(this.el,this.opts),this},e.prototype.stop=function(){return this.el&&("undefined"!=typeof requestAnimationFrame?cancelAnimationFrame(this.animateId):clearTimeout(this.animateId),this.el.parentNode&&this.el.parentNode.removeChild(this.el),this.el=void 0),this},e}();function Ww(e,t){for(var n in t)e.style[n]=t[n];return e}function $w(e,t){return"string"==typeof e?e:e[t%e.length]}function Vw(e,t){for(var n=[],a=0,r=e;a<r.length;a++){var i=r[a],o=qw(i.x,i.y,t);n.push(i.prefix+o[0]+i.xUnits+" "+o[1]+i.yUnits+i.end)}return n.join(", ")}function qw(e,t,n){var a=n*Math.PI/180,r=Math.sin(a),i=Math.cos(a);return[Math.round(1e3*(e*i+t*r))/1e3,Math.round(1e3*(-e*r+t*i))/1e3]}var Hw=[];function Yw(e){if(void 0!==e){if(e.classList.contains("ladda-button")||e.classList.add("ladda-button"),e.hasAttribute("data-style")||e.setAttribute("data-style","expand-right"),!e.querySelector(".ladda-label")){var t=document.createElement("span");t.className="ladda-label",function(e,t){var n=document.createRange();n.selectNodeContents(e),n.surroundContents(t),e.appendChild(t)}(e,t)}var n,a,r=e.querySelector(".ladda-spinner");r||((r=document.createElement("span")).className="ladda-spinner"),e.appendChild(r);var i={start:function(){return a||(a=function(e){var t,n,a=e.offsetHeight;0===a&&(a=parseFloat(window.getComputedStyle(e).height));a>32&&(a*=.8);e.hasAttribute("data-spinner-size")&&(a=parseInt(e.getAttribute("data-spinner-size"),10));e.hasAttribute("data-spinner-color")&&(t=e.getAttribute("data-spinner-color"));e.hasAttribute("data-spinner-lines")&&(n=parseInt(e.getAttribute("data-spinner-lines"),10));var r=.2*a;return new Gw({color:t||"#fff",lines:n||12,radius:r,length:.6*r,width:r<7?2:3,animation:"ladda-spinner-line-fade",zIndex:"auto",top:"auto",left:"auto",className:""})}(e)),e.disabled=!0,e.setAttribute("data-loading",""),clearTimeout(n),a.spin(r),this.setProgress(0),this},startAfter:function(e){return clearTimeout(n),n=setTimeout((function(){i.start()}),e),this},stop:function(){return i.isLoading()&&(e.disabled=!1,e.removeAttribute("data-loading")),clearTimeout(n),a&&(n=setTimeout((function(){a.stop()}),1e3)),this},toggle:function(){return this.isLoading()?this.stop():this.start()},setProgress:function(t){t=Math.max(Math.min(t,1),0);var n=e.querySelector(".ladda-progress");0===t&&n&&n.parentNode?n.parentNode.removeChild(n):(n||((n=document.createElement("div")).className="ladda-progress",e.appendChild(n)),n.style.width=(t||0)*e.offsetWidth+"px")},isLoading:function(){return e.hasAttribute("data-loading")},remove:function(){clearTimeout(n),e.disabled=!1,e.removeAttribute("data-loading"),a&&(a.stop(),a=null),Hw.splice(Hw.indexOf(i),1)}};return Hw.push(i),i}console.warn("Ladda button target must be defined.")}function Zw(e,t){if("function"==typeof e.addEventListener){var n=Yw(e),a=-1;e.addEventListener("click",(function(){var r=!0,i=function(e,t){for(;e.parentNode&&e.tagName!==t;)e=e.parentNode;return t===e.tagName?e:void 0}(e,"FORM");void 0===i||i.hasAttribute("novalidate")||"function"==typeof i.checkValidity&&(r=i.checkValidity()),r&&(n.startAfter(1),"number"==typeof t.timeout&&(clearTimeout(a),a=setTimeout(n.stop,t.timeout)),"function"==typeof t.callback&&t.callback.apply(null,[n]))}),!1)}}var Qw=Object.freeze({__proto__:null,create:Yw,bind:function(e,t){var n;if("string"==typeof e)n=document.querySelectorAll(e);else{if("object"!=typeof e)throw new Error("target must be string or object");n=[e]}t=t||{};for(var a=0;a<n.length;a++)Zw(n[a],t)},stopAll:function(){for(var e=0,t=Hw.length;e<t;e++)Hw[e].stop()}});e.CapturedDocumentImg=xg,e.CustomerBiometricsEnrollment=Iw,e.CustomerIdAndBiometricsEnrollment=KC,e.CustomerIdentification=kw,e.CustomerVerification=cw,e.DocumentCapture=Sw,e.FaceValidation=QC,e.IdAndFaceValidation=XC,e.IdValidation=ZC,e.SignatureKYC=Tw,e.VideoIdValidation=Mw,e.preloadModels=Kf,e.renderCustomerBiometricsEnrollment=Ow,e.renderCustomerIdAndBiometricsEnrollment=Rw,e.renderCustomerIdentification=jw,e.renderCustomerVerification=Fw,e.renderDocumentCapture=_w,e.renderFaceValidation=Aw,e.renderIdAndFaceValidation=Lw,e.renderIdValidation=Nw,e.renderSignatureKYC=Pw,e.renderVideoIdValidation=Bw,e.themes=HC,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
2
2
|
//# sourceMappingURL=sdk2.umd.production.js.map
|