function e(e){return e&&e.__esModule?e.default:e}var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},p={},n={},r=a.parcelRequire94c2;null==r&&((r=function(e){if(e in p)return p[e].exports;if(e in n){var a=n[e];delete n[e];var r={id:e,exports:{}};return p[e]=r,a.call(r.exports,r,r.exports),r.exports}var o=new Error("Cannot find module '"+e+"'");throw o.code="MODULE_NOT_FOUND",o}).register=function(e,a){n[e]=a},a.parcelRequire94c2=r);let o=function({noResults:e,messages:a,options:p}){this.params={mbHost:"",cid:null,noResults:e,messages:a},this.options=p,this.init(),this.getMostbetHost()};o.prototype={init:function(){let e=this;this.regType=this.options.regType,this.bonusType=this.options.bonusType,this.tabButtons=document.querySelectorAll(this.options.tabButtonClass),this.formEmail=document.querySelector(this.options.formEmailClass),this.formPhone=document.querySelector(this.options.formPhoneClass),this.buttonAction=document.querySelector(this.options.buttonActionClass),this.emailInput=document.querySelector(this.options.emailInputClass),this.passwordInput=document.querySelector(this.options.passwordInputClass),this.passwordInput2=document.querySelector(this.options.passwordInput2Class),this.phoneInput=document.querySelector(this.options.phoneInputClass),this.emailError=document.querySelector(this.options.emailErrorClass),this.passwordError=document.querySelector(this.options.passwordErrorClass),this.password2Error=document.querySelector(this.options.password2ErrorClass),this.phoneError=document.querySelector(this.options.phoneErrorClass),this.ofertaAgreementInput=document.querySelector(this.options.ofertaAgreementInputId),this.formEmail&&this.formPhone&&("email"===this.regType?this.formPhone.style.display="none":this.formEmail.style.display="none"),this.tabButtons&&[].forEach.call(this.tabButtons,(function(a){a.addEventListener("click",e.changeRegType.bind(e))})),this.ofertaAgreementInput&&(this.ofertaAgreementInput.checked=!0),this.emailInput&&this.emailInput.addEventListener("change",(function(a){e.showError({field:"email",message:""})})),this.passwordInput&&this.passwordInput.addEventListener("change",(function(a){e.showError({field:"password",message:""})})),this.passwordInput2&&this.passwordInput2.addEventListener("change",(function(a){e.showError({field:"password2",message:""})})),this.phoneInput&&this.phoneInput.addEventListener("change",(function(a){e.showError({field:"phone",message:""})})),this.buttonAction&&this.buttonAction.addEventListener("click",(function(a){e.submit()}))},ajax:function(e){let a=new XMLHttpRequest;e.contentType=e.contentType||"application/x-www-form-urlencoded",a.open(e.method,e.url,!0),a.setRequestHeader("Content-Type",e.contentType),a.withCredentials=e.withCredentials||!1,a.send(e.data||""),a.onreadystatechange=function(){4===a.readyState&&(200!==a.status&&console.warn("ajax error",a.response),"function"==typeof e.onDone&&e.onDone(a.response))}},getFormFields:function(e){this.ajax({url:this.params.mbHost+"/api/v1/external-register.json",method:"GET",onDone:function(a){"function"==typeof e&&e(JSON.parse(a))}})},urlGET:function(e){const a=e?new RegExp("[?&]"+encodeURIComponent(e)+"=([^&]*)").exec(location.search):null;return null===a?"":decodeURIComponent(a[1])},JSONP:function(e){let a=document.createElement("script");a.async=!0,a.setAttribute("src",e),document.body.appendChild(a)},getMostbetHost:function(){let e=this;window.lMostpartner={changeLinksUrl:function(a){e.params.redirectUrl=a.redirectUrl,e.params.mbHost=a.mbHost,e.getFormFields((function(a){e.initComponents(a.fields)}))}},this.params.cid=this.urlGET("cid"),this.JSONP(location.protocol+"//"+this.urlGET("h")+"/transit-view?cid="+this.params.cid+"&callback=lMostpartner.changeLinksUrl")},getCountryOptions:function(e){let a=[];for(let p in e)a.push({id:e[p],text:p});this.params.noResults;return{data:a,width:"100%",language:{noResults:function e(){return e}}}},getPhoneNumberOptions:function(e){let a=function(a){return!a.disabled&&$('')},p=[];for(let a in e)p.push({id:a,text:e[a]});return{data:p,width:"60px",templateSelection:a,templateResult:a,language:{noResults:function(){return""}}}},initComponents:function(e){this.phonePrefixes=e.mobile_registration_form.fields.phonePrefix.choices,this.phonePrefix=e.mobile_registration_form.fields.phonePrefixDefault.choices[0];const a=!this.phonePrefixes[this.phonePrefix]&&"LV"===this.phonePrefix;a&&(this.phonePrefix="IN");let p=this;if($(this.options.phonePrefixSelect).select2(this.getPhoneNumberOptions(this.phonePrefixes)).val(this.phonePrefix).trigger("change").on("change",(function(e){$(p.options.phonePrefixCode).text("+"+p.phonePrefixes[this.value])})),$(this.options.phonePrefixCode).text("+"+this.phonePrefixes[this.phonePrefix]),this.countries=e.email_registration_form.fields.country.choices,this.country=e.email_registration_form.fields.defaultCountry.choices[0],a)for(let e in this.countries)this.countries.hasOwnProperty(e)&&10105===this.countries[e]&&(this.country=e);$(this.options.emailCountry).select2(this.getCountryOptions(this.countries)).val(this.countries[this.country]).trigger("change"),this.currencies=e.mobile_registration_form.fields.currencyId.choices,this.currency=e.mobile_registration_form.fields.activeCurrencyCode.choices[0],$(this.options.phoneCurrency).select2(this.getCountryOptions(this.currencies)).val(this.currencies[this.currency]).trigger("change"),$(this.options.emailCurrency).select2(this.getCountryOptions(this.currencies)).val(this.currencies[this.currency]).trigger("change")},changeRegType:function(e){e.currentTarget.classList.contains("active")||([].forEach.call(this.tabButtons,(function(e){e.classList.remove("active")})),e.currentTarget.classList.add("active"),"email"===this.regType?(this.formPhone.style.display="block",this.formEmail.style.display="none"):(this.formPhone.style.display="none",this.formEmail.style.display="block"),this.regType=e.currentTarget.getAttribute("data-register-type"))},showError:function(e){switch(e.field){case"email":this.emailError&&(this.emailError.innerText=e.message);break;case"password":this.passwordError&&(this.passwordError.innerHTML=e.message);break;case"password2":this.password2Error&&(this.password2Error.innerHTML=e.message);break;case"phone":this.phoneError&&(this.phoneError.innerHTML=e.message)}},validate:function(){let e=this.params.messages;if("phone"===this.regType){const a=parseInt(this.phoneInput.value.replace(/[^\d]/g,""));if(0===a.length)return this.showError({field:"phone",message:e.required}),!1;if(!isFinite(a))return this.showError({field:"phone",message:e.phone.incorrect}),!1}if("email"===this.regType){const a=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;if(0===this.emailInput.value.length)return this.showError({field:"email",message:e.required}),!1;if(-1===this.emailInput.value.indexOf("@"))return this.showError({field:"email",message:e.email.symbolNotFound}),!1;if(!this.emailInput.value[this.emailInput.value.indexOf("@")+1])return this.showError({field:"email",message:e.email.addressIsNotFull}),!1;if(!a.test(this.emailInput.value.toLowerCase()))return this.showError({field:"email",message:e.email.incorrect}),!1;if(0===this.passwordInput.value.length)return this.showError({field:"password",message:e.required}),!1;if(this.passwordInput.value.length<6)return this.showError({field:"password",message:e.password.minLength.replace("%current_length%",this.passwordInput.value.length)}),!1;if(this.passwordInput2){if(0===this.passwordInput2.value.length)return this.showError({field:"password2",message:e.required}),!1;if(this.passwordInput2.value.length<6)return this.showError({field:"password2",message:e.password.minLength.replace("%current_length%",this.passwordInput2.value.length)}),!1;if(this.passwordInput2.value!==this.passwordInput.value)return this.showError({field:"password2",message:e.repeatPassword.discrepancy}),!1}}return!0},submit:function(){if(!this.validate())return!1;const e=this.ofertaAgreementInput?+this.ofertaAgreementInput.checked:1,a=$(this.options.emailCountry).val()||this.countries[this.country];if("email"===this.regType){const p=$(this.options.emailCurrency).val()||this.currencies[this.currency];this.register({email:this.emailInput.value,plainPasswordFirst:this.passwordInput.value,plainPasswordSecond:this.passwordInput2?this.passwordInput2.value:this.passwordInput.value,currencyId:p,countryId:a,ofertaAgreement:e,bonusType:this.bonusType})}if("phone"===this.regType){const p=$(this.options.phoneCurrency).val()||this.currencies[this.currency],n=this.phonePrefixes[$(this.options.phonePrefixSelect).val()];this.register({phoneNumber:n+this.phoneInput.value.replace(/[^\d]/g,""),currencyId:p||this.currency,countryId:a||this.country,ofertaAgreement:e,bonusType:this.bonusType})}},register:function(e){console.log("fields",e);let a=this,p=this.params.redirectUrl,n="",r="";"email"===this.regType&&(r=this.params.mbHost+"/api/v1/external-register-email.json?cid="+this.params.cid,n="email_registration_form[email]="+encodeURIComponent(e.email)+"&email_registration_form[plainPassword][first]="+encodeURIComponent(e.plainPasswordFirst)+"&email_registration_form[plainPassword][second]="+encodeURIComponent(e.plainPasswordSecond)+"&email_registration_form[currencyId]="+encodeURIComponent(e.currencyId)+"&email_registration_form[country]="+encodeURIComponent(e.countryId),e.bonusType&&(n+="&first_refill_bonus_type_choice="+e.bonusType)),"phone"===this.regType&&(r=this.params.mbHost+"/api/v1/external-register-mobile.json?cid="+this.params.cid,n="mobile_registration_form[phoneNumber]="+encodeURIComponent(e.phoneNumber)+"&mobile_registration_form[country]="+encodeURIComponent(e.countryId)+"&mobile_registration_form[currencyId]="+encodeURIComponent(e.currencyId),e.bonusType&&(n+="&first_refill_bonus_type_choice="+e.bonusType)),this.ajax({url:r,method:"POST",data:n,withCredentials:!0,onDone:function(e){let n=JSON.parse(e);"error"===n.status?n.errors&&(n.errors.form_errors.length?a.showError({field:a.regType,message:n.errors.form_errors[0]}):n.errors.phonePrefix&&n.errors.phonePrefix.length?a.showError({field:"phone",message:n.errors.phonePrefix[0]}):n.errors.phoneNumber&&n.errors.phoneNumber.length?a.showError({field:"phone",message:n.errors.phoneNumber[0]}):n.errors.email&&n.errors.email.length?a.showError({field:"email",message:n.errors.email[0]}):n.errors.plainPassword&&n.errors.plainPassword.length&&a.showError({field:"password",message:n.errors.plainPassword[0]})):window.location.href=p+(n.sso?"&sso="+n.sso:"")}})}};var t,i,h;function s(e){function a(){var e=0===p.get(0).offsetWidth||r.phoneInput.isValid;n.attr("disabled",!e),n.css({opacity:e?1:.5})}var p=$(".form-phone"),n=$(".form-btn"),r={phoneInput:{$el:$(".phone-input"),isValid:!1},phoneSelect:{$el:$(".phone-prefix__select")}};r.phoneInput.$el.attr("type","text"),r.phoneInput.$el.attr("inputmode","tel");var o=r.phoneInput.$el.closest(".phone-prefix__wrap").parent().get(0).querySelector(".formError.phone-error");r.phoneSelect.$el.on("change",(function(p){var n=e.phones.find((function(e){return e.alpha2.toLowerCase()===p.target.value.toLowerCase()}));if(n){var t="DE"===n.alpha2,i=function(e){var a=n.phone_sample.replace(/\d/gi,"0"),p=n.phone_sample.slice(0,-2).replace(/\d/gi,"0"),r=n.phone_sample.slice(0,-1).replace(/\d/gi,"0");return e.length<=10?p:e.length<=11?r:a},h=t?i:n.phone_sample.replace(/\d/gi,"0");r.phoneInput.$el.attr("placeholder",n.phone_sample),r.phoneInput.$el.mask(h,{onComplete(){r.phoneInput.isValid=!0,a()},onInvalid(){console.log("invalid")},onKeyPress(p,h,s,l){t&&s.mask(i.apply({},arguments),l),r.phoneInput.isValid=!1,a(),o||(o=document.createElement("div"),r.phoneInput.$el.closest(".phone-prefix__wrap").parent().get(0).appendChild(o)),o.className="formError phone-error";var c=n.phone_sample.replace(/ /gi,"").length,u=c-r.phoneInput.$el.cleanVal().length;t&&(c=10),o.innerHTML=t&&u>2&&c-u>1||!t&&u>0&&c-u>1?e.translations.validation.min.replace("{min}",c).replace("{length}",u):""}}),r.phoneInput.isValid=t?r.phoneInput.$el.cleanVal().length>=10&&r.phoneInput.$el.cleanVal().length<=12:r.phoneInput.$el.masked(r.phoneInput.$el.cleanVal()).length===h.length,a()}else r.phoneInput.$el.unmask()})),r.phoneSelect.$el.trigger("change"),a(),$("body").on("click",a)}t=function(e){var a=function(a,p,n){var r={invalid:[],getCaret:function(){try{var e,p=0,n=a.get(0),o=document.selection,t=n.selectionStart;return o&&-1===navigator.appVersion.indexOf("MSIE 10")?((e=o.createRange()).moveStart("character",-r.val().length),p=e.text.length):(t||"0"===t)&&(p=t),p}catch(e){}},setCaret:function(e){try{if(a.is(":focus")){var p,n=a.get(0);n.setSelectionRange?n.setSelectionRange(e,e):((p=n.createTextRange()).collapse(!0),p.moveEnd("character",e),p.moveStart("character",e),p.select())}}catch(e){}},events:function(){a.on("keydown.mask",(function(e){a.data("mask-keycode",e.keyCode||e.which),a.data("mask-previus-value",a.val()),a.data("mask-previus-caret-pos",r.getCaret()),r.maskDigitPosMapOld=r.maskDigitPosMap})).on(e.jMaskGlobals.useInput?"input.mask":"keyup.mask",r.behaviour).on("paste.mask drop.mask",(function(){setTimeout((function(){a.keydown().keyup()}),100)})).on("change.mask",(function(){a.data("changed",!0)})).on("blur.mask",(function(){i===r.val()||a.data("changed")||a.trigger("change"),a.data("changed",!1)})).on("blur.mask",(function(){i=r.val()})).on("focus.mask",(function(a){!0===n.selectOnFocus&&e(a.target).select()})).on("focusout.mask",(function(){n.clearIfNotMatch&&!o.test(r.val())&&r.val("")}))},getRegexMask:function(){for(var e,a,n,r,o,i,h=[],s=0;s