(function (_, kotlin_kotlin, kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core) {
  'use strict';
  //region block: imports
  var imul = Math.imul;
  var CoroutineImpl = kotlin_kotlin.$_$.ta;
  var Unit_instance = kotlin_kotlin.$_$.m5;
  var protoOf = kotlin_kotlin.$_$.uc;
  var THROW_CCE = kotlin_kotlin.$_$.fi;
  var SequenceScope = kotlin_kotlin.$_$.vd;
  var until = kotlin_kotlin.$_$.pd;
  var charSequenceLength = kotlin_kotlin.$_$.hb;
  var get_COROUTINE_SUSPENDED = kotlin_kotlin.$_$.fa;
  var classMeta = kotlin_kotlin.$_$.jb;
  var setMetadataFor = kotlin_kotlin.$_$.vc;
  var VOID = kotlin_kotlin.$_$.f;
  var ArrayList_init_$Create$ = kotlin_kotlin.$_$.m;
  var IllegalStateException_init_$Create$ = kotlin_kotlin.$_$.a2;
  var _Char___init__impl__6a9atx = kotlin_kotlin.$_$.u2;
  var sequence = kotlin_kotlin.$_$.je;
  var listOfNotNull = kotlin_kotlin.$_$.h8;
  var toString = kotlin_kotlin.$_$.zc;
  var IllegalArgumentException_init_$Create$ = kotlin_kotlin.$_$.u1;
  var StringBuilder_init_$Create$ = kotlin_kotlin.$_$.f1;
  var collectionSizeOrDefault = kotlin_kotlin.$_$.n6;
  var ArrayList_init_$Create$_0 = kotlin_kotlin.$_$.l;
  var ensureNotNull = kotlin_kotlin.$_$.yi;
  var equals = kotlin_kotlin.$_$.mb;
  var IndexOutOfBoundsException_init_$Create$ = kotlin_kotlin.$_$.d2;
  var objectCreate = kotlin_kotlin.$_$.sc;
  var emptyList = kotlin_kotlin.$_$.i7;
  var MutableList = kotlin_kotlin.$_$.z5;
  var isInterface = kotlin_kotlin.$_$.ec;
  var objectMeta = kotlin_kotlin.$_$.tc;
  var LinkedHashSet_init_$Create$ = kotlin_kotlin.$_$.x;
  var toList = kotlin_kotlin.$_$.r9;
  var asSequence = kotlin_kotlin.$_$.xd;
  var checkCountOverflow = kotlin_kotlin.$_$.k6;
  var isBlank = kotlin_kotlin.$_$.cf;
  var UnsupportedOperationException_init_$Create$ = kotlin_kotlin.$_$.r2;
  var indexOf = kotlin_kotlin.$_$.bf;
  var to = kotlin_kotlin.$_$.mj;
  var split = kotlin_kotlin.$_$.xf;
  var Enum = kotlin_kotlin.$_$.sh;
  var PrimitiveClasses_getInstance = kotlin_kotlin.$_$.c5;
  var arrayOf = kotlin_kotlin.$_$.ui;
  var createKType = kotlin_kotlin.$_$.b;
  var serializer = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.s3;
  var KSerializer = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.i3;
  var getKClass = kotlin_kotlin.$_$.e;
  var buildClassSerialDescriptor = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.u1;
  var Companion_instance = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.q;
  var throwUninitializedPropertyAccessException = kotlin_kotlin.$_$.kj;
  var interfaceMeta = kotlin_kotlin.$_$.vb;
  var asSequence_0 = kotlin_kotlin.$_$.i6;
  var plus = kotlin_kotlin.$_$.ge;
  var toList_0 = kotlin_kotlin.$_$.le;
  var StringCompanionObject_instance = kotlin_kotlin.$_$.a5;
  var serializer_0 = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.b1;
  var Iterator = kotlin_kotlin.$_$.t5;
  var getStringHashCode = kotlin_kotlin.$_$.tb;
  var flatMap = kotlin_kotlin.$_$.be;
  var fillArrayVal = kotlin_kotlin.$_$.ob;
  var Collection = kotlin_kotlin.$_$.p5;
  var ListSerializer = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.x;
  var SerialDescriptor = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.p1;
  var sequenceOf = kotlin_kotlin.$_$.ie;
  var reversed = kotlin_kotlin.$_$.nd;
  var firstOrNull = kotlin_kotlin.$_$.n7;
  var firstOrNull_0 = kotlin_kotlin.$_$.ae;
  var filter = kotlin_kotlin.$_$.zd;
  var map = kotlin_kotlin.$_$.fe;
  var IndexOutOfBoundsException_init_$Create$_0 = kotlin_kotlin.$_$.e2;
  var IndexOutOfBoundsException = kotlin_kotlin.$_$.xh;
  var contentEquals = kotlin_kotlin.$_$.q6;
  var contentHashCode = kotlin_kotlin.$_$.t6;
  var ArrayDeque_init_$Create$ = kotlin_kotlin.$_$.k;
  var NoSuchElementException_init_$Create$ = kotlin_kotlin.$_$.f2;
  var joinToString = kotlin_kotlin.$_$.a8;
  var getKClassFromExpression = kotlin_kotlin.$_$.d;
  var captureStack = kotlin_kotlin.$_$.db;
  var LinkedHashMap_init_$Create$ = kotlin_kotlin.$_$.v;
  var RuntimeException = kotlin_kotlin.$_$.ei;
  var charSequenceGet = kotlin_kotlin.$_$.gb;
  var charSequenceSubSequence = kotlin_kotlin.$_$.ib;
  var StringBuilder_init_$Create$_0 = kotlin_kotlin.$_$.e1;
  var arrayCopy = kotlin_kotlin.$_$.f6;
  var _UInt___init__impl__l7qpdl = kotlin_kotlin.$_$.q3;
  var UIntRange = kotlin_kotlin.$_$.fd;
  var UInt__compareTo_impl_yacclj = kotlin_kotlin.$_$.r3;
  var _UShort___init__impl__jigrne = kotlin_kotlin.$_$.j4;
  var _Char___init__impl__6a9atx_0 = kotlin_kotlin.$_$.v2;
  var _UInt___get_data__impl__f0vqqw = kotlin_kotlin.$_$.s3;
  var toShort = kotlin_kotlin.$_$.yc;
  var uintCompare = kotlin_kotlin.$_$.nj;
  var Char = kotlin_kotlin.$_$.nh;
  var Pair = kotlin_kotlin.$_$.ci;
  var toString_0 = kotlin_kotlin.$_$.xg;
  var isCharSequence = kotlin_kotlin.$_$.ac;
  var trimStart = kotlin_kotlin.$_$.gh;
  var Char__toInt_impl_vasixd = kotlin_kotlin.$_$.b3;
  var isHighSurrogate = kotlin_kotlin.$_$.ef;
  var UInt = kotlin_kotlin.$_$.mi;
  var copyOf = kotlin_kotlin.$_$.c7;
  var downTo = kotlin_kotlin.$_$.md;
  var copyOf_0 = kotlin_kotlin.$_$.d7;
  var getProgressionLastElement = kotlin_kotlin.$_$.ya;
  var joinToString_0 = kotlin_kotlin.$_$.z7;
  var booleanArray = kotlin_kotlin.$_$.cb;
  var NoSuchElementException_init_$Create$_0 = kotlin_kotlin.$_$.h2;
  var AssertionError_init_$Create$ = kotlin_kotlin.$_$.h1;
  var startsWith = kotlin_kotlin.$_$.yf;
  var Exception_init_$Init$ = kotlin_kotlin.$_$.l1;
  var Exception_init_$Init$_0 = kotlin_kotlin.$_$.m1;
  var Exception_init_$Init$_1 = kotlin_kotlin.$_$.o1;
  var Exception = kotlin_kotlin.$_$.uh;
  var get_js = kotlin_kotlin.$_$.ic;
  var hashCode = kotlin_kotlin.$_$.ub;
  var joinTo = kotlin_kotlin.$_$.b8;
  var HashSet_init_$Create$ = kotlin_kotlin.$_$.s;
  //endregion
  //region block: pre-declaration
  setMetadataFor(DomReader$_get_namespaceContext_$o$iterator$slambda_vvguk9, 'DomReader$<get-namespaceContext>$o$iterator$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]);
  function getPrefixes(namespaceURI) {
    return this.ck6(namespaceURI);
  }
  setMetadataFor(NamespaceContextImpl, 'NamespaceContextImpl', interfaceMeta);
  function freeze() {
    return SimpleNamespaceContext_init_$Create$_2(this);
  }
  function plus_0(secondary) {
    return SimpleNamespaceContext_init_$Create$_1(toList_0(plus(asSequence_0(this), asSequence_0(secondary))));
  }
  setMetadataFor(IterableNamespaceContext, 'IterableNamespaceContext', interfaceMeta, VOID, [NamespaceContextImpl]);
  setMetadataFor(DomReader$namespaceContext$1, VOID, classMeta, VOID, [IterableNamespaceContext]);
  function get_name() {
    return qname(this.fk6(), this.gk6(), this.hk6());
  }
  function require_0(type, namespace, name) {
    if (!this.ok6().equals(type))
      throw XmlException_init_$Create$_0('Type ' + this.ok6() + ' does not match expected type "' + type + '" (' + this.pk6() + ')');
    else if (!(namespace == null) ? !(this.fk6() === namespace) : false)
      throw XmlException_init_$Create$_0('Namespace ' + this.fk6() + ' does not match expected "' + namespace + '" (' + this.pk6() + ')');
    else if (!(name == null) ? !(this.gk6() === name) : false)
      throw XmlException_init_$Create$_0('local name ' + this.gk6() + ' does not match expected "' + name + '" (' + this.pk6() + ')');
  }
  function require_1(type, name) {
    var tmp;
    if (name == null) {
      tmp = null;
    } else {
      // Inline function 'nl.adaptivity.xmlutil.namespaceURI' call
      tmp = name.eka();
    }
    var tmp_0 = tmp;
    var tmp_1;
    if (name == null) {
      tmp_1 = null;
    } else {
      // Inline function 'nl.adaptivity.xmlutil.localPart' call
      tmp_1 = name.fka();
    }
    return this.yk6(type, tmp_0, tmp_1);
  }
  function getAttributeName(index) {
    return qname(this.uk6(index), this.wk6(index), this.vk6(index));
  }
  function getAttributeValue(name) {
    // Inline function 'nl.adaptivity.xmlutil.namespaceURI' call
    var tmp = name.eka();
    // Inline function 'nl.adaptivity.xmlutil.localPart' call
    var tmp$ret$1 = name.fka();
    return this.r7j(tmp, tmp$ret$1);
  }
  function isWhitespace() {
    return this.ok6() === EventType_IGNORABLE_WHITESPACE_getInstance() ? true : this.ok6() === EventType_TEXT_getInstance() ? isXmlWhitespace(this.mk6()) : false;
  }
  setMetadataFor(XmlReader, 'XmlReader', interfaceMeta, VOID, [Iterator]);
  setMetadataFor(DomReader, 'DomReader', classMeta, VOID, [XmlReader]);
  setMetadataFor(Companion, 'Companion', objectMeta);
  setMetadataFor(DomWriter$namespaceContext$1, VOID, classMeta, VOID, [NamespaceContextImpl]);
  function namespaceAttr(namespace) {
    this.zk7(namespace.hk6(), namespace.fk6());
  }
  function processingInstruction(target, data) {
    return this.vk7(target + ' ' + data);
  }
  function startDocument$default(version, encoding, standalone, $super) {
    version = version === VOID ? null : version;
    encoding = encoding === VOID ? null : encoding;
    standalone = standalone === VOID ? null : standalone;
    var tmp;
    if ($super === VOID) {
      this.fk8(version, encoding, standalone);
      tmp = Unit_instance;
    } else {
      tmp = $super.fk8.call(this, version, encoding, standalone);
    }
    return tmp;
  }
  setMetadataFor(XmlWriter, 'XmlWriter', interfaceMeta);
  setMetadataFor(PlatformXmlWriterBase, 'PlatformXmlWriterBase', classMeta, VOID, [XmlWriter]);
  setMetadataFor(DomWriter, 'DomWriter', classMeta, PlatformXmlWriterBase, [PlatformXmlWriterBase, XmlWriter], DomWriter_init_$Create$);
  setMetadataFor(EventType, 'EventType', classMeta, Enum);
  setMetadataFor(EventType$START_DOCUMENT, 'START_DOCUMENT', classMeta, EventType);
  setMetadataFor(EventType$START_ELEMENT, 'START_ELEMENT', classMeta, EventType);
  setMetadataFor(EventType$END_ELEMENT, 'END_ELEMENT', classMeta, EventType);
  setMetadataFor(EventType$COMMENT, 'COMMENT', classMeta, EventType);
  setMetadataFor(EventType$TEXT, 'TEXT', classMeta, EventType);
  setMetadataFor(EventType$CDSECT, 'CDSECT', classMeta, EventType);
  setMetadataFor(EventType$DOCDECL, 'DOCDECL', classMeta, EventType);
  setMetadataFor(EventType$END_DOCUMENT, 'END_DOCUMENT', classMeta, EventType);
  setMetadataFor(EventType$ENTITY_REF, 'ENTITY_REF', classMeta, EventType);
  setMetadataFor(EventType$IGNORABLE_WHITESPACE, 'IGNORABLE_WHITESPACE', classMeta, EventType);
  setMetadataFor(EventType$ATTRIBUTE, 'ATTRIBUTE', classMeta, EventType);
  setMetadataFor(EventType$PROCESSING_INSTRUCTION, 'PROCESSING_INSTRUCTION', classMeta, EventType);
  setMetadataFor(Companion_0, 'Companion', objectMeta, VOID, [KSerializer]);
  setMetadataFor(Namespace, 'Namespace', interfaceMeta);
  setMetadataFor(QNameSerializer, 'QNameSerializer', objectMeta, VOID, [KSerializer]);
  setMetadataFor(SimpleIterator, 'SimpleIterator', classMeta, VOID, [Iterator]);
  setMetadataFor(SimpleNamespace, 'SimpleNamespace', classMeta, VOID, [Namespace]);
  setMetadataFor(Companion_1, 'Companion', objectMeta, VOID, [KSerializer]);
  setMetadataFor(SimpleNamespaceContext, 'SimpleNamespaceContext', classMeta, VOID, [IterableNamespaceContext], SimpleNamespaceContext_init_$Create$, VOID, {0: Companion_getInstance_1});
  setMetadataFor(XMLConstants, 'XMLConstants', objectMeta);
  setMetadataFor(XmlBufferedReaderBase, 'XmlBufferedReaderBase', classMeta, VOID, [XmlReader]);
  setMetadataFor(XmlBufferedReader, 'XmlBufferedReader', classMeta, XmlBufferedReaderBase);
  setMetadataFor(XmlDelegatingReader, 'XmlDelegatingReader', classMeta, VOID, [XmlReader]);
  setMetadataFor(Companion_2, 'Companion', objectMeta);
  setMetadataFor(XmlEvent, 'XmlEvent', classMeta);
  setMetadataFor(TextEvent, 'TextEvent', classMeta, XmlEvent);
  setMetadataFor(ProcessingInstructionEvent, 'ProcessingInstructionEvent', classMeta, TextEvent);
  setMetadataFor(EntityRefEvent, 'EntityRefEvent', classMeta, TextEvent);
  setMetadataFor(EndDocumentEvent, 'EndDocumentEvent', classMeta, XmlEvent);
  setMetadataFor(NamedEvent, 'NamedEvent', classMeta, XmlEvent);
  setMetadataFor(EndElementEvent, 'EndElementEvent', classMeta, NamedEvent);
  setMetadataFor(StartDocumentEvent, 'StartDocumentEvent', classMeta, XmlEvent);
  setMetadataFor(StartElementEvent, 'StartElementEvent', classMeta, NamedEvent);
  setMetadataFor(Attribute, 'Attribute', classMeta, XmlEvent);
  setMetadataFor(NamespaceImpl, 'NamespaceImpl', classMeta, VOID, [Namespace]);
  setMetadataFor(IOException, 'IOException', classMeta, Exception, VOID, IOException_init_$Create$);
  setMetadataFor(XmlException, 'XmlException', classMeta, IOException, VOID, XmlException_init_$Create$);
  setMetadataFor(Companion_3, 'Companion', objectMeta);
  setMetadataFor(XmlDeclMode, 'XmlDeclMode', classMeta, Enum);
  setMetadataFor(EscapeMode, 'EscapeMode', classMeta, Enum);
  setMetadataFor(Companion_4, 'Companion', objectMeta);
  setMetadataFor(WriteState, 'WriteState', classMeta, Enum);
  setMetadataFor(KtXmlWriter, 'KtXmlWriter', classMeta, PlatformXmlWriterBase, [PlatformXmlWriterBase, XmlWriter]);
  setMetadataFor(asCodePoints$1$iterator$1, VOID, classMeta, VOID, [Iterator]);
  setMetadataFor(asCodePoints$1, VOID, classMeta);
  setMetadataFor(XmlVersion, 'XmlVersion', classMeta, Enum);
  setMetadataFor(NamespaceHolder$namespaceContext$1, VOID, classMeta, VOID, [IterableNamespaceContext]);
  setMetadataFor(NamespaceHolder$iterator$1, VOID, classMeta, VOID, [Iterator]);
  setMetadataFor(NamespaceHolder, 'NamespaceHolder', classMeta, VOID, VOID, NamespaceHolder);
  setMetadataFor(Companion_5, 'Companion', objectMeta);
  setMetadataFor(NamedNodeMapIterator, 'NamedNodeMapIterator', classMeta, VOID, [Iterator]);
  setMetadataFor(NodeConsts, 'NodeConsts', objectMeta);
  setMetadataFor(NodeListIterator, 'NodeListIterator', classMeta, VOID, [Iterator]);
  setMetadataFor(ICompactFragment, 'ICompactFragment', interfaceMeta);
  setMetadataFor(QName, 'QName', classMeta);
  setMetadataFor(XmlStreaming, 'XmlStreaming', objectMeta);
  setMetadataFor(WriterXmlWriter, 'WriterXmlWriter', classMeta, VOID, [XmlWriter]);
  setMetadataFor(Writer, 'Writer', classMeta);
  setMetadataFor(StringWriter, 'StringWriter', classMeta, Writer, VOID, StringWriter);
  setMetadataFor(Factory, 'Factory', classMeta, VOID, VOID, Factory);
  setMetadataFor(Companion_6, 'Companion', objectMeta);
  setMetadataFor(CompactFragment, 'CompactFragment', classMeta, VOID, [ICompactFragment]);
  setMetadataFor(FragmentNamespaceContext, 'FragmentNamespaceContext', classMeta, SimpleNamespaceContext);
  setMetadataFor(Companion_7, 'Companion', objectMeta);
  setMetadataFor(XMLFragmentStreamReader, 'XMLFragmentStreamReader', classMeta, XmlDelegatingReader);
  //endregion
  function DomReader$_get_namespaceContext_$o$iterator$slambda_vvguk9(this$0, resultContinuation) {
    this.hk5_1 = this$0;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(DomReader$_get_namespaceContext_$o$iterator$slambda_vvguk9).pk5 = function ($this$sequence, $completion) {
    var tmp = this.qk5($this$sequence, $completion);
    tmp.jd_1 = Unit_instance;
    tmp.kd_1 = null;
    return tmp.ud();
  };
  protoOf(DomReader$_get_namespaceContext_$o$iterator$slambda_vvguk9).he = function (p1, $completion) {
    return this.pk5(p1 instanceof SequenceScope ? p1 : THROW_CCE(), $completion);
  };
  protoOf(DomReader$_get_namespaceContext_$o$iterator$slambda_vvguk9).ud = function () {
    var suspendResult = this.jd_1;
    $sm: do
      try {
        var tmp = this.hd_1;
        switch (tmp) {
          case 0:
            this.id_1 = 8;
            this.jk5_1 = this.hk5_1.rk5_1;
            this.hd_1 = 1;
            continue $sm;
          case 1:
            if (!!(this.jk5_1 == null)) {
              this.hd_1 = 7;
              continue $sm;
            }

            var tmp_0 = this;
            tmp_0.kk5_1 = this.jk5_1.attributes;
            this.lk5_1 = this.kk5_1.length;
            this.mk5_1 = until(0, this.lk5_1).w();
            this.hd_1 = 2;
            continue $sm;
          case 2:
            if (!this.mk5_1.f()) {
              this.hd_1 = 6;
              continue $sm;
            }

            this.nk5_1 = this.mk5_1.e();
            var tmp_1 = this;
            var tmp_2 = this.kk5_1.item(this.nk5_1);
            tmp_1.ok5_1 = (!(tmp_2 == null) ? !(tmp_2 == null) : false) ? tmp_2 : THROW_CCE();
            if (this.ok5_1.prefix === 'xmlns') {
              this.hd_1 = 4;
              var tmp0_elvis_lhs = this.ok5_1.localName;
              suspendResult = this.ik5_1.ig(new NamespaceImpl(tmp0_elvis_lhs == null ? this.ok5_1.name : tmp0_elvis_lhs, this.ok5_1.value), this);
              if (suspendResult === get_COROUTINE_SUSPENDED()) {
                return suspendResult;
              }
              continue $sm;
            } else {
              var tmp_3;
              var this_0 = this.ok5_1.prefix;
              if (this_0 == null ? true : charSequenceLength(this_0) === 0) {
                tmp_3 = this.ok5_1.localName === 'xmlns';
              } else {
                tmp_3 = false;
              }
              if (tmp_3) {
                this.hd_1 = 3;
                suspendResult = this.ik5_1.ig(new NamespaceImpl('', this.ok5_1.value), this);
                if (suspendResult === get_COROUTINE_SUSPENDED()) {
                  return suspendResult;
                }
                continue $sm;
              } else {
                this.hd_1 = 5;
                continue $sm;
              }
            }

          case 3:
            this.hd_1 = 5;
            continue $sm;
          case 4:
            this.hd_1 = 5;
            continue $sm;
          case 5:
            this.hd_1 = 2;
            continue $sm;
          case 6:
            this.jk5_1 = this.jk5_1.parentElement;
            this.hd_1 = 1;
            continue $sm;
          case 7:
            return Unit_instance;
          case 8:
            throw this.kd_1;
        }
      } catch ($p) {
        var e = $p;
        if (this.id_1 === 8) {
          throw e;
        } else {
          this.hd_1 = this.id_1;
          this.kd_1 = e;
        }
      }
     while (true);
  };
  protoOf(DomReader$_get_namespaceContext_$o$iterator$slambda_vvguk9).qk5 = function ($this$sequence, completion) {
    var i = new DomReader$_get_namespaceContext_$o$iterator$slambda_vvguk9(this.hk5_1, completion);
    i.ik5_1 = $this$sequence;
    return i;
  };
  function DomReader$_get_namespaceContext_$o$iterator$slambda_vvguk9_0(this$0, resultContinuation) {
    var i = new DomReader$_get_namespaceContext_$o$iterator$slambda_vvguk9(this$0, resultContinuation);
    var l = function ($this$sequence, $completion) {
      return i.pk5($this$sequence, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function _get_namespaceAttrs__14mg2s($this) {
    var tmp0_elvis_lhs = $this.xk5_1;
    var tmp;
    if (tmp0_elvis_lhs == null) {
      // Inline function 'kotlin.also' call
      // Inline function 'nl.adaptivity.xmlutil.util.filterTyped' call
      var this_0 = _get_requireCurrentElem__bg81k8($this).attributes;
      // Inline function 'kotlin.collections.mutableListOf' call
      var result = ArrayList_init_$Create$();
      // Inline function 'nl.adaptivity.xmlutil.util.forEachAttr' call
      var l = this_0.length;
      var inductionVariable = 0;
      if (inductionVariable < l)
        do {
          var idx = inductionVariable;
          inductionVariable = inductionVariable + 1 | 0;
          // Inline function 'nl.adaptivity.xmlutil.util.filterTyped.<anonymous>' call
          var tmp_0 = this_0.item(idx);
          var attr = (!(tmp_0 == null) ? !(tmp_0 == null) : false) ? tmp_0 : THROW_CCE();
          // Inline function 'nl.adaptivity.xmlutil.DomReader.<get-namespaceAttrs>.<anonymous>' call
          var tmp_1;
          var tmp_2;
          var tmp_3;
          if (attr.namespaceURI == null) {
            tmp_3 = true;
          } else {
            var tmp_4 = attr.namespaceURI;
            tmp_3 = tmp_4 === 'http://www.w3.org/2000/xmlns/';
          }
          if (tmp_3) {
            var tmp_5;
            if (attr.prefix === 'xmlns') {
              tmp_5 = true;
            } else {
              var tmp_6;
              // Inline function 'kotlin.text.isNullOrEmpty' call
              var this_1 = attr.prefix;
              // Inline function 'kotlin.contracts.contract' call
              if (this_1 == null ? true : charSequenceLength(this_1) === 0) {
                tmp_6 = attr.localName === 'xmlns';
              } else {
                tmp_6 = false;
              }
              tmp_5 = tmp_6;
            }
            tmp_2 = tmp_5;
          } else {
            tmp_2 = false;
          }
          if (tmp_2) {
            var tmp_7 = attr.value;
            tmp_1 = !(tmp_7 === 'http://www.w3.org/2000/xmlns/');
          } else {
            tmp_1 = false;
          }
          if (tmp_1) {
            result.i1(attr);
          }
        }
         while (inductionVariable < l);
      // Inline function 'kotlin.contracts.contract' call
      // Inline function 'nl.adaptivity.xmlutil.DomReader.<get-namespaceAttrs>.<anonymous>' call
      $this.xk5_1 = result;
      tmp = result;
    } else {
      tmp = tmp0_elvis_lhs;
    }
    return tmp;
  }
  function _get_requireCurrent__f4sn5j($this) {
    var tmp0_elvis_lhs = $this.tk5_1;
    var tmp;
    if (tmp0_elvis_lhs == null) {
      throw IllegalStateException_init_$Create$('No current element');
    } else {
      tmp = tmp0_elvis_lhs;
    }
    return tmp;
  }
  function _get_requireCurrentElem__bg81k8($this) {
    var tmp0_elvis_lhs = $this.yk5();
    var tmp;
    if (tmp0_elvis_lhs == null) {
      throw IllegalStateException_init_$Create$('No current element');
    } else {
      tmp = tmp0_elvis_lhs;
    }
    return tmp;
  }
  function _get_locationInfo_$helper_86tu52(node, result) {
    var tmp;
    var tmp_0;
    if (node == null) {
      tmp_0 = true;
    } else {
      var tmp_1 = node.nodeType;
      tmp_0 = tmp_1 === 9;
    }
    if (tmp_0) {
      tmp = result;
    } else {
      if (get_isElement(node)) {
        // Inline function 'kotlin.apply' call
        var this_0 = _get_locationInfo_$helper_86tu52(node.parentNode, result);
        // Inline function 'kotlin.contracts.contract' call
        // Inline function 'nl.adaptivity.xmlutil.DomReader.<get-locationInfo>.helper.<anonymous>' call
        this_0.z5(_Char___init__impl__6a9atx(47)).r8(node.nodeName);
        tmp = this_0;
      } else {
        if (get_isText(node)) {
          // Inline function 'kotlin.apply' call
          var this_1 = _get_locationInfo_$helper_86tu52(node.parentNode, result);
          // Inline function 'kotlin.contracts.contract' call
          // Inline function 'nl.adaptivity.xmlutil.DomReader.<get-locationInfo>.helper.<anonymous>' call
          this_1.r8('/text()');
          tmp = this_1;
        } else {
          // Inline function 'kotlin.apply' call
          var this_2 = _get_locationInfo_$helper_86tu52(node.parentNode, result);
          // Inline function 'kotlin.contracts.contract' call
          // Inline function 'nl.adaptivity.xmlutil.DomReader.<get-locationInfo>.helper.<anonymous>' call
          this_2.r8('/.');
          tmp = this_2;
        }
      }
    }
    return tmp;
  }
  function DomReader$namespaceContext$1(this$0) {
    var tmp = this;
    var tmp_0 = _get_requireCurrent__f4sn5j(this$0);
    var tmp0_elvis_lhs = !(tmp_0 == null) ? tmp_0 : null;
    var tmp_1;
    if (tmp0_elvis_lhs == null) {
      var tmp_2 = _get_requireCurrent__f4sn5j(this$0).parentNode;
      tmp_1 = (!(tmp_2 == null) ? !(tmp_2 == null) : false) ? tmp_2 : null;
    } else {
      tmp_1 = tmp0_elvis_lhs;
    }
    tmp.rk5_1 = tmp_1;
  }
  protoOf(DomReader$namespaceContext$1).zk5 = function (prefix) {
    var tmp0_safe_receiver = this.rk5_1;
    return tmp0_safe_receiver == null ? null : myLookupNamespaceURI(tmp0_safe_receiver, prefix);
  };
  protoOf(DomReader$namespaceContext$1).ak6 = function (namespaceURI) {
    var tmp0_safe_receiver = this.rk5_1;
    return tmp0_safe_receiver == null ? null : myLookupPrefix(tmp0_safe_receiver, namespaceURI);
  };
  protoOf(DomReader$namespaceContext$1).bk6 = function () {
    return this;
  };
  protoOf(DomReader$namespaceContext$1).w = function () {
    return sequence(DomReader$_get_namespaceContext_$o$iterator$slambda_vvguk9_0(this, null)).w();
  };
  protoOf(DomReader$namespaceContext$1).ck6 = function (namespaceURI) {
    return listOfNotNull(this.ak6(namespaceURI)).w();
  };
  function DomReader(delegate) {
    this.sk5_1 = delegate;
    this.tk5_1 = null;
    this.uk5_1 = false;
    this.vk5_1 = false;
    this.wk5_1 = 0;
    this.xk5_1 = null;
  }
  protoOf(DomReader).fk6 = function () {
    var tmp0_safe_receiver = this.yk5();
    var tmp;
    if (tmp0_safe_receiver == null) {
      tmp = null;
    } else {
      // Inline function 'kotlin.run' call
      // Inline function 'kotlin.contracts.contract' call
      // Inline function 'nl.adaptivity.xmlutil.DomReader.<get-namespaceURI>.<anonymous>' call
      var tmp0_elvis_lhs = tmp0_safe_receiver.namespaceURI;
      tmp = tmp0_elvis_lhs == null ? '' : tmp0_elvis_lhs;
    }
    var tmp1_elvis_lhs = tmp;
    var tmp_0;
    if (tmp1_elvis_lhs == null) {
      throw XmlException_init_$Create$_0('Only elements have a namespace uri');
    } else {
      tmp_0 = tmp1_elvis_lhs;
    }
    return tmp_0;
  };
  protoOf(DomReader).gk6 = function () {
    var tmp0_safe_receiver = this.yk5();
    var tmp;
    if (tmp0_safe_receiver == null) {
      tmp = null;
    } else {
      // Inline function 'kotlin.let' call
      // Inline function 'kotlin.contracts.contract' call
      // Inline function 'nl.adaptivity.xmlutil.DomReader.<get-localName>.<anonymous>' call
      var tmp0_elvis_lhs = tmp0_safe_receiver.localName;
      tmp = tmp0_elvis_lhs == null ? tmp0_safe_receiver.tagName : tmp0_elvis_lhs;
    }
    var tmp1_elvis_lhs = tmp;
    var tmp_0;
    if (tmp1_elvis_lhs == null) {
      throw XmlException_init_$Create$_0('Only elements have a local name');
    } else {
      tmp_0 = tmp1_elvis_lhs;
    }
    return tmp_0;
  };
  protoOf(DomReader).hk6 = function () {
    var tmp0_safe_receiver = this.yk5();
    var tmp;
    if (tmp0_safe_receiver == null) {
      tmp = null;
    } else {
      // Inline function 'kotlin.run' call
      // Inline function 'kotlin.contracts.contract' call
      // Inline function 'nl.adaptivity.xmlutil.DomReader.<get-prefix>.<anonymous>' call
      var tmp0_elvis_lhs = tmp0_safe_receiver.prefix;
      tmp = tmp0_elvis_lhs == null ? '' : tmp0_elvis_lhs;
    }
    var tmp1_elvis_lhs = tmp;
    var tmp_0;
    if (tmp1_elvis_lhs == null) {
      throw XmlException_init_$Create$_0('Only elements have a prefix');
    } else {
      tmp_0 = tmp1_elvis_lhs;
    }
    return tmp_0;
  };
  protoOf(DomReader).ik6 = function () {
    return this.uk5_1;
  };
  protoOf(DomReader).jk6 = function () {
    return this.wk5_1;
  };
  protoOf(DomReader).kk6 = function () {
    var c = _get_requireCurrent__f4sn5j(this);
    // Inline function 'kotlin.require' call
    var tmp = c.nodeType;
    // Inline function 'kotlin.contracts.contract' call
    // Inline function 'kotlin.require' call
    // Inline function 'kotlin.contracts.contract' call
    if (!(tmp === 7)) {
      // Inline function 'kotlin.require.<anonymous>' call
      var message = 'Failed requirement.';
      throw IllegalArgumentException_init_$Create$(toString(message));
    }
    // Inline function 'nl.adaptivity.xmlutil.dom.getTarget' call
    return (!(c == null) ? c : THROW_CCE()).target;
  };
  protoOf(DomReader).lk6 = function () {
    var c = _get_requireCurrent__f4sn5j(this);
    // Inline function 'kotlin.require' call
    var tmp = c.nodeType;
    // Inline function 'kotlin.contracts.contract' call
    // Inline function 'kotlin.require' call
    // Inline function 'kotlin.contracts.contract' call
    if (!(tmp === 7)) {
      // Inline function 'kotlin.require.<anonymous>' call
      var message = 'Failed requirement.';
      throw IllegalArgumentException_init_$Create$(toString(message));
    }
    // Inline function 'nl.adaptivity.xmlutil.dom.getData' call
    return (!(c == null) ? c : THROW_CCE()).data;
  };
  protoOf(DomReader).mk6 = function () {
    var tmp0_safe_receiver = this.tk5_1;
    var tmp1_subject = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.nodeType;
    var tmp;
    var tmp_0;
    var tmp_1;
    var tmp_2;
    var tmp_3 = tmp1_subject == null ? null : tmp1_subject;
    if (tmp_3 === 5) {
      tmp_2 = true;
    } else {
      var tmp_4 = tmp1_subject == null ? null : tmp1_subject;
      tmp_2 = tmp_4 === 8;
    }
    if (tmp_2) {
      tmp_1 = true;
    } else {
      var tmp_5 = tmp1_subject == null ? null : tmp1_subject;
      tmp_1 = tmp_5 === 3;
    }
    if (tmp_1) {
      tmp_0 = true;
    } else {
      var tmp_6 = tmp1_subject == null ? null : tmp1_subject;
      tmp_0 = tmp_6 === 4;
    }
    if (tmp_0) {
      var tmp_7 = this.tk5_1;
      tmp = ((!(tmp_7 == null) ? !(tmp_7 == null) : false) ? tmp_7 : THROW_CCE()).data;
    } else {
      var tmp_8 = tmp1_subject == null ? null : tmp1_subject;
      if (tmp_8 === 7) {
        // Inline function 'kotlin.let' call
        var tmp_9 = this.tk5_1;
        // Inline function 'kotlin.contracts.contract' call
        // Inline function 'nl.adaptivity.xmlutil.DomReader.<get-text>.<anonymous>' call
        var it = (!(tmp_9 == null) ? !(tmp_9 == null) : false) ? tmp_9 : THROW_CCE();
        var tmp_10 = it.nodeName;
        // Inline function 'nl.adaptivity.xmlutil.dom.getData' call
        tmp = tmp_10 + ' ' + it.data;
      } else {
        throw XmlException_init_$Create$_0('Node is not a text node');
      }
    }
    return tmp;
  };
  protoOf(DomReader).nk6 = function () {
    var tmp = this.tk5_1;
    var tmp0_safe_receiver = (tmp == null ? true : !(tmp == null)) ? tmp : THROW_CCE();
    var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.attributes;
    var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : tmp1_safe_receiver.length;
    return tmp2_elvis_lhs == null ? 0 : tmp2_elvis_lhs;
  };
  protoOf(DomReader).ok6 = function () {
    var c = this.tk5_1;
    return c == null ? EventType_END_DOCUMENT_getInstance() : toEventType(c, this.vk5_1);
  };
  protoOf(DomReader).pk6 = function () {
    return _get_locationInfo_$helper_86tu52(this.tk5_1, StringBuilder_init_$Create$()).toString();
  };
  protoOf(DomReader).yk5 = function () {
    var tmp0_safe_receiver = this.tk5_1;
    var tmp;
    var tmp2_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.nodeType;
    var tmp_0 = tmp2_safe_receiver == null ? null : tmp2_safe_receiver;
    if (tmp_0 === 1) {
      var tmp_1 = this.tk5_1;
      tmp = (!(tmp_1 == null) ? !(tmp_1 == null) : false) ? tmp_1 : THROW_CCE();
    } else {
      tmp = null;
    }
    return tmp;
  };
  protoOf(DomReader).qk6 = function () {
    return new DomReader$namespaceContext$1(this);
  };
  protoOf(DomReader).rk6 = function () {
    // Inline function 'kotlin.collections.map' call
    var this_0 = _get_namespaceAttrs__14mg2s(this);
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
    var tmp0_iterator = this_0.w();
    while (tmp0_iterator.f()) {
      var item = tmp0_iterator.e();
      // Inline function 'nl.adaptivity.xmlutil.DomReader.<get-namespaceDecls>.<anonymous>' call
      var tmp$ret$0 = item.prefix === 'xmlns' ? new NamespaceImpl(ensureNotNull(item.localName), item.value) : new NamespaceImpl('', item.value);
      destination.i1(tmp$ret$0);
    }
    return destination;
  };
  protoOf(DomReader).sk6 = function () {
    var d = this.sk5_1;
    var tmp;
    var tmp_0 = d.nodeType;
    if (tmp_0 === 9) {
      tmp = (!(d == null) ? d : THROW_CCE()).inputEncoding;
    } else {
      tmp = ensureNotNull(d.ownerDocument).inputEncoding;
    }
    return tmp;
  };
  protoOf(DomReader).tk6 = function () {
    return null;
  };
  protoOf(DomReader).g3g = function () {
    return '1.0';
  };
  protoOf(DomReader).f = function () {
    var tmp;
    var tmp_0;
    if (this.vk5_1) {
      var tmp0_safe_receiver = this.tk5_1;
      tmp_0 = (tmp0_safe_receiver == null ? null : tmp0_safe_receiver.parentNode) == null;
    } else {
      tmp_0 = false;
    }
    if (!tmp_0) {
      tmp = true;
    } else {
      tmp = !equals(this.tk5_1, this.sk5_1);
    }
    return tmp;
  };
  protoOf(DomReader).e = function () {
    this.xk5_1 = null;
    var c = this.tk5_1;
    if (c == null) {
      this.uk5_1 = true;
      this.tk5_1 = this.sk5_1;
      return EventType_START_DOCUMENT_getInstance();
    } else {
      if (this.vk5_1) {
        if (!(c.nextSibling == null)) {
          this.tk5_1 = c.nextSibling;
          this.vk5_1 = false;
        } else {
          this.tk5_1 = c.parentNode;
          var tmp0_safe_receiver = this.tk5_1;
          var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : toEventType(tmp0_safe_receiver, true);
          return tmp1_elvis_lhs == null ? EventType_END_DOCUMENT_getInstance() : tmp1_elvis_lhs;
        }
      } else if (!(c.firstChild == null)) {
        this.tk5_1 = c.firstChild;
      } else {
        this.vk5_1 = true;
        return EventType_END_ELEMENT_getInstance();
      }
      var c2 = _get_requireCurrent__f4sn5j(this);
      var nodeType = c2.nodeType;
      var tmp;
      var tmp_0 = nodeType;
      if (!(tmp_0 === 1)) {
        var tmp_1 = nodeType;
        tmp = !(tmp_1 === 9);
      } else {
        tmp = false;
      }
      if (tmp) {
        this.vk5_1 = true;
      }
      return toEventType(c2, this.vk5_1);
    }
  };
  protoOf(DomReader).uk6 = function (index) {
    var tmp0_elvis_lhs = get(_get_requireCurrentElem__bg81k8(this).attributes, index);
    var tmp;
    if (tmp0_elvis_lhs == null) {
      throw IndexOutOfBoundsException_init_$Create$();
    } else {
      tmp = tmp0_elvis_lhs;
    }
    var attr = tmp;
    var tmp1_elvis_lhs = attr.namespaceURI;
    return tmp1_elvis_lhs == null ? '' : tmp1_elvis_lhs;
  };
  protoOf(DomReader).vk6 = function (index) {
    var tmp0_elvis_lhs = get(_get_requireCurrentElem__bg81k8(this).attributes, index);
    var tmp;
    if (tmp0_elvis_lhs == null) {
      throw IndexOutOfBoundsException_init_$Create$();
    } else {
      tmp = tmp0_elvis_lhs;
    }
    var attr = tmp;
    var tmp1_elvis_lhs = attr.prefix;
    return tmp1_elvis_lhs == null ? '' : tmp1_elvis_lhs;
  };
  protoOf(DomReader).wk6 = function (index) {
    var tmp0_elvis_lhs = get(_get_requireCurrentElem__bg81k8(this).attributes, index);
    var tmp;
    if (tmp0_elvis_lhs == null) {
      throw IndexOutOfBoundsException_init_$Create$();
    } else {
      tmp = tmp0_elvis_lhs;
    }
    var attr = tmp;
    var tmp1_elvis_lhs = attr.localName;
    return tmp1_elvis_lhs == null ? attr.name : tmp1_elvis_lhs;
  };
  protoOf(DomReader).xk6 = function (index) {
    var tmp0_elvis_lhs = get(_get_requireCurrentElem__bg81k8(this).attributes, index);
    var tmp;
    if (tmp0_elvis_lhs == null) {
      throw IndexOutOfBoundsException_init_$Create$();
    } else {
      tmp = tmp0_elvis_lhs;
    }
    var attr = tmp;
    return attr.value;
  };
  protoOf(DomReader).r7j = function (nsUri, localName) {
    return _get_requireCurrentElem__bg81k8(this).getAttributeNS(nsUri, localName);
  };
  protoOf(DomReader).n = function () {
    this.tk5_1 = null;
  };
  function toEventType(_this__u8e3s4, endOfElement) {
    var tmp0_subject = _this__u8e3s4.nodeType;
    var tmp;
    var tmp_0 = tmp0_subject;
    if (tmp_0 === 2) {
      tmp = EventType_ATTRIBUTE_getInstance();
    } else {
      var tmp_1 = tmp0_subject;
      if (tmp_1 === 4) {
        tmp = EventType_CDSECT_getInstance();
      } else {
        var tmp_2 = tmp0_subject;
        if (tmp_2 === 8) {
          tmp = EventType_COMMENT_getInstance();
        } else {
          var tmp_3 = tmp0_subject;
          if (tmp_3 === 10) {
            tmp = EventType_DOCDECL_getInstance();
          } else {
            var tmp_4 = tmp0_subject;
            if (tmp_4 === 5) {
              tmp = EventType_ENTITY_REF_getInstance();
            } else {
              var tmp_5;
              var tmp_6 = tmp0_subject;
              if (tmp_6 === 11) {
                tmp_5 = true;
              } else {
                var tmp_7 = tmp0_subject;
                tmp_5 = tmp_7 === 9;
              }
              if (tmp_5) {
                tmp = endOfElement ? EventType_END_DOCUMENT_getInstance() : EventType_START_DOCUMENT_getInstance();
              } else {
                var tmp_8 = tmp0_subject;
                if (tmp_8 === 7) {
                  tmp = EventType_PROCESSING_INSTRUCTION_getInstance();
                } else {
                  var tmp_9 = tmp0_subject;
                  if (tmp_9 === 3) {
                    tmp = isXmlWhitespace_1(ensureNotNull(_this__u8e3s4.textContent)) ? EventType_IGNORABLE_WHITESPACE_getInstance() : EventType_TEXT_getInstance();
                  } else {
                    var tmp_10 = tmp0_subject;
                    if (tmp_10 === 1) {
                      tmp = endOfElement ? EventType_END_ELEMENT_getInstance() : EventType_START_ELEMENT_getInstance();
                    } else {
                      throw XmlException_init_$Create$_0('Unsupported event type (' + _this__u8e3s4 + ')');
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
    return tmp;
  }
  function collectDeclaredPrefixes(_this__u8e3s4, $this, namespaceUri, result, redeclared) {
    // Inline function 'nl.adaptivity.xmlutil.util.forEachAttr' call
    var this_0 = _this__u8e3s4.attributes;
    var l = this_0.length;
    var inductionVariable = 0;
    if (inductionVariable < l)
      do {
        var idx = inductionVariable;
        inductionVariable = inductionVariable + 1 | 0;
        // Inline function 'nl.adaptivity.xmlutil.<no name provided>.collectDeclaredPrefixes.<anonymous>' call
        var tmp = this_0.item(idx);
        var attr = (!(tmp == null) ? !(tmp == null) : false) ? tmp : THROW_CCE();
        var tmp_0;
        if (attr.prefix === 'xmlns') {
          tmp_0 = attr.localName;
        } else {
          var tmp_1;
          // Inline function 'kotlin.text.isNullOrEmpty' call
          var this_1 = attr.prefix;
          // Inline function 'kotlin.contracts.contract' call
          if (this_1 == null ? true : charSequenceLength(this_1) === 0) {
            tmp_1 = attr.localName === 'xmlns';
          } else {
            tmp_1 = false;
          }
          if (tmp_1) {
            tmp_0 = '';
          } else {
            tmp_0 = null;
          }
        }
        var prefix = tmp_0;
        if (!(prefix == null)) {
          if (redeclared.a1(prefix)) {
            if (attr.value === namespaceUri) {
              result.i1(prefix);
            }
            redeclared.i1(prefix);
          }
        }
      }
       while (inductionVariable < l);
    var tmp0_safe_receiver = _this__u8e3s4.parentElement;
    if (tmp0_safe_receiver == null)
      null;
    else {
      collectDeclaredPrefixes(tmp0_safe_receiver, $this, namespaceUri, result, redeclared);
    }
  }
  function DomWriter_init_$Init$(xmlDeclMode, $this) {
    xmlDeclMode = xmlDeclMode === VOID ? XmlDeclMode_None_getInstance() : xmlDeclMode;
    DomWriter.call($this, null, VOID, xmlDeclMode);
    return $this;
  }
  function DomWriter_init_$Create$(xmlDeclMode) {
    return DomWriter_init_$Init$(xmlDeclMode, objectCreate(protoOf(DomWriter)));
  }
  function writeIndent($this, newDepth) {
    var indentSeq = $this.zk6_1;
    var tmp;
    var tmp_0;
    if ($this.gk7_1 >= 0) {
      // Inline function 'kotlin.collections.isNotEmpty' call
      tmp_0 = !indentSeq.c1();
    } else {
      tmp_0 = false;
    }
    if (tmp_0) {
      tmp = !($this.gk7_1 === $this.ik7_1);
    } else {
      tmp = false;
    }
    if (tmp) {
      $this.mk7('\n');
      try {
        $this.zk6_1 = emptyList();
        // Inline function 'kotlin.repeat' call
        var times = $this.ik7_1;
        // Inline function 'kotlin.contracts.contract' call
        var inductionVariable = 0;
        if (inductionVariable < times)
          do {
            var index = inductionVariable;
            inductionVariable = inductionVariable + 1 | 0;
            // Inline function 'nl.adaptivity.xmlutil.DomWriter.writeIndent.<anonymous>' call
            // Inline function 'kotlin.collections.forEach' call
            var tmp0_iterator = indentSeq.w();
            while (tmp0_iterator.f()) {
              var element = tmp0_iterator.e();
              // Inline function 'nl.adaptivity.xmlutil.DomWriter.writeIndent.<anonymous>.<anonymous>' call
              element.qk7($this);
            }
          }
           while (inductionVariable < times);
      }finally {
        $this.zk6_1 = indentSeq;
      }
    }
    $this.gk7_1 = newDepth;
  }
  function writeIndent$default($this, newDepth, $super) {
    newDepth = newDepth === VOID ? $this.ik7_1 : newDepth;
    return writeIndent($this, newDepth);
  }
  function addToPending($this, operation) {
    if ($this.dk7_1 == null) {
      var tmp = $this.fk7_1;
      (isInterface(tmp, MutableList) ? tmp : THROW_CCE()).i1(operation);
    } else
      throw IllegalStateException_init_$Create$('Use of pending list when there is a document already');
  }
  function requireCurrent($this, error) {
    var tmp = $this.ek7_1;
    var tmp0_elvis_lhs = (!(tmp == null) ? !(tmp == null) : false) ? tmp : null;
    var tmp_0;
    if (tmp0_elvis_lhs == null) {
      throw XmlException_init_$Create$_0('The current node is not an element: ' + error);
    } else {
      tmp_0 = tmp0_elvis_lhs;
    }
    return tmp_0;
  }
  function Companion() {
    this.rk7_1 = -1;
    this.sk7_1 = 2147483647;
  }
  var Companion_instance_0;
  function Companion_getInstance() {
    return Companion_instance_0;
  }
  function DomWriter$namespaceContext$1(this$0) {
    this.tk7_1 = this$0;
  }
  protoOf(DomWriter$namespaceContext$1).zk5 = function (prefix) {
    var tmp0_safe_receiver = this.tk7_1.ek7_1;
    return tmp0_safe_receiver == null ? null : tmp0_safe_receiver.lookupNamespaceURI(prefix);
  };
  protoOf(DomWriter$namespaceContext$1).ak6 = function (namespaceURI) {
    var tmp0_safe_receiver = this.tk7_1.ek7_1;
    return tmp0_safe_receiver == null ? null : tmp0_safe_receiver.lookupPrefix(namespaceURI);
  };
  protoOf(DomWriter$namespaceContext$1).ck6 = function (namespaceURI) {
    // Inline function 'kotlin.collections.buildSet' call
    // Inline function 'kotlin.contracts.contract' call
    // Inline function 'kotlin.collections.buildSetInternal' call
    // Inline function 'kotlin.apply' call
    var this_0 = LinkedHashSet_init_$Create$();
    // Inline function 'kotlin.contracts.contract' call
    // Inline function 'nl.adaptivity.xmlutil.<no name provided>.getPrefixesCompat.<anonymous>' call
    var tmp = this.tk7_1.ek7_1;
    var tmp0_safe_receiver = (tmp == null ? true : !(tmp == null)) ? tmp : THROW_CCE();
    if (tmp0_safe_receiver == null)
      null;
    else {
      // Inline function 'kotlin.collections.mutableListOf' call
      var tmp$ret$0 = ArrayList_init_$Create$();
      collectDeclaredPrefixes(tmp0_safe_receiver, this, namespaceURI, this_0, tmp$ret$0);
    }
    var tmp$ret$3 = this_0.f3();
    return toList(tmp$ret$3).w();
  };
  function DomWriter$comment$lambda(this$0, $text) {
    return function (it) {
      this$0.uk7($text);
      return Unit_instance;
    };
  }
  function DomWriter$text$lambda(this$0, $text) {
    return function (it) {
      this$0.mk7($text);
      return Unit_instance;
    };
  }
  function DomWriter$processingInstruction$lambda(this$0, $text) {
    return function (it) {
      this$0.vk7($text);
      return Unit_instance;
    };
  }
  function DomWriter$processingInstruction$lambda_0(this$0, $target, $data) {
    return function (it) {
      this$0.wk7($target, $data);
      return Unit_instance;
    };
  }
  function DomWriter$ignorableWhitespace$lambda(this$0, $text) {
    return function (it) {
      this$0.mk7($text);
      return Unit_instance;
    };
  }
  function DomWriter$docdecl$lambda(this$0, $text) {
    return function (it) {
      this$0.xk7($text);
      return Unit_instance;
    };
  }
  function DomWriter$close$lambda(this$0) {
    return function () {
      return 'Closing a dom writer but not all elements were closed (depth:' + this$0.ik7_1 + ')';
    };
  }
  function DomWriter(current, isAppend, xmlDeclMode) {
    isAppend = isAppend === VOID ? false : isAppend;
    xmlDeclMode = xmlDeclMode === VOID ? XmlDeclMode_None_getInstance() : xmlDeclMode;
    PlatformXmlWriterBase.call(this);
    this.bk7_1 = isAppend;
    this.ck7_1 = xmlDeclMode;
    var tmp = this;
    var tmp1_subject = current == null ? null : current.nodeType;
    var tmp_0;
    if (tmp1_subject == null) {
      tmp_0 = null;
    } else {
      var tmp_1 = tmp1_subject == null ? null : tmp1_subject;
      if (tmp_1 === 9) {
        tmp_0 = (!(current == null) ? !(current == null) : false) ? current : THROW_CCE();
      } else {
        tmp_0 = current.ownerDocument;
      }
    }
    tmp.dk7_1 = tmp_0;
    this.ek7_1 = current;
    var tmp_2 = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp_2.fk7_1 = ArrayList_init_$Create$();
    this.gk7_1 = -1;
    var tmp_3 = this;
    tmp_3.hk7_1 = new DomWriter$namespaceContext$1(this);
    this.ik7_1 = 0;
    this.jk7_1 = null;
    this.kk7_1 = null;
    this.lk7_1 = null;
  }
  protoOf(DomWriter).yk7 = function () {
    var tmp0_elvis_lhs = this.dk7_1;
    var tmp;
    if (tmp0_elvis_lhs == null) {
      throw XmlException_init_$Create$_0('Document not created yet');
    } else {
      tmp = tmp0_elvis_lhs;
    }
    return tmp;
  };
  protoOf(DomWriter).qk6 = function () {
    return this.hk7_1;
  };
  protoOf(DomWriter).jk6 = function () {
    return this.ik7_1;
  };
  protoOf(DomWriter).zk7 = function (namespacePrefix, namespaceUri) {
    var cur = requireCurrent(this, 'Namespace attribute');
    // Inline function 'kotlin.text.isEmpty' call
    if (charSequenceLength(namespacePrefix) === 0) {
      var tmp;
      // Inline function 'kotlin.text.isEmpty' call
      if (charSequenceLength(namespaceUri) === 0) {
        tmp = cur.lookupNamespaceURI('') === '';
      } else {
        tmp = false;
      }
      if (!tmp) {
        cur.setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns', namespaceUri);
      }
    } else {
      cur.setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns' + ':' + namespacePrefix, namespaceUri);
    }
  };
  protoOf(DomWriter).ak8 = function (namespace, localName, prefix) {
    writeIndent$default(this);
    this.ik7_1 = this.ik7_1 + 1 | 0;
    if (this.ek7_1 == null ? this.dk7_1 == null : false) {
      var doc = createDocument(qname(namespace == null ? '' : namespace, localName, prefix));
      this.dk7_1 = doc;
      this.ek7_1 = this.dk7_1;
      var e = ensureNotNull(doc.documentElement);
      doc.removeChild(e);
      var tmp3_iterator = this.fk7_1.w();
      while (tmp3_iterator.f()) {
        var pending = tmp3_iterator.e();
        pending(doc);
      }
      doc.appendChild(e);
      var tmp = this.fk7_1;
      (isInterface(tmp, MutableList) ? tmp : THROW_CCE()).n1();
      this.gk7_1 = 0;
      this.ek7_1 = doc.documentElement;
      return Unit_instance;
    } else if (this.ek7_1 == null ? !this.bk7_1 : false) {
      // Inline function 'kotlin.sequences.count' call
      var count = 0;
      var tmp0_iterator = asSequence(iterator_0(this.yk7().childNodes)).w();
      while (tmp0_iterator.f()) {
        var element = tmp0_iterator.e();
        // Inline function 'nl.adaptivity.xmlutil.DomWriter.startTag.<anonymous>' call
        var tmp_0 = element.nodeType;
        if (tmp_0 === 1) {
          count = count + 1 | 0;
          checkCountOverflow(count);
        }
      }
      if (count > 0) {
        removeElementChildren(this.yk7());
      }
    }
    // Inline function 'kotlin.let' call
    // Inline function 'kotlin.contracts.contract' call
    var elem = createElement(this.yk7(), qname(namespace, localName, prefix));
    ensureNotNull(this.ek7_1).appendChild(elem);
    this.ek7_1 = elem;
  };
  protoOf(DomWriter).uk7 = function (text) {
    writeIndent$default(this);
    var ce = this.ek7_1;
    if (ce == null) {
      addToPending(this, DomWriter$comment$lambda(this, text));
    } else {
      // Inline function 'kotlin.let' call
      // Inline function 'kotlin.contracts.contract' call
      // Inline function 'nl.adaptivity.xmlutil.DomWriter.comment.<anonymous>' call
      var comment = this.yk7().createComment(text);
      ce.appendChild(comment);
    }
  };
  protoOf(DomWriter).bk8 = function (text) {
    this.gk7_1 = -1;
    var ce = this.ek7_1;
    if (ce == null) {
      if (isBlank(text)) {
        addToPending(this, DomWriter$text$lambda(this, text));
      } else
        throw XmlException_init_$Create$_0('Not in an element -- text');
    } else {
      // Inline function 'kotlin.let' call
      // Inline function 'kotlin.contracts.contract' call
      // Inline function 'nl.adaptivity.xmlutil.DomWriter.text.<anonymous>' call
      var textNode = this.yk7().createTextNode(text);
      ce.appendChild(textNode);
    }
  };
  protoOf(DomWriter).ck8 = function (text) {
    this.gk7_1 = -1;
    // Inline function 'kotlin.let' call
    // Inline function 'kotlin.contracts.contract' call
    // Inline function 'nl.adaptivity.xmlutil.DomWriter.cdsect.<anonymous>' call
    var cdataSection = this.yk7().createCDATASection(text);
    var tmp0_safe_receiver = this.ek7_1;
    var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.appendChild(cdataSection);
    var tmp;
    if (tmp1_elvis_lhs == null) {
      throw XmlException_init_$Create$_0('Not in an element -- cdsect');
    } else {
      tmp = tmp1_elvis_lhs;
    }
  };
  protoOf(DomWriter).dk8 = function (text) {
    this.gk7_1 = -1;
    throw UnsupportedOperationException_init_$Create$('Creating entity references is not supported (or incorrect) in most browsers');
  };
  protoOf(DomWriter).vk7 = function (text) {
    writeIndent(this, 2147483647);
    var tmp0_safe_receiver = this.ek7_1;
    var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.nodeType;
    var tmp = tmp1_safe_receiver == null ? null : tmp1_safe_receiver;
    if (!(tmp === 1))
      throw XmlException_init_$Create$_0('Document already started');
    if (this.dk7_1 == null) {
      addToPending(this, DomWriter$processingInstruction$lambda(this, text));
    } else {
      var split = indexOf(text, _Char___init__impl__6a9atx(32));
      var tmp_0;
      if (split < 0) {
        tmp_0 = to(text, '');
      } else {
        // Inline function 'kotlin.text.substring' call
        // Inline function 'kotlin.js.asDynamic' call
        var tmp_1 = text.substring(0, split);
        // Inline function 'kotlin.text.substring' call
        var startIndex = split + 1 | 0;
        // Inline function 'kotlin.js.asDynamic' call
        var tmp$ret$3 = text.substring(startIndex);
        tmp_0 = to(tmp_1, tmp$ret$3);
      }
      var tmp2_container = tmp_0;
      var target = tmp2_container.y6();
      var data = tmp2_container.z6();
      // Inline function 'kotlin.let' call
      // Inline function 'kotlin.contracts.contract' call
      // Inline function 'nl.adaptivity.xmlutil.DomWriter.processingInstruction.<anonymous>' call
      var processInstr = this.yk7().createProcessingInstruction(target, data);
      this.yk7().appendChild(processInstr);
    }
  };
  protoOf(DomWriter).wk7 = function (target, data) {
    var ce = this.ek7_1;
    if (ce == null) {
      addToPending(this, DomWriter$processingInstruction$lambda_0(this, target, data));
    } else {
      var processInstr = this.yk7().createProcessingInstruction(target, data);
      ce.appendChild(processInstr);
    }
    this.gk7_1 = -1;
  };
  protoOf(DomWriter).mk7 = function (text) {
    var ce = this.ek7_1;
    if (ce == null) {
      addToPending(this, DomWriter$ignorableWhitespace$lambda(this, text));
    } else {
      var tmp = ce.nodeType;
      if (!(tmp === 9)) {
        // Inline function 'kotlin.let' call
        // Inline function 'kotlin.contracts.contract' call
        // Inline function 'nl.adaptivity.xmlutil.DomWriter.ignorableWhitespace.<anonymous>' call
        var textNode = this.yk7().createTextNode(text);
        ce.appendChild(textNode);
      }
    }
    this.gk7_1 = -1;
  };
  protoOf(DomWriter).ek8 = function (namespace, name, prefix, value) {
    var cur = requireCurrent(this, 'attribute');
    var tmp;
    // Inline function 'kotlin.text.isNullOrEmpty' call
    // Inline function 'kotlin.contracts.contract' call
    if (namespace == null ? true : charSequenceLength(namespace) === 0) {
      // Inline function 'kotlin.text.isNullOrEmpty' call
      // Inline function 'kotlin.contracts.contract' call
      tmp = prefix == null ? true : charSequenceLength(prefix) === 0;
    } else {
      tmp = false;
    }
    if (tmp) {
      cur.setAttribute(name, value);
    } else {
      // Inline function 'kotlin.text.isNullOrEmpty' call
      // Inline function 'kotlin.contracts.contract' call
      if (prefix == null ? true : charSequenceLength(prefix) === 0) {
        cur.setAttributeNS(namespace, name, value);
      } else {
        var tmp_0;
        if (namespace == null) {
          tmp_0 = '';
        } else {
          tmp_0 = namespace;
        }
        cur.setAttributeNS(tmp_0, '' + prefix + ':' + name, value);
      }
    }
  };
  protoOf(DomWriter).xk7 = function (text) {
    writeIndent(this, 2147483647);
    var target = this.dk7_1;
    if (target == null) {
      addToPending(this, DomWriter$docdecl$lambda(this, text));
    } else {
      var textElems = split(text, [' '], VOID, 3);
      var qualifiedName = textElems.v(0);
      var publicId = textElems.u() > 1 ? textElems.v(1) : '';
      var systemId = textElems.u() > 2 ? textElems.v(2) : '';
      // Inline function 'kotlin.let' call
      // Inline function 'kotlin.contracts.contract' call
      // Inline function 'nl.adaptivity.xmlutil.DomWriter.docdecl.<anonymous>' call
      var docType = target.implementation.createDocumentType(qualifiedName, publicId, systemId);
      target.appendChild(docType);
    }
  };
  protoOf(DomWriter).fk8 = function (version, encoding, standalone) {
    writeIndent(this, 2147483647);
    this.jk7_1 = version;
    this.kk7_1 = encoding;
    this.lk7_1 = standalone;
  };
  protoOf(DomWriter).hk8 = function () {
    this.ek7_1 = null;
  };
  protoOf(DomWriter).ik8 = function (namespace, localName, prefix) {
    this.ik7_1 = this.ik7_1 - 1 | 0;
    writeIndent(this, 2147483647);
    this.ek7_1 = requireCurrent(this, 'No current element or no parent element').parentNode;
  };
  protoOf(DomWriter).jk8 = function (prefix) {
    var tmp0_safe_receiver = this.ek7_1;
    return tmp0_safe_receiver == null ? null : myLookupNamespaceURI(tmp0_safe_receiver, prefix);
  };
  protoOf(DomWriter).kk8 = function (namespaceUri) {
    var tmp1_safe_receiver = this.ek7_1;
    var tmp;
    if (tmp1_safe_receiver == null) {
      tmp = null;
    } else {
      tmp = myLookupPrefix(tmp1_safe_receiver, namespaceUri == null ? '' : namespaceUri);
    }
    return tmp;
  };
  protoOf(DomWriter).n = function () {
    var tmp = this.ik7_1 === 0;
    assert(tmp, DomWriter$close$lambda(this));
    this.ek7_1 = null;
  };
  function EventType$START_DOCUMENT() {
    EventType.call(this, 'START_DOCUMENT', 0);
    EventType_START_DOCUMENT_instance = this;
  }
  protoOf(EventType$START_DOCUMENT).qk8 = function (reader) {
    // Inline function 'kotlin.run' call
    // Inline function 'kotlin.contracts.contract' call
    // Inline function 'nl.adaptivity.xmlutil.START_DOCUMENT.createEvent.<anonymous>' call
    return new StartDocumentEvent(reader.pk6(), reader.g3g(), reader.sk6(), reader.tk6());
  };
  protoOf(EventType$START_DOCUMENT).rk8 = function (writer, reader) {
    writer.fk8(reader.g3g(), reader.sk6(), reader.tk6());
  };
  var EventType_START_DOCUMENT_instance;
  function EventType$START_ELEMENT() {
    EventType.call(this, 'START_ELEMENT', 1);
    EventType_START_ELEMENT_instance = this;
  }
  protoOf(EventType$START_ELEMENT).qk8 = function (reader) {
    // Inline function 'kotlin.run' call
    // Inline function 'kotlin.contracts.contract' call
    // Inline function 'nl.adaptivity.xmlutil.START_ELEMENT.createEvent.<anonymous>' call
    return new StartElementEvent(reader.pk6(), reader.fk6(), reader.gk6(), reader.hk6(), get_attributes(reader), reader.qk6().bk6(), reader.rk6());
  };
  protoOf(EventType$START_ELEMENT).rk8 = function (writer, reader) {
    writer.ak8(reader.fk6(), reader.gk6(), reader.hk6());
    var tmp0_iterator = reader.rk6().w();
    while (tmp0_iterator.f()) {
      var attr = tmp0_iterator.e();
      writer.zk7(attr.hk6(), attr.fk6());
    }
    var inductionVariable = 0;
    var last = reader.nk6();
    if (inductionVariable < last)
      do {
        var i = inductionVariable;
        inductionVariable = inductionVariable + 1 | 0;
        var attrNs = reader.uk6(i);
        if (!(attrNs === 'http://www.w3.org/2000/xmlns/')) {
          var attrPrefix = reader.vk6(i);
          var tmp;
          if (attrNs === '') {
            tmp = '';
          } else if (attrNs === writer.qk6().zk5(attrPrefix)) {
            tmp = attrPrefix;
          } else {
            var tmp3_elvis_lhs = writer.qk6().ak6(attrNs);
            tmp = tmp3_elvis_lhs == null ? attrPrefix : tmp3_elvis_lhs;
          }
          var prefix = tmp;
          writer.ek8(attrNs, reader.wk6(i), prefix, reader.xk6(i));
        }
      }
       while (inductionVariable < last);
  };
  var EventType_START_ELEMENT_instance;
  function EventType$END_ELEMENT() {
    EventType.call(this, 'END_ELEMENT', 2);
    EventType_END_ELEMENT_instance = this;
  }
  protoOf(EventType$END_ELEMENT).qk8 = function (reader) {
    // Inline function 'kotlin.run' call
    // Inline function 'kotlin.contracts.contract' call
    // Inline function 'nl.adaptivity.xmlutil.END_ELEMENT.createEvent.<anonymous>' call
    return new EndElementEvent(reader.pk6(), reader.fk6(), reader.gk6(), reader.hk6(), reader.qk6());
  };
  protoOf(EventType$END_ELEMENT).rk8 = function (writer, reader) {
    writer.ik8(reader.fk6(), reader.gk6(), reader.hk6());
  };
  var EventType_END_ELEMENT_instance;
  function EventType$COMMENT() {
    EventType.call(this, 'COMMENT', 3);
    EventType_COMMENT_instance = this;
  }
  protoOf(EventType$COMMENT).uk8 = function () {
    return true;
  };
  protoOf(EventType$COMMENT).qk8 = function (reader) {
    // Inline function 'kotlin.run' call
    // Inline function 'kotlin.contracts.contract' call
    // Inline function 'nl.adaptivity.xmlutil.COMMENT.createEvent.<anonymous>' call
    return new TextEvent(reader.pk6(), EventType_COMMENT_getInstance(), reader.mk6());
  };
  protoOf(EventType$COMMENT).vk8 = function (writer, textEvent) {
    writer.uk7(textEvent.pk7_1);
  };
  protoOf(EventType$COMMENT).rk8 = function (writer, reader) {
    writer.uk7(reader.mk6());
  };
  var EventType_COMMENT_instance;
  function EventType$TEXT() {
    EventType.call(this, 'TEXT', 4);
    EventType_TEXT_instance = this;
  }
  protoOf(EventType$TEXT).uk8 = function () {
    return true;
  };
  protoOf(EventType$TEXT).qk8 = function (reader) {
    // Inline function 'kotlin.run' call
    // Inline function 'kotlin.contracts.contract' call
    // Inline function 'nl.adaptivity.xmlutil.TEXT.createEvent.<anonymous>' call
    return new TextEvent(reader.pk6(), EventType_TEXT_getInstance(), reader.mk6());
  };
  protoOf(EventType$TEXT).vk8 = function (writer, textEvent) {
    writer.bk8(textEvent.pk7_1);
  };
  protoOf(EventType$TEXT).rk8 = function (writer, reader) {
    writer.bk8(reader.mk6());
  };
  var EventType_TEXT_instance;
  function EventType$CDSECT() {
    EventType.call(this, 'CDSECT', 5);
    EventType_CDSECT_instance = this;
  }
  protoOf(EventType$CDSECT).uk8 = function () {
    return true;
  };
  protoOf(EventType$CDSECT).qk8 = function (reader) {
    // Inline function 'kotlin.run' call
    // Inline function 'kotlin.contracts.contract' call
    // Inline function 'nl.adaptivity.xmlutil.CDSECT.createEvent.<anonymous>' call
    return new TextEvent(reader.pk6(), EventType_CDSECT_getInstance(), reader.mk6());
  };
  protoOf(EventType$CDSECT).vk8 = function (writer, textEvent) {
    writer.ck8(textEvent.pk7_1);
  };
  protoOf(EventType$CDSECT).rk8 = function (writer, reader) {
    writer.ck8(reader.mk6());
  };
  var EventType_CDSECT_instance;
  function EventType$DOCDECL() {
    EventType.call(this, 'DOCDECL', 6);
    EventType_DOCDECL_instance = this;
  }
  protoOf(EventType$DOCDECL).qk8 = function (reader) {
    // Inline function 'kotlin.run' call
    // Inline function 'kotlin.contracts.contract' call
    // Inline function 'nl.adaptivity.xmlutil.DOCDECL.createEvent.<anonymous>' call
    return new TextEvent(reader.pk6(), EventType_DOCDECL_getInstance(), reader.mk6());
  };
  protoOf(EventType$DOCDECL).vk8 = function (writer, textEvent) {
    writer.xk7(textEvent.pk7_1);
  };
  protoOf(EventType$DOCDECL).rk8 = function (writer, reader) {
    writer.xk7(reader.mk6());
  };
  var EventType_DOCDECL_instance;
  function EventType$END_DOCUMENT() {
    EventType.call(this, 'END_DOCUMENT', 7);
    EventType_END_DOCUMENT_instance = this;
  }
  protoOf(EventType$END_DOCUMENT).qk8 = function (reader) {
    // Inline function 'kotlin.run' call
    // Inline function 'kotlin.contracts.contract' call
    // Inline function 'nl.adaptivity.xmlutil.END_DOCUMENT.createEvent.<anonymous>' call
    return new EndDocumentEvent(reader.pk6());
  };
  protoOf(EventType$END_DOCUMENT).rk8 = function (writer, reader) {
    writer.hk8();
  };
  var EventType_END_DOCUMENT_instance;
  function EventType$ENTITY_REF() {
    EventType.call(this, 'ENTITY_REF', 8);
    EventType_ENTITY_REF_instance = this;
  }
  protoOf(EventType$ENTITY_REF).uk8 = function () {
    return true;
  };
  protoOf(EventType$ENTITY_REF).qk8 = function (reader) {
    // Inline function 'kotlin.run' call
    // Inline function 'kotlin.contracts.contract' call
    // Inline function 'nl.adaptivity.xmlutil.ENTITY_REF.createEvent.<anonymous>' call
    return new EntityRefEvent(reader.pk6(), reader.gk6(), reader.mk6());
  };
  protoOf(EventType$ENTITY_REF).vk8 = function (writer, textEvent) {
    writer.bk8(textEvent.pk7_1);
  };
  protoOf(EventType$ENTITY_REF).rk8 = function (writer, reader) {
    writer.bk8(reader.mk6());
  };
  var EventType_ENTITY_REF_instance;
  function EventType$IGNORABLE_WHITESPACE() {
    EventType.call(this, 'IGNORABLE_WHITESPACE', 9);
    EventType_IGNORABLE_WHITESPACE_instance = this;
  }
  protoOf(EventType$IGNORABLE_WHITESPACE).uk8 = function () {
    return true;
  };
  protoOf(EventType$IGNORABLE_WHITESPACE).qk8 = function (reader) {
    // Inline function 'kotlin.run' call
    // Inline function 'kotlin.contracts.contract' call
    // Inline function 'nl.adaptivity.xmlutil.IGNORABLE_WHITESPACE.createEvent.<anonymous>' call
    return new TextEvent(reader.pk6(), EventType_IGNORABLE_WHITESPACE_getInstance(), reader.mk6());
  };
  protoOf(EventType$IGNORABLE_WHITESPACE).vk8 = function (writer, textEvent) {
    writer.mk7(textEvent.pk7_1);
  };
  protoOf(EventType$IGNORABLE_WHITESPACE).rk8 = function (writer, reader) {
    writer.mk7(reader.mk6());
  };
  var EventType_IGNORABLE_WHITESPACE_instance;
  function EventType$ATTRIBUTE() {
    EventType.call(this, 'ATTRIBUTE', 10);
    EventType_ATTRIBUTE_instance = this;
  }
  protoOf(EventType$ATTRIBUTE).qk8 = function (reader) {
    // Inline function 'kotlin.run' call
    // Inline function 'kotlin.contracts.contract' call
    // Inline function 'nl.adaptivity.xmlutil.ATTRIBUTE.createEvent.<anonymous>' call
    return new Attribute(reader.pk6(), reader.fk6(), reader.gk6(), reader.hk6(), reader.mk6());
  };
  protoOf(EventType$ATTRIBUTE).rk8 = function (writer, reader) {
    writer.ek8(reader.fk6(), reader.gk6(), reader.hk6(), reader.mk6());
  };
  var EventType_ATTRIBUTE_instance;
  function EventType$PROCESSING_INSTRUCTION() {
    EventType.call(this, 'PROCESSING_INSTRUCTION', 11);
    EventType_PROCESSING_INSTRUCTION_instance = this;
  }
  protoOf(EventType$PROCESSING_INSTRUCTION).uk8 = function () {
    return true;
  };
  protoOf(EventType$PROCESSING_INSTRUCTION).qk8 = function (reader) {
    return new ProcessingInstructionEvent(reader.pk6(), reader.kk6(), reader.lk6());
  };
  protoOf(EventType$PROCESSING_INSTRUCTION).vk8 = function (writer, textEvent) {
    var tmp;
    if (textEvent instanceof ProcessingInstructionEvent) {
      writer.wk7(textEvent.vk9_1, textEvent.wk9_1);
      tmp = Unit_instance;
    } else {
      writer.vk7(textEvent.pk7_1);
      tmp = Unit_instance;
    }
    return tmp;
  };
  protoOf(EventType$PROCESSING_INSTRUCTION).rk8 = function (writer, reader) {
    writer.wk7(reader.kk6(), reader.lk6());
  };
  var EventType_PROCESSING_INSTRUCTION_instance;
  var EventType_entriesInitialized;
  function EventType_initEntries() {
    if (EventType_entriesInitialized)
      return Unit_instance;
    EventType_entriesInitialized = true;
    EventType_START_DOCUMENT_instance = new EventType$START_DOCUMENT();
    EventType_START_ELEMENT_instance = new EventType$START_ELEMENT();
    EventType_END_ELEMENT_instance = new EventType$END_ELEMENT();
    EventType_COMMENT_instance = new EventType$COMMENT();
    EventType_TEXT_instance = new EventType$TEXT();
    EventType_CDSECT_instance = new EventType$CDSECT();
    EventType_DOCDECL_instance = new EventType$DOCDECL();
    EventType_END_DOCUMENT_instance = new EventType$END_DOCUMENT();
    EventType_ENTITY_REF_instance = new EventType$ENTITY_REF();
    EventType_IGNORABLE_WHITESPACE_instance = new EventType$IGNORABLE_WHITESPACE();
    EventType_ATTRIBUTE_instance = new EventType$ATTRIBUTE();
    EventType_PROCESSING_INSTRUCTION_instance = new EventType$PROCESSING_INSTRUCTION();
  }
  function EventType(name, ordinal) {
    Enum.call(this, name, ordinal);
  }
  protoOf(EventType).uk8 = function () {
    return false;
  };
  protoOf(EventType).vk8 = function (writer, textEvent) {
    throw UnsupportedOperationException_init_$Create$('This is not generally supported, only by text types');
  };
  function EventType_START_DOCUMENT_getInstance() {
    EventType_initEntries();
    return EventType_START_DOCUMENT_instance;
  }
  function EventType_START_ELEMENT_getInstance() {
    EventType_initEntries();
    return EventType_START_ELEMENT_instance;
  }
  function EventType_END_ELEMENT_getInstance() {
    EventType_initEntries();
    return EventType_END_ELEMENT_instance;
  }
  function EventType_COMMENT_getInstance() {
    EventType_initEntries();
    return EventType_COMMENT_instance;
  }
  function EventType_TEXT_getInstance() {
    EventType_initEntries();
    return EventType_TEXT_instance;
  }
  function EventType_CDSECT_getInstance() {
    EventType_initEntries();
    return EventType_CDSECT_instance;
  }
  function EventType_DOCDECL_getInstance() {
    EventType_initEntries();
    return EventType_DOCDECL_instance;
  }
  function EventType_END_DOCUMENT_getInstance() {
    EventType_initEntries();
    return EventType_END_DOCUMENT_instance;
  }
  function EventType_ENTITY_REF_getInstance() {
    EventType_initEntries();
    return EventType_ENTITY_REF_instance;
  }
  function EventType_IGNORABLE_WHITESPACE_getInstance() {
    EventType_initEntries();
    return EventType_IGNORABLE_WHITESPACE_instance;
  }
  function EventType_ATTRIBUTE_getInstance() {
    EventType_initEntries();
    return EventType_ATTRIBUTE_instance;
  }
  function EventType_PROCESSING_INSTRUCTION_getInstance() {
    EventType_initEntries();
    return EventType_PROCESSING_INSTRUCTION_instance;
  }
  function Namespace$Companion$descriptor$lambda($this$buildClassSerialDescriptor) {
    // Inline function 'kotlinx.serialization.descriptors.serialDescriptor' call
    // Inline function 'kotlinx.serialization.serializer' call
    // Inline function 'kotlinx.serialization.internal.cast' call
    var this_0 = serializer(createKType(PrimitiveClasses_getInstance().g8(), arrayOf([]), false));
    var tmp$ret$2 = (isInterface(this_0, KSerializer) ? this_0 : THROW_CCE()).v4a();
    $this$buildClassSerialDescriptor.g4b('prefix', tmp$ret$2);
    // Inline function 'kotlinx.serialization.descriptors.serialDescriptor' call
    // Inline function 'kotlinx.serialization.serializer' call
    // Inline function 'kotlinx.serialization.internal.cast' call
    var this_1 = serializer(createKType(PrimitiveClasses_getInstance().g8(), arrayOf([]), false));
    var tmp$ret$5 = (isInterface(this_1, KSerializer) ? this_1 : THROW_CCE()).v4a();
    $this$buildClassSerialDescriptor.g4b('namespaceURI', tmp$ret$5);
    return Unit_instance;
  }
  function Companion_0() {
    Companion_instance_1 = this;
    var tmp = this;
    var tmp_0 = ensureNotNull(getKClass(Namespace).f7());
    tmp.xk9_1 = buildClassSerialDescriptor(tmp_0, [], Namespace$Companion$descriptor$lambda);
  }
  protoOf(Companion_0).v4a = function () {
    return this.xk9_1;
  };
  protoOf(Companion_0).x4a = function (decoder) {
    var prefix = {_v: null};
    var namespaceUri = {_v: null};
    // Inline function 'kotlinx.serialization.encoding.decodeStructure' call
    var descriptor = this.xk9_1;
    var composite = decoder.n4e(descriptor);
    var index = composite.d4f(Companion_getInstance_0().xk9_1);
    $l$loop: while (true) {
      var tmp = index;
      if (!!(tmp === -1)) {
        break $l$loop;
      }
      var tmp0_subject = index;
      if (tmp0_subject === 0) {
        prefix._v = composite.x4e(Companion_getInstance_0().xk9_1, index);
      } else if (tmp0_subject === 1) {
        namespaceUri._v = composite.x4e(Companion_getInstance_0().xk9_1, index);
      }
      index = composite.d4f(Companion_getInstance_0().xk9_1);
    }
    var result = Unit_instance;
    composite.o4e(descriptor);
    var tmp_0;
    if (prefix._v == null) {
      throwUninitializedPropertyAccessException('prefix');
    } else {
      tmp_0 = prefix._v;
    }
    var tmp_1 = tmp_0;
    var tmp_2;
    if (namespaceUri._v == null) {
      throwUninitializedPropertyAccessException('namespaceUri');
    } else {
      tmp_2 = namespaceUri._v;
    }
    return new NamespaceImpl(tmp_1, tmp_2);
  };
  protoOf(Companion_0).yk9 = function (encoder, value) {
    // Inline function 'kotlinx.serialization.encoding.encodeStructure' call
    var descriptor = this.xk9_1;
    var composite = encoder.n4e(descriptor);
    // Inline function 'nl.adaptivity.xmlutil.Companion.serialize.<anonymous>' call
    composite.b4g(Companion_getInstance_0().xk9_1, 0, value.hk6());
    composite.b4g(Companion_getInstance_0().xk9_1, 1, value.fk6());
    composite.o4e(descriptor);
  };
  protoOf(Companion_0).w4a = function (encoder, value) {
    return this.yk9(encoder, (!(value == null) ? isInterface(value, Namespace) : false) ? value : THROW_CCE());
  };
  var Companion_instance_1;
  function Companion_getInstance_0() {
    if (Companion_instance_1 == null)
      new Companion_0();
    return Companion_instance_1;
  }
  function Namespace() {
  }
  function IterableNamespaceContext() {
  }
  function QNameSerializer$descriptor$lambda($this$buildClassSerialDescriptor) {
    var stringSerializer = serializer_0(StringCompanionObject_instance);
    $this$buildClassSerialDescriptor.g4b('namespace', stringSerializer.v4a(), VOID, true);
    $this$buildClassSerialDescriptor.g4b('localPart', stringSerializer.v4a());
    $this$buildClassSerialDescriptor.g4b('prefix', stringSerializer.v4a(), VOID, true);
    return Unit_instance;
  }
  function QNameSerializer() {
    QNameSerializer_instance = this;
    var tmp = this;
    tmp.zk9_1 = buildClassSerialDescriptor('javax.xml.namespace.QName', [], QNameSerializer$descriptor$lambda);
  }
  protoOf(QNameSerializer).v4a = function () {
    return this.zk9_1;
  };
  protoOf(QNameSerializer).x4a = function (decoder) {
    // Inline function 'kotlinx.serialization.encoding.decodeStructure' call
    var descriptor = this.zk9_1;
    var composite = decoder.n4e(descriptor);
    // Inline function 'nl.adaptivity.xmlutil.QNameSerializer.deserialize.<anonymous>' call
    var prefix = '';
    var namespace = '';
    var localPart = null;
    loop: while (true) {
      var tmp0_subject = composite.d4f(QNameSerializer_getInstance().zk9_1);
      if (tmp0_subject === -1)
        break loop;
      else {
        if (tmp0_subject === 0)
          namespace = composite.x4e(QNameSerializer_getInstance().zk9_1, 0);
        else {
          if (tmp0_subject === 1)
            localPart = composite.x4e(QNameSerializer_getInstance().zk9_1, 1);
          else {
            if (tmp0_subject === 2)
              prefix = composite.x4e(QNameSerializer_getInstance().zk9_1, 2);
          }
        }
      }
    }
    var tmp = namespace;
    var tmp_0;
    if (localPart == null) {
      throwUninitializedPropertyAccessException('localPart');
    } else {
      tmp_0 = localPart;
    }
    var result = new QName(tmp, tmp_0, prefix);
    composite.o4e(descriptor);
    return result;
  };
  protoOf(QNameSerializer).aka = function (encoder, value) {
    // Inline function 'kotlinx.serialization.encoding.encodeStructure' call
    var descriptor = this.zk9_1;
    var composite = encoder.n4e(descriptor);
    // Inline function 'nl.adaptivity.xmlutil.QNameSerializer.serialize.<anonymous>' call
    // Inline function 'kotlin.let' call
    // Inline function 'nl.adaptivity.xmlutil.namespaceURI' call
    // Inline function 'kotlin.contracts.contract' call
    var ns = value.eka();
    var tmp;
    var tmp_0;
    // Inline function 'kotlin.text.isNotEmpty' call
    if (charSequenceLength(ns) > 0) {
      tmp_0 = true;
    } else {
      tmp_0 = composite.j4g(QNameSerializer_getInstance().zk9_1, 0);
    }
    if (tmp_0) {
      composite.b4g(QNameSerializer_getInstance().zk9_1, 0, ns);
      tmp = Unit_instance;
    }
    var tmp_1 = QNameSerializer_getInstance().zk9_1;
    // Inline function 'nl.adaptivity.xmlutil.localPart' call
    var tmp$ret$3 = value.fka();
    composite.b4g(tmp_1, 1, tmp$ret$3);
    // Inline function 'kotlin.let' call
    // Inline function 'nl.adaptivity.xmlutil.prefix' call
    // Inline function 'kotlin.contracts.contract' call
    var prefix = value.gka();
    var tmp_2;
    var tmp_3;
    // Inline function 'kotlin.text.isNotEmpty' call
    if (charSequenceLength(prefix) > 0) {
      tmp_3 = true;
    } else {
      tmp_3 = composite.j4g(QNameSerializer_getInstance().zk9_1, 2);
    }
    if (tmp_3) {
      composite.b4g(QNameSerializer_getInstance().zk9_1, 2, prefix);
      tmp_2 = Unit_instance;
    }
    composite.o4e(descriptor);
  };
  protoOf(QNameSerializer).w4a = function (encoder, value) {
    return this.aka(encoder, value instanceof QName ? value : THROW_CCE());
  };
  var QNameSerializer_instance;
  function QNameSerializer_getInstance() {
    if (QNameSerializer_instance == null)
      new QNameSerializer();
    return QNameSerializer_instance;
  }
  function isEquivalent(_this__u8e3s4, other) {
    return _this__u8e3s4.fka() === other.fka() ? _this__u8e3s4.eka() === other.eka() : false;
  }
  function toNamespace(_this__u8e3s4) {
    // Inline function 'nl.adaptivity.xmlutil.prefix' call
    var tmp = _this__u8e3s4.gka();
    // Inline function 'nl.adaptivity.xmlutil.namespaceURI' call
    var tmp$ret$1 = _this__u8e3s4.eka();
    return new NamespaceImpl(tmp, tmp$ret$1);
  }
  function SimpleIterator($outer) {
    this.ika_1 = $outer;
    this.hka_1 = 0;
  }
  protoOf(SimpleIterator).f = function () {
    return this.hka_1 < this.ika_1.u();
  };
  protoOf(SimpleIterator).e = function () {
    var tmp1 = this.hka_1;
    this.hka_1 = tmp1 + 1 | 0;
    return new SimpleNamespace(this.ika_1, tmp1);
  };
  function SimpleNamespace($outer, pos) {
    this.lka_1 = $outer;
    this.kka_1 = pos;
  }
  protoOf(SimpleNamespace).hk6 = function () {
    return this.lka_1.mka(this.kka_1);
  };
  protoOf(SimpleNamespace).fk6 = function () {
    return this.lka_1.nka(this.kka_1);
  };
  protoOf(SimpleNamespace).hashCode = function () {
    return imul(getStringHashCode(this.hk6()), 31) + getStringHashCode(this.fk6()) | 0;
  };
  protoOf(SimpleNamespace).equals = function (other) {
    if (this === other)
      return true;
    if (!(!(other == null) ? isInterface(other, Namespace) : false))
      return false;
    return this.hk6() === other.hk6() ? this.fk6() === other.fk6() : false;
  };
  protoOf(SimpleNamespace).toString = function () {
    return '{' + this.hk6() + ':' + this.fk6() + '}';
  };
  function SimpleNamespaceContext_init_$Init$($this) {
    // Inline function 'kotlin.emptyArray' call
    var tmp$ret$0 = [];
    SimpleNamespaceContext.call($this, tmp$ret$0);
    return $this;
  }
  function SimpleNamespaceContext_init_$Create$() {
    return SimpleNamespaceContext_init_$Init$(objectCreate(protoOf(SimpleNamespaceContext)));
  }
  function SimpleNamespaceContext_init_$Init$_0(prefixMap, $this) {
    // Inline function 'nl.adaptivity.xmlutil.Companion.flatten' call
    Companion_getInstance_1();
    var namespaces = prefixMap.q2();
    var tmp = asSequence_0(namespaces);
    var filler = flatMap(tmp, SimpleNamespaceContext$_init_$lambda_w7q6ud).w();
    var tmp_0 = 0;
    var tmp_1 = imul(namespaces.u(), 2);
    // Inline function 'kotlin.arrayOfNulls' call
    var tmp_2 = fillArrayVal(Array(tmp_1), null);
    while (tmp_0 < tmp_1) {
      tmp_2[tmp_0] = filler.e();
      tmp_0 = tmp_0 + 1 | 0;
    }
    SimpleNamespaceContext.call($this, tmp_2);
    return $this;
  }
  function SimpleNamespaceContext_init_$Create$_0(prefixMap) {
    return SimpleNamespaceContext_init_$Init$_0(prefixMap, objectCreate(protoOf(SimpleNamespaceContext)));
  }
  function SimpleNamespaceContext_init_$Init$_1(prefixes, namespaces, $this) {
    var tmp = 0;
    var tmp_0 = imul(prefixes.length, 2);
    // Inline function 'kotlin.arrayOfNulls' call
    var tmp_1 = fillArrayVal(Array(tmp_0), null);
    while (tmp < tmp_0) {
      var tmp_2 = tmp;
      tmp_1[tmp_2] = toString((tmp_2 % 2 | 0) === 0 ? prefixes[tmp_2 / 2 | 0] : namespaces[tmp_2 / 2 | 0]);
      tmp = tmp + 1 | 0;
    }
    SimpleNamespaceContext.call($this, tmp_1);
    return $this;
  }
  function SimpleNamespaceContext_init_$Init$_2(namespaces, $this) {
    // Inline function 'nl.adaptivity.xmlutil.Companion.flatten' call
    Companion_getInstance_1();
    var tmp = asSequence_0(namespaces);
    var filler = flatMap(tmp, SimpleNamespaceContext$_init_$lambda_w7q6ud_0).w();
    var tmp_0 = 0;
    var tmp_1 = imul(namespaces.u(), 2);
    // Inline function 'kotlin.arrayOfNulls' call
    var tmp_2 = fillArrayVal(Array(tmp_1), null);
    while (tmp_0 < tmp_1) {
      tmp_2[tmp_0] = filler.e();
      tmp_0 = tmp_0 + 1 | 0;
    }
    SimpleNamespaceContext.call($this, tmp_2);
    return $this;
  }
  function SimpleNamespaceContext_init_$Create$_1(namespaces) {
    return SimpleNamespaceContext_init_$Init$_2(namespaces, objectCreate(protoOf(SimpleNamespaceContext)));
  }
  function SimpleNamespaceContext_init_$Init$_3(namespaces, $this) {
    var tmp0_elvis_lhs = isInterface(namespaces, Collection) ? namespaces : null;
    SimpleNamespaceContext_init_$Init$_2(tmp0_elvis_lhs == null ? toList(namespaces) : tmp0_elvis_lhs, $this);
    return $this;
  }
  function SimpleNamespaceContext_init_$Create$_2(namespaces) {
    return SimpleNamespaceContext_init_$Init$_3(namespaces, objectCreate(protoOf(SimpleNamespaceContext)));
  }
  function Companion_1() {
    Companion_instance_2 = this;
    this.oka_1 = ListSerializer(Companion_getInstance_0());
    this.pka_1 = SerialDescriptor('nl.adaptivity.xmlutil.SimpleNamespaceContext', this.oka_1.v4a());
  }
  protoOf(Companion_1).v4a = function () {
    return this.pka_1;
  };
  protoOf(Companion_1).qka = function (originalNSContext) {
    var tmp;
    if (originalNSContext instanceof SimpleNamespaceContext) {
      tmp = originalNSContext;
    } else {
      tmp = SimpleNamespaceContext_init_$Create$_2(originalNSContext);
    }
    return tmp;
  };
  protoOf(Companion_1).x4a = function (decoder) {
    return SimpleNamespaceContext_init_$Create$_1(this.oka_1.x4a(decoder));
  };
  protoOf(Companion_1).rka = function (encoder, value) {
    this.oka_1.w4a(encoder, toList(value));
  };
  protoOf(Companion_1).w4a = function (encoder, value) {
    return this.rka(encoder, value instanceof SimpleNamespaceContext ? value : THROW_CCE());
  };
  var Companion_instance_2;
  function Companion_getInstance_1() {
    if (Companion_instance_2 == null)
      new Companion_1();
    return Companion_instance_2;
  }
  function SimpleNamespaceContext$_init_$lambda_w7q6ud(it) {
    // Inline function 'nl.adaptivity.xmlutil.SimpleNamespaceContext.<init>.<anonymous>' call
    var tmp = toString(it.s2());
    // Inline function 'nl.adaptivity.xmlutil.SimpleNamespaceContext.<init>.<anonymous>' call
    var tmp$ret$1 = toString(it.t2());
    return sequenceOf([tmp, tmp$ret$1]);
  }
  function SimpleNamespaceContext$_init_$lambda_w7q6ud_0(it) {
    // Inline function 'nl.adaptivity.xmlutil.SimpleNamespaceContext.<init>.<anonymous>' call
    var tmp = it.hk6();
    // Inline function 'nl.adaptivity.xmlutil.SimpleNamespaceContext.<init>.<anonymous>' call
    var tmp$ret$1 = it.fk6();
    return sequenceOf([tmp, tmp$ret$1]);
  }
  function SimpleNamespaceContext$getPrefixSequence$lambda(this$0, $namespaceURI) {
    return function (it) {
      return this$0.nka(it) === $namespaceURI;
    };
  }
  function SimpleNamespaceContext$getPrefixSequence$lambda_0(this$0) {
    return function (it) {
      return this$0.mka(it);
    };
  }
  function SimpleNamespaceContext(buffer) {
    Companion_getInstance_1();
    this.jka_1 = buffer;
  }
  protoOf(SimpleNamespaceContext).ska = function () {
    return until(0, this.u());
  };
  protoOf(SimpleNamespaceContext).u = function () {
    return this.jka_1.length / 2 | 0;
  };
  protoOf(SimpleNamespaceContext).bk6 = function () {
    return this;
  };
  protoOf(SimpleNamespaceContext).zk5 = function (prefix) {
    var tmp;
    if (prefix === 'xml') {
      tmp = 'http://www.w3.org/XML/1998/namespace';
    } else {
      if (prefix === 'xmlns') {
        tmp = 'http://www.w3.org/2000/xmlns/';
      } else {
        // Inline function 'kotlin.collections.filter' call
        // Inline function 'kotlin.collections.filterTo' call
        var this_0 = reversed(this.ska());
        var destination = ArrayList_init_$Create$();
        var tmp0_iterator = this_0.w();
        while (tmp0_iterator.f()) {
          var element = tmp0_iterator.e();
          // Inline function 'nl.adaptivity.xmlutil.SimpleNamespaceContext.getNamespaceURI.<anonymous>' call
          if (this.mka(element) === prefix) {
            destination.i1(element);
          }
        }
        var tmp1_safe_receiver = firstOrNull(destination);
        var tmp_0;
        if (tmp1_safe_receiver == null) {
          tmp_0 = null;
        } else {
          // Inline function 'kotlin.let' call
          // Inline function 'kotlin.contracts.contract' call
          // Inline function 'nl.adaptivity.xmlutil.SimpleNamespaceContext.getNamespaceURI.<anonymous>' call
          tmp_0 = this.nka(tmp1_safe_receiver);
        }
        tmp = tmp_0;
      }
    }
    return tmp;
  };
  protoOf(SimpleNamespaceContext).ak6 = function (namespaceURI) {
    return firstOrNull_0(this.tka(namespaceURI));
  };
  protoOf(SimpleNamespaceContext).tka = function (namespaceURI) {
    var tmp;
    if (namespaceURI === 'http://www.w3.org/XML/1998/namespace') {
      tmp = sequenceOf(['xml']);
    } else {
      if (namespaceURI === '') {
        tmp = sequenceOf(['']);
      } else {
        if (namespaceURI === 'http://www.w3.org/2000/xmlns/') {
          tmp = sequenceOf(['xmlns']);
        } else {
          var tmp_0 = asSequence_0(reversed(this.ska()));
          var tmp_1 = filter(tmp_0, SimpleNamespaceContext$getPrefixSequence$lambda(this, namespaceURI));
          tmp = map(tmp_1, SimpleNamespaceContext$getPrefixSequence$lambda_0(this));
        }
      }
    }
    return tmp;
  };
  protoOf(SimpleNamespaceContext).ck6 = function (namespaceURI) {
    return this.tka(namespaceURI).w();
  };
  protoOf(SimpleNamespaceContext).mka = function (index) {
    try {
      return this.jka_1[imul(index, 2)];
    } catch ($p) {
      if ($p instanceof IndexOutOfBoundsException) {
        var e = $p;
        throw IndexOutOfBoundsException_init_$Create$_0('Index out of range: ' + index);
      } else {
        throw $p;
      }
    }
  };
  protoOf(SimpleNamespaceContext).nka = function (index) {
    try {
      return this.jka_1[imul(index, 2) + 1 | 0];
    } catch ($p) {
      if ($p instanceof IndexOutOfBoundsException) {
        var e = $p;
        throw IndexOutOfBoundsException_init_$Create$_0('Index out of range: ' + index);
      } else {
        throw $p;
      }
    }
  };
  protoOf(SimpleNamespaceContext).w = function () {
    return new SimpleIterator(this);
  };
  protoOf(SimpleNamespaceContext).dk6 = function (secondary) {
    var tmp;
    var tmp_0;
    if (secondary instanceof SimpleNamespaceContext) {
      tmp_0 = secondary.u() === 0;
    } else {
      tmp_0 = false;
    }
    if (tmp_0) {
      tmp = this;
    } else {
      var tmp_1;
      if (secondary instanceof SimpleNamespaceContext) {
        tmp_1 = this.u() === 0;
      } else {
        tmp_1 = false;
      }
      if (tmp_1) {
        tmp = secondary;
      } else {
        tmp = plus_0.call(this, secondary);
      }
    }
    return tmp;
  };
  protoOf(SimpleNamespaceContext).equals = function (other) {
    if (this === other)
      return true;
    if (!(other instanceof SimpleNamespaceContext))
      return false;
    if (!contentEquals(this.jka_1, other.jka_1))
      return false;
    return true;
  };
  protoOf(SimpleNamespaceContext).hashCode = function () {
    return contentHashCode(this.jka_1);
  };
  function XMLConstants() {
    this.uka_1 = '';
    this.vka_1 = '';
    this.wka_1 = 'http://www.w3.org/2000/xmlns/';
    this.xka_1 = 'xmlns';
    this.yka_1 = 'xml';
    this.zka_1 = 'http://www.w3.org/XML/1998/namespace';
    this.akb_1 = 'xsi';
    this.bkb_1 = 'http://www.w3.org/2001/XMLSchema-instance';
    this.ckb_1 = 'xsd';
    this.dkb_1 = 'http://www.w3.org/2001/XMLSchema';
  }
  var XMLConstants_instance;
  function XMLConstants_getInstance() {
    return XMLConstants_instance;
  }
  function XmlBufferedReader(delegate) {
    XmlBufferedReaderBase.call(this, delegate);
    this.hkb_1 = ArrayDeque_init_$Create$();
  }
  protoOf(XmlBufferedReader).ikb = function () {
    // Inline function 'kotlin.collections.isNotEmpty' call
    return !this.hkb_1.c1();
  };
  protoOf(XmlBufferedReader).jkb = function () {
    return this.hkb_1.hf();
  };
  protoOf(XmlBufferedReader).kkb = function () {
    return this.hkb_1.kf();
  };
  protoOf(XmlBufferedReader).lkb = function () {
    var tmp0_elvis_lhs = this.okb_1;
    var tmp;
    if (tmp0_elvis_lhs == null) {
      throw XmlException_init_$Create$_0('Push back fails due to missing current element');
    } else {
      tmp = tmp0_elvis_lhs;
    }
    var c = tmp;
    switch (c.ok6().za_1) {
      case 1:
        this.qkb();
        break;
      case 2:
        this.rkb();
        break;
      default:
        break;
    }
    this.hkb_1.if(c);
  };
  protoOf(XmlBufferedReader).skb = function (events) {
    this.hkb_1.m1(events);
  };
  protoOf(XmlBufferedReader).n = function () {
    protoOf(XmlBufferedReaderBase).n.call(this);
    this.hkb_1.n1();
  };
  function _get_currentElement__mbt3qg($this) {
    var tmp = $this.okb_1;
    var tmp0_elvis_lhs = tmp instanceof StartElementEvent ? tmp : null;
    var tmp_0;
    if (tmp0_elvis_lhs == null) {
      throw XmlException_init_$Create$_0('Expected a start element, but did not find it.');
    } else {
      tmp_0 = tmp0_elvis_lhs;
    }
    return tmp_0;
  }
  function removeFirstToCurrent($this) {
    var event = $this.kkb();
    $this.okb_1 = event;
    switch (event.ok6().za_1) {
      case 1:
        $this.nkb_1.rkb();
        var start = event instanceof StartElementEvent ? event : THROW_CCE();
        var tmp1_iterator = start.rk6().w();
        while (tmp1_iterator.f()) {
          var ns = tmp1_iterator.e();
          $this.nkb_1.okc(ns);
        }

        break;
      case 2:
        $this.nkb_1.qkb();
        break;
      default:
        break;
    }
    return event;
  }
  function XmlBufferedReaderBase(delegate) {
    this.mkb_1 = delegate;
    this.nkb_1 = new NamespaceHolder();
    if (this.mkb_1.ik6()) {
      var tmp0_iterator = this.mkb_1.qk6().w();
      while (tmp0_iterator.f()) {
        var ns = tmp0_iterator.e();
        this.nkb_1.okc(ns);
      }
    }
    this.okb_1 = this.mkb_1.ik6() ? Companion_instance_3.pkc(this.mkb_1) : null;
  }
  protoOf(XmlBufferedReaderBase).fk6 = function () {
    var tmp0_safe_receiver = this.okb_1;
    var tmp1_subject = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.ok6();
    var tmp;
    switch (tmp1_subject == null ? -1 : tmp1_subject.za_1) {
      case 10:
        var tmp_0 = this.okb_1;
        tmp = (tmp_0 instanceof Attribute ? tmp_0 : THROW_CCE()).ukc_1;
        break;
      case 1:
        var tmp_1 = this.okb_1;
        tmp = (tmp_1 instanceof StartElementEvent ? tmp_1 : THROW_CCE()).wkc_1;
        break;
      case 2:
        var tmp_2 = this.okb_1;
        tmp = (tmp_2 instanceof EndElementEvent ? tmp_2 : THROW_CCE()).wkc_1;
        break;
      default:
        var tmp2_safe_receiver = this.okb_1;
        throw XmlException_init_$Create$_0('Attribute not defined here: namespaceUri (current event: ' + (tmp2_safe_receiver == null ? null : tmp2_safe_receiver.ok6()) + ')');
    }
    return tmp;
  };
  protoOf(XmlBufferedReaderBase).gk6 = function () {
    var tmp0_safe_receiver = this.okb_1;
    var tmp1_subject = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.ok6();
    var tmp;
    switch (tmp1_subject == null ? -1 : tmp1_subject.za_1) {
      case 8:
        var tmp_0 = this.okb_1;
        tmp = (tmp_0 instanceof EntityRefEvent ? tmp_0 : THROW_CCE()).ckd_1;
        break;
      case 10:
        var tmp_1 = this.okb_1;
        tmp = (tmp_1 instanceof Attribute ? tmp_1 : THROW_CCE()).tkc_1;
        break;
      case 1:
        var tmp_2 = this.okb_1;
        tmp = (tmp_2 instanceof StartElementEvent ? tmp_2 : THROW_CCE()).xkc_1;
        break;
      case 2:
        var tmp_3 = this.okb_1;
        tmp = (tmp_3 instanceof EndElementEvent ? tmp_3 : THROW_CCE()).xkc_1;
        break;
      default:
        throw XmlException_init_$Create$_0('Attribute not defined here: localName');
    }
    return tmp;
  };
  protoOf(XmlBufferedReaderBase).hk6 = function () {
    var tmp0_safe_receiver = this.okb_1;
    var tmp1_subject = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.ok6();
    var tmp;
    switch (tmp1_subject == null ? -1 : tmp1_subject.za_1) {
      case 10:
        var tmp_0 = this.okb_1;
        tmp = (tmp_0 instanceof Attribute ? tmp_0 : THROW_CCE()).skc_1;
        break;
      case 1:
        var tmp_1 = this.okb_1;
        tmp = (tmp_1 instanceof StartElementEvent ? tmp_1 : THROW_CCE()).ykc_1;
        break;
      case 2:
        var tmp_2 = this.okb_1;
        tmp = (tmp_2 instanceof EndElementEvent ? tmp_2 : THROW_CCE()).ykc_1;
        break;
      default:
        throw XmlException_init_$Create$_0('Attribute not defined here: prefix');
    }
    return tmp;
  };
  protoOf(XmlBufferedReaderBase).jk6 = function () {
    return this.nkb_1.fkc_1;
  };
  protoOf(XmlBufferedReaderBase).rkb = function () {
    this.nkb_1.rkb();
  };
  protoOf(XmlBufferedReaderBase).qkb = function () {
    this.nkb_1.qkb();
  };
  protoOf(XmlBufferedReaderBase).kk6 = function () {
    var tmp = this.okb_1;
    return (tmp instanceof ProcessingInstructionEvent ? tmp : THROW_CCE()).vk9_1;
  };
  protoOf(XmlBufferedReaderBase).lk6 = function () {
    var tmp = this.okb_1;
    return (tmp instanceof ProcessingInstructionEvent ? tmp : THROW_CCE()).wk9_1;
  };
  protoOf(XmlBufferedReaderBase).mk6 = function () {
    var tmp;
    if (ensureNotNull(this.okb_1).ok6() === EventType_ATTRIBUTE_getInstance()) {
      var tmp_0 = this.okb_1;
      tmp = (tmp_0 instanceof Attribute ? tmp_0 : THROW_CCE()).rkc_1;
    } else {
      var tmp_1 = this.okb_1;
      tmp = (tmp_1 instanceof TextEvent ? tmp_1 : THROW_CCE()).pk7_1;
    }
    return tmp;
  };
  protoOf(XmlBufferedReaderBase).nk6 = function () {
    return _get_currentElement__mbt3qg(this).lkc_1.length;
  };
  protoOf(XmlBufferedReaderBase).ik6 = function () {
    return !(this.okb_1 == null);
  };
  protoOf(XmlBufferedReaderBase).ok6 = function () {
    var tmp0_safe_receiver = this.okb_1;
    var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.ok6();
    var tmp;
    if (tmp1_elvis_lhs == null) {
      var tmp_0;
      if (this.f()) {
        throw XmlException_init_$Create$_0('Attempting to get the event type before getting an event.');
      } else {
        throw XmlException_init_$Create$_0('Attempting to read beyond the end of the stream');
      }
    } else {
      tmp = tmp1_elvis_lhs;
    }
    return tmp;
  };
  protoOf(XmlBufferedReaderBase).pk6 = function () {
    var tmp0_safe_receiver = this.okb_1;
    var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.pkb_1;
    return tmp1_elvis_lhs == null ? this.mkb_1.pk6() : tmp1_elvis_lhs;
  };
  protoOf(XmlBufferedReaderBase).qk6 = function () {
    var c = this.okb_1;
    var tmp;
    if (c instanceof StartElementEvent) {
      tmp = c.qk6();
    } else {
      if (c instanceof EndElementEvent) {
        tmp = c.hkd_1;
      } else {
        tmp = this.nkb_1.gkc_1;
      }
    }
    return tmp;
  };
  protoOf(XmlBufferedReaderBase).rk6 = function () {
    var c = this.okb_1;
    var tmp;
    if (c instanceof StartElementEvent) {
      tmp = toList(c.rk6());
    } else {
      tmp = this.nkb_1.ikd();
    }
    return tmp;
  };
  protoOf(XmlBufferedReaderBase).sk6 = function () {
    var tmp = this.okb_1;
    return (tmp instanceof StartDocumentEvent ? tmp : THROW_CCE()).kkd_1;
  };
  protoOf(XmlBufferedReaderBase).tk6 = function () {
    var tmp = this.okb_1;
    return (tmp instanceof StartDocumentEvent ? tmp : THROW_CCE()).mkd_1;
  };
  protoOf(XmlBufferedReaderBase).g3g = function () {
    var tmp = this.okb_1;
    return (tmp instanceof StartDocumentEvent ? tmp : THROW_CCE()).lkd_1;
  };
  protoOf(XmlBufferedReaderBase).tkb = function () {
    if (this.ikb()) {
      return removeFirstToCurrent(this);
    }
    if (!this.f()) {
      throw NoSuchElementException_init_$Create$();
    }
    this.ukb();
    return removeFirstToCurrent(this);
  };
  protoOf(XmlBufferedReaderBase).ukb = function () {
    if (!this.ikb()) {
      this.skb(this.vkb());
    }
    return this.jkb();
  };
  protoOf(XmlBufferedReaderBase).vkb = function () {
    if (this.mkb_1.f()) {
      this.mkb_1.e();
      var event = Companion_instance_3.pkc(this.mkb_1);
      var result = ArrayList_init_$Create$_0(1);
      result.i1(event);
      return result;
    }
    return emptyList();
  };
  protoOf(XmlBufferedReaderBase).f = function () {
    if (this.ikb()) {
      return true;
    }
    return !(this.ukb() == null);
  };
  protoOf(XmlBufferedReaderBase).n = function () {
    this.mkb_1.n();
  };
  protoOf(XmlBufferedReaderBase).wkb = function () {
    return this.xkb().ok6();
  };
  protoOf(XmlBufferedReaderBase).xkb = function () {
    var current = this.tkb();
    var tmp;
    switch (current.ok6().za_1) {
      case 4:
        var tmp_0;
        if (isXmlWhitespace((current instanceof TextEvent ? current : THROW_CCE()).pk7_1)) {
          tmp_0 = this.xkb();
        } else {
          throw XmlException_init_$Create$_0('Unexpected element found when looking for tags: ' + current);
        }

        tmp = tmp_0;
        break;
      case 0:
      case 3:
      case 9:
      case 11:
        tmp = this.xkb();
        break;
      case 1:
      case 2:
        tmp = current;
        break;
      default:
        throw XmlException_init_$Create$_0('Unexpected element found when looking for tags: ' + current);
    }
    return tmp;
  };
  protoOf(XmlBufferedReaderBase).e = function () {
    return this.tkb().ok6();
  };
  protoOf(XmlBufferedReaderBase).uk6 = function (index) {
    return _get_currentElement__mbt3qg(this).lkc_1[index].ukc_1;
  };
  protoOf(XmlBufferedReaderBase).vk6 = function (index) {
    return _get_currentElement__mbt3qg(this).lkc_1[index].skc_1;
  };
  protoOf(XmlBufferedReaderBase).wk6 = function (index) {
    return _get_currentElement__mbt3qg(this).lkc_1[index].tkc_1;
  };
  protoOf(XmlBufferedReaderBase).xk6 = function (index) {
    return _get_currentElement__mbt3qg(this).lkc_1[index].rkc_1;
  };
  protoOf(XmlBufferedReaderBase).r7j = function (nsUri, localName) {
    var tmp$ret$1;
    $l$block: {
      // Inline function 'kotlin.collections.firstOrNull' call
      var indexedObject = _get_currentElement__mbt3qg(this).lkc_1;
      var inductionVariable = 0;
      var last = indexedObject.length;
      while (inductionVariable < last) {
        var element = indexedObject[inductionVariable];
        inductionVariable = inductionVariable + 1 | 0;
        // Inline function 'nl.adaptivity.xmlutil.XmlBufferedReaderBase.getAttributeValue.<anonymous>' call
        if ((nsUri == null ? true : nsUri === element.ukc_1) ? localName === element.tkc_1 : false) {
          tmp$ret$1 = element;
          break $l$block;
        }
      }
      tmp$ret$1 = null;
    }
    var tmp0_safe_receiver = tmp$ret$1;
    return tmp0_safe_receiver == null ? null : tmp0_safe_receiver.rkc_1;
  };
  protoOf(XmlBufferedReaderBase).zk5 = function (prefix) {
    return _get_currentElement__mbt3qg(this).zk5(prefix);
  };
  function XmlDelegatingReader(delegate) {
    this.nkd_1 = delegate;
  }
  protoOf(XmlDelegatingReader).fx = function () {
    return this.nkd_1;
  };
  protoOf(XmlDelegatingReader).nk6 = function () {
    return this.nkd_1.nk6();
  };
  protoOf(XmlDelegatingReader).jk6 = function () {
    return this.nkd_1.jk6();
  };
  protoOf(XmlDelegatingReader).sk6 = function () {
    return this.nkd_1.sk6();
  };
  protoOf(XmlDelegatingReader).ok6 = function () {
    return this.nkd_1.ok6();
  };
  protoOf(XmlDelegatingReader).ik6 = function () {
    return this.nkd_1.ik6();
  };
  protoOf(XmlDelegatingReader).gk6 = function () {
    return this.nkd_1.gk6();
  };
  protoOf(XmlDelegatingReader).pk6 = function () {
    return this.nkd_1.pk6();
  };
  protoOf(XmlDelegatingReader).dc = function () {
    return this.nkd_1.dc();
  };
  protoOf(XmlDelegatingReader).qk6 = function () {
    return this.nkd_1.qk6();
  };
  protoOf(XmlDelegatingReader).rk6 = function () {
    return this.nkd_1.rk6();
  };
  protoOf(XmlDelegatingReader).fk6 = function () {
    return this.nkd_1.fk6();
  };
  protoOf(XmlDelegatingReader).lk6 = function () {
    return this.nkd_1.lk6();
  };
  protoOf(XmlDelegatingReader).kk6 = function () {
    return this.nkd_1.kk6();
  };
  protoOf(XmlDelegatingReader).hk6 = function () {
    return this.nkd_1.hk6();
  };
  protoOf(XmlDelegatingReader).tk6 = function () {
    return this.nkd_1.tk6();
  };
  protoOf(XmlDelegatingReader).mk6 = function () {
    return this.nkd_1.mk6();
  };
  protoOf(XmlDelegatingReader).g3g = function () {
    return this.nkd_1.g3g();
  };
  protoOf(XmlDelegatingReader).n = function () {
    this.nkd_1.n();
  };
  protoOf(XmlDelegatingReader).wk6 = function (index) {
    return this.nkd_1.wk6(index);
  };
  protoOf(XmlDelegatingReader).uk6 = function (index) {
    return this.nkd_1.uk6(index);
  };
  protoOf(XmlDelegatingReader).vk6 = function (index) {
    return this.nkd_1.vk6(index);
  };
  protoOf(XmlDelegatingReader).xk6 = function (index) {
    return this.nkd_1.xk6(index);
  };
  protoOf(XmlDelegatingReader).r7j = function (nsUri, localName) {
    return this.nkd_1.r7j(nsUri, localName);
  };
  protoOf(XmlDelegatingReader).f = function () {
    return this.nkd_1.f();
  };
  protoOf(XmlDelegatingReader).e = function () {
    return this.nkd_1.e();
  };
  protoOf(XmlDelegatingReader).yk6 = function (type, namespace, name) {
    this.nkd_1.yk6(type, namespace, name);
  };
  function XmlEvent$StartElementEvent$toString$lambda(it) {
    return it.tkc_1 + ' = ' + it.rkc_1 + ' ';
  }
  function Companion_2() {
  }
  protoOf(Companion_2).pkc = function (reader) {
    return reader.ok6().qk8(reader);
  };
  var Companion_instance_3;
  function Companion_getInstance_2() {
    return Companion_instance_3;
  }
  function TextEvent(locationInfo, eventType, text) {
    XmlEvent.call(this, locationInfo);
    this.ok7_1 = eventType;
    this.pk7_1 = text;
  }
  protoOf(TextEvent).ok6 = function () {
    return this.ok7_1;
  };
  protoOf(TextEvent).qk7 = function (writer) {
    return this.ok6().vk8(writer, this);
  };
  protoOf(TextEvent).toString = function () {
    var tmp = this.ok6();
    var tmp0_elvis_lhs = this.pkb_1;
    return '' + tmp + ' - "' + this.pk7_1 + '" (' + (tmp0_elvis_lhs == null ? '' : tmp0_elvis_lhs) + ')';
  };
  function ProcessingInstructionEvent(locationInfo, target, data) {
    TextEvent.call(this, locationInfo, EventType_PROCESSING_INSTRUCTION_getInstance(), target + ' ' + data);
    this.vk9_1 = target;
    this.wk9_1 = data;
  }
  function EntityRefEvent(locationInfo, localName, text) {
    TextEvent.call(this, locationInfo, EventType_ENTITY_REF_getInstance(), text);
    this.ckd_1 = localName;
  }
  protoOf(EntityRefEvent).qk7 = function (writer) {
    return this.ok6().vk8(writer, this);
  };
  protoOf(EntityRefEvent).toString = function () {
    var tmp = this.ok6();
    var tmp0_elvis_lhs = this.pkb_1;
    return '' + tmp + ' - "' + this.pk7_1 + '" (' + (tmp0_elvis_lhs == null ? '' : tmp0_elvis_lhs) + ')';
  };
  function EndDocumentEvent(locationInfo) {
    XmlEvent.call(this, locationInfo);
  }
  protoOf(EndDocumentEvent).ok6 = function () {
    return EventType_END_DOCUMENT_getInstance();
  };
  protoOf(EndDocumentEvent).toString = function () {
    var tmp = this.ok6();
    var tmp0_elvis_lhs = this.pkb_1;
    return '' + tmp + ' (' + (tmp0_elvis_lhs == null ? '' : tmp0_elvis_lhs) + ')';
  };
  function EndElementEvent(locationInfo, namespaceUri, localName, prefix, namespaceContext) {
    NamedEvent.call(this, locationInfo, namespaceUri, localName, prefix);
    this.hkd_1 = namespaceContext.bk6();
  }
  protoOf(EndElementEvent).ok6 = function () {
    return EventType_END_ELEMENT_getInstance();
  };
  function StartDocumentEvent(locationInfo, encoding, version, standalone) {
    XmlEvent.call(this, locationInfo);
    this.kkd_1 = encoding;
    this.lkd_1 = version;
    this.mkd_1 = standalone;
  }
  protoOf(StartDocumentEvent).ok6 = function () {
    return EventType_START_DOCUMENT_getInstance();
  };
  protoOf(StartDocumentEvent).toString = function () {
    var tmp = this.ok6();
    var tmp0_elvis_lhs = this.pkb_1;
    return '' + tmp + ' - encoding:' + this.kkd_1 + ', version: ' + this.lkd_1 + ', standalone: ' + this.mkd_1 + ' (' + (tmp0_elvis_lhs == null ? '' : tmp0_elvis_lhs) + ')';
  };
  function NamedEvent(locationInfo, namespaceUri, localName, prefix) {
    XmlEvent.call(this, locationInfo);
    this.wkc_1 = namespaceUri;
    this.xkc_1 = localName;
    this.ykc_1 = prefix;
  }
  protoOf(NamedEvent).toString = function () {
    var tmp = this.ok6();
    var tmp0_elvis_lhs = this.pkb_1;
    return '' + tmp + ' - {' + this.wkc_1 + '}' + this.ykc_1 + ':' + this.xkc_1 + ' (' + (tmp0_elvis_lhs == null ? '' : tmp0_elvis_lhs) + ')';
  };
  function StartElementEvent(locationInfo, namespaceUri, localName, prefix, attributes, parentNamespaceContext, namespaceDecls) {
    NamedEvent.call(this, locationInfo, namespaceUri, localName, prefix);
    this.lkc_1 = attributes;
    this.mkc_1 = parentNamespaceContext;
    var tmp = this;
    // Inline function 'kotlin.collections.asIterable' call
    tmp.nkc_1 = SimpleNamespaceContext_init_$Create$_2(namespaceDecls);
  }
  protoOf(StartElementEvent).rk6 = function () {
    return this.nkc_1;
  };
  protoOf(StartElementEvent).ok6 = function () {
    return EventType_START_ELEMENT_getInstance();
  };
  protoOf(StartElementEvent).zk5 = function (prefix) {
    var decl = this.nkc_1.zk5(prefix);
    return decl == null ? this.mkc_1.zk5(prefix) : decl;
  };
  protoOf(StartElementEvent).qk6 = function () {
    return this.nkc_1.dk6(this.mkc_1);
  };
  protoOf(StartElementEvent).toString = function () {
    var tmp = this.ok6();
    var tmp0_elvis_lhs = this.pkb_1;
    var tmp_0 = '' + tmp + ' - {' + this.wkc_1 + '}' + this.ykc_1 + ':' + this.xkc_1 + ' (' + (tmp0_elvis_lhs == null ? '' : tmp0_elvis_lhs) + ')';
    var tmp_1;
    // Inline function 'kotlin.collections.isNotEmpty' call
    // Inline function 'kotlin.collections.isEmpty' call
    if (!(this.lkc_1.length === 0)) {
      tmp_1 = '\n    ';
    } else {
      tmp_1 = '';
    }
    var tmp_2 = tmp_1;
    return tmp_0 + joinToString(this.lkc_1, '\n    ', tmp_2, VOID, VOID, VOID, XmlEvent$StartElementEvent$toString$lambda);
  };
  function Attribute(locationInfo, namespaceUri, localName, prefix, value) {
    XmlEvent.call(this, locationInfo);
    this.rkc_1 = toString(value);
    this.skc_1 = toString(prefix);
    this.tkc_1 = toString(localName);
    this.ukc_1 = toString(namespaceUri);
  }
  protoOf(Attribute).ok6 = function () {
    return EventType_ATTRIBUTE_getInstance();
  };
  protoOf(Attribute).toString = function () {
    return isBlank(this.ukc_1) ? this.tkc_1 + '="' + this.rkc_1 + '"' : isBlank(this.skc_1) ? '{' + this.ukc_1 + '}' + this.tkc_1 + '="' + this.rkc_1 + '"' : '{' + this.ukc_1 + '}' + this.skc_1 + ':' + this.tkc_1 + '="' + this.rkc_1 + '"';
  };
  protoOf(Attribute).equals = function (other) {
    if (this === other)
      return true;
    if (other == null ? true : !getKClassFromExpression(this).equals(getKClassFromExpression(other)))
      return false;
    if (!(other instanceof Attribute))
      THROW_CCE();
    if (!(this.rkc_1 === other.rkc_1))
      return false;
    if (!(this.skc_1 === other.skc_1))
      return false;
    if (!(this.tkc_1 === other.tkc_1))
      return false;
    if (!(this.ukc_1 === other.ukc_1))
      return false;
    return true;
  };
  protoOf(Attribute).hashCode = function () {
    var result = getStringHashCode(this.rkc_1);
    result = imul(31, result) + getStringHashCode(this.skc_1) | 0;
    result = imul(31, result) + getStringHashCode(this.tkc_1) | 0;
    result = imul(31, result) + getStringHashCode(this.ukc_1) | 0;
    return result;
  };
  function NamespaceImpl(namespacePrefix, namespaceUri) {
    this.pkd_1 = toString(namespacePrefix);
    this.qkd_1 = toString(namespaceUri);
  }
  protoOf(NamespaceImpl).hk6 = function () {
    return this.pkd_1;
  };
  protoOf(NamespaceImpl).fk6 = function () {
    return this.qkd_1;
  };
  protoOf(NamespaceImpl).equals = function (other) {
    if (this === other)
      return true;
    if (!(!(other == null) ? isInterface(other, Namespace) : false))
      return false;
    if (!(this.pkd_1 === other.hk6()))
      return false;
    if (!(this.qkd_1 === other.fk6()))
      return false;
    return true;
  };
  protoOf(NamespaceImpl).hashCode = function () {
    return imul(31, getStringHashCode(this.pkd_1)) + getStringHashCode(this.qkd_1) | 0;
  };
  protoOf(NamespaceImpl).toString = function () {
    return '{' + this.pkd_1 + ':' + this.qkd_1 + '}';
  };
  function XmlEvent(locationInfo) {
    this.pkb_1 = locationInfo;
  }
  function XmlException_init_$Init$($this) {
    IOException_init_$Init$($this);
    XmlException.call($this);
    return $this;
  }
  function XmlException_init_$Create$() {
    var tmp = XmlException_init_$Init$(objectCreate(protoOf(XmlException)));
    captureStack(tmp, XmlException_init_$Create$);
    return tmp;
  }
  function XmlException_init_$Init$_0(message, $this) {
    IOException_init_$Init$_0(message, $this);
    XmlException.call($this);
    return $this;
  }
  function XmlException_init_$Create$_0(message) {
    var tmp = XmlException_init_$Init$_0(message, objectCreate(protoOf(XmlException)));
    captureStack(tmp, XmlException_init_$Create$_0);
    return tmp;
  }
  function XmlException_init_$Init$_1(message, cause, $this) {
    IOException_init_$Init$_1(message, cause, $this);
    XmlException.call($this);
    return $this;
  }
  function XmlException_init_$Create$_1(message, cause) {
    var tmp = XmlException_init_$Init$_1(message, cause, objectCreate(protoOf(XmlException)));
    captureStack(tmp, XmlException_init_$Create$_1);
    return tmp;
  }
  function XmlException() {
    captureStack(this, XmlException);
  }
  function XmlReader() {
  }
  function skipPreamble(_this__u8e3s4) {
    while ((!_this__u8e3s4.ik6() ? true : isIgnorable(_this__u8e3s4)) ? _this__u8e3s4.f() : false) {
      _this__u8e3s4.e();
    }
  }
  function readSimpleElement(_this__u8e3s4) {
    var t = _this__u8e3s4;
    t.yk6(EventType_START_ELEMENT_getInstance(), null, null);
    // Inline function 'kotlin.text.buildString' call
    // Inline function 'kotlin.contracts.contract' call
    // Inline function 'kotlin.apply' call
    var this_0 = StringBuilder_init_$Create$();
    // Inline function 'kotlin.contracts.contract' call
    // Inline function 'nl.adaptivity.xmlutil.readSimpleElement.<anonymous>' call
    while (!(t.e() === EventType_END_ELEMENT_getInstance())) {
      switch (t.ok6().za_1) {
        case 3:
        case 11:
          break;
        case 9:
        case 4:
        case 8:
        case 5:
          this_0.y5(t.mk6());
          break;
        default:
          throw XmlException_init_$Create$_0('Expected text content or end tag, found: ' + t.ok6());
      }
    }
    return this_0.toString();
  }
  function allConsecutiveTextContent(_this__u8e3s4) {
    var t = _this__u8e3s4;
    // Inline function 'kotlin.text.buildString' call
    // Inline function 'kotlin.contracts.contract' call
    // Inline function 'kotlin.apply' call
    var this_0 = StringBuilder_init_$Create$();
    // Inline function 'kotlin.contracts.contract' call
    // Inline function 'nl.adaptivity.xmlutil.allConsecutiveTextContent.<anonymous>' call
    if (_this__u8e3s4.ok6().uk8() ? true : _this__u8e3s4.ok6().equals(EventType_IGNORABLE_WHITESPACE_getInstance())) {
      this_0.y5(_this__u8e3s4.mk6());
    }
    var event = null;
    loop: while (true) {
      // Inline function 'kotlin.apply' call
      var this_1 = t.ukb();
      // Inline function 'kotlin.contracts.contract' call
      // Inline function 'nl.adaptivity.xmlutil.allConsecutiveTextContent.<anonymous>.<anonymous>' call
      event = this_1;
      if (!!((this_1 == null ? null : this_1.ok6()) === EventType_END_ELEMENT_getInstance())) {
        break loop;
      }
      var tmp1_safe_receiver = event;
      var tmp2_subject = tmp1_safe_receiver == null ? null : tmp1_safe_receiver.ok6();
      switch (tmp2_subject == null ? -1 : tmp2_subject.za_1) {
        case 11:
        case 3:
          t.e();
          break;
        case 9:
        case 4:
        case 8:
        case 5:
          t.e();
          this_0.y5(t.mk6());
          break;
        case 1:
          break loop;
        default:
          throw XmlException_init_$Create$_0('Found unexpected child tag: ' + event);
      }
    }
    return this_0.toString();
  }
  function allText(_this__u8e3s4) {
    var t = _this__u8e3s4;
    // Inline function 'kotlin.text.buildString' call
    // Inline function 'kotlin.contracts.contract' call
    // Inline function 'kotlin.apply' call
    var this_0 = StringBuilder_init_$Create$();
    // Inline function 'kotlin.contracts.contract' call
    // Inline function 'nl.adaptivity.xmlutil.allText.<anonymous>' call
    if (_this__u8e3s4.ok6().uk8()) {
      this_0.y5(_this__u8e3s4.mk6());
    }
    var type;
    $l$loop: while (true) {
      // Inline function 'kotlin.apply' call
      var this_1 = t.e();
      // Inline function 'kotlin.contracts.contract' call
      // Inline function 'nl.adaptivity.xmlutil.allText.<anonymous>.<anonymous>' call
      type = this_1;
      if (!!(this_1 === EventType_END_ELEMENT_getInstance())) {
        break $l$loop;
      }
      switch (type == null ? -1 : type.za_1) {
        case 11:
        case 3:
          break;
        case 9:
          if (!(this_0.a() === 0)) {
            this_0.y5(t.mk6());
          }

          break;
        case 8:
        case 4:
        case 5:
          this_0.y5(t.mk6());
          break;
        default:
          throw XmlException_init_$Create$_0('Found unexpected child tag with type: ' + type);
      }
    }
    return this_0.toString();
  }
  function isIgnorable(_this__u8e3s4) {
    switch (_this__u8e3s4.ok6().za_1) {
      case 3:
      case 0:
      case 7:
      case 11:
      case 6:
      case 9:
        return true;
      case 4:
        return isXmlWhitespace(_this__u8e3s4.mk6());
      default:
        return false;
    }
  }
  function get_attributes(_this__u8e3s4) {
    var tmp = 0;
    var tmp_0 = _this__u8e3s4.nk6();
    // Inline function 'kotlin.arrayOfNulls' call
    var tmp_1 = fillArrayVal(Array(tmp_0), null);
    while (tmp < tmp_0) {
      var tmp_2 = tmp;
      tmp_1[tmp_2] = new Attribute(_this__u8e3s4.pk6(), _this__u8e3s4.uk6(tmp_2), _this__u8e3s4.wk6(tmp_2), _this__u8e3s4.vk6(tmp_2), _this__u8e3s4.xk6(tmp_2));
      tmp = tmp + 1 | 0;
    }
    return tmp_1;
  }
  function writeCurrent(_this__u8e3s4, writer) {
    return _this__u8e3s4.ok6().rk8(writer, _this__u8e3s4);
  }
  function get_attributeIndices(_this__u8e3s4) {
    return until(0, _this__u8e3s4.nk6());
  }
  function isPrefixDeclaredInElement(_this__u8e3s4, prefix) {
    var tmp$ret$0;
    $l$block_0: {
      // Inline function 'kotlin.collections.any' call
      var this_0 = _this__u8e3s4.rk6();
      var tmp;
      if (isInterface(this_0, Collection)) {
        tmp = this_0.c1();
      } else {
        tmp = false;
      }
      if (tmp) {
        tmp$ret$0 = false;
        break $l$block_0;
      }
      var tmp0_iterator = this_0.w();
      while (tmp0_iterator.f()) {
        var element = tmp0_iterator.e();
        // Inline function 'nl.adaptivity.xmlutil.isPrefixDeclaredInElement.<anonymous>' call
        if (element.hk6() === prefix) {
          tmp$ret$0 = true;
          break $l$block_0;
        }
      }
      tmp$ret$0 = false;
    }
    return tmp$ret$0;
  }
  function elementContentToFragment(_this__u8e3s4) {
    var r = _this__u8e3s4;
    skipPreamble(r);
    if (r.f()) {
      r.yk6(EventType_START_ELEMENT_getInstance(), null, null);
      r.e();
      return siblingsToFragment(r);
    }
    return CompactFragment_init_$Create$('');
  }
  function elementToFragment(_this__u8e3s4) {
    var output = StringBuilder_init_$Create$();
    if (!_this__u8e3s4.ik6()) {
      if (_this__u8e3s4.f()) {
        _this__u8e3s4.e();
      } else {
        return CompactFragment_init_$Create$('');
      }
    }
    var startLocation = _this__u8e3s4.pk6();
    try {
      // Inline function 'kotlin.collections.mutableMapOf' call
      var missingNamespaces = LinkedHashMap_init_$Create$();
      if (_this__u8e3s4.ok6().uk8() ? true : _this__u8e3s4.ok6().equals(EventType_IGNORABLE_WHITESPACE_getInstance()))
        return CompactFragment_init_$Create$(_this__u8e3s4.mk6());
      _this__u8e3s4.yk6(EventType_START_ELEMENT_getInstance(), null, null);
      $l$block: {
        // Inline function 'nl.adaptivity.xmlutil.core.impl.multiplatform.use' call
        var this_0 = new KtXmlWriter(output, false, XmlDeclMode_None_getInstance());
        try {
          this_0.lk8('');
          while (_this__u8e3s4.ok6().equals(EventType_IGNORABLE_WHITESPACE_getInstance())) {
            this_0.mk7(_this__u8e3s4.mk6());
            _this__u8e3s4.e();
          }
          if (_this__u8e3s4.ok6().equals(EventType_END_ELEMENT_getInstance()) ? true : _this__u8e3s4.ok6().equals(EventType_END_DOCUMENT_getInstance())) {
            return CompactFragment_init_$Create$(output.toString());
          }
          _this__u8e3s4.yk6(EventType_START_ELEMENT_getInstance(), null, null);
          var namespaceForPrefix = this_0.jk8(_this__u8e3s4.hk6());
          writeCurrent(_this__u8e3s4, this_0);
          if (!(namespaceForPrefix === _this__u8e3s4.fk6())) {
            addUndeclaredNamespaces(this_0, _this__u8e3s4, missingNamespaces);
          }
          writeElementContent(this_0, missingNamespaces, _this__u8e3s4);
          break $l$block;
        }finally {
          this_0.n();
        }
      }
      if (missingNamespaces.q('') === '') {
        missingNamespaces.u2('');
      }
      return CompactFragment_init_$Create$_0(SimpleNamespaceContext_init_$Create$_0(missingNamespaces), output.toString());
    } catch ($p) {
      if ($p instanceof XmlException) {
        var e = $p;
        throw XmlException_init_$Create$_1('Failure to parse children into string at ' + startLocation, e);
      } else {
        if ($p instanceof RuntimeException) {
          var e_0 = $p;
          throw XmlException_init_$Create$_1('Failure to parse children into string at ' + startLocation, e_0);
        } else {
          throw $p;
        }
      }
    }
  }
  var XmlDeclMode_None_instance;
  var XmlDeclMode_Minimal_instance;
  var XmlDeclMode_Auto_instance;
  var XmlDeclMode_Charset_instance;
  function Companion_3() {
  }
  var Companion_instance_4;
  function Companion_getInstance_3() {
    return Companion_instance_4;
  }
  var XmlDeclMode_entriesInitialized;
  function XmlDeclMode_initEntries() {
    if (XmlDeclMode_entriesInitialized)
      return Unit_instance;
    XmlDeclMode_entriesInitialized = true;
    XmlDeclMode_None_instance = new XmlDeclMode('None', 0);
    XmlDeclMode_Minimal_instance = new XmlDeclMode('Minimal', 1);
    XmlDeclMode_Auto_instance = new XmlDeclMode('Auto', 2);
    XmlDeclMode_Charset_instance = new XmlDeclMode('Charset', 3);
  }
  function XmlDeclMode(name, ordinal) {
    Enum.call(this, name, ordinal);
  }
  function XmlDeclMode_None_getInstance() {
    XmlDeclMode_initEntries();
    return XmlDeclMode_None_instance;
  }
  function XmlDeclMode_Minimal_getInstance() {
    XmlDeclMode_initEntries();
    return XmlDeclMode_Minimal_instance;
  }
  function toCName(_this__u8e3s4) {
    if ('' === _this__u8e3s4.gka())
      return _this__u8e3s4.fka();
    return _this__u8e3s4.gka() + ':' + _this__u8e3s4.fka();
  }
  function toQname(_this__u8e3s4, namespace) {
    var split = indexOf(_this__u8e3s4, _Char___init__impl__6a9atx(125));
    var localname;
    var nsUri;
    if (split >= 0) {
      if (!(charSequenceGet(_this__u8e3s4, 0) === _Char___init__impl__6a9atx(123)))
        throw IllegalArgumentException_init_$Create$('Not a valid qname literal');
      // Inline function 'kotlin.text.substring' call
      nsUri = toString(charSequenceSubSequence(_this__u8e3s4, 1, split));
      // Inline function 'kotlin.text.substring' call
      var startIndex = split + 1 | 0;
      var endIndex = charSequenceLength(_this__u8e3s4);
      localname = toString(charSequenceSubSequence(_this__u8e3s4, startIndex, endIndex));
    } else {
      nsUri = namespace.fk6();
      localname = toString(_this__u8e3s4);
    }
    return QName_init_$Create$(nsUri, localname);
  }
  function xmlCollapseWhitespace(original) {
    // Inline function 'kotlin.text.buildString' call
    var capacity = original.length;
    // Inline function 'kotlin.contracts.contract' call
    // Inline function 'kotlin.apply' call
    var this_0 = StringBuilder_init_$Create$_0(capacity);
    // Inline function 'kotlin.contracts.contract' call
    // Inline function 'nl.adaptivity.xmlutil.xmlCollapseWhitespace.<anonymous>' call
    var last = _Char___init__impl__6a9atx(32);
    var inductionVariable = 0;
    var last_0 = original.length;
    while (inductionVariable < last_0) {
      var c = charSequenceGet(original, inductionVariable);
      inductionVariable = inductionVariable + 1 | 0;
      var tmp;
      if (((c === _Char___init__impl__6a9atx(9) ? true : c === _Char___init__impl__6a9atx(10)) ? true : c === _Char___init__impl__6a9atx(13)) ? true : c === _Char___init__impl__6a9atx(32)) {
        if (!(last === _Char___init__impl__6a9atx(32))) {
          this_0.z5(_Char___init__impl__6a9atx(32));
        }
        tmp = _Char___init__impl__6a9atx(32);
      } else {
        this_0.z5(c);
        tmp = c;
      }
      last = tmp;
    }
    if (last === _Char___init__impl__6a9atx(32)) {
      this_0.a9(this_0.a() - 1 | 0);
    }
    return this_0.toString();
  }
  function isXmlWhitespace(data) {
    var tmp$ret$1;
    $l$block: {
      // Inline function 'kotlin.text.all' call
      var inductionVariable = 0;
      while (inductionVariable < charSequenceLength(data)) {
        var element = charSequenceGet(data, inductionVariable);
        inductionVariable = inductionVariable + 1 | 0;
        // Inline function 'nl.adaptivity.xmlutil.isXmlWhitespace.<anonymous>' call
        if (!isXmlWhitespace_0(element)) {
          tmp$ret$1 = false;
          break $l$block;
        }
      }
      tmp$ret$1 = true;
    }
    return tmp$ret$1;
  }
  function qname(namespaceUri, localname, prefix) {
    var tmp;
    if (prefix === VOID) {
      tmp = '';
    } else {
      tmp = prefix;
    }
    prefix = tmp;
    var tmp_0;
    if (namespaceUri == null) {
      tmp_0 = '';
    } else {
      tmp_0 = namespaceUri;
    }
    var tmp_1 = tmp_0;
    var tmp_2;
    if (prefix == null) {
      tmp_2 = '';
    } else {
      tmp_2 = prefix;
    }
    return new QName(tmp_1, localname, tmp_2);
  }
  function isXmlWhitespace_0(char) {
    return ((char === _Char___init__impl__6a9atx(10) ? true : char === _Char___init__impl__6a9atx(9)) ? true : char === _Char___init__impl__6a9atx(13)) ? true : char === _Char___init__impl__6a9atx(32);
  }
  function xmlEncode(_this__u8e3s4) {
    // Inline function 'kotlin.text.buildString' call
    // Inline function 'kotlin.contracts.contract' call
    // Inline function 'kotlin.apply' call
    var this_0 = StringBuilder_init_$Create$();
    // Inline function 'kotlin.contracts.contract' call
    // Inline function 'nl.adaptivity.xmlutil.xmlEncode.<anonymous>' call
    var inductionVariable = 0;
    while (inductionVariable < charSequenceLength(_this__u8e3s4)) {
      var c = charSequenceGet(_this__u8e3s4, inductionVariable);
      inductionVariable = inductionVariable + 1 | 0;
      if (c === _Char___init__impl__6a9atx(60)) {
        this_0.y5('&lt;');
      } else if (c === _Char___init__impl__6a9atx(62)) {
        this_0.y5('&gt;');
      } else if (c === _Char___init__impl__6a9atx(38)) {
        this_0.y5('&amp;');
      } else {
        this_0.z5(c);
      }
    }
    return this_0.toString();
  }
  function XmlWriter() {
  }
  function smartStartTag(_this__u8e3s4, qName) {
    smartStartTag_0(_this__u8e3s4, qName.eka(), qName.fka(), qName.gka());
  }
  function endTag(_this__u8e3s4, predelemname) {
    _this__u8e3s4.ik8(predelemname.eka(), predelemname.fka(), predelemname.gka());
  }
  function writeAttribute(_this__u8e3s4, name, value) {
    if (value == null)
      null;
    else {
      // Inline function 'kotlin.let' call
      // Inline function 'kotlin.contracts.contract' call
      var tmp;
      var tmp_0;
      // Inline function 'kotlin.text.isEmpty' call
      // Inline function 'nl.adaptivity.xmlutil.namespaceURI' call
      var this_0 = name.eka();
      if (charSequenceLength(this_0) === 0) {
        // Inline function 'kotlin.text.isEmpty' call
        // Inline function 'nl.adaptivity.xmlutil.prefix' call
        var this_1 = name.gka();
        tmp_0 = charSequenceLength(this_1) === 0;
      } else {
        tmp_0 = false;
      }
      if (tmp_0) {
        // Inline function 'nl.adaptivity.xmlutil.localPart' call
        var tmp$ret$4 = name.fka();
        _this__u8e3s4.ek8(null, tmp$ret$4, null, value);
        tmp = Unit_instance;
      } else {
        // Inline function 'nl.adaptivity.xmlutil.namespaceURI' call
        var tmp_1 = name.eka();
        // Inline function 'nl.adaptivity.xmlutil.localPart' call
        var tmp_2 = name.fka();
        // Inline function 'nl.adaptivity.xmlutil.prefix' call
        var tmp$ret$7 = name.gka();
        _this__u8e3s4.ek8(tmp_1, tmp_2, tmp$ret$7, value);
        tmp = Unit_instance;
      }
    }
  }
  function writeElement(_this__u8e3s4, missingNamespaces, reader) {
    if (reader.ok6().equals(EventType_END_ELEMENT_getInstance()))
      throw IllegalArgumentException_init_$Create$('Cannot really validly write an end element here');
    writeCurrent(reader, _this__u8e3s4);
    if (reader.ok6().equals(EventType_START_ELEMENT_getInstance())) {
      writeElementContent(_this__u8e3s4, missingNamespaces, reader);
    }
  }
  function serialize(_this__u8e3s4, reader) {
    while (reader.f()) {
      switch (reader.e().za_1) {
        case 0:
        case 11:
        case 6:
        case 7:
          if (_this__u8e3s4.jk6() <= 0) {
            writeCurrentEvent(_this__u8e3s4, reader);
          }

          break;
        case 9:
          // Inline function 'kotlin.text.isEmpty' call

          var this_0 = _this__u8e3s4.mk8();
          if (charSequenceLength(this_0) === 0) {
            writeCurrentEvent(_this__u8e3s4, reader);
          }

          break;
        default:
          writeCurrentEvent(_this__u8e3s4, reader);
          break;
      }
    }
  }
  function addUndeclaredNamespaces(_this__u8e3s4, reader, missingNamespaces) {
    undeclaredPrefixes(_this__u8e3s4, reader, missingNamespaces);
  }
  function writeElementContent(_this__u8e3s4, missingNamespaces, reader) {
    // Inline function 'kotlin.collections.forEach' call
    // Inline function 'kotlin.collections.iterator' call
    var tmp0_iterator = reader;
    while (tmp0_iterator.f()) {
      var element = tmp0_iterator.e();
      // Inline function 'nl.adaptivity.xmlutil.writeElementContent.<anonymous>' call
      if (reader.ok6().equals(EventType_START_ELEMENT_getInstance()) ? !(missingNamespaces == null) : false) {
        addUndeclaredNamespaces(_this__u8e3s4, reader, missingNamespaces);
      }
      writeCurrent(reader, _this__u8e3s4);
      switch (element.za_1) {
        case 1:
          writeElementContent(_this__u8e3s4, missingNamespaces, reader);
          break;
        case 2:
          return Unit_instance;
        default:
          break;
      }
    }
  }
  function smartStartTag_0(_this__u8e3s4, nsUri, localName, prefix) {
    prefix = prefix === VOID ? null : prefix;
    var tmp;
    var tmp_0;
    if (nsUri == null) {
      tmp_0 = true;
    } else {
      tmp_0 = nsUri === 'http://www.w3.org/XML/1998/namespace';
    }
    if (tmp_0) {
      tmp = true;
    } else {
      tmp = nsUri === 'http://www.w3.org/2000/xmlns/';
    }
    if (tmp) {
      var tmp_1 = _this__u8e3s4.qk6();
      var tmp_2;
      if (prefix == null) {
        tmp_2 = '';
      } else {
        tmp_2 = prefix;
      }
      var tmp1_elvis_lhs = tmp_1.zk5(tmp_2);
      var tmp_3;
      if (tmp1_elvis_lhs == null) {
        tmp_3 = '';
      } else {
        tmp_3 = tmp1_elvis_lhs;
      }
      var namespace = tmp_3;
      _this__u8e3s4.ak8(namespace, localName, prefix);
    } else {
      var writeNs = false;
      var tmp2_elvis_lhs = _this__u8e3s4.kk8(nsUri);
      var tmp_4;
      if (tmp2_elvis_lhs == null) {
        // Inline function 'kotlin.run' call
        // Inline function 'kotlin.contracts.contract' call
        // Inline function 'nl.adaptivity.xmlutil.smartStartTag.<anonymous>' call
        var tmp_5;
        if (prefix == null) {
          tmp_5 = null;
        } else {
          // Inline function 'kotlin.let' call
          // Inline function 'kotlin.contracts.contract' call
          // Inline function 'nl.adaptivity.xmlutil.smartStartTag.<anonymous>.<anonymous>' call
          tmp_5 = _this__u8e3s4.jk8(prefix);
        }
        var tmp1_elvis_lhs_0 = tmp_5;
        var tmp_6;
        if (tmp1_elvis_lhs_0 == null) {
          tmp_6 = '';
        } else {
          tmp_6 = tmp1_elvis_lhs_0;
        }
        var currentNs = tmp_6;
        if (!(nsUri === currentNs)) {
          writeNs = true;
        }
        var tmp_7;
        if (prefix == null) {
          tmp_7 = '';
        } else {
          tmp_7 = prefix;
        }
        tmp_4 = tmp_7;
      } else {
        tmp_4 = tmp2_elvis_lhs;
      }
      var usedPrefix = tmp_4;
      _this__u8e3s4.ak8(nsUri, localName, usedPrefix);
      if (writeNs) {
        _this__u8e3s4.zk7(usedPrefix, nsUri);
      }
    }
  }
  function writeCurrentEvent(_this__u8e3s4, reader) {
    switch (reader.ok6().za_1) {
      case 0:
        _this__u8e3s4.fk8(null, reader.sk6(), reader.tk6());
        break;
      case 1:
        _this__u8e3s4.ak8(reader.fk6(), reader.gk6(), reader.hk6());
        // Inline function 'kotlin.run' call

        // Inline function 'kotlin.contracts.contract' call

        var tmp0_iterator = reader.rk6().w();
        while (tmp0_iterator.f()) {
          var a = tmp0_iterator.e();
          _this__u8e3s4.zk7(a.hk6(), a.fk6());
        }

        // Inline function 'kotlin.run' call

        // Inline function 'kotlin.contracts.contract' call

        var progression = get_attributeIndices(reader);
        var inductionVariable = progression.ib_1;
        var last = progression.jb_1;
        var tmp;
        if (inductionVariable <= last) {
          do {
            var i = inductionVariable;
            inductionVariable = inductionVariable + 1 | 0;
            var attrPrefix = reader.vk6(i);
            var namespace = attrPrefix === '' ? '' : reader.uk6(i);
            var tmp_0;
            if (namespace === '') {
              tmp_0 = '';
            } else if (namespace === _this__u8e3s4.qk6().zk5(attrPrefix)) {
              tmp_0 = attrPrefix;
            } else {
              var tmp2_elvis_lhs = _this__u8e3s4.qk6().ak6(namespace);
              tmp_0 = tmp2_elvis_lhs == null ? attrPrefix : tmp2_elvis_lhs;
            }
            var prefix = tmp_0;
            _this__u8e3s4.ek8(namespace, reader.wk6(i), prefix, reader.xk6(i));
          }
           while (!(i === last));
          tmp = Unit_instance;
        }

        break;
      case 2:
        _this__u8e3s4.ik8(reader.fk6(), reader.gk6(), reader.hk6());
        break;
      case 3:
        _this__u8e3s4.uk7(reader.mk6());
        break;
      case 4:
        _this__u8e3s4.bk8(reader.mk6());
        break;
      case 10:
        _this__u8e3s4.ek8(reader.fk6(), reader.gk6(), reader.hk6(), reader.mk6());
        break;
      case 5:
        _this__u8e3s4.ck8(reader.mk6());
        break;
      case 6:
        _this__u8e3s4.xk7(reader.mk6());
        break;
      case 7:
        _this__u8e3s4.hk8();
        break;
      case 8:
        _this__u8e3s4.dk8(reader.mk6());
        break;
      case 9:
        _this__u8e3s4.mk7(reader.mk6());
        break;
      case 11:
        _this__u8e3s4.wk7(reader.kk6(), reader.lk6());
        break;
    }
  }
  function undeclaredPrefixes(_this__u8e3s4, reader, missingNamespaces) {
    assert_0(reader.ok6() === EventType_START_ELEMENT_getInstance());
    var prefix = reader.hk6();
    if (!missingNamespaces.r(prefix)) {
      var uri = reader.fk6();
      if (_this__u8e3s4.jk8(prefix) === uri ? isPrefixDeclaredInElement(reader, prefix) : false) {
        return Unit_instance;
      } else {
        // Inline function 'kotlin.collections.set' call
        missingNamespaces.s(prefix, uri);
      }
    }
  }
  var EscapeMode_MINIMAL_instance;
  var EscapeMode_ATTRCONTENTQUOT_instance;
  var EscapeMode_ATTRCONTENTAPOS_instance;
  var EscapeMode_TEXTCONTENT_instance;
  var EscapeMode_DTD_instance;
  var EscapeMode_entriesInitialized;
  function EscapeMode_initEntries() {
    if (EscapeMode_entriesInitialized)
      return Unit_instance;
    EscapeMode_entriesInitialized = true;
    EscapeMode_MINIMAL_instance = new EscapeMode('MINIMAL', 0);
    EscapeMode_ATTRCONTENTQUOT_instance = new EscapeMode('ATTRCONTENTQUOT', 1);
    EscapeMode_ATTRCONTENTAPOS_instance = new EscapeMode('ATTRCONTENTAPOS', 2);
    EscapeMode_TEXTCONTENT_instance = new EscapeMode('TEXTCONTENT', 3);
    EscapeMode_DTD_instance = new EscapeMode('DTD', 4);
  }
  var WriteState_BeforeDocument_instance;
  var WriteState_AfterXmlDecl_instance;
  var WriteState_AfterDocTypeDecl_instance;
  var WriteState_InTagContent_instance;
  var WriteState_Finished_instance;
  var WriteState_entriesInitialized;
  function WriteState_initEntries() {
    if (WriteState_entriesInitialized)
      return Unit_instance;
    WriteState_entriesInitialized = true;
    WriteState_BeforeDocument_instance = new WriteState('BeforeDocument', 0);
    WriteState_AfterXmlDecl_instance = new WriteState('AfterXmlDecl', 1);
    WriteState_AfterDocTypeDecl_instance = new WriteState('AfterDocTypeDecl', 2);
    WriteState_InTagContent_instance = new WriteState('InTagContent', 3);
    WriteState_Finished_instance = new WriteState('Finished', 4);
  }
  function namespaceAt($this, depth) {
    return ensureNotNull($this.ykd_1[imul(depth, 3)]);
  }
  function setElementStack($this, depth, namespace, prefix, localName) {
    var esp = imul(depth, 3);
    if ($this.ykd_1.length < (esp + 3 | 0)) {
      // Inline function 'kotlin.arrayOfNulls' call
      var size = $this.ykd_1.length + 12 | 0;
      var hlp = fillArrayVal(Array(size), null);
      // Inline function 'kotlin.collections.copyInto' call
      var this_0 = $this.ykd_1;
      var endIndex = esp;
      arrayCopy(this_0, hlp, 0, 0, endIndex);
      $this.ykd_1 = hlp;
    }
    var tmp = $this.ykd_1;
    var tmp0 = esp;
    esp = tmp0 + 1 | 0;
    tmp[tmp0] = namespace;
    var tmp_0 = $this.ykd_1;
    var tmp1 = esp;
    esp = tmp1 + 1 | 0;
    tmp_0[tmp1] = prefix;
    $this.ykd_1[esp] = localName;
  }
  function prefixAt($this, depth) {
    return ensureNotNull($this.ykd_1[imul(depth, 3) + 1 | 0]);
  }
  function localNameAt($this, depth) {
    return ensureNotNull($this.ykd_1[imul(depth, 3) + 2 | 0]);
  }
  function finishPartialStartTag($this, close) {
    if (!$this.xkd_1) {
      return Unit_instance;
    }
    $this.xkd_1 = false;
    var endOfTag = !close ? '>' : $this.wkd_1 ? ' />' : '/>';
    $this.skd_1.r8(endOfTag);
  }
  function EscapeMode(name, ordinal) {
    Enum.call(this, name, ordinal);
  }
  function appendXmlCodepoint(_this__u8e3s4, $this, codepoint, mode) {
    var c = codepoint;
    var tmp;
    var tmp_0;
    var tmp_1;
    if ((codepoint === _UInt___init__impl__l7qpdl(9) ? true : codepoint === _UInt___init__impl__l7qpdl(10)) ? true : codepoint === _UInt___init__impl__l7qpdl(13)) {
      tmp_1 = true;
    } else {
      // Inline function 'kotlin.UInt.rangeTo' call
      var this_0 = _UInt___init__impl__l7qpdl(32);
      var other = _UInt___init__impl__l7qpdl(55295);
      var progression = new UIntRange(this_0, other);
      var containsLower = progression.jo_1;
      tmp_1 = UInt__compareTo_impl_yacclj(codepoint, progression.ko_1) <= 0 ? 0 <= UInt__compareTo_impl_yacclj(codepoint, containsLower) : false;
    }
    if (tmp_1) {
      tmp_0 = true;
    } else {
      // Inline function 'kotlin.UInt.rangeTo' call
      var this_1 = _UInt___init__impl__l7qpdl(57344);
      var other_0 = _UInt___init__impl__l7qpdl(65533);
      var progression_0 = new UIntRange(this_1, other_0);
      var containsLower_0 = progression_0.jo_1;
      tmp_0 = UInt__compareTo_impl_yacclj(codepoint, progression_0.ko_1) <= 0 ? 0 <= UInt__compareTo_impl_yacclj(codepoint, containsLower_0) : false;
    }
    if (tmp_0) {
      // Inline function 'kotlin.UInt.toUShort' call
      // Inline function 'kotlin.toUShort' call
      var this_2 = _UInt___get_data__impl__f0vqqw(codepoint);
      var tmp$ret$3 = _UShort___init__impl__jigrne(toShort(this_2));
      tmp = _Char___init__impl__6a9atx_0(tmp$ret$3);
    } else {
      tmp = _Char___init__impl__6a9atx_0(_UShort___init__impl__jigrne(0));
    }
    var ch = tmp;
    if (c === _UInt___init__impl__l7qpdl(0))
      throw IllegalArgumentException_init_$Create$('XML documents may not contain null strings directly or indirectly');
    else {
      if (ch === _Char___init__impl__6a9atx(38)) {
        _this__u8e3s4.r8('&amp;');
      } else {
        if (ch === _Char___init__impl__6a9atx(60) ? !mode.equals(EscapeMode_MINIMAL_getInstance()) : false) {
          _this__u8e3s4.r8('&lt;');
        } else {
          if (ch === _Char___init__impl__6a9atx(62) ? mode.equals(EscapeMode_TEXTCONTENT_getInstance()) : false) {
            _this__u8e3s4.r8('&gt;');
          } else {
            if (ch === _Char___init__impl__6a9atx(34) ? mode.equals(EscapeMode_ATTRCONTENTQUOT_getInstance()) : false) {
              _this__u8e3s4.r8('&quot;');
            } else {
              if (ch === _Char___init__impl__6a9atx(39) ? mode.equals(EscapeMode_ATTRCONTENTAPOS_getInstance()) : false) {
                _this__u8e3s4.r8('&apos;');
              } else {
                var tmp_2;
                var tmp_3;
                var tmp_4;
                // Inline function 'kotlin.UInt.rangeTo' call
                var this_3 = _UInt___init__impl__l7qpdl(1);
                var other_1 = _UInt___init__impl__l7qpdl(8);
                var progression_1 = new UIntRange(this_3, other_1);
                var containsLower_1 = progression_1.jo_1;
                if (UInt__compareTo_impl_yacclj(c, progression_1.ko_1) <= 0 ? 0 <= UInt__compareTo_impl_yacclj(c, containsLower_1) : false) {
                  tmp_4 = true;
                } else {
                  tmp_4 = c === _UInt___init__impl__l7qpdl(11);
                }
                if (tmp_4) {
                  tmp_3 = true;
                } else {
                  tmp_3 = c === _UInt___init__impl__l7qpdl(12);
                }
                if (tmp_3) {
                  tmp_2 = true;
                } else {
                  // Inline function 'kotlin.UInt.rangeTo' call
                  var this_4 = _UInt___init__impl__l7qpdl(14);
                  var other_2 = _UInt___init__impl__l7qpdl(31);
                  var progression_2 = new UIntRange(this_4, other_2);
                  var containsLower_2 = progression_2.jo_1;
                  tmp_2 = UInt__compareTo_impl_yacclj(c, progression_2.ko_1) <= 0 ? 0 <= UInt__compareTo_impl_yacclj(c, containsLower_2) : false;
                }
                if (tmp_2) {
                  var tmp0 = $this.vkd_1.za_1;
                  if (tmp0 === 0) {
                    appendXmlCodepoint$throwInvalid($this, c);
                  } else if (tmp0 === 1) {
                    appendXmlCodepoint$appendNumCharRef(_this__u8e3s4, c);
                  }
                } else {
                  var tmp_5;
                  // Inline function 'kotlin.UInt.rangeTo' call
                  var this_5 = _UInt___init__impl__l7qpdl(127);
                  var other_3 = _UInt___init__impl__l7qpdl(132);
                  var progression_3 = new UIntRange(this_5, other_3);
                  var containsLower_3 = progression_3.jo_1;
                  if (UInt__compareTo_impl_yacclj(c, progression_3.ko_1) <= 0 ? 0 <= UInt__compareTo_impl_yacclj(c, containsLower_3) : false) {
                    tmp_5 = true;
                  } else {
                    // Inline function 'kotlin.UInt.rangeTo' call
                    var this_6 = _UInt___init__impl__l7qpdl(134);
                    var other_4 = _UInt___init__impl__l7qpdl(159);
                    var progression_4 = new UIntRange(this_6, other_4);
                    var containsLower_4 = progression_4.jo_1;
                    tmp_5 = UInt__compareTo_impl_yacclj(c, progression_4.ko_1) <= 0 ? 0 <= UInt__compareTo_impl_yacclj(c, containsLower_4) : false;
                  }
                  if (tmp_5) {
                    var tmp0_0 = $this.vkd_1.za_1;
                    if (tmp0_0 === 0) {
                      _this__u8e3s4.z5(ch);
                    } else if (tmp0_0 === 1) {
                      appendXmlCodepoint$appendNumCharRef(_this__u8e3s4, c);
                    }
                  } else {
                    var tmp_6;
                    var tmp_7;
                    // Inline function 'kotlin.UInt.rangeTo' call
                    var this_7 = _UInt___init__impl__l7qpdl(55296);
                    var other_5 = _UInt___init__impl__l7qpdl(57343);
                    var progression_5 = new UIntRange(this_7, other_5);
                    var containsLower_5 = progression_5.jo_1;
                    if (UInt__compareTo_impl_yacclj(c, progression_5.ko_1) <= 0 ? 0 <= UInt__compareTo_impl_yacclj(c, containsLower_5) : false) {
                      tmp_7 = true;
                    } else {
                      tmp_7 = c === _UInt___init__impl__l7qpdl(65534);
                    }
                    if (tmp_7) {
                      tmp_6 = true;
                    } else {
                      tmp_6 = c === _UInt___init__impl__l7qpdl(65535);
                    }
                    if (tmp_6) {
                      appendXmlCodepoint$throwInvalid($this, c);
                    } else {
                      // Inline function 'kotlin.UInt.compareTo' call
                      var other_6 = _UInt___init__impl__l7qpdl(65535);
                      if (uintCompare(_UInt___get_data__impl__f0vqqw(c), _UInt___get_data__impl__f0vqqw(other_6)) > 0) {
                        // Inline function 'kotlin.UInt.minus' call
                        var other_7 = _UInt___init__impl__l7qpdl(65536);
                        var down = _UInt___init__impl__l7qpdl(_UInt___get_data__impl__f0vqqw(c) - _UInt___get_data__impl__f0vqqw(other_7) | 0);
                        // Inline function 'kotlin.UInt.plus' call
                        // Inline function 'kotlin.UInt.shr' call
                        var this_8 = _UInt___init__impl__l7qpdl(_UInt___get_data__impl__f0vqqw(down) >>> 10 | 0);
                        var other_8 = _UInt___init__impl__l7qpdl(55296);
                        var highSurogate = _UInt___init__impl__l7qpdl(_UInt___get_data__impl__f0vqqw(this_8) + _UInt___get_data__impl__f0vqqw(other_8) | 0);
                        // Inline function 'kotlin.UInt.plus' call
                        // Inline function 'kotlin.UInt.and' call
                        var other_9 = _UInt___init__impl__l7qpdl(1023);
                        var this_9 = _UInt___init__impl__l7qpdl(_UInt___get_data__impl__f0vqqw(down) & _UInt___get_data__impl__f0vqqw(other_9));
                        var other_10 = _UInt___init__impl__l7qpdl(56320);
                        var lowSurogate = _UInt___init__impl__l7qpdl(_UInt___get_data__impl__f0vqqw(this_9) + _UInt___get_data__impl__f0vqqw(other_10) | 0);
                        // Inline function 'kotlin.UInt.toUShort' call
                        // Inline function 'kotlin.toUShort' call
                        var this_10 = _UInt___get_data__impl__f0vqqw(highSurogate);
                        var tmp$ret$16 = _UShort___init__impl__jigrne(toShort(this_10));
                        _this__u8e3s4.z5(_Char___init__impl__6a9atx_0(tmp$ret$16));
                        // Inline function 'kotlin.UInt.toUShort' call
                        // Inline function 'kotlin.toUShort' call
                        var this_11 = _UInt___get_data__impl__f0vqqw(lowSurogate);
                        var tmp$ret$18 = _UShort___init__impl__jigrne(toShort(this_11));
                        _this__u8e3s4.z5(_Char___init__impl__6a9atx_0(tmp$ret$18));
                      } else {
                        _this__u8e3s4.z5(ch);
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  function writeEscapedText($this, s, mode) {
    var tmp0_iterator = asCodePoints(s).w();
    loop: while (tmp0_iterator.f()) {
      var c = tmp0_iterator.e().wn_1;
      appendXmlCodepoint($this.skd_1, $this, c, mode);
    }
  }
  function triggerStartDocument($this) {
    if ($this.zkd_1.za_1 === 0) {
      if (!$this.ukd_1.equals(XmlDeclMode_None_getInstance())) {
        $this.fk8(null, null, null);
      }
      $this.zkd_1 = WriteState_AfterXmlDecl_getInstance();
    }
  }
  function writeIndent_0($this, newDepth) {
    var indentSeq = $this.zk6_1;
    var tmp;
    var tmp_0;
    if ($this.bke_1 >= 0) {
      // Inline function 'kotlin.collections.isNotEmpty' call
      tmp_0 = !indentSeq.c1();
    } else {
      tmp_0 = false;
    }
    if (tmp_0) {
      tmp = !($this.bke_1 === $this.jk6());
    } else {
      tmp = false;
    }
    if (tmp) {
      $this.mk7('\n');
      try {
        $this.zk6_1 = emptyList();
        var merged = joinRepeated(indentSeq, $this.jk6());
        // Inline function 'kotlin.collections.forEach' call
        var tmp0_iterator = merged.w();
        while (tmp0_iterator.f()) {
          var element = tmp0_iterator.e();
          // Inline function 'nl.adaptivity.xmlutil.core.KtXmlWriter.writeIndent.<anonymous>' call
          element.qk7($this);
        }
      }finally {
        $this.zk6_1 = indentSeq;
      }
    }
    $this.bke_1 = newDepth;
  }
  function writeIndent$default_0($this, newDepth, $super) {
    newDepth = newDepth === VOID ? $this.jk6() : newDepth;
    return writeIndent_0($this, newDepth);
  }
  function ensureNamespaceIfRepairing($this, namespace, prefix) {
    var tmp;
    var tmp_0;
    if ($this.tkd_1 ? !(namespace == null) : false) {
      // Inline function 'kotlin.text.isNotEmpty' call
      tmp_0 = charSequenceLength(namespace) > 0;
    } else {
      tmp_0 = false;
    }
    if (tmp_0) {
      tmp = !(prefix == null);
    } else {
      tmp = false;
    }
    if (tmp) {
      if (!($this.ake_1.cke(prefix) == namespace)) {
        $this.zk7(prefix, namespace);
      }
    }
  }
  function rawWriteAttribute($this, prefix, localName, value) {
    $this.skd_1.z5(_Char___init__impl__6a9atx(32));
    // Inline function 'kotlin.text.isNotEmpty' call
    if (charSequenceLength(prefix) > 0) {
      $this.skd_1.r8(prefix).z5(_Char___init__impl__6a9atx(58));
    }
    $this.skd_1.r8(localName).z5(_Char___init__impl__6a9atx(61));
    var tmp1_container = indexOf(value, _Char___init__impl__6a9atx(34)) === -1 ? new Pair(new Char(_Char___init__impl__6a9atx(34)), EscapeMode_ATTRCONTENTQUOT_getInstance()) : new Pair(new Char(_Char___init__impl__6a9atx(39)), EscapeMode_ATTRCONTENTAPOS_getInstance());
    var q = tmp1_container.y6().rb_1;
    var mode = tmp1_container.z6();
    $this.skd_1.z5(q);
    writeEscapedText($this, value, mode);
    $this.skd_1.z5(q);
  }
  function Companion_4() {
    this.dke_1 = -1;
    this.eke_1 = 2147483647;
  }
  var Companion_instance_5;
  function Companion_getInstance_4() {
    return Companion_instance_5;
  }
  function WriteState(name, ordinal) {
    Enum.call(this, name, ordinal);
  }
  function appendXmlCodepoint$appendNumCharRef($this_appendXmlCodepoint, code) {
    $this_appendXmlCodepoint.r8('&#x').r8(toString_0(code, 16)).z5(_Char___init__impl__6a9atx(59));
  }
  function appendXmlCodepoint$throwInvalid(this$0, code) {
    throw IllegalArgumentException_init_$Create$('In xml ' + this$0.vkd_1.hke_1 + ' the character 0x' + toString_0(code, 16) + ' is not valid');
  }
  function EscapeMode_MINIMAL_getInstance() {
    EscapeMode_initEntries();
    return EscapeMode_MINIMAL_instance;
  }
  function EscapeMode_ATTRCONTENTQUOT_getInstance() {
    EscapeMode_initEntries();
    return EscapeMode_ATTRCONTENTQUOT_instance;
  }
  function EscapeMode_ATTRCONTENTAPOS_getInstance() {
    EscapeMode_initEntries();
    return EscapeMode_ATTRCONTENTAPOS_instance;
  }
  function EscapeMode_TEXTCONTENT_getInstance() {
    EscapeMode_initEntries();
    return EscapeMode_TEXTCONTENT_instance;
  }
  function WriteState_BeforeDocument_getInstance() {
    WriteState_initEntries();
    return WriteState_BeforeDocument_instance;
  }
  function WriteState_AfterXmlDecl_getInstance() {
    WriteState_initEntries();
    return WriteState_AfterXmlDecl_instance;
  }
  function WriteState_AfterDocTypeDecl_getInstance() {
    WriteState_initEntries();
    return WriteState_AfterDocTypeDecl_instance;
  }
  function WriteState_InTagContent_getInstance() {
    WriteState_initEntries();
    return WriteState_InTagContent_instance;
  }
  function WriteState_Finished_getInstance() {
    WriteState_initEntries();
    return WriteState_Finished_instance;
  }
  function KtXmlWriter(writer, isRepairNamespaces, xmlDeclMode, xmlVersion) {
    isRepairNamespaces = isRepairNamespaces === VOID ? true : isRepairNamespaces;
    xmlDeclMode = xmlDeclMode === VOID ? XmlDeclMode_None_getInstance() : xmlDeclMode;
    xmlVersion = xmlVersion === VOID ? XmlVersion_XML11_getInstance() : xmlVersion;
    PlatformXmlWriterBase.call(this);
    this.skd_1 = writer;
    this.tkd_1 = isRepairNamespaces;
    this.ukd_1 = xmlDeclMode;
    this.vkd_1 = xmlVersion;
    this.wkd_1 = true;
    this.xkd_1 = false;
    var tmp = this;
    // Inline function 'kotlin.arrayOfNulls' call
    tmp.ykd_1 = fillArrayVal(Array(12), null);
    this.zkd_1 = WriteState_BeforeDocument_getInstance();
    this.ake_1 = new NamespaceHolder();
    this.bke_1 = -1;
  }
  protoOf(KtXmlWriter).qk6 = function () {
    return this.ake_1.gkc_1;
  };
  protoOf(KtXmlWriter).jk6 = function () {
    return this.ake_1.fkc_1;
  };
  protoOf(KtXmlWriter).t6 = function () {
    finishPartialStartTag(this, false);
  };
  protoOf(KtXmlWriter).fk8 = function (version, encoding, standalone) {
    writeIndent_0(this, 2147483647);
    if (!this.zkd_1.equals(WriteState_BeforeDocument_getInstance())) {
      throw XmlException_init_$Create$_0('Attempting to write start document after document already started');
    }
    this.zkd_1 = WriteState_AfterXmlDecl_getInstance();
    var tmp;
    switch (version) {
      case null:
        tmp = this.vkd_1.hke_1;
        break;
      case '1':
      case '1.0':
        this.vkd_1 = XmlVersion_XML10_getInstance();
        tmp = version;
        break;
      default:
        this.vkd_1 = XmlVersion_XML11_getInstance();
        tmp = version;
        break;
    }
    var verString = tmp;
    this.skd_1.r8("<?xml version='" + verString + "'");
    var effectiveEncoding = encoding == null ? 'UTF-8' : encoding;
    if (!this.ukd_1.equals(XmlDeclMode_Minimal_getInstance()) ? true : !(encoding == null)) {
      this.skd_1.r8(" encoding='");
      writeEscapedText(this, effectiveEncoding, EscapeMode_ATTRCONTENTAPOS_getInstance());
      this.skd_1.z5(_Char___init__impl__6a9atx(39));
      if (!(standalone == null)) {
        this.skd_1.r8(" standalone='");
        this.skd_1.r8(standalone ? 'yes' : 'no');
        this.skd_1.z5(_Char___init__impl__6a9atx(39));
      }
    }
    if (this.wkd_1) {
      this.skd_1.z5(_Char___init__impl__6a9atx(32));
    }
    this.skd_1.r8('?>');
  };
  protoOf(KtXmlWriter).xk7 = function (text) {
    writeIndent_0(this, 2147483647);
    triggerStartDocument(this);
    if (!this.zkd_1.equals(WriteState_AfterXmlDecl_getInstance())) {
      throw XmlException_init_$Create$_0('Writing a DTD is only allowed once, in the prolog');
    }
    this.zkd_1 = WriteState_AfterDocTypeDecl_getInstance();
    var tmp = this.skd_1.r8('<!DOCTYPE ');
    // Inline function 'kotlin.text.trimStart' call
    var tmp$ret$0 = toString(trimStart(isCharSequence(text) ? text : THROW_CCE()));
    tmp.r8(tmp$ret$0).r8('>');
  };
  protoOf(KtXmlWriter).vk7 = function (text) {
    finishPartialStartTag(this, false);
    writeIndent_0(this, 2147483647);
    triggerStartDocument(this);
    this.skd_1.r8('<?');
    this.skd_1.r8(text);
    this.skd_1.r8('?>');
  };
  protoOf(KtXmlWriter).wk7 = function (target, data) {
    finishPartialStartTag(this, false);
    writeIndent_0(this, 2147483647);
    triggerStartDocument(this);
    this.skd_1.r8('<?');
    this.skd_1.r8(target);
    // Inline function 'kotlin.text.isNotEmpty' call
    if (charSequenceLength(data) > 0) {
      this.skd_1.z5(_Char___init__impl__6a9atx(32)).r8(data);
    }
    this.skd_1.r8('?>');
  };
  protoOf(KtXmlWriter).ak8 = function (namespace, localName, prefix) {
    finishPartialStartTag(this, false);
    writeIndent$default_0(this);
    triggerStartDocument(this);
    if (this.zkd_1.equals(WriteState_Finished_getInstance())) {
      throw XmlException_init_$Create$_0('Attempting to write tag after the document finished');
    }
    this.zkd_1 = WriteState_InTagContent_getInstance();
    var tmp;
    if (namespace === '') {
      tmp = '';
    } else {
      var reg = this.kk8(namespace);
      tmp = !(reg == null) ? reg : prefix == null ? this.ake_1.ike() : prefix;
    }
    var appliedPrefix = tmp;
    var tmp_0 = this.jk6();
    setElementStack(this, tmp_0, namespace == null ? '' : namespace, appliedPrefix, localName);
    this.skd_1.z5(_Char___init__impl__6a9atx(60));
    // Inline function 'kotlin.text.isNotEmpty' call
    if (charSequenceLength(appliedPrefix) > 0) {
      this.skd_1.r8(appliedPrefix);
      this.skd_1.z5(_Char___init__impl__6a9atx(58));
    }
    this.skd_1.r8(localName);
    this.xkd_1 = true;
    this.ake_1.rkb();
    ensureNamespaceIfRepairing(this, namespace, appliedPrefix);
  };
  protoOf(KtXmlWriter).ik8 = function (namespace, localName, prefix) {
    this.ake_1.qkb();
    writeIndent_0(this, 2147483647);
    var tmp;
    if (!((namespace == null ? '' : namespace) === namespaceAt(this, this.jk6()))) {
      tmp = true;
    } else {
      tmp = !(localNameAt(this, this.jk6()) === localName);
    }
    if (tmp) {
      throw IllegalArgumentException_init_$Create$('<\/{' + namespace + '}' + localName + '> does not match start');
    }
    if (this.xkd_1) {
      finishPartialStartTag(this, true);
    } else {
      this.skd_1.r8('<\/');
      var actualPrefix = prefixAt(this, this.jk6());
      // Inline function 'kotlin.text.isNotEmpty' call
      if (charSequenceLength(actualPrefix) > 0) {
        this.skd_1.r8(actualPrefix);
        this.skd_1.z5(_Char___init__impl__6a9atx(58));
      }
      this.skd_1.r8(localName);
      this.skd_1.z5(_Char___init__impl__6a9atx(62));
    }
  };
  protoOf(KtXmlWriter).uk7 = function (text) {
    finishPartialStartTag(this, false);
    writeIndent_0(this, 2147483647);
    triggerStartDocument(this);
    var lastWasHyphen = false;
    this.skd_1.r8('<!--');
    var tmp0_iterator = asCodePoints(text).w();
    while (tmp0_iterator.f()) {
      var cp = tmp0_iterator.e().wn_1;
      // Inline function 'kotlin.toUInt' call
      // Inline function 'kotlin.code' call
      var this_0 = _Char___init__impl__6a9atx(45);
      var this_1 = Char__toInt_impl_vasixd(this_0);
      if (cp === _UInt___init__impl__l7qpdl(this_1)) {
        if (lastWasHyphen) {
          lastWasHyphen = false;
          this.skd_1.r8('&#x2d;');
        } else {
          lastWasHyphen = true;
          this.skd_1.z5(_Char___init__impl__6a9atx(45));
        }
      } else {
        appendXmlCodepoint(this.skd_1, this, cp, EscapeMode_MINIMAL_getInstance());
      }
    }
    this.skd_1.r8('-->');
  };
  protoOf(KtXmlWriter).bk8 = function (text) {
    finishPartialStartTag(this, false);
    writeEscapedText(this, text, EscapeMode_TEXTCONTENT_getInstance());
    this.bke_1 = -1;
  };
  protoOf(KtXmlWriter).ck8 = function (text) {
    finishPartialStartTag(this, false);
    var endPos = 0;
    this.skd_1.r8('<![CDATA[');
    var tmp0_iterator = asCodePoints(text).w();
    while (tmp0_iterator.f()) {
      var cp = tmp0_iterator.e().wn_1;
      var tmp;
      // Inline function 'kotlin.UInt.compareTo' call
      var other = _UInt___init__impl__l7qpdl(32223);
      if (uintCompare(_UInt___get_data__impl__f0vqqw(cp), _UInt___get_data__impl__f0vqqw(other)) < 0) {
        // Inline function 'kotlin.UInt.toUShort' call
        // Inline function 'kotlin.toUShort' call
        var this_0 = _UInt___get_data__impl__f0vqqw(cp);
        var tmp$ret$2 = _UShort___init__impl__jigrne(toShort(this_0));
        tmp = _Char___init__impl__6a9atx_0(tmp$ret$2);
      } else {
        tmp = _Char___init__impl__6a9atx_0(_UShort___init__impl__jigrne(0));
      }
      var ch = tmp;
      if (ch === _Char___init__impl__6a9atx(93) ? endPos === 0 ? true : endPos === 1 : false) {
        endPos = endPos + 1 | 0;
        this.skd_1.z5(ch);
      } else if (ch === _Char___init__impl__6a9atx(62) ? endPos === 2 : false) {
        this.skd_1.r8('&gt;');
      } else if (ch === _Char___init__impl__6a9atx(93) ? endPos === 2 : false) {
        this.skd_1.z5(ch);
      } else {
        endPos = 0;
        appendXmlCodepoint(this.skd_1, this, cp, EscapeMode_MINIMAL_getInstance());
      }
    }
    this.skd_1.r8(']]>');
    this.bke_1 = -1;
  };
  protoOf(KtXmlWriter).dk8 = function (text) {
    finishPartialStartTag(this, false);
    this.skd_1.z5(_Char___init__impl__6a9atx(38)).r8(text).z5(_Char___init__impl__6a9atx(59));
    this.bke_1 = -1;
  };
  protoOf(KtXmlWriter).mk7 = function (text) {
    finishPartialStartTag(this, false);
    triggerStartDocument(this);
    var inductionVariable = 0;
    var last = text.length;
    while (inductionVariable < last) {
      var c = charSequenceGet(text, inductionVariable);
      inductionVariable = inductionVariable + 1 | 0;
      if (!(((c === _Char___init__impl__6a9atx(10) ? true : c === _Char___init__impl__6a9atx(13)) ? true : c === _Char___init__impl__6a9atx(9)) ? true : c === _Char___init__impl__6a9atx(32))) {
        throw IllegalArgumentException_init_$Create$('"' + text + '" is not ignorable whitespace');
      }
    }
    this.skd_1.r8(text);
    this.bke_1 = -1;
  };
  protoOf(KtXmlWriter).ek8 = function (namespace, name, prefix, value) {
    if (namespace === 'http://www.w3.org/2000/xmlns/') {
      this.zk7(name, value);
      return Unit_instance;
    } else {
      var tmp;
      // Inline function 'kotlin.text.isNullOrEmpty' call
      // Inline function 'kotlin.contracts.contract' call
      if (namespace == null ? true : charSequenceLength(namespace) === 0) {
        tmp = 'xmlns' === name;
      } else {
        tmp = false;
      }
      if (tmp) {
        this.zk7('', value);
        return Unit_instance;
      }
    }
    var tmp_0;
    var tmp_1;
    var tmp_2;
    if (!(prefix == null)) {
      // Inline function 'kotlin.text.isNotEmpty' call
      tmp_2 = charSequenceLength(prefix) > 0;
    } else {
      tmp_2 = false;
    }
    if (tmp_2) {
      tmp_1 = !(namespace == null);
    } else {
      tmp_1 = false;
    }
    if (tmp_1) {
      // Inline function 'kotlin.text.isNotEmpty' call
      tmp_0 = charSequenceLength(namespace) > 0;
    } else {
      tmp_0 = false;
    }
    if (tmp_0) {
      this.jke(prefix, namespace);
      ensureNamespaceIfRepairing(this, namespace, prefix);
    }
    if (!this.xkd_1) {
      throw IllegalStateException_init_$Create$('illegal position for attribute');
    }
    var tmp_3;
    // Inline function 'kotlin.text.isNullOrEmpty' call
    // Inline function 'kotlin.contracts.contract' call
    if (!(prefix == null ? true : charSequenceLength(prefix) === 0)) {
      var tmp_4;
      if (!(this.jk8(prefix) == namespace)) {
        tmp_4 = this.kk8(namespace);
      } else {
        tmp_4 = prefix;
      }
      tmp_3 = tmp_4;
    } else {
      tmp_3 = prefix;
    }
    var tmp0_elvis_lhs = tmp_3;
    var actualPrefix = tmp0_elvis_lhs == null ? '' : tmp0_elvis_lhs;
    rawWriteAttribute(this, actualPrefix, name, value);
  };
  protoOf(KtXmlWriter).zk7 = function (namespacePrefix, namespaceUri) {
    var existingNamespaceForPrefix = this.ake_1.kke(namespacePrefix);
    if (!(existingNamespaceForPrefix == null)) {
      if (this.tkd_1)
        return Unit_instance;
      else if (!(existingNamespaceForPrefix === namespaceUri))
        throw IllegalStateException_init_$Create$('Attempting to set prefix to different values in the same tag');
      else
        throw IllegalStateException_init_$Create$('Namespace attribute duplicated');
    }
    this.ake_1.lke(namespacePrefix, namespaceUri);
    if (!this.xkd_1) {
      throw IllegalStateException_init_$Create$('illegal position for attribute');
    }
    // Inline function 'kotlin.text.isNotEmpty' call
    if (charSequenceLength(namespacePrefix) > 0) {
      rawWriteAttribute(this, 'xmlns', namespacePrefix, namespaceUri);
    } else {
      rawWriteAttribute(this, '', 'xmlns', namespaceUri);
    }
  };
  protoOf(KtXmlWriter).hk8 = function () {
    assert_0(this.jk6() === 0);
    if (!this.zkd_1.equals(WriteState_InTagContent_getInstance())) {
      throw XmlException_init_$Create$_0('Attempting to end document when in invalid state: ' + this.zkd_1);
    }
    while (this.jk6() > 0) {
      this.ik8(namespaceAt(this, this.jk6() - 1 | 0), prefixAt(this, this.jk6() - 1 | 0), localNameAt(this, this.jk6() - 1 | 0));
    }
    this.t6();
  };
  protoOf(KtXmlWriter).jke = function (prefix, namespaceUri) {
    if (!(namespaceUri === this.jk8(prefix))) {
      this.ake_1.lke(prefix, namespaceUri);
    }
  };
  protoOf(KtXmlWriter).jk8 = function (prefix) {
    return this.ake_1.cke(prefix);
  };
  protoOf(KtXmlWriter).kk8 = function (namespaceUri) {
    var tmp;
    if (namespaceUri == null) {
      tmp = null;
    } else {
      // Inline function 'kotlin.let' call
      // Inline function 'kotlin.contracts.contract' call
      // Inline function 'nl.adaptivity.xmlutil.core.KtXmlWriter.getPrefix.<anonymous>' call
      tmp = this.ake_1.mke(namespaceUri);
    }
    return tmp;
  };
  protoOf(KtXmlWriter).n = function () {
    this.ake_1.n1();
  };
  function asCodePoints(_this__u8e3s4) {
    return new asCodePoints$1(_this__u8e3s4);
  }
  function joinRepeated(_this__u8e3s4, repeats) {
    var it = _this__u8e3s4.w();
    if (!it.f())
      return emptyList();
    // Inline function 'kotlin.collections.mutableListOf' call
    var result = ArrayList_init_$Create$();
    var pending = null;
    var inductionVariable = 0;
    if (inductionVariable < repeats)
      do {
        var i = inductionVariable;
        inductionVariable = inductionVariable + 1 | 0;
        var tmp1_iterator = _this__u8e3s4.w();
        while (tmp1_iterator.f()) {
          var ev = tmp1_iterator.e();
          if (pending == null) {
            pending = ev;
          } else if (pending.ok6().equals(EventType_COMMENT_getInstance()) ? true : !pending.ok6().equals(ev.ok6())) {
            result.i1(pending);
            pending = ev;
          } else if (ev.ok6().equals(pending.ok6())) {
            pending = new TextEvent(null, pending.ok6(), pending.pk7_1 + ev.pk7_1);
          }
        }
      }
       while (inductionVariable < repeats);
    if (!(pending == null)) {
      result.i1(pending);
    }
    return result;
  }
  function asCodePoints$1$iterator$1($this_asCodePoints) {
    this.oke_1 = $this_asCodePoints;
    this.nke_1 = 0;
  }
  protoOf(asCodePoints$1$iterator$1).f = function () {
    return this.nke_1 < charSequenceLength(this.oke_1);
  };
  protoOf(asCodePoints$1$iterator$1).ao = function () {
    var tmp;
    if (isHighSurrogate(charSequenceGet(this.oke_1, this.nke_1)) === true) {
      // Inline function 'kotlin.UInt.plus' call
      // Inline function 'kotlin.UInt.plus' call
      var this_0 = _UInt___init__impl__l7qpdl(65536);
      // Inline function 'kotlin.UInt.shl' call
      // Inline function 'kotlin.UInt.minus' call
      // Inline function 'kotlin.toUInt' call
      // Inline function 'kotlin.code' call
      var this_1 = charSequenceGet(this.oke_1, this.nke_1);
      var this_2 = Char__toInt_impl_vasixd(this_1);
      var this_3 = _UInt___init__impl__l7qpdl(this_2);
      var other = _UInt___init__impl__l7qpdl(55296);
      var this_4 = _UInt___init__impl__l7qpdl(_UInt___get_data__impl__f0vqqw(this_3) - _UInt___get_data__impl__f0vqqw(other) | 0);
      var other_0 = _UInt___init__impl__l7qpdl(_UInt___get_data__impl__f0vqqw(this_4) << 10);
      var this_5 = _UInt___init__impl__l7qpdl(_UInt___get_data__impl__f0vqqw(this_0) + _UInt___get_data__impl__f0vqqw(other_0) | 0);
      // Inline function 'kotlin.UInt.minus' call
      // Inline function 'kotlin.toUInt' call
      // Inline function 'kotlin.code' call
      var this_6 = charSequenceGet(this.oke_1, this.nke_1 + 1 | 0);
      var this_7 = Char__toInt_impl_vasixd(this_6);
      var this_8 = _UInt___init__impl__l7qpdl(this_7);
      var other_1 = _UInt___init__impl__l7qpdl(56320);
      var other_2 = _UInt___init__impl__l7qpdl(_UInt___get_data__impl__f0vqqw(this_8) - _UInt___get_data__impl__f0vqqw(other_1) | 0);
      var codePoint = _UInt___init__impl__l7qpdl(_UInt___get_data__impl__f0vqqw(this_5) + _UInt___get_data__impl__f0vqqw(other_2) | 0);
      this.nke_1 = this.nke_1 + 2 | 0;
      tmp = codePoint;
    } else {
      // Inline function 'kotlin.also' call
      // Inline function 'kotlin.toUInt' call
      // Inline function 'kotlin.code' call
      var this_9 = charSequenceGet(this.oke_1, this.nke_1);
      var this_10 = Char__toInt_impl_vasixd(this_9);
      var tmp$ret$10 = _UInt___init__impl__l7qpdl(this_10);
      var this_11 = new UInt(tmp$ret$10);
      // Inline function 'kotlin.contracts.contract' call
      // Inline function 'nl.adaptivity.xmlutil.core.<no name provided>.next.<anonymous>' call
      this_11.wn_1;
      this.nke_1 = this.nke_1 + 1 | 0;
      tmp = this_11.wn_1;
    }
    return tmp;
  };
  protoOf(asCodePoints$1$iterator$1).e = function () {
    return new UInt(this.ao());
  };
  function asCodePoints$1($this_asCodePoints) {
    this.pke_1 = $this_asCodePoints;
  }
  protoOf(asCodePoints$1).w = function () {
    return new asCodePoints$1$iterator$1(this.pke_1);
  };
  var XmlVersion_XML10_instance;
  var XmlVersion_XML11_instance;
  var XmlVersion_entriesInitialized;
  function XmlVersion_initEntries() {
    if (XmlVersion_entriesInitialized)
      return Unit_instance;
    XmlVersion_entriesInitialized = true;
    XmlVersion_XML10_instance = new XmlVersion('XML10', 0, '1.0');
    XmlVersion_XML11_instance = new XmlVersion('XML11', 1, '1.1');
  }
  function XmlVersion(name, ordinal, versionString) {
    Enum.call(this, name, ordinal);
    this.hke_1 = versionString;
  }
  function XmlVersion_XML10_getInstance() {
    XmlVersion_initEntries();
    return XmlVersion_XML10_instance;
  }
  function XmlVersion_XML11_getInstance() {
    XmlVersion_initEntries();
    return XmlVersion_XML11_instance;
  }
  function NamespaceHolder$namespaceContext$o$getPrefixesCompat$lambda(this$0, $namespaceURI) {
    return function (it) {
      return getNamespace(this$0, it) === $namespaceURI;
    };
  }
  function NamespaceHolder$namespaceContext$o$getPrefixesCompat$lambda_0(this$0) {
    return function (it) {
      return getPrefix(this$0, it);
    };
  }
  function namespaceIndicesAt($this, depth) {
    var startIdx = depth === 0 ? 0 : arrayUseAtDepth($this, depth - 1 | 0) / 2 | 0;
    var endIdx = arrayUseAtDepth($this, depth) / 2 | 0;
    return until(startIdx, endIdx);
  }
  function arrayUseAtDepth($this, depth) {
    return imul($this.ekc_1[depth], 2);
  }
  function prefixArrayPos($this, pairPos) {
    return imul(pairPos, 2);
  }
  function nsArrayPos($this, pairPos) {
    return imul(pairPos, 2) + 1 | 0;
  }
  function setPrefix($this, pos, value) {
    var tmp = $this.dkc_1;
    var tmp_0 = prefixArrayPos($this, pos);
    var tmp1_elvis_lhs = value == null ? null : toString(value);
    tmp[tmp_0] = tmp1_elvis_lhs == null ? '' : tmp1_elvis_lhs;
  }
  function getPrefix($this, pos) {
    return ensureNotNull($this.dkc_1[prefixArrayPos($this, pos)]);
  }
  function setNamespace($this, pos, value) {
    var tmp = $this.dkc_1;
    var tmp_0 = nsArrayPos($this, pos);
    var tmp1_elvis_lhs = value == null ? null : toString(value);
    tmp[tmp_0] = tmp1_elvis_lhs == null ? '' : tmp1_elvis_lhs;
  }
  function getNamespace($this, pos) {
    return ensureNotNull($this.dkc_1[nsArrayPos($this, pos)]);
  }
  function enlargeNamespaceBuffer($this) {
    $this.dkc_1 = copyOf($this.dkc_1, imul($this.dkc_1.length, 2));
  }
  function NamespaceHolder$namespaceContext$1(this$0) {
    this.qke_1 = this$0;
  }
  protoOf(NamespaceHolder$namespaceContext$1).zk5 = function (prefix) {
    return this.qke_1.cke(prefix);
  };
  protoOf(NamespaceHolder$namespaceContext$1).ak6 = function (namespaceURI) {
    return this.qke_1.mke(namespaceURI);
  };
  protoOf(NamespaceHolder$namespaceContext$1).bk6 = function () {
    return SimpleNamespaceContext_init_$Create$_2(this.qke_1);
  };
  protoOf(NamespaceHolder$namespaceContext$1).w = function () {
    return this.qke_1.w();
  };
  protoOf(NamespaceHolder$namespaceContext$1).ck6 = function (namespaceURI) {
    var tmp = asSequence_0(downTo(this.qke_1.rke() - 1 | 0, 0));
    var tmp_0 = filter(tmp, NamespaceHolder$namespaceContext$o$getPrefixesCompat$lambda(this.qke_1, namespaceURI));
    return map(tmp_0, NamespaceHolder$namespaceContext$o$getPrefixesCompat$lambda_0(this.qke_1)).w();
  };
  function NamespaceHolder$iterator$1(this$0) {
    this.tke_1 = this$0;
    this.ske_1 = 0;
  }
  protoOf(NamespaceHolder$iterator$1).f = function () {
    return this.ske_1 < this.tke_1.ekc_1[this.tke_1.fkc_1];
  };
  protoOf(NamespaceHolder$iterator$1).e = function () {
    // Inline function 'kotlin.also' call
    var this_0 = new NamespaceImpl(getPrefix(this.tke_1, this.ske_1), getNamespace(this.tke_1, this.ske_1));
    // Inline function 'kotlin.contracts.contract' call
    // Inline function 'nl.adaptivity.xmlutil.core.impl.<no name provided>.next.<anonymous>' call
    this.ske_1 = this.ske_1 + 1 | 0;
    return this_0;
  };
  function NamespaceHolder() {
    this.ckc_1 = 1;
    var tmp = this;
    // Inline function 'kotlin.arrayOfNulls' call
    tmp.dkc_1 = fillArrayVal(Array(10), null);
    this.ekc_1 = new Int32Array(20);
    this.fkc_1 = 0;
    var tmp_0 = this;
    tmp_0.gkc_1 = new NamespaceHolder$namespaceContext$1(this);
  }
  protoOf(NamespaceHolder).ikd = function () {
    // Inline function 'kotlin.collections.map' call
    var this_0 = namespaceIndicesAt(this, this.fkc_1);
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
    var tmp0_iterator = this_0.w();
    while (tmp0_iterator.f()) {
      var item = tmp0_iterator.e();
      // Inline function 'nl.adaptivity.xmlutil.core.impl.NamespaceHolder.<get-namespacesAtCurrentDepth>.<anonymous>' call
      var tmp$ret$0 = new NamespaceImpl(getPrefix(this, item), getNamespace(this, item));
      destination.i1(tmp$ret$0);
    }
    return destination;
  };
  protoOf(NamespaceHolder).rkb = function () {
    this.fkc_1 = this.fkc_1 + 1 | 0;
    if (this.fkc_1 >= this.ekc_1.length) {
      this.ekc_1 = copyOf_0(this.ekc_1, imul(this.ekc_1.length, 2));
    }
    this.ekc_1[this.fkc_1] = this.fkc_1 === 0 ? 0 : this.ekc_1[this.fkc_1 - 1 | 0];
  };
  protoOf(NamespaceHolder).qkb = function () {
    var progression = namespaceIndicesAt(this, this.fkc_1);
    var inductionVariable = progression.ib_1;
    var last = progression.jb_1;
    if (inductionVariable <= last)
      do {
        var i = inductionVariable;
        inductionVariable = inductionVariable + 1 | 0;
        this.dkc_1[prefixArrayPos(this, i)] = null;
        this.dkc_1[nsArrayPos(this, i)] = null;
      }
       while (!(i === last));
    this.ekc_1[this.fkc_1] = 0;
    this.fkc_1 = this.fkc_1 - 1 | 0;
  };
  protoOf(NamespaceHolder).rke = function () {
    return this.ekc_1[this.fkc_1];
  };
  protoOf(NamespaceHolder).n1 = function () {
    var tmp = this;
    // Inline function 'kotlin.arrayOfNulls' call
    tmp.dkc_1 = fillArrayVal(Array(10), null);
    this.ekc_1 = new Int32Array(20);
    this.fkc_1 = 0;
  };
  protoOf(NamespaceHolder).okc = function (ns) {
    this.lke(ns.hk6(), ns.fk6());
  };
  protoOf(NamespaceHolder).lke = function (prefix, namespaceUri) {
    var prevCounts = this.fkc_1 >= 1 ? this.ekc_1[this.fkc_1 - 1 | 0] : 0;
    var inductionVariable = prevCounts;
    var last = this.ekc_1[this.fkc_1];
    if (inductionVariable < last)
      do {
        var i = inductionVariable;
        inductionVariable = inductionVariable + 1 | 0;
        if (equals(getPrefix(this, i), prefix) ? equals(getNamespace(this, i), namespaceUri) : false)
          return Unit_instance;
      }
       while (inductionVariable < last);
    var nextPair = this.ekc_1[this.fkc_1];
    if (nsArrayPos(this, nextPair) >= this.dkc_1.length) {
      enlargeNamespaceBuffer(this);
    }
    setPrefix(this, nextPair, prefix);
    setNamespace(this, nextPair, namespaceUri);
    var tmp1_array = this.ekc_1;
    var tmp2_index0 = this.fkc_1;
    tmp1_array[tmp2_index0] = tmp1_array[tmp2_index0] + 1 | 0;
  };
  protoOf(NamespaceHolder).cke = function (prefix) {
    var prefixStr = toString(prefix);
    var tmp;
    if (prefixStr === 'xml') {
      return 'http://www.w3.org/XML/1998/namespace';
    } else {
      if (prefixStr === 'xmlns') {
        return 'http://www.w3.org/2000/xmlns/';
      } else {
        var tmp$ret$1;
        $l$block: {
          // Inline function 'kotlin.collections.firstOrNull' call
          var tmp0_iterator = downTo(this.rke() - 1 | 0, 0).w();
          while (tmp0_iterator.f()) {
            var element = tmp0_iterator.e();
            // Inline function 'nl.adaptivity.xmlutil.core.impl.NamespaceHolder.getNamespaceUri.<anonymous>' call
            if (getPrefix(this, element) === prefixStr) {
              tmp$ret$1 = element;
              break $l$block;
            }
          }
          tmp$ret$1 = null;
        }
        var tmp0_safe_receiver = tmp$ret$1;
        var tmp_0;
        if (tmp0_safe_receiver == null) {
          tmp_0 = null;
        } else {
          // Inline function 'kotlin.let' call
          // Inline function 'kotlin.contracts.contract' call
          // Inline function 'nl.adaptivity.xmlutil.core.impl.NamespaceHolder.getNamespaceUri.<anonymous>' call
          tmp_0 = getNamespace(this, tmp0_safe_receiver);
        }
        var tmp1_elvis_lhs = tmp_0;
        var tmp_1;
        if (tmp1_elvis_lhs == null) {
          var tmp_2;
          // Inline function 'kotlin.text.isEmpty' call
          if (charSequenceLength(prefixStr) === 0) {
            tmp_2 = '';
          } else {
            tmp_2 = null;
          }
          tmp_1 = tmp_2;
        } else {
          tmp_1 = tmp1_elvis_lhs;
        }
        tmp = tmp_1;
      }
    }
    return tmp;
  };
  protoOf(NamespaceHolder).mke = function (namespaceUri) {
    var namespaceUriStr = toString(namespaceUri);
    var tmp;
    if (namespaceUriStr === 'http://www.w3.org/XML/1998/namespace') {
      tmp = 'xml';
    } else {
      if (namespaceUriStr === 'http://www.w3.org/2000/xmlns/') {
        tmp = 'xmlns';
      } else {
        if (namespaceUriStr === '') {
          var tmp_0;
          var tmp$ret$0;
          $l$block_0: {
            // Inline function 'kotlin.collections.none' call
            var this_0 = until(0, this.rke());
            var tmp_1;
            if (isInterface(this_0, Collection)) {
              tmp_1 = this_0.c1();
            } else {
              tmp_1 = false;
            }
            if (tmp_1) {
              tmp$ret$0 = true;
              break $l$block_0;
            }
            var tmp0_iterator = this_0.w();
            while (tmp0_iterator.f()) {
              var element = tmp0_iterator.e();
              // Inline function 'nl.adaptivity.xmlutil.core.impl.NamespaceHolder.getPrefix.<anonymous>' call
              // Inline function 'kotlin.text.isEmpty' call
              var this_1 = getPrefix(this, element);
              if (charSequenceLength(this_1) === 0) {
                tmp$ret$0 = false;
                break $l$block_0;
              }
            }
            tmp$ret$0 = true;
          }
          if (tmp$ret$0) {
            tmp_0 = '';
          } else {
            tmp_0 = null;
          }
          tmp = tmp_0;
        } else {
          var tmp$ret$6;
          $l$block_3: {
            // Inline function 'kotlin.collections.firstOrNull' call
            var tmp0_iterator_0 = downTo(this.rke() - 1 | 0, 0).w();
            while (tmp0_iterator_0.f()) {
              var element_0 = tmp0_iterator_0.e();
              // Inline function 'nl.adaptivity.xmlutil.core.impl.NamespaceHolder.getPrefix.<anonymous>' call
              var tmp_2;
              if (getNamespace(this, element_0) === namespaceUriStr) {
                var tmp$ret$3;
                $l$block_2: {
                  // Inline function 'kotlin.collections.none' call
                  var this_2 = until(element_0 + 1 | 0, this.rke());
                  var tmp_3;
                  if (isInterface(this_2, Collection)) {
                    tmp_3 = this_2.c1();
                  } else {
                    tmp_3 = false;
                  }
                  if (tmp_3) {
                    tmp$ret$3 = true;
                    break $l$block_2;
                  }
                  var tmp0_iterator_1 = this_2.w();
                  while (tmp0_iterator_1.f()) {
                    var element_1 = tmp0_iterator_1.e();
                    // Inline function 'nl.adaptivity.xmlutil.core.impl.NamespaceHolder.getPrefix.<anonymous>.<anonymous>' call
                    if (getPrefix(this, element_0) === getPrefix(this, element_1)) {
                      tmp$ret$3 = false;
                      break $l$block_2;
                    }
                  }
                  tmp$ret$3 = true;
                }
                tmp_2 = tmp$ret$3;
              } else {
                tmp_2 = false;
              }
              if (tmp_2) {
                tmp$ret$6 = element_0;
                break $l$block_3;
              }
            }
            tmp$ret$6 = null;
          }
          var tmp0_safe_receiver = tmp$ret$6;
          var tmp_4;
          if (tmp0_safe_receiver == null) {
            tmp_4 = null;
          } else {
            // Inline function 'kotlin.let' call
            // Inline function 'kotlin.contracts.contract' call
            // Inline function 'nl.adaptivity.xmlutil.core.impl.NamespaceHolder.getPrefix.<anonymous>' call
            tmp_4 = getPrefix(this, tmp0_safe_receiver);
          }
          tmp = tmp_4;
        }
      }
    }
    return tmp;
  };
  protoOf(NamespaceHolder).w = function () {
    return new NamespaceHolder$iterator$1(this);
  };
  protoOf(NamespaceHolder).ike = function () {
    var prefix;
    do {
      prefix = 'n' + this.ckc_1;
    }
     while (!(this.cke(prefix) == null));
    return prefix;
  };
  protoOf(NamespaceHolder).kke = function (prefix) {
    var progression = namespaceIndicesAt(this, this.fkc_1);
    var nestedFirst = progression.ib_1;
    var nestedLast = progression.jb_1;
    var inductionVariable = nestedFirst;
    var last = getProgressionLastElement(nestedFirst, nestedLast, 2);
    if (inductionVariable <= last)
      do {
        var i = inductionVariable;
        inductionVariable = inductionVariable + 2 | 0;
        if (this.dkc_1[prefixArrayPos(this, i)] === prefix) {
          return this.dkc_1[nsArrayPos(this, i)];
        }
      }
       while (!(i === last));
    return null;
  };
  function toIndentSequence$sbToTextEvent(sb, result) {
    // Inline function 'kotlin.text.isNotEmpty' call
    if (charSequenceLength(sb) > 0) {
      var text = sb.toString();
      if (!isXmlWhitespace_1(text)) {
        throw XmlException_init_$Create$_0('Indents can only be whitespace or comments: ' + text);
      }
      result.i1(new TextEvent(null, EventType_IGNORABLE_WHITESPACE_getInstance(), text));
      sb.z8();
    }
  }
  function Companion_5() {
    this.uke_1 = '<!---->';
  }
  protoOf(Companion_5).vke = function (_this__u8e3s4) {
    // Inline function 'kotlin.collections.mutableListOf' call
    var result = ArrayList_init_$Create$();
    var sb = StringBuilder_init_$Create$();
    var commentPos = 0;
    var inductionVariable = 0;
    var last = _this__u8e3s4.length;
    while (inductionVariable < last) {
      var ch = charSequenceGet(_this__u8e3s4, inductionVariable);
      inductionVariable = inductionVariable + 1 | 0;
      if (ch === _Char___init__impl__6a9atx(60)) {
        if (commentPos === 0) {
          commentPos = commentPos + 1 | 0;
        } else {
          sb.z5(ch);
        }
      } else if (ch === _Char___init__impl__6a9atx(33)) {
        if (commentPos === 1) {
          commentPos = commentPos + 1 | 0;
        } else {
          sb.z5(ch);
        }
      } else if (ch === _Char___init__impl__6a9atx(45)) {
        switch (commentPos) {
          case 2:
            commentPos = commentPos + 1 | 0;
            break;
          case 3:
            commentPos = commentPos + 1 | 0;
            toIndentSequence$sbToTextEvent(sb, result);
            break;
          case 4:
          case 5:
            commentPos = commentPos + 1 | 0;
            break;
          case 6:
            throw XmlException_init_$Create$_0('-- is not allowed to occur inside xml comment text');
          default:
            sb.z5(ch);
            break;
        }
      } else if (ch === _Char___init__impl__6a9atx(62)) {
        switch (commentPos) {
          case 6:
            commentPos = 0;
            result.i1(new TextEvent(null, EventType_COMMENT_getInstance(), sb.toString()));
            sb.z8();
            break;
          case 5:
            commentPos = 4;
            sb.y5('->');
            break;
          default:
            sb.z5(ch);
            break;
        }
      } else {
        switch (commentPos) {
          case 1:
          case 2:
          case 3:
            sb.s8('<!---->', 0, commentPos);
            commentPos = 0;
            sb.z5(ch);
            break;
          case 0:
          case 4:
            sb.z5(ch);
            break;
          case 5:
            commentPos = 4;
            sb.z5(_Char___init__impl__6a9atx(45)).z5(ch);
            break;
          case 6:
            throw XmlException_init_$Create$_0('-- is not allowed to occur inside xml comment text');
        }
      }
    }
    if (commentPos > 0)
      throw XmlException_init_$Create$_0('Indent can not contain unclosed comment');
    toIndentSequence$sbToTextEvent(sb, result);
    return result;
  };
  var Companion_instance_6;
  function Companion_getInstance_5() {
    return Companion_instance_6;
  }
  function PlatformXmlWriterBase$_get_indentString_$lambda_yiqku9(ev) {
    return ev.ok6().za_1 === 3 ? '<!--' + ev.pk7_1 + '-->' : ev.pk7_1;
  }
  function PlatformXmlWriterBase(indentSequence) {
    indentSequence = indentSequence === VOID ? emptyList() : indentSequence;
    this.zk6_1 = toList(indentSequence);
  }
  protoOf(PlatformXmlWriterBase).lk8 = function (value) {
    this.zk6_1 = Companion_instance_6.vke(value);
  };
  protoOf(PlatformXmlWriterBase).mk8 = function () {
    var tmp = this.zk6_1;
    return joinToString_0(tmp, VOID, VOID, VOID, VOID, VOID, PlatformXmlWriterBase$_get_indentString_$lambda_yiqku9);
  };
  function get_WHITESPACE() {
    _init_properties_chars_kt__oshz4b();
    return WHITESPACE;
  }
  var WHITESPACE;
  function isXmlWhitespace_1(_this__u8e3s4) {
    _init_properties_chars_kt__oshz4b();
    var tmp$ret$2;
    $l$block: {
      // Inline function 'kotlin.text.all' call
      var inductionVariable = 0;
      while (inductionVariable < charSequenceLength(_this__u8e3s4)) {
        var element = charSequenceGet(_this__u8e3s4, inductionVariable);
        inductionVariable = inductionVariable + 1 | 0;
        // Inline function 'nl.adaptivity.xmlutil.core.impl.isXmlWhitespace.<anonymous>' call
        // Inline function 'kotlin.code' call
        var tmp$ret$0 = Char__toInt_impl_vasixd(element);
        if (!isXmlWhitespace_2(tmp$ret$0)) {
          tmp$ret$2 = false;
          break $l$block;
        }
      }
      tmp$ret$2 = true;
    }
    return tmp$ret$2;
  }
  function isXmlWhitespace_2(_this__u8e3s4) {
    _init_properties_chars_kt__oshz4b();
    return _this__u8e3s4 >= get_WHITESPACE().length ? false : get_WHITESPACE()[_this__u8e3s4];
  }
  var properties_initialized_chars_kt_qk0z7x;
  function _init_properties_chars_kt__oshz4b() {
    if (!properties_initialized_chars_kt_qk0z7x) {
      properties_initialized_chars_kt_qk0z7x = true;
      // Inline function 'kotlin.also' call
      var this_0 = booleanArray(33);
      // Inline function 'kotlin.contracts.contract' call
      // Inline function 'nl.adaptivity.xmlutil.core.impl.WHITESPACE.<anonymous>' call
      // Inline function 'kotlin.code' call
      var this_1 = _Char___init__impl__6a9atx(9);
      this_0[Char__toInt_impl_vasixd(this_1)] = true;
      // Inline function 'kotlin.code' call
      var this_2 = _Char___init__impl__6a9atx(10);
      this_0[Char__toInt_impl_vasixd(this_2)] = true;
      // Inline function 'kotlin.code' call
      var this_3 = _Char___init__impl__6a9atx(13);
      this_0[Char__toInt_impl_vasixd(this_3)] = true;
      // Inline function 'kotlin.code' call
      var this_4 = _Char___init__impl__6a9atx(32);
      this_0[Char__toInt_impl_vasixd(this_4)] = true;
      WHITESPACE = this_0;
    }
  }
  function iterator(_this__u8e3s4) {
    return new NamedNodeMapIterator(_this__u8e3s4);
  }
  function NamedNodeMapIterator(map) {
    this.wke_1 = map;
    this.xke_1 = 0;
  }
  protoOf(NamedNodeMapIterator).f = function () {
    var tmp = this.xke_1;
    // Inline function 'nl.adaptivity.xmlutil.dom.getLength' call
    return tmp < this.wke_1.length;
  };
  protoOf(NamedNodeMapIterator).e = function () {
    var tmp1 = this.xke_1;
    this.xke_1 = tmp1 + 1 | 0;
    var tmp = get(this.wke_1, tmp1);
    return (!(tmp == null) ? !(tmp == null) : false) ? tmp : THROW_CCE();
  };
  function get(_this__u8e3s4, index) {
    var tmp = _this__u8e3s4.item(index);
    return (tmp == null ? true : !(tmp == null)) ? tmp : THROW_CCE();
  }
  function NodeConsts() {
    this.yke_1 = 1;
    this.zke_1 = 2;
    this.akf_1 = 3;
    this.bkf_1 = 4;
    this.ckf_1 = 5;
    this.dkf_1 = 6;
    this.ekf_1 = 7;
    this.fkf_1 = 8;
    this.gkf_1 = 9;
    this.hkf_1 = 10;
    this.ikf_1 = 11;
    this.jkf_1 = 12;
  }
  var NodeConsts_instance;
  function NodeConsts_getInstance() {
    return NodeConsts_instance;
  }
  function iterator_0(_this__u8e3s4) {
    return new NodeListIterator(_this__u8e3s4);
  }
  function NodeListIterator(nodeList) {
    this.kkf_1 = nodeList;
    this.lkf_1 = 0;
  }
  protoOf(NodeListIterator).f = function () {
    var tmp = this.lkf_1;
    // Inline function 'nl.adaptivity.xmlutil.dom.getLength' call
    return tmp < this.kkf_1.length;
  };
  protoOf(NodeListIterator).e = function () {
    var tmp1 = this.lkf_1;
    this.lkf_1 = tmp1 + 1 | 0;
    var tmp2_elvis_lhs = this.kkf_1.item(tmp1);
    var tmp;
    if (tmp2_elvis_lhs == null) {
      throw NoSuchElementException_init_$Create$_0('No item found in the iterator');
    } else {
      tmp = tmp2_elvis_lhs;
    }
    return tmp;
  };
  function ICompactFragment() {
  }
  function removeElementChildren(_this__u8e3s4) {
    var top = _this__u8e3s4;
    var cur = top.firstChild;
    while (!(cur == null)) {
      var n = cur.nextSibling;
      if (get_isElement(cur)) {
        top.removeChild(cur);
      }
      cur = n;
    }
  }
  function createElement(_this__u8e3s4, name) {
    return _this__u8e3s4.createElementNS(name.eka(), toCName(name));
  }
  function myLookupNamespaceURI(_this__u8e3s4, prefix) {
    var tmp;
    var tmp_0 = _this__u8e3s4.nodeType;
    if (!(tmp_0 === 1)) {
      tmp = null;
    } else {
      // Inline function 'nl.adaptivity.xmlutil.util.filterTyped' call
      var this_0 = (!(_this__u8e3s4 == null) ? _this__u8e3s4 : THROW_CCE()).attributes;
      // Inline function 'kotlin.collections.mutableListOf' call
      var result = ArrayList_init_$Create$();
      // Inline function 'nl.adaptivity.xmlutil.util.forEachAttr' call
      var l = this_0.length;
      var inductionVariable = 0;
      if (inductionVariable < l)
        do {
          var idx = inductionVariable;
          inductionVariable = inductionVariable + 1 | 0;
          // Inline function 'nl.adaptivity.xmlutil.util.filterTyped.<anonymous>' call
          var tmp_1 = this_0.item(idx);
          var attr = (!(tmp_1 == null) ? !(tmp_1 == null) : false) ? tmp_1 : THROW_CCE();
          // Inline function 'nl.adaptivity.xmlutil.util.myLookupNamespaceURI.<anonymous>' call
          if ((prefix === '' ? attr.localName === 'xmlns' : false) ? true : attr.prefix === 'xmlns' ? attr.localName === prefix : false) {
            result.i1(attr);
          }
        }
         while (inductionVariable < l);
      var tmp0_safe_receiver = firstOrNull(result);
      var tmp2_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.value;
      var tmp_2;
      if (tmp2_elvis_lhs == null) {
        var tmp1_safe_receiver = _this__u8e3s4.parentNode;
        tmp_2 = tmp1_safe_receiver == null ? null : myLookupNamespaceURI(tmp1_safe_receiver, prefix);
      } else {
        tmp_2 = tmp2_elvis_lhs;
      }
      tmp = tmp_2;
    }
    return tmp;
  }
  function myLookupPrefix(_this__u8e3s4, namespaceUri) {
    var tmp = _this__u8e3s4.nodeType;
    if (!(tmp === 1))
      return null;
    var tmp_0 = !(_this__u8e3s4 == null) ? _this__u8e3s4 : THROW_CCE();
    // Inline function 'kotlin.collections.mutableSetOf' call
    var tmp$ret$0 = LinkedHashSet_init_$Create$();
    return myLookupPrefixImpl(tmp_0, namespaceUri, tmp$ret$0);
  }
  function get_isElement(_this__u8e3s4) {
    var tmp = _this__u8e3s4.nodeType;
    return tmp === 1;
  }
  function get_isText(_this__u8e3s4) {
    var tmp0_subject = _this__u8e3s4.nodeType;
    var tmp;
    var tmp_0;
    var tmp_1 = tmp0_subject;
    if (tmp_1 === 1) {
      tmp_0 = true;
    } else {
      var tmp_2 = tmp0_subject;
      tmp_0 = tmp_2 === 4;
    }
    if (tmp_0) {
      tmp = true;
    } else {
      tmp = false;
    }
    return tmp;
  }
  function myLookupPrefixImpl(_this__u8e3s4, namespaceUri, seenPrefixes) {
    var tmp0_safe_receiver = _this__u8e3s4.attributes;
    if (tmp0_safe_receiver == null)
      null;
    else {
      // Inline function 'nl.adaptivity.xmlutil.util.forEachAttr' call
      var l = tmp0_safe_receiver.length;
      var inductionVariable = 0;
      if (inductionVariable < l)
        do {
          var idx = inductionVariable;
          inductionVariable = inductionVariable + 1 | 0;
          // Inline function 'nl.adaptivity.xmlutil.util.myLookupPrefixImpl.<anonymous>' call
          var tmp = tmp0_safe_receiver.item(idx);
          var attr = (!(tmp == null) ? !(tmp == null) : false) ? tmp : THROW_CCE();
          var tmp_0 = attr.prefix;
          if (tmp_0 === 'xmlns')
            if (attr.value === namespaceUri ? !seenPrefixes.a1(attr.localName) : false) {
              return attr.localName;
            } else {
              var tmp0_elvis_lhs = attr.localName;
              seenPrefixes.i1(tmp0_elvis_lhs == null ? attr.name : tmp0_elvis_lhs);
            }
           else {
            var tmp_1;
            // Inline function 'kotlin.text.isNullOrBlank' call
            var this_0 = attr.prefix;
            // Inline function 'kotlin.contracts.contract' call
            if (this_0 == null ? true : isBlank(this_0)) {
              var tmp_2 = attr.localName;
              tmp_1 = tmp_2 === 'xmlns';
            } else {
              tmp_1 = false;
            }
            if (tmp_1)
              if (attr.value === namespaceUri ? !seenPrefixes.a1(attr.localName) : false) {
                return '';
              } else {
                seenPrefixes.i1('');
              }
          }
        }
         while (inductionVariable < l);
    }
    var tmp_3 = _this__u8e3s4.parentNode;
    var tmp1_safe_receiver = (!(tmp_3 == null) ? !(tmp_3 == null) : false) ? tmp_3 : null;
    return tmp1_safe_receiver == null ? null : myLookupPrefixImpl(tmp1_safe_receiver, namespaceUri, seenPrefixes);
  }
  function QName_init_$Init$(namespaceURI, localPart, $this) {
    QName.call($this, namespaceURI, localPart, '');
    return $this;
  }
  function QName_init_$Create$(namespaceURI, localPart) {
    return QName_init_$Init$(namespaceURI, localPart, objectCreate(protoOf(QName)));
  }
  function QName_init_$Init$_0(localPart, $this) {
    QName.call($this, '', localPart, '');
    return $this;
  }
  function QName_init_$Create$_0(localPart) {
    return QName_init_$Init$_0(localPart, objectCreate(protoOf(QName)));
  }
  function QName(namespaceURI, localPart, prefix) {
    this.bka_1 = namespaceURI;
    this.cka_1 = localPart;
    this.dka_1 = prefix;
  }
  protoOf(QName).gka = function () {
    return this.dka_1;
  };
  protoOf(QName).fka = function () {
    return this.cka_1;
  };
  protoOf(QName).eka = function () {
    return this.bka_1;
  };
  protoOf(QName).toString = function () {
    if (this.bka_1 === '')
      return this.cka_1;
    return '{' + this.bka_1 + '}' + this.cka_1;
  };
  protoOf(QName).equals = function (other) {
    if (this === other)
      return true;
    if (other == null ? true : !(this.constructor == other.constructor))
      return false;
    if (!(other instanceof QName))
      THROW_CCE();
    if (!(this.bka_1 === other.bka_1))
      return false;
    if (!(this.cka_1 === other.cka_1))
      return false;
    return true;
  };
  protoOf(QName).hashCode = function () {
    var result = getStringHashCode(this.bka_1);
    result = imul(31, result) + getStringHashCode(this.cka_1) | 0;
    return result;
  };
  function siblingsToFragment(_this__u8e3s4) {
    var tmp0_safe_receiver = _this__u8e3s4 instanceof DomReader ? _this__u8e3s4 : null;
    var d = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.sk5_1;
    var tmp2_subject = d == null ? null : d.nodeType;
    var tmp;
    var tmp_0 = tmp2_subject == null ? null : tmp2_subject;
    if (tmp_0 === 9) {
      tmp = (!(d == null) ? !(d == null) : false) ? d : THROW_CCE();
    } else {
      if (tmp2_subject == null) {
        var tmp_1 = new Document();
        tmp = !(tmp_1 == null) ? tmp_1 : THROW_CCE();
      } else {
        var tmp4_elvis_lhs = d.ownerDocument;
        var tmp_2;
        if (tmp4_elvis_lhs == null) {
          var tmp_3 = new Document();
          tmp_2 = !(tmp_3 == null) ? tmp_3 : THROW_CCE();
        } else {
          tmp_2 = tmp4_elvis_lhs;
        }
        tmp = tmp_2;
      }
    }
    var doc = tmp;
    var frag = doc.createDocumentFragment();
    var wrapperElement = doc.createElementNS('http://wrapperns', 'SDFKLJDSF:afjlfxkls');
    frag.appendChild(wrapperElement);
    if (!_this__u8e3s4.ik6()) {
      if (_this__u8e3s4.f()) {
        _this__u8e3s4.e();
      } else {
        return CompactFragment_init_$Create$('');
      }
    }
    var startLocation = _this__u8e3s4.pk6();
    try {
      // Inline function 'kotlin.collections.mutableMapOf' call
      var missingNamespaces = LinkedHashMap_init_$Create$();
      var initialDepth = _this__u8e3s4.jk6() - (_this__u8e3s4.ok6() === EventType_START_ELEMENT_getInstance() ? 1 : 0) | 0;
      var type = _this__u8e3s4.ok6();
      while ((!(type === EventType_END_DOCUMENT_getInstance()) ? !(type === EventType_END_ELEMENT_getInstance()) : false) ? _this__u8e3s4.jk6() >= initialDepth : false) {
        var tmp5_subject = type;
        switch (tmp5_subject == null ? -1 : tmp5_subject.za_1) {
          case 1:
            var out = new DomWriter(wrapperElement, true);
            addUndeclaredNamespaces(out, _this__u8e3s4, missingNamespaces);
            writeCurrent(_this__u8e3s4, out);
            writeElementContent(out, missingNamespaces, _this__u8e3s4);
            out.n();
            break;
          case 9:
          case 4:
            wrapperElement.appendChild(ensureNotNull(wrapperElement.ownerDocument).createTextNode(_this__u8e3s4.mk6()));
            break;
          case 5:
            wrapperElement.appendChild(ensureNotNull(wrapperElement.ownerDocument).createCDATASection(_this__u8e3s4.mk6()));
            break;
          case 3:
            wrapperElement.appendChild(ensureNotNull(wrapperElement.ownerDocument).createComment(_this__u8e3s4.mk6()));
            break;
          case 8:
            throw XmlException_init_$Create$_0('Entity references are not expected here');
          case 10:
            throw AssertionError_init_$Create$('Attributes are not expected in the event stream');
          default:
            break;
        }
        type = _this__u8e3s4.f() ? _this__u8e3s4.e() : null;
      }
      if (missingNamespaces.q('') === '') {
        missingNamespaces.u2('');
      }
      var tmp_4 = asSequence_0(missingNamespaces.q2());
      var tmp_5 = filter(tmp_4, siblingsToFragment$lambda);
      var ns = toList_0(map(tmp_5, siblingsToFragment$lambda_0(wrapperElement)));
      var tmp_6 = new XMLSerializer();
      var wrappedString = tmp_6.serializeToString(wrapperElement instanceof Node ? wrapperElement : THROW_CCE());
      // Inline function 'kotlin.text.substring' call
      var startIndex = indexOf(wrappedString, _Char___init__impl__6a9atx(62), 19) + 1 | 0;
      var endIndex = (wrappedString.length - 19 | 0) - 3 | 0;
      // Inline function 'kotlin.js.asDynamic' call
      var unwrappedString = wrappedString.substring(startIndex, endIndex);
      return CompactFragment_init_$Create$_0(ns, unwrappedString);
    } catch ($p) {
      if ($p instanceof XmlException) {
        var e = $p;
        throw XmlException_init_$Create$_1('Failure to parse children into string at ' + startLocation, e);
      } else {
        if ($p instanceof RuntimeException) {
          var e_0 = $p;
          throw XmlException_init_$Create$_1('Failure to parse children into string at ' + startLocation, e_0);
        } else {
          throw $p;
        }
      }
    }
  }
  function siblingsToFragment$lambda(_name_for_destructuring_parameter_0__wldtmu) {
    // Inline function 'kotlin.collections.component1' call
    var prefix = _name_for_destructuring_parameter_0__wldtmu.s2();
    // Inline function 'kotlin.collections.component2' call
    var uri = _name_for_destructuring_parameter_0__wldtmu.t2();
    return !(prefix === '') ? true : !(uri === '');
  }
  function siblingsToFragment$lambda_0($wrapperElement) {
    return function (_name_for_destructuring_parameter_0__wldtmu) {
      // Inline function 'kotlin.collections.component1' call
      var prefix = _name_for_destructuring_parameter_0__wldtmu.s2();
      // Inline function 'kotlin.collections.component2' call
      var uri = _name_for_destructuring_parameter_0__wldtmu.t2();
      $wrapperElement.setAttributeNS('http://www.w3.org/2000/xmlns/', prefix === '' ? 'xmlns' : 'xmlns:' + prefix, uri);
      return new NamespaceImpl(prefix, uri);
    };
  }
  function XmlStreaming() {
  }
  protoOf(XmlStreaming).pkf = function (input) {
    var str = toString(charSequenceGet(input, 0) === _Char___init__impl__6a9atx(65279) ? charSequenceSubSequence(input, 1, charSequenceLength(input)) : input);
    var tmp = (new DOMParser()).parseFromString(str, 'text/xml');
    return new DomReader(!(tmp == null) ? tmp : THROW_CCE());
  };
  protoOf(XmlStreaming).qkf = function (writer, repairNamespaces, xmlDeclMode) {
    return new WriterXmlWriter(writer, DomWriter_init_$Create$(xmlDeclMode));
  };
  var XmlStreaming_instance;
  function XmlStreaming_getInstance() {
    return XmlStreaming_instance;
  }
  function WriterXmlWriter(target, delegate) {
    this.rkf_1 = target;
    this.skf_1 = delegate;
  }
  protoOf(WriterXmlWriter).jk6 = function () {
    return this.skf_1.ik7_1;
  };
  protoOf(WriterXmlWriter).lk8 = function (_set____db54di) {
    this.skf_1.lk8(_set____db54di);
  };
  protoOf(WriterXmlWriter).mk8 = function () {
    return this.skf_1.mk8();
  };
  protoOf(WriterXmlWriter).qk6 = function () {
    return this.skf_1.hk7_1;
  };
  protoOf(WriterXmlWriter).ek8 = function (namespace, name, prefix, value) {
    this.skf_1.ek8(namespace, name, prefix, value);
  };
  protoOf(WriterXmlWriter).ck8 = function (text) {
    this.skf_1.ck8(text);
  };
  protoOf(WriterXmlWriter).uk7 = function (text) {
    this.skf_1.uk7(text);
  };
  protoOf(WriterXmlWriter).xk7 = function (text) {
    this.skf_1.xk7(text);
  };
  protoOf(WriterXmlWriter).hk8 = function () {
    this.skf_1.hk8();
  };
  protoOf(WriterXmlWriter).ik8 = function (namespace, localName, prefix) {
    this.skf_1.ik8(namespace, localName, prefix);
  };
  protoOf(WriterXmlWriter).dk8 = function (text) {
    this.skf_1.dk8(text);
  };
  protoOf(WriterXmlWriter).jk8 = function (prefix) {
    return this.skf_1.jk8(prefix);
  };
  protoOf(WriterXmlWriter).kk8 = function (namespaceUri) {
    return this.skf_1.kk8(namespaceUri);
  };
  protoOf(WriterXmlWriter).mk7 = function (text) {
    this.skf_1.mk7(text);
  };
  protoOf(WriterXmlWriter).zk7 = function (namespacePrefix, namespaceUri) {
    this.skf_1.zk7(namespacePrefix, namespaceUri);
  };
  protoOf(WriterXmlWriter).nk8 = function (namespace) {
    this.skf_1.nk8(namespace);
  };
  protoOf(WriterXmlWriter).vk7 = function (text) {
    this.skf_1.vk7(text);
  };
  protoOf(WriterXmlWriter).wk7 = function (target, data) {
    this.skf_1.wk7(target, data);
  };
  protoOf(WriterXmlWriter).fk8 = function (version, encoding, standalone) {
    this.skf_1.fk8(version, encoding, standalone);
  };
  protoOf(WriterXmlWriter).ak8 = function (namespace, localName, prefix) {
    this.skf_1.ak8(namespace, localName, prefix);
  };
  protoOf(WriterXmlWriter).bk8 = function (text) {
    this.skf_1.bk8(text);
  };
  protoOf(WriterXmlWriter).n = function () {
    try {
      var xmls = new XMLSerializer();
      var tmp = this.skf_1.yk7();
      var domText = xmls.serializeToString(tmp instanceof Node ? tmp : THROW_CCE());
      var xmlDeclMode = this.skf_1.ck7_1;
      if (!xmlDeclMode.equals(XmlDeclMode_None_getInstance())) {
        var tmp_0;
        if (xmlDeclMode.za_1 === 3) {
          var tmp1_elvis_lhs = this.skf_1.kk7_1;
          tmp_0 = tmp1_elvis_lhs == null ? 'UTF-8' : tmp1_elvis_lhs;
        } else {
          var tmp2_safe_receiver = this.skf_1.kk7_1;
          var tmp_1;
          if (tmp2_safe_receiver == null) {
            tmp_1 = null;
          } else {
            // Inline function 'kotlin.text.lowercase' call
            // Inline function 'kotlin.js.asDynamic' call
            tmp_1 = tmp2_safe_receiver.toLowerCase();
          }
          var tmp3_safe_receiver = tmp_1;
          tmp_0 = (tmp3_safe_receiver == null ? null : startsWith(tmp3_safe_receiver, 'utf-')) === false ? this.skf_1.kk7_1 : null;
        }
        var encoding = tmp_0;
        var tmp5_elvis_lhs = this.skf_1.jk7_1;
        var xmlVersion = tmp5_elvis_lhs == null ? '1.0' : tmp5_elvis_lhs;
        this.rkf_1.e4z('<?xml version="');
        this.rkf_1.e4z(xmlVersion);
        this.rkf_1.e4z('"');
        if (!(encoding == null)) {
          this.rkf_1.e4z(' encoding="');
          this.rkf_1.e4z(encoding);
          this.rkf_1.e4z('"');
        }
        this.rkf_1.e4z('?>');
        // Inline function 'kotlin.collections.isNotEmpty' call
        if (!this.skf_1.zk6_1.c1()) {
          this.rkf_1.e4z('\n');
        }
      }
      this.rkf_1.e4z(domText);
    }finally {
      this.skf_1.n();
    }
  };
  function NamespaceContextImpl() {
  }
  function IOException_init_$Init$($this) {
    Exception_init_$Init$($this);
    IOException.call($this);
    return $this;
  }
  function IOException_init_$Create$() {
    var tmp = IOException_init_$Init$(objectCreate(protoOf(IOException)));
    captureStack(tmp, IOException_init_$Create$);
    return tmp;
  }
  function IOException_init_$Init$_0(message, $this) {
    Exception_init_$Init$_0(message, $this);
    IOException.call($this);
    return $this;
  }
  function IOException_init_$Init$_1(message, cause, $this) {
    Exception_init_$Init$_1(message, cause, $this);
    IOException.call($this);
    return $this;
  }
  function IOException() {
    captureStack(this, IOException);
  }
  function StringWriter() {
    Writer.call(this);
    this.tkf_1 = StringBuilder_init_$Create$();
  }
  protoOf(StringWriter).e4z = function (text) {
    this.tkf_1.y5(text);
  };
  protoOf(StringWriter).toString = function () {
    return this.tkf_1.toString();
  };
  protoOf(StringWriter).z5 = function (value) {
    // Inline function 'kotlin.apply' call
    // Inline function 'kotlin.contracts.contract' call
    // Inline function 'nl.adaptivity.xmlutil.core.impl.multiplatform.StringWriter.append.<anonymous>' call
    this.tkf_1.z5(value);
    return this;
  };
  protoOf(StringWriter).r8 = function (value) {
    // Inline function 'kotlin.apply' call
    // Inline function 'kotlin.contracts.contract' call
    // Inline function 'nl.adaptivity.xmlutil.core.impl.multiplatform.StringWriter.append.<anonymous>' call
    this.tkf_1.r8(value);
    return this;
  };
  function assert(value, lazyMessage) {
    if (!value) {
      console.error('Assertion failed: ' + lazyMessage());
    }
  }
  function assert_0(value) {
    if (!value) {
      console.error('Assertion failed');
    }
  }
  function get_name_0(_this__u8e3s4) {
    return get_js(_this__u8e3s4).name;
  }
  function Writer() {
  }
  function Factory() {
  }
  function CompactFragment_init_$Init$(content, $this) {
    CompactFragment_init_$Init$_0(emptyList(), content, $this);
    return $this;
  }
  function CompactFragment_init_$Create$(content) {
    return CompactFragment_init_$Init$(content, objectCreate(protoOf(CompactFragment)));
  }
  function CompactFragment_init_$Init$_0(namespaces, content, $this) {
    CompactFragment.call($this);
    $this.ukf_1 = Companion_getInstance_1().qka(namespaces);
    $this.vkf_1 = content;
    return $this;
  }
  function CompactFragment_init_$Create$_0(namespaces, content) {
    return CompactFragment_init_$Init$_0(namespaces, content, objectCreate(protoOf(CompactFragment)));
  }
  function CompactFragment_init_$Init$_1(orig, $this) {
    CompactFragment.call($this);
    $this.ukf_1 = Companion_getInstance_1().qka(orig.mkf());
    $this.vkf_1 = orig.nkf();
    return $this;
  }
  function CompactFragment_init_$Create$_1(orig) {
    return CompactFragment_init_$Init$_1(orig, objectCreate(protoOf(CompactFragment)));
  }
  function Companion_6() {
    Companion_instance_7 = this;
    this.wkf_1 = new Factory();
  }
  var Companion_instance_7;
  function Companion_getInstance_6() {
    if (Companion_instance_7 == null)
      new Companion_6();
    return Companion_instance_7;
  }
  function CompactFragment$toString$lambda(it) {
    return '"' + it.hk6() + ' -> ' + it.fk6() + '"';
  }
  protoOf(CompactFragment).mkf = function () {
    return this.ukf_1;
  };
  protoOf(CompactFragment).nkf = function () {
    return this.vkf_1;
  };
  protoOf(CompactFragment).okf = function (out) {
    // Inline function 'kotlin.let' call
    // Inline function 'kotlin.contracts.contract' call
    var reader = Companion_instance_8.zkf(this);
    serialize(out, reader);
  };
  protoOf(CompactFragment).akg = function () {
    return Companion_instance_8.zkf(this);
  };
  protoOf(CompactFragment).equals = function (other) {
    if (this === other)
      return true;
    if (other == null ? true : get_prototype(this) != get_prototype(other))
      return false;
    var that = (other == null ? true : isInterface(other, ICompactFragment)) ? other : THROW_CCE();
    if (!equals(this.ukf_1, ensureNotNull(that).mkf()))
      return false;
    return this.vkf_1 === that.nkf();
  };
  protoOf(CompactFragment).hashCode = function () {
    var result = hashCode(this.ukf_1);
    result = imul(31, result) + getStringHashCode(this.vkf_1) | 0;
    return result;
  };
  protoOf(CompactFragment).toString = function () {
    // Inline function 'kotlin.text.buildString' call
    // Inline function 'kotlin.contracts.contract' call
    // Inline function 'kotlin.apply' call
    var this_0 = StringBuilder_init_$Create$();
    // Inline function 'kotlin.contracts.contract' call
    // Inline function 'nl.adaptivity.xmlutil.util.CompactFragment.toString.<anonymous>' call
    this_0.y5('{namespaces=[');
    joinTo(this.ukf_1, this_0, VOID, VOID, VOID, VOID, VOID, CompactFragment$toString$lambda);
    this_0.y5('], content=').y5(this.vkf_1).z5(_Char___init__impl__6a9atx(125));
    return this_0.toString();
  };
  function CompactFragment() {
    Companion_getInstance_6();
  }
  function get_prototype(_this__u8e3s4) {
    // Inline function 'nl.adaptivity.xmlutil.util.<get-prototype>.prototype' call
    return _this__u8e3s4.prototype;
  }
  function FragmentNamespaceContext_init_$Init$(parent, prefixes, namespaces, $this) {
    SimpleNamespaceContext_init_$Init$_1(prefixes, namespaces, $this);
    FragmentNamespaceContext.call($this);
    $this.ckg_1 = parent;
    return $this;
  }
  function FragmentNamespaceContext_init_$Create$(parent, prefixes, namespaces) {
    return FragmentNamespaceContext_init_$Init$(parent, prefixes, namespaces, objectCreate(protoOf(FragmentNamespaceContext)));
  }
  function getLocalNamespaceUri($this, prefix) {
    var inductionVariable = $this.u() - 1 | 0;
    if (0 <= inductionVariable)
      do {
        var i = inductionVariable;
        inductionVariable = inductionVariable + -1 | 0;
        if (prefix === $this.mka(i)) {
          return $this.nka(i);
        }
      }
       while (0 <= inductionVariable);
    return null;
  }
  function getDelegate($this, text, wrapperNamespaceContext) {
    // Inline function 'kotlin.text.buildString' call
    // Inline function 'kotlin.contracts.contract' call
    // Inline function 'kotlin.apply' call
    var this_0 = StringBuilder_init_$Create$();
    // Inline function 'kotlin.contracts.contract' call
    // Inline function 'nl.adaptivity.xmlutil.util.Companion.getDelegate.<anonymous>' call
    this_0.y5('<SDFKLJDSF:wrapper xmlns:SDFKLJDSF="http://wrapperns"');
    var tmp0_iterator = wrapperNamespaceContext.w();
    while (tmp0_iterator.f()) {
      var ns = tmp0_iterator.e();
      var prefix = ns.hk6();
      var uri = ns.fk6();
      if ('' === prefix) {
        this_0.y5(' xmlns');
      } else {
        this_0.y5(' xmlns:').y5(prefix);
      }
      this_0.y5('="').y5(xmlEncode(uri)).z5(_Char___init__impl__6a9atx(34));
    }
    this_0.y5(' >');
    var wrapper = this_0.toString();
    var actualInput = wrapper + text + '<\/SDFKLJDSF:wrapper>';
    var parser = new DOMParser();
    var tmp = parser.parseFromString(actualInput, 'text/xml');
    return new DomReader(!(tmp == null) ? tmp : THROW_CCE());
  }
  protoOf(FragmentNamespaceContext).bk6 = function () {
    return this;
  };
  protoOf(FragmentNamespaceContext).zk5 = function (prefix) {
    var namespaceURI = protoOf(SimpleNamespaceContext).zk5.call(this, prefix);
    var tmp0_safe_receiver = this.ckg_1;
    if (tmp0_safe_receiver == null)
      null;
    else {
      // Inline function 'kotlin.let' call
      // Inline function 'kotlin.contracts.contract' call
      return tmp0_safe_receiver.zk5(prefix);
    }
    return namespaceURI;
  };
  protoOf(FragmentNamespaceContext).ak6 = function (namespaceURI) {
    var prefix = protoOf(SimpleNamespaceContext).ak6.call(this, namespaceURI);
    if (prefix == null ? !(this.ckg_1 == null) : false) {
      return this.ckg_1.ak6(namespaceURI);
    }
    return prefix;
  };
  protoOf(FragmentNamespaceContext).ek6 = function (namespaceURI) {
    if (this.ckg_1 == null) {
      return protoOf(SimpleNamespaceContext).ek6.call(this, namespaceURI);
    }
    var prefixes = HashSet_init_$Create$();
    // Inline function 'kotlin.run' call
    // Inline function 'kotlin.contracts.contract' call
    var it = protoOf(SimpleNamespaceContext).ek6.call(this, namespaceURI);
    while (it.f()) {
      prefixes.i1(it.e());
    }
    var it_0 = this.ckg_1.ek6(namespaceURI);
    while (it_0.f()) {
      var prefix = it_0.e();
      var localNamespaceUri = getLocalNamespaceUri(this, prefix);
      if (localNamespaceUri == null) {
        prefixes.i1(prefix);
      }
    }
    return prefixes.w();
  };
  function FragmentNamespaceContext() {
  }
  function extendNamespace($this) {
    var namespaceDecls = $this.fx().rk6();
    var nscount = namespaceDecls.u();
    var tmp = 0;
    // Inline function 'kotlin.arrayOfNulls' call
    var tmp_0 = fillArrayVal(Array(nscount), null);
    while (tmp < nscount) {
      var tmp_1 = tmp;
      tmp_0[tmp_1] = namespaceDecls.v(tmp_1).hk6();
      tmp = tmp + 1 | 0;
    }
    var prefixes = tmp_0;
    var tmp_2 = 0;
    // Inline function 'kotlin.arrayOfNulls' call
    var tmp_3 = fillArrayVal(Array(nscount), null);
    while (tmp_2 < nscount) {
      var tmp_4 = tmp_2;
      tmp_3[tmp_4] = namespaceDecls.v(tmp_4).fk6();
      tmp_2 = tmp_2 + 1 | 0;
    }
    var namespaces = tmp_3;
    $this.ekg_1 = FragmentNamespaceContext_init_$Create$($this.ekg_1, prefixes, namespaces);
  }
  function Companion_7() {
    this.xkf_1 = 'SDFKLJDSF';
    this.ykf_1 = 'http://wrapperns';
  }
  protoOf(Companion_7).zkf = function (fragment) {
    return new XMLFragmentStreamReader(fragment.nkf(), fragment.mkf());
  };
  var Companion_instance_8;
  function Companion_getInstance_7() {
    return Companion_instance_8;
  }
  function XMLFragmentStreamReader(text, wrapperNamespaceContext) {
    XmlDelegatingReader.call(this, getDelegate(Companion_instance_8, text, wrapperNamespaceContext));
    var tmp = this;
    // Inline function 'kotlin.emptyArray' call
    var tmp_0 = [];
    // Inline function 'kotlin.emptyArray' call
    var tmp$ret$1 = [];
    tmp.ekg_1 = FragmentNamespaceContext_init_$Create$(null, tmp_0, tmp$ret$1);
    if (this.fx().ok6() === EventType_START_ELEMENT_getInstance()) {
      extendNamespace(this);
    }
  }
  protoOf(XMLFragmentStreamReader).e = function () {
    var result = this.fx().e();
    switch (result.za_1) {
      case 7:
        return result;
      case 0:
      case 11:
      case 6:
        return this.e();
      case 1:
        if ('http://wrapperns' === this.fx().fk6())
          return this.e();
        extendNamespace(this);
        break;
      case 2:
        if ('http://wrapperns' === this.fx().fk6()) {
          return this.fx().e();
        }

        var tmp = this;
        var tmp1_elvis_lhs = this.ekg_1.ckg_1;
        tmp.ekg_1 = tmp1_elvis_lhs == null ? this.ekg_1 : tmp1_elvis_lhs;
        break;
      default:
        break;
    }
    return result;
  };
  protoOf(XMLFragmentStreamReader).qk6 = function () {
    return this.ekg_1;
  };
  function createDocument(rootElementName) {
    var tmp = document.implementation;
    var tmp0_elvis_lhs = rootElementName.eka();
    var tmp_0 = tmp.createDocument(tmp0_elvis_lhs == null ? '' : tmp0_elvis_lhs, toCName(rootElementName));
    return !(tmp_0 == null) ? tmp_0 : THROW_CCE();
  }
  //region block: post-declaration
  protoOf(DomReader$namespaceContext$1).dk6 = plus_0;
  protoOf(DomReader$namespaceContext$1).ek6 = getPrefixes;
  protoOf(DomReader).dc = get_name;
  protoOf(DomReader).yk6 = require_0;
  protoOf(DomWriter$namespaceContext$1).ek6 = getPrefixes;
  protoOf(PlatformXmlWriterBase).nk8 = namespaceAttr;
  protoOf(PlatformXmlWriterBase).wk7 = processingInstruction;
  protoOf(PlatformXmlWriterBase).gk8 = startDocument$default;
  protoOf(SimpleNamespaceContext).ek6 = getPrefixes;
  protoOf(XmlBufferedReaderBase).dc = get_name;
  protoOf(XmlBufferedReaderBase).yk6 = require_0;
  protoOf(XmlBufferedReaderBase).zkb = require_1;
  protoOf(XmlBufferedReaderBase).akc = getAttributeName;
  protoOf(XmlBufferedReaderBase).ykb = getAttributeValue;
  protoOf(XmlBufferedReaderBase).bkc = isWhitespace;
  protoOf(NamespaceHolder$namespaceContext$1).dk6 = plus_0;
  protoOf(NamespaceHolder$namespaceContext$1).ek6 = getPrefixes;
  protoOf(WriterXmlWriter).gk8 = startDocument$default;
  //endregion
  //region block: init
  Companion_instance_0 = new Companion();
  XMLConstants_instance = new XMLConstants();
  Companion_instance_3 = new Companion_2();
  Companion_instance_4 = new Companion_3();
  Companion_instance_5 = new Companion_4();
  Companion_instance_6 = new Companion_5();
  NodeConsts_instance = new NodeConsts();
  XmlStreaming_instance = new XmlStreaming();
  Companion_instance_8 = new Companion_7();
  //endregion
  //region block: exports
  _.$_$ = _.$_$ || {};
  _.$_$.a = XmlVersion_XML11_getInstance;
  _.$_$.b = EventType_CDSECT_getInstance;
  _.$_$.c = EventType_END_DOCUMENT_getInstance;
  _.$_$.d = EventType_END_ELEMENT_getInstance;
  _.$_$.e = EventType_IGNORABLE_WHITESPACE_getInstance;
  _.$_$.f = EventType_START_ELEMENT_getInstance;
  _.$_$.g = EventType_TEXT_getInstance;
  _.$_$.h = XmlDeclMode_None_getInstance;
  _.$_$.i = startDocument$default;
  _.$_$.j = CompactFragment_init_$Create$_0;
  _.$_$.k = CompactFragment_init_$Create$_1;
  _.$_$.l = CompactFragment_init_$Create$;
  _.$_$.m = QName_init_$Create$_0;
  _.$_$.n = QName_init_$Create$;
  _.$_$.o = XmlException_init_$Create$_0;
  _.$_$.p = NodeConsts_instance;
  _.$_$.q = Companion_getInstance_0;
  _.$_$.r = QNameSerializer_getInstance;
  _.$_$.s = XMLConstants_instance;
  _.$_$.t = XmlStreaming_instance;
  _.$_$.u = StringWriter;
  _.$_$.v = assert_0;
  _.$_$.w = assert;
  _.$_$.x = get_name_0;
  _.$_$.y = iterator;
  _.$_$.z = iterator_0;
  _.$_$.a1 = createDocument;
  _.$_$.b1 = CompactFragment;
  _.$_$.c1 = ICompactFragment;
  _.$_$.d1 = DomWriter;
  _.$_$.e1 = getPrefixes;
  _.$_$.f1 = NamespaceContextImpl;
  _.$_$.g1 = QName;
  _.$_$.h1 = XmlBufferedReader;
  _.$_$.i1 = EndElementEvent;
  _.$_$.j1 = NamespaceImpl;
  _.$_$.k1 = namespaceAttr;
  _.$_$.l1 = processingInstruction;
  _.$_$.m1 = XmlWriter;
  _.$_$.n1 = allConsecutiveTextContent;
  _.$_$.o1 = allText;
  _.$_$.p1 = elementContentToFragment;
  _.$_$.q1 = elementToFragment;
  _.$_$.r1 = endTag;
  _.$_$.s1 = isEquivalent;
  _.$_$.t1 = readSimpleElement;
  _.$_$.u1 = siblingsToFragment;
  _.$_$.v1 = skipPreamble;
  _.$_$.w1 = smartStartTag_0;
  _.$_$.x1 = smartStartTag;
  _.$_$.y1 = toCName;
  _.$_$.z1 = toNamespace;
  _.$_$.a2 = toQname;
  _.$_$.b2 = writeAttribute;
  _.$_$.c2 = writeElement;
  _.$_$.d2 = xmlCollapseWhitespace;
  //endregion
  return _;
}(module.exports, require('./kotlin-kotlin-stdlib.js'), require('./kotlinx-serialization-kotlinx-serialization-core.js')));

//# sourceMappingURL=xmlutil-core.js.map
