<commit_before>{find, compact, extend, last} = require 'underscore-plus'
{Model} = require 'theorist'
{Emitter} = require 'event-kit'
Serializable = require 'serializable'
Grim = require 'grim'
PaneAxis = require './pane-axis'
TextEditor = require './text-editor'

# Extended: A container for presenting content in the center of the workspace.
# Panes can contain multiple items, one of which is *active* at a given time.
# The view corresponding to the active item is displayed in the interface. In
# the default configuration, tabs are also displayed for each item.
module.exports =
class Pane extends Model
  atom.deserializers.add(this)
  Serializable.includeInto(this)

  @properties
    container: undefined
    activeItem: undefined
    focused: false

  # Public: Only one pane is considered *active* at a time. A pane is activated
  # when it is focused, and when focus returns to the pane container after
  # moving to another element such as a panel, it returns to the active pane.
  @behavior 'active', ->
    @$container
      .switch((container) -> container?.$activePane)
      .map((activePane) => activePane is this)
      .distinctUntilChanged()

  constructor: (params) ->
    super

    @emitter = new Emitter
    @itemSubscriptions = new WeakMap
    @items = []

    @addItems(compact(params?.items ? []))
    @setActiveItem(@items[0]) unless @getActiveItem()?

  # Called by the Serializable mixin during serialization.
  serializeParams: ->
    if Grim.includeDeprecatedAPIs and typeof @activeItem?.getURI is 'function'
      activeItemURI = @activeItem.getURI()
    else if typeof @activeItem?.getUri is 'function'
      activeItemURI = @activeItem.getUri()

    id: @id
    items: compact(@items.map((item) -> item.serialize?()))
    activeItemURI: activeItemURI
    focused: @focused

  # Called by the Serializable mixin during deserialization.
  deserializeParams: (params) ->
    {items, activeItemURI, activeItemUri} = params
    activeItemURI ?= activeItemUri
    params.items = compact(items.map (itemState) -> atom.deserializers.deserialize(itemState))<commit_msg>Wrap getUri in deprecated API check<commit_after>{find, compact, extend, last} = require 'underscore-plus'
{Model} = require 'theorist'
{Emitter} = require 'event-kit'
Serializable = require 'serializable'
Grim = require 'grim'
PaneAxis = require './pane-axis'
TextEditor = require './text-editor'

# Extended: A container for presenting content in the center of the workspace.
# Panes can contain multiple items, one of which is *active* at a given time.
# The view corresponding to the active item is displayed in the interface. In
# the default configuration, tabs are also displayed for each item.
module.exports =
class Pane extends Model
  atom.deserializers.add(this)
  Serializable.includeInto(this)

  @properties
    container: undefined
    activeItem: undefined
    focused: false

  # Public: Only one pane is considered *active* at a time. A pane is activated
  # when it is focused, and when focus returns to the pane container after
  # moving to another element such as a panel, it returns to the active pane.
  @behavior 'active', ->
    @$container
      .switch((container) -> container?.$activePane)
      .map((activePane) => activePane is this)
      .distinctUntilChanged()

  constructor: (params) ->
    super

    @emitter = new Emitter
    @itemSubscriptions = new WeakMap
    @items = []

    @addItems(compact(params?.items ? []))
    @setActiveItem(@items[0]) unless @getActiveItem()?

  # Called by the Serializable mixin during serialization.
  serializeParams: ->
    if typeof @activeItem?.getURI is 'function'
      activeItemURI = @activeItem.getURI()
    else if Grim.includeDeprecatedAPIs and typeof @activeItem?.getUri is 'function'
      activeItemURI = @activeItem.getUri()

    id: @id
    items: compact(@items.map((item) -> item.serialize?()))
    activeItemURI: activeItemURI
    focused: @focused

  # Called by the Serializable mixin during deserialization.
  deserializeParams: (params) ->
    {items, activeItemURI, activeItemUri} = params
    activeItemURI ?= activeItemUri
    params.items = compact(items.map (itemState) -> atom.deserializers.deserialize(itemState))
{'fraction_non_alphanumeric': 0.10009487666034156, 'fraction_numerical': 0.0004743833017077799, 'mean_word_length': 3.961176470588235, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, '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': '6134362', 'n_tokens_mistral': 1214, 'n_tokens_neox': 1166, 'n_words': 414}