(function (_, kotlin_kotlin, kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core, kotlin_io_ktor_ktor_http, kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core, kotlin_io_ktor_ktor_io, kotlin_org_jetbrains_kotlinx_kotlinx_io_core, kotlin_io_ktor_ktor_serialization) {
  'use strict';
  //region block: imports
  var ArrayList_init_$Create$ = kotlin_kotlin.$_$.l1;
  var Unit_instance = kotlin_kotlin.$_$.b1;
  var CoroutineImpl = kotlin_kotlin.$_$.xa;
  var protoOf = kotlin_kotlin.$_$.od;
  var get_COROUTINE_SUSPENDED = kotlin_kotlin.$_$.fa;
  var initMetadataForLambda = kotlin_kotlin.$_$.uc;
  var VOID = kotlin_kotlin.$_$.c;
  var initMetadataForCoroutine = kotlin_kotlin.$_$.rc;
  var toString = kotlin_kotlin.$_$.rd;
  var IllegalStateException_init_$Create$ = kotlin_kotlin.$_$.y2;
  var THROW_CCE = kotlin_kotlin.$_$.vi;
  var KSerializer = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.p2;
  var isInterface = kotlin_kotlin.$_$.ed;
  var ByteArrayContent = kotlin_io_ktor_ktor_http.$_$.m;
  var BinaryFormat = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.n2;
  var withCharsetIfNeeded = kotlin_io_ktor_ktor_http.$_$.v1;
  var TextContent = kotlin_io_ktor_ktor_http.$_$.w;
  var StringFormat = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.v2;
  var equals = kotlin_kotlin.$_$.ic;
  var FunctionAdapter = kotlin_kotlin.$_$.vb;
  var FlowCollector = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.c1;
  var hashCode = kotlin_kotlin.$_$.oc;
  var initMetadataForClass = kotlin_kotlin.$_$.pc;
  var Flow = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.d1;
  var OutgoingContent = kotlin_io_ktor_ktor_http.$_$.v;
  var asFlow = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.e1;
  var firstOrNull = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.j;
  var SerializationException = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.t2;
  var readRemaining = kotlin_io_ktor_ktor_io.$_$.h;
  var discard = kotlin_io_ktor_ktor_io.$_$.w;
  var readByteArray = kotlin_org_jetbrains_kotlinx_kotlinx_io_core.$_$.k;
  var readText = kotlin_io_ktor_ktor_io.$_$.x;
  var JsonConvertException = kotlin_io_ktor_ktor_serialization.$_$.d;
  var IllegalArgumentException_init_$Create$ = kotlin_kotlin.$_$.u2;
  var serializerOrNull = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.y2;
  var serializer = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.a3;
  var getKClassFromExpression = kotlin_kotlin.$_$.he;
  var MapSerializer = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.t;
  var KtMap = kotlin_kotlin.$_$.y5;
  var SetSerializer = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.u;
  var KtSet = kotlin_kotlin.$_$.d6;
  var firstOrNull_0 = kotlin_kotlin.$_$.r7;
  var StringCompanionObject_instance = kotlin_kotlin.$_$.m;
  var serializer_0 = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.w;
  var ListSerializer = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.s;
  var isArray = kotlin_kotlin.$_$.wc;
  var KtList = kotlin_kotlin.$_$.v5;
  var get_nullable = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.v;
  var Exception = kotlin_kotlin.$_$.oi;
  var joinToString = kotlin_kotlin.$_$.c8;
  var to = kotlin_kotlin.$_$.bk;
  var SerializationException_init_$Create$ = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.q;
  var filterNotNull = kotlin_kotlin.$_$.p7;
  var collectionSizeOrDefault = kotlin_kotlin.$_$.p6;
  var ArrayList_init_$Create$_0 = kotlin_kotlin.$_$.k1;
  var HashSet_init_$Create$ = kotlin_kotlin.$_$.r1;
  var singleOrNull = kotlin_kotlin.$_$.f9;
  var Collection = kotlin_kotlin.$_$.q5;
  var KClass = kotlin_kotlin.$_$.ke;
  var emptyList = kotlin_kotlin.$_$.k7;
  //endregion
  //region block: pre-declaration
  initMetadataForLambda(KotlinxSerializationConverter$serialize$o$collect$slambda, CoroutineImpl, VOID, [1]);
  initMetadataForCoroutine($collectCOROUTINE$, CoroutineImpl);
  initMetadataForLambda(KotlinxSerializationConverter$deserialize$o$collect$slambda, CoroutineImpl, VOID, [1]);
  initMetadataForCoroutine($collectCOROUTINE$_0, CoroutineImpl);
  initMetadataForClass(sam$kotlinx_coroutines_flow_FlowCollector$0, 'sam$kotlinx_coroutines_flow_FlowCollector$0', VOID, VOID, [FlowCollector, FunctionAdapter], [1]);
  initMetadataForClass(sam$kotlinx_coroutines_flow_FlowCollector$0_0, 'sam$kotlinx_coroutines_flow_FlowCollector$0', VOID, VOID, [FlowCollector, FunctionAdapter], [1]);
  initMetadataForClass(KotlinxSerializationConverter$serialize$$inlined$map$1, VOID, VOID, VOID, [Flow], [1]);
  initMetadataForLambda(KotlinxSerializationConverter$serialize$slambda, CoroutineImpl, VOID, [1]);
  initMetadataForClass(KotlinxSerializationConverter$deserialize$$inlined$map$1, VOID, VOID, VOID, [Flow], [1]);
  initMetadataForLambda(KotlinxSerializationConverter$deserialize$slambda, CoroutineImpl, VOID, [1]);
  initMetadataForCoroutine($serializeCOROUTINE$, CoroutineImpl);
  initMetadataForCoroutine($deserializeCOROUTINE$, CoroutineImpl);
  initMetadataForClass(KotlinxSerializationConverter, 'KotlinxSerializationConverter', VOID, VOID, VOID, [4, 3]);
  //endregion
  function extensions(format) {
    // Inline function 'kotlin.collections.mapNotNull' call
    var tmp0 = get_providers();
    // Inline function 'kotlin.collections.mapNotNullTo' call
    var destination = ArrayList_init_$Create$();
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s = tmp0.t();
    while (_iterator__ex2g4s.u()) {
      var element = _iterator__ex2g4s.v();
      var tmp0_safe_receiver = element.o69(format);
      if (tmp0_safe_receiver == null)
        null;
      else {
        // Inline function 'kotlin.let' call
        destination.e1(tmp0_safe_receiver);
      }
    }
    return destination;
  }
  function serialization(_this__u8e3s4, contentType, format) {
    _this__u8e3s4.h4y(contentType, new KotlinxSerializationConverter(format));
  }
  function KotlinxSerializationConverter$serialize$o$collect$slambda($$this$unsafeFlow, $contentType, $charset, $typeInfo, $value, resultContinuation) {
    this.x69_1 = $$this$unsafeFlow;
    this.y69_1 = $contentType;
    this.z69_1 = $charset;
    this.a6a_1 = $typeInfo;
    this.b6a_1 = $value;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(KotlinxSerializationConverter$serialize$o$collect$slambda).i3h = function (value, $completion) {
    var tmp = this.j3h(value, $completion);
    tmp.g9_1 = Unit_instance;
    tmp.h9_1 = null;
    return tmp.m9();
  };
  protoOf(KotlinxSerializationConverter$serialize$o$collect$slambda).z9 = function (p1, $completion) {
    return this.i3h(p1, $completion);
  };
  protoOf(KotlinxSerializationConverter$serialize$o$collect$slambda).m9 = function () {
    var suspendResult = this.g9_1;
    $sm: do
      try {
        var tmp = this.e9_1;
        switch (tmp) {
          case 0:
            this.f9_1 = 3;
            var tmp0 = this.x69_1;
            var tmp2 = this.c6a_1;
            this.d6a_1 = tmp0;
            this.e9_1 = 1;
            suspendResult = tmp2.n69(this.y69_1, this.z69_1, this.a6a_1, this.b6a_1, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            var ARGUMENT = suspendResult;
            this.e9_1 = 2;
            suspendResult = this.d6a_1.k3c(ARGUMENT, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 2:
            return Unit_instance;
          case 3:
            throw this.h9_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.f9_1 === 3) {
          throw e;
        } else {
          this.e9_1 = this.f9_1;
          this.h9_1 = e;
        }
      }
     while (true);
  };
  protoOf(KotlinxSerializationConverter$serialize$o$collect$slambda).j3h = function (value, completion) {
    var i = new KotlinxSerializationConverter$serialize$o$collect$slambda(this.x69_1, this.y69_1, this.z69_1, this.a6a_1, this.b6a_1, completion);
    i.c6a_1 = value;
    return i;
  };
  function KotlinxSerializationConverter$serialize$o$collect$slambda_0($$this$unsafeFlow, $contentType, $charset, $typeInfo, $value, resultContinuation) {
    var i = new KotlinxSerializationConverter$serialize$o$collect$slambda($$this$unsafeFlow, $contentType, $charset, $typeInfo, $value, resultContinuation);
    var l = function (value, $completion) {
      return i.i3h(value, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function $collectCOROUTINE$(_this__u8e3s4, collector, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.m6a_1 = _this__u8e3s4;
    this.n6a_1 = collector;
  }
  protoOf($collectCOROUTINE$).m9 = function () {
    var suspendResult = this.g9_1;
    $sm: do
      try {
        var tmp = this.e9_1;
        switch (tmp) {
          case 0:
            this.f9_1 = 2;
            var $this$unsafeFlow = this.n6a_1;
            this.e9_1 = 1;
            var tmp_0 = KotlinxSerializationConverter$serialize$o$collect$slambda_0($this$unsafeFlow, this.m6a_1.p6a_1, this.m6a_1.q6a_1, this.m6a_1.r6a_1, this.m6a_1.s6a_1, null);
            suspendResult = this.m6a_1.o6a_1.v3b(new sam$kotlinx_coroutines_flow_FlowCollector$0(tmp_0), this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            return Unit_instance;
          case 2:
            throw this.h9_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.f9_1 === 2) {
          throw e;
        } else {
          this.e9_1 = this.f9_1;
          this.h9_1 = e;
        }
      }
     while (true);
  };
  function KotlinxSerializationConverter$deserialize$o$collect$slambda($$this$unsafeFlow, $charset, $typeInfo, $content, resultContinuation) {
    this.b6b_1 = $$this$unsafeFlow;
    this.c6b_1 = $charset;
    this.d6b_1 = $typeInfo;
    this.e6b_1 = $content;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(KotlinxSerializationConverter$deserialize$o$collect$slambda).i3h = function (value, $completion) {
    var tmp = this.j3h(value, $completion);
    tmp.g9_1 = Unit_instance;
    tmp.h9_1 = null;
    return tmp.m9();
  };
  protoOf(KotlinxSerializationConverter$deserialize$o$collect$slambda).z9 = function (p1, $completion) {
    return this.i3h(p1, $completion);
  };
  protoOf(KotlinxSerializationConverter$deserialize$o$collect$slambda).m9 = function () {
    var suspendResult = this.g9_1;
    $sm: do
      try {
        var tmp = this.e9_1;
        switch (tmp) {
          case 0:
            this.f9_1 = 3;
            var tmp0 = this.b6b_1;
            var tmp2 = this.f6b_1;
            this.g6b_1 = tmp0;
            this.e9_1 = 1;
            suspendResult = tmp2.x4y(this.c6b_1, this.d6b_1, this.e6b_1, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            var ARGUMENT = suspendResult;
            this.e9_1 = 2;
            suspendResult = this.g6b_1.k3c(ARGUMENT, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 2:
            return Unit_instance;
          case 3:
            throw this.h9_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.f9_1 === 3) {
          throw e;
        } else {
          this.e9_1 = this.f9_1;
          this.h9_1 = e;
        }
      }
     while (true);
  };
  protoOf(KotlinxSerializationConverter$deserialize$o$collect$slambda).j3h = function (value, completion) {
    var i = new KotlinxSerializationConverter$deserialize$o$collect$slambda(this.b6b_1, this.c6b_1, this.d6b_1, this.e6b_1, completion);
    i.f6b_1 = value;
    return i;
  };
  function KotlinxSerializationConverter$deserialize$o$collect$slambda_0($$this$unsafeFlow, $charset, $typeInfo, $content, resultContinuation) {
    var i = new KotlinxSerializationConverter$deserialize$o$collect$slambda($$this$unsafeFlow, $charset, $typeInfo, $content, resultContinuation);
    var l = function (value, $completion) {
      return i.i3h(value, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function $collectCOROUTINE$_0(_this__u8e3s4, collector, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.p6b_1 = _this__u8e3s4;
    this.q6b_1 = collector;
  }
  protoOf($collectCOROUTINE$_0).m9 = function () {
    var suspendResult = this.g9_1;
    $sm: do
      try {
        var tmp = this.e9_1;
        switch (tmp) {
          case 0:
            this.f9_1 = 2;
            var $this$unsafeFlow = this.q6b_1;
            this.e9_1 = 1;
            var tmp_0 = KotlinxSerializationConverter$deserialize$o$collect$slambda_0($this$unsafeFlow, this.p6b_1.s6b_1, this.p6b_1.t6b_1, this.p6b_1.u6b_1, null);
            suspendResult = this.p6b_1.r6b_1.v3b(new sam$kotlinx_coroutines_flow_FlowCollector$0_0(tmp_0), this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            return Unit_instance;
          case 2:
            throw this.h9_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.f9_1 === 2) {
          throw e;
        } else {
          this.e9_1 = this.f9_1;
          this.h9_1 = e;
        }
      }
     while (true);
  };
  function serializeContent($this, serializer, format, value, contentType, charset) {
    var tmp;
    if (isInterface(format, StringFormat)) {
      var content = format.yv(isInterface(serializer, KSerializer) ? serializer : THROW_CCE(), value);
      tmp = new TextContent(content, withCharsetIfNeeded(contentType, charset));
    } else {
      if (isInterface(format, BinaryFormat)) {
        var content_0 = format.aw(isInterface(serializer, KSerializer) ? serializer : THROW_CCE(), value);
        tmp = new ByteArrayContent(content_0, contentType);
      } else {
        // Inline function 'kotlin.error' call
        var message = 'Unsupported format ' + toString(format);
        throw IllegalStateException_init_$Create$(toString(message));
      }
    }
    return tmp;
  }
  function sam$kotlinx_coroutines_flow_FlowCollector$0(function_0) {
    this.v6b_1 = function_0;
  }
  protoOf(sam$kotlinx_coroutines_flow_FlowCollector$0).k3c = function (value, $completion) {
    return this.v6b_1(value, $completion);
  };
  protoOf(sam$kotlinx_coroutines_flow_FlowCollector$0).o3 = function () {
    return this.v6b_1;
  };
  protoOf(sam$kotlinx_coroutines_flow_FlowCollector$0).equals = function (other) {
    var tmp;
    if (!(other == null) ? isInterface(other, FlowCollector) : 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$kotlinx_coroutines_flow_FlowCollector$0).hashCode = function () {
    return hashCode(this.o3());
  };
  function sam$kotlinx_coroutines_flow_FlowCollector$0_0(function_0) {
    this.w6b_1 = function_0;
  }
  protoOf(sam$kotlinx_coroutines_flow_FlowCollector$0_0).k3c = function (value, $completion) {
    return this.w6b_1(value, $completion);
  };
  protoOf(sam$kotlinx_coroutines_flow_FlowCollector$0_0).o3 = function () {
    return this.w6b_1;
  };
  protoOf(sam$kotlinx_coroutines_flow_FlowCollector$0_0).equals = function (other) {
    var tmp;
    if (!(other == null) ? isInterface(other, FlowCollector) : 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$kotlinx_coroutines_flow_FlowCollector$0_0).hashCode = function () {
    return hashCode(this.o3());
  };
  function KotlinxSerializationConverter$serialize$$inlined$map$1($this, $contentType, $charset, $typeInfo, $value) {
    this.o6a_1 = $this;
    this.p6a_1 = $contentType;
    this.q6a_1 = $charset;
    this.r6a_1 = $typeInfo;
    this.s6a_1 = $value;
  }
  protoOf(KotlinxSerializationConverter$serialize$$inlined$map$1).l3c = function (collector, $completion) {
    var tmp = new $collectCOROUTINE$(this, collector, $completion);
    tmp.g9_1 = Unit_instance;
    tmp.h9_1 = null;
    return tmp.m9();
  };
  protoOf(KotlinxSerializationConverter$serialize$$inlined$map$1).v3b = function (collector, $completion) {
    return this.l3c(collector, $completion);
  };
  function KotlinxSerializationConverter$serialize$slambda(resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(KotlinxSerializationConverter$serialize$slambda).g6c = function (it, $completion) {
    var tmp = this.h6c(it, $completion);
    tmp.g9_1 = Unit_instance;
    tmp.h9_1 = null;
    return tmp.m9();
  };
  protoOf(KotlinxSerializationConverter$serialize$slambda).z9 = function (p1, $completion) {
    return this.g6c((p1 == null ? true : p1 instanceof OutgoingContent) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(KotlinxSerializationConverter$serialize$slambda).m9 = function () {
    var suspendResult = this.g9_1;
    $sm: do
      try {
        var tmp = this.e9_1;
        if (tmp === 0) {
          this.f9_1 = 1;
          return !(this.f6c_1 == null);
        } else if (tmp === 1) {
          throw this.h9_1;
        }
      } catch ($p) {
        var e = $p;
        throw e;
      }
     while (true);
  };
  protoOf(KotlinxSerializationConverter$serialize$slambda).h6c = function (it, completion) {
    var i = new KotlinxSerializationConverter$serialize$slambda(completion);
    i.f6c_1 = it;
    return i;
  };
  function KotlinxSerializationConverter$serialize$slambda_0(resultContinuation) {
    var i = new KotlinxSerializationConverter$serialize$slambda(resultContinuation);
    var l = function (it, $completion) {
      return i.g6c(it, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function KotlinxSerializationConverter$deserialize$$inlined$map$1($this, $charset, $typeInfo, $content) {
    this.r6b_1 = $this;
    this.s6b_1 = $charset;
    this.t6b_1 = $typeInfo;
    this.u6b_1 = $content;
  }
  protoOf(KotlinxSerializationConverter$deserialize$$inlined$map$1).l3c = function (collector, $completion) {
    var tmp = new $collectCOROUTINE$_0(this, collector, $completion);
    tmp.g9_1 = Unit_instance;
    tmp.h9_1 = null;
    return tmp.m9();
  };
  protoOf(KotlinxSerializationConverter$deserialize$$inlined$map$1).v3b = function (collector, $completion) {
    return this.l3c(collector, $completion);
  };
  function KotlinxSerializationConverter$deserialize$slambda($content, resultContinuation) {
    this.q6c_1 = $content;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(KotlinxSerializationConverter$deserialize$slambda).w4z = function (it, $completion) {
    var tmp = this.j3h(it, $completion);
    tmp.g9_1 = Unit_instance;
    tmp.h9_1 = null;
    return tmp.m9();
  };
  protoOf(KotlinxSerializationConverter$deserialize$slambda).z9 = function (p1, $completion) {
    return this.w4z(p1, $completion);
  };
  protoOf(KotlinxSerializationConverter$deserialize$slambda).m9 = function () {
    var suspendResult = this.g9_1;
    $sm: do
      try {
        var tmp = this.e9_1;
        if (tmp === 0) {
          this.f9_1 = 1;
          return !(this.r6c_1 == null) || this.q6c_1.x3o();
        } else if (tmp === 1) {
          throw this.h9_1;
        }
      } catch ($p) {
        var e = $p;
        throw e;
      }
     while (true);
  };
  protoOf(KotlinxSerializationConverter$deserialize$slambda).j3h = function (it, completion) {
    var i = new KotlinxSerializationConverter$deserialize$slambda(this.q6c_1, completion);
    i.r6c_1 = it;
    return i;
  };
  function KotlinxSerializationConverter$deserialize$slambda_0($content, resultContinuation) {
    var i = new KotlinxSerializationConverter$deserialize$slambda($content, resultContinuation);
    var l = function (it, $completion) {
      return i.w4z(it, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function $serializeCOROUTINE$(_this__u8e3s4, contentType, charset, typeInfo, value, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.a6d_1 = _this__u8e3s4;
    this.b6d_1 = contentType;
    this.c6d_1 = charset;
    this.d6d_1 = typeInfo;
    this.e6d_1 = value;
  }
  protoOf($serializeCOROUTINE$).m9 = function () {
    var suspendResult = this.g9_1;
    $sm: do
      try {
        var tmp = this.e9_1;
        switch (tmp) {
          case 0:
            this.f9_1 = 2;
            this.e9_1 = 1;
            var this_0 = asFlow(this.a6d_1.g6d_1);
            var tmp_0 = new KotlinxSerializationConverter$serialize$$inlined$map$1(this_0, this.b6d_1, this.c6d_1, this.d6d_1, this.e6d_1);
            suspendResult = firstOrNull(tmp_0, KotlinxSerializationConverter$serialize$slambda_0(null), this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            var fromExtension = suspendResult;
            if (!(fromExtension == null))
              return fromExtension;
            var tmp_1;
            try {
              tmp_1 = serializerForTypeInfo(this.a6d_1.f6d_1.zy(), this.d6d_1);
            } catch ($p) {
              var tmp_2;
              if ($p instanceof SerializationException) {
                var cause = $p;
                tmp_2 = guessSerializer(this.e6d_1, this.a6d_1.f6d_1.zy());
              } else {
                throw $p;
              }
              tmp_1 = tmp_2;
            }

            var serializer = tmp_1;
            return serializeContent(this.a6d_1, serializer, this.a6d_1.f6d_1, this.e6d_1, this.b6d_1, this.c6d_1);
          case 2:
            throw this.h9_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.f9_1 === 2) {
          throw e;
        } else {
          this.e9_1 = this.f9_1;
          this.h9_1 = e;
        }
      }
     while (true);
  };
  function $deserializeCOROUTINE$(_this__u8e3s4, charset, typeInfo, content, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.p6d_1 = _this__u8e3s4;
    this.q6d_1 = charset;
    this.r6d_1 = typeInfo;
    this.s6d_1 = content;
  }
  protoOf($deserializeCOROUTINE$).m9 = function () {
    var suspendResult = this.g9_1;
    $sm: do
      try {
        var tmp = this.e9_1;
        switch (tmp) {
          case 0:
            this.f9_1 = 4;
            this.e9_1 = 1;
            var this_0 = asFlow(this.p6d_1.g6d_1);
            var tmp_0 = new KotlinxSerializationConverter$deserialize$$inlined$map$1(this_0, this.q6d_1, this.r6d_1, this.s6d_1);
            suspendResult = firstOrNull(tmp_0, KotlinxSerializationConverter$deserialize$slambda_0(this.s6d_1, null), this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            var fromExtension = suspendResult;
            var tmp_1;
            if (!this.p6d_1.g6d_1.r()) {
              tmp_1 = !(fromExtension == null) || this.s6d_1.x3o();
            } else {
              tmp_1 = false;
            }

            if (tmp_1)
              return fromExtension;
            this.t6d_1 = serializerForTypeInfo(this.p6d_1.f6d_1.zy(), this.r6d_1);
            this.e9_1 = 2;
            suspendResult = readRemaining(this.s6d_1, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 2:
            var contentPacket = suspendResult;
            this.f9_1 = 3;
            var tmp0_subject = this.p6d_1.f6d_1;
            var tmp_2;
            if (isInterface(tmp0_subject, StringFormat)) {
              tmp_2 = this.p6d_1.f6d_1.zv(this.t6d_1, readText(contentPacket, this.q6d_1));
            } else {
              if (isInterface(tmp0_subject, BinaryFormat)) {
                tmp_2 = this.p6d_1.f6d_1.bw(this.t6d_1, readByteArray(contentPacket));
              } else {
                discard(contentPacket);
                var message = 'Unsupported format ' + toString(this.p6d_1.f6d_1);
                throw IllegalStateException_init_$Create$(toString(message));
              }
            }

            return tmp_2;
          case 3:
            this.f9_1 = 4;
            var tmp_3 = this.h9_1;
            if (tmp_3 instanceof Error) {
              var cause = this.h9_1;
              throw new JsonConvertException('Illegal input: ' + cause.message, cause);
            } else {
              throw this.h9_1;
            }

          case 4:
            throw this.h9_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.f9_1 === 4) {
          throw e;
        } else {
          this.e9_1 = this.f9_1;
          this.h9_1 = e;
        }
      }
     while (true);
  };
  function KotlinxSerializationConverter(format) {
    this.f6d_1 = format;
    this.g6d_1 = extensions(this.f6d_1);
    var tmp;
    var tmp_0 = this.f6d_1;
    if (isInterface(tmp_0, BinaryFormat)) {
      tmp = true;
    } else {
      var tmp_1 = this.f6d_1;
      tmp = isInterface(tmp_1, StringFormat);
    }
    // Inline function 'kotlin.require' call
    if (!tmp) {
      var message = 'Only binary and string formats are supported, ' + toString(this.f6d_1) + ' is not supported.';
      throw IllegalArgumentException_init_$Create$(toString(message));
    }
  }
  protoOf(KotlinxSerializationConverter).u6d = function (contentType, charset, typeInfo, value, $completion) {
    var tmp = new $serializeCOROUTINE$(this, contentType, charset, typeInfo, value, $completion);
    tmp.g9_1 = Unit_instance;
    tmp.h9_1 = null;
    return tmp.m9();
  };
  protoOf(KotlinxSerializationConverter).n69 = function (contentType, charset, typeInfo, value, $completion) {
    return this.u6d(contentType, charset, typeInfo, value, $completion);
  };
  protoOf(KotlinxSerializationConverter).x4y = function (charset, typeInfo, content, $completion) {
    var tmp = new $deserializeCOROUTINE$(this, charset, typeInfo, content, $completion);
    tmp.g9_1 = Unit_instance;
    tmp.h9_1 = null;
    return tmp.m9();
  };
  function serializerForTypeInfo(_this__u8e3s4, typeInfo) {
    var module_0 = _this__u8e3s4;
    var tmp0_safe_receiver = typeInfo.n45_1;
    var tmp;
    if (tmp0_safe_receiver == null) {
      tmp = null;
    } else {
      // Inline function 'kotlin.let' call
      var tmp_0;
      if (tmp0_safe_receiver.k().r()) {
        tmp_0 = null;
      } else {
        var tmp0_elvis_lhs = serializerOrNull(module_0, tmp0_safe_receiver);
        tmp_0 = tmp0_elvis_lhs == null ? checkTypeParameters(tmp0_safe_receiver, typeInfo, module_0) : tmp0_elvis_lhs;
      }
      tmp = tmp_0;
    }
    var tmp1_elvis_lhs = tmp;
    var tmp_1;
    if (tmp1_elvis_lhs == null) {
      var tmp2_safe_receiver = module_0.gw(typeInfo.m45_1);
      tmp_1 = tmp2_safe_receiver == null ? null : maybeNullable(tmp2_safe_receiver, typeInfo);
    } else {
      tmp_1 = tmp1_elvis_lhs;
    }
    var tmp3_elvis_lhs = tmp_1;
    return tmp3_elvis_lhs == null ? maybeNullable(serializer(typeInfo.m45_1), typeInfo) : tmp3_elvis_lhs;
  }
  function guessSerializer(value, module_0) {
    var tmp;
    if (value == null) {
      tmp = get_nullable(serializer_0(StringCompanionObject_instance));
    } else {
      if (isInterface(value, KtList)) {
        tmp = ListSerializer(elementSerializer(value, module_0));
      } else {
        if (isArray(value)) {
          var tmp1_safe_receiver = firstOrNull_0(value);
          var tmp_0;
          if (tmp1_safe_receiver == null) {
            tmp_0 = null;
          } else {
            // Inline function 'kotlin.let' call
            tmp_0 = guessSerializer(tmp1_safe_receiver, module_0);
          }
          var tmp2_elvis_lhs = tmp_0;
          tmp = tmp2_elvis_lhs == null ? ListSerializer(serializer_0(StringCompanionObject_instance)) : tmp2_elvis_lhs;
        } else {
          if (isInterface(value, KtSet)) {
            tmp = SetSerializer(elementSerializer(value, module_0));
          } else {
            if (isInterface(value, KtMap)) {
              var keySerializer = elementSerializer(value.y2(), module_0);
              var valueSerializer = elementSerializer(value.z2(), module_0);
              tmp = MapSerializer(keySerializer, valueSerializer);
            } else {
              var tmp3_elvis_lhs = module_0.gw(getKClassFromExpression(value));
              tmp = tmp3_elvis_lhs == null ? serializer(getKClassFromExpression(value)) : tmp3_elvis_lhs;
            }
          }
        }
      }
    }
    var tmp_1 = tmp;
    return isInterface(tmp_1, KSerializer) ? tmp_1 : THROW_CCE();
  }
  function checkTypeParameters(type, typeInfo, module_0) {
    // Inline function 'kotlin.collections.mapNotNull' call
    var tmp0 = type.k();
    // Inline function 'kotlin.collections.mapNotNullTo' call
    var destination = ArrayList_init_$Create$();
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s = tmp0.t();
    while (_iterator__ex2g4s.u()) {
      var element = _iterator__ex2g4s.v();
      var tmp;
      try {
        var tmp0_safe_receiver = element.qn_1;
        var tmp_0;
        if (tmp0_safe_receiver == null) {
          tmp_0 = null;
        } else {
          // Inline function 'kotlin.takeIf' call
          var tmp_1;
          if (serializerOrNull(module_0, tmp0_safe_receiver) == null) {
            tmp_1 = tmp0_safe_receiver;
          } else {
            tmp_1 = null;
          }
          tmp_0 = tmp_1;
        }
        tmp = tmp_0;
      } catch ($p) {
        var tmp_2;
        if ($p instanceof Exception) {
          var _unused_var__etf5q3 = $p;
          return null;
        } else {
          throw $p;
        }
      }
      if (tmp == null)
        null;
      else {
        // Inline function 'kotlin.let' call
        destination.e1(tmp);
      }
    }
    var nonSerializableArgs = destination;
    if (nonSerializableArgs.r())
      return null;
    var argNames = joinToString(nonSerializableArgs, VOID, VOID, VOID, VOID, VOID, checkTypeParameters$lambda);
    var tmp_3;
    if (nonSerializableArgs.i1() === 1) {
      tmp_3 = to('', 'is');
    } else {
      tmp_3 = to('s', 'are');
    }
    var _destruct__k2r9zo = tmp_3;
    var s = _destruct__k2r9zo.lh();
    var be = _destruct__k2r9zo.mh();
    throw SerializationException_init_$Create$('Serializer for type argument' + s + ' ' + argNames + ' ' + be + " not found for '" + typeInfo.m45_1.o() + "'. " + ('Ensure that the listed type' + s + ' ' + be + " marked as '@Serializable'."));
  }
  function maybeNullable(_this__u8e3s4, typeInfo) {
    var tmp;
    var tmp0_safe_receiver = typeInfo.n45_1;
    if ((tmp0_safe_receiver == null ? null : tmp0_safe_receiver.l()) === true) {
      tmp = get_nullable(_this__u8e3s4);
    } else {
      tmp = _this__u8e3s4;
    }
    return tmp;
  }
  function elementSerializer(_this__u8e3s4, module_0) {
    // Inline function 'kotlin.collections.map' call
    var this_0 = filterNotNull(_this__u8e3s4);
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
    var _iterator__ex2g4s = this_0.t();
    while (_iterator__ex2g4s.u()) {
      var item = _iterator__ex2g4s.v();
      var tmp$ret$2 = guessSerializer(item, module_0);
      destination.e1(tmp$ret$2);
    }
    // Inline function 'kotlin.collections.distinctBy' call
    var set = HashSet_init_$Create$();
    var list = ArrayList_init_$Create$();
    var _iterator__ex2g4s_0 = destination.t();
    while (_iterator__ex2g4s_0.u()) {
      var e = _iterator__ex2g4s_0.v();
      var key = e.vu().wv();
      if (set.e1(key)) {
        list.e1(e);
      }
    }
    var serializers = list;
    if (serializers.i1() > 1) {
      // Inline function 'kotlin.collections.map' call
      // Inline function 'kotlin.collections.mapTo' call
      var destination_0 = ArrayList_init_$Create$_0(collectionSizeOrDefault(serializers, 10));
      var _iterator__ex2g4s_1 = serializers.t();
      while (_iterator__ex2g4s_1.u()) {
        var item_0 = _iterator__ex2g4s_1.v();
        var tmp$ret$7 = item_0.vu().wv();
        destination_0.e1(tmp$ret$7);
      }
      // Inline function 'kotlin.error' call
      var message = 'Serializing collections of different element types is not yet supported. ' + ('Selected serializers: ' + toString(destination_0));
      throw IllegalStateException_init_$Create$(toString(message));
    }
    var tmp0_elvis_lhs = singleOrNull(serializers);
    var selected = tmp0_elvis_lhs == null ? serializer_0(StringCompanionObject_instance) : tmp0_elvis_lhs;
    if (selected.vu().kw()) {
      return selected;
    }
    if (!isInterface(selected, KSerializer))
      THROW_CCE();
    var tmp$ret$9;
    $l$block_0: {
      // Inline function 'kotlin.collections.any' call
      var tmp;
      if (isInterface(_this__u8e3s4, Collection)) {
        tmp = _this__u8e3s4.r();
      } else {
        tmp = false;
      }
      if (tmp) {
        tmp$ret$9 = false;
        break $l$block_0;
      }
      var _iterator__ex2g4s_2 = _this__u8e3s4.t();
      while (_iterator__ex2g4s_2.u()) {
        var element = _iterator__ex2g4s_2.v();
        if (element == null) {
          tmp$ret$9 = true;
          break $l$block_0;
        }
      }
      tmp$ret$9 = false;
    }
    if (tmp$ret$9) {
      return get_nullable(selected);
    }
    return selected;
  }
  function checkTypeParameters$lambda(it) {
    var clz = it.j();
    var tmp;
    if (!(clz == null) ? isInterface(clz, KClass) : false) {
      tmp = "'" + clz.o() + "'";
    } else {
      tmp = "'" + toString(it) + "'";
    }
    return tmp;
  }
  function get_providers() {
    return emptyList();
  }
  //region block: exports
  _.$_$ = _.$_$ || {};
  _.$_$.a = serialization;
  //endregion
  return _;
}(module.exports, require('./kotlin-kotlin-stdlib.js'), require('./kotlinx-serialization-kotlinx-serialization-core.js'), require('./ktor-ktor-http.js'), require('./kotlinx-coroutines-core.js'), require('./ktor-ktor-io.js'), require('./kotlinx-io-kotlinx-io-core.js'), require('./ktor-ktor-serialization.js')));

//# sourceMappingURL=ktor-ktor-serialization-kotlinx.js.map
