import{i as e,t}from"./react-B8IZ02wI.js";import{$ as n,At as r,Et as i,H as a,Ot as o,V as s,et as c,ht as l,mt as u,ot as d,pn as f,q as p,y as m}from"./button-DqbiydrF.js";import{F as h,f as g,g as _,h as v,l as y,o as b,p as x}from"./useForm-D_WiMFpZ.js";var S=e(t()),C=e=>p(e)?a(e)?e():e:null,w=`50%`,T=e=>{let{componentCls:t,popoverColor:r,titleMinWidth:i,fontWeightStrong:a,innerPadding:o,dropShadowPopover:s,colorTextHeading:c,borderRadiusLG:l,zIndexPopup:u,titleMarginBottom:f,colorBgElevated:p,popoverBg:m,titleBorderBottom:h,innerContentPadding:g,titlePadding:_,antCls:v}=e,[y,b]=n(v,`tooltip`);return[{[t]:{...d(e),position:`absolute`,top:0,left:{_skip_check_:!0,value:0},zIndex:u,fontWeight:`normal`,whiteSpace:`normal`,textAlign:`start`,cursor:`auto`,userSelect:`text`,filter:s,[y(`valid-offset-x`)]:b(`arrow-offset-x`,`var(--arrow-x)`),transformOrigin:[b(`valid-offset-x`,w),`var(--arrow-y, ${w})`].join(` `),[y(`arrow-background-color`)]:p,width:`max-content`,maxWidth:`100vw`,"&-rtl":{direction:`rtl`},"&-hidden":{display:`none`},[`${t}-content`]:{position:`relative`},[`${t}-container`]:{backgroundColor:m,backgroundClip:`padding-box`,borderRadius:l,padding:o},[`${t}-title`]:{minWidth:i,marginBottom:f,color:c,fontWeight:a,borderBottom:h,padding:_},[`${t}-content`]:{color:r,padding:g}}},x(e,b(`arrow-background-color`),{arrowShadow:!1}),{[`${t}-pure`]:{position:`relative`,maxWidth:`none`,margin:e.sizePopupArrow,display:`inline-block`}}]},E=e=>{let{componentCls:t,antCls:r}=e,[i]=n(r,`tooltip`);return{[t]:u.map(n=>{let r=e[`${n}6`];return{[`&${t}-${n}`]:{[i(`arrow-background-color`)]:r,[`${t}-inner`]:{backgroundColor:r},[`${t}-arrow`]:{background:`transparent`}}}})}},D=c(`Popover`,e=>{let{colorBgElevated:t,colorText:n}=e,r=l(e,{popoverBg:t,popoverColor:n});return[T(r),E(r),h(r,`zoom-big`)]},e=>{let{lineWidth:t,controlHeight:n,fontHeight:r,padding:i,wireframe:a,zIndexPopupBase:o,borderRadiusLG:s,marginXS:c,lineType:l,colorSplit:u,paddingSM:d}=e,f=n-r,p=f/2,m=f/2-t,h=i;return{titleMinWidth:177,zIndexPopup:o+30,...v(e),...g({contentRadius:s,limitVerticalRadius:!0}),innerPadding:a?0:12,titleMarginBottom:a?0:c,titlePadding:a?`${p}px ${h}px ${m}px`:0,titleBorderBottom:a?`${t}px ${l} ${u}`:`none`,innerContentPadding:a?`${d}px ${h}px`:0}},{resetStyle:!1,deprecatedTokens:[[`width`,`titleMinWidth`],[`minWidth`,`titleMinWidth`]]}),O=e=>{let{title:t,content:n,prefixCls:i,classNames:a,styles:o}=e;return!p(t)&&!p(n)?null:S.createElement(S.Fragment,null,p(t)&&S.createElement(`div`,{className:r(`${i}-title`,a?.title),style:o?.title},t),p(n)&&S.createElement(`div`,{className:r(`${i}-content`,a?.content),style:o?.content},n))},k=e=>{let{hashId:t,prefixCls:n,className:i,style:a,placement:o=`top`,title:c,content:l,children:u,classNames:d,styles:f}=e,p=C(c),m=C(l),h={...e,placement:o},[g,v]=s([d],[f],{props:h}),y=r(t,n,`${n}-pure`,`${n}-placement-${o}`,i);return S.createElement(`div`,{className:y,style:a},S.createElement(`div`,{className:`${n}-arrow`}),S.createElement(_,{...e,className:t,prefixCls:n,classNames:g,styles:v},u||S.createElement(O,{prefixCls:n,title:p,content:m,classNames:g,styles:v})))},A=e=>{let{prefixCls:t,className:n,...a}=e,{getPrefixCls:o}=S.useContext(i),s=o(`popover`,t),[c,l]=D(s);return S.createElement(k,{...a,prefixCls:s,hashId:c,className:r(n,l)})},j=S.forwardRef((e,t)=>{let{prefixCls:n,title:i,content:a,overlayClassName:c,placement:l=`top`,trigger:u,children:d,mouseEnterDelay:h=.1,mouseLeaveDelay:g=.1,onOpenChange:_,overlayStyle:v={},styles:x,classNames:w,motion:T,arrow:E,...k}=e,{getPrefixCls:A,className:j,style:M,classNames:N,styles:P,arrow:F,trigger:I}=o(`popover`),L=A(`popover`,n),[R,z]=D(L),B=A(),V=y(E,F),H=u||I||`hover`,U={...e,placement:l,trigger:H,mouseEnterDelay:h,mouseLeaveDelay:g,overlayStyle:v,styles:x,classNames:w},[W,G]=s([N,w],[P,x],{props:U}),K=r(c,R,z,j,W.root),[q,J]=f(e.defaultOpen??!1,e.open),Y=e=>{J(e),_?.(e)},X=C(i),Z=C(a);return S.createElement(b,{unique:!1,arrow:V,placement:l,trigger:H,mouseEnterDelay:h,mouseLeaveDelay:g,...k,prefixCls:L,classNames:{root:K,container:W.container,arrow:W.arrow},styles:{root:{...G.root,...M,...v},container:G.container,arrow:G.arrow},ref:t,open:q,onOpenChange:Y,overlay:p(X)||p(Z)?S.createElement(O,{prefixCls:L,title:X,content:Z,classNames:W,styles:G}):null,motion:{motionName:m(B,`zoom-big`,typeof T?.motionName==`string`?T?.motionName:void 0)},"data-popover-inject":!0},d)});j._InternalPanelDoNotUseOrYouWillBeFired=A;export{A as n,C as r,j as t};