(function (_, kotlin_kotlin, kotlin_dev_whyoleg_cryptography_cryptography_random) {
  'use strict';
  //region block: imports
  var protoOf = kotlin_kotlin.$_$.od;
  var initMetadataForInterface = kotlin_kotlin.$_$.tc;
  var initMetadataForClass = kotlin_kotlin.$_$.pc;
  var initMetadataForCompanion = kotlin_kotlin.$_$.qc;
  var toString = kotlin_kotlin.$_$.rd;
  var IllegalStateException_init_$Create$ = kotlin_kotlin.$_$.y2;
  var Unit_instance = kotlin_kotlin.$_$.b1;
  var initMetadataForObject = kotlin_kotlin.$_$.vc;
  var VOID = kotlin_kotlin.$_$.c;
  var equals = kotlin_kotlin.$_$.ic;
  var FunctionAdapter = kotlin_kotlin.$_$.vb;
  var isInterface = kotlin_kotlin.$_$.ed;
  var Comparator = kotlin_kotlin.$_$.ji;
  var hashCode = kotlin_kotlin.$_$.oc;
  var compareValues = kotlin_kotlin.$_$.da;
  var sortedWith = kotlin_kotlin.$_$.i9;
  var collectionSizeOrDefault = kotlin_kotlin.$_$.p6;
  var ArrayList_init_$Create$ = kotlin_kotlin.$_$.k1;
  var first = kotlin_kotlin.$_$.s7;
  var Default_getInstance = kotlin_dev_whyoleg_cryptography_cryptography_random.$_$.a;
  var LinkedHashMap_init_$Create$ = kotlin_kotlin.$_$.u1;
  var lazy = kotlin_kotlin.$_$.tj;
  var IllegalArgumentException_init_$Create$ = kotlin_kotlin.$_$.u2;
  var THROW_CCE = kotlin_kotlin.$_$.vi;
  var KtMap = kotlin_kotlin.$_$.y5;
  var closeFinally = kotlin_kotlin.$_$.kj;
  var AutoCloseable = kotlin_kotlin.$_$.ei;
  //endregion
  //region block: pre-declaration
  initMetadataForInterface(CryptographyAlgorithm, 'CryptographyAlgorithm');
  initMetadataForClass(CryptographyAlgorithmId, 'CryptographyAlgorithmId');
  initMetadataForCompanion(Companion);
  initMetadataForClass(CryptographyProvider, 'CryptographyProvider');
  initMetadataForObject(CryptographySystem, 'CryptographySystem');
  initMetadataForClass(CompositeProvider, 'CompositeProvider', VOID, CryptographyProvider);
  initMetadataForClass(sam$kotlin_Comparator$0, 'sam$kotlin_Comparator$0', VOID, VOID, [Comparator, FunctionAdapter]);
  initMetadataForClass(CryptographySystemImpl, 'CryptographySystemImpl', CryptographySystemImpl);
  initMetadataForCompanion(Companion_0, CryptographyAlgorithmId);
  initMetadataForCompanion(Companion_1, CryptographyAlgorithmId);
  initMetadataForCompanion(Companion_2, CryptographyAlgorithmId);
  initMetadataForObject(SHA512, 'SHA512', VOID, CryptographyAlgorithmId);
  initMetadataForObject(SHA1, 'SHA1', VOID, CryptographyAlgorithmId);
  initMetadataForObject(SHA256, 'SHA256', VOID, CryptographyAlgorithmId);
  initMetadataForObject(SHA384, 'SHA384', VOID, CryptographyAlgorithmId);
  initMetadataForCompanion(Companion_3, CryptographyAlgorithmId);
  initMetadataForCompanion(Companion_4, CryptographyAlgorithmId);
  initMetadataForCompanion(Companion_5, CryptographyAlgorithmId);
  initMetadataForCompanion(Companion_6, CryptographyAlgorithmId);
  initMetadataForCompanion(Companion_7, CryptographyAlgorithmId);
  initMetadataForCompanion(Companion_8, CryptographyAlgorithmId);
  initMetadataForCompanion(Companion_9, CryptographyAlgorithmId);
  initMetadataForCompanion(Companion_10, CryptographyAlgorithmId);
  initMetadataForCompanion(Companion_11, CryptographyAlgorithmId);
  initMetadataForCompanion(Companion_12, CryptographyAlgorithmId);
  function hash(data, $completion) {
    return this.q6e(data);
  }
  function hashBlocking(data) {
    var tmp0 = this.o6e();
    var tmp$ret$0;
    $l$block: {
      // Inline function 'kotlin.use' call
      var exception = null;
      try {
        tmp0.r6e(data);
        tmp$ret$0 = tmp0.s6e();
        break $l$block;
      } catch ($p) {
        if ($p instanceof Error) {
          var e = $p;
          exception = e;
          throw e;
        } else {
          throw $p;
        }
      }
      finally {
        closeFinally(tmp0, exception);
      }
    }
    return tmp$ret$0;
  }
  initMetadataForInterface(Hasher, 'Hasher', VOID, VOID, VOID, [1]);
  function update$default(source, startIndex, endIndex, $super) {
    startIndex = startIndex === VOID ? 0 : startIndex;
    endIndex = endIndex === VOID ? source.length : endIndex;
    var tmp;
    if ($super === VOID) {
      this.t6e(source, startIndex, endIndex);
      tmp = Unit_instance;
    } else {
      tmp = $super.t6e.call(this, source, startIndex, endIndex);
    }
    return tmp;
  }
  initMetadataForInterface(UpdateFunction, 'UpdateFunction', VOID, VOID, [AutoCloseable]);
  //endregion
  function CryptographyAlgorithm() {
  }
  function CryptographyAlgorithmId(name) {
    this.z6d_1 = name;
  }
  function Companion() {
  }
  protoOf(Companion).a6e = function () {
    return CryptographySystem_getInstance().c6e();
  };
  var Companion_instance;
  function Companion_getInstance() {
    return Companion_instance;
  }
  function CryptographyProvider() {
  }
  protoOf(CryptographyProvider).e6e = function (identifier) {
    var tmp0_elvis_lhs = this.d6e(identifier);
    var tmp;
    if (tmp0_elvis_lhs == null) {
      throw IllegalStateException_init_$Create$('Algorithm not found: ' + toString(identifier));
    } else {
      tmp = tmp0_elvis_lhs;
    }
    return tmp;
  };
  function CryptographySystem() {
    CryptographySystem_instance = this;
    this.b6e_1 = new CryptographySystemImpl();
    loadProviders(this);
  }
  protoOf(CryptographySystem).c6e = function () {
    return this.b6e_1.c6e();
  };
  protoOf(CryptographySystem).l6e = function (provider, priority) {
    return this.b6e_1.l6e(provider, priority);
  };
  var CryptographySystem_instance;
  function CryptographySystem_getInstance() {
    if (CryptographySystem_instance == null)
      new CryptographySystem();
    return CryptographySystem_instance;
  }
  function CompositeProvider(providers) {
    CryptographyProvider.call(this);
    this.m6e_1 = providers;
  }
  protoOf(CompositeProvider).d6e = function (identifier) {
    var tmp0 = this.m6e_1;
    var tmp$ret$0;
    $l$block: {
      // Inline function 'kotlin.collections.firstNotNullOfOrNull' call
      var _iterator__ex2g4s = tmp0.t();
      while (_iterator__ex2g4s.u()) {
        var element = _iterator__ex2g4s.v();
        var result = element.d6e(identifier);
        if (!(result == null)) {
          tmp$ret$0 = result;
          break $l$block;
        }
      }
      tmp$ret$0 = null;
    }
    return tmp$ret$0;
  };
  function sam$kotlin_Comparator$0(function_0) {
    this.n6e_1 = function_0;
  }
  protoOf(sam$kotlin_Comparator$0).ne = function (a, b) {
    return this.n6e_1(a, b);
  };
  protoOf(sam$kotlin_Comparator$0).compare = function (a, b) {
    return this.ne(a, b);
  };
  protoOf(sam$kotlin_Comparator$0).o3 = function () {
    return this.n6e_1;
  };
  protoOf(sam$kotlin_Comparator$0).equals = function (other) {
    var tmp;
    if (!(other == null) ? isInterface(other, Comparator) : false) {
      var tmp_0;
      if (!(other == null) ? isInterface(other, FunctionAdapter) : false) {
        tmp_0 = equals(this.o3(), other.o3());
      } else {
        tmp_0 = false;
      }
      tmp = tmp_0;
    } else {
      tmp = false;
    }
    return tmp;
  };
  protoOf(sam$kotlin_Comparator$0).hashCode = function () {
    return hashCode(this.o3());
  };
  function CryptographySystemImpl$lazyRegisteredProviders$lambda$lambda(a, b) {
    // Inline function 'kotlin.comparisons.compareValuesBy' call
    var tmp = a.p1();
    var tmp$ret$2 = b.p1();
    return compareValues(tmp, tmp$ret$2);
  }
  function CryptographySystemImpl$lazyRegisteredProviders$lambda(this$0) {
    return function () {
      // Inline function 'kotlin.collections.sortedBy' call
      var this_0 = this$0.f6e_1.o1();
      // Inline function 'kotlin.comparisons.compareBy' call
      var tmp = CryptographySystemImpl$lazyRegisteredProviders$lambda$lambda;
      var tmp$ret$1 = new sam$kotlin_Comparator$0(tmp);
      // Inline function 'kotlin.collections.map' call
      var this_1 = sortedWith(this_0, tmp$ret$1);
      // Inline function 'kotlin.collections.mapTo' call
      var destination = ArrayList_init_$Create$(collectionSizeOrDefault(this_1, 10));
      var _iterator__ex2g4s = this_1.t();
      while (_iterator__ex2g4s.u()) {
        var item = _iterator__ex2g4s.v();
        var tmp$ret$4 = item.q1().q1();
        destination.e1(tmp$ret$4);
      }
      return destination;
    };
  }
  function CryptographySystemImpl$lazyDefaultProvider$lambda(this$0) {
    return function () {
      var tmp0_elvis_lhs = this$0.h6e_1;
      var tmp;
      if (tmp0_elvis_lhs == null) {
        // Inline function 'kotlin.let' call
        var it = this$0.g6e_1.q1();
        var tmp_0;
        switch (it.i1()) {
          case 0:
            // Inline function 'kotlin.error' call

            var message = 'No providers registered. Please provide a dependency or register provider explicitly';
            throw IllegalStateException_init_$Create$(toString(message));
          case 1:
            tmp_0 = first(it);
            break;
          default:
            tmp_0 = new CompositeProvider(it);
            break;
        }
        tmp = tmp_0;
      } else {
        tmp = tmp0_elvis_lhs;
      }
      return tmp;
    };
  }
  function CryptographySystemImpl$lazyDefaultRandom$lambda(this$0) {
    return function () {
      var tmp0_elvis_lhs = this$0.j6e_1;
      return tmp0_elvis_lhs == null ? Default_getInstance() : tmp0_elvis_lhs;
    };
  }
  function CryptographySystemImpl() {
    var tmp = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp.f6e_1 = LinkedHashMap_init_$Create$();
    var tmp_0 = this;
    tmp_0.g6e_1 = lazy(CryptographySystemImpl$lazyRegisteredProviders$lambda(this));
    this.h6e_1 = null;
    var tmp_1 = this;
    tmp_1.i6e_1 = lazy(CryptographySystemImpl$lazyDefaultProvider$lambda(this));
    this.j6e_1 = null;
    var tmp_2 = this;
    tmp_2.k6e_1 = lazy(CryptographySystemImpl$lazyDefaultRandom$lambda(this));
  }
  protoOf(CryptographySystemImpl).c6e = function () {
    return this.i6e_1.q1();
  };
  protoOf(CryptographySystemImpl).l6e = function (provider, priority) {
    // Inline function 'kotlin.require' call
    if (!(priority >= 0)) {
      var message = 'Priority must be greater or equal to 0';
      throw IllegalArgumentException_init_$Create$(toString(message));
    }
    // Inline function 'kotlin.collections.contains' call
    // Inline function 'kotlin.collections.containsKey' call
    var this_0 = this.f6e_1;
    // Inline function 'kotlin.require' call
    if (!!(isInterface(this_0, KtMap) ? this_0 : THROW_CCE()).a3(priority)) {
      var message_0 = 'Provider with priority ' + priority + ' already registered. Every registered provider should have unique priority.';
      throw IllegalArgumentException_init_$Create$(toString(message_0));
    }
    // Inline function 'kotlin.check' call
    if (!!this.g6e_1.ar()) {
      var message_1 = 'Cannot register provider after `getRegisteredProviders` was called';
      throw IllegalStateException_init_$Create$(toString(message_1));
    }
    // Inline function 'kotlin.collections.set' call
    this.f6e_1.u2(priority, provider);
  };
  function Companion_0() {
    Companion_instance_0 = this;
    CryptographyAlgorithmId.call(this, 'AES-GCM');
  }
  var Companion_instance_0;
  function Companion_getInstance_0() {
    if (Companion_instance_0 == null)
      new Companion_0();
    return Companion_instance_0;
  }
  function Companion_1() {
    Companion_instance_1 = this;
    CryptographyAlgorithmId.call(this, 'AES-CTR');
  }
  var Companion_instance_1;
  function Companion_getInstance_1() {
    if (Companion_instance_1 == null)
      new Companion_1();
    return Companion_instance_1;
  }
  function Companion_2() {
    Companion_instance_2 = this;
    CryptographyAlgorithmId.call(this, 'AES-CBC');
  }
  var Companion_instance_2;
  function Companion_getInstance_2() {
    if (Companion_instance_2 == null)
      new Companion_2();
    return Companion_instance_2;
  }
  function SHA512() {
    SHA512_instance = this;
    CryptographyAlgorithmId.call(this, 'SHA-512');
  }
  var SHA512_instance;
  function SHA512_getInstance() {
    if (SHA512_instance == null)
      new SHA512();
    return SHA512_instance;
  }
  function SHA1() {
    SHA1_instance = this;
    CryptographyAlgorithmId.call(this, 'SHA-1');
  }
  var SHA1_instance;
  function SHA1_getInstance() {
    if (SHA1_instance == null)
      new SHA1();
    return SHA1_instance;
  }
  function SHA256() {
    SHA256_instance = this;
    CryptographyAlgorithmId.call(this, 'SHA-256');
  }
  var SHA256_instance;
  function SHA256_getInstance() {
    if (SHA256_instance == null)
      new SHA256();
    return SHA256_instance;
  }
  function SHA384() {
    SHA384_instance = this;
    CryptographyAlgorithmId.call(this, 'SHA-384');
  }
  var SHA384_instance;
  function SHA384_getInstance() {
    if (SHA384_instance == null)
      new SHA384();
    return SHA384_instance;
  }
  function Companion_3() {
    Companion_instance_3 = this;
    CryptographyAlgorithmId.call(this, 'ECDH');
  }
  var Companion_instance_3;
  function Companion_getInstance_3() {
    if (Companion_instance_3 == null)
      new Companion_3();
    return Companion_instance_3;
  }
  function Companion_4() {
    Companion_instance_4 = this;
    CryptographyAlgorithmId.call(this, 'ECDSA');
  }
  var Companion_instance_4;
  function Companion_getInstance_4() {
    if (Companion_instance_4 == null)
      new Companion_4();
    return Companion_instance_4;
  }
  function Companion_5() {
    Companion_instance_5 = this;
    CryptographyAlgorithmId.call(this, 'EdDSA');
  }
  var Companion_instance_5;
  function Companion_getInstance_5() {
    if (Companion_instance_5 == null)
      new Companion_5();
    return Companion_instance_5;
  }
  function Companion_6() {
    Companion_instance_6 = this;
    CryptographyAlgorithmId.call(this, 'HKDF');
  }
  var Companion_instance_6;
  function Companion_getInstance_6() {
    if (Companion_instance_6 == null)
      new Companion_6();
    return Companion_instance_6;
  }
  function Companion_7() {
    Companion_instance_7 = this;
    CryptographyAlgorithmId.call(this, 'HMAC');
  }
  var Companion_instance_7;
  function Companion_getInstance_7() {
    if (Companion_instance_7 == null)
      new Companion_7();
    return Companion_instance_7;
  }
  function Companion_8() {
    Companion_instance_8 = this;
    CryptographyAlgorithmId.call(this, 'PBKDF2');
  }
  var Companion_instance_8;
  function Companion_getInstance_8() {
    if (Companion_instance_8 == null)
      new Companion_8();
    return Companion_instance_8;
  }
  function Companion_9() {
    Companion_instance_9 = this;
    CryptographyAlgorithmId.call(this, 'RSA-OAEP');
  }
  var Companion_instance_9;
  function Companion_getInstance_9() {
    if (Companion_instance_9 == null)
      new Companion_9();
    return Companion_instance_9;
  }
  function Companion_10() {
    Companion_instance_10 = this;
    CryptographyAlgorithmId.call(this, 'RSA-PSS');
  }
  var Companion_instance_10;
  function Companion_getInstance_10() {
    if (Companion_instance_10 == null)
      new Companion_10();
    return Companion_instance_10;
  }
  function Companion_11() {
    Companion_instance_11 = this;
    CryptographyAlgorithmId.call(this, 'RSA-PKCS1-V1.5');
  }
  var Companion_instance_11;
  function Companion_getInstance_11() {
    if (Companion_instance_11 == null)
      new Companion_11();
    return Companion_instance_11;
  }
  function Companion_12() {
    Companion_instance_12 = this;
    CryptographyAlgorithmId.call(this, 'XDH');
  }
  var Companion_instance_12;
  function Companion_getInstance_12() {
    if (Companion_instance_12 == null)
      new Companion_12();
    return Companion_instance_12;
  }
  function Hasher() {
  }
  function UpdateFunction() {
  }
  function loadProviders(_this__u8e3s4) {
  }
  //region block: init
  Companion_instance = new Companion();
  //endregion
  //region block: exports
  _.$_$ = _.$_$ || {};
  _.$_$.a = Hasher;
  _.$_$.b = CryptographyAlgorithm;
  _.$_$.c = CryptographyProvider;
  _.$_$.d = Companion_getInstance_2;
  _.$_$.e = Companion_getInstance_1;
  _.$_$.f = Companion_getInstance_0;
  _.$_$.g = Companion_getInstance_3;
  _.$_$.h = Companion_getInstance_4;
  _.$_$.i = Companion_getInstance_5;
  _.$_$.j = Companion_getInstance_6;
  _.$_$.k = Companion_getInstance_7;
  _.$_$.l = Companion_getInstance_8;
  _.$_$.m = Companion_getInstance_9;
  _.$_$.n = Companion_getInstance_11;
  _.$_$.o = Companion_getInstance_10;
  _.$_$.p = SHA1_getInstance;
  _.$_$.q = SHA256_getInstance;
  _.$_$.r = SHA384_getInstance;
  _.$_$.s = SHA512_getInstance;
  _.$_$.t = Companion_getInstance_12;
  _.$_$.u = Companion_instance;
  _.$_$.v = CryptographySystem_getInstance;
  //endregion
  return _;
}(module.exports, require('./kotlin-kotlin-stdlib.js'), require('./cryptography-kotlin-cryptography-random.js')));

//# sourceMappingURL=cryptography-kotlin-cryptography-core.js.map
