<?php
function bongdako_shortcode_tylekeo_analysis()
{
    $assets = plugin_dir_url(__FILE__) . '/';
    $assets_root = trailingslashit(dirname(dirname(dirname(plugin_dir_url(__FILE__))))) . 'assets/';
    ob_start();

    ?>
    <?php
    static $sport_plugin_dt_existed = false;
    if (!$sport_plugin_dt_existed) {
        ?>
        <meta name="robots" content="nofollow, noindex"/>
        <link href="<?= $assets_root ?>site/assets/bongdawap/css/filter.css?v=<?= ASSETS_VERSION ?>" rel="stylesheet">
        <link href="<?= $assets_root ?>site/assets/bongdawap/css/pages/home/home.css?v=<?= ASSETS_VERSION ?>"
              rel="stylesheet">
        <link href="<?= $assets_root ?>site/assets/bongdawap/css/pages/home/match_detail.css?v=<?= ASSETS_VERSION ?>"
              rel="stylesheet">

        <?php
        bongdako_banner_assets();
        bongdako_layout_assets();
        add_action('wp_footer', function () {
            bongdako_assets_js();
            ?>
            <script type="module" src="<?= BONGDAKO_BUILD ?>analysis_iframe/assets/js/index.js?v=<?= ASSETS_VERSION ?>"
                    defer></script>
            <script src="<?= BONGDAKO_PLUGIN_DIR_URL ?>/layouts/shortcode/rate_analysis/common.js?v=<?= ASSETS_VERSION ?>"
                    defer></script>
            <?php
        });

        $sport_plugin_dt_existed = true;
    }
    ?>
    <link href="<?= $assets ?>style.css?v=<?= ASSETS_VERSION ?>" rel="stylesheet">

    <style>
        #scrollIframe .team-flag img {
            border: none;
            width: auto;
        }

        #scrollIframe .team {
            line-height: 45px;
        }

        #scrollIframe .header .cell {
            background-color: #0F458A;
        }

        #scrollIframe #appHome.match-detail {
            background-color: #ffffff00 !important;
        }

        #scrollIframe .row::after {
            display: none !important;
        }

        #scrollIframe .btn-sub-filter.isActive {
            background-color: #0F458A;
            border-color: #0F458A;
            color: white;
        }
    </style>
    <div id="scrollIframe" class="wrap-iframe analysis_iframe wrap-iframe-analysis tm_12-scrollIframe">
        <div id="soccer" class="tm_12-soccer">
            <div id="homepage" class="mcontent tm_12-homepage">
                <div id="main" class="main-home-page-mobile tm_12-main">
                    <div id="appHome" class="w-100 mx-auto match-detail tm_12-appHome">
                        <div id="analysis_iframe"
                             class="game-rate index idx-homepage css-home-page home-page-mobile tm_12-analysisIframe"></div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <?php
    $content = ob_get_contents();
    ob_end_clean();
    return $content;
}

add_shortcode('bongdako_analysis', 'bongdako_shortcode_tylekeo_analysis');