<commit_before>require 'clearwater/router'
require 'clearwater/application_registry'
require 'browser/delay'

module Clearwater
  class Application
    RENDER_FPS = 60
    AppRegistry = ApplicationRegistry.new

    attr_reader :store, :router, :component, :api_client, :on_render

    def self.render
      AppRegistry.render_all
    end

    def initialize options={}
      @store      = options.fetch(:store)      { nil }
      @router     = options.fetch(:router)     { Router.new }
      @component  = options.fetch(:component)  { nil }
      @api_client = options.fetch(:api_client) { nil }
      @element    = options.fetch(:element)    { nil }
      @on_render  = []

      router.application = self
      component.router = router

      $document.on 'visibilitychange' do
        if @render_on_visibility_change
          @render_on_visibility_change = false<commit_msg>Ensure we can handle popstate events<commit_after>require 'clearwater/router'
require 'clearwater/application_registry'
require 'browser/delay'
require 'browser/event/pop_state'

module Clearwater
  class Application
    RENDER_FPS = 60
    AppRegistry = ApplicationRegistry.new

    attr_reader :store, :router, :component, :api_client, :on_render

    def self.render
      AppRegistry.render_all
    end

    def initialize options={}
      @store      = options.fetch(:store)      { nil }
      @router     = options.fetch(:router)     { Router.new }
      @component  = options.fetch(:component)  { nil }
      @api_client = options.fetch(:api_client) { nil }
      @element    = options.fetch(:element)    { nil }
      @on_render  = []

      router.application = self
      component.router = router

      $document.on 'visibilitychange' do
        if @render_on_visibility_change
          @render_on_visibility_change = false
{'fraction_non_alphanumeric': 0.09586776859504133, 'fraction_numerical': 0.0022038567493112946, 'mean_word_length': 2.913793103448276, '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': '5604853', 'n_tokens_mistral': 537, 'n_tokens_neox': 517, 'n_words': 114}