(function (_, XXH, kotlin_kotlin, kotlin_io_ktor_ktor_io) {
  'use strict';
  //region block: imports
  var protoOf = kotlin_kotlin.$_$.f6;
  var interfaceMeta = kotlin_kotlin.$_$.w5;
  var setMetadataFor = kotlin_kotlin.$_$.g6;
  var Long = kotlin_kotlin.$_$.u8;
  var classMeta = kotlin_kotlin.$_$.m5;
  var VOID = kotlin_kotlin.$_$.d;
  var toULong = kotlin_kotlin.$_$.g8;
  var _ULong___get_data__impl__fggpzb = kotlin_kotlin.$_$.d2;
  var Charsets_getInstance = kotlin_io_ktor_ktor_io.$_$.f;
  var encodeToByteArray = kotlin_kotlin.$_$.f7;
  var encodeToByteArray_0 = kotlin_io_ktor_ktor_io.$_$.j;
  //endregion
  //region block: pre-declaration
  setMetadataFor(XXHasher64, 'XXHasher64', interfaceMeta);
  setMetadataFor(XXHasher64Factory, 'XXHasher64Factory', interfaceMeta);
  setMetadataFor(XXStringHasher, 'XXStringHasher', interfaceMeta);
  setMetadataFor(XXHasher64FactoryJs, 'XXHasher64FactoryJs', classMeta, VOID, [XXHasher64Factory], XXHasher64FactoryJs);
  setMetadataFor(XXHasher64Js, 'XXHasher64Js', classMeta, VOID, [XXHasher64]);
  setMetadataFor(XXStringHasherJs, 'XXStringHasherJs', classMeta, VOID, [XXStringHasher], XXStringHasherJs);
  //endregion
  function XXHasher64() {
  }
  function XXHasher64Factory() {
  }
  function XXStringHasher() {
  }
  function toByteArray(_this__u8e3s4) {
    var buffer = new Int8Array(8);
    var temp = _this__u8e3s4;
    var inductionVariable = 0;
    if (inductionVariable < 8)
      do {
        var i = inductionVariable;
        inductionVariable = inductionVariable + 1 | 0;
        buffer[7 - i | 0] = temp.and_4spn93_k$(new Long(255, 0)).toByte_edm0nx_k$();
        temp = temp.shr_9fl3wl_k$(8);
      }
       while (inductionVariable < 8);
    return buffer;
  }
  function XXHasher64FactoryJs() {
  }
  protoOf(XXHasher64FactoryJs).newHasher_bylh2l_k$ = function (seed) {
    var hasher = XXH.h64();
    hasher.init(seed);
    return new XXHasher64Js(hasher);
  };
  function _get_hasher64__tptygi($this) {
    return $this.hasher64__1;
  }
  function XXHasher64Js(hasher64) {
    this.hasher64__1 = hasher64;
  }
  protoOf(XXHasher64Js).update_abaron_k$ = function (data) {
    // Inline function 'js.typedarrays.toUint8Array' call
    // Inline function 'js.typedarrays.asInt8Array' call
    // Inline function 'kotlin.js.unsafeCast' call
    // Inline function 'kotlin.js.asDynamic' call
    var array = data;
    var array_0 = new Uint8Array(array.buffer, array.byteOffset, array.length);
    this.hasher64__1.update(array_0.buffer);
  };
  protoOf(XXHasher64Js).digest_m0ziv0_k$ = function () {
    var digestStr = this.hasher64__1.digest().toString(10);
    // Inline function 'kotlin.ULong.toLong' call
    var this_0 = toULong(digestStr);
    return _ULong___get_data__impl__fggpzb(this_0);
  };
  function XXStringHasherJs() {
  }
  protoOf(XXStringHasherJs).hash_6htf84_k$ = function (string) {
    // Inline function 'js.typedarrays.toUint8Array' call
    var tmp$ret$0;
    $l$block: {
      // Inline function 'io.ktor.utils.io.core.toByteArray' call
      var charset = Charsets_getInstance().get_UTF_8_ihn39z_k$();
      if (charset.equals(Charsets_getInstance().get_UTF_8_ihn39z_k$())) {
        tmp$ret$0 = encodeToByteArray(string);
        break $l$block;
      }
      tmp$ret$0 = encodeToByteArray_0(charset.newEncoder_gqwcdg_k$(), string, 0, string.length);
    }
    // Inline function 'js.typedarrays.asInt8Array' call
    // Inline function 'kotlin.js.unsafeCast' call
    // Inline function 'kotlin.js.asDynamic' call
    var array = tmp$ret$0;
    var array_0 = new Uint8Array(array.buffer, array.byteOffset, array.length);
    var hash = XXH.h64(array_0.buffer, 0).toString(10);
    // Inline function 'kotlin.ULong.toLong' call
    var this_0 = toULong(hash);
    return _ULong___get_data__impl__fggpzb(this_0);
  };
  //region block: exports
  _.$_$ = _.$_$ || {};
  _.$_$.a = toByteArray;
  _.$_$.b = XXHasher64FactoryJs;
  _.$_$.c = XXStringHasherJs;
  //endregion
  return _;
}(module.exports, require('xxhashjs'), require('./kotlin-kotlin-stdlib.js'), require('./ktor-ktor-io.js')));
