"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1662],{41662:function(e,t,n){n.r(t),n.d(t,{QuickBuyModalPresenter:function(){return eB}});var o,i,r=n(95235),a=n(8529),l=n(2784),s=n(53055),c=n(60418),u=n(80131),d=n(68544),p=n(77316),b=n(97209),h=n(10013),v=n(27564),f=n(43897),y=n(35016),g=n(35246),O=n(69363),k=n(58406),x=n(15792),m=n(16048),w=n(31477),T=n(17258),S=n(78930),C=n(93479),P=n(31275),j=n(73557),B=n(7328),D=n(48840),M=(0,D.zo)(m.a)(i||(i=(0,B.Z)(["\n width: 100%;\n"]))),A=n(52322);function I(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,o)}return n}function q(e){for(var t=1;t0||e.index>=0,selected:null===(n=e.selectedOptions)||void 0===n?void 0:n[e.option.key],maxDropdownHeight:e.maxDropdownHeight||"146px",width:e.dropdownWidth},e.option.label===L.Size&&{customErrorMessage:e.customErrorMessage}),{},{hideAsterixOnPDP:e.hideAsterixOnPDP}))},R=function(e){var t,n,o,i,r=e.choicesWithColour,a=(0,x.Fg)();return r.length>0&&!e.forceDropDowns&&(null===(t=null===(n=e.swatch)||void 0===n?void 0:n.show)||void 0===t||t)?(0,A.jsx)(T.m,{shape:null!==(o=e.swatchShape)&&void 0!==o?o:a.patterns.productBlock.components.quickBuySwatchShape,colours:r,selectedColour:null===(i=e.selectedOptions)||void 0===i?void 0:i[e.option.key],onColourChange:function(t){var n;e.onOptionChange(e.option.key,t),null===(n=e.onColourSwatchClick)||void 0===n||n.call(e)},i18nText:e.i18nText.swatch,showOnlyTwoRows:e.showOnlyTwoRows,displayColoursAsTextOnly:e.displayColoursAsTextOnly,size:a.patterns.productBlock.components.swatch.productOptionSize,noSwatchBorder:a.patterns.productBlock.components.swatch.noBorder}):null},W=function(e){var t,n=e.choicesWithColour;return(0,A.jsx)(S.k,{textStyle:e.textStyle,label:e.option.localizedKey||e.option.label,labelHidden:e.hideDropDownsLabel||!1,required:!1,ariaLabel:e.option.label,images:n,selectedImage:null===(t=e.selectedOptions)||void 0===t?void 0:t[e.option.key],onImageChange:function(t){var n;e.onOptionChange(e.option.key,t),null===(n=e.onColourSwatchClick)||void 0===n||n.call(e)},i18nText:e.i18nText.imageSwatch,hideOptionalText:!0,displayColoursAsTextOnly:e.displayColoursAsTextOnly,showAllImageSwatches:e.showAllImageSwatches})},Q=function(e,t){var n;return q(q({},t&&{error:null===(n=e.customErrorMessage)||void 0===n?void 0:n.errorMessage}),{},{labelCustomComponent:e.option.attribute?(0,A.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",width:"100%"},children:e.labelCustomComponent}):null})},N=function(e,t){var n=t.choices.find(function(t){return t.key===e});return(null==n?void 0:n.displayText)||e},Z=function(e,t,n,o){var i,r="unselected"===t||!!e.option.valueHidden;return(0,A.jsx)(C.Ee,q(q({required:null===(i=e.required)||void 0===i||i,label:E(e),textStyle:e.textStyle,selectedValue:n,labelHidden:!1,valueHidden:r,columns:2,getState:function(t){return e.onOptionChange(e.option.key,t)},horizontal:!0,defaultValue:n},Q(e,o)),{},{hideAsterixOnPDP:e.hideAsterixOnPDP,showBrandNameBeforeSize:e.showBrandNameBeforeSize,brandName:e.brandName,children:e.option.choices.map(function(t,n){return(0,A.jsx)(P.X,{name:e.option.key,title:t.title,value:t.key,disabled:!0!==e.enableOOSAddtoWishlist&&t.disabled,useDisabledStyling:t.useDisabledStyling,borderWidth:"2px"},n)})}))},_=function(e){var t,n,o,i=e.option.choices.filter(function(e){return e.colour}),r=null===(t=e.selectedOptions)||void 0===t?void 0:t[e.option.key],a=N(r,e.option),s=e.option.label===L.Size&&(null===(n=e.customErrorMessage)||void 0===n?void 0:n.displayError),c=(0,A.jsx)(w.N,{required:!e.hideAsterixOnPDP,textStyle:e.textStyle,children:e.showVariantNameNextTocolorLabel?"".concat(E(e)).concat(a?": ".concat(a):""):E(e)});switch("v1|show_image_swatches_pdp"===(0,k.jc)().image_swatches_pdp&&(e.option.type=L.Image),e.option.type){case L.Dropdown:return(0,A.jsxs)(l.Fragment,{children:[e.disableColorDropdown?c:(0,A.jsx)(V,q(q({},e),{},{choicesWithColour:i})),(0,A.jsx)(R,q(q({},e),{},{choicesWithColour:i}))]});case L.Image:return(0,A.jsx)(W,q(q({},e),{},{choicesWithColour:i}));case L.Swatch:return(0,A.jsxs)(l.Fragment,{children:[c,(0,A.jsx)(T.m,{shape:null!==(o=e.swatchShape)&&void 0!==o?o:j.M.SQUARE,colours:i,selectedColour:r,onColourChange:function(t){var n;e.onOptionChange(e.option.key,t),null===(n=e.onColourSwatchClick)||void 0===n||n.call(e)},i18nText:e.i18nText.swatch,showOnlyTwoRows:e.showOnlyTwoRows,displayColoursAsTextOnly:e.displayColoursAsTextOnly})]});default:return Z(e,r,a,s)}},H=n(37218);function z(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,o)}return n}function F(e){for(var t=1;t0&&(0,A.jsx)(Y.oh,{children:(0,A.jsx)(g.$,{tags:o.tags})})]}):null},options:function(e){var t,n,o,i,r=e.product,a=e.quickBuyModalTheme,l=e.inStockComponent,s=e.selectedOptions,c=e.options,u=e.i18nText,d=e.setSelectedOptionsCallback,p=e.hideAsterixOnPDP;return(0,A.jsxs)("div",{style:{gridArea:y.p.OPTIONS},children:[(null==r||null===(t=r.subscriptionData)||void 0===t?void 0:t.displaySubscription)&&(0,A.jsx)(h.Y,J(J({},r.subscriptionData.subscriptionPurchaseOptions),{},{selectedOptions:s,onOptionChange:d})),!(null!=r&&null!==(n=r.subscriptionData)&&void 0!==n&&n.displaySubscriptionChoicesOnly)&&(0,A.jsx)(G,{options:c,selectedOptions:s,onOptionChange:d,hideAsterixOnPDP:p,i18nText:u,order:null===(o=a.productOptions)||void 0===o?void 0:o.order,dropdownWidth:null===(i=a.productOptions)||void 0===i||null===(i=i.dropdown)||void 0===i?void 0:i.width,showOnlyTwoRows:a.swatch.showOnlyTwoRows,displayColoursAsTextOnly:a.swatch.displayColoursAsTextOnly}),u.failedToAddToBasketError&&(0,A.jsx)(Y.gY,{children:(0,A.jsx)(Y.Vv,{error:u.failedToAddToBasketError,id:"quick-buy-add-to-basket-error-".concat(null==r?void 0:r.sku)})}),l&&l]})},pricing:function(e,t,n){var o;return(0,A.jsx)("div",{style:{gridArea:y.p.PRICING},children:(0,A.jsxs)(Y.tw,{flexDirection:e.quickBuyModalTheme.pricing.flexDirection,alignItems:e.quickBuyModalTheme.pricing.alignItems,children:[e.pricing&&(0,A.jsx)(v.t,{pricing:e.pricing,priceDirection:e.quickBuyModalTheme.priceDirection,savings:e.quickBuyModalTheme.pricing.savings,i18nText:{saveLabel:e.i18nText.saveLabel,rrpLabel:e.i18nText.rrpLabel},priceTheme:e.quickBuyModalTheme.pricing.productPrice,discountMessageProps:{text:e.i18nText.subscriptionContractDiscountMessage,textStyle:null===(o=e.quickBuyModalTheme.pricing)||void 0===o||null===(o=o.discountMessage)||void 0===o?void 0:o.textStyle}}),!e.hideQuantitySelector&&(0,A.jsxs)("div",{style:{marginBottom:"".concat((0,D.W0)(2))},children:[(0,A.jsx)(Y.Ds,{children:e.quantitySelector.i18nText.quantityLabel}),(0,A.jsx)(f.c,J(J({},e.quantitySelector),{},{quantityChangedCallback:function(e){e&&n(e)},editable:!0,quantity:t}))]})]})})},addToBag:function(e,t){var n,o,i,r,a,l,s=X({selectedQuantity:t,enablePreselectedProductVariant:e.enablePreselectedProductVariant,product:e.product,options:e.options,selectedOptions:e.selectedOptions}),c=(null===(n=e.product)||void 0===n||null===(n=n.subscriptionData)||void 0===n?void 0:n.enableSubscriptionContracts)&&(null===(o=e.product.subscriptionData.subscriptionPurchaseOptions)||void 0===o?void 0:o.activeTabIndex)===1&&!!e.product.subscriptionData.subscriptionPurchaseOptions.subscriptionContracts.length,u=(null===(i=e.product)||void 0===i||null===(i=i.subscriptionData)||void 0===i?void 0:i.enableSubscriptionContracts)&&((null===(r=e.product)||void 0===r||null===(r=r.subscriptionData)||void 0===r?void 0:r.productInBasketWithSubscriptionContract)||(null===(a=e.product)||void 0===a||null===(a=a.subscriptionData)||void 0===a?void 0:a.productInBasketWithoutSubscriptionContract)&&!!(null!==(l=e.product.subscriptionData.subscriptionPurchaseOptions)&&void 0!==l&&l.subscriptionContracts.length));return(0,A.jsx)(ee,J({allowAddToBasket:!!s,allowAddToBasketAsSubscription:!!c,disableAddToBasketSubscriptions:!!u,selectedQuantity:t},e))},availability:function(e){return(0,A.jsx)("div",{style:{gridArea:y.p.AVAILABILITY},children:e.i18nText.availabilityMessage&&(0,A.jsx)(Y.s,{children:e.i18nText.availabilityMessage})})},viewProduct:function(e){return(0,A.jsx)("div",{style:{gridArea:y.p.VIEWPRODUCT},children:e.links&&(0,A.jsx)(Y.bi,{emphasis:"medium",href:e.links.productUrl,renderedAs:"a",onClick:function(t){var n;(null===(n=e.callbacks)||void 0===n?void 0:n.viewMoreInformationClicked)&&e.callbacks.viewMoreInformationClicked(t),e.setOpen&&e.setOpen(!1)},children:e.i18nText.viewMoreInformation})})}},ee=function(e){return(0,A.jsx)("div",{style:{gridArea:y.p.ADDTOBAG},children:(0,A.jsx)(Y.l1,{emphasis:"high",disabled:!e.allowAddToBasket||e.quantitySelector.maxValue<1||e.disableAddToBasketSubscriptions,onClick:function(){if(e.allowAddToBasket&&e.selectedQuantity&&e.selectedOptions){if(e.allowAddToBasketAsSubscription){var t;e.callbacks.addToBasketWithContractsCallback&&e.callbacks.addToBasketWithContractsCallback(e.selectedQuantity,null===(t=e.product)||void 0===t||null===(t=t.subscriptionData)||void 0===t||null===(t=t.subscriptionPurchaseOptions)||void 0===t?void 0:t.selectedFrequencyId)}else e.callbacks.addedToBasketClicked(e.selectedOptions,e.selectedQuantity)}},children:e.i18nText.addToBasket})})},et=function(e){var t=(0,U.G)();return(0,A.jsx)(Y.OO,{children:e.components[t].map(function(t){return t?$[t](e.quickBuyModalContentProps,e.selectedQuantity,e.setSelectedQuantity):null})})},en=function(e){var t,n,o,i=(null===(t=e.subscriptionData)||void 0===t?void 0:t.productInBasketWithSubscriptionContract)||(null===(n=e.subscriptionData)||void 0===n?void 0:n.productInBasketWithoutSubscriptionContract)&&!!(null!==(o=e.subscriptionData)&&void 0!==o&&null!==(o=o.subscriptionPurchaseOptions)&&void 0!==o&&o.subscriptionContracts.length);return(0,A.jsxs)(l.Fragment,{children:[i&&(0,A.jsx)(Y.o7,{text:e.i18nText.subscriptionInfoMessageText,type:"info"}),!e.quantitySelectorMaxValue&&(0,A.jsx)(Y.tO,{type:"info",text:e.i18nText.maxQuantityBasketItemMessageText,"data-testid":"quantity-basket-item"})]})},eo=function(e){return(0,A.jsxs)(Y.Tc,{ref:e.modalButtonsRef,modalContentScrollable:e.modalContentScrollable,children:[(0,A.jsx)(Y.l1,{emphasis:"high",disabled:!e.allowAddToBasket,onClick:function(){e.allowAddToBasket&&e.selectedQuantity&&e.selectedOptions&&e.callbacks.addedToBasketClicked(e.selectedOptions,e.selectedQuantity)},children:e.i18nText.addToBasket}),e.links&&!e.displayViewMoreInfo&&(0,A.jsx)(Y.bi,{emphasis:"medium",href:e.links.productUrl,renderedAs:"a",onClick:function(){var t;(null===(t=e.callbacks)||void 0===t?void 0:t.viewMoreInformationClicked)&&e.callbacks.viewMoreInformationClicked,e.setOpen&&e.setOpen(!1)},children:e.i18nText.viewMoreInformation})]})},ei=function(e){var t,n,o=e.i18nText,i=e.product,r=e.options,s=e.pricing,c=e.links,u=e.quantitySelector,d=e.hideQuantitySelector,p=e.callbacks,h=e.quickBuyModalTheme,v=e.coreTheme,f=e.setOpen,y=e.inStockComponent,g=e.selectedOptions,O=e.setSelectedOptionsCallback,k=e.enablePreselectedProductVariant,x=e.displayViewMoreInfo,m=e.hideAsterixOnPDP,w=l.useState(1),T=(0,a.Z)(w,2),S=T[0],C=T[1],P=l.useState(!1),j=(0,a.Z)(P,2),B=j[0],D=j[1],M=l.useRef(null),I=l.useRef(null);if(l.useEffect(function(){var e;if(null!=M&&M.current&&null!=I&&I.current)return(e=new b.Z(function(){var e,t,n=null==M||null===(e=M.current)||void 0===e?void 0:e.getBoundingClientRect(),o=null==I||null===(t=I.current)||void 0===t?void 0:t.getBoundingClientRect();n&&o&&D(n.top+n.height>o.top)})).observe(M.current),function(){e&&e.disconnect()}},[M]),!i)return(0,A.jsx)(Y.eZ,{flashMessageId:"quickBuyModalMissingProduct",message:o.missingProductMessage,type:"error"});var q=X({enablePreselectedProductVariant:k,product:i,selectedQuantity:S,options:r,selectedOptions:g});return(0,A.jsxs)(l.Fragment,{children:[(0,A.jsx)(Y.r6,{children:o.modalTitle}),(0,A.jsx)(en,{i18nText:{subscriptionInfoMessageText:o.subscriptionInfoMessageText,maxQuantityBasketItemMessageText:o.maxQuantityBasketItemMessageText,failedToAddToBasketError:o.failedToAddToBasketError},productSku:i.sku,subscriptionData:i.subscriptionData,quantitySelectorMaxValue:u.maxValue}),(0,A.jsxs)(Y.uE,{ref:M,reducedBottomPadding:h.enableStickyFooterButtons,children:[(0,A.jsx)(Y.W7,{urls:i.images[0],alt:i.title,width:(null===(t=h.product)||void 0===t||null===(t=t.image)||void 0===t?void 0:t.width)||["100%","100%",190,191],height:(null===(n=h.product)||void 0===n||null===(n=n.image)||void 0===n?void 0:n.height)||["","",190,191]}),(0,A.jsx)(et,{quickBuyModalContentProps:{i18nText:o,product:i,pricing:s,links:c,quantitySelector:u,hideQuantitySelector:d,callbacks:p,quickBuyModalTheme:h,coreTheme:v,inStockComponent:y,options:r,selectedOptions:g,setSelectedOptionsCallback:O,setOpen:f,enablePreselectedProductVariant:k,hideAsterixOnPDP:m,productSku:null==i?void 0:i.sku.toString()},components:h.enabledComponents,selectedQuantity:S,setSelectedQuantity:C})]}),h.enableStickyFooterButtons&&(0,A.jsx)(eo,{i18nText:o,modalButtonsRef:I,modalContentScrollable:B,allowAddToBasket:!!q,selectedQuantity:S,selectedOptions:g,callbacks:p,links:c,displayViewMoreInfo:x})]})},er=n(61265);function ea(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,o)}return n}function el(e){for(var t=1;t1?eR.multipleItemsText:eR.singleItemText,[(null==Z?void 0:Z.maxPerOrder)||5e3,eB]),eQ=l.useRef(!1),eN=l.useRef(),eZ=l.useRef(),e_=l.useRef(),eH=l.useRef();if(C.presentAuroraQuickBuyModal.current=function(e){var t,n=e.sku,o=e.quantity,i=e.fromRecommendations,r=e.onBasketChangeBeacon,a=e.trackingUrl,l=e.initialSelectedOptions,s=e.setSelectedOptionsCallback,u=e.setSelectedVariantCallback,d=e.setOptionsCallback,p=e.fullProductData,h=e.displayNotifyWhenInStock,v=e.enableMobilePDPStickyAddToBasket;if(!l){eM();return}$.current=o,eQ.current=null!=i&&i,eZ.current=r,e_.current=a,eN.current=v,J(l),eH.current={setSelectedOptionsCallback:s,setSelectedVariantCallback:u,setOptionsCallback:d};var f=p?"/e2/operation/product/product-options/".concat(n):"/e2/operation/product-options/".concat(n,"?displayNotifyWhenInStock=").concat(h);l&&c.Z.get(f,{timeout:null!==(t=null==w?void 0:w.PRODUCT_OPTIONS_TIMEOUT)&&void 0!==t?t:5e3,headers:{"Accept-Encoding":"deflate, gzip, br",Host:b,"x-customer-location":m}}).then(function(e){return e.data}).then(function(e){var t=Object.values(l).reduce(function(e,t){return e[t]},e);if(!t){eM();return}_(t.variant),G(t.options),X.current=e}).catch(function(e){console.trace("Error fetching product options: ".concat(f),e),eM()}),W(!0)},!C.presentAuroraQuickBuyModal)return e.warn("AuroraQuickBuyModalPresenter: Failed to find an initialised BasketContext. Make sure presentAuroraQuickBuyModal ref is defined and it wraps AuroraQuickBuyModalPresenter."),null;if(!R)return null;var ez=D.patterns.quickBuyModal,eF="v1|quickbuy_bottom_drawer"===T.quickBuyBottomDrawer_wave_01;return(0,A.jsx)(es,ej({enablePreselectedProductVariant:r,loading:!F.length,setOpen:W,hideAsterixOnPDP:i,options:F,product:Z,quickBuyModalTheme:ez,displayViewMoreInfo:!!eN,coreTheme:M,rendering:{open:R,onClose:function(){W(!1),eS.t.modalClose((null==Z?void 0:Z.sku.toString())||"")}},i18nText:ej(ej({},eI),{},{maxQuantityBasketItemMessageText:eW,subscriptionInfoMessageText:"",subscriptionContractDiscountMessage:"",failedToAddToBasketError:en?eL:void 0,availabilityMessage:null==Z?void 0:Z.availabilityMessage}),modal:{i18nText:eE,showHeader:!0,stickyHeader:!0,headerOffset:S,gridColSpan:[12,8,8,6],"data-testid":"quick-buy-modal",animation:!!eF||D.patterns.quickBuyModal.animation},selectedOptions:K,setSelectedOptionsCallback:function(e,t){if(!X.current){eM();return}eo(!1);var n=(0,eg.WZ)({selectedOptions:K,selectedVariant:Z,optionKey:e,value:t,productOptionsMap:X.current,setSelectedOptionsCallback:J,setSelectedVariantCallback:_,setOptionsCallback:G}),o=n.updatedSelectedOptions,i=n.updatedProductOptions;eH.current&&o&&i&&(eH.current.setSelectedOptionsCallback&&eH.current.setSelectedOptionsCallback(o),eH.current.setSelectedVariantCallback&&eH.current.setSelectedVariantCallback(i.variant),eH.current.setOptionsCallback&&eH.current.setOptionsCallback(i.options))},pricing:Z?(0,eO.a)(Z,h,v):void 0,links:{productUrl:null==Z?void 0:Z.product.url},callbacks:{addedToBasketClicked:function(e,t){if(C.presentAddedToBasketModal&&Z){if(!Z.enableAddToBasket){eo(!0);return}var n=C.presentAddedToBasketModal.current;C.presentAddedToBasketModal.current=function(e,t){C.presentAddedToBasketModal&&(W(!1),eo(!1),n(e,t),C.presentAddedToBasketModal.current=n)},ea([{quantity:t,sku:Z.sku.toString()}],{fromRecommendations:eQ.current,location:ew.A.PRODUCT_LIST},ef.eN.HomeDelivery,void 0,eZ.current,e_.current),eS.t.modalAddToBasket(Z.sku.toString())}},viewMoreInformationClicked:function(){Z&&eS.t.modalInformation(null==Z?void 0:Z.product.sku.toString())},addToBasketWithContractsCallback:function(e,t){er({variables:{basketId:null==B?void 0:B.id,sku:null==Z?void 0:Z.sku.toString(),quantity:e,contractId:t,settings:{currency:y,shippingDestination:g.code}}}).then(function(){if(C.presentAddedToBasketModal&&Z){var t=C.presentAddedToBasketModal.current;W(!1),t(null==Z?void 0:Z.sku.toString(),e)}})}},quantitySelector:{i18nText:eV,maxValue:eP,quantity:$.current}},n&&o&&{inStockComponent:(0,A.jsx)(d.G,{selectedVariant:Z,url:(null==Z?void 0:Z.product.url)||"",styleOverride:{margin:{top:0,bottom:2}}})}))}},71663:function(e,t,n){n.d(t,{L:function(){return o}});var o="unselected"},90576:function(e,t,n){n.d(t,{WZ:function(){return c},fH:function(){return s}});var o,i=n(8529),r=n(71663),a=function(e){var t=e.selectedOptions,n=e.productOptionsMap;return Object.values(t).reduce(function(e,t){if(!n)return e;if(!e.currentMap){var o=n[t];return e.currentMap=o,null!=o&&o.options&&(e.productOptions=o),e}var i=e.currentMap[t];return e.currentMap&&null!=i&&i.options?e.productOptions=i:e.currentMap=i,e},{productOptions:null,currentMap:null}).productOptions},l=((o=l||{}).THUMBNAIL="THUMBNAIL",o.ORIGINAL="ORIGINAL",o.MAGNIFY="MAGNIFY",o),s=function(e){var t,n=null===(t=e.personalisationData)||void 0===t?void 0:t.personalisationSupportImages;if(n){var o=[];return n.forEach(function(t){var n;null===(n=t.supportImages)||void 0===n||null===(n=n.imagesWithAssetSets)||void 0===n||n.forEach(function(t){var n,i,r,a=t.assetSet,s=t.images,c={url:s.find(function(e){return e.size===l.THUMBNAIL}).url,alt:(null==e?void 0:e.title)||""},u={url:s.find(function(e){return e.size===l.ORIGINAL}).url,alt:(null==e?void 0:e.title)||""},d={url:s.find(function(e){return e.size===l.MAGNIFY}).url,alt:(null==e?void 0:e.title)||""},p=o.find(function(e){return e.key===a}),b=p?o.indexOf(p):0;p||(o.push({key:a,images:[],thumbnails:[],zoom:[]}),b=o.length-1),null===(n=o[b])||void 0===n||n.images.push(u),null===(i=o[b])||void 0===i||i.thumbnails.push(c),null===(r=o[b])||void 0===r||r.zoom.push(d)})}),o}},c=function(e){var t,n=e.productOptionsMap,o=e.selectedOptions,l=e.setSelectedOptionsCallback,s=e.setOptionsCallback,c=e.setSelectedVariantCallback,u=e.selectedVariant,d=e.optionKey,p=e.value;o[d]=p,l(o);var b=a({selectedOptions:o,productOptionsMap:n});if(b)return s(b.options),c(b.variant),{updatedSelectedOptions:o,updatedProductOptions:b};if(null!=u&&null!==(t=u.product)&&void 0!==t&&t.linkedOn){var h=Object.entries(o).reduce(function(e,t){var n,o=(0,i.Z)(t,2),a=o[0],l=o[1];return a===(null===(n=u.product)||void 0===n?void 0:n.linkedOn)?e[a]=l:e[a]=r.L,e},{}),v=a({productOptionsMap:n,selectedOptions:h});if(v)return s(v.options),c(v.variant),{updatedSelectedOptions:h,updatedProductOptions:v}}return{updatedSelectedOptions:null,updatedProductOptions:null}}}}]); //# sourceMappingURL=1662.ea34b5992fb3ca6b.js.map