(()=>{"use strict";var e={893:e=>{var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===r}(e)}(e)},r="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function i(e,t){return!1!==t.clone&&t.isMergeableObject(e)?a((r=e,Array.isArray(r)?[]:{}),e,t):e;var r}function n(e,t,r){return e.concat(t).map((function(e){return i(e,r)}))}function s(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return e.propertyIsEnumerable(t)})):[]}(e))}function o(e,t){try{return t in e}catch(e){return!1}}function a(e,r,c){(c=c||{}).arrayMerge=c.arrayMerge||n,c.isMergeableObject=c.isMergeableObject||t,c.cloneUnlessOtherwiseSpecified=i;var u=Array.isArray(r);return u===Array.isArray(e)?u?c.arrayMerge(e,r,c):function(e,t,r){var n={};return r.isMergeableObject(e)&&s(e).forEach((function(t){n[t]=i(e[t],r)})),s(t).forEach((function(s){(function(e,t){return o(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,s)||(o(e,s)&&r.isMergeableObject(t[s])?n[s]=function(e,t){if(!t.customMerge)return a;var r=t.customMerge(e);return"function"==typeof r?r:a}(s,r)(e[s],t[s],r):n[s]=i(t[s],r))})),n}(e,r,c):i(r,c)}a.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,r){return a(e,r,t)}),{})};var c=a;e.exports=c}},t={};function r(i){var n=t[i];if(void 0!==n)return n.exports;var s=t[i]={exports:{}};return e[i](s,s.exports,r),s.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var i in t)r.o(t,i)&&!r.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);class i{static isTouchDevice(){return"ontouchstart"in document.documentElement}static isIOSDevice(){return i.isIPhoneDevice()||i.isIPadDevice()}static isNativeWindowsBrowser(){return i.isIEBrowser()||i.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":i.isTouchDevice(),"is-ios":i.isIOSDevice(),"is-native-windows":i.isNativeWindowsBrowser(),"is-iphone":i.isIPhoneDevice(),"is-ipad":i.isIPadDevice(),"is-ie":i.isIEBrowser(),"is-edge":i.isEdgeBrowser()}}}class n{static iterate(e,t){if(e instanceof Map)return e.forEach(t);if(Array.isArray(e))return e.forEach(t);if(!(e instanceof FormData)){if(e instanceof NodeList)return e.forEach(t);if(e instanceof HTMLCollection)return Array.from(e).forEach(t);if(e instanceof Object)return Object.keys(e).forEach((r=>{t(e[r],r)}));throw new Error(`The element type ${typeof e} is not iterable!`)}for(const r of e.entries())t(r[1],r[0])}}const s="modal-backdrop",o="modal-backdrop-open",a="no-scroll";class c{constructor(){return c.instance||(c.instance=this),c.instance}create(e){this._removeExistingBackdrops(),document.body.insertAdjacentHTML("beforeend",this._getTemplate());const t=document.body.lastChild;document.documentElement.classList.add(a),setTimeout((()=>{t.classList.add(o),"function"==typeof e&&e()}),75),this._dispatchEvents()}remove(e=350){const t=this._getBackdrops();n.iterate(t,(e=>e.classList.remove(o))),setTimeout(this._removeExistingBackdrops.bind(this),e),document.documentElement.classList.remove(a)}_dispatchEvents(){const e=i.isTouchDevice()?"touchstart":"click";document.addEventListener(e,(e=>{e.target.classList.contains(s)&&document.dispatchEvent(new CustomEvent("backdrop/onclick"))}))}_getBackdrops(){return document.querySelectorAll(`.${s}`)}_removeExistingBackdrops(){if(!1===this._exists())return;const e=this._getBackdrops();n.iterate(e,(e=>e.remove()))}_exists(){return document.querySelectorAll(`.${s}`).length>0}_getTemplate(){return`<div class="${s}"></div>`}}const u=Object.freeze(new c);class l{static create(e=null){u.create(e)}static remove(e=350){u.remove(e)}static SELECTOR_CLASS(){return s}}const d="loader",h="before";class p{constructor(e,t=h){this.parent=e instanceof Element?e:document.body.querySelector(e),this.position=t}create(){this.exists()||("inner"!==this.position?this.parent.insertAdjacentHTML(this._getPosition(),p.getTemplate()):this.parent.innerHTML=p.getTemplate())}remove(){const e=this.parent.querySelectorAll(`.${d}`);n.iterate(e,(e=>e.remove()))}exists(){return this.parent.querySelectorAll(`.${d}`).length>0}_getPosition(){return this.position===h?"afterbegin":"beforeend"}static getTemplate(){return`<div class="${d}" role="status">\n                    <span class="visually-hidden">Loading...</span>\n                </div>`}static SELECTOR_CLASS(){return d}}Object.freeze(new class extends p{constructor(){super(document.body)}create(e=!0){!this.exists()&&e&&(l.create(),document.querySelector(`.${l.SELECTOR_CLASS()}`).insertAdjacentHTML("beforeend",p.getTemplate()))}remove(e=!0){super.remove(),e&&l.remove()}});var m=r(893),f=r.n(m);class g{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){const r=g.toUpperCamelCase(e,t);return g.lcFirst(r)}static toUpperCamelCase(e,t){return t?e.split(t).map((e=>g.ucFirst(e.toLowerCase()))).join(""):g.ucFirst(e.toLowerCase())}static parsePrimitive(e){try{return/^\d+(.|,)\d+$/.test(e)&&(e=e.replace(",",".")),JSON.parse(e)}catch(t){return e.toString()}}}class b{static isNode(e){return"object"==typeof e&&null!==e&&(e===document||e===window||e instanceof Node)}static hasAttribute(e,t){if(!b.isNode(e))throw new Error("The element must be a valid HTML Node!");return"function"==typeof e.hasAttribute&&e.hasAttribute(t)}static getAttribute(e,t,r=!0){if(r&&!1===b.hasAttribute(e,t))throw new Error(`The required property "${t}" does not exist!`);if("function"==typeof e.getAttribute)return e.getAttribute(t);if(r)throw new Error("This node doesn't support the getAttribute function!")}static getDataAttribute(e,t,r=!0){const i=t.replace(/^data(|-)/,""),n=g.toLowerCamelCase(i,"-");if(!b.isNode(e)){if(r)throw new Error("The passed node is not a valid HTML Node!");return}if(void 0===e.dataset){if(r)throw new Error("This node doesn't support the dataset attribute!");return}const s=e.dataset[n];if(void 0===s){if(r)throw new Error(`The required data attribute "${t}" does not exist on ${e}!`);return s}return g.parsePrimitive(s)}static querySelector(e,t,r=!0){if(r&&!b.isNode(e))throw new Error("The parent node is not a valid HTML Node!");const i=e.querySelector(t)||!1;if(r&&!1===i)throw new Error(`The required element "${t}" does not exist in parent node!`);return i}static querySelectorAll(e,t,r=!0){if(r&&!b.isNode(e))throw new 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 new Error(`At least one item of "${t}" must exist in parent node!`);return i}}class v{constructor(e=document){this._el=e,e.$emitter=this,this._listeners=[]}publish(e,t={},r=!1){const i=new CustomEvent(e,{detail:t,cancelable:r});return this.el.dispatchEvent(i),i}subscribe(e,t,r={}){const i=this,n=e.split(".");let s=r.scope?t.bind(r.scope):t;if(r.once&&!0===r.once){const 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){const 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):(e.push(r),e)),[]),!0}reset(){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 w{constructor(e,t={},r=!1){if(!b.isNode(e))throw new Error("There is no valid element given.");this.el=e,this.$emitter=new v(this.el),this._pluginName=this._getPluginName(r),this.options=this._mergeOptions(t),this._initialized=!1,this._registerInstance(),this._init()}init(){throw new Error(`The "init" method for the plugin "${this._pluginName}" is not defined.`)}update(){}_init(){this._initialized||(this.init(),this._initialized=!0)}_update(){this._initialized&&this.update()}_mergeOptions(e){const t=g.toDashCase(this._pluginName),r=b.getDataAttribute(this.el,`data-${t}-config`,!1),i=b.getAttribute(this.el,`data-${t}-options`,!1),n=[this.constructor.options,this.options,e];r&&n.push(window.PluginConfigManager.get(this._pluginName,r));try{i&&n.push(JSON.parse(i))}catch(e){throw new Error(`The data attribute "data-${t}-options" could not be parsed to json: ${e.message}`)}return f().all(n.filter((e=>e instanceof Object&&!(e instanceof Array))).map((e=>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}}window.bootstrap,window.PluginManager.register("PickwareCheckoutConfirmationPlugin",class extends w{init(){this.getTransferDataForm()&&this.getTransferDataForm().addEventListener("submit",this.onFormSubmit.bind(this)),this.getEmailTransferCheckbox()&&this.getEmailTransferCheckbox().addEventListener("input",this.onEmailTransferCheckboxInput.bind(this))}onEmailTransferCheckboxInput(){this.getTransferDataForm().requestSubmit()}async onFormSubmit(e){e.preventDefault();const t=this.getEmailTransferCheckbox();t.disabled=!0;const r=new FormData;r.append("pickware__shipping__allow_email_transfer",t.checked);try{await fetch(e.target.action,{method:e.target.method,body:r})}catch(e){t.selected=!t.selected}finally{t.disabled=!1}}getTransferDataForm(){return document.getElementById("pickware-shipping-data-transfer-form")}getEmailTransferCheckbox(){return document.getElementById("pickware-shipping-transfer-email-input")}},"[data-pickware-checkout-confirmation]")})();