function gd_get_js_library_contents () {
    ob_start();

    foreach ( \GD\Js\Registry::getInstance()->getFiles() as $file ) {
        echo "\n".file_get_contents($file).";\n";
    }

    echo 'GD.options.host = "'.GOVDASH_HOST.'";';

    return ob_get_clean();
}
function gd_js_ext () {
    ob_start();
    header('Content-Type: text/javascript; charset=UTF-8');

    echo '(function(global){ '."\n\n";

    foreach ( \GD\Js\Registry::getInstance()->getVendorFiles() as $file ) {
        echo file_get_contents($file)."\n\n";
    }

    foreach ( \GD\Js\Registry::getInstance()->getFiles() as $file ) {
        echo file_get_contents($file)."\n\n";
    }

    echo 'GD.options.host = "'.GOVDASH_HOST.'";'."\n\n";
    echo 'GD.options.themeList = ["table.css", "filter.css", "highcharts.css", "reportMenu.css", "report.css"];'."\n\n";
    echo 'GD.options.themePath = "' . path_to_theme() . '/css/viewer/";'."\n\n";
    echo 'GD.options.csrf = "' . drupal_get_token('services') . '";'."\n";

    echo "\n\n";
    echo file_get_contents(dirname(__FILE__) . '/js/apps/Ext.js')."\n\n";

    echo 'global.GD_Highcharts = Highcharts;'."\n";
    echo 'global.GD_jQuery = jQuery;'."\n";

    echo "\n";
    echo '})(typeof window === "undefined" ? this : window);'."\n";


    gd_get_session_messages();

    echo ob_get_clean();
    drupal_exit();
}