"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("@gem-sdk/core"),s=require("@gem-sdk/system"),a=require("../../../../common/helper.js"),r=require("../common/helpers.js"),i=require("../common/styles.js"),n=require("./variants/Dropdown.js"),o=require("./variants/VariantItem.js"),l=require("../../../../../text/components/Text.js"),p=require("../common/classes.js");exports.default=({option:u,indexOption:d,productVariantSettings:c,styles:m,setting:y,builderProps:g,optionLength:j})=>{let{showAsSwatches:S}=y??{},{align:h}=m??{},{uid:v}=g??{},x=t.useVariants(),{getVariantConfiguration:b,getSwatchDropdownAutoWidth:q,hasPreSelected:f,variantId:w,selectedOptions:C,isChangeVariant:V}=c,D=b(u.name),N=D?D.optionType:u.optionType,P=(f||w)&&u.name?C?.[u.name]:void 0,T=D?.hide;if(T)return null;let O=D.presets[N],W=O?.labelToggle,$=O?.itemSpacing,k=a.postPurchaseSpacing[$||"none"],I=s.createStyle({...i.getVariantItemWrapperStyles(N,k)}),L=s.createClass({...p.getProductOptionClasses()}),_=s.createClass({...p.getVariantItemWrapperClasses()}),A=s.createClass({...p.getDropdownVariantWrapperClasses(m)}),K=s.createStyle({...i.getDisplayLabelStyles(h)});return e.jsxs("div",{className:L,children:[W&&"dropdown"!==N&&e.jsx(l.default,{style:K,styles:i.getDisplayLabelSettingStyles(),setting:r.getDisplayLabelSetting({option:u,hasPreSelected:f,isChangeVariant:V,selectedOptions:C})}),e.jsxs("div",{className:_,style:I,children:[S&&t.OptionSpecialStyle.includes(`${N}`)&&u.values.map(t=>{let s=(!!f||!!V||!!w)&&!!u.name&&C?.[u.name]===t.label;return e.jsx(o.default,{variantKey:`${u.id}-${t.id}`,showAsSwatches:S,uid:v,name:u.name,value:t,optionNumber:j,optionPosition:d,...m,...y,presetConfiguration:b(u.name),checked:s,optionType:N||"dropdown"},t.id)}),e.jsx("div",{className:A,children:("dropdown"===N||S&&!t.OptionSpecialStyle.includes(`${N}`))&&"radio_buttons"!==N&&e.jsx(n.default,{...m,...y,variants:x,preset:O,option:u,initValue:P,label:u.name,presetConfiguration:b(u.name),swatchAutoWidth:q(),optionPosition:d,optionNumber:j})})]})]},u.id)};
