1"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[29323],{156:t=>{var e=function(t){var e;return!!t&&"object"==typeof t&&"[object RegExp]"!==(e=Object.prototype.toString.call(t))&&"[object Date]"!==e&&t.$$typeof!==i},i="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function r(t,e){return!1!==e.clone&&e.isMergeableObject(t)?a(Array.isArray(t)?[]:{},t,e):t}function s(t,e,i){return t.concat(e).map(function(t){return r(t,i)})}function n(t){return Object.keys(t).concat(Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t).filter(function(e){return Object.propertyIsEnumerable.call(t,e)}):[])}function o(t,e){try{return e in t}catch(t){return!1}}function a(t,i,l){(l=l||{}).arrayMerge=l.arrayMerge||s,l.isMergeableObject=l.isMergeableObject||e,l.cloneUnlessOtherwiseSpecified=r;var d,c,u=Array.isArray(i);return u!==Array.isArray(t)?r(i,l):u?l.arrayMerge(t,i,l):(c={},(d=l).isMergeableObject(t)&&n(t).forEach(function(e){c[e]=r(t[e],d)}),n(i).forEach(function(e){(!o(t,e)||Object.hasOwnProperty.call(t,e)&&Object.propertyIsEnumerable.call(t,e))&&(o(t,e)&&d.isMergeableObject(i[e])?c[e]=(function(t,e){if(!e.customMerge)return a;var i=e.customMerge(t);return"function"==typeof i?i:a})(e,d)(t[e],i[e],d):c[e]=r(i[e],d))}),c)}a.all=function(t,e){if(!Array.isArray(t))throw Error("first argument should be an array");return t.reduce(function(t,i){return a(t,i,e)},{})},t.exports=a},154:(t,e,i)=>{i.d(e,{A:()=>r});class r{static iterate(t,e){if(t instanceof Map||Array.isArray(t))return t.forEach(e);if(t instanceof FormData){for(var i of t.entries())e(i[1],i[0]);return}if(t instanceof NodeList)return t.forEach(e);if(t instanceof HTMLCollection)return Array.from(t).forEach(e);if(t instanceof Object)return Object.keys(t).forEach(i=>{e(t[i],i)});throw Error(`The element type ${typeof t} is not iterable!`)}}},373:(t,e,i)=>{i.d(e,{A:()=>a});var r=i(156),s=i.n(r);class n{static ucFirst(t){return t.charAt(0).toUpperCase()+t.slice(1)}static lcFirst(t){return t.charAt(0).toLowerCase()+t.slice(1)}static toDashCase(t){return t.replace(/([A-Z])/g,"-$1").replace(/^-/,"").toLowerCase()}static toLowerCamelCase(t,e){let i=n.toUpperCamelCase(t,e);return n.lcFirst(i)}static toUpperCamelCase(t,e){return e?t.split(e).map(t=>n.ucFirst(t.toLowerCase())).join(""):n.ucFirst(t.toLowerCase())}static parsePrimitive(t){try{return/^\d+(.|,)\d+$/.test(t)&&(t=t.replace(",",".")),JSON.parse(t)}catch(e){return t.toString()}}}class o{constructor(t=document){this._el=t,t.$emitter=this,this._listeners=[]}publish(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=new CustomEvent(t,{detail:e,cancelable:i});return this.el.dispatchEvent(r),r}subscribe(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=this,s=t.split("."),n=i.scope?e.bind(i.scope):e;if(i.once&&!0===i.once){let e=n;n=function(i){r.unsubscribe(t),e(i)}}return this.el.addEventListener(s[0],n),this.listeners.push({splitEventName:s,opts:i,cb:n}),!0}unsubscribe(t){let e=t.split(".");return this.listeners=this.listeners.reduce((t,i)=>([...i.splitEventName].sort().toString()===e.sort().toString()?this.el.removeEventListener(i.splitEventName[0],i.cb):t.push(i),t),[]),!0}reset(){return this.listeners.forEach(t=>{this.el.removeEventListener(t.splitEventName[0],t.cb)}),this.listeners=[],!0}get el(){return this._el}set el(t){this._el=t}get listeners(){return this._listeners}set listeners(t){this._listeners=t}}class a{constructor(t,e={},i=!1){if(!(t instanceof Node)){console.warn(`There is no valid element given while trying to create a plugin instance for "${i}".`);return}this.el=t,this.$emitter=new o(this.el),this._pluginName=this._getPluginName(i),this.options=this._mergeOptions(e),this._initialized=!1,this._registerInstance(),this._init()}init(){console.warn(`The "init" method for the plugin "${this._pluginName}" is not defined. The plugin will not be initialized.`)}update(){}_init(){this._initialized||(this.init(),this._initialized=!0)}_update(){this._initialized&&this.update()}_mergeOptions(t){let e=[this.constructor.options,this.options,t];return e.push(this._getConfigFromDataAttribute()),e.push(this._getOptionsFromDataAttribute()),s().all(e.filter(t=>t instanceof Object&&!(t instanceof Array)).map(t=>t||{}))}_getConfigFromDataAttribute(){let t={};if("function"!=typeof this.el.getAttribute)return t;let e=n.toDashCase(this._pluginName),i=this.el.getAttribute(`data-${e}-config`);return i?window.PluginConfigManager.get(this._pluginName,i):t}_getOptionsFromDataAttribute(){let t={};if("function"!=typeof this.el.getAttribute)return t;let e=n.toDashCase(this._pluginName),i=this.el.getAttribute(`data-${e}-options`);if(i)try{return JSON.parse(i)}catch(t){console.error(`The data attribute "data-${e}-options" could not be parsed to json: ${t.message}`)}return t}_registerInstance(){window.PluginManager.getPluginInstancesFromElement(this.el).set(this._pluginName,this),window.PluginManager.getPlugin(this._pluginName,!1).get("instances").push(this)}_getPluginName(t){return t||(t=this.constructor.name),t}}},68:(t,e,i)=>{i.d(e,{A:()=>r});
1class r{constructor(){this._request=null,this._errorHandlingInternal=!1}get(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"application/json",r=this._createPreparedRequest("GET",t,i);return this._sendRequest(r,null,e)}post(t,e,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"application/json";r=this._getContentType(e,r);let s=this._createPreparedRequest("POST",t,r);return this._sendRequest(s,e,i)}delete(t,e,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"application/json";r=this._getContentType(e,r);let s=this._createPreparedRequest("DELETE",t,r);return this._sendRequest(s,e,i)}patch(t,e,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"application/json";r=this._getContentType(e,r);let s=this._createPreparedRequest("PATCH",t,r);return this._sendRequest(s,e,i)}abort(){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 ${t.responseURL} was aborted`)}),t.addEventListener("error",()=>{console.warn(`the request to ${t.responseURL} failed with status ${t.status}`)}),t.addEventListener("timeout",()=>{console.warn(`the request to ${t.responseURL} timed out`)})):t.addEventListener("loadend",()=>{e(t.responseText,t)}))}_sendRequest(t,e,i){return this._registerOnLoaded(t,i),t.send(e),t}_getContentType(t,e){return t instanceof FormData&&(e=!1),e}_createPreparedRequest(t,e,i){return this._request=new XMLHttpRequest,this._request.open(t,e),this._request.setRequestHeader("X-Requested-With","XMLHttpRequest"),i&&this._request.setRequestHeader("Content-type",i),this._request}}},683:(t,e,i)=>{i.d(e,{A:()=>n});let r="loader",s={BEFORE:"before",INNER:"inner"};class n{constructor(t,e=s.BEFORE){this.parent=t instanceof Element?t:document.body.querySelector(t),this.position=e}create(){if(!this.exists()){if(this.position===s.INNER){this._previousHTML=this.parent.innerHTML,this.parent.innerHTML=n.getTemplate();return}this.parent.insertAdjacentHTML(this._getPosition(),n.getTemplate())}}remove(){if(this.position===s.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===s.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}}},206:(t,e,i)=>{i.d(e,{A:()=>m});var r=i(683);class s{static isTouchDevice(){return"ontouchstart"in document.documentElement}static isIOSDevice(){return s.isIPhoneDevice()||s.isIPadDevice()}static isNativeWindowsBrowser(){return s.isIEBrowser()||s.isEdgeBrowser()}static isIPhoneDevice(){return!!navigator.userAgent.match(/iPhone/i)}static isIPadDevice(){return!!navigator.userAgent.match(/iPad/i)}static isIEBrowser(){return -1!==navigator.userAgent.toLowerCase().indexOf("msie")||!!navigator.userAgent.match(/Trident.*rv:\d+\./)}static isEdgeBrowser(){return!!navigator.userAgent.match(/Edge\/\d+/i)}static getList(){return{"is-touch":s.isTouchDevice(),"is-ios":s.isIOSDevice(),"is-native-windows":s.isNativeWindowsBrowser(),"is-iphone":s.isIPhoneDevice(),"is-ipad":s.isIPadDevice(),"is-ie":s.isIEBrowser(),"is-edge":s.isEdgeBrowser()}}}let n="modal-backdrop",o="modal-backdrop-open",a="no-scroll",l={ON_CLICK:"backdrop/onclick"};class d{constructor(){return d.instance||(d.instance=this),d.instance}create(t){this._removeExistingBackdrops(),document.body.insertAdjacentHTML("beforeend",this._getTemplate());let e=document.body.lastChild;document.documentElement.classList.add(a),setTimeout(function(){e.classList.add(o),"function"==typeof t&&t()},75),this._dispatchEvents()}remove(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:350;this._getBackdrops().forEach(t=>t.classList.remove(o)),setTimeout(this._removeExistingBackdrops.bind(this),t),document.documentElement.classList.remove(a)}_dispatchEvents(){let t=s.isTouchDevice()?"touchstart":"click";document.addEventListener(t,function(t){t.target.classList.contains(n)&&document.dispatchEvent(new CustomEvent(l.ON_CLICK))})}_getBackdrops(){return document.querySelectorAll(`.${n}`)}_removeExistingBackdrops(){!1!==this._exists()&&this._getBackdrops().forEac
3h(t=>t.remove())}_exists(){return document.querySelectorAll(`.${n}`).length>0}_getTemplate(){return`<div class="${n}"></div>`}}let c=Object.freeze(new d);class u{static create(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;c.create(t)}static remove(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:350;c.remove(t)}static SELECTOR_CLASS(){return n}}class h extends r.A{constructor(){super(document.body)}create(){let t=!(arguments.length>0)||void 0===arguments[0]||arguments[0];!this.exists()&&t&&(u.create(),document.querySelector(`.${u.SELECTOR_CLASS()}`).insertAdjacentHTML("beforeend",r.A.getTemplate()))}remove(){let t=!(arguments.length>0)||void 0===arguments[0]||arguments[0];super.remove(),t&&u.remove()}}let p=Object.freeze(new h);class m{static create(){let t=!(arguments.length>0)||void 0===arguments[0]||arguments[0];p.create(t)}static remove(){let t=!(arguments.length>0)||void 0===arguments[0]||arguments[0];p.remove(t)}}},323:(t,e,i)=>{i.r(e),i.d(e,{default:()=>l});var r=i(373),s=i(68),n=i(154),o=i(206);class a extends r.A{static #t=this.options={productItemsList:".quick-order-content-list",productItem:".quick-order-line-item",emptyItemClassName:"quick-order-empty-item",buttonConfirmAddToCart:".btn-confirm-add-to-cart",buttonAddToCart:".btn-add-to-cart",buttonRemoveList:".btn-clear-list",buttonConfirmRemove:".btn-confirm-remove",buttonUploadCSV:".btn-csv-upload",addToCartModal:".add-to-cart-modal",removeListModal:".remove-list-modal",notFoundItemsAlert:"#notFoundItemsAlert",duplicatedItemAlert:"#duplicatedItemAlert",itemAction:".quick-order-item-action",itemNameInput:".input-product-name",itemQuantityInput:".input-product-quantity",itemQuantityGroup:".line-item-quantity-group"};init(){this._addToCartModal=this.el.querySelector(this.options.addToCartModal),this._buttonAddToCart=this.el.querySelector(this.options.buttonAddToCart),this._buttonConfirmAddToCart=this.el.querySelector(this.options.buttonConfirmAddToCart),this._removeListModal=this.el.querySelector(this.options.removeListModal),this._buttonRemoveList=this.el.querySelectorAll(this.options.buttonRemoveList),this._buttonConfirmRemove=this.el.querySelector(this.options.buttonConfirmRemove),this._buttonUploadCSV=this.el.querySelector(this.options.buttonUploadCSV),this._emptyRow=this.el.querySelector(`.${this.options.emptyItemClassName}`).cloneNode(!0),this._notFoundItemsAlert=this.el.querySelector(this.options.notFoundItemsAlert).cloneNode(!0),this._duplicatedItemAlert=this.el.querySelector(this.options.duplicatedItemAlert).cloneNode(!0),this._client=new s.A,this._getBaseQuickOrder(),this._registerEvents()}_registerEvents(){this._buttonConfirmAddToCart.addEventListener("click",this._handleAddToCart.bind(this)),this._buttonConfirmRemove.addEventListener("click",this._clearList.bind(this)),document.$emitter.subscribe("QuickOrder/onProductsLoaded",this._renderProductList.bind(this)),this.$emitter.subscribe("QuickOrder/updateNotFoundProducts",this._showNotFoundItems.bind(this)),this.$emitter.subscribe("QuickOrder/updateDuplicatedItem",this._showDuplicatedItem.bind(this)),window.addEventListener("beforeunload",this._beforeUnloadListener.bind(this))}_beforeUnloadListener(t){if(!this._baseQuickOrder.products.length)return;t.preventDefault();let e=this.options.reloadPageMessage;return o.A.remove(),t.returnValue=e,e}_hideNotFoundItemsAlert(){let t=document.querySelector(this.options.notFoundItemsAlert);t&&!t.classList.contains("d-none")&&t.classList.add("d-none")}_hideDuplicatedItemAlert(){let t=document.querySelector(this.options.duplicatedItemAlert);t&&!t.classList.contains("d-none")&&t.classList.add("d-none")}_showNotFoundItems(t){let e=t.detail.notFoundProducts;if(!e.length){this._hideNotFoundItemsAlert();return}let i=document.querySelector(this.options.notFoundItemsAlert);if(!i){let t=document.querySelector(".quick-order-alert");t.appendChild(this._notFoundItemsAlert.cloneNode(!0)),i=t.querySelector(this.options.notFoundItemsAlert)}i.classList.remove("d-none"),i.querySelector(".alert-content-content").textContent=e.join(", "),i.addEventListener("closed.bs.alert",()=>{this._baseQuickOrder.updateNotFoundProducts([])})}_showDuplicatedItem(t){let e=t.detail.duplicatedItem;if(!e){this._hideDuplicatedItemAlert();return}let i=document.querySelector(this.options.duplicatedItemAlert);if(!i){let t=document.querySelector(".quick-order-alert");t.appendChild(this._duplicatedItemAlert.cloneNode(!0)),i=t.querySelector(this.options.duplicatedItemAlert)}i.classList.remove("d-none"),i.querySelector(".alert-content-content").textContent=e,i.addEventListener("closed.bs.alert",()=>{this._baseQuickOrder.updateDuplicatedItem("")})}_clearList(){this._handleRemoveList(),this._hideNotFoundItemsAlert(),this._hideDuplicatedItemAlert()}_handleRemoveList(){this._baseQuickOrder.resetProductList(),bootstrap.Modal.getInstance(this._removeListModal).hide()}_handleAddToCart(){bootstrap.Modal.getInstance(this._addToCartModal).hide(),this._confirmAddToCart()}_onAfterAjaxSubmit(){o.A.remove(),this._openOffCanvasCarts()}_openOffCanvasCarts(){let t=window.PluginManager.getPluginInstances("OffCanvasCart");n.A.iterate(t,t=>this._openOffCanvasCart(t)),this._baseQuickOrder.resetProductList()}_openOffCanvasCart(t){t.openOffCanvas(this.options.openCartOffCanvasUrl,!1,()=>{this.$emitter.publish("openOffCanvasCart")})}_convertArrayToObject(){let t={};
3return this._baseQuickOrder.products.forEach(e=>{t[e.id]={id:e.id,quantity:e.quantity,referencedId:e.id,stackable:!0,removable:!0,type:"product"}}),t}_confirmAddToCart(){o.A.create();let t=this._convertArrayToObject();this._client.post(this.options.addToCartUrl,JSON.stringify({lineItems:t}),this._onAfterAjaxSubmit.bind(this))}_renderProductList(t){let e=t.detail.products,i=this.el.querySelector(this.options.productItemsList);if(i.innerHTML="",this._resetEmptyLine(),0===e.length){this._buttonAddToCart.disabled=!0,this._buttonRemoveList.forEach(t=>{t.disabled=!0}),this._baseQuickOrder.products=[],window.PluginManager.initializePlugins();return}e.map(t=>{let e=this._emptyRow.cloneNode(!0);e.classList.remove(this.options.emptyItemClassName);let r=e.querySelector(this.options.itemNameInput),s=e.querySelector(this.options.itemQuantityInput),n=e.querySelector(this.options.itemQuantityGroup);e.querySelector(this.options.itemAction).classList.remove("d-none"),n.removeAttribute("disabled"),s.tabIndex=0,r.innerHTML=`<strong>${t.productNumber}</strong> - ${t.name}`,s.value=t.quantity,e.setAttribute("data-id",t.id),s.setAttribute("min",t.minPurchase),s.setAttribute("max",t.calculatedMaxPurchase),s.setAttribute("step",t.purchaseSteps),i.appendChild(e)}),window.PluginManager.initializePlugins(),this._buttonAddToCart.disabled=!1,this._buttonRemoveList.forEach(t=>{t.disabled=!1})}_resetEmptyLine(){this.el.querySelector(`.${this.options.emptyItemClassName}`).replaceWith(this._emptyRow.cloneNode(!0)),this.el.querySelector(`.${this.options.emptyItemClassName} ${this.options.itemNameInput}`).focus()}_getBaseQuickOrder(){this._baseQuickOrder=window.PluginManager.getPluginInstanceFromElement(document.querySelector('[data-b2b-base-quick-order="true"]'),"B2bBaseQuickOrder")}}class l extends a{init(){super.init(),this.buttonAddToList=this.el.querySelector(this.options.buttonAddToList)}_renderProductList(t){if(super._renderProductList(t),null!==this.buttonAddToList){if(0===t.detail.products.length){this.buttonAddToList.disabled=!0;return}this.buttonAddToList.disabled=!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.