<commit_before>import { ArrayUtils } from '/static/vesper/util/array-utils.js';
import { CLIP_LOAD_STATUS } from '/static/vesper/clip-album/clip.js';


// TODO: Make this a static ClipManager class property?
export const PAGE_LOAD_STATUS = {
    UNLOADED: 0,
    PARTIALLY_LOADED: 1,
    LOADED: 2
};


// Set this `true` to load clips in batches, or `false` to load them one
// at a time. We originally loaded clips one at a time, and have retained
// that capability at least for the time being for comparison to the newer
// and faster batch loading.
const _BATCH_LOADS_ENABLED = true;

// Maximum clip annotations batch size, in clips. When batch loads are
// enabled, the clip loader loads the annotations of the clips of a clip
// album page in batches of this size, except possibly for the last batch.
const _MAX_CLIP_ANNOTATIONS_BATCH_SIZE = 50;

// Maximum clip samples batch size, in clips. When batch loads are enabled,
// the clip loader loads the samples of the clips of a clip album page in
// batches of this size, except possibly for the last batch.
const _MAX_CLIP_SAMPLES_BATCH_SIZE = 10;

// Set this `true` to randomly simulate load errors for both clip batches
// and individual clips.
//
// If you set this `true`, also make sure that the calls to
// `_ClipLoader._throwRandomTestError` below are also uncommented.
// 
// When both test errors and batch loads are enabled, a simulated load
// failure for the annotations of any clip of a batch causes no annotations
// to be loaded for the entire batch. This means that you probably won't
// see any annotations at all unless you've made the annotations batch
// size and the test error probability sufficiently small that all
// annotations load successfully for some batches.
const _TEST_ERRORS_ENABLED = false;

// The probability that a call to the `_ClipLoader._throwRandomTestError`
// method will throw an error.
const _TEST_ERROR_PROBABILITY = .2;


/*
Testing in May, 2018 revealed several limitations of the current
Safari Web Audio implementation :

1. One must use "webkitAudioContext" and "webkitOfflineAudioContext"
   instead of "AudioContext" and "OfflineAudioContext". See
   https://github.com/cwilso/AudioContext-MonkeyPatch/blob/gh-pages/<commit_msg>Increased default clip samples batch size to 50.<commit_after>import { ArrayUtils } from '/static/vesper/util/array-utils.js';
import { CLIP_LOAD_STATUS } from '/static/vesper/clip-album/clip.js';


// TODO: Make this a static ClipManager class property?
export const PAGE_LOAD_STATUS = {
    UNLOADED: 0,
    PARTIALLY_LOADED: 1,
    LOADED: 2
};


// Set this `true` to load clips in batches, or `false` to load them one
// at a time. We originally loaded clips one at a time, and have retained
// that capability at least for the time being for comparison to the newer
// and faster batch loading.
const _BATCH_LOADS_ENABLED = true;

// Maximum clip samples batch size, in clips. When batch loads are enabled,
// the clip loader loads the samples of the clips of a clip album page in
// batches of this size, except possibly for the last batch.
const _MAX_CLIP_SAMPLES_BATCH_SIZE = 50;

// Maximum clip annotations batch size, in clips. When batch loads are
// enabled, the clip loader loads the annotations of the clips of a clip
// album page in batches of this size, except possibly for the last batch.
const _MAX_CLIP_ANNOTATIONS_BATCH_SIZE = 50;

// Set this `true` to randomly simulate load errors for both clip batches
// and individual clips.
//
// If you set this `true`, also make sure that the calls to
// `_ClipLoader._throwRandomTestError` below are also uncommented.
// 
// When both test errors and batch loads are enabled, a simulated load
// failure for the annotations of any clip of a batch causes no annotations
// to be loaded for the entire batch. This means that you probably won't
// see any annotations at all unless you've made the annotations batch
// size and the test error probability sufficiently small that all
// annotations load successfully for some batches.
const _TEST_ERRORS_ENABLED = false;

// The probability that a call to the `_ClipLoader._throwRandomTestError`
// method will throw an error.
const _TEST_ERROR_PROBABILITY = .2;


/*
Testing in May, 2018 revealed several limitations of the current
Safari Web Audio implementation :

1. One must use "webkitAudioContext" and "webkitOfflineAudioContext"
   instead of "AudioContext" and "OfflineAudioContext". See
   https://github.com/cwilso/AudioContext-MonkeyPatch/blob/gh-pages/
{'fraction_non_alphanumeric': 0.07059083868112415, 'fraction_numerical': 0.006196061075459172, 'mean_word_length': 3.9291166848418757, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '3832265', 'n_tokens_mistral': 1302, 'n_tokens_neox': 1214, 'n_words': 600}