(function (_, dev_icerock_moko_resources_internal_messageFormat_MessageFormat_rhgpjd, $module$bcp_47_7qe1cl, kotlin_kotlin, kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core) {
  'use strict';
  //region block: imports
  var imul = Math.imul;
  var parse = $module$bcp_47_7qe1cl.parse;
  var asList = kotlin_kotlin.$_$.g6;
  var protoOf = kotlin_kotlin.$_$.wc;
  var classMeta = kotlin_kotlin.$_$.lb;
  var setMetadataFor = kotlin_kotlin.$_$.xc;
  var getStringHashCode = kotlin_kotlin.$_$.vb;
  var copyToArray = kotlin_kotlin.$_$.e7;
  var hashCode = kotlin_kotlin.$_$.wb;
  var THROW_CCE = kotlin_kotlin.$_$.hi;
  var equals = kotlin_kotlin.$_$.ob;
  var VOID = kotlin_kotlin.$_$.f;
  var objectMeta = kotlin_kotlin.$_$.vc;
  var IllegalArgumentException_init_$Create$ = kotlin_kotlin.$_$.u1;
  var isArray = kotlin_kotlin.$_$.yb;
  var toList = kotlin_kotlin.$_$.u9;
  var emptyList = kotlin_kotlin.$_$.i7;
  var LinkedHashMap_init_$Create$ = kotlin_kotlin.$_$.v;
  var ArrayList_init_$Create$ = kotlin_kotlin.$_$.m;
  var Unit_instance = kotlin_kotlin.$_$.m5;
  var collectionSizeOrDefault = kotlin_kotlin.$_$.n6;
  var mapCapacity = kotlin_kotlin.$_$.m8;
  var coerceAtLeast = kotlin_kotlin.$_$.jd;
  var LinkedHashMap_init_$Create$_0 = kotlin_kotlin.$_$.u;
  var List = kotlin_kotlin.$_$.w5;
  var ArrayList_init_$Create$_0 = kotlin_kotlin.$_$.l;
  var to = kotlin_kotlin.$_$.nj;
  var json = kotlin_kotlin.$_$.lc;
  var plus = kotlin_kotlin.$_$.s8;
  var CoroutineImpl = kotlin_kotlin.$_$.va;
  var CoroutineScope = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.z1;
  var isInterface = kotlin_kotlin.$_$.gc;
  var get_COROUTINE_SUSPENDED = kotlin_kotlin.$_$.ha;
  var async = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.f2;
  var plus_0 = kotlin_kotlin.$_$.a9;
  var awaitAll = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.h;
  var toString = kotlin_kotlin.$_$.bd;
  var IllegalStateException_init_$Create$ = kotlin_kotlin.$_$.a2;
  var await_0 = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.i;
  var coroutineScope = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.j;
  var UnsupportedOperationException_init_$Create$ = kotlin_kotlin.$_$.r2;
  var listOf = kotlin_kotlin.$_$.l8;
  var interfaceMeta = kotlin_kotlin.$_$.xb;
  var Companion_instance = kotlin_kotlin.$_$.h5;
  var _Result___init__impl__xyqfz8 = kotlin_kotlin.$_$.d3;
  var createFailure = kotlin_kotlin.$_$.yi;
  var Result__exceptionOrNull_impl_p6xea9 = kotlin_kotlin.$_$.e3;
  var throwOnFailure = kotlin_kotlin.$_$.kj;
  var _Result___get_value__impl__bjfvqg = kotlin_kotlin.$_$.g3;
  //endregion
  //region block: pre-declaration
  setMetadataFor(PluralsResource, 'PluralsResource', classMeta);
  setMetadataFor(StringResource, 'StringResource', classMeta);
  setMetadataFor(PluralFormattedStringDesc, 'PluralFormattedStringDesc', classMeta, VOID, VOID, VOID, VOID, VOID, [0]);
  setMetadataFor(LocaleType, 'LocaleType', classMeta);
  setMetadataFor(System, 'System', objectMeta, LocaleType);
  setMetadataFor(Companion, 'Companion', objectMeta);
  setMetadataFor(ParsedLocale, 'ParsedLocale', classMeta);
  setMetadataFor(SupportedLocale, 'SupportedLocale', classMeta);
  setMetadataFor(SupportedLocales, 'SupportedLocales', classMeta, VOID, [List]);
  setMetadataFor(RemoteJsStringLoader$Impl$getOrLoad$slambda$slambda, 'RemoteJsStringLoader$Impl$getOrLoad$slambda$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(RemoteJsStringLoader$Impl$getOrLoad$slambda$slambda_1, 'RemoteJsStringLoader$Impl$getOrLoad$slambda$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  function plus_1(other) {
    var tmp = JsStringProvider$plus$lambda(this, other);
    return new sam$dev_icerock_moko_resources_provider_JsStringProvider$0_0(tmp);
  }
  setMetadataFor(JsStringProvider, 'JsStringProvider', interfaceMeta);
  setMetadataFor(sam$dev_icerock_moko_resources_provider_JsStringProvider$0, 'sam$dev_icerock_moko_resources_provider_JsStringProvider$0', classMeta, VOID, [JsStringProvider]);
  setMetadataFor(RemoteJsStringLoader$Impl$getOrLoad$slambda, 'RemoteJsStringLoader$Impl$getOrLoad$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor($loadLocalizationFileCOROUTINE$3, '$loadLocalizationFileCOROUTINE$3', classMeta, CoroutineImpl);
  setMetadataFor($getOrLoadCOROUTINE$4, '$getOrLoadCOROUTINE$4', classMeta, CoroutineImpl);
  setMetadataFor($downloadLocaleFileCOROUTINE$5, '$downloadLocaleFileCOROUTINE$5', classMeta, CoroutineImpl);
  setMetadataFor($downloadFallbackFileCOROUTINE$6, '$downloadFallbackFileCOROUTINE$6', classMeta, CoroutineImpl);
  setMetadataFor(RemoteJsStringLoader$Composition$getOrLoad$slambda$slambda, 'RemoteJsStringLoader$Composition$getOrLoad$slambda$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor(RemoteJsStringLoader$Composition$getOrLoad$slambda, 'RemoteJsStringLoader$Composition$getOrLoad$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  setMetadataFor($getOrLoadCOROUTINE$7, '$getOrLoadCOROUTINE$7', classMeta, CoroutineImpl);
  function plus_2(other) {
    return new Composition(listOf([this, other]));
  }
  setMetadataFor(RemoteJsStringLoader, 'RemoteJsStringLoader', interfaceMeta, VOID, VOID, VOID, VOID, VOID, [0]);
  setMetadataFor(Impl, 'Impl', classMeta, VOID, [RemoteJsStringLoader], VOID, VOID, VOID, [1, 0]);
  setMetadataFor(Composition, 'Composition', classMeta, VOID, [RemoteJsStringLoader], VOID, VOID, VOID, [0]);
  setMetadataFor(sam$dev_icerock_moko_resources_provider_JsStringProvider$0_0, 'sam$dev_icerock_moko_resources_provider_JsStringProvider$0', classMeta, VOID, [JsStringProvider]);
  //endregion
  function format(_this__u8e3s4, number, args) {
    return PluralFormatted(Companion_getInstance(), _this__u8e3s4, number, asList(args));
  }
  function PluralFormatted(_this__u8e3s4, pluralsRes, number, args) {
    return new PluralFormattedStringDesc(pluralsRes, number, args);
  }
  function PluralsResource(key, loader) {
    this.dm7_1 = key;
    this.em7_1 = loader;
  }
  protoOf(PluralsResource).fm7 = function (provider, locale, quantity, args) {
    var pluralString = provider.gm7(this.dm7_1, locale);
    var pluralLocale = locale == null ? currentLocale() : locale;
    // Inline function 'kotlin.arrayOf' call
    // Inline function 'kotlin.js.unsafeCast' call
    // Inline function 'kotlin.js.asDynamic' call
    var tmp$ret$2 = [pluralLocale];
    var compiledPlural = _CompiledPlural___init__impl__m1vc38((new dev_icerock_moko_resources_internal_messageFormat_MessageFormat_rhgpjd(tmp$ret$2)).compile(pluralString));
    return CompiledPlural__evaluate_impl_gca2wx(compiledPlural, quantity, args.slice());
  };
  function StringResource(key, loader) {
    this.hm7_1 = key;
    this.im7_1 = loader;
  }
  protoOf(StringResource).jm7 = function (provider, locale) {
    return provider.gm7(this.hm7_1, locale);
  };
  protoOf(StringResource).km7 = function (provider, locale, args) {
    var rawString = provider.gm7(this.hm7_1, locale);
    // Inline function 'kotlin.arrayOf' call
    // Inline function 'kotlin.js.unsafeCast' call
    // Inline function 'kotlin.js.asDynamic' call
    var tmp$ret$2 = [locale == null ? currentLocale() : locale];
    var compiled = _CompiledVariableString___init__impl__gl5jz1((new dev_icerock_moko_resources_internal_messageFormat_MessageFormat_rhgpjd(tmp$ret$2)).compile(rawString));
    return CompiledVariableString__evaluate_impl_iy6o3u(compiled, args.slice());
  };
  protoOf(StringResource).equals = function (other) {
    if (!(other instanceof StringResource))
      return false;
    if (!(this.hm7_1 === other.hm7_1))
      return false;
    return true;
  };
  protoOf(StringResource).hashCode = function () {
    return getStringHashCode(this.hm7_1);
  };
  function PluralFormattedStringDesc(pluralsRes, number, args) {
    this.lm7_1 = pluralsRes;
    this.mm7_1 = number;
    this.nm7_1 = args;
  }
  protoOf(PluralFormattedStringDesc).om7 = function (provider) {
    var tmp = Companion_getInstance().pm7_1.qm7();
    // Inline function 'kotlin.collections.toTypedArray' call
    var this_0 = this.nm7_1;
    var tmp$ret$0 = copyToArray(this_0);
    return this.lm7_1.fm7(provider, tmp, this.mm7_1, tmp$ret$0.slice());
  };
  protoOf(PluralFormattedStringDesc).toString = function () {
    return 'PluralFormattedStringDesc(pluralsRes=' + this.lm7_1 + ', number=' + this.mm7_1 + ', args=' + this.nm7_1 + ')';
  };
  protoOf(PluralFormattedStringDesc).hashCode = function () {
    var result = hashCode(this.lm7_1);
    result = imul(result, 31) + this.mm7_1 | 0;
    result = imul(result, 31) + hashCode(this.nm7_1) | 0;
    return result;
  };
  protoOf(PluralFormattedStringDesc).equals = function (other) {
    if (this === other)
      return true;
    if (!(other instanceof PluralFormattedStringDesc))
      return false;
    var tmp0_other_with_cast = other instanceof PluralFormattedStringDesc ? other : THROW_CCE();
    if (!equals(this.lm7_1, tmp0_other_with_cast.lm7_1))
      return false;
    if (!(this.mm7_1 === tmp0_other_with_cast.mm7_1))
      return false;
    if (!equals(this.nm7_1, tmp0_other_with_cast.nm7_1))
      return false;
    return true;
  };
  function System() {
    System_instance = this;
    LocaleType.call(this);
  }
  protoOf(System).qm7 = function () {
    return currentLocale();
  };
  var System_instance;
  function System_getInstance() {
    if (System_instance == null)
      new System();
    return System_instance;
  }
  function LocaleType() {
  }
  function Companion() {
    Companion_instance_0 = this;
    this.pm7_1 = System_getInstance();
  }
  var Companion_instance_0;
  function Companion_getInstance() {
    if (Companion_instance_0 == null)
      new Companion();
    return Companion_instance_0;
  }
  function currentLocale() {
    return window.navigator.language;
  }
  var cachedLocale;
  function ParsedLocale(parseResult) {
    var tmp = this;
    var tmp_0 = parseResult['language'];
    var tmp0_elvis_lhs = (!(tmp_0 == null) ? typeof tmp_0 === 'string' : false) ? tmp_0 : null;
    var tmp_1;
    if (tmp0_elvis_lhs == null) {
      throw IllegalArgumentException_init_$Create$('Primary language tags must not be empty');
    } else {
      tmp_1 = tmp0_elvis_lhs;
    }
    tmp.rm7_1 = tmp_1;
    var tmp_2 = this;
    // Inline function 'kotlin.collections.orEmpty' call
    var tmp_3 = parseResult['extendedLanguageSubtags'];
    var tmp0_safe_receiver = (!(tmp_3 == null) ? isArray(tmp_3) : false) ? tmp_3 : null;
    var tmp0_elvis_lhs_0 = tmp0_safe_receiver == null ? null : toList(tmp0_safe_receiver);
    tmp_2.sm7_1 = tmp0_elvis_lhs_0 == null ? emptyList() : tmp0_elvis_lhs_0;
    var tmp_4 = this;
    // Inline function 'kotlin.text.orEmpty' call
    var tmp_5 = parseResult['script'];
    var tmp0_elvis_lhs_1 = (!(tmp_5 == null) ? typeof tmp_5 === 'string' : false) ? tmp_5 : null;
    tmp_4.tm7_1 = tmp0_elvis_lhs_1 == null ? '' : tmp0_elvis_lhs_1;
    var tmp_6 = this;
    // Inline function 'kotlin.text.orEmpty' call
    var tmp_7 = parseResult['region'];
    var tmp0_elvis_lhs_2 = (!(tmp_7 == null) ? typeof tmp_7 === 'string' : false) ? tmp_7 : null;
    tmp_6.um7_1 = tmp0_elvis_lhs_2 == null ? '' : tmp0_elvis_lhs_2;
    var tmp_8 = this;
    // Inline function 'kotlin.collections.orEmpty' call
    var tmp_9 = parseResult['variants'];
    var tmp0_safe_receiver_0 = (!(tmp_9 == null) ? isArray(tmp_9) : false) ? tmp_9 : null;
    var tmp0_elvis_lhs_3 = tmp0_safe_receiver_0 == null ? null : toList(tmp0_safe_receiver_0);
    tmp_8.vm7_1 = tmp0_elvis_lhs_3 == null ? emptyList() : tmp0_elvis_lhs_3;
    var tmp_10 = this;
    // Inline function 'kotlin.collections.orEmpty' call
    var tmp_11 = parseResult['extensions'];
    var tmp0_safe_receiver_1 = (!(tmp_11 == null) ? isArray(tmp_11) : false) ? tmp_11 : null;
    var tmp0_elvis_lhs_4 = tmp0_safe_receiver_1 == null ? null : toList(tmp0_safe_receiver_1);
    tmp_10.wm7_1 = tmp0_elvis_lhs_4 == null ? emptyList() : tmp0_elvis_lhs_4;
    var tmp_12 = this;
    // Inline function 'kotlin.collections.orEmpty' call
    var tmp_13 = parseResult['privateuse'];
    var tmp0_safe_receiver_2 = (!(tmp_13 == null) ? isArray(tmp_13) : false) ? tmp_13 : null;
    var tmp0_elvis_lhs_5 = tmp0_safe_receiver_2 == null ? null : toList(tmp0_safe_receiver_2);
    tmp_12.xm7_1 = tmp0_elvis_lhs_5 == null ? emptyList() : tmp0_elvis_lhs_5;
  }
  function parseBcpLocale(tag) {
    return new ParsedLocale(parse(tag));
  }
  function SupportedLocale(locale, fileUrl) {
    this.ym7_1 = locale;
    this.zm7_1 = fileUrl;
    this.am8_1 = parseBcpLocale(this.ym7_1);
  }
  protoOf(SupportedLocale).toString = function () {
    return 'SupportedLocale(locale=' + this.ym7_1 + ', fileUrl=' + this.zm7_1 + ')';
  };
  protoOf(SupportedLocale).hashCode = function () {
    var result = getStringHashCode(this.ym7_1);
    result = imul(result, 31) + getStringHashCode(this.zm7_1) | 0;
    return result;
  };
  protoOf(SupportedLocale).equals = function (other) {
    if (this === other)
      return true;
    if (!(other instanceof SupportedLocale))
      return false;
    var tmp0_other_with_cast = other instanceof SupportedLocale ? other : THROW_CCE();
    if (!(this.ym7_1 === tmp0_other_with_cast.ym7_1))
      return false;
    if (!(this.zm7_1 === tmp0_other_with_cast.zm7_1))
      return false;
    return true;
  };
  function SupportedLocales(locales) {
    this.bm8_1 = locales;
    var tmp = this;
    // Inline function 'kotlin.collections.groupBy' call
    // Inline function 'kotlin.collections.groupByTo' call
    var this_0 = this.bm8_1;
    var destination = LinkedHashMap_init_$Create$();
    var tmp0_iterator = this_0.w();
    while (tmp0_iterator.f()) {
      var element = tmp0_iterator.e();
      // Inline function 'dev.icerock.moko.resources.internal.SupportedLocales.languageMap.<anonymous>' call
      var key = element.am8_1.rm7_1;
      // Inline function 'kotlin.collections.getOrPut' call
      var value = destination.q(key);
      var tmp_0;
      if (value == null) {
        // Inline function 'kotlin.collections.groupByTo.<anonymous>' call
        var answer = ArrayList_init_$Create$();
        destination.s(key, answer);
        tmp_0 = answer;
      } else {
        tmp_0 = value;
      }
      var list = tmp_0;
      list.i1(element);
    }
    tmp.cm8_1 = destination;
    var tmp_1 = this;
    // Inline function 'kotlin.collections.associateBy' call
    var this_1 = this.bm8_1;
    var capacity = coerceAtLeast(mapCapacity(collectionSizeOrDefault(this_1, 10)), 16);
    // Inline function 'kotlin.collections.associateByTo' call
    var destination_0 = LinkedHashMap_init_$Create$_0(capacity);
    var tmp0_iterator_0 = this_1.w();
    while (tmp0_iterator_0.f()) {
      var element_0 = tmp0_iterator_0.e();
      // Inline function 'dev.icerock.moko.resources.internal.SupportedLocales.localeMap.<anonymous>' call
      var tmp$ret$5 = element_0.ym7_1;
      destination_0.s(tmp$ret$5, element_0);
    }
    tmp_1.dm8_1 = destination_0;
  }
  protoOf(SupportedLocales).u = function () {
    return this.bm8_1.u();
  };
  protoOf(SupportedLocales).em8 = function (element) {
    return this.bm8_1.a1(element);
  };
  protoOf(SupportedLocales).a1 = function (element) {
    if (!(element instanceof SupportedLocale))
      return false;
    return this.em8(element instanceof SupportedLocale ? element : THROW_CCE());
  };
  protoOf(SupportedLocales).fm8 = function (elements) {
    return this.bm8_1.b1(elements);
  };
  protoOf(SupportedLocales).b1 = function (elements) {
    return this.fm8(elements);
  };
  protoOf(SupportedLocales).v = function (index) {
    return this.bm8_1.v(index);
  };
  protoOf(SupportedLocales).gm8 = function (element) {
    return this.bm8_1.x(element);
  };
  protoOf(SupportedLocales).x = function (element) {
    if (!(element instanceof SupportedLocale))
      return -1;
    return this.gm8(element instanceof SupportedLocale ? element : THROW_CCE());
  };
  protoOf(SupportedLocales).c1 = function () {
    return this.bm8_1.c1();
  };
  protoOf(SupportedLocales).w = function () {
    return this.bm8_1.w();
  };
  protoOf(SupportedLocales).y = function () {
    return this.bm8_1.y();
  };
  protoOf(SupportedLocales).z = function (fromIndex, toIndex) {
    return this.bm8_1.z(fromIndex, toIndex);
  };
  function _CompiledVariableString___init__impl__gl5jz1(function_0) {
    return function_0;
  }
  function _get_function__m6jw1f($this) {
    return $this;
  }
  function CompiledVariableString__evaluate_impl_iy6o3u($this, args) {
    // Inline function 'kotlin.collections.mapIndexed' call
    // Inline function 'kotlin.collections.mapIndexedTo' call
    var destination = ArrayList_init_$Create$_0(args.length);
    var index = 0;
    var inductionVariable = 0;
    var last = args.length;
    while (inductionVariable < last) {
      var item = args[inductionVariable];
      inductionVariable = inductionVariable + 1 | 0;
      // Inline function 'dev.icerock.moko.resources.internal.messageFormat.CompiledVariableString.evaluate.<anonymous>' call
      var tmp1 = index;
      index = tmp1 + 1 | 0;
      var tmp$ret$0 = to('' + tmp1, item);
      destination.i1(tmp$ret$0);
    }
    var keyValues = destination;
    // Inline function 'kotlin.collections.toTypedArray' call
    var tmp$ret$3 = copyToArray(keyValues);
    var json_0 = json(tmp$ret$3.slice());
    return _get_function__m6jw1f($this)(json_0);
  }
  function _CompiledPlural___init__impl__m1vc38(function_0) {
    return function_0;
  }
  function _get_function__m6jw1f_0($this) {
    return $this;
  }
  function CompiledPlural__evaluate_impl_gca2wx($this, quantity, args) {
    // Inline function 'kotlin.arrayOf' call
    // Inline function 'kotlin.js.unsafeCast' call
    // Inline function 'kotlin.js.asDynamic' call
    var tmp = [to('PLURAL', quantity)];
    // Inline function 'kotlin.collections.mapIndexed' call
    // Inline function 'kotlin.collections.mapIndexedTo' call
    var destination = ArrayList_init_$Create$_0(args.length);
    var index = 0;
    var inductionVariable = 0;
    var last = args.length;
    while (inductionVariable < last) {
      var item = args[inductionVariable];
      inductionVariable = inductionVariable + 1 | 0;
      // Inline function 'dev.icerock.moko.resources.internal.messageFormat.CompiledPlural.evaluate.<anonymous>' call
      var tmp1 = index;
      index = tmp1 + 1 | 0;
      var tmp$ret$3 = to('' + tmp1, item);
      destination.i1(tmp$ret$3);
    }
    var keyValues = plus(tmp, destination);
    var json_0 = json(keyValues.slice());
    return _get_function__m6jw1f_0($this)(json_0);
  }
  function RemoteJsStringLoader$Impl$getOrLoad$slambda$slambda(this$0, $it, resultContinuation) {
    this.pm8_1 = this$0;
    this.qm8_1 = $it;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(RemoteJsStringLoader$Impl$getOrLoad$slambda$slambda).u1m = function ($this$async, $completion) {
    var tmp = this.v1m($this$async, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(RemoteJsStringLoader$Impl$getOrLoad$slambda$slambda).he = function (p1, $completion) {
    return this.u1m((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(RemoteJsStringLoader$Impl$getOrLoad$slambda$slambda).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 2;
            this.hd_1 = 1;
            suspendResult = downloadLocaleFile(this.pm8_1, this.qm8_1, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            return Unit_instance;
          case 2:
            throw this.kd_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.id_1 === 2) {
          throw e;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e;
        }
      }
     while (true);
  };
  protoOf(RemoteJsStringLoader$Impl$getOrLoad$slambda$slambda).v1m = function ($this$async, completion) {
    var i = new RemoteJsStringLoader$Impl$getOrLoad$slambda$slambda(this.pm8_1, this.qm8_1, completion);
    i.rm8_1 = $this$async;
    return i;
  };
  function RemoteJsStringLoader$Impl$getOrLoad$slambda$slambda_0(this$0, $it, resultContinuation) {
    var i = new RemoteJsStringLoader$Impl$getOrLoad$slambda$slambda(this$0, $it, resultContinuation);
    var l = function ($this$async, $completion) {
      return i.u1m($this$async, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function RemoteJsStringLoader$Impl$getOrLoad$slambda$slambda_1(this$0, resultContinuation) {
    this.am9_1 = this$0;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(RemoteJsStringLoader$Impl$getOrLoad$slambda$slambda_1).u1m = function ($this$async, $completion) {
    var tmp = this.v1m($this$async, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(RemoteJsStringLoader$Impl$getOrLoad$slambda$slambda_1).he = function (p1, $completion) {
    return this.u1m((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(RemoteJsStringLoader$Impl$getOrLoad$slambda$slambda_1).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 2;
            this.hd_1 = 1;
            suspendResult = downloadFallbackFile(this.am9_1, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            return Unit_instance;
          case 2:
            throw this.kd_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.id_1 === 2) {
          throw e;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e;
        }
      }
     while (true);
  };
  protoOf(RemoteJsStringLoader$Impl$getOrLoad$slambda$slambda_1).v1m = function ($this$async, completion) {
    var i = new RemoteJsStringLoader$Impl$getOrLoad$slambda$slambda_1(this.am9_1, completion);
    i.bm9_1 = $this$async;
    return i;
  };
  function RemoteJsStringLoader$Impl$getOrLoad$slambda$slambda_2(this$0, resultContinuation) {
    var i = new RemoteJsStringLoader$Impl$getOrLoad$slambda$slambda_1(this$0, resultContinuation);
    var l = function ($this$async, $completion) {
      return i.u1m($this$async, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function loadLocalizationFile($this, fileUri, $completion) {
    var tmp = new $loadLocalizationFileCOROUTINE$3($this, fileUri, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  }
  function downloadLocaleFile($this, locale, $completion) {
    var tmp = new $downloadLocaleFileCOROUTINE$5($this, locale, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  }
  function downloadFallbackFile($this, $completion) {
    var tmp = new $downloadFallbackFileCOROUTINE$6($this, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  }
  function sam$dev_icerock_moko_resources_provider_JsStringProvider$0(function_0) {
    this.ima_1 = function_0;
  }
  protoOf(sam$dev_icerock_moko_resources_provider_JsStringProvider$0).gm7 = function (id, locale) {
    return this.ima_1(id, locale);
  };
  function RemoteJsStringLoader$Impl$getOrLoad$slambda(this$0, resultContinuation) {
    this.sma_1 = this$0;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(RemoteJsStringLoader$Impl$getOrLoad$slambda).uma = function ($this$coroutineScope, $completion) {
    var tmp = this.v1m($this$coroutineScope, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(RemoteJsStringLoader$Impl$getOrLoad$slambda).he = function (p1, $completion) {
    return this.uma((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(RemoteJsStringLoader$Impl$getOrLoad$slambda).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 2;
            this.hd_1 = 1;
            var this_0 = this.sma_1.vma_1;
            var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
            var tmp0_iterator = this_0.w();
            while (tmp0_iterator.f()) {
              var item = tmp0_iterator.e();
              destination.i1(async(this.tma_1, VOID, VOID, RemoteJsStringLoader$Impl$getOrLoad$slambda$slambda_0(this.sma_1, item, null)));
            }

            suspendResult = awaitAll(plus_0(destination, async(this.tma_1, VOID, VOID, RemoteJsStringLoader$Impl$getOrLoad$slambda$slambda_2(this.sma_1, null))), this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            return suspendResult;
          case 2:
            throw this.kd_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.id_1 === 2) {
          throw e;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e;
        }
      }
     while (true);
  };
  protoOf(RemoteJsStringLoader$Impl$getOrLoad$slambda).v1m = function ($this$coroutineScope, completion) {
    var i = new RemoteJsStringLoader$Impl$getOrLoad$slambda(this.sma_1, completion);
    i.tma_1 = $this$coroutineScope;
    return i;
  };
  function RemoteJsStringLoader$Impl$getOrLoad$slambda_0(this$0, resultContinuation) {
    var i = new RemoteJsStringLoader$Impl$getOrLoad$slambda(this$0, resultContinuation);
    var l = function ($this$coroutineScope, $completion) {
      return i.uma($this$coroutineScope, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function RemoteJsStringLoader$Impl$getOrLoad$lambda(this$0) {
    return function (id, locale) {
      var tmp;
      if (locale == null) {
        tmp = null;
      } else {
        // Inline function 'kotlin.let' call
        // Inline function 'kotlin.contracts.contract' call
        // Inline function 'dev.icerock.moko.resources.provider.Impl.getOrLoad.<anonymous>.<anonymous>' call
        tmp = this$0.xma_1.q(locale);
      }
      var tmp1_elvis_lhs = tmp;
      var tmp2_elvis_lhs = tmp1_elvis_lhs == null ? this$0.yma_1 : tmp1_elvis_lhs;
      var tmp_0;
      if (tmp2_elvis_lhs == null) {
        var message = 'Invalid state after download';
        throw IllegalStateException_init_$Create$(toString(message));
      } else {
        tmp_0 = tmp2_elvis_lhs;
      }
      var localeFile = tmp_0;
      var tmp3_safe_receiver = localeFile[id];
      var tmp6_elvis_lhs = tmp3_safe_receiver == null ? null : toString(tmp3_safe_receiver);
      var tmp_1;
      if (tmp6_elvis_lhs == null) {
        var tmp4_safe_receiver = this$0.yma_1;
        var tmp5_safe_receiver = tmp4_safe_receiver == null ? null : tmp4_safe_receiver[id];
        tmp_1 = tmp5_safe_receiver == null ? null : toString(tmp5_safe_receiver);
      } else {
        tmp_1 = tmp6_elvis_lhs;
      }
      var tmp7_elvis_lhs = tmp_1;
      var tmp_2;
      if (tmp7_elvis_lhs == null) {
        var message_0 = id + ' string resource not found';
        throw IllegalStateException_init_$Create$(toString(message_0));
      } else {
        tmp_2 = tmp7_elvis_lhs;
      }
      return tmp_2;
    };
  }
  function $loadLocalizationFileCOROUTINE$3(_this__u8e3s4, fileUri, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.km9_1 = _this__u8e3s4;
    this.lm9_1 = fileUri;
  }
  protoOf($loadLocalizationFileCOROUTINE$3).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 3;
            this.hd_1 = 1;
            suspendResult = await_0(window.fetch(this.lm9_1), this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            this.mm9_1 = suspendResult;
            if (!this.mm9_1.ok) {
              var message = 'response not ok for ' + this.lm9_1 + ' - ' + this.mm9_1.statusText + ' ' + this.mm9_1.body;
              throw IllegalStateException_init_$Create$(toString(message));
            }

            this.hd_1 = 2;
            suspendResult = await_0(this.mm9_1.json(), this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 2:
            var json = (suspendResult == null ? true : !(suspendResult == null)) ? suspendResult : THROW_CCE();
            var tmp_0;
            if (json == null) {
              var message_0 = 'Could not read json at ' + this.lm9_1;
              throw IllegalStateException_init_$Create$(toString(message_0));
            } else {
              tmp_0 = json;
            }

            return tmp_0;
          case 3:
            throw this.kd_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.id_1 === 3) {
          throw e;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e;
        }
      }
     while (true);
  };
  function $getOrLoadCOROUTINE$4(_this__u8e3s4, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.hmb_1 = _this__u8e3s4;
  }
  protoOf($getOrLoadCOROUTINE$4).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 2;
            this.hd_1 = 1;
            suspendResult = coroutineScope(RemoteJsStringLoader$Impl$getOrLoad$slambda_0(this.hmb_1, null), this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            var tmp_0 = RemoteJsStringLoader$Impl$getOrLoad$lambda(this.hmb_1);
            return new sam$dev_icerock_moko_resources_provider_JsStringProvider$0(tmp_0);
          case 2:
            throw this.kd_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.id_1 === 2) {
          throw e;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e;
        }
      }
     while (true);
  };
  function $downloadLocaleFileCOROUTINE$5(_this__u8e3s4, locale, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.vm9_1 = _this__u8e3s4;
    this.wm9_1 = locale;
  }
  protoOf($downloadLocaleFileCOROUTINE$5).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 2;
            if (!(this.vm9_1.xma_1.q(this.wm9_1.ym7_1) == null))
              return Unit_instance;
            var tmp_0 = this;
            tmp_0.xm9_1 = this.vm9_1.xma_1;
            var tmp_1 = this;
            tmp_1.ym9_1 = this.wm9_1.ym7_1;
            this.hd_1 = 1;
            suspendResult = loadLocalizationFile(this.vm9_1, this.wm9_1.zm7_1, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            var value = suspendResult;
            this.xm9_1.s(this.ym9_1, value);
            return Unit_instance;
          case 2:
            throw this.kd_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.id_1 === 2) {
          throw e;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e;
        }
      }
     while (true);
  };
  function $downloadFallbackFileCOROUTINE$6(_this__u8e3s4, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.hma_1 = _this__u8e3s4;
  }
  protoOf($downloadFallbackFileCOROUTINE$6).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 2;
            if (!(this.hma_1.yma_1 == null))
              return Unit_instance;
            this.hd_1 = 1;
            suspendResult = loadLocalizationFile(this.hma_1, this.hma_1.wma_1, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            var ARGUMENT = suspendResult;
            this.hma_1.yma_1 = ARGUMENT;
            return Unit_instance;
          case 2:
            throw this.kd_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.id_1 === 2) {
          throw e;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e;
        }
      }
     while (true);
  };
  function RemoteJsStringLoader$Composition$getOrLoad$slambda$slambda($it, resultContinuation) {
    this.qmb_1 = $it;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(RemoteJsStringLoader$Composition$getOrLoad$slambda$slambda).smb = function ($this$async, $completion) {
    var tmp = this.v1m($this$async, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(RemoteJsStringLoader$Composition$getOrLoad$slambda$slambda).he = function (p1, $completion) {
    return this.smb((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(RemoteJsStringLoader$Composition$getOrLoad$slambda$slambda).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 2;
            this.hd_1 = 1;
            suspendResult = this.qmb_1.tmb(this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            return suspendResult;
          case 2:
            throw this.kd_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.id_1 === 2) {
          throw e;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e;
        }
      }
     while (true);
  };
  protoOf(RemoteJsStringLoader$Composition$getOrLoad$slambda$slambda).v1m = function ($this$async, completion) {
    var i = new RemoteJsStringLoader$Composition$getOrLoad$slambda$slambda(this.qmb_1, completion);
    i.rmb_1 = $this$async;
    return i;
  };
  function RemoteJsStringLoader$Composition$getOrLoad$slambda$slambda_0($it, resultContinuation) {
    var i = new RemoteJsStringLoader$Composition$getOrLoad$slambda$slambda($it, resultContinuation);
    var l = function ($this$async, $completion) {
      return i.smb($this$async, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function RemoteJsStringLoader$Composition$getOrLoad$slambda(this$0, resultContinuation) {
    this.cmc_1 = this$0;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(RemoteJsStringLoader$Composition$getOrLoad$slambda).emc = function ($this$coroutineScope, $completion) {
    var tmp = this.v1m($this$coroutineScope, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(RemoteJsStringLoader$Composition$getOrLoad$slambda).he = function (p1, $completion) {
    return this.emc((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(RemoteJsStringLoader$Composition$getOrLoad$slambda).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 2;
            this.hd_1 = 1;
            var this_0 = this.cmc_1.fmc_1;
            var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
            var tmp0_iterator = this_0.w();
            while (tmp0_iterator.f()) {
              var item = tmp0_iterator.e();
              destination.i1(async(this.dmc_1, VOID, VOID, RemoteJsStringLoader$Composition$getOrLoad$slambda$slambda_0(item, null)));
            }

            suspendResult = awaitAll(destination, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            return suspendResult;
          case 2:
            throw this.kd_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.id_1 === 2) {
          throw e;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e;
        }
      }
     while (true);
  };
  protoOf(RemoteJsStringLoader$Composition$getOrLoad$slambda).v1m = function ($this$coroutineScope, completion) {
    var i = new RemoteJsStringLoader$Composition$getOrLoad$slambda(this.cmc_1, completion);
    i.dmc_1 = $this$coroutineScope;
    return i;
  };
  function RemoteJsStringLoader$Composition$getOrLoad$slambda_0(this$0, resultContinuation) {
    var i = new RemoteJsStringLoader$Composition$getOrLoad$slambda(this$0, resultContinuation);
    var l = function ($this$coroutineScope, $completion) {
      return i.emc($this$coroutineScope, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function $getOrLoadCOROUTINE$7(_this__u8e3s4, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.omc_1 = _this__u8e3s4;
  }
  protoOf($getOrLoadCOROUTINE$7).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 2;
            this.hd_1 = 1;
            suspendResult = coroutineScope(RemoteJsStringLoader$Composition$getOrLoad$slambda_0(this.omc_1, null), this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            var providers = suspendResult;
            var iterator = providers.w();
            if (!iterator.f())
              throw UnsupportedOperationException_init_$Create$("Empty collection can't be reduced.");
            var accumulator = iterator.e();
            while (iterator.f()) {
              var acc = accumulator;
              var jsStringProvider = iterator.e();
              accumulator = acc.jma(jsStringProvider);
            }

            return accumulator;
          case 2:
            throw this.kd_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.id_1 === 2) {
          throw e;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e;
        }
      }
     while (true);
  };
  function Impl(supportedLocales, fallbackFileUri) {
    this.vma_1 = supportedLocales;
    this.wma_1 = fallbackFileUri;
    var tmp = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp.xma_1 = LinkedHashMap_init_$Create$();
    this.yma_1 = null;
  }
  protoOf(Impl).tmb = function ($completion) {
    var tmp = new $getOrLoadCOROUTINE$4(this, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  function Composition(loaders) {
    this.fmc_1 = loaders;
  }
  protoOf(Composition).tmb = function ($completion) {
    var tmp = new $getOrLoadCOROUTINE$7(this, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  function RemoteJsStringLoader() {
  }
  function sam$dev_icerock_moko_resources_provider_JsStringProvider$0_0(function_0) {
    this.qmc_1 = function_0;
  }
  protoOf(sam$dev_icerock_moko_resources_provider_JsStringProvider$0_0).gm7 = function (id, locale) {
    return this.qmc_1(id, locale);
  };
  function JsStringProvider$plus$lambda(this$0, $other) {
    return function (id, locale) {
      // Inline function 'kotlin.getOrThrow' call
      // Inline function 'kotlin.recover' call
      // Inline function 'kotlin.runCatching' call
      var this_0 = this$0;
      var tmp;
      try {
        // Inline function 'kotlin.Companion.success' call
        // Inline function 'dev.icerock.moko.resources.provider.JsStringProvider.plus.<anonymous>.<anonymous>' call
        var value = this_0.gm7(id, locale);
        tmp = _Result___init__impl__xyqfz8(value);
      } catch ($p) {
        var tmp_0;
        if ($p instanceof Error) {
          var e = $p;
          // Inline function 'kotlin.Companion.failure' call
          tmp_0 = _Result___init__impl__xyqfz8(createFailure(e));
        } else {
          throw $p;
        }
        tmp = tmp_0;
      }
      var this_1 = tmp;
      // Inline function 'kotlin.contracts.contract' call
      var exception = Result__exceptionOrNull_impl_p6xea9(this_1);
      var tmp_1;
      if (exception == null) {
        tmp_1 = this_1;
      } else {
        // Inline function 'kotlin.Companion.success' call
        // Inline function 'dev.icerock.moko.resources.provider.JsStringProvider.plus.<anonymous>.<anonymous>' call
        var value_0 = $other.gm7(id, locale);
        tmp_1 = _Result___init__impl__xyqfz8(value_0);
      }
      var this_2 = tmp_1;
      throwOnFailure(this_2);
      var tmp_2 = _Result___get_value__impl__bjfvqg(this_2);
      return (tmp_2 == null ? true : !(tmp_2 == null)) ? tmp_2 : THROW_CCE();
    };
  }
  function JsStringProvider() {
  }
  //region block: post-declaration
  protoOf(sam$dev_icerock_moko_resources_provider_JsStringProvider$0).jma = plus_1;
  protoOf(Impl).pmc = plus_2;
  protoOf(Composition).pmc = plus_2;
  protoOf(sam$dev_icerock_moko_resources_provider_JsStringProvider$0_0).jma = plus_1;
  //endregion
  //region block: init
  cachedLocale = null;
  //endregion
  //region block: exports
  _.$_$ = _.$_$ || {};
  _.$_$.a = SupportedLocales;
  _.$_$.b = SupportedLocale;
  _.$_$.c = JsStringProvider;
  _.$_$.d = Impl;
  _.$_$.e = PluralsResource;
  _.$_$.f = StringResource;
  _.$_$.g = format;
  //endregion
  return _;
}(module.exports, require('@messageformat/core'), require('bcp-47'), require('./kotlin-kotlin-stdlib.js'), require('./kotlinx-coroutines-core.js')));

//# sourceMappingURL=moko-resources-resources.js.map
