<commit_before>// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.

import {
  JupyterLab, JupyterLabPlugin, ILayoutRestorer, LayoutRestorer
} from '@jupyterlab/application';

import {
  Dialog, ICommandPalette, showDialog
} from '@jupyterlab/apputils';

import {
  IStateDB, PageConfig
} from '@jupyterlab/coreutils';

import {
  h
} from '@phosphor/virtualdom';

/**
 * The command IDs used by the application plugin.
 */
namespace CommandIDs {
  export
  const activateNextTab: string = 'application:activate-next-tab';

  export
  const activatePreviousTab: string = 'application:activate-previous-tab';

  export
  const closeAll: string = 'application:close-all';

  export
  const setMode: string = 'application:set-mode';

  export
  const toggleMode: string = 'application:toggle-mode';
};


/**
 * The main extension.
 */
const mainPlugin: JupyterLabPlugin<void> = {
  id: 'jupyter.extensions.main',
  requires: [ICommandPalette],
  activate: (app: JupyterLab, palette: ICommandPalette) => {
    addCommands(app, palette);

    let unloadPrompt = true;

    // Temporary build message for manual rebuild.
    let buildMessage = PageConfig.getOption('buildRequired');
    if (buildMessage) {
      let body = h.div(
        h.p(
          'JupyterLab build is suggested:',
          h.br(),
          h.pre(buildMessage)
        )
      );
      showDialog({
        title: 'Build Recommended',
        body,
        buttons: [Dialog.cancelButton(), Dialog.okButton({ label: 'BUILD' })]
      }).then(result => {
        if (result.button.accept) {
          app.serviceManager.builder.build().then(() => {
            return showDialog({
              title: 'Build Complete',
              body: 'Build successfully completed, reload page?'
            });
          }).then(result => {
            if (result.button.accept) {
              unloadPrompt = false;
              location.reload();
            }
          }).catch(err => {
            showDialog({
              title: 'Build Failed',<commit_msg>Add a warning for page reload prompt<commit_after>// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.

import {
  JupyterLab, JupyterLabPlugin, ILayoutRestorer, LayoutRestorer
} from '@jupyterlab/application';

import {
  Dialog, ICommandPalette, showDialog
} from '@jupyterlab/apputils';

import {
  IStateDB, PageConfig
} from '@jupyterlab/coreutils';

import {
  h
} from '@phosphor/virtualdom';

/**
 * The command IDs used by the application plugin.
 */
namespace CommandIDs {
  export
  const activateNextTab: string = 'application:activate-next-tab';

  export
  const activatePreviousTab: string = 'application:activate-previous-tab';

  export
  const closeAll: string = 'application:close-all';

  export
  const setMode: string = 'application:set-mode';

  export
  const toggleMode: string = 'application:toggle-mode';
};


/**
 * The main extension.
 */
const mainPlugin: JupyterLabPlugin<void> = {
  id: 'jupyter.extensions.main',
  requires: [ICommandPalette],
  activate: (app: JupyterLab, palette: ICommandPalette) => {
    addCommands(app, palette);

    let unloadPrompt = true;

    // Temporary build message for manual rebuild.
    let buildMessage = PageConfig.getOption('buildRequired');
    if (buildMessage) {
      let body = h.div(
        h.p(
          'JupyterLab build is suggested:',
          h.br(),
          h.pre(buildMessage)
        )
      );
      showDialog({
        title: 'Build Recommended',
        body,
        buttons: [Dialog.cancelButton(), Dialog.okButton({ label: 'BUILD' })]
      }).then(result => {
        if (result.button.accept) {
          app.serviceManager.builder.build().then(() => {
            return showDialog({
              title: 'Build Complete',
              body: 'Build successfully completed, reload page?',
              buttons: [Dialog.cancelButton(),
                        Dialog.warnButton({ label: 'RELOAD' })]
            });
          }).then(result => {
            if (result.button.accept) {
              unloadPrompt = false;
              location.reload();
            }
          }).catch(err => {
            showDialog({
              title: 'Build Failed',
{'fraction_non_alphanumeric': 0.12193412754029433, 'fraction_numerical': 0.0, 'mean_word_length': 2.5594347464671654, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4729141', 'n_tokens_mistral': 1273, 'n_tokens_neox': 1228, 'n_words': 308}