<commit_before>﻿window.cls || (window.cls = {});
cls.EcmascriptDebugger || (cls.EcmascriptDebugger = {});
cls.EcmascriptDebugger["5.0"] || (cls.EcmascriptDebugger["5.0"] = {});
cls.EcmascriptDebugger["6.0"] || (cls.EcmascriptDebugger["6.0"] = {});

/**
  * @constructor
  * @extends InspectableDOMNode
  */

cls.EcmascriptDebugger["6.0"].DOMData =
cls.EcmascriptDebugger["5.0"].DOMData = function(view_id)
{

  /* interface */

  /**
    * To get an initial DOM of the given runtime.
    * Selects either the body or the root element in that order, if no optional
    * obj id is given.
    * Displays a travesal 'parent-node-chain-with-children' for the selected node.
    * @param {Number} rt_id. The runtime id of the given runtime.
    * @param {Number} obj_id. The optional node to be inspected.
    */
  this.get_dom = function(rt_id, obj_id, do_highlight, scroll_ito_view){};

  /**
    * To get a fully expanded DOM of the current selected runtime (document).
    */
  this.get_snapshot = function(){};

  /**
    * To bind the instantiated object to the service interface.
    */
  this.bind = function(ecma_debugger){};

  /* constants */

  const
  ID = 0,
  TYPE = 1,
  DEPTH = 3,
  CHILDREN_LENGTH = 6;

  const NOT_CHECKED = 0;
  const CHECKED = 1;
  const CHECK_AGAIN_RUNTIME = 2;
  const CHECK_AGAIN_NO_RUNTIME = 3;

  /* private */

  this._view_id = view_id;
  this._settings_id = view_id;
  this._current_target = 0;
  // to select a runtime if none is selected
  this._active_window = [];
  this._element_selected_state = NOT_CHECKED;
  // spotlight on hover on the host side
  this._reset_spotlight_timeouts = new Timeouts();
  this._is_waiting = false;
  this._editor_active = false;

  this._spotlight = function(event)
  {
    this._reset_spotlight_timeouts.clear();
    if (window.settings.dom.get('highlight-on-hover'))
      hostspotlighter.soft_spotlight(event.object_id);
  }

  this._reset_spotlight = function()
  {
    if (this._current_target)
    {
      if (window.settings.dom.get('highlight-on-hover'))
        hostspotlighter.spotlight(this._current_target);
    }
  }

  this._set_reset_spotlight = function(event)
  {
    this._reset_spotlight_timeouts.set(this._reset_spotlight_bound, 70);
  }

  this._on_setting_change = function(msg)
  {
    if (msg.id == this._settings_id &&
        window.views[this._view_id].isvisible() &&
        msg.key in this._settings)
      this._handle_setting(msg.key);
  }

  this._on_show_view = function(msg)
  {
    if (msg.id == this._view_id)
    {
      if (this._active_window.length)
      {
        // in the case there is no runtime selected
        // set the top window to the active runtime
        if (!this._data_runtime_id)
        {
          this._data_runtime_id = this._active_window[0];
        }

        for (var key in this._settings)
        {
          if (window.settings[this._settings_id].get(key))
            this._handle_setting(key);
        }

        if (!this._is_waiting)
        {
          if (!this._data.length && this._element_selected_state == CHECKED)
          {
            this._get_initial_view(this._data_runtime_id);
          }
          else if (this._element_selected_state != CHECKED && 
                   this._element_selected_state != CHECK_AGAIN_NO_RUNTIME)
          {
            this._get_selected_element(this._data_runtime_id);
          }
        }
      }
      else
      {
        // caller is also _on_active_tab.
        // if the runtime list is empty, the view must be updated too
        // and the element selection must be cleared
        window.views.dom.update();
        window.messages.post("element-selected", {obj_id: 0, rt_id: 0, model: null});
      }
    }
  }

  this._on_hide_view = function(msg)
  {
    if (msg.id == this._view_id)
      this._remove_all_active_window_listeners();
  }

  this._settings =
  {
    'highlight-on-hover':
    {
      events:
      [
        ['mouseover', '_spotlight_bound'],
        ['mouseout', '_set_reset_spotlight_bound']
      ],
      off: function(){window.hostspotlighter.clearSpotlight();}
    },
    'find-with-click':
    {
      events:
      [
        ['click', '_click_handler_host_bound']
      ]
    },<commit_msg>Fix for DFL-1420, highlight is not put back on the selected element when re-enabling highlighting.<commit_after>﻿window.cls || (window.cls = {});
cls.EcmascriptDebugger || (cls.EcmascriptDebugger = {});
cls.EcmascriptDebugger["5.0"] || (cls.EcmascriptDebugger["5.0"] = {});
cls.EcmascriptDebugger["6.0"] || (cls.EcmascriptDebugger["6.0"] = {});

/**
  * @constructor
  * @extends InspectableDOMNode
  */

cls.EcmascriptDebugger["6.0"].DOMData =
cls.EcmascriptDebugger["5.0"].DOMData = function(view_id)
{

  /* interface */

  /**
    * To get an initial DOM of the given runtime.
    * Selects either the body or the root element in that order, if no optional
    * obj id is given.
    * Displays a travesal 'parent-node-chain-with-children' for the selected node.
    * @param {Number} rt_id. The runtime id of the given runtime.
    * @param {Number} obj_id. The optional node to be inspected.
    */
  this.get_dom = function(rt_id, obj_id, do_highlight, scroll_ito_view){};

  /**
    * To get a fully expanded DOM of the current selected runtime (document).
    */
  this.get_snapshot = function(){};

  /**
    * To bind the instantiated object to the service interface.
    */
  this.bind = function(ecma_debugger){};

  /* constants */

  const
  ID = 0,
  TYPE = 1,
  DEPTH = 3,
  CHILDREN_LENGTH = 6;

  const NOT_CHECKED = 0;
  const CHECKED = 1;
  const CHECK_AGAIN_RUNTIME = 2;
  const CHECK_AGAIN_NO_RUNTIME = 3;

  /* private */

  this._view_id = view_id;
  this._settings_id = view_id;
  this._current_target = 0;
  // to select a runtime if none is selected
  this._active_window = [];
  this._element_selected_state = NOT_CHECKED;
  // spotlight on hover on the host side
  this._reset_spotlight_timeouts = new Timeouts();
  this._is_waiting = false;
  this._editor_active = false;

  this._spotlight = function(event)
  {
    this._reset_spotlight_timeouts.clear();
    if (window.settings.dom.get('highlight-on-hover'))
      hostspotlighter.soft_spotlight(event.object_id);
  }

  this._reset_spotlight = function()
  {
    if (this._current_target)
    {
      if (window.settings.dom.get('highlight-on-hover'))
        hostspotlighter.spotlight(this._current_target);
    }
  }

  this._set_reset_spotlight = function(event)
  {
    this._reset_spotlight_timeouts.set(this._reset_spotlight_bound, 70);
  }

  this._on_setting_change = function(msg)
  {
    if (msg.id == this._settings_id &&
        window.views[this._view_id].isvisible() &&
        msg.key in this._settings)
      this._handle_setting(msg.key);
  }

  this._on_show_view = function(msg)
  {
    if (msg.id == this._view_id)
    {
      if (this._active_window.length)
      {
        // in the case there is no runtime selected
        // set the top window to the active runtime
        if (!this._data_runtime_id)
        {
          this._data_runtime_id = this._active_window[0];
        }

        for (var key in this._settings)
        {
          if (window.settings[this._settings_id].get(key))
            this._handle_setting(key);
        }

        if (!this._is_waiting)
        {
          if (!this._data.length && this._element_selected_state == CHECKED)
          {
            this._get_initial_view(this._data_runtime_id);
          }
          else if (this._element_selected_state != CHECKED && 
                   this._element_selected_state != CHECK_AGAIN_NO_RUNTIME)
          {
            this._get_selected_element(this._data_runtime_id);
          }
        }
      }
      else
      {
        // caller is also _on_active_tab.
        // if the runtime list is empty, the view must be updated too
        // and the element selection must be cleared
        window.views.dom.update();
        window.messages.post("element-selected", {obj_id: 0, rt_id: 0, model: null});
      }
    }
  }

  this._on_hide_view = function(msg)
  {
    if (msg.id == this._view_id)
      this._remove_all_active_window_listeners();
  }

  this._settings =
  {
    'highlight-on-hover':
    {
      events:
      [
        ['mouseover', '_spotlight_bound'],
        ['mouseout', '_set_reset_spotlight_bound']
      ],
      off: function(){window.hostspotlighter.clearSpotlight();},
      on: function()
      {
        if (window.dom_data.target)
        {
          window.hostspotlighter.spotlight(window.dom_data.target);
        }
      }
    },
    'find-with-click':
    {
      events:
      [
        ['click', '_click_handler_host_bound']
      ]
    },
{'fraction_non_alphanumeric': 0.12222605496148096, 'fraction_numerical': 0.006439001954697022, 'mean_word_length': 2.5171856045289123, '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': '1203636', 'n_tokens_mistral': 2888, 'n_tokens_neox': 2832, 'n_words': 579}