"use strict";(self.webpackChunkshopwp=self.webpackChunkshopwp||[]).push([["CollectionImage-public"],{PeQO:function(e,n,i){function t(e){return Number.isInteger(e)}function r(e){return"string"==typeof e||e instanceof String}function o(e){var n=function(e){if(e){var n=e.split(".");return n[n.length-1].split("?")[0]}}(e);if(!n)return!1;var i=function(e,n){return i="."+n,e.split(i);var i}(e,n);return{extension:n,beforeExtension:i[0],afterExtension:i[1]}}function a(e){return e.src&&(c=e.src)&&c.includes("cdn.shopify.com/s/files/1/0533/2089/files/placeholder")?e.src:function(e,n){var i=o(n);return!1===i||e.scale<=1||e.scale>3?n:i.beforeExtension+function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return!e||!t(e)||e<=1||e>3?"":"@"+e+"x"}(e.scale)+"."+i.extension+i.afterExtension}(e,function(e,n){var i=o(n);return!1===i||!e.crop||function(e){return!e.width||0===e.width&&0===e.height}(e)?n:i.beforeExtension+function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return e&&r(e)&&"none"!==e?"_crop_"+e:""}(e.crop)+"."+i.extension+i.afterExtension}(e,(n=e.width,i=e.height,a=e.src,!1===(s=o(a))?a:s.beforeExtension+function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(!t(e)||e<0)&&(e=0),(!t(n)||n<0)&&(n=0),0!==e&&0!==n?"_"+e+"x"+n:0===n&&0!==e?"_"+e+"x":0===e&&0!==n?"_x"+n:""}(n,i)+"."+s.extension+s.afterExtension)));var n,i,a,s,c}function s(e,n){return n?a({src:e,width:n.imagesSizingWidth,height:n.imagesSizingHeight,crop:n.imagesSizingCrop,scale:n.imagesSizingScale}):e}function c(e,n){return n?a({src:e,width:n.thumbnailImagesSizingWidth,height:n.thumbnailImagesSizingHeight,crop:n.thumbnailImagesSizingCrop,scale:n.thumbnailImagesSizingScale}):e}function l(e){var n={id:"",data:!1};switch(e.node.mediaContentType){case"IMAGE":n.id=e.node.image.id,n.data=e.node.image;break;case"VIDEO":n.id=e.node.previewImage.id,n.data=e.node;break;case"EXTERNAL_VIDEO":n.id=e.node.id,n.data=e.node}return n}i.d(n,{hx:function(){return c},mo:function(){return s},o:function(){return l},yk:function(){return a}})},XyGs:function(e,n,i){i.d(n,{H:function(){return o},I:function(){return r}});var t=i("r+mp");function r(){var e=wp.element.useContext(t.g);if(!e)throw new Error("useCollectionState must be used within the CollectionProvider");return e}function o(){var e=wp.element.useContext(t.u);if(!e)throw new Error("useCollectionDispatch must be used within the CollectionProvider");return e}},OaFi:function(e,n,i){i.r(n);var t=i("2MD/"),r=i("LpH3"),o=i("U039"),a=i("PeQO"),s=i("dGr1"),c=i("Qu7M"),l=i("XyGs"),u=wp.element.lazy((function(){return i.e("Link-public").then(i.bind(i,"Y2m9"))})),g={name:"f39i3g-CollectionImageCSS",styles:"max-width:100%;label:CollectionImageCSS;"},m={name:"8fsg2c-CollectionImageWrapperCSS",styles:"margin-bottom:20px;max-width:400px;label:CollectionImageWrapperCSS;"};n.default=function(){var e=wp.element,n=e.useState,i=e.useEffect,d=(0,c.Q)(),p=(0,l.I)(),f=n((function(){return!!p.payload.image&&p.payload.image.originalSrc})),h=(0,t.Z)(f,2),S=h[0],w=h[1];i((function(){S&&p.imagesSizingToggle&&w((0,a.yk)({src:p.payload.image.originalSrc,width:p.imagesSizingWidth,height:p.imagesSizingHeight,crop:p.imagesSizingCrop,scale:p.imagesSizingScale}))}),[]);var v=m,x=g;return(0,o.vI)(S?(0,r.tZ)("div",{className:"wps-component wps-component-collection-image","aria-label":"Collection Image",css:v},(0,r.tZ)(u,{type:"collections",payload:p.payload,linkTo:d.settings.linkTo,target:d.settings.linkTarget},(0,r.tZ)("img",{itemProp:"image",src:S,className:"wps-product-image",css:x,alt:p.payload.image?p.payload.image.altText:"",loading:"lazy"}))):null,(0,s.tu)(d.settings.dropzoneCollectionImage))}}}]);