import{o as e}from"./request-xrnk7ZJV.js";import{Ct as t,Hn as n,Ln as r,Ot as i,Pr as a,Q as o,Wn as s,Zn as c,en as l,nn as u,qt as d,rr as f,wn as p,wt as m}from"./jsx-runtime-OfKoVykY.js";import{n as h,t as g}from"./useBreakpoint-DER0GTnn.js";var _=e(a()),v={xxxl:4,xxl:3,xl:3,lg:3,md:3,sm:2,xs:1},y=_.createContext(null),b=e=>c(e).map(e=>({...e?.props,key:e.key}));function x(e,t,n){let r=_.useMemo(()=>t||b(n),[t,n]);return _.useMemo(()=>r.map(({span:t,...n})=>t===`filled`?{...n,filled:!0}:{...n,span:i(t)?t:h(e,t)}),[r,e])}function S(e,t){let n=[],r=[],i=!1,a=0;return e.filter(e=>e).forEach(e=>{let{filled:o,...s}=e;if(o){r.push(s),n.push(r),r=[],a=0;return}let c=t-a;a+=e.span||1,a>=t?(a>t?(i=!0,r.push({...s,span:c})):r.push(s),n.push(r),r=[],a=0):r.push(s)}),r.length>0&&n.push(r),n=n.map(e=>{let n=e.reduce((e,t)=>e+(t.span||1),0);if(n{let[n,r]=(0,_.useMemo)(()=>S(t,e),[t,e]);return n},w=e=>e.children,T=e=>{let{itemPrefixCls:n,component:r,span:i,className:a,style:o,labelStyle:c,contentStyle:l,bordered:u,label:d,content:p,colon:m,type:h,styles:g,classNames:v}=e,b=r,{classNames:x,styles:S}=_.useContext(y),[C,w]=t([x,v],[S,g],{props:e}),T={...c,...w.label},E={...l,...w.content};if(u){let e;h===`label`&&(e=T),h===`content`&&(e=E);let t=e?{...o,...e}:o;return _.createElement(b,{colSpan:i,style:t,className:s(a,{[`${n}-item-${h}`]:h===`label`||h===`content`,[C.label]:C.label&&h===`label`,[C.content]:C.content&&h===`content`})},f(d)&&_.createElement(`span`,null,d),f(p)&&_.createElement(`span`,null,p))}return _.createElement(b,{className:s(`${n}-item`,a),style:o,colSpan:i},_.createElement(`div`,{className:`${n}-item-container`},f(d)&&_.createElement(`span`,{style:T,className:s(`${n}-item-label`,C.label,{[`${n}-item-no-colon`]:!m})},d),f(p)&&_.createElement(`span`,{style:E,className:s(`${n}-item-content`,C.content)},p)))};function E(e,{colon:t,prefixCls:n,bordered:r},{component:i,type:a,showLabel:o,showContent:s,labelStyle:c,contentStyle:l,styles:u}){return e.map(({label:e,children:d,prefixCls:f=n,className:p,style:m,labelStyle:h,contentStyle:g,span:v=1,key:y,styles:b,classNames:x},S)=>{let C=y??S;if(typeof i==`string`)return _.createElement(T,{key:`${a}-${C}`,className:p,style:m,classNames:x,styles:{label:{...c,...u?.label,...h,...b?.label},content:{...l,...u?.content,...g,...b?.content}},span:v,colon:t,component:i,itemPrefixCls:f,bordered:r,label:o?e:null,content:s?d:null,type:a});let w={label:{...c,...u?.label,...h,...b?.label},content:{...l,...u?.content,...g,...b?.content}};return[_.createElement(T,{key:`label-${C}`,className:p,style:m,classNames:x,styles:w,span:1,colon:t,component:i[0],itemPrefixCls:f,bordered:r,label:e,type:`label`}),_.createElement(T,{key:`content-${C}`,className:p,style:m,classNames:x,styles:w,span:v*2-1,component:i[1],itemPrefixCls:f,bordered:r,content:d,type:`content`})]})}var D=e=>{let t=_.useContext(y),{prefixCls:n,vertical:r,row:i,index:a,bordered:o}=e;return r?_.createElement(_.Fragment,null,_.createElement(`tr`,{key:`label-${a}`,className:`${n}-row`},E(i,e,{component:`th`,type:`label`,showLabel:!0,...t})),_.createElement(`tr`,{key:`content-${a}`,className:`${n}-row`},E(i,e,{component:`td`,type:`content`,showContent:!0,...t}))):_.createElement(`tr`,{key:a,className:`${n}-row`},E(i,e,{component:o?[`th`,`td`]:`td`,type:`item`,showLabel:!0,showContent:!0,...t}))},O=e=>{let{componentCls:t,labelBg:n}=e,i=`> ${t}-view > table > tbody > ${t}-row`;return{[`&${t}-bordered`]:{[`> ${t}-view`]:{border:`${r(e.lineWidth)} ${e.lineType} ${e.colorSplit}`,"> table":{tableLayout:`auto`},[`> table > tbody > ${t}-row`]:{borderBottom:`${r(e.lineWidth)} ${e.lineType} ${e.colorSplit}`,"&:first-child":{"> th:first-child, > td:first-child":{borderStartStartRadius:e.borderRadiusLG}},"&:last-child":{borderBottom:`none`,"> th:first-child, > td:first-child":{borderEndStartRadius:e.borderRadiusLG}},[`> ${t}-item-label, > ${t}-item-content`]:{padding:`${r(e.padding)} ${r(e.paddingLG)}`,borderInlineEnd:`${r(e.lineWidth)} ${e.lineType} ${e.colorSplit}`,"&:last-child":{borderInlineEnd:`none`}},[`> ${t}-item-label`]:{color:e.colorTextSecondary,backgroundColor:n,"&::after":{display:`none`}}}},[`&${t}-medium`]:{[i]:{[`> ${t}-item-label, > ${t}-item-content`]:{padding:`${r(e.paddingSM)} ${r(e.paddingLG)}`}}},[`&${t}-small`]:{[i]:{[`> ${t}-item-label, > ${t}-item-content`]:{padding:`${r(e.paddingXS)} ${r(e.padding)}`}}}}}},k=e=>{let{componentCls:t,extraColor:n,itemPaddingBottom:i,itemPaddingEnd:a,colonMarginRight:o,colonMarginLeft:s,titleMarginBottom:c}=e,d=`> ${t}-view > table > tbody > ${t}-row`;return{[t]:{...l(e),...O(e),"&-rtl":{direction:`rtl`},[`${t}-header`]:{display:`flex`,alignItems:`center`,marginBottom:c},[`${t}-title`]:{...u,flex:`auto`,color:e.titleColor,fontWeight:e.fontWeightStrong,fontSize:e.fontSizeLG,lineHeight:e.lineHeightLG},[`${t}-extra`]:{marginInlineStart:`auto`,color:n,fontSize:e.fontSize},[`${t}-view`]:{width:`100%`,borderRadius:e.borderRadiusLG,table:{minWidth:`100%`,tableLayout:`fixed`,borderCollapse:`collapse`}},[d]:{"> th, > td":{paddingBottom:i,paddingInlineEnd:a},"> th:last-child, > td:last-child":{paddingInlineEnd:0},"&:last-child":{borderBottom:`none`,"> th, > td":{paddingBottom:0}}},[`${t}-item-label`]:{color:e.labelColor,fontWeight:400,fontSize:e.fontSize,lineHeight:e.lineHeight,textAlign:`start`,"&::after":{content:`":"`,position:`relative`,top:-.5,marginInline:`${r(s)} ${r(o)}`},[`&${t}-item-no-colon::after`]:{content:`""`}},[`${t}-item-content`]:{display:`table-cell`,flex:1,color:e.contentColor,fontSize:e.fontSize,lineHeight:e.lineHeight,wordBreak:`break-word`,overflowWrap:`break-word`},[`${t}-item`]:{paddingBottom:0,verticalAlign:`top`,"&-container":{display:`flex`,[`> ${t}-item-label`]:{display:`inline-flex`,alignItems:`baseline`},[`> ${t}-item-content`]:{display:`inline-flex`,alignItems:`baseline`,minWidth:`1em`}}},"&-medium":{[d]:{"> th, > td":{paddingBottom:e.paddingSM}}},"&-small":{[d]:{"> th, > td":{paddingBottom:e.paddingXS}}}}}},A=d(`Descriptions`,e=>k(p(e,{})),e=>({labelBg:e.colorFillAlter,labelColor:e.colorTextTertiary,titleColor:e.colorText,titleMarginBottom:e.fontSizeSM*e.lineHeightSM,itemPaddingBottom:e.padding,itemPaddingEnd:e.padding,colonMarginRight:e.marginXS,colonMarginLeft:e.marginXXS/2,contentColor:e.colorText,extraColor:e.colorText})),j=_.forwardRef((e,r)=>{let{prefixCls:a,title:c,extra:l,column:u,colon:d=!0,bordered:p,layout:b,children:S,className:w,rootClassName:T,style:E,size:O,labelStyle:k,contentStyle:j,styles:M,items:ee,classNames:te,...N}=e,{getPrefixCls:P,direction:F,className:I,style:L,classNames:R,styles:z}=n(`descriptions`),B=P(`descriptions`,a),V=g(),H=_.useMemo(()=>i(u)?u:h(V,u)??h(V,v)??3,[V,u]),U=x(V,ee,S),W=o(O),G=C(H,U),[K,q]=A(B),J={...e,column:H,items:U,size:W},ne=m(L),re=m(E),[Y,X]=t([R,te],[z,ne,M,re],{props:J}),ie=_.useMemo(()=>({labelStyle:k,contentStyle:j,styles:{label:X.label,content:X.content},classNames:{label:Y.label,content:Y.content}}),[k,j,X.label,X.content,Y.label,Y.content]),Z=_.useRef(null);_.useImperativeHandle(r,()=>({nativeElement:Z.current}));let Q=f(c),$=f(l);return _.createElement(y.Provider,{value:ie},_.createElement(`div`,{ref:Z,className:s(B,I,Y.root,{[`${B}-medium`]:W===`medium`||W===`middle`,[`${B}-small`]:W===`small`,[`${B}-bordered`]:!!p,[`${B}-rtl`]:F===`rtl`},w,T,K,q),style:X.root,...N},(Q||$)&&_.createElement(`div`,{className:s(`${B}-header`,Y.header),style:X.header},Q&&_.createElement(`div`,{className:s(`${B}-title`,Y.title),style:X.title},c),$&&_.createElement(`div`,{className:s(`${B}-extra`,Y.extra),style:X.extra},l)),_.createElement(`div`,{className:`${B}-view`},_.createElement(`table`,null,_.createElement(`tbody`,null,G.map((e,t)=>_.createElement(D,{key:t,index:t,colon:d,prefixCls:B,vertical:b===`vertical`,bordered:p,row:e})))))))});j.Item=w;export{j as t};