{"ast":null,"code":"import * as React from 'react';\nimport { useMemo } from 'react';\nimport { PresenceContext } from '../../context/PresenceContext.js';\nimport { useConstant } from '../../utils/use-constant.js';\nvar presenceId = 0;\nfunction getPresenceId() {\n  var id = presenceId;\n  presenceId++;\n  return id;\n}\nvar PresenceChild = function PresenceChild(_a) {\n  var children = _a.children,\n    initial = _a.initial,\n    isPresent = _a.isPresent,\n    _onExitComplete = _a.onExitComplete,\n    custom = _a.custom,\n    presenceAffectsLayout = _a.presenceAffectsLayout;\n  var presenceChildren = useConstant(newChildrenMap);\n  var id = useConstant(getPresenceId);\n  var context = useMemo(function () {\n    return {\n      id: id,\n      initial: initial,\n      isPresent: isPresent,\n      custom: custom,\n      onExitComplete: function onExitComplete(childId) {\n        presenceChildren.set(childId, true);\n        var allComplete = true;\n        presenceChildren.forEach(function (isComplete) {\n          if (!isComplete) allComplete = false;\n        });\n        allComplete && (_onExitComplete === null || _onExitComplete === void 0 ? void 0 : _onExitComplete());\n      },\n      register: function register(childId) {\n        presenceChildren.set(childId, false);\n        return function () {\n          return presenceChildren[\"delete\"](childId);\n        };\n      }\n    };\n  },\n  /**\n   * If the presence of a child affects the layout of the components around it,\n   * we want to make a new context value to ensure they get re-rendered\n   * so they can detect that layout change.\n   */\n  presenceAffectsLayout ? undefined : [isPresent]);\n  useMemo(function () {\n    presenceChildren.forEach(function (_, key) {\n      return presenceChildren.set(key, false);\n    });\n  }, [isPresent]);\n  /**\n   * If there's no `motion` components to fire exit animations, we want to remove this\n   * component immediately.\n   */\n  React.useEffect(function () {\n    !isPresent && !presenceChildren.size && (_onExitComplete === null || _onExitComplete === void 0 ? void 0 : _onExitComplete());\n  }, [isPresent]);\n  return React.createElement(PresenceContext.Provider, {\n    value: context\n  }, children);\n};\nfunction newChildrenMap() {\n  return new Map();\n}\nexport { PresenceChild };","map":{"version":3,"names":["React","useMemo","PresenceContext","useConstant","presenceId","getPresenceId","id","PresenceChild","_a","children","initial","isPresent","onExitComplete","custom","presenceAffectsLayout","presenceChildren","newChildrenMap","context","childId","set","allComplete","forEach","isComplete","register","undefined","_","key","useEffect","size","createElement","Provider","value","Map"],"sources":["C:/ldt/LDT/Safemate_Management/node_modules/framer-motion/dist/es/components/AnimatePresence/PresenceChild.js"],"sourcesContent":["import * as React from 'react';\nimport { useMemo } from 'react';\nimport { PresenceContext } from '../../context/PresenceContext.js';\nimport { useConstant } from '../../utils/use-constant.js';\n\nvar presenceId = 0;\nfunction getPresenceId() {\n    var id = presenceId;\n    presenceId++;\n    return id;\n}\nvar PresenceChild = function (_a) {\n    var children = _a.children, initial = _a.initial, isPresent = _a.isPresent, onExitComplete = _a.onExitComplete, custom = _a.custom, presenceAffectsLayout = _a.presenceAffectsLayout;\n    var presenceChildren = useConstant(newChildrenMap);\n    var id = useConstant(getPresenceId);\n    var context = useMemo(function () { return ({\n        id: id,\n        initial: initial,\n        isPresent: isPresent,\n        custom: custom,\n        onExitComplete: function (childId) {\n            presenceChildren.set(childId, true);\n            var allComplete = true;\n            presenceChildren.forEach(function (isComplete) {\n                if (!isComplete)\n                    allComplete = false;\n            });\n            allComplete && (onExitComplete === null || onExitComplete === void 0 ? void 0 : onExitComplete());\n        },\n        register: function (childId) {\n            presenceChildren.set(childId, false);\n            return function () { return presenceChildren.delete(childId); };\n        },\n    }); }, \n    /**\n     * If the presence of a child affects the layout of the components around it,\n     * we want to make a new context value to ensure they get re-rendered\n     * so they can detect that layout change.\n     */\n    presenceAffectsLayout ? undefined : [isPresent]);\n    useMemo(function () {\n        presenceChildren.forEach(function (_, key) { return presenceChildren.set(key, false); });\n    }, [isPresent]);\n    /**\n     * If there's no `motion` components to fire exit animations, we want to remove this\n     * component immediately.\n     */\n    React.useEffect(function () {\n        !isPresent && !presenceChildren.size && (onExitComplete === null || onExitComplete === void 0 ? void 0 : onExitComplete());\n    }, [isPresent]);\n    return (React.createElement(PresenceContext.Provider, { value: context }, children));\n};\nfunction newChildrenMap() {\n    return new Map();\n}\n\nexport { PresenceChild };\n"],"mapp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