{"ast":null,"code":"import { FaceTecSDK } from \"core-sdk/FaceTecSDK.js/FaceTecSDK\";\nimport { message } from 'antd';\nexport var FaceMapAppUtillities = function () {\n  var currentTheme = \"Sample Bank\";\n\n  function displayStatus(status, method) {\n    if (method) {\n      method(status, 3);\n    } else {\n      message.info(status, 3);\n    }\n  }\n\n  function showMainUI() {\n    document.querySelector(\".wrapping-box-container\").style.opacity = 1;\n    FaceMapAppUtillities.enableAllButtons();\n  } // Disable buttons to prevent hammering, fade out main interface elements, and shuffle the guidance images.\n\n\n  function fadeOutMainUIAndPrepareForSession() {\n    disableAllButtons();\n    document.querySelector(\".wrapping-box-container\").style.opacity = 0;\n  }\n\n  function disableAllButtons() {\n    document.querySelectorAll(\"button\").forEach(function (button) {\n      button.disabled = true;\n    });\n  }\n\n  function enableAllButtons() {\n    document.querySelectorAll(\"button\").forEach(function (button) {\n      button.disabled = false;\n    });\n  }\n\n  function handleErrorGettingServerSessionToken() {\n    fadeInMainUI();\n    enableAllButtons();\n    displayStatus(\"Session could not be started due to an unexpected issue during the network request.\");\n  }\n\n  function generateUUId() {\n    //@ts-ignore\n    return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, function (c) {\n      return (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16);\n    });\n  }\n\n  function formatUIForDevice() {\n    if (isLikelyMobileDevice()) {\n      // Adjust button sizing\n      document.querySelectorAll(\".controls > button\").forEach(function (element) {// if (element.className === \"big-button\") {\n        //   (element).style.height = \"40px\";\n        //   (element).style.fontSize = \"18px\";\n        // }\n        // else if (element.className === \"medium-button\") {\n        //   (element).style.height = \"30px\";\n        //   (element).style.fontSize = \"14px\";\n        // }\n        // (element).style.width = \"220px\";\n      }); // Hide border around control panel\n      //  (document.getElementById(\"controls\")).style.borderColor = \"transparent\";\n      // Hide status label text background and decrease label font size\n      // (document.getElementById(\"status\")).style.backgroundColor = \"transparent\";\n      // (document.getElementById(\"status\")).style.fontSize = \"12px\";\n      // Center control interface on screen\n      // (document.getElementsByClassName(\"wrapping-box-container\")[0]).style.top = \"50%\";\n      // (document.getElementsByClassName(\"wrapping-box-container\")[0]).style.left = \"50%\";\n      // (document.getElementsByClassName(\"wrapping-box-container\")[0]).style.transform = \"translate(-50%, -50%)\";\n    }\n  }\n\n  function isLikelyMobileDevice() {\n    var isMobileDeviceUA = !!/Android|iPhone|iPad|iPod|IEMobile|Mobile|mobile/i.test(navigator.userAgent || \"\"); // ChromeOS/Chromebook detection.\n\n    if (isMobileDeviceUA && (navigator.userAgent.indexOf(\"CrOS\") != -1 || navigator.userAgent.indexOf(\"Chromebook\") != -1)) {\n      isMobileDeviceUA = false;\n    } // Mobile device determination based on portrait / landscape and user agent.\n\n\n    if (screen.width < screen.height || isMobileDeviceUA) {\n      // Assume mobile device when in portrait mode or when determined by the user agent.\n      return true;\n    } else {\n      return false;\n    }\n  }\n\n  function configureGuidanceScreenTextForDevice() {\n    if (isLikelyMobileDevice()) {\n      // using strings with breaks for Ready Screen text on mobile devices\n      Config.currentCustomization.guidanceCustomization.readyScreenHeaderAttributedString = \"Get Ready For<br/>Your Video Selfie\";\n      Config.currentCustomization.guidanceCustomization.readyScreenSubtextAttributedString = \"Please Frame Your Face In<br/>The Small Oval, Then The Big Oval\";\n    }\n\n    FaceTecSDK.setCustomization(Config.currentCustomization);\n  }\n\n  return {\n    displayStatus: displayStatus,\n    showMainUI: showMainUI,\n    fadeOutMainUIAndPrepareForSession: fadeOutMainUIAndPrepareForSession,\n    disableAllButtons: disableAllButtons,\n    enableAllButtons: enableAllButtons,\n    generateUUId: generateUUId,\n    formatUIForDevice: formatUIForDevice,\n    handleErrorGettingServerSessionToken: handleErrorGettingServerSessionToken,\n    configureGuidanceScreenTextForDevice: configureGuidanceScreenTextForDevice,\n    isLikelyMobileDevice: isLikelyMobileDevice\n  };\n}();","map":{"version":3,"sources":["/Users/dhrumil1/Documents/Tethy/online-verification/components/LivenessCheck/utilities/faceMapAppUtilities.js"],"names":["FaceTecSDK","message","FaceMapAppUtillities","currentTheme","displayStatus","status","method","info","showMainUI","document","querySelector","style","opacity","enableAllButtons","fadeOutMainUIAndPrepareForSession","disableAllButtons","querySelectorAll","forEach","button","disabled","handleErrorGettingServerSessionToken","fadeInMainUI","generateUUId","replace","c","crypto","getRandomValues","Uint8Array","toString","formatUIForDevice","isLikelyMobileDevice","element","isMobileDeviceUA","test","navigator","userAgent","indexOf","screen","width","height","configureGuidanceScreenTextForDevice","Config","currentCustomization","guidanceCustomization","readyScreenHeaderAttributedString","readyScreenSubtextAttributedString","setCustomization"],"mappings":"AAAA,SAASA,UAAT,QAA2B,mCAA3B;AACA,SAASC,OAAT,QAAwB,MAAxB;AACA,OAAO,IAAIC,oBAAoB,GAAI,YAAY;AAC7C,MAAIC,YAAY,GAAG,aAAnB;;AAEA,WAASC,aAAT,CAAuBC,MAAvB,EAA+BC,MAA/B,EAAuC;AACrC,QAAIA,MAAJ,EAAY;AACVA,MAAAA,MAAM,CAACD,MAAD,EAAS,CAAT,CAAN;AACD,KAFD,MAGK;AACHJ,MAAAA,OAAO,CAACM,IAAR,CAAaF,MAAb,EAAqB,CAArB;AACD;AACF;;AAED,WAASG,UAAT,GAAsB;AACpBC,IAAAA,QAAQ,CAACC,aAAT,CAAuB,yBAAvB,EAAkDC,KAAlD,CAAwDC,OAAxD,GAAkE,CAAlE;AACAV,IAAAA,oBAAoB,CAACW,gBAArB;AACD,GAf4C,CAiB7C;;;AACA,WAASC,iCAAT,GAA6C;AAC3CC,IAAAA,iBAAiB;AACjBN,IAAAA,QAAQ,CAACC,aAAT,CAAuB,yBAAvB,EAAkDC,KAAlD,CAAwDC,OAAxD,GAAkE,CAAlE;AACD;;AAED,WAASG,iBAAT,GAA6B;AAC3BN,IAAAA,QAAQ,CAACO,gBAAT,CAA0B,QAA1B,EAAoCC,OAApC,CAA4C,UAAUC,MAAV,EAAkB;AAC5DA,MAAAA,MAAM,CAACC,QAAP,GAAkB,IAAlB;AACD,KA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F,SAAS,CAACC,SAAV,CAAoBC,OAApB,CAA4B,YAA5B,KAA6C,CAAC,CAAnG,CAApB,EAA4H;AAC1HJ,MAAAA,gBAAgB,GAAG,KAAnB;AACD,KAL6B,CAM9B;;;AACA,QAAIK,MAAM,CAACC,KAAP,GAAeD,MAAM,CAACE,MAAtB,IAAgCP,gBAApC,EAAsD;AACpD;AACA,aAAO,IAAP;AACD,KAHD,MAIK;AACH,aAAO,KAAP;AACD;AACF;;AACD,WAASQ,oCAAT,GAAgD;AAC9C,QAAIV,oBAAoB,EAAxB,EAA4B;AAC1B;AACAW,MAAAA,MAAM,CAACC,oBAAP,CAA4BC,qBAA5B,CAAkDC,iCAAlD,GAAsF,qCAAtF;AACAH,MAAAA,MAAM,CAACC,oBAAP,CAA4BC,qBAA5B,CAAkDE,kCAAlD,GAAuF,iEAAvF;AACD;;AACD7C,IAAAA,UAAU,CAAC8C,gBAAX,CAA4BL,MAAM,CAACC,oBAAnC;AACD;;AACD,SAAO;AACLtC,IAAAA,aAAa,EAAbA,aADK;AAELI,IAAAA,UAAU,EAAVA,UAFK;AAGLM,IAAAA,iCAAiC,EAAjCA,iCAHK;AAILC,IAAAA,iBAAiB,EAAjBA,iBAJK;AAKLF,IAAAA,gBAAgB,EAAhBA,gBALK;AAMLS,IAAAA,YAAY,EAAZA,YANK;AAOLO,IAAAA,iBAAiB,EAAjBA,iBAPK;AAQLT,IAAAA,oCAAoC,EAApCA,oCARK;AASLoB,IAAAA,oCAAoC,EAApCA,oCATK;AAULV,IAAAA,oBAAoB,EAApBA;AAVK,GAAP;AAYD,CA9GiC,EAA3B","sourcesContent":["import { FaceTecSDK } from \"core-sdk/FaceTecSDK.js/FaceTecSDK\"\nimport { message } from 'antd'\nexport var FaceMapAppUtillities = (function () {\n  var currentTheme = \"Sample Bank\";\n\n  function displayStatus(status, method) {\n    if (method) {\n      method(status, 3)\n    }\n    else {\n      message.info(status, 3);\n    }\n  }\n\n  function showMainUI() {\n    document.querySelector(\".wrapping-box-container\").style.opacity = 1;\n    FaceMapAppUtillities.enableAllButtons();\n  }\n\n  // Disable buttons to prevent hammering, fade out main interface elements, and shuffle the guidance images.\n  function fadeOutMainUIAndPrepareForSession() {\n    disableAllButtons();\n    document.querySelector(\".wrapping-box-container\").style.opacity = 0;\n  }\n\n  function disableAllButtons() {\n    document.querySelectorAll(\"button\").forEach(function (button) {\n      button.disabled = true;\n    });\n  }\n\n  function enableAllButtons() {\n    document.querySelectorAll(\"button\").forEach(function (button) {\n      button.disabled = false;\n    })\n  }\n\n  function handleErrorGettingServerSessionToken() {\n    fadeInMainUI();\n    enableAllButtons();\n    displayStatus(\"Session could not be started due to an unexpected issue during the network request.\");\n  }\n\n  function generateUUId() {\n    //@ts-ignore\n    return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, c =>\n      (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)\n    )\n  }\n\n  function formatUIForDevice() {\n    if (isLikelyMobileDevice()) {\n      // Adjust button sizing\n      document.querySelectorAll(\".controls > button\").forEach(function (element) {\n        // if (element.className === \"big-button\") {\n        //   (element).style.height = \"40px\";\n        //   (element).style.fontSize = \"18px\";\n        // }\n        // else if (element.className === \"medium-button\") {\n        //   (element).style.height = \"30px\";\n        //   (element).style.fontSize = \"14px\";\n        // }\n\n        // (element).style.width = \"220px\";\n      });\n      // Hide border around control panel\n      //  (document.getElementById(\"controls\")).style.borderColor = \"transparent\";\n      // Hide status label text background and decrease label font size\n      // (document.getElementById(\"status\")).style.backgroundColor = \"transparent\";\n      // (document.getElementById(\"status\")).style.fontSize = \"12px\";\n      // Center control interface on screen\n      // (document.getElementsByClassName(\"wrapping-box-container\")[0]).style.top = \"50%\";\n      // (document.getElementsByClassName(\"wrapping-box-container\")[0]).style.left = \"50%\";\n      // (document.getElementsByClassName(\"wrapping-box-container\")[0]).style.transform = \"translate(-50%, -50%)\";\n    }\n  }\n\n  function isLikelyMobileDevice() {\n    var isMobileDeviceUA = !!(/Android|iPhone|iPad|iPod|IEMobile|Mobile|mobile/i.test(navigator.userAgent || \"\"));\n    // ChromeOS/Chromebook detection.\n    if (isMobileDeviceUA && ((navigator.userAgent.indexOf(\"CrOS\") != -1) || (navigator.userAgent.indexOf(\"Chromebook\") != -1))) {\n      isMobileDeviceUA = false;\n    }\n    // Mobile device determination based on portrait / landscape and user agent.\n    if (screen.width < screen.height || isMobileDeviceUA) {\n      // Assume mobile device when in portrait mode or when determined by the user agent.\n      return true;\n    }\n    else {\n      return false;\n    }\n  }\n  function configureGuidanceScreenTextForDevice() {\n    if (isLikelyMobileDevice()) {\n      // using strings with breaks for Ready Screen text on mobile devices\n      Config.currentCustomization.guidanceCustomization.readyScreenHeaderAttributedString = \"Get Ready For<br/>Your Video Selfie\";\n      Config.currentCustomization.guidanceCustomization.readyScreenSubtextAttributedString = \"Please Frame Your Face In<br/>The Small Oval, Then The Big Oval\";\n    }\n    FaceTecSDK.setCustomization(Config.currentCustomization);\n  }\n  return {\n    displayStatus,\n    showMainUI,\n    fadeOutMainUIAndPrepareForSession,\n    disableAllButtons,\n    enableAllButtons,\n    generateUUId,\n    formatUIForDevice,\n    handleErrorGettingServerSessionToken,\n    configureGuidanceScreenTextForDevice,\n    isLikelyMobileDevice,\n  }\n})()\n"]},"metadata":{},"sourceType":"module"}