(function (_, kotlin_kotlin) {
  'use strict';
  //region block: imports
  var imul = Math.imul;
  var Unit = kotlin_kotlin.$_$.dn;
  var getKClass = kotlin_kotlin.$_$.e;
  var PrimitiveClasses_getInstance = kotlin_kotlin.$_$.x5;
  var protoOf = kotlin_kotlin.$_$.dg;
  var objectMeta = kotlin_kotlin.$_$.cg;
  var setMetadataFor = kotlin_kotlin.$_$.eg;
  var interfaceMeta = kotlin_kotlin.$_$.ef;
  var equals = kotlin_kotlin.$_$.se;
  var Collection = kotlin_kotlin.$_$.r6;
  var isInterface = kotlin_kotlin.$_$.nf;
  var getKClassFromExpression = kotlin_kotlin.$_$.d;
  var classMeta = kotlin_kotlin.$_$.oe;
  var VOID = kotlin_kotlin.$_$.g;
  var toString = kotlin_kotlin.$_$.ig;
  var KClass = kotlin_kotlin.$_$.jh;
  var THROW_CCE = kotlin_kotlin.$_$.rm;
  var collectionSizeOrDefault = kotlin_kotlin.$_$.b8;
  var ArrayList_init_$Create$ = kotlin_kotlin.$_$.p;
  var copyToArray = kotlin_kotlin.$_$.b9;
  var Companion_getInstance = kotlin_kotlin.$_$.y5;
  var emptyList = kotlin_kotlin.$_$.f9;
  var IllegalArgumentException_init_$Create$ = kotlin_kotlin.$_$.g2;
  var hashCode = kotlin_kotlin.$_$.cf;
  var IllegalStateException_init_$Create$ = kotlin_kotlin.$_$.m2;
  var joinToString = kotlin_kotlin.$_$.fa;
  var isArray = kotlin_kotlin.$_$.ff;
  var contentEquals = kotlin_kotlin.$_$.h8;
  var contentHashCode = kotlin_kotlin.$_$.n8;
  //endregion
  //region block: pre-declaration
  setMetadataFor(Companion, 'Companion', objectMeta);
  setMetadataFor(TypeToken, 'TypeToken', interfaceMeta);
  setMetadataFor(Companion_0, 'Companion', objectMeta);
  setMetadataFor(AbstractTypeToken, 'AbstractTypeToken', classMeta, VOID, [TypeToken]);
  setMetadataFor(AbstractKClassTypeToken, 'AbstractKClassTypeToken', classMeta, AbstractTypeToken);
  setMetadataFor(JSKClassTypeToken, 'JSKClassTypeToken', classMeta, AbstractKClassTypeToken);
  setMetadataFor(JSKTypeTypeToken, 'JSKTypeTypeToken', classMeta, AbstractTypeToken);
  setMetadataFor(CompositeTypeToken, 'CompositeTypeToken', classMeta, AbstractTypeToken);
  //endregion
  function Companion() {
    Companion_instance = this;
    var tmp = this;
    // Inline function 'org.kodein.type.erased' call
    tmp.Unit_1 = erased(getKClass(Unit));
    var tmp_0 = this;
    // Inline function 'org.kodein.type.erased' call
    tmp_0.Any_1 = erased(PrimitiveClasses_getInstance().get_anyClass_x0jl4l_k$());
  }
  protoOf(Companion).get_Unit_wob9il_k$ = function () {
    return this.Unit_1;
  };
  protoOf(Companion).get_Any_18jx5p_k$ = function () {
    return this.Any_1;
  };
  var Companion_instance;
  function Companion_getInstance_0() {
    if (Companion_instance == null)
      new Companion();
    return Companion_instance;
  }
  function TypeToken() {
  }
  function Companion_0() {
    Companion_instance_0 = this;
    var tmp = this;
    // Inline function 'org.kodein.type.erased' call
    tmp.Unit_1 = erased(getKClass(Unit));
    var tmp_0 = this;
    // Inline function 'org.kodein.type.erased' call
    tmp_0.Any_1 = erased(PrimitiveClasses_getInstance().get_anyClass_x0jl4l_k$());
  }
  protoOf(Companion_0).get_Unit_wob9il_k$ = function () {
    return this.Unit_1;
  };
  protoOf(Companion_0).get_Any_18jx5p_k$ = function () {
    return this.Any_1;
  };
  var Companion_instance_0;
  function Companion_getInstance_1() {
    if (Companion_instance_0 == null)
      new Companion_0();
    return Companion_instance_0;
  }
  function AbstractTypeToken() {
    Companion_getInstance_1();
  }
  protoOf(AbstractTypeToken).isAssignableFrom_qb3ccr_k$ = function (typeToken) {
    if (this.equals(typeToken) ? true : this.equals(Companion_getInstance_1().Any_1))
      return true;
    var raw = this.getRaw_kntxqm_k$();
    if (equals(raw, typeToken.getRaw_kntxqm_k$())) {
      var thisParams = this.getGenericParameters_10ww2z_k$();
      // Inline function 'kotlin.collections.isEmpty' call
      if (thisParams.length === 0)
        return true;
      var tokenParams = typeToken.getGenericParameters_10ww2z_k$();
      // Inline function 'kotlin.collections.forEachIndexed' call
      var index = 0;
      var inductionVariable = 0;
      var last = thisParams.length;
      while (inductionVariable < last) {
        var item = thisParams[inductionVariable];
        inductionVariable = inductionVariable + 1 | 0;
        // Inline function 'org.kodein.type.AbstractTypeToken.isAssignableFrom.<anonymous>' call
        var tmp1 = index;
        index = tmp1 + 1 | 0;
        var tokenParam = tokenParams[tmp1];
        if (!item.isAssignableFrom_qb3ccr_k$(tokenParam))
          return false;
      }
      return true;
    }
    var tmp$ret$1;
    $l$block_0: {
      // Inline function 'kotlin.collections.any' call
      var this_0 = typeToken.getSuper_wia7d1_k$();
      var tmp;
      if (isInterface(this_0, Collection)) {
        tmp = this_0.isEmpty_y1axqb_k$();
      } else {
        tmp = false;
      }
      if (tmp) {
        tmp$ret$1 = false;
        break $l$block_0;
      }
      var tmp0_iterator = this_0.iterator_jk1svi_k$();
      while (tmp0_iterator.hasNext_bitz1p_k$()) {
        var element = tmp0_iterator.next_20eer_k$();
        // Inline function 'org.kodein.type.AbstractTypeToken.isAssignableFrom.<anonymous>' call
        if (this.isAssignableFrom_qb3ccr_k$(element)) {
          tmp$ret$1 = true;
          break $l$block_0;
        }
      }
      tmp$ret$1 = false;
    }
    return tmp$ret$1;
  };
  protoOf(AbstractTypeToken).toString = function () {
    return this.qualifiedDispString_lx0v0v_k$();
  };
  protoOf(AbstractTypeToken).equals = function (other) {
    if (this === other)
      return true;
    if (!(!(other == null) ? isInterface(other, TypeToken) : false))
      return false;
    if (getKClassFromExpression(this).equals(getKClassFromExpression(other)))
      return this.typeEquals_1n0xvz_k$(other);
    if (!equals(this.getRaw_kntxqm_k$(), other.getRaw_kntxqm_k$()))
      return false;
    if (!this.isWildcard_wiobmk_k$() ? true : !other.isWildcard_wiobmk_k$()) {
      var tParams = this.getGenericParameters_10ww2z_k$();
      var oParams = other.getGenericParameters_10ww2z_k$();
      if (!(tParams.length === oParams.length))
        return false;
      var inductionVariable = 0;
      var last = tParams.length - 1 | 0;
      if (inductionVariable <= last)
        do {
          var i = inductionVariable;
          inductionVariable = inductionVariable + 1 | 0;
          if (!equals(tParams[i], oParams[i]))
            return false;
        }
         while (inductionVariable <= last);
    }
    return true;
  };
  protoOf(AbstractTypeToken).hashCode = function () {
    return this.typeHashCode_k2yp2t_k$();
  };
  function JSKClassTypeToken(type) {
    AbstractKClassTypeToken.call(this, type);
  }
  protoOf(JSKClassTypeToken).simpleErasedDispString_fuvmbh_k$ = function () {
    var tmp0_elvis_lhs = this.get_type_wovaf7_k$().get_simpleName_r6f8py_k$();
    return tmp0_elvis_lhs == null ? '(non-denotable type)' : tmp0_elvis_lhs;
  };
  protoOf(JSKClassTypeToken).qualifiedErasedDispString_66jr59_k$ = function () {
    var tmp0_elvis_lhs = this.get_type_wovaf7_k$().get_simpleName_r6f8py_k$();
    return tmp0_elvis_lhs == null ? '(non-denotable type)' : tmp0_elvis_lhs;
  };
  function _get_type__deia8h($this) {
    return $this.type_1;
  }
  function JSKTypeTypeToken(type) {
    AbstractTypeToken.call(this);
    this.type_1 = type;
  }
  protoOf(JSKTypeTypeToken).simpleDispString_fi18pn_k$ = function () {
    return toString(this.type_1);
  };
  protoOf(JSKTypeTypeToken).simpleErasedDispString_fuvmbh_k$ = function () {
    var tmp = this.type_1.get_classifier_ottyl2_k$();
    var tmp0_safe_receiver = (!(tmp == null) ? isInterface(tmp, KClass) : false) ? tmp : null;
    var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.get_simpleName_r6f8py_k$();
    return tmp1_elvis_lhs == null ? '(non-denotable type)' : tmp1_elvis_lhs;
  };
  protoOf(JSKTypeTypeToken).qualifiedDispString_lx0v0v_k$ = function () {
    return toString(this.type_1);
  };
  protoOf(JSKTypeTypeToken).qualifiedErasedDispString_66jr59_k$ = function () {
    var tmp = this.type_1.get_classifier_ottyl2_k$();
    var tmp0_safe_receiver = (!(tmp == null) ? isInterface(tmp, KClass) : false) ? tmp : null;
    var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.get_simpleName_r6f8py_k$();
    return tmp1_elvis_lhs == null ? '(non-denotable type)' : tmp1_elvis_lhs;
  };
  protoOf(JSKTypeTypeToken).getRaw_kntxqm_k$ = function () {
    var tmp = this.type_1.get_classifier_ottyl2_k$();
    return new JSKClassTypeToken((!(tmp == null) ? isInterface(tmp, KClass) : false) ? tmp : THROW_CCE());
  };
  protoOf(JSKTypeTypeToken).isGeneric_awwipf_k$ = function () {
    return true;
  };
  protoOf(JSKTypeTypeToken).getGenericParameters_10ww2z_k$ = function () {
    // Inline function 'kotlin.collections.toTypedArray' call
    // Inline function 'kotlin.collections.map' call
    var this_0 = this.type_1.get_arguments_p5ddub_k$();
    // 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 'org.kodein.type.JSKTypeTypeToken.getGenericParameters.<anonymous>' call
      var tmp0_safe_receiver = item.get_type_wovaf7_k$();
      var tmp;
      if (tmp0_safe_receiver == null) {
        tmp = null;
      } else {
        // Inline function 'kotlin.let' call
        // Inline function 'kotlin.contracts.contract' call
        // Inline function 'org.kodein.type.JSKTypeTypeToken.getGenericParameters.<anonymous>.<anonymous>' call
        tmp = typeToken(tmp0_safe_receiver);
      }
      var tmp1_elvis_lhs = tmp;
      var tmp$ret$2 = tmp1_elvis_lhs == null ? Companion_getInstance_1().get_Any_18jx5p_k$() : tmp1_elvis_lhs;
      destination.add_utx5q5_k$(tmp$ret$2);
    }
    return copyToArray(destination);
  };
  protoOf(JSKTypeTypeToken).isWildcard_wiobmk_k$ = function () {
    var tmp$ret$0;
    $l$block_0: {
      // Inline function 'kotlin.collections.all' call
      var this_0 = this.type_1.get_arguments_p5ddub_k$();
      var tmp;
      if (isInterface(this_0, Collection)) {
        tmp = this_0.isEmpty_y1axqb_k$();
      } else {
        tmp = false;
      }
      if (tmp) {
        tmp$ret$0 = true;
        break $l$block_0;
      }
      var tmp0_iterator = this_0.iterator_jk1svi_k$();
      while (tmp0_iterator.hasNext_bitz1p_k$()) {
        var element = tmp0_iterator.next_20eer_k$();
        // Inline function 'org.kodein.type.JSKTypeTypeToken.isWildcard.<anonymous>' call
        if (!element.equals(Companion_getInstance().get_STAR_wo9fa3_k$())) {
          tmp$ret$0 = false;
          break $l$block_0;
        }
      }
      tmp$ret$0 = true;
    }
    return tmp$ret$0;
  };
  protoOf(JSKTypeTypeToken).getSuper_wia7d1_k$ = function () {
    return emptyList();
  };
  protoOf(JSKTypeTypeToken).typeEquals_1n0xvz_k$ = function (other) {
    // Inline function 'kotlin.require' call
    // Inline function 'kotlin.contracts.contract' call
    // Inline function 'kotlin.require' call
    // Inline function 'kotlin.contracts.contract' call
    if (!(other instanceof JSKTypeTypeToken)) {
      // Inline function 'kotlin.require.<anonymous>' call
      var message = 'Failed requirement.';
      throw IllegalArgumentException_init_$Create$(toString(message));
    }
    return equals(this.type_1, other.type_1);
  };
  protoOf(JSKTypeTypeToken).typeHashCode_k2yp2t_k$ = function () {
    return hashCode(this.type_1);
  };
  function erasedOf(obj) {
    return new JSKClassTypeToken(getKClassFromExpression(obj));
  }
  function typeToken(type) {
    var tmp;
    if (type.get_arguments_p5ddub_k$().isEmpty_y1axqb_k$()) {
      var tmp_0 = type.get_classifier_ottyl2_k$();
      tmp = new JSKClassTypeToken((!(tmp_0 == null) ? isInterface(tmp_0, KClass) : false) ? tmp_0 : THROW_CCE());
    } else {
      tmp = new JSKTypeTypeToken(type);
    }
    return tmp;
  }
  function erased(cls) {
    return new JSKClassTypeToken(cls);
  }
  function AbstractKClassTypeToken(type) {
    AbstractTypeToken.call(this);
    this.type_1 = type;
  }
  protoOf(AbstractKClassTypeToken).get_type_wovaf7_k$ = function () {
    return this.type_1;
  };
  protoOf(AbstractKClassTypeToken).simpleDispString_fi18pn_k$ = function () {
    return this.simpleErasedDispString_fuvmbh_k$();
  };
  protoOf(AbstractKClassTypeToken).qualifiedDispString_lx0v0v_k$ = function () {
    return this.qualifiedErasedDispString_66jr59_k$();
  };
  protoOf(AbstractKClassTypeToken).getRaw_kntxqm_k$ = function () {
    return this;
  };
  protoOf(AbstractKClassTypeToken).isGeneric_awwipf_k$ = function () {
    return false;
  };
  protoOf(AbstractKClassTypeToken).isWildcard_wiobmk_k$ = function () {
    return true;
  };
  protoOf(AbstractKClassTypeToken).getSuper_wia7d1_k$ = function () {
    return emptyList();
  };
  protoOf(AbstractKClassTypeToken).getGenericParameters_10ww2z_k$ = function () {
    // Inline function 'kotlin.emptyArray' call
    return [];
  };
  protoOf(AbstractKClassTypeToken).isAssignableFrom_qb3ccr_k$ = function (typeToken) {
    if (this.equals(typeToken))
      return true;
    if (this.type_1.equals(PrimitiveClasses_getInstance().get_anyClass_x0jl4l_k$()))
      return true;
    return false;
  };
  protoOf(AbstractKClassTypeToken).typeEquals_1n0xvz_k$ = function (other) {
    // Inline function 'kotlin.require' call
    // Inline function 'kotlin.contracts.contract' call
    // Inline function 'kotlin.require' call
    // Inline function 'kotlin.contracts.contract' call
    if (!(other instanceof AbstractKClassTypeToken)) {
      // Inline function 'kotlin.require.<anonymous>' call
      var message = 'Failed requirement.';
      throw IllegalArgumentException_init_$Create$(toString(message));
    }
    if (!this.type_1.equals(other.type_1))
      return false;
    return true;
  };
  protoOf(AbstractKClassTypeToken).typeHashCode_k2yp2t_k$ = function () {
    return this.type_1.hashCode();
  };
  function CompositeTypeToken$simpleDispString$lambda(it) {
    return it.simpleDispString_fi18pn_k$();
  }
  function CompositeTypeToken$qualifiedDispString$lambda(it) {
    return it.qualifiedDispString_lx0v0v_k$();
  }
  function CompositeTypeToken(main, params) {
    AbstractTypeToken.call(this);
    this.main_1 = main;
    this.params_1 = params;
    // Inline function 'kotlin.collections.isEmpty' call
    if (this.params_1.length === 0)
      throw IllegalStateException_init_$Create$('CompositeTypeToken must be given at least one type parameter');
  }
  protoOf(CompositeTypeToken).get_main_woqbk2_k$ = function () {
    return this.main_1;
  };
  protoOf(CompositeTypeToken).get_params_hy4oen_k$ = function () {
    return this.params_1;
  };
  protoOf(CompositeTypeToken).simpleDispString_fi18pn_k$ = function () {
    var tmp = this.main_1.simpleErasedDispString_fuvmbh_k$();
    return tmp + '<' + joinToString(this.params_1, ', ', VOID, VOID, VOID, VOID, CompositeTypeToken$simpleDispString$lambda) + '>';
  };
  protoOf(CompositeTypeToken).simpleErasedDispString_fuvmbh_k$ = function () {
    return this.main_1.simpleErasedDispString_fuvmbh_k$();
  };
  protoOf(CompositeTypeToken).qualifiedDispString_lx0v0v_k$ = function () {
    var tmp = this.main_1.qualifiedErasedDispString_66jr59_k$();
    return tmp + '<' + joinToString(this.params_1, ', ', VOID, VOID, VOID, VOID, CompositeTypeToken$qualifiedDispString$lambda) + '>';
  };
  protoOf(CompositeTypeToken).qualifiedErasedDispString_66jr59_k$ = function () {
    return this.main_1.qualifiedErasedDispString_66jr59_k$();
  };
  protoOf(CompositeTypeToken).getRaw_kntxqm_k$ = function () {
    return this.main_1.getRaw_kntxqm_k$();
  };
  protoOf(CompositeTypeToken).isGeneric_awwipf_k$ = function () {
    return true;
  };
  protoOf(CompositeTypeToken).isWildcard_wiobmk_k$ = function () {
    var tmp$ret$1;
    $l$block: {
      // Inline function 'kotlin.collections.all' call
      var indexedObject = this.params_1;
      var inductionVariable = 0;
      var last = indexedObject.length;
      while (inductionVariable < last) {
        var element = indexedObject[inductionVariable];
        inductionVariable = inductionVariable + 1 | 0;
        // Inline function 'org.kodein.type.CompositeTypeToken.isWildcard.<anonymous>' call
        if (!equals(element, Companion_getInstance_1().get_Any_18jx5p_k$())) {
          tmp$ret$1 = false;
          break $l$block;
        }
      }
      tmp$ret$1 = true;
    }
    return tmp$ret$1;
  };
  protoOf(CompositeTypeToken).getSuper_wia7d1_k$ = function () {
    return this.main_1.getSuper_wia7d1_k$();
  };
  protoOf(CompositeTypeToken).getGenericParameters_10ww2z_k$ = function () {
    var tmp = this.params_1;
    return isArray(tmp) ? tmp : THROW_CCE();
  };
  protoOf(CompositeTypeToken).typeEquals_1n0xvz_k$ = function (other) {
    // Inline function 'kotlin.require' call
    // Inline function 'kotlin.contracts.contract' call
    // Inline function 'kotlin.require' call
    // Inline function 'kotlin.contracts.contract' call
    if (!(other instanceof CompositeTypeToken)) {
      // Inline function 'kotlin.require.<anonymous>' call
      var message = 'Failed requirement.';
      throw IllegalArgumentException_init_$Create$(toString(message));
    }
    return equals(this.main_1, other.main_1) ? contentEquals(this.params_1, other.params_1) : false;
  };
  protoOf(CompositeTypeToken).typeHashCode_k2yp2t_k$ = function () {
    return imul(31, hashCode(this.main_1)) + contentHashCode(this.params_1) | 0;
  };
  function erasedComp(main, params) {
    var tmp;
    // Inline function 'kotlin.collections.isEmpty' call
    if (params.length === 0) {
      tmp = erased(main);
    } else {
      tmp = new CompositeTypeToken(erased(main), params.slice());
    }
    return tmp;
  }
  //region block: exports
  _.$_$ = _.$_$ || {};
  _.$_$.a = Companion_getInstance_0;
  _.$_$.b = TypeToken;
  _.$_$.c = erasedComp;
  _.$_$.d = erasedOf;
  _.$_$.e = typeToken;
  //endregion
  return _;
}(module.exports, require('./kotlin-kotlin-stdlib.js')));

//# sourceMappingURL=Kosi-Kaverit-kaverit.js.map
