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