1"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[60746],{746:(e,t,n)=>{n.r(t),n.d(t,{COOKIE_CONFIGURATION_CLOSE_OFF_CANVAS:()=>h,COOKIE_CONFIGURATION_UPDATE:()=>c,default:()=>f});var i=n(4335),o=n(1452),s=n(8948),a=n(6105),l=n(9068),r=n(3343);let c="CookieConfiguration_Update",h="CookieConfiguration_CloseOffCanvas";class f extends i.A{static #e=this.lastTriggerElement=null;static #t=this.options={offCanvasPosition:"left",submitEvent:"click",cookiePreference:"cookie-preference",cookieSelector:"[data-cookie]",buttonOpenSelector:".js-cookie-configuration-button button",buttonSubmitSelector:".js-offcanvas-cookie-submit",buttonAcceptAllSelector:".js-offcanvas-cookie-accept-all",globalButtonAcceptAllSelector:".js-cookie-accept-all-button",parentInputSelector:".offcanvas-cookie-parent-input",customLinkSelector:`[href="${window.router["frontend.cookie.offcanvas"]}"]`,entriesActiveClass:"offcanvas-cookie-entries--active",entriesClass:"offcanvas-cookie-entries",groupClass:"offcanvas-cookie-group",parentInputClass:"offcanvas-cookie-parent-input",consentAcceptButtonSelector:".js-wishlist-cookie-accept",consentLoginButtonSelector:".js-wishlist-login",consentCancelButtonSelector:".js-wishlist-cookie-offcanvas-cancel",consentPreferencesButtonSelector:".js-wishlist-cookie-preferences"};init(){this.lastState={active:[],inactive:[]},this._httpClient=new l.A,this._registerEvents(),document.$emitter.subscribe("CookieConfiguration/requestConsent",e=>{e instanceof CustomEvent&&(e=e.detail),this.openRequestConsentOffCanvas(e.route,e.cookieName)})}_registerEvents(){let{submitEvent:e,buttonOpenSelector:t,customLinkSelector:n,globalButtonAcceptAllSelector:i}=this.options;Array.from(document.querySelectorAll(t)).forEach(t=>{t.addEventListener(e,this.openOffCanvas.bind(this))}),Array.from(document.querySelectorAll(n)).forEach(t=>{t.addEventListener(e,this._handleCustomLink.bind(this))}),Array.from(document.querySelectorAll(i)).forEach(t=>{t.addEventListener(e,this._acceptAllCookiesFromCookieBar.bind(this))})}_registerOffCanvasEvents(){let{submitEvent:e,buttonSubmitSelector:t,buttonAcceptAllSelector:n}=this.options,i=this._getOffCanvas();if(i){let s=i.querySelector(t),a=i.querySelector(n),l=Array.from(i.querySelectorAll('input[type="checkbox"]'));s&&s.addEventListener(e,this._handleSubmit.bind(this,o.A)),a&&a.addEventListener(e,this._acceptAllCookiesFromOffCanvas.bind(this,o.A)),l.forEach(t=>{t.addEventListener(e,this._handleCheckbox.bind(this))})}}_handleCustomLink(e){e.preventDefault(),this.openOffCanvas()}_handleUpdateListener(e,t){let n=this._getUpdatedCookies(e,t);document.$emitter.publish(c,n)}_getUpdatedCookies(e,t){let{lastState:n}=this,i={};return e.forEach(e=>{n.inactive.includes(e)&&(i[e]=!0)}),t.forEach(e=>{n.active.includes(e)&&(i[e]=!1)}),i}openOffCanvas(e){let{offCanvasPosition:t}=this.options,n=window.router["frontend.cookie.offcanvas"];this._hideCookieBar(),s.A.open(n,!1,this._onOffCanvasOpened.bind(this,e),t)}closeOffCanvas(e){s.A.close(),"function"==typeof e&&e()}_onOffCanvasOpened(e){this._registerOffCanvasEvents(),this._setInitialState(),this._setInitialOffcanvasState(),PluginManager.initializePlugins(),"function"==typeof e&&e()}_hideCookieBar(){let e=PluginManager.getPluginInstances("CookiePermission");e&&e[0]&&(e[0]._hideCookieBar(),e[0]._removeBodyPadding())}openRequestConsentOffCanvas(e,t){e&&t&&(f.lastTriggerElement=document.activeElement,s.A.open(e,!1,()=>{window.PluginManager.initializePlugins();let e=document.querySelector(".offcanvas");e&&this._registerConsentOffcanvasEvents(e,t)},"left"))}_registerConsentOffcanvasEvents(e,t){let{consentAcceptButtonSelector:n,consentLoginButtonSelector:i,consentCancelButtonSelector:o,consentPreferencesButtonSelector:s}=this.options,a=e.querySelector(n);a&&a.addEventListener("click",this._onAccept.bind(this,t));let l=e.querySelector(i);l&&l.addEventListener("click",this._onLogin.bind(this));let r=e.querySelector(o);r&&r.addEventListener("click",this._onCancel.bind(this));let c=e.querySelector(s);c&&c.addEventListener("click",this._onPreferences.bind(this))}_setInitialState(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=e||this._getCookies("all"),n=[],i=[];
1t.forEach(e=>{let{cookie:t,required:s}=e;o.A.getItem(t)||s?n.push(t):i.push(t)}),this.lastState={active:n,inactive:i}}_setInitialOffcanvasState(){let e=this.lastState.active,t=this._getOffCanvas();e.forEach(e=>{let n=t.querySelector(`[data-cookie="${e}"]`);n.checked=!0,this._childCheckboxEvent(n)})}_handleCheckbox(e){let{parentInputClass:t}=this.options,{target:n}=e;(n.classList.contains(t)?this._parentCheckboxEvent:this._childCheckboxEvent).call(this,n)}_findParentEl(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;for(;e&&!e.classList.contains(n);){if(e.classList.contains(t))return e;e=e.parentElement}return null}_isChecked(e){return!!e.checked}_parentCheckboxEvent(e){let{groupClass:t}=this.options,n=this._isChecked(e),i=this._findParentEl(e,t);this._toggleWholeGroup(n,i)}_childCheckboxEvent(e){let{groupClass:t}=this.options,n=this._isChecked(e),i=this._findParentEl(e,t);this._toggleParentCheckbox(n,i)}_toggleWholeGroup(e,t){Array.from(t.querySelectorAll("input")).forEach(t=>{t.checked=e})}_toggleParentCheckbox(e,t){let{parentInputSelector:n}=this.options,i=Array.from(t.querySelectorAll(`input:not(${n})`)),o=Array.from(t.querySelectorAll(`input:not(${n}):checked`));if(i.length>0){let e=t.querySelector(n);if(e){let t=o.length>0,n=t&&o.length!==i.length;e.checked=t,e.indeterminate=n}}}_handleSubmit(){let e=this._getCookies("active"),t=this._getCookies("inactive"),{cookiePreference:n}=this.options,i=[],s=[];t.forEach(e=>{let{cookie:t}=e;s.push(t),o.A.getItem(t)&&o.A.removeItem(t)}),e.forEach(e=>{let{cookie:t,value:n,expiration:s}=e;i.push(t),t&&n&&o.A.setItem(t,n,s)}),o.A.setItem(n,"1","30"),this._handleUpdateListener(i,s),this.closeOffCanvas(document.$emitter.publish(h))}acceptAllCookies(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!e){this._handleAcceptAll(),this.closeOffCanvas();return}r.A.create(this.el),fetch(window.router["frontend.cookie.offcanvas"],{headers:{"X-Requested-With":"XMLHttpRequest"}}).then(e=>e.text()).then(e=>{let t=new DOMParser().parseFromString(e,"text/html");this._handleAcceptAll(t),r.A.remove(this.el),this._hideCookieBar()})}_acceptAllCookiesFromCookieBar(){return this.acceptAllCookies(!0)}_acceptAllCookiesFromOffCanvas(){return this.acceptAllCookies()}_handleAcceptAll(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=this._getCookies("all",e);this._setInitialState(t);let{cookiePreference:n}=this.options;t.forEach(e=>{let{cookie:t,value:n,expiration:i}=e;t&&n&&o.A.setItem(t,n,i)}),o.A.setItem(n,"1","30"),this._handleUpdateListener(t.map(e=>{let{cookie:t}=e;return t}),[])}_getCookies(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"all",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,{cookieSelector:n}=this.options;return t||(t=this._getOffCanvas()),Array.from(t.querySelectorAll(n)).filter(t=>{switch(e){case"all":return!0;case"active":return this._isChecked(t);case"inactive":return!this._isChecked(t);default:return!1}}).map(e=>{let{cookie:t,cookieValue:n,cookieExpiration:i,cookieRequired:o}=e.dataset;return{cookie:t,value:n,expiration:i,required:o}})}_getOffCanvas(){let e=a.A?a.A.getOffCanvas():[];return!!e&&e.length>0&&e[0]}_onAccept(e){o.A.setItem(e,"1",30),s.A.close()}_onLogin(){s.A.close(),window.location.href=window.router["frontend.account.login.page"]}_onCancel(){s.A.close()}_onPreferences(e){e.preventDefault(),s.A.close(),this.openOffCanvas(()=>{let e=document.querySelector(".offcanvas");e&&e.addEventListener("hidden.bs.offcanvas",this._restoreFocus.bind(this),{once:!0})})}_restoreFocus(){let e=f.lastTriggerElement;e&&e.focus&&e.focus()}}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.