"use strict";
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
    if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
    return cooked;
};
Object.defineProperty(exports, "__esModule", { value: true });
var React = require("react");
var ageOfDate_1 = require("./util/ageOfDate");
var ResultViewer_1 = require("./ResultViewer");
var cn = require("classnames");
var react_redux_1 = require("react-redux");
var reselect_1 = require("reselect");
var selectors_1 = require("../../state/sessions/selectors");
var styled_1 = require("../../styled");
var Results = function (_a) {
    var setRef = _a.setRef, responses = _a.responses;
    return (<div className={cn('result-window', {
        isSubscription: responses.size > 1,
    })} ref={setRef}>
      <style jsx={true}>{"\n        .result-window {\n          @p: .bgDarkBlue, .nosb, .relative;\n        }\n\n        .subscription-time {\n          @p: .relative;\n          height: 17px;\n          margin-top: 12px;\n          margin-bottom: 4px;\n          &:before {\n            @p: .absolute, .w100;\n            content: '';\n            top: 9px;\n            left: 95px;\n            border-top: 1px solid $white20;\n          }\n        }\n\n        .subscription-time-text {\n          @p: .bgDarkBlue, .white50, .f12;\n          padding-left: 15px;\n        }\n\n        .result-viewer-wrapper {\n          position: absolute;\n          top: 0;\n          left: 0;\n          right: 0;\n          bottom: 0;\n          overflow: auto;\n        }\n        .isSubscription .result-viewer-wrapper {\n          position: relative;\n        }\n      "}</style>
      {responses.map(function (response) { return (<Response key={response.resultID || String(response.time)}>
          {responses.size > 1 &&
        response.time && (<div className="subscription-time">
                <div className="subscription-time-text">
                  {ageOfDate_1.default(response.time)}
                </div>
              </div>)}
          <div className="result-viewer-wrapper">
            <ResultViewer_1.ResultViewer value={response.date}/>
          </div>
        </Response>); })}
    </div>);
};
var mapStateToProps = reselect_1.createStructuredSelector({
    responses: selectors_1.getResponses,
});
exports.default = react_redux_1.connect(mapStateToProps)(Results);
var Response = styled_1.styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n  &:not(:first-child):last-of-type {\n    margin-bottom: 48px;\n  }\n"], ["\n  &:not(:first-child):last-of-type {\n    margin-bottom: 48px;\n  }\n"])));
var templateObject_1;
//# sourceMappingURL=Results.jsx.map