<?php if ($settings['debug'] === 'yes') { ?>
    <pre>
</pre>
<?php } else { ?>
    <div class="webien-toc-widget-menu" id="webien-toc-widget-<?= $unique ?>" data-unique="<?= $unique ?>">
        <div class="inner" :class="{ready:appReady}">
            <div class="menu-item" v-for="item in settings.menu" :key="item.id">
                <div class="inner">
                    <a :href="item.link" :class="item.active" v-html="item.title"></a>

                    <button class="toggle-childs" v-if="item.child" @click="toggleChild(item)" :class="{open:item.open}">
                        <?php if(!empty($settings['menu_toggle_icon']['value'])){
                            \Elementor\Icons_Manager::render_icon($settings['menu_toggle_icon'], ['aria-hidden' => 'true']);
                        } else {
                            echo file_get_contents(WEBIEN_PLUGIN_PATH . '/src/Elementor/Widgets/TOC/images/chevron.svg');
                        } ?>


                    </button>
                </div>

                <div class="sub-menu" v-if="item.child" :class="{open:item.open}" v-show="item.open">
                    <a v-for="child in item.childs" :key="child.id" :href="child.link" :class="child.active"
                       v-html="child.title"></a>
                </div>

            </div>



            <div class="external-menu" v-if="settings.hasExternalMenu">
                <div class="menu-item" v-for="item in settings.externalMenu" :key="item.id">
                    <div class="inner">
                        <a :href="item.link" :class="item.active" v-html="item.title"></a>

                        <button class="toggle-childs" v-if="item.child" @click="toggleChild(item)" :class="{open:item.open}">
                            <?php if(!empty($settings['menu_toggle_icon']['value'])){
                                \Elementor\Icons_Manager::render_icon($settings['menu_toggle_icon'], ['aria-hidden' => 'true']);
                            } else {
                                echo file_get_contents(WEBIEN_PLUGIN_PATH . '/src/Elementor/Widgets/TOC/images/chevron.svg');
                            } ?>
                        </button>
                    </div>

                    <div class="sub-menu" v-if="item.child" :class="{open:item.open}" v-show="item.open">
                        <a v-for="child in item.childs" :key="child.id" :href="child.link" :class="item.active"
                           v-html="item.title"></a>
                    </div>
                </div>
            </div>



        </div>
    </div>

<?php } ?>

<?php if(is_admin()){ ?>
<script><?= $script ?></script>
<script src="<?= WEBIEN_PLUGIN_URL . 'dist/widget-toc.js' ?>"></script>
<?php } ?>

