'use client';
"use strict";var e=require("react/jsx-runtime"),r=require("@gem-sdk/core"),t=require("react"),s=require("../../../../../grid/components/row/Row.js"),i=require("../../../../../grid/components/ChildrenDroppable.js"),d=require("@gem-sdk/system"),c=require("../common/attrs.js"),n=require("../common/classes.js"),u=require("../context/PrdOfferSubscriptionPresenceContext.js");exports.ProductOfferItem=o=>{let{product:l,setting:a,builderProps:f,children:m,index:j,totalProduct:x,builderAttrs:P,styles:p}=o,{isEditMode:q}=r.useRenderMode(),{variantSelected:h,productOfferLayout:g,layout:O,...b}=a??{};Object.keys(O||{}).forEach(e=>{g?.[e]==="2col"&&O?.[e]&&(O[e].display="fill")});let v=h?.[l?.baseID??""]?.variantId,y=d.createAttr({...c.getProductOfferAttrs(l,f?.uid)}),C=d.createClass({...n.getProductOfferItemClasses(j,a,x)}),I=t.useRef(null),R=e.jsx("div",{ref:I,...q&&y,children:e.jsx(s.default,{builderAttrs:P,setting:{...b,layout:O},styles:p,children:r.isEmptyChildren(m)?e.jsx(i.default,{}):m})});return e.jsx("div",{className:C,children:e.jsx(r.ProductProvider,{product:l,readOnly:!0,initialVariantId:v??"Latest",uid:f?.uid,children:e.jsx(u.ProductOfferSubscriptionPresenceProvider,{containerRef:I,children:R})})},`uid-${l?.id}`)};
