"use strict";var React=require("react"),core=require("@gem-sdk/core");const useGpDescription=e=>{let t=React.useRef(null),[r,i]=React.useState(!1),[c,s]=React.useState(!1),o=core.useCollection(),u=core.useCurrentDevice(),n=core.getResponsiveValueByScreen(e?.hasLineClamp,u),a=core.getResponsiveValueByScreen(e?.lineClamp,u),l=core.useEditorMode(),p=()=>{i(e=>!e)};return React.useEffect(()=>{let e=t.current;i(!1),e&&n&&o?.description&&setTimeout(()=>{let t=e?.scrollHeight??0,r=e?.clientHeight??0,i=window.getComputedStyle(e).getPropertyValue("line-height"),c=parseInt(i,10)||1,o=Math.round((t??0)/c),u=void 0!==a&&a<o,n=r<t,l=core.isSafari()?u:n;a&&l?s(()=>!0):s(()=>!1)},100)},[n,a,o?.description]),{ref:t,open:r,isShowViewMore:c,handleToggleShowMore:p,mode:l,hasLineClamp:n}};exports.useGpDescription=useGpDescription;
