import{aO as Y,aP as Z,aQ as _,aR as G,aS as J,a0 as n,aT as V,ab as T,aU as W,aV as K,aW as ee,aX as oe,aY as re,aZ as te,a_ as H,a$ as le,b0 as ae}from"./index-F5308wi0.js";const ne=e=>{const{paddingXXS:t,lineWidth:l,tagPaddingHorizontal:o,componentCls:r,calc:c}=e,a=c(o).sub(l).equal(),u=c(t).sub(l).equal();return{[r]:Object.assign(Object.assign({},Z(e)),{display:"inline-block",height:"auto",marginInlineEnd:e.marginXS,paddingInline:a,fontSize:e.tagFontSize,lineHeight:e.tagLineHeight,whiteSpace:"nowrap",background:e.defaultBg,border:`${_(e.lineWidth)} ${e.lineType} ${e.colorBorder}`,borderRadius:e.borderRadiusSM,opacity:1,transition:`all ${e.motionDurationMid}`,textAlign:"start",position:"relative",[`&${r}-rtl`]:{direction:"rtl"},"&, a, a:hover":{color:e.defaultColor},[`${r}-close-icon`]:{marginInlineStart:u,fontSize:e.tagIconSize,color:e.colorTextDescription,cursor:"pointer",transition:`all ${e.motionDurationMid}`,"&:hover":{color:e.colorTextHeading}},[`&${r}-has-color`]:{borderColor:"transparent",[`&, a, a:hover, ${e.iconCls}-close, ${e.iconCls}-close:hover`]:{color:e.colorTextLightSolid}},"&-checkable":{backgroundColor:"transparent",borderColor:"transparent",cursor:"pointer",[`&:not(${r}-checkable-checked):hover`]:{color:e.colorPrimary,backgroundColor:e.colorFillSecondary},"&:active, &-checked":{color:e.colorTextLightSolid},"&-checked":{backgroundColor:e.colorPrimary,"&:hover":{backgroundColor:e.colorPrimaryHover}},"&:active":{backgroundColor:e.colorPrimaryActive}},"&-hidden":{display:"none"},[`> ${e.iconCls} + span, > span + ${e.iconCls}`]:{marginInlineStart:a}}),[`${r}-borderless`]:{borderColor:"transparent",background:e.tagBorderlessBg}}},P=e=>{const{lineWidth:t,fontSizeIcon:l,calc:o}=e,r=e.fontSizeSM;return G(e,{tagFontSize:r,tagLineHeight:_(o(e.lineHeightSM).mul(r).equal()),tagIconSize:o(l).sub(o(t).mul(2)).equal(),tagPaddingHorizontal:8,tagBorderlessBg:e.defaultBg})},I=e=>({defaultBg:new J(e.colorFillQuaternary).onBackground(e.colorBgContainer).toHexString(),defaultColor:e.colorText}),M=Y("Tag",e=>{const t=P(e);return ne(t)},I);var se=function(e,t){var l={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(l[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(l[o[r]]=e[o[r]]);return l};const ce=n.forwardRef((e,t)=>{const{prefixCls:l,style:o,className:r,checked:c,onChange:a,onClick:u}=e,d=se(e,["prefixCls","style","className","checked","onChange","onClick"]),{getPrefixCls:m,tag:g}=n.useContext(V),f=h=>{a==null||a(!c),u==null||u(h)},C=m("tag",l),[y,S,i]=M(C),$=T(C,`${C}-checkable`,{[`${C}-checkable-checked`]:c},g==null?void 0:g.className,r,S,i);return y(n.createElement("span",Object.assign({},d,{ref:t,style:Object.assign(Object.assign({},o),g==null?void 0:g.style),className:$,onClick:f})))}),ie=e=>K(e,(t,l)=>{let{textColor:o,lightBorderColor:r,lightColor:c,darkColor:a}=l;return{[`${e.componentCls}${e.componentCls}-${t}`]:{color:o,background:c,borderColor:r,"&-inverse":{color:e.colorTextLightSolid,background:a,borderColor:a},[`&${e.componentCls}-borderless`]:{borderColor:"transparent"}}}}),de=W(["Tag","preset"],e=>{const t=P(e);return ie(t)},I);function ge(e){return typeof e!="string"?e:e.charAt(0).toUpperCase()+e.slice(1)}const v=(e,t,l)=>{const o=ge(l);return{[`${e.componentCls}${e.componentCls}-${t}`]:{color:e[`color${l}`],background:e[`color${o}Bg`],borderColor:e[`color${o}Border`],[`&${e.componentCls}-borderless`]:{borderColor:"transparent"}}}},ue=W(["Tag","status"],e=>{const t=P(e);return[v(t,"success","Success"),v(t,"processing","Info"),v(t,"error","Error"),v(t,"warning","Warning")]},I);var Ce=function(e,t){var l={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(l[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(l[o[r]]=e[o[r]]);return l};const pe=n.forwardRef((e,t)=>{const{prefixCls:l,className:o,rootClassName:r,style:c,children:a,icon:u,color:d,onClose:m,bordered:g=!0,visible:f}=e,C=Ce(e,["prefixCls","className","rootClassName","style","children","icon","color","onClose","bordered","visible"]),{getPrefixCls:y,direction:S,tag:i}=n.useContext(V),[$,h]=n.useState(!0),R=ee(C,["closeIcon","closable"]);n.useEffect(()=>{f!==void 0&&h(f)},[f]);const j=oe(d),N=re(d),x=j||N,k=Object.assign(Object.assign({backgroundColor:d&&!x?d:void 0},i==null?void 0:i.style),c),s=y("tag",l),[F,L,q]=M(s),X=T(s,i==null?void 0:i.className,{[`${s}-${d}`]:x,[`${s}-has-color`]:d&&!x,[`${s}-hidden`]:!$,[`${s}-rtl`]:S==="rtl",[`${s}-borderless`]:!g},o,r,L,q),E=b=>{b.stopPropagation(),m==null||m(b),!b.defaultPrevented&&h(!1)},[,A]=te(H(e),H(i),{closable:!1,closeIconRender:b=>{const U=n.createElement("span",{className:`${s}-close-icon`,onClick:E},b);return le(b,U,p=>({onClick:B=>{var O;(O=p==null?void 0:p.onClick)===null||O===void 0||O.call(p,B),E(B)},className:T(p==null?void 0:p.className,`${s}-close-icon`)}))}}),D=typeof C.onClick=="function"||a&&a.type==="a",w=u||null,Q=w?n.createElement(n.Fragment,null,w,a&&n.createElement("span",null,a)):a,z=n.createElement("span",Object.assign({},R,{ref:t,className:X,style:k}),Q,A,j&&n.createElement(de,{key:"preset",prefixCls:s}),N&&n.createElement(ue,{key:"status",prefixCls:s}));return F(D?n.createElement(ae,{component:"Tag"},z):z)}),be=pe;be.CheckableTag=ce;export{be as T};