1"use strict";(self.webpackChunkMGDBaseTheme=self.webpackChunkMGDBaseTheme||[]).push([[3882],{3882:(t,e,r)=>{r.r(e),r.d(e,{default:()=>h});var s=r(3107);class o{static isSupported(){return"undefined"!==document.cookie}static setItem(t,e,r){if(null==t)throw Error("You must specify a key to set a cookie");let s=new Date;s.setTime(s.getTime()+864e5*r);let o="";"https:"===location.protocol&&(o="secure"),document.cookie="".concat(t,"=").concat(e,";expires=").concat(s.toUTCString(),";path=/;sameSite=lax;").concat(o)}static getItem(t){if(!t)return!1;let e=t+"=",r=document.cookie.split(";");for(let t=0;t<r.length;t++){let s=r[t];for(;" "===s.charAt(0);)s=s.substring(1);if(0===s.indexOf(e))return s.substring(e.length,s.length)}return!1}static removeItem(t){document.cookie="".concat(t,"= ; expires = Thu, 01 Jan 1970 00:00:00 GMT;path=/")}static key(){return""}static clear(){}}class i{setItem(t,e){return this._storage[t]=e}getItem(t){return Object.prototype.hasOwnProperty.call(this._storage,t)?this._storage[t]:null}removeItem(t){return delete this._storage[t]}key(t){return Object.values(this._storage)[t]||null}clear(){return this._storage={}}constructor(){this._storage={}}}class n{_chooseStorage(){return n._isSupported("localStorage")?this._storage=window.localStorage:n._isSupported("sessionStorage")?this._storage=window.sessionStorage:o.isSupported()?this._storage=o:this._storage=new i}static _isSupported(t){try{let e="__storage_test";return window[t].setItem(e,"1"),window[t].removeItem(e),!0}catch(t){return!1}}_validateStorage(){if("function"!=typeof this._storage.setItem)throw Error('The storage must have a "setItem" function');if("function"!=typeof this._storage.getItem)throw Error('The storage must have a "getItem" function');if("function"!=typeof this._storage.removeItem)throw Error('The storage must have a "removeItem" function');if("function"!=typeof this._storage.key)throw Error('The storage must have a "key" function');if("function"!=typeof this._storage.clear)throw Error('The storage must have a "clear" function')}getStorage(){return this._storage}constructor(){this._storage=null,this._chooseStorage(),this._validateStorage()}}let a=Object.freeze(new n).getStorage(),{PluginBaseClass:c}=window;class h extends c{init(){this._client=new s.Z,this.insertStoredContent(),this.registerEvents(),window.location.pathname.includes("/checkout/cart")?this.fetch():this.checkStoredContentValidity()}insertStoredContent(){a.setItem(this.options.emptyCartWidgetStorageKey,this.el.innerHTML);let t=a.getItem(this.options.cartWidgetStorageKey);t&&(this.el.innerHTML=t),this.$emitter.publish("insertStoredContent")}registerEvents(){document.$emitter.subscribe("afterAddLineItem",this.fetch.bind(this)),document.$emitter.subscribe("afterRemoveLineItem",this.fetch.bind(this)),document.$emitter.subscribe("cartItemQuantityChanged",this.fetch.bind(this)),document.$emitter.subscribe("formAjaxSubmitSuccess",this.fetch.bind(this))}checkStoredContentValidity(){let t=a.getItem(this.options.cartWidgetTimestampKey),e=Math.floor(Date.now()/1e3);(!t||e-t>this.options.maxCacheAge)&&this.fetch()}fetch(){this._client.get(window.router["frontend.checkout.info"],(t,e)=>{if(e.status>=500)return;let r=Math.floor(Date.now()/1e3);if(a.setItem(this.options.cartWidgetTimestampKey,r),204===e.status){a.removeItem(this.options.cartWidgetStorageKey);let t=a.getItem(this.options.emptyCartWidgetStorageKey);t&&(this.el.innerHTML=t);return}a.setItem(this.options.cartWidgetStorageKey,t),this.el.innerHTML=t,this.$emitter.publish("fetch",{content:t})})}}h.options={cartWidgetStorageKey:"cart-widget-template",cartWidgetTimestampKey:"cart-widget-timestamp",emptyCartWidgetStorageKey:"empty-cart-widget",maxCacheAge:3600}},3107:(t,e,r)=>{r.d(e,{Z:()=>s});class s{get(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"application/json",s=this._createPreparedRequest("GET",t,r);return this._sendRequest(s,null,e)}post(t,e,r){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"application/json";s=this._getContentType(e,s);let o=this._createPreparedRequest("POST",t,s);return this._sendRequest(o,e,r)}delete(t,e,r){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"application/json";s=this._getContentType(e,s);let o=this._createPreparedRequest("DELETE",t,s);return this._sendRequest(o,e,r)}patch(t,e,r){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"application/json";s=this._getContentType(e,s);let o=this._createPreparedRequest("PATCH",t,s);return this._sendRequest(o,e,r)}
1abort(){if(this._request)return this._request.abort()}setErrorHandlingInternal(t){this._errorHandlingInternal=t}_registerOnLoaded(t,e){e&&(!0===this._errorHandlingInternal?(t.addEventListener("load",()=>{e(t.responseText,t)}),t.addEventListener("abort",()=>{console.warn("the request to ".concat(t.responseURL," was aborted"))}),t.addEventListener("error",()=>{console.warn("the request to ".concat(t.responseURL," failed with status ").concat(t.status))}),t.addEventListener("timeout",()=>{console.warn("the request to ".concat(t.responseURL," timed out"))})):t.addEventListener("loadend",()=>{e(t.responseText,t)}))}_sendRequest(t,e,r){return this._registerOnLoaded(t,r),t.send(e),t}_getContentType(t,e){return t instanceof FormData&&(e=!1),e}_createPreparedRequest(t,e,r){return this._request=new XMLHttpRequest,this._request.open(t,e),this._request.setRequestHeader("X-Requested-With","XMLHttpRequest"),r&&this._request.setRequestHeader("Content-type",r),this._request}constructor(){this._request=null,this._errorHandlingInternal=!1}}}}]);
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.