"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/slicedToArray"),t=require("react/jsx-runtime"),r=require("classnames"),i=require("react"),n=require("lodash"),s=require("../Tooltip/Tooltip.js"),u=require("./TextEndTruncated.scss.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=a(e),l=a(r);exports.TextEndTruncated=function(e){var r=e.children,a=e.disableTooltip,o=e.maxLines,d=void 0===o?1:o,f=e.testId,b=e.className,v=d>1,h=i.useRef(null),m=i.useRef(v),p=i.useState(null),x=c.default(p,2),T=x[0],q=x[1],j=i.useState(!0),L=c.default(j,2),y=L[0],g=L[1];return m.current=v,i.useLayoutEffect((function(){var e=n.debounce((function(){requestAnimationFrame((function(){var e=h.current;e&&(q(e.textContent),g(e.scrollWidth<=e.clientWidth&&(e.scrollHeight<=e.clientHeight||!m.current)))}))}),200),t=new ResizeObserver(e),r=new MutationObserver(e);return h.current&&(t.observe(h.current),r.observe(h.current,{childList:!0,subtree:!0,characterData:!0})),function(){t.disconnect(),r.disconnect()}}),[]),t.jsx(s.Tooltip,{title:T,disabled:y||a,children:t.jsx("div",{className:l.default(u.root,v?u.multiLine:u.singleLine,b),style:v?{WebkitLineClamp:d}:void 0,ref:h,"data-testid":f,children:r})})};
//# sourceMappingURL=TextEndTruncated.js.map
