@kform/core
Version:
JavaScript bindings for KForm.
1,138 lines • 338 kB
JavaScript
import {
VOID3gxj6tk5isa35 as VOID,
initMetadataForCompanion1wyw17z38v6ac as initMetadataForCompanion,
Comparable198qfk8pnblz0 as Comparable,
initMetadataForInterface1egvbzx539z91 as initMetadataForInterface,
initMetadataForClassbxx6q50dy2s7 as initMetadataForClass,
THROW_CCE2g6jy02ryeudk as THROW_CCE,
contains21620uw5ew03f as contains,
protoOf180f3jzyo7rfj as protoOf,
isEmpty2lvc2zgoeh0ds as isEmpty,
ClosedRangehokgr73im9z3 as ClosedRange,
Iterable1y3qizuf89iou as Iterable,
Long2qws0ah9gnpki as Long,
ensureNotNull1e947j3ixpazm as ensureNotNull,
Unit_instance1fbcbse1fwigr as Unit_instance,
createThis2j2avj17cvnv2 as createThis,
longArray288a0fctlmjmj as longArray,
toLongw1zpgk99d84b as toLong,
_Char___init__impl__6a9atx2js6krycynjoo as _Char___init__impl__6a9atx,
charArrayOf27f4r3dozbrk1 as charArrayOf,
NumberFormatException3bgsm2s9o4t55 as NumberFormatException,
Char__minus_impl_a2frrh3548ixwefqxih as Char__minus_impl_a2frrh,
copyOf2ng0t8oizk6it as copyOf,
abs22kdeprm0tm5i as abs,
ArithmeticException18dajwq7kbp38 as ArithmeticException,
IllegalArgumentException2asla15b5jaob as IllegalArgumentException,
toString1pkumu07cwy4m as toString,
AssertionError3yq7q0knw9m5 as AssertionError,
numberToLong1a4cndvg6c52s as numberToLong,
get_signed9wrgmju9wx as get_sign,
longArrayOf1jqne2a8v34i5 as longArrayOf,
StringBuildermazzzhj6kkai as StringBuilder,
initMetadataForObject1cxne3s9w65el as initMetadataForObject,
charArray2ujmm1qusno00 as charArray,
removeRange2614yh20qvds6 as removeRange,
Char19o2r8palgjof as Char,
toString3o7ifthqydp6e as toString_0,
RuntimeException1r3t0zl97011n as RuntimeException,
IndexOutOfBoundsException1qfr429iumro0 as IndexOutOfBoundsException,
isInfinite12nl8hpz1hbp2 as isInfinite,
toBitszo75lm27azgm as toBits,
Paire9pteg33gng7 as Pair,
abs1kdzbjes1idip as abs_0,
isInterface3d6p8outrmvmk as isInterface,
toByte4i43936u611k as toByte,
numberToChar93r9buh19yek as numberToChar,
toShort36kaw0zjdq3ex as toShort,
toDouble1kn912gjoizjp as toDouble,
copyOfRange1v9olvyjr7c0r as copyOfRange,
round2mrvepag8eey0 as round,
numberToInt1ygmcfwhs2fkq as numberToInt,
requireNoNullssrvzhcmkbjy6 as requireNoNulls,
concatToString2syawgu50khxi as concatToString,
Default_getInstance3u4i6y54ri5cn as Default_getInstance,
until1jbpn0z3f8lbg as until,
ArrayList3it5z8td81qkl as ArrayList,
collectionSizeOrDefault36dulx8yinfqm as collectionSizeOrDefault,
copyToArray2j022khrow2yi as copyToArray,
copyOf3rutauicler23 as copyOf_0,
IllegalStateExceptionkoljg5n0nrlr as IllegalStateException,
toString28s61jeiy4rb0 as toString_1,
substringiqarkczpya5m as substring,
numberRangeToNumber25vse2rgp6rs8 as numberRangeToNumber,
contains2c50nlxg7en7o as contains_0,
lastIndexOfpmd3ei5son2n as lastIndexOf,
charCodeAt1yspne1d8erbm as charCodeAt,
toInt5qdj874w69jh as toInt,
throwKotlinNothingValueException2lxmvl03dor6f as throwKotlinNothingValueException,
defineProp3hxgpk2knu2px as defineProp,
equals2au1ep9vhcato as equals,
THROW_IAE23kobfj9wdoxr as THROW_IAE,
Enum3alwj03lh1n41 as Enum,
Char__plus_impl_qi7pgj3akekecdud2w6 as Char__plus_impl_qi7pgj,
replaceFirst16v6kjg1scqx4 as replaceFirst,
contains3ue2qo8xhmpf1 as contains_1,
charSequenceLength3278n89t01tmv as charSequenceLength,
charSequenceGet1vxk1y5n17t1z as charSequenceGet,
isArray1hxjqtqy632bc as isArray,
isNumberiramasdbon0i as isNumber,
DoubleCompanionObject_instance3q51gr7gsd0au as DoubleCompanionObject_instance,
setOf45ia9pnfhe90 as setOf,
} from './kotlin-kotlin-stdlib.mjs';
//region block: imports
var imul = Math.imul;
//endregion
//region block: pre-declaration
class Companion {
constructor() {
Companion_instance = this;
this.ZERO = BigDecimals_getInstance().ct_1;
this.ONE = BigDecimals_getInstance().dt_1;
this.TWO = BigDecimals_getInstance().et_1;
this.TEN = BigDecimals_getInstance().ft_1;
this.ONE_TENTH = BigDecimals_getInstance().gt_1;
this.ONE_HALF = BigDecimals_getInstance().ht_1;
this.PI = BigDecimals_getInstance().it_1;
this.E = BigDecimals_getInstance().jt_1;
}
kt() {
return this.ZERO;
}
lt() {
return this.ONE;
}
mt() {
return this.TWO;
}
nt() {
return this.TEN;
}
ot() {
return this.ONE_TENTH;
}
pt() {
return this.ONE_HALF;
}
qt() {
return this.PI;
}
rt() {
return this.E;
}
ofScaledLong(unscaledVal, scale) {
return bigDecimalOf(unscaledVal, scale);
}
ofScaledLongWithPrecision(unscaledVal, scale, prec) {
return bigDecimalOf_0(unscaledVal, scale, prec);
}
ofInt(val) {
return bigDecimalOf_1(val);
}
of(val) {
return bigDecimalOf_2(val);
}
ofScaledBigIntegerWithPrecision(intVal, scale, prec) {
return bigDecimalOf_3(intVal, scale, prec);
}
st(val, ctx) {
return bigDecimalOf_4(val, ctx);
}
ofDouble(val, ctx, $super) {
ctx = ctx === VOID ? null : ctx;
return $super === VOID ? this.st(val, ctx) : $super.st.call(this, val, ctx);
}
tt(val, ctx) {
return bigDecimalOf_5(val, ctx);
}
ofFloat(val, ctx, $super) {
ctx = ctx === VOID ? null : ctx;
return $super === VOID ? this.tt(val, ctx) : $super.tt.call(this, val, ctx);
}
ut(val, ctx) {
return bigDecimalOf_6(val, ctx);
}
parse(val, ctx, $super) {
ctx = ctx === VOID ? null : ctx;
return $super === VOID ? this.ut(val, ctx) : $super.ut.call(this, val, ctx);
}
vt(val, ctx) {
return bigDecimalOf_7(val, ctx);
}
ofBigInteger(val, ctx, $super) {
ctx = ctx === VOID ? null : ctx;
return $super === VOID ? this.vt(val, ctx) : $super.vt.call(this, val, ctx);
}
ofIntWithContext(val, ctx) {
return bigDecimalOf_8(val, ctx);
}
ofWithContext(val, ctx) {
return bigDecimalOf_9(val, ctx);
}
}
class BigDecimal_0 {}
function sqrt(mc, $super) {
mc = mc === VOID ? new MathContext() : mc;
return $super === VOID ? this.bu(mc) : $super.bu.call(this, mc);
}
class Companion_0 {
constructor() {
Companion_instance_0 = this;
this.ZERO = BigIntegers_getInstance().du_1;
this.ONE = BigIntegers_getInstance().eu_1;
this.TWO = BigIntegers_getInstance().fu_1;
this.NEGATIVE_ONE = BigIntegers_getInstance().hu_1;
this.TEN = BigIntegers_getInstance().gu_1;
}
kt() {
return this.ZERO;
}
lt() {
return this.ONE;
}
mt() {
return this.TWO;
}
iu() {
return this.NEGATIVE_ONE;
}
nt() {
return this.TEN;
}
probablePrime(bitLength, rnd) {
return bigProbablePrimeInteger(bitLength, rnd);
}
ofLong(value) {
return bigIntegerOf(value);
}
of(value) {
return bigIntegerOf_0(value);
}
parse(value) {
return bigIntegerOf_1(value);
}
parseWithRadix(value, radix) {
return bigIntegerOf_2(value, radix);
}
ofIntArray(value) {
return bigIntegerOf_3(value);
}
ofSlideIntArray(signum, magnitude, off, len) {
return bigIntegerOf_4(signum, magnitude, off, len);
}
}
class BigInteger_0 {}
function rangeTo(endInclusive) {
return new BigIntegerRange(this, endInclusive);
}
function rangeToInt(endInclusive) {
return new BigIntegerRange(this, Companion_getInstance_0().of(endInclusive));
}
function rangeToLong(endInclusive) {
return new BigIntegerRange(this, Companion_getInstance_0().ofLong(endInclusive));
}
function plusInt(other) {
return this.plus(Companion_getInstance_0().of(other));
}
function plusLong(other) {
return this.plus(Companion_getInstance_0().ofLong(other));
}
function minusInt(other) {
return this.minus(Companion_getInstance_0().of(other));
}
function minusLong(other) {
return this.minus(Companion_getInstance_0().ofLong(other));
}
function timesInt(other) {
return this.times(Companion_getInstance_0().of(other));
}
function timesLong(other) {
return this.times(Companion_getInstance_0().ofLong(other));
}
function divInt(other) {
return this.div(Companion_getInstance_0().of(other));
}
function divLong(other) {
return this.div(Companion_getInstance_0().ofLong(other));
}
function divideAndRemainderInt(other) {
return this.divideAndRemainder(Companion_getInstance_0().of(other));
}
function divideAndRemainderLong(other) {
return this.divideAndRemainder(Companion_getInstance_0().ofLong(other));
}
function reminderInt(other) {
return this.reminder(Companion_getInstance_0().of(other));
}
function reminderLong(other) {
return this.reminder(Companion_getInstance_0().ofLong(other));
}
function gcdInt(other) {
return this.gcd(Companion_getInstance_0().of(other));
}
function gcdLong(other) {
return this.gcd(Companion_getInstance_0().ofLong(other));
}
function remInt(modulus) {
return this.rem(Companion_getInstance_0().of(modulus));
}
function remLong(modulus) {
return this.rem(Companion_getInstance_0().ofLong(modulus));
}
function modInverseInt(modulus) {
return this.modInverse(Companion_getInstance_0().of(modulus));
}
function modInverseLong(modulus) {
return this.modInverse(Companion_getInstance_0().ofLong(modulus));
}
function andInt(other) {
return this.and(Companion_getInstance_0().of(other));
}
function andLong(other) {
return this.and(Companion_getInstance_0().ofLong(other));
}
function orInt(other) {
return this.or(Companion_getInstance_0().of(other));
}
function orLong(other) {
return this.or(Companion_getInstance_0().ofLong(other));
}
function xorInt(other) {
return this.xor(Companion_getInstance_0().of(other));
}
function xorLong(other) {
return this.xor(Companion_getInstance_0().ofLong(other));
}
function andNotInt(other) {
return this.andNot(Companion_getInstance_0().of(other));
}
function andNotLong(other) {
return this.andNot(Companion_getInstance_0().ofLong(other));
}
class BigIntegerRange$iterator$1 {
constructor(this$0) {
this.nu_1 = this$0;
this.mu_1 = this$0.ou_1;
}
a1() {
return this.mu_1.lu(this.nu_1.pu_1) <= 0;
}
b1() {
var temp = this.mu_1;
this.mu_1 = this.mu_1.plus(Companion_getInstance_0().ONE);
return temp;
}
}
class BigIntegerRange {
constructor(start, endInclusive) {
this.ou_1 = start;
this.pu_1 = endInclusive;
}
o1() {
return this.ou_1;
}
p1() {
return this.pu_1;
}
z() {
return new BigIntegerRange$iterator$1(this);
}
jm() {
return this.ou_1;
}
km() {
return this.pu_1;
}
qu(start, endInclusive) {
return new BigIntegerRange(start, endInclusive);
}
copy(start, endInclusive, $super) {
start = start === VOID ? this.ou_1 : start;
endInclusive = endInclusive === VOID ? this.pu_1 : endInclusive;
return $super === VOID ? this.qu(start, endInclusive) : $super.qu.call(this, start, endInclusive);
}
toString() {
return 'BigIntegerRange(start=' + this.ou_1.toString() + ', endInclusive=' + this.pu_1.toString() + ')';
}
hashCode() {
var result = this.ou_1.hashCode();
result = imul(result, 31) + this.pu_1.hashCode() | 0;
return result;
}
equals(other) {
if (this === other)
return true;
if (!(other instanceof BigIntegerRange))
return false;
var tmp0_other_with_cast = other instanceof BigIntegerRange ? other : THROW_CCE();
if (!this.ou_1.equals(tmp0_other_with_cast.ou_1))
return false;
if (!this.pu_1.equals(tmp0_other_with_cast.pu_1))
return false;
return true;
}
}
class Companion_1 {
constructor() {
Companion_instance_1 = this;
this.tu_1 = BitSieve.uu();
}
}
class BitSieve {
static uu() {
Companion_getInstance_1();
var $this = createThis(this);
init_org_gciatto_kt_math_BitSieve($this);
$this.su_1 = 9600;
$this.ru_1 = longArray(unitIndex(Companion_getInstance_1(), $this.su_1 - 1 | 0) + 1 | 0);
set($this, 0);
var nextIndex = 1;
var nextPrime = 3;
do {
sieveSingle($this, $this.su_1, nextIndex + nextPrime | 0, nextPrime);
nextIndex = sieveSearch($this, $this.su_1, nextIndex + 1 | 0);
nextPrime = imul(2, nextIndex) + 1 | 0;
}
while (nextIndex > 0 && nextPrime < $this.su_1);
return $this;
}
static vu(base, searchLen) {
Companion_getInstance_1();
var $this = createThis(this);
init_org_gciatto_kt_math_BitSieve($this);
$this.ru_1 = longArray(unitIndex(Companion_getInstance_1(), searchLen - 1 | 0) + 1 | 0);
$this.su_1 = searchLen;
var start = 0;
var step = sieveSearch(Companion_getInstance_1().tu_1, Companion_getInstance_1().tu_1.su_1, start);
var convertedStep = imul(step, 2) + 1 | 0;
var b = MutableBigInteger.zu(base);
var q = MutableBigInteger.av();
do {
start = b.bv(convertedStep, q);
start = convertedStep - start | 0;
if ((start % 2 | 0) === 0) {
start = start + convertedStep | 0;
}
sieveSingle($this, searchLen, (start - 1 | 0) / 2 | 0, convertedStep);
step = sieveSearch(Companion_getInstance_1().tu_1, Companion_getInstance_1().tu_1.su_1, step + 1 | 0);
convertedStep = imul(step, 2) + 1 | 0;
}
while (step > 0);
return $this;
}
cv(initValue, certainty, random) {
var offset = 1;
var inductionVariable = 0;
var last = ensureNotNull(this.ru_1).length - 1 | 0;
if (inductionVariable <= last)
do {
var i = inductionVariable;
inductionVariable = inductionVariable + 1 | 0;
var nextLong = ensureNotNull(this.ru_1)[i].w3();
var inductionVariable_0 = 0;
if (inductionVariable_0 <= 63)
do {
var j = inductionVariable_0;
inductionVariable_0 = inductionVariable_0 + 1 | 0;
if (nextLong.a4(new Long(1, 0)).equals(new Long(1, 0))) {
var candidate = initValue.plus(Companion_getInstance_4().ofLong(toLong(offset)));
if (candidate.jv(certainty, random)) {
return candidate;
}
}
nextLong = nextLong.z3(1);
offset = offset + 2 | 0;
}
while (inductionVariable_0 <= 63);
}
while (inductionVariable <= last);
return null;
}
}
class Companion_2 {
constructor() {
Companion_instance_2 = this;
var tmp = this;
// Inline function 'kotlin.charArrayOf' call
tmp.kv_1 = charArrayOf([_Char___init__impl__6a9atx(48), _Char___init__impl__6a9atx(48), _Char___init__impl__6a9atx(48), _Char___init__impl__6a9atx(48), _Char___init__impl__6a9atx(48), _Char___init__impl__6a9atx(48), _Char___init__impl__6a9atx(48), _Char___init__impl__6a9atx(48), _Char___init__impl__6a9atx(48), _Char___init__impl__6a9atx(48), _Char___init__impl__6a9atx(49), _Char___init__impl__6a9atx(49), _Char___init__impl__6a9atx(49), _Char___init__impl__6a9atx(49), _Char___init__impl__6a9atx(49), _Char___init__impl__6a9atx(49), _Char___init__impl__6a9atx(49), _Char___init__impl__6a9atx(49), _Char___init__impl__6a9atx(49), _Char___init__impl__6a9atx(49), _Char___init__impl__6a9atx(50), _Char___init__impl__6a9atx(50), _Char___init__impl__6a9atx(50), _Char___init__impl__6a9atx(50), _Char___init__impl__6a9atx(50), _Char___init__impl__6a9atx(50), _Char___init__impl__6a9atx(50), _Char___init__impl__6a9atx(50), _Char___init__impl__6a9atx(50), _Char___init__impl__6a9atx(50), _Char___init__impl__6a9atx(51), _Char___init__impl__6a9atx(51), _Char___init__impl__6a9atx(51), _Char___init__impl__6a9atx(51), _Char___init__impl__6a9atx(51), _Char___init__impl__6a9atx(51), _Char___init__impl__6a9atx(51), _Char___init__impl__6a9atx(51), _Char___init__impl__6a9atx(51), _Char___init__impl__6a9atx(51), _Char___init__impl__6a9atx(52), _Char___init__impl__6a9atx(52), _Char___init__impl__6a9atx(52), _Char___init__impl__6a9atx(52), _Char___init__impl__6a9atx(52), _Char___init__impl__6a9atx(52), _Char___init__impl__6a9atx(52), _Char___init__impl__6a9atx(52), _Char___init__impl__6a9atx(52), _Char___init__impl__6a9atx(52), _Char___init__impl__6a9atx(53), _Char___init__impl__6a9atx(53), _Char___init__impl__6a9atx(53), _Char___init__impl__6a9atx(53), _Char___init__impl__6a9atx(53), _Char___init__impl__6a9atx(53), _Char___init__impl__6a9atx(53), _Char___init__impl__6a9atx(53), _Char___init__impl__6a9atx(53), _Char___init__impl__6a9atx(53), _Char___init__impl__6a9atx(54), _Char___init__impl__6a9atx(54), _Char___init__impl__6a9atx(54), _Char___init__impl__6a9atx(54), _Char___init__impl__6a9atx(54), _Char___init__impl__6a9atx(54), _Char___init__impl__6a9atx(54), _Char___init__impl__6a9atx(54), _Char___init__impl__6a9atx(54), _Char___init__impl__6a9atx(54), _Char___init__impl__6a9atx(55), _Char___init__impl__6a9atx(55), _Char___init__impl__6a9atx(55), _Char___init__impl__6a9atx(55), _Char___init__impl__6a9atx(55), _Char___init__impl__6a9atx(55), _Char___init__impl__6a9atx(55), _Char___init__impl__6a9atx(55), _Char___init__impl__6a9atx(55), _Char___init__impl__6a9atx(55), _Char___init__impl__6a9atx(56), _Char___init__impl__6a9atx(56), _Char___init__impl__6a9atx(56), _Char___init__impl__6a9atx(56), _Char___init__impl__6a9atx(56), _Char___init__impl__6a9atx(56), _Char___init__impl__6a9atx(56), _Char___init__impl__6a9atx(56), _Char___init__impl__6a9atx(56), _Char___init__impl__6a9atx(56), _Char___init__impl__6a9atx(57), _Char___init__impl__6a9atx(57), _Char___init__impl__6a9atx(57), _Char___init__impl__6a9atx(57), _Char___init__impl__6a9atx(57), _Char___init__impl__6a9atx(57), _Char___init__impl__6a9atx(57), _Char___init__impl__6a9atx(57), _Char___init__impl__6a9atx(57), _Char___init__impl__6a9atx(57)]);
var tmp_0 = this;
// Inline function 'kotlin.charArrayOf' call
tmp_0.lv_1 = charArrayOf([_Char___init__impl__6a9atx(48), _Char___init__impl__6a9atx(49), _Char___init__impl__6a9atx(50), _Char___init__impl__6a9atx(51), _Char___init__impl__6a9atx(52), _Char___init__impl__6a9atx(53), _Char___init__impl__6a9atx(54), _Char___init__impl__6a9atx(55), _Char___init__impl__6a9atx(56), _Char___init__impl__6a9atx(57), _Char___init__impl__6a9atx(48), _Char___init__impl__6a9atx(49), _Char___init__impl__6a9atx(50), _Char___init__impl__6a9atx(51), _Char___init__impl__6a9atx(52), _Char___init__impl__6a9atx(53), _Char___init__impl__6a9atx(54), _Char___init__impl__6a9atx(55), _Char___init__impl__6a9atx(56), _Char___init__impl__6a9atx(57), _Char___init__impl__6a9atx(48), _Char___init__impl__6a9atx(49), _Char___init__impl__6a9atx(50), _Char___init__impl__6a9atx(51), _Char___init__impl__6a9atx(52), _Char___init__impl__6a9atx(53), _Char___init__impl__6a9atx(54), _Char___init__impl__6a9atx(55), _Char___init__impl__6a9atx(56), _Char___init__impl__6a9atx(57), _Char___init__impl__6a9atx(48), _Char___init__impl__6a9atx(49), _Char___init__impl__6a9atx(50), _Char___init__impl__6a9atx(51), _Char___init__impl__6a9atx(52), _Char___init__impl__6a9atx(53), _Char___init__impl__6a9atx(54), _Char___init__impl__6a9atx(55), _Char___init__impl__6a9atx(56), _Char___init__impl__6a9atx(57), _Char___init__impl__6a9atx(48), _Char___init__impl__6a9atx(49), _Char___init__impl__6a9atx(50), _Char___init__impl__6a9atx(51), _Char___init__impl__6a9atx(52), _Char___init__impl__6a9atx(53), _Char___init__impl__6a9atx(54), _Char___init__impl__6a9atx(55), _Char___init__impl__6a9atx(56), _Char___init__impl__6a9atx(57), _Char___init__impl__6a9atx(48), _Char___init__impl__6a9atx(49), _Char___init__impl__6a9atx(50), _Char___init__impl__6a9atx(51), _Char___init__impl__6a9atx(52), _Char___init__impl__6a9atx(53), _Char___init__impl__6a9atx(54), _Char___init__impl__6a9atx(55), _Char___init__impl__6a9atx(56), _Char___init__impl__6a9atx(57), _Char___init__impl__6a9atx(48), _Char___init__impl__6a9atx(49), _Char___init__impl__6a9atx(50), _Char___init__impl__6a9atx(51), _Char___init__impl__6a9atx(52), _Char___init__impl__6a9atx(53), _Char___init__impl__6a9atx(54), _Char___init__impl__6a9atx(55), _Char___init__impl__6a9atx(56), _Char___init__impl__6a9atx(57), _Char___init__impl__6a9atx(48), _Char___init__impl__6a9atx(49), _Char___init__impl__6a9atx(50), _Char___init__impl__6a9atx(51), _Char___init__impl__6a9atx(52), _Char___init__impl__6a9atx(53), _Char___init__impl__6a9atx(54), _Char___init__impl__6a9atx(55), _Char___init__impl__6a9atx(56), _Char___init__impl__6a9atx(57), _Char___init__impl__6a9atx(48), _Char___init__impl__6a9atx(49), _Char___init__impl__6a9atx(50), _Char___init__impl__6a9atx(51), _Char___init__impl__6a9atx(52), _Char___init__impl__6a9atx(53), _Char___init__impl__6a9atx(54), _Char___init__impl__6a9atx(55), _Char___init__impl__6a9atx(56), _Char___init__impl__6a9atx(57), _Char___init__impl__6a9atx(48), _Char___init__impl__6a9atx(49), _Char___init__impl__6a9atx(50), _Char___init__impl__6a9atx(51), _Char___init__impl__6a9atx(52), _Char___init__impl__6a9atx(53), _Char___init__impl__6a9atx(54), _Char___init__impl__6a9atx(55), _Char___init__impl__6a9atx(56), _Char___init__impl__6a9atx(57)]);
}
}
class LongOverflow {
constructor() {
LongOverflow_instance = this;
this.gy_1 = Companion_getInstance_4().ofLong(new Long(0, -2147483648));
this.hy_1 = Companion_getInstance_4().ofLong(new Long(-1, 2147483647));
}
iy(num) {
var intVal = inflated(num);
if (intVal.lu(this.gy_1) < 0 || intVal.lu(this.hy_1) > 0) {
throw ArithmeticException.ng('Overflow');
}
}
}
class StringBuilderHelper {
constructor(sb, compactCharArray) {
Companion_getInstance_2();
sb = sb === VOID ? StringBuilder.u() : sb;
compactCharArray = compactCharArray === VOID ? charArray(19) : compactCharArray;
this.jy_1 = sb;
this.ky_1 = compactCharArray;
}
ly() {
removeRange(this.jy_1, 0, this.jy_1.a());
return this.jy_1;
}
my(intCompact) {
var intCompact_0 = intCompact;
// Inline function 'kotlin.require' call
// Inline function 'kotlin.require' call
if (!(intCompact_0.w1(new Long(0, 0)) >= 0)) {
var message = 'Failed requirement.';
throw IllegalArgumentException.h(toString(message));
}
var q;
var r;
var charPos = this.ky_1.length;
while (intCompact_0.w1(new Long(2147483647, 0)) > 0) {
// Inline function 'kotlin.Long.div' call
q = intCompact_0.r3(toLong(100));
var tmp = intCompact_0;
// Inline function 'kotlin.Long.times' call
var tmp$ret$4 = q.q3(toLong(100));
r = tmp.p3(tmp$ret$4).y1();
intCompact_0 = q;
charPos = charPos - 1 | 0;
this.ky_1[charPos] = Companion_getInstance_2().lv_1[r];
charPos = charPos - 1 | 0;
this.ky_1[charPos] = Companion_getInstance_2().kv_1[r];
}
var q2;
var i2 = intCompact_0.y1();
while (i2 >= 100) {
q2 = i2 / 100 | 0;
r = i2 - imul(q2, 100) | 0;
i2 = q2;
charPos = charPos - 1 | 0;
this.ky_1[charPos] = Companion_getInstance_2().lv_1[r];
charPos = charPos - 1 | 0;
this.ky_1[charPos] = Companion_getInstance_2().kv_1[r];
}
charPos = charPos - 1 | 0;
this.ky_1[charPos] = Companion_getInstance_2().lv_1[i2];
if (i2 >= 10) {
charPos = charPos - 1 | 0;
this.ky_1[charPos] = Companion_getInstance_2().kv_1[i2];
}
return charPos;
}
}
class Companion_3 {
constructor() {
Companion_instance_3 = this;
this.ow_1 = new Long(0, -2147483648);
this.pw_1 = Companion_getInstance_4().ofLong(new Long(0, -2147483648));
this.qw_1 = 18;
var tmp = this;
// Inline function 'kotlin.arrayOf' call
// Inline function 'kotlin.js.unsafeCast' call
// Inline function 'kotlin.js.asDynamic' call
tmp.rw_1 = [CommonBigDecimal.nx(Companion_getInstance_4().ZERO, new Long(0, 0), 0, 1), CommonBigDecimal.nx(Companion_getInstance_4().ONE, new Long(1, 0), 0, 1), CommonBigDecimal.nx(Companion_getInstance_4().TWO, new Long(2, 0), 0, 1), CommonBigDecimal.nx(Companion_getInstance_4().of(3), new Long(3, 0), 0, 1), CommonBigDecimal.nx(Companion_getInstance_4().of(4), new Long(4, 0), 0, 1), CommonBigDecimal.nx(Companion_getInstance_4().of(5), new Long(5, 0), 0, 1), CommonBigDecimal.nx(Companion_getInstance_4().of(6), new Long(6, 0), 0, 1), CommonBigDecimal.nx(Companion_getInstance_4().of(7), new Long(7, 0), 0, 1), CommonBigDecimal.nx(Companion_getInstance_4().of(8), new Long(8, 0), 0, 1), CommonBigDecimal.nx(Companion_getInstance_4().of(9), new Long(9, 0), 0, 1), CommonBigDecimal.nx(Companion_getInstance_4().TEN, new Long(10, 0), 0, 2)];
var tmp_0 = this;
// Inline function 'kotlin.arrayOf' call
// Inline function 'kotlin.js.unsafeCast' call
// Inline function 'kotlin.js.asDynamic' call
tmp_0.sw_1 = [this.rw_1[0], CommonBigDecimal.nx(Companion_getInstance_4().ZERO, new Long(0, 0), 1, 1), CommonBigDecimal.nx(Companion_getInstance_4().ZERO, new Long(0, 0), 2, 1), CommonBigDecimal.nx(Companion_getInstance_4().ZERO, new Long(0, 0), 3, 1), CommonBigDecimal.nx(Companion_getInstance_4().ZERO, new Long(0, 0), 4, 1), CommonBigDecimal.nx(Companion_getInstance_4().ZERO, new Long(0, 0), 5, 1), CommonBigDecimal.nx(Companion_getInstance_4().ZERO, new Long(0, 0), 6, 1), CommonBigDecimal.nx(Companion_getInstance_4().ZERO, new Long(0, 0), 7, 1), CommonBigDecimal.nx(Companion_getInstance_4().ZERO, new Long(0, 0), 8, 1), CommonBigDecimal.nx(Companion_getInstance_4().ZERO, new Long(0, 0), 9, 1), CommonBigDecimal.nx(Companion_getInstance_4().ZERO, new Long(0, 0), 10, 1), CommonBigDecimal.nx(Companion_getInstance_4().ZERO, new Long(0, 0), 11, 1), CommonBigDecimal.nx(Companion_getInstance_4().ZERO, new Long(0, 0), 12, 1), CommonBigDecimal.nx(Companion_getInstance_4().ZERO, new Long(0, 0), 13, 1), CommonBigDecimal.nx(Companion_getInstance_4().ZERO, new Long(0, 0), 14, 1), CommonBigDecimal.nx(Companion_getInstance_4().ZERO, new Long(0, 0), 15, 1)];
this.tw_1 = new Long(-1, 1073741823);
this.uw_1 = new Long(0, -1073741824);
this.ZERO = this.rw_1[0];
this.ONE = this.rw_1[1];
this.TWO = this.rw_1[2];
this.TEN = this.rw_1[10];
this.ONE_TENTH = this.ofScaledLong(new Long(1, 0), 1);
this.ONE_HALF = this.ofScaledLong(new Long(5, 0), 1);
this.PI = this.parse('3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648');
this.E = this.parse('2.718281828459045235360287471352662497757247093699959574966967627724076630353547594571382178525166427427466391932003059921817413596629043572900334295260595630738132328627943490763233829880753195251019011573834187930702154089149934884167509244761460668082264');
var tmp_1 = this;
// Inline function 'kotlin.doubleArrayOf' call
tmp_1.vw_1 = new Float64Array([1.0, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, 1.0E7, 1.0E8, 1.0E9, 1.0E10, 1.0E11, 1.0E12, 1.0E13, 1.0E14, 1.0E15, 1.0E16, 1.0E17, 1.0E18, 1.0E19, 1.0E20, 1.0E21, 1.0E22]);
var tmp_2 = this;
// Inline function 'kotlin.floatArrayOf' call
tmp_2.ww_1 = new Float32Array([1.0, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, 1.0E7, 1.0E8, 1.0E9, 1.0E10]);
var tmp_3 = this;
// Inline function 'kotlin.longArrayOf' call
tmp_3.xw_1 = longArrayOf([new Long(1, 0), new Long(10, 0), new Long(100, 0), new Long(1000, 0), new Long(10000, 0), new Long(100000, 0), new Long(1000000, 0), new Long(10000000, 0), new Long(100000000, 0), new Long(1000000000, 0), new Long(1410065408, 2), new Long(1215752192, 23), new Long(-727379968, 232), new Long(1316134912, 2328), new Long(276447232, 23283), new Long(-1530494976, 232830), new Long(1874919424, 2328306), new Long(1569325056, 23283064), new Long(-1486618624, 232830643)]);
var tmp_4 = this;
// Inline function 'kotlin.arrayOf' call
// Inline function 'kotlin.js.unsafeCast' call
// Inline function 'kotlin.js.asDynamic' call
tmp_4.yw_1 = [Companion_getInstance_4().ONE, Companion_getInstance_4().of(10), Companion_getInstance_4().of(100), Companion_getInstance_4().of(1000), Companion_getInstance_4().of(10000), Companion_getInstance_4().of(100000), Companion_getInstance_4().of(1000000), Companion_getInstance_4().of(10000000), Companion_getInstance_4().of(100000000), Companion_getInstance_4().of(1000000000), Companion_getInstance_4().ofLong(new Long(1410065408, 2)), Companion_getInstance_4().ofLong(new Long(1215752192, 23)), Companion_getInstance_4().ofLong(new Long(-727379968, 232)), Companion_getInstance_4().ofLong(new Long(1316134912, 2328)), Companion_getInstance_4().ofLong(new Long(276447232, 23283)), Companion_getInstance_4().ofLong(new Long(-1530494976, 232830)), Companion_getInstance_4().ofLong(new Long(1874919424, 2328306)), Companion_getInstance_4().ofLong(new Long(1569325056, 23283064)), Companion_getInstance_4().ofLong(new Long(-1486618624, 232830643))];
this.zw_1 = this.yw_1.length;
this.ax_1 = imul(16, this.zw_1);
var tmp_5 = this;
// Inline function 'kotlin.longArrayOf' call
tmp_5.bx_1 = longArrayOf([new Long(-1, 2147483647), new Long(-858993460, 214748364), new Long(2061584302, 21474836), new Long(-1511828489, 2147483), new Long(1566804069, 214748), new Long(-702313053, 21474), new Long(2077252342, 2147), new Long(-1080764955, 214), new Long(2039407152, 21), new Long(633437444, 2), new Long(922337203, 0), new Long(92233720, 0), new Long(9223372, 0), new Long(922337, 0), new Long(92233, 0), new Long(9223, 0), new Long(922, 0), new Long(92, 0), new Long(9, 0)]);
this.cx_1 = new Long(0, 1);
var tmp_6 = this;
// Inline function 'kotlin.longArrayOf' call
var tmp_7 = longArrayOf([new Long(0, 0), new Long(-1981284352, -1966660860)]);
// Inline function 'kotlin.longArrayOf' call
var tmp_8 = longArrayOf([new Long(5, 0), new Long(1661992960, 1808227885)]);
// Inline function 'kotlin.longArrayOf' call
var tmp_9 = longArrayOf([new Long(54, 0), new Long(-559939584, 902409669)]);
// Inline function 'kotlin.longArrayOf' call
var tmp_10 = longArrayOf([new Long(542, 0), new Long(-1304428544, 434162106)]);
// Inline function 'kotlin.longArrayOf' call
var tmp_11 = longArrayOf([new Long(5421, 0), new Long(-159383552, 46653770)]);
// Inline function 'kotlin.longArrayOf' call
var tmp_12 = longArrayOf([new Long(54210, 0), new Long(-1593835520, 466537709)]);
// Inline function 'kotlin.longArrayOf' call
var tmp_13 = longArrayOf([new Long(542101, 0), new Long(1241513984, 370409800)]);
// Inline function 'kotlin.longArrayOf' call
var tmp_14 = longArrayOf([new Long(5421010, 0), new Long(-469762048, -590869294)]);
// Inline function 'kotlin.longArrayOf' call
var tmp_15 = longArrayOf([new Long(54210108, 0), new Long(-402653184, -1613725636)]);
// Inline function 'kotlin.longArrayOf' call
var tmp_16 = longArrayOf([new Long(542101086, 0), new Long(268435456, 1042612833)]);
// Inline function 'kotlin.longArrayOf' call
var tmp_17 = longArrayOf([new Long(1126043566, 1), new Long(-1610612736, 1836193738)]);
// Inline function 'kotlin.longArrayOf' call
var tmp_18 = longArrayOf([new Long(-1624466224, 12), new Long(1073741824, 1182068202)]);
// Inline function 'kotlin.longArrayOf' call
var tmp_19 = longArrayOf([new Long(935206946, 126), new Long(-2147483648, -1064219866)]);
// Inline function 'kotlin.longArrayOf' call
var tmp_20 = longArrayOf([new Long(762134875, 1262), new Long(0, -2052264063)]);
// Inline function 'kotlin.longArrayOf' call
var tmp_21 = longArrayOf([new Long(-968585837, 12621), new Long(0, 952195850)]);
// Inline function 'kotlin.longArrayOf' call
var tmp_22 = longArrayOf([new Long(-1095923776, 126217), new Long(0, 932023908)]);
// Inline function 'kotlin.longArrayOf' call
var tmp_23 = longArrayOf([new Long(1925664130, 1262177), new Long(0, 730304488)]);
// Inline function 'kotlin.longArrayOf' call
var tmp_24 = longArrayOf([new Long(2076772117, 12621774), new Long(0, -1286889712)]);
// Inline function 'kotlin.longArrayOf' call
var tmp_25 = longArrayOf([new Long(-707115303, 126217744), new Long(0, 16004768)]);
// Inline function 'kotlin.longArrayOf' call
// Inline function 'kotlin.arrayOf' call
// Inline function 'kotlin.js.unsafeCast' call
// Inline function 'kotlin.js.asDynamic' call
tmp_6.dx_1 = [tmp_7, tmp_8, tmp_9, tmp_10, tmp_11, tmp_12, tmp_13, tmp_14, tmp_15, tmp_16, tmp_17, tmp_18, tmp_19, tmp_20, tmp_21, tmp_22, tmp_23, tmp_24, tmp_25, longArrayOf([new Long(1518781562, 1262177448), new Long(0, 160047680)])];
}
kt() {
return this.ZERO;
}
lt() {
return this.ONE;
}
mt() {
return this.TWO;
}
nt() {
return this.TEN;
}
ot() {
return this.ONE_TENTH;
}
pt() {
return this.ONE_HALF;
}
qt() {
return this.PI;
}
rt() {
return this.E;
}
ofScaledLong(unscaledVal, scale) {
if (scale === 0) {
return this.of(unscaledVal);
} else if (unscaledVal.equals(new Long(0, 0))) {
return this.fy(scale);
}
var tmp;
if (unscaledVal.equals(new Long(0, -2147483648))) {
tmp = this.pw_1;
} else {
tmp = null;
}
return CommonBigDecimal.nx(tmp, unscaledVal, scale, 0);
}
ofScaledLongWithPrecision(unscaledVal, scale, prec) {
var tmp;
if (scale === 0 && unscaledVal.w1(new Long(0, 0)) >= 0 && unscaledVal.w1(toLong(this.rw_1.length)) < 0) {
tmp = this.rw_1[unscaledVal.y1()];
} else if (unscaledVal.equals(new Long(0, 0))) {
tmp = this.fy(scale);
} else {
tmp = CommonBigDecimal.nx(unscaledVal.equals(new Long(0, -2147483648)) ? this.pw_1 : null, unscaledVal, scale, prec);
}
return tmp;
}
ofInt(val) {
return this.of(toLong(val));
}
of(val) {
var tmp;
if (val.w1(new Long(0, 0)) >= 0 && val.w1(toLong(this.rw_1.length)) < 0) {
tmp = this.rw_1[val.y1()];
} else {
var tmp_0;
if (!val.equals(new Long(0, -2147483648))) {
tmp_0 = CommonBigDecimal.nx((null == null ? true : null instanceof CommonBigInteger) ? null : THROW_CCE(), val, 0, 0);
} else {
tmp_0 = CommonBigDecimal.nx(this.pw_1, val, 0, 0);
}
tmp = tmp_0;
}
return tmp;
}
ofScaledBigIntegerWithPrecision(intVal, scale, prec) {
var val = compactValFor(this, intVal);
if (val.equals(new Long(0, 0))) {
return this.fy(scale);
} else if (scale === 0 && val.w1(new Long(0, 0)) >= 0 && val.w1(toLong(this.rw_1.length)) < 0) {
return this.rw_1[val.y1()];
}
return CommonBigDecimal.nx(intVal, val, scale, prec);
}
fy(scale) {
var tmp;
if (scale >= 0 && scale < this.sw_1.length) {
tmp = this.sw_1[scale];
} else {
tmp = CommonBigDecimal.nx(Companion_getInstance_4().ZERO, new Long(0, 0), scale, 1);
}
return tmp;
}
ofDouble(val, ctx) {
return CommonBigDecimal.ny(val, ctx);
}
ofFloat(val, ctx) {
return this.ofDouble(val, ctx);
}
ut(val, ctx) {
var tmp;
if (ctx === null) {
tmp = CommonBigDecimal.py(val);
} else {
tmp = CommonBigDecimal.oy(val, ctx);
}
return tmp;
}
parse(val, ctx, $super) {
ctx = ctx === VOID ? null : ctx;
return $super === VOID ? this.ut(val, ctx) : $super.ut.call(this, val, ctx);
}
qy(val, ctx) {
var tmp;
if (ctx === null) {
tmp = CommonBigDecimal.sy(val);
} else {
tmp = CommonBigDecimal.ry(val, ctx);
}
return tmp;
}
ofBigInteger(val, ctx, $super) {
ctx = ctx === VOID ? null : ctx;
return $super === VOID ? this.qy(val, ctx) : $super.qy.call(this, val, ctx);
}
ofIntWithContext(val, ctx) {
return CommonBigDecimal.ty(toLong(val), ctx);
}
ofWithContext(val, ctx) {
return CommonBigDecimal.ty(val, ctx);
}
mx(x) {
var x_0 = x;
// Inline function 'kotlin.require' call
// Inline function 'kotlin.require' call
if (!!x_0.equals(new Long(0, -2147483648))) {
var message = 'Failed requirement.';
throw IllegalArgumentException.h(toString(message));
}
if (x_0.w1(new Long(0, 0)) < 0) {
x_0 = x_0.v3();
}
if (x_0.w1(new Long(10, 0)) < 0) {
return 1;
}
var r = imul((64 - numberOfLeadingZeros_0(x_0) | 0) + 1 | 0, 1233) >>> 12 | 0;
var tab = this.xw_1;
return r >= tab.length || x_0.w1(tab[r]) < 0 ? r : r + 1 | 0;
}
ey(n, sign, scale) {
if (n < this.xw_1.length) {
return this.ofScaledLong(numberToLong(sign).q3(this.xw_1[n]), scale);
} else {
var unscaledVal = bigTenToThe(this, n);
if (sign === -1) {
unscaledVal = unscaledVal.unaryMinus();
}
return CommonBigDecimal.nx(unscaledVal, new Long(0, -2147483648), scale, n + 1 | 0);
}
}
}
class CommonBigDecimal {
static nx(intVal, val, scale, prec) {
Companion_getInstance_3();
var $this = createThis(this);
init_org_gciatto_kt_math_CommonBigDecimal($this);
$this.fx_1 = scale;
$this.gx_1 = prec;
$this.ix_1 = val;
$this.ex_1 = intVal;
return $this;
}
static uy(in_0, offset, len, mc) {
Companion_getInstance_3();
offset = offset === VOID ? 0 : offset;
len = len === VOID ? in_0.length : len;
mc = mc === VOID ? Companion_getInstance_5().UNLIMITED : mc;
var $this = createThis(this);
init_org_gciatto_kt_math_CommonBigDecimal($this);
var offset_0 = offset;
var len_0 = len;
if ((offset_0 + len_0 | 0) > in_0.length || offset_0 < 0) {
throw NumberFormatException.ig('Bad offset or len arguments for char[] input.');
}
var prec = 0;
var scl = 0;
var rs = new Long(0, 0);
var rb = null;
try {
var isneg = false;
if (in_0[offset_0] === _Char___init__impl__6a9atx(45)) {
isneg = true;
offset_0 = offset_0 + 1 | 0;
len_0 = len_0 - 1 | 0;
} else if (in_0[offset_0] === _Char___init__impl__6a9atx(43)) {
offset_0 = offset_0 + 1 | 0;
len_0 = len_0 - 1 | 0;
}
var dot = false;
var exp = new Long(0, 0);
var c;
var isCompact = len_0 <= 18;
var idx = 0;
if (isCompact) {
$l$loop: while (len_0 > 0) {
c = in_0[offset_0];
if (c === _Char___init__impl__6a9atx(48)) {
if (prec === 0) {
prec = 1;
} else if (!rs.equals(new Long(0, 0))) {
// Inline function 'kotlin.Long.times' call
rs = rs.q3(toLong(10));
prec = prec + 1 | 0;
}
if (dot) {
scl = scl + 1 | 0;
}
} else if (_Char___init__impl__6a9atx(49) <= c ? c <= _Char___init__impl__6a9atx(57) : false) {
var digit = Char__minus_impl_a2frrh(c, _Char___init__impl__6a9atx(48));
if (!(prec === 1) || !rs.equals(new Long(0, 0))) {
prec = prec + 1 | 0;
}
// Inline function 'kotlin.Long.times' call
// Inline function 'kotlin.Long.plus' call
rs = rs.q3(toLong(10)).o3(toLong(digit));
if (dot) {
scl = scl + 1 | 0;
}
} else if (c === _Char___init__impl__6a9atx(46)) {
if (dot) {
throw NumberFormatException.ig('Character array contains more than one decimal point.');
}
dot = true;
} else if (isDigit(c)) {
var digit_0 = toDigit(c, 10);
if (digit_0 === 0) {
if (prec === 0) {
prec = 1;
} else if (!rs.equals(new Long(0, 0))) {
// Inline function 'kotlin.Long.times' call
rs = rs.q3(toLong(10));
prec = prec + 1 | 0;
}
} else {
if (!(prec === 1) || !rs.equals(new Long(0, 0))) {
prec = prec + 1 | 0;
}
// Inline function 'kotlin.Long.times' call
// Inline function 'kotlin.Long.plus' call
rs = rs.q3(toLong(10)).o3(toLong(digit_0));
}
if (dot) {
scl = scl + 1 | 0;
}
} else if (c === _Char___init__impl__6a9atx(101) || c === _Char___init__impl__6a9atx(69)) {
exp = parseExp(Companion_getInstance_3(), in_0, offset_0, len_0);
if (!toLong(exp.y1()).equals(exp)) {
throw NumberFormatException.ig('Exponent overflow.');
}
break $l$loop;
} else {
throw NumberFormatException.ig('Character ' + toString_0(c) + ' is neither a decimal digit number, decimal point, nor' + ' "e" notation exponential mark.');
}
offset_0 = offset_0 + 1 | 0;
len_0 = len_0 - 1 | 0;
}
if (prec === 0) {
throw NumberFormatException.ig('No digits found.');
}
if (!exp.equals(new Long(0, 0))) {
scl = adjustScale($this, scl, exp);
}
rs = isneg ? rs.v3() : rs;
var mcp = mc.precision;
var drop = prec - mcp | 0;
if (mcp > 0 && drop > 0) {
while (drop > 0) {
var tmp = Companion_getInstance_3();
var tmp0 = toLong(scl);
// Inline function 'kotlin.Long.minus' call
var other = drop;
var tmp$ret$6 = tmp0.p3(toLong(other));
scl = checkScaleNonZero(tmp, tmp$ret$6);
rs = divideAndRound_0(Companion_getInstance_3(), rs, Companion_getInstance_3().xw_1[drop], mc.roundingMode.value);
prec = Companion_getInstance_3().mx(rs);
drop = prec - mcp | 0;
}
}
} else {
var coeff = charArray(len_0);
$l$loop_1: while (len_0 > 0) {
c = in_0[offset_0];
if ((_Char___init__impl__6a9atx(48) <= c ? c <= _Char___init__impl__6a9atx(57) : false) || isDigit(c)) {
if (c === _Char___init__impl__6a9atx(48) || toDigit(c, 10) === 0) {
if (prec === 0) {
coeff[idx] = c;
prec = 1;
} else if (!(idx === 0)) {
var tmp6 = idx;
idx = tmp6 + 1 | 0;
coeff[tmp6] = c;
prec = prec + 1 | 0;
}
} else {
if (!(prec === 1) || !(idx === 0)) {
prec = prec + 1 | 0;
}
var tmp7 = idx;
idx = tmp7 + 1 | 0;
coeff[tmp7] = c;
}
if (dot) {
scl = scl + 1 | 0;
}
offset_0 = offset_0 + 1 | 0;
len_0 = len_0 - 1 | 0;
continue $l$loop_1;
}
if (c === _Char___init__impl__6a9atx(46)) {
if (dot) {
throw NumberFormatException.ig('Character array contains more than one decimal point.');
}
dot = true;
offset_0 = offset_0 + 1 | 0;
len_0 = len_0 - 1 | 0;
continue $l$loop_1;
}
if (!(c === _Char___init__impl__6a9atx(101)) && !(c === _Char___init__impl__6a9atx(69))) {
throw NumberFormatException.ig('Character array is missing "e" notation exponential mark.');
}
exp = parseExp(Companion_getInstance_3(), in_0, offset_0, len_0);
if (!toLong(exp.y1()).equals(exp)) {
throw NumberFormatException.ig('Exponent overflow.');
}
break $l$loop_1;
}
if (prec === 0) {
throw NumberFormatException.ig('No digits found.');
}
if (!exp.equals(new Long(0, 0))) {
scl = adjustScale($this, scl, exp);
}
rb = CommonBigInteger.vy(coeff, isneg ? -1 : 1, prec);
rs = compactValFor(Companion_getInstance_3(), rb);
var mcp_0 = mc.precision;
if (1 <= mcp_0 ? mcp_0 < prec : false) {
if (rs.equals(new Long(0, -2147483648))) {
var drop_0 = prec - mcp_0 | 0;
$l$loop_2: while (drop_0 > 0) {
var tmp_0 = Companion_getInstance_3();
var tmp0_0 = toLong(scl);
// Inline function 'kotlin.Long.minus' call
var other_0 = drop_0;
var tmp$ret$7 = tmp0_0.p3(toLong(other_0));
scl = checkScaleNonZero(tmp_0, tmp$ret$7);
rb = divideAndRoundByTenPow(Companion_getInstance_3(), ensureNotNull(rb), drop_0, mc.roundingMode.value);
rs = compactValFor(Companion_getInstance_3(), rb);
if (!rs.equals(new Long(0, -2147483648))) {
prec = Companion_getInstance_3().mx(rs);
break $l$loop_2;
}
prec = bigDigitLength(Companion_getInstance_3(), rb);
drop_0 = prec - mcp_0 | 0;
}
}
if (!rs.equals(new Long(0, -2147483648))) {
var drop_1 = prec - mcp_0 | 0;
while (drop_1 > 0) {
var tmp_1 = Companion_getInstance_3();
var tmp0_1 = toLong(scl);
// Inline function 'kotlin.Long.minus' call
var other_1 = drop_1;
var tmp$ret$8 = tmp0_1.p3(toLong(other_1));
scl = checkScaleNonZero(tmp_1, tmp$ret$8);
rs = divideAndRound_0(Companion_getInstance_3(), rs, Companion_getInstance_3().xw_1[drop_1], mc.roundingMode.value);
prec = Companion_getInstance_3().mx(rs);
drop_1 = prec - mcp_0 | 0;
}
rb = null;
}
}
}
} catch ($p) {
if ($p instanceof IndexOutOfBoundsException) {
var e = $p;
var nfe = NumberFormatException.hg();
throw nfe;
} else {
if ($p instanceof RuntimeException) {
var e_0 = $p;
var nfe_0 = NumberFormatException.hg();
throw nfe_0;
} else {
throw $p;
}
}
}
$this.fx_1 = scl;
$this.gx_1 = prec;
$this.ix_1 = rs;
$this.ex_1 = rb;
return $this;
}
static py(val) {
Companion_getInstance_3();
return this.uy(toCharArray(val), 0, val.length);
}
static oy(val, mc) {
Companion_getInstance_3();
return this.uy(toCharArray(val), 0, val.length, mc);
}
static ny(val, mc) {
Companion_getInstance_3();
mc = mc === VOID ? Companion_getInstance_5().UNLIMITED : mc;
var $this = createThis(this);
init_org_gciatto_kt_math_CommonBigDecimal($this);
if (isInfinite(val) || isInfinite(val)) {
throw NumberFormatException.ig('Infinite or NaN');
}
var valBits = toBits(val);
var sign = valBits.y3(63).equals(new Long(0, 0)) ? 1 : -1;
var exponent = valBits.y3(52).a4(new Long(2047, 0)).y1();
var tmp;
if (exponent === 0) {
// Inline function 'kotlin.Long.minus' call
var tmp$ret$0 = (new Long(0, 1048576)).p3(toLong(1));
tmp = valBits.a4(tmp$ret$0).x3(1);
} else {
// Inline function 'kotlin.Long.minus' call
var tmp$ret$1 = (new Long(0, 1048576)).p3(toLong(1));
tmp = valBits.a4(tmp$ret$1).b4(new Long(0, 1048576));
}
var significand = tmp;
exponent = exponent - 1075 | 0;
if (significand.equals(new Long(0, 0))) {
$this.ex_1 = Companion_getInstance_4().ZERO;
$this.fx_1 = 0;
$this.ix_1 = new Long(0, 0);
$this.gx_1 = 1;
return $this;
}
while (significand.a4(new Long(1, 0)).equals(new Long(0, 0))) {
significand = significand.y3(1);
exponent = exponent + 1 | 0;
}
var scl = 0;
var rb;
var compactVal = numberToLong(sign).q3(significand);
if (exponent === 0) {
rb = compactVal.equals(new Long(0, -2147483648)) ? Companion_getInstance_3().pw_1 : null;
} else {
if (exponent < 0) {
rb = Companion_getInstance_4().of(5).pow(-exponent | 0).dy(compactVal);
scl = -exponent | 0;
} else {
rb = Companion_getInstance_4().TWO.pow(exponent).dy(compactVal);
}
compactVal = compactValFor(Companion_getInstance_3(), rb);
}
var prec = 0;
var mcp = mc.precision;
if (mcp > 0) {
var mode = mc.roundingMode.value;
var drop;
if (compactVal.equals(new Long(0, -2147483648))) {
prec = bigDigitLength(Companion_getInstance_3(), ensureNotNull(rb));
drop = prec - mcp | 0;
$l$loop: while (drop > 0) {
var tmp_0 = Companion_getInstance_3();
var tmp0 = toLong(scl);
// Inline function 'kotlin.Long.minus' call
var other = drop;
var tmp$ret$2 = tmp0.p3(toLong(other));
scl = checkScaleNonZero(tmp_0, tmp$ret$2);
rb = divideAndRoundByTenPow(Companion_getInstance_3(), ensureNotNull(rb), drop, mode);
compactVal = compactValFor(Companion_getInstance_3(), rb);
if (!compactVal.equals(new Long(0, -2147483648))) {
break $l$loop;
}
prec = bigDigitLength(Companion_getInstance_3(), rb);
drop = prec - mcp | 0;
}
}
if (!compactVal.equals(new Long(0, -2147483648))) {
prec = Companion_getInstance_3().mx(compactVal);
drop = prec - mcp | 0;
while (drop > 0) {
var tmp_1 = Companion_getInstance_3();
var tmp0_0 = toLong(scl);
// Inline function 'kotlin.Long.minus' call
var other_0 = drop;
var tmp$ret$3 = tmp0_0.p3(toLong(other_0));
scl = checkScaleNonZero(tmp_1, tmp$ret$3);
compactVal = divideAndRound_0(Companion_getInstance_3(), compactVal, Companion_getInstance_3().xw_1[drop], mc.roundingMode.value);
prec = Companion_getInstance_3().mx(compactVal);
drop = prec - mcp | 0;
}
rb = null;
}
}
$this.ex_1 = rb;
$this.ix_1 = compactVal;
$this.fx_1 = scl;
$this.gx_1 = prec;
return $this;
}
static sy(val) {
Companion_getInstance_3();
var $this = createThis(this);
init_org_gciatto_kt_math_CommonBigDecimal($this);
$this.fx_1 = 0;
$this.ex_1 = val;
$this.ix_1 = compactValFor(Companion_getInstance_3(), val);
return $this;
}
static ry(val, mc) {
Companion_getInstance_3();
return this.wy(val, 0, mc);
}
static cy(unscaledVal, scale) {
Companion_getInstance_3();
var $this = createThis(this);
init_org_gciatto_kt_math_CommonBigDecimal($this);
$this.ex