"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _defineProperty2=require("babel-runtime/helpers/defineProperty"),_defineProperty3=_interopRequireDefault(_defineProperty2),_toConsumableArray2=require("babel-runtime/helpers/toConsumableArray"),_toConsumableArray3=_interopRequireDefault(_toConsumableArray2),_extends2=require("babel-runtime/helpers/extends"),_extends3=_interopRequireDefault(_extends2),_classCallCheck2=require("babel-runtime/helpers/classCallCheck"),_classCallCheck3=_interopRequireDefault(_classCallCheck2),_createClass2=require("babel-runtime/helpers/createClass"),_createClass3=_interopRequireDefault(_createClass2),_possibleConstructorReturn2=require("babel-runtime/helpers/possibleConstructorReturn"),_possibleConstructorReturn3=_interopRequireDefault(_possibleConstructorReturn2),_inherits2=require("babel-runtime/helpers/inherits"),_inherits3=_interopRequireDefault(_inherits2),_react=require("react"),React=_interopRequireWildcard(_react),_propTypes=require("prop-types"),PropTypes=_interopRequireWildcard(_propTypes),_classnames=require("classnames"),_classnames2=_interopRequireDefault(_classnames),_isFlexSupported=require("../_util/isFlexSupported"),_isFlexSupported2=_interopRequireDefault(_isFlexSupported);function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var __rest=function(e,t){var r={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(r[s]=e[s]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(s=Object.getOwnPropertySymbols(e);a<s.length;a++)t.indexOf(s[a])<0&&(r[s[a]]=e[s[a]])}return r};function generator(s){return function(t){return r=React.Component,(0,_inherits3.default)(e,r),(0,_createClass3.default)(e,[{key:"render",value:function(){var e=s.prefixCls;return React.createElement(t,(0,_extends3.default)({prefixCls:e},this.props))}}]),e;function e(){return(0,_classCallCheck3.default)(this,e),(0,_possibleConstructorReturn3.default)(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}var r}}var Basic=function(e){function t(){return(0,_classCallCheck3.default)(this,t),(0,_possibleConstructorReturn3.default)(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return(0,_inherits3.default)(t,e),(0,_createClass3.default)(t,[{key:"render",value:function(){var e=this.props,t=e.prefixCls,r=e.className,s=e.children,a=__rest(e,["prefixCls","className","children"]),n=(0,_classnames2.default)(r,t);return React.createElement("div",(0,_extends3.default)({className:n},a),s)}}]),t}(React.Component),BasicLayout=function(e){function t(){(0,_classCallCheck3.default)(this,t);var e=(0,_possibleConstructorReturn3.default)(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.state={siders:[]},e}return(0,_inherits3.default)(t,e),(0,_createClass3.default)(t,[{key:"getChildContext",value:function(){var r=this;return{siderHook:{addSider:function(e){r.setState({siders:[].concat((0,_toConsumableArray3.default)(r.state.siders),[e])})},removeSider:function(t){r.setState({siders:r.state.siders.filter(function(e){return e!==t})})}}}}},{key:"render",value:function(){var e=this.props,t=e.prefixCls,r=e.className,s=e.children,a=e.hasSider,n=__rest(e,["prefixCls","className","children","hasSider"]),o=(0,_classnames2.default)(r,t,(0,_defineProperty3.default)({},t+"-has-sider",a||0<this.state.siders.length),{"no-flex":!(0,_isFlexSupported2.default)()});return React.createElement("div",(0,_extends3.default)({className:o},n),s)}}]),t}(React.Component);BasicLayout.childContextTypes={siderHook:PropTypes.object};var Layout=generator({prefixCls:"dt-layout"})(BasicLayout),Header=generator({prefixCls:"dt-layout-header"})(Basic),Footer=generator({prefixCls:"dt-layout-footer"})(Basic),Content=generator({prefixCls:"dt-layout-content"})(Basic);Layout.Header=Header,Layout.Footer=Footer,Layout.Content=Content,exports.default=Layout,module.exports=exports.default;