"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[2189],{1422:(e,t,i)=>{i(8846);var s=i(9140),n=i(447);rx.componentLoader.register({contentSwitch:class{constructor(e,t){this.el=e,this.options=t,this.init()}init(){this.options.wcmModeEdit||this[this.options.type]()}printResource(e){this.el.innerHTML=atob(this.options.resourceMap[e]),rx.script.handleScriptsAsync(this.el)}checkAndCall(e){e&&e()}checkedRegistered(e,t){window.authSettings&&this.options.properties.claimValue?(s.authController.initialize(window.authSettings),s.authController.getClaim(this.options.properties.claimName).then((i=>{i&&("string"==typeof i&&i===this.options.properties.claimValue||Array.isArray(i)&&i.includes(this.options.properties.claimValue))?this.checkAndCall(e):this.checkAndCall(t)})).catch((()=>{this.checkAndCall(t)}))):this.checkAndCall(t)}checkedLogged(e,t){window.authSettings?(s.authController.initialize(window.authSettings),s.authController.getToken().then((t=>{this.checkAndCall(e.bind(this,t))})).catch((()=>{this.checkAndCall(t)}))):this.checkAndCall(t)}isMobileView(){return window.innerWidth<768}isMobileActive(){if(!this.options.scheduledSwitch)return!0;const e=Date.now();return this.options.startDate<e&&(0===this.options.endDate||e<this.options.endDate)}evaluateMobileView(){this.isMobileView()&&this.isMobileActive()?this.el.querySelector("#mobile-content").classList.remove("hidden"):this.el.querySelector("#default-content").classList.remove("hidden")}registerSwitch(){this.checkedRegistered(this.printResource.bind(this,"registered"),this.printResource.bind(this,"anonymous"))}headerRegisterSwitch(){this.checkedRegistered((()=>this.el.classList.add("hide")))}loggedSwitch(){this.checkedLogged(this.printResource.bind(this,"authenticated"),this.printResource.bind(this,"anonymous"))}subscribedSwitch(){this.checkedLogged((e=>{fetch(this.options.properties.snippetUrl,{credentials:"same-origin",headers:new Headers({Authorization:"bearer "+e})}).then((e=>{if(e.ok)return e.text();throw new Error("invalid status")})).then((e=>{this.el.innerHTML=e,rx.script.handleScriptsAsync(this.el)})).catch((()=>{this.printResource("notSubscribed")}))}),(()=>{this.printResource("notAuthenticated");const e=this.el.querySelector(".btn-primary");e&&e.addEventListener("click",(()=>{(0,n.hZ)(this.options.template)}))}))}mobileSwitch(){this.evaluateMobileView()}}})}},e=>{e.O(0,[5561],(()=>{return t=1422,e(e.s=t);var t}));e.O()}]);