<?php
    $loadTime = $this->getLoadTime();
?>
<style type="text/css">
    /**
     * Global
     */

    .fs-debug-panel h1,
    .fs-debug-panel h2,
    .fs-debug-panel h3,
    .fs-debug-panel h4,
    .fs-debug-panel h5,
    .fs-debug-panel h6,
    .fs-debug-panel p
    {
        font-family: "Courier New", Courier, monospace;
    }

    .fs-debug-panel h1,
    .fs-debug-panel h2,
    .fs-debug-panel h3,
    .fs-debug-panel h4,
    .fs-debug-panel h5,
    .fs-debug-panel h6
    {
        font-weight: 800;
    }

    .fs-debug-panel p
    {
        font-weight: 400;
    }

    .fs-debug-panel {
        font-family: "Courier New", Courier, monospace;
        margin: 10px;
        padding: 20px 20px;
        border-radius: 15px;
        background-color: #464646;
        color: #ececec;
        display: block;
        font-size: 14px;
        line-height: 16px;
        overflow: hidden;
    }
    .fs-debug-panel h1.fs-title {
        color: #ececec;
        margin: 0;
        font-size: 32px;
        line-height: 35px;
        font-weight: 800;
    }
    .fs-debug-panel h3.fs-title {
        color: #464646;
        margin: 0 0 15px 0;
        font-size: 22px;
        line-height: 24px;
        font-weight: 800;
    }
    .fs-debug-panel .fs-description {
        color: #464646;
        display: block;
        margin: 0 0 20px 0;
        font-weight: 400;
        border: 1px dotted #464646;
        padding: 10px;
    }
    .fs-debug-panel hr.fs-hr {
        margin: 25px 0 25px 0;
        color: #464646;
        border-top: 2px dashed;
        background-color: #f0f0f0;
    }
    .fs-debug-panel hr.fs-hr-dotted {
        margin: 20px 0 20px 0;
        border-top: 1px dotted;
        color: #464646;
        background-color: #f0f0f0;
    }
    .fs-debug-panel .fs-label {
        color: #464646;
        display: block;
        margin: 0 0 5px 0;
        font-weight: 400;
    }
    .fs-debug-panel .fs-openCloseBtn {
        color: #5178f1;
        cursor: pointer;
    }
    .fs-debug-panel pre.fs-dark {
        background-color: #16232e;
        color: #ececec;
    }
    .fs-debug-panel pre {
        color: #464646;
        border: 1px dotted;
        padding: 20px;
        margin: 0 0 10px 0;
        overflow-x: scroll;
        font-size: 14px;
        line-height: 16px;
        max-height: 200px;
    }
    .fs-debug-panel pre.fs-wrap {
        white-space: pre-wrap;
        white-space: -moz-pre-wrap;
        white-space: -pre-wrap;
        white-space: -o-pre-wrap;
        word-wrap: break-word;
        overflow: hidden;
    }
    .fs-debug-panel pre.fs-expand {
        max-height: none;
    }
    .fs-debug-panel .fs-pre-wrap,
    .fs-debug-panel .fs-pre-expand
    {
        font-size: 12px;
        color: #5178f1;
        cursor: pointer;
        text-decoration: underline;
    }
    .fs-debug-panel table {
        color: #464646;
        width: 100%;
        border: 1px solid;
        border-collapse: collapse;
        margin: 0 0 10px 0;
    }
    .fs-debug-panel table th {
        font-weight: bold;
    }
    .fs-debug-panel table th,
    .fs-debug-panel table td {
        color: #464646;
        border: 1px solid;
        text-align: left;
        padding: 5px;
    }
    /**
     * Section
     */
    .fs-debug-panel .fs-section {
        margin: 15px 0 0 0;
        background: #ececec;
        color: #464646;
        padding: 20px;
        border-radius: 10px;
    }
    .fs-debug-panel .fs-section .fs-content {
        overflow-x: scroll;
    }
    /**
     * Section Closed
     */
    .fs-debug-panel .fs-section.closed .fs-content {
        display: none;
    }
    .fs-debug-panel .fs-section.closed h3.fs-title {
        margin-bottom: 0;
    }
</style>

<script type="text/javascript">
    (function(){
        document.addEventListener('DOMContentLoaded', function () {
            var openCloseBtns = document.querySelectorAll('.fs-openCloseBtn');
            var button;
            var section;
            for (i = 0; i < openCloseBtns.length; i++) {
                button = openCloseBtns[i];
                section = button.parentElement.parentElement;
                if (section.classList.contains('closed')) {
                    button.innerHTML = '(+)';
                } else {
                    button.innerHTML = '(-)';
                }
                button.onclick = function () {
                    var button = this;
                    var section = button.parentElement.parentElement;
                    if (section.classList.contains('closed')) {
                        section.classList.remove('closed')
                        button.innerHTML = '(-)';
                    } else {
                        section.classList.add('closed')
                        button.innerHTML = '(+)';
                    }
                }
            }
        });
    })();
    (function(){
        document.addEventListener('DOMContentLoaded', function () {
            var preWrapButtons = document.querySelectorAll('.fs-pre-wrap');
            for (i = 0; i < preWrapButtons.length; i++) {
                preWrapButtons[i].onclick = function () {
                    var button = this;
                    var pre = button.parentElement.getElementsByTagName('pre')[0];
                    if (pre.classList.contains('fs-wrap')) {
                        pre.classList.remove('fs-wrap')
                        button.innerHTML = 'wrap';
                    } else {
                        pre.classList.add('fs-wrap')
                        button.innerHTML = 'unwrap';
                    }
                }
            }

            var preExpandButtons = document.querySelectorAll('.fs-pre-expand');
            for (i = 0; i < preExpandButtons.length; i++) {
                preExpandButtons[i].onclick = function () {
                    var button = this;
                    var pre = button.parentElement.getElementsByTagName('pre')[0];
                    if (pre.classList.contains('fs-expand')) {
                        pre.classList.remove('fs-expand')
                        button.innerHTML = 'expand';
                    } else {
                        pre.classList.add('fs-expand')
                        button.innerHTML = 'collapse';
                    }
                }
            }
        });
    })();
</script>

<div class="fs-debug-panel">
    <h1 class="fs-title"><?php echo $this->escape($this->getName()); ?></h1>
    <?php if ($loadTime) { ?>
        <span class="fs-label" style="text-align: right; color: #ececec;"><?php echo $this->escape($loadTime); ?> milliseconds</span>
    <?php } ?>
    <?php
        foreach ($this->getPanels() as $panel) {
            $panel->render();
        }
    ?>
</div>
