<commit_before>module.exports = function (grunt) {
  var child_process = require('child_process');

  var servername = child_process.exec("python -c 'from __future__ import print_function;from  apps.settings import NB_SERVERNAME;print(NB_SERVERNAME, end=\"\")'");
  var serverport = child_process.exec("python -c 'from __future__ import print_function;from  apps.settings import NB_HTTP_PORT;print(NB_HTTP_PORT, end=\"\")'");
  if (serverport !== '80') {
    servername += ':' + serverport;
  }

  var addPrefix = function (prefix, names) {
    /*
     * given a prefix and an array, returns a new array where each element
     * is prefixed by the prefix
     */
    var output = [];
    for (var i in names) {
      output.push(prefix + names[i]);
    }

    return output;
  };

  var unique = function (names) {
    /*
     * returns a new array with the subsequent occurences of a string removed.
     * for instance unique(["a", "b", "c", "a", "d", "a"]) returns ["a", "b", "c", "d"]
     */
    var index = {};
    var output = [];
    for (var i in names) {
      if (!(names[i] in index)) {
        index[names[i]] = null;
        output.push(names[i]);
      }
    }

    return output;
  };

  var LIB_DIR = 'content/lib/';
  var MODULE_DIR = 'content/modules/';
  var VIEWS_DIR = 'content/views/';
  var UI_DIR = 'content/ui/admin/';
  var DEST_DIR = 'content/compiled/';

  /* MODS are modules that serve as building blocks, without being built themselves */
  var MODS = {};
  MODS.CONTEXTMENU = {
    src_css: addPrefix(LIB_DIR, ['contextmenu/jquery.contextMenu.css']),
  };
  MODS.FILTERWIZARD = {
    src_css: addPrefix(VIEWS_DIR, ['ui.filterwizard.css']),
  };
  MODS.FILTERWIZARDEMOTICON = {
    src_js: addPrefix(VIEWS_DIR, ["ui.filterwizardEmoticon.js" ]),
    src_css: addPrefix(VIEWS_DIR, ["ui.filterwizardEmoticon.css" ])
  };
  MODS.DUPLICATEWIZARD = {
    src_css: addPrefix(VIEWS_DIR, ['ui.duplicatewizard.css', 'ui.threadselect.css']),
  };
  MODS.JQUI = {
    src_css: addPrefix(LIB_DIR, ['jquery-ui/1.12.1/jquery-ui.css',
				   'jquery-ui/1.12.1/jquery-ui.theme.css',
				   'jquery-ui/1.12.1/jquery-ui.structure.css'])
  };
  MODS.TREEVIEW = {
    src_css: [].concat(addPrefix(LIB_DIR, ['jstree/themes/default/style.css']),
                       addPrefix(VIEWS_DIR, ['ui.treeview.css'])),
  };
  MODS.FILESVIEW = {
    src_css: [].concat(
      MODS.CONTEXTMENU.src_css,
      addPrefix(LIB_DIR, ['tablesorter/style.css', 'calendrical/calendrical.css']),
      addPrefix(VIEWS_DIR, ['ui.filesview.css'])),
  };
  MODS.DOCVIEW = {
    src_css: [].concat(
      addPrefix(MODULE_DIR, ['ui.drawable.css']),
      addPrefix(VIEWS_DIR, ['ui.docView.css'])),
  };
  MODS.DOCVIEW_COLLAGE = {
     src_css: [].concat(
      addPrefix(MODULE_DIR, ['ui.drawable.css']),
      addPrefix(VIEWS_DIR, ['ui.docView.css'])),
  };
  MODS.DOCVIEW_SPREADSHEET = {
    src_css: [].concat(
      addPrefix(MODULE_DIR, ['ui.drawable.css']),
    addPrefix(VIEWS_DIR, ['ui.docView.css'])),
  };
  MODS.DOCVIEW_YOUTUBE = {
    src_css: [].concat(
      addPrefix(MODULE_DIR, ['ui.drawable.css']),
      addPrefix(VIEWS_DIR, ['ui.docView.css'])),
  };

  MODS.NOTEPANEVIEW_DOC = {
    src_css: [].concat(
      MODS.CONTEXTMENU.src_css,
      MODS.FILTERWIZARD.src_css,
      MODS.FILTERWIZARDEMOTICON.src_css,
      addPrefix(VIEWS_DIR, ['ui.notepaneView.css'])),
  };

  MODS.NOTEPANEVIEW_COLLAGE = {
    src_css: [].concat(
      MODS.CONTEXTMENU.src_css,
      addPrefix(VIEWS_DIR, ['ui.notepaneView.css'])),
  };

  MODS.NOTEPANEVIEW_SPREADSHEET = {
    src_css: [].concat(
      MODS.CONTEXTMENU.src_css,
      addPrefix(VIEWS_DIR, ['ui.notepaneView.css'])),
  };
  MODS.NOTEPANEVIEW_YOUTUBE = {
    src_css: [].concat(
      MODS.CONTEXTMENU.src_css,
      addPrefix(VIEWS_DIR, ['ui.notepaneView.css'])),
  };

  MODS.THREADVIEW = {
    src_js: [].concat(
      MODS.CONTEXTMENU.src_js,
      addPrefix(LIB_DIR, ['dateformat/date.format.js']),
      addPrefix(VIEWS_DIR, ['ui.threadview.js'])),
    src_css: [].concat(
      MODS.CONTEXTMENU.src_css,
      addPrefix(VIEWS_DIR, ['ui.threadview.css'])),
  };

  MODS.EDITORVIEW = {
    src_css: addPrefix(VIEWS_DIR, ['ui.editorview.css']),
  };

  MODS.SPREADSHEETVIEW = {
    src_css: addPrefix(VIEWS_DIR, ['ui.spreadsheetView1.css']),
  };

  MODS.BREADCRUMB = {
    src_css: addPrefix(VIEWS_DIR, ['ui.breadcrumb.css'])
  };

  /* TARGETS are modules that are built (but they can also serve as building blocks) */
  var TARGETS = {};
  TARGETS.API =  {
    include: ['auth',  'dom', 'mvc', 'models'],
    src_js: [],
    dest_js: DEST_DIR + 'apidev_NB.js',
  };

  TARGETS.EMBED = {
    include: ['buildEmbed'],
    src_js: [].concat(['build_embed']),
    dest_js: DEST_DIR + 'embed_NB.js',
    src_css: [].concat(
      MODS.JQUI.src_css,
      addPrefix(MODULE_DIR, ['ui.perspective.css', 'ui.viewport.css', 'ui.menu.css']),
      addPrefix(MODULE_DIR, ['ui.view.css', 'buildEmbed.css']),
      'content/ui/classic/base.css',
      addPrefix(UI_DIR, ['template.css']),
      MODS.NOTEPANEVIEW_DOC.src_css,
      MODS.THREADVIEW.src_css,
      MODS.EDITORVIEW.src_css),
    dest_css: DEST_DIR + 'embed_NB.css',
    servername: servername,
  };

  TARGETS.NEWSITE = {
    include: ['init_newsite', 'launch'],
    src_js: [].concat(['build_newsite']),
    src_css: [].concat(
      MODS.JQUI.src_css,
      addPrefix(MODULE_DIR, ['ui.perspective.css', 'ui.viewport.css', 'ui.menu.css', 'ui.view.css']),
      'content/ui/classic/base.css',
      addPrefix(UI_DIR, ['template.css']),
      MODS.FILTERWIZARD.src_css,
      MODS.FILTERWIZARDEMOTICON.src_css,
      MODS.DUPLICATEWIZARD.src_css,
      MODS.TREEVIEW.src_css,
      MODS.FILESVIEW.src_css,
      MODS.BREADCRUMB.src_css
    ),
    dest_js: DEST_DIR + 'newsite_NB.js',
    dest_css: DEST_DIR + 'newsite.css',
  };

  TARGETS.DESKTOP = {
      // MODS.BREADCRUMB.src_js
    include: ['init_desktop', 'launch'],
    src_js: [].concat(['build_desktop']),
    src_css: [].concat(
      MODS.JQUI.src_css,
      addPrefix(MODULE_DIR, ['ui.perspective.css', 'ui.viewport.css', 'ui.menu.css', 'ui.view.css']),
      'content/ui/classic/base.css',
      addPrefix(UI_DIR, ['template.css']),
      MODS.FILTERWIZARD.src_css,
      MODS.FILTERWIZARDEMOTICON.src_css,
      MODS.DUPLICATEWIZARD.src_css,
      MODS.TREEVIEW.src_css,
      MODS.FILESVIEW.src_css,
      MODS.BREADCRUMB.src_css
    ),
    dest_js: DEST_DIR + 'desktop_NB.js',
    dest_css: DEST_DIR + 'desktop.css',
  };

  TARGETS.PROPERTIES_ENSEMBLE_USERS = {
      // MODS.BREADCRUMB.src_js
    include: ['init_properties_ensemble_users', 'launch'],
    src_js: [].concat(['build_properties_ensemble_users']),
    src_css: [].concat(
      MODS.JQUI.src_css,
      addPrefix(MODULE_DIR, ['ui.perspective.css', 'ui.viewport.css', 'ui.menu.css', 'ui.view.css']),
      addPrefix(UI_DIR, ['template.css']),
      'content/ui/classic/base.css',
      MODS.FILTERWIZARD.src_css,
      MODS.FILTERWIZARDEMOTICON.src_css,
      MODS.DUPLICATEWIZARD.src_css,
      MODS.TREEVIEW.src_css,
      MODS.FILESVIEW.src_css,
      MODS.BREADCRUMB.src_css
    ),
    dest_js: DEST_DIR + 'properties_ensemble_users_NB.js',
    dest_css: DEST_DIR + 'properties_ensemble_users.css',
  };

  TARGETS.PROPERTIES_ENSEMBLE = {
    include: ['init_properties_ensemble', 'launch'],
    src_js: [].concat(['build_properties_ensemble']),
    src_css: [].concat(
      MODS.JQUI.src_css,
      addPrefix(MODULE_DIR, ['ui.perspective.css', 'ui.viewport.css', 'ui.menu.css', 'ui.view.css']),
      addPrefix(UI_DIR, ['template.css']),
      'content/ui/classic/base.css',
      MODS.FILTERWIZARD.src_css,
      MODS.FILTERWIZARDEMOTICON.src_css,
      MODS.DUPLICATEWIZARD.src_css,
      MODS.TREEVIEW.src_css,
      MODS.FILESVIEW.src_css,
      MODS.BREADCRUMB.src_css
    ),
    dest_js: DEST_DIR + 'properties_ensemble_NB.js',
    dest_css: DEST_DIR + 'properties_ensemble.css',
  };

  TARGETS.PROPERTIES_ENSEMBLE_SECTIONS = {
    include: ['init_properties_ensemble_sections', 'launch'],
    src_js: [].concat(['build_properties_ensemble_sections']),
    src_css: [].concat(
      addPrefix(LIB_DIR, ['jquery-ui-1.12.1/jquery-ui.theme.css',
      'DataTables-1.10.12/media/css/jquery.dataTables.css']),
      addPrefix(MODULE_DIR, ['ui.perspective.css', 'ui.viewport.css', 'ui.menu.css', 'ui.view.css']),
      addPrefix(UI_DIR, ['template.css']),
      'content/ui/classic/base.css',
      MODS.FILTERWIZARD.src_css,
      MODS.FILTERWIZARDEMOTICON.src_css,
      MODS.DUPLICATEWIZARD.src_css,
      MODS.TREEVIEW.src_css,
      MODS.FILESVIEW.src_css,
      MODS.BREADCRUMB.src_css
    ),
    dest_js: DEST_DIR + 'properties_ensemble_sections_NB.js',
    dest_css: DEST_DIR + 'properties_ensemble_sections.css',
  };

  TARGETS.SUBSCRIBE = {
    include: ['init_subscribe', 'launch'],
    src_js: [].concat(['build_subscribe']),
    src_css: [].concat(
      MODS.JQUI.src_css,
      addPrefix(MODULE_DIR, ['ui.perspective.css', 'ui.viewport.css', 'ui.menu.css', 'ui.view.css']),
      addPrefix(UI_DIR, ['template.css']),
      'content/ui/classic/base.css',
      MODS.FILTERWIZARD.src_css,
      MODS.FILTERWIZARDEMOTICON.src_css,
      MODS.DUPLICATEWIZARD.src_css,
      MODS.TREEVIEW.src_css,
      MODS.FILESVIEW.src_css,
      MODS.BREADCRUMB.src_css
    ),
    dest_js: DEST_DIR + 'subscribe_NB.js',
    dest_css: DEST_DIR + 'subscribe.css',
  };

  TARGETS.ADD_NAVBAR = {
    include: ['init_add_navbar', 'launch'],
    src_js: [].concat(['build_add_navbar']),
    src_css: [].concat(
      MODS.JQUI.src_css,
      addPrefix(MODULE_DIR, ['ui.perspective.css', 'ui.viewport.css', 'ui.menu.css', 'ui.view.css']),
      addPrefix(UI_DIR, ['template.css']),
      'content/ui/classic/base.css',
      MODS.FILTERWIZARD.src_css,
      MODS.FILTERWIZARDEMOTICON.src_css,
      MODS.DUPLICATEWIZARD.src_css,
      MODS.TREEVIEW.src_css,
      MODS.FILESVIEW.src_css,
      MODS.BREADCRUMB.src_css
    ),
    dest_js: DEST_DIR + 'add_navbar_NB.js',
    dest_css: DEST_DIR + 'add_navbar.css',
  };

  TARGETS.LOGIN = {
    include: ['login', 'launch'],
    src_js: [].concat(['build_login']),
    src_css: [].concat(
      MODS.JQUI.src_css,
      addPrefix(UI_DIR, ['template.css']),
      'content/ui/classic/base.css'),
    dest_js: DEST_DIR + 'login_NB.js',
    dest_css: DEST_DIR + 'login.css',
  };

  TARGETS.PDFVIEWER = {
    include: ['init_pdfviewer', 'launch'],
    src_js: [].concat(['build_pdfviewer']),
    src_css: [].concat(
      MODS.JQUI.src_css,
      addPrefix(MODULE_DIR, ['ui.perspective.css', 'ui.viewport.css', 'ui.menu.css', 'ui.view.css']),
      addPrefix(UI_DIR, ['template.css']),
      'content/ui/classic/base.css',
      MODS.DOCVIEW.src_css,
      MODS.NOTEPANEVIEW_DOC.src_css,
      MODS.THREADVIEW.src_css,
      MODS.EDITORVIEW.src_css),
    dest_js: DEST_DIR + 'pdfviewer_NB.js',
    dest_css: DEST_DIR + 'pdfviewer.css',
  };

  TARGETS.DOCANALYTICS = {
    include: ['init_analytics', 'launch'],
    src_js: [].concat(['build_analytics']),
    src_css: [].concat(
      MODS.JQUI.src_css,
      addPrefix(MODULE_DIR, ['ui.perspective.css', 'ui.viewport.css', 'ui.menu.css', 'ui.view.css']),
      addPrefix(UI_DIR, ['template.css']),
      addPrefix(VIEWS_DIR, ['ui.docAnalyticsView.css']),
      'content/ui/classic/base.css'),
    dest_js: DEST_DIR + 'docanalytics_NB.js',
    dest_css: DEST_DIR + 'docanalytics.css',
  };

  TARGETS.YOUTUBEVIEWER = {
    include: ['init_youtubeviewer', 'launch'],
    src_js: [].concat(['build_youtubeviewer']),
    src_css: [].concat(
      MODS.JQUI.src_css,
      addPrefix(MODULE_DIR, ['ui.perspective.css', 'ui.viewport.css', 'ui.menu.css', 'ui.view.css']),
      addPrefix(UI_DIR, ['template.css']),
      'content/ui/classic/base.css',
      MODS.DOCVIEW_YOUTUBE.src_css,
      MODS.NOTEPANEVIEW_YOUTUBE.src_css,
      MODS.THREADVIEW.src_css,
      MODS.EDITORVIEW.src_css),
    dest_js: DEST_DIR + 'youtubeviewer_NB.js',
    dest_css: DEST_DIR + 'youtubeviewer.css',
  };

  TARGETS.COLLAGE = {
    include: ['init_collage', 'launch'],
    src_js: [].concat(['build_collage']),
    src_css: [].concat(
      MODS.JQUI.src_css,
      addPrefix(MODULE_DIR, ['ui.perspective.css', 'ui.viewport.css', 'ui.menu.css', 'ui.view.css']),
      addPrefix(UI_DIR, ['template.css']),
      MODS.DOCVIEW_COLLAGE.src_css,
      MODS.NOTEPANEVIEW_COLLAGE.src_css,
      MODS.THREADVIEW.src_css,
      MODS.EDITORVIEW.src_css),
    dest_js: DEST_DIR + 'collage_NB.js',
    dest_css: DEST_DIR + 'collage.css',
  };

  TARGETS.LOGOUT = {
    include: ['logout', 'launch'],
    src_js: [].concat(['build_logout']),
    src_css: [].concat(
      MODS.JQUI.src_css,
      addPrefix(UI_DIR, ['template.css']),
      'content/ui/classic/base.css'),
    dest_js: DEST_DIR + 'logout_NB.js',
    dest_css: DEST_DIR + 'logout.css'
  };

  TARGETS.PASSWORD = {
    include: ['password_reminder', 'launch'],
    src_js: [].concat(['build_passwordreminder']),
    src_css: [].concat(
      MODS.JQUI.src_css,
      addPrefix(UI_DIR, ['template.css']),
      'content/ui/classic/base.css'),
    dest_js: DEST_DIR + 'password_reminder_NB.js',
    dest_css: DEST_DIR + 'password.css'
  };

  TARGETS.SPREADSHEET = {
    include: ['init_spreadsheet', 'launch'],
    src_js: [].concat(['build_spreadsheet']),
    src_css: [].concat(
      MODS.JQUI.src_css,
      addPrefix(MODULE_DIR, ['ui.perspective.css', 'ui.viewport.css', 'ui.menu.css', 'ui.view.css']),
      addPrefix(UI_DIR, ['template.css']),
      'content/ui/classic/base.css',
      MODS.SPREADSHEETVIEW.src_css,
      MODS.NOTEPANEVIEW_SPREADSHEET.src_css,
      MODS.DOCVIEW_SPREADSHEET.src_css,
      MODS.EDITORVIEW.src_css),
    dest_js: DEST_DIR + 'spreadsheet_NB.js',
    dest_css: DEST_DIR + 'spreadsheet.css',
  };

  TARGETS.EMBEDOPENID = {
    include: ['embedopenid'],
    src_js: [].concat(['build_embedopenid']),
    dest_js: DEST_DIR + 'embedopenid_NB.js',
  };

  TARGETS.SETTINGS = {
    include: ['your_settings', 'launch'],
    src_js: [].concat(['build_yoursettings']),
    src_css: [].concat(
      MODS.JQUI.src_css,
      addPrefix(MODULE_DIR, ['ui.perspective.css', 'ui.viewport.css', 'ui.view.css']),
      'content/ui/classic/base.css',
      addPrefix(UI_DIR, ['template.css', 'your_settings.css'])),
    dest_js: DEST_DIR + 'settings_NB.js',
    dest_css: DEST_DIR + 'settings.css',
  };

  TARGETS.ENTER_YOUR_NAME = {
    include: ['init_enteryourname', 'launch'],
    src_js: [].concat(['build_enteryourname']),
    src_css: [].concat(
      MODS.JQUI.src_css,
      addPrefix(MODULE_DIR, ['ui.perspective.css', 'ui.viewport.css', 'ui.view.css']),
      'content/ui/classic/base.css',
      addPrefix(UI_DIR, ['template.css'])),
    dest_js: DEST_DIR + 'enteryourname_NB.js',
    dest_css: DEST_DIR + 'enteryourname.css',
  };

  TARGETS.CONFIRM_INVITE = {
    include: ['init_confirm_invite', 'launch'],
    src_js: [].concat(['build_confirm_invite']),
    src_css: [].concat(
      MODS.JQUI.src_css,
      addPrefix(MODULE_DIR, ['ui.perspective.css', 'ui.viewport.css', 'ui.view.css']),
      'content/ui/classic/base.css',
      addPrefix(UI_DIR, ['template.css'])),
    dest_js: DEST_DIR + 'confirm_invite_NB.js',
    dest_css: DEST_DIR + 'confirm_invite.css',
  };

  var JS_TARGETS = {};
  var i, src;
  for (i in TARGETS) {<commit_msg>clean up Gruntfile<commit_after>module.exports = function (grunt) {
  var child_process = require('child_process');

  var servername = child_process.exec("python -c 'from __future__ import print_function;from  apps.settings import NB_SERVERNAME;print(NB_SERVERNAME, end=\"\")'");
  var serverport = child_process.exec("python -c 'from __future__ import print_function;from  apps.settings import NB_HTTP_PORT;print(NB_HTTP_PORT, end=\"\")'");
  if (serverport !== '80') {
    servername += ':' + serverport;
  }

  var addPrefix = function (prefix, names) {
    /*
     * given a prefix and an array, returns a new array where each element
     * is prefixed by the prefix
     */
    var output = [];
    for (var i in names) {
      output.push(prefix + names[i]);
    }

    return output;
  };

  var unique = function (names) {
    /*
     * returns a new array with the subsequent occurences of a string removed.
     * for instance unique(["a", "b", "c", "a", "d", "a"]) returns ["a", "b", "c", "d"]
     */
    var index = {};
    var output = [];
    for (var i in names) {
      if (!(names[i] in index)) {
        index[names[i]] = null;
        output.push(names[i]);
      }
    }

    return output;
  };

  var LIB_DIR = 'content/lib/';
  var MODULE_DIR = 'content/modules/';
  var VIEWS_DIR = 'content/views/';
  var UI_DIR = 'content/ui/admin/';
  var DEST_DIR = 'content/compiled/';

  /* MODS are modules that serve as building blocks, without being built themselves */
  var MODS = {};
  MODS.CONTEXTMENU = {
    src_css: addPrefix(LIB_DIR, ['contextmenu/jquery.contextMenu.css']),
  };
  MODS.FILTERWIZARD = {
    src_css: addPrefix(VIEWS_DIR, ['ui.filterwizard.css']),
  };
  MODS.FILTERWIZARDEMOTICON = {
    src_js: addPrefix(VIEWS_DIR, ["ui.filterwizardEmoticon.js" ]),
    src_css: addPrefix(VIEWS_DIR, ["ui.filterwizardEmoticon.css" ])
  };
  MODS.DUPLICATEWIZARD = {
    src_css: addPrefix(VIEWS_DIR, ['ui.duplicatewizard.css', 'ui.threadselect.css']),
  };
  MODS.JQUI = {
    src_css: addPrefix(LIB_DIR, ['jquery-ui/1.12.1/jquery-ui.css',
				   'jquery-ui/1.12.1/jquery-ui.theme.css',
				   'jquery-ui/1.12.1/jquery-ui.structure.css'])
  };
  MODS.CORE = {
      src_css: [].concat(
          addPrefix(MODULE_DIR, ['ui.perspective.css', 'ui.viewport.css', 'ui.menu.css','ui.view.css']),
          'content/ui/classic/base.css',
	  addPrefix(UI_DIR, ['template.css'])
      )
  };
  MODS.TREEVIEW = {
    src_css: [].concat(addPrefix(LIB_DIR, ['jstree/themes/default/style.css']),
                       addPrefix(VIEWS_DIR, ['ui.treeview.css'])),
  };
  MODS.FILESVIEW = {
    src_css: [].concat(
      MODS.CONTEXTMENU.src_css,
      addPrefix(LIB_DIR, ['tablesorter/style.css', 'calendrical/calendrical.css']),
      addPrefix(VIEWS_DIR, ['ui.filesview.css'])),
  };
  MODS.DOCVIEW = {
    src_css: [].concat(
      addPrefix(MODULE_DIR, ['ui.drawable.css']),
      addPrefix(VIEWS_DIR, ['ui.docView.css'])),
  };
  MODS.DOCVIEW_COLLAGE = {
     src_css: [].concat(
      addPrefix(MODULE_DIR, ['ui.drawable.css']),
      addPrefix(VIEWS_DIR, ['ui.docView.css'])),
  };
  MODS.DOCVIEW_SPREADSHEET = {
    src_css: [].concat(
      addPrefix(MODULE_DIR, ['ui.drawable.css']),
    addPrefix(VIEWS_DIR, ['ui.docView.css'])),
  };
  MODS.DOCVIEW_YOUTUBE = {
    src_css: [].concat(
      addPrefix(MODULE_DIR, ['ui.drawable.css']),
      addPrefix(VIEWS_DIR, ['ui.docView.css'])),
  };

  MODS.NOTEPANEVIEW_DOC = {
    src_css: [].concat(
      MODS.CONTEXTMENU.src_css,
      MODS.FILTERWIZARD.src_css,
      MODS.FILTERWIZARDEMOTICON.src_css,
      addPrefix(VIEWS_DIR, ['ui.notepaneView.css'])),
  };

  MODS.NOTEPANEVIEW_COLLAGE = {
    src_css: [].concat(
      MODS.CONTEXTMENU.src_css,
      addPrefix(VIEWS_DIR, ['ui.notepaneView.css'])),
  };

  MODS.NOTEPANEVIEW_SPREADSHEET = {
    src_css: [].concat(
      MODS.CONTEXTMENU.src_css,
      addPrefix(VIEWS_DIR, ['ui.notepaneView.css'])),
  };
  MODS.NOTEPANEVIEW_YOUTUBE = {
    src_css: [].concat(
      MODS.CONTEXTMENU.src_css,
      addPrefix(VIEWS_DIR, ['ui.notepaneView.css'])),
  };

  MODS.THREADVIEW = {
    src_js: [].concat(
      MODS.CONTEXTMENU.src_js,
      addPrefix(LIB_DIR, ['dateformat/date.format.js']),
      addPrefix(VIEWS_DIR, ['ui.threadview.js'])),
    src_css: [].concat(
      MODS.CONTEXTMENU.src_css,
      addPrefix(VIEWS_DIR, ['ui.threadview.css'])),
  };

  MODS.EDITORVIEW = {
    src_css: addPrefix(VIEWS_DIR, ['ui.editorview.css']),
  };

  MODS.SPREADSHEETVIEW = {
    src_css: addPrefix(VIEWS_DIR, ['ui.spreadsheetView1.css']),
  };

  MODS.BREADCRUMB = {
    src_css: addPrefix(VIEWS_DIR, ['ui.breadcrumb.css'])
  };

  /* TARGETS are modules that are built (but they can also serve as building blocks) */
  var TARGETS = {};
  TARGETS.API =  {
    include: ['auth',  'dom', 'mvc', 'models'],
    src_js: [],
    dest_js: DEST_DIR + 'apidev_NB.js',
  };

  TARGETS.EMBED = {
    include: ['buildEmbed'],
    src_js: ['build_embed'],
    dest_js: DEST_DIR + 'embed_NB.js',
    src_css: [].concat(
      MODS.JQUI.src_css,
      MODS.CORE.src_css,
      addPrefix(MODULE_DIR, ['buildEmbed.css']),
      MODS.NOTEPANEVIEW_DOC.src_css,
      MODS.THREADVIEW.src_css,
      MODS.EDITORVIEW.src_css),
    dest_css: DEST_DIR + 'embed_NB.css',
    servername: servername,
  };

  TARGETS.NEWSITE = {
    include: ['init_newsite', 'launch'],
    src_js: ['build_newsite'],
    src_css: [].concat(
      MODS.JQUI.src_css,
      MODS.CORE.src_css,
      MODS.FILTERWIZARD.src_css,
      MODS.FILTERWIZARDEMOTICON.src_css,
      MODS.DUPLICATEWIZARD.src_css,
      MODS.TREEVIEW.src_css,
      MODS.FILESVIEW.src_css,
      MODS.BREADCRUMB.src_css
    ),
    dest_js: DEST_DIR + 'newsite_NB.js',
    dest_css: DEST_DIR + 'newsite.css',
  };

  TARGETS.DESKTOP = {
    include: ['init_desktop', 'launch'],
    src_js: ['build_desktop'],
    src_css: [].concat(
      MODS.JQUI.src_css,
      MODS.CORE.src_css,
      MODS.FILTERWIZARD.src_css,
      MODS.FILTERWIZARDEMOTICON.src_css,
      MODS.DUPLICATEWIZARD.src_css,
      MODS.TREEVIEW.src_css,
      MODS.FILESVIEW.src_css,
      MODS.BREADCRUMB.src_css
    ),
    dest_js: DEST_DIR + 'desktop_NB.js',
    dest_css: DEST_DIR + 'desktop.css',
  };

  TARGETS.PROPERTIES_ENSEMBLE_USERS = {
      // MODS.BREADCRUMB.src_js
    include: ['init_properties_ensemble_users', 'launch'],
    src_js: ['build_properties_ensemble_users'],
    src_css: [].concat(
      MODS.JQUI.src_css,
      MODS.CORE.src_css,
      MODS.FILTERWIZARD.src_css,
      MODS.FILTERWIZARDEMOTICON.src_css,
      MODS.DUPLICATEWIZARD.src_css,
      MODS.TREEVIEW.src_css,
      MODS.FILESVIEW.src_css,
      MODS.BREADCRUMB.src_css
    ),
    dest_js: DEST_DIR + 'properties_ensemble_users_NB.js',
    dest_css: DEST_DIR + 'properties_ensemble_users.css',
  };

  TARGETS.PROPERTIES_ENSEMBLE = {
    include: ['init_properties_ensemble', 'launch'],
    src_js: ['build_properties_ensemble'],
    src_css: [].concat(
      MODS.JQUI.src_css,
      MODS.CORE.src_css,
      MODS.FILTERWIZARD.src_css,
      MODS.FILTERWIZARDEMOTICON.src_css,
      MODS.DUPLICATEWIZARD.src_css,
      MODS.TREEVIEW.src_css,
      MODS.FILESVIEW.src_css,
      MODS.BREADCRUMB.src_css
    ),
    dest_js: DEST_DIR + 'properties_ensemble_NB.js',
    dest_css: DEST_DIR + 'properties_ensemble.css',
  };

  TARGETS.PROPERTIES_ENSEMBLE_SECTIONS = {
    include: ['init_properties_ensemble_sections', 'launch'],
    src_js: ['build_properties_ensemble_sections'],
    src_css: [].concat(
      addPrefix(LIB_DIR, ['jquery-ui-1.12.1/jquery-ui.theme.css',
      'DataTables-1.10.12/media/css/jquery.dataTables.css']),
      MODS.FILTERWIZARD.src_css,
      MODS.FILTERWIZARDEMOTICON.src_css,
      MODS.DUPLICATEWIZARD.src_css,
      MODS.TREEVIEW.src_css,
      MODS.FILESVIEW.src_css,
      MODS.BREADCRUMB.src_css
    ),
    dest_js: DEST_DIR + 'properties_ensemble_sections_NB.js',
    dest_css: DEST_DIR + 'properties_ensemble_sections.css',
  };

  TARGETS.SUBSCRIBE = {
    include: ['init_subscribe', 'launch'],
    src_js: ['build_subscribe'],
    src_css: [].concat(
      MODS.JQUI.src_css,
      MODS.CORE.src_css,
      MODS.FILTERWIZARD.src_css,
      MODS.FILTERWIZARDEMOTICON.src_css,
      MODS.DUPLICATEWIZARD.src_css,
      MODS.TREEVIEW.src_css,
      MODS.FILESVIEW.src_css,
      MODS.BREADCRUMB.src_css
    ),
    dest_js: DEST_DIR + 'subscribe_NB.js',
    dest_css: DEST_DIR + 'subscribe.css',
  };

  TARGETS.ADD_NAVBAR = {
    include: ['init_add_navbar', 'launch'],
    src_js: ['build_add_navbar'],
    src_css: [].concat(
      MODS.JQUI.src_css,
      MODS.CORE.src_css,
      MODS.FILTERWIZARD.src_css,
      MODS.FILTERWIZARDEMOTICON.src_css,
      MODS.DUPLICATEWIZARD.src_css,
      MODS.TREEVIEW.src_css,
      MODS.FILESVIEW.src_css,
      MODS.BREADCRUMB.src_css
    ),
    dest_js: DEST_DIR + 'add_navbar_NB.js',
    dest_css: DEST_DIR + 'add_navbar.css',
  };

  TARGETS.LOGIN = {
    include: ['login', 'launch'],
    src_js: ['build_login'],
    src_css: [].concat(
      MODS.JQUI.src_css,
      addPrefix(UI_DIR, ['template.css']),
      'content/ui/classic/base.css'),
    dest_js: DEST_DIR + 'login_NB.js',
    dest_css: DEST_DIR + 'login.css',
  };

  TARGETS.PDFVIEWER = {
    include: ['init_pdfviewer', 'launch'],
    src_js: ['build_pdfviewer'],
    src_css: [].concat(
      MODS.JQUI.src_css,
      MODS.CORE.src_css,
      MODS.DOCVIEW.src_css,
      MODS.NOTEPANEVIEW_DOC.src_css,
      MODS.THREADVIEW.src_css,
      MODS.EDITORVIEW.src_css),
    dest_js: DEST_DIR + 'pdfviewer_NB.js',
    dest_css: DEST_DIR + 'pdfviewer.css',
  };

  TARGETS.DOCANALYTICS = {
    include: ['init_analytics', 'launch'],
    src_js: ['build_analytics'],
    src_css: [].concat(
      MODS.JQUI.src_css,
      MODS.CORE.src_css,
     addPrefix(VIEWS_DIR, ['ui.docAnalyticsView.css'])
    ),
    dest_js: DEST_DIR + 'docanalytics_NB.js',
    dest_css: DEST_DIR + 'docanalytics.css',
  };

  TARGETS.YOUTUBEVIEWER = {
    include: ['init_youtubeviewer', 'launch'],
    src_js: ['build_youtubeviewer'],
    src_css: [].concat(
      MODS.JQUI.src_css,
      MODS.CORE.src_css,
      MODS.DOCVIEW_YOUTUBE.src_css,
      MODS.NOTEPANEVIEW_YOUTUBE.src_css,
      MODS.THREADVIEW.src_css,
      MODS.EDITORVIEW.src_css),
    dest_js: DEST_DIR + 'youtubeviewer_NB.js',
    dest_css: DEST_DIR + 'youtubeviewer.css',
  };

  TARGETS.COLLAGE = {
    include: ['init_collage', 'launch'],
    src_js: ['build_collage'],
    src_css: [].concat(
      MODS.JQUI.src_css,
      MODS.CORE.src_css,
      MODS.DOCVIEW_COLLAGE.src_css,
      MODS.NOTEPANEVIEW_COLLAGE.src_css,
      MODS.THREADVIEW.src_css,
      MODS.EDITORVIEW.src_css),
    dest_js: DEST_DIR + 'collage_NB.js',
    dest_css: DEST_DIR + 'collage.css',
  };

  TARGETS.LOGOUT = {
    include: ['logout', 'launch'],
    src_js: ['build_logout'],
    src_css: [].concat(
      MODS.JQUI.src_css,
      addPrefix(UI_DIR, ['template.css']),
      'content/ui/classic/base.css'),
    dest_js: DEST_DIR + 'logout_NB.js',
    dest_css: DEST_DIR + 'logout.css'
  };

  TARGETS.PASSWORD = {
    include: ['password_reminder', 'launch'],
    src_js: ['build_passwordreminder'],
    src_css: [].concat(
      MODS.JQUI.src_css,
      addPrefix(UI_DIR, ['template.css']),
      'content/ui/classic/base.css'),
    dest_js: DEST_DIR + 'password_reminder_NB.js',
    dest_css: DEST_DIR + 'password.css'
  };

  TARGETS.SPREADSHEET = {
    include: ['init_spreadsheet', 'launch'],
    src_js: ['build_spreadsheet'],
    src_css: [].concat(
      MODS.JQUI.src_css,
      MODS.CORE.src_css,
      MODS.SPREADSHEETVIEW.src_css,
      MODS.NOTEPANEVIEW_SPREADSHEET.src_css,
      MODS.DOCVIEW_SPREADSHEET.src_css,
      MODS.EDITORVIEW.src_css),
    dest_js: DEST_DIR + 'spreadsheet_NB.js',
    dest_css: DEST_DIR + 'spreadsheet.css',
  };

  TARGETS.EMBEDOPENID = {
    include: ['embedopenid'],
    src_js: ['build_embedopenid'],
    dest_js: DEST_DIR + 'embedopenid_NB.js',
  };

  TARGETS.SETTINGS = {
    include: ['your_settings', 'launch'],
    src_js: ['build_yoursettings'],
    src_css: [].concat(
      MODS.JQUI.src_css,
      MODS.CORE.src_css,
      addPrefix(UI_DIR, ['your_settings.css'])
    ),
    dest_js: DEST_DIR + 'settings_NB.js',
    dest_css: DEST_DIR + 'settings.css',
  };

  TARGETS.ENTER_YOUR_NAME = {
    include: ['init_enteryourname', 'launch'],
    src_js: ['build_enteryourname'],
    src_css: [].concat(
      MODS.JQUI.src_css,
      MODS.CORE.src_css
    ),
    dest_js: DEST_DIR + 'enteryourname_NB.js',
    dest_css: DEST_DIR + 'enteryourname.css',
  };

  TARGETS.CONFIRM_INVITE = {
    include: ['init_confirm_invite', 'launch'],
    src_js: ['build_confirm_invite'],
    src_css: [].concat(
      MODS.JQUI.src_css,
      MODS.CORE.src_css
    ),
    dest_js: DEST_DIR + 'confirm_invite_NB.js',
    dest_css: DEST_DIR + 'confirm_invite.css',
  };

  var JS_TARGETS = {};
  var i, src;
  for (i in TARGETS) {
{'fraction_non_alphanumeric': 0.16216502863607438, 'fraction_numerical': 0.0016969525560347875, 'mean_word_length': 3.1832298136645965, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5232623', 'n_tokens_mistral': 11656, 'n_tokens_neox': 11348, 'n_words': 1497}