import{jsxs as e,Fragment as t,jsx as o}from"react/jsx-runtime";import{ProductSubscriptionOptions as n}from"./ProductSubscriptionOptions.js";import{SellingPlanLabel as i}from"./SellingPlanLabel.js";import{SubscriptionRadio as l}from"./SubscriptionRadio.js";import{SubscriptionEnum as r}from"../../../constants/index.js";import{handleContainerKeyDown as s}from"../helpers/handleContainerKeyDown.js";let ProductSubscriptionContent=({data:d,setting:a,styles:c,builderProps:p})=>{let{visibility:u,productId:m,renderType:h,radioGroupName:S,direction:y,containerClasses:g,subscriptionStyles:b,selectedValue:P,sellingPlanOptions:C,handleSellingPlanChange:T,onSelectType:f}=d,j=h===r.SUBSCRIPTION&&(u.selectedType===r.ONE_TIME&&u.requiresSellingPlan||u.selectedType===h);return e(t,{children:[u.shouldShowRadio&&o(l,{id:`${p?.uid??""}-${m}-${h}-radio`,name:S,value:h,checked:u.selectedType===h,className:"!gp-items-start",onChange:e=>{e.target.checked&&f(h)}}),e("div",{"data-component-container":!0,className:g,style:b,onClick:()=>f(h),onKeyDown:e=>s({event:e,type:h,shouldShowRadio:u.shouldShowRadio,selectedType:u.selectedType,onSelectType:f}),role:"button",tabIndex:0,children:[o(i,{setting:a,styles:c,id:`label-${p?.uid??""}-${m}-${h}-radio`}),j&&o(n,{direction:y,setting:a,styles:c,builderProps:p,productId:m,sellingPlanOptions:C,selectedValue:P,onSellingPlanChange:T})]})]})};export{ProductSubscriptionContent};
