(function (_, kotlin_kotlin) {
  'use strict';
  //region block: imports
  var VOID = kotlin_kotlin.$_$.g;
  var numberRangeToNumber = kotlin_kotlin.$_$.tf;
  var collectionSizeOrDefault = kotlin_kotlin.$_$.b8;
  var ArrayList_init_$Create$ = kotlin_kotlin.$_$.p;
  var Default_getInstance = kotlin_kotlin.$_$.w5;
  var charSequenceGet = kotlin_kotlin.$_$.je;
  var Char = kotlin_kotlin.$_$.tl;
  var joinToString = kotlin_kotlin.$_$.ea;
  var removePrefix = kotlin_kotlin.$_$.qj;
  var Regex_init_$Create$ = kotlin_kotlin.$_$.k1;
  var numberToLong = kotlin_kotlin.$_$.yf;
  var THROW_CCE = kotlin_kotlin.$_$.nm;
  //endregion
  //region block: pre-declaration
  //endregion
  function get_CHAR_POOL_DEFAULT() {
    return CHAR_POOL_DEFAULT;
  }
  var CHAR_POOL_DEFAULT;
  function randomString(length, charPool) {
    charPool = charPool === VOID ? CHAR_POOL_DEFAULT : charPool;
    // Inline function 'kotlin.collections.map' call
    var this_0 = numberRangeToNumber(1, length);
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList_init_$Create$(collectionSizeOrDefault(this_0, 10));
    var tmp0_iterator = this_0.iterator_jk1svi_k$();
    while (tmp0_iterator.hasNext_bitz1p_k$()) {
      var item = tmp0_iterator.next_20eer_k$();
      // Inline function 'com.ustadmobile.lib.util.randomString.<anonymous>' call
      var tmp$ret$0 = charSequenceGet(charPool, Default_getInstance().nextInt_ak696k_k$(0, charPool.length));
      destination.add_utx5q5_k$(new Char(tmp$ret$0));
    }
    return joinToString(destination, '');
  }
  function get_RANGE_CONTENT_LENGTH_HEADER() {
    return RANGE_CONTENT_LENGTH_HEADER;
  }
  var RANGE_CONTENT_LENGTH_HEADER;
  function get_RANGE_CONTENT_RANGE_HEADER() {
    return RANGE_CONTENT_RANGE_HEADER;
  }
  var RANGE_CONTENT_RANGE_HEADER;
  function get_RANGE_CONTENT_ACCEPT_RANGE_HEADER() {
    return RANGE_CONTENT_ACCEPT_RANGE_HEADER;
  }
  var RANGE_CONTENT_ACCEPT_RANGE_HEADER;
  function get_sanitizeRegex() {
    _init_properties_UmAccountUtil_kt__77mlln();
    return sanitizeRegex;
  }
  var sanitizeRegex;
  function sanitizeDbNameFromUrl(url) {
    _init_properties_UmAccountUtil_kt__77mlln();
    // Inline function 'kotlin.text.replace' call
    var this_0 = removePrefix(removePrefix(url, 'https://'), 'http://');
    return get_sanitizeRegex().replace_1ix0wf_k$(this_0, '_');
  }
  var properties_initialized_UmAccountUtil_kt_2rfqnb;
  function _init_properties_UmAccountUtil_kt__77mlln() {
    if (!properties_initialized_UmAccountUtil_kt_2rfqnb) {
      properties_initialized_UmAccountUtil_kt_2rfqnb = true;
      sanitizeRegex = Regex_init_$Create$('\\W');
    }
  }
  function get_SEPARATE_END_TAG_REQUIRED_ELEMENTS() {
    _init_properties_XmlPullParserExt_kt__ggulfq();
    return SEPARATE_END_TAG_REQUIRED_ELEMENTS;
  }
  var SEPARATE_END_TAG_REQUIRED_ELEMENTS;
  var properties_initialized_XmlPullParserExt_kt_3kxlns;
  function _init_properties_XmlPullParserExt_kt__ggulfq() {
    if (!properties_initialized_XmlPullParserExt_kt_3kxlns) {
      properties_initialized_XmlPullParserExt_kt_3kxlns = true;
      // Inline function 'kotlin.arrayOf' call
      // Inline function 'kotlin.js.unsafeCast' call
      // Inline function 'kotlin.js.asDynamic' call
      SEPARATE_END_TAG_REQUIRED_ELEMENTS = ['script', 'style', 'title'];
    }
  }
  function getSystemTimeInMillis() {
    return numberToLong((new Date()).getTime());
  }
  function getDefaultTimeZoneId() {
    var tmp = Intl.DateTimeFormat().resolvedOptions().timeZone;
    return (!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE();
  }
  //region block: init
  CHAR_POOL_DEFAULT = 'abcdefghikjmnpqrstuvxwyz23456789';
  RANGE_CONTENT_LENGTH_HEADER = 'Content-Length';
  RANGE_CONTENT_RANGE_HEADER = 'Content-Range';
  RANGE_CONTENT_ACCEPT_RANGE_HEADER = 'Accept-Ranges';
  //endregion
  //region block: exports
  _.$_$ = _.$_$ || {};
  _.$_$.a = getDefaultTimeZoneId;
  _.$_$.b = getSystemTimeInMillis;
  _.$_$.c = randomString;
  _.$_$.d = sanitizeDbNameFromUrl;
  //endregion
  return _;
}(module.exports, require('./kotlin-kotlin-stdlib.js')));

//# sourceMappingURL=UstadMobile-lib-util.js.map
