1500&&(i=500),i}clearErrorMessages(){this.$ctx.find("div.js-added-error-msg").remove()}handleFieldErrors(e,t,i,r){if(!i.Group){const s=`${this.getErrorMessage(i)}
`,n=e.find(`input[name="${t}"]`);n.addClass("is-error"),n.parents(".ll-col-data").find(".ll-error-msg").remove(),n.parents(".js-row").removeClass("is-valid"),n.parents(".js-row").addClass("is-error"),n.parents(".ll-col-data").prepend(s),n.length?r.push(n):console.warn(`No element found to show validation message for '${t}'. Maybe an according mapping is missing in fillLookupServerFieldnames.`)}}handleGeneralError(e){this.handleTechnicalErrorWithTemplate(void 0,!0,(this.options.app.templates.error||this.options.app.templates.errorpage)?.templateurl)}handleDefaultErrorResponse(e,t,i,r,s){l.View.stopLoader();const n=`${t} API error`;400===e?.status?this.isServerValidationError(e)?i():this.isQualifiedError(e)?(r&&r(),this.handleTechnicalError(e)):s&&(this.hideErrorDialog(),s()):this.handleAllOtherHttpErrors(n)}handleTechnicalError(e){l.Helper.logError(e,this.options.name,window.location.href,this.options.name),this.handleServerErrorWithErrorPageRedirect(e)||(this.isQualifiedError(e)?this.handleTechnicalErrorWithErrorQualifiedTemplate(e,!0):this.handleTechnicalErrorWithErrorTemplate(e,!0))}handleTechnicalErrorWithErrorBlock(e,t){this.$ctx.find(this.errorClass).show(),this.$ctx.find(this.validClass).hide(),l.Helper.logError(e,this.options.name,window.location.href,t||e.url)}handleAllOtherHttpErrors(e){const t=this.options.app.validationmessages.backend.code_Anlage||"Unknown Error";this.errorDialog(l.Helper.linkify(t,e))}clearTechnicalErrorWithErrorBlock(){this.$ctx.find(this.errorClass).hide(),this.$ctx.find(this.validClass).show()}handleTechnicalErrorWithErrorTemplate(e,t){this.options.app.templates.error||l.Helper.logInfo("Missing template",this.options.app.applicationId,window.location.href,"Template 'error' not found"),this.handleTechnicalErrorWithTemplate(e,t,this.options.app.templates.error?.templateurl)}handleTechnicalErrorWithErrorQualifiedTemplate(e,t){this.options.app.templates.errorqualified||l.Helper.logInfo("Missing template",this.options.app.applicationId,window.location.href,"Template 'errorqualified' not found"),this.handleTechnicalErrorWithTemplate(e,t,this.options.app.templates.errorqualified?.templateurl)}handleTechnicalErrorWithTemplate(e,t,i){i?l.Ajax.fragment({url:i,dataType:"html",timeout:3e4},i=>{let r=[];t||(r=this.getErrorMessageFromJqxhr(e));const s={errorresponse:{Messages:r,prevurl:this.options.app.prevurl}};this.renderTemplate(i,s)},()=>{this.router.error()}):this.showGeneralErrorLayer()}renderTemplate(e,t){l.View.renderTemplate(e,t,this.$ctx,function(){})}handleServerErrorWithErrorPageRedirect(e,t){return!!this.isFatalError(e)&&(l.Helper.logError(e,this.options.name,window.location.href,t||e.url),this.router.error(),!0)}handleBadRequestErrorWithDialog(e,t){if(400===e.status){let i="";return e.responseJSON.Messages.slice().reverse().forEach(e=>{i+=`${this.getErrorMessage(e)}
`}),this.errorDialog(l.Helper.linkify(i,t)),!0}return!1}showModal(e,t){this.displayDialog(e,t,!0)}errorDialog(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.displayDialog($("#error_dialog"),e,t)}displayDialog(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];l.View.displayDialog(e,t,i),l.View.stopLoader()}hideErrorDialog(){$.magnificPopup.close()}isServerValidationError(e){let t=!1;return e&&e.responseJSON&&e.responseJSON.Messages&&(t=e.responseJSON.Messages.some(e=>!!e.CancelledOnValidation)),t}isQualifiedError(e){let t=!1;return e&&e.responseJSON&&e.responseJSON.Messages&&(t=e.responseJSON.Messages.some(e=>!!e.Stop)),t}isFatalError(e){return null!=e?.status&&e.status.toString().startsWith("5")}isFieldError(e){return!this.isGeneralError(e)}isGeneralError(e){return this.options.app.generalErrorCodes.some(t=>t.code==e.Id)}getErrorMessage(e){let t=e.Message;return this.options.app.validationmessages&&this.options.app.validationmessages.backend[`code_${e.Id}`]&&(t=this.options.app.validationmessages.backend[`code_${e.Id}`]),t}getErrorMessageFromJqxhr(e){const t=[];return e&&e.responseJSON&&e.responseJSON.Messages&&e.responseJSON.Messages.slice().reverse().forEach(e=>{t.push(this.getErrorMessage(e))}),t}showGeneralErrorLayer(){T.Utils.View.showGeneralErrorLayer()}getMappedSource(e){let t=e.replace(/^(Anlage\.Antragssteller|BankUpdateMitAktion|Anlage\.Versicherungsnehmer|LangzeitAksAnlage|IncAnlage)./,"");return t=t.replace("Anlage.Ausbildungsende","InAusbildung"),this.lookupServerFieldnames[e]?t=this.lookupServerFieldnames[e]:e.indexOf("Kind")>-1&&(t=this.getChildFieldSource(e)),t}fillLookupServerFieldnames(){this.lookupServerFieldnames["Anlage.Partner.Email"]=this.lookupServerFieldnames["MitgliedschaftAnlageErweiterung.Partner.Email"]="EmailPartner",this.lookupServerFieldnames["Anlage.Partner.Geburtsdatum"]=this.lookupServerFieldnames["MitgliedschaftAnlageErweiterung.Partner.Geburtsdatum"]="GeburtsdatumPartner",this.lookupServerFieldnames["MeinPostfachService:VerifyTokenAsync"]="ConfirmationCode"}getChildFieldSource(e){const t=e.split(".");if(t.length){let e=t[t.length-1].toLowerCase();return"strassehausnummer"===e?e="street":"geburtsdatum"===e?e="birthday":"prefix"===e&&(e="phonepre"),`${e}_c_${t[0].split("_")[1]||"0"}`}return e}getErrorMessageFromId(e,t){if(e&&e.responseJSON&&e.responseJSON.Messages)return e.responseJSON.Messages.find(e=>e.Id===t)}hasErrorWithId(e,t){return!!(e&&e.responseJSON&&e.responseJSON.Messages)&&e.responseJSON.Messages.some(e=>e.Id===t)}}function Te(e,t,i){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var i=t.call(e,"string");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}class ze{static VALIDATION_FAILED_MARKER=(()=>(Me=()=>{Te(this,"VALIDATION_FAILED_ATTR",`data-${ze.VALIDATION_FAILED_MARKER}`),Te(this,"BACKEND_VALIDATION_MARKER","backend-validation"),Te(this,"BACKEND_VALIDATION_ATTR",`data-${ze.BACKEND_VALIDATION_MARKER}`)},"validation-failed"))();lookupServerFieldnames;errorService;$ctx;validators;options;callback;forms;validationOptions;urlBuilder;scrollTopFooterHeight;ignoreValidationSelector;ignoreValidationComposite;errorClassName;errorClassSelector;rowClass;noCheckMarkFieldTypes;calendarSelector;isFormSubmit=!1;constructor(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:()=>{};this.forms=$(t),this.callback=i,this.options=e.options,this.validationOptions=this.options.app.validatorRules,this.validationOptions.messages=this.options.app.validationmessages.client,this.validators=[],this.$ctx=this.options.$ctx,this.errorService=new Ie(e.options),this.lookupServerFieldnames={},this.ignoreValidationSelector=".ignore-validation",this.ignoreValidationComposite=`:hidden, ${this.ignoreValidationSelector}`,this.fillLookupServerFieldnames(),this.scrollTopFooterHeight=80,this.errorClassName="ll-error-msg mm-error-msg",this.errorClassSelector=".ll-error-msg, .mm-error-msg",this.rowClass=".js-row, .ll-row, .mm-row",this.noCheckMarkFieldTypes="[type=radio], [type=checkbox], [type=file]",this.calendarSelector=".a-basic-input-text--calendar",this.urlBuilder=new z(e.options),this.init()}init(){this.initFormValidation()}updateValidationMessages(){this.forms.length>0&&this.addValidationMessages()}registerSubmitListener(){this.forms.on("click",".js-submit-form",this.onHandleFormSubmit.bind(this))}onHandleFormSubmit(e){this.prepareFormSubmit(!0,$(e.currentTarget).parents("form"))||e.preventDefault()}isValid(){this.isFormSubmit=!0,document.body.isFormSubmit=!0;let e=!0;return this.forms.each(function(t,i){$(i).valid()||(e=!1)}),document.body.isFormSubmit=!1,this.isFormSubmit=!1,e}isValidWithoutTriggerErrors(){this.isFormSubmit=!0;let e=!0;return this.forms.each(function(t,i){$(i).validate().checkForm()||(e=!1)}),this.isFormSubmit=!1,e}prepareFormSubmit(e,t){const i=t||this.forms;return!(e&&!i.valid())}initFormValidation(){this.addCustomMethods(),this.forms.each((e,t)=>{t.validation=$(t).validate({errorClass:"is-error",focusInvalid:!1,invalidHandler:(e,t)=>{t.numberOfInvalids()&&l.View.scrollToElement(t.errorList[0].element,this.scrollTopFooterHeight)},errorPlacement:this.generalErrorPlacement.bind(this),onkeyup:!1,onfocusout:this.decorateElement.bind(this),onfocusin:this.undecorateElement.bind(this),onclick:!1,ignore:this.ignoreValidationComposite}),this.validators.push(t.validation)}),this.forms.length>0&&this.forms[0]&&(this.addValidationMessages(),this.registerSubmitListener()),this.showGeneralValidationMessage(),this.callback&&this.callback()}decorateSingleElement(e,t){const i=$(e);this.setValidationMarkers(i,i.valid())}decorateElement(e,t){const i=$(e).data("validation-group");i?this.$ctx.find(`[data-validation-group="${i}"]`).each((e,i)=>{this.decorateSingleElement(i,t)}):this.decorateSingleElement(e,t)}undecorateElement(e,t){if(!t||"Enter"!==t.key){const t=$(e);t.removeClass("is-error");let i=t.parents(this.rowClass);i.length>1&&(i=i.first()),(t.data("undecorate-parent")??1)&&i.removeClass("is-error")}}generalErrorPlacement(e,t){const i=$(t);if(i.data("customerrors"))return;const r=i.parents(this.rowClass).first(),s=r.find(this.errorClassSelector);if(i.parents(this.rowClass).first().removeClass("is-valid").addClass("is-error"),this.setCheckMarkOnField(i,r),s.is(":visible"))s.html(e[0].innerHTML);else{const t=i.prev("input").is(":visible")?i.prev():i.parent();$(``).html(e[0].innerHTML).insertBefore(t)}}setValidationMarkers(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=((arguments.length>2?arguments[2]:void 0)||e.parents(this.rowClass)).first();i.removeClass(t?"is-error":"is-valid").addClass(t?"is-valid":"is-error"),e.data(ze.VALIDATION_FAILED_MARKER)===t&&e.removeClass(t?"is-error":"valid").addClass(t?"valid":"is-error"),this.setCheckMarkOnField(e,i)}setCheckMarkOnField(e,t){e.is(this.noCheckMarkFieldTypes)||t.addClass("is-check")}showServerValidationErrors(e){let t=!1;this.showGeneralValidationMessage(),e&&e.responseJSON&&e.responseJSON.Messages&&e.responseJSON.Messages.slice().reverse().forEach(e=>{const i=e.Source;if(e.CancelledOnValidation){const e=i.replace(/.+\.(Anschrift|AbwKontoInhaber)$/,"$1");e!==i&&e in this.lookupServerFieldnames&&this.$ctx.find(`#${this.lookupServerFieldnames[e]}`).length&&(this.setServerValidationFlag(!1,this.lookupServerFieldnames[e]),t=!0)}else"Identity"===i&&this.$ctx.find(`#${this.lookupServerFieldnames[i]}`).length&&(this.setServerValidationFlag(!1,this.lookupServerFieldnames[i]),t=!0)}),!t&&this.validationOptions.messages.customflagvalidation&&this.showGeneralValidationMessage(this.validationOptions.messages.customflagvalidation),l.View.scrollTo(0)}showGeneralValidationMessage(e){const t=this.$ctx.find(".js-general");t.html(e||""),l.View.hideElement(t,!e)}setServerValidationFlag(e,t){const i=this.findValidatingElement(t);i.data(ze.VALIDATION_FAILED_MARKER,!e),e&&this.setValidationMarkers(i)}setServerValidationBackendFlag(e,t,i){const r=this.findValidatingElement(t);if(r.data(ze.VALIDATION_FAILED_MARKER,!e),(e||i)&&this.setValidationMarkers(r,e),!e&&i&&r.length){let e=`Es ist ein Fehler aufgetreten (Fehlercode: ${i})`;this.options.app.validationmessages.backend[`code_${i}`]?e=this.options.app.validationmessages.backend[`code_${i}`]:l.Helper.logError("",this.options.app.applicationId,window.location.href,`CMS: FehlerText Backend mit der Nummer ${i} fehlt`),this.validators.forEach(t=>{t.lastActive&&t.lastActive.id===r[0].id&&(t.element(r),t.errorList[0].message=e)}),r.parents(this.rowClass).find(this.errorClassSelector).html(e),this.scrollTo(r)}}showErrorDialogWithMappedErrorMessage(e,t,i){const r=this.findValidatingElement(t);if(!e&&i&&r.length){const e=this.getMappedBackendMessage(i);this.errorService.errorDialog(e)}}getMappedBackendMessage(e){let t=`Es ist ein Fehler aufgetreten (Fehlercode: ${e})`;return this.options.app.validationmessages.backend[`code_${e}`]?t=this.options.app.validationmessages.backend[`code_${e}`]:l.Helper.logError("",this.options.app.applicationId,window.location.href,`CMS: FehlerText Backend mit der Nummer ${e} fehlt`),t}findValidatingElement(e){let t=this.$ctx.find(`[data-validation="${e}"]`);return 0===t.length&&(t=this.$ctx.find(`#${e}`)),t}scrollTo(e){l.View.scrollToElement(e,100,1e3)}showErrors(e){this.forms.length&&this.forms[0].validation&&this.forms[0].validation.showErrors(e)}addValidationMessages(){this.validators.forEach(e=>{$(e.currentForm).find("input, textarea, select").not(this.ignoreValidationSelector).each((e,t)=>{const i=this.parseValidationAttr(t);i&&i.length?i.forEach(e=>{this.validationOptions.messages[e]?this.validationOptions.rules[e]?(this.validationOptions.rules[e].messages=this.validationOptions.messages[e],$(t).rules("add",this.validationOptions.rules[e])):console.log(`No validation rule found with data-validation name: ${e}`):console.log(`No validation message found with data-validation name: ${e}`)}):this.validationOptions.rules[t.name]&&(this.validationOptions.messages[t.name]?(this.validationOptions.rules[t.name].messages=this.validationOptions.messages[t.name],$(`[name="${t.name}"]`).each((e,i)=>{$(i).rules("add",this.validationOptions.rules[t.name])})):console.log(`No validation message found with name: ${t.name}`))}),$(e.currentForm).find(".a-basic-input-text--calendar input").on("change",e=>{$(this.forms)[0].validation.element($(e.target)),this.decorateElement(e.target)})})}parseValidationAttr(e){const t=$(e).data("validation");return t?t.split(","):[]}addCustomMethods(){$.validator.addMethod("requireddatepast",this.validatorRequiredSameOrPastDate.bind(this)),$.validator.addMethod("inputcross",this.validatorInputCross.bind(this)),$.validator.addMethod("phonecross",this.validatorPhoneCross.bind(this)),$.validator.addMethod("workphonecross",this.validatorWorkPhoneCross.bind(this)),$.validator.addMethod("streetandnumber",this.validatorStreetAndNumber.bind(this)),$.validator.addMethod("monthyear",this.validatorMonthYear.bind(this)),$.validator.addMethod("nonumber",this.validatorNoNumber.bind(this)),$.validator.addMethod("notequals",this.validatorNotEquals.bind(this)),$.validator.addMethod("requireddate",this.validatorRequiredDate.bind(this)),$.validator.addMethod("zukunft",this.validatorFuture.bind(this)),$.validator.addMethod("customflagvalidation",this.validatorCustomFlag.bind(this)),$.validator.addMethod("password",this.validatorPassword.bind(this)),$.validator.addMethod("calendarbegin",this.validatorCalendarBegin.bind(this)),$.validator.addMethod("calendarend",this.validatorCalendarEnd.bind(this)),$.validator.addMethod("equalTo",this.validatorEqualTo.bind(this));const e=$.validator.methods.equalTo;if(e&&($.validator.methods.equalto=e,$.validator.messages.equalto=$.validator.messages.equalTo),$.validator.addMethod("filerequired",this.validatorFileRequired.bind(this)),$.validator.addMethod("email",this.validatorEmail.bind(this)),$.validator.addMethod("oneoptinrequired",this.validatorOneOptinRequired.bind(this)),$.validator.addMethod("starttomorrow",this.validatorStartTomorrow.bind(this)),$.validator.addMethod("maxfutureoneyear",this.validatorFuterMaxOneYear.bind(this)),$.validator.addMethod("oneleadingzero",this.validatorOneLeadingZero.bind(this)),this.options.app.apicmglnumbercheck){let e="";$.validator.addMethod("membernumbercheck",(t,i)=>{let r;return({result:r,mglNoMessage:e}=this.validatorMemberNumberCheck(t,e)),r},()=>e),$.validator.addMethod("membernumberwithvescheck",(t,i)=>{let r;return({result:r,mglNoMessage:e}=this.validatorMemberNumberWithVesCheck(t,e)),r},()=>e),e="",$.validator.addMethod("membernumbercheckoptional",(t,i)=>{let r=!0;return""!==t&&({result:r,mglNoMessage:e}=this.validatorMemberNumberCheck(t,e)),r},()=>e)}const t=$.validator.methods.require_from_group;t&&($.validator.methods.requirefromgroup=t,$.validator.messages.requirefromgroup=$.validator.messages.require_from_group)}validatorOneLeadingZero(e){return!/^0{2,}/.test(e)}validatorMemberNumberCheck(e,t){let i=!1,r=t;return l.Ajax.fragment({method:"GET",async:!1,headers:{"Ocp-Apim-Subscription-Key":T.Utils.Application.getApiMSubscriptionKey()},url:this.urlBuilder.fullApimUrl(this.options.app.apicmglnumbercheck),data:{MglNo:e}},e=>{e.Data.IsMglNo&&(i=!0)},e=>{r=this.errorService.getErrorMessage(e.responseJSON.Messages[0]),i=!1}),{result:i,mglNoMessage:r}}validatorMemberNumberWithVesCheck(e,t){let i=!1,r=t;return l.Ajax.fragment({method:"GET",async:!1,url:this.urlBuilder.fullUrl(this.options.app.apicmglnumbercheck),data:{MglNo:e}},e=>{e.Data.IsMglOrVesNo&&(i=!0)},e=>{r=this.errorService.getErrorMessage(e.responseJSON.Messages[0]),i=!1}),{result:i,mglNoMessage:r}}validatorEmail(e,t,i){return!($(t).prop("required")||e.length>0)||T.Utils.Validation.emailPattern.test(e.trim())}validatorFileRequired(e,t,i){return!(this.isFormSubmit&&t.files&&t.files.length<1)}validatorEqualTo(e,t,i){return e==$(i).val()}validatorPassword(e,t,i){return"Oldpassword"===t.id?e.length>0:/^(?=.*\d)(?=.*[*²³!"#§€$%&'()*+,\-./:;<=>?@[\\\]^_`´{|}~])(?=.*[a-z])(?=.*[A-Z]).{8,}$/.test(e)}validatorCustomFlag(e,t,i){return!$(t).data(ze.VALIDATION_FAILED_MARKER)}validatorFuture(e,t,i){if("Geburtsdatum"===t.name||"Geburtsdatum"===t.getAttribute("data-validation")){const t=l.Format.viewDateToIsoDate(e);return!!(t&&t.length>0)&&moment(t).isBefore(moment(),"day")}return!1}validatorRequiredDate(e,t,i){return!(!e||"__.__.____"==e)&&(i&&i.test?i:/^(([1-9]|[0-2]\d|[3][0-1])\.([1-9]|[0]\d|[1][0-2])\.\d{4})$/).test(e)}validatorNotEquals(e,t,i){return e!=i}validatorNoNumber(e,t,i){return/^[^0-9]*$/.test(e)}validatorMonthYear(e,t,i){return/(0[1-9]|1[012]).[0-9]{4}/.test(e)||/[0-9]{4}-(0[1-9]|1[012])/.test(e)}validatorStreetAndNumber(e,t,i){return!!e&&/^[a-zA-Z0-9àáâäãåąčćęèéêëėįìíîïłńòóôöõøùúûüųūÿýżźñçčšžÀÁÂÄÃÅĄĆČĖĘÈÉÊËÌÍÎÏĮŁŃÒÓÔÖÕØÙÚÛÜŲŪŸÝŻŹÑßÇŒÆČŠŽ∂ð ,.'-/]+$/.test(e)}validatorWorkPhoneCross(e,t,i){return this.validatePhoneNumberCross(t,"TelefonGeschaeftlichVorwahl","TelefonGeschaeftlichNummer")}validatorPhoneCross(e,t,i){return this.validatePhoneNumberCross(t,"TelefonVorwahl","TelefonNummer")}validatePhoneNumberCross(e,t,i){e.was_seen=!0;const r=$(e).attr("name"),s=$(`input[name="${r?.replace(i,t)}"]`),n=$(`input[name="${r?.replace(t,i)}"]`);return!(s[0].was_seen&&n[0].was_seen&&(!l.Helper.isEmptyString(s.val())||!l.Helper.isEmptyString(n.val()))&&(s.removeClass("is-error"),n.removeClass("is-error"),l.Helper.isEmptyString(s.val())||l.Helper.isEmptyString(n.val())))}validatorInputCross(e,t,i){if(i.length<=0)return console.log("dependency is not set"),!1;t.was_seen=!0;const r=$(t),s=r.closest("fieldset").find(`input[data-validation="${i[0]}"]`);return!(r[0].was_seen&&s[0].was_seen&&(!l.Helper.isEmptyString(r.val())||!l.Helper.isEmptyString(s.val()))&&(r.removeClass("is-error"),s.removeClass("is-error"),l.Helper.isEmptyString(r.val())||l.Helper.isEmptyString(s.val())))}validatorRequiredSameOrPastDate(e){const t=l.Format.viewDateToIsoDate(e);return!!(t&&t.length>0)&&(moment(t).isSame(moment())||moment(t).isBefore(moment()))}validatorCalendarBegin(e,t,i){if(e&&e.toString().length&&"__.__.____"!==e){const i=$(t).parent(this.calendarSelector).data("init");if(i&&i.begin)return moment(l.Format.viewDateToIsoDate(e)).isSameOrAfter(l.Format.parseDateOffset(i.begin),"days")}return!0}validatorCalendarEnd(e,t,i){if(e&&e.toString().length&&"__.__.____"!==e){const i=$(t).parent(this.calendarSelector).data("init");if(i&&i.end)return moment(l.Format.viewDateToIsoDate(e)).isSameOrBefore(l.Format.parseDateOffset(i.end),"days")}return!0}validatorOneOptinRequired(e,t,i){return!e||!document.body.isFormSubmit||$(t).closest(this.rowClass).first().find(".js-email:checked, .js-phone:checked, .js-personalization:checked").length>0}validatorStartTomorrow(e){const t=moment().add(1,"days");return moment(l.Format.viewDateToIsoDate(e)).isSameOrAfter(t,"day")}validatorFuterMaxOneYear(e){const t=moment().add(1,"years");return moment(l.Format.viewDateToIsoDate(e)).isSameOrBefore(t,"day")}validatorCompleteAddress(e){const t=e=>e?.trim().length>0,i=t(e.street)&&t(e.number),r=t(e.streetnumber);return(i||r)&&t(e.zip)&&t(e.city)}triggerValidation(e){$.each(this.validators,(t,i)=>{e&&e.length>0?e.forEach(e=>{if(i&&i.currentForm){let t=$(i.currentForm).find(`[data-validation="${e}"]`);t.length||(t=$(i.currentForm).find(`#${e}`)),t.length&&i.element(t)}}):$.each($(i.currentForm).find("input, select, textarea"),(e,t)=>{const r=$(t);i.element(r)})})}isElementValid(e){let t,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2?arguments[2]:void 0;if($.each(this.validators,(i,r)=>{$(r.currentForm).find(e).length&&(t=r)}),!t)return!0;const s=e.val();if(i&&(null==s||""===s))return!0;const n=$(e).rules();let a=!0;if(r){const i=$.validator.methods[r],o=n[r];i&&(i.call(t,s,e[0],o)||(a=!1))}else $.each(n,(i,r)=>{const n=$.validator.methods[i];n&&(n.call(t,s,e[0],r)||(a=!1))});return a}isSelectorValid(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const r=$(e).toArray();for(const e of r){const r=$(e);if(!this.isElementValid(r,t,i))return!1}return!0}addValidationForElement(e,t){$(e).rules("add",t)}removeValidationForElement(e,t){$(e).rules("remove",t)}getValidationMessageObjectByName(e){let t={};return this.options.app.validationmessages&&this.options.app.validationmessages.client&&void 0!==this.options.app.validationmessages.client[e]&&(t=this.options.app.validationmessages.client[e]),t}fillLookupServerFieldnames(){this.lookupServerFieldnames.Anrede="salutation_1",this.lookupServerFieldnames.Nachname="lastname",this.lookupServerFieldnames.Vorname="firstname",this.lookupServerFieldnames.Firma="street",this.lookupServerFieldnames.Beguenstigter="company_addition",this.lookupServerFieldnames.Geburtsdatum="dateofbirth",this.lookupServerFieldnames["Anschrift.StrasseHausnummer"]="streetandno",this.lookupServerFieldnames["Anschrift.Postleitzahl"]="zip",this.lookupServerFieldnames["Anschrift.Ort"]="city",this.lookupServerFieldnames["Anschrift.Ergaenzungszeile"]="Ergaenzungszeile",this.lookupServerFieldnames["Telefon.Prefix"]="phone_prefix",this.lookupServerFieldnames["Telefon.Suffix"]="phone_suffix",this.lookupServerFieldnames["TelGesch.Prefix"]="phone_work_prefix",this.lookupServerFieldnames["TelGesch.Suffix"]="phone_work_suffix",this.lookupServerFieldnames.Email="email",this.lookupServerFieldnames.Iban="Bankdaten.Iban",this.lookupServerFieldnames.Bic="Bankdaten.Bic",this.lookupServerFieldnames.Bankname="Bankdaten.Name",this.lookupServerFieldnames.Bankleitzahl="Bankleitzahl",this.lookupServerFieldnames.Kontonummer="Kontonummer",this.lookupServerFieldnames["AbwKontoInhaber.AnredeKennzeichen"]="Bankdaten\\.AbwKontoInhaber\\.AnredeKennzeichen_1",this.lookupServerFieldnames["AbwKontoInhaber.Vorname"]="Bankdaten\\.AbwKontoInhaber\\.Vorname",this.lookupServerFieldnames["AbwKontoInhaber.Name"]="Bankdaten\\.AbwKontoInhaber\\.Name",this.lookupServerFieldnames["AbwKontoInhaber.Adresse.StrasseHausnummer"]="Bankdaten\\.AbwKontoInhaber\\.Adresse\\.StrasseHausnummer",this.lookupServerFieldnames["AbwKontoInhaber.Adresse.Postleitzahl"]="Bankdaten\\.AbwKontoInhaber\\.Adresse\\.Postleitzahl",this.lookupServerFieldnames["AbwKontoInhaber.Adresse.Ort"]="Bankdaten\\.AbwKontoInhaber\\.Adresse\\.Ort",this.lookupServerFieldnames["AbwKontoInhaber.Adresse.Ergaenzungszeile"]="Bankdaten\\.AbwKontoInhaber\\.Adresse\\.Ergaenzungszeile",this.lookupServerFieldnames.VersicherterVorname="insuredperson_firstname",this.lookupServerFieldnames.VersicherterNachname="insuredperson_lastname",this.lookupServerFieldnames.VersicherterOrganisation="VersicherterOrganisation",this.lookupServerFieldnames.Identity="Oldpassword",this.lookupServerFieldnames.Password="change-password-new",this.lookupServerFieldnames.LoginMail="personal-data-email"}}Me();class Pe extends ze{user;mode;constructor(e,t){let i=arguments.length>3?arguments[3]:void 0;super(e,t,arguments.length>2&&void 0!==arguments[2]?arguments[2]:()=>{}),this.user=i}addCustomMethods(){super.addCustomMethods(),$.validator.addMethod("pattern",(e,t,i)=>!i||!e||new RegExp(`${i}`,"i").test(e)),$.validator.addMethod("i18nphonenumber",(e,t,i)=>{if(i&&e){const i=`${e}`.replace(/\s/g,"");if(!i)return!0;let r=!1;if(i.startsWith("+")){if(r=/^(\+\d\d)?(\d+)$/.test(i),r){const r=l.Format.formatCountrySpecificPhoneNumber(i);r!==e&&($(t).val(r),$(t).trigger("change"))}}else r=/^(\d+)$/.test(i);return r}return!0}),$.validator.addMethod("noemojis",(e,t,i)=>!i||!e||!/(\ud83c[\udc00-\udfff])+/i.test(e)),$.validator.addMethod("requirelogin",(e,t)=>!t||!t.checked||this.user&&this.user.Valid),$.validator.addMethod("terminwunscheingabe",e=>{if(this.$ctx.find('input[name="TerminwunschGewuenschteAktion"][value="1"]').is(":checked")){const t=moment().format("DD.MM.YYYY"),i=moment().add(1,"d").format("DD.MM.YYYY");return e===t||e===i}return!0}),$.validator.addMethod("terminwunschzeitspanneeingabe",e=>"Bitte wählen"!==this.$ctx.find('select[name="cardamageTiming"]').find("option:selected").text()&&0!==parseInt(e)),$.validator.addMethod("garagerequired",e=>!!("garage"!==this.mode||e&&0!==`${e}`.trim().length)),$.validator.addMethod("requiredif",(e,t,i)=>{const r=this.$ctx.find(`input[name="${i}"][value="1"]`);return!r||!r.length||01&&void 0!==arguments[1])||arguments[1];this.mode=e,$(this.forms).each(function(){const i=$(this).validate();t&&(i.resetForm(),i.showErrors([]),$(this).find(".is-error").removeClass("is-error")),i.settings.ignore="garage"===e?":not(.validation-garage)":":hidden"})}decorateElement(e,t){"SonderKommunikation"!==$(e).data("validation")&&super.decorateElement(e,t)}}class ye{clientKey="roadsideassist";options;applicationUrlBuilder;constructor(e){this.options=e,this.applicationUrlBuilder=new z(this.options)}submitRequest(e,t,i){T.Utils.ClientAuth.authorize(this.clientKey,()=>{l.Ajax.fragment({method:"POST",url:this.applicationUrlBuilder.fullUrl(this.options.app.apipannenmeldung),data:e.toJsonString(),xhrFields:{withCredentials:!0}},t,i)},i)}checkSystemStatus(e,t){T.Utils.ClientAuth.authorize(this.clientKey,()=>{l.Ajax.fragment({method:"GET",url:this.applicationUrlBuilder.fullUrl(this.options.app.apisystemstatus),xhrFields:{withCredentials:!0}},e,t)},t)}getUserVehicles(e,t,i){let r=this.options.app.apigarage;e&&(r+=`/${e}`),T.Utils.Auth.getBearerToken(e=>{l.Ajax.fragment({method:"GET",url:this.applicationUrlBuilder.fullUrl(r),headers:{Authorization:`Bearer ${e}`}},t,i)})}submitUserVehicle(e,t,i){const r=Ae.getFahrzeugModelApi(e);r.Zustimmung=!0,T.Utils.Auth.getBearerToken(e=>{const s={method:"POST",url:this.applicationUrlBuilder.fullUrl(this.options.app.apigarage),headers:{Authorization:`Bearer ${e}`},data:r.toJsonString()};l.Ajax.fragment(s,t,i)})}getModels(e,t,i,r){t.Valid?T.Utils.Auth.getBearerToken(t=>{l.Ajax.fragment({method:"GET",url:e,headers:{Authorization:`Bearer ${t}`}},i,r)}):l.Ajax.fragment({method:"GET",url:e},i,r)}interceptClientAuthError(e,t,i){T.Utils.ClientAuth.revalidateAuth(this.clientKey,e,t,i)}}class $e{systemAvail;$ctx;applicationRouter;user;options;appViewService;appPersistenceService;parent;loader;appValidationService;appValidationServiceLayer;appApiService;clientAuthFallbackCalled=!1;constructor(e,t,i,r){this.systemAvail=!1,this.parent=e,this.options=t,this.loader=i,this.user=r,this.$ctx=$(t.$ctx),this.applicationRouter=new P(t),this.appPersistenceService=new j(t),this.appViewService=new ke(e,t,i),this.appApiService=new ye(t)}start(){const e=()=>{const e={data:this.getViewOptions(),templateurl:this.options.app.currenttemplate.templateurl,campaignurls:this.options.app.campaignurls,parent:this,$ctx:this.$ctx,options:this.options,callback:this.afterRenderApp};this.appViewService.render(e)};this.appApiService.checkSystemStatus(t=>{this.systemAvail=t.Data&&t.Data.SystemAvailable,e()},t=>{this.appApiService.interceptClientAuthError(t,()=>{this.clientAuthFallbackCalled||(this.start(),this.clientAuthFallbackCalled=!0)},e)})}getViewOptions(){const e=this.appPersistenceService.getInputFormModelFromStore(),t=this.appViewService.isWebview();return{User:this.user,FormModel:e,nexturl:this.options.app.nexturl||"",prevurl:this.options.app.prevurl||"",showManualLocation:e.Position.Strasse||e.Position.PLZ||e.Position.Ort||e.Position.Land,IsWebview:t,IsDefaultView:!t,SystemAvail:this.systemAvail}}afterRenderApp(){this.loader.loadSubApps({options:this.options},()=>{this.parent.afterRenderApp(),this.appValidationService=new Pe({options:this.options},this.appViewService.getForm()),this.appValidationServiceLayer=new Pe({options:this.options},this.appViewService.getCountryLayerForm());const e=this.appPersistenceService.getInputFormModelFromStore();this.appViewService.setFormModelToInputView(e),this.appViewService.updateLanguageSwitch(),this.appViewService.fixupAutocompleteEvents(),this.appViewService.addListeners(this),this.appViewService.addInputPageListeners(this),this.appViewService.setSubmitBtn(),this.handleCountry(e.Position),this.prefillDataFromContext(),l.Helper.scheduleTask(()=>{this.pushEcommerceBasisPacket(T.Utils.Tracking.GA4_ONLY)},"background"),l.View.stopLoader(),l.View.scrollTop()})}prefillDataFromContext(){if(this.appViewService.getFromAppContextData("gotpost")){const e=this.appPersistenceService.getFurtherInfoFormModelFromtStore(),t=e.AppUser,i=this.appViewService.getPostedData("givenname"),r=this.appViewService.getPostedData("surname"),s=this.appViewService.getPostedData("phone"),n=this.appViewService.getPostedData("membernumber"),a=this.appViewService.getPostedData("salutation");i&&(t.Vorname=i),r&&(t.Nachname=r),s&&(t.Rueckrufnummer=s),n&&(t.Mitgliedsnummer=n),a&&(t.Anrede="1"===a?1:2),this.appPersistenceService.setFurtherInfoFormModel(e)}const e=l.Url.getParamsAsSingle(window.location.search),t=e&&e.id?e.id:null;t&&this.user&&this.user.Valid&&this.appApiService.getUserVehicles(t,this.onUserVehicleDataSuccess.bind(this),()=>{})}onUserVehicleDataSuccess(e){if(e.Data.length>0){const t=this.appPersistenceService.getFurtherInfoFormModelFromtStore(),i=e.Data[0];t.Fahrzeug=Ae.getFahrzeugModel(i),t.GarageId=i.ReferenceId,this.appPersistenceService.setFurtherInfoFormModel(t)}}viewChangeListener(e){l.Helper.scheduleTask(()=>{const t=this.appViewService.getFormModelFromInputView(e,this.appPersistenceService.getInputFormModelFromStore());this.appPersistenceService.setInputFormModelToStore(t),this.handleCountry(t.Position),this.appViewService.setSubmitBtn()},"user-visible")}viewChangeLayerListener(){l.Helper.scheduleTask(()=>{const e=this.appViewService.getLayerFormModelFromView();this.appPersistenceService.setInputFormModelToStore(e)},"background")}handleCountry(e){const t=e&&e.IsManualInput,i=e?e.LaenderKuerzel:null;i&&this.appViewService.getCountryByCode(i)?(this.appViewService.enforceCountrySelection(!1),this.appViewService.showCountryHint(!t)):(this.appViewService.enforceCountrySelection(!t),this.appViewService.showCountryHint(!1))}submitListener(e){if(e.preventDefault(),this.appValidationService.isValid()){l.View.startLoader(),this.viewChangeListener(e),this.pushEcommerceBasisPacket(T.Utils.Tracking.PIWIK_ONLY);const t=this.appPersistenceService.getInputFormModelFromStore();if(t.Position.IsDangerous&&t.LastShownDangerousLayerLoc!==t.GershwinPosition.StandortFormatiert)l.View.stopLoader(),this.appViewService.showDangerousLayer();else{const e=this.appPersistenceService.getInputFormModelFromStore();e.LastShownDangerousLayerLoc="",this.appPersistenceService.setInputFormModelToStore(e),l.View.stopLoader(),this.applicationRouter.next(window.location.search)}}}async pushEcommerceBasisPacket(e){const t=this.appPersistenceService.getApplicationModel(),i=this.getEcommerceBasisPacket(t);await T.Utils.Tracking.setEcommerceModel(i),T.Utils.Tracking.push(i,T.Utils.Tracking.CHECKOUT,e)}getEcommerceBasisPacket(e){let t=T.Utils.Tracking.getEcommerceModel(this.options.app.ecommercemodelph.producttype);return t=Ae.updateEcommerceModelStepOne(t,e,this.options),t}submitLayerListener(e){e.preventDefault(),e.stopPropagation(),this.appValidationServiceLayer.isValid()&&(l.View.startLoader(),this.applicationRouter.next(window.location.search),l.View.stopLoader())}submitDangerousLayerListener(e){const t=this.appPersistenceService.getInputFormModelFromStore();t.LastShownDangerousLayerLoc=t.GershwinPosition.StandortFormatiert,this.appPersistenceService.setInputFormModelToStore(t),this.submitLayerListener(e)}}class Ce{options;appViewService;parent;user;appPersistenceService;responseModel;constructor(e,t,i,r,s){this.parent=e,this.options=t,this.user=i,this.responseModel=s,this.appPersistenceService=new j(t),this.appViewService=new ke(e,t,r)}start(){const e={data:this.getViewOptions(),templateurl:this.options.app.currenttemplate.templateurl,campaignurls:this.options.app.campaignurls,parent:this,$ctx:this.options.$ctx,options:this.options,callback:this.afterRenderApp};T.Utils.Map.resetMapContainer(),this.appViewService.render(e)}getViewOptions(){const e=this.appPersistenceService.getFurtherInfoFormModelFromtStore(),t=this.appPersistenceService.getInputFormModelFromStore(),i=t.Position.IsDomesticRequest,r=this.appViewService.isWebview();return{User:this.user,FurtherInfoModel:e,InputFormModel:t,IsDomestic:i,IsForeign:!i,ShowMap:t.Position.Breitengrad&&t.Position.Laengengrad,ShowAddressDetails:t.Position.Strasse||t.Position.PLZ||t.Position.Ort||t.Position.Land,ShowCarDetails:e.Fahrzeug.Marke||e.Fahrzeug.Baureihe||e.Fahrzeug.Farbe||e.Fahrzeug.KennzeichenPrefix,ResponseModel:this.responseModel,Asap:0===e.Terminwunsch.GewuenschteAktion,IsWebview:r,IsDefaultView:!r,apisystemstatus:this.options.app.apisystemstatus,apimessages:this.options.app.apimessages,apilatestmessage:this.options.app.apimessageslatest,messagesbackend:this.options.app.messagesbackend,apistatekeymap:this.options.app.apistatekeymap,apigelberengelgeo:this.options.app.apigelberengelgeo}}afterRenderApp(){T.Utils.Tracking.pushKameleoonData(),this.parent.afterRenderApp(),this.appPersistenceService.clearApplicationSession(),l.View.stopLoader(),l.View.scrollTop()}}let xe=function(e){return e[e.None=0]="None",e[e.Frau=1]="Frau",e[e.Herr=2]="Herr",e}({}),De=function(e){return e[e.None=0]="None",e[e.Herr=1]="Herr",e[e.Frau=2]="Frau",e[e.Familie=3]="Familie",e[e.Firma=4]="Firma",e[e.Unbekannt=9]="Unbekannt",e}({});class Ve{$ctx;applicationRouter;appApiService;appApplicationService;errorService;user;options;appViewService;appPersistenceService;parent;loader;appValidationService;userGarage;selecectedGarageId;clientAuthFallbackCalled=!1;constructor(e,t,i,r){this.parent=e,this.options=t,this.loader=i,this.user=r,this.$ctx=$(t.$ctx),this.applicationRouter=new P(t),this.appApplicationService=new y(t),this.appPersistenceService=new j(t),this.appViewService=new ke(e,t,i),this.errorService=new Ie(t),this.appApiService=new ye(t),this.selecectedGarageId="0"}start(){this.checkPreconditions()?this.preloadData(()=>{const e={data:this.getViewOptions(),templateurl:this.options.app.currenttemplate.templateurl,campaignurls:this.options.app.campaignurls,parent:this,$ctx:this.$ctx,options:this.options,callback:this.afterRenderApp};this.appViewService.render(e)}):this.applicationRouter.back()}checkPreconditions(){return!!this.appPersistenceService.getInputFormModelFromStore().Position.LaenderKuerzel}preloadData(e){this.user&&this.user.Valid&&!this.appViewService.isWebview()?this.appApiService.getUserVehicles("",t=>{t.Data&&t.Data.length&&(this.userGarage=t.Data),e()},()=>{e()}):e()}getViewOptions(){const e=this.appPersistenceService.getFurtherInfoFormModelFromtStore(),t=this.appPersistenceService.getInputFormModelFromStore();e.AppUser&&(e.AppUser.SonderKommunikationSms&&"+49"!==e.AppUser.SonderKommunikationSms||(e.AppUser.SonderKommunikationSms=e.AppUser.Rueckrufnummer),this.updateFormModel(e)),this.appViewService.isWebview()&&(e.Fahrzeug.Art=2),e.GarageId&&(this.selecectedGarageId=e.GarageId);const i=t.Position.IsDomesticRequest,r=this.appViewService.isWebview();return{FormModel:e,InputFormModel:t,User:this.user,Garage:this.userGarage,IsDomestic:i,IsForeign:!i,ShowMap:t.Position.Breitengrad&&t.Position.Laengengrad,ShowAddressDetails:t.Position.Strasse||t.Position.PLZ||t.Position.Ort||t.Position.Land,nexturl:this.options.app.nexturl||"",prevurl:this.options.app.prevurl||"",IsWebview:r,IsDefaultView:!r,position:this.getPosition()}}updateFormModel(e){if(this.user&&this.user.UserData){if(void 0===e.AppUser.Anrede&&!e.AppUser.Vorname&&!e.AppUser.Nachname&&!e.AppUser.Mitgliedsnummer){if(void 0===e.AppUser.Anrede)switch(this.user.UserData.Anrede){case De.Herr:e.AppUser.Anrede=xe.Herr;break;case De.Frau:e.AppUser.Anrede=xe.Frau}e.AppUser.Vorname||(e.AppUser.Vorname=this.user.UserData.Vorname),e.AppUser.Nachname||(e.AppUser.Nachname=this.user.UserData.Nachname),e.AppUser.Mitgliedsnummer||(e.AppUser.Mitgliedsnummer=this.user.MglNo)}e.AppUser.SonderKommunikationEmail||(e.AppUser.SonderKommunikationEmail=this.user.UserData.Email)}}getPosition(){const e=this.appPersistenceService.getInputFormModelFromStore();return{X:e.Position.LaengengradMercator,Y:e.Position.BreitengradMercator}}afterRenderApp(){this.loader.loadSubApps({options:this.options},()=>{this.appValidationService=new Pe({options:this.options},this.appViewService.getForm(),()=>{},this.user),this.parent.afterRenderApp();const e=this.appPersistenceService.getInputFormModelFromStore();this.appViewService.hasMapContainer()&&this.appViewService.renderStaticMap(e),this.appViewService.setFormModelToFurtherView(this.appPersistenceService.getFurtherInfoFormModelFromtStore(),e),this.appViewService.updateLanguageSwitch(),this.appViewService.fixupAutocompleteEvents(),this.appViewService.addListeners(this),this.appViewService.addFurtherInfoListeners(this),l.View.stopLoader(),l.View.scrollTop()})}backToPreviousListener(e){e.preventDefault(),this.applicationRouter.back(window.location.search)}viewChangeListener(){l.Helper.scheduleTask(()=>{const e=this.appViewService.getFormModelFromFurtherView(this.appPersistenceService.getInputFormModelFromStore());this.appViewService.showDamageDetails(e.Schadendiagnose.Schaden),this.appPersistenceService.setFurtherInfoFormModel(e)},"user-visible")}submitListener(e){e.preventDefault(),this.appValidationService.setMode(""),this.appValidationService.isValid()&&(l.View.startLoader(),this._finalSubmit())}_finalSubmit(){let e=this.appPersistenceService.getApplicationModel();this.updateVehicleData(e,t=>{e=t;const i=Ae.getPannenhilfeRequestApi(e,this.options.app.isenglish,this.options,this.appViewService.isWebview());this.appApiService.submitRequest(i,this.submitSuccess.bind(this),this.submitFailed.bind(this))})}updateVehicleData(e,t){e.FurtherInfoFormModel.Fahrzeug.Marke&&e.FurtherInfoFormModel.Fahrzeug.Baureihe&&e.FurtherInfoFormModel.Fahrzeug.Modell?(this.appViewService.updateModelSearchURL(e.FurtherInfoFormModel),this.appApiService.getModels(`${this.appViewService.getModelSearchUrlFromView()}&searchname=${e.FurtherInfoFormModel.Fahrzeug.Modell}`,this.user,i=>{i.Data&&i.Data.Modelle&&i.Data.Modelle.length>0&&(e.FurtherInfoFormModel.Fahrzeug.TetId=i.Data.Modelle[0].Id,e.FurtherInfoFormModel.Fahrzeug.Modell||(e.FurtherInfoFormModel.Fahrzeug.Modell=i.Data.Modelle[0].ModellLabel&&""!==i.Data.Modelle[0].ModellLabel?i.Data.Modelle[0].ModellLabel:i.Data.Modelle[0].Name)),t(e)},()=>{t(e)})):t(e)}submitSuccess(e){l.View.stopLoader(),e.Success?(e.Data.RequestTime=moment.utc().format(),this.appPersistenceService.setAssistanceRequestData(e.Data,this.appViewService.hasAllowedToSetCookie()),this.pushEcommerceBasisPacket(),this.renderSuccessTemplate(e.Data)):this.appViewService.showApiUnavailableHintBox()}async pushEcommerceBasisPacket(){const e=this.appPersistenceService.getApplicationModel(),t=this.getEcommerceBasisPacket(e);await T.Utils.Tracking.setEcommerceModel(t),T.Utils.Tracking.push(t,T.Utils.Tracking.CHECKOUT,T.Utils.Tracking.PIWIK_ONLY)}getEcommerceBasisPacket(e){let t=T.Utils.Tracking.getEcommerceModel(this.options.app.ecommercemodelph.producttype);return t=Ae.updateEcommerceModelStepTwo(t,e,this.options),t}submitFailed(e,t){this.appApiService.interceptClientAuthError(e,()=>{this.clientAuthFallbackCalled||(this._finalSubmit(),this.clientAuthFallbackCalled=!0)},()=>{"timeout"===t?(l.View.stopLoader(),this.appViewService.showApiUnavailableHintBox()):this.handleErrorResponse(e)})}submitGarageListener(e){e.preventDefault();const t=this.appPersistenceService.getFurtherInfoFormModelFromtStore();this.userGarage&&this.userGarage.length&&this.userGarage.some(e=>!(!e.Zulassung||e.Zulassung.Kreis!==t.Fahrzeug.KennzeichenPrefix||e.Zulassung.Nummer!==t.Fahrzeug.KennzeichenSuffix))?this.appViewService.showSubmitGarageFailureHint():(this.appValidationService.setMode("garage"),this.appValidationService.isValid()&&(l.View.startLoader(),this.appApiService.submitUserVehicle(t.Fahrzeug,()=>{this.appViewService.showSubmitGarageSuccessHint(),l.View.stopLoader()},()=>{this.appViewService.showSubmitGarageFailureHint(),l.View.stopLoader()})),this.appValidationService.setMode("",!1))}loginListener(){this.applicationRouter.login()}changeDateListener(){this.appViewService.updateSelectableTimes()}changePhonenumberListener(){this.appViewService.updatePhoneNumberFields()}focusInCarbrandListener(){const e=this.appViewService.getFormModelFromFurtherView(this.appPersistenceService.getInputFormModelFromStore());this.appViewService.updateBrandsSearchURL(e)}changeCarbrandListener(){this.appViewService.resetVehicleData(!0),this.resetUserGarage()}focusInSeriesListener(){const e=this.appViewService.getFormModelFromFurtherView(this.appPersistenceService.getInputFormModelFromStore());this.appViewService.updateSeriesSearchURL(e)}changeSeriesListener(){const e=this.appViewService.getFormModelFromFurtherView(this.appPersistenceService.getInputFormModelFromStore());this.appViewService.updateModelSearchURL(e),this.appApiService.getModels(`${this.appViewService.getModelSearchUrlFromView()}&searchname=`,this.user,e=>{this.appViewService.setVehicleModelToView(e)},()=>{}),this.appViewService.resetVehicleData(!1),this.resetUserGarage()}focusInModelListener(){const e=this.appViewService.getFormModelFromFurtherView(this.appPersistenceService.getInputFormModelFromStore());this.appViewService.clearModelField(),this.appViewService.updateModelSearchURL(e)}modelSelectedListener(e,t,i){i?this.setFahrzeugTetDataToModel($(i[0]).data("js-id"),$(i[0]).data("js-val")):this.setFahrzeugTetDataToModel("",""),this.resetUserGarage()}changeVehicleTypeListener(){this.appViewService.resetVehicleData(!0),this.appViewService.updateVehicleTypeValidation(),this.resetUserGarage(),this.handleModelVisibility()}changePlateNumberListener(){this.resetUserGarage()}changeGarageListener(){const e=this.appViewService.getFormModelFromFurtherView(this.appPersistenceService.getInputFormModelFromStore()),t=e.GarageId;t!==this.selecectedGarageId&&(this.appViewService.resetVehicleData(!0),this.selecectedGarageId=t,e.Fahrzeug=Ae.getFahrzeugModel(this.findGarageVehicle(t)),this.appViewService.setVehicleDataToView(e),this.appViewService.showSubmitGarageButton("0"===t),this.appPersistenceService.setFurtherInfoFormModel(e),this.appValidationService.setMode(""))}handleModelVisibility(){const e=this.appViewService.getFormModelFromFurtherView(this.appPersistenceService.getInputFormModelFromStore());this.appViewService.toggleModelVisibility(0!==e.Fahrzeug.Art)}findGarageVehicle(e){let t=null;return this.userGarage&&this.userGarage.length&&this.userGarage.some(i=>i.ReferenceId===e&&(t=i,!0)),t}resetUserGarage(){this.selecectedGarageId="0",this.appViewService.resetGarageSelect(),this.appViewService.showSubmitGarageButton()}renderSuccessTemplate(e){const t=this.appApplicationService.preparePageOptions("confirmationpage");this.pushEcommerceBasisSuccessPacket(e.ChannelID),new Ce(this.parent,t,this.user,this.loader,e).start()}async pushEcommerceBasisSuccessPacket(e){const t=this.appPersistenceService.getApplicationModel(),i=this.getEcommerceBasisSuccessPacket(t,e);await T.Utils.Tracking.setEcommerceModel(i),T.Utils.Tracking.push(i,T.Utils.Tracking.ORDER)}getEcommerceBasisSuccessPacket(e,t){let i=T.Utils.Tracking.getEcommerceModel(this.options.app.ecommercemodelph.producttype);return i=Ae.updateEcommerceModelStepThree(i,e,this.options,t),i}handleErrorResponse(e){this.errorService.isServerValidationError(e)?(this.appValidationService.showServerValidationErrors(e),this.appValidationService.triggerValidation()):this.appViewService.showApiUnavailableHintBox(),l.View.stopLoader()}setFahrzeugTetDataToModel(e,t){const i=this.appPersistenceService.getFurtherInfoFormModelFromtStore();i.Fahrzeug.TetId=e.replace(/"/g,""),i.Fahrzeug.Modell||(i.Fahrzeug.Modell=t),this.appPersistenceService.setFurtherInfoFormModel(i)}}class Ee{stepController;appPersistanceService;appApplicationService;userService;$ctx;options;loader;basicApplicationRouter;constructor(e,t,i){this.loader=i,this.options=$.extend(!0,{},G,t),this.$ctx=this.options.$ctx,this.userService=new k,this.basicApplicationRouter=new P(this.options),this.appPersistanceService=new j(this.options),this.appApplicationService=new y(this.options)}start(){this.callDependencyLoader()}callDependencyLoader(){this.loader._loadDependencies(this.initApplication.bind(this))}initApplication(){const e=this.appPersistanceService.hasApplicationSession();l.View.startLoader(),this.appPersistanceService.prepareApplicationSession(),this.userService.getUser(t=>{const i=this.appApplicationService.getCurrentStepName().toLowerCase();if("inputpage"===i||"inputpagev2"===i)this.stepController=new $e(this,this.options,this.loader,t),this.stepController.start();else{if(this.checkRoutingCondition(e))return;this.stepController=new Ve(this,this.options,this.loader,t),this.stepController.start()}})}checkRoutingCondition(e){return!e&&(this.appPersistanceService.checkAssistanceRequestDataExists()?this.basicApplicationRouter.routeToLocation(this.options.app.reloadredirecturl):this.basicApplicationRouter.back(window.location.search),!0)}afterRenderApp(){this.loader.initAdditionalModules(this.$ctx),S.Utils.Lightbox.init(),l.View.stopLoader(),this.loader.complete()}}window.InstanceCollection=window.InstanceCollection||{};const Oe=window.$jq||jQuery.noConflict();Oe.ADAC||(Oe.ADAC={}),window.$=jQuery;const Le="RoadsideAssistanceApplication",Ue=`ADAC_${Le}`;Oe.ADAC[Le]=function(e,t,i){this.tid=t.app.tid,this.element=e,this.loader=i,this.options=t,this.options.$jq=Oe,this.$ctx=this.options.$ctx,this._name=Le,window.InstanceCollection[Le]=this,this.application=new Ee(this.element,this.options,this.loader),this.application.start()},Oe.fn[Ue]=function(e,t){return this.each(function(){Oe.data(this,Ue)||Oe.data(this,Ue,new Oe.ADAC[Le](this,e,t))})}})();
//# sourceMappingURL=/api/apps/svc/roadsideassistance/dist/app.bundle.min.js.map