import{g as K,U as se,Q as S,c1 as ie,r as F,dc as de,p as he,a0 as ue,fg as ge,bl as l,a2 as be,aV as z,ag as w,bm as T,a1 as _,a3 as V,c6 as Ce,a4 as fe,X as L,b3 as ve,a6 as pe,a8 as me,C as N,ai as ke,ac as xe,ah as f,cb as ye,b0 as D,b2 as Ie}from"./Czresmtb.js";import{l as Pe,n as ze}from"./poFbq7Xm.js";const I="v-hidden",Se=Pe("[v-hidden]",{display:"none!important"}),_e=K({name:"Overflow",props:{getCounter:Function,getTail:Function,updateCounter:Function,onUpdateCount:Function,onUpdateOverflow:Function},setup(o,{slots:u}){const r=F(null),p=F(null);function c(s){const{value:n}=r,{getCounter:a,getTail:m}=o;let d;if(a!==void 0?d=a():d=p.value,!n||!d)return;d.hasAttribute(I)&&d.removeAttribute(I);const{children:b}=n;if(s.showAllItemsBeforeCalculate)for(const h of b)h.hasAttribute(I)&&h.removeAttribute(I);const v=n.offsetWidth,e=[],t=u.tail?m==null?void 0:m():null;let C=t?t.offsetWidth:0,g=!1;const x=n.children.length-(u.tail?1:0);for(let h=0;h<x-1;++h){if(h<0)continue;const y=b[h];if(g){y.hasAttribute(I)||y.setAttribute(I,"");continue}else y.hasAttribute(I)&&y.removeAttribute(I);const $=y.offsetWidth;if(C+=$,e[h]=$,C>v){const{updateCounter:H}=o;for(let k=h;k>=0;--k){const B=x-1-k;H!==void 0?H(B):d.textContent=`${B}`;const R=d.offsetWidth;if(C-=e[k],C+R<=v||k===0){g=!0,h=k-1,t&&(h===-1?(t.style.maxWidth=`${v-R}px`,t.style.boxSizing="border-box"):t.style.maxWidth="");const{onUpdateCount:W}=o;W&&W(B);break}}}}const{onUpdateOverflow:P}=o;g?P!==void 0&&P(!0):(P!==void 0&&P(!1),d.setAttribute(I,""))}const i=de();return Se.mount({id:"vueuc/overflow",head:!0,anchorMetaName:ze,ssr:i}),he(()=>c({showAllItemsBeforeCalculate:!1})),{selfRef:r,counterRef:p,sync:c}},render(){const{$slots:o}=this;return se(()=>this.sync({showAllItemsBeforeCalculate:!1})),S("div",{class:"v-overflow",ref:"selfRef"},[ie(o,"default"),o.counter?o.counter():S("span",{style:{display:"inline-block"},ref:"counterRef"}),o.tail?o.tail():null])}});function Be(o){const{textColor2:u,primaryColorHover:r,primaryColorPressed:p,primaryColor:c,infoColor:i,successColor:s,warningColor:n,errorColor:a,baseColor:m,borderColor:d,opacityDisabled:b,tagColor:v,closeIconColor:e,closeIconColorHover:t,closeIconColorPressed:C,borderRadiusSmall:g,fontSizeMini:x,fontSizeTiny:P,fontSizeSmall:h,fontSizeMedium:y,heightMini:$,heightTiny:H,heightSmall:k,heightMedium:B,closeColorHover:R,closeColorPressed:W,buttonColor2Hover:A,buttonColor2Pressed:O,fontWeightStrong:E}=o;return Object.assign(Object.assign({},ge),{closeBorderRadius:g,heightTiny:$,heightSmall:H,heightMedium:k,heightLarge:B,borderRadius:g,opacityDisabled:b,fontSizeTiny:x,fontSizeSmall:P,fontSizeMedium:h,fontSizeLarge:y,fontWeightStrong:E,textColorCheckable:u,textColorHoverCheckable:u,textColorPressedCheckable:u,textColorChecked:m,colorCheckable:"#0000",colorHoverCheckable:A,colorPressedCheckable:O,colorChecked:c,colorCheckedHover:r,colorCheckedPressed:p,border:`1px solid ${d}`,textColor:u,color:v,colorBordered:"rgb(250, 250, 252)",closeIconColor:e,closeIconColorHover:t,closeIconColorPressed:C,closeColorHover:R,closeColorPressed:W,borderPrimary:`1px solid ${l(c,{alpha:.3})}`,textColorPrimary:c,colorPrimary:l(c,{alpha:.12}),colorBorderedPrimary:l(c,{alpha:.1}),closeIconColorPrimary:c,closeIconColorHoverPrimary:c,closeIconColorPressedPrimary:c,closeColorHoverPrimary:l(c,{alpha:.12}),closeColorPressedPrimary:l(c,{alpha:.18}),borderInfo:`1px solid ${l(i,{alpha:.3})}`,textColorInfo:i,colorInfo:l(i,{alpha:.12}),colorBorderedInfo:l(i,{alpha:.1}),closeIconColorInfo:i,closeIconColorHoverInfo:i,closeIconColorPressedInfo:i,closeColorHoverInfo:l(i,{alpha:.12}),closeColorPressedInfo:l(i,{alpha:.18}),borderSuccess:`1px solid ${l(s,{alpha:.3})}`,textColorSuccess:s,colorSuccess:l(s,{alpha:.12}),colorBorderedSuccess:l(s,{alpha:.1}),closeIconColorSuccess:s,closeIconColorHoverSuccess:s,closeIconColorPressedSuccess:s,closeColorHoverSuccess:l(s,{alpha:.12}),closeColorPressedSuccess:l(s,{alpha:.18}),borderWarning:`1px solid ${l(n,{alpha:.35})}`,textColorWarning:n,colorWarning:l(n,{alpha:.15}),colorBorderedWarning:l(n,{alpha:.12}),closeIconColorWarning:n,closeIconColorHoverWarning:n,closeIconColorPressedWarning:n,closeColorHoverWarning:l(n,{alpha:.12}),closeColorPressedWarning:l(n,{alpha:.18}),borderError:`1px solid ${l(a,{alpha:.23})}`,textColorError:a,colorError:l(a,{alpha:.1}),colorBorderedError:l(a,{alpha:.08}),closeIconColorError:a,closeIconColorHoverError:a,closeIconColorPressedError:a,closeColorHoverError:l(a,{alpha:.12}),closeColorPressedError:l(a,{alpha:.18})})}const $e={common:ue,self:Be},He={color:Object,type:{type:String,default:"default"},round:Boolean,size:{type:String,default:"medium"},closable:Boolean,disabled:{type:Boolean,default:void 0}},Re=be("tag",`
 --n-close-margin: var(--n-close-margin-top) var(--n-close-margin-right) var(--n-close-margin-bottom) var(--n-close-margin-left);
 white-space: nowrap;
 position: relative;
 box-sizing: border-box;
 cursor: default;
 display: inline-flex;
 align-items: center;
 flex-wrap: nowrap;
 padding: var(--n-padding);
 border-radius: var(--n-border-radius);
 color: var(--n-text-color);
 background-color: var(--n-color);
 transition: 
 border-color .3s var(--n-bezier),
 background-color .3s var(--n-bezier),
 color .3s var(--n-bezier),
 box-shadow .3s var(--n-bezier),
 opacity .3s var(--n-bezier);
 line-height: 1;
 height: var(--n-height);
 font-size: var(--n-font-size);
`,[z("strong",`
 font-weight: var(--n-font-weight-strong);
 `),w("border",`
 pointer-events: none;
 position: absolute;
 left: 0;
 right: 0;
 top: 0;
 bottom: 0;
 border-radius: inherit;
 border: var(--n-border);
 transition: border-color .3s var(--n-bezier);
 `),w("icon",`
 display: flex;
 margin: 0 4px 0 0;
 color: var(--n-text-color);
 transition: color .3s var(--n-bezier);
 font-size: var(--n-avatar-size-override);
 `),w("avatar",`
 display: flex;
 margin: 0 6px 0 0;
 `),w("close",`
 margin: var(--n-close-margin);
 transition:
 background-color .3s var(--n-bezier),
 color .3s var(--n-bezier);
 `),z("round",`
 padding: 0 calc(var(--n-height) / 3);
 border-radius: calc(var(--n-height) / 2);
 `,[w("icon",`
 margin: 0 4px 0 calc((var(--n-height) - 8px) / -2);
 `),w("avatar",`
 margin: 0 6px 0 calc((var(--n-height) - 8px) / -2);
 `),z("closable",`
 padding: 0 calc(var(--n-height) / 4) 0 calc(var(--n-height) / 3);
 `)]),z("icon, avatar",[z("round",`
 padding: 0 calc(var(--n-height) / 3) 0 calc(var(--n-height) / 2);
 `)]),z("disabled",`
 cursor: not-allowed !important;
 opacity: var(--n-opacity-disabled);
 `),z("checkable",`
 cursor: pointer;
 box-shadow: none;
 color: var(--n-text-color-checkable);
 background-color: var(--n-color-checkable);
 `,[T("disabled",[_("&:hover","background-color: var(--n-color-hover-checkable);",[T("checked","color: var(--n-text-color-hover-checkable);")]),_("&:active","background-color: var(--n-color-pressed-checkable);",[T("checked","color: var(--n-text-color-pressed-checkable);")])]),z("checked",`
 color: var(--n-text-color-checked);
 background-color: var(--n-color-checked);
 `,[T("disabled",[_("&:hover","background-color: var(--n-color-checked-hover);"),_("&:active","background-color: var(--n-color-checked-pressed);")])])])]),We=Object.assign(Object.assign(Object.assign({},L.props),He),{bordered:{type:Boolean,default:void 0},checked:Boolean,checkable:Boolean,strong:Boolean,triggerClickOnClose:Boolean,onClose:[Array,Function],onMouseenter:Function,onMouseleave:Function,"onUpdate:checked":Function,onUpdateChecked:Function,internalCloseFocusable:{type:Boolean,default:!0},internalCloseIsButtonTag:{type:Boolean,default:!0},onCheckedChange:Function}),we=Ie("n-tag"),Ae=K({name:"Tag",props:We,slots:Object,setup(o){const u=F(null),{mergedBorderedRef:r,mergedClsPrefixRef:p,inlineThemeDisabled:c,mergedRtlRef:i}=fe(o),s=L("Tag","-tag",Re,$e,o,p);ve(we,{roundRef:pe(o,"round")});function n(){if(!o.disabled&&o.checkable){const{checked:e,onCheckedChange:t,onUpdateChecked:C,"onUpdate:checked":g}=o;C&&C(!e),g&&g(!e),t&&t(!e)}}function a(e){if(o.triggerClickOnClose||e.stopPropagation(),!o.disabled){const{onClose:t}=o;t&&xe(t,e)}}const m={setTextContent(e){const{value:t}=u;t&&(t.textContent=e)}},d=me("Tag",i,p),b=N(()=>{const{type:e,size:t,color:{color:C,textColor:g}={}}=o,{common:{cubicBezierEaseInOut:x},self:{padding:P,closeMargin:h,borderRadius:y,opacityDisabled:$,textColorCheckable:H,textColorHoverCheckable:k,textColorPressedCheckable:B,textColorChecked:R,colorCheckable:W,colorHoverCheckable:A,colorPressedCheckable:O,colorChecked:E,colorCheckedHover:Q,colorCheckedPressed:X,closeBorderRadius:q,fontWeightStrong:G,[f("colorBordered",e)]:J,[f("closeSize",t)]:Y,[f("closeIconSize",t)]:Z,[f("fontSize",t)]:ee,[f("height",t)]:j,[f("color",e)]:oe,[f("textColor",e)]:re,[f("border",e)]:le,[f("closeIconColor",e)]:U,[f("closeIconColorHover",e)]:te,[f("closeIconColorPressed",e)]:ne,[f("closeColorHover",e)]:ce,[f("closeColorPressed",e)]:ae}}=s.value,M=ye(h);return{"--n-font-weight-strong":G,"--n-avatar-size-override":`calc(${j} - 8px)`,"--n-bezier":x,"--n-border-radius":y,"--n-border":le,"--n-close-icon-size":Z,"--n-close-color-pressed":ae,"--n-close-color-hover":ce,"--n-close-border-radius":q,"--n-close-icon-color":U,"--n-close-icon-color-hover":te,"--n-close-icon-color-pressed":ne,"--n-close-icon-color-disabled":U,"--n-close-margin-top":M.top,"--n-close-margin-right":M.right,"--n-close-margin-bottom":M.bottom,"--n-close-margin-left":M.left,"--n-close-size":Y,"--n-color":C||(r.value?J:oe),"--n-color-checkable":W,"--n-color-checked":E,"--n-color-checked-hover":Q,"--n-color-checked-pressed":X,"--n-color-hover-checkable":A,"--n-color-pressed-checkable":O,"--n-font-size":ee,"--n-height":j,"--n-opacity-disabled":$,"--n-padding":P,"--n-text-color":g||re,"--n-text-color-checkable":H,"--n-text-color-checked":R,"--n-text-color-hover-checkable":k,"--n-text-color-pressed-checkable":B}}),v=c?ke("tag",N(()=>{let e="";const{type:t,size:C,color:{color:g,textColor:x}={}}=o;return e+=t[0],e+=C[0],g&&(e+=`a${D(g)}`),x&&(e+=`b${D(x)}`),r.value&&(e+="c"),e}),b,o):void 0;return Object.assign(Object.assign({},m),{rtlEnabled:d,mergedClsPrefix:p,contentRef:u,mergedBordered:r,handleClick:n,handleCloseClick:a,cssVars:c?void 0:b,themeClass:v==null?void 0:v.themeClass,onRender:v==null?void 0:v.onRender})},render(){var o,u;const{mergedClsPrefix:r,rtlEnabled:p,closable:c,color:{borderColor:i}={},round:s,onRender:n,$slots:a}=this;n==null||n();const m=V(a.avatar,b=>b&&S("div",{class:`${r}-tag__avatar`},b)),d=V(a.icon,b=>b&&S("div",{class:`${r}-tag__icon`},b));return S("div",{class:[`${r}-tag`,this.themeClass,{[`${r}-tag--rtl`]:p,[`${r}-tag--strong`]:this.strong,[`${r}-tag--disabled`]:this.disabled,[`${r}-tag--checkable`]:this.checkable,[`${r}-tag--checked`]:this.checkable&&this.checked,[`${r}-tag--round`]:s,[`${r}-tag--avatar`]:m,[`${r}-tag--icon`]:d,[`${r}-tag--closable`]:c}],style:this.cssVars,onClick:this.handleClick,onMouseenter:this.onMouseenter,onMouseleave:this.onMouseleave},d||m,S("span",{class:`${r}-tag__content`,ref:"contentRef"},(u=(o=this.$slots).default)===null||u===void 0?void 0:u.call(o)),!this.checkable&&c?S(Ce,{clsPrefix:r,class:`${r}-tag__close`,disabled:this.disabled,onClick:this.handleCloseClick,focusable:this.internalCloseFocusable,round:s,isButtonTag:this.internalCloseIsButtonTag,absolute:!0}):null,!this.checkable&&this.mergedBordered?S("div",{class:`${r}-tag__border`,style:{borderColor:i}}):null)}});export{_e as V,Ae as _,we as t};
