(function (_, kotlin_kotlin, kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core, kotlin_io_ktor_ktor_client_core, kotlin_io_ktor_ktor_http, kotlin_io_ktor_ktor_utils, kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core) {
  'use strict';
  //region block: imports
  var imul = Math.imul;
  var protoOf = kotlin_kotlin.$_$.dg;
  var objectMeta = kotlin_kotlin.$_$.cg;
  var setMetadataFor = kotlin_kotlin.$_$.eg;
  var interfaceMeta = kotlin_kotlin.$_$.ef;
  var lazy = kotlin_kotlin.$_$.un;
  var classMeta = kotlin_kotlin.$_$.oe;
  var VOID = kotlin_kotlin.$_$.g;
  var KProperty1 = kotlin_kotlin.$_$.nh;
  var getPropertyCallableRef = kotlin_kotlin.$_$.af;
  var CoroutineImpl = kotlin_kotlin.$_$.td;
  var Unit_getInstance = kotlin_kotlin.$_$.i6;
  var THROW_CCE = kotlin_kotlin.$_$.rm;
  var FlowCollector = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.l1;
  var isInterface = kotlin_kotlin.$_$.nf;
  var HttpRequestBuilder = kotlin_io_ktor_ktor_client_core.$_$.k;
  var url = kotlin_io_ktor_ktor_client_core.$_$.o;
  var Companion_getInstance = kotlin_io_ktor_ktor_http.$_$.k;
  var HttpStatement = kotlin_io_ktor_ktor_client_core.$_$.r;
  var get_COROUTINE_SUSPENDED = kotlin_kotlin.$_$.ed;
  var JsType_getInstance = kotlin_io_ktor_ktor_utils.$_$.b;
  var List = kotlin_kotlin.$_$.b7;
  var getKClass = kotlin_kotlin.$_$.e;
  var arrayOf = kotlin_kotlin.$_$.gn;
  var createKType = kotlin_kotlin.$_$.b;
  var createInvariantKTypeProjection = kotlin_kotlin.$_$.a;
  var typeInfoImpl = kotlin_io_ktor_ktor_utils.$_$.k;
  var emptyList = kotlin_kotlin.$_$.f9;
  var Exception = kotlin_kotlin.$_$.fm;
  var flow = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.y1;
  var IllegalStateException_init_$Create$ = kotlin_kotlin.$_$.m2;
  var SuspendFunction1 = kotlin_kotlin.$_$.vd;
  var PluginGeneratedSerialDescriptor = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.z2;
  var StringSerializer_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.x;
  var LongSerializer_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.w;
  var Long = kotlin_kotlin.$_$.jm;
  var UnknownFieldException_init_$Create$ = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.g;
  var typeParametersSerializers = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.t2;
  var GeneratedSerializer = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.u2;
  var throwMissingFieldException = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.e3;
  var objectCreate = kotlin_kotlin.$_$.bg;
  var getStringHashCode = kotlin_kotlin.$_$.bf;
  //endregion
  //region block: pre-declaration
  setMetadataFor(Companion, 'Companion', objectMeta);
  setMetadataFor(CentralAppConfigDbDataSource, 'CentralAppConfigDbDataSource', interfaceMeta);
  setMetadataFor(Companion_0, 'Companion', objectMeta);
  setMetadataFor(LearningSpaceDataSource, 'LearningSpaceDataSource', interfaceMeta);
  setMetadataFor(CentralAppConfigDbDataSourceHttp, 'CentralAppConfigDbDataSourceHttp', classMeta, VOID, [CentralAppConfigDbDataSource]);
  setMetadataFor(LearningSpaceDataSourceHttp$getAll$slambda, 'LearningSpaceDataSourceHttp$getAll$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]);
  setMetadataFor(LearningSpaceDataSourceHttp, 'LearningSpaceDataSourceHttp', classMeta, VOID, [LearningSpaceDataSource]);
  setMetadataFor(Companion_1, 'Companion', objectMeta);
  setMetadataFor($serializer, '$serializer', objectMeta, VOID, [GeneratedSerializer]);
  setMetadataFor(LearningSpaceInfo, 'LearningSpaceInfo', classMeta, VOID, VOID, VOID, VOID, {0: $serializer_getInstance});
  //endregion
  function Companion() {
    Companion_instance = this;
    this.PATH_1 = 'centralappconfig';
  }
  protoOf(Companion).get_PATH_wo74oe_k$ = function () {
    return this.PATH_1;
  };
  var Companion_instance;
  function Companion_getInstance_0() {
    if (Companion_instance == null)
      new Companion();
    return Companion_instance;
  }
  function CentralAppConfigDbDataSource() {
  }
  function Companion_0() {
    Companion_instance_0 = this;
    this.PATH_1 = 'learningspace';
  }
  protoOf(Companion_0).get_PATH_wo74oe_k$ = function () {
    return this.PATH_1;
  };
  var Companion_instance_0;
  function Companion_getInstance_1() {
    if (Companion_instance_0 == null)
      new Companion_0();
    return Companion_instance_0;
  }
  function LearningSpaceDataSource() {
  }
  function _get_url__e6i4g2($this) {
    return $this.url_1;
  }
  function _get_httpClient__2ty1zc($this) {
    return $this.httpClient_1;
  }
  function CentralAppConfigDbDataSourceHttp$learningSpaceDataSource$delegate$lambda(this$0) {
    return function () {
      return new LearningSpaceDataSourceHttp(this$0.url_1 + Companion_getInstance_1().get_PATH_wo74oe_k$() + '/', this$0.httpClient_1);
    };
  }
  function CentralAppConfigDbDataSourceHttp(url, httpClient) {
    this.url_1 = url;
    this.httpClient_1 = httpClient;
    var tmp = this;
    tmp.learningSpaceDataSource$delegate_1 = lazy(CentralAppConfigDbDataSourceHttp$learningSpaceDataSource$delegate$lambda(this));
  }
  protoOf(CentralAppConfigDbDataSourceHttp).get_learningSpaceDataSource_k2iy1o_k$ = function () {
    // Inline function 'kotlin.getValue' call
    var this_0 = this.learningSpaceDataSource$delegate_1;
    learningSpaceDataSource$factory();
    return this_0.get_value_j01efc_k$();
  };
  function learningSpaceDataSource$factory() {
    return getPropertyCallableRef('learningSpaceDataSource', 1, KProperty1, function (receiver) {
      return receiver.get_learningSpaceDataSource_k2iy1o_k$();
    }, null);
  }
  function _get_url__e6i4g2_0($this) {
    return $this.url_1;
  }
  function _get_httpClient__2ty1zc_0($this) {
    return $this.httpClient_1;
  }
  function LearningSpaceDataSourceHttp$getAll$slambda(this$0, resultContinuation) {
    this.this$0__1 = this$0;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(LearningSpaceDataSourceHttp$getAll$slambda).invoke_ys2r4u_k$ = function ($this$flow, $completion) {
    var tmp = this.create_pvkwkq_k$($this$flow, $completion);
    tmp.set_result_xj64lm_k$(Unit_getInstance());
    tmp.set_exception_px07aa_k$(null);
    return tmp.doResume_5yljmg_k$();
  };
  protoOf(LearningSpaceDataSourceHttp$getAll$slambda).invoke_qns8j1_k$ = function (p1, $completion) {
    return this.invoke_ys2r4u_k$((!(p1 == null) ? isInterface(p1, FlowCollector) : false) ? p1 : THROW_CCE(), $completion);
  };
  protoOf(LearningSpaceDataSourceHttp$getAll$slambda).doResume_5yljmg_k$ = function () {
    var suspendResult = this.get_result_iyg5d2_k$();
    $sm: do
      try {
        var tmp = this.get_state_iypx7s_k$();
        switch (tmp) {
          case 0:
            this.set_exceptionState_fex74n_k$(7);
            this.set_exceptionState_fex74n_k$(4);
            var tmp_0 = this;
            tmp_0.this0__1 = this.this$0__1.httpClient_1;
            var tmp_1 = this;
            tmp_1.urlString1__1 = this.this$0__1.url_1 + 'getAll';
            var tmp_2 = this;
            tmp_2.this2__1 = this.this0__1;
            var tmp_3 = this;
            tmp_3.this3__1 = this.this2__1;
            var tmp_4 = this;
            var this_0 = new HttpRequestBuilder();
            url(this_0, this.urlString1__1);
            tmp_4.builder4__1 = this_0;
            this.builder4__1.set_method_hoo95u_k$(Companion_getInstance().get_Get_18jsxf_k$());
            var tmp_5 = this;
            tmp_5.this5__1 = this.this3__1;
            var tmp_6 = this;
            tmp_6.builder6__1 = this.builder4__1;
            this.set_state_rjd8d0_k$(1);
            suspendResult = (new HttpStatement(this.builder6__1, this.this5__1)).execute_rsj18j_k$(this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            this.this7__1 = suspendResult;
            this.set_state_rjd8d0_k$(2);
            var tmp_7 = this.this7__1.get_call_wojxrb_k$();
            var tmp_8 = JsType_getInstance();
            var tmp_9 = getKClass(List);
            var tmp_10;
            try {
              tmp_10 = createKType(getKClass(List), arrayOf([createInvariantKTypeProjection(createKType(getKClass(LearningSpaceInfo), arrayOf([]), false))]), false);
            } catch ($p) {
              var tmp_11;
              if ($p instanceof Error) {
                var cause = $p;
                tmp_11 = null;
              } else {
                throw $p;
              }
              tmp_10 = tmp_11;
            }

            suspendResult = tmp_7.bodyNullable_wn8z59_k$(typeInfoImpl(tmp_8, tmp_9, tmp_10), this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 2:
            var tmp_12 = this;
            tmp_12.learningSpaceInfos8__1 = (!(suspendResult == null) ? isInterface(suspendResult, List) : false) ? suspendResult : THROW_CCE();
            this.set_state_rjd8d0_k$(3);
            suspendResult = this.$this$flow_1.emit_t92u1f_k$(this.learningSpaceInfos8__1, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 3:
            this.set_exceptionState_fex74n_k$(7);
            this.set_state_rjd8d0_k$(6);
            continue $sm;
          case 4:
            this.set_exceptionState_fex74n_k$(7);
            var tmp_13 = this.get_exception_x0n6w6_k$();
            if (tmp_13 instanceof Exception) {
              this.e9__1 = this.get_exception_x0n6w6_k$();
              this.set_state_rjd8d0_k$(5);
              suspendResult = this.$this$flow_1.emit_t92u1f_k$(emptyList(), this);
              if (suspendResult === get_COROUTINE_SUSPENDED()) {
                return suspendResult;
              }
              continue $sm;
            } else {
              throw this.get_exception_x0n6w6_k$();
            }

          case 5:
            this.set_state_rjd8d0_k$(6);
            continue $sm;
          case 6:
            this.set_exceptionState_fex74n_k$(7);
            return Unit_getInstance();
          case 7:
            throw this.get_exception_x0n6w6_k$();
        }
      } catch ($p) {
        var e = $p;
        if (this.get_exceptionState_wflpxn_k$() === 7) {
          throw e;
        } else {
          this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$());
          this.set_exception_px07aa_k$(e);
        }
      }
     while (true);
  };
  protoOf(LearningSpaceDataSourceHttp$getAll$slambda).create_pvkwkq_k$ = function ($this$flow, completion) {
    var i = new LearningSpaceDataSourceHttp$getAll$slambda(this.this$0__1, completion);
    i.$this$flow_1 = $this$flow;
    return i;
  };
  protoOf(LearningSpaceDataSourceHttp$getAll$slambda).create_wyq9v6_k$ = function (value, completion) {
    return this.create_pvkwkq_k$((!(value == null) ? isInterface(value, FlowCollector) : false) ? value : THROW_CCE(), completion);
  };
  function LearningSpaceDataSourceHttp$getAll$slambda_0(this$0, resultContinuation) {
    var i = new LearningSpaceDataSourceHttp$getAll$slambda(this$0, resultContinuation);
    var l = function ($this$flow, $completion) {
      return i.invoke_ys2r4u_k$($this$flow, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function LearningSpaceDataSourceHttp(url, httpClient) {
    this.url_1 = url;
    this.httpClient_1 = httpClient;
  }
  protoOf(LearningSpaceDataSourceHttp).getAll_knua39_k$ = function () {
    return flow(LearningSpaceDataSourceHttp$getAll$slambda_0(this, null));
  };
  protoOf(LearningSpaceDataSourceHttp).upsertLearningSpaceInfo_g41xjm_k$ = function (learningSpaceInfo) {
    throw IllegalStateException_init_$Create$('Remote updates to learning space info NOT allowed');
  };
  function Companion_1() {
    Companion_instance_1 = this;
  }
  protoOf(Companion_1).serializer_9w0wvi_k$ = function () {
    return $serializer_getInstance();
  };
  var Companion_instance_1;
  function Companion_getInstance_2() {
    if (Companion_instance_1 == null)
      new Companion_1();
    return Companion_instance_1;
  }
  function $serializer() {
    $serializer_instance = this;
    var tmp0_serialDesc = new PluginGeneratedSerialDescriptor('com.ustadmobile.centralappconfigdb.model.LearningSpaceInfo', this, 4);
    tmp0_serialDesc.addElement_5pzumi_k$('url', false);
    tmp0_serialDesc.addElement_5pzumi_k$('name', false);
    tmp0_serialDesc.addElement_5pzumi_k$('description', false);
    tmp0_serialDesc.addElement_5pzumi_k$('lastModified', false);
    this.descriptor_1 = tmp0_serialDesc;
  }
  protoOf($serializer).get_descriptor_wjt6a0_k$ = function () {
    return this.descriptor_1;
  };
  protoOf($serializer).childSerializers_5ghqw5_k$ = function () {
    // Inline function 'kotlin.arrayOf' call
    // Inline function 'kotlin.js.unsafeCast' call
    // Inline function 'kotlin.js.asDynamic' call
    return [StringSerializer_getInstance(), StringSerializer_getInstance(), StringSerializer_getInstance(), LongSerializer_getInstance()];
  };
  protoOf($serializer).deserialize_sy6x50_k$ = function (decoder) {
    var tmp0_desc = this.descriptor_1;
    var tmp1_flag = true;
    var tmp2_index = 0;
    var tmp3_bitMask0 = 0;
    var tmp4_local0 = null;
    var tmp5_local1 = null;
    var tmp6_local2 = null;
    var tmp7_local3 = new Long(0, 0);
    var tmp8_input = decoder.beginStructure_yljocp_k$(tmp0_desc);
    if (tmp8_input.decodeSequentially_xlblqy_k$()) {
      tmp4_local0 = tmp8_input.decodeStringElement_3oenpg_k$(tmp0_desc, 0);
      tmp3_bitMask0 = tmp3_bitMask0 | 1;
      tmp5_local1 = tmp8_input.decodeStringElement_3oenpg_k$(tmp0_desc, 1);
      tmp3_bitMask0 = tmp3_bitMask0 | 2;
      tmp6_local2 = tmp8_input.decodeStringElement_3oenpg_k$(tmp0_desc, 2);
      tmp3_bitMask0 = tmp3_bitMask0 | 4;
      tmp7_local3 = tmp8_input.decodeLongElement_994anb_k$(tmp0_desc, 3);
      tmp3_bitMask0 = tmp3_bitMask0 | 8;
    } else
      while (tmp1_flag) {
        tmp2_index = tmp8_input.decodeElementIndex_bstkhp_k$(tmp0_desc);
        switch (tmp2_index) {
          case -1:
            tmp1_flag = false;
            break;
          case 0:
            tmp4_local0 = tmp8_input.decodeStringElement_3oenpg_k$(tmp0_desc, 0);
            tmp3_bitMask0 = tmp3_bitMask0 | 1;
            break;
          case 1:
            tmp5_local1 = tmp8_input.decodeStringElement_3oenpg_k$(tmp0_desc, 1);
            tmp3_bitMask0 = tmp3_bitMask0 | 2;
            break;
          case 2:
            tmp6_local2 = tmp8_input.decodeStringElement_3oenpg_k$(tmp0_desc, 2);
            tmp3_bitMask0 = tmp3_bitMask0 | 4;
            break;
          case 3:
            tmp7_local3 = tmp8_input.decodeLongElement_994anb_k$(tmp0_desc, 3);
            tmp3_bitMask0 = tmp3_bitMask0 | 8;
            break;
          default:
            throw UnknownFieldException_init_$Create$(tmp2_index);
        }
      }
    tmp8_input.endStructure_1xqz0n_k$(tmp0_desc);
    return LearningSpaceInfo_init_$Create$(tmp3_bitMask0, tmp4_local0, tmp5_local1, tmp6_local2, tmp7_local3, null);
  };
  protoOf($serializer).serialize_pi1j9u_k$ = function (encoder, value) {
    var tmp0_desc = this.descriptor_1;
    var tmp1_output = encoder.beginStructure_yljocp_k$(tmp0_desc);
    tmp1_output.encodeStringElement_1n5wu2_k$(tmp0_desc, 0, value.url_1);
    tmp1_output.encodeStringElement_1n5wu2_k$(tmp0_desc, 1, value.name_1);
    tmp1_output.encodeStringElement_1n5wu2_k$(tmp0_desc, 2, value.description_1);
    tmp1_output.encodeLongElement_cega27_k$(tmp0_desc, 3, value.lastModified_1);
    tmp1_output.endStructure_1xqz0n_k$(tmp0_desc);
  };
  protoOf($serializer).serialize_5ase3y_k$ = function (encoder, value) {
    return this.serialize_pi1j9u_k$(encoder, value instanceof LearningSpaceInfo ? value : THROW_CCE());
  };
  var $serializer_instance;
  function $serializer_getInstance() {
    if ($serializer_instance == null)
      new $serializer();
    return $serializer_instance;
  }
  function LearningSpaceInfo_init_$Init$(seen1, url, name, description, lastModified, serializationConstructorMarker, $this) {
    if (!(15 === (15 & seen1))) {
      throwMissingFieldException(seen1, 15, $serializer_getInstance().descriptor_1);
    }
    $this.url_1 = url;
    $this.name_1 = name;
    $this.description_1 = description;
    $this.lastModified_1 = lastModified;
    return $this;
  }
  function LearningSpaceInfo_init_$Create$(seen1, url, name, description, lastModified, serializationConstructorMarker) {
    return LearningSpaceInfo_init_$Init$(seen1, url, name, description, lastModified, serializationConstructorMarker, objectCreate(protoOf(LearningSpaceInfo)));
  }
  function LearningSpaceInfo(url, name, description, lastModified) {
    Companion_getInstance_2();
    this.url_1 = url;
    this.name_1 = name;
    this.description_1 = description;
    this.lastModified_1 = lastModified;
  }
  protoOf(LearningSpaceInfo).get_url_18iuii_k$ = function () {
    return this.url_1;
  };
  protoOf(LearningSpaceInfo).get_name_woqyms_k$ = function () {
    return this.name_1;
  };
  protoOf(LearningSpaceInfo).get_description_emjre5_k$ = function () {
    return this.description_1;
  };
  protoOf(LearningSpaceInfo).get_lastModified_y37iuw_k$ = function () {
    return this.lastModified_1;
  };
  protoOf(LearningSpaceInfo).component1_7eebsc_k$ = function () {
    return this.url_1;
  };
  protoOf(LearningSpaceInfo).component2_7eebsb_k$ = function () {
    return this.name_1;
  };
  protoOf(LearningSpaceInfo).component3_7eebsa_k$ = function () {
    return this.description_1;
  };
  protoOf(LearningSpaceInfo).component4_7eebs9_k$ = function () {
    return this.lastModified_1;
  };
  protoOf(LearningSpaceInfo).copy_rkanc9_k$ = function (url, name, description, lastModified) {
    return new LearningSpaceInfo(url, name, description, lastModified);
  };
  protoOf(LearningSpaceInfo).copy$default_vb9e5c_k$ = function (url, name, description, lastModified, $super) {
    url = url === VOID ? this.url_1 : url;
    name = name === VOID ? this.name_1 : name;
    description = description === VOID ? this.description_1 : description;
    lastModified = lastModified === VOID ? this.lastModified_1 : lastModified;
    return $super === VOID ? this.copy_rkanc9_k$(url, name, description, lastModified) : $super.copy_rkanc9_k$.call(this, url, name, description, lastModified);
  };
  protoOf(LearningSpaceInfo).toString = function () {
    return 'LearningSpaceInfo(url=' + this.url_1 + ', name=' + this.name_1 + ', description=' + this.description_1 + ', lastModified=' + this.lastModified_1.toString() + ')';
  };
  protoOf(LearningSpaceInfo).hashCode = function () {
    var result = getStringHashCode(this.url_1);
    result = imul(result, 31) + getStringHashCode(this.name_1) | 0;
    result = imul(result, 31) + getStringHashCode(this.description_1) | 0;
    result = imul(result, 31) + this.lastModified_1.hashCode() | 0;
    return result;
  };
  protoOf(LearningSpaceInfo).equals = function (other) {
    if (this === other)
      return true;
    if (!(other instanceof LearningSpaceInfo))
      return false;
    var tmp0_other_with_cast = other instanceof LearningSpaceInfo ? other : THROW_CCE();
    if (!(this.url_1 === tmp0_other_with_cast.url_1))
      return false;
    if (!(this.name_1 === tmp0_other_with_cast.name_1))
      return false;
    if (!(this.description_1 === tmp0_other_with_cast.description_1))
      return false;
    if (!this.lastModified_1.equals(tmp0_other_with_cast.lastModified_1))
      return false;
    return true;
  };
  //region block: post-declaration
  protoOf($serializer).typeParametersSerializers_fr94fx_k$ = typeParametersSerializers;
  //endregion
  //region block: exports
  _.$_$ = _.$_$ || {};
  _.$_$.a = CentralAppConfigDbDataSourceHttp;
  _.$_$.b = CentralAppConfigDbDataSource;
  _.$_$.c = Companion_getInstance_0;
  //endregion
  return _;
}(module.exports, require('./kotlin-kotlin-stdlib.js'), require('./kotlinx-coroutines-core.js'), require('./ktor-ktor-client-core.js'), require('./ktor-ktor-http.js'), require('./ktor-ktor-utils.js'), require('./kotlinx-serialization-kotlinx-serialization-core.js')));

//# sourceMappingURL=UstadMobile-lib-centralappconfigdb-common.js.map
