{
  "version": 3,
  "sources": ["../src/entity-provider.js"],
  "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useContext, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { EntityContext } from './entity-context';\n\n/**\n * Context provider component for providing\n * an entity for a specific entity.\n *\n * @param {Object} props              The component's props.\n * @param {string} props.kind         The entity kind.\n * @param {string} props.type         The entity name.\n * @param {number} props.id           The entity ID.\n * @param {number} [props.revisionId] Optional revision ID. When set,\n *                                    `useEntityProp` reads from the\n *                                    revision record instead of the\n *                                    current entity.\n * @param {*}      props.children     The children to wrap.\n *\n * @return {Object} The provided children, wrapped with\n *                   the entity's context provider.\n */\nexport default function EntityProvider( {\n\tkind,\n\ttype: name,\n\tid,\n\trevisionId,\n\tchildren,\n} ) {\n\tconst parent = useContext( EntityContext );\n\tconst childContext = useMemo(\n\t\t() => ( {\n\t\t\t...parent,\n\t\t\t...( kind && {\n\t\t\t\t[ kind ]: {\n\t\t\t\t\t...parent?.[ kind ],\n\t\t\t\t\t[ name ]: id,\n\t\t\t\t},\n\t\t\t} ),\n\t\t\t...( revisionId !== undefined && { revisionId } ),\n\t\t} ),\n\t\t[ parent, kind, name, id, revisionId ]\n\t);\n\treturn (\n\t\t<EntityContext.Provider value={ childContext }>\n\t\t\t{ children }\n\t\t</EntityContext.Provider>\n\t);\n}\n"],
  "mappings": ";AAGA,SAAS,YAAY,eAAe;AAKpC,SAAS,qBAAqB;AAyC5B;AAtBa,SAAR,eAAiC;AAAA,EACvC;AAAA,EACA,MAAM;AAAA,EACN;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,QAAM,SAAS,WAAY,aAAc;AACzC,QAAM,eAAe;AAAA,IACpB,OAAQ;AAAA,MACP,GAAG;AAAA,MACH,GAAK,QAAQ;AAAA,QACZ,CAAE,IAAK,GAAG;AAAA,UACT,GAAG,SAAU,IAAK;AAAA,UAClB,CAAE,IAAK,GAAG;AAAA,QACX;AAAA,MACD;AAAA,MACA,GAAK,eAAe,UAAa,EAAE,WAAW;AAAA,IAC/C;AAAA,IACA,CAAE,QAAQ,MAAM,MAAM,IAAI,UAAW;AAAA,EACtC;AACA,SACC,oBAAC,cAAc,UAAd,EAAuB,OAAQ,cAC7B,UACH;AAEF;",
  "names": []
}
