<commit_before>import Active from '../Active'
import Filter from '../Filter'
import { InfoBox } from '../Map'

import Map from './Map'
import MapCollection from './MapCollection'
import Message from './Message'
import MessageCollection from './MessageCollection'
import Mapper from './Mapper'
import MapperCollection from './MapperCollection'
import Metacode from './Metacode'
import MetacodeCollection from './MetacodeCollection'
import Topic from './Topic'
import TopicCollection from './TopicCollection'
import Synapse from './Synapse'
import SynapseCollection from './SynapseCollection'
import Mapping from './Mapping'
import MappingCollection from './MappingCollection'

const DataModel = {
  Map: Map,
  MapCollection: MapCollection,
  Message: Message,
  MessageCollection: MessageCollection,
  Mapper: Mapper,
  MapperCollection: MapperCollection,
  Metacode: Metacode,
  MetacodeCollection: MetacodeCollection,
  Topic: Topic,
  TopicCollection: TopicCollection,
  Synapse: Synapse,
  SynapseCollection: SynapseCollection,
  Mapping: Mapping,
  MappingCollection: MappingCollection,

  Collaborators: new MapperCollection(),
  Creators: new MapperCollection(),
  Mappers: new MapperCollection(),
  Mappings: new MappingCollection(),
  Maps: {
    Mine: [],
    Shared: [],
    Starred: [],
    Mapper: {
      models: [],
      mapperId: null
    },
    Featured: [],
    Active: []
  },
  Messages: [],
  Metacodes: new MetacodeCollection(),
  Stars: [],
  Synapses: new SynapseCollection(),
  Topics: new TopicCollection(),

  init: function(serverData) {
    var self = DataModel

    // workaround circular import problem
    if (!self.MapCollection.model) self.MapCollection.model = Map

    self.synapseIconUrl = serverData['synapse16.png']

    if (serverData.ActiveMap) Active.Map = new Map(serverData.ActiveMap)
    if (serverData.ActiveMapper) Active.Mapper = new Mapper(serverData.ActiveMapper)
    if (serverData.ActiveTopic) Active.Topic = new Topic(serverData.ActiveTopic)

    if (serverData.Collaborators) self.Collaborators = new MapperCollection(serverData.Collaborators)
    if (serverData.Creators) self.Creators = new MapperCollection(serverData.Creators)
    if (serverData.Mappers) self.Mappers = new MapperCollection(serverData.Mappers)
    if (serverData.Mappings) self.Mappings = new MappingCollection(serverData.Mappings)
    if (serverData.Messages) self.Messages = serverData.Messages
    if (serverData.Metacodes) self.Metacodes = new MetacodeCollection(serverData.Metacodes)
    if (serverData.Stars) self.Stars = serverData.Stars
    if (serverData.Synapses) self.Synapses = new SynapseCollection(serverData.Synapses)
    if (serverData.Topics) self.Topics = new TopicCollection(serverData.Topics)

    // initialize global backbone models and collections
    if (Active.Mapper) Active.Mapper = new self.Mapper(Active.Mapper)

    var myCollection = serverData.Mine ? serverData.Mine : []
    var sharedCollection = serverData.Shared ? serverData.Shared : []
    var starredCollection = serverData.Starred ? serverData.Starred : []
    var mapperCollection = []<commit_msg>Active.Mapper was being initialized twice, causing errors (#934)<commit_after>import Active from '../Active'
import Filter from '../Filter'
import { InfoBox } from '../Map'

import Map from './Map'
import MapCollection from './MapCollection'
import Message from './Message'
import MessageCollection from './MessageCollection'
import Mapper from './Mapper'
import MapperCollection from './MapperCollection'
import Metacode from './Metacode'
import MetacodeCollection from './MetacodeCollection'
import Topic from './Topic'
import TopicCollection from './TopicCollection'
import Synapse from './Synapse'
import SynapseCollection from './SynapseCollection'
import Mapping from './Mapping'
import MappingCollection from './MappingCollection'

const DataModel = {
  Map: Map,
  MapCollection: MapCollection,
  Message: Message,
  MessageCollection: MessageCollection,
  Mapper: Mapper,
  MapperCollection: MapperCollection,
  Metacode: Metacode,
  MetacodeCollection: MetacodeCollection,
  Topic: Topic,
  TopicCollection: TopicCollection,
  Synapse: Synapse,
  SynapseCollection: SynapseCollection,
  Mapping: Mapping,
  MappingCollection: MappingCollection,

  Collaborators: new MapperCollection(),
  Creators: new MapperCollection(),
  Mappers: new MapperCollection(),
  Mappings: new MappingCollection(),
  Maps: {
    Mine: [],
    Shared: [],
    Starred: [],
    Mapper: {
      models: [],
      mapperId: null
    },
    Featured: [],
    Active: []
  },
  Messages: [],
  Metacodes: new MetacodeCollection(),
  Stars: [],
  Synapses: new SynapseCollection(),
  Topics: new TopicCollection(),

  init: function(serverData) {
    var self = DataModel

    // workaround circular import problem
    if (!self.MapCollection.model) self.MapCollection.model = Map

    self.synapseIconUrl = serverData['synapse16.png']

    if (serverData.ActiveMap) Active.Map = new Map(serverData.ActiveMap)
    if (serverData.ActiveMapper) Active.Mapper = new Mapper(serverData.ActiveMapper)
    if (serverData.ActiveTopic) Active.Topic = new Topic(serverData.ActiveTopic)

    if (serverData.Collaborators) self.Collaborators = new MapperCollection(serverData.Collaborators)
    if (serverData.Creators) self.Creators = new MapperCollection(serverData.Creators)
    if (serverData.Mappers) self.Mappers = new MapperCollection(serverData.Mappers)
    if (serverData.Mappings) self.Mappings = new MappingCollection(serverData.Mappings)
    if (serverData.Messages) self.Messages = serverData.Messages
    if (serverData.Metacodes) self.Metacodes = new MetacodeCollection(serverData.Metacodes)
    if (serverData.Stars) self.Stars = serverData.Stars
    if (serverData.Synapses) self.Synapses = new SynapseCollection(serverData.Synapses)
    if (serverData.Topics) self.Topics = new TopicCollection(serverData.Topics)

    // initialize global backbone models and collections
    var myCollection = serverData.Mine ? serverData.Mine : []
    var sharedCollection = serverData.Shared ? serverData.Shared : []
    var starredCollection = serverData.Starred ? serverData.Starred : []
    var mapperCollection = []
{'fraction_non_alphanumeric': 0.10341494845360824, 'fraction_numerical': 0.0011275773195876288, 'mean_word_length': 4.573608617594255, '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': '5512979', 'n_tokens_mistral': 1804, 'n_tokens_neox': 1753, 'n_words': 460}