(()=>{var t={457:(t,e,r)=>{"use strict";r.d(e,{Z:()=>o});r(422);const o=new class{constructor(){return this.component=this.component.bind(this),this.component}component(t,e,...r){if("function"==typeof t)return t({...e,children:r});r&&(r=r.filter((t=>null!==t))),e&&(e.class&&(e.className=e.class),delete e.children);let o="fragment"!==t?function(t,e){e=e||{};let r=document.createElement(t);try{r=Object.assign(r,e)}catch{const t=Object.keys(e);for(let o=0;o<t.length;o++)"dataSet"!==e[o]&&r.setAttribute(t[o],e[t[o]])}return r}(t,e):document.createDocumentFragment();if(-1!==["svg","path","rect","text","circle","g"].indexOf(t)){o=document.createElementNS("http://www.w3.org/2000/svg",t);for(const t in e){const r="className"===t?"class":t;o.setAttribute(r,e[t])}}for(const t of r)Array.isArray(t)?o.append(...t):o.append(t);if(e?.dataSet)for(const t in e.dataSet)Object.prototype.hasOwnProperty.call(e.dataSet,t)&&(o.dataset[t]=e.dataSet[t]);return e&&!window.__aleartedJSXData&&Object.keys(e).find((t=>t.match(/^data-/)))&&(alert("Do not use data-* in your JSX component! Use dataSet instead!! - Check the console.trace for more info"),window.__aleartedJSXData=!0),e?.ref&&("function"==typeof e.ref?e.ref(o):e.ref=o),e?.on&&Object.entries(e.on).forEach((([t,e])=>{o.addEventListener(t,e)})),e?.style&&Object.entries(e.style).forEach((([t,e])=>{o.style.setProperty(t,e)})),o}}},422:()=>{!function(){function t(){var t=Array.prototype.slice.call(arguments),e=document.createDocumentFragment();t.forEach((function(t){var r=t instanceof Node;e.appendChild(r?t:document.createTextNode(String(t)))})),this.appendChild(e)}[Element.prototype,Document.prototype,DocumentFragment.prototype].forEach((function(e){e.hasOwnProperty("append")||Object.defineProperty(e,"append",{configurable:!0,enumerable:!0,writable:!0,value:t})}))}()}},e={};function r(o){var n=e[o];if(void 0!==n)return n.exports;var i=e[o]={exports:{}};return t[o](i,i.exports,r),i.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var o in e)r.o(e,o)&&!r.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{var t;r.g.importScripts&&(t=r.g.location+"");var e=r.g.document;if(!t&&e&&(e.currentScript&&(t=e.currentScript.src),!t)){var o=e.getElementsByTagName("script");o.length&&(t=o[o.length-1].src)}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),r.p=t})(),(()=>{"use strict";function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(e){var r=function(e,r){if("object"!=t(e)||!e)return e;var o=e[Symbol.toPrimitive];if(void 0!==o){var n=o.call(e,r||"default");if("object"!=t(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==t(r)?r:r+""}function o(t,r,o){return(r=e(r))in t?Object.defineProperty(t,r,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[r]=o,t}r.p;var n=r(457).Z;window.FoxKitV2=window.FoxKitV2||{},window.FoxKitModules.InCart=new class{constructor(){o(this,"getCart",(async t=>{document.querySelectorAll("foxkit-incart-upsell").length>0||(t||(t=await FoxKitV2.getCart()),t&&(this.cartItems=t.items),this.getRecommendedList())})),o(this,"getRecommendedList",(async()=>{var t;if(await(t=250,new Promise((e=>{setTimeout(e,t)}))),this.offers=[],!this.cartItems.length)return;const e=Array.from(new Set(this.cartItems.map((({product_id:t})=>t)))).map((async(t,e)=>{let r={productId:t};const o=document.querySelector(`.cart-item#CartItem-${e+1} ,[data-foxkit-product-id="${t}"], .m-cart-drawer--item[data-product-id="${t}"], .m-cart--item[data-product-id="${t}"], .m-cart-item[data-product-id="${t}"], .f-cart-drawer__item[data-cart-item-product-id="${t}"]`);if(o){r.selector=o;const t=o.dataset.foxkitCollections;t&&(r.collectionIds=t)}this.offers.push(r)}));await Promise.all(e),Object.values(this.offers).map((t=>this.renderRecommendedList(t)))})),o(this,"renderRecommendedList",(async t=>{const e="TR"===t.selector?.tagName,r=this.cartItems.find((({product_id:e})=>e===t.productId)),o=this.renderComponent({collectionsIds:t.collectionIds,productId:t.productId,productTitle:r.title}),i=t?.selector?.querySelector(this.hookSelector)||t?.selector;i?.querySelector(".f-incart")?.remove(),e?(t.selector.closest("table").classList.add("table--with-incart"),t.selector.classList.add("cart-item--with-incart"),t.selector.after(n("tr",{className:"f-incart__row"},n("td",{colSpan:t.selector?.children.length},o)))):i?.appendChild(o)})),this.hookSelector=".foxkit-incart-items, foxkit-incart-items",this.cartItems=[],this.offers=[]}init(t=!1){t||(this.getCart(),window.subscribe&&window.subscribe("cart-update",(t=>{setTimeout((()=>{"product-form"===t?.source&&this.getCart()}),250)})),window.FoxkitEvents.subscribe("ON_CART_UPDATE",(async t=>{this.cartItems=t?.items,this.getRecommendedList()})))}renderComponent({collectionsIds:t="",productTitle:e,productId:r}){const o=document.createElement("foxkit-incart-upsell");return o.dataset.collections=t,o.dataset.productTitle=e,o.dataset.productId=r,o}},window.FoxKitV2.Modules={},window.FoxKitV2.Modules.InCart=window.FoxKitModules.InCart})()})();