1mcWeb.loginCheckout=new function(){var n=jQuery;this.events={onShowHideLogin:"mcWeb.loginCheckout.events.onShowHideLogin",onShowLoginEmail:"mcWeb.loginCheckout.events.onShowLoginEmail",onShowLoginPassword:"mcWeb.loginCheckout.events.onShowLoginPassword",onShowLoginPasswordKeepPaymentsVisible:"mcWeb.loginCheckout.events.onShowLoginPasswordKeepPaymentsVisible",onChangedEmail:"mcWeb.loginCheckout.events.onChangedEmail",onReadyToLoad:"mcWeb.loginCheckout.events.onReadyToLoad"};this.vm=function(t){var f=167,e=183,c=186,o=187,i=this,h,a;this.id="#"+t;this.service=new WebApiService("CustomerRegistration");this.isLoggedIn=ko.observable(!1);this.isSoftLoggedIn=ko.observable(!1);this.forceLogin=ko.observable(!1);this.showSearchBtn=ko.observable(!0);this.showSearchSpin=ko.observable(!1);this.showPswPanel=ko.observable(!1);this.showPswBtn=ko.observable(!1);this.showPswSpin=ko.observable(!1);this.showVippsLoginBtn=ko.observable(!1);this.showVippsLoginSpin=ko.observable(!1);this.showNewCustomerBtn=ko.observable(!1);this.email=ko.observable("");this.psw=ko.observable("");this.isEmailSelected=ko.observable(!0);this.onBlurMail=ko.observable(!1);this.onBlurMail.subscribe(function(){i.isEmailSelected(!1)});this.isPswSelected=ko.observable(!1);this.showErrorLogin=ko.observable(!1);this.showBlockedLogin=ko.observable(!1);this.showCustomerRegistration=ko.observable(!1);this.onlyExpressCheckout=ko.observable(!1);this.paymentId=ko.observable();this.isCheckout=ko.observable(!1);this.checkoutRequirePassword=!1;this.useCustomerRegistration=!1;this.vippsExpressCheckoutInCart=!1;this.vippsLoginEnabled=!1;this.isVippsLogin=!1;this.emailPHText=ko.observable("");this.pwPHText=ko.observable("");this.hasDefaultDeliveryAddressSelected=ko.observable(!0);this.readyToLoad=!1;PubSub.subscribe(mcWeb.events.customerRegistration.onCustomerRegLoaded,function(){getLibrary("mcWeb.customerRegistration").then(()=>{mcWeb.customerRegistration.instances!==undefined&&mcWeb.customerRegistration.instances["checkout-registration"]!==undefined&&(i.registration=mcWeb.customerRegistration.instances["checkout-registration"],i.readyToLoad=!0,PubSub.publish(mcWeb.loginCheckout.events.onReadyToLoad,null))})});this.data=null;var l="********************",u=function(){window.StorageService.localStorage.removeItem("user");window.StorageService.localStorage.removeItem("id");window.StorageService.localStorage.removeItem("remember");window.StorageService.localStorage.removeItem("authenticatedGuid")},v=function(){var n=mcWeb.currentUser.getUser();n!==null&&i.email(n);r(!1)};this.load=function(n,t){if(i.readyToLoad)i.innerLoad(n,t);else{const r=n,u=t;PubSub.subscribe(mcWeb.loginCheckout.events.onReadyToLoad,function(){i.innerLoad(r,u)})}};this.innerLoad=function(t,u){if(u!==null&&u!==undefined){i.isCheckout(n(".body-checkout").length>0);var f=mcWeb.currentUser.getUser();!u.IsLoggedIn&&u.SecuritySoftening&&f!==null&&i.email(f);i.securitySoftening=u.SecuritySoftening;i.isSoftLoggedIn(u.IsSoftLoggedIn);i.isLoggedIn(u.IsLoggedIn||u.ReadOnly||u.SecuritySoftening&&f!==null);i.checkoutRequirePassword=u.CheckoutRequirePassword;i.useCustomerRegistration=u.ShowCustomerRegistration;i.vippsExpressCheckoutInCart=u.VippsExpressCheckoutInCart;i.vippsLoginEnabled=u.VippsLoginEnabled;i.showVippsLoginBtn(i.vippsLoginEnabled)}if(i.isLoggedIn()||i.isSoftLoggedIn()){r(!1);return}v();i.vippsRegisterCustomer();i.loadTexts()};this.loadTexts=function(){let t=new WebApiService("Language");var n={ObjectName:"CHECKOUT",ValueNames:["E-mailSearchTextBoxPlaceholder",]};t.PostAction("GetLanguageTexts",n).then(function(r){r&&"E-mailSearchTextBoxPlaceholder"in r&&i.emailPHText(r["E-mailSearchTextBoxPlaceholder"]);n={ObjectName:"CUSTOMER_REGISTRATION",ValueNames:["Password:",]};t.PostAction("GetLanguageTexts",n).then(function(n){n&&"Password:"in n&&i.pwPHText(n["Password:"])})})};this.vippsRegisterCustomer=function(){if(window.location.hash.toLowerCase()==="#vippslogin"&&(i.isVippsLogin=!0),i.vippsLoginEnabled&&i.isVippsLogin){var t=mcWeb.customerRegistration.instances["checkout-registration"];t!==null&&i.service.GetAction("RegistrationSettingsJson",{isCheckout:n(".body-checkout").length>0,token:null}).then(function(n){n!==null&&(n.ShowCustomerRegistration===!0||token!==null)&&(t.registrationVM.populateAddress(n.User,n.IsVippsLogin),i.newCustomer())})}};var r=function(n){var t=null;
1t=n?{WebBrukerId:"",NewCustomer:!0}:{WebBrukerId:i.email(),NewCustomer:!1};i.showSearchSpin(!0);i.service.PostAction("CheckNextCheckoutStage",t).then(function(n){if(i.showSearchSpin(!1),n&&n.Success)switch(n.NextStage){case"InActive":b();return;case"DoSoftLogin":k();return;case"ShowUserName":w();break;case"ShowUserNameAndPassword":s(n.AutoFillUserName);PubSub.publish(mcWeb.loginCheckout.events.onShowHideLogin,null);break;case"ShowUserDetails":p();break;case"ShowCustomerRegistration":y()}})},y=function(){i.showCustomerRegistration(!0);i.showNewCustomerBtn(!1);i.showPswPanel(!1);i.isPswSelected(!1);i.showPswBtn(!1);i.showSearchSpin(!1);i.forceLogin(!1);PubSub.publish(mcWeb.events.customerRegistration.onChangeEmail,i.email());PubSub.publish(mcWeb.loginCheckout.events.onShowHideLogin,null)},p=function(){i.showCustomerRegistration(!1);i.showNewCustomerBtn(!1);i.showPswPanel(!1);i.isPswSelected(!1);i.showPswBtn(!1);i.showSearchSpin(!1);i.forceLogin(!1);PubSub.publish(mcWeb.loginCheckout.events.onShowHideLogin,null);d()},w=function(){i.showCustomerRegistration(!1);i.showSearchBtn(!0);i.showPswPanel(!1);i.showPswBtn(!1);i.showNewCustomerBtn(!1);i.forceLogin(!1);i.setLoginFocus(!0);PubSub.publish(mcWeb.loginCheckout.events.onShowHideLogin,null)},b=function(){i.showBlockedLogin(!0);i.showCustomerRegistration(!1);i.showSearchSpin(!1)},k=function(){i.showCustomerRegistration(!1);i.showPswPanel(!1);i.showNewCustomerBtn(!1);i.showPswBtn(!1);i.forceLogin(!1);mcWeb.currentUser.doSecuritySofteningLogin(i.email())},s=function(n){i.showSearchBtn(!1);i.showCustomerRegistration(!1);i.showNewCustomerBtn(i.useCustomerRegistration);i.showPswPanel(!0);i.showPswBtn(!0);i.showSearchSpin(!1);n!==undefined&&n!==null&&n.length>0&&i.email(n);i.setLoginFocus();i.forceLogin(!0)},d=function(){var t={email:i.email(),zipCode:null,isCheckout:i.isCheckout()},n=mcWeb.customerRegistration.instances["checkout-registration"].registrationVM;n.usingPorterbuddy()&&(t.email=n.epostCustomer());i.hasDefaultDeliveryAddressSelected(n.hasDefaultDeliveryAddressSelected());i.service.PostAction("IsRegistered",t).then(function(n){if(i.showSearchSpin(!1),i.showPswSpin(!1),n!==null){if(n.useSoftlog&&i.checkoutRequirePassword===!0){i.showPswPanel(!0);i.isPswSelected(!0);i.showPswBtn(!0);return}var t=n.epost===null||n.epost.length<2?i.email():n.epost;n.epost=t;h(n)}})};PubSub.subscribe("DeliveryAddress.ChangedSelectedDeliveryAddress",function(n,t){i.hasDefaultDeliveryAddressSelected(t)});this.runCheckEmail=function(){r()};h=function(n){if(n===null){i.showPswSpin(!1);i.showPswBtn(!0);return}i.showCustomerRegistration(!0);i.registration!==null&&i.registration!==undefined?PubSub.publish(mcWeb.events.customerRegistration.onChangedCustomerData,n):(console.log("Waiting for customer registration to load"),i.tmpCustomerRegData=n,PubSub.subscribe(mcWeb.events.customerRegistration.onCustomerRegLoaded,()=>i.publishDelayedOnChangedCustomerData()));PubSub.publish(mcWeb.loginCheckout.events.onShowHideLogin,null)};this.publishDelayedOnChangedCustomerData=function(){console.log("publishing delayed customer data changed event");PubSub.publish(mcWeb.events.customerRegistration.onChangedCustomerData,i.tmpCustomerRegData);i.unsubscribeCustomerRegLoaded()};this.unsubscribeCustomerRegLoaded=function(){PubSub.unsubscribe(mcWeb.events.customerRegistration.onCustomerRegLoaded,i.publishDelayedOnChangedCustomerData)};this.newCustomer=function(){if(i.isLoggedIn()||i.isSoftLoggedIn()){PubSub.publish(mcWeb.customerRegistration.onRememberedUserNotMe,null);var n=new WebApiService("CustomerRegistration");n.GetAction("ChangeSessionToDefaultCustomer").then(function(){window.location.reload()})}else r(!0)};this.onClickCheckEmail=function(n,t){return(i.showErrorLogin(!1),i.showBlockedLogin(!1),t.keyCode===13||t.type==="click")?(i.email()!==null&&i.email().length>0?r():(u(!1),i.showErrorLogin(!0)),!1):!0};a=function(){var r,s;try{var t=i.psw(),f=t===l,e=window.StorageService.localStorage.getItem("id"),o=e!==null&&f?e:t;if(o===null||t===l){u();PubSub.publish(mcWeb.lightbox.events.onHideSpinicon);n("#error-msg-login").show();return}i.showPswBtn(!1);i.showPswSpin(!0);r={username:i.email(),password:o,localstorge:f,allowasynclogin:!1,isCheckout:i.isCheckout(),IsNormalMode:i.email().indexOf("@multicase.no")>0};i.data=r;s=new WebApiService("Login");s.PostAction("Login",r).then(function(n){return i.showPswSpin(!1),n.Success===!0?(i.successLoginResult=n,n.IsAgent===!0||n.IsClub===!0||n.Token!=null||n.TwoFactorStatus!==null?i.postViewingConditions():i.runAfterLoginSuccess(n)):(i.showPswSpin(!1),i.showPswBtn(!0),u(!1),i.showErrorLogin(!0)),!1})}catch(h){alert("Exception: "+h)}};this.runAfterLoginSuccess=function(n){var t,r,u,f,e;i.successLoginResult=n;t=!0;r=window.StorageService.localStorage.getItem("remember");r!==null&&r==="true"&&(u=mcWeb.currentUser.getUser(),u!==null&&u===n.User&&(window.StorageService.localStorage.setItem("id",n.Id),t=!1));t&&(window.StorageService.localStorage.removeItem("id"),window.StorageService.localStorage.removeItem("remember"));f={email:i.email(),zipCode:null,isCheckout:i.isCheckout(),authenticationGuid:n.AuthenticatedUserGuid};PubSub.publish(mcWeb.cart.events.onChangedCart,null);PubSub.publish(mcWeb.lightbox.events.onHideLightbox);mcWeb.countrySelector!==undefined&&PubSub.publish("mcWeb.countrySelector.onStartRefresh",null);e=mcWeb.customerRegistration.instances["checkout-registration"].registrationVM;i.service.PostAction("IsRegistered",f).then(function(n){e.usingPorterbuddy()&&localStorage.getItem("pb-recipient-email")===null&&localStorage.getItem("postalCode")===null&&localStorage.getItem("pb-recipient-street-address")===null&&(localStorage.setItem("pb-recipient-email",n.epost),localStorage.setItem("postalCode",n.postnrDelivery),localStorage.setItem("pb-recipient-street-address",n.adressDelivery),porterbuddy.refresh());PubSub.publish(mcWeb.login.events.onIsloggedIn,!0);PubSub.publish(mcWeb.payments.events.reloadPayments,null);h(n)})};this.onClickVippsLogin=function(){i.showVippsLoginSpin(!0);i.showVippsLoginBtn(!1);var n=new WebApiService("Login");n.GetAction("VippsGetAuthorizationEndpoint",{isCart:!0}).then(function(n){return i.showVippsLoginSpin(!1),n&&n.length>0?document.location.href=n:i.showVippsLoginBtn(!0),!1})};this.onClickLogin=function(n,t){return(i.showErrorLogin(!1),i.showBlockedLogin(!1),t.keyCode===13||t.type==="click")?(i.psw()!==null&&i.psw().length>4?a():i.showErrorLogin(!0),!1):!0};this.setLoginFocus=function(n){if(n)i.isPswSelected(!1),i.isEmailSelected(!0);else{var t=i.email()!==null&&i.email().length>0;i.isPswSelected(t);i.isEmailSelected(!t)}};PubSub.subscribe(mcWeb.cart.events.hasCartItems,function(n,t){t===!0&&(PubSub.publish(mcWeb.events.customerRegistration.onChangedCustomerData,null),PubSub.publish(mcWeb.cart.events.focusDiscoutCode))});getLibrary("mcWeb.customerRegistration").then(()=>{PubSub.subscribe(mcWeb.customerRegistration.onRememberedUserNotMe,function(){u(!0);i.email("")})});PubSub.subscribe(mcWeb.loginCheckout.events.onShowLoginEmail,function(t,r){i.isLoggedIn(!1);i.showCustomerRegistration(!1);n("#payments-tab-nav").slideUp(800);i.showSearchBtn(!0);PubSub.publish(mcWeb.loginCheckout.events.onShowHideLogin,r)});PubSub.subscribe(mcWeb.loginCheckout.events.onShowLoginPassword,function(t,r){i.isLoggedIn(!1);i.showCustomerRegistration(!1);n("#payments-tab-nav").slideUp(800);i.showPswPanel(!0);i.showPswBtn(!0);mcWeb.responsive.getScreenSize()!=="xs"&&n("#checkout-email").focus();s();PubSub.publish(mcWeb.loginCheckout.events.onShowHideLogin,r)});PubSub.subscribe(mcWeb.loginCheckout.events.onShowLoginPasswordKeepPaymentsVisible,function(t,r){i.isLoggedIn(!1);i.showCustomerRegistration(!1);i.showPswPanel(!0);i.showPswBtn(!0);mcWeb.responsive.getScreenSize()!=="xs"&&n("#checkout-email").focus();s();PubSub.publish(mcWeb.loginCheckout.events.onShowHideLogin,r)});PubSub.subscribe(mcWeb.loginCheckout.events.onShowHideLogin,function(t,r){if(r!==null?i.paymentId(r):r=i.paymentId(),i.isLoggedIn()||i.showCustomerRegistration()||i.isSoftLoggedIn()&&!i.checkoutRequirePassword&&!i.forceLogin()){var u=n("#payments-tab-nav");u.slideDown(800);n("#checkout-login").fadeOut("slow",function(){n(".registration-type").hide();n(".payment-title").slideDown("slow",function(){i.registration.registrationVM.showCustomerType(!1);n(".registration-type").fadeIn(400);n(".santander-partpayment").fadeIn(400);n(".santander-invoice").fadeIn(400);n(".sveawebpay").fadeIn(400);n(".vipps").fadeIn(400);n(".gothia").fadeIn(400);n("#OrgnrSsn").fadeIn(400);n(".tab-content").removeClass("tab-radius");var t=!0;(r===f||r===e||r===o)&&(t=!1);PubSub.publish(mcWeb.checkout.events.onShowSendOrder,{showBtn:t,disabledBtn:!1});n(".checkout").removeClass("l-out").addClass("l-in");r!==f&&r!==e&&r!==o&&r!==c&&setTimeout(function(){n("#customer-registration").fadeIn();n("#registrationFieldContainer").fadeIn();n(".checkout .customer-registration .requiredMsg").fadeIn()},400);i.isLoggedIn()||(PubSub.publish(mcWeb.payments.events.focusFirstName),PubSub.publish(mcWeb.payments.events.processPaymentMethods,r))})});return}r!==null&&(n(".payment-title").slideUp("slow"),n(".santander-partpayment").fadeOut("slow"),n(".santander-invoice").fadeOut("slow"),n(".sveawebpay").fadeOut("slow"),n(".vipps").fadeOut("slow"),n(".gothia").fadeOut("slow"),n("#customer-registration").fadeOut("slow"),n("#OrgnrSsn").fadeOut("slow",function(){n(".tab-content").addClass("tab-radius");r===f||r===e||r===o||i.isVippsLogin||(n("#mcweb-logincheckout-login-checkout").detach().appendTo("#"+r),n("#checkout-login").fadeIn("slow"));n(".checkout").removeClass("l-in").addClass("l-out");PubSub.publish(mcWeb.checkout.events.onShowSendOrder,{showBtn:!0,disabledBtn:!0});
1i.setLoginFocus();i.vippsExpressCheckoutInCart&&r===c&&i.newCustomer()}))});PubSub.subscribe(mcWeb.payments.events.onSelectedPayment,function(n,t){t!==null&&i.paymentId(t)});PubSub.subscribe(mcWeb.login.events.onIsloggedIn,function(n,t){i.isLoggedIn(t)});PubSub.subscribe(mcWeb.loginCheckout.events.onChangedEmail,function(n,t){if(!(t.length<3)){var u=i.registration.getJsonData();(u===null||u.epost===null||u.epost!==t)&&(i.email(t),r())}});i.postViewingConditions=function(n){var t=n?n:i.successLoginResult;t||(console.log("No successfull login. Starting over."),i.load());i.loginResult(t)};i.loginResult=function(n){n.TwoFactorStatus!==null&&n.TwoFactorStatus.Show2FARegistration?mcWeb.login2FAReg.load(n.TwoFactorStatus,i):n.TwoFactorStatus!==null&&n.TwoFactorStatus.Show2FACodeInput?mcWeb.login2FAReg.load(n.TwoFactorStatus,i):i.runAfterLoginSuccess(n)}};this.getEmail=function(){var n=mcWeb.loginCheckout.instances["login-checkout"];return n.email()};this.ResetLoginCheckoutPosision=function(){n(".cart-login #mcweb-logincheckout-login-checkout").length<1&&(n("#checkout-login").hide(),n("#mcweb-logincheckout-login-checkout").detach().appendTo(".cart-login"))}}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.