"use strict";const e=require("vue"),c=require("./base-iCmnU-fv.js"),v=require("../Element/__provide__/Clipboard.cjs"),b={class:"clipboard-btn"},y={key:0,class:"clipboard-operate-result"},E=e.defineComponent({name:"ClClipboard",__name:"Index",props:{textLabel:{type:[String,Function],required:!0},className:String,iconColorClass:String,isUseSuccess:Boolean},emits:["onCopySuccess","onCopyError"],setup(l,{emit:u}){const n=l,r=u,t=e.reactive({isHover:!1,isShowSuccess:!1});let i=null;const m=e.computed(()=>{const s={"panel-clipboard":!0},{className:o}=n;return o&&!c.CommonBase.isEmpty(o)&&o.split(" ").forEach(a=>{c.CommonBase.isEmpty(a)||(s[a]=!0)}),s}),p=e.computed(()=>{const s={clIconFont:!0,"clIcon-copy":!0},{iconColorClass:o}=n;return o&&!c.CommonBase.isEmpty(o)&&(s[o]=!0),s}),d=()=>{i=v()};e.onMounted(()=>{e.nextTick(()=>{d()})});const C=()=>{let s="";const{textLabel:o}=n;if(o)switch(typeof o){case"function":s=o();break;case"string":s=o;break}c.CommonBase.isEmpty(s)?r("onCopyError",s):i.copy({text:s,successCallback:()=>{t.isShowSuccess=!0,r("onCopySuccess")},errorCallback:()=>{t.isShowSuccess=!1,r("onCopyError",s)}})},f=()=>{t.isHover=!0},S=()=>{t.isShowSuccess=!1,t.isHover=!1};return(s,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(m.value),onMouseenter:f,onMouseleave:S,onClick:e.withModifiers(C,["stop"])},[e.createElementVNode("div",b,[e.renderSlot(s.$slots,"default",{},()=>[e.createElementVNode("i",{class:e.normalizeClass(p.value),title:"复制"},null,2)])]),l.isUseSuccess&&t.isHover&&t.isShowSuccess?(e.openBlock(),e.createElementBlock("div",y,[...o[0]||(o[0]=[e.createElementVNode("i",{class:"clIconFont clIcon-check"},null,-1)])])):e.createCommentVNode("",!0)],34))}});exports._sfc_main=E;
//# sourceMappingURL=Index.vue_vue_type_script_setup_true_lang-BYmK-TqX.js.map
