protected static function _searchPaths($paths, $library) {
		$result = [];

		foreach ($paths as $tpl => $opts) {
			if (is_int($tpl)) {
				$tpl = $opts;
				$opts = [];
			}
			if (isset($opts['libraries']) && !in_array($library, (array) $opts['libraries'])) {
				continue;
			}
			$result[] = $tpl;
		}
		return $result;
	}