"use strict";var product=require("../../../helpers/product.js"),productFeaturedImage=require("../../product-images/common/productFeaturedImage.js"),helpers=require("../../../../carousel/components/dot/common/helpers.js");const getData=e=>{let{setting:t,styles:o}=e,r=t?.productSetting??{},d="RelatedProduct"===r.productSrc,c=helpers.getUpdatedDotStyle(t?.dot,t?.dotStyle),l={dotSize:{desktop:12},dotGapToCarousel:{desktop:16},arrowIconSize:{desktop:24},showWhenHover:!1,rtl:!1,...t};delete l.childItem;let a={...o,sizeSetting:{...product.getSizeSetting({adaptiveHeight:o?.adaptiveHeight,height:o?.height,fullWidth:{desktop:!0}})},spacing:o?.spacing};return delete a.backgroundColor,delete a.backgroundImage,{isRelatedProduct:d,productSetting:r,dotStyle:c,carouselConfigSetting:l,carouselConfigStyle:a}},getDataLiquid=e=>{let{setting:t,styles:o}=e,r=t?.productSetting,d=r?.relatedTag,c=r?.hasRelatedExclude,l=(d&&"collection"===d[0]?r?.relatedCollectionExclude:r?.relatedTagsExclude)??"",a=l?.split(",").map(e=>e.trim()).toString(),i=r?.productSrc??"Collection",u=r?.collectionId?.replace(PREFIX_COLLECTION_ID,"")??"latest",p=r?.productSrc==="PickProduct"&&r?.productIds?.length===0,n=o?.layout==="grid",s=productFeaturedImage.convertUnitToNumber(t?.numberOfProducts,4),g="PickProduct"===i&&r?.productIds?.length?r?.productIds.map(e=>e.replace(PREFIX_PRODUCT_ID,"")):[],I="PickProduct"===i&&r?.productHandles?.length?r?.productHandles:[],P=t?.orderBy&&t?.orderBy!=="none",h=(r?.productSrc==="Collection"||r?.productSrc==="DynamicCollection")&&P?t?.orderBy?.split("_"):"none",D=P&&h?.[0]==="TITLE"?"| sort: 'title'":"| sort: 'updated_at'",C=h?.[h.length-1]==="DESC",m=()=>"PickProduct"===i?p?4:r?.numOfSelectedProducts??4:s;return{hasRelatedExclude:c,relatedExcludeTrim:a,collectionID:u,isLatestProducts:p,isGrid:n,numberOfProducts:s,productListId:g,productListHandles:I,sortedBy:D,isReverse:C,productSrc:i,productSetting:r,isSorted:P,relatedTag:d,productNumber:m(),collectionHandle:r?.collectionHandle}},PREFIX_COLLECTION_ID="gid://shopify/Collection/",PREFIX_PRODUCT_ID="gid://shopify/Product/";exports.PREFIX_COLLECTION_ID=PREFIX_COLLECTION_ID,exports.PREFIX_PRODUCT_ID=PREFIX_PRODUCT_ID,exports.getData=getData,exports.getDataLiquid=getDataLiquid;
