import{h,Host}from"@stencil/core";import{sizeImage,getFeaturedProductMediaAttributes}from"../../../../functions/media";import{applyFilters}from"@wordpress/hooks";export class ScProductItemImage{constructor(){this.product=void 0,this.sizing=void 0}getSrc(){var t,e,i,r,o,d,s,c,a,u,l;return(null===(e=null===(t=this.product)||void 0===t?void 0:t.featured_product_media)||void 0===e?void 0:e.url)?null===(r=null===(i=this.product)||void 0===i?void 0:i.featured_product_media)||void 0===r?void 0:r.url:(null===(s=null===(d=null===(o=this.product)||void 0===o?void 0:o.featured_product_media)||void 0===d?void 0:d.media)||void 0===s?void 0:s.url)?sizeImage(null===(u=null===(a=null===(c=this.product)||void 0===c?void 0:c.featured_product_media)||void 0===a?void 0:a.media)||void 0===u?void 0:u.url,applyFilters("surecart/product-list/media/size",900)):`${null===(l=window.scData)||void 0===l?void 0:l.plugin_url}/images/placeholder.jpg`}render(){const{alt:t,title:e}=getFeaturedProductMediaAttributes(this.product);return h(Host,{key:"d654049525a5e944585cbd25b57294964f1a2f16",style:{borderStyle:"none"}},h("div",{key:"a552abf3d4237c6c0733d012852370ea48e0afb9",class:{"product-img":!0,is_contained:"contain"===this.sizing,is_covered:"cover"===this.sizing}},this.getSrc()?h("img",{src:this.getSrc(),alt:t,...e?{title:e}:{}}):h("div",{class:"product-img_placeholder"})))}static get is(){return"sc-product-item-image"}static get encapsulation(){return"shadow"}static get originalStyleUrls(){return{$:["sc-product-item-image.scss"]}}static get styleUrls(){return{$:["sc-product-item-image.css"]}}static get properties(){return{product:{type:"unknown",mutable:!1,complexType:{original:"Product",resolved:"Product",references:{Product:{location:"import",path:"../../../../types",id:"src/types.ts::Product"}}},required:!1,optional:!1,docs:{tags:[],text:""}},sizing:{type:"string",mutable:!1,complexType:{original:"'cover' | 'contain'",resolved:'"contain" | "cover"',references:{}},required:!1,optional:!1,docs:{tags:[],text:""},attribute:"sizing",reflect:!1}}}}