import{Or as e,Sr as t,Tr as n,hn as r,mn as i,pn as a,sn as o,vn as s,xt as c}from"./jsx-runtime-NwRKtVrk.js";import{i as l,r as u,t as d}from"./useBreakpoint-BdDQSe50.js";import{a as f,o as p}from"./space-Dvitgohy.js";var m=e(n()),h=(0,m.createContext)({});function g(e){return e===`auto`?`1 1 auto`:i(e)?`${e} ${e} auto`:/^\d+(\.\d+)?(px|em|rem|%)$/.test(e)?`0 0 ${e}`:e}var _=m.forwardRef((e,n)=>{let{getPrefixCls:s,direction:u}=m.useContext(o),{gutter:d,wrap:p}=m.useContext(h),{prefixCls:_,span:v,order:y,offset:b,push:x,pull:S,className:C,children:w,flex:T,style:E,...D}=e,O=s(`col`,_),k=s(),[A,j]=f(O),[M]=c(k,`col`),N={},P={};l.forEach(t=>{let n={},o=e[t];i(o)?n.span=o:r(o)&&(n=o||{}),delete D[t],P={...P,[`${O}-${t}-${n.span}`]:a(n.span),[`${O}-${t}-order-${n.order}`]:n.order||n.order===0,[`${O}-${t}-offset-${n.offset}`]:n.offset||n.offset===0,[`${O}-${t}-push-${n.push}`]:n.push||n.push===0,[`${O}-${t}-pull-${n.pull}`]:n.pull||n.pull===0,[`${O}-rtl`]:u===`rtl`},n.flex&&(P[`${O}-${t}-flex`]=!0,N[M(`${t}-flex`)]=g(n.flex))});let F=t(O,{[`${O}-${v}`]:v!==void 0,[`${O}-order-${y}`]:y,[`${O}-offset-${b}`]:b,[`${O}-push-${x}`]:x,[`${O}-pull-${S}`]:S},C,P,A,j),I={};return d?.[0]&&(I.paddingInline=i(d[0])?`${d[0]/2}px`:`calc(${d[0]} / 2)`),T&&(I.flex=g(T),p===!1&&!I.minWidth&&(I.minWidth=0)),m.createElement(`div`,{...D,style:{...I,...E,...N},className:F,ref:n},w)});function v(e,t){let n=[void 0,void 0],i=Array.isArray(e)?e:[e,void 0],a=t||{xs:!0,sm:!0,md:!0,lg:!0,xl:!0,xxl:!0,xxxl:!0};return i.forEach((e,t)=>{if(r(e))for(let r=0;r<u.length;r++){let i=u[r];if(a[i]&&e[i]!==void 0){n[t]=e[i];break}}else n[t]=e}),n}var y=(e,t)=>{let[n,i]=m.useState(()=>s(e)?e:``),a=()=>{if(s(e)&&i(e),r(e))for(let n=0;n<u.length;n++){let r=u[n];if(!t||!t[r])continue;let a=e[r];if(a!==void 0){i(a);return}}};return m.useEffect(()=>{a()},[JSON.stringify(e),t]),n},b=m.forwardRef((e,n)=>{let{prefixCls:r,justify:a,align:s,className:c,style:l,children:u,gutter:f=0,wrap:g,..._}=e,{getPrefixCls:b,direction:x}=m.useContext(o),S=d(!0,null),C=y(s,S),w=y(a,S),T=b(`row`,r),[E,D]=p(T),O=v(f,S),k=t(T,{[`${T}-no-wrap`]:g===!1,[`${T}-${w}`]:w,[`${T}-${C}`]:C,[`${T}-rtl`]:x===`rtl`},c,E,D),A={};O?.[0]&&(A.marginInline=i(O[0])?`${O[0]/-2}px`:`calc(${O[0]} / -2)`);let[j,M]=O;A.rowGap=M;let N=m.useMemo(()=>({gutter:[j,M],wrap:g}),[j,M,g]);return m.createElement(h.Provider,{value:N},m.createElement(`div`,{..._,className:k,style:{...A,...l},ref:n},u))});export{_ as n,b as t};