<?php
declare(strict_types=1);
?>
<?php use Tracy\Dumper ?>
<style class="tracy-debug">
	#tracy-debug .nette-ContainerPanel table {
		width: 100%;
		white-space: nowrap;
	}

	#tracy-debug .nette-ContainerPanel .created {
		font-weight: bold;
	}

	#tracy-debug .nette-ContainerPanel .yes {
		color: green;
		font-weight: bold;
	}

	#tracy-debug .nette-ContainerPanel table pre {
		display: inline;
		background: transparent;
		padding: 0;
		word-break: normal;
	}
</style>

<h1>Nette DI Container</h1>

<div class="tracy-inner nette-ContainerPanel">
<div class="tracy-inner-container">
	<p>Source: <?= Tracy\Helpers::editorLink($file) ?>
</p>

	<table class="tracy-sortable">
		<thead>
			<tr>
				<th>Name</th>
				<th>Autowired</th>
				<th>Service</th>
				<th>Tags</th>
			</tr>
		</thead>
		<tbody>
<?php foreach ($services as $name => $type): ?><?php $name = (string) $name ?><?php $autowired = in_array($name, array_merge($wiring[$type][0] ?? [], $wiring[$type][1] ?? []), strict: true) ?>				<tr>
					<td class="<?= Tracy\Helpers::escapeHtml(isset($instances[$name]) ? 'created' : '') ?>
">
<?php if (is_numeric($name)): ?>
						<small><?= Tracy\Helpers::escapeHtml($name) ?>
</small><?php else: ?>
<?= Tracy\Helpers::escapeHtml($name) ?>

<?php endif ?>
					</td>
					<td class="<?= Tracy\Helpers::escapeHtml($autowired ? 'yes' : '') ?>
">
						<?= Tracy\Helpers::escapeHtml($autowired ? 'yes' : (isset($wiring[$type]) ? 'no' : '?')) ?>

					</td>
					<td>
<?php if (isset($instances[$name]) && !$instances[$name] instanceof Nette\DI\Container): ?>							<?= Dumper::toHtml($instances[$name], [Dumper::COLLAPSE => true, Dumper::LIVE => true, Dumper::DEPTH => 5]) ?>

<?php elseif (isset($instances[$name])): ?>							<code><?= Tracy\Helpers::escapeHtml(get_class($instances[$name])) ?>
</code>
<?php elseif (is_string($type)): ?>							<code><?= Tracy\Helpers::escapeHtml($type) ?>
</code>
<?php endif ?>					</td>
					<td>
<?php if (!isset($tags[$name])): ?><?php elseif (count($tags[$name]) === 1): ?>							<?= Tracy\Helpers::escapeHtml(key($tags[$name])) ?>
 = <?= Dumper::toHtml(current($tags[$name]), [Dumper::COLLAPSE => true]) ?>

<?php else: ?>							<?= Dumper::toHtml($tags[$name], [Dumper::COLLAPSE => true]) ?>

<?php endif ?>					</td>
				</tr>
<?php endforeach ?>		</tbody>
	</table>

	<h2>Parameters</h2>

	<div class="nette-ContainerPanel-parameters">
<?php if ($parameters === null): ?>			<i>disabled via 'di › export › parameters'</i>
<?php else: ?>			<?= Dumper::toHtml($parameters) ?>

<?php endif ?>	</div>
</div>
</div>
