(self.webpackChunkwebpackWcBlocksCartCheckoutFrontendJsonp=self.webpackChunkwebpackWcBlocksCartCheckoutFrontendJsonp||[]).push([[3819],{6838:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>O});var c=a(1609),s=a(8645),o=a(2796),n=a(6087),r=a(7723),l=a(851),i=a(5703),d=a(2150),m=a(1616),u=a(9499),p=a(8537),g=a(4656);a(6007);const _=(0,m.withProductDataContext)((e=>{const{className:t,align:a}=e,s=(0,d.p)(e),{parentClassName:n}=(0,o.useInnerBlockLayoutContext)(),{product:i}=(0,o.useProductDataContext)();if(!(i.id&&i.on_sale||e.isDescendentOfSingleProductTemplate))return null;const m="string"==typeof a?`wc-block-components-product-sale-badge--align-${a}`:"";return(0,c.createElement)("div",{className:(0,l.A)("wc-block-components-product-sale-badge",t,m,{[`${n}__product-onsale`]:n},s.className),style:s.style},(0,c.createElement)(g.Label,{label:(0,r.__)("Sale","woocommerce"),screenReaderLabel:(0,r.__)("Product on sale","woocommerce")}))}));a(5183);let w=function(e){return e.SINGLE="single",e.THUMBNAIL="thumbnail",e}({});const N=e=>(0,c.createElement)("img",{...e,src:i.PLACEHOLDER_IMG_SRC,alt:e.alt,width:void 0,height:void 0}),k=({image:e,loaded:t,showFullSize:a,fallbackAlt:s,width:o,scale:r,height:l,aspectRatio:i})=>{const{thumbnail:d,src:m,srcset:u,sizes:p,alt:g}=e||{},_={alt:g||s,hidden:!t,src:d,...a&&{src:m,srcSet:u,sizes:p}},w={height:l,width:o,objectFit:r,aspectRatio:i};return(0,c.createElement)(n.Fragment,null,_.src&&(0,c.createElement)("img",{style:w,"data-testid":"product-image",..._}),!e&&(0,c.createElement)(N,{style:w,alt:_.alt}))},v=e=>{const{className:t,imageSizing:a=w.SINGLE,showProductLink:s=!0,showSaleBadge:i,saleBadgeAlign:m="right",height:g,width:v,scale:b,aspectRatio:h,...E}=e,y=(0,d.p)(e),{parentClassName:C}=(0,o.useInnerBlockLayoutContext)(),{product:L,isLoading:P}=(0,o.useProductDataContext)(),{dispatchStoreEvent:f}=(0,u.y)();if(!L.id)return(0,c.createElement)("div",{className:(0,l.A)(t,"wc-block-components-product-image",{[`${C}__product-image`]:C},y.className),style:y.style},(0,c.createElement)(N,null));const A=!!L.images.length,x=A?L.images[0]:null,$=s?"a":n.Fragment,S=(0,r.sprintf)(/* translators: %s is referring to the product name */ /* translators: %s is referring to the product name */
(0,r.__)("Link to %s","woocommerce"),L.name),R={href:L.permalink,...!A&&{"aria-label":S},onClick:()=>{f("product-view-link",{product:L})}};return delete E.style,(0,c.createElement)("div",{className:(0,l.A)(t,"wc-block-components-product-image",{[`${C}__product-image`]:C},y.className),style:y.style},(0,c.createElement)($,{...s&&R},!!i&&(0,c.createElement)(_,{align:m,...E}),(0,c.createElement)(k,{fallbackAlt:(0,p.decodeEntities)(L.name),image:x,loaded:!P,showFullSize:a!==w.THUMBNAIL,width:v,height:g,scale:b,aspectRatio:h})))};(0,m.withProductDataContext)(v);var b=a(7702);a(7128);const h=({children:e,headingLevel:t,elementType:a=`h${t}`,...s})=>(0,c.createElement)(a,{...s},e),E=e=>{const{className:t,headingLevel:a=2,showProductLink:s=!0,linkTarget:n,align:r}=e,i=(0,d.p)(e),{parentClassName:m}=(0,o.useInnerBlockLayoutContext)(),{product:p}=(0,o.useProductDataContext)(),{dispatchStoreEvent:g}=(0,u.y)();return p.id?(0,c.createElement)(h,{headingLevel:a,className:(0,l.A)(t,i.className,"wc-block-components-product-title",{[`${m}__product-title`]:m,[`wc-block-components-product-title--align-${r}`]:r}),style:i.style},(0,c.createElement)(b.A,{disabled:!s,name:p.name,permalink:p.permalink,target:n,onClick:()=>{g("product-view-link",{product:p})}})):(0,c.createElement)(h,{headingLevel:a,className:(0,l.A)(t,i.className,"wc-block-components-product-title",{[`${m}__product-title`]:m,[`wc-block-components-product-title--align-${r}`]:r}),style:i.style})};(0,m.withProductDataContext)(E);var y=a(3993);const C=e=>({width:e/5*100+"%"}),L=({className:e,parentClassName:t})=>{const a=C(0);return(0,c.createElement)("div",{className:(0,l.A)(`${e}__norating-container`,`${t}-product-rating__norating-container`)},(0,c.createElement)("div",{className:`${e}__norating`,role:"img"},(0,c.createElement)("span",{style:a})),(0,c.createElement)("span",null,(0,r.__)("No Reviews","woocommerce")))},P=e=>{const{className:t,rating:a,reviews:s,parentClassName:o}=e,n=C(a),i=(0,r.sprintf)(/* translators: %f is referring to the average rating value */ /* translators: %f is referring to the average rating value */
(0,r.__)("Rated %f out of 5","woocommerce"),a),d={__html:(0,r.sprintf)(/* translators: %1$s is referring to the average rating value, %2$s is referring to the number of ratings */ /* translators: %1$s is referring to the average rating value, %2$s is referring to the number of ratings */
(0,r._n)("Rated %1$s out of 5 based on %2$s customer rating","Rated %1$s out of 5 based on %2$s customer ratings",s,"woocommerce"),(0,r.sprintf)('<strong class="rating">%f</strong>',a),(0,r.sprintf)('<span class="rating">%d</span>',s))};return(0,c.createElement)("div",{className:(0,l.A)(`${t}__stars`,`${o}__product-rating__stars`),role:"img","aria-label":i},(0,c.createElement)("span",{style:n,dangerouslySetInnerHTML:d}))},f=e=>{const{className:t,reviews:a}=e,s=(0,r.sprintf)(/* translators: %s is referring to the total of reviews for a product */ /* translators: %s is referring to the total of reviews for a product */
(0,r._n)("(%s customer review)","(%s customer reviews)",a,"woocommerce"),a);return(0,c.createElement)("span",{className:`${t}__reviews_count`},s)},A=e=>{const{className:t="wc-block-components-product-rating",showReviewCount:a,showMockedReviews:s,parentClassName:o="",rating:n,reviews:r,styleProps:i,textAlign:d}=e,m=(0,l.A)(i.className,t,{[`${o}__product-rating`]:o,[`has-text-align-${d}`]:d}),u=s&&(0,c.createElement)(L,{className:t,parentClassName:o}),p=r?(0,c.createElement)(P,{className:t,rating:n,reviews:r,parentClassName:o}):u,g=r&&a;return(0,c.createElement)("div",{className:m,style:i.style},(0,c.createElement)("div",{className:`${t}__container`},p,g?(0,c.createElement)(f,{className:t,reviews:r}):null))};a(7195);const x=e=>{const{textAlign:t="",shouldDisplayMockedReviewsWhenProductHasNoReviews:a}=e,s=(0,d.p)(e),{parentClassName:n}=(0,o.useInnerBlockLayoutContext)(),{product:r}=(0,o.useProductDataContext)(),l=(e=>{const t=parseFloat(e.average_rating);return Number.isFinite(t)&&t>0?t:0})(r),i=(e=>{const t=(0,y.isNumber)(e.review_count)?e.review_count:parseInt(e.review_count,10);return Number.isFinite(t)&&t>0?t:0})(r);return(0,c.createElement)(A,{className:"wc-block-components-product-rating-stars",showMockedReviews:a,styleProps:s,parentClassName:n,reviews:i,rating:l,textAlign:t})};(0,m.withProductDataContext)(x);var $=a(8834),S=a(910);const R=e=>{var t,a;const{className:s,textAlign:n,isDescendentOfSingleProductTemplate:r}=e,i=(0,d.p)(e),{parentName:m,parentClassName:u}=(0,o.useInnerBlockLayoutContext)(),{product:p}=(0,o.useProductDataContext)(),g="woocommerce/all-products"===m,_=r&&!("woocommerce/add-to-cart-with-options-grouped-product-selector-item"===m),w=(0,l.A)("wc-block-components-product-price",s,i.className,{[`${u}__product-price`]:u});if(!p.id&&!r){const e=(0,c.createElement)($.A,{align:n,className:w});return g?(0,c.createElement)("div",{className:"wp-block-woocommerce-product-price"},e):e}const N=p.prices,k=_?(0,S.getCurrencyFromPriceResponse)():(0,S.getCurrencyFromPriceResponse)(N),v="5000",b=N.price!==N.regular_price,h=(0,l.A)({[`${u}__product-price__value`]:u,[`${u}__product-price__value--on-sale`]:b}),E=(0,c.createElement)($.A,{align:n,className:w,style:i.style,regularPriceStyle:i.style,priceStyle:i.style,priceClassName:h,currency:k,price:_?v:N.price,minPrice:null==N||null===(t=N.price_range)||void 0===t?void 0:t.min_amount,maxPrice:null==N||null===(a=N.price_range)||void 0===a?void 0:a.max_amount,regularPrice:_?v:N.regular_price,regularPriceClassName:(0,l.A)({[`${u}__product-price__regular`]:u})});return g?(0,c.createElement)("div",{className:"wp-block-woocommerce-product-price"},E):E};var D=a(3564),I=a(2516);a(1546);const B=({product:e,className:t,style:a})=>{const{id:s,permalink:o,add_to_cart:n,has_options:d,is_purchasable:m,is_in_stock:g}=e,{dispatchStoreEvent:_}=(0,u.y)(),{cartQuantity:w,addingToCart:N,addToCart:k}=(0,D.R)(s),v=Number.isFinite(w)&&w>0,b=!d&&m&&g,h=(0,p.decodeEntities)((null==n?void 0:n.description)||""),E=v?(0,r.sprintf)(/* translators: %s number of products in cart. */ /* translators: %s number of products in cart. */
(0,r._n)("%d in cart","%d in cart",w,"woocommerce"),w):(0,p.decodeEntities)((null==n?void 0:n.text)||(0,r.__)("Add to cart","woocommerce")),y=b?"button":"a",C={};return b?C.onClick=async()=>{await k(),_("cart-add-item",{product:e});const{cartRedirectAfterAdd:t}=(0,i.getSetting)("productsSettings");t&&(window.location.href=I.Vo)}:(C.href=o,C.rel="nofollow",C.onClick=()=>{_("product-view-link",{product:e})}),(0,c.createElement)(y,{...C,"aria-label":h,disabled:N,className:(0,l.A)(t,"wp-block-button__link","wp-element-button","add_to_cart_button","wc-block-components-product-button__button",{loading:N,added:v}),style:a},E)},F=({className:e,style:t,isLoading:a})=>(0,c.createElement)("button",{className:(0,l.A)("wp-block-button__link","wp-element-button","add_to_cart_button","wc-block-components-product-button__button",{"wc-block-components-product-button__button--placeholder":a},e),style:t,disabled:!0},(0,r.__)("Add to cart","woocommerce")),T=e=>{const{className:t,textAlign:a}=e,s=(0,d.p)(e),{parentClassName:n}=(0,o.useInnerBlockLayoutContext)(),{isLoading:r,product:i}=(0,o.useProductDataContext)();return(0,c.createElement)("div",{className:(0,l.A)(t,"wp-block-button","wc-block-components-product-button",{[`${n}__product-add-to-cart`]:n,[`align-${a}`]:a})},i.id?(0,c.createElement)(B,{product:i,style:s.style,className:s.className}):(0,c.createElement)(F,{style:s.style,className:s.className,isLoading:r}))},M=((0,m.withProductDataContext)(T),({product:e})=>(0,c.createElement)("div",{className:"cross-sells-product"},(0,c.createElement)(o.InnerBlockLayoutContextProvider,{parentName:"woocommerce/cart-cross-sells-block",parentClassName:"wp-block-cart-cross-sells-product"},(0,c.createElement)(o.ProductDataContextProvider,{isLoading:!1,product:e},(0,c.createElement)("div",null,(0,c.createElement)(v,{className:"",showSaleBadge:!0,productId:e.id,showProductLink:!0,saleBadgeAlign:"left",imageSizing:w.SINGLE,isDescendentOfQueryLoop:!1,scale:"cover",aspectRatio:"1:1"}),(0,c.createElement)(E,{align:"",headingLevel:3,showProductLink:!0}),(0,c.createElement)(x,{isDescendentOfQueryLoop:!1,isDescendentOfSingleProductBlock:!1,productId:e.id,postId:0,shouldDisplayMockedReviewsWhenProductHasNoReviews:!1}),(0,c.createElement)(R,null)),(0,c.createElement)(T,null))))),z=({products:e,columns:t})=>{const a=e.map(((e,a)=>a>=t?null:(0,c.createElement)(M,{isLoading:!1,product:e,key:e.id})));return(0,c.createElement)("div",null,a)};var H=a(7292);const O=({className:e,columns:t})=>{const{crossSellsProducts:a}=(0,s.V)();return void 0===t&&(t=H.attributes.columns.default),(0,c.createElement)(z,{className:e,columns:t,products:a})}},1546:()=>{},5183:()=>{},7195:()=>{},6007:()=>{},7128:()=>{}}]);