"use strict";(self.webpackChunkui=self.webpackChunkui||[]).push([[12],{252:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.bundle_configuration=void 0;const r=t(1),i=t(253);n.bundle_configuration=r.content.object({name:"Bundle Configuration",type:"bundle_configuration",key:"key",fields:{display_name:r.content.singleLineTextField({name:"Display Name",required:!0}),percent_discount:r.content.integerField({name:"Percent Discount",required:!0}),bundle_quantity:r.content.integerField({name:"Bundle Quantity",required:!0}),bundle_parent_variant:r.content.listField({name:"Bundle Parent Variant",required:!0,fieldType:"mixedReferenceField",references:[i.bundle_parent_variant]}),default_bundle_image:r.content.fileField({name:"Default Bundle Image",required:!1}),key:r.content.singleLineTextField({name:"Key",required:!0}),disable_bundle:r.content.booleanField({name:"Disable Bundle",required:!1}),max_pre_order_discount:r.content.integerField({name:"Max Pre-Order Discount",required:!1})}})},253:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.bundle_parent_variant=void 0;const r=t(1);n.bundle_parent_variant=r.content.object({name:"Bundle Parent Variant",type:"bundle_parent_variant",fields:{display_name:r.content.singleLineTextField({name:"Display Name",required:!0}),variant_id:r.content.singleLineTextField({name:"variantId",required:!0}),variant:r.content.variantField({name:"Variant",required:!0})}})},34:function(e,n,t){var r=this&&this.__awaiter||function(e,n,t,r){return new(t||(t=Promise))((function(i,o){function a(e){try{d(r.next(e))}catch(e){o(e)}}function u(e){try{d(r.throw(e))}catch(e){o(e)}}function d(e){var n;e.done?i(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(a,u)}d((r=r.apply(e,n||[])).next())}))};Object.defineProperty(n,"__esModule",{value:!0}),n.getBundleConfig=function(e){return r(this,void 0,void 0,(function*(){const n=yield e.getContent(o.bundle_configuration,"default");if(!n||(null==n?void 0:n.disable_bundle))return{bundleConfig:void 0};const t=function(e,n){var t,r,i;if(n.bundle_parent_variant.length<=1)return n.bundle_parent_variant[0];const o=null!==(t=e.getAssignment("bundle_parent_variant"))&&void 0!==t?t:"default";return null!==(i=null!==(r=n.bundle_parent_variant.find((e=>e.variant_id===o)))&&void 0!==r?r:n.bundle_parent_variant.find((e=>"default"===e.variant_id)))&&void 0!==i?i:n.bundle_parent_variant[0]}(e,n),r=function(e){if(e)return e.split("gid://shopify/ProductVariant/")[1]}(null==t?void 0:t.variant.id);return{bundleConfig:Object.assign(Object.assign({},n),{default_bundle_image:(0,u.convertImageMedia)(n.default_bundle_image)}),bundleParent:r,bundleTagMessage:null==t?void 0:t.display_name,isDynamicDiscount:d(n)}}))},n.getBundleDiscount=l,n.getMaxBundleDiscount=function(e,n,t){if(t)return 0;const r=e[n];return r?r<7?0:r<28?5:r<30?8:r<35?10:r<50?15:r<75?20:void 0:void 0},n.getPreOrderDiscount=function(e,n){const t=e[n];return!t||t<=0?0:t<14?void 0:t<28?10:0},n.getBundlePrices=function(e,n){const t=n.map((({selectedVariant:e})=>e)),r=s(e,t);return Object.assign(Object.assign({},r),{getPriceDifferences(i,o){if(!i||!o)return{priceDiff:0,preOrderPriceDiff:0};const a=n.findIndex((({selectedVariant:e})=>e.variantId===i.variantId)),u=t.map(((e,n)=>n===a?o:e)),d=s(e,u),l=r.availableForSale?r.bundlePrice:r.preOrderPrice,f=d.preOrderShipDate.displayValue;return{priceDiff:d.availableForSale?c(d.bundlePrice-l):void 0,preOrderPriceDiff:c(d.preOrderPrice-l),preOrderLabel:f}}})},n.roundToCents=c,n.formatPriceSimple=function(e){return Number.isInteger(e)?e.toString():e.toFixed(2)},n.maybeFilterColorsFromSibling=function({product:e,siblingProduct:n,context:t}){return(0,a.filterExtraColors)({isFilterVariation:()=>"filter"===t.getAssignment("bundleSiblingColorOptions"),heroProduct:e,product:n})};const i=t(15),o=t(252),a=t(190),u=t(5);function d(e){return e.handle.startsWith("dynamic-bundle-discount")}function l(e,n){if(!e.isDynamicDiscount)return e.maxBundleDiscount;const t=n.map((e=>"variantId"in e?{isPreOrderVariant:(0,i.isPreOrderVariant)(e),discount:e.maxBundleDiscount,price:parseFloat(e.price)}:e)),r=t.map((n=>{const t=function(e,n){var t;if(!e.isDynamicDiscount)return e.maxBundleDiscount;const r=null!==(t=n.discount)&&void 0!==t?t:e.maxBundleDiscount;return void 0!==e.maxPreOrderDiscount&&n.isPreOrderVariant?Math.min(e.maxPreOrderDiscount,r):r}(e,n);return t*(e.avgDiscounts?n.price:1)}));if(e.avgDiscounts){const e=t.reduce(((e,n)=>e+n.price),0),n=r.reduce(((e,n)=>e+n),0);return Math.ceil(n/e)}return Math.min(e.maxBundleDiscount,...r)}function c(e){return Math.round(100*e)/100}function s(e,n){var t;const r=n.reduce(((e,n)=>{var t,r;return e+parseFloat(null!==(r=null===(t=n.preorderVariant)||void 0===t?void 0:t.price)&&void 0!==r?r:"NaN")}),0),o=n.reduce(((e,n)=>e+parseFloat(n.price)),0),a=n.reduce(((e,n)=>{var t,r;return e+parseFloat(null!==(r=null!==(t=n.compareAtPrice)&&void 0!==t?t:n.price)&&void 0!==r?r:"0")}),0),u=l(e,n)/100,d=(null!==(t=e.maxPreOrderDiscount)&&void 0!==t?t:e.maxBundleDiscount)/100;return{compareAtBundlePrice:o,compareAtRetailBundlePrice:a,bundlePrice:c(o*(1-u)),bundleDiscount:u,preOrderPrice:c(r*(1-d)),preOrderShipDate:(0,i.formatPreorderBundleDate)(n,!0),availableForSale:n.every((e=>!e.oos))}}},190:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.completeTheLookVariation=function({getAssignment:e,heroProduct:n,selectedVariant:t,completeTheLook:r}){var i;const u="filterProducts",d="sortProducts",l=["filterColors",u,d];if(!n)return{};const c=r.filter(((e,n)=>n<2)),s=c.some((e=>o({heroProduct:n,product:e})));if(!c.some((e=>a({product:e,selectedVariant:t})))&&!s)return{};const f=null!==(i=e("completeTheLookOptions"))&&void 0!==i?i:"default",p=f===u;return{filterColors:l.includes(f),filterProducts:p,sortProducts:p||f===d}},n.mapAndFilterCompleteLookProducts=function({variation:e,heroProduct:n,selectedVariant:t,completeTheLook:r,skipFilter:o}){return(r=function({variation:e,selectedVariant:n,completeTheLook:t,skipFilter:r}){if(!n)return t;if(!r&&e.filterProducts)return t.filter((e=>!a({product:e,selectedVariant:n})));if(e.sortProducts){const e=[...t];return e.sort(((e,t)=>{const r=a({product:e,selectedVariant:n}),i=a({product:t,selectedVariant:n});return r===i?0:i?-1:1})),e}return t}({variation:e,selectedVariant:t,completeTheLook:r,skipFilter:o})).map((t=>i({isFilterVariation:e.filterColors,heroProduct:n,product:t})))},n.filterExtraColors=i;const r=t(68);function i({isFilterVariation:e,heroProduct:n,product:t}){if(!e)return t;const r=o({heroProduct:n,product:t});if(!r)return t;if("function"==typeof e&&!e())return t;const i=t.options.map((e=>"Color"!==e.name?e:Object.assign(Object.assign({},e),{values:r}))),a=t.variants.filter((e=>r.includes(e.selectedOptions.Color)));return Object.assign(Object.assign({},t),{options:i,variants:a})}function o({heroProduct:e,product:n}){var t,i;const o=null===(t=(0,r.getColorOption)(e.options))||void 0===t?void 0:t.values,a=null===(i=(0,r.getColorOption)(n.options))||void 0===i?void 0:i.values;if(!o||!a)return;const u=a.filter((e=>o.includes(e)));return u.length!==a.length&&0!==u.length?u:void 0}function a({product:e,selectedVariant:n}){if(!n)return!1;const t=(0,r.getSelectedColor)(n),i=(0,r.getColorOption)(e.options);return t&&!(null==i?void 0:i.values.includes(t))}}}]);