{
  "version": 3,
  "sources": ["../../../src/components/with-select/index.tsx"],
  "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent, pure } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport useSelect from '../use-select';\nimport type { SelectFunction, DataRegistry } from '../../types';\n\n/**\n * Higher-order component used to inject state-derived props using registered\n * selectors.\n *\n * @param mapSelectToProps Function called on every state change,\n *                         expected to return object of props to\n *                         merge with the component's own props.\n *\n * @example\n * ```js\n * import { withSelect } from '@wordpress/data';\n * import { store as myCustomStore } from 'my-custom-store';\n *\n * function PriceDisplay( { price, currency } ) {\n * \treturn new Intl.NumberFormat( 'en-US', {\n * \t\tstyle: 'currency',\n * \t\tcurrency,\n * \t} ).format( price );\n * }\n *\n * const HammerPriceDisplay = withSelect( ( select, ownProps ) => {\n * \tconst { getPrice } = select( myCustomStore );\n * \tconst { currency } = ownProps;\n *\n * \treturn {\n * \t\tprice: getPrice( 'hammer', currency ),\n * \t};\n * } )( PriceDisplay );\n *\n * // Rendered in the application:\n * //\n * //  <HammerPriceDisplay currency=\"USD\" />\n * ```\n * In the above example, when `HammerPriceDisplay` is rendered into an\n * application, it will pass the price into the underlying `PriceDisplay`\n * component and update automatically if the price of a hammer ever changes in\n * the store.\n *\n * @return Enhanced component with merged state data props.\n */\nconst withSelect = (\n\tmapSelectToProps: (\n\t\tselect: SelectFunction,\n\t\townProps: Record< string, unknown >,\n\t\tregistry: DataRegistry\n\t) => Record< string, unknown >\n) =>\n\tcreateHigherOrderComponent(\n\t\t( WrappedComponent ) =>\n\t\t\tpure( ( ownProps: Record< string, unknown > ) => {\n\t\t\t\tconst mapSelect = (\n\t\t\t\t\tselect: SelectFunction,\n\t\t\t\t\tregistry: DataRegistry\n\t\t\t\t) => mapSelectToProps( select, ownProps, registry );\n\t\t\t\tconst mergeProps = useSelect( mapSelect );\n\t\t\t\treturn <WrappedComponent { ...ownProps } { ...mergeProps } />;\n\t\t\t} ),\n\t\t'withSelect'\n\t);\n\nexport default withSelect;\n"],
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAiD;AAKjD,wBAAsB;AA0DX;AAfX,IAAM,aAAa,CAClB,yBAMA;AAAA,EACC,CAAE,yBACD,qBAAM,CAAE,aAAyC;AAChD,UAAM,YAAY,CACjB,QACA,aACI,iBAAkB,QAAQ,UAAU,QAAS;AAClD,UAAM,iBAAa,kBAAAA,SAAW,SAAU;AACxC,WAAO,4CAAC,oBAAmB,GAAG,UAAa,GAAG,YAAa;AAAA,EAC5D,CAAE;AAAA,EACH;AACD;AAED,IAAO,sBAAQ;",
  "names": ["useSelect"]
}
