const e=require("../vc-util/Dom/css.js");let t=require("vue");var n=3,r=8,i,a={padding:0,margin:0,display:`inline`,lineHeight:`inherit`};function o(t,n){t.setAttribute(`aria-hidden`,`true`);let r=e.styleToString(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 s(e){let t=document.createElement(`div`);o(t,e),t.appendChild(document.createTextNode(`text`)),document.body.appendChild(t);let n=t.getBoundingClientRect().height;return document.body.removeChild(t),n}var c=(e,c,l,u,d)=>{i||(i=document.createElement(`div`),i.setAttribute(`aria-hidden`,`true`),document.body.appendChild(i));let{rows:f,suffix:p=``}=c,m=s(e),h=Math.round(m*f*100)/100;o(i,e);let g=(0,t.createApp)({render(){return(0,t.createVNode)(`div`,{style:a},[(0,t.createVNode)(`span`,{style:a},[l,p]),(0,t.createVNode)(`span`,{style:a},[u])])}});g.mount(i);function _(){return Math.round(i.getBoundingClientRect().height*100)/100-.1<=h}if(_())return g.unmount(),{content:l,text:i.innerHTML,ellipsis:!1};let v=Array.prototype.slice.apply(i.childNodes[0].childNodes[0].cloneNode(!0).childNodes).filter(({nodeType:e,data:t})=>e!==r&&t!==``),y=Array.prototype.slice.apply(i.childNodes[0].childNodes[1].cloneNode(!0).childNodes);g.unmount();let b=[];i.innerHTML=``;let x=document.createElement(`span`);i.appendChild(x);let S=document.createTextNode(d+p);x.appendChild(S),y.forEach(e=>{i.appendChild(e)});function C(e){x.insertBefore(e,S)}function w(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,_()||!n)return i===t.length?{finished:!1,vNode:t}:{finished:!0,vNode:n}}return _()?w(e,t,a,r,a):w(e,t,n,a,i)}function T(e){if(e.nodeType===n){let t=e.textContent||``,n=document.createTextNode(t);return C(n),w(n,t)}return{finished:!1,vNode:null}}return v.some(e=>{let{finished:t,vNode:n}=T(e);return n&&b.push(n),t}),{content:b,text:i.innerHTML,ellipsis:!0}};exports.default=c;