import{styleToString as e}from"../vc-util/Dom/css.mjs";import{createApp as t,createVNode as n}from"vue";var r=3,i=8,a,o={padding:0,margin:0,display:`inline`,lineHeight:`inherit`};function s(t,n){t.setAttribute(`aria-hidden`,`true`);let r=e(window.getComputedStyle(n));t.setAttribute(`style`,r),t.style.position=`fixed`,t.style.left=`0`,t.style.height=`auto`,t.style.minHeight=`auto`,t.style.maxHeight=`auto`,t.style.paddingTop=`0`,t.style.paddingBottom=`0`,t.style.borderTopWidth=`0`,t.style.borderBottomWidth=`0`,t.style.top=`-999999px`,t.style.zIndex=`-1000`,t.style.textOverflow=`clip`,t.style.whiteSpace=`normal`,t.style.webkitLineClamp=`none`}function c(e){let t=document.createElement(`div`);s(t,e),t.appendChild(document.createTextNode(`text`)),document.body.appendChild(t);let n=t.getBoundingClientRect().height;return document.body.removeChild(t),n}var l=(e,l,u,d,f)=>{a||(a=document.createElement(`div`),a.setAttribute(`aria-hidden`,`true`),document.body.appendChild(a));let{rows:p,suffix:m=``}=l,h=c(e),g=Math.round(h*p*100)/100;s(a,e);let _=t({render(){return n(`div`,{style:o},[n(`span`,{style:o},[u,m]),n(`span`,{style:o},[d])])}});_.mount(a);function v(){return Math.round(a.getBoundingClientRect().height*100)/100-.1<=g}if(v())return _.unmount(),{content:u,text:a.innerHTML,ellipsis:!1};let y=Array.prototype.slice.apply(a.childNodes[0].childNodes[0].cloneNode(!0).childNodes).filter(({nodeType:e,data:t})=>e!==i&&t!==``),b=Array.prototype.slice.apply(a.childNodes[0].childNodes[1].cloneNode(!0).childNodes);_.unmount();let x=[];a.innerHTML=``;let S=document.createElement(`span`);a.appendChild(S);let C=document.createTextNode(f+m);S.appendChild(C),b.forEach(e=>{a.appendChild(e)});function w(e){S.insertBefore(e,C)}function T(e,t,n=0,r=t.length,i=0){let a=Math.floor((n+r)/2);if(e.textContent=t.slice(0,a),n>=r-1)for(let i=r;i>=n;--i){let n=t.slice(0,i);if(e.textContent=n,v()||!n)return i===t.length?{finished:!1,vNode:t}:{finished:!0,vNode:n}}return v()?T(e,t,a,r,a):T(e,t,n,a,i)}function E(e){if(e.nodeType===r){let t=e.textContent||``,n=document.createTextNode(t);return w(n),T(n,t)}return{finished:!1,vNode:null}}return y.some(e=>{let{finished:t,vNode:n}=E(e);return n&&x.push(n),t}),{content:x,text:a.innerHTML,ellipsis:!0}};export{l as default};