'use client';
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),system=require("@gem-sdk/system"),useAddToCart=require("./hooks/useAddToCart.js"),styles=require("./common/styles.js"),SoldOutButton=require("./SoldOutButton.js"),AddToCartButton=require("./AddToCartButton.js");const ProductButton=t=>{let{setting:e,builderProps:s,style:r,styles:u,children:d}=t,{wrapStyle:o,restStyle:l}=styles.getSplitStyle(r),{isLoading:n,isInStock:i,outOfStockLabel:a,notiComponent:j,addToCart:y,addToCartRef:m}=useAddToCart.useBtnAddToCart({setting:e,styles:u,builderProps:s}),c=()=>jsxRuntime.jsx(AddToCartButton.default,{...t,style:l,children:d,isLoading:n,addToCart:y}),x=()=>jsxRuntime.jsx(SoldOutButton.default,{...t,style:l,children:d,label:a});return jsxRuntime.jsxs("div",{style:o,ref:m,children:[system.If(i,c(),x()),j]})};exports.default=ProductButton;
