/home/ivoiecob/email.hirewise-va.com/static/js/TwoFactorAuth.app.5b3816f80617c6bc5168.min.js
/*! For license information please see TwoFactorAuth.app.5b3816f80617c6bc5168.min.js.LICENSE.txt */
(self.webpackChunkafterlogic_aurora_platform=self.webpackChunkafterlogic_aurora_platform||[]).push([[3448],{"5m4f":(t,e,i)=>{"use strict";var o=i("a7T2"),s=i("LKDt"),r=i("yU9o"),n=i("JBu3"),a=i("aGpU");t.exports=function(t){return n.init(t),{start:function(t){if(r.isMobile()||(t.isModuleEnabled("SecuritySettingsWebclient")?t.run("SecuritySettingsWebclient","registerSecuritySettingsSection",[function(){return i("hnod")},"TwoFactorAuth"]):t.run("SettingsWebclient","registerSettingsTab",[function(){return i("hnod")},n.HashModuleName,s.i18n("TWOFACTORAUTH/LABEL_SETTINGS_TAB")])),r.getUserRole()===Enums.UserRole.Anonymous){var e=function(t){var e=t.View,s=i("PMEU"),r=i("t0U+");if(e){var n=e.onSystemLoginResponse.bind(e);o.isFunction(n)||(n=e.onSystemLoginResponseBase.bind(e)),o.isFunction(n)||(n=function(){}),e.onSystemLoginResponse=function(t,e){void 0!==e.Parameters.Domain&&(e.Parameters.Login=e.Parameters.Login+"@"+e.Parameters.Domain);var i=t.Result&&t.Result.TwoFactorAuth;if(i)s.showPopup(r,[n,o.bind(function(){this.loading(!1)},this),i,e.Parameters.Login.split(" ").join(""),e.Parameters.Password]);else{var u=t&&t.Result&&t.Result.AuthToken||"";a.saveDevice(u,function(){n(t,e)})}}}}.bind(this);r.subscribeEvent("StandardLoginFormWebclient::ConstructView::after",e),r.subscribeEvent("MailLoginFormWebclient::ConstructView::after",e)}}}}},BjEp:(t,e,i)=>{"use strict";var o=i("M4cL"),s=i("a7T2"),r=i("p09A"),n=i("sdEb"),a=i("LKDt"),u=i("ERH9"),c=i("uQaC"),h=i("8QQh"),p=i("yU9o"),l=i("69av"),d=i("MYiO"),f=i("VhVF"),y=i("PMEU"),v=i("zVyH"),A=i("JBu3");function C(){l.call(this),this.sEditVerificator="",this.backupCodes=r.observableArray([]),this.codesGeneratedDataInfo=r.observable(""),this.fCallBack=null,this.generatingBackupCodes=r.observable(!1),this.generateBackupCodesCommand=c.createCommand(this,this.confirmGenerateNewBackupCodes,function(){return!this.generatingBackupCodes()})}s.extendOwn(C.prototype,l.prototype),C.prototype.PopupTemplate="TwoFactorAuth_ShowBackupCodesPopup",C.prototype.onOpen=function(t,e){this.sEditVerificator=t,this.fCallBack=e,A.BackupCodesCount>0?this.getBackupCodes():(this.backupCodes([]),this.codesGeneratedDataInfo(""),this.generateBackupCodes())},C.prototype.onClose=function(){s.isFunction(this.fCallBack)&&this.fCallBack(s.without(this.backupCodes(),"").length)},C.prototype.getBackupCodes=function(){this.backupCodes([]),this.codesGeneratedDataInfo(""),this.generatingBackupCodes(!0),h.send("TwoFactorAuth","GetBackupCodes",{Password:this.sEditVerificator},function(t){this.generatingBackupCodes(!1),this.parseBackupCodes(t)},this)},C.prototype.confirmGenerateNewBackupCodes=function(){y.showPopup(d,[a.i18n("TWOFACTORAUTH/INFO_GET_NEW_CODES"),function(t){t&&this.generateBackupCodes()}.bind(this),a.i18n("TWOFACTORAUTH/CONFIRM_GET_NEW_CODES")])},C.prototype.generateBackupCodes=function(){this.generatingBackupCodes(!0),h.send("TwoFactorAuth","GenerateBackupCodes",{Password:this.sEditVerificator},function(t){this.generatingBackupCodes(!1),this.parseBackupCodes(t)},this)},C.prototype.parseBackupCodes=function(t){var e=t&&t.Result,i=e&&e.Codes;if(u.isNonEmptyArray(i)){var o=n.unix(e.Datetime);this.codesGeneratedDataInfo(a.i18n("TWOFACTORAUTH/INFO_CODES_GENERATED_DATA",{DATA:o.format("MMM D, YYYY")})),this.backupCodes(i)}},C.prototype.getBackupCodesFileText=function(){var t="";return t+=a.i18n("TWOFACTORAUTH/HEADING_SAVE_CODES")+"\n",t+=a.i18n("TWOFACTORAUTH/INFO_KEEP_CODES_SAFE")+"\n",t+="\n",s.each(this.backupCodes(),function(e,i){t+=i+1+". "+e+"\n"}),t+="\n",t+=p.getUserPublicId()+"\n",t+="\n",t+=a.i18n("TWOFACTORAUTH/INFO_USE_CODE_ONCE")+"\n",t+=this.codesGeneratedDataInfo()+"\n"},C.prototype.print=function(){var t=this.getBackupCodesFileText(),e=v.open("","backup-codes-"+p.getUserPublicId()+"-print");e&&(o(e.document.body).html("<pre>"+t+"</pre>"),e.print())},C.prototype.download=function(){var t=this.getBackupCodesFileText(),e=new Blob([t],{type:"text/plain;charset=utf-8"});f.saveAs(e,"backup-codes-"+p.getUserPublicId()+".txt",!0)},t.exports=new C},D4nH:(t,e,i)=>{"use strict";var o=i("sdEb"),s=i("LKDt"),r=i("ERH9"),n=i("yU9o"),a=i("JBu3");function u(t){this.sDeviceId="",this.bCurrentDevice=!1,this.sDeviceName="",this.sDeviceCustomName="",this.bAuthenticated=!1,this.sDeviceExpiresDate="",this.sDeviceLastUsageDate="",t&&this.parse(t)}u.prototype.parse=function(t){var e=o.unix(t.TrustTillDateTime),i=o.unix(t.LastUsageDateTime);this.sDeviceId=r.pString(t.DeviceId),this.bCurrentDevice=this.sDeviceId===n.getCurrentDeviceId(),this.bAuthenticated=r.pBool(t.Authenticated),this.sDeviceName=r.pString(t.DeviceName),this.sDeviceCustomName=r.pString(t.DeviceCustomName),a.AllowTrustedDevices&&e.diff(o())>0&&(this.sDeviceExpiresDate=s.i18n("TWOFACTORAUTH/LABEL_DEVICE_TRUST_TILL_DATE",{EXPDATE:e.format("MMM D, YYYY")})),this.sDeviceLastUsageDate=s.i18n("TWOFACTORAUTH/LABEL_DEVICE_LAST_USAGE_DATE",{USAGEDATE:i.fromNow()})},t.exports=u},JBu3:(t,e,i)=>{"use strict";var o=i("M4cL"),s=i("p09A"),r=i("a7T2"),n=i("LKDt"),a=i("ERH9"),u=i("yU9o"),c=i("5D2l"),h=i("D2Gh");t.exports={ServerModuleName:"TwoFactorAuth",HashModuleName:"two-factor-auth",AuthenticatorAppEnabled:!1,ShowRecommendationToConfigure:!0,AllowBackupCodes:!1,BackupCodesCount:!1,AllowSecurityKeys:!1,AllowAuthenticatorApp:!1,SecurityKeys:[],AllowUsedDevices:!1,CurrentIP:"",TrustDevicesForDays:0,AllowTrustedDevices:!1,init:function(t){var e=r.extend({},t[this.ServerModuleName]||{},t.TwoFactorAuth||{});r.isEmpty(e)||(this.ShowRecommendationToConfigure=a.pBool(e.ShowRecommendationToConfigure,this.ShowRecommendationToConfigure),this.AllowBackupCodes=a.pBool(e.AllowBackupCodes,this.AllowBackupCodes),this.BackupCodesCount=a.pInt(e.BackupCodesCount,this.BackupCodesCount),this.AllowSecurityKeys=a.pBool(e.AllowSecurityKeys,this.AllowSecurityKeys),this.AllowAuthenticatorApp=a.pBool(e.AllowAuthenticatorApp,this.AllowAuthenticatorApp),this.AuthenticatorAppEnabled=this.AllowAuthenticatorApp&&a.pBool(e.AuthenticatorAppEnabled,this.AuthenticatorAppEnabled),this.AllowUsedDevices=a.pBool(e.AllowUsedDevices,this.AllowUsedDevices),this.CurrentIP=a.pString(e.CurrentIP,this.CurrentIP),this.TrustDevicesForDays=a.pInt(e.TrustDevicesForDays,this.TrustDevicesForDays),this.AllowTrustedDevices=this.TrustDevicesForDays>0,this.SecurityKeys=[],a.isNonEmptyArray(e.WebAuthKeysInfo)&&r.each(e.WebAuthKeysInfo,function(t){a.isNonEmptyArray(t,2)&&this.SecurityKeys.push({Id:t[0],keyName:s.observable(t[1])})}.bind(this)),this.checkIfEnabled())},updateShowRecommendation:function(t){this.ShowRecommendationToConfigure=t},updateBackupCodesCount:function(t){this.BackupCodesCount=t},updateAuthenticatorApp:function(t){this.AuthenticatorAppEnabled=!!t},checkIfEnabled:function(){if(!u.isMobile()&&u.isUserNormalOrTenant()&&this.ShowRecommendationToConfigure){var t="settings/two-factor-auth"===window.location.hash||"#settings/two-factor-auth"===window.location.hash,e="settings/security"===window.location.hash||"#settings/security"===window.location.hash;this.AuthenticatorAppEnabled||t||e||setTimeout(function(){var t=c.isModuleEnabled("SecuritySettingsWebclient")?"#settings/security":"#settings/two-factor-auth";h.showLoading(n.i18n("TWOFACTORAUTH/CONFIRM_MODULE_NOT_ENABLED",{TWO_FACTOR_LINK:t})),o(".report_panel.loading a").on("click",function(){h.hideLoading()}),setTimeout(function(){h.hideLoading()},1e4)},100)}}}},MVsM:(t,e,i)=>{"use strict";var o=i("+147"),s=i("LKDt"),r=i("ERH9");t.exports={getName:function(){var t=navigator.userAgent,e=o(r.pString(t));return s.i18n("TWOFACTORAUTH/LABEL_DEVICE_NAME",{NAME:"".concat(e.browser.name,"/").concat(r.pInt(e.browser.version)),PLATFORM:"".concat(e.os.name," ").concat(e.os.version)})}}},NN8Y:(t,e,i)=>{"use strict";var o=i("a7T2"),s=i("p09A"),r=i("8QQh"),n=i("Z9uT"),a=i("69av");function u(){a.call(this),this.deviceId=s.observable(""),this.customUaName=s.observable(""),this.customName=s.observable(""),this.successCallback=function(){},this.inProgress=s.observable(!1)}o.extendOwn(u.prototype,a.prototype),u.prototype.PopupTemplate="TwoFactorAuth_EditDevicePopup",u.prototype.onOpen=function(t,e,i,o){this.deviceId(t),this.customUaName(e),this.customName(i),this.successCallback="function"==typeof o?o:function(){}},u.prototype.saveCustomName=function(){var t={DeviceId:this.deviceId(),DeviceCustomName:this.customName()};this.inProgress(!0),r.send("TwoFactorAuth","SetDeviceCustomName",t,this.onSetDeviceCustomNameResponse,this)},u.prototype.onSetDeviceCustomNameResponse=function(t){this.inProgress(!1),t&&t.Result?(this.successCallback(),this.closePopup()):n.showErrorByCode(t)},t.exports=new u},"PW9/":(t,e,i)=>{"use strict";var o=i("a7T2"),s=i("p09A"),r=i("LKDt"),n=i("ERH9"),a=i("uQaC"),u=i("8QQh"),c=i("Z9uT"),h=i("69av"),p=i("D2Gh"),l=i("WVZ0");function d(){h.call(this),this.sEditVerificator=null,this.fSuccessCallback=null,this.authenticatorQRCodeUrl=s.observable(""),this.authenticatorSecret=s.observable(""),this.authenticatorCode=s.observable(""),this.authenticatorCodeFocus=s.observable(!1),this.saveInProgress=s.observable(!1),this.qrCodeIsLoading=s.observable(!1),this.saveCommand=a.createCommand(this,this.save,function(){return n.isNonEmptyString(this.authenticatorQRCodeUrl())&&n.isNonEmptyString(this.authenticatorSecret())&&n.isNonEmptyString(this.authenticatorCode())})}o.extendOwn(d.prototype,h.prototype),d.prototype.PopupTemplate="TwoFactorAuth_ConfigureAuthenticatorAppPopup",d.prototype.onOpen=function(t,e){this.sEditVerificator=t,this.fSuccessCallback=e,this.authenticatorQRCodeUrl(""),this.authenticatorSecret(""),this.authenticatorCode(""),this.authenticatorCodeFocus(!1),this.saveInProgress(!1),this.qrCodeIsLoading(!0),this.getAuthenticatorAppData()},d.prototype.getAuthenticatorAppData=function(){var t={Password:this.sEditVerificator};u.send("TwoFactorAuth","RegisterAuthenticatorAppBegin",t,this.onRegisterAuthenticatorAppBeginResponse,this)},d.prototype.onRegisterAuthenticatorAppBeginResponse=function(t){var e=t&&t.Result;if(e&&e.Secret&&e.QRCodeName){var i="otpauth://totp/".concat(e.QRCodeName,"?secret=").concat(e.Secret);this.authenticatorQRCodeUrl(l.generatePNG(i,{margin:0,modulesize:6})),this.authenticatorSecret(e.Secret),this.authenticatorCodeFocus(!0)}else c.showErrorByCode(t,r.i18n("TWOFACTORAUTH/ERROR_SECRET_GENERATION_FAILED"))},d.prototype.save=function(){if(n.isNonEmptyString(this.authenticatorCode())){var t={Password:this.sEditVerificator,Code:this.authenticatorCode(),Secret:this.authenticatorSecret()};this.saveInProgress(!0),u.send("TwoFactorAuth","RegisterAuthenticatorAppFinish",t,this.onRegisterAuthenticatorAppFinishResponse,this)}},d.prototype.onRegisterAuthenticatorAppFinishResponse=function(t){this.saveInProgress(!1),t&&t.Result?(o.isFunction(this.fSuccessCallback)&&this.fSuccessCallback(),this.closePopup()):p.showError(r.i18n("TWOFACTORAUTH/ERROR_WRONG_CODE"))},t.exports=new d},SW2n:(t,e,i)=>{"use strict";var o=i("a7T2"),s=i("p09A"),r=i("LKDt"),n=i("ERH9"),a=i("uQaC"),u=i("8QQh"),c=i("Z9uT"),h=i("69av");function p(){h.call(this),this.sEditVerificator="",this.sName="",this.iId=0,this.name=s.observable(""),this.nameFocus=s.observable(!0),this.inProgress=s.observable(!1),this.saveCommand=a.createCommand(this,this.save,function(){return n.isNonEmptyString(this.name())})}i("D2Gh"),o.extendOwn(p.prototype,h.prototype),p.prototype.PopupTemplate="TwoFactorAuth_EditSecurityKeyPopup",p.prototype.onOpen=function(t,e,i,o){this.sEditVerificator=t,this.iId=e,this.name(i),this.nameFocus(!0),this.fCallback=o},p.prototype.save=function(){if(n.isNonEmptyString(this.name())){var t={Password:this.sEditVerificator,KeyId:this.iId,NewName:this.name()};this.inProgress(!0),u.send("TwoFactorAuth","UpdateSecurityKeyName",t,this.onUpdateSecurityKeyNameResponse,this)}},p.prototype.onUpdateSecurityKeyNameResponse=function(t){this.inProgress(!1),t&&t.Result?(o.isFunction(this.fCallback)&&this.fCallback(this.iId,this.name()),this.closePopup()):c.showErrorByCode(t,r.i18n("TWOFACTORAUTH/ERROR_SETUP_SECRET_KEY_NAME"))},t.exports=new p},VhVF:function(t,e,i){var o,s=s||function(t){"use strict";if(!(void 0===t||"undefined"!=typeof navigator&&/MSIE [1-9]\./.test(navigator.userAgent))){var e=t.document,i=function(){return t.URL||t.webkitURL||t},o=e.createElementNS("http://www.w3.org/1999/xhtml","a"),s="download"in o,r=/constructor/i.test(t.HTMLElement)||t.safari,n=/CriOS\/[\d]+/.test(navigator.userAgent),a=function(e){(t.setImmediate||t.setTimeout)(function(){throw e},0)},u=function(t){setTimeout(function(){"string"==typeof t?i().revokeObjectURL(t):t.remove()},4e4)},c=function(t){return/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(t.type)?new Blob([String.fromCharCode(65279),t],{type:t.type}):t},h=function(e,h,p){p||(e=c(e));var l,d=this,f="application/octet-stream"===e.type,y=function(){!function(t,e){for(var i=(e=[].concat(e)).length;i--;){var o=t["on"+e[i]];if("function"==typeof o)try{o.call(t,t)}catch(t){a(t)}}}(d,"writestart progress write writeend".split(" "))};if(d.readyState=d.INIT,s)return l=i().createObjectURL(e),void setTimeout(function(){var t,e;o.href=l,o.download=h,t=o,e=new MouseEvent("click"),t.dispatchEvent(e),y(),u(l),d.readyState=d.DONE});!function(){if((n||f&&r)&&t.FileReader){var o=new FileReader;return o.onloadend=function(){var e=n?o.result:o.result.replace(/^data:[^;]*;/,"data:attachment/file;");t.open(e,"_blank")||(t.location.href=e),e=void 0,d.readyState=d.DONE,y()},o.readAsDataURL(e),void(d.readyState=d.INIT)}l||(l=i().createObjectURL(e)),f?t.location.href=l:t.open(l,"_blank")||(t.location.href=l),d.readyState=d.DONE,y(),u(l)}()},p=h.prototype;return"undefined"!=typeof navigator&&navigator.msSaveOrOpenBlob?function(t,e,i){return e=e||t.name||"download",i||(t=c(t)),navigator.msSaveOrOpenBlob(t,e)}:(p.abort=function(){},p.readyState=p.INIT=0,p.WRITING=1,p.DONE=2,p.error=p.onwritestart=p.onprogress=p.onwrite=p.onabort=p.onerror=p.onwriteend=null,function(t,e,i){return new h(t,e||t.name||"download",i)})}}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||this.content);t.exports?t.exports.saveAs=s:null!==i.amdD&&null!==i.amdO&&(void 0===(o=function(){return s}.call(e,i,e,t))||(t.exports=o))},WVZ0:function(t,e){var i,o;void 0===(o="function"==typeof(i=function(){for(var t=[null,[[10,7,17,13],[1,1,1,1],[]],[[16,10,28,22],[1,1,1,1],[4,16]],[[26,15,22,18],[1,1,2,2],[4,20]],[[18,20,16,26],[2,1,4,2],[4,24]],[[24,26,22,18],[2,1,4,4],[4,28]],[[16,18,28,24],[4,2,4,4],[4,32]],[[18,20,26,18],[4,2,5,6],[4,20,36]],[[22,24,26,22],[4,2,6,6],[4,22,40]],[[22,30,24,20],[5,2,8,8],[4,24,44]],[[26,18,28,24],[5,4,8,8],[4,26,48]],[[30,20,24,28],[5,4,11,8],[4,28,52]],[[22,24,28,26],[8,4,11,10],[4,30,56]],[[22,26,22,24],[9,4,16,12],[4,32,60]],[[24,30,24,20],[9,4,16,16],[4,24,44,64]],[[24,22,24,30],[10,6,18,12],[4,24,46,68]],[[28,24,30,24],[10,6,16,17],[4,24,48,72]],[[28,28,28,28],[11,6,19,16],[4,28,52,76]],[[26,30,28,28],[13,6,21,18],[4,28,54,80]],[[26,28,26,26],[14,7,25,21],[4,28,56,84]],[[26,28,28,30],[16,8,25,20],[4,32,60,88]],[[26,28,30,28],[17,8,25,23],[4,26,48,70,92]],[[28,28,24,30],[17,9,34,23],[4,24,48,72,96]],[[28,30,30,30],[18,9,30,25],[4,28,52,76,100]],[[28,30,30,30],[20,10,32,27],[4,26,52,78,104]],[[28,26,30,30],[21,12,35,29],[4,30,56,82,108]],[[28,28,30,28],[23,12,37,34],[4,28,56,84,112]],[[28,30,30,30],[25,12,40,34],[4,32,60,88,116]],[[28,30,30,30],[26,13,42,35],[4,24,48,72,96,120]],[[28,30,30,30],[28,14,45,38],[4,28,52,76,100,124]],[[28,30,30,30],[29,15,48,40],[4,24,50,76,102,128]],[[28,30,30,30],[31,16,51,43],[4,28,54,80,106,132]],[[28,30,30,30],[33,17,54,45],[4,32,58,84,110,136]],[[28,30,30,30],[35,18,57,48],[4,28,56,84,112,140]],[[28,30,30,30],[37,19,60,51],[4,32,60,88,116,144]],[[28,30,30,30],[38,19,63,53],[4,28,52,76,100,124,148]],[[28,30,30,30],[40,20,66,56],[4,22,48,74,100,126,152]],[[28,30,30,30],[43,21,70,59],[4,26,52,78,104,130,156]],[[28,30,30,30],[45,22,74,62],[4,30,56,82,108,134,160]],[[28,30,30,30],[47,24,77,65],[4,24,52,80,108,136,164]],[[28,30,30,30],[49,25,81,68],[4,28,56,84,112,140,168]]],e=/^\d*$/,i=/^[A-Za-z0-9 $%*+\-./:]*$/,o=/^[A-Z0-9 $%*+\-./:]*$/,s=[],r=[-1],n=0,a=1;n<255;++n)s.push(a),r[a]=n,a=2*a^(a>=128?285:0);var u=[[]];for(n=0;n<30;++n){for(var c=u[n],h=[],p=0;p<=n;++p){var l=p<n?s[c[p]]:0,d=s[(n+(c[p-1]||0))%255];h.push(r[l^d])}u.push(h)}var f={};for(n=0;n<45;++n)f["0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:".charAt(n)]=n;var y=[function(t,e){return(t+e)%2==0},function(t,e){return t%2==0},function(t,e){return e%3==0},function(t,e){return(t+e)%3==0},function(t,e){return((t/2|0)+(e/3|0))%2==0},function(t,e){return t*e%2+t*e%3==0},function(t,e){return(t*e%2+t*e%3)%2==0},function(t,e){return((t+e)%2+t*e%3)%2==0}],v=function(t){return t>6},A=function(e,i){var o=-8&function(e){var i=t[e],o=16*e*e+128*e+64;return v(e)&&(o-=36),i[2].length&&(o-=25*i[2].length*i[2].length-10*i[2].length-55),o}(e),s=t[e];return o-8*s[0][i]*s[1][i]},C=function(t,e){switch(e){case 1:return t<10?10:t<27?12:14;case 2:return t<10?9:t<27?11:13;case 4:return t<10?8:16;case 8:return t<10?8:t<27?10:12}},b=function(t,e,i){var o=A(t,i)-4-C(t,e);switch(e){case 1:return 3*(o/10|0)+(o%10<4?0:o%10<7?1:2);case 2:return 2*(o/11|0)+(o%11<6?0:1);case 4:return o/8|0;case 8:return o/13|0}},T=function(t,e){for(var i=t.slice(0),o=t.length,n=e.length,a=0;a<n;++a)i.push(0);for(a=0;a<o;){var u=r[i[a++]];if(u>=0)for(var c=0;c<n;++c)i[a+c]^=s[(u+e[c])%255]}return i.slice(o)},g=function(t,e,i,o){for(var s=t<<o,r=e-1;r>=0;--r)s>>o+r&1&&(s^=i<<r);return t<<o|s},w=function(t,e,i){for(var o=y[i],s=t.length,r=0;r<s;++r)for(var n=0;n<s;++n)e[r][n]||(t[r][n]^=o(r,n));return t},m=function(t,e,i,o){for(var s=t.length,r=21522^g(i<<3|o,5,1335,10),n=0;n<15;++n){var a=[s-1,s-2,s-3,s-4,s-5,s-6,s-7,s-8,7,5,4,3,2,1,0][n];t[[0,1,2,3,4,5,7,8,s-7,s-6,s-5,s-4,s-3,s-2,s-1][n]][8]=t[8][a]=r>>n&1}return t},E=function(t){for(var e=function(t){for(var e=0,i=0;i<t.length;++i)t[i]>=5&&(e+=t[i]-5+3);for(i=5;i<t.length;i+=2){var o=t[i];t[i-1]==o&&t[i-2]==3*o&&t[i-3]==o&&t[i-4]==o&&(t[i-5]>=4*o||t[i+1]>=4*o)&&(e+=40)}return e},i=t.length,o=0,s=0,r=0;r<i;++r){var n,a=t[r];n=[0];for(var u=0;u<i;){for(c=0;u<i&&a[u];++c)++u;for(n.push(c),c=0;u<i&&!a[u];++c)++u;n.push(c)}for(o+=e(n),n=[0],u=0;u<i;){var c;for(c=0;u<i&&t[u][r];++c)++u;for(n.push(c),c=0;u<i&&!t[u][r];++c)++u;n.push(c)}o+=e(n);var h=t[r+1]||[];for(s+=a[0],u=1;u<i;++u){var p=a[u];s+=p,a[u-1]==p&&h[u]===p&&h[u-1]===p&&(o+=3)}}return o+10*(Math.abs(s/i/i-.5)/.05|0)},R=function(e,i,o,s,r){var n=t[i],a=function(t,e,i,o){var s=[],r=0,n=8,a=i.length,u=function(t,e){if(e>=n){for(s.push(r|t>>(e-=n));e>=8;)s.push(t>>(e-=8)&255);r=0,n=8}e>0&&(r|=(t&(1<<e)-1)<<(n-=e))},c=C(t,e);switch(u(e,4),u(a,c),e){case 1:for(var h=2;h<a;h+=3)u(parseInt(i.substring(h-2,h+1),10),10);u(parseInt(i.substring(h-2),10),[0,4,7][a%3]);break;case 2:for(h=1;h<a;h+=2)u(45*f[i.charAt(h-1)]+f[i.charAt(h)],11);a%2==1&&u(f[i.charAt(h-1)],6);break;case 4:for(h=0;h<a;++h)u(i[h],8)}for(u(0,4),n<8&&s.push(r);s.length+1<o;)s.push(236,17);return s.length<o&&s.push(236),s}(i,o,e,A(i,s)>>3);a=function(t,e,i){for(var o=[],s=t.length/e|0,r=0,n=e-t.length%e,a=0;a<n;++a)o.push(r),r+=s;for(a=n;a<e;++a)o.push(r),r+=s+1;o.push(r);var u=[];for(a=0;a<e;++a)u.push(T(t.slice(o[a],o[a+1]),i));var c=[],h=t.length/e|0;for(a=0;a<h;++a)for(var p=0;p<e;++p)c.push(t[o[p]+a]);for(p=n;p<e;++p)c.push(t[o[p+1]-1]);for(a=0;a<i.length;++a)for(p=0;p<e;++p)c.push(u[p][a]);return c}(a,n[1][s],u[n[0][s]]);var c=function(e){for(var i=t[e],o=function(t){return 4*t+17}(e),s=[],r=[],n=0;n<o;++n)s.push([]),r.push([]);var a=function(t,e,i,o,n){for(var a=0;a<i;++a)for(var u=0;u<o;++u)s[t+a][e+u]=n[a]>>u&1,r[t+a][e+u]=1};for(a(0,0,9,9,[127,65,93,93,93,65,383,0,64]),a(o-8,0,8,9,[256,127,65,93,93,93,65,127]),a(0,o-8,9,8,[254,130,186,186,186,130,254,0,0]),n=9;n<o-8;++n)s[6][n]=s[n][6]=1&~n,r[6][n]=r[n][6]=1;var u=i[2],c=u.length;for(n=0;n<c;++n)for(var h=0==n?c-1:c,p=0==n||n==c-1?1:0;p<h;++p)a(u[n],u[p],5,5,[31,17,21,17,31]);if(v(e)){var l=g(e,6,7973,12),d=0;for(n=0;n<6;++n)for(p=0;p<3;++p)s[n][o-11+p]=s[o-11+p][n]=l>>d++&1,r[n][o-11+p]=r[o-11+p][n]=1}return{matrix:s,reserved:r}}(i),h=c.matrix,p=c.reserved;if(function(t,e,i){for(var o=t.length,s=0,r=-1,n=o-1;n>=0;n-=2){6==n&&--n;for(var a=r<0?o-1:0,u=0;u<o;++u){for(var c=n;c>n-2;--c)e[a][c]||(t[a][c]=i[s>>3]>>(7&~s)&1,++s);a+=r}r=-r}}(h,p,a),r<0){w(h,p,0),m(h,0,s,0);var l=0,d=E(h);for(w(h,p,0),r=1;r<8;++r){w(h,p,r),m(h,0,s,r);var y=E(h);d>y&&(d=y,l=r),w(h,p,r)}r=l}return w(h,p,r),m(h,0,s,r),h},S={generate:function(t,s){var r={numeric:1,alphanumeric:2,octet:4},n={L:1,M:0,Q:3,H:2},a=(s=s||{}).version||-1,u=n[(s.ecclevel||"L").toUpperCase()],c=s.mode?r[s.mode.toLowerCase()]:-1,h="mask"in s?s.mask:-1;if(c<0)c="string"==typeof t?t.match(e)?1:t.match(o)?2:4:4;else if(1!=c&&2!=c&&4!=c)throw"invalid or unsupported mode";if(null===(t=function(t,o){switch(t){case 1:return o.match(e)?o:null;case 2:return o.match(i)?o.toUpperCase():null;case 4:if("string"==typeof o){for(var s=[],r=0;r<o.length;++r){var n=o.charCodeAt(r);n<128?s.push(n):n<2048?s.push(192|n>>6,128|63&n):n<65536?s.push(224|n>>12,128|n>>6&63,128|63&n):s.push(240|n>>18,128|n>>12&63,128|n>>6&63,128|63&n)}return s}return o}}(c,t)))throw"invalid data format";if(u<0||u>3)throw"invalid ECC level";if(a<0){for(a=1;a<=40&&!(t.length<=b(a,c,u));++a);if(a>40)throw"too large data"}else if(a<1||a>40)throw"invalid version";if(-1!=h&&(h<0||h>8))throw"invalid mask";return R(t,a,c,u,h)},generateHTML:function(t,e){e=e||{};for(var i=S.generate(t,e),o=Math.max(e.modulesize||5,.5),s=Math.max(null!==e.margin?e.margin:4,0),r=document.createElement("div"),n=i.length,a=['<table border="0" cellspacing="0" cellpadding="0" style="border:'+o*s+'px solid #fff;background:#fff">'],u=0;u<n;++u){a.push("<tr>");for(var c=0;c<n;++c)a.push('<td style="width:'+o+"px;height:"+o+"px"+(i[u][c]?";background:#000":"")+'"></td>');a.push("</tr>")}return r.className="qrcode",r.innerHTML=a.join("")+"</table>",r},generateSVG:function(t,e){e=e||{};var i=S.generate(t,e),o=i.length,s=Math.max(e.modulesize||5,.5),r=Math.max(e.margin?e.margin:4,0),n=s*(o+2*r),a=' class= "fg" width="'+s+'" height="'+s+'"/>',u=document.createElementNS("http://www.w3.org/2000/svg","svg");u.setAttribute("viewBox","0 0 "+n+" "+n),u.setAttribute("style","shape-rendering:crispEdges");for(var c=["<style scoped>.bg{fill:#FFF}.fg{fill:#000}</style>",'<rect class="bg" x="0" y="0"','width="'+n+'" height="'+n+'"/>'],h=r*s,p=0;p<o;++p){for(var l=r*s,d=0;d<o;++d)i[p][d]&&c.push('<rect x="'+l+'" y="'+h+'"',a),l+=s;h+=s}return u.innerHTML=c.join(""),u},generatePNG:function(t,e){e=e||{};var i,o=S.generate(t,e),s=Math.max(e.modulesize||5,.5),r=Math.max(null!=e.margin?e.margin:4,0),n=o.length,a=s*(n+2*r),u=document.createElement("canvas");if(u.width=u.height=a,!(i=u.getContext("2d")))throw"canvas support is needed for PNG output";i.fillStyle="#fff",i.fillRect(0,0,a,a),i.fillStyle="#000";for(var c=0;c<n;++c)for(var h=0;h<n;++h)o[c][h]&&i.fillRect(s*(r+h),s*(r+c),s,s);return u.toDataURL()}};return S})?i.apply(e,[]):i)||(t.exports=o)},aGpU:(t,e,i)=>{"use strict";var o=i("8QQh"),s=i("yU9o"),r=i("MVsM"),n=i("JBu3");t.exports={saveDevice:function(t,e){if(n.AllowUsedDevices){var i={DeviceId:s.getCurrentDeviceId(),DeviceName:r.getName()};o.send("TwoFactorAuth","SetDeviceName",i,e,this,null,t)}else e()}}},b8T5:t=>{"use strict";var e={base64ToArrayBuffer:function(t){for(var e=window.atob(t),i=e.length,o=new Uint8Array(i),s=0;s<i;s++)o[s]=e.charCodeAt(s);return o.buffer},arrayBufferToBase64:function(t){for(var e="",i=new Uint8Array(t),o=i.byteLength,s=0;s<o;s++)e+=String.fromCharCode(i[s]);return window.btoa(e)}};t.exports=e},hnod:(t,e,i)=>{"use strict";var o=i("a7T2"),s=i("p09A"),r=i("LKDt"),n=i("ERH9"),a=i("uQaC"),u=i("8QQh"),c=i("Z9uT"),h=i("MYiO"),p=i("5D2l"),l=i("PMEU"),d=i("D2Gh"),f=p.run("SettingsWebclient","getAbstractSettingsFormViewClass"),y=i("D4nH"),v=i("PW9/"),A=i("qqvp"),C=i("iU3V"),b=i("NN8Y"),T=i("JBu3"),g=i("SW2n"),w=i("BjEp");function m(){f.call(this,T.ServerModuleName),this.subPage=s.observable(!1),this.visibleHeading=s.observable(!0),this.showRecommendationToConfigure=s.observable(T.ShowRecommendationToConfigure),this.bAllowSecurityKeys=T.AllowSecurityKeys,this.bAllowAuthenticatorApp=T.AllowAuthenticatorApp,this.securityKeys=s.observableArray(T.SecurityKeys),this.hasBackupCodes=s.observable(!1),this.infoShowBackupCodes=s.observable(""),this.hasAuthenticatorApp=s.observable(T.AuthenticatorAppEnabled),this.isEnabledTwoFactorAuth=s.computed(function(){return this.hasAuthenticatorApp()||this.securityKeys().length>0},this),this.isEnabledTwoFactorAuth.subscribe(function(){this.isEnabledTwoFactorAuth()||(T.updateBackupCodesCount(0),this.populateSettings())},this),this.sEditVerificator="",this.passwordVerified=s.observable(!1),this.passwordVerified.subscribe(function(t){this.subPage(!!t)},this),this.allowBackupCodes=s.computed(function(){return T.AllowBackupCodes&&(this.hasAuthenticatorApp()||this.securityKeys().length>0)&&this.passwordVerified()},this),this.devices=s.observableArray([]),this.allowUsedDevices=s.computed(function(){return T.AllowUsedDevices&&this.devices().length>0},this),this.allowRevokeAll=s.computed(function(){return T.AllowTrustedDevices&&!!o.find(this.devices(),function(t){return n.isNonEmptyString(t.sDeviceExpiresDate)})},this),this.populateSettings(),this.revokeAllCommand=a.createCommand(this,this.askRevokeTrustFromAllDevices,function(){return this.allowRevokeAll()})}o.extendOwn(m.prototype,f.prototype),m.prototype.ViewTemplate="TwoFactorAuth_TwoFactorAuthSettingsFormView",m.prototype.onShow=function(){this.clearAll()},m.prototype.clearAll=function(){this.sEditVerificator="",this.passwordVerified(!1),this.populateSettings(),T.AllowUsedDevices&&this.getUsedDevices()},m.prototype.populateSettings=function(){this.showRecommendationToConfigure(T.ShowRecommendationToConfigure),this.hasAuthenticatorApp(T.AuthenticatorAppEnabled),this.hasBackupCodes(T.BackupCodesCount>0),this.infoShowBackupCodes(this.hasBackupCodes()?r.i18n("TWOFACTORAUTH/INFO_SHOW_BACKUP_CODES",{COUNT:T.BackupCodesCount}):"")},m.prototype.confirmPassword=function(){l.showPopup(A,[function(t){this.sEditVerificator=t,this.passwordVerified(!0)}.bind(this)])},m.prototype.setupAuthenticatorApp=function(){l.showPopup(v,[this.sEditVerificator,function(){T.updateAuthenticatorApp(!0),this.populateSettings(),this.disableShowRecommendation()}.bind(this)])},m.prototype.disableShowRecommendation=function(){this.showRecommendationToConfigure()&&(this.showRecommendationToConfigure(!1),u.send("TwoFactorAuth","UpdateSettings",{ShowRecommendationToConfigure:!1},function(){T.updateShowRecommendation(!1),this.populateSettings()}.bind(this)))},m.prototype.askDisableAuthenticatorApp=function(){var t=r.i18n("TWOFACTORAUTH/CONFIRM_DISABLE_AUTHENTICATOR_APP");l.showPopup(h,[t,o.bind(function(t){t&&this.disableAuthenticatorApp()},this)])},m.prototype.disableAuthenticatorApp=function(){var t={Password:this.sEditVerificator};u.send("TwoFactorAuth","DisableAuthenticatorApp",t),T.updateAuthenticatorApp(!1),this.populateSettings()},m.prototype.showBackupCodes=function(){this.allowBackupCodes()&&l.showPopup(w,[this.sEditVerificator,function(t){T.updateBackupCodesCount(t),this.populateSettings()}.bind(this)])},m.prototype.addSecurityKey=function(){l.showPopup(C,[this.sEditVerificator,this.addCreatedSecurityKey.bind(this)])},m.prototype.addCreatedSecurityKey=function(t,e){this.securityKeys.push({Id:t,keyName:s.observable(e)}),this.disableShowRecommendation()},m.prototype.askNewSecurityKeyName=function(t,e){l.showPopup(g,[this.sEditVerificator,t,e,this.updateSecurityKeyName.bind(this)])},m.prototype.updateSecurityKeyName=function(t,e){o.each(this.securityKeys(),function(i){i.Id===t&&i.keyName(e)}),this.securityKeys.valueHasMutated()},m.prototype.askRemoveSecurityKey=function(t,e){var i=r.i18n("TWOFACTORAUTH/CONFIRM_REMOVE_SECURITY_KEY",{KEYNAME:e});l.showPopup(h,[i,o.bind(function(e){e&&this.removeSecurityKey(t)},this)])},m.prototype.removeSecurityKey=function(t){u.send("TwoFactorAuth","DeleteSecurityKey",{Password:this.sEditVerificator,KeyId:t},function(e){e&&e.Result?(this.securityKeys(o.filter(this.securityKeys(),function(e){return e.Id!==t})),d.showReport(r.i18n("TWOFACTORAUTH/REPORT_DELETE_SECURITY_KEY"))):c.showErrorByCode(e,r.i18n("TWOFACTORAUTH/ERROR_DELETE_SECURITY_KEY"))},this)},m.prototype.getUsedDevices=function(){u.send("TwoFactorAuth","GetUsedDevices",{},function(t){var e=t&&t.Result,i=[];n.isNonEmptyArray(e)&&o.each(e,function(t){var e=new y(t);i.push(e)}),this.devices(i)},this)},m.prototype.askRevokeTrustFromAllDevices=function(){var t=r.i18n("TWOFACTORAUTH/CONFIRM_REVOKE_ALL"),e=r.i18n("TWOFACTORAUTH/CONFIRM_HEADING_REVOKE_ALL");l.showPopup(h,[t,o.bind(function(t){t&&this.revokeTrustFromAllDevices()},this),e])},m.prototype.revokeTrustFromAllDevices=function(){u.send("TwoFactorAuth","RevokeTrustFromAllDevices",{},function(t){this.getUsedDevices(),t&&t.Result||c.showErrorByCode(t,r.i18n("TWOFACTORAUTH/ERROR_REVOKE_TRUST"))},this)},m.prototype.askLogoutFromDevice=function(t,e){var i=r.i18n("TWOFACTORAUTH/CONFIRM_LOGOUT_DEVICE"),s=r.i18n("TWOFACTORAUTH/CONFIRM_HEADING_LOGOUT_DEVICE",{NAME:e});l.showPopup(h,[i,o.bind(function(e){e&&this.logoutFromDevice(t)},this),s])},m.prototype.logoutFromDevice=function(t){var e={DeviceId:t};u.send("TwoFactorAuth","LogoutFromDevice",e,function(t){this.getUsedDevices(),t&&t.Result||c.showErrorByCode(t,r.i18n("TWOFACTORAUTH/ERROR_LOGOUT_DEVICE"))},this)},m.prototype.askRemoveDevice=function(t,e){var i=r.i18n("TWOFACTORAUTH/CONFIRM_LOGOUT_DEVICE"),s=r.i18n("TWOFACTORAUTH/CONFIRM_HEADING_REMOVE_DEVICE",{NAME:e});l.showPopup(h,[i,o.bind(function(e){e&&this.removeDevice(t)},this),s])},m.prototype.removeDevice=function(t){var e={DeviceId:t};u.send("TwoFactorAuth","RemoveDevice",e,function(t){this.getUsedDevices(),t&&t.Result||c.showErrorByCode(t,r.i18n("TWOFACTORAUTH/ERROR_LOGOUT_DEVICE"))},this)},m.prototype.editDevice=function(t,e,i){var o=this;l.showPopup(b,[t,e,i,function(){o.getUsedDevices()}])},t.exports=new m},iU3V:(t,e,i)=>{"use strict";var o=i("a7T2"),s=i("p09A"),r=i("LKDt"),n=i("ERH9"),a=i("uQaC"),u=i("8QQh"),c=i("Z9uT"),h=i("69av"),p=(i("D2Gh"),i("b8T5"));function l(){h.call(this),this.bSecurityKeysNotSupportedError=!(navigator.credentials&&navigator.credentials.create),this.bIsHttps="https:"===window.location.protocol,this.sEditVerificator="",this.sName="",this.iId=0,this.name=s.observable(""),this.nameFocus=s.observable(!0),this.saveNameInProgress=s.observable(!1),this.securityKeyInProgress=s.observable(!1),this.securityKeyError=s.observable(!1),this.securityKeyCanceled=s.observable(!1),this.saveCommand=a.createCommand(this,this.save,function(){return n.isNonEmptyString(this.name())})}o.extendOwn(l.prototype,h.prototype),l.prototype.PopupTemplate="TwoFactorAuth_CreateSecurityKeyPopup",l.prototype.onOpen=function(t,e){this.sEditVerificator=t,this.fCallback=e,this.registerSecurityKey()},l.prototype.registerSecurityKey=function(t){this.bSecurityKeysNotSupportedError?(this.securityKeyInProgress(!1),this.securityKeyError(!0)):(this.iId=0,this.name(""),this.securityKeyInProgress(!0),this.securityKeyError(!1),this.securityKeyCanceled(!1),u.send("TwoFactorAuth","RegisterSecurityKeyBegin",{Password:this.sEditVerificator},this.onRegisterSecurityKeyBeginResponse,this))},l.prototype.onRegisterSecurityKeyBeginResponse=function(t){var e=this;if(t&&t.Result){var i=t.Result;i.publicKey.challenge=p.base64ToArrayBuffer(i.publicKey.challenge),i.publicKey.user.id=p.base64ToArrayBuffer(i.publicKey.user.id),navigator.credentials.create(i).then(function(t){var i={Password:e.sEditVerificator,Attestation:{attestationObject:p.arrayBufferToBase64(t.response.attestationObject),clientDataJSON:p.arrayBufferToBase64(t.response.clientDataJSON)}};u.send("TwoFactorAuth","RegisterSecurityKeyFinish",i,e.onRegisterSecurityKeyFinishResponse,e)}).catch(function(t){e.securityKeyInProgress(!1),e.securityKeyCanceled(!0)})}else this.securityKeyInProgress(!1),this.closePopup(),c.showErrorByCode(t,r.i18n("TWOFACTORAUTH/ERROR_ADD_SECURITY_KEY"))},l.prototype.onRegisterSecurityKeyFinishResponse=function(t){this.securityKeyInProgress(!1),t&&t.Result?(this.iId=t.Result,this.nameFocus(!0)):(this.closePopup(),c.showErrorByCode(t,r.i18n("TWOFACTORAUTH/ERROR_ADD_SECURITY_KEY")))},l.prototype.save=function(){if(n.isNonEmptyString(this.name())){var t={Password:this.sEditVerificator,KeyId:this.iId,NewName:this.name()};this.saveNameInProgress(!0),u.send("TwoFactorAuth","UpdateSecurityKeyName",t,this.onUpdateSecurityKeyNameResponse,this)}},l.prototype.onUpdateSecurityKeyNameResponse=function(t){this.saveNameInProgress(!1),t&&t.Result?(o.isFunction(this.fCallback)&&this.fCallback(this.iId,this.name()),this.closePopup()):(o.isFunction(this.fCallback)&&this.fCallback(this.iId,""),this.closePopup(),c.showErrorByCode(t,r.i18n("TWOFACTORAUTH/ERROR_SETUP_SECRET_KEY_NAME")))},l.prototype.cancelPopup=function(){},l.prototype.onEscHandler=function(t){},t.exports=new l},qqvp:(t,e,i)=>{"use strict";var o=i("a7T2"),s=i("p09A"),r=i("LKDt"),n=i("8QQh"),a=i("Z9uT"),u=i("69av");function c(){u.call(this),this.fSuccessCallback=null,this.password=s.observable(""),this.passwordFocus=s.observable(!0),this.inProgress=s.observable(!1)}o.extendOwn(c.prototype,u.prototype),c.prototype.PopupTemplate="TwoFactorAuth_ConfirmPasswordPopup",c.prototype.onOpen=function(t){this.fSuccessCallback=t,this.password(""),this.passwordFocus(!0)},c.prototype.verifyPassword=function(){var t={Password:this.password()};this.inProgress(!0),n.send("TwoFactorAuth","VerifyPassword",t,this.onVerifyPasswordResponse,this)},c.prototype.onVerifyPasswordResponse=function(t){this.inProgress(!1),t&&t.Result?(o.isFunction(this.fSuccessCallback)&&this.fSuccessCallback(this.password()),this.closePopup()):a.showErrorByCode(t,r.i18n("TWOFACTORAUTH/ERROR_WRONG_PASSWORD"))},t.exports=new c},"t0U+":(t,e,i)=>{"use strict";var o=i("a7T2"),s=i("p09A"),r=i("LKDt"),n=i("uQaC"),a=i("8QQh"),u=i("Z9uT"),c=i("yU9o"),h=i("69av"),p=i("D2Gh"),l=i("b8T5"),d=i("MVsM"),f=i("JBu3"),y=i("aGpU");function v(){h.call(this),this.isMobile=s.observable(c.isMobile()||!1),this.afterVerifyCallback=function(){},this.fOnCancel=null,this.login=s.observable(null),this.sPassword=null,this.bAllowTrustedDevices=f.AllowTrustedDevices,this.verificationResponse=s.observable(null),this.verificationPassed=s.computed(function(){return null!==this.verificationResponse()},this),this.verificationResponse.subscribe(function(){this.verificationPassed()&&!this.bAllowTrustedDevices&&(this.afterVerify(),this.closePopup())},this),this.trustThisBrowser=s.observable(!1),this.sTrustThisBrowserText=r.i18n("TWOFACTORAUTH/LABEL_TRUST_DEVICE_PLURAL",{COUNT:f.TrustDevicesForDays},null,f.TrustDevicesForDays),this.allOptionsVisible=s.observable(!1),this.securityKeyVisible=s.observable(!1),this.authenticatorAppVisible=s.observable(!1),this.backupCodesVisible=s.observable(!1),this.hasSecurityKey=s.observable(!1),this.securityKeyInProgress=s.observable(!1),this.securityKeyError=s.observable(!1),this.bSecurityKeysNotSupportedError=!(navigator.credentials&&navigator.credentials.get),this.bIsHttps="https:"===window.location.protocol,this.hasAuthenticatorApp=s.observable(!1),this.authenticatorCode=s.observable(""),this.authenticatorCodeFocused=s.observable(!1),this.authenticatorCodeInProgress=s.observable(!1),this.hasBackupCodes=s.observable(!1),this.backupCode=s.observable(!1),this.backupCodeFocus=s.observable(!1),this.backupCodeInProgress=s.observable(!1),this.hasSeveralOptions=s.computed(function(){var t=0;return this.hasSecurityKey()&&t++,this.hasAuthenticatorApp()&&t++,this.hasBackupCodes()&&t++,t>1},this),this.continueInProgress=s.observable(!1),this.continueCommand=n.createCommand(this,this.afterVerify,function(){return!this.continueInProgress()})}o.extendOwn(v.prototype,h.prototype),v.prototype.PopupTemplate="TwoFactorAuth_VerifySecondFactorPopup",v.prototype.onOpen=function(t,e,i,o,s){this.continueInProgress(!1),this.afterVerifyCallback="function"==typeof t?t:function(){},this.fOnCancel=e,this.login(o),this.sPassword=s,this.hasSecurityKey(f.AllowSecurityKeys&&i.HasSecurityKey),this.hasAuthenticatorApp(f.AllowAuthenticatorApp&&i.HasAuthenticatorApp),this.hasBackupCodes(f.AllowBackupCodes&&i.HasBackupCodes),this.verificationResponse(null),this.authenticatorCode(""),this.authenticatorCodeInProgress(!1),this.backupCode(""),this.backupCodeInProgress(!1),this.allOptionsVisible(!1),this.securityKeyVisible(!1),this.authenticatorAppVisible(!1),this.backupCodesVisible(!1),this.hasSecurityKey()?this.useSecurityKey():this.hasAuthenticatorApp()&&this.useAuthenticatorApp()},v.prototype.useOtherOption=function(){this.allOptionsVisible(!0),this.securityKeyVisible(!1),this.authenticatorAppVisible(!1),this.backupCodesVisible(!1)},v.prototype.useSecurityKey=function(){this.hasSecurityKey()&&(this.allOptionsVisible(!1),this.securityKeyVisible(!0),this.authenticatorAppVisible(!1),this.backupCodesVisible(!1),this.verifySecurityKey())},v.prototype.useAuthenticatorApp=function(){this.hasAuthenticatorApp()&&(this.allOptionsVisible(!1),this.securityKeyVisible(!1),this.authenticatorAppVisible(!0),this.backupCodesVisible(!1),this.authenticatorCodeFocused(!0))},v.prototype.useBackupCodes=function(){this.hasBackupCodes()&&(this.allOptionsVisible(!1),this.securityKeyVisible(!1),this.authenticatorAppVisible(!1),this.backupCodesVisible(!0),this.backupCodeFocus(!0))},v.prototype.verifySecurityKey=function(){if(this.bSecurityKeysNotSupportedError)this.securityKeyInProgress(!1),this.securityKeyError(!0);else{var t={Login:this.login(),Password:this.sPassword};this.securityKeyInProgress(!0),this.securityKeyError(!1),a.send("TwoFactorAuth","VerifySecurityKeyBegin",t,this.onVerifySecurityKeyBegin,this)}},v.prototype.onVerifySecurityKeyBegin=function(t){var e=this,i=t&&t.Result;i?(i.publicKey.challenge=l.base64ToArrayBuffer(i.publicKey.challenge),i.publicKey.allowCredentials.forEach(function(t){t.id=l.base64ToArrayBuffer(t.id)}),navigator.credentials.get(i).then(function(t){var i=t&&t.response,o={Login:e.login(),Password:e.sPassword,Attestation:{id:t&&t.rawId?l.arrayBufferToBase64(t.rawId):null,clientDataJSON:i&&i.clientDataJSON?l.arrayBufferToBase64(i.clientDataJSON):null,authenticatorData:i&&i.authenticatorData?l.arrayBufferToBase64(i.authenticatorData):null,signature:i&&i.signature?l.arrayBufferToBase64(i.signature):null}};a.send("TwoFactorAuth","VerifySecurityKeyFinish",o,e.onVerifySecurityKeyFinish,e)}).catch(function(t){e.securityKeyInProgress(!1),e.securityKeyError(!0)})):(this.securityKeyInProgress(!1),this.securityKeyError(!0),u.showErrorByCode(t,r.i18n("TWOFACTORAUTH/ERROR_VERIFY_SECURITY_KEY")))},v.prototype.onVerifySecurityKeyFinish=function(t){this.securityKeyInProgress(!1),t&&t.Result?this.verificationResponse(t):(this.securityKeyError(!0),u.showErrorByCode(t,r.i18n("TWOFACTORAUTH/ERROR_VERIFY_SECURITY_KEY")))},v.prototype.verifyAuthenticatorCode=function(){var t={Login:this.login(),Password:this.sPassword,Code:this.authenticatorCode()};this.authenticatorCodeInProgress(!0),a.send("TwoFactorAuth","VerifyAuthenticatorAppCode",t,this.onVerifyAuthenticatorAppCodeResponse,this)},v.prototype.onVerifyAuthenticatorAppCodeResponse=function(t){var e=t.Result;this.authenticatorCodeInProgress(!1),this.authenticatorCode(""),e?this.verificationResponse(t):p.showError(r.i18n("TWOFACTORAUTH/ERROR_WRONG_CODE"))},v.prototype.verifyBackupCode=function(){var t={Login:this.login(),Password:this.sPassword,BackupCode:this.backupCode()};this.backupCodeInProgress(!0),a.send("TwoFactorAuth","VerifyBackupCode",t,this.onVerifyBackupCode,this)},v.prototype.onVerifyBackupCode=function(t){var e=t.Result;this.backupCodeInProgress(!1),this.backupCode(""),e?this.verificationResponse(t):p.showError(r.i18n("TWOFACTORAUTH/ERROR_WRONG_BACKUP_CODE"))},v.prototype.cancelPopup=function(){o.isFunction(this.fOnCancel)&&this.fOnCancel(!1),this.closePopup()},v.prototype.afterVerify=function(){var t=this,e=this.verificationResponse()&&this.verificationResponse().Result&&this.verificationResponse().Result.AuthToken||"";y.saveDevice(e,function(){t.trustDevice(e,function(){t.afterVerifyCallback(t.verificationResponse())})})},v.prototype.trustDevice=function(t,e){if(f.AllowUsedDevices&&this.trustThisBrowser()){var i={DeviceId:c.getCurrentDeviceId(),DeviceName:d.getName(),Trust:this.trustThisBrowser()};this.continueInProgress(!0),a.send("TwoFactorAuth","TrustDevice",i,function(t){t&&t.Result?e():u.showErrorByCode(t)},this,null,t)}else e()},t.exports=new v}}]);