"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3281],{92258:function(e,n,o){o.d(n,{G:function(){return d},w:function(){return c}});var i,t=o(52746),l=o(95235);function r(e,n){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),o.push.apply(o,i)}return o}function u(e){for(var n=1;ny.indexOf(n.key)?1:-1})}},s=function(e){var n=e.accumulator,o=e.choice,i=e.otherChoice;n[o.key]||(n[o.key]={}),n[o.key][i.optionKey]||(n[o.key][i.optionKey]=[])},v=e.variants.reduce(function(n,o){return o.choices.forEach(function(t){if(e.linkedOn)o.choices.forEach(function(i){if(t.optionKey!==i.optionKey){if(t.optionKey===e.linkedOn){s({accumulator:n,choice:t,otherChoice:i}),s({accumulator:n,otherChoice:t,choice:i});var l=n[t.key][i.optionKey].map(function(e){return e.key});p({variant:o,storedKeys:l,choice:t,otherChoice:i,accumulator:n}),p({variant:o,storedKeys:l,accumulator:n,otherChoice:t,choice:i})}return n}});else if(n[t.optionKey]||(n[t.optionKey]={}),n[t.optionKey][t.optionKey]||(n[t.optionKey][t.optionKey]=[]),!n[t.optionKey][t.optionKey].map(function(e){return e.key}).includes(t.key)){n[t.optionKey][t.optionKey].push(u(u({},t),{},{disabled:!!i&&!o.inStock,inStock:o.inStock,thumbnailImage:null===(l=o.images[0])||void 0===l?void 0:l.thumbnail,notifyWhenInStockEnabled:null!==(r=o.notifyWhenInStockEnabled)&&void 0!==r&&r}));var l,r,c=e.options.reduce(function(e,n){return n.key!==t.optionKey||n.choices.forEach(function(n){return e.push(n.key)}),e},[]);n[t.optionKey][t.optionKey].length===(null==c?void 0:c.length)&&n[t.optionKey][t.optionKey].sort(function(e,n){return c.indexOf(e.key)>c.indexOf(n.key)?1:-1})}}),n},{}),h=e.variants.reduce(function(n,o){var t,l,r,u=e.linkedOn?o.choices.find(function(n){return n.optionKey===e.linkedOn}):null;u&&!n[a([u])]&&(n[a([u])]={supportedChoices:{},inStock:!1,thumbnailImage:null===(r=o.images[0])||void 0===r?void 0:r.thumbnail,disabled:!0});var c=null;return Object.keys(v).length&&(u&&v[u.key]?c=v[u.key]:o.choices.length&&v[o.choices[0].optionKey]&&(c=v[o.choices[0].optionKey])),n[a(o.choices)]={supportedChoices:c,inStock:o.inStock,thumbnailImage:null===(t=o.images[0])||void 0===t?void 0:t.thumbnail,disabled:!!i&&!o.inStock,notifyWhenInStockEnabled:null!==(l=o.notifyWhenInStockEnabled)&&void 0!==l&&l},n},{}),k={};if(!d){var f=Object.keys(v).reduce(function(i,t){if(!i[t]){i[t]=[];var l=Object.keys(v[t]);e.options.forEach(function(d){if(l.includes(d.key)){var y,p,s,k,f,b,m,O=(null===(k=e.options.find(function(e){return e.key===d.key}))||void 0===k?void 0:k.choices)||[],g=v[t][d.key],K=d.key===e.linkedOn&&O&&g.length!==O.length?O:g,S=K.map(function(n){if(n.colour&&n.colour.startsWith("#")&&n.colour.length<7){var o,i,l,r,c,d,y=n.colour.substring(1,3);"#".padEnd(n.colour.length,y)===n.colour&&(n.colour="#".padEnd(7,y))}var p=a(1===e.options.length?[n]:[{key:t},n]),s=null===(o=h[p])||void 0===o?void 0:o.thumbnailImage;return s||(s=null===(d=h[a(K.filter(function(n){return n.optionKey===e.linkedOn}))])||void 0===d?void 0:d.thumbnailImage),u(u({},n),{},{image:n.colour&&s||null,inStock:null!==(i=null===(l=h[p])||void 0===l?void 0:l.inStock)&&void 0!==i&&i,disabled:null!==(r=null===(c=h[p])||void 0===c?void 0:c.disabled)&&void 0!==r&&r})});i[t].push({key:d.key,label:(null===(f=o[n[d.key].propertyKey])||void 0===f?void 0:f.value)||d.key,placeholder:(null===(b=o[n[d.key].placeholderPropertyKey])||void 0===b?void 0:b.value)||null,type:(null===(m=n[d.key])||void 0===m?void 0:m.type)||c.DROPDOWN,attribute:!!(null!=r&&r.includes(d.key))||null,choices:S})}else i[t].push({key:d.key,label:(null===(y=o[n[d.key].propertyKey])||void 0===y?void 0:y.value)||d.key,placeholder:(null===(p=o[n[d.key].placeholderPropertyKey])||void 0===p?void 0:p.value)||null,type:(null===(s=n[d.key])||void 0===s?void 0:s.type)||c.DROPDOWN,attribute:!!(null!=r&&r.includes(d.key))||null,choices:d.choices.map(function(e){var n,o=null===(n=h[a([e])])||void 0===n?void 0:n.thumbnailImage;return u(u({},e),{},{image:e.colour&&o||null,inStock:!0,disabled:!1})})})})}return i},{});k=1===e.options.length?{0:Object.keys(f).length?f[e.options[0].key]:e.options}:u(u({},f),{},{0:e.options.map(function(e){var i,t,l;return{key:e.key,label:(null===(i=o[n[e.key].propertyKey])||void 0===i?void 0:i.value)||e.key,placeholder:(null===(t=o[n[e.key].placeholderPropertyKey])||void 0===t?void 0:t.value)||null,type:(null===(l=n[e.key])||void 0===l?void 0:l.type)||c.DROPDOWN,attribute:!!(null!=r&&r.includes(e.key))||null,choices:e.choices.map(function(e){var n,o=null===(n=h[a([e])])||void 0===n?void 0:n.thumbnailImage;return u(u({},e),{},{image:e.colour&&o||null,inStock:!0,disabled:!1})})}})})}return{choiceMap:v,options:e.variants.reduce(function(i,d){return i[d.sku]=e.options.reduce(function(i,p){if(null!=l&&l.includes(p.key))return i;var s,v,k,f=a(d.choices),b=d.choices.filter(function(e){return e.optionKey!==p.key}),m=(h[f].supportedChoices&&h[f].supportedChoices[p.key]?h[f].supportedChoices[p.key]:p.choices).map(function(n){if(n.colour&&n.colour.startsWith("#")&&n.colour.length<7){var o,i,l,r,c,d,y,p,s=n.colour.substring(1,3);"#".padEnd(n.colour.length,s)===n.colour&&(n.colour="#".padEnd(7,s))}var v=[].concat((0,t.Z)(b),[n]),k=a(v),f=null===(o=h[k])||void 0===o?void 0:o.thumbnailImage;return f||(f=null===(p=h[a(v.filter(function(n){return n.optionKey===e.linkedOn}))])||void 0===p?void 0:p.thumbnailImage),u(u({},n),{},{image:n.colour&&f||null,inStock:null!==(i=null===(l=h[k])||void 0===l?void 0:l.inStock)&&void 0!==i&&i,disabled:null!==(r=null===(c=h[k])||void 0===c?void 0:c.disabled)&&void 0!==r&&r,notifyWhenInStockEnabled:null!==(d=null===(y=h[k])||void 0===y?void 0:y.notifyWhenInStockEnabled)&&void 0!==d&&d})});return i.push({key:p.key,localizedKey:p.localizedKey,label:(null===(s=o[n[p.key].propertyKey])||void 0===s?void 0:s.value)||p.key,placeholder:(null===(v=o[n[p.key].placeholderPropertyKey])||void 0===v?void 0:v.value)||null,type:(null===(k=n[p.key])||void 0===k?void 0:k.type)||c.DROPDOWN,attribute:!!(null!=r&&r.includes(p.key))||null,choices:m.filter(function(e){return y?e:e.inStock?e:null})}),i},[]),i},k)}}},86054:function(e,n,o){o.d(n,{$:function(){return t},f:function(){return l}});var i=function(e){var n=e.price,o=e.rrp,i=n.displayValue.replace(/[0-9\.,]+/g,""),t=n.displayValue.indexOf(i),l=parseFloat(n.amount),r=parseFloat(o.amount);return l===r||l>r||isNaN(l)||isNaN(r)?null:{indexOfCurrency:t,currencySymbol:i,saving:r-l}},t=function(e){var n=i(e),o=null==n?void 0:n.saving.toFixed(2);return n&&o?"".concat(o.slice(0,n.indexOfCurrency)).concat(n.currencySymbol).concat(o.slice(n.indexOfCurrency)):null},l=function(e){var n;return null===(n=i(e))||void 0===n?void 0:n.saving}}}]); //# sourceMappingURL=3281-1b3675b95d033e6b.js.map