'use client';
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),o=require("../dropdown-option/VariantOption.js"),t=require("../dropdown-option/DropdownOption.js"),r=require("../../common/dropdown/classes.js"),i=require("@gem-sdk/system"),s=require("../../common/dropdown/styles.js"),n=require("../../common/dropdown/attrs.js"),a=require("./hooks/useDropdownSwatches.js");exports.default=l=>{let{option:d,optionPosition:p,optionNumber:u,variantGroup:c,variants:m,price:h,blankText:w,optionTypography:j,optionTransform:g,initValue:x,hasPreSelected:S,optionTypo:q,combineHeight:v,combineWidth:y,soldOutStyle:b}=l,{optionBgColor:f,optionTextColor:C,optionRounded:k,optionShadow:A,optionHasShadow:N,optionBorder:O}=l,{value:P,preset:D,handleOnChangeSelect:B,checkVariantInStock:I}=a.useDropdownSwatches(l),M="disable"===b;c||(f=D?.optionBgColor,C=D?.optionTextColor,O=D?.optionBorder,N=D?.optionHasShadow,A=D?.optionShadow,k=D?.optionRounded);let R=i.createClass(r.getSelectClass({optionTypo:q,optionTypography:j,optionBgColor:f,optionBorder:O,optionTextColor:C})),_=i.createStyle(s.getSelectStyle({width:c?y:D?.width,height:c?v:D?.height,optionTypo:q,optionTypography:j,optionBgColor:f,optionTextColor:C,optionRounded:k,optionShadow:A,optionHasShadow:N,optionBorder:O,optionTransform:g,isCombine:c,textAlign:q?.attrs?.textAlign})),H=i.createAttr(n.getSelectAttr({optionName:d?.name,value:P??x,type:"React"}));return e.jsxs("select",{...H,className:R,style:_,onChange:e=>B(e),children:[i.If(!S,e.jsx("option",{value:"blank",children:w??"Please select an option"})," "),i.If(c,m?.map(t=>e.jsx(o.default,{disabled:!I(t)&&M,value:t?.id,variant:t,includePrice:h},t?.id)),d?.values?.map(o=>e.jsx(t.default,{value:o,optionName:d.name,optionPosition:p,optionNumber:u,isSoldOutMark:M},o?.id)))]})};
