PageSourceSearch

https://www.graf-barf.de/theme/e1b7dfb946bbb6fb2b4354509028f59f/js…st-cart-create-add-product.plugin.a471d0.js

js graf-barf.de collected 2026-10-07 00:14:14 UTC 11,256 bytes, 8 lines download raw bytes

1"use strict";(self.webpackChunkacris_price_on_request_c_s=self.webpackChunkacris_price_on_request_c_s||[]).push([[34051],{51(e,t,r){r.r(t),r.d(t,{default:()=>s});var i=r(737),n=r(997);class s extends i.A{static #e=this.options={};init(){this._domHelper=new n.A(this.el),this.formEl=this._domHelper.closest("form"),this._collectItems(),this._registerEvents();let e="acris-price-on-request::search::create::click";document.$emitter.unsubscribe(e),document.$emitter.subscribe(e,this._handleAddProduct.bind(this))}_collectItems(){this.tableBody=this._domHelper.querySelector("tbody"),this.btnRemoveItems=this._domHelper.querySelectorAll(".line-item-remove-button")}_registerEvents(){this.btnRemoveItems?.forEach(e=>{e.addEventListener("click",this._handleItemRemove.bind(this,e))})}_handleItemRemove(e,t){t.preventDefault();let r=e.closest("tr");r&&(r.remove(),this._toggleNoProductsText())}_handleAddProduct(e){let t=e.detail?.url,r=e.detail?.productId;t&&r&&this._updateListing(t,r)}_updateListing(e,t){fetch(e,{method:"POST",body:new FormData(this.formEl)}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}: ${e.statusText}`);return e.text()}).then(e=>this._handleResponse(e)).catch(e=>{console.error("AcrisRequestCartCreateAddProduct: Error adding product",e)}).finally(()=>{this._tearDown()})}_handleResponse(e){if(!e)return;let t=document.createElement("div");t.innerHTML=e;let r=t.querySelector("[data-acris-request-cart-create-add-product]");this.el.innerHTML=r.innerHTML,this._collectItems(),this._registerEvents(),this._toggleNoProductsText(),window.PluginManager.initializePlugins()}_toggleNoProductsText(){let e=this._domHelper.querySelector(".acris-request-cart-empty-row"),t=this.tableBody.querySelectorAll("tr:not(.acris-request-cart-empty-row)");e&&(0===t.length?e.classList.remove("d-none"):e.classList.add("d-none"))}_tearDown(){document.$emitter.publish("acris-price-on-request::toggle-search-suggest",{show:!1}),document.$emitter.publish("acris-price-on-request::search::create::loading",{show:!1})}}},156(e){var t=function(e){var t;return!!e&&"object"==typeof e&&"[object RegExp]"!==(t=Object.prototype.toString.call(e))&&"[object Date]"!==t&&e.$$typeof!==r},r="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function i(e,t){return!1!==t.clone&&t.isMergeableObject(e)?a(Array.isArray(e)?[]:{},e,t):e}function n(e,t,r){return e.concat(t).map(function(e){return i(e,r)})}function s(e){return Object.keys(e).concat(Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[])}function o(e,t){try{return t in e}catch(e){return!1}}function a(e,r,l){(l=l||{}).arrayMerge=l.arrayMerge||n,l.isMergeableObject=l.isMergeableObject||t,l.cloneUnlessOtherwiseSpecified=i;var u,c,d=Array.isArray(r);return d!==Array.isArray(e)?i(r,l):d?l.arrayMerge(e,r,l):(c={},(u=l).isMergeableObject(e)&&s(e).forEach(function(t){c[t]=i(e[t],u)}),s(r).forEach(function(t){(!o(e,t)||Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))&&(o(e,t)&&u.isMergeableObject(r[t])?c[t]=(function(e,t){if(!t.customMerge)return a;var r=t.customMerge(e);return"function"==typeof r?r:a})(t,u)(e[t],r[t],u):c[t]=i(r[t],u))}),c)}a.all=function(e,t){if(!Array.isArray(e))throw Error("first argument should be an array");return e.reduce(function(e,r){return a(e,r,t)},{})},e.exports=a},707(e,t,r){r.d(t,{A:()=>i});class i{static ucFirst(e){return e.charAt(0).toUpperCase()+e.slice(1)}static lcFirst(e){return e.charAt(0).toLowerCase()+e.slice(1)}static toDashCase(e){return e.replace(/([A-Z])/g,"-$1").replace(/^-/,"").toLowerCase()}static toLowerCamelCase(e,t){let r=i.toUpperCamelCase(e,t);return i.lcFirst(r)}static toUpperCamelCase(e,t){return t?e.split(t).map(e=>i.ucFirst(e.toLowerCase())).join(""):i.ucFirst(e.toLowerCase())}static parsePrimitive(e){try{return/^\d+(.|,)\d+$/.test(e)&&(e=e.replace(",",".")),JSON.parse(e)}catch(t){return e.toString()}}}},737(e,t,r){r.d(t,{A:()=>a});var i=r(156),n=r.n(i),s=r(707);class o{constructor(e=document){this._el=e,e.$emitter=this,this._listeners=[]}publish(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=new CustomEvent(e,{detail:t,cancelable:r});return this.el.dispatchEvent(i),i}subscribe(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=this,n=e.split("."),s=r.scope?t.bind(r.scope):t;if(r.once&&!0===r.once){let t=s;s=function(r){i.unsubscribe(e),t(r)}}return this.el.addEventListener(n[0],s),this.listeners.push({splitEventName:n,opts:r,cb:s}),!0}unsubscribe(e){arguments.length>1&&"function"==typeof arguments[1]&&console.warn(`[NativeEventEmitter] Unsubscribing by passing the subscriber function as a second argument is not supported. By default, all listeners for the event will be removed. Use a suffix (separated by a dot) on the event name when subscribing/unsubscribing to identify/target your specific listener only, e.g. "${e}.MyCustomPlugin"`);let t=e.split(".");return this.listeners=this.listeners.reduce((e,r)=>([...r.splitEventName].sort().toString()===t.sort().toString()?this.el.removeEventListener(r.splitEventName[0],r.cb):e.push(r),e),[]),!0}
1reset(){return this.listeners.forEach(e=>{this.el.removeEventListener(e.splitEventName[0],e.cb)}),this.listeners=[],!0}get el(){return this._el}set el(e){this._el=e}get listeners(){return this._listeners}set listeners(e){this._listeners=e}}class a{constructor(e,t={},r=!1){if(!(e instanceof Node)){console.warn(`There is no valid element given while trying to create a plugin instance for "${r}".`);return}this.el=e,this.$emitter=new o(this.el),this._pluginName=this._getPluginName(r),this.options=this._mergeOptions(t),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(){}destroy(){}_init(){this._initialized||(this.init(),this._initialized=!0)}_update(){this._initialized&&this.update()}_mergeOptions(e){let t=[this.constructor.options,this.options,e];return t.push(this._getConfigFromDataAttribute()),t.push(this._getOptionsFromDataAttribute()),n().all(t.filter(e=>e instanceof Object&&!(e instanceof Array)).map(e=>e||{}))}_getConfigFromDataAttribute(){let e={};if("function"!=typeof this.el.getAttribute)return e;let t=s.A.toDashCase(this._pluginName),r=this.el.getAttribute(`data-${t}-config`);return r?window.PluginConfigManager.get(this._pluginName,r):e}_getOptionsFromDataAttribute(){let e={};if("function"!=typeof this.el.getAttribute)return e;let t=s.A.toDashCase(this._pluginName),r=this.el.getAttribute(`data-${t}-options`);if(r)try{return JSON.parse(r)}catch(e){console.error(`The data attribute "data-${t}-options" could not be parsed to json: ${e.message}`)}return e}_registerInstance(){window.PluginManager.getPluginInstancesFromElement(this.el).set(this._pluginName,this),window.PluginManager.getPlugin(this._pluginName,!1).get("instances").push(this)}_getPluginName(e){return e||(e=this.constructor.name),e}}},795(e,t,r){r.d(t,{A:()=>n});var i=r(707);class n{static isNode(e){return"object"==typeof e&&null!==e&&(e===document||e===window||e instanceof Node)}static hasAttribute(e,t){if(!n.isNode(e))throw Error("The element must be a valid HTML Node!");return"function"==typeof e.hasAttribute&&e.hasAttribute(t)}static getAttribute(e,t){let r=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(r&&!1===n.hasAttribute(e,t))throw Error(`The required property "${t}" does not exist!`);if("function"!=typeof e.getAttribute){if(r)throw Error("This node doesn't support the getAttribute function!");return}return e.getAttribute(t)}static getDataAttribute(e,t){let r=!(arguments.length>2)||void 0===arguments[2]||arguments[2],s=t.replace(/^data(|-)/,""),o=i.A.toLowerCamelCase(s,"-");if(!n.isNode(e)){if(r)throw Error("The passed node is not a valid HTML Node!");return}if(void 0===e.dataset){if(r)throw Error("This node doesn't support the dataset attribute!");return}let a=e.dataset[o];if(void 0===a){if(r)throw Error(`The required data attribute "${t}" does not exist on ${e}!`);return a}return i.A.parsePrimitive(a)}static querySelector(e,t){let r=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(r&&!n.isNode(e))throw Error("The parent node is not a valid HTML Node!");let i=e.querySelector(t)||!1;if(r&&!1===i)throw Error(`The required element "${t}" does not exist in parent node!`);return i}static querySelectorAll(e,t){let r=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(r&&!n.isNode(e))throw Error("The parent node is not a valid HTML Node!");let i=e.querySelectorAll(t);if(0===i.length&&(i=!1),r&&!1===i)throw Error(`At least one item of "${t}" must exist in parent node!`);return i}static getFocusableElements(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document.body,t=`
2            input:not([tabindex^="-"]):not([disabled]):not([type="hidden"]),
3            select:not([tabindex^="-"]):not([disabled]),
4            textarea:not([tabindex^="-"]):not([disabled]),
5            button:not([tabindex^="-"]):not([disabled]),
6            a[href]:not([tabindex^="-"]):not([disabled]),
7            [tabindex]:not([tabindex^="-"]):not([disabled])
8        `;return e.querySelectorAll(t)}static getFirstFocusableElement(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document.body;return this.getFocusableElements(e)[0]}static getLastFocusableElement(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,t=this.getFocusableElements(e);return t[t.length-1]}}},997(e,t,r){r.d(t,{A:()=>n});var i=r(795);
8class n{static #e=this._selectors=["#","."];static getSelectorName(e){return n._selectors.includes(e.at(0))?e.slice(1):e}static getDataAttribute(e,t){let r=i.A.getDataAttribute(e,t,!1);return"string"==typeof r&&0===r.length?null:r??null}_getDataOptions(e,t){if("string"!=typeof t)return null;try{return JSON.parse(t)}catch{}return null}constructor(e){if(!e instanceof HTMLElement)throw Error("Element is not an HTMLElement");this.el=e}querySelector(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=this.#t(e,t);return r?this.el.querySelector(r):null}closest(e){return this.el.closest(e)}querySelectorAll(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=this.#t(e,t);return r?this.el.querySelectorAll(r):[]}getAttribute(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return i.A.getAttribute(this.el,e,t)}buildFormDataFromElement(e){let t=new FormData;return e.querySelectorAll("input[name], select[name], textarea[name]").forEach(e=>{if(e.disabled)return;let r=e.name;if("file"===e.type){Array.from(e.files||[]).forEach(e=>{t.append(r,e)}),e.files?.length;return}if("checkbox"===e.type){e.checked&&t.append(r,e.value||"on");return}if("radio"===e.type){e.checked&&t.append(r,e.value);return}if("SELECT"===e.tagName&&e.multiple){Array.from(e.selectedOptions).forEach(e=>{t.append(r,e.value)});return}t.append(r,e.value)}),t}#t(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(""===t)return e;let r=t,i=e;return n._selectors.includes(e.at(0))&&(i=e.slice(1),r=n._selectors.includes(t.at(0))?e[0]+t.slice(1):e[0]+t),r+i}}}}]);

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.