import{BreadcrumbHomeTemplate as e}from"./templates/home.js";import{BreadcrumbLadingTemplate as t}from"./templates/landing.js";import{BreadcrumbProductTemplate as o}from"./templates/product.js";import{BreadcrumbCollectionTemplate as m}from"./templates/collection.js";import{BreadcrumbArticleTemplate as s}from"./templates/article.js";import{generateBreadcrumbChildIconStyles as r,getBreadcrumbChildItemStyles as p}from"../common/styles.js";import{createStyle as l,createClass as i}from"@gem-sdk/system";import{getBreadcrumbSecondItemClasses as n,getBreadcrumbContainerChildItemClasses as a,getBreadcrumbChildItemClasses as c,generateBreadcrumbClasses as d}from"../common/classes.js";import{composeAppendTypoStyle as f,composeAppendTypoClass as u}from"../common/helpers.js";let BreadcrumbItem=g=>{let{breadcrumbItemIndex:y,lengthOfBreadcrumb:j,setting:x,styles:$}=g,{fontWeight:b,labelColor:C,hideCurrentPage:S}=x??{},h={home:e,landing:t,product:o,collection:m,article:s},I=l({...r(x?.iconWidth,x?.color)}),P=l({...p({breadcrumbItemIndex:y,lengthOfBreadcrumb:j,appendTypoStyle:f($?.typo),fontWeight:b,labelColor:C})}),N=l({...p({breadcrumbItemIndex:0,lengthOfBreadcrumb:j,appendTypoStyle:f($?.typo),fontWeight:b,labelColor:C})}),O=i({...n(y,S,j)}),k=i({...a()}),v=i({...c(y,j,u($?.typo))}),B=y+1===j&&"home"!==g.templateName,T=i({...d(S,{indexOffset:y??0,lengthOfBreadcrumb:j,extendCondition:B})}),H=()=>B?`${v} ${T}`.trim():v,W=()=>{let e=i({...d(S,{indexOffset:y??0,lengthOfBreadcrumb:j,extendCondition:!0})});return`${v} ${e}`.trim()},q=()=>`${v} ${T}`.trim(),w=()=>{let e=i({...d(S,{indexOffset:y??0,lengthOfBreadcrumb:j,extendCondition:!1})});return`${v} ${e}`.trim()},z=i({...n(y,{desktop:!1,tablet:!1,mobile:!1},j)}),A=g.templateName?h[g.templateName]({getBreadcrumbChildIconStyles:I,breadcrumbChildItemStyles:P,breadcrumbSecondItemClasses:O,breadcrumbChildItemClasses:v,breadcrumbChildSecondItemStyles:N,breadcrumbContainerChildItemClasses:k,composePageClasses:H(),composeHomePageClasses:W(),composePageSecondClasses:q(),composeSubPageClasses:w(),breadcrumbSubPageIconItemClasses:z,iconSvg:x?.iconSvg}):null;return A};export{BreadcrumbItem};
