(function(o,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(o=typeof globalThis!="undefined"?globalThis:o||self,e(o.index={},o.Vue))})(this,function(o,e){"use strict";const m={type:{type:String,default:""},color:{type:String,default:""},titleContent:{type:String,default:""},checked:{type:Boolean,default:!1},deletable:{type:Boolean,default:!1},size:{type:String,default:"md"}};function s(n,t,a){let l=n;return t&&(l+=`__${t}`),a&&(l+=`--${a}`),l}function v(n,t=!1){const a=t?`.devui-${n}`:`devui-${n}`;return{b:()=>s(a),e:c=>c?s(a,c):"",m:c=>c?s(a,"",c):"",em:(c,f)=>c&&f?s(a,c,f):""}}function y(n){const t=v("tag");return e.computed(()=>{const{type:a,color:l,deletable:u}=n;return`${t.e("item")} ${t.m(a||(l?"colorful":"")||"default")} ${u?t.m("deletable"):""} ${t.m(n.size)}`})}function b(n){return e.computed(()=>{const{color:t,type:a}=n,l={primary:"var(--devui-primary, #5e7ce0)",success:"var(--devui-success, #50d4ab)",warning:"var(--devui-warning, #fac20a)",danger:"var(--devui-danger, #f66f6a)"},u={"blue-w98":"#3383ff","aqua-w98":"#39afcc","olivine-w98":"#2fa898","green-w98":"#4eb15e","yellow-w98":"#b08d1a","orange-w98":"#d47f35","red-w98":"#f66f6a","pink-w98":"#f3689a","purple-w98":"#a97af8"};return!t&&a?l[a]:u[t]||t})}var V="",p=e.defineComponent({name:"DTag",props:m,emits:["click","tagDelete","checkedChange"],setup(n,{slots:t,emit:a}){const l=v("tag"),{type:u,color:d,checked:i,titleContent:c,deletable:f}=e.toRefs(n),h=y(n),g=b(n),w=c.value||"",k=()=>!u.value&&!d.value,T=r=>{a("click",r)},$=r=>{r.stopPropagation(),a("tagDelete",r)},N=()=>f.value?e.createVNode("a",{class:"remove-button",onClick:$},[k()?e.createVNode(e.resolveComponent("d-icon"),{size:"12px",name:"error-o",color:"#adb0b8"},null):e.createVNode(e.resolveComponent("d-icon"),{size:"12px",name:"close",color:g.value},null)]):null,S=e.watch(i,r=>{a("checkedChange",r)});return e.onUnmounted(()=>S()),()=>{var r;return e.createVNode("div",{class:l.b(),onClick:T},[e.createVNode("span",{class:h.value,style:{display:"block",color:i.value?"#fff":g.value,backgroundColor:i.value?g.value:d.value?"var(--devui-base-bg, #ffffff)":""},title:w},[(r=t.default)==null?void 0:r.call(t),N()])])}}}),C={title:"Tag \u6807\u7B7E",category:"\u6570\u636E\u5C55\u793A",status:"100%",install(n){n.component(p.name,p)}};o.Tag=p,o.default=C,o.tagProps=m,Object.defineProperty(o,"__esModule",{value:!0}),o[Symbol.toStringTag]="Module"});
