@cpaassdk/cpaas-sdk
Version:
1,260 lines (1,258 loc) • 133 kB
JavaScript
(function (root, factory) {
if (typeof define === 'function' && define.amd)
define(['exports', './kotlin-kotlin-stdlib-js-ir.js', './ktor-ktor-io-js-ir.js', './ktor-ktor-utils-js-ir.js'], factory);
else if (typeof exports === 'object')
factory(module.exports, require('./kotlin-kotlin-stdlib-js-ir.js'), require('./ktor-ktor-io-js-ir.js'), require('./ktor-ktor-utils-js-ir.js'));
else {
if (typeof this['kotlin-kotlin-stdlib-js-ir'] === 'undefined') {
throw new Error("Error loading module 'ktor-ktor-http-js-ir'. Its dependency 'kotlin-kotlin-stdlib-js-ir' was not found. Please, check whether 'kotlin-kotlin-stdlib-js-ir' is loaded prior to 'ktor-ktor-http-js-ir'.");
}
if (typeof this['ktor-ktor-io-js-ir'] === 'undefined') {
throw new Error("Error loading module 'ktor-ktor-http-js-ir'. Its dependency 'ktor-ktor-io-js-ir' was not found. Please, check whether 'ktor-ktor-io-js-ir' is loaded prior to 'ktor-ktor-http-js-ir'.");
}
if (typeof this['ktor-ktor-utils-js-ir'] === 'undefined') {
throw new Error("Error loading module 'ktor-ktor-http-js-ir'. Its dependency 'ktor-ktor-utils-js-ir' was not found. Please, check whether 'ktor-ktor-utils-js-ir' is loaded prior to 'ktor-ktor-http-js-ir'.");
}
root['ktor-ktor-http-js-ir'] = factory(typeof this['ktor-ktor-http-js-ir'] === 'undefined' ? {} : this['ktor-ktor-http-js-ir'], this['kotlin-kotlin-stdlib-js-ir'], this['ktor-ktor-io-js-ir'], this['ktor-ktor-utils-js-ir']);
}
}(this, function (_, kotlin_kotlin, kotlin_io_ktor_ktor_io, kotlin_io_ktor_ktor_utils) {
'use strict';
//region block: imports
var imul = Math.imul;
var StringBuilder_init_$Create$ = kotlin_kotlin.$_$.s1;
var Charsets_getInstance = kotlin_io_ktor_ktor_io.$_$.o;
var charSequenceGet = kotlin_kotlin.$_$.u8;
var Char = kotlin_kotlin.$_$.bc;
var _Char___init__impl__6a9atx = kotlin_kotlin.$_$.q2;
var equals = kotlin_kotlin.$_$.z8;
var isSurrogate = kotlin_kotlin.$_$.fb;
var encode = kotlin_io_ktor_ktor_io.$_$.r;
var Unit_getInstance = kotlin_kotlin.$_$.h4;
var encode$default = kotlin_io_ktor_ktor_io.$_$.g;
var prepareReadFirstHead = kotlin_io_ktor_ktor_io.$_$.v;
var prepareReadNextHead = kotlin_io_ktor_ktor_io.$_$.w;
var completeReadHead = kotlin_io_ktor_ktor_io.$_$.u;
var StringBuilder_init_$Create$_0 = kotlin_kotlin.$_$.r1;
var toString = kotlin_kotlin.$_$.ha;
var Char__plus_impl_qi7pgj = kotlin_kotlin.$_$.u2;
var Char__minus_impl_a2frrh = kotlin_kotlin.$_$.t2;
var charSequenceLength = kotlin_kotlin.$_$.v8;
var charSequenceSubSequence = kotlin_kotlin.$_$.w8;
var toByte = kotlin_kotlin.$_$.ea;
var String_0 = kotlin_io_ktor_ktor_io.$_$.b1;
var Exception = kotlin_kotlin.$_$.ic;
var Exception_init_$Init$ = kotlin_kotlin.$_$.w1;
var captureStack = kotlin_kotlin.$_$.s8;
var classMeta = kotlin_kotlin.$_$.x8;
var Char__minus_impl_a2frrh_0 = kotlin_kotlin.$_$.s2;
var numberToChar = kotlin_kotlin.$_$.z9;
var Char__rangeTo_impl_tkncvp = kotlin_kotlin.$_$.v2;
var plus = kotlin_kotlin.$_$.v6;
var plus_0 = kotlin_kotlin.$_$.w6;
var collectionSizeOrDefault = kotlin_kotlin.$_$.k5;
var ArrayList_init_$Create$ = kotlin_kotlin.$_$.z;
var Char__toByte_impl_7s7yt0 = kotlin_kotlin.$_$.w2;
var listOf = kotlin_kotlin.$_$.p6;
var toSet = kotlin_kotlin.$_$.m7;
var plus_1 = kotlin_kotlin.$_$.u6;
var setOf = kotlin_kotlin.$_$.b7;
var interfaceMeta = kotlin_kotlin.$_$.g9;
var emptyList = kotlin_kotlin.$_$.y5;
var equals_0 = kotlin_kotlin.$_$.za;
var Collection = kotlin_kotlin.$_$.j4;
var isInterface = kotlin_kotlin.$_$.p9;
var isBlank = kotlin_kotlin.$_$.bb;
var single = kotlin_kotlin.$_$.d7;
var indexOf$default = kotlin_kotlin.$_$.q;
var THROW_CCE = kotlin_kotlin.$_$.qc;
var isCharSequence = kotlin_kotlin.$_$.l9;
var trim = kotlin_kotlin.$_$.zb;
var contains$default = kotlin_kotlin.$_$.l;
var objectMeta = kotlin_kotlin.$_$.da;
var plus_2 = kotlin_kotlin.$_$.x6;
var getStringHashCode = kotlin_kotlin.$_$.e9;
var hashCode = kotlin_kotlin.$_$.f9;
var Companion_getInstance = kotlin_io_ktor_ktor_io.$_$.n;
var IllegalArgumentException = kotlin_kotlin.$_$.jc;
var get_name = kotlin_io_ktor_ktor_io.$_$.s;
var last = kotlin_kotlin.$_$.ib;
var first = kotlin_kotlin.$_$.ab;
var get_lastIndex = kotlin_kotlin.$_$.hb;
var StringValuesBuilder = kotlin_io_ktor_ktor_utils.$_$.q;
var IllegalArgumentException_init_$Create$ = kotlin_kotlin.$_$.a2;
var StringValues = kotlin_io_ktor_ktor_utils.$_$.s;
var StringValuesImpl = kotlin_io_ktor_ktor_utils.$_$.r;
var emptySet = kotlin_kotlin.$_$.a6;
var get = kotlin_io_ktor_ktor_utils.$_$.p;
var forEach = kotlin_io_ktor_ktor_utils.$_$.o;
var toDoubleOrNull = kotlin_kotlin.$_$.nb;
var rangeTo = kotlin_kotlin.$_$.qa;
var LazyThreadSafetyMode_NONE_getInstance = kotlin_kotlin.$_$.e;
var lazy = kotlin_kotlin.$_$.id;
var to = kotlin_kotlin.$_$.pd;
var ArrayList_init_$Create$_0 = kotlin_kotlin.$_$.a1;
var asList = kotlin_kotlin.$_$.h5;
var Char__compareTo_impl_ypi4mb = kotlin_kotlin.$_$.r2;
var IllegalArgumentException_init_$Init$ = kotlin_kotlin.$_$.z1;
var Char__toInt_impl_vasixd = kotlin_kotlin.$_$.x2;
var toLong = kotlin_kotlin.$_$.sb;
var fillArrayVal = kotlin_kotlin.$_$.b9;
var Enum = kotlin_kotlin.$_$.gc;
var listOf_0 = kotlin_kotlin.$_$.o6;
var addAll = kotlin_kotlin.$_$.f5;
var joinTo$default = kotlin_kotlin.$_$.j;
var toString_0 = kotlin_kotlin.$_$.od;
var isWhitespace = kotlin_kotlin.$_$.gb;
var IllegalStateException_init_$Create$ = kotlin_kotlin.$_$.e2;
var toCharArray = kotlin_io_ktor_ktor_utils.$_$.x;
var indexOfAny$default = kotlin_kotlin.$_$.o;
var lastIndexOf$default = kotlin_kotlin.$_$.r;
var IllegalStateException = kotlin_kotlin.$_$.kc;
var IllegalStateException_init_$Init$ = kotlin_kotlin.$_$.f2;
var indexOf$default_0 = kotlin_kotlin.$_$.p;
var toInt = kotlin_kotlin.$_$.qb;
var mapCapacity = kotlin_kotlin.$_$.q6;
var coerceAtLeast = kotlin_kotlin.$_$.la;
var LinkedHashMap_init_$Create$ = kotlin_kotlin.$_$.i1;
var toLowerCasePreservingASCIIRules = kotlin_io_ktor_ktor_utils.$_$.y;
var isLowerCase = kotlin_io_ktor_ktor_utils.$_$.v;
var appendAll = kotlin_io_ktor_ktor_utils.$_$.t;
var startsWith$default = kotlin_kotlin.$_$.w;
var encodeToByteArray = kotlin_io_ktor_ktor_io.$_$.q;
var toLong_0 = kotlin_kotlin.$_$.fa;
var take = kotlin_kotlin.$_$.lb;
var PlatformUtils_getInstance = kotlin_io_ktor_ktor_utils.$_$.e;
//endregion
//region block: pre-declaration
URLDecodeException.prototype = Object.create(Exception.prototype);
URLDecodeException.prototype.constructor = URLDecodeException;
ContentType.prototype = Object.create(HeaderValueWithParameters.prototype);
ContentType.prototype.constructor = ContentType;
BadContentTypeFormatException.prototype = Object.create(Exception.prototype);
BadContentTypeFormatException.prototype.constructor = BadContentTypeFormatException;
HeadersBuilder.prototype = Object.create(StringValuesBuilder.prototype);
HeadersBuilder.prototype.constructor = HeadersBuilder;
HeadersImpl.prototype = Object.create(StringValuesImpl.prototype);
HeadersImpl.prototype.constructor = HeadersImpl;
UnsafeHeaderException.prototype = Object.create(IllegalArgumentException.prototype);
UnsafeHeaderException.prototype.constructor = UnsafeHeaderException;
IllegalHeaderNameException.prototype = Object.create(IllegalArgumentException.prototype);
IllegalHeaderNameException.prototype.constructor = IllegalHeaderNameException;
IllegalHeaderValueException.prototype = Object.create(IllegalArgumentException.prototype);
IllegalHeaderValueException.prototype.constructor = IllegalHeaderValueException;
UrlEncodingOption.prototype = Object.create(Enum.prototype);
UrlEncodingOption.prototype.constructor = UrlEncodingOption;
ParametersBuilder.prototype = Object.create(StringValuesBuilder.prototype);
ParametersBuilder.prototype.constructor = ParametersBuilder;
function get_urlEncodingOption() {
return UrlEncodingOption_DEFAULT_getInstance();
}
ParametersImpl.prototype = Object.create(StringValuesImpl.prototype);
ParametersImpl.prototype.constructor = ParametersImpl;
URLParserException.prototype = Object.create(IllegalStateException.prototype);
URLParserException.prototype.constructor = URLParserException;
NoContent.prototype = Object.create(OutgoingContent.prototype);
NoContent.prototype.constructor = NoContent;
ReadChannelContent.prototype = Object.create(OutgoingContent.prototype);
ReadChannelContent.prototype.constructor = ReadChannelContent;
WriteChannelContent.prototype = Object.create(OutgoingContent.prototype);
WriteChannelContent.prototype.constructor = WriteChannelContent;
ByteArrayContent.prototype = Object.create(OutgoingContent.prototype);
ByteArrayContent.prototype.constructor = ByteArrayContent;
ProtocolUpgrade.prototype = Object.create(OutgoingContent.prototype);
ProtocolUpgrade.prototype.constructor = ProtocolUpgrade;
TextContent.prototype = Object.create(ByteArrayContent.prototype);
TextContent.prototype.constructor = TextContent;
//endregion
function get_URL_ALPHABET() {
init_properties_Codecs_kt_hjkt7n();
return URL_ALPHABET;
}
var URL_ALPHABET;
function get_URL_ALPHABET_CHARS() {
init_properties_Codecs_kt_hjkt7n();
return URL_ALPHABET_CHARS;
}
var URL_ALPHABET_CHARS;
function get_HEX_ALPHABET() {
init_properties_Codecs_kt_hjkt7n();
return HEX_ALPHABET;
}
var HEX_ALPHABET;
function get_URL_PROTOCOL_PART() {
init_properties_Codecs_kt_hjkt7n();
return URL_PROTOCOL_PART;
}
var URL_PROTOCOL_PART;
function get_VALID_PATH_PART() {
init_properties_Codecs_kt_hjkt7n();
return VALID_PATH_PART;
}
var VALID_PATH_PART;
function get_OAUTH_SYMBOLS() {
init_properties_Codecs_kt_hjkt7n();
return OAUTH_SYMBOLS;
}
var OAUTH_SYMBOLS;
function get_LETTERS_AND_NUMBERS() {
init_properties_Codecs_kt_hjkt7n();
return LETTERS_AND_NUMBERS;
}
var LETTERS_AND_NUMBERS;
var TOKENS;
function encodeURLPath(_this__u8e3s4) {
init_properties_Codecs_kt_hjkt7n();
var tmp$ret$1;
{
{
}
var tmp$ret$0;
{
var tmp0_apply = StringBuilder_init_$Create$();
{
}
{
var charset = Charsets_getInstance().j1n_1;
var index = 0;
$l$loop_0: while (index < _this__u8e3s4.length) {
var current = charSequenceGet(_this__u8e3s4, index);
if ((equals(new Char(current), new Char(_Char___init__impl__6a9atx(47))) ? true : get_URL_ALPHABET_CHARS().q1(new Char(current))) ? true : get_VALID_PATH_PART().q1(new Char(current))) {
tmp0_apply.n6(current);
var tmp0 = index;
index = tmp0 + 1 | 0;
continue $l$loop_0;
}
if (((equals(new Char(current), new Char(_Char___init__impl__6a9atx(37))) ? (index + 2 | 0) < _this__u8e3s4.length : false) ? get_HEX_ALPHABET().q1(new Char(charSequenceGet(_this__u8e3s4, index + 1 | 0))) : false) ? get_HEX_ALPHABET().q1(new Char(charSequenceGet(_this__u8e3s4, index + 2 | 0))) : false) {
tmp0_apply.n6(current);
tmp0_apply.n6(charSequenceGet(_this__u8e3s4, index + 1 | 0));
tmp0_apply.n6(charSequenceGet(_this__u8e3s4, index + 2 | 0));
index = index + 3 | 0;
continue $l$loop_0;
}
var symbolSize = isSurrogate(current) ? 2 : 1;
var tmp = encode(charset.a1q(), _this__u8e3s4, index, index + symbolSize | 0);
forEach_0(tmp, encodeURLPath$lambda(tmp0_apply));
index = index + symbolSize | 0;
}
}
tmp$ret$0 = tmp0_apply;
}
tmp$ret$1 = tmp$ret$0.toString();
}
return tmp$ret$1;
}
function encodeURLQueryComponent(_this__u8e3s4, encodeFull, spaceToPlus, charset) {
init_properties_Codecs_kt_hjkt7n();
var tmp$ret$1;
{
{
}
var tmp$ret$0;
{
var tmp0_apply = StringBuilder_init_$Create$();
{
}
{
var tmp = charset.a1q();
var content = encode$default(tmp, _this__u8e3s4, 0, 0, 6, null);
forEach_0(content, encodeURLQueryComponent$lambda(spaceToPlus, tmp0_apply, encodeFull));
}
tmp$ret$0 = tmp0_apply;
}
tmp$ret$1 = tmp$ret$0.toString();
}
return tmp$ret$1;
}
function encodeURLQueryComponent$default(_this__u8e3s4, encodeFull, spaceToPlus, charset, $mask0, $handler) {
if (!(($mask0 & 1) === 0))
encodeFull = false;
if (!(($mask0 & 2) === 0))
spaceToPlus = false;
if (!(($mask0 & 4) === 0))
charset = Charsets_getInstance().j1n_1;
return encodeURLQueryComponent(_this__u8e3s4, encodeFull, spaceToPlus, charset);
}
function encodeURLParameter(_this__u8e3s4, spaceToPlus) {
init_properties_Codecs_kt_hjkt7n();
var tmp$ret$1;
{
{
}
var tmp$ret$0;
{
var tmp0_apply = StringBuilder_init_$Create$();
{
}
{
var tmp = Charsets_getInstance().j1n_1.a1q();
var content = encode$default(tmp, _this__u8e3s4, 0, 0, 6, null);
forEach_0(content, encodeURLParameter$lambda(tmp0_apply, spaceToPlus));
}
tmp$ret$0 = tmp0_apply;
}
tmp$ret$1 = tmp$ret$0.toString();
}
return tmp$ret$1;
}
function encodeURLParameter$default(_this__u8e3s4, spaceToPlus, $mask0, $handler) {
if (!(($mask0 & 1) === 0))
spaceToPlus = false;
return encodeURLParameter(_this__u8e3s4, spaceToPlus);
}
function encodeURLParameterValue(_this__u8e3s4) {
init_properties_Codecs_kt_hjkt7n();
return encodeURLParameter(_this__u8e3s4, true);
}
function decodeURLPart(_this__u8e3s4, start, end, charset) {
init_properties_Codecs_kt_hjkt7n();
return decodeScan(_this__u8e3s4, start, end, false, charset);
}
function decodeURLPart$default(_this__u8e3s4, start, end, charset, $mask0, $handler) {
if (!(($mask0 & 1) === 0))
start = 0;
if (!(($mask0 & 2) === 0))
end = _this__u8e3s4.length;
if (!(($mask0 & 4) === 0))
charset = Charsets_getInstance().j1n_1;
return decodeURLPart(_this__u8e3s4, start, end, charset);
}
function forEach_0(_this__u8e3s4, block) {
init_properties_Codecs_kt_hjkt7n();
var tmp$ret$0;
$l$block: {
var release = true;
var tmp0_elvis_lhs = prepareReadFirstHead(_this__u8e3s4, 1);
var tmp;
if (tmp0_elvis_lhs == null) {
tmp$ret$0 = Unit_getInstance();
break $l$block;
} else {
tmp = tmp0_elvis_lhs;
}
var current = tmp;
try {
$l$loop_1: do {
var tmp$ret$2;
{
var tmp0__anonymous__q1qw7t = current;
$l$loop: while (true) {
var tmp$ret$1;
{
tmp$ret$1 = tmp0__anonymous__q1qw7t.i1f() > tmp0__anonymous__q1qw7t.j1f();
}
if (!tmp$ret$1) {
break $l$loop;
}
block(tmp0__anonymous__q1qw7t.p1o());
}
tmp$ret$2 = true;
}
if (!tmp$ret$2) {
break $l$loop_1;
}
release = false;
var tmp1_elvis_lhs = prepareReadNextHead(_this__u8e3s4, current);
var tmp_0;
if (tmp1_elvis_lhs == null) {
break $l$loop_1;
} else {
tmp_0 = tmp1_elvis_lhs;
}
var next = tmp_0;
current = next;
release = true;
}
while (true);
}finally {
if (release) {
completeReadHead(_this__u8e3s4, current);
}
}
}
}
function percentEncode(_this__u8e3s4) {
init_properties_Codecs_kt_hjkt7n();
var tmp$ret$1;
{
{
}
var tmp$ret$0;
{
var tmp0_apply = StringBuilder_init_$Create$_0(3);
{
}
{
var code = _this__u8e3s4 & 255;
tmp0_apply.n6(_Char___init__impl__6a9atx(37));
tmp0_apply.n6(hexDigitToChar(code >> 4));
tmp0_apply.n6(hexDigitToChar(code & 15));
}
tmp$ret$0 = tmp0_apply;
}
tmp$ret$1 = tmp$ret$0.toString();
}
return tmp$ret$1;
}
function decodeScan(_this__u8e3s4, start, end, plusIsSpace, charset) {
init_properties_Codecs_kt_hjkt7n();
var inductionVariable = start;
if (inductionVariable < end)
do {
var index = inductionVariable;
inductionVariable = inductionVariable + 1 | 0;
var ch = charSequenceGet(_this__u8e3s4, index);
if (equals(new Char(ch), new Char(_Char___init__impl__6a9atx(37))) ? true : plusIsSpace ? equals(new Char(ch), new Char(_Char___init__impl__6a9atx(43))) : false) {
return decodeImpl(_this__u8e3s4, start, end, index, plusIsSpace, charset);
}
}
while (inductionVariable < end);
var tmp;
if (start === 0 ? end === _this__u8e3s4.length : false) {
tmp = toString(_this__u8e3s4);
} else {
var tmp$ret$1;
{
var tmp$ret$0;
{
tmp$ret$0 = _this__u8e3s4;
}
tmp$ret$1 = tmp$ret$0.substring(start, end);
}
tmp = tmp$ret$1;
}
return tmp;
}
function hexDigitToChar(digit) {
init_properties_Codecs_kt_hjkt7n();
var tmp0_subject = digit;
return (0 <= tmp0_subject ? tmp0_subject <= 9 : false) ? Char__plus_impl_qi7pgj(_Char___init__impl__6a9atx(48), digit) : Char__minus_impl_a2frrh(Char__plus_impl_qi7pgj(_Char___init__impl__6a9atx(65), digit), 10);
}
function decodeImpl(_this__u8e3s4, start, end, prefixEnd, plusIsSpace, charset) {
init_properties_Codecs_kt_hjkt7n();
var length = end - start | 0;
var sbSize = length > 255 ? length / 3 | 0 : length;
var sb = StringBuilder_init_$Create$_0(sbSize);
if (prefixEnd > start) {
sb.pg(_this__u8e3s4, start, prefixEnd);
}
var index = prefixEnd;
var bytes = null;
while (index < end) {
var c = charSequenceGet(_this__u8e3s4, index);
if (plusIsSpace ? equals(new Char(c), new Char(_Char___init__impl__6a9atx(43))) : false) {
sb.n6(_Char___init__impl__6a9atx(32));
var tmp0 = index;
index = tmp0 + 1 | 0;
} else if (equals(new Char(c), new Char(_Char___init__impl__6a9atx(37)))) {
if (bytes == null) {
bytes = new Int8Array((end - index | 0) / 3 | 0);
}
var count = 0;
while (index < end ? equals(new Char(charSequenceGet(_this__u8e3s4, index)), new Char(_Char___init__impl__6a9atx(37))) : false) {
if ((index + 2 | 0) >= end) {
var tmp$ret$0;
{
var tmp0_substring = index;
var tmp1_substring = charSequenceLength(_this__u8e3s4);
tmp$ret$0 = toString(charSequenceSubSequence(_this__u8e3s4, tmp0_substring, tmp1_substring));
}
throw new URLDecodeException('Incomplete trailing HEX escape: ' + tmp$ret$0 + ', in ' + _this__u8e3s4 + ' at ' + index);
}
var digit1 = charToHexDigit(charSequenceGet(_this__u8e3s4, index + 1 | 0));
var digit2 = charToHexDigit(charSequenceGet(_this__u8e3s4, index + 2 | 0));
if (digit1 === -1 ? true : digit2 === -1) {
throw new URLDecodeException('Wrong HEX escape: %' + new Char(charSequenceGet(_this__u8e3s4, index + 1 | 0)) + new Char(charSequenceGet(_this__u8e3s4, index + 2 | 0)) + ', in ' + _this__u8e3s4 + ', at ' + index);
}
var tmp = bytes;
var tmp1 = count;
count = tmp1 + 1 | 0;
tmp[tmp1] = toByte(imul(digit1, 16) + digit2 | 0);
index = index + 3 | 0;
}
sb.sg(String_0(bytes, 0, count, charset));
} else {
sb.n6(c);
var tmp2 = index;
index = tmp2 + 1 | 0;
}
}
return sb.toString();
}
function URLDecodeException(message) {
Exception_init_$Init$(message, this);
captureStack(this, URLDecodeException);
}
URLDecodeException.$metadata$ = classMeta('URLDecodeException', undefined, undefined, undefined, undefined, Exception.prototype);
function charToHexDigit(c2) {
init_properties_Codecs_kt_hjkt7n();
var tmp0_subject = c2;
return (_Char___init__impl__6a9atx(48) <= tmp0_subject ? tmp0_subject <= _Char___init__impl__6a9atx(57) : false) ? Char__minus_impl_a2frrh_0(c2, _Char___init__impl__6a9atx(48)) : (_Char___init__impl__6a9atx(65) <= tmp0_subject ? tmp0_subject <= _Char___init__impl__6a9atx(70) : false) ? Char__minus_impl_a2frrh_0(c2, _Char___init__impl__6a9atx(65)) + 10 | 0 : (_Char___init__impl__6a9atx(97) <= tmp0_subject ? tmp0_subject <= _Char___init__impl__6a9atx(102) : false) ? Char__minus_impl_a2frrh_0(c2, _Char___init__impl__6a9atx(97)) + 10 | 0 : -1;
}
function decodeURLQueryComponent(_this__u8e3s4, start, end, plusIsSpace, charset) {
init_properties_Codecs_kt_hjkt7n();
return decodeScan(_this__u8e3s4, start, end, plusIsSpace, charset);
}
function decodeURLQueryComponent$default(_this__u8e3s4, start, end, plusIsSpace, charset, $mask0, $handler) {
if (!(($mask0 & 1) === 0))
start = 0;
if (!(($mask0 & 2) === 0))
end = _this__u8e3s4.length;
if (!(($mask0 & 4) === 0))
plusIsSpace = false;
if (!(($mask0 & 8) === 0))
charset = Charsets_getInstance().j1n_1;
return decodeURLQueryComponent(_this__u8e3s4, start, end, plusIsSpace, charset);
}
function encodeURLPath$lambda($tmp0_apply) {
return function (it) {
$tmp0_apply.sg(percentEncode(it));
return Unit_getInstance();
};
}
function encodeURLQueryComponent$lambda($spaceToPlus, $tmp0_apply, $encodeFull) {
return function (it) {
var tmp;
if (it === 32) {
var tmp_0;
if ($spaceToPlus) {
$tmp0_apply.n6(_Char___init__impl__6a9atx(43));
tmp_0 = Unit_getInstance();
} else {
$tmp0_apply.sg('%20');
tmp_0 = Unit_getInstance();
}
tmp = tmp_0;
} else if (get_URL_ALPHABET().q1(it) ? true : !$encodeFull ? get_URL_PROTOCOL_PART().q1(it) : false) {
$tmp0_apply.n6(numberToChar(it));
tmp = Unit_getInstance();
} else {
$tmp0_apply.sg(percentEncode(it));
tmp = Unit_getInstance();
}
return Unit_getInstance();
};
}
function encodeURLParameter$lambda($tmp0_apply, $spaceToPlus) {
return function (it) {
var tmp;
if (get_URL_ALPHABET().q1(it) ? true : get_OAUTH_SYMBOLS().q1(it)) {
$tmp0_apply.n6(numberToChar(it));
tmp = Unit_getInstance();
} else if ($spaceToPlus ? it === 32 : false) {
$tmp0_apply.n6(_Char___init__impl__6a9atx(43));
tmp = Unit_getInstance();
} else {
$tmp0_apply.sg(percentEncode(it));
tmp = Unit_getInstance();
}
return Unit_getInstance();
};
}
var properties_initialized_Codecs_kt_hkj9s1;
function init_properties_Codecs_kt_hjkt7n() {
if (properties_initialized_Codecs_kt_hkj9s1) {
} else {
properties_initialized_Codecs_kt_hkj9s1 = true;
var tmp$ret$2;
{
var tmp0_map = plus_0(plus(Char__rangeTo_impl_tkncvp(_Char___init__impl__6a9atx(97), _Char___init__impl__6a9atx(122)), Char__rangeTo_impl_tkncvp(_Char___init__impl__6a9atx(65), _Char___init__impl__6a9atx(90))), Char__rangeTo_impl_tkncvp(_Char___init__impl__6a9atx(48), _Char___init__impl__6a9atx(57)));
var tmp$ret$1;
{
var tmp0_mapTo = ArrayList_init_$Create$(collectionSizeOrDefault(tmp0_map, 10));
var tmp0_iterator = tmp0_map.g();
while (tmp0_iterator.h()) {
var item = tmp0_iterator.i().n1_1;
var tmp$ret$0;
{
tmp$ret$0 = Char__toByte_impl_7s7yt0(item);
}
tmp0_mapTo.a(tmp$ret$0);
}
tmp$ret$1 = tmp0_mapTo;
}
tmp$ret$2 = tmp$ret$1;
}
URL_ALPHABET = tmp$ret$2;
URL_ALPHABET_CHARS = plus_0(plus(Char__rangeTo_impl_tkncvp(_Char___init__impl__6a9atx(97), _Char___init__impl__6a9atx(122)), Char__rangeTo_impl_tkncvp(_Char___init__impl__6a9atx(65), _Char___init__impl__6a9atx(90))), Char__rangeTo_impl_tkncvp(_Char___init__impl__6a9atx(48), _Char___init__impl__6a9atx(57)));
HEX_ALPHABET = plus_0(plus(Char__rangeTo_impl_tkncvp(_Char___init__impl__6a9atx(97), _Char___init__impl__6a9atx(102)), Char__rangeTo_impl_tkncvp(_Char___init__impl__6a9atx(65), _Char___init__impl__6a9atx(70))), Char__rangeTo_impl_tkncvp(_Char___init__impl__6a9atx(48), _Char___init__impl__6a9atx(57)));
var tmp$ret$2_0;
{
var tmp0_map_0 = listOf([new Char(_Char___init__impl__6a9atx(58)), 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(91)), new Char(_Char___init__impl__6a9atx(93)), new Char(_Char___init__impl__6a9atx(64)), new Char(_Char___init__impl__6a9atx(33)), new Char(_Char___init__impl__6a9atx(36)), new Char(_Char___init__impl__6a9atx(38)), new Char(_Char___init__impl__6a9atx(39)), new Char(_Char___init__impl__6a9atx(40)), new Char(_Char___init__impl__6a9atx(41)), new Char(_Char___init__impl__6a9atx(42)), new Char(_Char___init__impl__6a9atx(44)), new Char(_Char___init__impl__6a9atx(59)), new Char(_Char___init__impl__6a9atx(61)), new Char(_Char___init__impl__6a9atx(45)), new Char(_Char___init__impl__6a9atx(46)), new Char(_Char___init__impl__6a9atx(95)), new Char(_Char___init__impl__6a9atx(126)), new Char(_Char___init__impl__6a9atx(43))]);
var tmp$ret$1_0;
{
var tmp0_mapTo_0 = ArrayList_init_$Create$(collectionSizeOrDefault(tmp0_map_0, 10));
var tmp0_iterator_0 = tmp0_map_0.g();
while (tmp0_iterator_0.h()) {
var item_0 = tmp0_iterator_0.i().n1_1;
var tmp$ret$0_0;
{
tmp$ret$0_0 = Char__toByte_impl_7s7yt0(item_0);
}
tmp0_mapTo_0.a(tmp$ret$0_0);
}
tmp$ret$1_0 = tmp0_mapTo_0;
}
tmp$ret$2_0 = tmp$ret$1_0;
}
URL_PROTOCOL_PART = tmp$ret$2_0;
VALID_PATH_PART = listOf([new Char(_Char___init__impl__6a9atx(58)), new Char(_Char___init__impl__6a9atx(64)), new Char(_Char___init__impl__6a9atx(33)), new Char(_Char___init__impl__6a9atx(36)), new Char(_Char___init__impl__6a9atx(38)), new Char(_Char___init__impl__6a9atx(39)), new Char(_Char___init__impl__6a9atx(40)), new Char(_Char___init__impl__6a9atx(41)), new Char(_Char___init__impl__6a9atx(42)), new Char(_Char___init__impl__6a9atx(43)), new Char(_Char___init__impl__6a9atx(44)), new Char(_Char___init__impl__6a9atx(59)), new Char(_Char___init__impl__6a9atx(61)), new Char(_Char___init__impl__6a9atx(45)), new Char(_Char___init__impl__6a9atx(46)), new Char(_Char___init__impl__6a9atx(95)), new Char(_Char___init__impl__6a9atx(126))]);
var tmp$ret$2_1;
{
var tmp0_map_1 = listOf([new Char(_Char___init__impl__6a9atx(45)), new Char(_Char___init__impl__6a9atx(46)), new Char(_Char___init__impl__6a9atx(95)), new Char(_Char___init__impl__6a9atx(126))]);
var tmp$ret$1_1;
{
var tmp0_mapTo_1 = ArrayList_init_$Create$(collectionSizeOrDefault(tmp0_map_1, 10));
var tmp0_iterator_1 = tmp0_map_1.g();
while (tmp0_iterator_1.h()) {
var item_1 = tmp0_iterator_1.i().n1_1;
var tmp$ret$0_1;
{
tmp$ret$0_1 = Char__toByte_impl_7s7yt0(item_1);
}
tmp0_mapTo_1.a(tmp$ret$0_1);
}
tmp$ret$1_1 = tmp0_mapTo_1;
}
tmp$ret$2_1 = tmp$ret$1_1;
}
OAUTH_SYMBOLS = tmp$ret$2_1;
LETTERS_AND_NUMBERS = plus_1(plus_1(toSet(Char__rangeTo_impl_tkncvp(_Char___init__impl__6a9atx(97), _Char___init__impl__6a9atx(122))), toSet(Char__rangeTo_impl_tkncvp(_Char___init__impl__6a9atx(65), _Char___init__impl__6a9atx(90)))), toSet(Char__rangeTo_impl_tkncvp(_Char___init__impl__6a9atx(48), _Char___init__impl__6a9atx(57))));
TOKENS = plus_1(setOf([new Char(_Char___init__impl__6a9atx(33)), new Char(_Char___init__impl__6a9atx(35)), new Char(_Char___init__impl__6a9atx(37)), new Char(_Char___init__impl__6a9atx(38)), new Char(_Char___init__impl__6a9atx(39)), new Char(_Char___init__impl__6a9atx(42)), new Char(_Char___init__impl__6a9atx(43)), new Char(_Char___init__impl__6a9atx(45)), new Char(_Char___init__impl__6a9atx(46)), new Char(_Char___init__impl__6a9atx(94)), new Char(_Char___init__impl__6a9atx(95)), new Char(_Char___init__impl__6a9atx(96)), new Char(_Char___init__impl__6a9atx(124)), new Char(_Char___init__impl__6a9atx(126))]), get_LETTERS_AND_NUMBERS());
}
}
function ContentTypeMatcher() {
}
ContentTypeMatcher.$metadata$ = interfaceMeta('ContentTypeMatcher');
function ContentType_init_$Init$(contentType, contentSubtype, parameters, $this) {
ContentType.call($this, contentType, contentSubtype, contentType + '/' + contentSubtype, parameters);
return $this;
}
function ContentType_init_$Create$(contentType, contentSubtype, parameters) {
return ContentType_init_$Init$(contentType, contentSubtype, parameters, Object.create(ContentType.prototype));
}
function ContentType_init_$Init$_0(contentType, contentSubtype, parameters, $mask0, $marker, $this) {
if (!(($mask0 & 4) === 0))
parameters = emptyList();
ContentType_init_$Init$(contentType, contentSubtype, parameters, $this);
return $this;
}
function ContentType_init_$Create$_0(contentType, contentSubtype, parameters, $mask0, $marker) {
return ContentType_init_$Init$_0(contentType, contentSubtype, parameters, $mask0, $marker, Object.create(ContentType.prototype));
}
function hasParameter($this, name, value) {
var tmp0_subject = $this.t23().j();
var tmp;
switch (tmp0_subject) {
case 0:
tmp = false;
break;
case 1:
var tmp$ret$1;
{
var tmp0_let = $this.t23().l(0);
{
}
var tmp$ret$0;
{
tmp$ret$0 = equals_0(tmp0_let.u23_1, name, true) ? equals_0(tmp0_let.v23_1, value, true) : false;
}
tmp$ret$1 = tmp$ret$0;
}
tmp = tmp$ret$1;
break;
default:
var tmp$ret$2;
$l$block_0: {
var tmp1_any = $this.t23();
var tmp_0;
if (isInterface(tmp1_any, Collection)) {
tmp_0 = tmp1_any.m();
} else {
tmp_0 = false;
}
if (tmp_0) {
tmp$ret$2 = false;
break $l$block_0;
}
var tmp0_iterator = tmp1_any.g();
while (tmp0_iterator.h()) {
var element = tmp0_iterator.i();
var tmp$ret$3;
{
tmp$ret$3 = equals_0(element.u23_1, name, true) ? equals_0(element.v23_1, value, true) : false;
}
if (tmp$ret$3) {
tmp$ret$2 = true;
break $l$block_0;
}
}
tmp$ret$2 = false;
}
tmp = tmp$ret$2;
break;
}
return tmp;
}
function Companion() {
Companion_instance = this;
var tmp = this;
tmp.w23_1 = ContentType_init_$Create$_0('*', '*', null, 4, null);
}
Companion.prototype.x23 = function (value) {
if (isBlank(value))
return this.w23_1;
var tmp$ret$10;
{
var tmp0_parse = Companion_getInstance_1();
var headerValue = single(parseHeaderValue(value));
var tmp$ret$9;
{
var tmp1__anonymous__uwfjfc = headerValue.y23_1;
var tmp2__anonymous__z9zvc9 = headerValue.z23_1;
var tmp = _Char___init__impl__6a9atx(47);
var slash = indexOf$default(tmp1__anonymous__uwfjfc, tmp, 0, false, 6, null);
if (slash === -1) {
var tmp$ret$0;
{
tmp$ret$0 = toString(trim(isCharSequence(tmp1__anonymous__uwfjfc) ? tmp1__anonymous__uwfjfc : THROW_CCE()));
}
if (tmp$ret$0 === '*') {
return Companion_getInstance_0().w23_1;
}
throw new BadContentTypeFormatException(value);
}
var tmp$ret$3;
{
var tmp$ret$2;
{
var tmp$ret$1;
{
tmp$ret$1 = tmp1__anonymous__uwfjfc;
}
tmp$ret$2 = tmp$ret$1.substring(0, slash);
}
var tmp0_trim = tmp$ret$2;
tmp$ret$3 = toString(trim(isCharSequence(tmp0_trim) ? tmp0_trim : THROW_CCE()));
}
var type = tmp$ret$3;
var tmp$ret$4;
{
tmp$ret$4 = charSequenceLength(type) === 0;
}
if (tmp$ret$4) {
throw new BadContentTypeFormatException(value);
}
var tmp$ret$7;
{
var tmp$ret$6;
{
var tmp1_substring = slash + 1 | 0;
var tmp$ret$5;
{
tmp$ret$5 = tmp1__anonymous__uwfjfc;
}
tmp$ret$6 = tmp$ret$5.substring(tmp1_substring);
}
var tmp2_trim = tmp$ret$6;
tmp$ret$7 = toString(trim(isCharSequence(tmp2_trim) ? tmp2_trim : THROW_CCE()));
}
var subtype = tmp$ret$7;
var tmp_0;
var tmp_1 = _Char___init__impl__6a9atx(32);
if (contains$default(type, tmp_1, false, 2, null)) {
tmp_0 = true;
} else {
var tmp_2 = _Char___init__impl__6a9atx(32);
tmp_0 = contains$default(subtype, tmp_2, false, 2, null);
}
if (tmp_0) {
throw new BadContentTypeFormatException(value);
}
var tmp_3;
var tmp$ret$8;
{
tmp$ret$8 = charSequenceLength(subtype) === 0;
}
if (tmp$ret$8) {
tmp_3 = true;
} else {
var tmp_4 = _Char___init__impl__6a9atx(47);
tmp_3 = contains$default(subtype, tmp_4, false, 2, null);
}
if (tmp_3) {
throw new BadContentTypeFormatException(value);
}
tmp$ret$9 = ContentType_init_$Create$(type, subtype, tmp2__anonymous__z9zvc9);
}
tmp$ret$10 = tmp$ret$9;
}
return tmp$ret$10;
};
Companion.prototype.b24 = function () {
return this.w23_1;
};
Companion.$metadata$ = objectMeta('Companion');
var Companion_instance;
function Companion_getInstance_0() {
if (Companion_instance == null)
new Companion();
return Companion_instance;
}
function Application() {
Application_instance = this;
var tmp = this;
tmp.c24_1 = ContentType_init_$Create$_0('application', '*', null, 4, null);
var tmp_0 = this;
tmp_0.d24_1 = ContentType_init_$Create$_0('application', 'atom+xml', null, 4, null);
var tmp_1 = this;
tmp_1.e24_1 = ContentType_init_$Create$_0('application', 'cbor', null, 4, null);
var tmp_2 = this;
tmp_2.f24_1 = ContentType_init_$Create$_0('application', 'json', null, 4, null);
var tmp_3 = this;
tmp_3.g24_1 = ContentType_init_$Create$_0('application', 'hal+json', null, 4, null);
var tmp_4 = this;
tmp_4.h24_1 = ContentType_init_$Create$_0('application', 'javascript', null, 4, null);
var tmp_5 = this;
tmp_5.i24_1 = ContentType_init_$Create$_0('application', 'octet-stream', null, 4, null);
var tmp_6 = this;
tmp_6.j24_1 = ContentType_init_$Create$_0('application', 'font-woff', null, 4, null);
var tmp_7 = this;
tmp_7.k24_1 = ContentType_init_$Create$_0('application', 'rss+xml', null, 4, null);
var tmp_8 = this;
tmp_8.l24_1 = ContentType_init_$Create$_0('application', 'xml', null, 4, null);
var tmp_9 = this;
tmp_9.m24_1 = ContentType_init_$Create$_0('application', 'xml-dtd', null, 4, null);
var tmp_10 = this;
tmp_10.n24_1 = ContentType_init_$Create$_0('application', 'zip', null, 4, null);
var tmp_11 = this;
tmp_11.o24_1 = ContentType_init_$Create$_0('application', 'gzip', null, 4, null);
var tmp_12 = this;
tmp_12.p24_1 = ContentType_init_$Create$_0('application', 'x-www-form-urlencoded', null, 4, null);
var tmp_13 = this;
tmp_13.q24_1 = ContentType_init_$Create$_0('application', 'pdf', null, 4, null);
var tmp_14 = this;
tmp_14.r24_1 = ContentType_init_$Create$_0('application', 'protobuf', null, 4, null);
var tmp_15 = this;
tmp_15.s24_1 = ContentType_init_$Create$_0('application', 'wasm', null, 4, null);
var tmp_16 = this;
tmp_16.t24_1 = ContentType_init_$Create$_0('application', 'problem+json', null, 4, null);
var tmp_17 = this;
tmp_17.u24_1 = ContentType_init_$Create$_0('application', 'problem+xml', null, 4, null);
}
Application.$metadata$ = objectMeta('Application');
var Application_instance;
function Application_getInstance() {
if (Application_instance == null)
new Application();
return Application_instance;
}
function Text() {
Text_instance = this;
var tmp = this;
tmp.v24_1 = ContentType_init_$Create$_0('text', '*', null, 4, null);
var tmp_0 = this;
tmp_0.w24_1 = ContentType_init_$Create$_0('text', 'plain', null, 4, null);
var tmp_1 = this;
tmp_1.x24_1 = ContentType_init_$Create$_0('text', 'css', null, 4, null);
var tmp_2 = this;
tmp_2.y24_1 = ContentType_init_$Create$_0('text', 'csv', null, 4, null);
var tmp_3 = this;
tmp_3.z24_1 = ContentType_init_$Create$_0('text', 'html', null, 4, null);
var tmp_4 = this;
tmp_4.a25_1 = ContentType_init_$Create$_0('text', 'javascript', null, 4, null);
var tmp_5 = this;
tmp_5.b25_1 = ContentType_init_$Create$_0('text', 'vcard', null, 4, null);
var tmp_6 = this;
tmp_6.c25_1 = ContentType_init_$Create$_0('text', 'xml', null, 4, null);
var tmp_7 = this;
tmp_7.d25_1 = ContentType_init_$Create$_0('text', 'event-stream', null, 4, null);
}
Text.$metadata$ = objectMeta('Text');
var Text_instance;
function Text_getInstance() {
if (Text_instance == null)
new Text();
return Text_instance;
}
function ContentType(contentType, contentSubtype, existingContent, parameters) {
Companion_getInstance_0();
HeaderValueWithParameters.call(this, existingContent, parameters);
this.g25_1 = contentType;
this.h25_1 = contentSubtype;
}
ContentType.prototype.i25 = function (name, value) {
if (hasParameter(this, name, value))
return this;
return new ContentType(this.g25_1, this.h25_1, this.j25(), plus_2(this.t23(), new HeaderValueParam(name, value)));
};
ContentType.prototype.k25 = function () {
var tmp;
if (this.t23().m()) {
tmp = this;
} else {
tmp = ContentType_init_$Create$_0(this.g25_1, this.h25_1, null, 4, null);
}
return tmp;
};
ContentType.prototype.l25 = function (pattern) {
if (!(pattern.g25_1 === '*') ? !equals_0(pattern.g25_1, this.g25_1, true) : false) {
return false;
}
if (!(pattern.h25_1 === '*') ? !equals_0(pattern.h25_1, this.h25_1, true) : false) {
return false;
}
var tmp0_iterator = pattern.t23().g();
while (tmp0_iterator.h()) {
var tmp1_loop_parameter = tmp0_iterator.i();
var patternName = tmp1_loop_parameter.k4();
var patternValue = tmp1_loop_parameter.l4();
var tmp2_subject = patternName;
var tmp;
if (tmp2_subject === '*') {
var tmp3_subject = patternValue;
var tmp_0;
if (tmp3_subject === '*') {
tmp_0 = true;
} else {
var tmp$ret$0;
$l$block_0: {
var tmp0_any = this.t23();
var tmp_1;
if (isInterface(tmp0_any, Collection)) {
tmp_1 = tmp0_any.m();
} else {
tmp_1 = false;
}
if (tmp_1) {
tmp$ret$0 = false;
break $l$block_0;
}
var tmp0_iterator_0 = tmp0_any.g();
while (tmp0_iterator_0.h()) {
var element = tmp0_iterator_0.i();
var tmp$ret$1;
{
tmp$ret$1 = equals_0(element.v23_1, patternValue, true);
}
if (tmp$ret$1) {
tmp$ret$0 = true;
break $l$block_0;
}
}
tmp$ret$0 = false;
}
tmp_0 = tmp$ret$0;
}
tmp = tmp_0;
} else {
var value = this.m25(patternName);
var tmp4_subject = patternValue;
tmp = tmp4_subject === '*' ? !(value == null) : equals_0(value, patternValue, true);
}
var matches = tmp;
if (!matches) {
return false;
}
}
return true;
};
ContentType.prototype.equals = function (other) {
var tmp;
var tmp_0;
var tmp_1;
if (other instanceof ContentType) {
tmp_1 = equals_0(this.g25_1, other.g25_1, true);
} else {
tmp_1 = false;
}
if (tmp_1) {
tmp_0 = equals_0(this.h25_1, other.h25_1, true);
} else {
tmp_0 = false;
}
if (tmp_0) {
tmp = equals(this.t23(), other.t23());
} else {
tmp = false;
}
return tmp;
};
ContentType.prototype.hashCode = function () {
var tmp$ret$1;
{
var tmp0_toLowerCase = this.g25_1;
var tmp$ret$0;
{
tmp$ret$0 = tmp0_toLowerCase;
}
tmp$ret$1 = tmp$ret$0.toLowerCase();
}
var result = getStringHashCode(tmp$ret$1);
var tmp = result;
var tmp_0 = imul(31, result);
var tmp$ret$3;
{
var tmp1_toLowerCase = this.h25_1;
var tmp$ret$2;
{
tmp$ret$2 = tmp1_toLowerCase;
}
tmp$ret$3 = tmp$ret$2.toLowerCase();
}
result = tmp + (tmp_0 + getStringHashCode(tmp$ret$3) | 0) | 0;
result = result + imul(31, hashCode(this.t23())) | 0;
return result;
};
ContentType.$metadata$ = classMeta('ContentType', undefined, undefined, undefined, undefined, HeaderValueWithParameters.prototype);
function BadContentTypeFormatException(value) {
Exception_init_$Init$('Bad Content-Type format: ' + value, this);
captureStack(this, BadContentTypeFormatException);
}
BadContentTypeFormatException.$metadata$ = classMeta('BadContentTypeFormatException', undefined, undefined, undefined, undefined, Exception.prototype);
function charset(_this__u8e3s4) {
var tmp0_safe_receiver = _this__u8e3s4.m25('charset');
var tmp;
if (tmp0_safe_receiver == null) {
tmp = null;
} else {
var tmp$ret$1;
{
{
}
var tmp$ret$0;
{
var tmp_0;
try {
tmp_0 = Companion_getInstance().w1s(tmp0_safe_receiver);
} catch ($p) {
var tmp_1;
if ($p instanceof IllegalArgumentException) {
tmp_1 = null;
} else {
throw $p;
}
tmp_0 = tmp_1;
}
tmp$ret$0 = tmp_0;
}
tmp$ret$1 = tmp$ret$0;
}
tmp = tmp$ret$1;
}
return tmp;
}
function withCharset(_this__u8e3s4, charset) {
return _this__u8e3s4.i25('charset', get_name(charset));
}
function get_HeaderFieldValueSeparators() {
init_properties_HeaderValueWithParameters_kt_2dfzmo();
return HeaderFieldValueSeparators;
}
var HeaderFieldValueSeparators;
function Companion_0() {
Companion_instance_0 = this;
}
Companion_0.prototype.n25 = function (value, init) {
var headerValue = single(parseHeaderValue(value));
return init(headerValue.y23_1, headerValue.z23_1);
};
Companion_0.$metadata$ = objectMeta('Companion');
var Companion_instance_0;
function Companion_getInstance_1() {
if (Companion_instance_0 == null)
new Companion_0();
return Companion_instance_0;
}
function HeaderValueWithParameters(content, parameters) {
Companion_getInstance_1();
this.r23_1 = content;
this.s23_1 = parameters;
}
HeaderValueWithParameters.prototype.j25 = function () {
return this.r23_1;
};
HeaderValueWithParameters.prototype.t23 = function () {
return this.s23_1;
};
HeaderValueWithParameters.prototype.m25 = function (name) {
var tmp$ret$1;
$l$block: {
var tmp0_firstOrNull = this.s23_1;
var tmp0_iterator = tmp0_firstOrNull.g();
while (tmp0_iterator.h()) {
var element = tmp0_iterator.i();
var tmp$ret$0;
{
tmp$ret$0 = equals_0(element.u23_1, name, true);
}
if (tmp$ret$0) {
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.v23_1;
};
HeaderValueWithParameters.prototype.toString = function () {
var tmp;
if (this.s23_1.m()) {
tmp = this.r23_1;
} else {
var tmp_0 = this.r23_1.length;
var tmp$ret$1;
{
var tmp0_sumBy = this.s23_1;
var sum = 0;
var tmp0_iterator = tmp0_sumBy.g();
while (tmp0_iterator.h()) {
var element = tmp0_iterator.i();
var tmp_1 = sum;
var tmp$ret$0;
{
tmp$ret$0 = (element.u23_1.length + element.v23_1.length | 0) + 3 | 0;
}
sum = tmp_1 + tmp$ret$0 | 0;
}
tmp$ret$1 = sum;
}
var size = tmp_0 + tmp$ret$1 | 0;
var tmp$ret$2;
{
var tmp1_apply = StringBuilder_init_$Create$_0(size);
{
}
{
tmp1_apply.sg(this.r23_1);
var inductionVariable = 0;
var last = this.s23_1.j();
if (inductionVariable < last)
do {
var index = inductionVariable;
inductionVariable = inductionVariable + 1 | 0;
var tmp1_container = this.s23_1.l(index);
var name = tmp1_container.k4();
var value = tmp1_container.l4();
tmp1_apply.sg('; ');
tmp1_apply.sg(name);
tmp1_apply.sg('=');
{
if (checkNeedEscape$accessor$vynnj(value)) {
tmp1_apply.sg(quote(value));
} else {
tmp1_apply.sg(value);
}
}
}
while (inductionVariable < last);
}
tmp$ret$2 = tmp1_apply;
}
tmp = tmp$ret$2.toString();
}
return tmp;
};
HeaderValueWithParameters.$metadata$ = classMeta('HeaderValueWithParameters');
function escapeIfNeededTo(_this__u8e3s4, out) {
init_properties_HeaderValueWithParameters_kt_2dfzmo();
if (checkNeedEscape$accessor$vynnj(_this__u8e3s4)) {
out.sg(quote(_this__u8e3s4));
} else {
out.sg(_this__u8e3s4);
}
}
function checkNeedEscape(_this__u8e3s4) {
init_properties_HeaderValueWithParameters_kt_2dfzmo();
var tmp$ret$0;
{
tmp$ret$0 = charSequenceLength(_this__u8e3s4) === 0;
}
if (tmp$ret$0)
return true;
if (isQuoted(_this__u8e3s4))
return false;
var inductionVariable = 0;
var last = _this__u8e3s4.length;
if (inductionVariable < last)
do {
var index = inductionVariable;
inductionVariable = inductionVariable + 1 | 0;
if (get_HeaderFieldValueSeparators().q1(new Char(charSequenceGet(_this__u8e3s4, index))))
return true;
}
while (inductionVariable < last);
return false;
}
function quote(_this__u8e3s4) {
init_properties_HeaderValueWithParameters_kt_2dfzmo();
var tmp$ret$1;
{
{
}
var tmp$ret$0;
{
var tmp0_apply = StringBuilder_init_$Create$();
{
}
{
quoteTo(_this__u8e3s4, tmp0_apply);
}
tmp$ret$0 = tmp0_apply;
}
tmp$ret$1 = tmp$ret$0.toString();
}
return tmp$ret$1;
}
function isQuoted(_this__u8e3s4) {
init_properties_HeaderValueWithParameters_kt_2dfzmo();
if (_this__u8e3s4.length < 2) {
return false;
}
if (!equals(new Char(first(_this__u8e3s4)), new Char(_Char___init__impl__6a9atx(34))) ? true : !equals(new Char(last(_this__u8e3s4)), new Char(_Char___init__impl__6a9atx(34)))) {
return false;
}
var startIndex = 1;
$l$loop: do {
var tmp = _Char___init__impl__6a9atx(34);
var tmp_0 = startIndex;
var index = indexOf$default(_this__u8e3s4, tmp, tmp_0, false, 4, null);
if (index === get_lastIndex(_this__u8e3s4)) {
break $l$loop;
}
var slashesCount = 0;
var slashIndex = index - 1 | 0;
while (equals(new Char(charSequenceGet(_this__u8e3s4, slashIndex)), new Char(_Char___init__impl__6a9atx(92)))) {
var tmp0 = slashesCount;
slashesCount = tmp0 + 1 | 0;
var tmp1 = slashIndex;
slashIndex = tmp1 - 1 | 0;
}
if ((slashesCount % 2 | 0) === 0) {
return false;
}
startIndex = index + 1 | 0;
}
while (startIndex < _this__u8e3s4.length);
return true;
}
function quoteTo(_this__u8e3s4, out) {
init_properties_HeaderValueWithParameters_kt_2dfzmo();
out.sg('"');
var inductionVariable = 0;
var last = _this__u8e3s4.length;
if (inductionVariable < last)
do {
var i = inductionVariable;
inductionVariable = inductionVariable + 1 | 0;
var ch = charSequenceGet(_this__u8e3s4, i);
var tmp1_subject = ch;
if (equals(new Char(tmp1_subject), new Char(_Char___init__impl__6a9atx(92)))) {
out.sg('\\\\');
} else if (equals(new Char(tmp1_subject), new Char(_Char___init__impl__6a9atx(10)))) {
out.sg('\\n');
} else if (equals(new Char(tmp1_subject), new Char(_Char___init__impl__6a9atx(13)))) {
out.sg('\\r');
} else if (equals(new Char(tmp1_subject), new Char(_Char___init__impl__6a9atx(9)))) {
out.sg('\\t');
} else if (equals(new Char(tmp1_subject), ne