@earth-app/shovel
Version:
Kotlin Multiplatform Web Scraping Framework
1,309 lines (1,270 loc) • 84.2 kB
JavaScript
(function (factory) {
if (typeof define === 'function' && define.amd)
define(['exports', './kotlin-kotlin-stdlib.js', './ktor-ktor-http.js', './kotlinx-coroutines-core.js', './ktor-ktor-io.js', './kotlinx-io-kotlinx-io-bytestring.js', './kotlinx-io-kotlinx-io-core.js'], factory);
else if (typeof exports === 'object')
factory(module.exports, require('./kotlin-kotlin-stdlib.js'), require('./ktor-ktor-http.js'), require('./kotlinx-coroutines-core.js'), require('./ktor-ktor-io.js'), require('./kotlinx-io-kotlinx-io-bytestring.js'), require('./kotlinx-io-kotlinx-io-core.js'));
else {
if (typeof globalThis['kotlin-kotlin-stdlib'] === 'undefined') {
throw new Error("Error loading module 'ktor-ktor-http-cio'. Its dependency 'kotlin-kotlin-stdlib' was not found. Please, check whether 'kotlin-kotlin-stdlib' is loaded prior to 'ktor-ktor-http-cio'.");
}
if (typeof globalThis['ktor-ktor-http'] === 'undefined') {
throw new Error("Error loading module 'ktor-ktor-http-cio'. Its dependency 'ktor-ktor-http' was not found. Please, check whether 'ktor-ktor-http' is loaded prior to 'ktor-ktor-http-cio'.");
}
if (typeof globalThis['kotlinx-coroutines-core'] === 'undefined') {
throw new Error("Error loading module 'ktor-ktor-http-cio'. Its dependency 'kotlinx-coroutines-core' was not found. Please, check whether 'kotlinx-coroutines-core' is loaded prior to 'ktor-ktor-http-cio'.");
}
if (typeof globalThis['ktor-ktor-io'] === 'undefined') {
throw new Error("Error loading module 'ktor-ktor-http-cio'. Its dependency 'ktor-ktor-io' was not found. Please, check whether 'ktor-ktor-io' is loaded prior to 'ktor-ktor-http-cio'.");
}
if (typeof globalThis['kotlinx-io-kotlinx-io-bytestring'] === 'undefined') {
throw new Error("Error loading module 'ktor-ktor-http-cio'. Its dependency 'kotlinx-io-kotlinx-io-bytestring' was not found. Please, check whether 'kotlinx-io-kotlinx-io-bytestring' is loaded prior to 'ktor-ktor-http-cio'.");
}
if (typeof globalThis['kotlinx-io-kotlinx-io-core'] === 'undefined') {
throw new Error("Error loading module 'ktor-ktor-http-cio'. Its dependency 'kotlinx-io-kotlinx-io-core' was not found. Please, check whether 'kotlinx-io-kotlinx-io-core' is loaded prior to 'ktor-ktor-http-cio'.");
}
globalThis['ktor-ktor-http-cio'] = factory(typeof globalThis['ktor-ktor-http-cio'] === 'undefined' ? {} : globalThis['ktor-ktor-http-cio'], globalThis['kotlin-kotlin-stdlib'], globalThis['ktor-ktor-http'], globalThis['kotlinx-coroutines-core'], globalThis['ktor-ktor-io'], globalThis['kotlinx-io-kotlinx-io-bytestring'], globalThis['kotlinx-io-kotlinx-io-core']);
}
}(function (_, kotlin_kotlin, kotlin_io_ktor_ktor_http, kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core, kotlin_io_ktor_ktor_io, kotlin_org_jetbrains_kotlinx_kotlinx_io_bytestring, kotlin_org_jetbrains_kotlinx_kotlinx_io_core) {
'use strict';
//region block: imports
var imul = Math.imul;
var Long = kotlin_kotlin.$_$.wb;
var VOID = kotlin_kotlin.$_$.b;
var protoOf = kotlin_kotlin.$_$.j8;
var MultiPartData = kotlin_io_ktor_ktor_http.$_$.k;
var CoroutineScope = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.t;
var initMetadataForClass = kotlin_kotlin.$_$.t7;
var Unit_instance = kotlin_kotlin.$_$.v2;
var toString = kotlin_kotlin.$_$.m8;
var IllegalArgumentException_init_$Create$ = kotlin_kotlin.$_$.i1;
var abs = kotlin_kotlin.$_$.n8;
var StringBuilder_init_$Create$ = kotlin_kotlin.$_$.x;
var CoroutineImpl = kotlin_kotlin.$_$.h6;
var THROW_CCE = kotlin_kotlin.$_$.bc;
var SequenceScope = kotlin_kotlin.$_$.b9;
var get_COROUTINE_SUSPENDED = kotlin_kotlin.$_$.r5;
var initMetadataForLambda = kotlin_kotlin.$_$.y7;
var ArrayList_init_$Create$ = kotlin_kotlin.$_$.j;
var sequence = kotlin_kotlin.$_$.g9;
var DefaultPool = kotlin_io_ktor_ktor_io.$_$.a1;
var fill = kotlin_kotlin.$_$.c4;
var isIntArray = kotlin_kotlin.$_$.c8;
var _Char___init__impl__6a9atx = kotlin_kotlin.$_$.b2;
var endsWith = kotlin_kotlin.$_$.r9;
var charSequenceLength = kotlin_kotlin.$_$.i7;
var charSequenceGet = kotlin_kotlin.$_$.h7;
var Char = kotlin_kotlin.$_$.nb;
var Char__compareTo_impl_ypi4mb = kotlin_kotlin.$_$.c2;
var contains = kotlin_kotlin.$_$.n9;
var charSequenceSubSequence = kotlin_kotlin.$_$.j7;
var Char__toInt_impl_vasixd = kotlin_kotlin.$_$.h2;
var IllegalStateException = kotlin_kotlin.$_$.ub;
var IllegalStateException_init_$Init$ = kotlin_kotlin.$_$.k1;
var captureStack = kotlin_kotlin.$_$.d7;
var readUTF8LineTo = kotlin_io_ktor_ktor_io.$_$.e;
var IllegalStateException_init_$Create$ = kotlin_kotlin.$_$.l1;
var HttpHeaders_getInstance = kotlin_io_ktor_ktor_http.$_$.g;
var initMetadataForCoroutine = kotlin_kotlin.$_$.v7;
var setOf = kotlin_kotlin.$_$.y4;
var Companion_getInstance = kotlin_io_ktor_ktor_io.$_$.m;
var LineEndingMode__plus_impl_ttpz2j = kotlin_io_ktor_ktor_io.$_$.j;
var listOf = kotlin_kotlin.$_$.o4;
var MultiPart_getInstance = kotlin_io_ktor_ktor_http.$_$.d;
var ByteString_init_$Create$ = kotlin_org_jetbrains_kotlinx_kotlinx_io_bytestring.$_$.a;
var IOException_init_$Create$ = kotlin_org_jetbrains_kotlinx_kotlinx_io_core.$_$.c;
var toString_0 = kotlin_kotlin.$_$.gb;
var toByte = kotlin_kotlin.$_$.k8;
var copyOfRange = kotlin_kotlin.$_$.v3;
var produce = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.j;
var startsWith = kotlin_kotlin.$_$.ta;
var readUntil = kotlin_io_ktor_ktor_io.$_$.f;
var WriterScope = kotlin_io_ktor_ktor_io.$_$.f1;
var ProducerScope = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.h;
var isInterface = kotlin_kotlin.$_$.d8;
var counted = kotlin_io_ktor_ktor_io.$_$.i1;
var writer = kotlin_io_ktor_ktor_io.$_$.m1;
var readRemaining = kotlin_io_ktor_ktor_io.$_$.d;
var get_remaining = kotlin_io_ktor_ktor_io.$_$.u;
var compare = kotlin_kotlin.$_$.o6;
var skipIfFound = kotlin_io_ktor_ktor_io.$_$.g;
var ByteChannel = kotlin_io_ktor_ktor_io.$_$.c1;
var CompletableDeferred = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.o;
var CancellationException_init_$Create$ = kotlin_kotlin.$_$.q;
var close = kotlin_io_ktor_ktor_io.$_$.h1;
var subtract = kotlin_kotlin.$_$.y6;
var convertToInt = kotlin_kotlin.$_$.p6;
var readPacket = kotlin_io_ktor_ktor_io.$_$.c;
var EOFException_init_$Create$ = kotlin_org_jetbrains_kotlinx_kotlinx_io_core.$_$.a;
var copyTo = kotlin_io_ktor_ktor_io.$_$.a;
var add = kotlin_kotlin.$_$.m6;
var fromInt = kotlin_kotlin.$_$.s6;
var toByteArray = kotlin_io_ktor_ktor_io.$_$.w;
var ByteString = kotlin_org_jetbrains_kotlinx_kotlinx_io_bytestring.$_$.c;
var LinkedHashMap_init_$Create$ = kotlin_kotlin.$_$.o;
var compareTo = kotlin_kotlin.$_$.k7;
var NoSuchElementException_init_$Create$ = kotlin_kotlin.$_$.s1;
var Collection = kotlin_kotlin.$_$.x2;
var emptyList = kotlin_kotlin.$_$.z3;
var initMetadataForCompanion = kotlin_kotlin.$_$.u7;
var ensureNotNull = kotlin_kotlin.$_$.ic;
var StringBuilder_init_$Create$_0 = kotlin_kotlin.$_$.w;
var isCharSequence = kotlin_kotlin.$_$.b8;
var getStringHashCode = kotlin_kotlin.$_$.r7;
var CharSequence = kotlin_kotlin.$_$.mb;
var IndexOutOfBoundsException_init_$Create$ = kotlin_kotlin.$_$.p1;
var NoPoolImpl = kotlin_io_ktor_ktor_io.$_$.b1;
var charArray = kotlin_kotlin.$_$.f7;
var shiftLeft = kotlin_kotlin.$_$.w6;
var NumberFormatException_init_$Create$ = kotlin_kotlin.$_$.t1;
var toString_1 = kotlin_kotlin.$_$.i2;
var charCodeAt = kotlin_kotlin.$_$.g7;
var Companion_getInstance_0 = kotlin_io_ktor_ktor_http.$_$.h;
var numberRangeToNumber = kotlin_kotlin.$_$.g8;
var collectionSizeOrDefault = kotlin_kotlin.$_$.p3;
var ArrayList_init_$Create$_0 = kotlin_kotlin.$_$.i;
var numberToLong = kotlin_kotlin.$_$.v6;
var toLongArray = kotlin_kotlin.$_$.i5;
var Char__plus_impl_qi7pgj = kotlin_kotlin.$_$.f2;
var Char__minus_impl_a2frrh = kotlin_kotlin.$_$.e2;
var toByteArray_0 = kotlin_kotlin.$_$.d5;
var IOException = kotlin_org_jetbrains_kotlinx_kotlinx_io_core.$_$.g;
var IOException_init_$Init$ = kotlin_org_jetbrains_kotlinx_kotlinx_io_core.$_$.b;
var isWhitespace = kotlin_kotlin.$_$.fa;
//endregion
//region block: pre-declaration
initMetadataForClass(CIOMultipartDataBase, 'CIOMultipartDataBase', VOID, VOID, [MultiPartData, CoroutineScope], [0, 1]);
initMetadataForClass(HttpHeadersMap, 'HttpHeadersMap');
initMetadataForLambda(HeadersData$headersStarts$slambda, CoroutineImpl, VOID, [1]);
initMetadataForClass(HeadersData, 'HeadersData', HeadersData);
initMetadataForClass(IntArrayPool$1, VOID, VOID, DefaultPool);
initMetadataForClass(HeadersDataPool$1, VOID, VOID, DefaultPool);
initMetadataForClass(ParserException, 'ParserException', VOID, IllegalStateException);
initMetadataForCoroutine($parseHeadersCOROUTINE$, CoroutineImpl);
initMetadataForClass(MultipartEvent, 'MultipartEvent');
initMetadataForClass(Preamble, 'Preamble', VOID, MultipartEvent);
initMetadataForClass(MultipartPart, 'MultipartPart', VOID, MultipartEvent);
initMetadataForClass(Epilogue, 'Epilogue', VOID, MultipartEvent);
initMetadataForLambda(parseMultipart$slambda$slambda, CoroutineImpl, VOID, [1]);
initMetadataForLambda(parseMultipart$slambda, CoroutineImpl, VOID, [1]);
initMetadataForCoroutine($parsePartHeadersImplCOROUTINE$, CoroutineImpl);
initMetadataForCoroutine($parsePartBodyImplCOROUTINE$, CoroutineImpl);
initMetadataForCoroutine($skipIfFoundReadCountCOROUTINE$, CoroutineImpl);
initMetadataForClass(Node, 'Node');
initMetadataForCompanion(Companion);
initMetadataForClass(AsciiCharTree, 'AsciiCharTree');
initMetadataForClass(SubSequenceImpl, 'SubSequenceImpl', VOID, VOID, [CharSequence]);
initMetadataForClass(CharArrayBuilder, 'CharArrayBuilder', CharArrayBuilder, VOID, [CharSequence]);
initMetadataForClass(CharArrayPool$1, VOID, VOID, NoPoolImpl);
initMetadataForClass(CharArrayPool$2, VOID, VOID, DefaultPool);
initMetadataForClass(UnsupportedMediaTypeExceptionCIO, 'UnsupportedMediaTypeExceptionCIO', VOID, IOException);
initMetadataForClass(MutableRange, 'MutableRange');
//endregion
function CIOMultipartDataBase(coroutineContext, channel, contentType, contentLength, formFieldLimit) {
formFieldLimit = formFieldLimit === VOID ? new Long(65536, 0) : formFieldLimit;
this.l26_1 = coroutineContext;
this.m26_1 = null;
this.n26_1 = parseMultipart(this, channel, contentType, contentLength, formFieldLimit);
}
protoOf(CIOMultipartDataBase).vl = function () {
return this.l26_1;
};
function get_IntArrayPool() {
_init_properties_HttpHeadersMap_kt__hwatby();
return IntArrayPool;
}
var IntArrayPool;
function get_HeadersDataPool() {
_init_properties_HttpHeadersMap_kt__hwatby();
return HeadersDataPool;
}
var HeadersDataPool;
function thresholdReached($this) {
return $this.p26_1 >= $this.q26_1 * 0.75;
}
function resize($this) {
var prevSize = $this.p26_1;
var prevData = $this.r26_1;
$this.p26_1 = 0;
$this.q26_1 = imul($this.q26_1, 2) | 128;
var tmp = $this;
// Inline function 'kotlin.apply' call
var this_0 = get_HeadersDataPool().x1j();
this_0.u26(imul(prevData.t26(), 2) | 1);
tmp.r26_1 = this_0;
var _iterator__ex2g4s = prevData.v26().q();
while (_iterator__ex2g4s.r()) {
var headerOffset = _iterator__ex2g4s.s();
$this.x26(prevData.w26(headerOffset + 1 | 0), prevData.w26(headerOffset + 2 | 0), prevData.w26(headerOffset + 3 | 0), prevData.w26(headerOffset + 4 | 0));
}
get_HeadersDataPool().y1j(prevData);
// Inline function 'kotlin.require' call
// Inline function 'kotlin.require' call
if (!(prevSize === $this.p26_1)) {
var message = 'Failed requirement.';
throw IllegalArgumentException_init_$Create$(toString(message));
}
}
function headerHasName($this, name, headerOffset) {
var nameStartIndex = $this.r26_1.w26(headerOffset + 1 | 0);
var nameEndIndex = $this.r26_1.w26(headerOffset + 2 | 0);
return equalsLowerCase($this.o26_1, nameStartIndex, nameEndIndex, name);
}
function HttpHeadersMap(builder) {
this.o26_1 = builder;
this.p26_1 = 0;
this.q26_1 = 0;
this.r26_1 = get_HeadersDataPool().x1j();
}
protoOf(HttpHeadersMap).dd = function (name) {
if (this.p26_1 === 0)
return null;
// Inline function 'kotlin.math.absoluteValue' call
var this_0 = hashCodeLowerCase(name);
var hash = abs(this_0);
var headerIndex = hash % this.q26_1 | 0;
while (!(this.r26_1.w26(imul(headerIndex, 6) + 0 | 0) === -1)) {
if (headerHasName(this, name, imul(headerIndex, 6))) {
return this.y26(imul(headerIndex, 6));
}
headerIndex = (headerIndex + 1 | 0) % this.q26_1 | 0;
}
return null;
};
protoOf(HttpHeadersMap).z26 = function () {
return this.r26_1.v26();
};
protoOf(HttpHeadersMap).x26 = function (nameStartIndex, nameEndIndex, valueStartIndex, valueEndIndex) {
if (thresholdReached(this)) {
resize(this);
}
// Inline function 'kotlin.math.absoluteValue' call
var this_0 = hashCodeLowerCase(this.o26_1, nameStartIndex, nameEndIndex);
var hash = abs(this_0);
var name = this.o26_1.c(nameStartIndex, nameEndIndex);
var headerIndex = hash % this.q26_1 | 0;
var sameNameHeaderIndex = -1;
while (!(this.r26_1.w26(imul(headerIndex, 6) + 0 | 0) === -1)) {
if (headerHasName(this, name, imul(headerIndex, 6))) {
sameNameHeaderIndex = headerIndex;
}
headerIndex = (headerIndex + 1 | 0) % this.q26_1 | 0;
}
var headerOffset = imul(headerIndex, 6);
this.r26_1.h27(headerOffset + 0 | 0, hash);
this.r26_1.h27(headerOffset + 1 | 0, nameStartIndex);
this.r26_1.h27(headerOffset + 2 | 0, nameEndIndex);
this.r26_1.h27(headerOffset + 3 | 0, valueStartIndex);
this.r26_1.h27(headerOffset + 4 | 0, valueEndIndex);
this.r26_1.h27(headerOffset + 5 | 0, -1);
if (!(sameNameHeaderIndex === -1)) {
this.r26_1.h27(imul(sameNameHeaderIndex, 6) + 5 | 0, headerIndex);
}
this.p26_1 = this.p26_1 + 1 | 0;
};
protoOf(HttpHeadersMap).i27 = function (headerOffset) {
var nameStartIndex = this.r26_1.w26(headerOffset + 1 | 0);
var nameEndIndex = this.r26_1.w26(headerOffset + 2 | 0);
return this.o26_1.c(nameStartIndex, nameEndIndex);
};
protoOf(HttpHeadersMap).y26 = function (headerOffset) {
var valueStartIndex = this.r26_1.w26(headerOffset + 3 | 0);
var valueEndIndex = this.r26_1.w26(headerOffset + 4 | 0);
return this.o26_1.c(valueStartIndex, valueEndIndex);
};
protoOf(HttpHeadersMap).j27 = function () {
this.p26_1 = 0;
this.q26_1 = 0;
get_HeadersDataPool().y1j(this.r26_1);
this.r26_1 = get_HeadersDataPool().x1j();
};
protoOf(HttpHeadersMap).toString = function () {
// Inline function 'kotlin.text.buildString' call
// Inline function 'kotlin.apply' call
var this_0 = StringBuilder_init_$Create$();
dumpTo(this, '', this_0);
return this_0.toString();
};
function HeadersData$headersStarts$slambda(this$0, resultContinuation) {
this.s27_1 = this$0;
CoroutineImpl.call(this, resultContinuation);
}
protoOf(HeadersData$headersStarts$slambda).y27 = function ($this$sequence, $completion) {
var tmp = this.z27($this$sequence, $completion);
tmp.j8_1 = Unit_instance;
tmp.k8_1 = null;
return tmp.p8();
};
protoOf(HeadersData$headersStarts$slambda).b9 = function (p1, $completion) {
return this.y27(p1 instanceof SequenceScope ? p1 : THROW_CCE(), $completion);
};
protoOf(HeadersData$headersStarts$slambda).p8 = function () {
var suspendResult = this.j8_1;
$sm: do
try {
var tmp = this.h8_1;
switch (tmp) {
case 0:
this.i8_1 = 7;
this.u27_1 = 0;
this.x27_1 = this.s27_1.s26_1.q();
this.h8_1 = 1;
continue $sm;
case 1:
if (!this.x27_1.r()) {
this.h8_1 = 6;
continue $sm;
}
this.w27_1 = this.x27_1.s();
this.v27_1 = 0;
this.h8_1 = 2;
continue $sm;
case 2:
if (!(this.v27_1 < this.w27_1.length)) {
this.h8_1 = 5;
continue $sm;
}
if (!(this.s27_1.w26(this.u27_1 + 0 | 0) === -1)) {
this.h8_1 = 3;
suspendResult = this.t27_1.rf(this.u27_1, this);
if (suspendResult === get_COROUTINE_SUSPENDED()) {
return suspendResult;
}
continue $sm;
} else {
this.h8_1 = 4;
continue $sm;
}
case 3:
this.h8_1 = 4;
continue $sm;
case 4:
this.v27_1 = this.v27_1 + 6 | 0;
this.u27_1 = this.u27_1 + 6 | 0;
this.h8_1 = 2;
continue $sm;
case 5:
this.h8_1 = 1;
continue $sm;
case 6:
return Unit_instance;
case 7:
throw this.k8_1;
}
} catch ($p) {
var e = $p;
if (this.i8_1 === 7) {
throw e;
} else {
this.h8_1 = this.i8_1;
this.k8_1 = e;
}
}
while (true);
};
protoOf(HeadersData$headersStarts$slambda).z27 = function ($this$sequence, completion) {
var i = new HeadersData$headersStarts$slambda(this.s27_1, completion);
i.t27_1 = $this$sequence;
return i;
};
function HeadersData$headersStarts$slambda_0(this$0, resultContinuation) {
var i = new HeadersData$headersStarts$slambda(this$0, resultContinuation);
var l = function ($this$sequence, $completion) {
return i.y27($this$sequence, $completion);
};
l.$arity = 1;
return l;
}
function HeadersData() {
var tmp = this;
// Inline function 'kotlin.collections.mutableListOf' call
tmp.s26_1 = ArrayList_init_$Create$();
}
protoOf(HeadersData).t26 = function () {
return this.s26_1.a1();
};
protoOf(HeadersData).u26 = function (subArraysCount) {
// Inline function 'kotlin.repeat' call
var inductionVariable = 0;
if (inductionVariable < subArraysCount)
do {
var index = inductionVariable;
inductionVariable = inductionVariable + 1 | 0;
this.s26_1.y(get_IntArrayPool().x1j());
}
while (inductionVariable < subArraysCount);
};
protoOf(HeadersData).w26 = function (index) {
return this.s26_1.b1(index / 768 | 0)[index % 768 | 0];
};
protoOf(HeadersData).h27 = function (index, value) {
this.s26_1.b1(index / 768 | 0)[index % 768 | 0] = value;
};
protoOf(HeadersData).v26 = function () {
return sequence(HeadersData$headersStarts$slambda_0(this, null));
};
protoOf(HeadersData).j27 = function () {
var _iterator__ex2g4s = this.s26_1.q();
while (_iterator__ex2g4s.r()) {
var array = _iterator__ex2g4s.s();
get_IntArrayPool().y1j(array);
}
this.s26_1.m2();
};
function dumpTo(_this__u8e3s4, indent, out) {
_init_properties_HttpHeadersMap_kt__hwatby();
var _iterator__ex2g4s = _this__u8e3s4.z26().q();
while (_iterator__ex2g4s.r()) {
var offset = _iterator__ex2g4s.s();
out.z(indent);
out.z(_this__u8e3s4.i27(offset));
out.z(' => ');
out.z(_this__u8e3s4.y26(offset));
out.z('\n');
}
}
function IntArrayPool$1() {
DefaultPool.call(this, 1000);
}
protoOf(IntArrayPool$1).q1j = function () {
var tmp = 0;
var tmp_0 = new Int32Array(768);
while (tmp < 768) {
tmp_0[tmp] = -1;
tmp = tmp + 1 | 0;
}
return tmp_0;
};
protoOf(IntArrayPool$1).d28 = function (instance) {
fill(instance, -1);
return protoOf(DefaultPool).v1j.call(this, instance);
};
protoOf(IntArrayPool$1).v1j = function (instance) {
return this.d28(isIntArray(instance) ? instance : THROW_CCE());
};
function HeadersDataPool$1() {
DefaultPool.call(this, 1000);
}
protoOf(HeadersDataPool$1).q1j = function () {
return new HeadersData();
};
protoOf(HeadersDataPool$1).h28 = function (instance) {
instance.j27();
return protoOf(DefaultPool).v1j.call(this, instance);
};
protoOf(HeadersDataPool$1).v1j = function (instance) {
return this.h28(instance instanceof HeadersData ? instance : THROW_CCE());
};
var properties_initialized_HttpHeadersMap_kt_kotj4w;
function _init_properties_HttpHeadersMap_kt__hwatby() {
if (!properties_initialized_HttpHeadersMap_kt_kotj4w) {
properties_initialized_HttpHeadersMap_kt_kotj4w = true;
IntArrayPool = new IntArrayPool$1();
HeadersDataPool = new HeadersDataPool$1();
}
}
function get_hostForbiddenSymbols() {
_init_properties_HttpParser_kt__gbdom1();
return hostForbiddenSymbols;
}
var hostForbiddenSymbols;
function get_httpLineEndings() {
_init_properties_HttpParser_kt__gbdom1();
return httpLineEndings;
}
var httpLineEndings;
var versions;
function parseHeaders(input, builder, range, $completion) {
range = range === VOID ? new MutableRange(0, 0) : range;
var tmp = new $parseHeadersCOROUTINE$(input, builder, range, $completion);
tmp.j8_1 = Unit_instance;
tmp.k8_1 = null;
return tmp.p8();
}
function parseHeaderName(text, range) {
_init_properties_HttpParser_kt__gbdom1();
var index = range.v28_1;
var end = range.w28_1;
while (index < end) {
var ch = text.b(index);
if (ch === _Char___init__impl__6a9atx(58) && !(index === range.v28_1)) {
range.v28_1 = index + 1 | 0;
return index;
}
if (isDelimiter(ch)) {
parseHeaderNameFailed(text, index, range.v28_1, ch);
}
index = index + 1 | 0;
}
noColonFound(text, range);
}
function parseHeaderValue(text, range) {
_init_properties_HttpParser_kt__gbdom1();
var start = range.v28_1;
var end = range.w28_1;
var index = start;
index = skipSpacesAndHorizontalTabs(text, index, end);
if (index >= end) {
range.v28_1 = end;
return Unit_instance;
}
var valueStart = index;
var valueLastIndex = index;
while (index < end) {
var ch = text.b(index);
if (ch !== _Char___init__impl__6a9atx(9) && ch !== _Char___init__impl__6a9atx(32))
if (ch === _Char___init__impl__6a9atx(13) || ch === _Char___init__impl__6a9atx(10)) {
characterIsNotAllowed(text, ch);
} else
valueLastIndex = index;
index = index + 1 | 0;
}
range.v28_1 = valueStart;
range.w28_1 = valueLastIndex + 1 | 0;
}
function validateHostHeader(host) {
_init_properties_HttpParser_kt__gbdom1();
if (endsWith(host, ':')) {
throw new ParserException("Host header with ':' should contains port: " + toString(host));
}
var tmp$ret$1;
$l$block: {
// Inline function 'kotlin.text.any' call
var inductionVariable = 0;
while (inductionVariable < charSequenceLength(host)) {
var element = charSequenceGet(host, inductionVariable);
inductionVariable = inductionVariable + 1 | 0;
if (get_hostForbiddenSymbols().c2(new Char(element))) {
tmp$ret$1 = true;
break $l$block;
}
}
tmp$ret$1 = false;
}
if (tmp$ret$1) {
throw new ParserException('Host cannot contain any of the following symbols: ' + toString(get_hostForbiddenSymbols()));
}
}
function isDelimiter(ch) {
_init_properties_HttpParser_kt__gbdom1();
return Char__compareTo_impl_ypi4mb(ch, _Char___init__impl__6a9atx(32)) <= 0 || contains('"(),/:;<=>?@[\\]{}', ch);
}
function parseHeaderNameFailed(text, index, start, ch) {
_init_properties_HttpParser_kt__gbdom1();
if (ch === _Char___init__impl__6a9atx(58)) {
throw new ParserException('Empty header names are not allowed as per RFC7230.');
}
if (index === start) {
throw new ParserException('Multiline headers via line folding is not supported since it is deprecated as per RFC7230.');
}
characterIsNotAllowed(text, ch);
}
function noColonFound(text, range) {
_init_properties_HttpParser_kt__gbdom1();
var tmp2 = range.v28_1;
// Inline function 'kotlin.text.substring' call
var endIndex = range.w28_1;
var tmp$ret$0 = toString(charSequenceSubSequence(text, tmp2, endIndex));
throw new ParserException('No colon in HTTP header in ' + tmp$ret$0 + ' in builder: \n' + toString(text));
}
function characterIsNotAllowed(text, ch) {
_init_properties_HttpParser_kt__gbdom1();
// Inline function 'kotlin.code' call
var tmp$ret$0 = Char__toInt_impl_vasixd(ch);
throw new ParserException('Character with code ' + (tmp$ret$0 & 255) + ' is not allowed in header names, \n' + toString(text));
}
function ParserException(message) {
IllegalStateException_init_$Init$(message, this);
captureStack(this, ParserException);
}
function $parseHeadersCOROUTINE$(input, builder, range, resultContinuation) {
CoroutineImpl.call(this, resultContinuation);
this.q28_1 = input;
this.r28_1 = builder;
this.s28_1 = range;
}
protoOf($parseHeadersCOROUTINE$).p8 = function () {
var suspendResult = this.j8_1;
$sm: do
try {
var tmp = this.h8_1;
switch (tmp) {
case 0:
this.i8_1 = 7;
this.t28_1 = new HttpHeadersMap(this.r28_1);
this.i8_1 = 6;
this.h8_1 = 1;
continue $sm;
case 1:
if (!true) {
this.h8_1 = 5;
continue $sm;
}
this.h8_1 = 2;
suspendResult = readUTF8LineTo(this.q28_1, this.r28_1, 8192, get_httpLineEndings(), this);
if (suspendResult === get_COROUTINE_SUSPENDED()) {
return suspendResult;
}
continue $sm;
case 2:
if (!suspendResult) {
this.t28_1.j27();
return null;
} else {
this.h8_1 = 3;
continue $sm;
}
case 3:
this.s28_1.w28_1 = this.r28_1.g27_1;
this.u28_1 = this.s28_1.w28_1 - this.s28_1.v28_1 | 0;
if (this.u28_1 === 0) {
this.h8_1 = 5;
continue $sm;
} else {
this.h8_1 = 4;
continue $sm;
}
case 4:
if (this.u28_1 >= 8192) {
var message = 'Header line length limit exceeded';
throw IllegalStateException_init_$Create$(toString(message));
}
var nameStart = this.s28_1.v28_1;
var nameEnd = parseHeaderName(this.r28_1, this.s28_1);
var headerEnd = this.s28_1.w28_1;
parseHeaderValue(this.r28_1, this.s28_1);
var valueStart = this.s28_1.v28_1;
var valueEnd = this.s28_1.w28_1;
this.s28_1.v28_1 = headerEnd;
this.t28_1.x26(nameStart, nameEnd, valueStart, valueEnd);
this.h8_1 = 1;
continue $sm;
case 5:
var host = this.t28_1.dd(HttpHeaders_getInstance().p1w_1);
if (!(host == null)) {
validateHostHeader(host);
}
return this.t28_1;
case 6:
this.i8_1 = 7;
var tmp_0 = this.k8_1;
if (tmp_0 instanceof Error) {
var t = this.k8_1;
this.t28_1.j27();
throw t;
} else {
throw this.k8_1;
}
case 7:
throw this.k8_1;
}
} catch ($p) {
var e = $p;
if (this.i8_1 === 7) {
throw e;
} else {
this.h8_1 = this.i8_1;
this.k8_1 = e;
}
}
while (true);
};
var properties_initialized_HttpParser_kt_uedryv;
function _init_properties_HttpParser_kt__gbdom1() {
if (!properties_initialized_HttpParser_kt_uedryv) {
properties_initialized_HttpParser_kt_uedryv = true;
hostForbiddenSymbols = setOf([new Char(_Char___init__impl__6a9atx(47)), new Char(_Char___init__impl__6a9atx(63)), new Char(_Char___init__impl__6a9atx(35)), new Char(_Char___init__impl__6a9atx(64))]);
httpLineEndings = LineEndingMode__plus_impl_ttpz2j(Companion_getInstance().r1f_1, Companion_getInstance().q1f_1);
versions = Companion_instance.x28(listOf(['HTTP/1.0', 'HTTP/1.1']));
}
}
function get_CrLf() {
_init_properties_Multipart_kt__ato98a();
return CrLf;
}
var CrLf;
function get_PrefixString() {
_init_properties_Multipart_kt__ato98a();
return PrefixString;
}
var PrefixString;
function Preamble(body) {
MultipartEvent.call(this);
this.y28_1 = body;
}
function MultipartPart(headers, body) {
MultipartEvent.call(this);
this.z28_1 = headers;
this.a29_1 = body;
}
function Epilogue(body) {
MultipartEvent.call(this);
this.b29_1 = body;
}
function MultipartEvent() {
}
function parseMultipart(_this__u8e3s4, input, contentType, contentLength, maxPartSize) {
maxPartSize = maxPartSize === VOID ? new Long(-1, 2147483647) : maxPartSize;
_init_properties_Multipart_kt__ato98a();
if (!MultiPart_getInstance().p1u(contentType)) {
throw new UnsupportedMediaTypeExceptionCIO('Failed to parse multipart: Content-Type should be multipart/* but it is ' + toString(contentType));
}
var boundaryByteBuffer = parseBoundaryInternal(contentType);
var boundaryBytes = ByteString_init_$Create$(boundaryByteBuffer);
return parseMultipart_0(_this__u8e3s4, boundaryBytes, input, contentLength, maxPartSize);
}
function parseBoundaryInternal(contentType) {
_init_properties_Multipart_kt__ato98a();
var boundaryParameter = findBoundary(contentType);
if (boundaryParameter === -1) {
throw IOException_init_$Create$("Failed to parse multipart: Content-Type's boundary parameter is missing");
}
var boundaryStart = boundaryParameter + 9 | 0;
var boundaryBytes = new Int8Array(74);
var position = {_v: 0};
parseBoundaryInternal$put(position, boundaryBytes, 13);
parseBoundaryInternal$put(position, boundaryBytes, 10);
parseBoundaryInternal$put(position, boundaryBytes, 45);
parseBoundaryInternal$put(position, boundaryBytes, 45);
var state = 0;
var inductionVariable = boundaryStart;
var last = charSequenceLength(contentType);
if (inductionVariable < last)
loop: do {
var i = inductionVariable;
inductionVariable = inductionVariable + 1 | 0;
var ch = charSequenceGet(contentType, i);
// Inline function 'kotlin.code' call
var v = Char__toInt_impl_vasixd(ch) & 65535;
if ((v & 65535) > 127) {
throw IOException_init_$Create$('Failed to parse multipart: wrong boundary byte 0x' + toString_0(v, 16) + ' - should be 7bit character');
}
switch (state) {
case 0:
if (ch !== _Char___init__impl__6a9atx(32))
if (ch === _Char___init__impl__6a9atx(34)) {
state = 2;
} else if (ch === _Char___init__impl__6a9atx(59) || ch === _Char___init__impl__6a9atx(44)) {
break loop;
} else {
state = 1;
parseBoundaryInternal$put(position, boundaryBytes, toByte(v));
}
break;
case 1:
if (ch === _Char___init__impl__6a9atx(32) || ch === _Char___init__impl__6a9atx(44) || ch === _Char___init__impl__6a9atx(59)) {
break loop;
} else {
parseBoundaryInternal$put(position, boundaryBytes, toByte(v));
}
break;
case 2:
if (ch === _Char___init__impl__6a9atx(92)) {
state = 3;
} else if (ch === _Char___init__impl__6a9atx(34)) {
break loop;
} else {
parseBoundaryInternal$put(position, boundaryBytes, toByte(v));
}
break;
case 3:
parseBoundaryInternal$put(position, boundaryBytes, toByte(v));
state = 2;
break;
}
}
while (inductionVariable < last);
if (position._v === 4) {
throw IOException_init_$Create$('Empty multipart boundary is not allowed');
}
return copyOfRange(boundaryBytes, 0, position._v);
}
function parseMultipart_0(_this__u8e3s4, boundaryPrefixed, input, totalLength, maxPartSize) {
_init_properties_Multipart_kt__ato98a();
return produce(_this__u8e3s4, VOID, VOID, parseMultipart$slambda_0(input, boundaryPrefixed, maxPartSize, totalLength, null));
}
function findBoundary(contentType) {
_init_properties_Multipart_kt__ato98a();
var state = 0;
var paramNameCount = 0;
var inductionVariable = 0;
var last = charSequenceLength(contentType) - 1 | 0;
if (inductionVariable <= last)
do {
var i = inductionVariable;
inductionVariable = inductionVariable + 1 | 0;
var ch = charSequenceGet(contentType, i);
switch (state) {
case 0:
if (ch === _Char___init__impl__6a9atx(59)) {
state = 1;
paramNameCount = 0;
}
break;
case 1:
if (ch === _Char___init__impl__6a9atx(61)) {
state = 2;
} else if (ch === _Char___init__impl__6a9atx(59)) {
paramNameCount = 0;
} else if (ch === _Char___init__impl__6a9atx(44)) {
state = 0;
} else if (ch !== _Char___init__impl__6a9atx(32))
if (paramNameCount === 0 && startsWith(contentType, 'boundary=', i, true)) {
return i;
} else {
paramNameCount = paramNameCount + 1 | 0;
}
break;
case 2:
if (ch === _Char___init__impl__6a9atx(34))
state = 3;
else if (ch === _Char___init__impl__6a9atx(44))
state = 0;
else if (ch === _Char___init__impl__6a9atx(59)) {
state = 1;
paramNameCount = 0;
}
break;
case 3:
if (ch === _Char___init__impl__6a9atx(34)) {
state = 1;
paramNameCount = 0;
} else if (ch === _Char___init__impl__6a9atx(92)) {
state = 4;
}
break;
case 4:
state = 3;
break;
}
}
while (inductionVariable <= last);
return -1;
}
function parsePreambleImpl(boundary, input, output, limit, $completion) {
limit = limit === VOID ? new Long(-1, 2147483647) : limit;
return readUntil(input, boundary, output, limit, true, $completion);
}
function parsePartHeadersImpl(input, $completion) {
var tmp = new $parsePartHeadersImplCOROUTINE$(input, $completion);
tmp.j8_1 = Unit_instance;
tmp.k8_1 = null;
return tmp.p8();
}
function parsePartBodyImpl(boundaryPrefixed, input, output, headers, limit, $completion) {
var tmp = new $parsePartBodyImplCOROUTINE$(boundaryPrefixed, input, output, headers, limit, $completion);
tmp.j8_1 = Unit_instance;
tmp.k8_1 = null;
return tmp.p8();
}
function skipIfFoundReadCount(_this__u8e3s4, prefix, $completion) {
var tmp = new $skipIfFoundReadCountCOROUTINE$(_this__u8e3s4, prefix, $completion);
tmp.j8_1 = Unit_instance;
tmp.k8_1 = null;
return tmp.p8();
}
function throwLimitExceeded(actual, limit) {
_init_properties_Multipart_kt__ato98a();
throw IOException_init_$Create$('Multipart content length exceeds limit ' + actual.toString() + ' > ' + limit.toString() + '; ' + "limit is defined using 'formFieldLimit' argument");
}
function parseBoundaryInternal$put(position, boundaryBytes, value) {
if (position._v >= boundaryBytes.length) {
throw IOException_init_$Create$("Failed to parse multipart: boundary shouldn't be longer than 70 characters");
}
var _unary__edvuaz = position._v;
position._v = _unary__edvuaz + 1 | 0;
boundaryBytes[_unary__edvuaz] = value;
}
function parseMultipart$slambda$slambda($firstBoundary, $countedInput, resultContinuation) {
this.v2a_1 = $firstBoundary;
this.w2a_1 = $countedInput;
CoroutineImpl.call(this, resultContinuation);
}
protoOf(parseMultipart$slambda$slambda).y2a = function ($this$writer, $completion) {
var tmp = this.z2a($this$writer, $completion);
tmp.j8_1 = Unit_instance;
tmp.k8_1 = null;
return tmp.p8();
};
protoOf(parseMultipart$slambda$slambda).b9 = function (p1, $completion) {
return this.y2a(p1 instanceof WriterScope ? p1 : THROW_CCE(), $completion);
};
protoOf(parseMultipart$slambda$slambda).p8 = function () {
var suspendResult = this.j8_1;
$sm: do
try {
var tmp = this.h8_1;
switch (tmp) {
case 0:
this.i8_1 = 3;
this.h8_1 = 1;
suspendResult = parsePreambleImpl(this.v2a_1, this.w2a_1, this.x2a_1.r1h_1, new Long(8193, 0), this);
if (suspendResult === get_COROUTINE_SUSPENDED()) {
return suspendResult;
}
continue $sm;
case 1:
this.h8_1 = 2;
suspendResult = this.x2a_1.r1h_1.w1a(this);
if (suspendResult === get_COROUTINE_SUSPENDED()) {
return suspendResult;
}
continue $sm;
case 2:
return Unit_instance;
case 3:
throw this.k8_1;
}
} catch ($p) {
var e = $p;
if (this.i8_1 === 3) {
throw e;
} else {
this.h8_1 = this.i8_1;
this.k8_1 = e;
}
}
while (true);
};
protoOf(parseMultipart$slambda$slambda).z2a = function ($this$writer, completion) {
var i = new parseMultipart$slambda$slambda(this.v2a_1, this.w2a_1, completion);
i.x2a_1 = $this$writer;
return i;
};
function parseMultipart$slambda$slambda_0($firstBoundary, $countedInput, resultContinuation) {
var i = new parseMultipart$slambda$slambda($firstBoundary, $countedInput, resultContinuation);
var l = function ($this$writer, $completion) {
return i.y2a($this$writer, $completion);
};
l.$arity = 1;
return l;
}
function parseMultipart$slambda($input, $boundaryPrefixed, $maxPartSize, $totalLength, resultContinuation) {
this.i2b_1 = $input;
this.j2b_1 = $boundaryPrefixed;
this.k2b_1 = $maxPartSize;
this.l2b_1 = $totalLength;
CoroutineImpl.call(this, resultContinuation);
}
protoOf(parseMultipart$slambda).u2b = function ($this$produce, $completion) {
var tmp = this.v2b($this$produce, $completion);
tmp.j8_1 = Unit_instance;
tmp.k8_1 = null;
return tmp.p8();
};
protoOf(parseMultipart$slambda).b9 = function (p1, $completion) {
return this.u2b((!(p1 == null) ? isInterface(p1, ProducerScope) : false) ? p1 : THROW_CCE(), $completion);
};
protoOf(parseMultipart$slambda).p8 = function () {
var suspendResult = this.j8_1;
$sm: do
try {
var tmp = this.h8_1;
switch (tmp) {
case 0:
this.i8_1 = 25;
this.n2b_1 = counted(this.i2b_1);
this.o2b_1 = this.n2b_1.e1j();
this.s2b_1 = this.j2b_1.e15(get_PrefixString().a1());
this.h8_1 = 1;
suspendResult = readRemaining(writer(this.m2b_1, VOID, VOID, parseMultipart$slambda$slambda_0(this.s2b_1, this.n2b_1, null)).p1h_1, this);
if (suspendResult === get_COROUTINE_SUSPENDED()) {
return suspendResult;
}
continue $sm;
case 1:
var preambleData = suspendResult;
if (compare(get_remaining(preambleData), new Long(0, 0)) > 0) {
this.h8_1 = 2;
suspendResult = this.m2b_1.a11(new Preamble(preambleData), this);
if (suspendResult === get_COROUTINE_SUSPENDED()) {
return suspendResult;
}
continue $sm;
} else {
this.h8_1 = 3;
continue $sm;
}
case 2:
this.h8_1 = 3;
continue $sm;
case 3:
this.h8_1 = 4;
continue $sm;
case 4:
if (!this.n2b_1.t1a()) {
this.h8_1 = 5;
suspendResult = skipIfFound(this.n2b_1, get_PrefixString(), this);
if (suspendResult === get_COROUTINE_SUSPENDED()) {
return suspendResult;
}
continue $sm;
} else {
this.t2b_1 = false;
this.h8_1 = 6;
continue $sm;
}
case 5:
this.t2b_1 = !suspendResult;
this.h8_1 = 6;
continue $sm;
case 6:
if (!this.t2b_1) {
this.h8_1 = 15;
continue $sm;
}
this.h8_1 = 7;
suspendResult = skipIfFound(this.n2b_1, get_CrLf(), this);
if (suspendResult === get_COROUTINE_SUSPENDED()) {
return suspendResult;
}
continue $sm;
case 7:
this.h8_1 = 8;
suspendResult = skipIfFound(this.n2b_1, this.s2b_1, this);
if (suspendResult === get_COROUTINE_SUSPENDED()) {
return suspendResult;
}
continue $sm;
case 8:
if (suspendResult) {
this.h8_1 = 4;
continue $sm;
} else {
this.h8_1 = 9;
continue $sm;
}
case 9:
this.p2b_1 = new ByteChannel();
this.r2b_1 = CompletableDeferred();
var part = new MultipartPart(this.r2b_1, this.p2b_1);
this.h8_1 = 10;
suspendResult = this.m2b_1.a11(part, this);
if (suspendResult === get_COROUTINE_SUSPENDED()) {
return suspendResult;
}
continue $sm;
case 10:
this.q2b_1 = null;
this.i8_1 = 14;
this.h8_1 = 11;
suspendResult = parsePartHeadersImpl(this.n2b_1, this);
if (suspendResult === get_COROUTINE_SUSPENDED()) {
return suspendResult;
}
continue $sm;
case 11:
this.q2b_1 = suspendResult;
if (!this.r2b_1.ns(this.q2b_1)) {
this.q2b_1.j27();
throw CancellationException_init_$Create$('Multipart processing has been cancelled');
}
this.h8_1 = 12;
suspendResult = parsePartBodyImpl(this.j2b_1, this.n2b_1, this.p2b_1, this.q2b_1, this.k2b_1, this);
if (suspendResult === get_COROUTINE_SUSPENDED()) {
return suspendResult;
}
continue $sm;
case 12:
this.p2b_1.w3();
this.i8_1 = 25;
this.h8_1 = 13;
continue $sm;
case 13:
this.i8_1 = 25;
this.h8_1 = 4;
continue $sm;
case 14:
this.i8_1 = 25;
var tmp_0 = this.k8_1;
if (tmp_0 instanceof Error) {
var cause = this.k8_1;
if (this.r2b_1.ps(cause)) {
var tmp0_safe_receiver = this.q2b_1;
if (tmp0_safe_receiver == null)
null;
else {
tmp0_safe_receiver.j27();
}
}
close(this.p2b_1, cause);
throw cause;
} else {
throw this.k8_1;
}
case 15:
this.h8_1 = 16;
suspendResult = skipIfFound(this.n2b_1, get_CrLf(), this);
if (suspendResult === get_COROUTINE_SUSPENDED()) {
return suspendResult;
}
continue $sm;
case 16:
this.h8_1 = 17;
suspendResult = skipIfFound(this.n2b_1, get_CrLf(), this);
if (suspendResult === get_COROUTINE_SUSPENDED()) {
return suspendResult;
}
continue $sm;
case 17:
if (!(this.l2b_1 == null)) {
var consumedExceptEpilogue = subtract(this.n2b_1.e1j(), this.o2b_1);
var size = subtract(this.l2b_1, consumedExceptEpilogue);
if (compare(size, new Long(2147483647, 0)) > 0)
throw IOException_init_$Create$('Failed to parse multipart: prologue is too long');
if (compare(size, new Long(0, 0)) > 0) {
this.h8_1 = 21;
suspendResult = readPacket(this.n2b_1, convertToInt(size), this);
if (suspendResult === get_COROUTINE_SUSPENDED()) {
return suspendResult;
}
continue $sm;
} else {
this.h8_1 = 23;
continue $sm;
}
} else {
this.h8_1 = 18;
suspendResult = readRemaining(this.n2b_1, this);
if (suspendResult === get_COROUTINE_SUSPENDED()) {
return suspendResult;
}
continue $sm;
}
case 18:
var epilogueContent = suspendResult;
if (!epilogueContent.m15()) {
this.h8_1 = 19;
suspendResult = this.m2b_1.a11(new Epilogue(epilogueContent), this);
if (suspendResult === get_COROUTINE_SUSPENDED()) {
return suspendResult;
}
continue $sm;
} else {
this.h8_1 = 20;
continue $sm;
}
case 19:
this.h8_1 = 20;
continue $sm;
case 20:
this.h8_1 = 24;
continue $sm;
case 21:
var ARGUMENT = suspendResult;
var ARGUMENT_0 = new Epilogue(ARGUMENT);
this.h8_1 = 22;
suspendResult = this.m2b_1.a11(ARGUMENT_0, this);
if (suspendResult === get_COROUTINE_SUSPENDED()) {
return suspendResult;
}
continue $sm;
case 22:
this.h8_1 = 23;
continue $sm;
case 23:
this.h8_1 = 24;
continue $sm;
case 24:
return Unit_instance;
case 25:
throw this.k8_1;
}
} catch ($p) {
var e = $p;
if (this.i8_1 === 25) {
throw e;
} else {
this.h8_1 = this.i8_1;
this.k8_1 = e;
}
}
while (true);
};
protoOf(parseMultipart$slambda).v2b = function ($this$produce, completion) {
var i = new parseMultipart$slambda(this.i2b_1, this.j2b_1, this.k2b_1, this.l2b_1, completion);
i.m2b_1 = $this$produce;
return i;
};
function parseMultipart$slambda_0($input, $boundaryPrefixed, $maxPartSize, $totalLength, resultContinuation) {
var i = new parseMultipart$slambda($input, $boundaryPrefixed, $maxPartSize, $totalLength, resultContinuation);
var l = function ($this$produce, $completion) {
return i.u2b($this$produce, $completion);
};
l.$arity = 1;
return l;
}
function $parsePartHeadersImplCOROUTINE$(input, resultContinuation) {
CoroutineImpl.call(this, resultContinuation);
this.k29_1 = input;
}
protoOf($parsePartHeadersImplCOROUTINE$).p8 = function () {
var suspendResult = this.j8_1;
$sm: do
try {
var tmp = this.h8_1;
switch (tmp) {
case 0:
this.i8_1 = 3;
this.l29_1 = new CharArrayBuilder();
this.i8_1 = 2;
this.h8_1 = 1;
suspendResult = parseHeaders(this.k29_1, this.l29_1, VOID, this);
if (suspendResult === get_COROUTINE_SUSPENDED()) {
return suspendResult;
}
continue $sm;
case 1:
var tmp0_elvis_lhs = suspendResult;
var tmp_0;
if (tmp0_elvis_lhs == null) {
throw EOFException_init_$Create$('Failed to parse multipart headers: unexpected end of stream');
} else {
tmp_0 = tmp0_elvis_lhs;
}
return tmp_0;
case 2:
this.i8_1 = 3;
var tmp_1 = this.k8_1;
if (tmp_1 instanceof Error) {
var t = this.k8_1;
this.l29_1.j27();
throw t;
} else {
throw this.k8_1;
}
case 3:
throw this.k8_1;
}
} catch ($p) {
var e = $p;
if (this.i8_1 === 3) {
throw e;
} else {
this.h8_1 = this.i8_1;
this.k8_1 = e;
}
}
while (true);
};
function $parsePartBodyImplCOROUTINE$(boundaryPrefixed, input, output, headers, limit, resultContinuation) {
CoroutineImpl.call(this, resultContinuation);
this.u29_1 = boundaryPrefixed;
this.v29_1 = input;
this.w29_1 = output;
this.x29_1 = headers;
this.y29_1 = limit;
}
protoOf($parsePartBodyImplCOROUTINE$).p8 = function () {
var suspendResult = this.j8_1;
$sm: do
try {
var tmp = this.h8_1;
switch (tmp) {
case 0:
this.i8_1 = 6;
var tmp0_safe_receiver = this.x29_1.dd('Content-Length');
var contentLength = tmp0_safe_receiver == null ? null : parseDecLong(tmp0_safe_receiver);
if (contentLength == null) {
this.h8_1 = 3;
suspendResult = readUntil(this.v29_1, this.u29_1, this.w29_1, this.y29_1, true, this);
if