import{flattenChildren as e,isValidElement as t}from"../../_util/props-util/index.mjs";function n(e){let{key:t,children:n,props:{value:r,disabled:i,...a}}=e,o=n?.default;return{key:t,value:r===void 0?t:r,children:o,disabled:i||i===``,...a}}function r(i,a=!1){return e(i).map((e,i)=>{if(!t(e)||!e.type)return null;let{type:{isSelectOptGroup:o},key:s,children:c,props:l}=e;if(a||!o)return n(e);let u=c&&c.default?c.default():void 0,d=l?.label||c.label?.()||s;return{key:`__RC_SELECT_GRP__${s===null?i:String(s)}__`,...l,label:d,options:r(u||[])}}).filter(e=>e)}export{r as convertChildrenToData};