(globalThis.webpackChunkwebpackWcBlocksFrontendJsonp=globalThis.webpackChunkwebpackWcBlocksFrontendJsonp||[]).push([[345],{964:(e,t,r)=>{"use strict";r.r(t),r.d(t,{Block:()=>d,default:()=>p});var s=r(7723),o=r(4921),c=r(2796),n=r(3754),i=r(1616),l=r(5703),a=r(5248),u=(r(3790),r(790));const d=e=>{const{className:t}=e,r=(0,n.p)(e),{parentClassName:i}=(0,c.useInnerBlockLayoutContext)(),{product:d}=(0,c.useProductDataContext)(),{text:p,class:y}=d.stock_availability,{current:g}=(0,a.A)();if(!((e,t,r)=>{if(0!==e.id)return""!==t;const s=(0,l.getSetting)("productTypesWithoutStockIndicator",["external","grouped","variable"]),o=r||e?.type;return!s.includes(o)})(d,p,g?.slug))return null;const k=0===d.id,m=d.low_stock_remaining;return(0,u.jsx)("div",{className:(0,o.A)(t,{[`${i}__stock-indicator`]:i,[`wc-block-components-product-stock-indicator--${y}`]:y,"wc-block-components-product-stock-indicator--in-stock":k,"wc-block-components-product-stock-indicator--low-stock":!!m,...e.isDescendantOfAllProducts&&{[r.className]:r.className,"wc-block-components-product-stock-indicator wp-block-woocommerce-product-stock-indicator":!0}}),...e.isDescendantOfAllProducts&&{style:r.style},children:k?(0,s.__)("In stock","woocommerce"):p})},p=e=>{const{product:t}=(0,c.useProductDataContext)();return 0===t.id?(0,u.jsx)(d,{...e}):(0,i.withProductDataContext)(d)(e)}},3754:(e,t,r)=>{"use strict";r.d(t,{p:()=>a});var s=r(4921),o=r(3993),c=r(7356),n=r(9786);function i(e={}){const t={};return(0,n.getCSSRules)(e,{selector:""}).forEach(e=>{t[e.key]=e.value}),t}function l(e,t){return e&&t?`has-${(0,c.c)(t)}-${e}`:""}const a=e=>{const t=(e=>{const t=(0,o.isObject)(e)?e:{style:{}};let r=t.style;return(0,o.isString)(r)&&(r=JSON.parse(r)||{}),(0,o.isObject)(r)||(r={}),{...t,style:r}})(e),r=function(e){const{backgroundColor:t,textColor:r,gradient:c,style:n}=e,a=l("background-color",t),u=l("color",r),d=function(e){if(e)return`has-${e}-gradient-background`}(c),p=d||n?.color?.gradient;return{className:(0,s.A)(u,d,{[a]:!p&&!!a,"has-text-color":r||n?.color?.text,"has-background":t||n?.color?.background||c||n?.color?.gradient,"has-link-color":(0,o.isObject)(n?.elements?.link)?n?.elements?.link?.color:void 0}),style:i({color:n?.color||{}})}}(t),c=function(e){const t=e.style?.border||{};return{className:function(e){const{borderColor:t,style:r}=e,o=t?l("border-color",t):"";return(0,s.A)({"has-border-color":!!t||!!r?.border?.color,[o]:!!o})}(e),style:i({border:t})}}(t),n=function(e){return{className:void 0,style:i({spacing:e.style?.spacing||{}})}}(t),a=(e=>{const t=(0,o.isObject)(e.style.typography)?e.style.typography:{},r=(0,o.isString)(t.fontFamily)?t.fontFamily:"";return{className:e.fontFamily?`has-${e.fontFamily}-font-family`:r,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,s.A)(a.className,r.className,c.className,n.className),style:{...a.style,...r.style,...c.style,...n.style}}}},5248:(e,t,r)=>{"use strict";r.d(t,{A:()=>g});var s=r(7143);const o="woocommerce/product-type-template-state",c="SWITCH_PRODUCT_TYPE",n="SET_PRODUCT_TYPES",i="REGISTER_LISTENER",l="UNREGISTER_LISTENER",a=(0,r(5703).getSetting)("productTypes",{}),u=Object.keys(a).map(e=>({slug:e,label:a[e]})),d={productTypes:{list:u,current:u[0]?.slug},listeners:[]},p={switchProductType:e=>({type:c,current:e}),setProductTypes:e=>({type:n,productTypes:e}),registerListener:e=>({type:i,listener:e}),unregisterListener:e=>({type:l,listener:e})},y=(0,s.createReduxStore)(o,{reducer:(e=d,t)=>{switch(t.type){case n:return{...e,productTypes:{...e.productTypes,list:t.productTypes||[]}};case c:return{...e,productTypes:{...e.productTypes,current:t.current}};case i:return{...e,listeners:[...e.listeners,t.listener||""]};case l:return{...e,listeners:e.listeners.filter(e=>e!==t.listener)};default:return e}},actions:p,selectors:{getProductTypes:e=>e.productTypes.list,getCurrentProductType:e=>e.productTypes.list.find(t=>t.slug===e.productTypes.current),getRegisteredListeners:e=>e.listeners}});function g(){const{productTypes:e,current:t,registeredListeners:r}=(0,s.useSelect)(e=>{const{getProductTypes:t,getCurrentProductType:r,getRegisteredListeners:s}=e(y);return{productTypes:t(),current:r(),registeredListeners:s()}},[]),{switchProductType:o,registerListener:c,unregisterListener:n}=(0,s.useDispatch)(y);return{productTypes:e,current:t,set:o,registeredListeners:r,registerListener:c,unregisterListener:n}}(0,s.select)(o)||(0,s.register)(y)},3790:()=>{}}]);