"use strict";var e=require("react"),t=require("@gem-sdk/core"),i=require("@gem-sdk/system"),r=require("../../common/hooks/useInView.js");exports.useRowSettings=s=>{let{setting:n,styles:u,children:l,maxWidthWithEmptyChildren:o,builderAttrs:c}=s,{isSection:d,lazy:g,layout:a,blockAlignment:h}=n??{},{background:m}=u??{},p=t.useCurrentDevice(),y=t.useEditorMode(),P=t.usePageType(),f=t.getBgVideoByDevice(m,p),v=e.useRef(null),w=e.useMemo(()=>t.isEmptyChildren(l),[l]),C=e=>{v.current&&(clearTimeout(v.current),v.current=null);let t=e?.getBoundingClientRect().height;e.style.height=`${t||500}px`,e.style.overflow="hidden"},T=e=>{v.current&&clearTimeout(v.current),v.current=setTimeout(()=>{e.style.height="",e.style.overflow="",v.current=null},1500)},[R,V]=r.useInView({initialInView:!g,triggerOnce:!0,skip:!d,onChange:(e,t)=>{t&&t instanceof HTMLElement&&"edit"===y&&(e?T(t):C(t))}}),k=e.useMemo(()=>!V&&"edit"==y&&"POST_PURCHASE"!==P,[V,y,P]),E=e.useMemo(()=>"edit"!==y&&g&&!V,[V,g,y]),M=i.createClass({...()=>{let e=o&&w&&"edit"===y;if(!e)return{};let i=t.getResponsiveValue(a,"display"),r=i[p];return{width:"fit"===r?"fit-content":"400px"}},"gp-content-visibility-hidden":E});return{ref:R,isRowEmpty:w,bgVideo:f,rowClassEditorOnly:M,isRenderPlaceholderViewBox:k,builderAttrs:c,children:l,isPostPurchase:"POST_PURCHASE"===P,postPurchaseVerticalAlign:()=>({desktop:h,tablet:h,mobile:h})}};
