import{ae as _,aR as m,al as s,aW as n,am as r,ap as i,a_ as u,aX as v,at as g,aw as w}from"./index-D68iA7pN.js";const B={key:0,className:"mx_text_parent_main"},N={class:"mx_text_next_span"},S=_({__name:"TextEllipsis",props:{text:{},width:{default:100},size:{},family:{},sliceNum:{default:6}},setup(e){const o=document.body.currentStyle||document.defaultView.getComputedStyle(document.body,""),d=parseInt(o.fontSize),x=parseInt(o.fontFamily);function p(t){const l=document.createElement("canvas").getContext("2d");l.font=`${e.size||d}px ${e.family||x}`;const a=l.measureText(t),y=Math.abs(a.actualBoundingBoxLeft)+Math.abs(a.actualBoundingBoxRight);return Math.max(a.width,y)}const c=m(()=>p(e.text)),f=m(()=>c.value>e.width);return(t,h)=>(s(),n("div",{class:"mx_text_parent",style:u({width:t.width+"px"})},[f.value?(s(),n("div",B,[r("span",{class:"mx_text_prev_span",style:u({width:c.value})},i(t.text.slice(0,-t.sliceNum)),5),r("span",N,i(t.text.slice(-t.sliceNum)),1)])):(s(),n(v,{key:1},[g(i(t.text),1)],64))],4))}}),E=w(S,[["__scopeId","data-v-66f61507"]]);export{E as T};