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oB,CAAC,UAAK,CAAC,CAAC,EAAE,UAAK,CAAC,CAAC,CAAC,CAAC;KACjD;CACJ","file":"index.js","sourcesContent":["import extendReactClass from './extendReactClass';\nimport wrapStatelessFunction from './wrapStatelessFunction';\n\nlet decoratorConstructor,\n functionConstructor,\n isReactComponent;\n\n/**\n * Determines if the given object has the signature of a class that inherits React.Component.\n *\n * @param {*} Component\n * @return {boolean}\n */\nisReactComponent = (Component) => {\n return 'prototype' in Component && typeof Component.prototype.render === 'function';\n};\n\n/**\n * When used as a function.\n *\n * @param {Function} Component\n * @param {Object} defaultStyles CSS Modules class map.\n * @param {Object} options {@link https://github.com/gajus/react-css-modules#options}\n * @return {Function}\n */\nfunctionConstructor = (Component, defaultStyles, options) => {\n let decoratedClass;\n\n if (isReactComponent(Component)) {\n decoratedClass = extendReactClass(Component, defaultStyles, options);\n } else {\n decoratedClass = wrapStatelessFunction(Component, defaultStyles, options);\n }\n\n if (Component.displayName) {\n decoratedClass.displayName = Component.displayName;\n } else {\n decoratedClass.displayName = Component.name;\n }\n\n return decoratedClass;\n};\n\n/**\n * When used as a ES7 decorator.\n *\n * @param {Object} defaultStyles CSS Modules class map.\n * @param {Object} options {@link https://github.com/gajus/react-css-modules#options}\n * @return {Function}\n */\ndecoratorConstructor = (defaultStyles, options) => {\n return (Component) => {\n return functionConstructor(Component, defaultStyles, options);\n };\n};\n\nexport default (...args) => {\n if (typeof args[0] === 'function') {\n return functionConstructor(args[0], args[1], args[2]);\n } else {\n return decoratorConstructor(args[0], args[1]);\n }\n};\n"],"sourceRoot":"/source/"}
\No newline at end of file