text: "use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function getReducerPropertyName(e,o){var r=void 0,t=_commons2.default.parse(e),d=_commons2.default.findDefaultExportsNode(t);if(!d)throw Error("Could not find default export in global reducers file.");var n=_commons2.default.findDefaultImport(t,o);if(!n)throw Error("Could not find import from "+o+" in global reducers file.");var u=_commons2.default.findPropertyInObjectNode(d,n),m=_commons2.default.findPropertyByValueInObjectNode(d,n);if(!u&&!m)throw Error("There is no a reducer imported from the module reducer file "+o);return u&&u.key?r=u.key.name:m&&m.key&&(r=m.key.name),r}function injectModuleReducer(e,o,r,t){var d=_commons2.default.parse(e),n=_commons2.default.findDefaultExportsNode(d);if(!n)throw Error("Could not find default export in module reducer file.");var u=n.callee,m=n.arguments;if(!u||"combineReducers"!==u.name)throw Error('Could not find "combineReducers" method in the default export in module reducer file.');if(m&&m.length>0){var a=_commons2.default.findPropertyInObjectNode(n.arguments[0],o);if(a)throw Error("There is already a reducer with name "+o+" in module reducer file");var f=_commons2.default.findDefaultImport(d,t);_commons2.default.deletePropertyFromObjectNode(n.arguments[0],o,f),_commons2.default.deletePropertyFromObjectNode(n.arguments[0],o,r),_commons2.default.addPropertyToObjectNode(n.arguments[0],o,r)}else{var l=_commons2.default.createObjectExpressionNode();_commons2.default.addPropertyToObjectNode(l,o,r),n.arguments=[l]}return _commons2.default.addDefaultImport(d,r,t),_commons2.default.generate(d)}function injectReducer(e,o,r,t){var d=_commons2.default.parse(e),n=_commons2.default.findDefaultExportsNode(d);if(!n)throw Error("Could not find default export in global reducers file.");var u=_commons2.default.findDefaultImport(d,t);if(u){var m=_commons2.default.findPropertyInObjectNode(n,u),a=_commons2.default.findPropertyByValueInObjectNode(n,u);m||a||(_commons2.default.addPropertyToObjectNode(n,o,r),_commons2.default.addDefaultImport(d,r,t))}else _commons2.default.addPropertyToObjectNode(n,o,r),_commons2.default.addDefaultImport(d,r,t);return _commons2.default.generate(d)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.getReducerPropertyName=getReducerPropertyName,exports.injectModuleReducer=injectModuleReducer,exports.injectReducer=injectReducer;var _commons=require("../commons"),_commons2=_interopRequireDefault(_commons);