<?php

/**
 * Debug Bar screen template.
 *
 * It uses Font Awesome by Dave Gandy - http://fontawesome.io
 *
 * This file is part of the Tracy (https://tracy.nette.org)
 * Copyright (c) 2004 David Grudl (https://davidgrudl.com)
 *
 * @param  array $panels
 * @param  array $info
 * @param  array $liveData
 * @return void
 */

namespace Tracy;

use Tracy;

?>




<!-- Tracy Debug Bar -->

<?php ob_start() ?>
&nbsp;

<style id="tracy-debug-style" class="tracy-debug">
<?php readfile(__DIR__ . '/bar.css') ?>
<?php readfile(__DIR__ . '/../Dumper/dumper.css') ?>
</style>

<script id="tracy-debug-script">
<?php readfile(__DIR__ . '/bar.js') ?>
<?php readfile(__DIR__ . '/../Dumper/dumper.js') ?>
</script>


<?php foreach ($panels as $panel): if (!empty($panel['previous'])) continue ?>
	<div class="tracy-panel" id="tracy-debug-panel-<?php echo $panel['id'] ?>">
		<?php if ($panel['panel']): echo $panel['panel'] ?>
		<div class="tracy-icons">
			<a href="#" title="open in window">&curren;</a>
			<a href="#" rel="close" title="close window">&times;</a>
		</div>
		<?php endif ?>
	</div>
<?php endforeach ?>

<div id="tracy-debug-bar">
	<ul>
		<li id="tracy-debug-logo" title="Tracy Debugger <?php echo Debugger::VERSION, " \nhttps://tracy.nette.org" ?>">
			<svg viewBox="0 -10 1561 333"><path fill="#585755" d="m176 327h-57v-269h-119v-57h291v57h-115v269zm208-191h114c50 0 47-78 0-78h-114v78zm106-135c17 0 33 2 46 7 75 30 75 144 1 175-13 6-29 8-47 8h-27l132 74v68l-211-128v122h-57v-326h163zm300 57c-5 0-9 3-11 9l-56 156h135l-55-155c-2-7-6-10-13-10zm-86 222l-17 47h-61l102-285c20-56 107-56 126 0l102 285h-61l-17-47h-174zm410 47c-98 0-148-55-148-163v-2c0-107 50-161 149-161h118v57h-133c-26 0-45 8-58 25-12 17-19 44-19 81 0 71 26 106 77 106h133v57h-119zm270-145l-121-181h68l81 130 81-130h68l-121 178v148h-56v-145z"/></svg>
		</li>
		<?php foreach ($panels as $panel): if (!$panel['tab']) continue; ?>
		<?php if (!empty($panel['previous'])) echo '</ul><ul class="tracy-previous">'; ?>
		<li><?php if ($panel['panel']): ?><a href="#" rel="<?php echo $panel['id'] ?>"><?php echo trim($panel['tab']) ?></a><?php else: echo '<span>', trim($panel['tab']), '</span>'; endif ?></li>
		<?php endforeach ?>
		<li><a href="#" rel="close" title="close debug bar">&times;</a></li>
	</ul>
</div>
<?php $output = ob_get_clean(); ?>


<script>
(function() {
	if (!document.documentElement.classList) {
		document.write('<div style="position:fixed;right:0;bottom:0;z-index:30000;font:normal normal 12px/21px sans-serif;color:#333;background:#EDEAE0;border:1px solid #ccc;padding:.2em">Warning: Tracy requires IE 10+<\/div>');
		return;
	}

	window.addEventListener('load', function() {
		var debug = document.body.appendChild(document.createElement('div'));
		debug.id = 'tracy-debug';
		debug.innerHTML = <?php echo json_encode(Helpers::fixEncoding($output)) ?>;
		for (var i = 0, scripts = debug.getElementsByTagName('script'); i < scripts.length; i++) {
			(window.execScript || function(data) {
				window['eval'].call(window, data);
			})(scripts[i].innerHTML);
		}
		Tracy.Dumper.init(<?php echo json_encode($liveData) ?>);
		Tracy.Debug.init();
		debug.style.display = 'block';
	});
})();
</script>

<!-- /Tracy Debug Bar -->
