import{useContext as t,useEffect as o}from"react";import{__assign as n}from"../../../../node_modules/tslib/tslib.es6.js";import{MotionConfigContext as e}from"../../context/MotionConfigContext.js";import{useVisualElementContext as i}from"../../context/MotionContext/index.js";import{PresenceContext as r}from"../../context/PresenceContext.js";import{useConstant as s}from"../../utils/use-constant.js";import{isPresent as u}from"../../components/AnimatePresence/use-presence.js";import{LayoutGroupContext as m}from"../../context/LayoutGroupContext.js";import{useIsomorphicLayoutEffect as a}from"../../utils/use-isomorphic-effect.js";import{useSnapshotOnUnmount as c}from"../features/layout/use-snapshot-on-unmount.js";function p(p,l,f,d){var x=t(e),j=i(),v=t(r),y=function(o){var n=o.layoutId,e=t(m);return e&&void 0!==n?e+"-"+n:n}(d),C=s((function(){return f(p,{visualState:l,parent:j,props:n(n({},d),{layoutId:y}),presenceId:null==v?void 0:v.id,blockInitialAnimation:!1===(null==v?void 0:v.initial)})}));return a((function(){C.setProps(n(n(n({},x),d),{layoutId:y})),C.isPresent=u(v),C.isPresenceRoot=!j||j.presenceId!==(null==v?void 0:v.id),C.syncRender()})),o((function(){var t;null===(t=C.animationState)||void 0===t||t.animateChanges()})),c(C),C}export{p as useVisualElement};
//# sourceMappingURL=use-visual-element.js.map
