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