<#if book?? && !(is_module_ai_present?? && is_module_ai_present)>
#if>
<#if space??>
#if>
<#macro flattenBookChildren children depth=0>
<#list children as child>
<#assign hasEditRights = chapter_edit_rights?? && chapter_edit_rights[child.id?c]?? && chapter_edit_rights[child.id?c]>
<#assign pendingCount = (pending_counts?? && pending_counts[child.id?c]??)?then(pending_counts[child.id?c], 0)>
<#if child.type.code == "page">
<#elseif child.type.code == "chapter">
<#assign chapter = child>
<#if (chapter.children?? && chapter.children?has_content) || hasEditRights>
<#if chapter.children?? && chapter.children?has_content>
<@flattenBookChildren children=chapter.children depth=depth+1 />
#if>
#if>
#if>
#list>
#macro>
<#if book_children?has_content>
<#elseif can_edit?? && can_edit && book??>
#i18n{wiki.sidebar.emptyBook.title}
#i18n{wiki.sidebar.emptyBook.message}
#if>