"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),require("../../../../react/jsx-runtime.js");var e=require("react"),t=require("../context/LayoutGroupContext.mjs.js"),o=require("../context/LazyContext.mjs.js"),n=require("../context/MotionConfigContext.mjs.js"),s=require("../context/MotionContext/index.mjs.js"),r=require("../context/MotionContext/create.mjs.js"),i=require("../render/dom/use-render.mjs.js"),u=require("../render/dom/utils/is-svg-component.mjs.js"),a=require("../render/html/use-html-visual-state.mjs.js"),l=require("../render/svg/use-svg-visual-state.mjs.js"),m=require("./features/definitions.mjs.js"),d=require("./features/load-features.mjs.js"),c=require("./utils/symbol.mjs.js"),j=require("./utils/use-motion-ref.mjs.js"),x=require("./utils/use-visual-element.mjs.js"),v=require("../../../../../_virtual/jsx-runtime.js"),f=require("../../../../motion-utils/dist/es/errors.mjs.js");function p(o){let{layoutId:n}=o;const s=e.useContext(t.LayoutGroupContext).id;return s&&void 0!==n?s+"-"+n:n}exports.createMotionComponent=function(t){let{forwardMotionProps:y=!1,type:C}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},q=arguments.length>2?arguments[2]:void 0,g=arguments.length>3?arguments[3]:void 0;q&&d.loadFeatures(q);const M=C?"svg"===C:u.isSVGComponent(t),h=M?l.useSVGVisualState:a.useHTMLVisualState;function E(u,a){let l;const d={...e.useContext(n.MotionConfigContext),...u,layoutId:p(u)},{isStatic:c}=d,C=r.useCreateMotionContext(u),E=h(u,c);if(!c&&"undefined"!=typeof window){!function(t,n){const s=e.useContext(o.LazyContext).strict;if("production"!==process.env.NODE_ENV&&n&&s){const e="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";t.ignoreStrict?f.warning(!1,e,"lazy-strict-mode"):f.invariant(!1,e,"lazy-strict-mode")}}(d,q);const n=function(e){const t=m.getInitializedFeatureDefinitions(),{drag:o,layout:n}=t;if(!o&&!n)return{};const s={...o,...n};return{MeasureLayout:o?.isEnabled(e)||n?.isEnabled(e)?s.MeasureLayout:void 0,ProjectionNode:s.ProjectionNode}}(d);l=n.MeasureLayout,C.visualElement=x.useVisualElement(t,E,d,g,n.ProjectionNode,M)}return v.exports.jsxs(s.MotionContext.Provider,{value:C,children:[l&&C.visualElement?v.exports.jsx(l,{visualElement:C.visualElement,...d}):null,i.useRender(t,u,j.useMotionRef(E,C.visualElement,a),E,c,y,M)]})}E.displayName=`motion.${"string"==typeof t?t:`create(${t.displayName??t.name??""})`}`;const L=e.forwardRef(E);return L[c.motionComponentSymbol]=t,L};
//# sourceMappingURL=index.mjs.js.map
