<commit_before>B  = require \backbone
F  = require \fs # browserified
_  = require \underscore
C  = require \../collection
D  = require \../view-handler/directive
Ve = require \../view-activity/edit
Vr = require \../view-activity/read
Gc = require \./map/graph/composer
Sp = require \./map/scroll-pos
T  = require \./map/tool
Te = require \./map/tool/edit

V-Graph  = require \./map/graph
V-Find   = require \./map/tool/find
V-Layers = require \./map/tool/layers

T-Edit = F.readFileSync __dirname + \/map/tool/edit.html
T-Info = F.readFileSync __dirname + \/map/tool/info.html
T-Meta = F.readFileSync __dirname + \/meta.html

module.exports = B.View.extend do
  initialize: ->
    @$el.html F.readFileSync __dirname + \/map.html

    @v-graph  = new V-Graph el:@$ \.graph
    @v-meta   = new Vr.InfoView el:@$(\.meta), template:T-Meta
    @v-edit   = new Ve.EditView el:@$(\.edit), template:T-Edit
    @v-info   = new Vr.InfoView el:@$(\.info), template:T-Info
    @v-find   = new V-Find el:@$ \.find
    @v-layers = new V-Layers el:@$ \.layers

    @v-info.on \rendered -> @$el.toggle (it.get \description)?length > 0

    Gc @
    T @
    Te @v-edit, @v-graph

    @scroll-pos = new Sp @v-graph

  render: (@map, node-id) -> # @map for external ref
    (vg = @v-graph).map = @map
    vg.once \render-complete ~>
      @v-find.render vg
      @v-layers.render vg
      @v-info.render @map, D.map
      @v-meta.render @map, D.meta
      @v-edit.render @map, C.Maps, fetch:no directive:D.map-edit if @map.get-is-editable!
      @map.globalise-entities! # do this expensive step last, for performance
    vg.render!
    if not node-id and rxs = @map.get \node_default_rx
      try
        rx = new RegExp rxs
        node-id = (_.sample _.filter vg.d3f.nodes!, -> rx.test it.name)?_id<commit_msg>defer render of map tools<commit_after>B  = require \backbone
F  = require \fs # browserified
_  = require \underscore
C  = require \../collection
D  = require \../view-handler/directive
Ve = require \../view-activity/edit
Vr = require \../view-activity/read
Gc = require \./map/graph/composer
Sp = require \./map/scroll-pos
T  = require \./map/tool
Te = require \./map/tool/edit

V-Graph  = require \./map/graph
V-Find   = require \./map/tool/find
V-Layers = require \./map/tool/layers

T-Edit = F.readFileSync __dirname + \/map/tool/edit.html
T-Info = F.readFileSync __dirname + \/map/tool/info.html
T-Meta = F.readFileSync __dirname + \/meta.html

module.exports = B.View.extend do
  initialize: ->
    @$el.html F.readFileSync __dirname + \/map.html

    @v-graph  = new V-Graph el:@$ \.graph
    @v-meta   = new Vr.InfoView el:@$(\.meta), template:T-Meta
    @v-edit   = new Ve.EditView el:@$(\.edit), template:T-Edit
    @v-info   = new Vr.InfoView el:@$(\.info), template:T-Info
    @v-find   = new V-Find el:@$ \.find
    @v-layers = new V-Layers el:@$ \.layers

    @v-info.on \rendered -> @$el.toggle (it.get \description)?length > 0

    Gc @
    T @
    Te @v-edit, @v-graph

    @scroll-pos = new Sp @v-graph

  render: (@map, node-id) -> # @map for external ref
    (vg = @v-graph).map = @map
    vg.once \render-complete ~>
      <~ _.defer # allow completed map to display
      @v-find.render vg
      @v-layers.render vg
      @v-info.render @map, D.map
      @v-meta.render @map, D.meta
      @v-edit.render @map, C.Maps, fetch:no directive:D.map-edit if @map.get-is-editable!
      @map.globalise-entities! # do this expensive step last, for performance
    vg.render!
    if not node-id and rxs = @map.get \node_default_rx
      try
        rx = new RegExp rxs
        node-id = (_.sample _.filter vg.d3f.nodes!, -> rx.test it.name)?_id
{'fraction_non_alphanumeric': 0.16593647316538881, 'fraction_numerical': 0.001095290251916758, 'mean_word_length': 2.407649253731343, 'pattern_counts': {'":': 0, '<': 4, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '618293', 'n_tokens_mistral': 1401, 'n_tokens_neox': 1370, 'n_words': 335}