{"version":3,"file":"index.mjs","names":[],"sources":["../../src/MotionProvider/index.tsx"],"sourcesContent":["'use client';\n\nimport type * as m from 'motion/react-m';\nimport { type Context, createContext, memo, type ReactNode, use } from 'react';\n\nexport type MotionComponentType = typeof import('motion/react').motion | typeof m;\n\nexport const MotionComponent: Context<MotionComponentType> = createContext<MotionComponentType>(\n  null!,\n);\n\nexport const MotionProvider = memo<{ children: ReactNode; motion: MotionComponentType }>(\n  ({ children, motion }) => {\n    return <MotionComponent value={motion}>{children}</MotionComponent>;\n  },\n);\n\nexport const useMotionComponent = (): MotionComponentType => {\n  const context = use(MotionComponent);\n  if (!context) {\n    throw new Error(\n      'Please wrap your app with <ConfigProvider> (or <MotionProvider>) and pass the motion component',\n    );\n  }\n  return context;\n};\n"],"mappings":";;;;AAOA,MAAa,kBAAgD,cAC3D,KACD;AAED,MAAa,iBAAiB,MAC3B,EAAE,UAAU,aAAa;AACxB,QAAO,oBAAC,iBAAD;EAAiB,OAAO;EAAS;EAA2B,CAAA;EAEtE;AAED,MAAa,2BAAgD;CAC3D,MAAM,UAAU,IAAI,gBAAgB;AACpC,KAAI,CAAC,QACH,OAAM,IAAI,MACR,iGACD;AAEH,QAAO"}