lyb-pixi-js 1.10.7 → 1.10.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Components/Custom/LibPixiPuzzleBg.d.ts +7 -0
- package/Components/Custom/LibPixiPuzzleBg.js +45 -0
- package/Components/Custom/LibPixiScrollContainerX.d.ts +1 -1
- package/Components/Custom/LibPixiScrollContainerX.js +1 -1
- package/Components/Custom/LibPixiScrollContainerY.d.ts +1 -1
- package/Components/Custom/LibPixiScrollContainerY.js +1 -1
- package/libPixiJs.d.ts +5 -0
- package/libPixiJs.js +5 -0
- package/lyb-pixi.js +2834 -455
- package/package.json +1 -1
package/lyb-pixi.js
CHANGED
|
@@ -590,14 +590,14 @@
|
|
|
590
590
|
} while (p2 !== outerNode);
|
|
591
591
|
if (!m2)
|
|
592
592
|
return null;
|
|
593
|
-
var stop = m2, mx = m2.x, my = m2.y, tanMin = Infinity,
|
|
593
|
+
var stop = m2, mx = m2.x, my = m2.y, tanMin = Infinity, tan2;
|
|
594
594
|
p2 = m2;
|
|
595
595
|
do {
|
|
596
596
|
if (hx >= p2.x && p2.x >= mx && hx !== p2.x && pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p2.x, p2.y)) {
|
|
597
|
-
|
|
598
|
-
if (locallyInside(p2, hole) && (
|
|
597
|
+
tan2 = Math.abs(hy - p2.y) / (hx - p2.x);
|
|
598
|
+
if (locallyInside(p2, hole) && (tan2 < tanMin || tan2 === tanMin && (p2.x > m2.x || p2.x === m2.x && sectorContainsSector(m2, p2)))) {
|
|
599
599
|
m2 = p2;
|
|
600
|
-
tanMin =
|
|
600
|
+
tanMin = tan2;
|
|
601
601
|
}
|
|
602
602
|
}
|
|
603
603
|
p2 = p2.next;
|
|
@@ -700,10 +700,10 @@
|
|
|
700
700
|
return p1.x === p2.x && p1.y === p2.y;
|
|
701
701
|
}
|
|
702
702
|
function intersects(p1, q1, p2, q2) {
|
|
703
|
-
var o1 = sign$
|
|
704
|
-
var o2 = sign$
|
|
705
|
-
var o3 = sign$
|
|
706
|
-
var o4 = sign$
|
|
703
|
+
var o1 = sign$4(area(p1, q1, p2));
|
|
704
|
+
var o2 = sign$4(area(p1, q1, q2));
|
|
705
|
+
var o3 = sign$4(area(p2, q2, p1));
|
|
706
|
+
var o4 = sign$4(area(p2, q2, q1));
|
|
707
707
|
if (o1 !== o2 && o3 !== o4)
|
|
708
708
|
return true;
|
|
709
709
|
if (o1 === 0 && onSegment(p1, p2, q1))
|
|
@@ -719,7 +719,7 @@
|
|
|
719
719
|
function onSegment(p2, q, r2) {
|
|
720
720
|
return q.x <= Math.max(p2.x, r2.x) && q.x >= Math.min(p2.x, r2.x) && q.y <= Math.max(p2.y, r2.y) && q.y >= Math.min(p2.y, r2.y);
|
|
721
721
|
}
|
|
722
|
-
function sign$
|
|
722
|
+
function sign$4(num) {
|
|
723
723
|
return num > 0 ? 1 : num < 0 ? -1 : 0;
|
|
724
724
|
}
|
|
725
725
|
function intersectsPolygon(a2, b2) {
|
|
@@ -810,12 +810,12 @@
|
|
|
810
810
|
return polygonArea === 0 && trianglesArea === 0 ? 0 : Math.abs((trianglesArea - polygonArea) / polygonArea);
|
|
811
811
|
};
|
|
812
812
|
function signedArea(data, start, end, dim) {
|
|
813
|
-
var
|
|
813
|
+
var sum2 = 0;
|
|
814
814
|
for (var i2 = start, j2 = end - dim; i2 < end; i2 += dim) {
|
|
815
|
-
|
|
815
|
+
sum2 += (data[j2] - data[i2]) * (data[i2 + 1] + data[j2 + 1]);
|
|
816
816
|
j2 = i2;
|
|
817
817
|
}
|
|
818
|
-
return
|
|
818
|
+
return sum2;
|
|
819
819
|
}
|
|
820
820
|
earcut.flatten = function(data) {
|
|
821
821
|
var dim = data[0][0].length, result = { vertices: [], holes: [], dimensions: dim }, holeIndex = 0;
|
|
@@ -1317,14 +1317,14 @@
|
|
|
1317
1317
|
var protoTag = obj instanceof Object ? "" : "null prototype";
|
|
1318
1318
|
var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? "Object" : "";
|
|
1319
1319
|
var constructorTag = isPlainObject || typeof obj.constructor !== "function" ? "" : obj.constructor.name ? obj.constructor.name + " " : "";
|
|
1320
|
-
var
|
|
1320
|
+
var tag2 = constructorTag + (stringTag || protoTag ? "[" + $join.call($concat$1.call([], stringTag || [], protoTag || []), ": ") + "] " : "");
|
|
1321
1321
|
if (ys.length === 0) {
|
|
1322
|
-
return
|
|
1322
|
+
return tag2 + "{}";
|
|
1323
1323
|
}
|
|
1324
1324
|
if (indent) {
|
|
1325
|
-
return
|
|
1325
|
+
return tag2 + "{" + indentedJoin(ys, indent) + "}";
|
|
1326
1326
|
}
|
|
1327
|
-
return
|
|
1327
|
+
return tag2 + "{ " + $join.call(ys, ", ") + " }";
|
|
1328
1328
|
}
|
|
1329
1329
|
return String(obj);
|
|
1330
1330
|
};
|
|
@@ -1698,17 +1698,17 @@
|
|
|
1698
1698
|
var ref = ReferenceError;
|
|
1699
1699
|
var syntax = SyntaxError;
|
|
1700
1700
|
var uri = URIError;
|
|
1701
|
-
var abs$
|
|
1702
|
-
var floor$
|
|
1703
|
-
var max$
|
|
1704
|
-
var min$
|
|
1705
|
-
var pow$
|
|
1706
|
-
var round$
|
|
1701
|
+
var abs$2 = Math.abs;
|
|
1702
|
+
var floor$2 = Math.floor;
|
|
1703
|
+
var max$2 = Math.max;
|
|
1704
|
+
var min$2 = Math.min;
|
|
1705
|
+
var pow$2 = Math.pow;
|
|
1706
|
+
var round$3 = Math.round;
|
|
1707
1707
|
var _isNaN = Number.isNaN || function isNaN2(a2) {
|
|
1708
1708
|
return a2 !== a2;
|
|
1709
1709
|
};
|
|
1710
1710
|
var $isNaN = _isNaN;
|
|
1711
|
-
var sign$
|
|
1711
|
+
var sign$3 = function sign2(number) {
|
|
1712
1712
|
if ($isNaN(number) || number === 0) {
|
|
1713
1713
|
return number;
|
|
1714
1714
|
}
|
|
@@ -2028,13 +2028,13 @@
|
|
|
2028
2028
|
var $SyntaxError = syntax;
|
|
2029
2029
|
var $TypeError$3 = type;
|
|
2030
2030
|
var $URIError = uri;
|
|
2031
|
-
var abs = abs$
|
|
2032
|
-
var floor = floor$
|
|
2033
|
-
var max = max$
|
|
2034
|
-
var min = min$
|
|
2035
|
-
var pow = pow$
|
|
2036
|
-
var round$
|
|
2037
|
-
var sign$
|
|
2031
|
+
var abs$1 = abs$2;
|
|
2032
|
+
var floor$1 = floor$2;
|
|
2033
|
+
var max$1 = max$2;
|
|
2034
|
+
var min$1 = min$2;
|
|
2035
|
+
var pow$1 = pow$2;
|
|
2036
|
+
var round$2 = round$3;
|
|
2037
|
+
var sign$2 = sign$3;
|
|
2038
2038
|
var $Function = Function;
|
|
2039
2039
|
var getEvalledConstructor = function(expressionSyntax) {
|
|
2040
2040
|
try {
|
|
@@ -2141,13 +2141,13 @@
|
|
|
2141
2141
|
"%Function.prototype.apply%": $apply,
|
|
2142
2142
|
"%Object.defineProperty%": $defineProperty,
|
|
2143
2143
|
"%Object.getPrototypeOf%": $ObjectGPO,
|
|
2144
|
-
"%Math.abs%": abs,
|
|
2145
|
-
"%Math.floor%": floor,
|
|
2146
|
-
"%Math.max%": max,
|
|
2147
|
-
"%Math.min%": min,
|
|
2148
|
-
"%Math.pow%": pow,
|
|
2149
|
-
"%Math.round%": round$
|
|
2150
|
-
"%Math.sign%": sign$
|
|
2144
|
+
"%Math.abs%": abs$1,
|
|
2145
|
+
"%Math.floor%": floor$1,
|
|
2146
|
+
"%Math.max%": max$1,
|
|
2147
|
+
"%Math.min%": min$1,
|
|
2148
|
+
"%Math.pow%": pow$1,
|
|
2149
|
+
"%Math.round%": round$2,
|
|
2150
|
+
"%Math.sign%": sign$2,
|
|
2151
2151
|
"%Reflect.getPrototypeOf%": $ReflectGPO
|
|
2152
2152
|
};
|
|
2153
2153
|
if (getProto) {
|
|
@@ -4578,7 +4578,7 @@ Deprecated since v${version}`), console.warn(stack))), warnings[message] = true;
|
|
|
4578
4578
|
function isPow2(v2) {
|
|
4579
4579
|
return !(v2 & v2 - 1) && !!v2;
|
|
4580
4580
|
}
|
|
4581
|
-
function log2(v2) {
|
|
4581
|
+
function log2$1(v2) {
|
|
4582
4582
|
let r2 = (v2 > 65535 ? 1 : 0) << 4;
|
|
4583
4583
|
v2 >>>= r2;
|
|
4584
4584
|
let shift = (v2 > 255 ? 1 : 0) << 3;
|
|
@@ -4595,7 +4595,7 @@ Deprecated since v${version}`), console.warn(stack))), warnings[message] = true;
|
|
|
4595
4595
|
arr[i2] = arr[i2 + removeCount];
|
|
4596
4596
|
arr.length = len;
|
|
4597
4597
|
}
|
|
4598
|
-
function sign(n2) {
|
|
4598
|
+
function sign$1(n2) {
|
|
4599
4599
|
return n2 === 0 ? 0 : n2 < 0 ? -1 : 1;
|
|
4600
4600
|
}
|
|
4601
4601
|
let nextUid = 0;
|
|
@@ -6356,8 +6356,8 @@ else `), i2 < maxIfs - 1 && (src += `if(test == ${i2}.0){}`);
|
|
|
6356
6356
|
* @returns This matrix. Good for chaining method calls.
|
|
6357
6357
|
*/
|
|
6358
6358
|
rotate(angle) {
|
|
6359
|
-
const
|
|
6360
|
-
return this.a = a1 *
|
|
6359
|
+
const cos2 = Math.cos(angle), sin2 = Math.sin(angle), a1 = this.a, c1 = this.c, tx1 = this.tx;
|
|
6360
|
+
return this.a = a1 * cos2 - this.b * sin2, this.b = a1 * sin2 + this.b * cos2, this.c = c1 * cos2 - this.d * sin2, this.d = c1 * sin2 + this.d * cos2, this.tx = tx1 * cos2 - this.ty * sin2, this.ty = tx1 * sin2 + this.ty * cos2, this;
|
|
6361
6361
|
}
|
|
6362
6362
|
/**
|
|
6363
6363
|
* Appends the given Matrix to this Matrix.
|
|
@@ -7871,7 +7871,7 @@ void main(void){
|
|
|
7871
7871
|
* @returns - buffer than can hold atleast `size` floats
|
|
7872
7872
|
*/
|
|
7873
7873
|
getAttributeBuffer(size) {
|
|
7874
|
-
const roundedP2 = nextPow2(Math.ceil(size / 8)), roundedSizeIndex = log2(roundedP2), roundedSize = roundedP2 * 8;
|
|
7874
|
+
const roundedP2 = nextPow2(Math.ceil(size / 8)), roundedSizeIndex = log2$1(roundedP2), roundedSize = roundedP2 * 8;
|
|
7875
7875
|
this._aBuffers.length <= roundedSizeIndex && (this._iBuffers.length = roundedSizeIndex + 1);
|
|
7876
7876
|
let buffer = this._aBuffers[roundedSize];
|
|
7877
7877
|
return buffer || (this._aBuffers[roundedSize] = buffer = new ViewableBuffer(roundedSize * this.vertexSize * 4)), buffer;
|
|
@@ -7883,7 +7883,7 @@ void main(void){
|
|
|
7883
7883
|
* @returns - buffer that can fit `size` indices.
|
|
7884
7884
|
*/
|
|
7885
7885
|
getIndexBuffer(size) {
|
|
7886
|
-
const roundedP2 = nextPow2(Math.ceil(size / 12)), roundedSizeIndex = log2(roundedP2), roundedSize = roundedP2 * 12;
|
|
7886
|
+
const roundedP2 = nextPow2(Math.ceil(size / 12)), roundedSizeIndex = log2$1(roundedP2), roundedSize = roundedP2 * 12;
|
|
7887
7887
|
this._iBuffers.length <= roundedSizeIndex && (this._iBuffers.length = roundedSizeIndex + 1);
|
|
7888
7888
|
let buffer = this._iBuffers[roundedSizeIndex];
|
|
7889
7889
|
return buffer || (this._iBuffers[roundedSizeIndex] = buffer = new Uint16Array(roundedSize)), buffer;
|
|
@@ -11145,14 +11145,14 @@ void main(void)
|
|
|
11145
11145
|
* Systems are attached dynamically to this class when added.
|
|
11146
11146
|
* @param config - the config for the system manager
|
|
11147
11147
|
*/
|
|
11148
|
-
setup(
|
|
11149
|
-
this.addRunners(...
|
|
11150
|
-
const priority = (
|
|
11148
|
+
setup(config2) {
|
|
11149
|
+
this.addRunners(...config2.runners);
|
|
11150
|
+
const priority = (config2.priority ?? []).filter((key) => config2.systems[key]), orderByPriority = [
|
|
11151
11151
|
...priority,
|
|
11152
|
-
...Object.keys(
|
|
11152
|
+
...Object.keys(config2.systems).filter((key) => !priority.includes(key))
|
|
11153
11153
|
];
|
|
11154
11154
|
for (const i2 of orderByPriority)
|
|
11155
|
-
this.addSystem(
|
|
11155
|
+
this.addSystem(config2.systems[i2], i2);
|
|
11156
11156
|
}
|
|
11157
11157
|
/**
|
|
11158
11158
|
* Create a bunch of runners based of a collection of ids
|
|
@@ -14341,7 +14341,7 @@ void main(void)
|
|
|
14341
14341
|
}
|
|
14342
14342
|
/** When the texture is updated, this event will fire to update the scale and frame. */
|
|
14343
14343
|
_onTextureUpdate() {
|
|
14344
|
-
this._textureID = -1, this._textureTrimmedID = -1, this._cachedTint = 16777215, this._width && (this.scale.x = sign(this.scale.x) * this._width / this._texture.orig.width), this._height && (this.scale.y = sign(this.scale.y) * this._height / this._texture.orig.height);
|
|
14344
|
+
this._textureID = -1, this._textureTrimmedID = -1, this._cachedTint = 16777215, this._width && (this.scale.x = sign$1(this.scale.x) * this._width / this._texture.orig.width), this._height && (this.scale.y = sign$1(this.scale.y) * this._height / this._texture.orig.height);
|
|
14345
14345
|
}
|
|
14346
14346
|
/** Called when the anchor position updates. */
|
|
14347
14347
|
_onAnchorUpdate() {
|
|
@@ -14460,7 +14460,7 @@ void main(void)
|
|
|
14460
14460
|
return Math.abs(this.scale.x) * this._texture.orig.width;
|
|
14461
14461
|
}
|
|
14462
14462
|
set width(value) {
|
|
14463
|
-
const s2 = sign(this.scale.x) || 1;
|
|
14463
|
+
const s2 = sign$1(this.scale.x) || 1;
|
|
14464
14464
|
this.scale.x = s2 * value / this._texture.orig.width, this._width = value;
|
|
14465
14465
|
}
|
|
14466
14466
|
/** The height of the sprite, setting this will actually modify the scale to achieve the value set. */
|
|
@@ -14468,7 +14468,7 @@ void main(void)
|
|
|
14468
14468
|
return Math.abs(this.scale.y) * this._texture.orig.height;
|
|
14469
14469
|
}
|
|
14470
14470
|
set height(value) {
|
|
14471
|
-
const s2 = sign(this.scale.y) || 1;
|
|
14471
|
+
const s2 = sign$1(this.scale.y) || 1;
|
|
14472
14472
|
this.scale.y = s2 * value / this._texture.orig.height, this._height = value;
|
|
14473
14473
|
}
|
|
14474
14474
|
/**
|
|
@@ -15164,7 +15164,7 @@ void main(void)
|
|
|
15164
15164
|
*/
|
|
15165
15165
|
hue(rotation, multiply) {
|
|
15166
15166
|
rotation = (rotation || 0) / 180 * Math.PI;
|
|
15167
|
-
const cosR = Math.cos(rotation), sinR = Math.sin(rotation),
|
|
15167
|
+
const cosR = Math.cos(rotation), sinR = Math.sin(rotation), sqrt2 = Math.sqrt, w2 = 1 / 3, sqrW = sqrt2(w2), a00 = cosR + (1 - cosR) * w2, a01 = w2 * (1 - cosR) - sqrW * sinR, a02 = w2 * (1 - cosR) + sqrW * sinR, a10 = w2 * (1 - cosR) + sqrW * sinR, a11 = cosR + w2 * (1 - cosR), a12 = w2 * (1 - cosR) - sqrW * sinR, a20 = w2 * (1 - cosR) - sqrW * sinR, a21 = w2 * (1 - cosR) + sqrW * sinR, a22 = cosR + w2 * (1 - cosR), matrix = [
|
|
15168
15168
|
a00,
|
|
15169
15169
|
a01,
|
|
15170
15170
|
a02,
|
|
@@ -17784,8 +17784,8 @@ void main()
|
|
|
17784
17784
|
*/
|
|
17785
17785
|
constructor(renderer) {
|
|
17786
17786
|
this.debug = false, this._isActive = false, this._isMobileAccessibility = false, this.pool = [], this.renderId = 0, this.children = [], this.androidUpdateCount = 0, this.androidUpdateFrequency = 500, this._hookDiv = null, (isMobile.tablet || isMobile.phone) && this.createTouchHook();
|
|
17787
|
-
const
|
|
17788
|
-
|
|
17787
|
+
const div2 = document.createElement("div");
|
|
17788
|
+
div2.style.width = `${DIV_TOUCH_SIZE}px`, div2.style.height = `${DIV_TOUCH_SIZE}px`, div2.style.position = "absolute", div2.style.top = `${DIV_TOUCH_POS_X}px`, div2.style.left = `${DIV_TOUCH_POS_Y}px`, div2.style.zIndex = DIV_TOUCH_ZINDEX.toString(), this.div = div2, this.renderer = renderer, this._onKeyDown = this._onKeyDown.bind(this), this._onMouseMove = this._onMouseMove.bind(this), globalThis.addEventListener("keydown", this._onKeyDown, false);
|
|
17789
17789
|
}
|
|
17790
17790
|
/**
|
|
17791
17791
|
* Value of `true` if accessibility is currently active and accessibility layers are showing.
|
|
@@ -17862,17 +17862,17 @@ void main()
|
|
|
17862
17862
|
return;
|
|
17863
17863
|
this.renderer.lastObjectRendered && this.updateAccessibleObjects(this.renderer.lastObjectRendered);
|
|
17864
17864
|
const { x: x2, y: y2, width, height } = this.renderer.view.getBoundingClientRect(), { width: viewWidth, height: viewHeight, resolution } = this.renderer, sx = width / viewWidth * resolution, sy = height / viewHeight * resolution;
|
|
17865
|
-
let
|
|
17866
|
-
|
|
17865
|
+
let div2 = this.div;
|
|
17866
|
+
div2.style.left = `${x2}px`, div2.style.top = `${y2}px`, div2.style.width = `${viewWidth}px`, div2.style.height = `${viewHeight}px`;
|
|
17867
17867
|
for (let i2 = 0; i2 < this.children.length; i2++) {
|
|
17868
17868
|
const child = this.children[i2];
|
|
17869
17869
|
if (child.renderId !== this.renderId)
|
|
17870
17870
|
child._accessibleActive = false, removeItems(this.children, i2, 1), this.div.removeChild(child._accessibleDiv), this.pool.push(child._accessibleDiv), child._accessibleDiv = null, i2--;
|
|
17871
17871
|
else {
|
|
17872
|
-
|
|
17872
|
+
div2 = child._accessibleDiv;
|
|
17873
17873
|
let hitArea = child.hitArea;
|
|
17874
17874
|
const wt = child.worldTransform;
|
|
17875
|
-
child.hitArea ? (
|
|
17875
|
+
child.hitArea ? (div2.style.left = `${(wt.tx + hitArea.x * wt.a) * sx}px`, div2.style.top = `${(wt.ty + hitArea.y * wt.d) * sy}px`, div2.style.width = `${hitArea.width * wt.a * sx}px`, div2.style.height = `${hitArea.height * wt.d * sy}px`) : (hitArea = child.getBounds(), this.capHitArea(hitArea), div2.style.left = `${hitArea.x * sx}px`, div2.style.top = `${hitArea.y * sy}px`, div2.style.width = `${hitArea.width * sx}px`, div2.style.height = `${hitArea.height * sy}px`, div2.title !== child.accessibleTitle && child.accessibleTitle !== null && (div2.title = child.accessibleTitle), div2.getAttribute("aria-label") !== child.accessibleHint && child.accessibleHint !== null && div2.setAttribute("aria-label", child.accessibleHint)), (child.accessibleTitle !== div2.title || child.tabIndex !== div2.tabIndex) && (div2.title = child.accessibleTitle, div2.tabIndex = child.tabIndex, this.debug && this.updateDebugHTML(div2));
|
|
17876
17876
|
}
|
|
17877
17877
|
}
|
|
17878
17878
|
this.renderId++;
|
|
@@ -17882,8 +17882,8 @@ void main()
|
|
|
17882
17882
|
* accessability div
|
|
17883
17883
|
* @param {HTMLElement} div -
|
|
17884
17884
|
*/
|
|
17885
|
-
updateDebugHTML(
|
|
17886
|
-
|
|
17885
|
+
updateDebugHTML(div2) {
|
|
17886
|
+
div2.innerHTML = `type: ${div2.type}</br> title : ${div2.title}</br> tabIndex: ${div2.tabIndex}`;
|
|
17887
17887
|
}
|
|
17888
17888
|
/**
|
|
17889
17889
|
* Adjust the hit area based on the bounds of a display object
|
|
@@ -17900,8 +17900,8 @@ void main()
|
|
|
17900
17900
|
* @param {PIXI.DisplayObject} displayObject - The child to make accessible.
|
|
17901
17901
|
*/
|
|
17902
17902
|
addChild(displayObject) {
|
|
17903
|
-
let
|
|
17904
|
-
|
|
17903
|
+
let div2 = this.pool.pop();
|
|
17904
|
+
div2 || (div2 = document.createElement("button"), div2.style.width = `${DIV_TOUCH_SIZE}px`, div2.style.height = `${DIV_TOUCH_SIZE}px`, div2.style.backgroundColor = this.debug ? "rgba(255,255,255,0.5)" : "transparent", div2.style.position = "absolute", div2.style.zIndex = DIV_TOUCH_ZINDEX.toString(), div2.style.borderStyle = "none", navigator.userAgent.toLowerCase().includes("chrome") ? div2.setAttribute("aria-live", "off") : div2.setAttribute("aria-live", "polite"), navigator.userAgent.match(/rv:.*Gecko\//) ? div2.setAttribute("aria-relevant", "additions") : div2.setAttribute("aria-relevant", "text"), div2.addEventListener("click", this._onClick.bind(this)), div2.addEventListener("focus", this._onFocus.bind(this)), div2.addEventListener("focusout", this._onFocusOut.bind(this))), div2.style.pointerEvents = displayObject.accessiblePointerEvents, div2.type = displayObject.accessibleType, displayObject.accessibleTitle && displayObject.accessibleTitle !== null ? div2.title = displayObject.accessibleTitle : (!displayObject.accessibleHint || displayObject.accessibleHint === null) && (div2.title = `displayObject ${displayObject.tabIndex}`), displayObject.accessibleHint && displayObject.accessibleHint !== null && div2.setAttribute("aria-label", displayObject.accessibleHint), this.debug && this.updateDebugHTML(div2), displayObject._accessibleActive = true, displayObject._accessibleDiv = div2, div2.displayObject = displayObject, this.children.push(displayObject), this.div.appendChild(displayObject._accessibleDiv), displayObject._accessibleDiv.tabIndex = displayObject.tabIndex;
|
|
17905
17905
|
}
|
|
17906
17906
|
/**
|
|
17907
17907
|
* Dispatch events with the EventSystem.
|
|
@@ -20510,7 +20510,7 @@ Please use Assets.add({ alias, src, data, format, loadParser }) instead.`), asse
|
|
|
20510
20510
|
eoy
|
|
20511
20511
|
), 2;
|
|
20512
20512
|
}
|
|
20513
|
-
function round(cx, cy, sx, sy, ex, ey, verts, clockwise) {
|
|
20513
|
+
function round$1(cx, cy, sx, sy, ex, ey, verts, clockwise) {
|
|
20514
20514
|
const cx2p0x = sx - cx, cy2p0y = sy - cy;
|
|
20515
20515
|
let angle0 = Math.atan2(cx2p0x, cy2p0y), angle1 = Math.atan2(ex - cx, ey - cy);
|
|
20516
20516
|
clockwise && angle0 < angle1 ? angle0 += Math.PI * 2 : !clockwise && angle0 > angle1 && (angle1 += Math.PI * 2);
|
|
@@ -20577,7 +20577,7 @@ Please use Assets.add({ alias, src, data, format, loadParser }) instead.`), asse
|
|
|
20577
20577
|
let x0 = points[0], y0 = points[1], x1 = points[2], y1 = points[3], x2 = 0, y2 = 0, perpx = -(y0 - y1), perpy = x0 - x1, perp1x = 0, perp1y = 0, dist = Math.sqrt(perpx * perpx + perpy * perpy);
|
|
20578
20578
|
perpx /= dist, perpy /= dist, perpx *= width, perpy *= width;
|
|
20579
20579
|
const ratio = style.alignment, innerWeight = (1 - ratio) * 2, outerWeight = ratio * 2;
|
|
20580
|
-
closedShape || (style.cap === LINE_CAP.ROUND ? indexCount += round(
|
|
20580
|
+
closedShape || (style.cap === LINE_CAP.ROUND ? indexCount += round$1(
|
|
20581
20581
|
x0 - perpx * (innerWeight - outerWeight) * 0.5,
|
|
20582
20582
|
y0 - perpy * (innerWeight - outerWeight) * 0.5,
|
|
20583
20583
|
x0 - perpx * innerWeight,
|
|
@@ -20601,7 +20601,7 @@ Please use Assets.add({ alias, src, data, format, loadParser }) instead.`), asse
|
|
|
20601
20601
|
y1 - perpy * innerWeight,
|
|
20602
20602
|
x1 + perpx * outerWeight,
|
|
20603
20603
|
y1 + perpy * outerWeight
|
|
20604
|
-
), dot >= 0 && (style.join === LINE_JOIN.ROUND ? indexCount += round(
|
|
20604
|
+
), dot >= 0 && (style.join === LINE_JOIN.ROUND ? indexCount += round$1(
|
|
20605
20605
|
x1,
|
|
20606
20606
|
y1,
|
|
20607
20607
|
x1 - perpx * innerWeight,
|
|
@@ -20665,7 +20665,7 @@ Please use Assets.add({ alias, src, data, format, loadParser }) instead.`), asse
|
|
|
20665
20665
|
imy,
|
|
20666
20666
|
x1 + perpx * outerWeight,
|
|
20667
20667
|
y1 + perpy * outerWeight
|
|
20668
|
-
), indexCount += round(
|
|
20668
|
+
), indexCount += round$1(
|
|
20669
20669
|
x1,
|
|
20670
20670
|
y1,
|
|
20671
20671
|
x1 + perpx * outerWeight,
|
|
@@ -20684,7 +20684,7 @@ Please use Assets.add({ alias, src, data, format, loadParser }) instead.`), asse
|
|
|
20684
20684
|
y1 - perpy * innerWeight,
|
|
20685
20685
|
omx,
|
|
20686
20686
|
omy
|
|
20687
|
-
), indexCount += round(
|
|
20687
|
+
), indexCount += round$1(
|
|
20688
20688
|
x1,
|
|
20689
20689
|
y1,
|
|
20690
20690
|
x1 - perpx * innerWeight,
|
|
@@ -20727,7 +20727,7 @@ Please use Assets.add({ alias, src, data, format, loadParser }) instead.`), asse
|
|
|
20727
20727
|
break;
|
|
20728
20728
|
}
|
|
20729
20729
|
case LINE_JOIN.ROUND: {
|
|
20730
|
-
clockwise ? indexCount += round(
|
|
20730
|
+
clockwise ? indexCount += round$1(
|
|
20731
20731
|
x1,
|
|
20732
20732
|
y1,
|
|
20733
20733
|
x1 + perpx * outerWeight,
|
|
@@ -20736,7 +20736,7 @@ Please use Assets.add({ alias, src, data, format, loadParser }) instead.`), asse
|
|
|
20736
20736
|
y1 + perp1y * outerWeight,
|
|
20737
20737
|
verts,
|
|
20738
20738
|
true
|
|
20739
|
-
) + 2 : indexCount += round(
|
|
20739
|
+
) + 2 : indexCount += round$1(
|
|
20740
20740
|
x1,
|
|
20741
20741
|
y1,
|
|
20742
20742
|
x1 - perpx * innerWeight,
|
|
@@ -20763,7 +20763,7 @@ Please use Assets.add({ alias, src, data, format, loadParser }) instead.`), asse
|
|
|
20763
20763
|
y1 - perpy * innerWeight,
|
|
20764
20764
|
x1 + perpx * outerWeight,
|
|
20765
20765
|
y1 + perpy * outerWeight
|
|
20766
|
-
), closedShape || (style.cap === LINE_CAP.ROUND ? indexCount += round(
|
|
20766
|
+
), closedShape || (style.cap === LINE_CAP.ROUND ? indexCount += round$1(
|
|
20767
20767
|
x1 - perpx * (innerWeight - outerWeight) * 0.5,
|
|
20768
20768
|
y1 - perpy * (innerWeight - outerWeight) * 0.5,
|
|
20769
20769
|
x1 - perpx * innerWeight,
|
|
@@ -23724,7 +23724,7 @@ void main(void){
|
|
|
23724
23724
|
}
|
|
23725
23725
|
set width(value) {
|
|
23726
23726
|
this.updateText(true);
|
|
23727
|
-
const s2 = sign(this.scale.x) || 1;
|
|
23727
|
+
const s2 = sign$1(this.scale.x) || 1;
|
|
23728
23728
|
this.scale.x = s2 * value / this._texture.orig.width, this._width = value;
|
|
23729
23729
|
}
|
|
23730
23730
|
/** The height of the Text, setting this will actually modify the scale to achieve the value set. */
|
|
@@ -23733,7 +23733,7 @@ void main(void){
|
|
|
23733
23733
|
}
|
|
23734
23734
|
set height(value) {
|
|
23735
23735
|
this.updateText(true);
|
|
23736
|
-
const s2 = sign(this.scale.y) || 1;
|
|
23736
|
+
const s2 = sign$1(this.scale.y) || 1;
|
|
23737
23737
|
this.scale.y = s2 * value / this._texture.orig.height, this._height = value;
|
|
23738
23738
|
}
|
|
23739
23739
|
/**
|
|
@@ -25640,7 +25640,7 @@ void main(void)\r
|
|
|
25640
25640
|
}
|
|
25641
25641
|
set width(value) {
|
|
25642
25642
|
this.updateText(true);
|
|
25643
|
-
const s2 = sign(this.scale.x) || 1;
|
|
25643
|
+
const s2 = sign$1(this.scale.x) || 1;
|
|
25644
25644
|
this.scale.x = s2 * value / this._image.width / this.resolution, this._width = value;
|
|
25645
25645
|
}
|
|
25646
25646
|
/**
|
|
@@ -25652,7 +25652,7 @@ void main(void)\r
|
|
|
25652
25652
|
}
|
|
25653
25653
|
set height(value) {
|
|
25654
25654
|
this.updateText(true);
|
|
25655
|
-
const s2 = sign(this.scale.y) || 1;
|
|
25655
|
+
const s2 = sign$1(this.scale.y) || 1;
|
|
25656
25656
|
this.scale.y = s2 * value / this._image.height / this.resolution, this._height = value;
|
|
25657
25657
|
}
|
|
25658
25658
|
/** The base style to render with text. */
|
|
@@ -26134,7 +26134,7 @@ void main(void)\r
|
|
|
26134
26134
|
return value < min2 ? min2 : value > max2 ? max2 : value;
|
|
26135
26135
|
}, getUnit = function getUnit2(value, v2) {
|
|
26136
26136
|
return !_isString(value) || !(v2 = _unitExp.exec(value)) ? "" : v2[1];
|
|
26137
|
-
}, clamp = function clamp2(min2, max2, value) {
|
|
26137
|
+
}, clamp$1 = function clamp2(min2, max2, value) {
|
|
26138
26138
|
return _conditionalReturn(value, function(v2) {
|
|
26139
26139
|
return _clamp(min2, max2, v2);
|
|
26140
26140
|
});
|
|
@@ -26166,14 +26166,14 @@ void main(void)\r
|
|
|
26166
26166
|
}
|
|
26167
26167
|
var vars = _isObject(v2) ? v2 : {
|
|
26168
26168
|
each: v2
|
|
26169
|
-
}, ease = _parseEase(vars.ease), from = vars.from || 0, base = parseFloat(vars.base) || 0, cache = {},
|
|
26169
|
+
}, ease = _parseEase(vars.ease), from = vars.from || 0, base = parseFloat(vars.base) || 0, cache = {}, isDecimal2 = from > 0 && from < 1, ratios = isNaN(from) || isDecimal2, axis = vars.axis, ratioX = from, ratioY = from;
|
|
26170
26170
|
if (_isString(from)) {
|
|
26171
26171
|
ratioX = ratioY = {
|
|
26172
26172
|
center: 0.5,
|
|
26173
26173
|
edges: 0.5,
|
|
26174
26174
|
end: 1
|
|
26175
26175
|
}[from] || 0;
|
|
26176
|
-
} else if (!
|
|
26176
|
+
} else if (!isDecimal2 && ratios) {
|
|
26177
26177
|
ratioX = from[0];
|
|
26178
26178
|
ratioY = from[1];
|
|
26179
26179
|
}
|
|
@@ -26250,7 +26250,7 @@ void main(void)\r
|
|
|
26250
26250
|
closest = !radius || min2 <= radius ? snapTo[closest] : raw;
|
|
26251
26251
|
return is2D || closest === raw || _isNumber(raw) ? closest : closest + getUnit(raw);
|
|
26252
26252
|
});
|
|
26253
|
-
}, random = function random2(min2, max2, roundingIncrement, returnFunction) {
|
|
26253
|
+
}, random$1 = function random2(min2, max2, roundingIncrement, returnFunction) {
|
|
26254
26254
|
return _conditionalReturn(_isArray(min2) ? !max2 : roundingIncrement === true ? !!(roundingIncrement = 0) : !returnFunction, function() {
|
|
26255
26255
|
return _isArray(min2) ? min2[~~(Math.random() * min2.length)] : (roundingIncrement = roundingIncrement || 1e-5) && (returnFunction = roundingIncrement < 1 ? Math.pow(10, (roundingIncrement + "").length - 2) : 1) && Math.floor(Math.round((min2 - roundingIncrement / 2 + Math.random() * (max2 - min2 + roundingIncrement * 0.99)) / roundingIncrement) * roundingIncrement * returnFunction) / returnFunction;
|
|
26256
26256
|
});
|
|
@@ -26290,7 +26290,7 @@ void main(void)\r
|
|
|
26290
26290
|
end = value.indexOf(")", i2);
|
|
26291
26291
|
isArray2 = value.charAt(i2 + 7) === "[";
|
|
26292
26292
|
nums = value.substr(i2 + 7, end - i2 - 7).match(isArray2 ? _delimitedValueExp : _strictNumExp);
|
|
26293
|
-
s2 += value.substr(prev, i2 - prev) + random(isArray2 ? nums : +nums[0], isArray2 ? 0 : +nums[1], +nums[2] || 1e-5);
|
|
26293
|
+
s2 += value.substr(prev, i2 - prev) + random$1(isArray2 ? nums : +nums[0], isArray2 ? 0 : +nums[1], +nums[2] || 1e-5);
|
|
26294
26294
|
prev = end + 1;
|
|
26295
26295
|
}
|
|
26296
26296
|
return s2 + value.substr(prev, value.length - prev);
|
|
@@ -26367,14 +26367,14 @@ void main(void)\r
|
|
|
26367
26367
|
animation.scrollTrigger && animation.scrollTrigger.kill(!!_reverting$1);
|
|
26368
26368
|
animation.progress() < 1 && _callback(animation, "onInterrupt");
|
|
26369
26369
|
return animation;
|
|
26370
|
-
}, _quickTween, _registerPluginQueue = [], _createPlugin = function _createPlugin2(
|
|
26371
|
-
if (!
|
|
26370
|
+
}, _quickTween, _registerPluginQueue = [], _createPlugin = function _createPlugin2(config2) {
|
|
26371
|
+
if (!config2)
|
|
26372
26372
|
return;
|
|
26373
|
-
|
|
26374
|
-
if (_windowExists$1() ||
|
|
26375
|
-
var name =
|
|
26373
|
+
config2 = !config2.name && config2["default"] || config2;
|
|
26374
|
+
if (_windowExists$1() || config2.headless) {
|
|
26375
|
+
var name = config2.name, isFunc = _isFunction(config2), Plugin = name && !isFunc && config2.init ? function() {
|
|
26376
26376
|
this._props = [];
|
|
26377
|
-
} :
|
|
26377
|
+
} : config2, instanceDefaults = {
|
|
26378
26378
|
init: _emptyFunc,
|
|
26379
26379
|
render: _renderPropTweens,
|
|
26380
26380
|
add: _addPropTween,
|
|
@@ -26389,23 +26389,23 @@ void main(void)\r
|
|
|
26389
26389
|
register: 0
|
|
26390
26390
|
};
|
|
26391
26391
|
_wake();
|
|
26392
|
-
if (
|
|
26392
|
+
if (config2 !== Plugin) {
|
|
26393
26393
|
if (_plugins[name]) {
|
|
26394
26394
|
return;
|
|
26395
26395
|
}
|
|
26396
|
-
_setDefaults(Plugin, _setDefaults(_copyExcluding(
|
|
26397
|
-
_merge(Plugin.prototype, _merge(instanceDefaults, _copyExcluding(
|
|
26396
|
+
_setDefaults(Plugin, _setDefaults(_copyExcluding(config2, instanceDefaults), statics));
|
|
26397
|
+
_merge(Plugin.prototype, _merge(instanceDefaults, _copyExcluding(config2, statics)));
|
|
26398
26398
|
_plugins[Plugin.prop = name] = Plugin;
|
|
26399
|
-
if (
|
|
26399
|
+
if (config2.targetTest) {
|
|
26400
26400
|
_harnessPlugins.push(Plugin);
|
|
26401
26401
|
_reservedProps[name] = 1;
|
|
26402
26402
|
}
|
|
26403
26403
|
name = (name === "css" ? "CSS" : name.charAt(0).toUpperCase() + name.substr(1)) + "Plugin";
|
|
26404
26404
|
}
|
|
26405
26405
|
_addGlobal(name, Plugin);
|
|
26406
|
-
|
|
26406
|
+
config2.register && config2.register(gsap, Plugin, PropTween);
|
|
26407
26407
|
} else {
|
|
26408
|
-
_registerPluginQueue.push(
|
|
26408
|
+
_registerPluginQueue.push(config2);
|
|
26409
26409
|
}
|
|
26410
26410
|
}, _255 = 255, _colorLookup = {
|
|
26411
26411
|
aqua: [0, _255, _255],
|
|
@@ -26607,7 +26607,7 @@ void main(void)\r
|
|
|
26607
26607
|
_gap = 1e3 / (_fps || 240);
|
|
26608
26608
|
_nextTime = _self.time * 1e3 + _gap;
|
|
26609
26609
|
},
|
|
26610
|
-
add: function
|
|
26610
|
+
add: function add2(callback, once, prioritize) {
|
|
26611
26611
|
var func = once ? function(t2, d2, f2, v2) {
|
|
26612
26612
|
callback(t2, d2, f2, v2);
|
|
26613
26613
|
_self.remove(func);
|
|
@@ -26750,7 +26750,7 @@ void main(void)\r
|
|
|
26750
26750
|
});
|
|
26751
26751
|
_insertEase("Back", _configBack("in"), _configBack("out"), _configBack());
|
|
26752
26752
|
_easeMap.SteppedEase = _easeMap.steps = _globals.SteppedEase = {
|
|
26753
|
-
config: function
|
|
26753
|
+
config: function config2(steps, immediateStart) {
|
|
26754
26754
|
if (steps === void 0) {
|
|
26755
26755
|
steps = 1;
|
|
26756
26756
|
}
|
|
@@ -26893,17 +26893,17 @@ void main(void)\r
|
|
|
26893
26893
|
var parent = this.parent || this._dp;
|
|
26894
26894
|
return !parent ? this._tTime : wrapRepeats && (!this._ts || this._repeat && this._time && this.totalProgress() < 1) ? this._tTime % (this._dur + this._rDelay) : !this._ts ? this._tTime : _parentToChildTotalTime(parent.rawTime(wrapRepeats), this);
|
|
26895
26895
|
};
|
|
26896
|
-
_proto.revert = function revert(
|
|
26897
|
-
if (
|
|
26898
|
-
|
|
26896
|
+
_proto.revert = function revert(config2) {
|
|
26897
|
+
if (config2 === void 0) {
|
|
26898
|
+
config2 = _revertConfig;
|
|
26899
26899
|
}
|
|
26900
26900
|
var prevIsReverting = _reverting$1;
|
|
26901
|
-
_reverting$1 =
|
|
26901
|
+
_reverting$1 = config2;
|
|
26902
26902
|
if (this._initted || this._startAt) {
|
|
26903
|
-
this.timeline && this.timeline.revert(
|
|
26904
|
-
this.totalTime(-0.01,
|
|
26903
|
+
this.timeline && this.timeline.revert(config2);
|
|
26904
|
+
this.totalTime(-0.01, config2.suppressEvents);
|
|
26905
26905
|
}
|
|
26906
|
-
this.data !== "nested" &&
|
|
26906
|
+
this.data !== "nested" && config2.kill !== false && this.kill();
|
|
26907
26907
|
_reverting$1 = prevIsReverting;
|
|
26908
26908
|
return this;
|
|
26909
26909
|
};
|
|
@@ -27240,7 +27240,7 @@ void main(void)\r
|
|
|
27240
27240
|
}
|
|
27241
27241
|
return this;
|
|
27242
27242
|
};
|
|
27243
|
-
_proto2.add = function
|
|
27243
|
+
_proto2.add = function add2(child, position) {
|
|
27244
27244
|
var _this2 = this;
|
|
27245
27245
|
_isNumber(position) || (position = _parsePosition(this, position, child));
|
|
27246
27246
|
if (!(child instanceof Animation$3)) {
|
|
@@ -28279,7 +28279,7 @@ void main(void)\r
|
|
|
28279
28279
|
func && this.add(func);
|
|
28280
28280
|
}
|
|
28281
28281
|
var _proto5 = Context2.prototype;
|
|
28282
|
-
_proto5.add = function
|
|
28282
|
+
_proto5.add = function add2(name, func, scope) {
|
|
28283
28283
|
if (_isFunction(name)) {
|
|
28284
28284
|
scope = func;
|
|
28285
28285
|
func = name;
|
|
@@ -28372,8 +28372,8 @@ void main(void)\r
|
|
|
28372
28372
|
}
|
|
28373
28373
|
}
|
|
28374
28374
|
};
|
|
28375
|
-
_proto5.revert = function revert(
|
|
28376
|
-
this.kill(
|
|
28375
|
+
_proto5.revert = function revert(config2) {
|
|
28376
|
+
this.kill(config2 || {});
|
|
28377
28377
|
};
|
|
28378
28378
|
return Context2;
|
|
28379
28379
|
}();
|
|
@@ -28384,7 +28384,7 @@ void main(void)\r
|
|
|
28384
28384
|
_context && _context.data.push(this);
|
|
28385
28385
|
}
|
|
28386
28386
|
var _proto6 = MatchMedia2.prototype;
|
|
28387
|
-
_proto6.add = function
|
|
28387
|
+
_proto6.add = function add2(conditions, func, scope) {
|
|
28388
28388
|
_isObject(conditions) || (conditions = {
|
|
28389
28389
|
matches: conditions
|
|
28390
28390
|
});
|
|
@@ -28410,8 +28410,8 @@ void main(void)\r
|
|
|
28410
28410
|
});
|
|
28411
28411
|
return this;
|
|
28412
28412
|
};
|
|
28413
|
-
_proto6.revert = function revert(
|
|
28414
|
-
this.kill(
|
|
28413
|
+
_proto6.revert = function revert(config2) {
|
|
28414
|
+
this.kill(config2 || {});
|
|
28415
28415
|
};
|
|
28416
28416
|
_proto6.kill = function kill(revert) {
|
|
28417
28417
|
this.contexts.forEach(function(c2) {
|
|
@@ -28425,8 +28425,8 @@ void main(void)\r
|
|
|
28425
28425
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
28426
28426
|
args[_key2] = arguments[_key2];
|
|
28427
28427
|
}
|
|
28428
|
-
args.forEach(function(
|
|
28429
|
-
return _createPlugin(
|
|
28428
|
+
args.forEach(function(config2) {
|
|
28429
|
+
return _createPlugin(config2);
|
|
28430
28430
|
});
|
|
28431
28431
|
},
|
|
28432
28432
|
timeline: function timeline(vars) {
|
|
@@ -28483,7 +28483,7 @@ void main(void)\r
|
|
|
28483
28483
|
value && value.ease && (value.ease = _parseEase(value.ease, _defaults.ease));
|
|
28484
28484
|
return _mergeDeep(_defaults, value || {});
|
|
28485
28485
|
},
|
|
28486
|
-
config: function
|
|
28486
|
+
config: function config2(value) {
|
|
28487
28487
|
return _mergeDeep(_config, value || {});
|
|
28488
28488
|
},
|
|
28489
28489
|
registerEffect: function registerEffect(_ref3) {
|
|
@@ -28559,11 +28559,11 @@ void main(void)\r
|
|
|
28559
28559
|
wrap,
|
|
28560
28560
|
wrapYoyo,
|
|
28561
28561
|
distribute,
|
|
28562
|
-
random,
|
|
28562
|
+
random: random$1,
|
|
28563
28563
|
snap,
|
|
28564
28564
|
normalize: normalize$1,
|
|
28565
28565
|
getUnit,
|
|
28566
|
-
clamp,
|
|
28566
|
+
clamp: clamp$1,
|
|
28567
28567
|
splitColor,
|
|
28568
28568
|
toArray,
|
|
28569
28569
|
selector,
|
|
@@ -29242,7 +29242,7 @@ void main(void)\r
|
|
|
29242
29242
|
if ("x" in cache && !uncache && !cache.uncache) {
|
|
29243
29243
|
return cache;
|
|
29244
29244
|
}
|
|
29245
|
-
var style = target.style, invertedScaleX = cache.scaleX < 0, px = "px", deg = "deg", cs = getComputedStyle(target), origin = _getComputedProperty(target, _transformOriginProp) || "0", x2, y2, z2, scaleX, scaleY, rotation, rotationX, rotationY, skewX, skewY, perspective, xOrigin, yOrigin, matrix, angle,
|
|
29245
|
+
var style = target.style, invertedScaleX = cache.scaleX < 0, px = "px", deg = "deg", cs = getComputedStyle(target), origin = _getComputedProperty(target, _transformOriginProp) || "0", x2, y2, z2, scaleX, scaleY, rotation, rotationX, rotationY, skewX, skewY, perspective, xOrigin, yOrigin, matrix, angle, cos2, sin2, a2, b2, c2, d2, a12, a22, t1, t2, t3, a13, a23, a33, a42, a43, a32;
|
|
29246
29246
|
x2 = y2 = z2 = rotation = rotationX = rotationY = skewX = skewY = perspective = 0;
|
|
29247
29247
|
scaleX = scaleY = 1;
|
|
29248
29248
|
cache.svg = !!(target.getCTM && _isSVG(target));
|
|
@@ -29295,15 +29295,15 @@ void main(void)\r
|
|
|
29295
29295
|
angle = _atan2(a32, a33);
|
|
29296
29296
|
rotationX = angle * _RAD2DEG;
|
|
29297
29297
|
if (angle) {
|
|
29298
|
-
|
|
29299
|
-
|
|
29300
|
-
t1 = a12 *
|
|
29301
|
-
t2 = a22 *
|
|
29302
|
-
t3 = a32 *
|
|
29303
|
-
a13 = a12 * -
|
|
29304
|
-
a23 = a22 * -
|
|
29305
|
-
a33 = a32 * -
|
|
29306
|
-
a43 = a42 * -
|
|
29298
|
+
cos2 = Math.cos(-angle);
|
|
29299
|
+
sin2 = Math.sin(-angle);
|
|
29300
|
+
t1 = a12 * cos2 + a13 * sin2;
|
|
29301
|
+
t2 = a22 * cos2 + a23 * sin2;
|
|
29302
|
+
t3 = a32 * cos2 + a33 * sin2;
|
|
29303
|
+
a13 = a12 * -sin2 + a13 * cos2;
|
|
29304
|
+
a23 = a22 * -sin2 + a23 * cos2;
|
|
29305
|
+
a33 = a32 * -sin2 + a33 * cos2;
|
|
29306
|
+
a43 = a42 * -sin2 + a43 * cos2;
|
|
29307
29307
|
a12 = t1;
|
|
29308
29308
|
a22 = t2;
|
|
29309
29309
|
a32 = t3;
|
|
@@ -29311,12 +29311,12 @@ void main(void)\r
|
|
|
29311
29311
|
angle = _atan2(-c2, a33);
|
|
29312
29312
|
rotationY = angle * _RAD2DEG;
|
|
29313
29313
|
if (angle) {
|
|
29314
|
-
|
|
29315
|
-
|
|
29316
|
-
t1 = a2 *
|
|
29317
|
-
t2 = b2 *
|
|
29318
|
-
t3 = c2 *
|
|
29319
|
-
a43 = d2 *
|
|
29314
|
+
cos2 = Math.cos(-angle);
|
|
29315
|
+
sin2 = Math.sin(-angle);
|
|
29316
|
+
t1 = a2 * cos2 - a13 * sin2;
|
|
29317
|
+
t2 = b2 * cos2 - a23 * sin2;
|
|
29318
|
+
t3 = c2 * cos2 - a33 * sin2;
|
|
29319
|
+
a43 = d2 * sin2 + a43 * cos2;
|
|
29320
29320
|
a2 = t1;
|
|
29321
29321
|
b2 = t2;
|
|
29322
29322
|
c2 = t3;
|
|
@@ -29324,12 +29324,12 @@ void main(void)\r
|
|
|
29324
29324
|
angle = _atan2(b2, a2);
|
|
29325
29325
|
rotation = angle * _RAD2DEG;
|
|
29326
29326
|
if (angle) {
|
|
29327
|
-
|
|
29328
|
-
|
|
29329
|
-
t1 = a2 *
|
|
29330
|
-
t2 = a12 *
|
|
29331
|
-
b2 = b2 *
|
|
29332
|
-
a22 = a22 *
|
|
29327
|
+
cos2 = Math.cos(angle);
|
|
29328
|
+
sin2 = Math.sin(angle);
|
|
29329
|
+
t1 = a2 * cos2 + b2 * sin2;
|
|
29330
|
+
t2 = a12 * cos2 + a22 * sin2;
|
|
29331
|
+
b2 = b2 * cos2 - a2 * sin2;
|
|
29332
|
+
a22 = a22 * cos2 - a12 * sin2;
|
|
29333
29333
|
a2 = t1;
|
|
29334
29334
|
a12 = t2;
|
|
29335
29335
|
}
|
|
@@ -29392,12 +29392,12 @@ void main(void)\r
|
|
|
29392
29392
|
}, _zeroDeg = "0deg", _zeroPx = "0px", _endParenthesis = ") ", _renderCSSTransforms = function _renderCSSTransforms2(ratio, cache) {
|
|
29393
29393
|
var _ref = cache || this, xPercent = _ref.xPercent, yPercent = _ref.yPercent, x2 = _ref.x, y2 = _ref.y, z2 = _ref.z, rotation = _ref.rotation, rotationY = _ref.rotationY, rotationX = _ref.rotationX, skewX = _ref.skewX, skewY = _ref.skewY, scaleX = _ref.scaleX, scaleY = _ref.scaleY, transformPerspective = _ref.transformPerspective, force3D = _ref.force3D, target = _ref.target, zOrigin = _ref.zOrigin, transforms = "", use3D = force3D === "auto" && ratio && ratio !== 1 || force3D === true;
|
|
29394
29394
|
if (zOrigin && (rotationX !== _zeroDeg || rotationY !== _zeroDeg)) {
|
|
29395
|
-
var angle = parseFloat(rotationY) * _DEG2RAD, a13 = Math.sin(angle), a33 = Math.cos(angle),
|
|
29395
|
+
var angle = parseFloat(rotationY) * _DEG2RAD, a13 = Math.sin(angle), a33 = Math.cos(angle), cos2;
|
|
29396
29396
|
angle = parseFloat(rotationX) * _DEG2RAD;
|
|
29397
|
-
|
|
29398
|
-
x2 = _addPxTranslate(target, x2, a13 *
|
|
29397
|
+
cos2 = Math.cos(angle);
|
|
29398
|
+
x2 = _addPxTranslate(target, x2, a13 * cos2 * -zOrigin);
|
|
29399
29399
|
y2 = _addPxTranslate(target, y2, -Math.sin(angle) * -zOrigin);
|
|
29400
|
-
z2 = _addPxTranslate(target, z2, a33 *
|
|
29400
|
+
z2 = _addPxTranslate(target, z2, a33 * cos2 * -zOrigin + zOrigin);
|
|
29401
29401
|
}
|
|
29402
29402
|
if (transformPerspective !== _zeroPx) {
|
|
29403
29403
|
transforms += "perspective(" + transformPerspective + _endParenthesis;
|
|
@@ -30082,7 +30082,7 @@ void main(void)\r
|
|
|
30082
30082
|
* true, the Emitter will automatically call
|
|
30083
30083
|
* update via the PIXI shared ticker.
|
|
30084
30084
|
*/
|
|
30085
|
-
constructor(particleParent,
|
|
30085
|
+
constructor(particleParent, config2) {
|
|
30086
30086
|
this.initBehaviors = [];
|
|
30087
30087
|
this.updateBehaviors = [];
|
|
30088
30088
|
this.recycleBehaviors = [];
|
|
@@ -30114,8 +30114,8 @@ void main(void)\r
|
|
|
30114
30114
|
this._destroyWhenComplete = false;
|
|
30115
30115
|
this._completeCallback = null;
|
|
30116
30116
|
this.parent = particleParent;
|
|
30117
|
-
if (
|
|
30118
|
-
this.init(
|
|
30117
|
+
if (config2) {
|
|
30118
|
+
this.init(config2);
|
|
30119
30119
|
}
|
|
30120
30120
|
this.recycle = this.recycle;
|
|
30121
30121
|
this.update = this.update;
|
|
@@ -30160,41 +30160,41 @@ void main(void)\r
|
|
|
30160
30160
|
* Sets up the emitter based on the config settings.
|
|
30161
30161
|
* @param config A configuration object containing settings for the emitter.
|
|
30162
30162
|
*/
|
|
30163
|
-
init(
|
|
30164
|
-
if (!
|
|
30163
|
+
init(config2) {
|
|
30164
|
+
if (!config2) {
|
|
30165
30165
|
return;
|
|
30166
30166
|
}
|
|
30167
30167
|
this.cleanup();
|
|
30168
|
-
this._origConfig =
|
|
30169
|
-
this.minLifetime =
|
|
30170
|
-
this.maxLifetime =
|
|
30171
|
-
if (
|
|
30172
|
-
this.customEase = typeof
|
|
30168
|
+
this._origConfig = config2;
|
|
30169
|
+
this.minLifetime = config2.lifetime.min;
|
|
30170
|
+
this.maxLifetime = config2.lifetime.max;
|
|
30171
|
+
if (config2.ease) {
|
|
30172
|
+
this.customEase = typeof config2.ease === "function" ? config2.ease : generateEase(config2.ease);
|
|
30173
30173
|
} else {
|
|
30174
30174
|
this.customEase = null;
|
|
30175
30175
|
}
|
|
30176
30176
|
this.particlesPerWave = 1;
|
|
30177
|
-
if (
|
|
30178
|
-
this.particlesPerWave =
|
|
30179
|
-
}
|
|
30180
|
-
this.frequency =
|
|
30181
|
-
this.spawnChance = typeof
|
|
30182
|
-
this.emitterLifetime =
|
|
30183
|
-
this.maxParticles =
|
|
30184
|
-
this.addAtBack = !!
|
|
30177
|
+
if (config2.particlesPerWave && config2.particlesPerWave > 1) {
|
|
30178
|
+
this.particlesPerWave = config2.particlesPerWave;
|
|
30179
|
+
}
|
|
30180
|
+
this.frequency = config2.frequency;
|
|
30181
|
+
this.spawnChance = typeof config2.spawnChance === "number" && config2.spawnChance > 0 ? config2.spawnChance : 1;
|
|
30182
|
+
this.emitterLifetime = config2.emitterLifetime || -1;
|
|
30183
|
+
this.maxParticles = config2.maxParticles > 0 ? config2.maxParticles : 1e3;
|
|
30184
|
+
this.addAtBack = !!config2.addAtBack;
|
|
30185
30185
|
this.rotation = 0;
|
|
30186
30186
|
this.ownerPos.set(0);
|
|
30187
|
-
if (
|
|
30188
|
-
this.spawnPos.copyFrom(
|
|
30187
|
+
if (config2.pos) {
|
|
30188
|
+
this.spawnPos.copyFrom(config2.pos);
|
|
30189
30189
|
} else {
|
|
30190
30190
|
this.spawnPos.set(0);
|
|
30191
30191
|
}
|
|
30192
30192
|
this._prevEmitterPos.copyFrom(this.spawnPos);
|
|
30193
30193
|
this._prevPosIsValid = false;
|
|
30194
30194
|
this._spawnTimer = 0;
|
|
30195
|
-
this.emit =
|
|
30196
|
-
this.autoUpdate = !!
|
|
30197
|
-
const behaviors =
|
|
30195
|
+
this.emit = config2.emit === void 0 ? true : !!config2.emit;
|
|
30196
|
+
this.autoUpdate = !!config2.autoUpdate;
|
|
30197
|
+
const behaviors = config2.behaviors.map((data) => {
|
|
30198
30198
|
const constructor = Emitter.knownBehaviors[data.type];
|
|
30199
30199
|
if (!constructor) {
|
|
30200
30200
|
console.error(`Unknown behavior: ${data.type}`);
|
|
@@ -30629,11 +30629,11 @@ void main(void)\r
|
|
|
30629
30629
|
}
|
|
30630
30630
|
Emitter.knownBehaviors = {};
|
|
30631
30631
|
class Rectangle {
|
|
30632
|
-
constructor(
|
|
30633
|
-
this.x =
|
|
30634
|
-
this.y =
|
|
30635
|
-
this.w =
|
|
30636
|
-
this.h =
|
|
30632
|
+
constructor(config2) {
|
|
30633
|
+
this.x = config2.x;
|
|
30634
|
+
this.y = config2.y;
|
|
30635
|
+
this.w = config2.w;
|
|
30636
|
+
this.h = config2.h;
|
|
30637
30637
|
}
|
|
30638
30638
|
getRandPos(particle) {
|
|
30639
30639
|
particle.x = Math.random() * this.w + this.x;
|
|
@@ -30643,12 +30643,12 @@ void main(void)\r
|
|
|
30643
30643
|
Rectangle.type = "rect";
|
|
30644
30644
|
Rectangle.editorConfig = null;
|
|
30645
30645
|
class Torus {
|
|
30646
|
-
constructor(
|
|
30647
|
-
this.x =
|
|
30648
|
-
this.y =
|
|
30649
|
-
this.radius =
|
|
30650
|
-
this.innerRadius =
|
|
30651
|
-
this.rotation = !!
|
|
30646
|
+
constructor(config2) {
|
|
30647
|
+
this.x = config2.x || 0;
|
|
30648
|
+
this.y = config2.y || 0;
|
|
30649
|
+
this.radius = config2.radius;
|
|
30650
|
+
this.innerRadius = config2.innerRadius || 0;
|
|
30651
|
+
this.rotation = !!config2.affectRotation;
|
|
30652
30652
|
}
|
|
30653
30653
|
getRandPos(particle) {
|
|
30654
30654
|
if (this.innerRadius !== this.radius) {
|
|
@@ -30739,14 +30739,14 @@ void main(void)\r
|
|
|
30739
30739
|
PolygonalChain.type = "polygonalChain";
|
|
30740
30740
|
PolygonalChain.editorConfig = null;
|
|
30741
30741
|
class AccelerationBehavior {
|
|
30742
|
-
constructor(
|
|
30742
|
+
constructor(config2) {
|
|
30743
30743
|
var _a;
|
|
30744
30744
|
this.order = BehaviorOrder.Late;
|
|
30745
|
-
this.minStart =
|
|
30746
|
-
this.maxStart =
|
|
30747
|
-
this.accel =
|
|
30748
|
-
this.rotate = !!
|
|
30749
|
-
this.maxSpeed = (_a =
|
|
30745
|
+
this.minStart = config2.minStart;
|
|
30746
|
+
this.maxStart = config2.maxStart;
|
|
30747
|
+
this.accel = config2.accel;
|
|
30748
|
+
this.rotate = !!config2.rotate;
|
|
30749
|
+
this.maxSpeed = (_a = config2.maxSpeed) !== null && _a !== void 0 ? _a : 0;
|
|
30750
30750
|
}
|
|
30751
30751
|
initParticles(first) {
|
|
30752
30752
|
let next = first;
|
|
@@ -30874,10 +30874,10 @@ void main(void)\r
|
|
|
30874
30874
|
}
|
|
30875
30875
|
}
|
|
30876
30876
|
class AlphaBehavior {
|
|
30877
|
-
constructor(
|
|
30877
|
+
constructor(config2) {
|
|
30878
30878
|
this.order = BehaviorOrder.Normal;
|
|
30879
30879
|
this.list = new PropertyList(false);
|
|
30880
|
-
this.list.reset(PropertyNode.createList(
|
|
30880
|
+
this.list.reset(PropertyNode.createList(config2.alpha));
|
|
30881
30881
|
}
|
|
30882
30882
|
initParticles(first) {
|
|
30883
30883
|
let next = first;
|
|
@@ -30893,9 +30893,9 @@ void main(void)\r
|
|
|
30893
30893
|
AlphaBehavior.type = "alpha";
|
|
30894
30894
|
AlphaBehavior.editorConfig = null;
|
|
30895
30895
|
class StaticAlphaBehavior {
|
|
30896
|
-
constructor(
|
|
30896
|
+
constructor(config2) {
|
|
30897
30897
|
this.order = BehaviorOrder.Normal;
|
|
30898
|
-
this.value =
|
|
30898
|
+
this.value = config2.alpha;
|
|
30899
30899
|
}
|
|
30900
30900
|
initParticles(first) {
|
|
30901
30901
|
let next = first;
|
|
@@ -30930,11 +30930,11 @@ void main(void)\r
|
|
|
30930
30930
|
return outTextures;
|
|
30931
30931
|
}
|
|
30932
30932
|
class RandomAnimatedTextureBehavior {
|
|
30933
|
-
constructor(
|
|
30933
|
+
constructor(config2) {
|
|
30934
30934
|
this.order = BehaviorOrder.Normal;
|
|
30935
30935
|
this.anims = [];
|
|
30936
|
-
for (let i2 = 0; i2 <
|
|
30937
|
-
const anim =
|
|
30936
|
+
for (let i2 = 0; i2 < config2.anims.length; ++i2) {
|
|
30937
|
+
const anim = config2.anims[i2];
|
|
30938
30938
|
const textures = getTextures(anim.textures);
|
|
30939
30939
|
const framerate = anim.framerate < 0 ? -1 : anim.framerate > 0 ? anim.framerate : 60;
|
|
30940
30940
|
const parsedAnim = {
|
|
@@ -30964,26 +30964,26 @@ void main(void)\r
|
|
|
30964
30964
|
}
|
|
30965
30965
|
}
|
|
30966
30966
|
updateParticle(particle, deltaSec) {
|
|
30967
|
-
const
|
|
30968
|
-
const anim =
|
|
30969
|
-
|
|
30970
|
-
if (
|
|
30971
|
-
if (
|
|
30972
|
-
|
|
30967
|
+
const config2 = particle.config;
|
|
30968
|
+
const anim = config2.anim;
|
|
30969
|
+
config2.animElapsed += deltaSec;
|
|
30970
|
+
if (config2.animElapsed >= config2.animDuration) {
|
|
30971
|
+
if (config2.anim.loop) {
|
|
30972
|
+
config2.animElapsed = config2.animElapsed % config2.animDuration;
|
|
30973
30973
|
} else {
|
|
30974
|
-
|
|
30974
|
+
config2.animElapsed = config2.animDuration - 1e-6;
|
|
30975
30975
|
}
|
|
30976
30976
|
}
|
|
30977
|
-
const frame =
|
|
30977
|
+
const frame = config2.animElapsed * config2.animFramerate + 1e-7 | 0;
|
|
30978
30978
|
particle.texture = anim.textures[frame] || anim.textures[anim.textures.length - 1] || Texture.EMPTY;
|
|
30979
30979
|
}
|
|
30980
30980
|
}
|
|
30981
30981
|
RandomAnimatedTextureBehavior.type = "animatedRandom";
|
|
30982
30982
|
RandomAnimatedTextureBehavior.editorConfig = null;
|
|
30983
30983
|
class SingleAnimatedTextureBehavior {
|
|
30984
|
-
constructor(
|
|
30984
|
+
constructor(config2) {
|
|
30985
30985
|
this.order = BehaviorOrder.Normal;
|
|
30986
|
-
const anim =
|
|
30986
|
+
const anim = config2.anim;
|
|
30987
30987
|
const textures = getTextures(anim.textures);
|
|
30988
30988
|
const framerate = anim.framerate < 0 ? -1 : anim.framerate > 0 ? anim.framerate : 60;
|
|
30989
30989
|
this.anim = {
|
|
@@ -31011,25 +31011,25 @@ void main(void)\r
|
|
|
31011
31011
|
}
|
|
31012
31012
|
updateParticle(particle, deltaSec) {
|
|
31013
31013
|
const anim = this.anim;
|
|
31014
|
-
const
|
|
31015
|
-
|
|
31016
|
-
if (
|
|
31014
|
+
const config2 = particle.config;
|
|
31015
|
+
config2.animElapsed += deltaSec;
|
|
31016
|
+
if (config2.animElapsed >= config2.animDuration) {
|
|
31017
31017
|
if (anim.loop) {
|
|
31018
|
-
|
|
31018
|
+
config2.animElapsed = config2.animElapsed % config2.animDuration;
|
|
31019
31019
|
} else {
|
|
31020
|
-
|
|
31020
|
+
config2.animElapsed = config2.animDuration - 1e-6;
|
|
31021
31021
|
}
|
|
31022
31022
|
}
|
|
31023
|
-
const frame =
|
|
31023
|
+
const frame = config2.animElapsed * config2.animFramerate + 1e-7 | 0;
|
|
31024
31024
|
particle.texture = anim.textures[frame] || anim.textures[anim.textures.length - 1] || Texture.EMPTY;
|
|
31025
31025
|
}
|
|
31026
31026
|
}
|
|
31027
31027
|
SingleAnimatedTextureBehavior.type = "animatedSingle";
|
|
31028
31028
|
SingleAnimatedTextureBehavior.editorConfig = null;
|
|
31029
31029
|
class BlendModeBehavior {
|
|
31030
|
-
constructor(
|
|
31030
|
+
constructor(config2) {
|
|
31031
31031
|
this.order = BehaviorOrder.Normal;
|
|
31032
|
-
this.value =
|
|
31032
|
+
this.value = config2.blendMode;
|
|
31033
31033
|
}
|
|
31034
31034
|
initParticles(first) {
|
|
31035
31035
|
let next = first;
|
|
@@ -31042,11 +31042,11 @@ void main(void)\r
|
|
|
31042
31042
|
BlendModeBehavior.type = "blendMode";
|
|
31043
31043
|
BlendModeBehavior.editorConfig = null;
|
|
31044
31044
|
class BurstSpawnBehavior {
|
|
31045
|
-
constructor(
|
|
31045
|
+
constructor(config2) {
|
|
31046
31046
|
this.order = BehaviorOrder.Spawn;
|
|
31047
|
-
this.spacing =
|
|
31048
|
-
this.start =
|
|
31049
|
-
this.distance =
|
|
31047
|
+
this.spacing = config2.spacing * DEG_TO_RADS;
|
|
31048
|
+
this.start = config2.start * DEG_TO_RADS;
|
|
31049
|
+
this.distance = config2.distance;
|
|
31050
31050
|
}
|
|
31051
31051
|
initParticles(first) {
|
|
31052
31052
|
let count = 0;
|
|
@@ -31071,10 +31071,10 @@ void main(void)\r
|
|
|
31071
31071
|
BurstSpawnBehavior.type = "spawnBurst";
|
|
31072
31072
|
BurstSpawnBehavior.editorConfig = null;
|
|
31073
31073
|
class ColorBehavior {
|
|
31074
|
-
constructor(
|
|
31074
|
+
constructor(config2) {
|
|
31075
31075
|
this.order = BehaviorOrder.Normal;
|
|
31076
31076
|
this.list = new PropertyList(true);
|
|
31077
|
-
this.list.reset(PropertyNode.createList(
|
|
31077
|
+
this.list.reset(PropertyNode.createList(config2.color));
|
|
31078
31078
|
}
|
|
31079
31079
|
initParticles(first) {
|
|
31080
31080
|
let next = first;
|
|
@@ -31092,9 +31092,9 @@ void main(void)\r
|
|
|
31092
31092
|
ColorBehavior.type = "color";
|
|
31093
31093
|
ColorBehavior.editorConfig = null;
|
|
31094
31094
|
class StaticColorBehavior {
|
|
31095
|
-
constructor(
|
|
31095
|
+
constructor(config2) {
|
|
31096
31096
|
this.order = BehaviorOrder.Normal;
|
|
31097
|
-
let color =
|
|
31097
|
+
let color = config2.color;
|
|
31098
31098
|
if (color.charAt(0) === "#") {
|
|
31099
31099
|
color = color.substr(1);
|
|
31100
31100
|
} else if (color.indexOf("0x") === 0) {
|
|
@@ -31113,10 +31113,10 @@ void main(void)\r
|
|
|
31113
31113
|
StaticColorBehavior.type = "colorStatic";
|
|
31114
31114
|
StaticColorBehavior.editorConfig = null;
|
|
31115
31115
|
class OrderedTextureBehavior {
|
|
31116
|
-
constructor(
|
|
31116
|
+
constructor(config2) {
|
|
31117
31117
|
this.order = BehaviorOrder.Normal;
|
|
31118
31118
|
this.index = 0;
|
|
31119
|
-
this.textures =
|
|
31119
|
+
this.textures = config2.textures.map((tex) => typeof tex === "string" ? GetTextureFromString(tex) : tex);
|
|
31120
31120
|
}
|
|
31121
31121
|
initParticles(first) {
|
|
31122
31122
|
let next = first;
|
|
@@ -31190,15 +31190,15 @@ void main(void)\r
|
|
|
31190
31190
|
return new Function("x", `return ${pathString};`);
|
|
31191
31191
|
}
|
|
31192
31192
|
class PathBehavior {
|
|
31193
|
-
constructor(
|
|
31193
|
+
constructor(config2) {
|
|
31194
31194
|
var _a;
|
|
31195
31195
|
this.order = BehaviorOrder.Late;
|
|
31196
|
-
if (
|
|
31197
|
-
if (typeof
|
|
31198
|
-
this.path =
|
|
31196
|
+
if (config2.path) {
|
|
31197
|
+
if (typeof config2.path === "function") {
|
|
31198
|
+
this.path = config2.path;
|
|
31199
31199
|
} else {
|
|
31200
31200
|
try {
|
|
31201
|
-
this.path = parsePath(
|
|
31201
|
+
this.path = parsePath(config2.path);
|
|
31202
31202
|
} catch (e2) {
|
|
31203
31203
|
this.path = null;
|
|
31204
31204
|
}
|
|
@@ -31207,8 +31207,8 @@ void main(void)\r
|
|
|
31207
31207
|
this.path = (x2) => x2;
|
|
31208
31208
|
}
|
|
31209
31209
|
this.list = new PropertyList(false);
|
|
31210
|
-
this.list.reset(PropertyNode.createList(
|
|
31211
|
-
this.minMult = (_a =
|
|
31210
|
+
this.list.reset(PropertyNode.createList(config2.speed));
|
|
31211
|
+
this.minMult = (_a = config2.minMult) !== null && _a !== void 0 ? _a : 1;
|
|
31212
31212
|
}
|
|
31213
31213
|
initParticles(first) {
|
|
31214
31214
|
let next = first;
|
|
@@ -31248,9 +31248,9 @@ void main(void)\r
|
|
|
31248
31248
|
PointSpawnBehavior.type = "spawnPoint";
|
|
31249
31249
|
PointSpawnBehavior.editorConfig = null;
|
|
31250
31250
|
class RandomTextureBehavior {
|
|
31251
|
-
constructor(
|
|
31251
|
+
constructor(config2) {
|
|
31252
31252
|
this.order = BehaviorOrder.Normal;
|
|
31253
|
-
this.textures =
|
|
31253
|
+
this.textures = config2.textures.map((tex) => typeof tex === "string" ? GetTextureFromString(tex) : tex);
|
|
31254
31254
|
}
|
|
31255
31255
|
initParticles(first) {
|
|
31256
31256
|
let next = first;
|
|
@@ -31264,13 +31264,13 @@ void main(void)\r
|
|
|
31264
31264
|
RandomTextureBehavior.type = "textureRandom";
|
|
31265
31265
|
RandomTextureBehavior.editorConfig = null;
|
|
31266
31266
|
class RotationBehavior {
|
|
31267
|
-
constructor(
|
|
31267
|
+
constructor(config2) {
|
|
31268
31268
|
this.order = BehaviorOrder.Normal;
|
|
31269
|
-
this.minStart =
|
|
31270
|
-
this.maxStart =
|
|
31271
|
-
this.minSpeed =
|
|
31272
|
-
this.maxSpeed =
|
|
31273
|
-
this.accel =
|
|
31269
|
+
this.minStart = config2.minStart * DEG_TO_RADS;
|
|
31270
|
+
this.maxStart = config2.maxStart * DEG_TO_RADS;
|
|
31271
|
+
this.minSpeed = config2.minSpeed * DEG_TO_RADS;
|
|
31272
|
+
this.maxSpeed = config2.maxSpeed * DEG_TO_RADS;
|
|
31273
|
+
this.accel = config2.accel * DEG_TO_RADS;
|
|
31274
31274
|
}
|
|
31275
31275
|
initParticles(first) {
|
|
31276
31276
|
let next = first;
|
|
@@ -31297,10 +31297,10 @@ void main(void)\r
|
|
|
31297
31297
|
RotationBehavior.type = "rotation";
|
|
31298
31298
|
RotationBehavior.editorConfig = null;
|
|
31299
31299
|
class StaticRotationBehavior {
|
|
31300
|
-
constructor(
|
|
31300
|
+
constructor(config2) {
|
|
31301
31301
|
this.order = BehaviorOrder.Normal;
|
|
31302
|
-
this.min =
|
|
31303
|
-
this.max =
|
|
31302
|
+
this.min = config2.min * DEG_TO_RADS;
|
|
31303
|
+
this.max = config2.max * DEG_TO_RADS;
|
|
31304
31304
|
}
|
|
31305
31305
|
initParticles(first) {
|
|
31306
31306
|
let next = first;
|
|
@@ -31317,9 +31317,9 @@ void main(void)\r
|
|
|
31317
31317
|
StaticRotationBehavior.type = "rotationStatic";
|
|
31318
31318
|
StaticRotationBehavior.editorConfig = null;
|
|
31319
31319
|
class NoRotationBehavior {
|
|
31320
|
-
constructor(
|
|
31320
|
+
constructor(config2) {
|
|
31321
31321
|
this.order = BehaviorOrder.Late + 1;
|
|
31322
|
-
this.rotation = (
|
|
31322
|
+
this.rotation = (config2.rotation || 0) * DEG_TO_RADS;
|
|
31323
31323
|
}
|
|
31324
31324
|
initParticles(first) {
|
|
31325
31325
|
let next = first;
|
|
@@ -31332,12 +31332,12 @@ void main(void)\r
|
|
|
31332
31332
|
NoRotationBehavior.type = "noRotation";
|
|
31333
31333
|
NoRotationBehavior.editorConfig = null;
|
|
31334
31334
|
class ScaleBehavior {
|
|
31335
|
-
constructor(
|
|
31335
|
+
constructor(config2) {
|
|
31336
31336
|
var _a;
|
|
31337
31337
|
this.order = BehaviorOrder.Normal;
|
|
31338
31338
|
this.list = new PropertyList(false);
|
|
31339
|
-
this.list.reset(PropertyNode.createList(
|
|
31340
|
-
this.minMult = (_a =
|
|
31339
|
+
this.list.reset(PropertyNode.createList(config2.scale));
|
|
31340
|
+
this.minMult = (_a = config2.minMult) !== null && _a !== void 0 ? _a : 1;
|
|
31341
31341
|
}
|
|
31342
31342
|
initParticles(first) {
|
|
31343
31343
|
let next = first;
|
|
@@ -31355,10 +31355,10 @@ void main(void)\r
|
|
|
31355
31355
|
ScaleBehavior.type = "scale";
|
|
31356
31356
|
ScaleBehavior.editorConfig = null;
|
|
31357
31357
|
class StaticScaleBehavior {
|
|
31358
|
-
constructor(
|
|
31358
|
+
constructor(config2) {
|
|
31359
31359
|
this.order = BehaviorOrder.Normal;
|
|
31360
|
-
this.min =
|
|
31361
|
-
this.max =
|
|
31360
|
+
this.min = config2.min;
|
|
31361
|
+
this.max = config2.max;
|
|
31362
31362
|
}
|
|
31363
31363
|
initParticles(first) {
|
|
31364
31364
|
let next = first;
|
|
@@ -31372,13 +31372,13 @@ void main(void)\r
|
|
|
31372
31372
|
StaticScaleBehavior.type = "scaleStatic";
|
|
31373
31373
|
StaticScaleBehavior.editorConfig = null;
|
|
31374
31374
|
class ShapeSpawnBehavior {
|
|
31375
|
-
constructor(
|
|
31375
|
+
constructor(config2) {
|
|
31376
31376
|
this.order = BehaviorOrder.Spawn;
|
|
31377
|
-
const ShapeClass = ShapeSpawnBehavior.shapes[
|
|
31377
|
+
const ShapeClass = ShapeSpawnBehavior.shapes[config2.type];
|
|
31378
31378
|
if (!ShapeClass) {
|
|
31379
|
-
throw new Error(`No shape found with type '${
|
|
31379
|
+
throw new Error(`No shape found with type '${config2.type}'`);
|
|
31380
31380
|
}
|
|
31381
|
-
this.shape = new ShapeClass(
|
|
31381
|
+
this.shape = new ShapeClass(config2.data);
|
|
31382
31382
|
}
|
|
31383
31383
|
/**
|
|
31384
31384
|
* Registers a shape to be used by the ShapeSpawn behavior.
|
|
@@ -31404,9 +31404,9 @@ void main(void)\r
|
|
|
31404
31404
|
ShapeSpawnBehavior.registerShape(Torus);
|
|
31405
31405
|
ShapeSpawnBehavior.registerShape(Torus, "circle");
|
|
31406
31406
|
class SingleTextureBehavior {
|
|
31407
|
-
constructor(
|
|
31407
|
+
constructor(config2) {
|
|
31408
31408
|
this.order = BehaviorOrder.Normal;
|
|
31409
|
-
this.texture = typeof
|
|
31409
|
+
this.texture = typeof config2.texture === "string" ? GetTextureFromString(config2.texture) : config2.texture;
|
|
31410
31410
|
}
|
|
31411
31411
|
initParticles(first) {
|
|
31412
31412
|
let next = first;
|
|
@@ -31419,12 +31419,12 @@ void main(void)\r
|
|
|
31419
31419
|
SingleTextureBehavior.type = "textureSingle";
|
|
31420
31420
|
SingleTextureBehavior.editorConfig = null;
|
|
31421
31421
|
class SpeedBehavior {
|
|
31422
|
-
constructor(
|
|
31422
|
+
constructor(config2) {
|
|
31423
31423
|
var _a;
|
|
31424
31424
|
this.order = BehaviorOrder.Late;
|
|
31425
31425
|
this.list = new PropertyList(false);
|
|
31426
|
-
this.list.reset(PropertyNode.createList(
|
|
31427
|
-
this.minMult = (_a =
|
|
31426
|
+
this.list.reset(PropertyNode.createList(config2.speed));
|
|
31427
|
+
this.minMult = (_a = config2.minMult) !== null && _a !== void 0 ? _a : 1;
|
|
31428
31428
|
}
|
|
31429
31429
|
initParticles(first) {
|
|
31430
31430
|
let next = first;
|
|
@@ -31452,10 +31452,10 @@ void main(void)\r
|
|
|
31452
31452
|
SpeedBehavior.type = "moveSpeed";
|
|
31453
31453
|
SpeedBehavior.editorConfig = null;
|
|
31454
31454
|
class StaticSpeedBehavior {
|
|
31455
|
-
constructor(
|
|
31455
|
+
constructor(config2) {
|
|
31456
31456
|
this.order = BehaviorOrder.Late;
|
|
31457
|
-
this.min =
|
|
31458
|
-
this.max =
|
|
31457
|
+
this.min = config2.min;
|
|
31458
|
+
this.max = config2.max;
|
|
31459
31459
|
}
|
|
31460
31460
|
initParticles(first) {
|
|
31461
31461
|
let next = first;
|
|
@@ -31478,39 +31478,39 @@ void main(void)\r
|
|
|
31478
31478
|
}
|
|
31479
31479
|
StaticSpeedBehavior.type = "moveSpeedStatic";
|
|
31480
31480
|
StaticSpeedBehavior.editorConfig = null;
|
|
31481
|
-
function upgradeConfig(
|
|
31481
|
+
function upgradeConfig(config2, art) {
|
|
31482
31482
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
31483
|
-
if ("behaviors" in
|
|
31484
|
-
return
|
|
31483
|
+
if ("behaviors" in config2) {
|
|
31484
|
+
return config2;
|
|
31485
31485
|
}
|
|
31486
31486
|
const out = {
|
|
31487
|
-
lifetime:
|
|
31488
|
-
ease:
|
|
31489
|
-
particlesPerWave:
|
|
31490
|
-
frequency:
|
|
31491
|
-
spawnChance:
|
|
31492
|
-
emitterLifetime:
|
|
31493
|
-
maxParticles:
|
|
31494
|
-
addAtBack:
|
|
31495
|
-
pos:
|
|
31496
|
-
emit:
|
|
31497
|
-
autoUpdate:
|
|
31487
|
+
lifetime: config2.lifetime,
|
|
31488
|
+
ease: config2.ease,
|
|
31489
|
+
particlesPerWave: config2.particlesPerWave,
|
|
31490
|
+
frequency: config2.frequency,
|
|
31491
|
+
spawnChance: config2.spawnChance,
|
|
31492
|
+
emitterLifetime: config2.emitterLifetime,
|
|
31493
|
+
maxParticles: config2.maxParticles,
|
|
31494
|
+
addAtBack: config2.addAtBack,
|
|
31495
|
+
pos: config2.pos,
|
|
31496
|
+
emit: config2.emit,
|
|
31497
|
+
autoUpdate: config2.autoUpdate,
|
|
31498
31498
|
behaviors: []
|
|
31499
31499
|
};
|
|
31500
|
-
if (
|
|
31501
|
-
if ("start" in
|
|
31502
|
-
if (
|
|
31503
|
-
if (
|
|
31500
|
+
if (config2.alpha) {
|
|
31501
|
+
if ("start" in config2.alpha) {
|
|
31502
|
+
if (config2.alpha.start === config2.alpha.end) {
|
|
31503
|
+
if (config2.alpha.start !== 1) {
|
|
31504
31504
|
out.behaviors.push({
|
|
31505
31505
|
type: "alphaStatic",
|
|
31506
|
-
config: { alpha:
|
|
31506
|
+
config: { alpha: config2.alpha.start }
|
|
31507
31507
|
});
|
|
31508
31508
|
}
|
|
31509
31509
|
} else {
|
|
31510
31510
|
const list = {
|
|
31511
31511
|
list: [
|
|
31512
|
-
{ time: 0, value:
|
|
31513
|
-
{ time: 1, value:
|
|
31512
|
+
{ time: 0, value: config2.alpha.start },
|
|
31513
|
+
{ time: 1, value: config2.alpha.end }
|
|
31514
31514
|
]
|
|
31515
31515
|
};
|
|
31516
31516
|
out.behaviors.push({
|
|
@@ -31518,124 +31518,124 @@ void main(void)\r
|
|
|
31518
31518
|
config: { alpha: list }
|
|
31519
31519
|
});
|
|
31520
31520
|
}
|
|
31521
|
-
} else if (
|
|
31522
|
-
if (
|
|
31521
|
+
} else if (config2.alpha.list.length === 1) {
|
|
31522
|
+
if (config2.alpha.list[0].value !== 1) {
|
|
31523
31523
|
out.behaviors.push({
|
|
31524
31524
|
type: "alphaStatic",
|
|
31525
|
-
config: { alpha:
|
|
31525
|
+
config: { alpha: config2.alpha.list[0].value }
|
|
31526
31526
|
});
|
|
31527
31527
|
}
|
|
31528
31528
|
} else {
|
|
31529
31529
|
out.behaviors.push({
|
|
31530
31530
|
type: "alpha",
|
|
31531
|
-
config: { alpha:
|
|
31531
|
+
config: { alpha: config2.alpha }
|
|
31532
31532
|
});
|
|
31533
31533
|
}
|
|
31534
31534
|
}
|
|
31535
|
-
if (
|
|
31535
|
+
if (config2.acceleration && (config2.acceleration.x || config2.acceleration.y)) {
|
|
31536
31536
|
let minStart;
|
|
31537
31537
|
let maxStart;
|
|
31538
|
-
if ("start" in
|
|
31539
|
-
minStart =
|
|
31540
|
-
maxStart =
|
|
31538
|
+
if ("start" in config2.speed) {
|
|
31539
|
+
minStart = config2.speed.start * ((_a = config2.speed.minimumSpeedMultiplier) !== null && _a !== void 0 ? _a : 1);
|
|
31540
|
+
maxStart = config2.speed.start;
|
|
31541
31541
|
} else {
|
|
31542
|
-
minStart =
|
|
31543
|
-
maxStart =
|
|
31542
|
+
minStart = config2.speed.list[0].value * ((_b = config2.minimumSpeedMultiplier) !== null && _b !== void 0 ? _b : 1);
|
|
31543
|
+
maxStart = config2.speed.list[0].value;
|
|
31544
31544
|
}
|
|
31545
31545
|
out.behaviors.push({
|
|
31546
31546
|
type: "moveAcceleration",
|
|
31547
31547
|
config: {
|
|
31548
|
-
accel:
|
|
31548
|
+
accel: config2.acceleration,
|
|
31549
31549
|
minStart,
|
|
31550
31550
|
maxStart,
|
|
31551
|
-
rotate: !
|
|
31552
|
-
maxSpeed:
|
|
31551
|
+
rotate: !config2.noRotation,
|
|
31552
|
+
maxSpeed: config2.maxSpeed
|
|
31553
31553
|
}
|
|
31554
31554
|
});
|
|
31555
|
-
} else if ((_c =
|
|
31555
|
+
} else if ((_c = config2.extraData) === null || _c === void 0 ? void 0 : _c.path) {
|
|
31556
31556
|
let list;
|
|
31557
31557
|
let mult;
|
|
31558
|
-
if ("start" in
|
|
31559
|
-
mult = (_d =
|
|
31560
|
-
if (
|
|
31558
|
+
if ("start" in config2.speed) {
|
|
31559
|
+
mult = (_d = config2.speed.minimumSpeedMultiplier) !== null && _d !== void 0 ? _d : 1;
|
|
31560
|
+
if (config2.speed.start === config2.speed.end) {
|
|
31561
31561
|
list = {
|
|
31562
|
-
list: [{ time: 0, value:
|
|
31562
|
+
list: [{ time: 0, value: config2.speed.start }]
|
|
31563
31563
|
};
|
|
31564
31564
|
} else {
|
|
31565
31565
|
list = {
|
|
31566
31566
|
list: [
|
|
31567
|
-
{ time: 0, value:
|
|
31568
|
-
{ time: 1, value:
|
|
31567
|
+
{ time: 0, value: config2.speed.start },
|
|
31568
|
+
{ time: 1, value: config2.speed.end }
|
|
31569
31569
|
]
|
|
31570
31570
|
};
|
|
31571
31571
|
}
|
|
31572
31572
|
} else {
|
|
31573
|
-
list =
|
|
31574
|
-
mult = (_e =
|
|
31573
|
+
list = config2.speed;
|
|
31574
|
+
mult = (_e = config2.minimumSpeedMultiplier) !== null && _e !== void 0 ? _e : 1;
|
|
31575
31575
|
}
|
|
31576
31576
|
out.behaviors.push({
|
|
31577
31577
|
type: "movePath",
|
|
31578
31578
|
config: {
|
|
31579
|
-
path:
|
|
31579
|
+
path: config2.extraData.path,
|
|
31580
31580
|
speed: list,
|
|
31581
31581
|
minMult: mult
|
|
31582
31582
|
}
|
|
31583
31583
|
});
|
|
31584
31584
|
} else {
|
|
31585
|
-
if (
|
|
31586
|
-
if ("start" in
|
|
31587
|
-
if (
|
|
31585
|
+
if (config2.speed) {
|
|
31586
|
+
if ("start" in config2.speed) {
|
|
31587
|
+
if (config2.speed.start === config2.speed.end) {
|
|
31588
31588
|
out.behaviors.push({
|
|
31589
31589
|
type: "moveSpeedStatic",
|
|
31590
31590
|
config: {
|
|
31591
|
-
min:
|
|
31592
|
-
max:
|
|
31591
|
+
min: config2.speed.start * ((_f = config2.speed.minimumSpeedMultiplier) !== null && _f !== void 0 ? _f : 1),
|
|
31592
|
+
max: config2.speed.start
|
|
31593
31593
|
}
|
|
31594
31594
|
});
|
|
31595
31595
|
} else {
|
|
31596
31596
|
const list = {
|
|
31597
31597
|
list: [
|
|
31598
|
-
{ time: 0, value:
|
|
31599
|
-
{ time: 1, value:
|
|
31598
|
+
{ time: 0, value: config2.speed.start },
|
|
31599
|
+
{ time: 1, value: config2.speed.end }
|
|
31600
31600
|
]
|
|
31601
31601
|
};
|
|
31602
31602
|
out.behaviors.push({
|
|
31603
31603
|
type: "moveSpeed",
|
|
31604
|
-
config: { speed: list, minMult:
|
|
31604
|
+
config: { speed: list, minMult: config2.speed.minimumSpeedMultiplier }
|
|
31605
31605
|
});
|
|
31606
31606
|
}
|
|
31607
|
-
} else if (
|
|
31607
|
+
} else if (config2.speed.list.length === 1) {
|
|
31608
31608
|
out.behaviors.push({
|
|
31609
31609
|
type: "moveSpeedStatic",
|
|
31610
31610
|
config: {
|
|
31611
|
-
min:
|
|
31612
|
-
max:
|
|
31611
|
+
min: config2.speed.list[0].value * ((_g = config2.minimumSpeedMultiplier) !== null && _g !== void 0 ? _g : 1),
|
|
31612
|
+
max: config2.speed.list[0].value
|
|
31613
31613
|
}
|
|
31614
31614
|
});
|
|
31615
31615
|
} else {
|
|
31616
31616
|
out.behaviors.push({
|
|
31617
31617
|
type: "moveSpeed",
|
|
31618
|
-
config: { speed:
|
|
31618
|
+
config: { speed: config2.speed, minMult: (_h = config2.minimumSpeedMultiplier) !== null && _h !== void 0 ? _h : 1 }
|
|
31619
31619
|
});
|
|
31620
31620
|
}
|
|
31621
31621
|
}
|
|
31622
31622
|
}
|
|
31623
|
-
if (
|
|
31624
|
-
if ("start" in
|
|
31625
|
-
const mult = (_j =
|
|
31626
|
-
if (
|
|
31623
|
+
if (config2.scale) {
|
|
31624
|
+
if ("start" in config2.scale) {
|
|
31625
|
+
const mult = (_j = config2.scale.minimumScaleMultiplier) !== null && _j !== void 0 ? _j : 1;
|
|
31626
|
+
if (config2.scale.start === config2.scale.end) {
|
|
31627
31627
|
out.behaviors.push({
|
|
31628
31628
|
type: "scaleStatic",
|
|
31629
31629
|
config: {
|
|
31630
|
-
min:
|
|
31631
|
-
max:
|
|
31630
|
+
min: config2.scale.start * mult,
|
|
31631
|
+
max: config2.scale.start
|
|
31632
31632
|
}
|
|
31633
31633
|
});
|
|
31634
31634
|
} else {
|
|
31635
31635
|
const list = {
|
|
31636
31636
|
list: [
|
|
31637
|
-
{ time: 0, value:
|
|
31638
|
-
{ time: 1, value:
|
|
31637
|
+
{ time: 0, value: config2.scale.start },
|
|
31638
|
+
{ time: 1, value: config2.scale.end }
|
|
31639
31639
|
]
|
|
31640
31640
|
};
|
|
31641
31641
|
out.behaviors.push({
|
|
@@ -31643,9 +31643,9 @@ void main(void)\r
|
|
|
31643
31643
|
config: { scale: list, minMult: mult }
|
|
31644
31644
|
});
|
|
31645
31645
|
}
|
|
31646
|
-
} else if (
|
|
31647
|
-
const mult = (_k =
|
|
31648
|
-
const scale =
|
|
31646
|
+
} else if (config2.scale.list.length === 1) {
|
|
31647
|
+
const mult = (_k = config2.minimumScaleMultiplier) !== null && _k !== void 0 ? _k : 1;
|
|
31648
|
+
const scale = config2.scale.list[0].value;
|
|
31649
31649
|
out.behaviors.push({
|
|
31650
31650
|
type: "scaleStatic",
|
|
31651
31651
|
config: { min: scale * mult, max: scale }
|
|
@@ -31653,24 +31653,24 @@ void main(void)\r
|
|
|
31653
31653
|
} else {
|
|
31654
31654
|
out.behaviors.push({
|
|
31655
31655
|
type: "scale",
|
|
31656
|
-
config: { scale:
|
|
31656
|
+
config: { scale: config2.scale, minMult: (_l = config2.minimumScaleMultiplier) !== null && _l !== void 0 ? _l : 1 }
|
|
31657
31657
|
});
|
|
31658
31658
|
}
|
|
31659
31659
|
}
|
|
31660
|
-
if (
|
|
31661
|
-
if ("start" in
|
|
31662
|
-
if (
|
|
31663
|
-
if (
|
|
31660
|
+
if (config2.color) {
|
|
31661
|
+
if ("start" in config2.color) {
|
|
31662
|
+
if (config2.color.start === config2.color.end) {
|
|
31663
|
+
if (config2.color.start !== "ffffff") {
|
|
31664
31664
|
out.behaviors.push({
|
|
31665
31665
|
type: "colorStatic",
|
|
31666
|
-
config: { color:
|
|
31666
|
+
config: { color: config2.color.start }
|
|
31667
31667
|
});
|
|
31668
31668
|
}
|
|
31669
31669
|
} else {
|
|
31670
31670
|
const list = {
|
|
31671
31671
|
list: [
|
|
31672
|
-
{ time: 0, value:
|
|
31673
|
-
{ time: 1, value:
|
|
31672
|
+
{ time: 0, value: config2.color.start },
|
|
31673
|
+
{ time: 1, value: config2.color.end }
|
|
31674
31674
|
]
|
|
31675
31675
|
};
|
|
31676
31676
|
out.behaviors.push({
|
|
@@ -31678,51 +31678,51 @@ void main(void)\r
|
|
|
31678
31678
|
config: { color: list }
|
|
31679
31679
|
});
|
|
31680
31680
|
}
|
|
31681
|
-
} else if (
|
|
31682
|
-
if (
|
|
31681
|
+
} else if (config2.color.list.length === 1) {
|
|
31682
|
+
if (config2.color.list[0].value !== "ffffff") {
|
|
31683
31683
|
out.behaviors.push({
|
|
31684
31684
|
type: "colorStatic",
|
|
31685
|
-
config: { color:
|
|
31685
|
+
config: { color: config2.color.list[0].value }
|
|
31686
31686
|
});
|
|
31687
31687
|
}
|
|
31688
31688
|
} else {
|
|
31689
31689
|
out.behaviors.push({
|
|
31690
31690
|
type: "color",
|
|
31691
|
-
config: { color:
|
|
31691
|
+
config: { color: config2.color }
|
|
31692
31692
|
});
|
|
31693
31693
|
}
|
|
31694
31694
|
}
|
|
31695
|
-
if (
|
|
31695
|
+
if (config2.rotationAcceleration || ((_m = config2.rotationSpeed) === null || _m === void 0 ? void 0 : _m.min) || ((_o = config2.rotationSpeed) === null || _o === void 0 ? void 0 : _o.max)) {
|
|
31696
31696
|
out.behaviors.push({
|
|
31697
31697
|
type: "rotation",
|
|
31698
31698
|
config: {
|
|
31699
|
-
accel:
|
|
31700
|
-
minSpeed: ((_p =
|
|
31701
|
-
maxSpeed: ((_q =
|
|
31702
|
-
minStart: ((_r =
|
|
31703
|
-
maxStart: ((_s =
|
|
31699
|
+
accel: config2.rotationAcceleration || 0,
|
|
31700
|
+
minSpeed: ((_p = config2.rotationSpeed) === null || _p === void 0 ? void 0 : _p.min) || 0,
|
|
31701
|
+
maxSpeed: ((_q = config2.rotationSpeed) === null || _q === void 0 ? void 0 : _q.max) || 0,
|
|
31702
|
+
minStart: ((_r = config2.startRotation) === null || _r === void 0 ? void 0 : _r.min) || 0,
|
|
31703
|
+
maxStart: ((_s = config2.startRotation) === null || _s === void 0 ? void 0 : _s.max) || 0
|
|
31704
31704
|
}
|
|
31705
31705
|
});
|
|
31706
|
-
} else if (((_t =
|
|
31706
|
+
} else if (((_t = config2.startRotation) === null || _t === void 0 ? void 0 : _t.min) || ((_u = config2.startRotation) === null || _u === void 0 ? void 0 : _u.max)) {
|
|
31707
31707
|
out.behaviors.push({
|
|
31708
31708
|
type: "rotationStatic",
|
|
31709
31709
|
config: {
|
|
31710
|
-
min: ((_v =
|
|
31711
|
-
max: ((_w =
|
|
31710
|
+
min: ((_v = config2.startRotation) === null || _v === void 0 ? void 0 : _v.min) || 0,
|
|
31711
|
+
max: ((_w = config2.startRotation) === null || _w === void 0 ? void 0 : _w.max) || 0
|
|
31712
31712
|
}
|
|
31713
31713
|
});
|
|
31714
31714
|
}
|
|
31715
|
-
if (
|
|
31715
|
+
if (config2.noRotation) {
|
|
31716
31716
|
out.behaviors.push({
|
|
31717
31717
|
type: "noRotation",
|
|
31718
31718
|
config: {}
|
|
31719
31719
|
});
|
|
31720
31720
|
}
|
|
31721
|
-
if (
|
|
31721
|
+
if (config2.blendMode && config2.blendMode !== "normal") {
|
|
31722
31722
|
out.behaviors.push({
|
|
31723
31723
|
type: "blendMode",
|
|
31724
31724
|
config: {
|
|
31725
|
-
blendMode:
|
|
31725
|
+
blendMode: config2.blendMode
|
|
31726
31726
|
}
|
|
31727
31727
|
});
|
|
31728
31728
|
}
|
|
@@ -31748,7 +31748,7 @@ void main(void)\r
|
|
|
31748
31748
|
anim: art
|
|
31749
31749
|
}
|
|
31750
31750
|
});
|
|
31751
|
-
} else if (
|
|
31751
|
+
} else if (config2.orderedArt && Array.isArray(art)) {
|
|
31752
31752
|
out.behaviors.push({
|
|
31753
31753
|
type: "textureOrdered",
|
|
31754
31754
|
config: {
|
|
@@ -31770,54 +31770,54 @@ void main(void)\r
|
|
|
31770
31770
|
}
|
|
31771
31771
|
});
|
|
31772
31772
|
}
|
|
31773
|
-
if (
|
|
31773
|
+
if (config2.spawnType === "burst") {
|
|
31774
31774
|
out.behaviors.push({
|
|
31775
31775
|
type: "spawnBurst",
|
|
31776
31776
|
config: {
|
|
31777
|
-
start:
|
|
31778
|
-
spacing:
|
|
31777
|
+
start: config2.angleStart || 0,
|
|
31778
|
+
spacing: config2.particleSpacing,
|
|
31779
31779
|
// older formats bursted from a single point
|
|
31780
31780
|
distance: 0
|
|
31781
31781
|
}
|
|
31782
31782
|
});
|
|
31783
|
-
} else if (
|
|
31783
|
+
} else if (config2.spawnType === "point") {
|
|
31784
31784
|
out.behaviors.push({
|
|
31785
31785
|
type: "spawnPoint",
|
|
31786
31786
|
config: {}
|
|
31787
31787
|
});
|
|
31788
31788
|
} else {
|
|
31789
31789
|
let shape;
|
|
31790
|
-
if (
|
|
31790
|
+
if (config2.spawnType === "ring") {
|
|
31791
31791
|
shape = {
|
|
31792
31792
|
type: "torus",
|
|
31793
31793
|
data: {
|
|
31794
|
-
x:
|
|
31795
|
-
y:
|
|
31796
|
-
radius:
|
|
31797
|
-
innerRadius:
|
|
31794
|
+
x: config2.spawnCircle.x,
|
|
31795
|
+
y: config2.spawnCircle.y,
|
|
31796
|
+
radius: config2.spawnCircle.r,
|
|
31797
|
+
innerRadius: config2.spawnCircle.minR,
|
|
31798
31798
|
affectRotation: true
|
|
31799
31799
|
}
|
|
31800
31800
|
};
|
|
31801
|
-
} else if (
|
|
31801
|
+
} else if (config2.spawnType === "circle") {
|
|
31802
31802
|
shape = {
|
|
31803
31803
|
type: "torus",
|
|
31804
31804
|
data: {
|
|
31805
|
-
x:
|
|
31806
|
-
y:
|
|
31807
|
-
radius:
|
|
31805
|
+
x: config2.spawnCircle.x,
|
|
31806
|
+
y: config2.spawnCircle.y,
|
|
31807
|
+
radius: config2.spawnCircle.r,
|
|
31808
31808
|
innerRadius: 0,
|
|
31809
31809
|
affectRotation: false
|
|
31810
31810
|
}
|
|
31811
31811
|
};
|
|
31812
|
-
} else if (
|
|
31812
|
+
} else if (config2.spawnType === "rect") {
|
|
31813
31813
|
shape = {
|
|
31814
31814
|
type: "rect",
|
|
31815
|
-
data:
|
|
31815
|
+
data: config2.spawnRect
|
|
31816
31816
|
};
|
|
31817
|
-
} else if (
|
|
31817
|
+
} else if (config2.spawnType === "polygonalChain") {
|
|
31818
31818
|
shape = {
|
|
31819
31819
|
type: "polygonalChain",
|
|
31820
|
-
data:
|
|
31820
|
+
data: config2.spawnPolygon
|
|
31821
31821
|
};
|
|
31822
31822
|
}
|
|
31823
31823
|
if (shape) {
|
|
@@ -31908,7 +31908,7 @@ void main(void)\r
|
|
|
31908
31908
|
particleConfig,
|
|
31909
31909
|
onDestroy
|
|
31910
31910
|
} = params;
|
|
31911
|
-
const
|
|
31911
|
+
const config2 = upgradeConfig(
|
|
31912
31912
|
{
|
|
31913
31913
|
lifetime: particleConfig.lifetime,
|
|
31914
31914
|
blendMode: particleConfig.blendMode,
|
|
@@ -31933,7 +31933,7 @@ void main(void)\r
|
|
|
31933
31933
|
this._particleContainer = new Container();
|
|
31934
31934
|
}
|
|
31935
31935
|
this.addChild(this._particleContainer);
|
|
31936
|
-
const flyParticle = new Emitter(this._particleContainer,
|
|
31936
|
+
const flyParticle = new Emitter(this._particleContainer, config2);
|
|
31937
31937
|
const path2 = this._createBezierPoints(
|
|
31938
31938
|
[start, ...control, end],
|
|
31939
31939
|
100,
|
|
@@ -33737,10 +33737,10 @@ void main(void)\r
|
|
|
33737
33737
|
}
|
|
33738
33738
|
computeWorldRotation(bone) {
|
|
33739
33739
|
const mat = bone.matrix;
|
|
33740
|
-
const
|
|
33741
|
-
const
|
|
33742
|
-
const x2 =
|
|
33743
|
-
const y2 =
|
|
33740
|
+
const cos2 = MathUtils.cosDeg(this.rotation);
|
|
33741
|
+
const sin2 = MathUtils.sinDeg(this.rotation);
|
|
33742
|
+
const x2 = cos2 * mat.a + sin2 * mat.c;
|
|
33743
|
+
const y2 = cos2 * mat.b + sin2 * mat.d;
|
|
33744
33744
|
return Math.atan2(y2, x2) * MathUtils.radDeg;
|
|
33745
33745
|
}
|
|
33746
33746
|
copy() {
|
|
@@ -33822,16 +33822,16 @@ void main(void)\r
|
|
|
33822
33822
|
const localX2 = localX + this.region.width * regionScaleX;
|
|
33823
33823
|
const localY2 = localY + this.region.height * regionScaleY;
|
|
33824
33824
|
const radians = this.rotation * Math.PI / 180;
|
|
33825
|
-
const
|
|
33826
|
-
const
|
|
33827
|
-
const localXCos = localX *
|
|
33828
|
-
const localXSin = localX *
|
|
33829
|
-
const localYCos = localY *
|
|
33830
|
-
const localYSin = localY *
|
|
33831
|
-
const localX2Cos = localX2 *
|
|
33832
|
-
const localX2Sin = localX2 *
|
|
33833
|
-
const localY2Cos = localY2 *
|
|
33834
|
-
const localY2Sin = localY2 *
|
|
33825
|
+
const cos2 = Math.cos(radians);
|
|
33826
|
+
const sin2 = Math.sin(radians);
|
|
33827
|
+
const localXCos = localX * cos2 + this.x;
|
|
33828
|
+
const localXSin = localX * sin2;
|
|
33829
|
+
const localYCos = localY * cos2 + this.y;
|
|
33830
|
+
const localYSin = localY * sin2;
|
|
33831
|
+
const localX2Cos = localX2 * cos2 + this.x;
|
|
33832
|
+
const localX2Sin = localX2 * sin2;
|
|
33833
|
+
const localY2Cos = localY2 * cos2 + this.y;
|
|
33834
|
+
const localY2Sin = localY2 * sin2;
|
|
33835
33835
|
const offset = this.offset;
|
|
33836
33836
|
offset[_RegionAttachment$2.OX1] = localXCos - localYSin;
|
|
33837
33837
|
offset[_RegionAttachment$2.OY1] = localYCos + localXSin;
|
|
@@ -36387,10 +36387,10 @@ void main(void)\r
|
|
|
36387
36387
|
}
|
|
36388
36388
|
case TransformMode.NoScale:
|
|
36389
36389
|
case TransformMode.NoScaleOrReflection: {
|
|
36390
|
-
const
|
|
36391
|
-
const
|
|
36392
|
-
let za = (pa *
|
|
36393
|
-
let zc = (pc *
|
|
36390
|
+
const cos2 = MathUtils.cosDeg(rotation);
|
|
36391
|
+
const sin2 = MathUtils.sinDeg(rotation);
|
|
36392
|
+
let za = (pa * cos2 + pb * sin2) / sx;
|
|
36393
|
+
let zc = (pc * cos2 + pd * sin2) / sy;
|
|
36394
36394
|
let s2 = Math.sqrt(za * za + zc * zc);
|
|
36395
36395
|
if (s2 > 1e-5)
|
|
36396
36396
|
s2 = 1 / s2;
|
|
@@ -36510,16 +36510,16 @@ void main(void)\r
|
|
|
36510
36510
|
return local;
|
|
36511
36511
|
}
|
|
36512
36512
|
worldToLocalRotation(worldRotation) {
|
|
36513
|
-
const
|
|
36514
|
-
const
|
|
36513
|
+
const sin2 = MathUtils.sinDeg(worldRotation);
|
|
36514
|
+
const cos2 = MathUtils.cosDeg(worldRotation);
|
|
36515
36515
|
const mat = this.matrix;
|
|
36516
|
-
return Math.atan2(mat.a *
|
|
36516
|
+
return Math.atan2(mat.a * sin2 - mat.b * cos2, mat.d * cos2 - mat.c * sin2) * MathUtils.radDeg;
|
|
36517
36517
|
}
|
|
36518
36518
|
localToWorldRotation(localRotation) {
|
|
36519
|
-
const
|
|
36520
|
-
const
|
|
36519
|
+
const sin2 = MathUtils.sinDeg(localRotation);
|
|
36520
|
+
const cos2 = MathUtils.cosDeg(localRotation);
|
|
36521
36521
|
const mat = this.matrix;
|
|
36522
|
-
return Math.atan2(
|
|
36522
|
+
return Math.atan2(cos2 * mat.b + sin2 * mat.d, cos2 * mat.a + sin2 * mat.c) * MathUtils.radDeg;
|
|
36523
36523
|
}
|
|
36524
36524
|
rotateWorld(degrees) {
|
|
36525
36525
|
const mat = this.matrix;
|
|
@@ -36527,12 +36527,12 @@ void main(void)\r
|
|
|
36527
36527
|
const b2 = mat.c;
|
|
36528
36528
|
const c2 = mat.b;
|
|
36529
36529
|
const d2 = mat.d;
|
|
36530
|
-
const
|
|
36531
|
-
const
|
|
36532
|
-
mat.a =
|
|
36533
|
-
mat.c =
|
|
36534
|
-
mat.b =
|
|
36535
|
-
mat.d =
|
|
36530
|
+
const cos2 = MathUtils.cosDeg(degrees);
|
|
36531
|
+
const sin2 = MathUtils.sinDeg(degrees);
|
|
36532
|
+
mat.a = cos2 * a2 - sin2 * c2;
|
|
36533
|
+
mat.c = cos2 * b2 - sin2 * d2;
|
|
36534
|
+
mat.b = sin2 * a2 + cos2 * c2;
|
|
36535
|
+
mat.d = sin2 * b2 + cos2 * d2;
|
|
36536
36536
|
this.appliedValid = false;
|
|
36537
36537
|
}
|
|
36538
36538
|
}
|
|
@@ -36773,16 +36773,16 @@ void main(void)\r
|
|
|
36773
36773
|
outer:
|
|
36774
36774
|
if (u2) {
|
|
36775
36775
|
l2 *= psx;
|
|
36776
|
-
let
|
|
36777
|
-
if (
|
|
36778
|
-
|
|
36779
|
-
else if (
|
|
36780
|
-
|
|
36776
|
+
let cos2 = (dd - l1 * l1 - l2 * l2) / (2 * l1 * l2);
|
|
36777
|
+
if (cos2 < -1)
|
|
36778
|
+
cos2 = -1;
|
|
36779
|
+
else if (cos2 > 1) {
|
|
36780
|
+
cos2 = 1;
|
|
36781
36781
|
if (stretch)
|
|
36782
36782
|
sx *= (Math.sqrt(dd) / (l1 + l2) - 1) * alpha + 1;
|
|
36783
36783
|
}
|
|
36784
|
-
a22 = Math.acos(
|
|
36785
|
-
a2 = l1 + l2 *
|
|
36784
|
+
a22 = Math.acos(cos2) * bendDir;
|
|
36785
|
+
a2 = l1 + l2 * cos2;
|
|
36786
36786
|
b2 = l2 * Math.sin(a22);
|
|
36787
36787
|
a1 = Math.atan2(ty * a2 - tx * b2, tx * a2 + ty * b2);
|
|
36788
36788
|
} else {
|
|
@@ -37007,8 +37007,8 @@ void main(void)\r
|
|
|
37007
37007
|
const c2 = mat.b;
|
|
37008
37008
|
const d2 = mat.d;
|
|
37009
37009
|
let r2 = 0;
|
|
37010
|
-
let
|
|
37011
|
-
let
|
|
37010
|
+
let cos2 = 0;
|
|
37011
|
+
let sin2 = 0;
|
|
37012
37012
|
if (tangents)
|
|
37013
37013
|
if (tangents)
|
|
37014
37014
|
r2 = positions[p2 - 1];
|
|
@@ -37018,11 +37018,11 @@ void main(void)\r
|
|
|
37018
37018
|
r2 = Math.atan2(dy, dx);
|
|
37019
37019
|
r2 -= Math.atan2(c2, a2);
|
|
37020
37020
|
if (tip) {
|
|
37021
|
-
|
|
37022
|
-
|
|
37021
|
+
cos2 = Math.cos(r2);
|
|
37022
|
+
sin2 = Math.sin(r2);
|
|
37023
37023
|
const length2 = bone.data.length;
|
|
37024
|
-
boneX += (length2 * (
|
|
37025
|
-
boneY += (length2 * (
|
|
37024
|
+
boneX += (length2 * (cos2 * a2 - sin2 * c2) - dx) * rotateMix;
|
|
37025
|
+
boneY += (length2 * (sin2 * a2 + cos2 * c2) - dy) * rotateMix;
|
|
37026
37026
|
} else {
|
|
37027
37027
|
r2 += offsetRotation;
|
|
37028
37028
|
}
|
|
@@ -37031,12 +37031,12 @@ void main(void)\r
|
|
|
37031
37031
|
else if (r2 < -MathUtils.PI)
|
|
37032
37032
|
r2 += MathUtils.PI2;
|
|
37033
37033
|
r2 *= rotateMix;
|
|
37034
|
-
|
|
37035
|
-
|
|
37036
|
-
mat.a =
|
|
37037
|
-
mat.c =
|
|
37038
|
-
mat.b =
|
|
37039
|
-
mat.d =
|
|
37034
|
+
cos2 = Math.cos(r2);
|
|
37035
|
+
sin2 = Math.sin(r2);
|
|
37036
|
+
mat.a = cos2 * a2 - sin2 * c2;
|
|
37037
|
+
mat.c = cos2 * b2 - sin2 * d2;
|
|
37038
|
+
mat.b = sin2 * a2 + cos2 * c2;
|
|
37039
|
+
mat.d = sin2 * b2 + cos2 * d2;
|
|
37040
37040
|
}
|
|
37041
37041
|
bone.appliedValid = false;
|
|
37042
37042
|
}
|
|
@@ -37378,12 +37378,12 @@ void main(void)\r
|
|
|
37378
37378
|
else if (r2 < -MathUtils.PI)
|
|
37379
37379
|
r2 += MathUtils.PI2;
|
|
37380
37380
|
r2 *= rotateMix;
|
|
37381
|
-
const
|
|
37382
|
-
const
|
|
37383
|
-
mat.a =
|
|
37384
|
-
mat.c =
|
|
37385
|
-
mat.b =
|
|
37386
|
-
mat.d =
|
|
37381
|
+
const cos2 = Math.cos(r2);
|
|
37382
|
+
const sin2 = Math.sin(r2);
|
|
37383
|
+
mat.a = cos2 * a2 - sin2 * c2;
|
|
37384
|
+
mat.c = cos2 * b2 - sin2 * d2;
|
|
37385
|
+
mat.b = sin2 * a2 + cos2 * c2;
|
|
37386
|
+
mat.d = sin2 * b2 + cos2 * d2;
|
|
37387
37387
|
modified = true;
|
|
37388
37388
|
}
|
|
37389
37389
|
if (translateMix != 0) {
|
|
@@ -37457,12 +37457,12 @@ void main(void)\r
|
|
|
37457
37457
|
else if (r2 < -MathUtils.PI)
|
|
37458
37458
|
r2 += MathUtils.PI2;
|
|
37459
37459
|
r2 *= rotateMix;
|
|
37460
|
-
const
|
|
37461
|
-
const
|
|
37462
|
-
mat.a =
|
|
37463
|
-
mat.c =
|
|
37464
|
-
mat.b =
|
|
37465
|
-
mat.d =
|
|
37460
|
+
const cos2 = Math.cos(r2);
|
|
37461
|
+
const sin2 = Math.sin(r2);
|
|
37462
|
+
mat.a = cos2 * a2 - sin2 * c2;
|
|
37463
|
+
mat.c = cos2 * b2 - sin2 * d2;
|
|
37464
|
+
mat.b = sin2 * a2 + cos2 * c2;
|
|
37465
|
+
mat.d = sin2 * b2 + cos2 * d2;
|
|
37466
37466
|
modified = true;
|
|
37467
37467
|
}
|
|
37468
37468
|
if (translateMix != 0) {
|
|
@@ -40265,10 +40265,10 @@ void main(void)\r
|
|
|
40265
40265
|
}
|
|
40266
40266
|
computeWorldRotation(bone) {
|
|
40267
40267
|
const mat = bone.matrix;
|
|
40268
|
-
const
|
|
40269
|
-
const
|
|
40270
|
-
const x2 =
|
|
40271
|
-
const y2 =
|
|
40268
|
+
const cos2 = MathUtils.cosDeg(this.rotation);
|
|
40269
|
+
const sin2 = MathUtils.sinDeg(this.rotation);
|
|
40270
|
+
const x2 = cos2 * mat.a + sin2 * mat.c;
|
|
40271
|
+
const y2 = cos2 * mat.b + sin2 * mat.d;
|
|
40272
40272
|
return Math.atan2(y2, x2) * MathUtils.radDeg;
|
|
40273
40273
|
}
|
|
40274
40274
|
};
|
|
@@ -40342,16 +40342,16 @@ void main(void)\r
|
|
|
40342
40342
|
const localX2 = localX + this.region.width * regionScaleX;
|
|
40343
40343
|
const localY2 = localY + this.region.height * regionScaleY;
|
|
40344
40344
|
const radians = this.rotation * Math.PI / 180;
|
|
40345
|
-
const
|
|
40346
|
-
const
|
|
40347
|
-
const localXCos = localX *
|
|
40348
|
-
const localXSin = localX *
|
|
40349
|
-
const localYCos = localY *
|
|
40350
|
-
const localYSin = localY *
|
|
40351
|
-
const localX2Cos = localX2 *
|
|
40352
|
-
const localX2Sin = localX2 *
|
|
40353
|
-
const localY2Cos = localY2 *
|
|
40354
|
-
const localY2Sin = localY2 *
|
|
40345
|
+
const cos2 = Math.cos(radians);
|
|
40346
|
+
const sin2 = Math.sin(radians);
|
|
40347
|
+
const localXCos = localX * cos2 + this.x;
|
|
40348
|
+
const localXSin = localX * sin2;
|
|
40349
|
+
const localYCos = localY * cos2 + this.y;
|
|
40350
|
+
const localYSin = localY * sin2;
|
|
40351
|
+
const localX2Cos = localX2 * cos2 + this.x;
|
|
40352
|
+
const localX2Sin = localX2 * sin2;
|
|
40353
|
+
const localY2Cos = localY2 * cos2 + this.y;
|
|
40354
|
+
const localY2Sin = localY2 * sin2;
|
|
40355
40355
|
const offset = this.offset;
|
|
40356
40356
|
offset[_RegionAttachment$1.OX1] = localXCos - localYSin;
|
|
40357
40357
|
offset[_RegionAttachment$1.OY1] = localYCos + localXSin;
|
|
@@ -42983,10 +42983,10 @@ void main(void)\r
|
|
|
42983
42983
|
}
|
|
42984
42984
|
computeWorldRotation(bone) {
|
|
42985
42985
|
const mat = bone.matrix;
|
|
42986
|
-
const
|
|
42987
|
-
const
|
|
42988
|
-
const x2 =
|
|
42989
|
-
const y2 =
|
|
42986
|
+
const cos2 = MathUtils.cosDeg(this.rotation);
|
|
42987
|
+
const sin2 = MathUtils.sinDeg(this.rotation);
|
|
42988
|
+
const x2 = cos2 * mat.a + sin2 * mat.c;
|
|
42989
|
+
const y2 = cos2 * mat.b + sin2 * mat.d;
|
|
42990
42990
|
return Math.atan2(y2, x2) * MathUtils.radDeg;
|
|
42991
42991
|
}
|
|
42992
42992
|
copy() {
|
|
@@ -43030,18 +43030,18 @@ void main(void)\r
|
|
|
43030
43030
|
const localX2 = localX + this.region.width * regionScaleX;
|
|
43031
43031
|
const localY2 = localY + this.region.height * regionScaleY;
|
|
43032
43032
|
const radians = this.rotation * Math.PI / 180;
|
|
43033
|
-
const
|
|
43034
|
-
const
|
|
43033
|
+
const cos2 = Math.cos(radians);
|
|
43034
|
+
const sin2 = Math.sin(radians);
|
|
43035
43035
|
const x2 = this.x;
|
|
43036
43036
|
const y2 = this.y;
|
|
43037
|
-
const localXCos = localX *
|
|
43038
|
-
const localXSin = localX *
|
|
43039
|
-
const localYCos = localY *
|
|
43040
|
-
const localYSin = localY *
|
|
43041
|
-
const localX2Cos = localX2 *
|
|
43042
|
-
const localX2Sin = localX2 *
|
|
43043
|
-
const localY2Cos = localY2 *
|
|
43044
|
-
const localY2Sin = localY2 *
|
|
43037
|
+
const localXCos = localX * cos2 + x2;
|
|
43038
|
+
const localXSin = localX * sin2;
|
|
43039
|
+
const localYCos = localY * cos2 + y2;
|
|
43040
|
+
const localYSin = localY * sin2;
|
|
43041
|
+
const localX2Cos = localX2 * cos2 + x2;
|
|
43042
|
+
const localX2Sin = localX2 * sin2;
|
|
43043
|
+
const localY2Cos = localY2 * cos2 + y2;
|
|
43044
|
+
const localY2Sin = localY2 * sin2;
|
|
43045
43045
|
const offset = this.offset;
|
|
43046
43046
|
offset[0] = localXCos - localYSin;
|
|
43047
43047
|
offset[1] = localYCos + localXSin;
|
|
@@ -54706,7 +54706,7 @@ void main(void){
|
|
|
54706
54706
|
sample *= alpha;
|
|
54707
54707
|
|
|
54708
54708
|
gl_FragColor = sample;
|
|
54709
|
-
}`, P = Object.defineProperty, c = Object.getOwnPropertySymbols, T = Object.prototype.hasOwnProperty, z = Object.prototype.propertyIsEnumerable, _ = (t2, e2, i2) => e2 in t2 ? P(t2, e2, { enumerable: true, configurable: true, writable: true, value: i2 }) : t2[e2] = i2, b = (t2, e2) => {
|
|
54709
|
+
}`, P$1 = Object.defineProperty, c = Object.getOwnPropertySymbols, T = Object.prototype.hasOwnProperty, z = Object.prototype.propertyIsEnumerable, _ = (t2, e2, i2) => e2 in t2 ? P$1(t2, e2, { enumerable: true, configurable: true, writable: true, value: i2 }) : t2[e2] = i2, b = (t2, e2) => {
|
|
54710
54710
|
for (var i2 in e2 || (e2 = {}))
|
|
54711
54711
|
T.call(e2, i2) && _(t2, i2, e2[i2]);
|
|
54712
54712
|
if (c)
|
|
@@ -54796,14 +54796,14 @@ void main(void){
|
|
|
54796
54796
|
};
|
|
54797
54797
|
let F = o;
|
|
54798
54798
|
F.defaults = { offset: { x: 4, y: 4 }, color: 0, alpha: 0.5, shadowOnly: false, kernels: null, blur: 2, quality: 3, pixelSize: 1, resolution: settings$1.FILTER_RESOLUTION };
|
|
54799
|
-
const libPixiShadow = (container,
|
|
54799
|
+
const libPixiShadow = (container, config2) => {
|
|
54800
54800
|
const {
|
|
54801
54801
|
color = "#000",
|
|
54802
54802
|
alpha = 0.25,
|
|
54803
54803
|
blur = 1,
|
|
54804
54804
|
distance = 0,
|
|
54805
54805
|
offset = { x: 0, y: 0 }
|
|
54806
|
-
} =
|
|
54806
|
+
} = config2 || {};
|
|
54807
54807
|
const shadowFilter = new F({
|
|
54808
54808
|
color,
|
|
54809
54809
|
alpha,
|
|
@@ -55419,6 +55419,2381 @@ void main(void){
|
|
|
55419
55419
|
this._maxWidth && libPixiScaleContainer(this, this._maxWidth);
|
|
55420
55420
|
}
|
|
55421
55421
|
}
|
|
55422
|
+
/*!
|
|
55423
|
+
* decimal.js v10.4.3
|
|
55424
|
+
* An arbitrary-precision Decimal type for JavaScript.
|
|
55425
|
+
* https://github.com/MikeMcl/decimal.js
|
|
55426
|
+
* Copyright (c) 2022 Michael Mclaughlin <M8ch88l@gmail.com>
|
|
55427
|
+
* MIT Licence
|
|
55428
|
+
*/
|
|
55429
|
+
var EXP_LIMIT = 9e15, MAX_DIGITS = 1e9, NUMERALS = "0123456789abcdef", LN10 = "2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058", PI = "3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789", DEFAULTS = {
|
|
55430
|
+
// These values must be integers within the stated ranges (inclusive).
|
|
55431
|
+
// Most of these values can be changed at run-time using the `Decimal.config` method.
|
|
55432
|
+
// The maximum number of significant digits of the result of a calculation or base conversion.
|
|
55433
|
+
// E.g. `Decimal.config({ precision: 20 });`
|
|
55434
|
+
precision: 20,
|
|
55435
|
+
// 1 to MAX_DIGITS
|
|
55436
|
+
// The rounding mode used when rounding to `precision`.
|
|
55437
|
+
//
|
|
55438
|
+
// ROUND_UP 0 Away from zero.
|
|
55439
|
+
// ROUND_DOWN 1 Towards zero.
|
|
55440
|
+
// ROUND_CEIL 2 Towards +Infinity.
|
|
55441
|
+
// ROUND_FLOOR 3 Towards -Infinity.
|
|
55442
|
+
// ROUND_HALF_UP 4 Towards nearest neighbour. If equidistant, up.
|
|
55443
|
+
// ROUND_HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.
|
|
55444
|
+
// ROUND_HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.
|
|
55445
|
+
// ROUND_HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.
|
|
55446
|
+
// ROUND_HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.
|
|
55447
|
+
//
|
|
55448
|
+
// E.g.
|
|
55449
|
+
// `Decimal.rounding = 4;`
|
|
55450
|
+
// `Decimal.rounding = Decimal.ROUND_HALF_UP;`
|
|
55451
|
+
rounding: 4,
|
|
55452
|
+
// 0 to 8
|
|
55453
|
+
// The modulo mode used when calculating the modulus: a mod n.
|
|
55454
|
+
// The quotient (q = a / n) is calculated according to the corresponding rounding mode.
|
|
55455
|
+
// The remainder (r) is calculated as: r = a - n * q.
|
|
55456
|
+
//
|
|
55457
|
+
// UP 0 The remainder is positive if the dividend is negative, else is negative.
|
|
55458
|
+
// DOWN 1 The remainder has the same sign as the dividend (JavaScript %).
|
|
55459
|
+
// FLOOR 3 The remainder has the same sign as the divisor (Python %).
|
|
55460
|
+
// HALF_EVEN 6 The IEEE 754 remainder function.
|
|
55461
|
+
// EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)). Always positive.
|
|
55462
|
+
//
|
|
55463
|
+
// Truncated division (1), floored division (3), the IEEE 754 remainder (6), and Euclidian
|
|
55464
|
+
// division (9) are commonly used for the modulus operation. The other rounding modes can also
|
|
55465
|
+
// be used, but they may not give useful results.
|
|
55466
|
+
modulo: 1,
|
|
55467
|
+
// 0 to 9
|
|
55468
|
+
// The exponent value at and beneath which `toString` returns exponential notation.
|
|
55469
|
+
// JavaScript numbers: -7
|
|
55470
|
+
toExpNeg: -7,
|
|
55471
|
+
// 0 to -EXP_LIMIT
|
|
55472
|
+
// The exponent value at and above which `toString` returns exponential notation.
|
|
55473
|
+
// JavaScript numbers: 21
|
|
55474
|
+
toExpPos: 21,
|
|
55475
|
+
// 0 to EXP_LIMIT
|
|
55476
|
+
// The minimum exponent value, beneath which underflow to zero occurs.
|
|
55477
|
+
// JavaScript numbers: -324 (5e-324)
|
|
55478
|
+
minE: -EXP_LIMIT,
|
|
55479
|
+
// -1 to -EXP_LIMIT
|
|
55480
|
+
// The maximum exponent value, above which overflow to Infinity occurs.
|
|
55481
|
+
// JavaScript numbers: 308 (1.7976931348623157e+308)
|
|
55482
|
+
maxE: EXP_LIMIT,
|
|
55483
|
+
// 1 to EXP_LIMIT
|
|
55484
|
+
// Whether to use cryptographically-secure random number generation, if available.
|
|
55485
|
+
crypto: false
|
|
55486
|
+
// true/false
|
|
55487
|
+
}, inexact, quadrant, external = true, decimalError = "[DecimalError] ", invalidArgument = decimalError + "Invalid argument: ", precisionLimitExceeded = decimalError + "Precision limit exceeded", cryptoUnavailable = decimalError + "crypto unavailable", tag = "[object Decimal]", mathfloor = Math.floor, mathpow = Math.pow, isBinary = /^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i, isHex = /^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i, isOctal = /^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i, isDecimal = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i, BASE = 1e7, LOG_BASE = 7, MAX_SAFE_INTEGER = 9007199254740991, LN10_PRECISION = LN10.length - 1, PI_PRECISION = PI.length - 1, P = { toStringTag: tag };
|
|
55488
|
+
P.absoluteValue = P.abs = function() {
|
|
55489
|
+
var x2 = new this.constructor(this);
|
|
55490
|
+
if (x2.s < 0)
|
|
55491
|
+
x2.s = 1;
|
|
55492
|
+
return finalise(x2);
|
|
55493
|
+
};
|
|
55494
|
+
P.ceil = function() {
|
|
55495
|
+
return finalise(new this.constructor(this), this.e + 1, 2);
|
|
55496
|
+
};
|
|
55497
|
+
P.clampedTo = P.clamp = function(min2, max2) {
|
|
55498
|
+
var k2, x2 = this, Ctor = x2.constructor;
|
|
55499
|
+
min2 = new Ctor(min2);
|
|
55500
|
+
max2 = new Ctor(max2);
|
|
55501
|
+
if (!min2.s || !max2.s)
|
|
55502
|
+
return new Ctor(NaN);
|
|
55503
|
+
if (min2.gt(max2))
|
|
55504
|
+
throw Error(invalidArgument + max2);
|
|
55505
|
+
k2 = x2.cmp(min2);
|
|
55506
|
+
return k2 < 0 ? min2 : x2.cmp(max2) > 0 ? max2 : new Ctor(x2);
|
|
55507
|
+
};
|
|
55508
|
+
P.comparedTo = P.cmp = function(y2) {
|
|
55509
|
+
var i2, j2, xdL, ydL, x2 = this, xd = x2.d, yd = (y2 = new x2.constructor(y2)).d, xs = x2.s, ys = y2.s;
|
|
55510
|
+
if (!xd || !yd) {
|
|
55511
|
+
return !xs || !ys ? NaN : xs !== ys ? xs : xd === yd ? 0 : !xd ^ xs < 0 ? 1 : -1;
|
|
55512
|
+
}
|
|
55513
|
+
if (!xd[0] || !yd[0])
|
|
55514
|
+
return xd[0] ? xs : yd[0] ? -ys : 0;
|
|
55515
|
+
if (xs !== ys)
|
|
55516
|
+
return xs;
|
|
55517
|
+
if (x2.e !== y2.e)
|
|
55518
|
+
return x2.e > y2.e ^ xs < 0 ? 1 : -1;
|
|
55519
|
+
xdL = xd.length;
|
|
55520
|
+
ydL = yd.length;
|
|
55521
|
+
for (i2 = 0, j2 = xdL < ydL ? xdL : ydL; i2 < j2; ++i2) {
|
|
55522
|
+
if (xd[i2] !== yd[i2])
|
|
55523
|
+
return xd[i2] > yd[i2] ^ xs < 0 ? 1 : -1;
|
|
55524
|
+
}
|
|
55525
|
+
return xdL === ydL ? 0 : xdL > ydL ^ xs < 0 ? 1 : -1;
|
|
55526
|
+
};
|
|
55527
|
+
P.cosine = P.cos = function() {
|
|
55528
|
+
var pr, rm, x2 = this, Ctor = x2.constructor;
|
|
55529
|
+
if (!x2.d)
|
|
55530
|
+
return new Ctor(NaN);
|
|
55531
|
+
if (!x2.d[0])
|
|
55532
|
+
return new Ctor(1);
|
|
55533
|
+
pr = Ctor.precision;
|
|
55534
|
+
rm = Ctor.rounding;
|
|
55535
|
+
Ctor.precision = pr + Math.max(x2.e, x2.sd()) + LOG_BASE;
|
|
55536
|
+
Ctor.rounding = 1;
|
|
55537
|
+
x2 = cosine(Ctor, toLessThanHalfPi(Ctor, x2));
|
|
55538
|
+
Ctor.precision = pr;
|
|
55539
|
+
Ctor.rounding = rm;
|
|
55540
|
+
return finalise(quadrant == 2 || quadrant == 3 ? x2.neg() : x2, pr, rm, true);
|
|
55541
|
+
};
|
|
55542
|
+
P.cubeRoot = P.cbrt = function() {
|
|
55543
|
+
var e2, m2, n2, r2, rep, s2, sd, t2, t3, t3plusx, x2 = this, Ctor = x2.constructor;
|
|
55544
|
+
if (!x2.isFinite() || x2.isZero())
|
|
55545
|
+
return new Ctor(x2);
|
|
55546
|
+
external = false;
|
|
55547
|
+
s2 = x2.s * mathpow(x2.s * x2, 1 / 3);
|
|
55548
|
+
if (!s2 || Math.abs(s2) == 1 / 0) {
|
|
55549
|
+
n2 = digitsToString(x2.d);
|
|
55550
|
+
e2 = x2.e;
|
|
55551
|
+
if (s2 = (e2 - n2.length + 1) % 3)
|
|
55552
|
+
n2 += s2 == 1 || s2 == -2 ? "0" : "00";
|
|
55553
|
+
s2 = mathpow(n2, 1 / 3);
|
|
55554
|
+
e2 = mathfloor((e2 + 1) / 3) - (e2 % 3 == (e2 < 0 ? -1 : 2));
|
|
55555
|
+
if (s2 == 1 / 0) {
|
|
55556
|
+
n2 = "5e" + e2;
|
|
55557
|
+
} else {
|
|
55558
|
+
n2 = s2.toExponential();
|
|
55559
|
+
n2 = n2.slice(0, n2.indexOf("e") + 1) + e2;
|
|
55560
|
+
}
|
|
55561
|
+
r2 = new Ctor(n2);
|
|
55562
|
+
r2.s = x2.s;
|
|
55563
|
+
} else {
|
|
55564
|
+
r2 = new Ctor(s2.toString());
|
|
55565
|
+
}
|
|
55566
|
+
sd = (e2 = Ctor.precision) + 3;
|
|
55567
|
+
for (; ; ) {
|
|
55568
|
+
t2 = r2;
|
|
55569
|
+
t3 = t2.times(t2).times(t2);
|
|
55570
|
+
t3plusx = t3.plus(x2);
|
|
55571
|
+
r2 = divide(t3plusx.plus(x2).times(t2), t3plusx.plus(t3), sd + 2, 1);
|
|
55572
|
+
if (digitsToString(t2.d).slice(0, sd) === (n2 = digitsToString(r2.d)).slice(0, sd)) {
|
|
55573
|
+
n2 = n2.slice(sd - 3, sd + 1);
|
|
55574
|
+
if (n2 == "9999" || !rep && n2 == "4999") {
|
|
55575
|
+
if (!rep) {
|
|
55576
|
+
finalise(t2, e2 + 1, 0);
|
|
55577
|
+
if (t2.times(t2).times(t2).eq(x2)) {
|
|
55578
|
+
r2 = t2;
|
|
55579
|
+
break;
|
|
55580
|
+
}
|
|
55581
|
+
}
|
|
55582
|
+
sd += 4;
|
|
55583
|
+
rep = 1;
|
|
55584
|
+
} else {
|
|
55585
|
+
if (!+n2 || !+n2.slice(1) && n2.charAt(0) == "5") {
|
|
55586
|
+
finalise(r2, e2 + 1, 1);
|
|
55587
|
+
m2 = !r2.times(r2).times(r2).eq(x2);
|
|
55588
|
+
}
|
|
55589
|
+
break;
|
|
55590
|
+
}
|
|
55591
|
+
}
|
|
55592
|
+
}
|
|
55593
|
+
external = true;
|
|
55594
|
+
return finalise(r2, e2, Ctor.rounding, m2);
|
|
55595
|
+
};
|
|
55596
|
+
P.decimalPlaces = P.dp = function() {
|
|
55597
|
+
var w2, d2 = this.d, n2 = NaN;
|
|
55598
|
+
if (d2) {
|
|
55599
|
+
w2 = d2.length - 1;
|
|
55600
|
+
n2 = (w2 - mathfloor(this.e / LOG_BASE)) * LOG_BASE;
|
|
55601
|
+
w2 = d2[w2];
|
|
55602
|
+
if (w2)
|
|
55603
|
+
for (; w2 % 10 == 0; w2 /= 10)
|
|
55604
|
+
n2--;
|
|
55605
|
+
if (n2 < 0)
|
|
55606
|
+
n2 = 0;
|
|
55607
|
+
}
|
|
55608
|
+
return n2;
|
|
55609
|
+
};
|
|
55610
|
+
P.dividedBy = P.div = function(y2) {
|
|
55611
|
+
return divide(this, new this.constructor(y2));
|
|
55612
|
+
};
|
|
55613
|
+
P.dividedToIntegerBy = P.divToInt = function(y2) {
|
|
55614
|
+
var x2 = this, Ctor = x2.constructor;
|
|
55615
|
+
return finalise(divide(x2, new Ctor(y2), 0, 1, 1), Ctor.precision, Ctor.rounding);
|
|
55616
|
+
};
|
|
55617
|
+
P.equals = P.eq = function(y2) {
|
|
55618
|
+
return this.cmp(y2) === 0;
|
|
55619
|
+
};
|
|
55620
|
+
P.floor = function() {
|
|
55621
|
+
return finalise(new this.constructor(this), this.e + 1, 3);
|
|
55622
|
+
};
|
|
55623
|
+
P.greaterThan = P.gt = function(y2) {
|
|
55624
|
+
return this.cmp(y2) > 0;
|
|
55625
|
+
};
|
|
55626
|
+
P.greaterThanOrEqualTo = P.gte = function(y2) {
|
|
55627
|
+
var k2 = this.cmp(y2);
|
|
55628
|
+
return k2 == 1 || k2 === 0;
|
|
55629
|
+
};
|
|
55630
|
+
P.hyperbolicCosine = P.cosh = function() {
|
|
55631
|
+
var k2, n2, pr, rm, len, x2 = this, Ctor = x2.constructor, one = new Ctor(1);
|
|
55632
|
+
if (!x2.isFinite())
|
|
55633
|
+
return new Ctor(x2.s ? 1 / 0 : NaN);
|
|
55634
|
+
if (x2.isZero())
|
|
55635
|
+
return one;
|
|
55636
|
+
pr = Ctor.precision;
|
|
55637
|
+
rm = Ctor.rounding;
|
|
55638
|
+
Ctor.precision = pr + Math.max(x2.e, x2.sd()) + 4;
|
|
55639
|
+
Ctor.rounding = 1;
|
|
55640
|
+
len = x2.d.length;
|
|
55641
|
+
if (len < 32) {
|
|
55642
|
+
k2 = Math.ceil(len / 3);
|
|
55643
|
+
n2 = (1 / tinyPow(4, k2)).toString();
|
|
55644
|
+
} else {
|
|
55645
|
+
k2 = 16;
|
|
55646
|
+
n2 = "2.3283064365386962890625e-10";
|
|
55647
|
+
}
|
|
55648
|
+
x2 = taylorSeries(Ctor, 1, x2.times(n2), new Ctor(1), true);
|
|
55649
|
+
var cosh2_x, i2 = k2, d8 = new Ctor(8);
|
|
55650
|
+
for (; i2--; ) {
|
|
55651
|
+
cosh2_x = x2.times(x2);
|
|
55652
|
+
x2 = one.minus(cosh2_x.times(d8.minus(cosh2_x.times(d8))));
|
|
55653
|
+
}
|
|
55654
|
+
return finalise(x2, Ctor.precision = pr, Ctor.rounding = rm, true);
|
|
55655
|
+
};
|
|
55656
|
+
P.hyperbolicSine = P.sinh = function() {
|
|
55657
|
+
var k2, pr, rm, len, x2 = this, Ctor = x2.constructor;
|
|
55658
|
+
if (!x2.isFinite() || x2.isZero())
|
|
55659
|
+
return new Ctor(x2);
|
|
55660
|
+
pr = Ctor.precision;
|
|
55661
|
+
rm = Ctor.rounding;
|
|
55662
|
+
Ctor.precision = pr + Math.max(x2.e, x2.sd()) + 4;
|
|
55663
|
+
Ctor.rounding = 1;
|
|
55664
|
+
len = x2.d.length;
|
|
55665
|
+
if (len < 3) {
|
|
55666
|
+
x2 = taylorSeries(Ctor, 2, x2, x2, true);
|
|
55667
|
+
} else {
|
|
55668
|
+
k2 = 1.4 * Math.sqrt(len);
|
|
55669
|
+
k2 = k2 > 16 ? 16 : k2 | 0;
|
|
55670
|
+
x2 = x2.times(1 / tinyPow(5, k2));
|
|
55671
|
+
x2 = taylorSeries(Ctor, 2, x2, x2, true);
|
|
55672
|
+
var sinh2_x, d5 = new Ctor(5), d16 = new Ctor(16), d20 = new Ctor(20);
|
|
55673
|
+
for (; k2--; ) {
|
|
55674
|
+
sinh2_x = x2.times(x2);
|
|
55675
|
+
x2 = x2.times(d5.plus(sinh2_x.times(d16.times(sinh2_x).plus(d20))));
|
|
55676
|
+
}
|
|
55677
|
+
}
|
|
55678
|
+
Ctor.precision = pr;
|
|
55679
|
+
Ctor.rounding = rm;
|
|
55680
|
+
return finalise(x2, pr, rm, true);
|
|
55681
|
+
};
|
|
55682
|
+
P.hyperbolicTangent = P.tanh = function() {
|
|
55683
|
+
var pr, rm, x2 = this, Ctor = x2.constructor;
|
|
55684
|
+
if (!x2.isFinite())
|
|
55685
|
+
return new Ctor(x2.s);
|
|
55686
|
+
if (x2.isZero())
|
|
55687
|
+
return new Ctor(x2);
|
|
55688
|
+
pr = Ctor.precision;
|
|
55689
|
+
rm = Ctor.rounding;
|
|
55690
|
+
Ctor.precision = pr + 7;
|
|
55691
|
+
Ctor.rounding = 1;
|
|
55692
|
+
return divide(x2.sinh(), x2.cosh(), Ctor.precision = pr, Ctor.rounding = rm);
|
|
55693
|
+
};
|
|
55694
|
+
P.inverseCosine = P.acos = function() {
|
|
55695
|
+
var halfPi, x2 = this, Ctor = x2.constructor, k2 = x2.abs().cmp(1), pr = Ctor.precision, rm = Ctor.rounding;
|
|
55696
|
+
if (k2 !== -1) {
|
|
55697
|
+
return k2 === 0 ? x2.isNeg() ? getPi(Ctor, pr, rm) : new Ctor(0) : new Ctor(NaN);
|
|
55698
|
+
}
|
|
55699
|
+
if (x2.isZero())
|
|
55700
|
+
return getPi(Ctor, pr + 4, rm).times(0.5);
|
|
55701
|
+
Ctor.precision = pr + 6;
|
|
55702
|
+
Ctor.rounding = 1;
|
|
55703
|
+
x2 = x2.asin();
|
|
55704
|
+
halfPi = getPi(Ctor, pr + 4, rm).times(0.5);
|
|
55705
|
+
Ctor.precision = pr;
|
|
55706
|
+
Ctor.rounding = rm;
|
|
55707
|
+
return halfPi.minus(x2);
|
|
55708
|
+
};
|
|
55709
|
+
P.inverseHyperbolicCosine = P.acosh = function() {
|
|
55710
|
+
var pr, rm, x2 = this, Ctor = x2.constructor;
|
|
55711
|
+
if (x2.lte(1))
|
|
55712
|
+
return new Ctor(x2.eq(1) ? 0 : NaN);
|
|
55713
|
+
if (!x2.isFinite())
|
|
55714
|
+
return new Ctor(x2);
|
|
55715
|
+
pr = Ctor.precision;
|
|
55716
|
+
rm = Ctor.rounding;
|
|
55717
|
+
Ctor.precision = pr + Math.max(Math.abs(x2.e), x2.sd()) + 4;
|
|
55718
|
+
Ctor.rounding = 1;
|
|
55719
|
+
external = false;
|
|
55720
|
+
x2 = x2.times(x2).minus(1).sqrt().plus(x2);
|
|
55721
|
+
external = true;
|
|
55722
|
+
Ctor.precision = pr;
|
|
55723
|
+
Ctor.rounding = rm;
|
|
55724
|
+
return x2.ln();
|
|
55725
|
+
};
|
|
55726
|
+
P.inverseHyperbolicSine = P.asinh = function() {
|
|
55727
|
+
var pr, rm, x2 = this, Ctor = x2.constructor;
|
|
55728
|
+
if (!x2.isFinite() || x2.isZero())
|
|
55729
|
+
return new Ctor(x2);
|
|
55730
|
+
pr = Ctor.precision;
|
|
55731
|
+
rm = Ctor.rounding;
|
|
55732
|
+
Ctor.precision = pr + 2 * Math.max(Math.abs(x2.e), x2.sd()) + 6;
|
|
55733
|
+
Ctor.rounding = 1;
|
|
55734
|
+
external = false;
|
|
55735
|
+
x2 = x2.times(x2).plus(1).sqrt().plus(x2);
|
|
55736
|
+
external = true;
|
|
55737
|
+
Ctor.precision = pr;
|
|
55738
|
+
Ctor.rounding = rm;
|
|
55739
|
+
return x2.ln();
|
|
55740
|
+
};
|
|
55741
|
+
P.inverseHyperbolicTangent = P.atanh = function() {
|
|
55742
|
+
var pr, rm, wpr, xsd, x2 = this, Ctor = x2.constructor;
|
|
55743
|
+
if (!x2.isFinite())
|
|
55744
|
+
return new Ctor(NaN);
|
|
55745
|
+
if (x2.e >= 0)
|
|
55746
|
+
return new Ctor(x2.abs().eq(1) ? x2.s / 0 : x2.isZero() ? x2 : NaN);
|
|
55747
|
+
pr = Ctor.precision;
|
|
55748
|
+
rm = Ctor.rounding;
|
|
55749
|
+
xsd = x2.sd();
|
|
55750
|
+
if (Math.max(xsd, pr) < 2 * -x2.e - 1)
|
|
55751
|
+
return finalise(new Ctor(x2), pr, rm, true);
|
|
55752
|
+
Ctor.precision = wpr = xsd - x2.e;
|
|
55753
|
+
x2 = divide(x2.plus(1), new Ctor(1).minus(x2), wpr + pr, 1);
|
|
55754
|
+
Ctor.precision = pr + 4;
|
|
55755
|
+
Ctor.rounding = 1;
|
|
55756
|
+
x2 = x2.ln();
|
|
55757
|
+
Ctor.precision = pr;
|
|
55758
|
+
Ctor.rounding = rm;
|
|
55759
|
+
return x2.times(0.5);
|
|
55760
|
+
};
|
|
55761
|
+
P.inverseSine = P.asin = function() {
|
|
55762
|
+
var halfPi, k2, pr, rm, x2 = this, Ctor = x2.constructor;
|
|
55763
|
+
if (x2.isZero())
|
|
55764
|
+
return new Ctor(x2);
|
|
55765
|
+
k2 = x2.abs().cmp(1);
|
|
55766
|
+
pr = Ctor.precision;
|
|
55767
|
+
rm = Ctor.rounding;
|
|
55768
|
+
if (k2 !== -1) {
|
|
55769
|
+
if (k2 === 0) {
|
|
55770
|
+
halfPi = getPi(Ctor, pr + 4, rm).times(0.5);
|
|
55771
|
+
halfPi.s = x2.s;
|
|
55772
|
+
return halfPi;
|
|
55773
|
+
}
|
|
55774
|
+
return new Ctor(NaN);
|
|
55775
|
+
}
|
|
55776
|
+
Ctor.precision = pr + 6;
|
|
55777
|
+
Ctor.rounding = 1;
|
|
55778
|
+
x2 = x2.div(new Ctor(1).minus(x2.times(x2)).sqrt().plus(1)).atan();
|
|
55779
|
+
Ctor.precision = pr;
|
|
55780
|
+
Ctor.rounding = rm;
|
|
55781
|
+
return x2.times(2);
|
|
55782
|
+
};
|
|
55783
|
+
P.inverseTangent = P.atan = function() {
|
|
55784
|
+
var i2, j2, k2, n2, px, t2, r2, wpr, x2, x3 = this, Ctor = x3.constructor, pr = Ctor.precision, rm = Ctor.rounding;
|
|
55785
|
+
if (!x3.isFinite()) {
|
|
55786
|
+
if (!x3.s)
|
|
55787
|
+
return new Ctor(NaN);
|
|
55788
|
+
if (pr + 4 <= PI_PRECISION) {
|
|
55789
|
+
r2 = getPi(Ctor, pr + 4, rm).times(0.5);
|
|
55790
|
+
r2.s = x3.s;
|
|
55791
|
+
return r2;
|
|
55792
|
+
}
|
|
55793
|
+
} else if (x3.isZero()) {
|
|
55794
|
+
return new Ctor(x3);
|
|
55795
|
+
} else if (x3.abs().eq(1) && pr + 4 <= PI_PRECISION) {
|
|
55796
|
+
r2 = getPi(Ctor, pr + 4, rm).times(0.25);
|
|
55797
|
+
r2.s = x3.s;
|
|
55798
|
+
return r2;
|
|
55799
|
+
}
|
|
55800
|
+
Ctor.precision = wpr = pr + 10;
|
|
55801
|
+
Ctor.rounding = 1;
|
|
55802
|
+
k2 = Math.min(28, wpr / LOG_BASE + 2 | 0);
|
|
55803
|
+
for (i2 = k2; i2; --i2)
|
|
55804
|
+
x3 = x3.div(x3.times(x3).plus(1).sqrt().plus(1));
|
|
55805
|
+
external = false;
|
|
55806
|
+
j2 = Math.ceil(wpr / LOG_BASE);
|
|
55807
|
+
n2 = 1;
|
|
55808
|
+
x2 = x3.times(x3);
|
|
55809
|
+
r2 = new Ctor(x3);
|
|
55810
|
+
px = x3;
|
|
55811
|
+
for (; i2 !== -1; ) {
|
|
55812
|
+
px = px.times(x2);
|
|
55813
|
+
t2 = r2.minus(px.div(n2 += 2));
|
|
55814
|
+
px = px.times(x2);
|
|
55815
|
+
r2 = t2.plus(px.div(n2 += 2));
|
|
55816
|
+
if (r2.d[j2] !== void 0)
|
|
55817
|
+
for (i2 = j2; r2.d[i2] === t2.d[i2] && i2--; )
|
|
55818
|
+
;
|
|
55819
|
+
}
|
|
55820
|
+
if (k2)
|
|
55821
|
+
r2 = r2.times(2 << k2 - 1);
|
|
55822
|
+
external = true;
|
|
55823
|
+
return finalise(r2, Ctor.precision = pr, Ctor.rounding = rm, true);
|
|
55824
|
+
};
|
|
55825
|
+
P.isFinite = function() {
|
|
55826
|
+
return !!this.d;
|
|
55827
|
+
};
|
|
55828
|
+
P.isInteger = P.isInt = function() {
|
|
55829
|
+
return !!this.d && mathfloor(this.e / LOG_BASE) > this.d.length - 2;
|
|
55830
|
+
};
|
|
55831
|
+
P.isNaN = function() {
|
|
55832
|
+
return !this.s;
|
|
55833
|
+
};
|
|
55834
|
+
P.isNegative = P.isNeg = function() {
|
|
55835
|
+
return this.s < 0;
|
|
55836
|
+
};
|
|
55837
|
+
P.isPositive = P.isPos = function() {
|
|
55838
|
+
return this.s > 0;
|
|
55839
|
+
};
|
|
55840
|
+
P.isZero = function() {
|
|
55841
|
+
return !!this.d && this.d[0] === 0;
|
|
55842
|
+
};
|
|
55843
|
+
P.lessThan = P.lt = function(y2) {
|
|
55844
|
+
return this.cmp(y2) < 0;
|
|
55845
|
+
};
|
|
55846
|
+
P.lessThanOrEqualTo = P.lte = function(y2) {
|
|
55847
|
+
return this.cmp(y2) < 1;
|
|
55848
|
+
};
|
|
55849
|
+
P.logarithm = P.log = function(base) {
|
|
55850
|
+
var isBase10, d2, denominator, k2, inf, num, sd, r2, arg = this, Ctor = arg.constructor, pr = Ctor.precision, rm = Ctor.rounding, guard = 5;
|
|
55851
|
+
if (base == null) {
|
|
55852
|
+
base = new Ctor(10);
|
|
55853
|
+
isBase10 = true;
|
|
55854
|
+
} else {
|
|
55855
|
+
base = new Ctor(base);
|
|
55856
|
+
d2 = base.d;
|
|
55857
|
+
if (base.s < 0 || !d2 || !d2[0] || base.eq(1))
|
|
55858
|
+
return new Ctor(NaN);
|
|
55859
|
+
isBase10 = base.eq(10);
|
|
55860
|
+
}
|
|
55861
|
+
d2 = arg.d;
|
|
55862
|
+
if (arg.s < 0 || !d2 || !d2[0] || arg.eq(1)) {
|
|
55863
|
+
return new Ctor(d2 && !d2[0] ? -1 / 0 : arg.s != 1 ? NaN : d2 ? 0 : 1 / 0);
|
|
55864
|
+
}
|
|
55865
|
+
if (isBase10) {
|
|
55866
|
+
if (d2.length > 1) {
|
|
55867
|
+
inf = true;
|
|
55868
|
+
} else {
|
|
55869
|
+
for (k2 = d2[0]; k2 % 10 === 0; )
|
|
55870
|
+
k2 /= 10;
|
|
55871
|
+
inf = k2 !== 1;
|
|
55872
|
+
}
|
|
55873
|
+
}
|
|
55874
|
+
external = false;
|
|
55875
|
+
sd = pr + guard;
|
|
55876
|
+
num = naturalLogarithm(arg, sd);
|
|
55877
|
+
denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd);
|
|
55878
|
+
r2 = divide(num, denominator, sd, 1);
|
|
55879
|
+
if (checkRoundingDigits(r2.d, k2 = pr, rm)) {
|
|
55880
|
+
do {
|
|
55881
|
+
sd += 10;
|
|
55882
|
+
num = naturalLogarithm(arg, sd);
|
|
55883
|
+
denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd);
|
|
55884
|
+
r2 = divide(num, denominator, sd, 1);
|
|
55885
|
+
if (!inf) {
|
|
55886
|
+
if (+digitsToString(r2.d).slice(k2 + 1, k2 + 15) + 1 == 1e14) {
|
|
55887
|
+
r2 = finalise(r2, pr + 1, 0);
|
|
55888
|
+
}
|
|
55889
|
+
break;
|
|
55890
|
+
}
|
|
55891
|
+
} while (checkRoundingDigits(r2.d, k2 += 10, rm));
|
|
55892
|
+
}
|
|
55893
|
+
external = true;
|
|
55894
|
+
return finalise(r2, pr, rm);
|
|
55895
|
+
};
|
|
55896
|
+
P.minus = P.sub = function(y2) {
|
|
55897
|
+
var d2, e2, i2, j2, k2, len, pr, rm, xd, xe, xLTy, yd, x2 = this, Ctor = x2.constructor;
|
|
55898
|
+
y2 = new Ctor(y2);
|
|
55899
|
+
if (!x2.d || !y2.d) {
|
|
55900
|
+
if (!x2.s || !y2.s)
|
|
55901
|
+
y2 = new Ctor(NaN);
|
|
55902
|
+
else if (x2.d)
|
|
55903
|
+
y2.s = -y2.s;
|
|
55904
|
+
else
|
|
55905
|
+
y2 = new Ctor(y2.d || x2.s !== y2.s ? x2 : NaN);
|
|
55906
|
+
return y2;
|
|
55907
|
+
}
|
|
55908
|
+
if (x2.s != y2.s) {
|
|
55909
|
+
y2.s = -y2.s;
|
|
55910
|
+
return x2.plus(y2);
|
|
55911
|
+
}
|
|
55912
|
+
xd = x2.d;
|
|
55913
|
+
yd = y2.d;
|
|
55914
|
+
pr = Ctor.precision;
|
|
55915
|
+
rm = Ctor.rounding;
|
|
55916
|
+
if (!xd[0] || !yd[0]) {
|
|
55917
|
+
if (yd[0])
|
|
55918
|
+
y2.s = -y2.s;
|
|
55919
|
+
else if (xd[0])
|
|
55920
|
+
y2 = new Ctor(x2);
|
|
55921
|
+
else
|
|
55922
|
+
return new Ctor(rm === 3 ? -0 : 0);
|
|
55923
|
+
return external ? finalise(y2, pr, rm) : y2;
|
|
55924
|
+
}
|
|
55925
|
+
e2 = mathfloor(y2.e / LOG_BASE);
|
|
55926
|
+
xe = mathfloor(x2.e / LOG_BASE);
|
|
55927
|
+
xd = xd.slice();
|
|
55928
|
+
k2 = xe - e2;
|
|
55929
|
+
if (k2) {
|
|
55930
|
+
xLTy = k2 < 0;
|
|
55931
|
+
if (xLTy) {
|
|
55932
|
+
d2 = xd;
|
|
55933
|
+
k2 = -k2;
|
|
55934
|
+
len = yd.length;
|
|
55935
|
+
} else {
|
|
55936
|
+
d2 = yd;
|
|
55937
|
+
e2 = xe;
|
|
55938
|
+
len = xd.length;
|
|
55939
|
+
}
|
|
55940
|
+
i2 = Math.max(Math.ceil(pr / LOG_BASE), len) + 2;
|
|
55941
|
+
if (k2 > i2) {
|
|
55942
|
+
k2 = i2;
|
|
55943
|
+
d2.length = 1;
|
|
55944
|
+
}
|
|
55945
|
+
d2.reverse();
|
|
55946
|
+
for (i2 = k2; i2--; )
|
|
55947
|
+
d2.push(0);
|
|
55948
|
+
d2.reverse();
|
|
55949
|
+
} else {
|
|
55950
|
+
i2 = xd.length;
|
|
55951
|
+
len = yd.length;
|
|
55952
|
+
xLTy = i2 < len;
|
|
55953
|
+
if (xLTy)
|
|
55954
|
+
len = i2;
|
|
55955
|
+
for (i2 = 0; i2 < len; i2++) {
|
|
55956
|
+
if (xd[i2] != yd[i2]) {
|
|
55957
|
+
xLTy = xd[i2] < yd[i2];
|
|
55958
|
+
break;
|
|
55959
|
+
}
|
|
55960
|
+
}
|
|
55961
|
+
k2 = 0;
|
|
55962
|
+
}
|
|
55963
|
+
if (xLTy) {
|
|
55964
|
+
d2 = xd;
|
|
55965
|
+
xd = yd;
|
|
55966
|
+
yd = d2;
|
|
55967
|
+
y2.s = -y2.s;
|
|
55968
|
+
}
|
|
55969
|
+
len = xd.length;
|
|
55970
|
+
for (i2 = yd.length - len; i2 > 0; --i2)
|
|
55971
|
+
xd[len++] = 0;
|
|
55972
|
+
for (i2 = yd.length; i2 > k2; ) {
|
|
55973
|
+
if (xd[--i2] < yd[i2]) {
|
|
55974
|
+
for (j2 = i2; j2 && xd[--j2] === 0; )
|
|
55975
|
+
xd[j2] = BASE - 1;
|
|
55976
|
+
--xd[j2];
|
|
55977
|
+
xd[i2] += BASE;
|
|
55978
|
+
}
|
|
55979
|
+
xd[i2] -= yd[i2];
|
|
55980
|
+
}
|
|
55981
|
+
for (; xd[--len] === 0; )
|
|
55982
|
+
xd.pop();
|
|
55983
|
+
for (; xd[0] === 0; xd.shift())
|
|
55984
|
+
--e2;
|
|
55985
|
+
if (!xd[0])
|
|
55986
|
+
return new Ctor(rm === 3 ? -0 : 0);
|
|
55987
|
+
y2.d = xd;
|
|
55988
|
+
y2.e = getBase10Exponent(xd, e2);
|
|
55989
|
+
return external ? finalise(y2, pr, rm) : y2;
|
|
55990
|
+
};
|
|
55991
|
+
P.modulo = P.mod = function(y2) {
|
|
55992
|
+
var q, x2 = this, Ctor = x2.constructor;
|
|
55993
|
+
y2 = new Ctor(y2);
|
|
55994
|
+
if (!x2.d || !y2.s || y2.d && !y2.d[0])
|
|
55995
|
+
return new Ctor(NaN);
|
|
55996
|
+
if (!y2.d || x2.d && !x2.d[0]) {
|
|
55997
|
+
return finalise(new Ctor(x2), Ctor.precision, Ctor.rounding);
|
|
55998
|
+
}
|
|
55999
|
+
external = false;
|
|
56000
|
+
if (Ctor.modulo == 9) {
|
|
56001
|
+
q = divide(x2, y2.abs(), 0, 3, 1);
|
|
56002
|
+
q.s *= y2.s;
|
|
56003
|
+
} else {
|
|
56004
|
+
q = divide(x2, y2, 0, Ctor.modulo, 1);
|
|
56005
|
+
}
|
|
56006
|
+
q = q.times(y2);
|
|
56007
|
+
external = true;
|
|
56008
|
+
return x2.minus(q);
|
|
56009
|
+
};
|
|
56010
|
+
P.naturalExponential = P.exp = function() {
|
|
56011
|
+
return naturalExponential(this);
|
|
56012
|
+
};
|
|
56013
|
+
P.naturalLogarithm = P.ln = function() {
|
|
56014
|
+
return naturalLogarithm(this);
|
|
56015
|
+
};
|
|
56016
|
+
P.negated = P.neg = function() {
|
|
56017
|
+
var x2 = new this.constructor(this);
|
|
56018
|
+
x2.s = -x2.s;
|
|
56019
|
+
return finalise(x2);
|
|
56020
|
+
};
|
|
56021
|
+
P.plus = P.add = function(y2) {
|
|
56022
|
+
var carry, d2, e2, i2, k2, len, pr, rm, xd, yd, x2 = this, Ctor = x2.constructor;
|
|
56023
|
+
y2 = new Ctor(y2);
|
|
56024
|
+
if (!x2.d || !y2.d) {
|
|
56025
|
+
if (!x2.s || !y2.s)
|
|
56026
|
+
y2 = new Ctor(NaN);
|
|
56027
|
+
else if (!x2.d)
|
|
56028
|
+
y2 = new Ctor(y2.d || x2.s === y2.s ? x2 : NaN);
|
|
56029
|
+
return y2;
|
|
56030
|
+
}
|
|
56031
|
+
if (x2.s != y2.s) {
|
|
56032
|
+
y2.s = -y2.s;
|
|
56033
|
+
return x2.minus(y2);
|
|
56034
|
+
}
|
|
56035
|
+
xd = x2.d;
|
|
56036
|
+
yd = y2.d;
|
|
56037
|
+
pr = Ctor.precision;
|
|
56038
|
+
rm = Ctor.rounding;
|
|
56039
|
+
if (!xd[0] || !yd[0]) {
|
|
56040
|
+
if (!yd[0])
|
|
56041
|
+
y2 = new Ctor(x2);
|
|
56042
|
+
return external ? finalise(y2, pr, rm) : y2;
|
|
56043
|
+
}
|
|
56044
|
+
k2 = mathfloor(x2.e / LOG_BASE);
|
|
56045
|
+
e2 = mathfloor(y2.e / LOG_BASE);
|
|
56046
|
+
xd = xd.slice();
|
|
56047
|
+
i2 = k2 - e2;
|
|
56048
|
+
if (i2) {
|
|
56049
|
+
if (i2 < 0) {
|
|
56050
|
+
d2 = xd;
|
|
56051
|
+
i2 = -i2;
|
|
56052
|
+
len = yd.length;
|
|
56053
|
+
} else {
|
|
56054
|
+
d2 = yd;
|
|
56055
|
+
e2 = k2;
|
|
56056
|
+
len = xd.length;
|
|
56057
|
+
}
|
|
56058
|
+
k2 = Math.ceil(pr / LOG_BASE);
|
|
56059
|
+
len = k2 > len ? k2 + 1 : len + 1;
|
|
56060
|
+
if (i2 > len) {
|
|
56061
|
+
i2 = len;
|
|
56062
|
+
d2.length = 1;
|
|
56063
|
+
}
|
|
56064
|
+
d2.reverse();
|
|
56065
|
+
for (; i2--; )
|
|
56066
|
+
d2.push(0);
|
|
56067
|
+
d2.reverse();
|
|
56068
|
+
}
|
|
56069
|
+
len = xd.length;
|
|
56070
|
+
i2 = yd.length;
|
|
56071
|
+
if (len - i2 < 0) {
|
|
56072
|
+
i2 = len;
|
|
56073
|
+
d2 = yd;
|
|
56074
|
+
yd = xd;
|
|
56075
|
+
xd = d2;
|
|
56076
|
+
}
|
|
56077
|
+
for (carry = 0; i2; ) {
|
|
56078
|
+
carry = (xd[--i2] = xd[i2] + yd[i2] + carry) / BASE | 0;
|
|
56079
|
+
xd[i2] %= BASE;
|
|
56080
|
+
}
|
|
56081
|
+
if (carry) {
|
|
56082
|
+
xd.unshift(carry);
|
|
56083
|
+
++e2;
|
|
56084
|
+
}
|
|
56085
|
+
for (len = xd.length; xd[--len] == 0; )
|
|
56086
|
+
xd.pop();
|
|
56087
|
+
y2.d = xd;
|
|
56088
|
+
y2.e = getBase10Exponent(xd, e2);
|
|
56089
|
+
return external ? finalise(y2, pr, rm) : y2;
|
|
56090
|
+
};
|
|
56091
|
+
P.precision = P.sd = function(z2) {
|
|
56092
|
+
var k2, x2 = this;
|
|
56093
|
+
if (z2 !== void 0 && z2 !== !!z2 && z2 !== 1 && z2 !== 0)
|
|
56094
|
+
throw Error(invalidArgument + z2);
|
|
56095
|
+
if (x2.d) {
|
|
56096
|
+
k2 = getPrecision(x2.d);
|
|
56097
|
+
if (z2 && x2.e + 1 > k2)
|
|
56098
|
+
k2 = x2.e + 1;
|
|
56099
|
+
} else {
|
|
56100
|
+
k2 = NaN;
|
|
56101
|
+
}
|
|
56102
|
+
return k2;
|
|
56103
|
+
};
|
|
56104
|
+
P.round = function() {
|
|
56105
|
+
var x2 = this, Ctor = x2.constructor;
|
|
56106
|
+
return finalise(new Ctor(x2), x2.e + 1, Ctor.rounding);
|
|
56107
|
+
};
|
|
56108
|
+
P.sine = P.sin = function() {
|
|
56109
|
+
var pr, rm, x2 = this, Ctor = x2.constructor;
|
|
56110
|
+
if (!x2.isFinite())
|
|
56111
|
+
return new Ctor(NaN);
|
|
56112
|
+
if (x2.isZero())
|
|
56113
|
+
return new Ctor(x2);
|
|
56114
|
+
pr = Ctor.precision;
|
|
56115
|
+
rm = Ctor.rounding;
|
|
56116
|
+
Ctor.precision = pr + Math.max(x2.e, x2.sd()) + LOG_BASE;
|
|
56117
|
+
Ctor.rounding = 1;
|
|
56118
|
+
x2 = sine(Ctor, toLessThanHalfPi(Ctor, x2));
|
|
56119
|
+
Ctor.precision = pr;
|
|
56120
|
+
Ctor.rounding = rm;
|
|
56121
|
+
return finalise(quadrant > 2 ? x2.neg() : x2, pr, rm, true);
|
|
56122
|
+
};
|
|
56123
|
+
P.squareRoot = P.sqrt = function() {
|
|
56124
|
+
var m2, n2, sd, r2, rep, t2, x2 = this, d2 = x2.d, e2 = x2.e, s2 = x2.s, Ctor = x2.constructor;
|
|
56125
|
+
if (s2 !== 1 || !d2 || !d2[0]) {
|
|
56126
|
+
return new Ctor(!s2 || s2 < 0 && (!d2 || d2[0]) ? NaN : d2 ? x2 : 1 / 0);
|
|
56127
|
+
}
|
|
56128
|
+
external = false;
|
|
56129
|
+
s2 = Math.sqrt(+x2);
|
|
56130
|
+
if (s2 == 0 || s2 == 1 / 0) {
|
|
56131
|
+
n2 = digitsToString(d2);
|
|
56132
|
+
if ((n2.length + e2) % 2 == 0)
|
|
56133
|
+
n2 += "0";
|
|
56134
|
+
s2 = Math.sqrt(n2);
|
|
56135
|
+
e2 = mathfloor((e2 + 1) / 2) - (e2 < 0 || e2 % 2);
|
|
56136
|
+
if (s2 == 1 / 0) {
|
|
56137
|
+
n2 = "5e" + e2;
|
|
56138
|
+
} else {
|
|
56139
|
+
n2 = s2.toExponential();
|
|
56140
|
+
n2 = n2.slice(0, n2.indexOf("e") + 1) + e2;
|
|
56141
|
+
}
|
|
56142
|
+
r2 = new Ctor(n2);
|
|
56143
|
+
} else {
|
|
56144
|
+
r2 = new Ctor(s2.toString());
|
|
56145
|
+
}
|
|
56146
|
+
sd = (e2 = Ctor.precision) + 3;
|
|
56147
|
+
for (; ; ) {
|
|
56148
|
+
t2 = r2;
|
|
56149
|
+
r2 = t2.plus(divide(x2, t2, sd + 2, 1)).times(0.5);
|
|
56150
|
+
if (digitsToString(t2.d).slice(0, sd) === (n2 = digitsToString(r2.d)).slice(0, sd)) {
|
|
56151
|
+
n2 = n2.slice(sd - 3, sd + 1);
|
|
56152
|
+
if (n2 == "9999" || !rep && n2 == "4999") {
|
|
56153
|
+
if (!rep) {
|
|
56154
|
+
finalise(t2, e2 + 1, 0);
|
|
56155
|
+
if (t2.times(t2).eq(x2)) {
|
|
56156
|
+
r2 = t2;
|
|
56157
|
+
break;
|
|
56158
|
+
}
|
|
56159
|
+
}
|
|
56160
|
+
sd += 4;
|
|
56161
|
+
rep = 1;
|
|
56162
|
+
} else {
|
|
56163
|
+
if (!+n2 || !+n2.slice(1) && n2.charAt(0) == "5") {
|
|
56164
|
+
finalise(r2, e2 + 1, 1);
|
|
56165
|
+
m2 = !r2.times(r2).eq(x2);
|
|
56166
|
+
}
|
|
56167
|
+
break;
|
|
56168
|
+
}
|
|
56169
|
+
}
|
|
56170
|
+
}
|
|
56171
|
+
external = true;
|
|
56172
|
+
return finalise(r2, e2, Ctor.rounding, m2);
|
|
56173
|
+
};
|
|
56174
|
+
P.tangent = P.tan = function() {
|
|
56175
|
+
var pr, rm, x2 = this, Ctor = x2.constructor;
|
|
56176
|
+
if (!x2.isFinite())
|
|
56177
|
+
return new Ctor(NaN);
|
|
56178
|
+
if (x2.isZero())
|
|
56179
|
+
return new Ctor(x2);
|
|
56180
|
+
pr = Ctor.precision;
|
|
56181
|
+
rm = Ctor.rounding;
|
|
56182
|
+
Ctor.precision = pr + 10;
|
|
56183
|
+
Ctor.rounding = 1;
|
|
56184
|
+
x2 = x2.sin();
|
|
56185
|
+
x2.s = 1;
|
|
56186
|
+
x2 = divide(x2, new Ctor(1).minus(x2.times(x2)).sqrt(), pr + 10, 0);
|
|
56187
|
+
Ctor.precision = pr;
|
|
56188
|
+
Ctor.rounding = rm;
|
|
56189
|
+
return finalise(quadrant == 2 || quadrant == 4 ? x2.neg() : x2, pr, rm, true);
|
|
56190
|
+
};
|
|
56191
|
+
P.times = P.mul = function(y2) {
|
|
56192
|
+
var carry, e2, i2, k2, r2, rL, t2, xdL, ydL, x2 = this, Ctor = x2.constructor, xd = x2.d, yd = (y2 = new Ctor(y2)).d;
|
|
56193
|
+
y2.s *= x2.s;
|
|
56194
|
+
if (!xd || !xd[0] || !yd || !yd[0]) {
|
|
56195
|
+
return new Ctor(!y2.s || xd && !xd[0] && !yd || yd && !yd[0] && !xd ? NaN : !xd || !yd ? y2.s / 0 : y2.s * 0);
|
|
56196
|
+
}
|
|
56197
|
+
e2 = mathfloor(x2.e / LOG_BASE) + mathfloor(y2.e / LOG_BASE);
|
|
56198
|
+
xdL = xd.length;
|
|
56199
|
+
ydL = yd.length;
|
|
56200
|
+
if (xdL < ydL) {
|
|
56201
|
+
r2 = xd;
|
|
56202
|
+
xd = yd;
|
|
56203
|
+
yd = r2;
|
|
56204
|
+
rL = xdL;
|
|
56205
|
+
xdL = ydL;
|
|
56206
|
+
ydL = rL;
|
|
56207
|
+
}
|
|
56208
|
+
r2 = [];
|
|
56209
|
+
rL = xdL + ydL;
|
|
56210
|
+
for (i2 = rL; i2--; )
|
|
56211
|
+
r2.push(0);
|
|
56212
|
+
for (i2 = ydL; --i2 >= 0; ) {
|
|
56213
|
+
carry = 0;
|
|
56214
|
+
for (k2 = xdL + i2; k2 > i2; ) {
|
|
56215
|
+
t2 = r2[k2] + yd[i2] * xd[k2 - i2 - 1] + carry;
|
|
56216
|
+
r2[k2--] = t2 % BASE | 0;
|
|
56217
|
+
carry = t2 / BASE | 0;
|
|
56218
|
+
}
|
|
56219
|
+
r2[k2] = (r2[k2] + carry) % BASE | 0;
|
|
56220
|
+
}
|
|
56221
|
+
for (; !r2[--rL]; )
|
|
56222
|
+
r2.pop();
|
|
56223
|
+
if (carry)
|
|
56224
|
+
++e2;
|
|
56225
|
+
else
|
|
56226
|
+
r2.shift();
|
|
56227
|
+
y2.d = r2;
|
|
56228
|
+
y2.e = getBase10Exponent(r2, e2);
|
|
56229
|
+
return external ? finalise(y2, Ctor.precision, Ctor.rounding) : y2;
|
|
56230
|
+
};
|
|
56231
|
+
P.toBinary = function(sd, rm) {
|
|
56232
|
+
return toStringBinary(this, 2, sd, rm);
|
|
56233
|
+
};
|
|
56234
|
+
P.toDecimalPlaces = P.toDP = function(dp, rm) {
|
|
56235
|
+
var x2 = this, Ctor = x2.constructor;
|
|
56236
|
+
x2 = new Ctor(x2);
|
|
56237
|
+
if (dp === void 0)
|
|
56238
|
+
return x2;
|
|
56239
|
+
checkInt32(dp, 0, MAX_DIGITS);
|
|
56240
|
+
if (rm === void 0)
|
|
56241
|
+
rm = Ctor.rounding;
|
|
56242
|
+
else
|
|
56243
|
+
checkInt32(rm, 0, 8);
|
|
56244
|
+
return finalise(x2, dp + x2.e + 1, rm);
|
|
56245
|
+
};
|
|
56246
|
+
P.toExponential = function(dp, rm) {
|
|
56247
|
+
var str, x2 = this, Ctor = x2.constructor;
|
|
56248
|
+
if (dp === void 0) {
|
|
56249
|
+
str = finiteToString(x2, true);
|
|
56250
|
+
} else {
|
|
56251
|
+
checkInt32(dp, 0, MAX_DIGITS);
|
|
56252
|
+
if (rm === void 0)
|
|
56253
|
+
rm = Ctor.rounding;
|
|
56254
|
+
else
|
|
56255
|
+
checkInt32(rm, 0, 8);
|
|
56256
|
+
x2 = finalise(new Ctor(x2), dp + 1, rm);
|
|
56257
|
+
str = finiteToString(x2, true, dp + 1);
|
|
56258
|
+
}
|
|
56259
|
+
return x2.isNeg() && !x2.isZero() ? "-" + str : str;
|
|
56260
|
+
};
|
|
56261
|
+
P.toFixed = function(dp, rm) {
|
|
56262
|
+
var str, y2, x2 = this, Ctor = x2.constructor;
|
|
56263
|
+
if (dp === void 0) {
|
|
56264
|
+
str = finiteToString(x2);
|
|
56265
|
+
} else {
|
|
56266
|
+
checkInt32(dp, 0, MAX_DIGITS);
|
|
56267
|
+
if (rm === void 0)
|
|
56268
|
+
rm = Ctor.rounding;
|
|
56269
|
+
else
|
|
56270
|
+
checkInt32(rm, 0, 8);
|
|
56271
|
+
y2 = finalise(new Ctor(x2), dp + x2.e + 1, rm);
|
|
56272
|
+
str = finiteToString(y2, false, dp + y2.e + 1);
|
|
56273
|
+
}
|
|
56274
|
+
return x2.isNeg() && !x2.isZero() ? "-" + str : str;
|
|
56275
|
+
};
|
|
56276
|
+
P.toFraction = function(maxD) {
|
|
56277
|
+
var d2, d0, d1, d22, e2, k2, n2, n0, n1, pr, q, r2, x2 = this, xd = x2.d, Ctor = x2.constructor;
|
|
56278
|
+
if (!xd)
|
|
56279
|
+
return new Ctor(x2);
|
|
56280
|
+
n1 = d0 = new Ctor(1);
|
|
56281
|
+
d1 = n0 = new Ctor(0);
|
|
56282
|
+
d2 = new Ctor(d1);
|
|
56283
|
+
e2 = d2.e = getPrecision(xd) - x2.e - 1;
|
|
56284
|
+
k2 = e2 % LOG_BASE;
|
|
56285
|
+
d2.d[0] = mathpow(10, k2 < 0 ? LOG_BASE + k2 : k2);
|
|
56286
|
+
if (maxD == null) {
|
|
56287
|
+
maxD = e2 > 0 ? d2 : n1;
|
|
56288
|
+
} else {
|
|
56289
|
+
n2 = new Ctor(maxD);
|
|
56290
|
+
if (!n2.isInt() || n2.lt(n1))
|
|
56291
|
+
throw Error(invalidArgument + n2);
|
|
56292
|
+
maxD = n2.gt(d2) ? e2 > 0 ? d2 : n1 : n2;
|
|
56293
|
+
}
|
|
56294
|
+
external = false;
|
|
56295
|
+
n2 = new Ctor(digitsToString(xd));
|
|
56296
|
+
pr = Ctor.precision;
|
|
56297
|
+
Ctor.precision = e2 = xd.length * LOG_BASE * 2;
|
|
56298
|
+
for (; ; ) {
|
|
56299
|
+
q = divide(n2, d2, 0, 1, 1);
|
|
56300
|
+
d22 = d0.plus(q.times(d1));
|
|
56301
|
+
if (d22.cmp(maxD) == 1)
|
|
56302
|
+
break;
|
|
56303
|
+
d0 = d1;
|
|
56304
|
+
d1 = d22;
|
|
56305
|
+
d22 = n1;
|
|
56306
|
+
n1 = n0.plus(q.times(d22));
|
|
56307
|
+
n0 = d22;
|
|
56308
|
+
d22 = d2;
|
|
56309
|
+
d2 = n2.minus(q.times(d22));
|
|
56310
|
+
n2 = d22;
|
|
56311
|
+
}
|
|
56312
|
+
d22 = divide(maxD.minus(d0), d1, 0, 1, 1);
|
|
56313
|
+
n0 = n0.plus(d22.times(n1));
|
|
56314
|
+
d0 = d0.plus(d22.times(d1));
|
|
56315
|
+
n0.s = n1.s = x2.s;
|
|
56316
|
+
r2 = divide(n1, d1, e2, 1).minus(x2).abs().cmp(divide(n0, d0, e2, 1).minus(x2).abs()) < 1 ? [n1, d1] : [n0, d0];
|
|
56317
|
+
Ctor.precision = pr;
|
|
56318
|
+
external = true;
|
|
56319
|
+
return r2;
|
|
56320
|
+
};
|
|
56321
|
+
P.toHexadecimal = P.toHex = function(sd, rm) {
|
|
56322
|
+
return toStringBinary(this, 16, sd, rm);
|
|
56323
|
+
};
|
|
56324
|
+
P.toNearest = function(y2, rm) {
|
|
56325
|
+
var x2 = this, Ctor = x2.constructor;
|
|
56326
|
+
x2 = new Ctor(x2);
|
|
56327
|
+
if (y2 == null) {
|
|
56328
|
+
if (!x2.d)
|
|
56329
|
+
return x2;
|
|
56330
|
+
y2 = new Ctor(1);
|
|
56331
|
+
rm = Ctor.rounding;
|
|
56332
|
+
} else {
|
|
56333
|
+
y2 = new Ctor(y2);
|
|
56334
|
+
if (rm === void 0) {
|
|
56335
|
+
rm = Ctor.rounding;
|
|
56336
|
+
} else {
|
|
56337
|
+
checkInt32(rm, 0, 8);
|
|
56338
|
+
}
|
|
56339
|
+
if (!x2.d)
|
|
56340
|
+
return y2.s ? x2 : y2;
|
|
56341
|
+
if (!y2.d) {
|
|
56342
|
+
if (y2.s)
|
|
56343
|
+
y2.s = x2.s;
|
|
56344
|
+
return y2;
|
|
56345
|
+
}
|
|
56346
|
+
}
|
|
56347
|
+
if (y2.d[0]) {
|
|
56348
|
+
external = false;
|
|
56349
|
+
x2 = divide(x2, y2, 0, rm, 1).times(y2);
|
|
56350
|
+
external = true;
|
|
56351
|
+
finalise(x2);
|
|
56352
|
+
} else {
|
|
56353
|
+
y2.s = x2.s;
|
|
56354
|
+
x2 = y2;
|
|
56355
|
+
}
|
|
56356
|
+
return x2;
|
|
56357
|
+
};
|
|
56358
|
+
P.toNumber = function() {
|
|
56359
|
+
return +this;
|
|
56360
|
+
};
|
|
56361
|
+
P.toOctal = function(sd, rm) {
|
|
56362
|
+
return toStringBinary(this, 8, sd, rm);
|
|
56363
|
+
};
|
|
56364
|
+
P.toPower = P.pow = function(y2) {
|
|
56365
|
+
var e2, k2, pr, r2, rm, s2, x2 = this, Ctor = x2.constructor, yn = +(y2 = new Ctor(y2));
|
|
56366
|
+
if (!x2.d || !y2.d || !x2.d[0] || !y2.d[0])
|
|
56367
|
+
return new Ctor(mathpow(+x2, yn));
|
|
56368
|
+
x2 = new Ctor(x2);
|
|
56369
|
+
if (x2.eq(1))
|
|
56370
|
+
return x2;
|
|
56371
|
+
pr = Ctor.precision;
|
|
56372
|
+
rm = Ctor.rounding;
|
|
56373
|
+
if (y2.eq(1))
|
|
56374
|
+
return finalise(x2, pr, rm);
|
|
56375
|
+
e2 = mathfloor(y2.e / LOG_BASE);
|
|
56376
|
+
if (e2 >= y2.d.length - 1 && (k2 = yn < 0 ? -yn : yn) <= MAX_SAFE_INTEGER) {
|
|
56377
|
+
r2 = intPow(Ctor, x2, k2, pr);
|
|
56378
|
+
return y2.s < 0 ? new Ctor(1).div(r2) : finalise(r2, pr, rm);
|
|
56379
|
+
}
|
|
56380
|
+
s2 = x2.s;
|
|
56381
|
+
if (s2 < 0) {
|
|
56382
|
+
if (e2 < y2.d.length - 1)
|
|
56383
|
+
return new Ctor(NaN);
|
|
56384
|
+
if ((y2.d[e2] & 1) == 0)
|
|
56385
|
+
s2 = 1;
|
|
56386
|
+
if (x2.e == 0 && x2.d[0] == 1 && x2.d.length == 1) {
|
|
56387
|
+
x2.s = s2;
|
|
56388
|
+
return x2;
|
|
56389
|
+
}
|
|
56390
|
+
}
|
|
56391
|
+
k2 = mathpow(+x2, yn);
|
|
56392
|
+
e2 = k2 == 0 || !isFinite(k2) ? mathfloor(yn * (Math.log("0." + digitsToString(x2.d)) / Math.LN10 + x2.e + 1)) : new Ctor(k2 + "").e;
|
|
56393
|
+
if (e2 > Ctor.maxE + 1 || e2 < Ctor.minE - 1)
|
|
56394
|
+
return new Ctor(e2 > 0 ? s2 / 0 : 0);
|
|
56395
|
+
external = false;
|
|
56396
|
+
Ctor.rounding = x2.s = 1;
|
|
56397
|
+
k2 = Math.min(12, (e2 + "").length);
|
|
56398
|
+
r2 = naturalExponential(y2.times(naturalLogarithm(x2, pr + k2)), pr);
|
|
56399
|
+
if (r2.d) {
|
|
56400
|
+
r2 = finalise(r2, pr + 5, 1);
|
|
56401
|
+
if (checkRoundingDigits(r2.d, pr, rm)) {
|
|
56402
|
+
e2 = pr + 10;
|
|
56403
|
+
r2 = finalise(naturalExponential(y2.times(naturalLogarithm(x2, e2 + k2)), e2), e2 + 5, 1);
|
|
56404
|
+
if (+digitsToString(r2.d).slice(pr + 1, pr + 15) + 1 == 1e14) {
|
|
56405
|
+
r2 = finalise(r2, pr + 1, 0);
|
|
56406
|
+
}
|
|
56407
|
+
}
|
|
56408
|
+
}
|
|
56409
|
+
r2.s = s2;
|
|
56410
|
+
external = true;
|
|
56411
|
+
Ctor.rounding = rm;
|
|
56412
|
+
return finalise(r2, pr, rm);
|
|
56413
|
+
};
|
|
56414
|
+
P.toPrecision = function(sd, rm) {
|
|
56415
|
+
var str, x2 = this, Ctor = x2.constructor;
|
|
56416
|
+
if (sd === void 0) {
|
|
56417
|
+
str = finiteToString(x2, x2.e <= Ctor.toExpNeg || x2.e >= Ctor.toExpPos);
|
|
56418
|
+
} else {
|
|
56419
|
+
checkInt32(sd, 1, MAX_DIGITS);
|
|
56420
|
+
if (rm === void 0)
|
|
56421
|
+
rm = Ctor.rounding;
|
|
56422
|
+
else
|
|
56423
|
+
checkInt32(rm, 0, 8);
|
|
56424
|
+
x2 = finalise(new Ctor(x2), sd, rm);
|
|
56425
|
+
str = finiteToString(x2, sd <= x2.e || x2.e <= Ctor.toExpNeg, sd);
|
|
56426
|
+
}
|
|
56427
|
+
return x2.isNeg() && !x2.isZero() ? "-" + str : str;
|
|
56428
|
+
};
|
|
56429
|
+
P.toSignificantDigits = P.toSD = function(sd, rm) {
|
|
56430
|
+
var x2 = this, Ctor = x2.constructor;
|
|
56431
|
+
if (sd === void 0) {
|
|
56432
|
+
sd = Ctor.precision;
|
|
56433
|
+
rm = Ctor.rounding;
|
|
56434
|
+
} else {
|
|
56435
|
+
checkInt32(sd, 1, MAX_DIGITS);
|
|
56436
|
+
if (rm === void 0)
|
|
56437
|
+
rm = Ctor.rounding;
|
|
56438
|
+
else
|
|
56439
|
+
checkInt32(rm, 0, 8);
|
|
56440
|
+
}
|
|
56441
|
+
return finalise(new Ctor(x2), sd, rm);
|
|
56442
|
+
};
|
|
56443
|
+
P.toString = function() {
|
|
56444
|
+
var x2 = this, Ctor = x2.constructor, str = finiteToString(x2, x2.e <= Ctor.toExpNeg || x2.e >= Ctor.toExpPos);
|
|
56445
|
+
return x2.isNeg() && !x2.isZero() ? "-" + str : str;
|
|
56446
|
+
};
|
|
56447
|
+
P.truncated = P.trunc = function() {
|
|
56448
|
+
return finalise(new this.constructor(this), this.e + 1, 1);
|
|
56449
|
+
};
|
|
56450
|
+
P.valueOf = P.toJSON = function() {
|
|
56451
|
+
var x2 = this, Ctor = x2.constructor, str = finiteToString(x2, x2.e <= Ctor.toExpNeg || x2.e >= Ctor.toExpPos);
|
|
56452
|
+
return x2.isNeg() ? "-" + str : str;
|
|
56453
|
+
};
|
|
56454
|
+
function digitsToString(d2) {
|
|
56455
|
+
var i2, k2, ws, indexOfLastWord = d2.length - 1, str = "", w2 = d2[0];
|
|
56456
|
+
if (indexOfLastWord > 0) {
|
|
56457
|
+
str += w2;
|
|
56458
|
+
for (i2 = 1; i2 < indexOfLastWord; i2++) {
|
|
56459
|
+
ws = d2[i2] + "";
|
|
56460
|
+
k2 = LOG_BASE - ws.length;
|
|
56461
|
+
if (k2)
|
|
56462
|
+
str += getZeroString(k2);
|
|
56463
|
+
str += ws;
|
|
56464
|
+
}
|
|
56465
|
+
w2 = d2[i2];
|
|
56466
|
+
ws = w2 + "";
|
|
56467
|
+
k2 = LOG_BASE - ws.length;
|
|
56468
|
+
if (k2)
|
|
56469
|
+
str += getZeroString(k2);
|
|
56470
|
+
} else if (w2 === 0) {
|
|
56471
|
+
return "0";
|
|
56472
|
+
}
|
|
56473
|
+
for (; w2 % 10 === 0; )
|
|
56474
|
+
w2 /= 10;
|
|
56475
|
+
return str + w2;
|
|
56476
|
+
}
|
|
56477
|
+
function checkInt32(i2, min2, max2) {
|
|
56478
|
+
if (i2 !== ~~i2 || i2 < min2 || i2 > max2) {
|
|
56479
|
+
throw Error(invalidArgument + i2);
|
|
56480
|
+
}
|
|
56481
|
+
}
|
|
56482
|
+
function checkRoundingDigits(d2, i2, rm, repeating) {
|
|
56483
|
+
var di, k2, r2, rd;
|
|
56484
|
+
for (k2 = d2[0]; k2 >= 10; k2 /= 10)
|
|
56485
|
+
--i2;
|
|
56486
|
+
if (--i2 < 0) {
|
|
56487
|
+
i2 += LOG_BASE;
|
|
56488
|
+
di = 0;
|
|
56489
|
+
} else {
|
|
56490
|
+
di = Math.ceil((i2 + 1) / LOG_BASE);
|
|
56491
|
+
i2 %= LOG_BASE;
|
|
56492
|
+
}
|
|
56493
|
+
k2 = mathpow(10, LOG_BASE - i2);
|
|
56494
|
+
rd = d2[di] % k2 | 0;
|
|
56495
|
+
if (repeating == null) {
|
|
56496
|
+
if (i2 < 3) {
|
|
56497
|
+
if (i2 == 0)
|
|
56498
|
+
rd = rd / 100 | 0;
|
|
56499
|
+
else if (i2 == 1)
|
|
56500
|
+
rd = rd / 10 | 0;
|
|
56501
|
+
r2 = rm < 4 && rd == 99999 || rm > 3 && rd == 49999 || rd == 5e4 || rd == 0;
|
|
56502
|
+
} else {
|
|
56503
|
+
r2 = (rm < 4 && rd + 1 == k2 || rm > 3 && rd + 1 == k2 / 2) && (d2[di + 1] / k2 / 100 | 0) == mathpow(10, i2 - 2) - 1 || (rd == k2 / 2 || rd == 0) && (d2[di + 1] / k2 / 100 | 0) == 0;
|
|
56504
|
+
}
|
|
56505
|
+
} else {
|
|
56506
|
+
if (i2 < 4) {
|
|
56507
|
+
if (i2 == 0)
|
|
56508
|
+
rd = rd / 1e3 | 0;
|
|
56509
|
+
else if (i2 == 1)
|
|
56510
|
+
rd = rd / 100 | 0;
|
|
56511
|
+
else if (i2 == 2)
|
|
56512
|
+
rd = rd / 10 | 0;
|
|
56513
|
+
r2 = (repeating || rm < 4) && rd == 9999 || !repeating && rm > 3 && rd == 4999;
|
|
56514
|
+
} else {
|
|
56515
|
+
r2 = ((repeating || rm < 4) && rd + 1 == k2 || !repeating && rm > 3 && rd + 1 == k2 / 2) && (d2[di + 1] / k2 / 1e3 | 0) == mathpow(10, i2 - 3) - 1;
|
|
56516
|
+
}
|
|
56517
|
+
}
|
|
56518
|
+
return r2;
|
|
56519
|
+
}
|
|
56520
|
+
function convertBase(str, baseIn, baseOut) {
|
|
56521
|
+
var j2, arr = [0], arrL, i2 = 0, strL = str.length;
|
|
56522
|
+
for (; i2 < strL; ) {
|
|
56523
|
+
for (arrL = arr.length; arrL--; )
|
|
56524
|
+
arr[arrL] *= baseIn;
|
|
56525
|
+
arr[0] += NUMERALS.indexOf(str.charAt(i2++));
|
|
56526
|
+
for (j2 = 0; j2 < arr.length; j2++) {
|
|
56527
|
+
if (arr[j2] > baseOut - 1) {
|
|
56528
|
+
if (arr[j2 + 1] === void 0)
|
|
56529
|
+
arr[j2 + 1] = 0;
|
|
56530
|
+
arr[j2 + 1] += arr[j2] / baseOut | 0;
|
|
56531
|
+
arr[j2] %= baseOut;
|
|
56532
|
+
}
|
|
56533
|
+
}
|
|
56534
|
+
}
|
|
56535
|
+
return arr.reverse();
|
|
56536
|
+
}
|
|
56537
|
+
function cosine(Ctor, x2) {
|
|
56538
|
+
var k2, len, y2;
|
|
56539
|
+
if (x2.isZero())
|
|
56540
|
+
return x2;
|
|
56541
|
+
len = x2.d.length;
|
|
56542
|
+
if (len < 32) {
|
|
56543
|
+
k2 = Math.ceil(len / 3);
|
|
56544
|
+
y2 = (1 / tinyPow(4, k2)).toString();
|
|
56545
|
+
} else {
|
|
56546
|
+
k2 = 16;
|
|
56547
|
+
y2 = "2.3283064365386962890625e-10";
|
|
56548
|
+
}
|
|
56549
|
+
Ctor.precision += k2;
|
|
56550
|
+
x2 = taylorSeries(Ctor, 1, x2.times(y2), new Ctor(1));
|
|
56551
|
+
for (var i2 = k2; i2--; ) {
|
|
56552
|
+
var cos2x = x2.times(x2);
|
|
56553
|
+
x2 = cos2x.times(cos2x).minus(cos2x).times(8).plus(1);
|
|
56554
|
+
}
|
|
56555
|
+
Ctor.precision -= k2;
|
|
56556
|
+
return x2;
|
|
56557
|
+
}
|
|
56558
|
+
var divide = function() {
|
|
56559
|
+
function multiplyInteger(x2, k2, base) {
|
|
56560
|
+
var temp, carry = 0, i2 = x2.length;
|
|
56561
|
+
for (x2 = x2.slice(); i2--; ) {
|
|
56562
|
+
temp = x2[i2] * k2 + carry;
|
|
56563
|
+
x2[i2] = temp % base | 0;
|
|
56564
|
+
carry = temp / base | 0;
|
|
56565
|
+
}
|
|
56566
|
+
if (carry)
|
|
56567
|
+
x2.unshift(carry);
|
|
56568
|
+
return x2;
|
|
56569
|
+
}
|
|
56570
|
+
function compare(a2, b2, aL, bL) {
|
|
56571
|
+
var i2, r2;
|
|
56572
|
+
if (aL != bL) {
|
|
56573
|
+
r2 = aL > bL ? 1 : -1;
|
|
56574
|
+
} else {
|
|
56575
|
+
for (i2 = r2 = 0; i2 < aL; i2++) {
|
|
56576
|
+
if (a2[i2] != b2[i2]) {
|
|
56577
|
+
r2 = a2[i2] > b2[i2] ? 1 : -1;
|
|
56578
|
+
break;
|
|
56579
|
+
}
|
|
56580
|
+
}
|
|
56581
|
+
}
|
|
56582
|
+
return r2;
|
|
56583
|
+
}
|
|
56584
|
+
function subtract(a2, b2, aL, base) {
|
|
56585
|
+
var i2 = 0;
|
|
56586
|
+
for (; aL--; ) {
|
|
56587
|
+
a2[aL] -= i2;
|
|
56588
|
+
i2 = a2[aL] < b2[aL] ? 1 : 0;
|
|
56589
|
+
a2[aL] = i2 * base + a2[aL] - b2[aL];
|
|
56590
|
+
}
|
|
56591
|
+
for (; !a2[0] && a2.length > 1; )
|
|
56592
|
+
a2.shift();
|
|
56593
|
+
}
|
|
56594
|
+
return function(x2, y2, pr, rm, dp, base) {
|
|
56595
|
+
var cmp, e2, i2, k2, logBase, more, prod, prodL, q, qd, rem, remL, rem0, sd, t2, xi, xL, yd0, yL, yz, Ctor = x2.constructor, sign2 = x2.s == y2.s ? 1 : -1, xd = x2.d, yd = y2.d;
|
|
56596
|
+
if (!xd || !xd[0] || !yd || !yd[0]) {
|
|
56597
|
+
return new Ctor(
|
|
56598
|
+
// Return NaN if either NaN, or both Infinity or 0.
|
|
56599
|
+
!x2.s || !y2.s || (xd ? yd && xd[0] == yd[0] : !yd) ? NaN : (
|
|
56600
|
+
// Return ±0 if x is 0 or y is ±Infinity, or return ±Infinity as y is 0.
|
|
56601
|
+
xd && xd[0] == 0 || !yd ? sign2 * 0 : sign2 / 0
|
|
56602
|
+
)
|
|
56603
|
+
);
|
|
56604
|
+
}
|
|
56605
|
+
if (base) {
|
|
56606
|
+
logBase = 1;
|
|
56607
|
+
e2 = x2.e - y2.e;
|
|
56608
|
+
} else {
|
|
56609
|
+
base = BASE;
|
|
56610
|
+
logBase = LOG_BASE;
|
|
56611
|
+
e2 = mathfloor(x2.e / logBase) - mathfloor(y2.e / logBase);
|
|
56612
|
+
}
|
|
56613
|
+
yL = yd.length;
|
|
56614
|
+
xL = xd.length;
|
|
56615
|
+
q = new Ctor(sign2);
|
|
56616
|
+
qd = q.d = [];
|
|
56617
|
+
for (i2 = 0; yd[i2] == (xd[i2] || 0); i2++)
|
|
56618
|
+
;
|
|
56619
|
+
if (yd[i2] > (xd[i2] || 0))
|
|
56620
|
+
e2--;
|
|
56621
|
+
if (pr == null) {
|
|
56622
|
+
sd = pr = Ctor.precision;
|
|
56623
|
+
rm = Ctor.rounding;
|
|
56624
|
+
} else if (dp) {
|
|
56625
|
+
sd = pr + (x2.e - y2.e) + 1;
|
|
56626
|
+
} else {
|
|
56627
|
+
sd = pr;
|
|
56628
|
+
}
|
|
56629
|
+
if (sd < 0) {
|
|
56630
|
+
qd.push(1);
|
|
56631
|
+
more = true;
|
|
56632
|
+
} else {
|
|
56633
|
+
sd = sd / logBase + 2 | 0;
|
|
56634
|
+
i2 = 0;
|
|
56635
|
+
if (yL == 1) {
|
|
56636
|
+
k2 = 0;
|
|
56637
|
+
yd = yd[0];
|
|
56638
|
+
sd++;
|
|
56639
|
+
for (; (i2 < xL || k2) && sd--; i2++) {
|
|
56640
|
+
t2 = k2 * base + (xd[i2] || 0);
|
|
56641
|
+
qd[i2] = t2 / yd | 0;
|
|
56642
|
+
k2 = t2 % yd | 0;
|
|
56643
|
+
}
|
|
56644
|
+
more = k2 || i2 < xL;
|
|
56645
|
+
} else {
|
|
56646
|
+
k2 = base / (yd[0] + 1) | 0;
|
|
56647
|
+
if (k2 > 1) {
|
|
56648
|
+
yd = multiplyInteger(yd, k2, base);
|
|
56649
|
+
xd = multiplyInteger(xd, k2, base);
|
|
56650
|
+
yL = yd.length;
|
|
56651
|
+
xL = xd.length;
|
|
56652
|
+
}
|
|
56653
|
+
xi = yL;
|
|
56654
|
+
rem = xd.slice(0, yL);
|
|
56655
|
+
remL = rem.length;
|
|
56656
|
+
for (; remL < yL; )
|
|
56657
|
+
rem[remL++] = 0;
|
|
56658
|
+
yz = yd.slice();
|
|
56659
|
+
yz.unshift(0);
|
|
56660
|
+
yd0 = yd[0];
|
|
56661
|
+
if (yd[1] >= base / 2)
|
|
56662
|
+
++yd0;
|
|
56663
|
+
do {
|
|
56664
|
+
k2 = 0;
|
|
56665
|
+
cmp = compare(yd, rem, yL, remL);
|
|
56666
|
+
if (cmp < 0) {
|
|
56667
|
+
rem0 = rem[0];
|
|
56668
|
+
if (yL != remL)
|
|
56669
|
+
rem0 = rem0 * base + (rem[1] || 0);
|
|
56670
|
+
k2 = rem0 / yd0 | 0;
|
|
56671
|
+
if (k2 > 1) {
|
|
56672
|
+
if (k2 >= base)
|
|
56673
|
+
k2 = base - 1;
|
|
56674
|
+
prod = multiplyInteger(yd, k2, base);
|
|
56675
|
+
prodL = prod.length;
|
|
56676
|
+
remL = rem.length;
|
|
56677
|
+
cmp = compare(prod, rem, prodL, remL);
|
|
56678
|
+
if (cmp == 1) {
|
|
56679
|
+
k2--;
|
|
56680
|
+
subtract(prod, yL < prodL ? yz : yd, prodL, base);
|
|
56681
|
+
}
|
|
56682
|
+
} else {
|
|
56683
|
+
if (k2 == 0)
|
|
56684
|
+
cmp = k2 = 1;
|
|
56685
|
+
prod = yd.slice();
|
|
56686
|
+
}
|
|
56687
|
+
prodL = prod.length;
|
|
56688
|
+
if (prodL < remL)
|
|
56689
|
+
prod.unshift(0);
|
|
56690
|
+
subtract(rem, prod, remL, base);
|
|
56691
|
+
if (cmp == -1) {
|
|
56692
|
+
remL = rem.length;
|
|
56693
|
+
cmp = compare(yd, rem, yL, remL);
|
|
56694
|
+
if (cmp < 1) {
|
|
56695
|
+
k2++;
|
|
56696
|
+
subtract(rem, yL < remL ? yz : yd, remL, base);
|
|
56697
|
+
}
|
|
56698
|
+
}
|
|
56699
|
+
remL = rem.length;
|
|
56700
|
+
} else if (cmp === 0) {
|
|
56701
|
+
k2++;
|
|
56702
|
+
rem = [0];
|
|
56703
|
+
}
|
|
56704
|
+
qd[i2++] = k2;
|
|
56705
|
+
if (cmp && rem[0]) {
|
|
56706
|
+
rem[remL++] = xd[xi] || 0;
|
|
56707
|
+
} else {
|
|
56708
|
+
rem = [xd[xi]];
|
|
56709
|
+
remL = 1;
|
|
56710
|
+
}
|
|
56711
|
+
} while ((xi++ < xL || rem[0] !== void 0) && sd--);
|
|
56712
|
+
more = rem[0] !== void 0;
|
|
56713
|
+
}
|
|
56714
|
+
if (!qd[0])
|
|
56715
|
+
qd.shift();
|
|
56716
|
+
}
|
|
56717
|
+
if (logBase == 1) {
|
|
56718
|
+
q.e = e2;
|
|
56719
|
+
inexact = more;
|
|
56720
|
+
} else {
|
|
56721
|
+
for (i2 = 1, k2 = qd[0]; k2 >= 10; k2 /= 10)
|
|
56722
|
+
i2++;
|
|
56723
|
+
q.e = i2 + e2 * logBase - 1;
|
|
56724
|
+
finalise(q, dp ? pr + q.e + 1 : pr, rm, more);
|
|
56725
|
+
}
|
|
56726
|
+
return q;
|
|
56727
|
+
};
|
|
56728
|
+
}();
|
|
56729
|
+
function finalise(x2, sd, rm, isTruncated) {
|
|
56730
|
+
var digits, i2, j2, k2, rd, roundUp, w2, xd, xdi, Ctor = x2.constructor;
|
|
56731
|
+
out:
|
|
56732
|
+
if (sd != null) {
|
|
56733
|
+
xd = x2.d;
|
|
56734
|
+
if (!xd)
|
|
56735
|
+
return x2;
|
|
56736
|
+
for (digits = 1, k2 = xd[0]; k2 >= 10; k2 /= 10)
|
|
56737
|
+
digits++;
|
|
56738
|
+
i2 = sd - digits;
|
|
56739
|
+
if (i2 < 0) {
|
|
56740
|
+
i2 += LOG_BASE;
|
|
56741
|
+
j2 = sd;
|
|
56742
|
+
w2 = xd[xdi = 0];
|
|
56743
|
+
rd = w2 / mathpow(10, digits - j2 - 1) % 10 | 0;
|
|
56744
|
+
} else {
|
|
56745
|
+
xdi = Math.ceil((i2 + 1) / LOG_BASE);
|
|
56746
|
+
k2 = xd.length;
|
|
56747
|
+
if (xdi >= k2) {
|
|
56748
|
+
if (isTruncated) {
|
|
56749
|
+
for (; k2++ <= xdi; )
|
|
56750
|
+
xd.push(0);
|
|
56751
|
+
w2 = rd = 0;
|
|
56752
|
+
digits = 1;
|
|
56753
|
+
i2 %= LOG_BASE;
|
|
56754
|
+
j2 = i2 - LOG_BASE + 1;
|
|
56755
|
+
} else {
|
|
56756
|
+
break out;
|
|
56757
|
+
}
|
|
56758
|
+
} else {
|
|
56759
|
+
w2 = k2 = xd[xdi];
|
|
56760
|
+
for (digits = 1; k2 >= 10; k2 /= 10)
|
|
56761
|
+
digits++;
|
|
56762
|
+
i2 %= LOG_BASE;
|
|
56763
|
+
j2 = i2 - LOG_BASE + digits;
|
|
56764
|
+
rd = j2 < 0 ? 0 : w2 / mathpow(10, digits - j2 - 1) % 10 | 0;
|
|
56765
|
+
}
|
|
56766
|
+
}
|
|
56767
|
+
isTruncated = isTruncated || sd < 0 || xd[xdi + 1] !== void 0 || (j2 < 0 ? w2 : w2 % mathpow(10, digits - j2 - 1));
|
|
56768
|
+
roundUp = rm < 4 ? (rd || isTruncated) && (rm == 0 || rm == (x2.s < 0 ? 3 : 2)) : rd > 5 || rd == 5 && (rm == 4 || isTruncated || rm == 6 && // Check whether the digit to the left of the rounding digit is odd.
|
|
56769
|
+
(i2 > 0 ? j2 > 0 ? w2 / mathpow(10, digits - j2) : 0 : xd[xdi - 1]) % 10 & 1 || rm == (x2.s < 0 ? 8 : 7));
|
|
56770
|
+
if (sd < 1 || !xd[0]) {
|
|
56771
|
+
xd.length = 0;
|
|
56772
|
+
if (roundUp) {
|
|
56773
|
+
sd -= x2.e + 1;
|
|
56774
|
+
xd[0] = mathpow(10, (LOG_BASE - sd % LOG_BASE) % LOG_BASE);
|
|
56775
|
+
x2.e = -sd || 0;
|
|
56776
|
+
} else {
|
|
56777
|
+
xd[0] = x2.e = 0;
|
|
56778
|
+
}
|
|
56779
|
+
return x2;
|
|
56780
|
+
}
|
|
56781
|
+
if (i2 == 0) {
|
|
56782
|
+
xd.length = xdi;
|
|
56783
|
+
k2 = 1;
|
|
56784
|
+
xdi--;
|
|
56785
|
+
} else {
|
|
56786
|
+
xd.length = xdi + 1;
|
|
56787
|
+
k2 = mathpow(10, LOG_BASE - i2);
|
|
56788
|
+
xd[xdi] = j2 > 0 ? (w2 / mathpow(10, digits - j2) % mathpow(10, j2) | 0) * k2 : 0;
|
|
56789
|
+
}
|
|
56790
|
+
if (roundUp) {
|
|
56791
|
+
for (; ; ) {
|
|
56792
|
+
if (xdi == 0) {
|
|
56793
|
+
for (i2 = 1, j2 = xd[0]; j2 >= 10; j2 /= 10)
|
|
56794
|
+
i2++;
|
|
56795
|
+
j2 = xd[0] += k2;
|
|
56796
|
+
for (k2 = 1; j2 >= 10; j2 /= 10)
|
|
56797
|
+
k2++;
|
|
56798
|
+
if (i2 != k2) {
|
|
56799
|
+
x2.e++;
|
|
56800
|
+
if (xd[0] == BASE)
|
|
56801
|
+
xd[0] = 1;
|
|
56802
|
+
}
|
|
56803
|
+
break;
|
|
56804
|
+
} else {
|
|
56805
|
+
xd[xdi] += k2;
|
|
56806
|
+
if (xd[xdi] != BASE)
|
|
56807
|
+
break;
|
|
56808
|
+
xd[xdi--] = 0;
|
|
56809
|
+
k2 = 1;
|
|
56810
|
+
}
|
|
56811
|
+
}
|
|
56812
|
+
}
|
|
56813
|
+
for (i2 = xd.length; xd[--i2] === 0; )
|
|
56814
|
+
xd.pop();
|
|
56815
|
+
}
|
|
56816
|
+
if (external) {
|
|
56817
|
+
if (x2.e > Ctor.maxE) {
|
|
56818
|
+
x2.d = null;
|
|
56819
|
+
x2.e = NaN;
|
|
56820
|
+
} else if (x2.e < Ctor.minE) {
|
|
56821
|
+
x2.e = 0;
|
|
56822
|
+
x2.d = [0];
|
|
56823
|
+
}
|
|
56824
|
+
}
|
|
56825
|
+
return x2;
|
|
56826
|
+
}
|
|
56827
|
+
function finiteToString(x2, isExp, sd) {
|
|
56828
|
+
if (!x2.isFinite())
|
|
56829
|
+
return nonFiniteToString(x2);
|
|
56830
|
+
var k2, e2 = x2.e, str = digitsToString(x2.d), len = str.length;
|
|
56831
|
+
if (isExp) {
|
|
56832
|
+
if (sd && (k2 = sd - len) > 0) {
|
|
56833
|
+
str = str.charAt(0) + "." + str.slice(1) + getZeroString(k2);
|
|
56834
|
+
} else if (len > 1) {
|
|
56835
|
+
str = str.charAt(0) + "." + str.slice(1);
|
|
56836
|
+
}
|
|
56837
|
+
str = str + (x2.e < 0 ? "e" : "e+") + x2.e;
|
|
56838
|
+
} else if (e2 < 0) {
|
|
56839
|
+
str = "0." + getZeroString(-e2 - 1) + str;
|
|
56840
|
+
if (sd && (k2 = sd - len) > 0)
|
|
56841
|
+
str += getZeroString(k2);
|
|
56842
|
+
} else if (e2 >= len) {
|
|
56843
|
+
str += getZeroString(e2 + 1 - len);
|
|
56844
|
+
if (sd && (k2 = sd - e2 - 1) > 0)
|
|
56845
|
+
str = str + "." + getZeroString(k2);
|
|
56846
|
+
} else {
|
|
56847
|
+
if ((k2 = e2 + 1) < len)
|
|
56848
|
+
str = str.slice(0, k2) + "." + str.slice(k2);
|
|
56849
|
+
if (sd && (k2 = sd - len) > 0) {
|
|
56850
|
+
if (e2 + 1 === len)
|
|
56851
|
+
str += ".";
|
|
56852
|
+
str += getZeroString(k2);
|
|
56853
|
+
}
|
|
56854
|
+
}
|
|
56855
|
+
return str;
|
|
56856
|
+
}
|
|
56857
|
+
function getBase10Exponent(digits, e2) {
|
|
56858
|
+
var w2 = digits[0];
|
|
56859
|
+
for (e2 *= LOG_BASE; w2 >= 10; w2 /= 10)
|
|
56860
|
+
e2++;
|
|
56861
|
+
return e2;
|
|
56862
|
+
}
|
|
56863
|
+
function getLn10(Ctor, sd, pr) {
|
|
56864
|
+
if (sd > LN10_PRECISION) {
|
|
56865
|
+
external = true;
|
|
56866
|
+
if (pr)
|
|
56867
|
+
Ctor.precision = pr;
|
|
56868
|
+
throw Error(precisionLimitExceeded);
|
|
56869
|
+
}
|
|
56870
|
+
return finalise(new Ctor(LN10), sd, 1, true);
|
|
56871
|
+
}
|
|
56872
|
+
function getPi(Ctor, sd, rm) {
|
|
56873
|
+
if (sd > PI_PRECISION)
|
|
56874
|
+
throw Error(precisionLimitExceeded);
|
|
56875
|
+
return finalise(new Ctor(PI), sd, rm, true);
|
|
56876
|
+
}
|
|
56877
|
+
function getPrecision(digits) {
|
|
56878
|
+
var w2 = digits.length - 1, len = w2 * LOG_BASE + 1;
|
|
56879
|
+
w2 = digits[w2];
|
|
56880
|
+
if (w2) {
|
|
56881
|
+
for (; w2 % 10 == 0; w2 /= 10)
|
|
56882
|
+
len--;
|
|
56883
|
+
for (w2 = digits[0]; w2 >= 10; w2 /= 10)
|
|
56884
|
+
len++;
|
|
56885
|
+
}
|
|
56886
|
+
return len;
|
|
56887
|
+
}
|
|
56888
|
+
function getZeroString(k2) {
|
|
56889
|
+
var zs = "";
|
|
56890
|
+
for (; k2--; )
|
|
56891
|
+
zs += "0";
|
|
56892
|
+
return zs;
|
|
56893
|
+
}
|
|
56894
|
+
function intPow(Ctor, x2, n2, pr) {
|
|
56895
|
+
var isTruncated, r2 = new Ctor(1), k2 = Math.ceil(pr / LOG_BASE + 4);
|
|
56896
|
+
external = false;
|
|
56897
|
+
for (; ; ) {
|
|
56898
|
+
if (n2 % 2) {
|
|
56899
|
+
r2 = r2.times(x2);
|
|
56900
|
+
if (truncate(r2.d, k2))
|
|
56901
|
+
isTruncated = true;
|
|
56902
|
+
}
|
|
56903
|
+
n2 = mathfloor(n2 / 2);
|
|
56904
|
+
if (n2 === 0) {
|
|
56905
|
+
n2 = r2.d.length - 1;
|
|
56906
|
+
if (isTruncated && r2.d[n2] === 0)
|
|
56907
|
+
++r2.d[n2];
|
|
56908
|
+
break;
|
|
56909
|
+
}
|
|
56910
|
+
x2 = x2.times(x2);
|
|
56911
|
+
truncate(x2.d, k2);
|
|
56912
|
+
}
|
|
56913
|
+
external = true;
|
|
56914
|
+
return r2;
|
|
56915
|
+
}
|
|
56916
|
+
function isOdd(n2) {
|
|
56917
|
+
return n2.d[n2.d.length - 1] & 1;
|
|
56918
|
+
}
|
|
56919
|
+
function maxOrMin(Ctor, args, ltgt) {
|
|
56920
|
+
var y2, x2 = new Ctor(args[0]), i2 = 0;
|
|
56921
|
+
for (; ++i2 < args.length; ) {
|
|
56922
|
+
y2 = new Ctor(args[i2]);
|
|
56923
|
+
if (!y2.s) {
|
|
56924
|
+
x2 = y2;
|
|
56925
|
+
break;
|
|
56926
|
+
} else if (x2[ltgt](y2)) {
|
|
56927
|
+
x2 = y2;
|
|
56928
|
+
}
|
|
56929
|
+
}
|
|
56930
|
+
return x2;
|
|
56931
|
+
}
|
|
56932
|
+
function naturalExponential(x2, sd) {
|
|
56933
|
+
var denominator, guard, j2, pow2, sum2, t2, wpr, rep = 0, i2 = 0, k2 = 0, Ctor = x2.constructor, rm = Ctor.rounding, pr = Ctor.precision;
|
|
56934
|
+
if (!x2.d || !x2.d[0] || x2.e > 17) {
|
|
56935
|
+
return new Ctor(x2.d ? !x2.d[0] ? 1 : x2.s < 0 ? 0 : 1 / 0 : x2.s ? x2.s < 0 ? 0 : x2 : 0 / 0);
|
|
56936
|
+
}
|
|
56937
|
+
if (sd == null) {
|
|
56938
|
+
external = false;
|
|
56939
|
+
wpr = pr;
|
|
56940
|
+
} else {
|
|
56941
|
+
wpr = sd;
|
|
56942
|
+
}
|
|
56943
|
+
t2 = new Ctor(0.03125);
|
|
56944
|
+
while (x2.e > -2) {
|
|
56945
|
+
x2 = x2.times(t2);
|
|
56946
|
+
k2 += 5;
|
|
56947
|
+
}
|
|
56948
|
+
guard = Math.log(mathpow(2, k2)) / Math.LN10 * 2 + 5 | 0;
|
|
56949
|
+
wpr += guard;
|
|
56950
|
+
denominator = pow2 = sum2 = new Ctor(1);
|
|
56951
|
+
Ctor.precision = wpr;
|
|
56952
|
+
for (; ; ) {
|
|
56953
|
+
pow2 = finalise(pow2.times(x2), wpr, 1);
|
|
56954
|
+
denominator = denominator.times(++i2);
|
|
56955
|
+
t2 = sum2.plus(divide(pow2, denominator, wpr, 1));
|
|
56956
|
+
if (digitsToString(t2.d).slice(0, wpr) === digitsToString(sum2.d).slice(0, wpr)) {
|
|
56957
|
+
j2 = k2;
|
|
56958
|
+
while (j2--)
|
|
56959
|
+
sum2 = finalise(sum2.times(sum2), wpr, 1);
|
|
56960
|
+
if (sd == null) {
|
|
56961
|
+
if (rep < 3 && checkRoundingDigits(sum2.d, wpr - guard, rm, rep)) {
|
|
56962
|
+
Ctor.precision = wpr += 10;
|
|
56963
|
+
denominator = pow2 = t2 = new Ctor(1);
|
|
56964
|
+
i2 = 0;
|
|
56965
|
+
rep++;
|
|
56966
|
+
} else {
|
|
56967
|
+
return finalise(sum2, Ctor.precision = pr, rm, external = true);
|
|
56968
|
+
}
|
|
56969
|
+
} else {
|
|
56970
|
+
Ctor.precision = pr;
|
|
56971
|
+
return sum2;
|
|
56972
|
+
}
|
|
56973
|
+
}
|
|
56974
|
+
sum2 = t2;
|
|
56975
|
+
}
|
|
56976
|
+
}
|
|
56977
|
+
function naturalLogarithm(y2, sd) {
|
|
56978
|
+
var c2, c0, denominator, e2, numerator, rep, sum2, t2, wpr, x1, x2, n2 = 1, guard = 10, x3 = y2, xd = x3.d, Ctor = x3.constructor, rm = Ctor.rounding, pr = Ctor.precision;
|
|
56979
|
+
if (x3.s < 0 || !xd || !xd[0] || !x3.e && xd[0] == 1 && xd.length == 1) {
|
|
56980
|
+
return new Ctor(xd && !xd[0] ? -1 / 0 : x3.s != 1 ? NaN : xd ? 0 : x3);
|
|
56981
|
+
}
|
|
56982
|
+
if (sd == null) {
|
|
56983
|
+
external = false;
|
|
56984
|
+
wpr = pr;
|
|
56985
|
+
} else {
|
|
56986
|
+
wpr = sd;
|
|
56987
|
+
}
|
|
56988
|
+
Ctor.precision = wpr += guard;
|
|
56989
|
+
c2 = digitsToString(xd);
|
|
56990
|
+
c0 = c2.charAt(0);
|
|
56991
|
+
if (Math.abs(e2 = x3.e) < 15e14) {
|
|
56992
|
+
while (c0 < 7 && c0 != 1 || c0 == 1 && c2.charAt(1) > 3) {
|
|
56993
|
+
x3 = x3.times(y2);
|
|
56994
|
+
c2 = digitsToString(x3.d);
|
|
56995
|
+
c0 = c2.charAt(0);
|
|
56996
|
+
n2++;
|
|
56997
|
+
}
|
|
56998
|
+
e2 = x3.e;
|
|
56999
|
+
if (c0 > 1) {
|
|
57000
|
+
x3 = new Ctor("0." + c2);
|
|
57001
|
+
e2++;
|
|
57002
|
+
} else {
|
|
57003
|
+
x3 = new Ctor(c0 + "." + c2.slice(1));
|
|
57004
|
+
}
|
|
57005
|
+
} else {
|
|
57006
|
+
t2 = getLn10(Ctor, wpr + 2, pr).times(e2 + "");
|
|
57007
|
+
x3 = naturalLogarithm(new Ctor(c0 + "." + c2.slice(1)), wpr - guard).plus(t2);
|
|
57008
|
+
Ctor.precision = pr;
|
|
57009
|
+
return sd == null ? finalise(x3, pr, rm, external = true) : x3;
|
|
57010
|
+
}
|
|
57011
|
+
x1 = x3;
|
|
57012
|
+
sum2 = numerator = x3 = divide(x3.minus(1), x3.plus(1), wpr, 1);
|
|
57013
|
+
x2 = finalise(x3.times(x3), wpr, 1);
|
|
57014
|
+
denominator = 3;
|
|
57015
|
+
for (; ; ) {
|
|
57016
|
+
numerator = finalise(numerator.times(x2), wpr, 1);
|
|
57017
|
+
t2 = sum2.plus(divide(numerator, new Ctor(denominator), wpr, 1));
|
|
57018
|
+
if (digitsToString(t2.d).slice(0, wpr) === digitsToString(sum2.d).slice(0, wpr)) {
|
|
57019
|
+
sum2 = sum2.times(2);
|
|
57020
|
+
if (e2 !== 0)
|
|
57021
|
+
sum2 = sum2.plus(getLn10(Ctor, wpr + 2, pr).times(e2 + ""));
|
|
57022
|
+
sum2 = divide(sum2, new Ctor(n2), wpr, 1);
|
|
57023
|
+
if (sd == null) {
|
|
57024
|
+
if (checkRoundingDigits(sum2.d, wpr - guard, rm, rep)) {
|
|
57025
|
+
Ctor.precision = wpr += guard;
|
|
57026
|
+
t2 = numerator = x3 = divide(x1.minus(1), x1.plus(1), wpr, 1);
|
|
57027
|
+
x2 = finalise(x3.times(x3), wpr, 1);
|
|
57028
|
+
denominator = rep = 1;
|
|
57029
|
+
} else {
|
|
57030
|
+
return finalise(sum2, Ctor.precision = pr, rm, external = true);
|
|
57031
|
+
}
|
|
57032
|
+
} else {
|
|
57033
|
+
Ctor.precision = pr;
|
|
57034
|
+
return sum2;
|
|
57035
|
+
}
|
|
57036
|
+
}
|
|
57037
|
+
sum2 = t2;
|
|
57038
|
+
denominator += 2;
|
|
57039
|
+
}
|
|
57040
|
+
}
|
|
57041
|
+
function nonFiniteToString(x2) {
|
|
57042
|
+
return String(x2.s * x2.s / 0);
|
|
57043
|
+
}
|
|
57044
|
+
function parseDecimal(x2, str) {
|
|
57045
|
+
var e2, i2, len;
|
|
57046
|
+
if ((e2 = str.indexOf(".")) > -1)
|
|
57047
|
+
str = str.replace(".", "");
|
|
57048
|
+
if ((i2 = str.search(/e/i)) > 0) {
|
|
57049
|
+
if (e2 < 0)
|
|
57050
|
+
e2 = i2;
|
|
57051
|
+
e2 += +str.slice(i2 + 1);
|
|
57052
|
+
str = str.substring(0, i2);
|
|
57053
|
+
} else if (e2 < 0) {
|
|
57054
|
+
e2 = str.length;
|
|
57055
|
+
}
|
|
57056
|
+
for (i2 = 0; str.charCodeAt(i2) === 48; i2++)
|
|
57057
|
+
;
|
|
57058
|
+
for (len = str.length; str.charCodeAt(len - 1) === 48; --len)
|
|
57059
|
+
;
|
|
57060
|
+
str = str.slice(i2, len);
|
|
57061
|
+
if (str) {
|
|
57062
|
+
len -= i2;
|
|
57063
|
+
x2.e = e2 = e2 - i2 - 1;
|
|
57064
|
+
x2.d = [];
|
|
57065
|
+
i2 = (e2 + 1) % LOG_BASE;
|
|
57066
|
+
if (e2 < 0)
|
|
57067
|
+
i2 += LOG_BASE;
|
|
57068
|
+
if (i2 < len) {
|
|
57069
|
+
if (i2)
|
|
57070
|
+
x2.d.push(+str.slice(0, i2));
|
|
57071
|
+
for (len -= LOG_BASE; i2 < len; )
|
|
57072
|
+
x2.d.push(+str.slice(i2, i2 += LOG_BASE));
|
|
57073
|
+
str = str.slice(i2);
|
|
57074
|
+
i2 = LOG_BASE - str.length;
|
|
57075
|
+
} else {
|
|
57076
|
+
i2 -= len;
|
|
57077
|
+
}
|
|
57078
|
+
for (; i2--; )
|
|
57079
|
+
str += "0";
|
|
57080
|
+
x2.d.push(+str);
|
|
57081
|
+
if (external) {
|
|
57082
|
+
if (x2.e > x2.constructor.maxE) {
|
|
57083
|
+
x2.d = null;
|
|
57084
|
+
x2.e = NaN;
|
|
57085
|
+
} else if (x2.e < x2.constructor.minE) {
|
|
57086
|
+
x2.e = 0;
|
|
57087
|
+
x2.d = [0];
|
|
57088
|
+
}
|
|
57089
|
+
}
|
|
57090
|
+
} else {
|
|
57091
|
+
x2.e = 0;
|
|
57092
|
+
x2.d = [0];
|
|
57093
|
+
}
|
|
57094
|
+
return x2;
|
|
57095
|
+
}
|
|
57096
|
+
function parseOther(x2, str) {
|
|
57097
|
+
var base, Ctor, divisor, i2, isFloat, len, p2, xd, xe;
|
|
57098
|
+
if (str.indexOf("_") > -1) {
|
|
57099
|
+
str = str.replace(/(\d)_(?=\d)/g, "$1");
|
|
57100
|
+
if (isDecimal.test(str))
|
|
57101
|
+
return parseDecimal(x2, str);
|
|
57102
|
+
} else if (str === "Infinity" || str === "NaN") {
|
|
57103
|
+
if (!+str)
|
|
57104
|
+
x2.s = NaN;
|
|
57105
|
+
x2.e = NaN;
|
|
57106
|
+
x2.d = null;
|
|
57107
|
+
return x2;
|
|
57108
|
+
}
|
|
57109
|
+
if (isHex.test(str)) {
|
|
57110
|
+
base = 16;
|
|
57111
|
+
str = str.toLowerCase();
|
|
57112
|
+
} else if (isBinary.test(str)) {
|
|
57113
|
+
base = 2;
|
|
57114
|
+
} else if (isOctal.test(str)) {
|
|
57115
|
+
base = 8;
|
|
57116
|
+
} else {
|
|
57117
|
+
throw Error(invalidArgument + str);
|
|
57118
|
+
}
|
|
57119
|
+
i2 = str.search(/p/i);
|
|
57120
|
+
if (i2 > 0) {
|
|
57121
|
+
p2 = +str.slice(i2 + 1);
|
|
57122
|
+
str = str.substring(2, i2);
|
|
57123
|
+
} else {
|
|
57124
|
+
str = str.slice(2);
|
|
57125
|
+
}
|
|
57126
|
+
i2 = str.indexOf(".");
|
|
57127
|
+
isFloat = i2 >= 0;
|
|
57128
|
+
Ctor = x2.constructor;
|
|
57129
|
+
if (isFloat) {
|
|
57130
|
+
str = str.replace(".", "");
|
|
57131
|
+
len = str.length;
|
|
57132
|
+
i2 = len - i2;
|
|
57133
|
+
divisor = intPow(Ctor, new Ctor(base), i2, i2 * 2);
|
|
57134
|
+
}
|
|
57135
|
+
xd = convertBase(str, base, BASE);
|
|
57136
|
+
xe = xd.length - 1;
|
|
57137
|
+
for (i2 = xe; xd[i2] === 0; --i2)
|
|
57138
|
+
xd.pop();
|
|
57139
|
+
if (i2 < 0)
|
|
57140
|
+
return new Ctor(x2.s * 0);
|
|
57141
|
+
x2.e = getBase10Exponent(xd, xe);
|
|
57142
|
+
x2.d = xd;
|
|
57143
|
+
external = false;
|
|
57144
|
+
if (isFloat)
|
|
57145
|
+
x2 = divide(x2, divisor, len * 4);
|
|
57146
|
+
if (p2)
|
|
57147
|
+
x2 = x2.times(Math.abs(p2) < 54 ? mathpow(2, p2) : Decimal.pow(2, p2));
|
|
57148
|
+
external = true;
|
|
57149
|
+
return x2;
|
|
57150
|
+
}
|
|
57151
|
+
function sine(Ctor, x2) {
|
|
57152
|
+
var k2, len = x2.d.length;
|
|
57153
|
+
if (len < 3) {
|
|
57154
|
+
return x2.isZero() ? x2 : taylorSeries(Ctor, 2, x2, x2);
|
|
57155
|
+
}
|
|
57156
|
+
k2 = 1.4 * Math.sqrt(len);
|
|
57157
|
+
k2 = k2 > 16 ? 16 : k2 | 0;
|
|
57158
|
+
x2 = x2.times(1 / tinyPow(5, k2));
|
|
57159
|
+
x2 = taylorSeries(Ctor, 2, x2, x2);
|
|
57160
|
+
var sin2_x, d5 = new Ctor(5), d16 = new Ctor(16), d20 = new Ctor(20);
|
|
57161
|
+
for (; k2--; ) {
|
|
57162
|
+
sin2_x = x2.times(x2);
|
|
57163
|
+
x2 = x2.times(d5.plus(sin2_x.times(d16.times(sin2_x).minus(d20))));
|
|
57164
|
+
}
|
|
57165
|
+
return x2;
|
|
57166
|
+
}
|
|
57167
|
+
function taylorSeries(Ctor, n2, x2, y2, isHyperbolic) {
|
|
57168
|
+
var j2, t2, u2, x22, pr = Ctor.precision, k2 = Math.ceil(pr / LOG_BASE);
|
|
57169
|
+
external = false;
|
|
57170
|
+
x22 = x2.times(x2);
|
|
57171
|
+
u2 = new Ctor(y2);
|
|
57172
|
+
for (; ; ) {
|
|
57173
|
+
t2 = divide(u2.times(x22), new Ctor(n2++ * n2++), pr, 1);
|
|
57174
|
+
u2 = isHyperbolic ? y2.plus(t2) : y2.minus(t2);
|
|
57175
|
+
y2 = divide(t2.times(x22), new Ctor(n2++ * n2++), pr, 1);
|
|
57176
|
+
t2 = u2.plus(y2);
|
|
57177
|
+
if (t2.d[k2] !== void 0) {
|
|
57178
|
+
for (j2 = k2; t2.d[j2] === u2.d[j2] && j2--; )
|
|
57179
|
+
;
|
|
57180
|
+
if (j2 == -1)
|
|
57181
|
+
break;
|
|
57182
|
+
}
|
|
57183
|
+
j2 = u2;
|
|
57184
|
+
u2 = y2;
|
|
57185
|
+
y2 = t2;
|
|
57186
|
+
t2 = j2;
|
|
57187
|
+
}
|
|
57188
|
+
external = true;
|
|
57189
|
+
t2.d.length = k2 + 1;
|
|
57190
|
+
return t2;
|
|
57191
|
+
}
|
|
57192
|
+
function tinyPow(b2, e2) {
|
|
57193
|
+
var n2 = b2;
|
|
57194
|
+
while (--e2)
|
|
57195
|
+
n2 *= b2;
|
|
57196
|
+
return n2;
|
|
57197
|
+
}
|
|
57198
|
+
function toLessThanHalfPi(Ctor, x2) {
|
|
57199
|
+
var t2, isNeg = x2.s < 0, pi = getPi(Ctor, Ctor.precision, 1), halfPi = pi.times(0.5);
|
|
57200
|
+
x2 = x2.abs();
|
|
57201
|
+
if (x2.lte(halfPi)) {
|
|
57202
|
+
quadrant = isNeg ? 4 : 1;
|
|
57203
|
+
return x2;
|
|
57204
|
+
}
|
|
57205
|
+
t2 = x2.divToInt(pi);
|
|
57206
|
+
if (t2.isZero()) {
|
|
57207
|
+
quadrant = isNeg ? 3 : 2;
|
|
57208
|
+
} else {
|
|
57209
|
+
x2 = x2.minus(t2.times(pi));
|
|
57210
|
+
if (x2.lte(halfPi)) {
|
|
57211
|
+
quadrant = isOdd(t2) ? isNeg ? 2 : 3 : isNeg ? 4 : 1;
|
|
57212
|
+
return x2;
|
|
57213
|
+
}
|
|
57214
|
+
quadrant = isOdd(t2) ? isNeg ? 1 : 4 : isNeg ? 3 : 2;
|
|
57215
|
+
}
|
|
57216
|
+
return x2.minus(pi).abs();
|
|
57217
|
+
}
|
|
57218
|
+
function toStringBinary(x2, baseOut, sd, rm) {
|
|
57219
|
+
var base, e2, i2, k2, len, roundUp, str, xd, y2, Ctor = x2.constructor, isExp = sd !== void 0;
|
|
57220
|
+
if (isExp) {
|
|
57221
|
+
checkInt32(sd, 1, MAX_DIGITS);
|
|
57222
|
+
if (rm === void 0)
|
|
57223
|
+
rm = Ctor.rounding;
|
|
57224
|
+
else
|
|
57225
|
+
checkInt32(rm, 0, 8);
|
|
57226
|
+
} else {
|
|
57227
|
+
sd = Ctor.precision;
|
|
57228
|
+
rm = Ctor.rounding;
|
|
57229
|
+
}
|
|
57230
|
+
if (!x2.isFinite()) {
|
|
57231
|
+
str = nonFiniteToString(x2);
|
|
57232
|
+
} else {
|
|
57233
|
+
str = finiteToString(x2);
|
|
57234
|
+
i2 = str.indexOf(".");
|
|
57235
|
+
if (isExp) {
|
|
57236
|
+
base = 2;
|
|
57237
|
+
if (baseOut == 16) {
|
|
57238
|
+
sd = sd * 4 - 3;
|
|
57239
|
+
} else if (baseOut == 8) {
|
|
57240
|
+
sd = sd * 3 - 2;
|
|
57241
|
+
}
|
|
57242
|
+
} else {
|
|
57243
|
+
base = baseOut;
|
|
57244
|
+
}
|
|
57245
|
+
if (i2 >= 0) {
|
|
57246
|
+
str = str.replace(".", "");
|
|
57247
|
+
y2 = new Ctor(1);
|
|
57248
|
+
y2.e = str.length - i2;
|
|
57249
|
+
y2.d = convertBase(finiteToString(y2), 10, base);
|
|
57250
|
+
y2.e = y2.d.length;
|
|
57251
|
+
}
|
|
57252
|
+
xd = convertBase(str, 10, base);
|
|
57253
|
+
e2 = len = xd.length;
|
|
57254
|
+
for (; xd[--len] == 0; )
|
|
57255
|
+
xd.pop();
|
|
57256
|
+
if (!xd[0]) {
|
|
57257
|
+
str = isExp ? "0p+0" : "0";
|
|
57258
|
+
} else {
|
|
57259
|
+
if (i2 < 0) {
|
|
57260
|
+
e2--;
|
|
57261
|
+
} else {
|
|
57262
|
+
x2 = new Ctor(x2);
|
|
57263
|
+
x2.d = xd;
|
|
57264
|
+
x2.e = e2;
|
|
57265
|
+
x2 = divide(x2, y2, sd, rm, 0, base);
|
|
57266
|
+
xd = x2.d;
|
|
57267
|
+
e2 = x2.e;
|
|
57268
|
+
roundUp = inexact;
|
|
57269
|
+
}
|
|
57270
|
+
i2 = xd[sd];
|
|
57271
|
+
k2 = base / 2;
|
|
57272
|
+
roundUp = roundUp || xd[sd + 1] !== void 0;
|
|
57273
|
+
roundUp = rm < 4 ? (i2 !== void 0 || roundUp) && (rm === 0 || rm === (x2.s < 0 ? 3 : 2)) : i2 > k2 || i2 === k2 && (rm === 4 || roundUp || rm === 6 && xd[sd - 1] & 1 || rm === (x2.s < 0 ? 8 : 7));
|
|
57274
|
+
xd.length = sd;
|
|
57275
|
+
if (roundUp) {
|
|
57276
|
+
for (; ++xd[--sd] > base - 1; ) {
|
|
57277
|
+
xd[sd] = 0;
|
|
57278
|
+
if (!sd) {
|
|
57279
|
+
++e2;
|
|
57280
|
+
xd.unshift(1);
|
|
57281
|
+
}
|
|
57282
|
+
}
|
|
57283
|
+
}
|
|
57284
|
+
for (len = xd.length; !xd[len - 1]; --len)
|
|
57285
|
+
;
|
|
57286
|
+
for (i2 = 0, str = ""; i2 < len; i2++)
|
|
57287
|
+
str += NUMERALS.charAt(xd[i2]);
|
|
57288
|
+
if (isExp) {
|
|
57289
|
+
if (len > 1) {
|
|
57290
|
+
if (baseOut == 16 || baseOut == 8) {
|
|
57291
|
+
i2 = baseOut == 16 ? 4 : 3;
|
|
57292
|
+
for (--len; len % i2; len++)
|
|
57293
|
+
str += "0";
|
|
57294
|
+
xd = convertBase(str, base, baseOut);
|
|
57295
|
+
for (len = xd.length; !xd[len - 1]; --len)
|
|
57296
|
+
;
|
|
57297
|
+
for (i2 = 1, str = "1."; i2 < len; i2++)
|
|
57298
|
+
str += NUMERALS.charAt(xd[i2]);
|
|
57299
|
+
} else {
|
|
57300
|
+
str = str.charAt(0) + "." + str.slice(1);
|
|
57301
|
+
}
|
|
57302
|
+
}
|
|
57303
|
+
str = str + (e2 < 0 ? "p" : "p+") + e2;
|
|
57304
|
+
} else if (e2 < 0) {
|
|
57305
|
+
for (; ++e2; )
|
|
57306
|
+
str = "0" + str;
|
|
57307
|
+
str = "0." + str;
|
|
57308
|
+
} else {
|
|
57309
|
+
if (++e2 > len)
|
|
57310
|
+
for (e2 -= len; e2--; )
|
|
57311
|
+
str += "0";
|
|
57312
|
+
else if (e2 < len)
|
|
57313
|
+
str = str.slice(0, e2) + "." + str.slice(e2);
|
|
57314
|
+
}
|
|
57315
|
+
}
|
|
57316
|
+
str = (baseOut == 16 ? "0x" : baseOut == 2 ? "0b" : baseOut == 8 ? "0o" : "") + str;
|
|
57317
|
+
}
|
|
57318
|
+
return x2.s < 0 ? "-" + str : str;
|
|
57319
|
+
}
|
|
57320
|
+
function truncate(arr, len) {
|
|
57321
|
+
if (arr.length > len) {
|
|
57322
|
+
arr.length = len;
|
|
57323
|
+
return true;
|
|
57324
|
+
}
|
|
57325
|
+
}
|
|
57326
|
+
function abs(x2) {
|
|
57327
|
+
return new this(x2).abs();
|
|
57328
|
+
}
|
|
57329
|
+
function acos(x2) {
|
|
57330
|
+
return new this(x2).acos();
|
|
57331
|
+
}
|
|
57332
|
+
function acosh(x2) {
|
|
57333
|
+
return new this(x2).acosh();
|
|
57334
|
+
}
|
|
57335
|
+
function add(x2, y2) {
|
|
57336
|
+
return new this(x2).plus(y2);
|
|
57337
|
+
}
|
|
57338
|
+
function asin(x2) {
|
|
57339
|
+
return new this(x2).asin();
|
|
57340
|
+
}
|
|
57341
|
+
function asinh(x2) {
|
|
57342
|
+
return new this(x2).asinh();
|
|
57343
|
+
}
|
|
57344
|
+
function atan(x2) {
|
|
57345
|
+
return new this(x2).atan();
|
|
57346
|
+
}
|
|
57347
|
+
function atanh(x2) {
|
|
57348
|
+
return new this(x2).atanh();
|
|
57349
|
+
}
|
|
57350
|
+
function atan2(y2, x2) {
|
|
57351
|
+
y2 = new this(y2);
|
|
57352
|
+
x2 = new this(x2);
|
|
57353
|
+
var r2, pr = this.precision, rm = this.rounding, wpr = pr + 4;
|
|
57354
|
+
if (!y2.s || !x2.s) {
|
|
57355
|
+
r2 = new this(NaN);
|
|
57356
|
+
} else if (!y2.d && !x2.d) {
|
|
57357
|
+
r2 = getPi(this, wpr, 1).times(x2.s > 0 ? 0.25 : 0.75);
|
|
57358
|
+
r2.s = y2.s;
|
|
57359
|
+
} else if (!x2.d || y2.isZero()) {
|
|
57360
|
+
r2 = x2.s < 0 ? getPi(this, pr, rm) : new this(0);
|
|
57361
|
+
r2.s = y2.s;
|
|
57362
|
+
} else if (!y2.d || x2.isZero()) {
|
|
57363
|
+
r2 = getPi(this, wpr, 1).times(0.5);
|
|
57364
|
+
r2.s = y2.s;
|
|
57365
|
+
} else if (x2.s < 0) {
|
|
57366
|
+
this.precision = wpr;
|
|
57367
|
+
this.rounding = 1;
|
|
57368
|
+
r2 = this.atan(divide(y2, x2, wpr, 1));
|
|
57369
|
+
x2 = getPi(this, wpr, 1);
|
|
57370
|
+
this.precision = pr;
|
|
57371
|
+
this.rounding = rm;
|
|
57372
|
+
r2 = y2.s < 0 ? r2.minus(x2) : r2.plus(x2);
|
|
57373
|
+
} else {
|
|
57374
|
+
r2 = this.atan(divide(y2, x2, wpr, 1));
|
|
57375
|
+
}
|
|
57376
|
+
return r2;
|
|
57377
|
+
}
|
|
57378
|
+
function cbrt(x2) {
|
|
57379
|
+
return new this(x2).cbrt();
|
|
57380
|
+
}
|
|
57381
|
+
function ceil(x2) {
|
|
57382
|
+
return finalise(x2 = new this(x2), x2.e + 1, 2);
|
|
57383
|
+
}
|
|
57384
|
+
function clamp(x2, min2, max2) {
|
|
57385
|
+
return new this(x2).clamp(min2, max2);
|
|
57386
|
+
}
|
|
57387
|
+
function config(obj) {
|
|
57388
|
+
if (!obj || typeof obj !== "object")
|
|
57389
|
+
throw Error(decimalError + "Object expected");
|
|
57390
|
+
var i2, p2, v2, useDefaults = obj.defaults === true, ps = [
|
|
57391
|
+
"precision",
|
|
57392
|
+
1,
|
|
57393
|
+
MAX_DIGITS,
|
|
57394
|
+
"rounding",
|
|
57395
|
+
0,
|
|
57396
|
+
8,
|
|
57397
|
+
"toExpNeg",
|
|
57398
|
+
-EXP_LIMIT,
|
|
57399
|
+
0,
|
|
57400
|
+
"toExpPos",
|
|
57401
|
+
0,
|
|
57402
|
+
EXP_LIMIT,
|
|
57403
|
+
"maxE",
|
|
57404
|
+
0,
|
|
57405
|
+
EXP_LIMIT,
|
|
57406
|
+
"minE",
|
|
57407
|
+
-EXP_LIMIT,
|
|
57408
|
+
0,
|
|
57409
|
+
"modulo",
|
|
57410
|
+
0,
|
|
57411
|
+
9
|
|
57412
|
+
];
|
|
57413
|
+
for (i2 = 0; i2 < ps.length; i2 += 3) {
|
|
57414
|
+
if (p2 = ps[i2], useDefaults)
|
|
57415
|
+
this[p2] = DEFAULTS[p2];
|
|
57416
|
+
if ((v2 = obj[p2]) !== void 0) {
|
|
57417
|
+
if (mathfloor(v2) === v2 && v2 >= ps[i2 + 1] && v2 <= ps[i2 + 2])
|
|
57418
|
+
this[p2] = v2;
|
|
57419
|
+
else
|
|
57420
|
+
throw Error(invalidArgument + p2 + ": " + v2);
|
|
57421
|
+
}
|
|
57422
|
+
}
|
|
57423
|
+
if (p2 = "crypto", useDefaults)
|
|
57424
|
+
this[p2] = DEFAULTS[p2];
|
|
57425
|
+
if ((v2 = obj[p2]) !== void 0) {
|
|
57426
|
+
if (v2 === true || v2 === false || v2 === 0 || v2 === 1) {
|
|
57427
|
+
if (v2) {
|
|
57428
|
+
if (typeof crypto != "undefined" && crypto && (crypto.getRandomValues || crypto.randomBytes)) {
|
|
57429
|
+
this[p2] = true;
|
|
57430
|
+
} else {
|
|
57431
|
+
throw Error(cryptoUnavailable);
|
|
57432
|
+
}
|
|
57433
|
+
} else {
|
|
57434
|
+
this[p2] = false;
|
|
57435
|
+
}
|
|
57436
|
+
} else {
|
|
57437
|
+
throw Error(invalidArgument + p2 + ": " + v2);
|
|
57438
|
+
}
|
|
57439
|
+
}
|
|
57440
|
+
return this;
|
|
57441
|
+
}
|
|
57442
|
+
function cos(x2) {
|
|
57443
|
+
return new this(x2).cos();
|
|
57444
|
+
}
|
|
57445
|
+
function cosh(x2) {
|
|
57446
|
+
return new this(x2).cosh();
|
|
57447
|
+
}
|
|
57448
|
+
function clone(obj) {
|
|
57449
|
+
var i2, p2, ps;
|
|
57450
|
+
function Decimal2(v2) {
|
|
57451
|
+
var e2, i3, t2, x2 = this;
|
|
57452
|
+
if (!(x2 instanceof Decimal2))
|
|
57453
|
+
return new Decimal2(v2);
|
|
57454
|
+
x2.constructor = Decimal2;
|
|
57455
|
+
if (isDecimalInstance(v2)) {
|
|
57456
|
+
x2.s = v2.s;
|
|
57457
|
+
if (external) {
|
|
57458
|
+
if (!v2.d || v2.e > Decimal2.maxE) {
|
|
57459
|
+
x2.e = NaN;
|
|
57460
|
+
x2.d = null;
|
|
57461
|
+
} else if (v2.e < Decimal2.minE) {
|
|
57462
|
+
x2.e = 0;
|
|
57463
|
+
x2.d = [0];
|
|
57464
|
+
} else {
|
|
57465
|
+
x2.e = v2.e;
|
|
57466
|
+
x2.d = v2.d.slice();
|
|
57467
|
+
}
|
|
57468
|
+
} else {
|
|
57469
|
+
x2.e = v2.e;
|
|
57470
|
+
x2.d = v2.d ? v2.d.slice() : v2.d;
|
|
57471
|
+
}
|
|
57472
|
+
return;
|
|
57473
|
+
}
|
|
57474
|
+
t2 = typeof v2;
|
|
57475
|
+
if (t2 === "number") {
|
|
57476
|
+
if (v2 === 0) {
|
|
57477
|
+
x2.s = 1 / v2 < 0 ? -1 : 1;
|
|
57478
|
+
x2.e = 0;
|
|
57479
|
+
x2.d = [0];
|
|
57480
|
+
return;
|
|
57481
|
+
}
|
|
57482
|
+
if (v2 < 0) {
|
|
57483
|
+
v2 = -v2;
|
|
57484
|
+
x2.s = -1;
|
|
57485
|
+
} else {
|
|
57486
|
+
x2.s = 1;
|
|
57487
|
+
}
|
|
57488
|
+
if (v2 === ~~v2 && v2 < 1e7) {
|
|
57489
|
+
for (e2 = 0, i3 = v2; i3 >= 10; i3 /= 10)
|
|
57490
|
+
e2++;
|
|
57491
|
+
if (external) {
|
|
57492
|
+
if (e2 > Decimal2.maxE) {
|
|
57493
|
+
x2.e = NaN;
|
|
57494
|
+
x2.d = null;
|
|
57495
|
+
} else if (e2 < Decimal2.minE) {
|
|
57496
|
+
x2.e = 0;
|
|
57497
|
+
x2.d = [0];
|
|
57498
|
+
} else {
|
|
57499
|
+
x2.e = e2;
|
|
57500
|
+
x2.d = [v2];
|
|
57501
|
+
}
|
|
57502
|
+
} else {
|
|
57503
|
+
x2.e = e2;
|
|
57504
|
+
x2.d = [v2];
|
|
57505
|
+
}
|
|
57506
|
+
return;
|
|
57507
|
+
} else if (v2 * 0 !== 0) {
|
|
57508
|
+
if (!v2)
|
|
57509
|
+
x2.s = NaN;
|
|
57510
|
+
x2.e = NaN;
|
|
57511
|
+
x2.d = null;
|
|
57512
|
+
return;
|
|
57513
|
+
}
|
|
57514
|
+
return parseDecimal(x2, v2.toString());
|
|
57515
|
+
} else if (t2 !== "string") {
|
|
57516
|
+
throw Error(invalidArgument + v2);
|
|
57517
|
+
}
|
|
57518
|
+
if ((i3 = v2.charCodeAt(0)) === 45) {
|
|
57519
|
+
v2 = v2.slice(1);
|
|
57520
|
+
x2.s = -1;
|
|
57521
|
+
} else {
|
|
57522
|
+
if (i3 === 43)
|
|
57523
|
+
v2 = v2.slice(1);
|
|
57524
|
+
x2.s = 1;
|
|
57525
|
+
}
|
|
57526
|
+
return isDecimal.test(v2) ? parseDecimal(x2, v2) : parseOther(x2, v2);
|
|
57527
|
+
}
|
|
57528
|
+
Decimal2.prototype = P;
|
|
57529
|
+
Decimal2.ROUND_UP = 0;
|
|
57530
|
+
Decimal2.ROUND_DOWN = 1;
|
|
57531
|
+
Decimal2.ROUND_CEIL = 2;
|
|
57532
|
+
Decimal2.ROUND_FLOOR = 3;
|
|
57533
|
+
Decimal2.ROUND_HALF_UP = 4;
|
|
57534
|
+
Decimal2.ROUND_HALF_DOWN = 5;
|
|
57535
|
+
Decimal2.ROUND_HALF_EVEN = 6;
|
|
57536
|
+
Decimal2.ROUND_HALF_CEIL = 7;
|
|
57537
|
+
Decimal2.ROUND_HALF_FLOOR = 8;
|
|
57538
|
+
Decimal2.EUCLID = 9;
|
|
57539
|
+
Decimal2.config = Decimal2.set = config;
|
|
57540
|
+
Decimal2.clone = clone;
|
|
57541
|
+
Decimal2.isDecimal = isDecimalInstance;
|
|
57542
|
+
Decimal2.abs = abs;
|
|
57543
|
+
Decimal2.acos = acos;
|
|
57544
|
+
Decimal2.acosh = acosh;
|
|
57545
|
+
Decimal2.add = add;
|
|
57546
|
+
Decimal2.asin = asin;
|
|
57547
|
+
Decimal2.asinh = asinh;
|
|
57548
|
+
Decimal2.atan = atan;
|
|
57549
|
+
Decimal2.atanh = atanh;
|
|
57550
|
+
Decimal2.atan2 = atan2;
|
|
57551
|
+
Decimal2.cbrt = cbrt;
|
|
57552
|
+
Decimal2.ceil = ceil;
|
|
57553
|
+
Decimal2.clamp = clamp;
|
|
57554
|
+
Decimal2.cos = cos;
|
|
57555
|
+
Decimal2.cosh = cosh;
|
|
57556
|
+
Decimal2.div = div;
|
|
57557
|
+
Decimal2.exp = exp;
|
|
57558
|
+
Decimal2.floor = floor;
|
|
57559
|
+
Decimal2.hypot = hypot;
|
|
57560
|
+
Decimal2.ln = ln;
|
|
57561
|
+
Decimal2.log = log;
|
|
57562
|
+
Decimal2.log10 = log10;
|
|
57563
|
+
Decimal2.log2 = log2;
|
|
57564
|
+
Decimal2.max = max;
|
|
57565
|
+
Decimal2.min = min;
|
|
57566
|
+
Decimal2.mod = mod;
|
|
57567
|
+
Decimal2.mul = mul;
|
|
57568
|
+
Decimal2.pow = pow;
|
|
57569
|
+
Decimal2.random = random;
|
|
57570
|
+
Decimal2.round = round;
|
|
57571
|
+
Decimal2.sign = sign;
|
|
57572
|
+
Decimal2.sin = sin;
|
|
57573
|
+
Decimal2.sinh = sinh;
|
|
57574
|
+
Decimal2.sqrt = sqrt;
|
|
57575
|
+
Decimal2.sub = sub;
|
|
57576
|
+
Decimal2.sum = sum;
|
|
57577
|
+
Decimal2.tan = tan;
|
|
57578
|
+
Decimal2.tanh = tanh;
|
|
57579
|
+
Decimal2.trunc = trunc;
|
|
57580
|
+
if (obj === void 0)
|
|
57581
|
+
obj = {};
|
|
57582
|
+
if (obj) {
|
|
57583
|
+
if (obj.defaults !== true) {
|
|
57584
|
+
ps = ["precision", "rounding", "toExpNeg", "toExpPos", "maxE", "minE", "modulo", "crypto"];
|
|
57585
|
+
for (i2 = 0; i2 < ps.length; )
|
|
57586
|
+
if (!obj.hasOwnProperty(p2 = ps[i2++]))
|
|
57587
|
+
obj[p2] = this[p2];
|
|
57588
|
+
}
|
|
57589
|
+
}
|
|
57590
|
+
Decimal2.config(obj);
|
|
57591
|
+
return Decimal2;
|
|
57592
|
+
}
|
|
57593
|
+
function div(x2, y2) {
|
|
57594
|
+
return new this(x2).div(y2);
|
|
57595
|
+
}
|
|
57596
|
+
function exp(x2) {
|
|
57597
|
+
return new this(x2).exp();
|
|
57598
|
+
}
|
|
57599
|
+
function floor(x2) {
|
|
57600
|
+
return finalise(x2 = new this(x2), x2.e + 1, 3);
|
|
57601
|
+
}
|
|
57602
|
+
function hypot() {
|
|
57603
|
+
var i2, n2, t2 = new this(0);
|
|
57604
|
+
external = false;
|
|
57605
|
+
for (i2 = 0; i2 < arguments.length; ) {
|
|
57606
|
+
n2 = new this(arguments[i2++]);
|
|
57607
|
+
if (!n2.d) {
|
|
57608
|
+
if (n2.s) {
|
|
57609
|
+
external = true;
|
|
57610
|
+
return new this(1 / 0);
|
|
57611
|
+
}
|
|
57612
|
+
t2 = n2;
|
|
57613
|
+
} else if (t2.d) {
|
|
57614
|
+
t2 = t2.plus(n2.times(n2));
|
|
57615
|
+
}
|
|
57616
|
+
}
|
|
57617
|
+
external = true;
|
|
57618
|
+
return t2.sqrt();
|
|
57619
|
+
}
|
|
57620
|
+
function isDecimalInstance(obj) {
|
|
57621
|
+
return obj instanceof Decimal || obj && obj.toStringTag === tag || false;
|
|
57622
|
+
}
|
|
57623
|
+
function ln(x2) {
|
|
57624
|
+
return new this(x2).ln();
|
|
57625
|
+
}
|
|
57626
|
+
function log(x2, y2) {
|
|
57627
|
+
return new this(x2).log(y2);
|
|
57628
|
+
}
|
|
57629
|
+
function log2(x2) {
|
|
57630
|
+
return new this(x2).log(2);
|
|
57631
|
+
}
|
|
57632
|
+
function log10(x2) {
|
|
57633
|
+
return new this(x2).log(10);
|
|
57634
|
+
}
|
|
57635
|
+
function max() {
|
|
57636
|
+
return maxOrMin(this, arguments, "lt");
|
|
57637
|
+
}
|
|
57638
|
+
function min() {
|
|
57639
|
+
return maxOrMin(this, arguments, "gt");
|
|
57640
|
+
}
|
|
57641
|
+
function mod(x2, y2) {
|
|
57642
|
+
return new this(x2).mod(y2);
|
|
57643
|
+
}
|
|
57644
|
+
function mul(x2, y2) {
|
|
57645
|
+
return new this(x2).mul(y2);
|
|
57646
|
+
}
|
|
57647
|
+
function pow(x2, y2) {
|
|
57648
|
+
return new this(x2).pow(y2);
|
|
57649
|
+
}
|
|
57650
|
+
function random(sd) {
|
|
57651
|
+
var d2, e2, k2, n2, i2 = 0, r2 = new this(1), rd = [];
|
|
57652
|
+
if (sd === void 0)
|
|
57653
|
+
sd = this.precision;
|
|
57654
|
+
else
|
|
57655
|
+
checkInt32(sd, 1, MAX_DIGITS);
|
|
57656
|
+
k2 = Math.ceil(sd / LOG_BASE);
|
|
57657
|
+
if (!this.crypto) {
|
|
57658
|
+
for (; i2 < k2; )
|
|
57659
|
+
rd[i2++] = Math.random() * 1e7 | 0;
|
|
57660
|
+
} else if (crypto.getRandomValues) {
|
|
57661
|
+
d2 = crypto.getRandomValues(new Uint32Array(k2));
|
|
57662
|
+
for (; i2 < k2; ) {
|
|
57663
|
+
n2 = d2[i2];
|
|
57664
|
+
if (n2 >= 429e7) {
|
|
57665
|
+
d2[i2] = crypto.getRandomValues(new Uint32Array(1))[0];
|
|
57666
|
+
} else {
|
|
57667
|
+
rd[i2++] = n2 % 1e7;
|
|
57668
|
+
}
|
|
57669
|
+
}
|
|
57670
|
+
} else if (crypto.randomBytes) {
|
|
57671
|
+
d2 = crypto.randomBytes(k2 *= 4);
|
|
57672
|
+
for (; i2 < k2; ) {
|
|
57673
|
+
n2 = d2[i2] + (d2[i2 + 1] << 8) + (d2[i2 + 2] << 16) + ((d2[i2 + 3] & 127) << 24);
|
|
57674
|
+
if (n2 >= 214e7) {
|
|
57675
|
+
crypto.randomBytes(4).copy(d2, i2);
|
|
57676
|
+
} else {
|
|
57677
|
+
rd.push(n2 % 1e7);
|
|
57678
|
+
i2 += 4;
|
|
57679
|
+
}
|
|
57680
|
+
}
|
|
57681
|
+
i2 = k2 / 4;
|
|
57682
|
+
} else {
|
|
57683
|
+
throw Error(cryptoUnavailable);
|
|
57684
|
+
}
|
|
57685
|
+
k2 = rd[--i2];
|
|
57686
|
+
sd %= LOG_BASE;
|
|
57687
|
+
if (k2 && sd) {
|
|
57688
|
+
n2 = mathpow(10, LOG_BASE - sd);
|
|
57689
|
+
rd[i2] = (k2 / n2 | 0) * n2;
|
|
57690
|
+
}
|
|
57691
|
+
for (; rd[i2] === 0; i2--)
|
|
57692
|
+
rd.pop();
|
|
57693
|
+
if (i2 < 0) {
|
|
57694
|
+
e2 = 0;
|
|
57695
|
+
rd = [0];
|
|
57696
|
+
} else {
|
|
57697
|
+
e2 = -1;
|
|
57698
|
+
for (; rd[0] === 0; e2 -= LOG_BASE)
|
|
57699
|
+
rd.shift();
|
|
57700
|
+
for (k2 = 1, n2 = rd[0]; n2 >= 10; n2 /= 10)
|
|
57701
|
+
k2++;
|
|
57702
|
+
if (k2 < LOG_BASE)
|
|
57703
|
+
e2 -= LOG_BASE - k2;
|
|
57704
|
+
}
|
|
57705
|
+
r2.e = e2;
|
|
57706
|
+
r2.d = rd;
|
|
57707
|
+
return r2;
|
|
57708
|
+
}
|
|
57709
|
+
function round(x2) {
|
|
57710
|
+
return finalise(x2 = new this(x2), x2.e + 1, this.rounding);
|
|
57711
|
+
}
|
|
57712
|
+
function sign(x2) {
|
|
57713
|
+
x2 = new this(x2);
|
|
57714
|
+
return x2.d ? x2.d[0] ? x2.s : 0 * x2.s : x2.s || NaN;
|
|
57715
|
+
}
|
|
57716
|
+
function sin(x2) {
|
|
57717
|
+
return new this(x2).sin();
|
|
57718
|
+
}
|
|
57719
|
+
function sinh(x2) {
|
|
57720
|
+
return new this(x2).sinh();
|
|
57721
|
+
}
|
|
57722
|
+
function sqrt(x2) {
|
|
57723
|
+
return new this(x2).sqrt();
|
|
57724
|
+
}
|
|
57725
|
+
function sub(x2, y2) {
|
|
57726
|
+
return new this(x2).sub(y2);
|
|
57727
|
+
}
|
|
57728
|
+
function sum() {
|
|
57729
|
+
var i2 = 0, args = arguments, x2 = new this(args[i2]);
|
|
57730
|
+
external = false;
|
|
57731
|
+
for (; x2.s && ++i2 < args.length; )
|
|
57732
|
+
x2 = x2.plus(args[i2]);
|
|
57733
|
+
external = true;
|
|
57734
|
+
return finalise(x2, this.precision, this.rounding);
|
|
57735
|
+
}
|
|
57736
|
+
function tan(x2) {
|
|
57737
|
+
return new this(x2).tan();
|
|
57738
|
+
}
|
|
57739
|
+
function tanh(x2) {
|
|
57740
|
+
return new this(x2).tanh();
|
|
57741
|
+
}
|
|
57742
|
+
function trunc(x2) {
|
|
57743
|
+
return finalise(x2 = new this(x2), x2.e + 1, 1);
|
|
57744
|
+
}
|
|
57745
|
+
P[Symbol.for("nodejs.util.inspect.custom")] = P.toString;
|
|
57746
|
+
P[Symbol.toStringTag] = "Decimal";
|
|
57747
|
+
var Decimal = P.constructor = clone(DEFAULTS);
|
|
57748
|
+
LN10 = new Decimal(LN10);
|
|
57749
|
+
PI = new Decimal(PI);
|
|
57750
|
+
const libJsDecimal = (num1, num2, operator, point = 2) => {
|
|
57751
|
+
const calc = {
|
|
57752
|
+
"+": (a2, b2) => a2.add(b2),
|
|
57753
|
+
"-": (a2, b2) => a2.sub(b2),
|
|
57754
|
+
"*": (a2, b2) => a2.mul(b2),
|
|
57755
|
+
"/": (a2, b2) => {
|
|
57756
|
+
if (b2.eq(0)) {
|
|
57757
|
+
throw new Error("除数不能为0");
|
|
57758
|
+
}
|
|
57759
|
+
return a2.div(b2);
|
|
57760
|
+
}
|
|
57761
|
+
};
|
|
57762
|
+
const result = calc[operator](new Decimal(num1), new Decimal(num2));
|
|
57763
|
+
return Number(result.toFixed(point));
|
|
57764
|
+
};
|
|
57765
|
+
class LibPixiPuzzleBg extends Container {
|
|
57766
|
+
constructor() {
|
|
57767
|
+
super();
|
|
57768
|
+
this.eventMode = "none";
|
|
57769
|
+
const bg = new Sprite(Assets.get("preload/bg"));
|
|
57770
|
+
this.addChild(bg);
|
|
57771
|
+
bg.visible = false;
|
|
57772
|
+
const config2 = JSON.parse(localStorage.getItem("puzzle_bg_config") || "{}");
|
|
57773
|
+
const { alpha, x: x2, y: y2 } = config2;
|
|
57774
|
+
bg.alpha = alpha || 0.25;
|
|
57775
|
+
bg.position.set(x2 || 0, y2 || 0);
|
|
57776
|
+
document.addEventListener("keydown", (e2) => {
|
|
57777
|
+
if (e2.code === "Space") {
|
|
57778
|
+
bg.visible = !bg.visible;
|
|
57779
|
+
} else if (e2.code === "ArrowUp") {
|
|
57780
|
+
bg.y -= 2;
|
|
57781
|
+
} else if (e2.code === "ArrowDown") {
|
|
57782
|
+
bg.y += 2;
|
|
57783
|
+
} else if (e2.code === "ArrowLeft") {
|
|
57784
|
+
bg.x -= 2;
|
|
57785
|
+
} else if (e2.code === "ArrowRight") {
|
|
57786
|
+
bg.x += 2;
|
|
57787
|
+
}
|
|
57788
|
+
if (e2.code === "NumpadAdd" && bg.alpha < 1) {
|
|
57789
|
+
bg.alpha = libJsDecimal(bg.alpha, 0.1, "+");
|
|
57790
|
+
} else if (e2.code === "NumpadSubtract" && bg.alpha > 0) {
|
|
57791
|
+
bg.alpha = libJsDecimal(bg.alpha, 0.1, "-");
|
|
57792
|
+
}
|
|
57793
|
+
localStorage.setItem("puzzle_bg_config", JSON.stringify({ alpha: bg.alpha, x: bg.x, y: bg.y }));
|
|
57794
|
+
});
|
|
57795
|
+
}
|
|
57796
|
+
}
|
|
55422
57797
|
const Components = {
|
|
55423
57798
|
Base: {
|
|
55424
57799
|
/** @description 自定义位图文本
|
|
@@ -55514,7 +57889,11 @@ void main(void){
|
|
|
55514
57889
|
/** @description 自适应宽度的标签和值组件
|
|
55515
57890
|
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiLabelValue-标签值
|
|
55516
57891
|
*/
|
|
55517
|
-
LibPixiLabelValue
|
|
57892
|
+
LibPixiLabelValue,
|
|
57893
|
+
/** @description 设计图背景拼接
|
|
57894
|
+
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiPuzzleBg-设计图背景拼接
|
|
57895
|
+
*/
|
|
57896
|
+
LibPixiPuzzleBg
|
|
55518
57897
|
}
|
|
55519
57898
|
};
|
|
55520
57899
|
const Utils = {
|