OwlCyberSecurity - MANAGER
Edit File: product-image-frontend.js
(globalThis.webpackChunkwebpackWcBlocksFrontendJsonp=globalThis.webpackChunkwebpackWcBlocksFrontendJsonp||[]).push([[232,442],{3014:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>w});var o=s(1616),a=s(6087),n=s(7723),l=s(4921),r=s(5703),i=s(2796),c=s(41),d=s(1509),u=s(8537),g=s(3993),m=s(3848);s(1189);let p=function(e){return e.SINGLE="single",e.THUMBNAIL="thumbnail",e}({});var h=s(790);const y=e=>(0,h.jsx)("img",{...e,src:r.PLACEHOLDER_IMG_SRC,alt:"",width:void 0,height:void 0}),f=({image:e,loaded:t,showFullSize:s,fallbackAlt:o,width:a,scale:n,height:l,aspectRatio:r})=>{const{thumbnail:i,src:c,srcset:d,sizes:u,alt:g}=e||{},m={alt:g||o,hidden:!t,src:i,...s&&{src:c,srcSet:d,sizes:u}},p={height:l,width:a,objectFit:n,aspectRatio:r};return(0,h.jsxs)(h.Fragment,{children:[m.src&&(0,h.jsx)("img",{style:p,"data-testid":"product-image",...m}),!e&&(0,h.jsx)(y,{style:p})]})},b=e=>{const{product:t}=e;return!(0,g.isEmpty)(t)&&(void 0===(s=e.showSaleBadge)||s);var s},k=(0,o.withProductDataContext)((e=>{const{aspectRatio:t,children:s,className:o,height:r,imageId:k,imageSizing:S=p.SINGLE,scale:w,showProductLink:x=!0,style:N,width:j,...v}=e,C=(0,c.p)(e),{parentClassName:L}=(0,i.useInnerBlockLayoutContext)(),{product:_,isLoading:A}=(0,i.useProductDataContext)(),{dispatchStoreEvent:F}=(0,d.y)();if(!_?.id)return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)("div",{className:(0,l.A)(o,"wc-block-components-product-image",{[`${L}__product-image`]:L},C.className),style:C.style,children:(0,h.jsx)(y,{})}),s]});const B=((e,t)=>e.images.length?t&&e.images.find((e=>e.id===t))||e.images[0]:null)(_,k);B&&(B.alt=B.alt||(0,u.decodeEntities)(_.name));const P=x?"a":a.Fragment,R=_?.name? // translators: %s is the product name. // translators: %s is the product name. (0,n.sprintf)((0,n.__)("Link to %s","woocommerce"),_.name):"",z={href:x?_?.permalink:void 0,...x&&{"aria-label":R,onClick:()=>{F("product-view-link",{product:_})}}};return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)("div",{className:(0,l.A)(o,"wc-block-components-product-image",{[`${L}__product-image`]:L},C.className),style:C.style,children:[b(e)&&(0,h.jsx)(m.default,{align:e.saleBadgeAlign||"right",...v}),(0,h.jsx)(P,{...x&&z,children:(0,h.jsx)(f,{fallbackAlt:(0,u.decodeEntities)(_.name),image:B,loaded:!A,showFullSize:S!==p.THUMBNAIL,width:j,height:r,scale:w,aspectRatio:(0,g.objectHasProp)(N,"dimensions")&&(0,g.objectHasProp)(N.dimensions,"aspectRatio")&&(0,g.isString)(N.dimensions.aspectRatio)?N.dimensions.aspectRatio:t})})]}),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"}}}'),w=(0,o.withFilteredAttributes)(S.uK)(k)},3848:(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),l=s(2796),r=s(41),i=s(1616),c=(s(4313),s(790));const d=e=>{const{className:t,align:s,isDescendentOfSingleProductTemplate:i}=e,d=(0,r.p)(e),{parentClassName:u}=(0,l.useInnerBlockLayoutContext)(),{product:g}=(0,l.useProductDataContext)();if(!(g.id&&g.on_sale||i))return null;const m="string"==typeof s?`wc-block-components-product-sale-badge--align-${s}`:"";return(0,c.jsx)("div",{className:(0,a.A)("wc-block-components-product-sale-badge",t,m,{[`${u}__product-onsale`]:u},d.className),style:d.style,children:(0,c.jsx)(n.Label,{label:(0,o.__)("Sale","woocommerce"),screenReaderLabel:(0,o.__)("Product on sale","woocommerce")})})},u=(0,i.withProductDataContext)(d)},41:(e,t,s)=>{"use strict";s.d(t,{p:()=>c});var o=s(4921),a=s(3993),n=s(7356),l=s(9786);function r(e={}){const t={};return(0,l.getCSSRules)(e,{selector:""}).forEach((e=>{t[e.key]=e.value})),t}function i(e,t){return e&&t?`has-${(0,n.c)(t)}-${e}`:""}const c=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:l}=e,c=i("background-color",t),d=i("color",s),u=function(e){if(e)return`has-${e}-gradient-background`}(n),g=u||l?.color?.gradient;return{className:(0,o.A)(d,u,{[c]:!g&&!!c,"has-text-color":s||l?.color?.text,"has-background":t||l?.color?.background||n||l?.color?.gradient,"has-link-color":(0,a.isObject)(l?.elements?.link)?l?.elements?.link?.color:void 0}),style:r({color:l?.color||{}})}}(t),n=function(e){const t=e.style?.border||{};return{className:function(e){const{borderColor:t,style:s}=e,a=t?i("border-color",t):"";return(0,o.A)({"has-border-color":!!t||!!s?.border?.color,[a]:!!a})}(e),style:r({border:t})}}(t),l=function(e){return{className:void 0,style:r({spacing:e.style?.spacing||{}})}}(t),c=(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)(c.className,s.className,n.className,l.className),style:{...c.style,...s.style,...n.style,...l.style}}}},1189:()=>{},4313:()=>{}}]);