import React from "react";
import _ from "lodash";
import {formatTimeStamp, formatTimeDelta} from "../../utils.js";
var TimeStamp = React.createClass({
    render: function () {
        if (!this.props.t) {
            //should be return null, but that triggers a React bug.
            return 
|
;
        }
        var ts = formatTimeStamp(this.props.t);
        var delta;
        if (this.props.deltaTo) {
            delta = formatTimeDelta(1000 * (this.props.t - this.props.deltaTo));
            delta = {"(" + delta + ")"};
        } else {
            delta = null;
        }
        return 
            | {this.props.title + ":"} | {ts} {delta} | 
;
    }
});
var ConnectionInfo = React.createClass({
    render: function () {
        var conn = this.props.conn;
        var address = conn.address.address.join(":");
        var sni = |
; //should be null, but that triggers a React bug.
        if (conn.sni) {
            sni = 
                | TLS SNI: | {conn.sni} | 
;
        }
        return (
            
        );
    }
});
var CertificateInfo = React.createClass({
    render: function () {
        //TODO: We should fetch human-readable certificate representation
        // from the server
        var flow = this.props.flow;
        var client_conn = flow.client_conn;
        var server_conn = flow.server_conn;
        var preStyle = {maxHeight: 100};
        return (
            
            {client_conn.cert ? 
Client Certificate
 : null}
            {client_conn.cert ? 
{client_conn.cert} : null}
            {server_conn.cert ? 
Server Certificate
 : null}
            {server_conn.cert ? 
{server_conn.cert} : null}
            
Client Connection
                
                Server Connection
                
                
                
            
        );
    }
});
export default Details;