1"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[1140],{1140:(t,e,i)=>{i.r(e),i.d(e,{default:()=>o});class r{static serialize(t){let e=!(arguments.length>1)||void 0===arguments[1]||arguments[1];if("FORM"!==t.nodeName){if(e)throw Error("The passed element is not a form!");return{}}return new FormData(t)}static serializeJson(t){let e=!(arguments.length>1)||void 0===arguments[1]||arguments[1],i=r.serialize(t,e);if(!(i instanceof FormData)&&0===Object.keys(i).length||i instanceof FormData&&0===Array.from(i.entries()).length)return{};let n={};for(let[t,e]of i.entries())n[t]=e;return n}}var n=i(5683);class s extends n.A{constructor(t,e="before"){super(t,e),this._isValidElement()||console.warn(`[ButtonLoadingIndicatorUtil] Parent element is not of type <button> or <a>. Given element: ${this.parent}`)}create(){if(!this._isValidElement()){console.warn(`[ButtonLoadingIndicatorUtil] Unable to create loading indicator. Parent element is not of type <button> or <a>. Given element: ${this.parent}`);return}if("inner"===this.position){let t=this.parent.getBoundingClientRect().width;this.parent.style.width=`${t}px`}super.create(),this.parent.classList.add(`is-loading-indicator-${this.position}`),this._isButtonElement()?this.parent.disabled=!0:this._isAnchorElement()&&this.parent.classList.add("disabled")}remove(){if(!this.exists()){console.warn(`[ButtonLoadingIndicatorUtil] Unable to remove loading indicator. No indicator present on given element: ${this.parent}`);return}"inner"===this.position&&(this.parent.style.width="auto"),super.remove(),this.parent.classList.remove(`is-loading-indicator-${this.position}`),this._isButtonElement()?this.parent.disabled=!1:this._isAnchorElement()&&this.parent.classList.remove("disabled")}_isValidElement(){return this._isButtonElement()||this._isAnchorElement()}_isButtonElement(){return this.parent?.tagName.toLowerCase()==="button"}_isAnchorElement(){return this.parent?.tagName.toLowerCase()==="a"}}class o extends window.PluginBaseClass{static #t=this.options={redirectSelector:'[name="redirectTo"]',redirectParamSelector:'[data-redirect-parameters="true"]',redirectTo:"frontend.cart.offcanvas",payPalExpressCheckoutSelector:"[data-swag-paypal-express-button]"};init(){if(this.el.querySelector(this.options.payPalExpressCheckoutSelector)){this.el.setAttribute("data-add-to-cart","true"),window.PluginManager.initializePlugin("AddToCart",this.el);return}if(this._getForm(),!this._form)throw Error(`No form found for the plugin: ${this.constructor.name}`);this._registerEvents(),this._prepareFormRedirect(),this._preventOffcanvas()&&(this.headerCartButton=document.querySelector(".header-cart-btn"),this.buyButton=this._form.querySelector(".btn-buy"),this.initialBuyButtonContent=this.buyButton.innerHTML,this.loader=new s(this.buyButton))}_registerEvents(){this.el.addEventListener("submit",this._formSubmit.bind(this))}_formSubmit(t){t.preventDefault();let e=this._form.getAttribute("action"),i=r.serialize(this._form);this.$emitter.publish("beforeFormSubmit"),this._preventOffcanvas()?(this.loader.create(),fetch(e.toLowerCase(),{method:"POST",body:i,header:{"X-Requested-With":"XMLHttpRequest"}}).then(t=>t.text()).then(this._updateCart.bind(this))):this._openOffCanvasCarts(e,i)}_updateCart(t){if(this.loader.remove(),!t){this._createFailureIcon();return}fetch(window.router["frontend.checkout.info"],{header:{"X-Requested-With":"XMLHttpRequest"}}).then(t=>t.text()).then(t=>{if(!this.headerCartButton){this._createFailureIcon();return}let e=document.createElement("div");if(e.innerHTML=t,this.headerCartButton.innerHTML.trim()===e.innerHTML.trim()){this._createFailureIcon();return}this.headerCartButton.innerHTML=t,this._createSuccessIcon()})}_prepareFormRedirect(){try{let t=this._form.querySelector(this.options.redirectSelector),e=this._form.querySelector(this.options.redirectParamSelector);t.value=this.options.redirectTo,e.disabled=!0}catch{}}_getForm(){this.el&&"FORM"===this.el.nodeName?this._form=this.el:this._form=this.el.closest("form")}_createSuccessIcon(){this.buyButton.innerHTML='<span class=\'icon icon-checkmark\'><svg xmlns="http://www.w3.org/2000/svg" id="meteor-icon-kit__regular-checkmark" viewBox="0 0 22 15" fill="none"><path fill-rule="evenodd" clip-rule="evenodd" d="M1.70711 6.2929C1.31658 5.90237 0.68342 5.90237 0.29289 6.2929C-0.097631 6.6834 -0.097631 7.3166 0.29289 7.7071L7.29289 14.7071C7.68342 15.0976 8.31658 15.0976 8.70711 14.7071L21.7071 1.70711C22.0976 1.31658 22.0976 0.68342 21.7071 0.29289C21.3166 -0.09763 20.6834 -0.09763 20.2929 0.29289L8 12.5858L1.70711 6.2929z" fill="#758CA3"/></svg></span>',setTimeout(()=>{this._removeIcon()},1500)}_createFailureIcon(){this.buyButton.innerHTML='<span class=\'icon icon-x\'><svg xmlns="http://www.w3.org/2000/svg" id="meteor-icon-kit__regular-times" viewBox="0 0 18 18" fill="none"><path fill-rule="evenodd" clip-rule="evenodd" d="M7.5858 9L0.29289 1.70711C-0.09763 1.31658 -0.09763 0.68342 0.29289 0.29289C0.68342 -0.09763 1.31658 -0.09763 1.70711 0.29289L9 7.5858L16.2929 0.29289C16.6834 -0.09763 17.3166 -0.09763 17.7071 0.29289C18.0976 0.68342 18.0976 1.31658 17.7071 1.70711L10.4142 9L17.7071 16.2929C18.0976 16.6834 18.0976 17.3166 17.7071 17.7071C17.3166 18.0976 16.6834 18.0976 16.2929 17.7071L9 10.4142L1.70711 17.7071C1.31658 18.0976 0.68342 18.0976 0.29289 17.7071C-0.09763 17.3166 -0.09763 16.6834 0.29289 16.2929L7.5858 9z" fill="#758CA3"/></svg></span>',setTimeout(()=>{this._removeIcon()},1500)}_removeIcon(){this.buyButton.hasAttribute("disabled")?this.loader.create():this.buyButton.innerHTML=this.initialBuyButtonContent}_openOffCanvasCarts(t,e){window.PluginManager.getPluginInstances("OffCanvasCart").forEach(i=>
1this._openOffCanvasCart(i,t,e))}_openOffCanvasCart(t,e,i){t.openOffCanvas(e,i,()=>{this.$emitter.publish("openOffCanvasCart")})}_preventOffcanvas(){return this.cart=document.querySelector("[data-zen-off-canvas-prevent-on-add-to-cart]")}}},5683:(t,e,i)=>{i.d(e,{A:()=>s});let r="loader",n={BEFORE:"before",INNER:"inner"};class s{constructor(t,e=n.BEFORE){this.parent=t instanceof Element?t:document.body.querySelector(t),this.position=e}create(){if(!this.exists()){if(this.position===n.INNER){this._previousHTML=this.parent.innerHTML,this.parent.innerHTML=s.getTemplate();return}this.parent.insertAdjacentHTML(this._getPosition(),s.getTemplate())}}remove(){if(this.position===n.INNER){this.parent.innerHTML=this._previousHTML;return}this.parent.querySelectorAll(`.${r}`).forEach(t=>t.remove())}exists(){return this.parent.querySelectorAll(`.${r}`).length>0}_getPosition(){return this.position===n.BEFORE?"afterbegin":"beforeend"}static getTemplate(){return`<div class="${r}" role="status"> 2 <span class="visually-hidden">Loading...</span> 3 </div>`}static SELECTOR_CLASS(){return r}}}}]);
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.