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){c.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){c.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(),c.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(c.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||c.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||c.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?c.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){c.View.renderTemplate(e,t,this.$ctx,function(){})}handleServerErrorWithErrorPageRedirect(e,t){return!!this.isFatalError(e)&&(c.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(c.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];c.View.displayDialog(e,t,i),c.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)}}var G;function L(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 H{static VALIDATION_FAILED_MARKER=(()=>(G=()=>{L(this,"VALIDATION_FAILED_ATTR",`data-${H.VALIDATION_FAILED_MARKER}`),L(this,"BACKEND_VALIDATION_MARKER","backend-validation"),L(this,"BACKEND_VALIDATION_ATTR",`data-${H.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 j(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 B(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()&&c.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(H.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),c.View.scrollTo(0)}showGeneralValidationMessage(e){const t=this.$ctx.find(".js-general");t.html(e||""),c.View.hideElement(t,!e)}setServerValidationFlag(e,t){const i=this.findValidatingElement(t);i.data(H.VALIDATION_FAILED_MARKER,!e),e&&this.setValidationMarkers(i)}setServerValidationBackendFlag(e,t,i){const r=this.findValidatingElement(t);if(r.data(H.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}`]:c.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}`]:c.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){c.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 c.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 c.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(H.VALIDATION_FAILED_MARKER)}validatorFuture(e,t,i){if("Geburtsdatum"===t.name||"Geburtsdatum"===t.getAttribute("data-validation")){const t=c.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&&(!c.Helper.isEmptyString(s.val())||!c.Helper.isEmptyString(n.val()))&&(s.removeClass("is-error"),n.removeClass("is-error"),c.Helper.isEmptyString(s.val())||c.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&&(!c.Helper.isEmptyString(r.val())||!c.Helper.isEmptyString(s.val()))&&(r.removeClass("is-error"),s.removeClass("is-error"),c.Helper.isEmptyString(r.val())||c.Helper.isEmptyString(s.val())))}validatorRequiredSameOrPastDate(e){const t=c.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(c.Format.viewDateToIsoDate(e)).isSameOrAfter(c.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(c.Format.viewDateToIsoDate(e)).isSameOrBefore(c.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(c.Format.viewDateToIsoDate(e)).isSameOrAfter(t,"day")}validatorFuterMaxOneYear(e){const t=moment().add(1,"years");return moment(c.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"}}G();class _ extends H{ALREADY_VALIDATED_ATTR="data-alreadyvalidated";addCustomMethods(){super.addCustomMethods(),$.validator.addMethod("cancellationdate",e=>!($("#time_1").is(":checked")&&e.length<=0)),$.validator.addMethod("customrequired",this.validatorCustomRequired.bind(this)),$.validator.addMethod("otherreasonrequired",this.validatorOtherReasonRequired.bind(this)),$.validator.addMethod("otherreasonsecond",this.validatorOtherReasonSecond.bind(this))}validatorCustomRequired(e,t){const i=$(t);return!!$("#time_1").is(":checked")||!!i.attr(this.ALREADY_VALIDATED_ATTR)||(i.attr(this.ALREADY_VALIDATED_ATTR,"true"),$('[name="radioreason"]:checked').length>0)}validatorOtherReasonRequired(){return!$("#time_1").is(":checked")||$('textarea[name="otherreason"]').val().toString().trim().length>0}validatorOtherReasonSecond(e,t){const i=$(t);return!!$("#time_1").is(":checked")||!!(i.attr(this.ALREADY_VALIDATED_ATTR)||$('[name="radioreason"]:checked').not("#radioreason_other").length>0)||(i.attr(this.ALREADY_VALIDATED_ATTR,"true"),$('textarea[name="otherreason"]').val().toString().trim().length>0)}}class K{ort;postleitzahl;strasseHausnummer;strasse;hausnummer;postfachnummer;ergaenzungszeile;auslandsadresse;landkennzeichen;land;regionalclubKennung;regionalclubCode;get Ergaenzungszeile(){return this.ergaenzungszeile}set Ergaenzungszeile(e){this.ergaenzungszeile=e}get StrasseHausnummer(){return this.strasseHausnummer}set StrasseHausnummer(e){this.strasseHausnummer=e}get Postfachnummer(){return this.postfachnummer}set Postfachnummer(e){this.postfachnummer=e}get Postleitzahl(){return this.postleitzahl}set Postleitzahl(e){this.postleitzahl=e}get Ort(){return this.ort}set Ort(e){this.ort=e}get Auslandsadresse(){return this.auslandsadresse}set Auslandsadresse(e){this.auslandsadresse=e}get Landkennzeichen(){return this.landkennzeichen}set Landkennzeichen(e){this.landkennzeichen=e}get Land(){return this.land}set Land(e){this.land=e}get RegionalclubKennung(){return this.regionalclubKennung}set RegionalclubKennung(e){this.regionalclubKennung=e}get RegionalclubCode(){return this.regionalclubCode}set RegionalclubCode(e){this.regionalclubCode=e}get Strasse(){return this.strasse}set Strasse(e){this.strasse=e}get Hausnummer(){return this.hausnummer}set Hausnummer(e){this.hausnummer=e}toString(){return JSON.stringify(this)}mergeWithUser(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e.UserData.Anschrift&&(this.Ergaenzungszeile&&!t||(this.Ergaenzungszeile=e.UserData.Anschrift.Ergaenzungszeile),this.StrasseHausnummer&&!t||(this.StrasseHausnummer=e.UserData.Anschrift.StrasseHausnummer),this.Postfachnummer&&!t||(this.Postfachnummer=e.UserData.Anschrift.Postfachnummer),this.Postleitzahl&&!t||(this.Postleitzahl=e.UserData.Anschrift.Postleitzahl),this.Ort&&!t||(this.Ort=e.UserData.Anschrift.Ort))}static createFromObject(e){return c.Helper.createFromMap(e,K)}}class q{mitgliedsnummer;telefonGeschaeftlichNummer;telefonGeschaeftlichVorwahl;telefonNummer;telefonVorwahl;email;geburtsdatum;adresse;beguenstigter;firma;nachname;vorname;anredeKennzeichen;title;constructor(){this.Adresse=new K}get Anrede(){return 1==this.anredeKennzeichen?"Herr":"Frau"}get AnredeKennzeichen(){return this.anredeKennzeichen}set AnredeKennzeichen(e){this.anredeKennzeichen=e}get Titel(){return this.title}set Titel(e){this.title=e}get Vorname(){return this.vorname}set Vorname(e){this.vorname=e}get Mitgliedsnummer(){return this.mitgliedsnummer}set Mitgliedsnummer(e){this.mitgliedsnummer=e}get Nachname(){return this.nachname}set Nachname(e){this.nachname=e}get Firma(){return this.firma}set Firma(e){this.firma=e}get Beguenstigter(){return this.beguenstigter}set Beguenstigter(e){this.beguenstigter=e}get Adresse(){return this.adresse}set Adresse(e){this.adresse=e}get Geburtsdatum(){return this.geburtsdatum}set Geburtsdatum(e){this.geburtsdatum=e}get Email(){return this.email}set Email(e){this.email=e}get TelefonVorwahl(){return this.telefonVorwahl}set TelefonVorwahl(e){this.telefonVorwahl=e}get TelefonNummer(){return this.telefonNummer}set TelefonNummer(e){this.telefonNummer=e}get TelefonGeschaeftlichVorwahl(){return this.telefonGeschaeftlichVorwahl}set TelefonGeschaeftlichVorwahl(e){this.telefonGeschaeftlichVorwahl=e}get TelefonGeschaeftlichNummer(){return this.telefonGeschaeftlichNummer}set TelefonGeschaeftlichNummer(e){this.telefonGeschaeftlichNummer=e}toString(){return JSON.stringify(this)}mergeWithUserExceptAdress(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.mergePersonalUserData(e,t,i)}mergeWithUser(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.mergePersonalUserData(e,t,i),this.Adresse.mergeWithUser(e,i)}mergePersonalUserData(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];!e.MglNo||this.Mitgliedsnummer&&!i||(this.Mitgliedsnummer=e.MglNo),!e.UserData.Anrede||this.AnredeKennzeichen&&t||(this.AnredeKennzeichen=e.UserData.Anrede),!e.UserData.Vorname||this.Vorname&&t||(this.Vorname=e.UserData.Vorname),!e.UserData.Titel||this.Titel&&t||(this.Titel=e.UserData.Titel),!e.UserData.Nachname||this.Nachname&&t||(this.Nachname=e.UserData.Nachname),!e.UserData.Firma||this.Firma&&!i||(this.Firma=e.UserData.Firma),!e.UserData.Beguenstigter||this.Beguenstigter&&!i||(this.Beguenstigter=e.UserData.Beguenstigter),!e.UserData.Geburtsdatum||this.Geburtsdatum&&t||(this.Geburtsdatum=e.UserData.Geburtsdatum),!e.UserData.Email||this.Email&&!i||(this.Email=e.UserData.Email),e.UserData.Telefon&&e.UserData.Telefon.Prefix&&(!this.TelefonVorwahl||i)&&(this.TelefonVorwahl=e.UserData.Telefon.Prefix),e.UserData.Telefon&&e.UserData.Telefon.Suffix&&(!this.TelefonNummer||i)&&(this.TelefonNummer=e.UserData.Telefon.Suffix),e.UserData.TelGesch&&e.UserData.TelGesch.Prefix&&(!this.TelefonGeschaeftlichVorwahl||i)&&(this.TelefonGeschaeftlichVorwahl=e.UserData.TelGesch.Prefix),e.UserData.TelGesch&&e.UserData.TelGesch.Suffix&&(!this.TelefonGeschaeftlichNummer||i)&&(this.TelefonGeschaeftlichNummer=e.UserData.TelGesch.Suffix)}static createFromObject(e){return c.Helper.createFromMap(e,q,(e,t)=>"adresse"===e.toLowerCase()?K.createFromObject(t):t)}}class J{loader;options;parent;applicationService;renderingCanceled;$ctx;formId;sectionBgClasses;autoCompleteZipSelector;autoCompleteStreetSelector;autoCompleteCitySelector;constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.parent=e,this.options=i,this.loader=r,this.applicationService=new t(i),this.$ctx=i.$ctx,this.formId=i.app.applicationId,this.sectionBgClasses=["h-background"],this.autoCompleteZipSelector=".js-autocomplete-zip",this.autoCompleteStreetSelector=".js-autocomplete-street",this.autoCompleteCitySelector=".js-autocomplete-city"}getForm(){return this.$ctx.find(`#${this.formId} form`)}getFormByClassSelector(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:".js-main-form";return this.$ctx.find(`#${this.formId} form${e}`)}render(e){window.addEventListener("beforeunload",()=>{this.renderingCanceled=!0}),c.Ajax.fragment({url:e.templateurl,dataType:"html",timeout:3e4},t=>{this.renderTemplate(t,e)},t=>{this.handleRenderError(e,t)})}handleRenderError(e,t){window.setTimeout(()=>{this.renderingCanceled||(c.Helper.logError(t,"ViewService",window.location.href,`GET request from AppUtils.Ajax.fragment ${e.templateurl}`),T.Utils.Helper.routeToUrl(this.options.app.errorurl))},300)}renderTemplate(e,t){if(this.parent&&this.parent.beforeRenderApp&&this.parent.beforeRenderApp(),t.beforeRenderApp&&t.beforeRenderApp(e),t.callback){const i=t.callback.bind(t.parent);c.View.renderTemplate(e,t.data,t.$ctx,()=>{i()})}else c.View.renderTemplate(e,t.data,t.$ctx,this._afterRender.bind(this))}_afterRender(){this.loader.loadSubApps({options:this.options},()=>{}),this.parent.afterRenderApp()}getPersonalDataModel(){return this._getPersonalDataModel(this.getFormData())}_getPersonalDataModel(e){const t=new q;return t.AnredeKennzeichen=Number(e.Anrede),t.Titel=e.Titel,t.Vorname=e.Vorname,t.Nachname=e.Nachname,t.Firma=e.Firma,t.Beguenstigter=e.Beguenstigter,t.Adresse=new K,t.Adresse.StrasseHausnummer=e.StrasseHausnummer,t.Adresse.Postleitzahl=e.Postleitzahl,t.Adresse.Ort=e.Ort,t.Adresse.Postfachnummer=e.Postfachnummer,t.Geburtsdatum=c.Format.viewDateToIsoDate(e.Geburtsdatum),t.Email=e.Email,t.TelefonVorwahl=e.TelefonVorwahl,t.TelefonNummer=e.TelefonNummer,t.TelefonGeschaeftlichVorwahl=e.TelefonGeschaeftlichVorwahl,t.TelefonGeschaeftlichNummer=e.TelefonGeschaeftlichNummer,t}setDate(e,t){e.val(c.Format.isoDateToViewDate(t)),e.attr("value",c.Format.isoDateToViewDate(t))}setDateToField(e,t){if(e.val(moment(t).format("DD.MM.YYYY")),c.Helper.isEmptyString(e.val())){let i=e.attr("value");if(i){t&&(i=t);const r=c.Format.viewDateToShortInvIsoDate(i);e.val(r);const s=c.Format.viewDateToShortIsoDate(t);e.attr("value",s),e.closest(".l-outer").hasClass("is-touch")&&(e.closest(".l-outer").hasClass("is-ios")||e.val(s),e.attr("value",c.Format.viewDateToShortIsoDate(i)))}else{const t=moment().add(1,"d"),i=c.Format.viewDateToShortIsoDate(t),r=c.Format.viewDateToShortInvIsoDate(t);e.val(r),e.attr("value",i),e.closest(".l-outer").hasClass("is-touch")&&(e.val(e.closest(".l-outer").hasClass("is-ios")?r:i),e.attr(i))}}}showDependendElements(e,t,i){this.$ctx.find(".js-app-depend").each(function(){const r=$(this),s=r.data(t);s&&(s.toUpperCase()===e.toUpperCase()?i||r.show():i?r.remove():r.hide())})}getFormData(){return c.Url.getParamsAsCSV(this.getFormElements().serialize())}getFormElements(){return this.$ctx.find("#app-form > form, .js-app-form form")}setFormModelElementsToView(e){e&&this.$ctx.find("input, select").each((t,i)=>{const r=c.Helper.getNestedProperty(e,i.name);r&&("text"===i.type||"date"===i.type||"hidden"===i.type?this.$ctx.find(`input[name="${i.name}"]`).val(r):"checkbox"===i.type?this.$ctx.find(`input[name="${i.name}"][value="${r}"]`).prop("checked",!0):"select-one"===i.type?this.$ctx.find(`select[name="${i.name}"] option[value="${r}"]`).prop("selected",!0):"text"!==i.type&&this.$ctx.find(`input[name="${i.name}"][value="${r}"]`).trigger("click"))})}getValueFromViewByAttributeName(e){if(e.length>0)return this.$ctx.find(`[name=${e}]`).val()}getFormFieldByName(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"input";return this.$ctx.find(`${t}[name="${e}"]`)}setTaxInformationToView(e){this.$ctx.find(".js-tax-information-text").text(e),this.$ctx.find(".js-tax-information").toggleClass("h-hidden",!1)}getPostedData(e){return(this.$ctx.data("postdata")||{})[e]}getFromAppContextData(e){return`${this.$ctx.data(e)}`}showSepaLinkWithInfo(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this.$ctx.find(`${e} .js-sepa-downloadnote`).hide(),this.$ctx.find(`${e} .js-sepa-pdflink`).removeClass("h-hidden"),this.$ctx.find(`${e} .js-sepa-printnote`).removeClass("h-hidden")}toggleCreditCardError(e,t){const i=this.$ctx.find(".js-cc-error");i.toggleClass("h-hidden",e),e||(i.text(t),c.View.scrollToElement(i))}restoreSectionBackground(e,t){if(!e||!e.length)return null;const i=this.$ctx.find(e.map(e=>`${e}:visible`,[]).join(","));return i.each((e,i)=>{const r=$(i);r.toggleClass(this.sectionBgClasses.join(" "),0==e%2),t&&t(r)}),i}handleAddressAutocompleteSelection(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>3?arguments[3]:void 0;if(t&&t.data()&&t.length>0){const i=t.data(),r=["streetandno","zip","city"];if(!i?.jsId||!r.includes(i.jsId))return;const s=this.$ctx.find(this.autoCompleteStreetSelector),n=this.$ctx.find(this.autoCompleteCitySelector),a=this.$ctx.find(this.autoCompleteZipSelector);if(s.val(""),s.closest(".ll-row").removeClass("is-valid is-check"),"streetandno"===i.jsId){const i=t[0].innerText.split(",");if(i.length>1){const t=i[1].split("-");s.val(i[0]).removeClass("is-error"),a.val(t[0].trim()).removeClass("is-error"),n.val(t[1].trim()).removeClass("is-error"),e&&(a.closest(".ll-row").removeClass("is-error"),n.closest(".ll-row").removeClass("is-error"))}}else{const i=t[0].innerText.split("-");i.length>1&&(a.val(i[0].trim()).removeClass("is-error"),n.val(i[1].trim()).removeClass("is-error"),e&&(a.closest(".ll-row").removeClass("is-error"),n.closest(".ll-row").removeClass("is-error")))}}}}class W extends J{autocompletePendingFlag="autocomplete-pending";radioreasonOther="#radioreason_other";radioreason='[name="radioreason"]';submitBtnSelector=".js-submit-form";user;constructor(e,t,i,r){super(e,t,i),this.formId="mglcancellation",this.user=r}setFormModelToView(e){const t=this.getForm();t.find('[name="MemberNumber"]').val(e.MemberNumber),t.find(`[name="Anrede"][value="${e.Anrede}"]`).prop("checked","checked"),t.find('[name="Vorname"]').val(e.Vorname),t.find('[name="Nachname"]').val(e.Nachname),this.setDate(t.find('[name="Geburtsdatum"]'),e.Geburtsdatum),t.find('[name="Geburtsdatum"]').val(c.Format.isoDateToViewDate(e.Geburtsdatum)),t.find('[name="StrasseHausnummer"]').val(e.Anschrift.StrasseHausnummer),t.find('[name="Postleitzahl"]').val(e.Anschrift.Postleitzahl),t.find('[name="Ort"]').val(e.Anschrift.Ort),t.find('[name="Email"]').val(e.Email)}getFormModelFromView(e){const t=e||new O,i=this.getFormData(),r=new b;return this.user.Valid||(t.MemberNumber=i.MemberNumber,t.Anrede=Number(i.Anrede),t.Vorname=i.Vorname,t.Nachname=i.Nachname,t.Geburtsdatum=c.Format.viewDateToIsoDate(i.Geburtsdatum),r.StrasseHausnummer=i.StrasseHausnummer,r.Postleitzahl=i.Postleitzahl,r.Ort=i.Ort,t.Anschrift=r),t.Email=i.Email,t}setReasonModelToView(e){const t=this.getForm();t.find(`[name="radioreason"][value="${e.Grund}"]`).trigger("click"),t.find('[name="otherreason"]').val(e.SonstigerGrund),t.find(`[name="RadioCancellationDate"][value="${e.RadioCancellationDate}"]`).trigger("click"),t.find('[name="RadioCancellationDate"][value="1"]').is(":checked")&&(t.find('[name="Cancellationdate"]').val(e.CancellationDate),t.find(this.radioreason).not(this.radioreasonOther).prop("disabled",!0)),this.toggleOtherReasonLabel(!t.find('[name="RadioCancellationDate"][value="1"]').is(":checked"))}getReasonModelFromView(){const e=new I,t=this.getFormData();return e.Grund=t.radioreason,e.GrundText=this.getReasonText(t.radioreason),e.GrundCrmId=this.getReasonCrmId(t.radioreason),e.GrundDesignationDopix=this.getReasonDesignationDopix(t.radioreason),e.SonstigerGrund=this.getIsOtherReason()?t.otherreason:"",e.ContraArguments=this.getIsOtherReason()?"":this.getContraArguments(t.radioreason),e.RadioCancellationDate=this.getRadioCancellationDate(),e.CancellationDate=this.getCancellationDate(),e.RadioCancellationDateText="0"===e.RadioCancellationDate?this.options.$ctx.find("#labeltime").text():"",e}getIsOtherReason(){const e=this.options.$ctx.find(this.radioreasonOther);return!!(e&&e[0]&&e[0].checked)}getReasonText(e){return this.options.$ctx.find(`input[name="radioreason"][value="${e}"]`).data("reasontext")}getReasonCrmId(e){return this.options.$ctx.find(`input[name="radioreason"][value="${e}"]`).data("crmid")}getReasonDesignationDopix(e){return this.options.$ctx.find(`input[name="radioreason"][value="${e}"]`).data("designationdopix")}getContraArguments(e){const t=this.options.$ctx.find(`[data-contraarguments="${e}"]`);return t?t.text().trim():""}addListeners(e){const t=this.getForm();t.find("input, select, textarea").on("change",e),t.find(this.radioreason).on("click",this.changeReasonFocus.bind(this)),t.find('[name="RadioCancellationDate"]').on("change",this.changecancellationDate.bind(this)),t.find(".js-member-benefits").on("change",e);const i=t.find('[data-t-decorator="autocomplete"]');i&&(this.$ctx.on("automcompleteSelect",this.handleAddressAutocompleteSelection.bind(this,!1)),i.on("keypress",e=>{"Enter"===e.key&&i.data(this.autocompletePendingFlag)&&i.data(this.autocompletePendingFlag,null)}),i.trigger("keypress")),c.View.initFormElements(),S.Globals.lazyloadertx.init()}changeReasonFocus(e){$(e.currentTarget).trigger("blur")}changecancellationDate(){const e=this.getForm();e.find("#time_1").is(":checked")?(e.find(this.radioreasonOther).trigger("click"),e.find(this.radioreason).not(this.radioreasonOther).prop("disabled",!0),this.toggleOtherReasonLabel(!1)):(e.find(this.radioreason).not(this.radioreasonOther).prop("disabled",!1),this.toggleOtherReasonLabel(!0))}toggleOtherReasonLabel(e){const t=this.getForm();t.find(".js-label-extraordinary-reason").toggleClass("h-hidden",e),t.find(".js-label-other-reason").toggleClass("h-hidden",!e)}addListenerBenefits(e){this.$ctx.find(`#${this.formId}`).find(".js-member-benefits").on("change",e),c.View.initFormElements(),S.Globals.lazyloadertx.init()}getFormElements(){return this.getForm()}setConfigAutocomplete(e){const t=this.getForm().find('[data-t-decorator="autocomplete"]');t.attr("data-subscription-key",T.Utils.Application.apimSubscriptionKey),t.attr("data-searchurl",e)}getRadioCancellationDate(){return this.options.$ctx.find('input[name="RadioCancellationDate"]:checked').val()}getCancellationDate(){return this.options.$ctx.find('[name="Cancellationdate"]').val()}setSuccessModelToView(e){const t=$(".js-introduction").html();$(".js-introduction").html(t.replace("{Vorgangsnummer}",e.Vorgangsnummer.toString()))}toggleSubmitButton(e){const t=this.$ctx.find(`#${this.formId}`);t.find(this.submitBtnSelector).prop("disabled",e),t.find(this.submitBtnSelector).toggleClass("is-disabled",e)}}class Y extends d{constructor(e){super(),e&&c.Helper.mapObject(e,this)}memberNumber;get MemberNumber(){return this.memberNumber}set MemberNumber(e){this.memberNumber=e}birthday;get Birthday(){return this.birthday}set Birthday(e){this.birthday=e}lastName;get LastName(){return this.lastName}set LastName(e){this.lastName=e}firstName;get FirstName(){return this.firstName}set FirstName(e){this.firstName=e}streetAndNumber;get StreetAndNumber(){return this.streetAndNumber}set StreetAndNumber(e){this.streetAndNumber=e}postalCode;get PostalCode(){return this.postalCode}set PostalCode(e){this.postalCode=e}city;get City(){return this.city}set City(e){this.city=e}static createFromObject(e){return c.Helper.createFromMap(e,Y,(e,t)=>(e.toLowerCase(),t))}toRequestObject(){const e={};return e.MemberNumber=this.memberNumber,e.Birthday=this.birthday,e.LastName=this.lastName,e.FirstName=this.firstName,e.StreetAndNumber=this.streetAndNumber,e.PostalCode=this.postalCode,e.City=this.city,e}toJsonString(){return JSON.stringify(this.toRequestObject())}}class Z{static checkCancellationRequestModel(e){const t=new Y;return t.FirstName=e.Vorname,t.LastName=e.Nachname,t.Birthday=e.Geburtsdatum,t.MemberNumber=e.MemberNumber,t.PostalCode=e.Anschrift.Postleitzahl,t.City=e.Anschrift.Ort,t.StreetAndNumber=e.Anschrift.StrasseHausnummer,t}static cancellationRequestModel(e,t){const i=new N,r=e.getFormModelFromStore(),s=e.getReasonModelFromStore(),n=e.getStepModelFromStore(),a=e.getMemeberBenefitsModelFromStore();if(i.Id=n.Id||"",i.SeitenStatus=n.SeitenStatus||0,i.Verwerfen=n.Verwerfen||!1,1!==n.SeitenStatus){void 0===s.Grund&&(s.Grund="KA",s.GrundText="Keine Angabe",e.setReasonModelToStore(s),i.GrundText=s.GrundText),i.Grund=s.Grund,void 0!==s.SonstigerGrund&&s.SonstigerGrund.length<=0&&(i.GrundText=s.GrundText||"",i.GrundCrm=s.GrundCrmId,i.BriefBezeichnung=s.GrundDesignationDopix),i.SonstigerGrund=s.SonstigerGrund||"";const t="1"===s.RadioCancellationDate;i.MitTermin=!!t,i.Termin=t?c.Format.viewDateToIsoDate(s.CancellationDate):""}i.MemberNumber=r.MemberNumber,i.Anrede=r.Anrede,i.Vorname=r.Vorname,i.Nachname=r.Nachname,i.Geburtsdatum=c.Format.viewDateToIsoDate(r.Geburtsdatum),i.Anschrift=r.Anschrift,i.Email=r.Email||"",i.Vorteil=a.MemberBenefitsIds?a.MemberBenefitsIds.toString():"";let o="Sehr ",l="Sehr ";const h=9===r.Anrede?"geehrtes Mitglied,\n":`${1===r.Anrede?"geehrter Herr":"geehrte Frau"} ${r.Nachname},\n`;return o+=h,l+=h,o+=`${t.app.usermailintroductiontext}${s.ContraArguments} \n\n${t.app.usermailclosingtext}`,l+=`${t.app.usermailintroductiontextautomated}${s.ContraArguments} \n\n${t.app.usermailclosingtextautomated}`,i.BenutzermailText=o,i.BenutzermailTextCrm=l,r.Validierungscode&&!r.UserValid&&(i.Validierungscode=r.Validierungscode),i}}class Q{options;cancellationPersistenceService;urlBuilder;constructor(e){this.options=e,this.cancellationPersistenceService=new U(e),this.urlBuilder=new B(e)}cancellationRequest(e,t){const i=Z.cancellationRequestModel(this.cancellationPersistenceService,this.options);T.Utils.View.startLoader(),c.Ajax.fragment({method:"POST",url:this.urlBuilder.fullUrl(this.options.app.apicancellationstate),data:i.toJsonString()},t=>{e(t)},e=>{T.Utils.View.stopLoader(),t(e)})}cancellationRequestV2(e,t,i){const r=Z.cancellationRequestModel(this.cancellationPersistenceService,this.options);T.Utils.View.startLoader(),e?T.Utils.Auth.getBearerToken(e=>{c.Ajax.fragment({method:"POST",url:this.urlBuilder.fullUrl(this.options.app.apicancelmembership),headers:{Authorization:`Bearer ${e}`},data:r.toJsonString()},e=>{t(e)},e=>{T.Utils.View.stopLoader(),i(e)})}):c.Ajax.fragment({method:"POST",url:this.urlBuilder.fullUrl(this.options.app.apicancelmembership),data:r.toJsonString()},e=>{t(e)},e=>{T.Utils.View.stopLoader(),i(e)})}cancellationRequestOnUnload(){const e=Z.cancellationRequestModel(this.cancellationPersistenceService,this.options);c.Ajax.fragment({method:"POST",url:this.urlBuilder.fullUrl(this.options.app.apicancellationstate),data:e.toJsonString(),async:!1})}checkForAutomaticCancellation(e,t,i){const r=Z.checkCancellationRequestModel(e);c.Ajax.fragment({method:"POST",url:this.urlBuilder.fullUrl(this.options.app.apitestuser),data:r.toJsonString()},t,i)}}class X extends z{discardUrl;constructor(e){super(e),this.discardUrl=e.app.discardcancellationurl}discard(){this.routeToLocation(this.discardUrl)}}class ee{Step;TemplateUrl;Location}class te{getFormModel;setFormModel;toggleSubmitButton;constructor(e,t,i){this.getFormModel=e,this.setFormModel=t,this.toggleSubmitButton=i}registerCaptchaHandler(e){e.on("captcha-completed",this.captchaHandler.bind(this))}captchaHandler(e){const t=e,i=this.getFormModel();i.Validierungscode=t.detail.solution,this.setFormModel(i),this.toggleSubmitButton(!1)}isCaptchaValid(){const e=$('[name="frc-captcha-response"]').val();return""!==e?.trim()&&".ACTIVATED"!==e?.trim()}resetAllCaptchas(){document.querySelectorAll("friendly-captcha").forEach(e=>e.dispatchEvent(new CustomEvent("captcha-reset")))}static resetAllCaptchasStatic(){document.querySelectorAll("friendly-captcha").forEach(e=>e.dispatchEvent(new CustomEvent("captcha-reset")))}}class ie{options;cancellationPersistenceService;cancellationRouterService;cancellationApiService;isClosingWindow;appErrorService;appValidationService;appPersistenceService;allowedManualControlErrorIds=[346e3,346001,346002,116001];constructor(e){this.cancellationPersistenceService=new U(e),this.cancellationRouterService=new X(e),this.cancellationApiService=new Q(e),this.appErrorService=new j(e),this.appPersistenceService=new U(e),this.options=e,this.isClosingWindow=!0}nextStep(){const e=this.cancellationPersistenceService.getStepModelFromStore();e.Id&&e.Id.length>0?this.nextStepSetting(e.Id):this.cancellationApiService.cancellationRequest(e=>{this.nextStepSetting(e.Data.Id)},this.handleDefaultErrorCallback.bind(this))}submit(){const e=this.cancellationPersistenceService.getFormModelFromStore();this.options.app.usev2backend?this.cancellationApiService.cancellationRequestV2(e.UserValid,this.handleSubmitSuccessCallback.bind(this),this.handleDefaultErrorCallback.bind(this)):this.cancellationApiService.cancellationRequest(this.handleSubmitSuccessCallback.bind(this),this.handleDefaultErrorCallback.bind(this))}discardCancellation(){this.discarded=!0,this.cancellationApiService.cancellationRequest(()=>{this.cancellationPersistenceService.clearPersistence(),this.cancellationRouterService.discard()},()=>{this.cancellationPersistenceService.clearPersistence(),this.cancellationRouterService.discard()})}closingWindowUnload(){this.isClosingWindow&&this.unloadCancellation()}determinePageReload(){$(window).on("keydown keyup",e=>{(116===e.which||e.ctrlKey&&82===e.which)&&(this.isClosingWindow=!1)})}set discarded(e){const t=this.cancellationPersistenceService.getStepModelFromStore();t.Verwerfen=e,this.cancellationPersistenceService.setStepModelToStore(t)}get discarded(){return this.cancellationPersistenceService.getStepModelFromStore().Verwerfen}set pageStatus(e){const t=this.cancellationPersistenceService.getStepModelFromStore();t.SeitenStatus=e,this.cancellationPersistenceService.setStepModelToStore(t)}get pageStatus(){return this.cancellationPersistenceService.getStepModelFromStore().SeitenStatus}set StepId(e){const t=this.cancellationPersistenceService.getStepModelFromStore();t.Id=e,this.cancellationPersistenceService.setStepModelToStore(t)}get StepId(){return this.cancellationPersistenceService.getStepModelFromStore().Id}get IsClosingWindow(){return this.isClosingWindow}set IsClosingWindow(e){this.isClosingWindow=e}set ValidationService(e){this.appValidationService=e}handleSubmitSuccessCallback(e){const t=this.cancellationPersistenceService.getReasonModelFromStore();t.Vorgangsnummer=e&&e.Data?e.Data.ProcessId:0,this.cancellationPersistenceService.setReasonModelToStore(t),this.nextStepSetting(e.Data.Id)}handleDefaultErrorCallback(e){if(this.options.app.usev2backend&&e&&400===e.status&&e.responseJSON){const t=e.responseJSON.Messages;if(t.length>0){const i=t.some(e=>348e3===e.Id),r=t.some(e=>347e3===e.Id),s=t.some(e=>this.allowedManualControlErrorIds.includes(e.Id));if(i||s){const t=this.cancellationPersistenceService.getReasonModelFromStore();if(t.Vorgangsnummer=e.responseJSON&&e.responseJSON.Data?e.responseJSON.Data.ProcessId:0,this.cancellationPersistenceService.setReasonModelToStore(t),s){const e=this.appPersistenceService.getFormModelFromStore();e.Austrittsdatum=void 0,this.appPersistenceService.setFormModelToStore(e)}return this.nextStepSetting(e.responseJSON.Data.Id),void te.resetAllCaptchasStatic()}if(r)return this.appErrorService.errorDialog(this.appValidationService.getMappedBackendMessage("347000"),this.onCloseCaptchaError.bind(this)),c.View.stopLoader(),void(e.errorHandled=!0)}}te.resetAllCaptchasStatic(),this.appErrorService.handleDefaultErrorResponse(e,this.options.name,()=>this.showAndTriggerValidationError(e),()=>this.appPersistenceService.clearApplicationSession())}onCloseCaptchaError(){this.appPersistenceService.clearApplicationSession()}showAndTriggerValidationError(e){this.appValidationService&&(this.appValidationService.showServerValidationErrors(e),this.appValidationService.triggerValidation())}unloadCancellation(){this.discarded=!0,this.cancellationApiService.cancellationRequestOnUnload()}nextStepSetting(e){this.StepId=e;const t=new ee;t.Location=window.location.href,t.TemplateUrl=this.options.app.currenttemplate.templateurl,t.Step=this.options.app.currenttemplate.step,this.cancellationPersistenceService.setRouteToStore(t),this.cancellationRouterService.next()}}class re{validationService;parent;options;loader;urlBuilder;cancellationPersistenceService;cancellationStepService;cancellationViewService;cancellationApiService;user;editMode;constructor(e,t,i,r){this.parent=e,this.options=t,this.loader=i,this.cancellationPersistenceService=new U(t),this.cancellationApiService=new Q(t),this.cancellationStepService=new ie(t),this.cancellationViewService=new W(this,t,i,r),this.urlBuilder=new B(t),this.user=r,this.editMode=!1}start(){this.cancellationViewService.render(this.getViewConfig())}getViewConfig(){return{data:this.getFormViewOptions(),templateurl:this.options.app.currenttemplate.templateurl,campaignurls:this.options.app.campaignurls,parent:this,$ctx:this.options.$ctx,options:this.options,callback:this.afterRenderApp}}submitStep(e){if(e.preventDefault(),this.validationService.isValid()){const e=this.cancellationPersistenceService.getFormModelFromStore();this.useV2()?this.cancellationApiService.checkForAutomaticCancellation(e,this.checkForAutomaticCancellationSuccess.bind(this),this.checkForAutomaticCancellationError.bind(this)):this.cancellationStepService.nextStep()}}checkForAutomaticCancellationSuccess(e){const t=this.cancellationPersistenceService.getFormModelFromStore();t.Austrittsdatum=e.Data.Austrittsdatum,this.cancellationPersistenceService.setFormModelToStore(t),this.cancellationStepService.nextStep()}checkForAutomaticCancellationError(){this.cancellationStepService.nextStep()}toggleEditMode(e){e.preventDefault(),this.editMode=!this.editMode,this.cancellationViewService.render(this.getViewConfig())}getFormViewOptions(){const e=this.user.Valid?this.user:{};return{prevurl:this.options.app.prevurl||"",discardurl:this.options.app.discardcancellationurl||"",User:e,editMode:this.editMode}}afterRenderApp(){const e=this.urlBuilder.fullApimUrl(this.options.app.apiautocompleteaddress);this.cancellationViewService.setConfigAutocomplete(e),this.loader.loadSubApps({options:this.options},()=>{this.parent.afterRenderApp(),this.validationService=new _({options:this.options},this.cancellationViewService.getForm()),this.cancellationPersistenceService.prepareApplicationSession(),this.cancellationStepService.pageStatus=1;const e=this.cancellationPersistenceService.getFormModelFromStore();this.cancellationViewService.setFormModelToView(e),this.user.Valid&&this.cancellationPersistenceService.setUserModelToStore(this.user),this.cancellationViewService.addListeners(this.viewChangeListener.bind(this)),this.initFormListeners()})}initFormListeners(){const e=$(this.options.$ctx),t=e.find(".js-edit, .js-abort"),i=e.find(".js-next-step");this.user.Valid&&t.on("click",this.toggleEditMode.bind(this)),i.on("click",this.submitStep.bind(this))}viewChangeListener(){c.Helper.scheduleTask(()=>{const e=this.cancellationViewService.getFormModelFromView(this.cancellationPersistenceService.getFormModelFromStore());this.cancellationPersistenceService.setFormModelToStore(e)},"background")}useV2(){return this.options.app.usev2backend}}class se{validationService;parent;options;loader;cancellationPersistenceService;cancellationViewService;cancellationStepService;cancellationRouterService;user;constructor(e,t,i,r){this.parent=e,this.options=t,this.loader=i,this.cancellationPersistenceService=new U(t),this.cancellationViewService=new W(this,t,i,r),this.cancellationStepService=new ie(t),this.cancellationRouterService=new X(t),this.user=r}start(){this.cancellationStepService.StepId?this.cancellationViewService.render(this.getViewConfig()):this.cancellationRouterService.back()}getViewConfig(){return{data:this.getReasonViewOptions(),templateurl:this.options.app.currenttemplate.templateurl,campaignurls:this.options.app.campaignurls,parent:this,$ctx:this.options.$ctx,options:this.options,callback:this.afterRenderApp}}initListeners(){const e=$(this.options.$ctx),t=e.find(".js-next-step"),i=e.find(".js-discard"),r=e.find(".js-back");this.cancellationStepService.determinePageReload(),$(window).on("pagehide",this.unload.bind(this)),i.on("click",this.discard.bind(this)),t.on("click",this.submitStep.bind(this)),r.on("click",this.stepBack.bind(this)),c.View.initFormElements(),S.Globals.lazyloadertx.init()}unload(){this.cancellationStepService.closingWindowUnload()}stepBack(e){e.preventDefault(),this.cancellationStepService.IsClosingWindow=!1,this.cancellationRouterService.back()}discard(e){e.preventDefault(),this.cancellationStepService.IsClosingWindow=!1,this.cancellationStepService.discardCancellation()}submitStep(e){e.preventDefault(),this.cancellationStepService.IsClosingWindow=!1,this.validationService.isValid()&&this.cancellationStepService.nextStep()}getReasonViewOptions(){const e=this.user.Valid?this.user:{};return{FormModel:this.cancellationPersistenceService.getFormModelFromStore(),prevurl:this.options.app.prevurl||"",discardurl:this.options.app.discardcancellationurl||"",cancellationTracking:this.options.app.campaignurls.cancellationtracking,User:e}}afterRenderApp(){this.loader.loadSubApps({options:this.options},()=>{this.parent.afterRenderApp(),this.validationService=new _({options:this.options},this.cancellationViewService.getForm()),this.cancellationPersistenceService.prepareApplicationSession(),this.cancellationStepService.pageStatus=2;const e=this.cancellationPersistenceService.getReasonModelFromStore();this.cancellationViewService.setReasonModelToView(e),this.cancellationViewService.addListeners(this.viewChangeListener.bind(this)),this.initListeners()})}viewChangeListener(){c.Helper.scheduleTask(()=>{const e=this.cancellationViewService.getReasonModelFromView();this.cancellationPersistenceService.setReasonModelToStore(e)},"background")}}class ne{validationService;parent;options;loader;cancellationPersistenceService;cancellationViewService;cancellationStepService;cancellationRouterService;user;constructor(e,t,i,r){this.parent=e,this.options=t,this.loader=i,this.cancellationPersistenceService=new U(t),this.cancellationViewService=new W(this,t,i,r),this.cancellationStepService=new ie(t),this.cancellationRouterService=new X(t),this.user=r}start(){this.cancellationStepService.StepId?this.cancellationViewService.render(this.getViewConfig()):this.cancellationRouterService.back()}getViewConfig(){return{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}}initListeners(){this.cancellationStepService.determinePageReload(),c.View.initFormElements(),S.Globals.lazyloadertx.init()}getViewOptions(){let e=this.options.app.campaignurls.cancellationtracking?this.options.app.campaignurls.cancellationtracking[0]:"";const t=this.user.Valid?this.user:{},i=this.cancellationPersistenceService.getFormModelFromStore(),r=this.cancellationPersistenceService.getReasonModelFromStore(),s=this.cancellationPersistenceService.getRouteFromStore();return""!==e&&(e=this.setReasonToTrackingParameters(r.Grund,e)),{prevurl:this.options.app.prevurl||"",discardurl:this.options.app.discardcancellationurl||"",cancellationTracking:e,FormModel:i,Anschrift:i.Anschrift,ReasonModel:r,Routes:s,User:t}}setReasonToTrackingParameters(e,t){const i={subid3:e};return c.Url.updateUrlParameter(i,t)}afterRenderApp(){this.loader.loadSubApps({options:this.options},()=>{this.parent.afterRenderApp(),this.validationService=new _({options:this.options},this.cancellationViewService.getForm()),this.cancellationPersistenceService.prepareApplicationSession(),this.cancellationViewService.setSuccessModelToView(this.cancellationPersistenceService.getReasonModelFromStore()),this.cancellationStepService.pageStatus=4,this.cancellationStepService.ValidationService=this.validationService,this.initListeners(),this.cancellationPersistenceService.clearPersistence()})}}class ae{parent;options;loader;cancellationPersistenceService;cancellationViewService;cancellationStepService;cancellationRouterService;user;constructor(e,t,i,r){this.parent=e,this.options=t,this.loader=i,this.cancellationPersistenceService=new U(t),this.cancellationViewService=new W(this,t,i,r),this.cancellationStepService=new ie(t),this.cancellationRouterService=new X(t),this.user=r}start(){this.cancellationStepService.StepId?this.cancellationViewService.render(this.getViewConfig()):this.cancellationRouterService.back()}getViewConfig(){return{data:this.getMemberBenefitsViewOptions(),templateurl:this.options.app.currenttemplate.templateurl,campaignurls:this.options.app.campaignurls,parent:this,$ctx:this.options.$ctx,options:this.options,callback:this.afterRenderApp}}getMemberBenefitsViewOptions(){const e=this.user.Valid?this.user:{};return{prevurl:this.options.app.prevurl||"",discardurl:this.options.app.discardcancellationurl||"",cancellationTracking:this.options.app.campaignurls.cancellationtracking,User:e}}initListeners(){const e=$(this.options.$ctx),t=e.find(".js-next-step"),i=e.find(".js-discard"),r=e.find(".js-back"),s=e.find(".js-member-benefits");this.cancellationStepService.determinePageReload(),$(window).on("pagehide",this.unload.bind(this)),i.on("click",this.discard.bind(this)),t.on("click",this.submitStep.bind(this)),r.on("click",this.stepBack.bind(this)),s.on("click",this.setBenefitsId.bind(this)),c.View.initFormElements(),S.Globals.lazyloadertx.init()}unload(){this.cancellationStepService.closingWindowUnload()}stepBack(e){e.preventDefault(),this.cancellationStepService.IsClosingWindow=!1,this.cancellationRouterService.back()}discard(e){e.preventDefault(),this.cancellationStepService.IsClosingWindow=!1,this.cancellationStepService.discardCancellation()}setBenefitsId(e){e.preventDefault();const t=this.cancellationPersistenceService.getMemeberBenefitsModelFromStore(),i=$(e.currentTarget).data("member-benfits");t.MemberBenefitsIds||(t.MemberBenefitsIds=new Array),0!==t.MemberBenefitsIds.indexOf(i)&&(t.MemberBenefitsIds.push(i),this.cancellationPersistenceService.setMemeberBenefitsModelToStore(t))}submitStep(e){e.preventDefault(),this.cancellationStepService.IsClosingWindow=!1,this.cancellationStepService.nextStep()}afterRenderApp(){this.loader.loadSubApps({options:this.options},()=>{this.parent.afterRenderApp(),this.cancellationPersistenceService.prepareApplicationSession(),this.cancellationStepService.pageStatus=3,this.initListeners()})}}class oe{validationService;parent;options;loader;cancellationPersistenceService;cancellationViewService;cancellationStepService;cancellationRouterService;user;captchaService;constructor(e,t,i,r){this.parent=e,this.options=t,this.loader=i,this.cancellationPersistenceService=new U(t),this.cancellationViewService=new W(this,t,i,r),this.cancellationStepService=new ie(t),this.cancellationRouterService=new X(t),this.user=r}start(){this.cancellationStepService.StepId?this.cancellationViewService.render(this.getViewConfig()):this.cancellationRouterService.back()}getViewConfig(){return{data:this.getOverviewViewOptions(),templateurl:this.options.app.currenttemplate.templateurl,campaignurls:this.options.app.campaignurls,parent:this,$ctx:this.options.$ctx,options:this.options,callback:this.afterRenderApp}}initListeners(){const e=$(this.options.$ctx),t=e.find(".js-submit"),i=e.find(".js-dialog"),r=e.find(".js-discard"),s=e.find(".js-back");this.cancellationStepService.determinePageReload(),$(window).on("pagehide",this.unload.bind(this)),i.magnificPopup({fixedContentPos:!0,callbacks:{beforeOpen:function(){$(this.st.el[0].hash).addClass("ll-lightbox-inner mfp-with-anim"),this.st.mainClass=`${this.st.el.attr("data-effect")} l-lightbox`}}}),r.on("click",this.discard.bind(this)),t.on("click",this.submitCancellation.bind(this)),s.on("click",this.stepBack.bind(this)),c.View.initFormElements(),S.Globals.lazyloadertx.init()}unload(){this.cancellationStepService.closingWindowUnload()}stepBack(e){e.preventDefault(),this.cancellationStepService.IsClosingWindow=!1,this.cancellationRouterService.back()}discard(e){e.preventDefault(),this.cancellationStepService.IsClosingWindow=!1,this.cancellationStepService.discardCancellation()}submitCancellation(e){e.preventDefault(),$.magnificPopup.instance.isOpen&&$.magnificPopup.close(),this.cancellationStepService.IsClosingWindow=!1;const t=!0===this.captchaService?.isCaptchaValid();if(!this.user.Valid&&t||this.user.Valid){const e=this.cancellationPersistenceService.getFormModelFromStore();e.UserValid=this.user.Valid,this.cancellationPersistenceService.setFormModelToStore(e),this.cancellationStepService.submit()}}getOverviewViewOptions(){let e=this.options.app.campaignurls.cancellationtracking?this.options.app.campaignurls.cancellationtracking[0]:"";const t=this.user.Valid?this.user:{},i=this.cancellationPersistenceService.getFormModelFromStore(),r=this.cancellationPersistenceService.getReasonModelFromStore(),s=this.cancellationPersistenceService.getMemeberBenefitsModelFromStore(),n=this.cancellationPersistenceService.getRouteFromStore();return""!==e&&(e=this.setReasonToTrackingParameters(r.Grund,e)),{prevurl:this.options.app.prevurl||"",discardurl:this.options.app.discardcancellationurl||"",cancellationTracking:e,FormModel:i,ReasonModel:r,MemberBenefitsModel:s,Routes:n,User:t,FriendlyCaptchaSitekey:this.options.app.friendlycaptchasitekey||""}}setReasonToTrackingParameters(e,t){const i={subid3:e};return c.Url.updateUrlParameter(i,t)}afterRenderApp(){this.loader.loadSubApps({options:this.options},()=>{this.parent.afterRenderApp(),this.validationService=new _({options:this.options},this.cancellationViewService.getForm()),this.cancellationPersistenceService.prepareApplicationSession(),this.cancellationStepService.pageStatus=4,this.cancellationStepService.ValidationService=this.validationService,!this.user.Valid&&this.options.app.friendlycaptchasitekey&&(this.captchaService=new te(()=>this.cancellationPersistenceService.getFormModelFromStore(),e=>this.cancellationPersistenceService.setFormModelToStore(e),e=>this.cancellationViewService.toggleSubmitButton(e)),this.captchaService.registerCaptchaHandler(this.cancellationViewService.getForm())),this.initListeners()})}}class le{stepController;loader;options;$ctx;applicationService;userService;constructor(e,i,r){this.loader=r,this.options=$.extend(!0,{},E,i),this.$ctx=this.options.$ctx,this.applicationService=new t(this.options),this.userService=new F}start(){this.callDependencyLoader()}callDependencyLoader(){this.loader._loadDependencies(this.initApplication.bind(this))}initApplication(){c.View.startLoader(),this.userService.getUser(e=>{this.applicationService.isStep(0)?(this.stepController=new re(this,this.options,this.loader,e),this.stepController.start()):this.applicationService.isStep(1)?(this.stepController=new se(this,this.options,this.loader,e),this.stepController.start()):this.applicationService.isStep(2)?(this.stepController=new ae(this,this.options,this.loader,e),this.stepController.start()):this.applicationService.isStep(3)?(this.stepController=new oe(this,this.options,this.loader,e),this.stepController.start()):this.applicationService.isStep(4)&&(this.stepController=new ne(this,this.options,this.loader,e),this.stepController.start())})}afterRenderApp(){this.loader.initAdditionalModules(this.$ctx),c.View.stopLoader(),this.loader.complete()}}window.InstanceCollection=window.InstanceCollection||{};const he=window.$jq||jQuery.noConflict();he.ADAC||(he.ADAC={}),window.$=jQuery;const ce="MembershipCancellationApplication",de=`ADAC_${ce}`;he.ADAC[ce]=function(e,t,i){this.tid=t.app.tid,this.element=e,this.loader=i,this.options=t,this.options.$jq=he,this.$ctx=this.options.$ctx,this._name=ce,window.InstanceCollection[ce]=this,this.application=new le(this.element,this.options,this.loader),this.application.start()},he.fn[de]=function(e,t){return this.each(function(){he.data(this,de)||he.data(this,de,new he.ADAC[ce](this,e,t))})}})();
//# sourceMappingURL=/api/apps/mgl/mglcancellation/dist/app.bundle.min.js.map