@php
    $menuCollapsed = ($configData['menuCollapsed'] === 'layout-menu-collapsed') ? json_encode(true) : false;
@endphp

<!-- Laravel Helper Functions -->
@vite('vendor/koneko/laravel-vuexy-admin/resources/assets/vendor/js/helpers.js')

@if ($configData['hasCustomizer'])
    <!--! Template customizer & Theme config files -->
    @vite('vendor/koneko/laravel-vuexy-admin/resources/assets/vendor/js/template-customizer.js')
@endif

<!-- Config File -->
@vite('vendor/koneko/laravel-vuexy-admin/resources/assets/js/layout/config.js')

@if ($configData['hasCustomizer'])
    <script type="module">
        window.templateCustomizer = new TemplateCustomizer({
            cssPath: '',
            themesPath: '',
            defaultStyle: "{{ $configData['styleOpt'] }}",
            defaultShowDropdownOnHover: "{{ $configData['showDropdownOnHover'] }}", // true/false (for horizontal layout only)
            displayCustomizer: "{{ $configData['displayCustomizer'] }}",
            lang: '{{ app()->getLocale() }}',
            pathResolver: function(path) {
                var resolvedPaths = {
                    // Core stylesheets
                    @foreach (['core'] as $name)
                        '{{ $name }}.scss': '{{ Vite::asset('vendor/koneko/laravel-vuexy-admin/resources/assets/vendor/scss'.$configData["rtlSupport"].'/'.$name.'.scss') }}',
                        '{{ $name }}-dark.scss': '{{ Vite::asset('vendor/koneko/laravel-vuexy-admin/resources/assets/vendor/scss'.$configData["rtlSupport"].'/'.$name.'-dark.scss') }}',
                    @endforeach

                    // Themes
                    @foreach (['default', 'bordered', 'semi-dark'] as $name)
                        'theme-{{ $name }}.scss': '{{ Vite::asset('vendor/koneko/laravel-vuexy-admin/resources/assets/vendor/scss'.$configData["rtlSupport"].'/theme-'.$name.'.scss') }}',
                        'theme-{{ $name }}-dark.scss': '{{ Vite::asset('vendor/koneko/laravel-vuexy-admin/resources/assets/vendor/scss'.$configData["rtlSupport"].'/theme-'.$name.'-dark.scss') }}',
                    @endforeach
                };

                return resolvedPaths[path] || path;
            },
            'controls': <?php echo json_encode($configData['customizerControls']); ?>,
        });
    </script>
@endif
