@leafer-ui/miniapp 1.9.8 → 1.9.10
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/dist/miniapp.cjs +49 -25
- package/dist/miniapp.esm.js +50 -26
- package/dist/miniapp.esm.min.js +1 -1
- package/dist/miniapp.esm.min.js.map +1 -1
- package/dist/miniapp.min.cjs +1 -1
- package/dist/miniapp.min.cjs.map +1 -1
- package/dist/miniapp.module.js +177 -125
- package/dist/miniapp.module.min.js +1 -1
- package/dist/miniapp.module.min.js.map +1 -1
- package/package.json +12 -12
package/dist/miniapp.cjs
CHANGED
|
@@ -823,7 +823,7 @@ class Picker {
|
|
|
823
823
|
children: [ target ]
|
|
824
824
|
} : target);
|
|
825
825
|
const {list: list} = this.findList;
|
|
826
|
-
const leaf = this.getBestMatchLeaf(list, options.bottomList, ignoreHittable);
|
|
826
|
+
const leaf = this.getBestMatchLeaf(list, options.bottomList, ignoreHittable, !!options.findList);
|
|
827
827
|
const path = ignoreHittable ? this.getPath(leaf) : this.getHitablePath(leaf);
|
|
828
828
|
this.clear();
|
|
829
829
|
return through ? {
|
|
@@ -838,7 +838,7 @@ class Picker {
|
|
|
838
838
|
hitPoint(hitPoint, hitRadius, options) {
|
|
839
839
|
return !!this.getByPoint(hitPoint, hitRadius, options).target;
|
|
840
840
|
}
|
|
841
|
-
getBestMatchLeaf(list, bottomList, ignoreHittable) {
|
|
841
|
+
getBestMatchLeaf(list, bottomList, ignoreHittable, allowNull) {
|
|
842
842
|
const findList = this.findList = new core.LeafList;
|
|
843
843
|
if (list.length) {
|
|
844
844
|
let find;
|
|
@@ -869,15 +869,27 @@ class Picker {
|
|
|
869
869
|
if (findList.length) return findList.list[0];
|
|
870
870
|
}
|
|
871
871
|
}
|
|
872
|
+
if (allowNull) return null;
|
|
872
873
|
return ignoreHittable ? list[0] : list.find(item => core.LeafHelper.worldHittable(item));
|
|
873
874
|
}
|
|
874
875
|
getPath(leaf) {
|
|
875
|
-
const path = new core.LeafList;
|
|
876
|
+
const path = new core.LeafList, syncList = [], {target: target} = this;
|
|
876
877
|
while (leaf) {
|
|
878
|
+
if (leaf.syncEventer) syncList.push(leaf.syncEventer);
|
|
877
879
|
path.add(leaf);
|
|
878
880
|
leaf = leaf.parent;
|
|
881
|
+
if (leaf === target) break;
|
|
882
|
+
}
|
|
883
|
+
if (syncList.length) {
|
|
884
|
+
syncList.forEach(item => {
|
|
885
|
+
while (item) {
|
|
886
|
+
if (item.__.hittable) path.add(item);
|
|
887
|
+
item = item.parent;
|
|
888
|
+
if (item === target) break;
|
|
889
|
+
}
|
|
890
|
+
});
|
|
879
891
|
}
|
|
880
|
-
if (
|
|
892
|
+
if (target) path.add(target);
|
|
881
893
|
return path;
|
|
882
894
|
}
|
|
883
895
|
getHitablePath(leaf) {
|
|
@@ -1465,7 +1477,14 @@ const PaintModule = {
|
|
|
1465
1477
|
|
|
1466
1478
|
let origin = {}, tempMatrix$1 = core.getMatrixData();
|
|
1467
1479
|
|
|
1468
|
-
const {get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = core.MatrixHelper;
|
|
1480
|
+
const {get: get$3, set: set, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = core.MatrixHelper;
|
|
1481
|
+
|
|
1482
|
+
function stretchMode(data, box, scaleX, scaleY) {
|
|
1483
|
+
const transform = get$3();
|
|
1484
|
+
translate$1(transform, box.x, box.y);
|
|
1485
|
+
if (scaleX) scaleHelper(transform, scaleX, scaleY);
|
|
1486
|
+
data.transform = transform;
|
|
1487
|
+
}
|
|
1469
1488
|
|
|
1470
1489
|
function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
1471
1490
|
const transform = get$3();
|
|
@@ -1482,8 +1501,11 @@ function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipScaleX, c
|
|
|
1482
1501
|
const transform = get$3();
|
|
1483
1502
|
layout(transform, box, x, y, scaleX, scaleY, rotation, skew);
|
|
1484
1503
|
if (clipScaleX) {
|
|
1485
|
-
|
|
1486
|
-
|
|
1504
|
+
if (rotation || skew) {
|
|
1505
|
+
set(tempMatrix$1);
|
|
1506
|
+
scaleOfOuter$1(tempMatrix$1, box, clipScaleX, clipScaleY);
|
|
1507
|
+
multiplyParent(transform, tempMatrix$1);
|
|
1508
|
+
} else scaleOfOuter$1(transform, box, clipScaleX, clipScaleY);
|
|
1487
1509
|
}
|
|
1488
1510
|
data.transform = transform;
|
|
1489
1511
|
}
|
|
@@ -1579,7 +1601,10 @@ function getPatternData(paint, box, image) {
|
|
|
1579
1601
|
if (offset) core.PointHelper.move(tempImage, offset);
|
|
1580
1602
|
switch (mode) {
|
|
1581
1603
|
case "stretch":
|
|
1582
|
-
if (!sameBox)
|
|
1604
|
+
if (!sameBox) {
|
|
1605
|
+
scaleX = box.width / width, scaleY = box.height / height;
|
|
1606
|
+
stretchMode(data, box, scaleX, scaleY);
|
|
1607
|
+
}
|
|
1583
1608
|
break;
|
|
1584
1609
|
|
|
1585
1610
|
case "normal":
|
|
@@ -1588,7 +1613,7 @@ function getPatternData(paint, box, image) {
|
|
|
1588
1613
|
let clipScaleX, clipScaleY;
|
|
1589
1614
|
if (clipSize) clipScaleX = box.width / clipSize.width, clipScaleY = box.height / clipSize.height;
|
|
1590
1615
|
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY);
|
|
1591
|
-
if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX :
|
|
1616
|
+
if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX : clipScaleX, scaleY = scaleY ? scaleY * clipScaleY : clipScaleY;
|
|
1592
1617
|
}
|
|
1593
1618
|
break;
|
|
1594
1619
|
|
|
@@ -1605,17 +1630,14 @@ function getPatternData(paint, box, image) {
|
|
|
1605
1630
|
if (scaleX) fillOrFitMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
1606
1631
|
}
|
|
1607
1632
|
if (!data.transform) {
|
|
1608
|
-
if (box.x || box.y)
|
|
1609
|
-
data.transform = get$2();
|
|
1610
|
-
translate(data.transform, box.x, box.y);
|
|
1611
|
-
}
|
|
1633
|
+
if (box.x || box.y) translate(data.transform = get$2(), box.x, box.y);
|
|
1612
1634
|
}
|
|
1613
|
-
|
|
1635
|
+
data.width = width;
|
|
1636
|
+
data.height = height;
|
|
1637
|
+
if (scaleX) {
|
|
1614
1638
|
data.scaleX = scaleX;
|
|
1615
1639
|
data.scaleY = scaleY;
|
|
1616
1640
|
}
|
|
1617
|
-
data.width = width;
|
|
1618
|
-
data.height = height;
|
|
1619
1641
|
if (opacity) data.opacity = opacity;
|
|
1620
1642
|
if (filters) data.filters = filters;
|
|
1621
1643
|
if (repeat) data.repeat = core.isString(repeat) ? repeat === "x" ? "repeat-x" : "repeat-y" : "repeat";
|
|
@@ -1747,7 +1769,7 @@ function ignoreRender(ui, value) {
|
|
|
1747
1769
|
|
|
1748
1770
|
const {get: get$1, scale: scale, copy: copy$1} = core.MatrixHelper;
|
|
1749
1771
|
|
|
1750
|
-
const {floor: floor, ceil: ceil, max: max$1, abs: abs} = Math;
|
|
1772
|
+
const {floor: floor, ceil: ceil, max: max$1, abs: abs$1} = Math;
|
|
1751
1773
|
|
|
1752
1774
|
function createPattern(ui, paint, pixelRatio) {
|
|
1753
1775
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
@@ -1758,8 +1780,8 @@ function createPattern(ui, paint, pixelRatio) {
|
|
|
1758
1780
|
scaleX *= pixelRatio;
|
|
1759
1781
|
scaleY *= pixelRatio;
|
|
1760
1782
|
if (sx) {
|
|
1761
|
-
sx = abs(sx);
|
|
1762
|
-
sy = abs(sy);
|
|
1783
|
+
sx = abs$1(sx);
|
|
1784
|
+
sy = abs$1(sy);
|
|
1763
1785
|
imageMatrix = get$1();
|
|
1764
1786
|
copy$1(imageMatrix, transform);
|
|
1765
1787
|
scale(imageMatrix, 1 / sx, 1 / sy);
|
|
@@ -1934,6 +1956,7 @@ const PaintImageModule = {
|
|
|
1934
1956
|
recycleImage: recycleImage,
|
|
1935
1957
|
createData: createData,
|
|
1936
1958
|
getPatternData: getPatternData,
|
|
1959
|
+
stretchMode: stretchMode,
|
|
1937
1960
|
fillOrFitMode: fillOrFitMode,
|
|
1938
1961
|
clipMode: clipMode,
|
|
1939
1962
|
repeatMode: repeatMode
|
|
@@ -2044,7 +2067,7 @@ const PaintGradientModule = {
|
|
|
2044
2067
|
getTransform: getTransform
|
|
2045
2068
|
};
|
|
2046
2069
|
|
|
2047
|
-
const {copy: copy, move: move, toOffsetOutBounds: toOffsetOutBounds$1} = core.BoundsHelper, {max: max} = Math;
|
|
2070
|
+
const {copy: copy, move: move, toOffsetOutBounds: toOffsetOutBounds$1} = core.BoundsHelper, {max: max, abs: abs} = Math;
|
|
2048
2071
|
|
|
2049
2072
|
const tempBounds = {}, tempMatrix = new core.Matrix;
|
|
2050
2073
|
|
|
@@ -2064,8 +2087,8 @@ function shadow(ui, current, shape) {
|
|
|
2064
2087
|
const sx = Math.abs(nowWorld.scaleX);
|
|
2065
2088
|
if (sx > 1) otherScale = 1 / sx;
|
|
2066
2089
|
}
|
|
2067
|
-
other.setWorldShadow(offsetOutBounds$1.offsetX + item.x * scaleX * otherScale, offsetOutBounds$1.offsetY + item.y * scaleY * otherScale, item.blur * scaleX * otherScale, draw.ColorConvert.string(item.color));
|
|
2068
|
-
transform = getShadowTransform(ui, other, shape, item, offsetOutBounds$1, otherScale);
|
|
2090
|
+
other.setWorldShadow(offsetOutBounds$1.offsetX + (item.x || 0) * scaleX * otherScale, offsetOutBounds$1.offsetY + (item.y || 0) * scaleY * otherScale, (item.blur || 0) * scaleX * otherScale, draw.ColorConvert.string(item.color));
|
|
2091
|
+
transform = draw.Effect.getShadowTransform(ui, other, shape, item, offsetOutBounds$1, otherScale);
|
|
2069
2092
|
if (transform) other.setTransform(transform);
|
|
2070
2093
|
drawWorldShadow(other, offsetOutBounds$1, shape);
|
|
2071
2094
|
if (transform) other.resetTransform();
|
|
@@ -2088,7 +2111,7 @@ function shadow(ui, current, shape) {
|
|
|
2088
2111
|
function getShadowRenderSpread(_ui, shadow) {
|
|
2089
2112
|
let top = 0, right = 0, bottom = 0, left = 0, x, y, spread, blur;
|
|
2090
2113
|
shadow.forEach(item => {
|
|
2091
|
-
x = item.x || 0, y = item.y || 0,
|
|
2114
|
+
x = item.x || 0, y = item.y || 0, blur = (item.blur || 0) * 1.5, spread = abs(item.spread || 0);
|
|
2092
2115
|
top = max(top, spread + blur - y);
|
|
2093
2116
|
right = max(right, spread + blur + x);
|
|
2094
2117
|
bottom = max(bottom, spread + blur + y);
|
|
@@ -2141,8 +2164,8 @@ function innerShadow(ui, current, shape) {
|
|
|
2141
2164
|
if (sx > 1) otherScale = 1 / sx;
|
|
2142
2165
|
}
|
|
2143
2166
|
other.save();
|
|
2144
|
-
other.setWorldShadow(offsetOutBounds.offsetX + item.x * scaleX * otherScale, offsetOutBounds.offsetY + item.y * scaleY * otherScale, item.blur * scaleX * otherScale);
|
|
2145
|
-
transform = getShadowTransform(ui, other, shape, item, offsetOutBounds, otherScale, true);
|
|
2167
|
+
other.setWorldShadow(offsetOutBounds.offsetX + (item.x || 0) * scaleX * otherScale, offsetOutBounds.offsetY + (item.y || 0) * scaleY * otherScale, (item.blur || 0) * scaleX * otherScale);
|
|
2168
|
+
transform = draw.Effect.getShadowTransform(ui, other, shape, item, offsetOutBounds, otherScale, true);
|
|
2146
2169
|
if (transform) other.setTransform(transform);
|
|
2147
2170
|
drawWorldShadow(other, offsetOutBounds, shape);
|
|
2148
2171
|
other.restore();
|
|
@@ -2778,6 +2801,7 @@ const TextConvertModule = {
|
|
|
2778
2801
|
};
|
|
2779
2802
|
|
|
2780
2803
|
function string(color, opacity) {
|
|
2804
|
+
if (!color) return "#000";
|
|
2781
2805
|
const doOpacity = core.isNumber(opacity) && opacity < 1;
|
|
2782
2806
|
if (core.isString(color)) {
|
|
2783
2807
|
if (doOpacity && draw.ColorConvert.object) color = draw.ColorConvert.object(color); else return color;
|
package/dist/miniapp.esm.js
CHANGED
|
@@ -8,7 +8,7 @@ import { InteractionHelper, InteractionBase, isUndefined as isUndefined$1, HitCa
|
|
|
8
8
|
|
|
9
9
|
export * from "@leafer-ui/core";
|
|
10
10
|
|
|
11
|
-
import { PaintImage, Paint, ColorConvert, PaintGradient, Export, Group, TextConvert,
|
|
11
|
+
import { PaintImage, Paint, ColorConvert, PaintGradient, Export, Effect, Group, TextConvert, Leafer } from "@leafer-ui/draw";
|
|
12
12
|
|
|
13
13
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
14
14
|
get allowBackgroundColor() {
|
|
@@ -827,7 +827,7 @@ class Picker {
|
|
|
827
827
|
children: [ target ]
|
|
828
828
|
} : target);
|
|
829
829
|
const {list: list} = this.findList;
|
|
830
|
-
const leaf = this.getBestMatchLeaf(list, options.bottomList, ignoreHittable);
|
|
830
|
+
const leaf = this.getBestMatchLeaf(list, options.bottomList, ignoreHittable, !!options.findList);
|
|
831
831
|
const path = ignoreHittable ? this.getPath(leaf) : this.getHitablePath(leaf);
|
|
832
832
|
this.clear();
|
|
833
833
|
return through ? {
|
|
@@ -842,7 +842,7 @@ class Picker {
|
|
|
842
842
|
hitPoint(hitPoint, hitRadius, options) {
|
|
843
843
|
return !!this.getByPoint(hitPoint, hitRadius, options).target;
|
|
844
844
|
}
|
|
845
|
-
getBestMatchLeaf(list, bottomList, ignoreHittable) {
|
|
845
|
+
getBestMatchLeaf(list, bottomList, ignoreHittable, allowNull) {
|
|
846
846
|
const findList = this.findList = new LeafList;
|
|
847
847
|
if (list.length) {
|
|
848
848
|
let find;
|
|
@@ -873,15 +873,27 @@ class Picker {
|
|
|
873
873
|
if (findList.length) return findList.list[0];
|
|
874
874
|
}
|
|
875
875
|
}
|
|
876
|
+
if (allowNull) return null;
|
|
876
877
|
return ignoreHittable ? list[0] : list.find(item => LeafHelper.worldHittable(item));
|
|
877
878
|
}
|
|
878
879
|
getPath(leaf) {
|
|
879
|
-
const path = new LeafList;
|
|
880
|
+
const path = new LeafList, syncList = [], {target: target} = this;
|
|
880
881
|
while (leaf) {
|
|
882
|
+
if (leaf.syncEventer) syncList.push(leaf.syncEventer);
|
|
881
883
|
path.add(leaf);
|
|
882
884
|
leaf = leaf.parent;
|
|
885
|
+
if (leaf === target) break;
|
|
886
|
+
}
|
|
887
|
+
if (syncList.length) {
|
|
888
|
+
syncList.forEach(item => {
|
|
889
|
+
while (item) {
|
|
890
|
+
if (item.__.hittable) path.add(item);
|
|
891
|
+
item = item.parent;
|
|
892
|
+
if (item === target) break;
|
|
893
|
+
}
|
|
894
|
+
});
|
|
883
895
|
}
|
|
884
|
-
if (
|
|
896
|
+
if (target) path.add(target);
|
|
885
897
|
return path;
|
|
886
898
|
}
|
|
887
899
|
getHitablePath(leaf) {
|
|
@@ -1469,7 +1481,14 @@ const PaintModule = {
|
|
|
1469
1481
|
|
|
1470
1482
|
let origin = {}, tempMatrix$1 = getMatrixData();
|
|
1471
1483
|
|
|
1472
|
-
const {get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = MatrixHelper;
|
|
1484
|
+
const {get: get$3, set: set, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = MatrixHelper;
|
|
1485
|
+
|
|
1486
|
+
function stretchMode(data, box, scaleX, scaleY) {
|
|
1487
|
+
const transform = get$3();
|
|
1488
|
+
translate$1(transform, box.x, box.y);
|
|
1489
|
+
if (scaleX) scaleHelper(transform, scaleX, scaleY);
|
|
1490
|
+
data.transform = transform;
|
|
1491
|
+
}
|
|
1473
1492
|
|
|
1474
1493
|
function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
1475
1494
|
const transform = get$3();
|
|
@@ -1486,8 +1505,11 @@ function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipScaleX, c
|
|
|
1486
1505
|
const transform = get$3();
|
|
1487
1506
|
layout(transform, box, x, y, scaleX, scaleY, rotation, skew);
|
|
1488
1507
|
if (clipScaleX) {
|
|
1489
|
-
|
|
1490
|
-
|
|
1508
|
+
if (rotation || skew) {
|
|
1509
|
+
set(tempMatrix$1);
|
|
1510
|
+
scaleOfOuter$1(tempMatrix$1, box, clipScaleX, clipScaleY);
|
|
1511
|
+
multiplyParent(transform, tempMatrix$1);
|
|
1512
|
+
} else scaleOfOuter$1(transform, box, clipScaleX, clipScaleY);
|
|
1491
1513
|
}
|
|
1492
1514
|
data.transform = transform;
|
|
1493
1515
|
}
|
|
@@ -1583,7 +1605,10 @@ function getPatternData(paint, box, image) {
|
|
|
1583
1605
|
if (offset) PointHelper.move(tempImage, offset);
|
|
1584
1606
|
switch (mode) {
|
|
1585
1607
|
case "stretch":
|
|
1586
|
-
if (!sameBox)
|
|
1608
|
+
if (!sameBox) {
|
|
1609
|
+
scaleX = box.width / width, scaleY = box.height / height;
|
|
1610
|
+
stretchMode(data, box, scaleX, scaleY);
|
|
1611
|
+
}
|
|
1587
1612
|
break;
|
|
1588
1613
|
|
|
1589
1614
|
case "normal":
|
|
@@ -1592,7 +1617,7 @@ function getPatternData(paint, box, image) {
|
|
|
1592
1617
|
let clipScaleX, clipScaleY;
|
|
1593
1618
|
if (clipSize) clipScaleX = box.width / clipSize.width, clipScaleY = box.height / clipSize.height;
|
|
1594
1619
|
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY);
|
|
1595
|
-
if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX :
|
|
1620
|
+
if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX : clipScaleX, scaleY = scaleY ? scaleY * clipScaleY : clipScaleY;
|
|
1596
1621
|
}
|
|
1597
1622
|
break;
|
|
1598
1623
|
|
|
@@ -1609,17 +1634,14 @@ function getPatternData(paint, box, image) {
|
|
|
1609
1634
|
if (scaleX) fillOrFitMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
1610
1635
|
}
|
|
1611
1636
|
if (!data.transform) {
|
|
1612
|
-
if (box.x || box.y)
|
|
1613
|
-
data.transform = get$2();
|
|
1614
|
-
translate(data.transform, box.x, box.y);
|
|
1615
|
-
}
|
|
1637
|
+
if (box.x || box.y) translate(data.transform = get$2(), box.x, box.y);
|
|
1616
1638
|
}
|
|
1617
|
-
|
|
1639
|
+
data.width = width;
|
|
1640
|
+
data.height = height;
|
|
1641
|
+
if (scaleX) {
|
|
1618
1642
|
data.scaleX = scaleX;
|
|
1619
1643
|
data.scaleY = scaleY;
|
|
1620
1644
|
}
|
|
1621
|
-
data.width = width;
|
|
1622
|
-
data.height = height;
|
|
1623
1645
|
if (opacity) data.opacity = opacity;
|
|
1624
1646
|
if (filters) data.filters = filters;
|
|
1625
1647
|
if (repeat) data.repeat = isString(repeat) ? repeat === "x" ? "repeat-x" : "repeat-y" : "repeat";
|
|
@@ -1751,7 +1773,7 @@ function ignoreRender(ui, value) {
|
|
|
1751
1773
|
|
|
1752
1774
|
const {get: get$1, scale: scale, copy: copy$1} = MatrixHelper;
|
|
1753
1775
|
|
|
1754
|
-
const {floor: floor, ceil: ceil, max: max$1, abs: abs} = Math;
|
|
1776
|
+
const {floor: floor, ceil: ceil, max: max$1, abs: abs$1} = Math;
|
|
1755
1777
|
|
|
1756
1778
|
function createPattern(ui, paint, pixelRatio) {
|
|
1757
1779
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
@@ -1762,8 +1784,8 @@ function createPattern(ui, paint, pixelRatio) {
|
|
|
1762
1784
|
scaleX *= pixelRatio;
|
|
1763
1785
|
scaleY *= pixelRatio;
|
|
1764
1786
|
if (sx) {
|
|
1765
|
-
sx = abs(sx);
|
|
1766
|
-
sy = abs(sy);
|
|
1787
|
+
sx = abs$1(sx);
|
|
1788
|
+
sy = abs$1(sy);
|
|
1767
1789
|
imageMatrix = get$1();
|
|
1768
1790
|
copy$1(imageMatrix, transform);
|
|
1769
1791
|
scale(imageMatrix, 1 / sx, 1 / sy);
|
|
@@ -1938,6 +1960,7 @@ const PaintImageModule = {
|
|
|
1938
1960
|
recycleImage: recycleImage,
|
|
1939
1961
|
createData: createData,
|
|
1940
1962
|
getPatternData: getPatternData,
|
|
1963
|
+
stretchMode: stretchMode,
|
|
1941
1964
|
fillOrFitMode: fillOrFitMode,
|
|
1942
1965
|
clipMode: clipMode,
|
|
1943
1966
|
repeatMode: repeatMode
|
|
@@ -2048,7 +2071,7 @@ const PaintGradientModule = {
|
|
|
2048
2071
|
getTransform: getTransform
|
|
2049
2072
|
};
|
|
2050
2073
|
|
|
2051
|
-
const {copy: copy, move: move, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max} = Math;
|
|
2074
|
+
const {copy: copy, move: move, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max, abs: abs} = Math;
|
|
2052
2075
|
|
|
2053
2076
|
const tempBounds = {}, tempMatrix = new Matrix;
|
|
2054
2077
|
|
|
@@ -2068,8 +2091,8 @@ function shadow(ui, current, shape) {
|
|
|
2068
2091
|
const sx = Math.abs(nowWorld.scaleX);
|
|
2069
2092
|
if (sx > 1) otherScale = 1 / sx;
|
|
2070
2093
|
}
|
|
2071
|
-
other.setWorldShadow(offsetOutBounds$1.offsetX + item.x * scaleX * otherScale, offsetOutBounds$1.offsetY + item.y * scaleY * otherScale, item.blur * scaleX * otherScale, ColorConvert.string(item.color));
|
|
2072
|
-
transform = getShadowTransform(ui, other, shape, item, offsetOutBounds$1, otherScale);
|
|
2094
|
+
other.setWorldShadow(offsetOutBounds$1.offsetX + (item.x || 0) * scaleX * otherScale, offsetOutBounds$1.offsetY + (item.y || 0) * scaleY * otherScale, (item.blur || 0) * scaleX * otherScale, ColorConvert.string(item.color));
|
|
2095
|
+
transform = Effect.getShadowTransform(ui, other, shape, item, offsetOutBounds$1, otherScale);
|
|
2073
2096
|
if (transform) other.setTransform(transform);
|
|
2074
2097
|
drawWorldShadow(other, offsetOutBounds$1, shape);
|
|
2075
2098
|
if (transform) other.resetTransform();
|
|
@@ -2092,7 +2115,7 @@ function shadow(ui, current, shape) {
|
|
|
2092
2115
|
function getShadowRenderSpread(_ui, shadow) {
|
|
2093
2116
|
let top = 0, right = 0, bottom = 0, left = 0, x, y, spread, blur;
|
|
2094
2117
|
shadow.forEach(item => {
|
|
2095
|
-
x = item.x || 0, y = item.y || 0,
|
|
2118
|
+
x = item.x || 0, y = item.y || 0, blur = (item.blur || 0) * 1.5, spread = abs(item.spread || 0);
|
|
2096
2119
|
top = max(top, spread + blur - y);
|
|
2097
2120
|
right = max(right, spread + blur + x);
|
|
2098
2121
|
bottom = max(bottom, spread + blur + y);
|
|
@@ -2145,8 +2168,8 @@ function innerShadow(ui, current, shape) {
|
|
|
2145
2168
|
if (sx > 1) otherScale = 1 / sx;
|
|
2146
2169
|
}
|
|
2147
2170
|
other.save();
|
|
2148
|
-
other.setWorldShadow(offsetOutBounds.offsetX + item.x * scaleX * otherScale, offsetOutBounds.offsetY + item.y * scaleY * otherScale, item.blur * scaleX * otherScale);
|
|
2149
|
-
transform = getShadowTransform(ui, other, shape, item, offsetOutBounds, otherScale, true);
|
|
2171
|
+
other.setWorldShadow(offsetOutBounds.offsetX + (item.x || 0) * scaleX * otherScale, offsetOutBounds.offsetY + (item.y || 0) * scaleY * otherScale, (item.blur || 0) * scaleX * otherScale);
|
|
2172
|
+
transform = Effect.getShadowTransform(ui, other, shape, item, offsetOutBounds, otherScale, true);
|
|
2150
2173
|
if (transform) other.setTransform(transform);
|
|
2151
2174
|
drawWorldShadow(other, offsetOutBounds, shape);
|
|
2152
2175
|
other.restore();
|
|
@@ -2782,6 +2805,7 @@ const TextConvertModule = {
|
|
|
2782
2805
|
};
|
|
2783
2806
|
|
|
2784
2807
|
function string(color, opacity) {
|
|
2808
|
+
if (!color) return "#000";
|
|
2785
2809
|
const doOpacity = isNumber(opacity) && opacity < 1;
|
|
2786
2810
|
if (isString(color)) {
|
|
2787
2811
|
if (doOpacity && ColorConvert.object) color = ColorConvert.object(color); else return color;
|
package/dist/miniapp.esm.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{LeaferCanvasBase as t,isString as e,Platform as i,isNumber as s,canvasPatch as n,DataHelper as a,canvasSizeAttrs as o,isUndefined as r,ResizeEvent as h,FileHelper as c,Creator as l,LeaferImage as d,defineKey as u,LeafList as f,RenderEvent as g,ChildEvent as p,WatchEvent as _,PropertyEvent as w,LeafHelper as m,BranchHelper as y,LeafBoundsHelper as v,Bounds as x,isArray as S,Debug as b,LeafLevelList as k,LayoutEvent as B,Run as R,ImageManager as T,BoundsHelper as E,Plugin as L,isObject as A,FourNumberHelper as C,Matrix as P,getMatrixData as M,MatrixHelper as O,MathHelper as W,AlignHelper as D,PointHelper as I,ImageEvent as z,AroundHelper as F,Direction4 as U}from"@leafer/core";export*from"@leafer/core";export{LeaferImage}from"@leafer/core";import{InteractionHelper as Y,InteractionBase as X,isUndefined as j,HitCanvasManager as G}from"@leafer-ui/core";export*from"@leafer-ui/core";import{PaintImage as N,Paint as q,ColorConvert as H,PaintGradient as V,Export as Q,Group as K,TextConvert as Z,Effect as $,Leafer as J}from"@leafer-ui/draw";class tt extends t{get allowBackgroundColor(){return!1}init(){const{config:t}=this;let s=t.view||t.canvas;s?(e(s)?("#"!==s[0]&&(s="#"+s),this.viewSelect=i.miniapp.select(s)):s.fields?this.viewSelect=s:this.initView(s),this.viewSelect&&i.miniapp.getSizeView(this.viewSelect).then(t=>{this.initView(t)})):this.initView()}initView(t){t?this.view=t.view||t:(t={},this.__createView()),this.view.getContext?this.__createContext():this.unrealCanvas();const{width:e,height:a,pixelRatio:o}=this.config,r={width:e||t.width,height:a||t.height,pixelRatio:o};this.resize(r),this.context&&(this.viewSelect&&(i.renderCanvas=this),this.context.roundRect&&(this.roundRect=function(t,e,i,n,a){this.context.roundRect(t,e,i,n,s(a)?[a]:a)}),n(this.context.__proto__))}__createView(){this.view=i.origin.createCanvas(1,1)}updateViewSize(){if(this.unreal)return;const{width:t,height:e,pixelRatio:i}=this;this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i)}updateClientBounds(t){this.viewSelect&&i.miniapp.getBounds(this.viewSelect).then(e=>{this.clientBounds=e,t&&t()})}startAutoLayout(t,e){this.resizeListener||(this.resizeListener=e,t&&(this.checkSize=this.checkSize.bind(this),i.miniapp.onWindowResize(this.checkSize)))}checkSize(){this.viewSelect&&setTimeout(()=>{this.updateClientBounds(()=>{const{width:t,height:e}=this.clientBounds,{pixelRatio:i}=this,s={width:t,height:e,pixelRatio:i};this.isSameSize(s)||this.emitResize(s)})},500)}stopAutoLayout(){this.autoLayout=!1,this.resizeListener=null,i.miniapp.offWindowResize(this.checkSize)}unrealCanvas(){this.unreal=!0}emitResize(t){const e={};a.copyAttrs(e,this,o),this.resize(t),r(this.width)||this.resizeListener(new h(t,e))}}const{mineType:et,fileType:it}=c;function st(t,e){i.origin={createCanvas:(t,i,s)=>{const n={type:"2d",width:t,height:i};return e.createOffscreenCanvas?e.createOffscreenCanvas(n):e.createOffScreenCanvas(n)},canvasToDataURL:(t,e,i)=>t.toDataURL(et(e),i),canvasToBolb:(t,e,i)=>t.toBuffer(e,{quality:i}),canvasSaveAs:(t,e,s)=>{let n=t.toDataURL(et(it(e)),s);return n=n.substring(n.indexOf("64,")+3),i.origin.download(n,e)},download:(t,s)=>new Promise((n,a)=>{let o;s.includes("/")||(s=`${e.env.USER_DATA_PATH}/`+s,o=!0);const r=e.getFileSystemManager();r.writeFile({filePath:s,data:t,encoding:"base64",success(){o?i.miniapp.saveToAlbum(s).then(()=>{r.unlink({filePath:s}),n()}):n()},fail(t){a(t)}})}),loadImage:t=>new Promise((e,s)=>{const n=i.canvas.view.createImage();n.onload=()=>{e(n)},n.onerror=t=>{s(t)},n.src=i.image.getRealURL(t)}),noRepeat:"repeat-x"},i.miniapp={select:t=>e.createSelectorQuery().select(t),getBounds:t=>new Promise(e=>{t.boundingClientRect().exec(t=>{const i=t[1];e({x:i.top,y:i.left,width:i.width,height:i.height})})}),getSizeView:t=>new Promise(e=>{t.fields({node:!0,size:!0}).exec(t=>{const i=t[0];e({view:i.node,width:i.width,height:i.height})})}),saveToAlbum:t=>new Promise(i=>{e.getSetting({success:s=>{s.authSetting["scope.writePhotosAlbum"]?e.saveImageToPhotosAlbum({filePath:t,success(){i(!0)}}):e.authorize({scope:"scope.writePhotosAlbum",success:()=>{e.saveImageToPhotosAlbum({filePath:t,success(){i(!0)}})},fail:()=>{}})}})}),onWindowResize(t){e.onWindowResize(t)},offWindowResize(t){e.offWindowResize(t)}},i.event={stopDefault(t){},stopNow(t){},stop(t){}},i.canvas=l.canvas(),i.conicGradientSupport=!!i.canvas.context.createConicGradient}Object.assign(l,{canvas:(t,e)=>new tt(t,e),image:t=>new d(t)}),i.name="miniapp",i.requestRender=function(t){const{view:e}=i.renderCanvas||i.canvas;e.requestAnimationFrame?e.requestAnimationFrame(t):setTimeout(t,16)},u(i,"devicePixelRatio",{get:()=>Math.max(1,wx.getWindowInfo?wx.getWindowInfo().pixelRatio:wx.getSystemInfoSync().pixelRatio)});class nt{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new f;return this.__updatedList.list.forEach(e=>{e.leafer&&t.add(e)}),t}return this.__updatedList}constructor(t,e){this.totalTimes=0,this.config={},this.__updatedList=new f,this.target=t,e&&(this.config=a.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(g.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===p.ADD?(this.hasAdd=!0,this.__pushChild(t.child)):(this.hasRemove=!0,this.__updatedList.add(t.parent)),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new _(_.DATA,{updatedList:this.updatedList})),this.__updatedList=new f,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[w.CHANGE,this.__onAttrChange,this],[[p.ADD,p.REMOVE],this.__onChildEvent,this],[_.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:at,updateBounds:ot,updateChange:rt}=m,{pushAllChildBranch:ht,pushAllParent:ct}=y;const{worldBounds:lt}=v;class dt{constructor(t){this.updatedBounds=new x,this.beforeBounds=new x,this.afterBounds=new x,S(t)&&(t=new f(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,lt)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,lt),this.updatedBounds.setList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.addList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllMatrix:ut,updateAllChange:ft}=m,gt=b.get("Layouter");class pt{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new k,this.target=t,e&&(this.config=a.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(this.layouting||!this.running)return;const{target:t}=this;this.times=0;try{t.emit(B.START),this.layoutOnce(),t.emitEvent(new B(B.END,this.layoutedBlocks,this.times))}catch(t){gt.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?gt.warn("layouting"):this.times>3?gt.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(_.REQUEST),this.totalTimes>1?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const e=R.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:n,LAYOUT:a,AFTER:o}=B,r=this.getBlocks(s);r.forEach(t=>t.setBefore()),i.emitEvent(new B(n,r,this.times)),this.extraBlock=null,s.sort(),function(t,e){let i;t.list.forEach(t=>{i=t.__layout,e.without(t)&&!i.proxyZoom&&(i.matrixChanged?(at(t,!0),e.add(t),t.isBranch&&ht(t,e),ct(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),ct(t,e)))})}(s,this.__levelList),function(t){let e,i,s;t.sort(!0),t.levels.forEach(n=>{e=t.levelMap[n];for(let t=0,n=e.length;t<n;t++){if(i=e[t],i.isBranch&&i.__tempNumber){s=i.children;for(let t=0,e=s.length;t<e;t++)s[t].isBranch||ot(s[t])}ot(i)}})}(this.__levelList),function(t){t.list.forEach(rt)}(s),this.extraBlock&&r.push(this.extraBlock),r.forEach(t=>t.setAfter()),i.emitEvent(new B(a,r,this.times)),i.emitEvent(new B(o,r,this.times)),this.addBlocks(r),this.__levelList.reset(),this.__updatedList=null,R.end(e)}fullLayout(){const t=R.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:n}=B,a=this.getBlocks(new f(e));e.emitEvent(new B(i,a,this.times)),pt.fullLayout(e),a.forEach(t=>{t.setAfter()}),e.emitEvent(new B(s,a,this.times)),e.emitEvent(new B(n,a,this.times)),this.addBlocks(a),R.end(t)}static fullLayout(t){ut(t,!0),t.isBranch?y.updateBounds(t):m.updateBounds(t),ft(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new dt([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new dt(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){this.__eventIds=[this.target.on_([[B.REQUEST,this.layout,this],[B.AGAIN,this.layoutAgain,this],[_.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const _t=b.get("Renderer");class wt{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=e,i&&(this.config=a.default(i,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.__requestRender()}requestLayout(){this.target.emit(B.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(g.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(g.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(g.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new x,_t.log(e.innerName,"---\x3e");try{this.emitRender(g.START),this.renderOnce(t),this.emitRender(g.END,this.totalBounds),T.clearRecycled()}catch(t){this.rendering=!1,_t.error(t)}_t.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return _t.warn("rendering");if(this.times>3)return _t.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new x,this.renderOptions={},t)this.emitRender(g.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(g.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(g.RENDER,this.renderBounds,this.renderOptions),this.emitRender(g.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,this.waitAgain&&(this.waitAgain=!1,this.renderOnce())}partRender(){const{canvas:t,updateBlocks:e}=this;e&&(this.mergeBlocks(),e.forEach(e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(t){const e=R.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),n=new x(s);i.save(),s.spread(wt.clipSpread).ceil(),i.clearWorld(s),i.clipWorld(s),this.__render(s,n),i.restore(),R.end(e)}fullRender(){const t=R.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),R.end(t)}__render(t,e){const{canvas:s}=this,n=t.includes(this.target.__world),a=n?{includes:n}:{bounds:t,includes:n};this.needFill&&s.fillWorld(t,this.config.fill),b.showRepaint&&b.drawRepaint(s,t),i.render(this.target,s,a),this.renderBounds=e=e||t,this.renderOptions=a,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),s.updateRender(e)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new x;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const t=this.target;if(this.requestTime||!t)return;if(t.parentApp)return t.parentApp.requestRender(!1);this.requestTime=this.frameTime||Date.now();const e=()=>{const t=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:s}=this.config;if(s&&t>s)return i.requestRender(e);const{frames:n}=this;n.length>30&&n.shift(),n.push(t),this.FPS=Math.round(n.reduce((t,e)=>t+e,0)/n.length),this.requestTime=0,this.checkRender()};i.requestRender(e)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new x(0,0,e,i).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new x(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;t.updatedList&&t.updatedList.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||_t.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(t,e,i){this.target.emitEvent(new g(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[g.REQUEST,this.update,this],[B.END,this.__onLayoutEnd,this],[g.AGAIN,this.renderAgain,this],[h.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}wt.clipSpread=10;const{hitRadiusPoint:mt}=E;class yt{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,n=i.ignoreHittable||!1,a=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new f(i.findList),i.findList||this.hitBranch(a.isBranchLeaf?{children:[a]}:a);const{list:o}=this.findList,r=this.getBestMatchLeaf(o,i.bottomList,n),h=n?this.getPath(r):this.getHitablePath(r);return this.clear(),s?{path:h,target:r,throughPath:o.length?this.getThroughPath(o):h}:{path:h,target:r}}hitPoint(t,e,i){return!!this.getByPoint(t,e,i).target}getBestMatchLeaf(t,e,i){const s=this.findList=new f;if(t.length){let e;const{x:n,y:a}=this.point,o={x:n,y:a,radiusX:0,radiusY:0};for(let n=0,a=t.length;n<a;n++)if(e=t[n],(i||m.worldHittable(e))&&(this.hitChild(e,o),s.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&m.hasParent(t,e))){s.reset();break}return s.list[0]}}if(e)for(let t=0,i=e.length;t<i;t++)if(this.hitChild(e[t].target,this.point,e[t].proxy),s.length)return s.list[0];return i?t[0]:t.find(t=>m.worldHittable(t))}getPath(t){const e=new f;for(;t;)e.add(t),t=t.parent;return this.target&&e.add(this.target),e}getHitablePath(t){const e=this.getPath(t&&t.hittable?t:null);let i,s=new f;for(let t=e.list.length-1;t>-1&&(i=e.list[t],i.__.hittable)&&(s.addAt(i,0),i.__.hitChildren&&(!i.isLeafer||"draw"!==i.mode));t--);return s}getThroughPath(t){const e=new f,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,n,a;for(let t=0,o=i.length;t<o;t++){s=i[t],n=i[t+1];for(let t=0,i=s.length;t<i&&(a=s.list[t],!n||!n.has(a));t++)e.add(a)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s;const{point:n}=this;for(let a=t.length-1;a>-1;a--)i=t[a],!i.__.visible||e&&!i.__.mask||(s=!!i.__.hitRadius||mt(i.__world,n),i.isBranch?(s||i.__ignoreHitWorld)&&(i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,n)):s&&this.hitChild(i,n))}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:s}=t;if(s&&s.__hasMask&&!t.__.mask){let i,n=[];const{children:a}=s;for(let s=0,o=a.length;s<o;s++)if(i=a[s],i.__.mask&&n.push(i),i===t){if(n&&!n.every(t=>t.__hitWorld(e)))return;break}}this.findList.add(i||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class vt{constructor(t,e){this.config={},e&&(this.config=a.default(e,this.config)),this.picker=new yt(this.target=t,this),this.finder=l.finder&&l.finder()}getByPoint(t,e,s){const{target:n,picker:a}=this;return i.backgrounder&&n&&n.updateLayout(),a.getByPoint(t,e,s)}hitPoint(t,e,i){return this.picker.hitPoint(t,e,i)}getBy(t,e,i,s){return this.finder?this.finder.getBy(t,e,i,s):L.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}Object.assign(l,{watcher:(t,e)=>new nt(t,e),layouter:(t,e)=>new pt(t,e),renderer:(t,e,i)=>new wt(t,e,i),selector:(t,e)=>new vt(t,e)}),i.layout=pt.fullLayout,i.render=function(t,e,i){const s=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new f,t.__render(e,i),i.topList.length&&i.topList.forEach(t=>t.__render(e,s))};const xt={convertTouch(t,e){const i=xt.getTouch(t),s=Y.getBase(t);return Object.assign(Object.assign({},s),{x:e.x,y:e.y,width:1,height:1,pointerType:"touch",multiTouch:t.touches.length>1,pressure:i.force||1})},getTouch:t=>t.touches[0]||t.changedTouches[0]};class St extends X{__listenEvents(){super.__listenEvents(),this.config.eventer&&(this.config.eventer.receiveEvent=this.receive.bind(this))}receive(t){switch(t.type){case"touchstart":this.onTouchStart(t);break;case"touchmove":this.onTouchMove(t);break;case"touchend":this.onTouchEnd(t);break;case"touchcancel":this.onTouchCancel()}}getLocal(t,e){return j(t.x)?super.getLocal(t,e):{x:t.x,y:t.y}}getTouches(t){return t}onTouchStart(t){this.multiTouchStart(t);const e=xt.getTouch(t);this.pointerDown(xt.convertTouch(t,this.getLocal(e,!0)))}onTouchMove(t){if(this.multiTouchMove(t),this.useMultiTouch)return;const e=xt.getTouch(t);this.pointerMove(xt.convertTouch(t,this.getLocal(e)))}onTouchEnd(t){this.multiTouchEnd();const e=xt.getTouch(t);this.pointerUp(xt.convertTouch(t,this.getLocal(e)))}onTouchCancel(){this.pointerCancel()}multiTouchStart(t){this.useMultiTouch=t.touches.length>1,this.touches=this.useMultiTouch?this.getTouches(t.touches):void 0,this.useMultiTouch&&this.pointerCancel()}multiTouchMove(t){if(this.useMultiTouch&&t.touches.length>1){const e=this.getTouches(t.touches),i=this.getKeepTouchList(this.touches,e);i.length>1&&(this.multiTouch(Y.getBase(t),i),this.touches=e)}}multiTouchEnd(){this.touches=null,this.useMultiTouch=!1,this.transformEnd()}getKeepTouchList(t,e){let i;const s=[];return t.forEach(t=>{i=e.find(e=>e.identifier===t.identifier),i&&s.push({from:this.getLocal(t),to:this.getLocal(i)})}),s}getLocalTouchs(t){return t.map(t=>this.getLocal(t))}destroy(){super.destroy(),this.touches=null}}function bt(t,e){const i=t.__,{rows:s,decorationY:n}=i.__textDrawData;let a;i.__isPlacehold&&i.placeholderColor&&(e.fillStyle=i.placeholderColor);for(let t=0,i=s.length;t<i;t++)a=s[t],a.text?e.fillText(a.text,a.x,a.y):a.data&&a.data.forEach(t=>{e.fillText(t.char,t.x,a.y)});if(n){const{decorationColor:t,decorationHeight:a}=i.__textDrawData;t&&(e.fillStyle=t),s.forEach(t=>n.forEach(i=>e.fillRect(t.x,t.y+i,t.width,a)))}}function kt(t,e){t.__.__font?bt(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function Bt(t,e,i){switch(e.__.strokeAlign){case"center":Rt(t,1,e,i);break;case"inside":Tt(t,"inside",e,i);break;case"outside":e.__.__fillAfterStroke?Rt(t,2,e,i):Tt(t,"outside",e,i)}}function Rt(t,e,i,s){const n=i.__;A(t)?Lt(t,e,!0,i,s):(s.setStroke(t,n.__strokeWidth*e,n),Et(i,s))}function Tt(t,e,i,s){const n=s.getSameCanvas(!0,!0);n.font=i.__.__font,Rt(t,2,i,n),n.blendMode="outside"===e?"destination-out":"destination-in",bt(i,n),n.blendMode="normal",m.copyCanvasByWorld(i,s,n),n.recycle(i.__nowWorld)}function Et(t,e){let i,s=t.__.__textDrawData;const{rows:n,decorationY:a}=s;for(let t=0,s=n.length;t<s;t++)i=n[t],i.text?e.strokeText(i.text,i.x,i.y):i.data&&i.data.forEach(t=>{e.strokeText(t.char,t.x,i.y)});if(a){const{decorationHeight:t}=s;n.forEach(i=>a.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}}function Lt(t,e,i,s,n){let a;const o=s.__,{__hasMultiStrokeStyle:r}=o;r||n.setStroke(void 0,o.__strokeWidth*e,o);for(let h=0,c=t.length;h<c;h++)if(a=t[h],(!a.image||!N.checkImage(s,n,a,!1))&&a.style){if(r){const{strokeStyle:t}=a;t?n.setStroke(a.style,o.__getRealStrokeWidth(t)*e,o,t):n.setStroke(a.style,o.__strokeWidth*e,o)}else n.strokeStyle=a.style;a.blendMode?(n.saveBlendMode(a.blendMode),i?Et(s,n):n.stroke(),n.restoreBlendMode()):i?Et(s,n):n.stroke()}}function At(t,e,i){const s=e.__;if(s.__strokeWidth)if(s.__font)Bt(t,e,i);else switch(s.strokeAlign){case"center":Ct(t,1,e,i);break;case"inside":!function(t,e,i){i.save(),i.clipUI(e),Ct(t,2,e,i),i.restore()}(t,e,i);break;case"outside":!function(t,e,i){const s=e.__;if(s.__fillAfterStroke)Ct(t,2,e,i);else{const{renderBounds:n}=e.__layout,a=i.getSameCanvas(!0,!0);e.__drawRenderPath(a),Ct(t,2,e,a),a.clipUI(s),a.clearWorld(n),m.copyCanvasByWorld(e,i,a),a.recycle(e.__nowWorld)}}(t,e,i)}}function Ct(t,e,i,s){const n=i.__;A(t)?Lt(t,e,!1,i,s):(s.setStroke(t,n.__strokeWidth*e,n),s.stroke()),n.__useArrow&&q.strokeArrow(t,i,s)}const{getSpread:Pt,copyAndSpread:Mt,toOuterOf:Ot,getOuterOf:Wt,getByMove:Dt,move:It,getIntersectData:zt}=E,Ft={};let Ut;const{stintSet:Yt}=a,{hasTransparent:Xt}=H;function jt(t,i,s){if(!A(i)||!1===i.visible||0===i.opacity)return;let n;const{boxBounds:a}=s.__layout;switch(i.type){case"image":n=N.image(s,t,i,a,!Ut||!Ut[i.url]);break;case"linear":n=V.linearGradient(i,a);break;case"radial":n=V.radialGradient(i,a);break;case"angular":n=V.conicGradient(i,a);break;case"solid":const{type:e,color:o,opacity:h}=i;n={type:e,style:H.string(o,h)};break;default:r(i.r)||(n={type:"solid",style:H.string(i)})}if(n){if(e(n.style)&&Xt(n.style)&&(n.isTransparent=!0),i.style){if(0===i.style.strokeWidth)return;n.strokeStyle=i.style}i.editing&&(n.editing=i.editing),i.blendMode&&(n.blendMode=i.blendMode)}return n}const Gt={compute:function(t,e){const i=e.__,s=[];let n,a,o,r=i.__input[t];S(r)||(r=[r]),Ut=N.recycleImage(t,i);for(let i,n=0,a=r.length;n<a;n++)(i=jt(t,r[n],e))&&(s.push(i),i.strokeStyle&&(o||(o=1),i.strokeStyle.strokeWidth&&(o=Math.max(o,i.strokeStyle.strokeWidth))));i["_"+t]=s.length?s:void 0,s.length&&s.every(t=>t.isTransparent)&&(s.some(t=>t.image)&&(n=!0),a=!0),"fill"===t?(Yt(i,"__isAlphaPixelFill",n),Yt(i,"__isTransparentFill",a)):(Yt(i,"__isAlphaPixelStroke",n),Yt(i,"__isTransparentStroke",a),Yt(i,"__hasMultiStrokeStyle",o))},fill:function(t,e,i){i.fillStyle=t,kt(e,i)},fills:function(t,e,i){let s;for(let n=0,a=t.length;n<a;n++){if(s=t[n],s.image){if(N.checkImage(e,i,s,!e.__.__font))continue;if(!s.style){!n&&s.image.isPlacehold&&e.drawImagePlaceholder(i,s.image);continue}}if(i.fillStyle=s.style,s.transform||s.scaleFixed){if(i.save(),s.transform&&i.transform(s.transform),s.scaleFixed){const{scaleX:t,scaleY:n}=e.getRenderScaleData(!0);(!0===s.scaleFixed||"zoom-in"===s.scaleFixed&&t>1&&n>1)&&i.scale(1/t,1/n)}s.blendMode&&(i.blendMode=s.blendMode),kt(e,i),i.restore()}else s.blendMode?(i.saveBlendMode(s.blendMode),kt(e,i),i.restoreBlendMode()):kt(e,i)}},fillPathOrText:kt,fillText:bt,stroke:At,strokes:function(t,e,i){At(t,e,i)},strokeText:Bt,drawTextStroke:Et,shape:function(t,e,s){const n=e.getSameCanvas(),a=e.bounds,o=t.__nowWorld,r=t.__layout,h=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let c,l,d,u,f,g;Ot(r.strokeSpread?(Mt(Ft,r.boxBounds,r.strokeSpread),Ft):r.boxBounds,o,h);let{scaleX:p,scaleY:_}=t.getRenderScaleData(!0);if(a.includes(h))g=n,c=f=h,l=o;else{let n;if(i.fullImageShadow)n=h;else{const t=r.renderShapeSpread?Pt(a,C.swapAndScale(r.renderShapeSpread,p,_)):a;n=zt(t,h)}u=a.getFitMatrix(n);let{a:w,d:m}=u;u.a<1&&(g=e.getSameCanvas(),t.__renderShape(g,s),p*=w,_*=m),f=Wt(h,u),c=Dt(f,-u.e,-u.f),l=Wt(o,u),It(l,-u.e,-u.f);const y=s.matrix;y?(d=new P(u),d.multiply(y),w*=y.scaleX,m*=y.scaleY):d=u,d.withScale(w,m),s=Object.assign(Object.assign({},s),{matrix:d})}return t.__renderShape(n,s),{canvas:n,matrix:d,fitMatrix:u,bounds:c,renderBounds:l,worldCanvas:g,shapeBounds:f,scaleX:p,scaleY:_}}};let Nt={},qt=M();const{get:Ht,rotateOfOuter:Vt,translate:Qt,scaleOfOuter:Kt,multiplyParent:Zt,scale:$t,rotate:Jt,skew:te}=O;function ee(t,e,i,s,n,a,o){const r=Ht();Qt(r,e.x+i,e.y+s),$t(r,n,a),o&&Vt(r,{x:e.x+e.width/2,y:e.y+e.height/2},o),t.transform=r}function ie(t,e,i,s,n,a,o,r,h,c){const l=Ht();ne(l,e,i,s,n,a,o,r),h&&(qt.a=h,qt.d=c,Zt(l,qt)),t.transform=l}function se(t,e,i,s,n,a,o,r,h,c,l,d){const u=Ht();if(d)ne(u,e,n,a,o,r,h,c);else{if(h)if("center"===l)Vt(u,{x:i/2,y:s/2},h);else switch(Jt(u,h),h){case 90:Qt(u,s,0);break;case 180:Qt(u,i,s);break;case 270:Qt(u,0,i)}Nt.x=e.x+n,Nt.y=e.y+a,Qt(u,Nt.x,Nt.y),o&&Kt(u,Nt,o,r)}t.transform=u}function ne(t,e,i,s,n,a,o,r){o&&Jt(t,o),r&&te(t,r.x,r.y),n&&$t(t,n,a),Qt(t,e.x+i,e.y+s)}const{get:ae,translate:oe}=O,re=new x,he={},ce={};function le(t,e,i,s){const{changeful:n,sync:a,scaleFixed:o}=i;n&&(t.changeful=n),a&&(t.sync=a),o&&(t.scaleFixed=o),t.data=de(i,s,e)}function de(t,i,s){t.padding&&(i=re.set(i).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");let{width:n,height:a}=s;const{opacity:o,mode:r,align:h,offset:c,scale:l,size:d,rotation:u,skew:f,clipSize:g,repeat:p,gap:_,filters:w}=t,m=i.width===n&&i.height===a,y={mode:r},v="center"!==h&&(u||0)%180==90;let x,S;switch(E.set(ce,0,0,v?a:n,v?n:a),r&&"cover"!==r&&"fit"!==r?((l||d)&&(W.getScaleData(l,d,s,he),x=he.scaleX,S=he.scaleY),(h||_||p)&&(x&&E.scale(ce,x,S,!0),h&&D.toPoint(h,ce,i,ce,!0,!0))):m&&!u||(x=S=E.getFitScale(i,ce,"fit"!==r),E.put(i,s,h,x,!1,ce),E.scale(ce,x,S,!0)),c&&I.move(ce,c),r){case"stretch":m||(n=i.width,a=i.height);break;case"normal":case"clip":if(ce.x||ce.y||x||g||u||f){let t,e;g&&(t=i.width/g.width,e=i.height/g.height),ie(y,i,ce.x,ce.y,x,S,u,f,t,e),t&&(x=x?x*t:x,S=S?S*e:e)}break;case"repeat":(!m||x||u||f)&&se(y,i,n,a,ce.x,ce.y,x,S,u,f,h,t.freeTransform),p||(y.repeat="repeat");const e=A(p);(_||e)&&(y.gap=function(t,e,i,s,n){let a,o;A(t)?(a=t.x,o=t.y):a=o=t;return{x:ue(a,i,n.width,e&&e.x),y:ue(o,s,n.height,e&&e.y)}}(_,e&&p,ce.width,ce.height,i));break;default:x&&ee(y,i,ce.x,ce.y,x,S,u)}return y.transform||(i.x||i.y)&&(y.transform=ae(),oe(y.transform,i.x,i.y)),x&&"stretch"!==r&&(y.scaleX=x,y.scaleY=S),y.width=n,y.height=a,o&&(y.opacity=o),w&&(y.filters=w),p&&(y.repeat=e(p)?"x"===p?"repeat-x":"repeat-y":"repeat"),y}function ue(t,i,s,n){const a=e(t)||n?(n?s-n*i:s%i)/((n||Math.floor(s/i))-1):t;return"auto"===t&&a<0?0:a}let fe,ge=new x;const{isSame:pe}=E;function _e(t,e,i,s,n,a){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=s.width/e.pixelRatio,e.__naturalHeight=s.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return n.data||le(n,s,i,a),!0}function we(t,e){ve(t,z.LOAD,e)}function me(t,e){ve(t,z.LOADED,e)}function ye(t,e,i){e.error=i,t.forceUpdate("surface"),ve(t,z.ERROR,e)}function ve(t,e,i){t.hasEvent(e)&&t.emitEvent(new z(e,i))}function xe(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:Se,scale:be,copy:ke}=O,{floor:Be,ceil:Re,max:Te,abs:Ee}=Math;function Le(t,e,s){let{scaleX:n,scaleY:a}=t.getRenderScaleData(!0,e.scaleFixed);const o=n+"-"+a+"-"+s;if(e.patternId===o||t.destroyed)return!1;{const{image:r,data:h}=e;let c,l,{width:d,height:u,scaleX:f,scaleY:g,transform:p,repeat:_,gap:w}=h;n*=s,a*=s,f&&(f=Ee(f),g=Ee(g),l=Se(),ke(l,p),be(l,1/f,1/g),n*=f,a*=g),d*=n,u*=a;const m=d*u;if(!_&&m>i.image.maxCacheSize)return!1;let y=i.image.maxPatternSize;if(r.isSVG){const t=d/r.width;t>1&&(c=t/Re(t))}else{const t=r.width*r.height;y>t&&(y=t)}m>y&&(c=Math.sqrt(m/y)),c&&(n/=c,a/=c,d/=c,u/=c),f&&(n/=f,a/=g);const v=w&&w.x*n,x=w&&w.y*a;if(p||1!==n||1!==a){const t=d+(v||0),e=u+(x||0);n/=t/Te(Be(t),1),a/=e/Te(Be(e),1),l||(l=Se(),p&&ke(l,p)),be(l,1/n,1/a)}const S=r.getCanvas(d,u,h.opacity,h.filters,v,x,t.leafer&&t.leafer.config.smooth),b=r.getPattern(S,_||i.origin.noRepeat||"no-repeat",l,e);return e.style=b,e.patternId=o,!0}}function Ae(t,e,i,s){return new(i||(i=Promise))(function(n,a){function o(t){try{h(s.next(t))}catch(t){a(t)}}function r(t){try{h(s.throw(t))}catch(t){a(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(o,r)}h((s=s.apply(t,e||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const Ce={image:function(t,e,i,s,n){let a,o;const r=T.get(i);return fe&&i===fe.paint&&pe(s,fe.boxBounds)?a=fe.leafPaint:(a={type:i.type,image:r},r.hasAlphaPixel&&(a.isTransparent=!0),fe=r.use>1?{leafPaint:a,paint:i,boxBounds:ge.set(s)}:null),(n||r.loading)&&(o={image:r,attrName:e,attrValue:i}),r.ready?(_e(t,e,i,r,a,s),n&&(we(t,o),me(t,o))):r.error?n&&ye(t,o,r.error):(n&&(xe(t,!0),we(t,o)),a.loadId=r.load(()=>{xe(t,!1),t.destroyed||(_e(t,e,i,r,a,s)&&(r.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),me(t,o)),a.loadId=void 0},e=>{xe(t,!1),ye(t,o,e),a.loadId=void 0}),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{r.ready||(r.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):r.isPlacehold=!0)),a},checkImage:function(t,e,s,n){const{scaleX:a,scaleY:o}=t.getRenderScaleData(!0,s.scaleFixed),{pixelRatio:r}=e,{data:c}=s;if(!c||s.patternId===a+"-"+o+"-"+r&&!Q.running)return!1;if(n)if(c.repeat)n=!1;else if(!(s.changeful||"miniapp"===i.name&&h.isResizing(t)||Q.running)){let{width:t,height:e}=c;t*=a*r,e*=o*r,c.scaleX&&(t*=c.scaleX,e*=c.scaleY),n=t*e>i.image.maxCacheSize}return n?(t.__.__isFastShadow&&(e.fillStyle=s.style||"#000",e.fill()),function(t,e,i,s){e.save(),e.clipUI(t),i.blendMode&&(e.blendMode=i.blendMode);s.opacity&&(e.opacity*=s.opacity);s.transform&&e.transform(s.transform);e.drawImage(i.image.getFull(s.filters),0,0,s.width,s.height),e.restore()}(t,e,s,c),!0):(!s.style||s.sync||Q.running?Le(t,s,r):s.patternTask||(s.patternTask=T.patternTasker.add(()=>Ae(this,void 0,void 0,function*(){s.patternTask=null,e.bounds.hit(t.__nowWorld)&&Le(t,s,r),t.forceUpdate("surface")}),300)),!1)},createPattern:Le,recycleImage:function(t,e){const i=e["_"+t];if(S(i)){let s,n,a,o,r;for(let h=0,c=i.length;h<c;h++)s=i[h],n=s.image,r=n&&n.url,r&&(a||(a={}),a[r]=!0,T.recycle(n),n.loading&&(o||(o=e.__input&&e.__input[t]||[],S(o)||(o=[o])),n.unload(i[h].loadId,!o.some(t=>t.url===r))));return a}return null},createData:le,getPatternData:de,fillOrFitMode:ee,clipMode:ie,repeatMode:se},{toPoint:Pe}=F,{hasTransparent:Me}=H,Oe={},We={};function De(t,i,s,n){if(s){let a,o,r,h;for(let t=0,c=s.length;t<c;t++)a=s[t],e(a)?(r=t/(c-1),o=H.string(a,n)):(r=a.offset,o=H.string(a.color,n)),i.addColorStop(r,o),!h&&Me(o)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:Ie,getDistance:ze}=I,{get:Fe,rotateOfOuter:Ue,scaleOfOuter:Ye}=O,{toPoint:Xe}=F,je={},Ge={};function Ne(t,e,i,s,n){let a;const{width:o,height:r}=t;if(o!==r||s){const t=Ie(e,i);a=Fe(),n?(Ye(a,e,o/r*(s||1),1),Ue(a,e,t+90)):(Ye(a,e,1,o/r*(s||1)),Ue(a,e,t))}return a}const{getDistance:qe}=I,{toPoint:He}=F,Ve={},Qe={};const Ke={linearGradient:function(t,e){let{from:s,to:n,type:a,opacity:o}=t;Pe(s||"top",e,Oe),Pe(n||"bottom",e,We);const r=i.canvas.createLinearGradient(Oe.x,Oe.y,We.x,We.y),h={type:a,style:r};return De(h,r,t.stops,o),h},radialGradient:function(t,e){let{from:s,to:n,type:a,opacity:o,stretch:r}=t;Xe(s||"center",e,je),Xe(n||"bottom",e,Ge);const h=i.canvas.createRadialGradient(je.x,je.y,0,je.x,je.y,ze(je,Ge)),c={type:a,style:h};De(c,h,t.stops,o);const l=Ne(e,je,Ge,r,!0);return l&&(c.transform=l),c},conicGradient:function(t,e){let{from:s,to:n,type:a,opacity:o,stretch:r}=t;He(s||"center",e,Ve),He(n||"bottom",e,Qe);const h=i.conicGradientSupport?i.canvas.createConicGradient(0,Ve.x,Ve.y):i.canvas.createRadialGradient(Ve.x,Ve.y,0,Ve.x,Ve.y,qe(Ve,Qe)),c={type:a,style:h};De(c,h,t.stops,o);const l=Ne(e,Ve,Qe,r||1,i.conicGradientRotate90);return l&&(c.transform=l),c},getTransform:Ne},{copy:Ze,move:$e,toOffsetOutBounds:Je}=E,{max:ti}=Math,ei={},ii=new P,si={};function ni(t,e){let i,s,n,a,o=0,r=0,h=0,c=0;return e.forEach(t=>{i=t.x||0,s=t.y||0,n=t.spread||0,a=1.5*(t.blur||0),o=ti(o,n+a-s),r=ti(r,n+a+i),h=ti(h,n+a+s),c=ti(c,n+a-i)}),o===r&&r===h&&h===c?o:[o,r,h,c]}function ai(t,e,i,s,n,a,o){if(s.spread){const i=1+2*s.spread/t.__layout.strokeBounds.width*a*(o?-1:1);return ii.set().scaleOfOuter({x:(n.x+n.width/2)*e.pixelRatio,y:(n.y+n.height/2)*e.pixelRatio},i),ii}}function oi(t,e,s){const{shapeBounds:n}=s;let a,o;i.fullImageShadow?(Ze(ei,t.bounds),$e(ei,e.x-n.x,e.y-n.y),a=t.bounds,o=ei):(a=n,o=e),t.copyWorld(s.canvas,a,o)}const{toOffsetOutBounds:ri}=E,hi={};const ci=ni;const li={shadow:function(t,e,i){let s,n;const{__nowWorld:a}=t,{shadow:o}=t.__,{worldCanvas:r,bounds:h,renderBounds:c,shapeBounds:l,scaleX:d,scaleY:u}=i,f=e.getSameCanvas(),g=o.length-1;Je(h,si,c),o.forEach((o,p)=>{let _=1;if(o.scaleFixed){const t=Math.abs(a.scaleX);t>1&&(_=1/t)}f.setWorldShadow(si.offsetX+o.x*d*_,si.offsetY+o.y*u*_,o.blur*d*_,H.string(o.color)),n=ai(t,f,i,o,si,_),n&&f.setTransform(n),oi(f,si,i),n&&f.resetTransform(),s=c,o.box&&(f.restore(),f.save(),r&&(f.copyWorld(f,c,a,"copy"),s=a),r?f.copyWorld(r,a,a,"destination-out"):f.copyWorld(i.canvas,l,h,"destination-out")),m.copyCanvasByWorld(t,e,f,s,o.blendMode),g&&p<g&&f.clearWorld(s)}),f.recycle(s)},innerShadow:function(t,e,i){let s,n;const{__nowWorld:a}=t,{innerShadow:o}=t.__,{worldCanvas:r,bounds:h,renderBounds:c,shapeBounds:l,scaleX:d,scaleY:u}=i,f=e.getSameCanvas(),g=o.length-1;ri(h,hi,c),o.forEach((o,p)=>{let _=1;if(o.scaleFixed){const t=Math.abs(a.scaleX);t>1&&(_=1/t)}f.save(),f.setWorldShadow(hi.offsetX+o.x*d*_,hi.offsetY+o.y*u*_,o.blur*d*_),n=ai(t,f,0,o,hi,_,!0),n&&f.setTransform(n),oi(f,hi,i),f.restore(),r?(f.copyWorld(f,c,a,"copy"),f.copyWorld(r,a,a,"source-out"),s=a):(f.copyWorld(i.canvas,l,h,"source-out"),s=c),f.fillWorld(s,H.string(o.color),"source-in"),m.copyCanvasByWorld(t,e,f,s,o.blendMode),g&&p<g&&f.clearWorld(s)}),f.recycle(s)},blur:function(t,e,i){const{blur:s}=t.__;i.setWorldBlur(s*t.__nowWorld.a),i.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),i.filter="none"},backgroundBlur:function(t,e,i){},getShadowRenderSpread:ni,getShadowTransform:ai,isTransformShadow(t){},getInnerShadowSpread:ci},{excludeRenderBounds:di}=v;let ui;function fi(t,e,i,s,n,a,o,r){switch(e){case"grayscale":ui||(ui=!0,n.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,n,a){const o=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,o),a&&s.recycle(o);pi(t,e,i,1,n,a)}(t,i,s,n,o,r);break;case"opacity-path":pi(t,i,s,a,o,r);break;case"path":r&&i.restore()}}function gi(t){return t.getSameCanvas(!1,!0)}function pi(t,e,i,s,n,a){const o=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,o,void 0,n),a?i.recycle(o):i.clearWorld(o)}K.prototype.__renderMask=function(t,e){let i,s,n,a,o,r;const{children:h}=this;for(let c=0,l=h.length;c<l;c++){if(i=h[c],r=i.__.mask,r){o&&(fi(this,o,t,n,s,a,void 0,!0),s=n=null),"clipping"!==r&&"clipping-path"!==r||di(i,e)||i.__render(t,e),a=i.__.opacity,ui=!1,"path"===r||"clipping-path"===r?(a<1?(o="opacity-path",n||(n=gi(t))):(o="path",t.save()),i.__clip(n||t,e)):(o="grayscale"===r?"grayscale":"alpha",s||(s=gi(t)),n||(n=gi(t)),i.__render(s,e));continue}const l=1===a&&i.__.__blendMode;l&&fi(this,o,t,n,s,a,void 0,!1),di(i,e)||i.__render(n||t,e),l&&fi(this,o,t,n,s,a,l,!1)}fi(this,o,t,n,s,a,void 0,!0)};const _i=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",wi=_i+"_#~&*+\\=|≮≯≈≠=…",mi=new RegExp([[19968,40959],[13312,19903],[131072,173791],[173824,177983],[177984,178207],[178208,183983],[183984,191471],[196608,201551],[201552,205743],[11904,12031],[12032,12255],[12272,12287],[12288,12351],[12736,12783],[12800,13055],[13056,13311],[63744,64255],[65072,65103],[127488,127743],[194560,195103]].map(([t,e])=>`[\\u${t.toString(16)}-\\u${e.toString(16)}]`).join("|"));function yi(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const vi=yi("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),xi=yi("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Si=yi(_i),bi=yi(wi),ki=yi("- —/~|┆·");var Bi;!function(t){t[t.Letter=0]="Letter",t[t.Single=1]="Single",t[t.Before=2]="Before",t[t.After=3]="After",t[t.Symbol=4]="Symbol",t[t.Break=5]="Break"}(Bi||(Bi={}));const{Letter:Ri,Single:Ti,Before:Ei,After:Li,Symbol:Ai,Break:Ci}=Bi;function Pi(t){return vi[t]?Ri:ki[t]?Ci:xi[t]?Ei:Si[t]?Li:bi[t]?Ai:mi.test(t)?Ti:Ri}const Mi={trimRight(t){const{words:e}=t;let i,s=0,n=e.length;for(let a=n-1;a>-1&&(i=e[a].data[0]," "===i.char);a--)s++,t.width-=i.width;s&&e.splice(n-s,s)}};function Oi(t,e,i){switch(e){case"title":return i?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:Wi}=Mi,{Letter:Di,Single:Ii,Before:zi,After:Fi,Symbol:Ui,Break:Yi}=Bi;let Xi,ji,Gi,Ni,qi,Hi,Vi,Qi,Ki,Zi,$i,Ji,ts,es,is,ss,ns,as=[];function os(t,e){Ki&&!Qi&&(Qi=Ki),Xi.data.push({char:t,width:e}),Gi+=e}function rs(){Ni+=Gi,Xi.width=Gi,ji.words.push(Xi),Xi={data:[]},Gi=0}function hs(){es&&(is.paraNumber++,ji.paraStart=!0,es=!1),Ki&&(ji.startCharSize=Qi,ji.endCharSize=Ki,Qi=0),ji.width=Ni,ss.width?Wi(ji):ns&&cs(),as.push(ji),ji={words:[]},Ni=0}function cs(){Ni>(is.maxWidth||0)&&(is.maxWidth=Ni)}const{top:ls,right:ds,bottom:us,left:fs}=U;function gs(t,e,i){const{bounds:s,rows:n}=t;s[e]+=i;for(let t=0;t<n.length;t++)n[t][e]+=i}const ps={getDrawData:function(t,s){e(t)||(t=String(t));let n=0,a=0,o=s.__getInput("width")||0,r=s.__getInput("height")||0;const{textDecoration:h,__font:c,__padding:l}=s;l&&(o?(n=l[fs],o-=l[ds]+l[fs]):s.autoSizeAlign||(n=l[fs]),r?(a=l[ls],r-=l[ls]+l[us]):s.autoSizeAlign||(a=l[ls]));const d={bounds:{x:n,y:a,width:o,height:r},rows:[],paraNumber:0,font:i.canvas.font=c};return function(t,e,s){is=t,as=t.rows,ss=t.bounds,ns=!ss.width&&!s.autoSizeAlign;const{__letterSpacing:n,paraIndent:a,textCase:o}=s,{canvas:r}=i,{width:h,height:c}=ss;if(h||c||n||"none"!==o){const t="none"!==s.textWrap,i="break"===s.textWrap;es=!0,$i=null,Qi=Vi=Ki=Gi=Ni=0,Xi={data:[]},ji={words:[]},n&&(e=[...e]);for(let s=0,c=e.length;s<c;s++)Hi=e[s],"\n"===Hi?(Gi&&rs(),ji.paraEnd=!0,hs(),es=!0):(Zi=Pi(Hi),Zi===Di&&"none"!==o&&(Hi=Oi(Hi,o,!Gi)),Vi=r.measureText(Hi).width,n&&(n<0&&(Ki=Vi),Vi+=n),Ji=Zi===Ii&&($i===Ii||$i===Di)||$i===Ii&&Zi!==Fi,ts=!(Zi!==zi&&Zi!==Ii||$i!==Ui&&$i!==Fi),qi=es&&a?h-a:h,t&&h&&Ni+Gi+Vi>qi&&(i?(Gi&&rs(),Ni&&hs()):(ts||(ts=Zi===Di&&$i==Fi),Ji||ts||Zi===Yi||Zi===zi||Zi===Ii||Gi+Vi>qi?(Gi&&rs(),Ni&&hs()):Ni&&hs()))," "===Hi&&!0!==es&&Ni+Gi===0||(Zi===Yi?(" "===Hi&&Gi&&rs(),os(Hi,Vi),rs()):Ji||ts?(Gi&&rs(),os(Hi,Vi)):os(Hi,Vi)),$i=Zi);Gi&&rs(),Ni&&hs(),as.length>0&&(as[as.length-1].paraEnd=!0)}else e.split("\n").forEach(t=>{is.paraNumber++,Ni=r.measureText(t).width,as.push({x:a||0,text:t,width:Ni,paraStart:!0}),ns&&cs()})}(d,t,s),l&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":gs(e,"x",t[fs]);break;case"right":gs(e,"x",-t[ds])}if(!n&&i.autoSizeAlign)switch(i.verticalAlign){case"top":gs(e,"y",t[ls]);break;case"bottom":gs(e,"y",-t[us])}}(l,d,s,o,r),function(t,e){const{rows:i,bounds:s}=t,n=i.length,{__lineHeight:a,__baseLine:o,__letterSpacing:r,__clipText:h,textAlign:c,verticalAlign:l,paraSpacing:d,autoSizeAlign:u}=e;let{x:f,y:g,width:p,height:_}=s,w=a*n+(d?d*(t.paraNumber-1):0),m=o;if(h&&w>_)w=Math.max(_,a),n>1&&(t.overflow=n);else if(_||u)switch(l){case"middle":g+=(_-w)/2;break;case"bottom":g+=_-w}m+=g;let y,v,x,S=p||u?p:t.maxWidth;for(let o=0,l=n;o<l;o++){if(y=i[o],y.x=f,y.width<p||y.width>p&&!h)switch(c){case"center":y.x+=(S-y.width)/2;break;case"right":y.x+=S-y.width}y.paraStart&&d&&o>0&&(m+=d),y.y=m,m+=a,t.overflow>o&&m>w&&(y.isOverflow=!0,t.overflow=o+1),v=y.x,x=y.width,r<0&&(y.width<0?(x=-y.width+e.fontSize+r,v-=x,x+=e.fontSize):x-=r),v<s.x&&(s.x=v),x>s.width&&(s.width=x),h&&p&&p<x&&(y.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=g,s.height=w}(d,s),function(t,e,i){const{rows:s}=t,{textAlign:n,paraIndent:a,letterSpacing:o}=e;let r,h,c,l,d,u;s.forEach(t=>{t.words&&(c=a&&t.paraStart?a:0,u=t.words.length,h=i&&("justify"===n||"both"===n)&&u>1?(i-t.width-c)/(u-1):0,l=o||t.isOverflow?0:h>.01?1:2,t.isOverflow&&!o&&(t.textMode=!0),2===l?(t.x+=c,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=c,r=t.x,t.data=[],t.words.forEach((e,i)=>{1===l?(d={char:"",x:r},r=function(t,e,i){return t.forEach(t=>{i.char+=t.char,e+=t.width}),e}(e.data,r,d),(t.isOverflow||" "!==d.char)&&t.data.push(d)):r=function(t,e,i,s){return t.forEach(t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width}),e}(e.data,r,t.data,t.isOverflow),!h||t.paraEnd&&"both"!==n||i===u-1||(r+=h,t.width+=h)})),t.words=null)})}(d,s,o),d.overflow&&function(t,e,s,n){if(!n)return;const{rows:a,overflow:o}=t;let{textOverflow:r}=e;if(a.splice(o),r&&"show"!==r){let t,h;"hide"===r?r="":"ellipsis"===r&&(r="...");const c=r?i.canvas.measureText(r).width:0,l=s+n-c;("none"===e.textWrap?a:[a[o-1]]).forEach(e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let s=i;s>-1&&(t=e.data[s],h=t.x+t.width,!(s===i&&h<l));s--){if(h<l&&" "!==t.char||!s){e.data.splice(s+1),e.width-=t.width;break}e.width-=t.width}e.width+=c,e.data.push({char:r,x:h}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(d,s,n,o),"none"!==h&&function(t,e){let i,s=0;const{fontSize:n,textDecoration:a}=e;switch(t.decorationHeight=n/11,A(a)?(i=a.type,a.color&&(t.decorationColor=H.string(a.color)),a.offset&&(s=Math.min(.3*n,Math.max(a.offset,.15*-n)))):i=a,i){case"under":t.decorationY=[.15*n+s];break;case"delete":t.decorationY=[.35*-n];break;case"under-delete":t.decorationY=[.15*n+s,.35*-n]}}(d,s),d}};const _s={string:function(t,i){const n=s(i)&&i<1;if(e(t)){if(!n||!H.object)return t;t=H.object(t)}let a=r(t.a)?1:t.a;n&&(a*=i);const o=t.r+","+t.g+","+t.b;return 1===a?"rgb("+o+")":"rgba("+o+","+a+")"}};Object.assign(Z,ps),Object.assign(H,_s),Object.assign(q,Gt),Object.assign(N,Ce),Object.assign(V,Ke),Object.assign($,li),Object.assign(l,{interaction:(t,e,i,s)=>new St(t,e,i,s),hitCanvas:(t,e)=>new tt(t,e),hitCanvasManager:()=>new G}),J.prototype.receiveEvent=function(t){this.interaction&&this.interaction.receive(t)};try{wx&&st(0,wx)}catch(t){}export{St as Interaction,pt as Layouter,tt as LeaferCanvas,yt as Picker,wt as Renderer,vt as Selector,nt as Watcher,st as useCanvas};
|
|
1
|
+
import{LeaferCanvasBase as t,isString as e,Platform as i,isNumber as s,canvasPatch as n,DataHelper as a,canvasSizeAttrs as o,isUndefined as r,ResizeEvent as h,FileHelper as c,Creator as l,LeaferImage as d,defineKey as u,LeafList as f,RenderEvent as g,ChildEvent as p,WatchEvent as _,PropertyEvent as w,LeafHelper as m,BranchHelper as y,LeafBoundsHelper as v,Bounds as x,isArray as S,Debug as b,LeafLevelList as k,LayoutEvent as B,Run as T,ImageManager as R,BoundsHelper as E,Plugin as L,isObject as A,FourNumberHelper as C,Matrix as M,getMatrixData as P,MatrixHelper as O,MathHelper as W,AlignHelper as D,PointHelper as I,ImageEvent as z,AroundHelper as F,Direction4 as U}from"@leafer/core";export*from"@leafer/core";export{LeaferImage}from"@leafer/core";import{InteractionHelper as Y,InteractionBase as X,isUndefined as j,HitCanvasManager as G}from"@leafer-ui/core";export*from"@leafer-ui/core";import{PaintImage as N,Paint as q,ColorConvert as H,PaintGradient as V,Export as Q,Effect as K,Group as Z,TextConvert as $,Leafer as J}from"@leafer-ui/draw";class tt extends t{get allowBackgroundColor(){return!1}init(){const{config:t}=this;let s=t.view||t.canvas;s?(e(s)?("#"!==s[0]&&(s="#"+s),this.viewSelect=i.miniapp.select(s)):s.fields?this.viewSelect=s:this.initView(s),this.viewSelect&&i.miniapp.getSizeView(this.viewSelect).then(t=>{this.initView(t)})):this.initView()}initView(t){t?this.view=t.view||t:(t={},this.__createView()),this.view.getContext?this.__createContext():this.unrealCanvas();const{width:e,height:a,pixelRatio:o}=this.config,r={width:e||t.width,height:a||t.height,pixelRatio:o};this.resize(r),this.context&&(this.viewSelect&&(i.renderCanvas=this),this.context.roundRect&&(this.roundRect=function(t,e,i,n,a){this.context.roundRect(t,e,i,n,s(a)?[a]:a)}),n(this.context.__proto__))}__createView(){this.view=i.origin.createCanvas(1,1)}updateViewSize(){if(this.unreal)return;const{width:t,height:e,pixelRatio:i}=this;this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i)}updateClientBounds(t){this.viewSelect&&i.miniapp.getBounds(this.viewSelect).then(e=>{this.clientBounds=e,t&&t()})}startAutoLayout(t,e){this.resizeListener||(this.resizeListener=e,t&&(this.checkSize=this.checkSize.bind(this),i.miniapp.onWindowResize(this.checkSize)))}checkSize(){this.viewSelect&&setTimeout(()=>{this.updateClientBounds(()=>{const{width:t,height:e}=this.clientBounds,{pixelRatio:i}=this,s={width:t,height:e,pixelRatio:i};this.isSameSize(s)||this.emitResize(s)})},500)}stopAutoLayout(){this.autoLayout=!1,this.resizeListener=null,i.miniapp.offWindowResize(this.checkSize)}unrealCanvas(){this.unreal=!0}emitResize(t){const e={};a.copyAttrs(e,this,o),this.resize(t),r(this.width)||this.resizeListener(new h(t,e))}}const{mineType:et,fileType:it}=c;function st(t,e){i.origin={createCanvas:(t,i,s)=>{const n={type:"2d",width:t,height:i};return e.createOffscreenCanvas?e.createOffscreenCanvas(n):e.createOffScreenCanvas(n)},canvasToDataURL:(t,e,i)=>t.toDataURL(et(e),i),canvasToBolb:(t,e,i)=>t.toBuffer(e,{quality:i}),canvasSaveAs:(t,e,s)=>{let n=t.toDataURL(et(it(e)),s);return n=n.substring(n.indexOf("64,")+3),i.origin.download(n,e)},download:(t,s)=>new Promise((n,a)=>{let o;s.includes("/")||(s=`${e.env.USER_DATA_PATH}/`+s,o=!0);const r=e.getFileSystemManager();r.writeFile({filePath:s,data:t,encoding:"base64",success(){o?i.miniapp.saveToAlbum(s).then(()=>{r.unlink({filePath:s}),n()}):n()},fail(t){a(t)}})}),loadImage:t=>new Promise((e,s)=>{const n=i.canvas.view.createImage();n.onload=()=>{e(n)},n.onerror=t=>{s(t)},n.src=i.image.getRealURL(t)}),noRepeat:"repeat-x"},i.miniapp={select:t=>e.createSelectorQuery().select(t),getBounds:t=>new Promise(e=>{t.boundingClientRect().exec(t=>{const i=t[1];e({x:i.top,y:i.left,width:i.width,height:i.height})})}),getSizeView:t=>new Promise(e=>{t.fields({node:!0,size:!0}).exec(t=>{const i=t[0];e({view:i.node,width:i.width,height:i.height})})}),saveToAlbum:t=>new Promise(i=>{e.getSetting({success:s=>{s.authSetting["scope.writePhotosAlbum"]?e.saveImageToPhotosAlbum({filePath:t,success(){i(!0)}}):e.authorize({scope:"scope.writePhotosAlbum",success:()=>{e.saveImageToPhotosAlbum({filePath:t,success(){i(!0)}})},fail:()=>{}})}})}),onWindowResize(t){e.onWindowResize(t)},offWindowResize(t){e.offWindowResize(t)}},i.event={stopDefault(t){},stopNow(t){},stop(t){}},i.canvas=l.canvas(),i.conicGradientSupport=!!i.canvas.context.createConicGradient}Object.assign(l,{canvas:(t,e)=>new tt(t,e),image:t=>new d(t)}),i.name="miniapp",i.requestRender=function(t){const{view:e}=i.renderCanvas||i.canvas;e.requestAnimationFrame?e.requestAnimationFrame(t):setTimeout(t,16)},u(i,"devicePixelRatio",{get:()=>Math.max(1,wx.getWindowInfo?wx.getWindowInfo().pixelRatio:wx.getSystemInfoSync().pixelRatio)});class nt{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new f;return this.__updatedList.list.forEach(e=>{e.leafer&&t.add(e)}),t}return this.__updatedList}constructor(t,e){this.totalTimes=0,this.config={},this.__updatedList=new f,this.target=t,e&&(this.config=a.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(g.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===p.ADD?(this.hasAdd=!0,this.__pushChild(t.child)):(this.hasRemove=!0,this.__updatedList.add(t.parent)),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new _(_.DATA,{updatedList:this.updatedList})),this.__updatedList=new f,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[w.CHANGE,this.__onAttrChange,this],[[p.ADD,p.REMOVE],this.__onChildEvent,this],[_.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:at,updateBounds:ot,updateChange:rt}=m,{pushAllChildBranch:ht,pushAllParent:ct}=y;const{worldBounds:lt}=v;class dt{constructor(t){this.updatedBounds=new x,this.beforeBounds=new x,this.afterBounds=new x,S(t)&&(t=new f(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,lt)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,lt),this.updatedBounds.setList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.addList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllMatrix:ut,updateAllChange:ft}=m,gt=b.get("Layouter");class pt{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new k,this.target=t,e&&(this.config=a.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(this.layouting||!this.running)return;const{target:t}=this;this.times=0;try{t.emit(B.START),this.layoutOnce(),t.emitEvent(new B(B.END,this.layoutedBlocks,this.times))}catch(t){gt.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?gt.warn("layouting"):this.times>3?gt.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(_.REQUEST),this.totalTimes>1?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const e=T.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:n,LAYOUT:a,AFTER:o}=B,r=this.getBlocks(s);r.forEach(t=>t.setBefore()),i.emitEvent(new B(n,r,this.times)),this.extraBlock=null,s.sort(),function(t,e){let i;t.list.forEach(t=>{i=t.__layout,e.without(t)&&!i.proxyZoom&&(i.matrixChanged?(at(t,!0),e.add(t),t.isBranch&&ht(t,e),ct(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),ct(t,e)))})}(s,this.__levelList),function(t){let e,i,s;t.sort(!0),t.levels.forEach(n=>{e=t.levelMap[n];for(let t=0,n=e.length;t<n;t++){if(i=e[t],i.isBranch&&i.__tempNumber){s=i.children;for(let t=0,e=s.length;t<e;t++)s[t].isBranch||ot(s[t])}ot(i)}})}(this.__levelList),function(t){t.list.forEach(rt)}(s),this.extraBlock&&r.push(this.extraBlock),r.forEach(t=>t.setAfter()),i.emitEvent(new B(a,r,this.times)),i.emitEvent(new B(o,r,this.times)),this.addBlocks(r),this.__levelList.reset(),this.__updatedList=null,T.end(e)}fullLayout(){const t=T.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:n}=B,a=this.getBlocks(new f(e));e.emitEvent(new B(i,a,this.times)),pt.fullLayout(e),a.forEach(t=>{t.setAfter()}),e.emitEvent(new B(s,a,this.times)),e.emitEvent(new B(n,a,this.times)),this.addBlocks(a),T.end(t)}static fullLayout(t){ut(t,!0),t.isBranch?y.updateBounds(t):m.updateBounds(t),ft(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new dt([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new dt(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){this.__eventIds=[this.target.on_([[B.REQUEST,this.layout,this],[B.AGAIN,this.layoutAgain,this],[_.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const _t=b.get("Renderer");class wt{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=e,i&&(this.config=a.default(i,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.__requestRender()}requestLayout(){this.target.emit(B.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(g.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(g.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(g.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new x,_t.log(e.innerName,"---\x3e");try{this.emitRender(g.START),this.renderOnce(t),this.emitRender(g.END,this.totalBounds),R.clearRecycled()}catch(t){this.rendering=!1,_t.error(t)}_t.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return _t.warn("rendering");if(this.times>3)return _t.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new x,this.renderOptions={},t)this.emitRender(g.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(g.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(g.RENDER,this.renderBounds,this.renderOptions),this.emitRender(g.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,this.waitAgain&&(this.waitAgain=!1,this.renderOnce())}partRender(){const{canvas:t,updateBlocks:e}=this;e&&(this.mergeBlocks(),e.forEach(e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(t){const e=T.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),n=new x(s);i.save(),s.spread(wt.clipSpread).ceil(),i.clearWorld(s),i.clipWorld(s),this.__render(s,n),i.restore(),T.end(e)}fullRender(){const t=T.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),T.end(t)}__render(t,e){const{canvas:s}=this,n=t.includes(this.target.__world),a=n?{includes:n}:{bounds:t,includes:n};this.needFill&&s.fillWorld(t,this.config.fill),b.showRepaint&&b.drawRepaint(s,t),i.render(this.target,s,a),this.renderBounds=e=e||t,this.renderOptions=a,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),s.updateRender(e)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new x;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const t=this.target;if(this.requestTime||!t)return;if(t.parentApp)return t.parentApp.requestRender(!1);this.requestTime=this.frameTime||Date.now();const e=()=>{const t=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:s}=this.config;if(s&&t>s)return i.requestRender(e);const{frames:n}=this;n.length>30&&n.shift(),n.push(t),this.FPS=Math.round(n.reduce((t,e)=>t+e,0)/n.length),this.requestTime=0,this.checkRender()};i.requestRender(e)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new x(0,0,e,i).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new x(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;t.updatedList&&t.updatedList.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||_t.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(t,e,i){this.target.emitEvent(new g(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[g.REQUEST,this.update,this],[B.END,this.__onLayoutEnd,this],[g.AGAIN,this.renderAgain,this],[h.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}wt.clipSpread=10;const{hitRadiusPoint:mt}=E;class yt{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,n=i.ignoreHittable||!1,a=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new f(i.findList),i.findList||this.hitBranch(a.isBranchLeaf?{children:[a]}:a);const{list:o}=this.findList,r=this.getBestMatchLeaf(o,i.bottomList,n,!!i.findList),h=n?this.getPath(r):this.getHitablePath(r);return this.clear(),s?{path:h,target:r,throughPath:o.length?this.getThroughPath(o):h}:{path:h,target:r}}hitPoint(t,e,i){return!!this.getByPoint(t,e,i).target}getBestMatchLeaf(t,e,i,s){const n=this.findList=new f;if(t.length){let e;const{x:s,y:a}=this.point,o={x:s,y:a,radiusX:0,radiusY:0};for(let s=0,a=t.length;s<a;s++)if(e=t[s],(i||m.worldHittable(e))&&(this.hitChild(e,o),n.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&m.hasParent(t,e))){n.reset();break}return n.list[0]}}if(e)for(let t=0,i=e.length;t<i;t++)if(this.hitChild(e[t].target,this.point,e[t].proxy),n.length)return n.list[0];return s?null:i?t[0]:t.find(t=>m.worldHittable(t))}getPath(t){const e=new f,i=[],{target:s}=this;for(;t&&(t.syncEventer&&i.push(t.syncEventer),e.add(t),(t=t.parent)!==s););return i.length&&i.forEach(t=>{for(;t&&(t.__.hittable&&e.add(t),(t=t.parent)!==s););}),s&&e.add(s),e}getHitablePath(t){const e=this.getPath(t&&t.hittable?t:null);let i,s=new f;for(let t=e.list.length-1;t>-1&&(i=e.list[t],i.__.hittable)&&(s.addAt(i,0),i.__.hitChildren&&(!i.isLeafer||"draw"!==i.mode));t--);return s}getThroughPath(t){const e=new f,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,n,a;for(let t=0,o=i.length;t<o;t++){s=i[t],n=i[t+1];for(let t=0,i=s.length;t<i&&(a=s.list[t],!n||!n.has(a));t++)e.add(a)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s;const{point:n}=this;for(let a=t.length-1;a>-1;a--)i=t[a],!i.__.visible||e&&!i.__.mask||(s=!!i.__.hitRadius||mt(i.__world,n),i.isBranch?(s||i.__ignoreHitWorld)&&(i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,n)):s&&this.hitChild(i,n))}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:s}=t;if(s&&s.__hasMask&&!t.__.mask){let i,n=[];const{children:a}=s;for(let s=0,o=a.length;s<o;s++)if(i=a[s],i.__.mask&&n.push(i),i===t){if(n&&!n.every(t=>t.__hitWorld(e)))return;break}}this.findList.add(i||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class vt{constructor(t,e){this.config={},e&&(this.config=a.default(e,this.config)),this.picker=new yt(this.target=t,this),this.finder=l.finder&&l.finder()}getByPoint(t,e,s){const{target:n,picker:a}=this;return i.backgrounder&&n&&n.updateLayout(),a.getByPoint(t,e,s)}hitPoint(t,e,i){return this.picker.hitPoint(t,e,i)}getBy(t,e,i,s){return this.finder?this.finder.getBy(t,e,i,s):L.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}Object.assign(l,{watcher:(t,e)=>new nt(t,e),layouter:(t,e)=>new pt(t,e),renderer:(t,e,i)=>new wt(t,e,i),selector:(t,e)=>new vt(t,e)}),i.layout=pt.fullLayout,i.render=function(t,e,i){const s=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new f,t.__render(e,i),i.topList.length&&i.topList.forEach(t=>t.__render(e,s))};const xt={convertTouch(t,e){const i=xt.getTouch(t),s=Y.getBase(t);return Object.assign(Object.assign({},s),{x:e.x,y:e.y,width:1,height:1,pointerType:"touch",multiTouch:t.touches.length>1,pressure:i.force||1})},getTouch:t=>t.touches[0]||t.changedTouches[0]};class St extends X{__listenEvents(){super.__listenEvents(),this.config.eventer&&(this.config.eventer.receiveEvent=this.receive.bind(this))}receive(t){switch(t.type){case"touchstart":this.onTouchStart(t);break;case"touchmove":this.onTouchMove(t);break;case"touchend":this.onTouchEnd(t);break;case"touchcancel":this.onTouchCancel()}}getLocal(t,e){return j(t.x)?super.getLocal(t,e):{x:t.x,y:t.y}}getTouches(t){return t}onTouchStart(t){this.multiTouchStart(t);const e=xt.getTouch(t);this.pointerDown(xt.convertTouch(t,this.getLocal(e,!0)))}onTouchMove(t){if(this.multiTouchMove(t),this.useMultiTouch)return;const e=xt.getTouch(t);this.pointerMove(xt.convertTouch(t,this.getLocal(e)))}onTouchEnd(t){this.multiTouchEnd();const e=xt.getTouch(t);this.pointerUp(xt.convertTouch(t,this.getLocal(e)))}onTouchCancel(){this.pointerCancel()}multiTouchStart(t){this.useMultiTouch=t.touches.length>1,this.touches=this.useMultiTouch?this.getTouches(t.touches):void 0,this.useMultiTouch&&this.pointerCancel()}multiTouchMove(t){if(this.useMultiTouch&&t.touches.length>1){const e=this.getTouches(t.touches),i=this.getKeepTouchList(this.touches,e);i.length>1&&(this.multiTouch(Y.getBase(t),i),this.touches=e)}}multiTouchEnd(){this.touches=null,this.useMultiTouch=!1,this.transformEnd()}getKeepTouchList(t,e){let i;const s=[];return t.forEach(t=>{i=e.find(e=>e.identifier===t.identifier),i&&s.push({from:this.getLocal(t),to:this.getLocal(i)})}),s}getLocalTouchs(t){return t.map(t=>this.getLocal(t))}destroy(){super.destroy(),this.touches=null}}function bt(t,e){const i=t.__,{rows:s,decorationY:n}=i.__textDrawData;let a;i.__isPlacehold&&i.placeholderColor&&(e.fillStyle=i.placeholderColor);for(let t=0,i=s.length;t<i;t++)a=s[t],a.text?e.fillText(a.text,a.x,a.y):a.data&&a.data.forEach(t=>{e.fillText(t.char,t.x,a.y)});if(n){const{decorationColor:t,decorationHeight:a}=i.__textDrawData;t&&(e.fillStyle=t),s.forEach(t=>n.forEach(i=>e.fillRect(t.x,t.y+i,t.width,a)))}}function kt(t,e){t.__.__font?bt(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function Bt(t,e,i){switch(e.__.strokeAlign){case"center":Tt(t,1,e,i);break;case"inside":Rt(t,"inside",e,i);break;case"outside":e.__.__fillAfterStroke?Tt(t,2,e,i):Rt(t,"outside",e,i)}}function Tt(t,e,i,s){const n=i.__;A(t)?Lt(t,e,!0,i,s):(s.setStroke(t,n.__strokeWidth*e,n),Et(i,s))}function Rt(t,e,i,s){const n=s.getSameCanvas(!0,!0);n.font=i.__.__font,Tt(t,2,i,n),n.blendMode="outside"===e?"destination-out":"destination-in",bt(i,n),n.blendMode="normal",m.copyCanvasByWorld(i,s,n),n.recycle(i.__nowWorld)}function Et(t,e){let i,s=t.__.__textDrawData;const{rows:n,decorationY:a}=s;for(let t=0,s=n.length;t<s;t++)i=n[t],i.text?e.strokeText(i.text,i.x,i.y):i.data&&i.data.forEach(t=>{e.strokeText(t.char,t.x,i.y)});if(a){const{decorationHeight:t}=s;n.forEach(i=>a.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}}function Lt(t,e,i,s,n){let a;const o=s.__,{__hasMultiStrokeStyle:r}=o;r||n.setStroke(void 0,o.__strokeWidth*e,o);for(let h=0,c=t.length;h<c;h++)if(a=t[h],(!a.image||!N.checkImage(s,n,a,!1))&&a.style){if(r){const{strokeStyle:t}=a;t?n.setStroke(a.style,o.__getRealStrokeWidth(t)*e,o,t):n.setStroke(a.style,o.__strokeWidth*e,o)}else n.strokeStyle=a.style;a.blendMode?(n.saveBlendMode(a.blendMode),i?Et(s,n):n.stroke(),n.restoreBlendMode()):i?Et(s,n):n.stroke()}}function At(t,e,i){const s=e.__;if(s.__strokeWidth)if(s.__font)Bt(t,e,i);else switch(s.strokeAlign){case"center":Ct(t,1,e,i);break;case"inside":!function(t,e,i){i.save(),i.clipUI(e),Ct(t,2,e,i),i.restore()}(t,e,i);break;case"outside":!function(t,e,i){const s=e.__;if(s.__fillAfterStroke)Ct(t,2,e,i);else{const{renderBounds:n}=e.__layout,a=i.getSameCanvas(!0,!0);e.__drawRenderPath(a),Ct(t,2,e,a),a.clipUI(s),a.clearWorld(n),m.copyCanvasByWorld(e,i,a),a.recycle(e.__nowWorld)}}(t,e,i)}}function Ct(t,e,i,s){const n=i.__;A(t)?Lt(t,e,!1,i,s):(s.setStroke(t,n.__strokeWidth*e,n),s.stroke()),n.__useArrow&&q.strokeArrow(t,i,s)}const{getSpread:Mt,copyAndSpread:Pt,toOuterOf:Ot,getOuterOf:Wt,getByMove:Dt,move:It,getIntersectData:zt}=E,Ft={};let Ut;const{stintSet:Yt}=a,{hasTransparent:Xt}=H;function jt(t,i,s){if(!A(i)||!1===i.visible||0===i.opacity)return;let n;const{boxBounds:a}=s.__layout;switch(i.type){case"image":n=N.image(s,t,i,a,!Ut||!Ut[i.url]);break;case"linear":n=V.linearGradient(i,a);break;case"radial":n=V.radialGradient(i,a);break;case"angular":n=V.conicGradient(i,a);break;case"solid":const{type:e,color:o,opacity:h}=i;n={type:e,style:H.string(o,h)};break;default:r(i.r)||(n={type:"solid",style:H.string(i)})}if(n){if(e(n.style)&&Xt(n.style)&&(n.isTransparent=!0),i.style){if(0===i.style.strokeWidth)return;n.strokeStyle=i.style}i.editing&&(n.editing=i.editing),i.blendMode&&(n.blendMode=i.blendMode)}return n}const Gt={compute:function(t,e){const i=e.__,s=[];let n,a,o,r=i.__input[t];S(r)||(r=[r]),Ut=N.recycleImage(t,i);for(let i,n=0,a=r.length;n<a;n++)(i=jt(t,r[n],e))&&(s.push(i),i.strokeStyle&&(o||(o=1),i.strokeStyle.strokeWidth&&(o=Math.max(o,i.strokeStyle.strokeWidth))));i["_"+t]=s.length?s:void 0,s.length&&s.every(t=>t.isTransparent)&&(s.some(t=>t.image)&&(n=!0),a=!0),"fill"===t?(Yt(i,"__isAlphaPixelFill",n),Yt(i,"__isTransparentFill",a)):(Yt(i,"__isAlphaPixelStroke",n),Yt(i,"__isTransparentStroke",a),Yt(i,"__hasMultiStrokeStyle",o))},fill:function(t,e,i){i.fillStyle=t,kt(e,i)},fills:function(t,e,i){let s;for(let n=0,a=t.length;n<a;n++){if(s=t[n],s.image){if(N.checkImage(e,i,s,!e.__.__font))continue;if(!s.style){!n&&s.image.isPlacehold&&e.drawImagePlaceholder(i,s.image);continue}}if(i.fillStyle=s.style,s.transform||s.scaleFixed){if(i.save(),s.transform&&i.transform(s.transform),s.scaleFixed){const{scaleX:t,scaleY:n}=e.getRenderScaleData(!0);(!0===s.scaleFixed||"zoom-in"===s.scaleFixed&&t>1&&n>1)&&i.scale(1/t,1/n)}s.blendMode&&(i.blendMode=s.blendMode),kt(e,i),i.restore()}else s.blendMode?(i.saveBlendMode(s.blendMode),kt(e,i),i.restoreBlendMode()):kt(e,i)}},fillPathOrText:kt,fillText:bt,stroke:At,strokes:function(t,e,i){At(t,e,i)},strokeText:Bt,drawTextStroke:Et,shape:function(t,e,s){const n=e.getSameCanvas(),a=e.bounds,o=t.__nowWorld,r=t.__layout,h=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let c,l,d,u,f,g;Ot(r.strokeSpread?(Pt(Ft,r.boxBounds,r.strokeSpread),Ft):r.boxBounds,o,h);let{scaleX:p,scaleY:_}=t.getRenderScaleData(!0);if(a.includes(h))g=n,c=f=h,l=o;else{let n;if(i.fullImageShadow)n=h;else{const t=r.renderShapeSpread?Mt(a,C.swapAndScale(r.renderShapeSpread,p,_)):a;n=zt(t,h)}u=a.getFitMatrix(n);let{a:w,d:m}=u;u.a<1&&(g=e.getSameCanvas(),t.__renderShape(g,s),p*=w,_*=m),f=Wt(h,u),c=Dt(f,-u.e,-u.f),l=Wt(o,u),It(l,-u.e,-u.f);const y=s.matrix;y?(d=new M(u),d.multiply(y),w*=y.scaleX,m*=y.scaleY):d=u,d.withScale(w,m),s=Object.assign(Object.assign({},s),{matrix:d})}return t.__renderShape(n,s),{canvas:n,matrix:d,fitMatrix:u,bounds:c,renderBounds:l,worldCanvas:g,shapeBounds:f,scaleX:p,scaleY:_}}};let Nt={},qt=P();const{get:Ht,set:Vt,rotateOfOuter:Qt,translate:Kt,scaleOfOuter:Zt,multiplyParent:$t,scale:Jt,rotate:te,skew:ee}=O;function ie(t,e,i,s){const n=Ht();Kt(n,e.x,e.y),i&&Jt(n,i,s),t.transform=n}function se(t,e,i,s,n,a,o){const r=Ht();Kt(r,e.x+i,e.y+s),Jt(r,n,a),o&&Qt(r,{x:e.x+e.width/2,y:e.y+e.height/2},o),t.transform=r}function ne(t,e,i,s,n,a,o,r,h,c){const l=Ht();oe(l,e,i,s,n,a,o,r),h&&(o||r?(Vt(qt),Zt(qt,e,h,c),$t(l,qt)):Zt(l,e,h,c)),t.transform=l}function ae(t,e,i,s,n,a,o,r,h,c,l,d){const u=Ht();if(d)oe(u,e,n,a,o,r,h,c);else{if(h)if("center"===l)Qt(u,{x:i/2,y:s/2},h);else switch(te(u,h),h){case 90:Kt(u,s,0);break;case 180:Kt(u,i,s);break;case 270:Kt(u,0,i)}Nt.x=e.x+n,Nt.y=e.y+a,Kt(u,Nt.x,Nt.y),o&&Zt(u,Nt,o,r)}t.transform=u}function oe(t,e,i,s,n,a,o,r){o&&te(t,o),r&&ee(t,r.x,r.y),n&&Jt(t,n,a),Kt(t,e.x+i,e.y+s)}const{get:re,translate:he}=O,ce=new x,le={},de={};function ue(t,e,i,s){const{changeful:n,sync:a,scaleFixed:o}=i;n&&(t.changeful=n),a&&(t.sync=a),o&&(t.scaleFixed=o),t.data=fe(i,s,e)}function fe(t,i,s){t.padding&&(i=ce.set(i).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");let{width:n,height:a}=s;const{opacity:o,mode:r,align:h,offset:c,scale:l,size:d,rotation:u,skew:f,clipSize:g,repeat:p,gap:_,filters:w}=t,m=i.width===n&&i.height===a,y={mode:r},v="center"!==h&&(u||0)%180==90;let x,S;switch(E.set(de,0,0,v?a:n,v?n:a),r&&"cover"!==r&&"fit"!==r?((l||d)&&(W.getScaleData(l,d,s,le),x=le.scaleX,S=le.scaleY),(h||_||p)&&(x&&E.scale(de,x,S,!0),h&&D.toPoint(h,de,i,de,!0,!0))):m&&!u||(x=S=E.getFitScale(i,de,"fit"!==r),E.put(i,s,h,x,!1,de),E.scale(de,x,S,!0)),c&&I.move(de,c),r){case"stretch":m||(x=i.width/n,S=i.height/a,ie(y,i,x,S));break;case"normal":case"clip":if(de.x||de.y||x||g||u||f){let t,e;g&&(t=i.width/g.width,e=i.height/g.height),ne(y,i,de.x,de.y,x,S,u,f,t,e),t&&(x=x?x*t:t,S=S?S*e:e)}break;case"repeat":(!m||x||u||f)&&ae(y,i,n,a,de.x,de.y,x,S,u,f,h,t.freeTransform),p||(y.repeat="repeat");const e=A(p);(_||e)&&(y.gap=function(t,e,i,s,n){let a,o;A(t)?(a=t.x,o=t.y):a=o=t;return{x:ge(a,i,n.width,e&&e.x),y:ge(o,s,n.height,e&&e.y)}}(_,e&&p,de.width,de.height,i));break;default:x&&se(y,i,de.x,de.y,x,S,u)}return y.transform||(i.x||i.y)&&he(y.transform=re(),i.x,i.y),y.width=n,y.height=a,x&&(y.scaleX=x,y.scaleY=S),o&&(y.opacity=o),w&&(y.filters=w),p&&(y.repeat=e(p)?"x"===p?"repeat-x":"repeat-y":"repeat"),y}function ge(t,i,s,n){const a=e(t)||n?(n?s-n*i:s%i)/((n||Math.floor(s/i))-1):t;return"auto"===t&&a<0?0:a}let pe,_e=new x;const{isSame:we}=E;function me(t,e,i,s,n,a){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=s.width/e.pixelRatio,e.__naturalHeight=s.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return n.data||ue(n,s,i,a),!0}function ye(t,e){Se(t,z.LOAD,e)}function ve(t,e){Se(t,z.LOADED,e)}function xe(t,e,i){e.error=i,t.forceUpdate("surface"),Se(t,z.ERROR,e)}function Se(t,e,i){t.hasEvent(e)&&t.emitEvent(new z(e,i))}function be(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:ke,scale:Be,copy:Te}=O,{floor:Re,ceil:Ee,max:Le,abs:Ae}=Math;function Ce(t,e,s){let{scaleX:n,scaleY:a}=t.getRenderScaleData(!0,e.scaleFixed);const o=n+"-"+a+"-"+s;if(e.patternId===o||t.destroyed)return!1;{const{image:r,data:h}=e;let c,l,{width:d,height:u,scaleX:f,scaleY:g,transform:p,repeat:_,gap:w}=h;n*=s,a*=s,f&&(f=Ae(f),g=Ae(g),l=ke(),Te(l,p),Be(l,1/f,1/g),n*=f,a*=g),d*=n,u*=a;const m=d*u;if(!_&&m>i.image.maxCacheSize)return!1;let y=i.image.maxPatternSize;if(r.isSVG){const t=d/r.width;t>1&&(c=t/Ee(t))}else{const t=r.width*r.height;y>t&&(y=t)}m>y&&(c=Math.sqrt(m/y)),c&&(n/=c,a/=c,d/=c,u/=c),f&&(n/=f,a/=g);const v=w&&w.x*n,x=w&&w.y*a;if(p||1!==n||1!==a){const t=d+(v||0),e=u+(x||0);n/=t/Le(Re(t),1),a/=e/Le(Re(e),1),l||(l=ke(),p&&Te(l,p)),Be(l,1/n,1/a)}const S=r.getCanvas(d,u,h.opacity,h.filters,v,x,t.leafer&&t.leafer.config.smooth),b=r.getPattern(S,_||i.origin.noRepeat||"no-repeat",l,e);return e.style=b,e.patternId=o,!0}}function Me(t,e,i,s){return new(i||(i=Promise))(function(n,a){function o(t){try{h(s.next(t))}catch(t){a(t)}}function r(t){try{h(s.throw(t))}catch(t){a(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(o,r)}h((s=s.apply(t,e||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const Pe={image:function(t,e,i,s,n){let a,o;const r=R.get(i);return pe&&i===pe.paint&&we(s,pe.boxBounds)?a=pe.leafPaint:(a={type:i.type,image:r},r.hasAlphaPixel&&(a.isTransparent=!0),pe=r.use>1?{leafPaint:a,paint:i,boxBounds:_e.set(s)}:null),(n||r.loading)&&(o={image:r,attrName:e,attrValue:i}),r.ready?(me(t,e,i,r,a,s),n&&(ye(t,o),ve(t,o))):r.error?n&&xe(t,o,r.error):(n&&(be(t,!0),ye(t,o)),a.loadId=r.load(()=>{be(t,!1),t.destroyed||(me(t,e,i,r,a,s)&&(r.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),ve(t,o)),a.loadId=void 0},e=>{be(t,!1),xe(t,o,e),a.loadId=void 0}),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{r.ready||(r.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):r.isPlacehold=!0)),a},checkImage:function(t,e,s,n){const{scaleX:a,scaleY:o}=t.getRenderScaleData(!0,s.scaleFixed),{pixelRatio:r}=e,{data:c}=s;if(!c||s.patternId===a+"-"+o+"-"+r&&!Q.running)return!1;if(n)if(c.repeat)n=!1;else if(!(s.changeful||"miniapp"===i.name&&h.isResizing(t)||Q.running)){let{width:t,height:e}=c;t*=a*r,e*=o*r,c.scaleX&&(t*=c.scaleX,e*=c.scaleY),n=t*e>i.image.maxCacheSize}return n?(t.__.__isFastShadow&&(e.fillStyle=s.style||"#000",e.fill()),function(t,e,i,s){e.save(),e.clipUI(t),i.blendMode&&(e.blendMode=i.blendMode);s.opacity&&(e.opacity*=s.opacity);s.transform&&e.transform(s.transform);e.drawImage(i.image.getFull(s.filters),0,0,s.width,s.height),e.restore()}(t,e,s,c),!0):(!s.style||s.sync||Q.running?Ce(t,s,r):s.patternTask||(s.patternTask=R.patternTasker.add(()=>Me(this,void 0,void 0,function*(){s.patternTask=null,e.bounds.hit(t.__nowWorld)&&Ce(t,s,r),t.forceUpdate("surface")}),300)),!1)},createPattern:Ce,recycleImage:function(t,e){const i=e["_"+t];if(S(i)){let s,n,a,o,r;for(let h=0,c=i.length;h<c;h++)s=i[h],n=s.image,r=n&&n.url,r&&(a||(a={}),a[r]=!0,R.recycle(n),n.loading&&(o||(o=e.__input&&e.__input[t]||[],S(o)||(o=[o])),n.unload(i[h].loadId,!o.some(t=>t.url===r))));return a}return null},createData:ue,getPatternData:fe,stretchMode:ie,fillOrFitMode:se,clipMode:ne,repeatMode:ae},{toPoint:Oe}=F,{hasTransparent:We}=H,De={},Ie={};function ze(t,i,s,n){if(s){let a,o,r,h;for(let t=0,c=s.length;t<c;t++)a=s[t],e(a)?(r=t/(c-1),o=H.string(a,n)):(r=a.offset,o=H.string(a.color,n)),i.addColorStop(r,o),!h&&We(o)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:Fe,getDistance:Ue}=I,{get:Ye,rotateOfOuter:Xe,scaleOfOuter:je}=O,{toPoint:Ge}=F,Ne={},qe={};function He(t,e,i,s,n){let a;const{width:o,height:r}=t;if(o!==r||s){const t=Fe(e,i);a=Ye(),n?(je(a,e,o/r*(s||1),1),Xe(a,e,t+90)):(je(a,e,1,o/r*(s||1)),Xe(a,e,t))}return a}const{getDistance:Ve}=I,{toPoint:Qe}=F,Ke={},Ze={};const $e={linearGradient:function(t,e){let{from:s,to:n,type:a,opacity:o}=t;Oe(s||"top",e,De),Oe(n||"bottom",e,Ie);const r=i.canvas.createLinearGradient(De.x,De.y,Ie.x,Ie.y),h={type:a,style:r};return ze(h,r,t.stops,o),h},radialGradient:function(t,e){let{from:s,to:n,type:a,opacity:o,stretch:r}=t;Ge(s||"center",e,Ne),Ge(n||"bottom",e,qe);const h=i.canvas.createRadialGradient(Ne.x,Ne.y,0,Ne.x,Ne.y,Ue(Ne,qe)),c={type:a,style:h};ze(c,h,t.stops,o);const l=He(e,Ne,qe,r,!0);return l&&(c.transform=l),c},conicGradient:function(t,e){let{from:s,to:n,type:a,opacity:o,stretch:r}=t;Qe(s||"center",e,Ke),Qe(n||"bottom",e,Ze);const h=i.conicGradientSupport?i.canvas.createConicGradient(0,Ke.x,Ke.y):i.canvas.createRadialGradient(Ke.x,Ke.y,0,Ke.x,Ke.y,Ve(Ke,Ze)),c={type:a,style:h};ze(c,h,t.stops,o);const l=He(e,Ke,Ze,r||1,i.conicGradientRotate90);return l&&(c.transform=l),c},getTransform:He},{copy:Je,move:ti,toOffsetOutBounds:ei}=E,{max:ii,abs:si}=Math,ni={},ai=new M,oi={};function ri(t,e){let i,s,n,a,o=0,r=0,h=0,c=0;return e.forEach(t=>{i=t.x||0,s=t.y||0,a=1.5*(t.blur||0),n=si(t.spread||0),o=ii(o,n+a-s),r=ii(r,n+a+i),h=ii(h,n+a+s),c=ii(c,n+a-i)}),o===r&&r===h&&h===c?o:[o,r,h,c]}function hi(t,e,s){const{shapeBounds:n}=s;let a,o;i.fullImageShadow?(Je(ni,t.bounds),ti(ni,e.x-n.x,e.y-n.y),a=t.bounds,o=ni):(a=n,o=e),t.copyWorld(s.canvas,a,o)}const{toOffsetOutBounds:ci}=E,li={};const di=ri;const ui={shadow:function(t,e,i){let s,n;const{__nowWorld:a}=t,{shadow:o}=t.__,{worldCanvas:r,bounds:h,renderBounds:c,shapeBounds:l,scaleX:d,scaleY:u}=i,f=e.getSameCanvas(),g=o.length-1;ei(h,oi,c),o.forEach((o,p)=>{let _=1;if(o.scaleFixed){const t=Math.abs(a.scaleX);t>1&&(_=1/t)}f.setWorldShadow(oi.offsetX+(o.x||0)*d*_,oi.offsetY+(o.y||0)*u*_,(o.blur||0)*d*_,H.string(o.color)),n=K.getShadowTransform(t,f,i,o,oi,_),n&&f.setTransform(n),hi(f,oi,i),n&&f.resetTransform(),s=c,o.box&&(f.restore(),f.save(),r&&(f.copyWorld(f,c,a,"copy"),s=a),r?f.copyWorld(r,a,a,"destination-out"):f.copyWorld(i.canvas,l,h,"destination-out")),m.copyCanvasByWorld(t,e,f,s,o.blendMode),g&&p<g&&f.clearWorld(s)}),f.recycle(s)},innerShadow:function(t,e,i){let s,n;const{__nowWorld:a}=t,{innerShadow:o}=t.__,{worldCanvas:r,bounds:h,renderBounds:c,shapeBounds:l,scaleX:d,scaleY:u}=i,f=e.getSameCanvas(),g=o.length-1;ci(h,li,c),o.forEach((o,p)=>{let _=1;if(o.scaleFixed){const t=Math.abs(a.scaleX);t>1&&(_=1/t)}f.save(),f.setWorldShadow(li.offsetX+(o.x||0)*d*_,li.offsetY+(o.y||0)*u*_,(o.blur||0)*d*_),n=K.getShadowTransform(t,f,i,o,li,_,!0),n&&f.setTransform(n),hi(f,li,i),f.restore(),r?(f.copyWorld(f,c,a,"copy"),f.copyWorld(r,a,a,"source-out"),s=a):(f.copyWorld(i.canvas,l,h,"source-out"),s=c),f.fillWorld(s,H.string(o.color),"source-in"),m.copyCanvasByWorld(t,e,f,s,o.blendMode),g&&p<g&&f.clearWorld(s)}),f.recycle(s)},blur:function(t,e,i){const{blur:s}=t.__;i.setWorldBlur(s*t.__nowWorld.a),i.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),i.filter="none"},backgroundBlur:function(t,e,i){},getShadowRenderSpread:ri,getShadowTransform:function(t,e,i,s,n,a,o){if(s.spread){const i=1+2*s.spread/t.__layout.strokeBounds.width*a*(o?-1:1);return ai.set().scaleOfOuter({x:(n.x+n.width/2)*e.pixelRatio,y:(n.y+n.height/2)*e.pixelRatio},i),ai}},isTransformShadow(t){},getInnerShadowSpread:di},{excludeRenderBounds:fi}=v;let gi;function pi(t,e,i,s,n,a,o,r){switch(e){case"grayscale":gi||(gi=!0,n.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,n,a){const o=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,o),a&&s.recycle(o);wi(t,e,i,1,n,a)}(t,i,s,n,o,r);break;case"opacity-path":wi(t,i,s,a,o,r);break;case"path":r&&i.restore()}}function _i(t){return t.getSameCanvas(!1,!0)}function wi(t,e,i,s,n,a){const o=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,o,void 0,n),a?i.recycle(o):i.clearWorld(o)}Z.prototype.__renderMask=function(t,e){let i,s,n,a,o,r;const{children:h}=this;for(let c=0,l=h.length;c<l;c++){if(i=h[c],r=i.__.mask,r){o&&(pi(this,o,t,n,s,a,void 0,!0),s=n=null),"clipping"!==r&&"clipping-path"!==r||fi(i,e)||i.__render(t,e),a=i.__.opacity,gi=!1,"path"===r||"clipping-path"===r?(a<1?(o="opacity-path",n||(n=_i(t))):(o="path",t.save()),i.__clip(n||t,e)):(o="grayscale"===r?"grayscale":"alpha",s||(s=_i(t)),n||(n=_i(t)),i.__render(s,e));continue}const l=1===a&&i.__.__blendMode;l&&pi(this,o,t,n,s,a,void 0,!1),fi(i,e)||i.__render(n||t,e),l&&pi(this,o,t,n,s,a,l,!1)}pi(this,o,t,n,s,a,void 0,!0)};const mi=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",yi=mi+"_#~&*+\\=|≮≯≈≠=…",vi=new RegExp([[19968,40959],[13312,19903],[131072,173791],[173824,177983],[177984,178207],[178208,183983],[183984,191471],[196608,201551],[201552,205743],[11904,12031],[12032,12255],[12272,12287],[12288,12351],[12736,12783],[12800,13055],[13056,13311],[63744,64255],[65072,65103],[127488,127743],[194560,195103]].map(([t,e])=>`[\\u${t.toString(16)}-\\u${e.toString(16)}]`).join("|"));function xi(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const Si=xi("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),bi=xi("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),ki=xi(mi),Bi=xi(yi),Ti=xi("- —/~|┆·");var Ri;!function(t){t[t.Letter=0]="Letter",t[t.Single=1]="Single",t[t.Before=2]="Before",t[t.After=3]="After",t[t.Symbol=4]="Symbol",t[t.Break=5]="Break"}(Ri||(Ri={}));const{Letter:Ei,Single:Li,Before:Ai,After:Ci,Symbol:Mi,Break:Pi}=Ri;function Oi(t){return Si[t]?Ei:Ti[t]?Pi:bi[t]?Ai:ki[t]?Ci:Bi[t]?Mi:vi.test(t)?Li:Ei}const Wi={trimRight(t){const{words:e}=t;let i,s=0,n=e.length;for(let a=n-1;a>-1&&(i=e[a].data[0]," "===i.char);a--)s++,t.width-=i.width;s&&e.splice(n-s,s)}};function Di(t,e,i){switch(e){case"title":return i?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:Ii}=Wi,{Letter:zi,Single:Fi,Before:Ui,After:Yi,Symbol:Xi,Break:ji}=Ri;let Gi,Ni,qi,Hi,Vi,Qi,Ki,Zi,$i,Ji,ts,es,is,ss,ns,as,os,rs=[];function hs(t,e){$i&&!Zi&&(Zi=$i),Gi.data.push({char:t,width:e}),qi+=e}function cs(){Hi+=qi,Gi.width=qi,Ni.words.push(Gi),Gi={data:[]},qi=0}function ls(){ss&&(ns.paraNumber++,Ni.paraStart=!0,ss=!1),$i&&(Ni.startCharSize=Zi,Ni.endCharSize=$i,Zi=0),Ni.width=Hi,as.width?Ii(Ni):os&&ds(),rs.push(Ni),Ni={words:[]},Hi=0}function ds(){Hi>(ns.maxWidth||0)&&(ns.maxWidth=Hi)}const{top:us,right:fs,bottom:gs,left:ps}=U;function _s(t,e,i){const{bounds:s,rows:n}=t;s[e]+=i;for(let t=0;t<n.length;t++)n[t][e]+=i}const ws={getDrawData:function(t,s){e(t)||(t=String(t));let n=0,a=0,o=s.__getInput("width")||0,r=s.__getInput("height")||0;const{textDecoration:h,__font:c,__padding:l}=s;l&&(o?(n=l[ps],o-=l[fs]+l[ps]):s.autoSizeAlign||(n=l[ps]),r?(a=l[us],r-=l[us]+l[gs]):s.autoSizeAlign||(a=l[us]));const d={bounds:{x:n,y:a,width:o,height:r},rows:[],paraNumber:0,font:i.canvas.font=c};return function(t,e,s){ns=t,rs=t.rows,as=t.bounds,os=!as.width&&!s.autoSizeAlign;const{__letterSpacing:n,paraIndent:a,textCase:o}=s,{canvas:r}=i,{width:h,height:c}=as;if(h||c||n||"none"!==o){const t="none"!==s.textWrap,i="break"===s.textWrap;ss=!0,ts=null,Zi=Ki=$i=qi=Hi=0,Gi={data:[]},Ni={words:[]},n&&(e=[...e]);for(let s=0,c=e.length;s<c;s++)Qi=e[s],"\n"===Qi?(qi&&cs(),Ni.paraEnd=!0,ls(),ss=!0):(Ji=Oi(Qi),Ji===zi&&"none"!==o&&(Qi=Di(Qi,o,!qi)),Ki=r.measureText(Qi).width,n&&(n<0&&($i=Ki),Ki+=n),es=Ji===Fi&&(ts===Fi||ts===zi)||ts===Fi&&Ji!==Yi,is=!(Ji!==Ui&&Ji!==Fi||ts!==Xi&&ts!==Yi),Vi=ss&&a?h-a:h,t&&h&&Hi+qi+Ki>Vi&&(i?(qi&&cs(),Hi&&ls()):(is||(is=Ji===zi&&ts==Yi),es||is||Ji===ji||Ji===Ui||Ji===Fi||qi+Ki>Vi?(qi&&cs(),Hi&&ls()):Hi&&ls()))," "===Qi&&!0!==ss&&Hi+qi===0||(Ji===ji?(" "===Qi&&qi&&cs(),hs(Qi,Ki),cs()):es||is?(qi&&cs(),hs(Qi,Ki)):hs(Qi,Ki)),ts=Ji);qi&&cs(),Hi&&ls(),rs.length>0&&(rs[rs.length-1].paraEnd=!0)}else e.split("\n").forEach(t=>{ns.paraNumber++,Hi=r.measureText(t).width,rs.push({x:a||0,text:t,width:Hi,paraStart:!0}),os&&ds()})}(d,t,s),l&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":_s(e,"x",t[ps]);break;case"right":_s(e,"x",-t[fs])}if(!n&&i.autoSizeAlign)switch(i.verticalAlign){case"top":_s(e,"y",t[us]);break;case"bottom":_s(e,"y",-t[gs])}}(l,d,s,o,r),function(t,e){const{rows:i,bounds:s}=t,n=i.length,{__lineHeight:a,__baseLine:o,__letterSpacing:r,__clipText:h,textAlign:c,verticalAlign:l,paraSpacing:d,autoSizeAlign:u}=e;let{x:f,y:g,width:p,height:_}=s,w=a*n+(d?d*(t.paraNumber-1):0),m=o;if(h&&w>_)w=Math.max(_,a),n>1&&(t.overflow=n);else if(_||u)switch(l){case"middle":g+=(_-w)/2;break;case"bottom":g+=_-w}m+=g;let y,v,x,S=p||u?p:t.maxWidth;for(let o=0,l=n;o<l;o++){if(y=i[o],y.x=f,y.width<p||y.width>p&&!h)switch(c){case"center":y.x+=(S-y.width)/2;break;case"right":y.x+=S-y.width}y.paraStart&&d&&o>0&&(m+=d),y.y=m,m+=a,t.overflow>o&&m>w&&(y.isOverflow=!0,t.overflow=o+1),v=y.x,x=y.width,r<0&&(y.width<0?(x=-y.width+e.fontSize+r,v-=x,x+=e.fontSize):x-=r),v<s.x&&(s.x=v),x>s.width&&(s.width=x),h&&p&&p<x&&(y.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=g,s.height=w}(d,s),function(t,e,i){const{rows:s}=t,{textAlign:n,paraIndent:a,letterSpacing:o}=e;let r,h,c,l,d,u;s.forEach(t=>{t.words&&(c=a&&t.paraStart?a:0,u=t.words.length,h=i&&("justify"===n||"both"===n)&&u>1?(i-t.width-c)/(u-1):0,l=o||t.isOverflow?0:h>.01?1:2,t.isOverflow&&!o&&(t.textMode=!0),2===l?(t.x+=c,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=c,r=t.x,t.data=[],t.words.forEach((e,i)=>{1===l?(d={char:"",x:r},r=function(t,e,i){return t.forEach(t=>{i.char+=t.char,e+=t.width}),e}(e.data,r,d),(t.isOverflow||" "!==d.char)&&t.data.push(d)):r=function(t,e,i,s){return t.forEach(t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width}),e}(e.data,r,t.data,t.isOverflow),!h||t.paraEnd&&"both"!==n||i===u-1||(r+=h,t.width+=h)})),t.words=null)})}(d,s,o),d.overflow&&function(t,e,s,n){if(!n)return;const{rows:a,overflow:o}=t;let{textOverflow:r}=e;if(a.splice(o),r&&"show"!==r){let t,h;"hide"===r?r="":"ellipsis"===r&&(r="...");const c=r?i.canvas.measureText(r).width:0,l=s+n-c;("none"===e.textWrap?a:[a[o-1]]).forEach(e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let s=i;s>-1&&(t=e.data[s],h=t.x+t.width,!(s===i&&h<l));s--){if(h<l&&" "!==t.char||!s){e.data.splice(s+1),e.width-=t.width;break}e.width-=t.width}e.width+=c,e.data.push({char:r,x:h}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(d,s,n,o),"none"!==h&&function(t,e){let i,s=0;const{fontSize:n,textDecoration:a}=e;switch(t.decorationHeight=n/11,A(a)?(i=a.type,a.color&&(t.decorationColor=H.string(a.color)),a.offset&&(s=Math.min(.3*n,Math.max(a.offset,.15*-n)))):i=a,i){case"under":t.decorationY=[.15*n+s];break;case"delete":t.decorationY=[.35*-n];break;case"under-delete":t.decorationY=[.15*n+s,.35*-n]}}(d,s),d}};const ms={string:function(t,i){if(!t)return"#000";const n=s(i)&&i<1;if(e(t)){if(!n||!H.object)return t;t=H.object(t)}let a=r(t.a)?1:t.a;n&&(a*=i);const o=t.r+","+t.g+","+t.b;return 1===a?"rgb("+o+")":"rgba("+o+","+a+")"}};Object.assign($,ws),Object.assign(H,ms),Object.assign(q,Gt),Object.assign(N,Pe),Object.assign(V,$e),Object.assign(K,ui),Object.assign(l,{interaction:(t,e,i,s)=>new St(t,e,i,s),hitCanvas:(t,e)=>new tt(t,e),hitCanvasManager:()=>new G}),J.prototype.receiveEvent=function(t){this.interaction&&this.interaction.receive(t)};try{wx&&st(0,wx)}catch(t){}export{St as Interaction,pt as Layouter,tt as LeaferCanvas,yt as Picker,wt as Renderer,vt as Selector,nt as Watcher,st as useCanvas};
|
|
2
2
|
//# sourceMappingURL=miniapp.esm.min.js.map
|