
    // Base URL of your Laravel app (points to /public automatically)
   

    function loadStylesheet(href) {
        let link = document.createElement("link");
        link.setAttribute("href", href);
        link.setAttribute("rel", "stylesheet");
        link.setAttribute("type", "text/css");
        document.head.appendChild(link);
    }

    function loadJS(src, async = true) {
        let script = document.createElement("script");
        script.setAttribute("src", src);
        script.setAttribute("type", "text/javascript");
        script.async = async;
        document.head.appendChild(script);
    }

    // Core CSS
    loadStylesheet(window.base_url + "/assets/css/perfect-scrollbar.css");

    // Core JS
    loadJS(window.base_url + "/assets/admin/js/perfect-scrollbar.js");

    // Conditional assets
    if (document.querySelector("[slider]")) {
        loadJS(window.base_url + "/assets/admin/js/carousel.js");
    }

    if (document.querySelector("canvas")) {
        loadJS(window.base_url + "/assets/admin/js/charts.js", false);
    }

    if (document.querySelector("[data-toggle='widget-calendar']") || document.querySelector("[data-toggle='calendar']")) {
        loadStylesheet(window.base_url + "/assets/css/full-calendar.css");
        loadJS(window.base_url + "/assets/admin/js/full-calendar.js", false);
    }

    if (document.querySelector("[data-target='tooltip_trigger']")) {
        loadJS(window.base_url + "/assets/admin/js/tooltips.js");
        loadStylesheet(window.base_url + "/assets/css/tooltips.css");
    }

    if (document.querySelector("#sliderRegular")) {
        loadStylesheet(window.base_url + "/assets/css/noui-slider.css");
        loadJS(window.base_url + "/assets/admin/js/slider.js");
    }

    if (document.querySelector("[choice]")) {
        loadStylesheet(window.base_url + "/assets/css/choices.css");
        loadJS(window.base_url + "/assets/admin/js/choices.js");
    }

    if (document.querySelector("#mapid.leaflet")) {
        loadStylesheet(window.base_url + "/assets/css/leaflet.css");
        loadJS(window.base_url + "/assets/admin/js/map.js");
    }

    if (document.querySelector("[countTo]")) {
        loadJS(window.base_url + "/assets/admin/js/count-to.js");
    }

    if (document.querySelector("[nav-pills]")) {
        if (document.querySelector("[nav-pills][aria-controls='camera-gallery']")) {
            loadJS(window.base_url + "/assets/admin/js/pills-gallery.js");
        }
        if (document.querySelector("[nav-pills][aria-controls='pricing-plans']")) {
            loadJS(window.base_url + "/assets/admin/js/pills-pricing.js");
        }
        loadJS(window.base_url + "/assets/admin/js/nav-pills.js");
    }

    if (document.querySelector("[fixed-plugin]")) {
        loadJS(window.base_url + "/assets/admin/js/fixed-plugin.js");
    }

    if (document.querySelector("aside")) {
        loadJS(window.base_url + "/assets/admin/js/sidenav.js");
        if (window.location.pathname.indexOf("landing.html") === -1) {
            loadJS(window.base_url + "/assets/admin/js/sidenav-burger.js");
        }
    }

    if (document.querySelector("[dropdown-trigger]")) {
        loadJS(window.base_url + "/assets/admin/js/dropdown.js");
    }

    if (document.querySelector("[navbar-main]")) {
        loadJS(window.base_url + "/assets/admin/js/navbar-sticky.js");
    }

    if (document.querySelector(".github-button")) {
        loadJS("https://buttons.github.io/buttons.js");
    }

    if (document.querySelector("[multisteps-form]")) {
        loadJS(window.base_url + "/assets/admin/js/multisteps-form.js");
    }

    if (document.querySelector("[profile-visibility-toggle]")) {
        loadJS(window.base_url + "/assets/admin/js/toggle.js");
    }

    if (document.querySelector("[editor-quill]")) {
        loadStylesheet(window.base_url + "/assets/css/editor-quill.css");
        loadJS(window.base_url + "/assets/admin/js/editor-quill.js");
    }

    if (document.querySelector("[datetimepicker]")) {
        loadStylesheet(window.base_url + "/assets/css/flatpickr.css");
        loadJS(window.base_url + "/assets/admin/js/flatpickr.js");
    }

    if (document.querySelector("[dropzone]")) {
        loadStylesheet(window.base_url + "/assets/css/dropzone.css");
        loadJS(window.base_url + "/assets/admin/js/dropzone.js");
    }

    if (document.querySelector("[notification]")) {
        loadJS(window.base_url + "/assets/admin/js/notify.js");
    }

    if (document.querySelector("[alert]")) {
        loadJS(window.base_url + "/assets/admin/js/alert.js");
    }

    if (document.querySelector("[toast]")) {
        loadJS(window.base_url + "/assets/admin/js/toast.js");
    }

    if (document.querySelector("[accordion]")) {
        loadJS(window.base_url + "/assets/admin/js/accordion.js");
    }

    if (document.querySelector("[nav-nested-menu]")) {
        loadJS(window.base_url + "/assets/admin/js/navbar-dropdown.js");
    }

    if (document.querySelector("[nav-collapse-trigger]")) {
        loadJS(window.base_url + "/assets/admin/js/navbar-collapse.js");
    }

    if (document.querySelector("#myKanban")) {
        loadJS(window.base_url + "/assets/admin/js/kanban.js");
        loadStylesheet(window.base_url + "/assets/css/kanban.css");
    }

    if (document.querySelector("[checkbox-color-label]")) {
        loadJS(window.base_url + "/assets/admin/js/label-color.js");
    }

    if (document.querySelector("[data-toggle='modal']")) {
        loadJS(window.base_url + "/assets/admin/js/modal.js");
    }

    if (document.querySelector("[datatable]")) {
        loadStylesheet(window.base_url + "/assets/css/datatable.css");
        loadJS(window.base_url + "/assets/admin/js/datatable.js");
    }

    if (document.querySelector("[onclick^='soft.showSwal']")) {
        loadJS(window.base_url + "/assets/admin/js/sweet-alerts.js");
        loadStylesheet(window.base_url + "/assets/css/sweet-alerts.css");
    }

    if (document.querySelector("[photo-swipe-gallery]")) {
        loadJS(window.base_url + "/assets/admin/js/photo-swipe.js");
        loadStylesheet(window.base_url + "/assets/css/photo-swipe.css");
    }

