(globalThis.webpackChunkwebpackWcBlocksFrontendJsonp=globalThis.webpackChunkwebpackWcBlocksFrontendJsonp||[]).push([[232,442],{7957:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>x});var o=s(1616),a=s(6087),n=s(7723),i=s(4921),l=s(5703),c=s(2796),r=s(3754),d=s(8981),u=s(8537),g=s(3993),p=s(4927);s(1189);let m=function(e){return e.SINGLE="single",e.THUMBNAIL="thumbnail",e.CROPPED="cropped",e}({});var h=s(790);const y=e=>{const{aspectRatio:t,height:s,width:o,scale:a}=e;return{height:s,width:o,objectFit:a,aspectRatio:t}},f=e=>{const t=(0,l.getSetting)("placeholderImgSrcFullSize",l.PLACEHOLDER_IMG_SRC);return(0,h.jsx)("img",{...e,src:t,alt:"",width:void 0,height:void 0})},b=({image:e,loaded:t,fallbackAlt:s,width:o,scale:a,height:n,aspectRatio:i})=>{const{src:l,srcset:c,sizes:r,alt:d}=e||{},u={alt:d||s,hidden:!t,src:l,srcSet:c,sizes:r},g=y({height:n,width:o,scale:a,aspectRatio:i});return e?(0,h.jsx)("img",{style:g,"data-testid":"product-image",...u}):(0,h.jsx)(f,{style:g})},k=e=>{const{product:t}=e;return!(0,g.isEmpty)(t)&&(void 0===(s=e.showSaleBadge)||s);var s},w=(0,o.withProductDataContext)(e=>{const{aspectRatio:t,children:s,className:o,height:g,imageId:w,imageSizing:S,scale:x,showProductLink:N=!0,style:v,width:R,isAdmin:C,product:j,isResolving:A,..._}=e,L=(0,r.p)(e),{parentClassName:P}=(0,c.useInnerBlockLayoutContext)(),{product:B,isLoading:D}=(0,c.useProductDataContext)({isAdmin:C,product:j,isResolving:A}),{dispatchStoreEvent:F}=(0,d.y)(),O=((e,t,s,o)=>e&&e.dimensions&&e.dimensions.aspectRatio&&"string"==typeof e.dimensions.aspectRatio?e.dimensions.aspectRatio:t&&"string"==typeof t?t:!o||o!==m.THUMBNAIL&&o!==m.CROPPED?void 0:s??void 0)(v,t,(0,l.getSetting)("thumbnailAspectRatio",null),S),z=`wc-block-components-product-image--aspect-ratio-${O?O.replace("/","-"):"auto"}`;if(!B?.id){const e=y({height:g,width:R,scale:x,aspectRatio:O});return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)("div",{className:(0,i.A)(o,"wc-block-components-product-image",z,{[`${P}__product-image`]:P},L.className),style:L.style,children:(0,h.jsx)(f,{style:e})}),s]})}const E=((e,t)=>e.images.length?t&&e.images.find(e=>e.id===t)||e.images[0]:null)(B,w);E&&(E.alt=E.alt||(0,u.decodeEntities)(B.name));const $=N?"a":a.Fragment,I=B?.name?
// translators: %s is the product name.
// translators: %s is the product name.
(0,n.sprintf)((0,n.__)("Link to %s","woocommerce"),B.name):"",T={href:N?B?.permalink:void 0,...N&&{"aria-label":I,onClick:()=>{F("product-view-link",{product:B})}}};return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)("div",{className:(0,i.A)(o,"wc-block-components-product-image",z,{[`${P}__product-image`]:P},L.className),style:L.style,children:[k(e)&&(0,h.jsx)(p.default,{align:e.saleBadgeAlign||"right",..._}),(0,h.jsx)($,{...!C&&N&&T,children:(0,h.jsx)(b,{fallbackAlt:(0,u.decodeEntities)(B.name),image:E,loaded:!D,width:R,height:g,scale:x,aspectRatio:O})})]}),s]})}),S=JSON.parse('{"uK":{"showProductLink":{"type":"boolean","default":true},"showSaleBadge":{"type":"boolean","default":true},"saleBadgeAlign":{"type":"string","default":"right"},"imageSizing":{"type":"string","default":"single"},"productId":{"type":"number","default":0},"isDescendentOfQueryLoop":{"type":"boolean","default":false},"isDescendentOfSingleProductBlock":{"type":"boolean","default":false},"width":{"type":"string"},"height":{"type":"string"},"scale":{"type":"string","default":"cover"},"aspectRatio":{"type":"string"}}}'),x=(0,o.withFilteredAttributes)(S.uK)(w)},4927:(e,t,s)=>{"use strict";s.r(t),s.d(t,{Block:()=>d,default:()=>u});var o=s(7723),a=s(4921),n=s(4656),i=s(2796),l=s(3754),c=s(1616),r=(s(4313),s(790));const d=e=>{const{className:t,align:s,isDescendentOfSingleProductTemplate:c}=e,d=(0,l.p)(e),{parentClassName:u}=(0,i.useInnerBlockLayoutContext)(),{product:g}=(0,i.useProductDataContext)();if(!(g.id&&g.on_sale||c))return null;const p="string"==typeof s?`wc-block-components-product-sale-badge--align-${s}`:"";return(0,r.jsx)("div",{className:(0,a.A)("wc-block-components-product-sale-badge",t,p,{[`${u}__product-onsale`]:u},d.className),style:d.style,children:(0,r.jsx)(n.Label,{label:(0,o.__)("Sale","woocommerce"),screenReaderLabel:(0,o.__)("Product on sale","woocommerce")})})},u=(0,c.withProductDataContext)(d)},3754:(e,t,s)=>{"use strict";s.d(t,{p:()=>r});var o=s(4921),a=s(3993),n=s(7356),i=s(9786);function l(e={}){const t={};return(0,i.getCSSRules)(e,{selector:""}).forEach(e=>{t[e.key]=e.value}),t}function c(e,t){return e&&t?`has-${(0,n.c)(t)}-${e}`:""}const r=e=>{const t=(e=>{const t=(0,a.isObject)(e)?e:{style:{}};let s=t.style;return(0,a.isString)(s)&&(s=JSON.parse(s)||{}),(0,a.isObject)(s)||(s={}),{...t,style:s}})(e),s=function(e){const{backgroundColor:t,textColor:s,gradient:n,style:i}=e,r=c("background-color",t),d=c("color",s),u=function(e){if(e)return`has-${e}-gradient-background`}(n),g=u||i?.color?.gradient;return{className:(0,o.A)(d,u,{[r]:!g&&!!r,"has-text-color":s||i?.color?.text,"has-background":t||i?.color?.background||n||i?.color?.gradient,"has-link-color":(0,a.isObject)(i?.elements?.link)?i?.elements?.link?.color:void 0}),style:l({color:i?.color||{}})}}(t),n=function(e){const t=e.style?.border||{};return{className:function(e){const{borderColor:t,style:s}=e,a=t?c("border-color",t):"";return(0,o.A)({"has-border-color":!!t||!!s?.border?.color,[a]:!!a})}(e),style:l({border:t})}}(t),i=function(e){return{className:void 0,style:l({spacing:e.style?.spacing||{}})}}(t),r=(e=>{const t=(0,a.isObject)(e.style.typography)?e.style.typography:{},s=(0,a.isString)(t.fontFamily)?t.fontFamily:"";return{className:e.fontFamily?`has-${e.fontFamily}-font-family`:s,style:{fontSize:e.fontSize?`var(--wp--preset--font-size--${e.fontSize})`:t.fontSize,fontStyle:t.fontStyle,fontWeight:t.fontWeight,letterSpacing:t.letterSpacing,lineHeight:t.lineHeight,textDecoration:t.textDecoration,textTransform:t.textTransform}}})(t);return{className:(0,o.A)(r.className,s.className,n.className,i.className),style:{...r.style,...s.style,...n.style,...i.style}}}},1189:()=>{},4313:()=>{}}]);