-
Notifications
You must be signed in to change notification settings - Fork 0
/
FaceScan.js
1 lines (1 loc) · 8.57 KB
/
FaceScan.js
1
var _0x5204=["InvalidDomId"," - missing elements property","hasOwnProperty","function","handleError","InvalidHandleErrorCallback"," - missing handleError property","faceScanOptions","faceScanInstance","origin","init","serviceWorker","yoti-face-scan-sw.js","then","log","Service Worker Registered","handleFaceScan","prototype","endsWith","indexOf","length","https://face-scan.yoti.world","handlePostMessage","bind","resize","test","parse","data","image","onImage","onClose","options"," - sender of this message is not trusted","yoti-face-scan-start-age-estimation","yoti-face-scan-container","yoti-face-scan-modal","InvalidConfigurationOptions - init options must be an object","ConfigurationOptions - InvalidDomId - domID must be a string","ConfigurationOptions - InvalidElements","ConfigurationOptions - InvalidHandleFaceScanCallback - handleFaceScan must be a function","string","removeChild","Error creating node at element ID ","firstChild","createElement","setAttribute","style","width: 100%; height: 50px; max-width: 250px; display: inline-block;","appendChild","text","error","message","button","data-qa","start-age-estimation","type","font-size: 14px; padding: 10px; border: none; color: white; background-color: black; width: 100%; max-width: 250px; display: block;","startFaceScan","createTextNode","addEventListener","click","Yoti","FaceScan","startAgeScan","innerWidth","width","height","100%","position: absolute; top: 0; left: 0; background-color: white; border: none;","740px","640px","border: none; box-shadow: 0 2px 30px 0 rgba(0, 0, 0, 0.25); display: block; margin: 0 auto;","innerHeight","position: absolute; top: 0; left: 0; background-color: white; border: none; width: 100%; height: 100%;","height: 640px; width: 740px; display: block; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background:rgba(255,255,255,1); z-index: 9000;","getElementById","iframe","object","stringify","camera;microphone","div","position: absolute; top: 0; left: 0; height: 100vh; width: 100vw; background:rgba(0,0,0,0.5); z-index: 8000;","modal","MissingConfigurationOptions","InvalidConfigurationOptions","elements","InvalidElements"," - elements must be an array of objects"," - elements must contain at least 1 element","domId"];!function(t){!function(x){for(;--x;)t.push(t.shift())}(214)}(_0x5204);var _0x5565=function(x,t){return _0x5204[x-=0]},FaceScan=function(){function a(x,t){return typeof x===_0x5565("0x7")&&"number"==typeof t?x+"-"+t:x}function o(x,t){var n=document.getElementById(x);if(n){for(;n.firstChild;)n[_0x5565("0x8")](n.firstChild);return n}throw void 0!==t&&!0===t?new Error(h.MissingDomElement):new Error(_0x5565("0x9")+x)}function e(x,t,n){try{for(var i=o(x,!0);i.firstChild;)i[_0x5565("0x8")](i[_0x5565("0xa")]);var e=document[_0x5565("0xb")]("div");e.id=a(_,t),e[_0x5565("0xc")](_0x5565("0xd"),_0x5565("0xe")),i[_0x5565("0xf")](e),f(t,n[_0x5565("0x10")])}catch(x){console[_0x5565("0x11")](x[_0x5565("0x12")])}}function r(x){var t=window[_0x5565("0x1f")],n=window.innerHeight;t<768||n<640?(x.setAttribute(_0x5565("0x20"),"100%"),x.setAttribute(_0x5565("0x21"),_0x5565("0x22")),x[_0x5565("0xc")](_0x5565("0xd"),_0x5565("0x23"))):(x[_0x5565("0xc")](_0x5565("0x20"),_0x5565("0x24")),x[_0x5565("0xc")](_0x5565("0x21"),_0x5565("0x25")),x[_0x5565("0xc")]("style",_0x5565("0x26")))}function s(x){var t=window.innerWidth,n=window[_0x5565("0x27")];t<768||n<640?x[_0x5565("0xc")](_0x5565("0xd"),_0x5565("0x28")):(x[_0x5565("0xc")]("width",_0x5565("0x24")),x[_0x5565("0xc")](_0x5565("0x21"),_0x5565("0x25")),x.setAttribute(_0x5565("0xd"),_0x5565("0x29")))}function x(){this.iframe=null,this.modal=null,this[_0x5565("0x40")]=null,this[_0x5565("0x41")]=0,this[_0x5565("0x42")]=null}var _="yoti-face-scan-start-age-estimation-wrapper",c=_0x5565("0x0"),d=_0x5565("0x1"),l=_0x5565("0x2"),h={MissingConfigurationOptions:"MissingConfigurationOptions - init options are missing",InvalidConfigurationOptions:_0x5565("0x3"),InvalidDomId:_0x5565("0x4"),MissingDomElement:"ConfigurationOptions - MissingDomElement - dom element is missing",InvalidElements:_0x5565("0x5"),InvalidHandleFaceScanCallback:_0x5565("0x6"),InvalidHandleErrorCallback:"ConfigurationOptions - InvalidHandleErrorCallback - handleError must be a function"},f=function(x,t){try{for(var n=o(a(_,x));n[_0x5565("0xa")];)n[_0x5565("0x8")](n.firstChild);var i=document[_0x5565("0xb")](_0x5565("0x13"));i.id=a(c,x),i[_0x5565("0xc")](_0x5565("0x14"),_0x5565("0x15")),i[_0x5565("0xc")](_0x5565("0x16"),"button"),i.setAttribute("style",_0x5565("0x17"));var e="Start Face Scan";t&&t[_0x5565("0x18")]&&(e=t[_0x5565("0x18")]),i[_0x5565("0xf")](document[_0x5565("0x19")](e)),i[_0x5565("0x1a")](_0x5565("0x1b"),function(){window[_0x5565("0x1c")][_0x5565("0x1d")][_0x5565("0x1e")](x)}),n[_0x5565("0xf")](i)}catch(x){console[_0x5565("0x11")](x)}};return x.prototype[_0x5565("0x43")]=function(x){_0x5565("0x44")in navigator&&navigator[_0x5565("0x44")].register(_0x5565("0x45"))[_0x5565("0x46")](function(){console[_0x5565("0x47")](_0x5565("0x48"))});try{!function(x){if(!x)throw new Error(h[_0x5565("0x32")]);if("object"!=typeof x)throw new Error(h[_0x5565("0x33")]);if(!x.hasOwnProperty(_0x5565("0x34")))throw new Error(h[_0x5565("0x35")]+_0x5565("0x3a"));if(!Array.isArray(x.elements))throw new Error(h[_0x5565("0x35")]+_0x5565("0x36"));if(0===x[_0x5565("0x34")].length)throw new Error(h.InvalidElements+_0x5565("0x37"));for(var t in x[_0x5565("0x34")]){var n=x.elements[t][_0x5565("0x38")];if(!n||typeof n!==_0x5565("0x7"))throw new Error(h[_0x5565("0x39")])}if(!x[_0x5565("0x3b")]("handleFaceScan"))throw new Error(h[_0x5565("0x33")]+" - missing handleFaceScan property");if(typeof x.handleFaceScan!==_0x5565("0x3c"))throw new Error(h.InvalidHandleFaceScanCallback);if(!x[_0x5565("0x3b")](_0x5565("0x3d")))throw new Error(h[_0x5565("0x33")]+_0x5565("0x3f"));if(typeof x[_0x5565("0x3d")]!==_0x5565("0x3c"))throw new Error(h[_0x5565("0x3e")])}(x),this[_0x5565("0x40")]=x,this[_0x5565("0x49")]=this[_0x5565("0x40")][_0x5565("0x49")]||null,this.handleError=this.faceScanOptions[_0x5565("0x3d")]||null,String[_0x5565("0x4a")][_0x5565("0x4b")]||(String[_0x5565("0x4a")][_0x5565("0x4b")]=function(x){return-1!==this[_0x5565("0x4c")](x,this[_0x5565("0x4d")]-x[_0x5565("0x4d")])}),this[_0x5565("0x40")].origin?this.origin=this[_0x5565("0x40")][_0x5565("0x42")][_0x5565("0x4b")]("/")?new RegExp(this.faceScanOptions[_0x5565("0x42")].substring(0,this.faceScanOptions[_0x5565("0x42")][_0x5565("0x4d")]-1)):new RegExp(this[_0x5565("0x40")].origin):this.origin=new RegExp(_0x5565("0x4e")),window.addEventListener(_0x5565("0x12"),this[_0x5565("0x4f")][_0x5565("0x50")](this),!1),window.addEventListener(_0x5565("0x51"),function(){this[_0x5565("0x2b")]&&r(this[_0x5565("0x2b")]),this.modal&&s(this[_0x5565("0x31")])},!1);for(var t=this[_0x5565("0x40")][_0x5565("0x34")],n=0;n<t[_0x5565("0x4d")];n++){var i=t[n][_0x5565("0x38")];this.faceScanInstance+=1,e(i,this[_0x5565("0x41")],x)}}catch(x){console[_0x5565("0x11")](x[_0x5565("0x12")])}},x.prototype[_0x5565("0x1e")]=function(x){!function(x){try{var t=o(a(_,x)),n=document[_0x5565("0xb")](_0x5565("0x2f"));n.id=a(d,x),n[_0x5565("0xc")](_0x5565("0xd"),_0x5565("0x30"));var i=document[_0x5565("0xb")](_0x5565("0x2f"));i.id=a(l,x),s(i),n[_0x5565("0xf")](i),t[_0x5565("0xf")](n),this[_0x5565("0x31")]=i}catch(x){console[_0x5565("0x11")](x)}}(x),function(x,t){var n,i=document[_0x5565("0x2a")](a(l,t));if(i){var e=document[_0x5565("0xb")](_0x5565("0x2b"));if(x&&typeof x===_0x5565("0x2c"))x.faceScanInstance=t,n=btoa(JSON.stringify(x));else{var o={faceScanInstance:t};n=btoa(JSON[_0x5565("0x2d")](o))}e[_0x5565("0xc")]("src","https://face-scan.yoti.world/web-ui/face-scan.html?args="+n),e[_0x5565("0xc")]("allow",_0x5565("0x2e")),r(e),this[_0x5565("0x2b")]=e,i[_0x5565("0xf")](e)}}(this.faceScanOptions[_0x5565("0x10")],x)},x[_0x5565("0x4a")][_0x5565("0x4f")]=function(x){if(this[_0x5565("0x42")]instanceof RegExp&&this[_0x5565("0x42")][_0x5565("0x52")](x[_0x5565("0x42")])){var t=JSON[_0x5565("0x53")](x[_0x5565("0x54")]);switch(t[_0x5565("0x16")]){case _0x5565("0x55"):this[_0x5565("0x56")](t[_0x5565("0x54")]);break;case"close":this[_0x5565("0x57")](t[_0x5565("0x58")]);break;case _0x5565("0x11"):default:this.onError(t.data)}}else console[_0x5565("0x11")](x[_0x5565("0x42")]+_0x5565("0x59"))},x.prototype.onImage=function(x){this[_0x5565("0x57")](x[_0x5565("0x58")]),this[_0x5565("0x49")]&&this[_0x5565("0x49")](x[_0x5565("0x55")])},x.prototype.onError=function(x){this[_0x5565("0x57")](x[_0x5565("0x58")]),this[_0x5565("0x3d")]&&this[_0x5565("0x3d")](x[_0x5565("0x11")])},x[_0x5565("0x4a")][_0x5565("0x57")]=function(x){var t=x[_0x5565("0x41")];f(t,x)},x}();window[_0x5565("0x1c")]=window[_0x5565("0x1c")]||{},window.Yoti[_0x5565("0x1d")]=new FaceScan;