@leafer-ui/worker 1.9.5 → 1.9.6
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/worker.cjs +17 -6
- package/dist/worker.esm.js +18 -7
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.esm.min.js.map +1 -1
- package/dist/worker.js +129 -90
- package/dist/worker.min.cjs +1 -1
- package/dist/worker.min.cjs.map +1 -1
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +144 -103
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +11 -11
package/dist/worker.js
CHANGED
|
@@ -344,7 +344,7 @@ var LeaferUI = function(exports) {
|
|
|
344
344
|
};
|
|
345
345
|
}
|
|
346
346
|
const {sin: sin$5, cos: cos$5, acos: acos, sqrt: sqrt$3} = Math;
|
|
347
|
-
const {float: float$
|
|
347
|
+
const {float: float$2} = MathHelper;
|
|
348
348
|
const tempPoint$3 = {};
|
|
349
349
|
function getWorld() {
|
|
350
350
|
return Object.assign(Object.assign(Object.assign({}, getMatrixData()), getBoundsData()), {
|
|
@@ -583,12 +583,12 @@ var LeaferUI = function(exports) {
|
|
|
583
583
|
const cosR = c / scaleY;
|
|
584
584
|
rotation = PI_2 - (d > 0 ? acos(-cosR) : -acos(cosR));
|
|
585
585
|
}
|
|
586
|
-
const cosR = float$
|
|
586
|
+
const cosR = float$2(cos$5(rotation));
|
|
587
587
|
const sinR = sin$5(rotation);
|
|
588
|
-
scaleX = float$
|
|
589
|
-
skewX = cosR ? float$
|
|
590
|
-
skewY = cosR ? float$
|
|
591
|
-
rotation = float$
|
|
588
|
+
scaleX = float$2(scaleX), scaleY = float$2(scaleY);
|
|
589
|
+
skewX = cosR ? float$2((c / scaleY + sinR) / cosR / OneRadian, 9) : 0;
|
|
590
|
+
skewY = cosR ? float$2((b / scaleX - sinR) / cosR / OneRadian, 9) : 0;
|
|
591
|
+
rotation = float$2(rotation / OneRadian);
|
|
592
592
|
} else {
|
|
593
593
|
scaleX = a;
|
|
594
594
|
scaleY = d;
|
|
@@ -1085,7 +1085,7 @@ var LeaferUI = function(exports) {
|
|
|
1085
1085
|
};
|
|
1086
1086
|
const {tempPointBounds: tempPointBounds$1, setPoint: setPoint$2, addPoint: addPoint$2, toBounds: toBounds$2} = TwoPointBoundsHelper;
|
|
1087
1087
|
const {toOuterPoint: toOuterPoint$2} = MatrixHelper;
|
|
1088
|
-
const {float: float, fourNumber: fourNumber} = MathHelper;
|
|
1088
|
+
const {float: float$1, fourNumber: fourNumber} = MathHelper;
|
|
1089
1089
|
const {floor: floor$2, ceil: ceil$2} = Math;
|
|
1090
1090
|
let right$1, bottom$1, boundsRight, boundsBottom;
|
|
1091
1091
|
const point = {};
|
|
@@ -1262,10 +1262,10 @@ var LeaferUI = function(exports) {
|
|
|
1262
1262
|
}
|
|
1263
1263
|
},
|
|
1264
1264
|
float(t, maxLength) {
|
|
1265
|
-
t.x = float(t.x, maxLength);
|
|
1266
|
-
t.y = float(t.y, maxLength);
|
|
1267
|
-
t.width = float(t.width, maxLength);
|
|
1268
|
-
t.height = float(t.height, maxLength);
|
|
1265
|
+
t.x = float$1(t.x, maxLength);
|
|
1266
|
+
t.y = float$1(t.y, maxLength);
|
|
1267
|
+
t.width = float$1(t.width, maxLength);
|
|
1268
|
+
t.height = float$1(t.height, maxLength);
|
|
1269
1269
|
},
|
|
1270
1270
|
add(t, bounds, isPoint) {
|
|
1271
1271
|
right$1 = t.x + t.width;
|
|
@@ -5105,6 +5105,7 @@ var LeaferUI = function(exports) {
|
|
|
5105
5105
|
LeaferEvent.STOP = "leafer.stop";
|
|
5106
5106
|
LeaferEvent.RESTART = "leafer.restart";
|
|
5107
5107
|
LeaferEvent.END = "leafer.end";
|
|
5108
|
+
LeaferEvent.UPDATE_MODE = "leafer.update_mode";
|
|
5108
5109
|
LeaferEvent.TRANSFORM = "leafer.transform";
|
|
5109
5110
|
LeaferEvent.MOVE = "leafer.move";
|
|
5110
5111
|
LeaferEvent.SCALE = "leafer.scale";
|
|
@@ -6350,7 +6351,7 @@ var LeaferUI = function(exports) {
|
|
|
6350
6351
|
this.levelMap = null;
|
|
6351
6352
|
}
|
|
6352
6353
|
}
|
|
6353
|
-
const version = "1.9.
|
|
6354
|
+
const version = "1.9.6";
|
|
6354
6355
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6355
6356
|
get allowBackgroundColor() {
|
|
6356
6357
|
return true;
|
|
@@ -7046,7 +7047,7 @@ var LeaferUI = function(exports) {
|
|
|
7046
7047
|
item = path.list[i];
|
|
7047
7048
|
if (!item.__.hittable) break;
|
|
7048
7049
|
hittablePath.addAt(item, 0);
|
|
7049
|
-
if (!item.__.hitChildren) break;
|
|
7050
|
+
if (!item.__.hitChildren || item.isLeafer && item.mode === "draw") break;
|
|
7050
7051
|
}
|
|
7051
7052
|
return hittablePath;
|
|
7052
7053
|
}
|
|
@@ -7464,8 +7465,6 @@ var LeaferUI = function(exports) {
|
|
|
7464
7465
|
if (!boxStyle) box.parent = t, box.__world = t.__world, boxLayout.boxBounds = layout.boxBounds;
|
|
7465
7466
|
box.set(value);
|
|
7466
7467
|
if (boxLayout.strokeChanged) layout.strokeChange();
|
|
7467
|
-
if (boxLayout.renderChanged) layout.renderChange();
|
|
7468
|
-
box.__updateChange();
|
|
7469
7468
|
} else if (box) {
|
|
7470
7469
|
t.__box = box.parent = null;
|
|
7471
7470
|
box.destroy();
|
|
@@ -7532,7 +7531,7 @@ var LeaferUI = function(exports) {
|
|
|
7532
7531
|
__updateRenderSpread() {
|
|
7533
7532
|
let width = 0;
|
|
7534
7533
|
const {shadow: shadow, innerShadow: innerShadow, blur: blur, backgroundBlur: backgroundBlur, filter: filter, renderSpread: renderSpread} = this.__;
|
|
7535
|
-
if (shadow)
|
|
7534
|
+
if (shadow) width = Effect.getShadowSpread(this, shadow);
|
|
7536
7535
|
if (blur) width = Math.max(width, blur);
|
|
7537
7536
|
if (filter) width += Filter.getSpread(filter);
|
|
7538
7537
|
if (renderSpread) width += renderSpread;
|
|
@@ -7544,36 +7543,67 @@ var LeaferUI = function(exports) {
|
|
|
7544
7543
|
return this.__box ? Math.max(this.__box.__updateRenderSpread(), width) : width;
|
|
7545
7544
|
}
|
|
7546
7545
|
};
|
|
7546
|
+
const {float: float} = MathHelper;
|
|
7547
|
+
const tempContent = new Bounds, tempMerge = new Bounds, tempIntersect = new Bounds;
|
|
7547
7548
|
const DragBoundsHelper = {
|
|
7549
|
+
limitMove(leaf, move) {
|
|
7550
|
+
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
7551
|
+
if (dragBounds) D.getValidMove(leaf.__localBoxBounds, D.getDragBounds(leaf), dragBoundsType, move, true);
|
|
7552
|
+
D.axisMove(leaf, move);
|
|
7553
|
+
},
|
|
7554
|
+
limitScaleOf(leaf, origin, scale) {
|
|
7555
|
+
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
7556
|
+
if (dragBounds) D.getValidScaleOf(leaf.__localBoxBounds, D.getDragBounds(leaf), dragBoundsType, leaf.getLocalPointByInner(leaf.getInnerPointByBox(origin)), scale, true);
|
|
7557
|
+
},
|
|
7558
|
+
axisMove(leaf, move) {
|
|
7559
|
+
const {draggable: draggable} = leaf;
|
|
7560
|
+
if (draggable === "x") move.y = 0;
|
|
7561
|
+
if (draggable === "y") move.x = 0;
|
|
7562
|
+
},
|
|
7563
|
+
getDragBounds(leaf) {
|
|
7564
|
+
const {dragBounds: dragBounds} = leaf;
|
|
7565
|
+
return dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds;
|
|
7566
|
+
},
|
|
7567
|
+
isInnerMode(content, dragBounds, dragBoundsType, sideType) {
|
|
7568
|
+
return dragBoundsType === "inner" || dragBoundsType === "auto" && content[sideType] > dragBounds[sideType];
|
|
7569
|
+
},
|
|
7548
7570
|
getValidMove(content, dragBounds, dragBoundsType, move, change) {
|
|
7549
7571
|
const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
|
|
7550
7572
|
const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
|
|
7551
7573
|
if (!change) move = Object.assign({}, move);
|
|
7552
|
-
|
|
7553
|
-
const isBiggerHeight = content.height > dragBounds.height;
|
|
7554
|
-
if (isBiggerWidth && dragBoundsType !== "outer") {
|
|
7574
|
+
if (D.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
|
|
7555
7575
|
if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
|
|
7556
7576
|
} else {
|
|
7557
7577
|
if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
|
|
7558
7578
|
}
|
|
7559
|
-
if (
|
|
7579
|
+
if (D.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
|
|
7560
7580
|
if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
|
|
7561
7581
|
} else {
|
|
7562
7582
|
if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
|
|
7563
7583
|
}
|
|
7564
|
-
move.x =
|
|
7565
|
-
move.y =
|
|
7584
|
+
move.x = float(move.x);
|
|
7585
|
+
move.y = float(move.y);
|
|
7566
7586
|
return move;
|
|
7567
7587
|
},
|
|
7568
|
-
|
|
7569
|
-
|
|
7570
|
-
|
|
7571
|
-
|
|
7572
|
-
|
|
7573
|
-
|
|
7574
|
-
|
|
7575
|
-
|
|
7576
|
-
|
|
7588
|
+
getValidScaleOf(content, dragBounds, dragBoundsType, origin, scale, change) {
|
|
7589
|
+
if (!change) scale = Object.assign({}, scale);
|
|
7590
|
+
let fitScaleX, fitScaleY;
|
|
7591
|
+
tempContent.set(content).scaleOf(origin, scale.x, scale.y).unsign();
|
|
7592
|
+
tempMerge.set(tempContent).add(dragBounds);
|
|
7593
|
+
tempIntersect.set(tempContent).intersect(dragBounds);
|
|
7594
|
+
if (D.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
|
|
7595
|
+
fitScaleX = tempMerge.width / tempContent.width;
|
|
7596
|
+
} else {
|
|
7597
|
+
fitScaleX = tempIntersect.width / tempContent.width;
|
|
7598
|
+
}
|
|
7599
|
+
if (D.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
|
|
7600
|
+
fitScaleY = tempMerge.height / tempContent.height;
|
|
7601
|
+
} else {
|
|
7602
|
+
fitScaleY = tempIntersect.height / tempContent.height;
|
|
7603
|
+
}
|
|
7604
|
+
scale.x = float(tempIntersect.width) ? scale.x * fitScaleX : 1;
|
|
7605
|
+
scale.y = float(tempIntersect.height) ? scale.y * fitScaleY : 1;
|
|
7606
|
+
return scale;
|
|
7577
7607
|
}
|
|
7578
7608
|
};
|
|
7579
7609
|
const D = DragBoundsHelper;
|
|
@@ -7588,7 +7618,7 @@ var LeaferUI = function(exports) {
|
|
|
7588
7618
|
}
|
|
7589
7619
|
if (data.__useEffect) {
|
|
7590
7620
|
const {shadow: shadow, fill: fill, stroke: stroke} = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
|
|
7591
|
-
stintSet$1(data, "__isFastShadow", shadow && !otherEffect && shadow.length < 2 && !shadow[0].spread && fill && !data.__isTransparentFill && !(isArray(fill) && fill.length > 1) && (this.useFastShadow || !stroke || stroke && data.strokeAlign === "inside"));
|
|
7621
|
+
stintSet$1(data, "__isFastShadow", shadow && !otherEffect && shadow.length < 2 && !shadow[0].spread && !Effect.isTransformShadow(shadow[0]) && fill && !data.__isTransparentFill && !(isArray(fill) && fill.length > 1) && (this.useFastShadow || !stroke || stroke && data.strokeAlign === "inside"));
|
|
7592
7622
|
data.__useEffect = !!(shadow || otherEffect);
|
|
7593
7623
|
}
|
|
7594
7624
|
data.__checkSingle();
|
|
@@ -8140,7 +8170,9 @@ var LeaferUI = function(exports) {
|
|
|
8140
8170
|
} else if (attrName === "zIndex") {
|
|
8141
8171
|
this.canvas.zIndex = newValue;
|
|
8142
8172
|
setTimeout(() => this.parent && this.parent.__updateSortChildren());
|
|
8143
|
-
}
|
|
8173
|
+
} else if (attrName === "mode") this.emit(LeaferEvent.UPDATE_MODE, {
|
|
8174
|
+
mode: newValue
|
|
8175
|
+
});
|
|
8144
8176
|
}
|
|
8145
8177
|
return super.__setAttr(attrName, newValue);
|
|
8146
8178
|
}
|
|
@@ -8319,6 +8351,7 @@ var LeaferUI = function(exports) {
|
|
|
8319
8351
|
exports.Leafer.list = new LeafList;
|
|
8320
8352
|
__decorate([ dataProcessor(LeaferData) ], exports.Leafer.prototype, "__", void 0);
|
|
8321
8353
|
__decorate([ boundsType() ], exports.Leafer.prototype, "pixelRatio", void 0);
|
|
8354
|
+
__decorate([ dataType("normal") ], exports.Leafer.prototype, "mode", void 0);
|
|
8322
8355
|
exports.Leafer = Leafer_1 = __decorate([ registerUI() ], exports.Leafer);
|
|
8323
8356
|
exports.Rect = class Rect extends exports.UI {
|
|
8324
8357
|
get __tag() {
|
|
@@ -8478,45 +8511,8 @@ var LeaferUI = function(exports) {
|
|
|
8478
8511
|
__decorate([ pathType(0) ], exports.Ellipse.prototype, "startAngle", void 0);
|
|
8479
8512
|
__decorate([ pathType(0) ], exports.Ellipse.prototype, "endAngle", void 0);
|
|
8480
8513
|
exports.Ellipse = __decorate([ registerUI() ], exports.Ellipse);
|
|
8481
|
-
const {moveTo: moveTo$2, lineTo: lineTo$2, drawPoints: drawPoints$1} = PathCommandDataHelper;
|
|
8482
|
-
const {rotate: rotate$1, getAngle: getAngle$1, getDistance: getDistance$2, defaultPoint: defaultPoint} = PointHelper;
|
|
8483
|
-
exports.Line = class Line extends exports.UI {
|
|
8484
|
-
get __tag() {
|
|
8485
|
-
return "Line";
|
|
8486
|
-
}
|
|
8487
|
-
get toPoint() {
|
|
8488
|
-
const {width: width, rotation: rotation} = this.__;
|
|
8489
|
-
const to = getPointData();
|
|
8490
|
-
if (width) to.x = width;
|
|
8491
|
-
if (rotation) rotate$1(to, rotation);
|
|
8492
|
-
return to;
|
|
8493
|
-
}
|
|
8494
|
-
set toPoint(value) {
|
|
8495
|
-
this.width = getDistance$2(defaultPoint, value);
|
|
8496
|
-
this.rotation = getAngle$1(defaultPoint, value);
|
|
8497
|
-
if (this.height) this.height = 0;
|
|
8498
|
-
}
|
|
8499
|
-
__updatePath() {
|
|
8500
|
-
const data = this.__;
|
|
8501
|
-
const path = data.path = [];
|
|
8502
|
-
if (data.points) {
|
|
8503
|
-
drawPoints$1(path, data.points, data.curve, data.closed);
|
|
8504
|
-
} else {
|
|
8505
|
-
moveTo$2(path, 0, 0);
|
|
8506
|
-
lineTo$2(path, this.width, 0);
|
|
8507
|
-
}
|
|
8508
|
-
}
|
|
8509
|
-
};
|
|
8510
|
-
__decorate([ dataProcessor(LineData) ], exports.Line.prototype, "__", void 0);
|
|
8511
|
-
__decorate([ affectStrokeBoundsType("center") ], exports.Line.prototype, "strokeAlign", void 0);
|
|
8512
|
-
__decorate([ boundsType(0) ], exports.Line.prototype, "height", void 0);
|
|
8513
|
-
__decorate([ pathType() ], exports.Line.prototype, "points", void 0);
|
|
8514
|
-
__decorate([ pathType(0) ], exports.Line.prototype, "curve", void 0);
|
|
8515
|
-
__decorate([ pathType(false) ], exports.Line.prototype, "closed", void 0);
|
|
8516
|
-
exports.Line = __decorate([ registerUI() ], exports.Line);
|
|
8517
8514
|
const {sin: sin$1, cos: cos$1, PI: PI$1} = Math;
|
|
8518
|
-
const {moveTo: moveTo$
|
|
8519
|
-
const line = exports.Line.prototype;
|
|
8515
|
+
const {moveTo: moveTo$2, lineTo: lineTo$2, closePath: closePath$1, drawPoints: drawPoints$1} = PathCommandDataHelper;
|
|
8520
8516
|
exports.Polygon = class Polygon extends exports.UI {
|
|
8521
8517
|
get __tag() {
|
|
8522
8518
|
return "Polygon";
|
|
@@ -8525,29 +8521,25 @@ var LeaferUI = function(exports) {
|
|
|
8525
8521
|
const data = this.__;
|
|
8526
8522
|
const path = data.path = [];
|
|
8527
8523
|
if (data.points) {
|
|
8528
|
-
drawPoints(path, data.points, data.curve, true);
|
|
8524
|
+
drawPoints$1(path, data.points, data.curve, true);
|
|
8529
8525
|
} else {
|
|
8530
8526
|
const {width: width, height: height, sides: sides} = data;
|
|
8531
8527
|
const rx = width / 2, ry = height / 2;
|
|
8532
|
-
moveTo$
|
|
8528
|
+
moveTo$2(path, rx, 0);
|
|
8533
8529
|
for (let i = 1; i < sides; i++) {
|
|
8534
|
-
lineTo$
|
|
8530
|
+
lineTo$2(path, rx + rx * sin$1(i * 2 * PI$1 / sides), ry - ry * cos$1(i * 2 * PI$1 / sides));
|
|
8535
8531
|
}
|
|
8536
8532
|
closePath$1(path);
|
|
8537
8533
|
}
|
|
8538
8534
|
}
|
|
8539
|
-
__updateRenderPath() {}
|
|
8540
|
-
__updateBoxBounds() {}
|
|
8541
8535
|
};
|
|
8542
8536
|
__decorate([ dataProcessor(PolygonData) ], exports.Polygon.prototype, "__", void 0);
|
|
8543
8537
|
__decorate([ pathType(3) ], exports.Polygon.prototype, "sides", void 0);
|
|
8544
8538
|
__decorate([ pathType() ], exports.Polygon.prototype, "points", void 0);
|
|
8545
8539
|
__decorate([ pathType(0) ], exports.Polygon.prototype, "curve", void 0);
|
|
8546
|
-
__decorate([ rewrite(line.__updateRenderPath) ], exports.Polygon.prototype, "__updateRenderPath", null);
|
|
8547
|
-
__decorate([ rewrite(line.__updateBoxBounds) ], exports.Polygon.prototype, "__updateBoxBounds", null);
|
|
8548
8540
|
exports.Polygon = __decorate([ rewriteAble(), registerUI() ], exports.Polygon);
|
|
8549
8541
|
const {sin: sin, cos: cos, PI: PI} = Math;
|
|
8550
|
-
const {moveTo: moveTo, lineTo: lineTo, closePath: closePath} = PathCommandDataHelper;
|
|
8542
|
+
const {moveTo: moveTo$1, lineTo: lineTo$1, closePath: closePath} = PathCommandDataHelper;
|
|
8551
8543
|
exports.Star = class Star extends exports.UI {
|
|
8552
8544
|
get __tag() {
|
|
8553
8545
|
return "Star";
|
|
@@ -8556,9 +8548,9 @@ var LeaferUI = function(exports) {
|
|
|
8556
8548
|
const {width: width, height: height, corners: corners, innerRadius: innerRadius} = this.__;
|
|
8557
8549
|
const rx = width / 2, ry = height / 2;
|
|
8558
8550
|
const path = this.__.path = [];
|
|
8559
|
-
moveTo(path, rx, 0);
|
|
8551
|
+
moveTo$1(path, rx, 0);
|
|
8560
8552
|
for (let i = 1; i < corners * 2; i++) {
|
|
8561
|
-
lineTo(path, rx + (i % 2 === 0 ? rx : rx * innerRadius) * sin(i * PI / corners), ry - (i % 2 === 0 ? ry : ry * innerRadius) * cos(i * PI / corners));
|
|
8553
|
+
lineTo$1(path, rx + (i % 2 === 0 ? rx : rx * innerRadius) * sin(i * PI / corners), ry - (i % 2 === 0 ? ry : ry * innerRadius) * cos(i * PI / corners));
|
|
8562
8554
|
}
|
|
8563
8555
|
closePath(path);
|
|
8564
8556
|
}
|
|
@@ -8567,6 +8559,42 @@ var LeaferUI = function(exports) {
|
|
|
8567
8559
|
__decorate([ pathType(5) ], exports.Star.prototype, "corners", void 0);
|
|
8568
8560
|
__decorate([ pathType(.382) ], exports.Star.prototype, "innerRadius", void 0);
|
|
8569
8561
|
exports.Star = __decorate([ registerUI() ], exports.Star);
|
|
8562
|
+
const {moveTo: moveTo, lineTo: lineTo, drawPoints: drawPoints} = PathCommandDataHelper;
|
|
8563
|
+
const {rotate: rotate$1, getAngle: getAngle$1, getDistance: getDistance$2, defaultPoint: defaultPoint} = PointHelper;
|
|
8564
|
+
exports.Line = class Line extends exports.UI {
|
|
8565
|
+
get __tag() {
|
|
8566
|
+
return "Line";
|
|
8567
|
+
}
|
|
8568
|
+
get toPoint() {
|
|
8569
|
+
const {width: width, rotation: rotation} = this.__;
|
|
8570
|
+
const to = getPointData();
|
|
8571
|
+
if (width) to.x = width;
|
|
8572
|
+
if (rotation) rotate$1(to, rotation);
|
|
8573
|
+
return to;
|
|
8574
|
+
}
|
|
8575
|
+
set toPoint(value) {
|
|
8576
|
+
this.width = getDistance$2(defaultPoint, value);
|
|
8577
|
+
this.rotation = getAngle$1(defaultPoint, value);
|
|
8578
|
+
if (this.height) this.height = 0;
|
|
8579
|
+
}
|
|
8580
|
+
__updatePath() {
|
|
8581
|
+
const data = this.__;
|
|
8582
|
+
const path = data.path = [];
|
|
8583
|
+
if (data.points) {
|
|
8584
|
+
drawPoints(path, data.points, data.curve, data.closed);
|
|
8585
|
+
} else {
|
|
8586
|
+
moveTo(path, 0, 0);
|
|
8587
|
+
lineTo(path, this.width, 0);
|
|
8588
|
+
}
|
|
8589
|
+
}
|
|
8590
|
+
};
|
|
8591
|
+
__decorate([ dataProcessor(LineData) ], exports.Line.prototype, "__", void 0);
|
|
8592
|
+
__decorate([ affectStrokeBoundsType("center") ], exports.Line.prototype, "strokeAlign", void 0);
|
|
8593
|
+
__decorate([ boundsType(0) ], exports.Line.prototype, "height", void 0);
|
|
8594
|
+
__decorate([ pathType() ], exports.Line.prototype, "points", void 0);
|
|
8595
|
+
__decorate([ pathType(0) ], exports.Line.prototype, "curve", void 0);
|
|
8596
|
+
__decorate([ pathType(false) ], exports.Line.prototype, "closed", void 0);
|
|
8597
|
+
exports.Line = __decorate([ registerUI() ], exports.Line);
|
|
8570
8598
|
exports.Image = class Image extends exports.Rect {
|
|
8571
8599
|
get __tag() {
|
|
8572
8600
|
return "Image";
|
|
@@ -8699,10 +8727,6 @@ var LeaferUI = function(exports) {
|
|
|
8699
8727
|
DataHelper.stintSet(this, "isOverflow", !includes(b, contentBounds));
|
|
8700
8728
|
if (this.isOverflow) setList(data.__textBoxBounds = {}, [ b, contentBounds ]), layout.renderChanged = true; else data.__textBoxBounds = b;
|
|
8701
8729
|
}
|
|
8702
|
-
__onUpdateSize() {
|
|
8703
|
-
if (this.__box) this.__box.__onUpdateSize();
|
|
8704
|
-
super.__onUpdateSize();
|
|
8705
|
-
}
|
|
8706
8730
|
__updateRenderSpread() {
|
|
8707
8731
|
let width = super.__updateRenderSpread();
|
|
8708
8732
|
if (!width) width = this.isOverflow ? 1 : 0;
|
|
@@ -8713,6 +8737,11 @@ var LeaferUI = function(exports) {
|
|
|
8713
8737
|
copyAndSpread(renderBounds, this.__.__textBoxBounds, renderSpread);
|
|
8714
8738
|
if (this.__box) this.__box.__layout.renderBounds = renderBounds;
|
|
8715
8739
|
}
|
|
8740
|
+
__updateChange() {
|
|
8741
|
+
super.__updateChange();
|
|
8742
|
+
const box = this.__box;
|
|
8743
|
+
if (box) box.__onUpdateSize(), box.__updateChange();
|
|
8744
|
+
}
|
|
8716
8745
|
__drawRenderPath(canvas) {
|
|
8717
8746
|
canvas.font = this.__.__font;
|
|
8718
8747
|
}
|
|
@@ -10964,11 +10993,16 @@ var LeaferUI = function(exports) {
|
|
|
10964
10993
|
}
|
|
10965
10994
|
worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, "destination-out") : other.copyWorld(shape.canvas, shapeBounds, bounds, "destination-out");
|
|
10966
10995
|
}
|
|
10967
|
-
LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
10996
|
+
if (Effect.isTransformShadow(item)) Effect.renderTransformShadow(ui, current, other, copyBounds, item); else LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
10968
10997
|
if (end && index < end) other.clearWorld(copyBounds);
|
|
10969
10998
|
});
|
|
10970
10999
|
other.recycle(copyBounds);
|
|
10971
11000
|
}
|
|
11001
|
+
function getShadowSpread(_ui, shadow) {
|
|
11002
|
+
let width = 0;
|
|
11003
|
+
shadow.forEach(item => width = Math.max(width, Math.max(Math.abs(item.y), Math.abs(item.x)) + (item.spread > 0 ? item.spread : 0) + item.blur * 1.5));
|
|
11004
|
+
return width;
|
|
11005
|
+
}
|
|
10972
11006
|
function drawWorldShadow(canvas, outBounds, spreadScale, shape) {
|
|
10973
11007
|
const {bounds: bounds, shapeBounds: shapeBounds} = shape;
|
|
10974
11008
|
if (Platform.fullImageShadow) {
|
|
@@ -11040,7 +11074,11 @@ var LeaferUI = function(exports) {
|
|
|
11040
11074
|
shadow: shadow,
|
|
11041
11075
|
innerShadow: innerShadow,
|
|
11042
11076
|
blur: blur,
|
|
11043
|
-
backgroundBlur: backgroundBlur
|
|
11077
|
+
backgroundBlur: backgroundBlur,
|
|
11078
|
+
getShadowSpread: getShadowSpread,
|
|
11079
|
+
isTransformShadow(_shadow) {
|
|
11080
|
+
return undefined;
|
|
11081
|
+
}
|
|
11044
11082
|
};
|
|
11045
11083
|
const {excludeRenderBounds: excludeRenderBounds} = LeafBoundsHelper;
|
|
11046
11084
|
let usedGrayscaleAlpha;
|
|
@@ -11496,16 +11534,17 @@ var LeaferUI = function(exports) {
|
|
|
11496
11534
|
row.data = null;
|
|
11497
11535
|
}
|
|
11498
11536
|
function decorationText(drawData, style) {
|
|
11499
|
-
let type;
|
|
11537
|
+
let type, offset = 0;
|
|
11500
11538
|
const {fontSize: fontSize, textDecoration: textDecoration} = style;
|
|
11501
11539
|
drawData.decorationHeight = fontSize / 11;
|
|
11502
11540
|
if (isObject(textDecoration)) {
|
|
11503
11541
|
type = textDecoration.type;
|
|
11504
11542
|
if (textDecoration.color) drawData.decorationColor = ColorConvert.string(textDecoration.color);
|
|
11543
|
+
if (textDecoration.offset) offset = Math.min(fontSize * .3, Math.max(textDecoration.offset, -fontSize * .15));
|
|
11505
11544
|
} else type = textDecoration;
|
|
11506
11545
|
switch (type) {
|
|
11507
11546
|
case "under":
|
|
11508
|
-
drawData.decorationY = [ fontSize * .15 ];
|
|
11547
|
+
drawData.decorationY = [ fontSize * .15 + offset ];
|
|
11509
11548
|
break;
|
|
11510
11549
|
|
|
11511
11550
|
case "delete":
|
|
@@ -11513,7 +11552,7 @@ var LeaferUI = function(exports) {
|
|
|
11513
11552
|
break;
|
|
11514
11553
|
|
|
11515
11554
|
case "under-delete":
|
|
11516
|
-
drawData.decorationY = [ fontSize * .15, -fontSize * .35 ];
|
|
11555
|
+
drawData.decorationY = [ fontSize * .15 + offset, -fontSize * .35 ];
|
|
11517
11556
|
}
|
|
11518
11557
|
}
|
|
11519
11558
|
const {top: top, right: right, bottom: bottom, left: left} = exports.Direction4;
|
package/dist/worker.min.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var t=require("@leafer/core"),e=require("@leafer-ui/core"),i=require("@leafer-ui/draw");class n extends t.LeaferCanvasBase{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=t.Platform.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this;this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i),this.clientBounds=this.bounds}}t.canvasPatch(OffscreenCanvasRenderingContext2D.prototype),t.canvasPatch(Path2D.prototype);const{mineType:a}=t.FileHelper;function s(e,i){t.Platform.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,i)=>new Promise((n,s)=>{t.convertToBlob({type:a(e),quality:i}).then(t=>{var e=new FileReader;e.onload=t=>n(t.target.result),e.onerror=t=>s(t),e.readAsDataURL(t)}).catch(t=>{s(t)})}),canvasToBolb:(t,e,i)=>t.convertToBlob({type:a(e),quality:i}),canvasSaveAs:(t,e,i)=>new Promise(t=>t()),download(t,e){},loadImage:e=>new Promise((i,n)=>{let a=new XMLHttpRequest;a.open("GET",t.Platform.image.getRealURL(e),!0),a.responseType="blob",a.onload=()=>{createImageBitmap(a.response).then(t=>{i(t)}).catch(t=>{n(t)})},a.onerror=t=>n(t),a.send()})},t.Platform.canvas=t.Creator.canvas(),t.Platform.conicGradientSupport=!!t.Platform.canvas.context.createConicGradient}Object.assign(t.Creator,{canvas:(t,e)=>new n(t,e),image:e=>new t.LeaferImage(e)}),t.Platform.name="web",t.Platform.isWorker=!0,t.Platform.backgrounder=!0,t.Platform.requestRender=function(t){requestAnimationFrame(t)},t.defineKey(t.Platform,"devicePixelRatio",{get:()=>1});const{userAgent:r}=navigator;r.indexOf("Firefox")>-1?(t.Platform.conicGradientRotate90=!0,t.Platform.intWheelDeltaY=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(t.Platform.fullImageShadow=!0),r.indexOf("Windows")>-1?(t.Platform.os="Windows",t.Platform.intWheelDeltaY=!0):r.indexOf("Mac")>-1?t.Platform.os="Mac":r.indexOf("Linux")>-1&&(t.Platform.os="Linux");class o{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const e=new t.LeafList;return this.__updatedList.list.forEach(t=>{t.leafer&&e.add(t)}),e}return this.__updatedList}constructor(e,i){this.totalTimes=0,this.config={},this.__updatedList=new t.LeafList,this.target=e,i&&(this.config=t.DataHelper.default(i,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(t.RenderEvent.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(e){e.type===t.ChildEvent.ADD?(this.hasAdd=!0,this.__pushChild(e.child)):(this.hasRemove=!0,this.__updatedList.add(e.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 t.WatchEvent(t.WatchEvent.DATA,{updatedList:this.updatedList})),this.__updatedList=new t.LeafList,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[t.PropertyEvent.CHANGE,this.__onAttrChange,this],[[t.ChildEvent.ADD,t.ChildEvent.REMOVE],this.__onChildEvent,this],[t.WatchEvent.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:l,updateBounds:d,updateChange:h}=t.LeafHelper,{pushAllChildBranch:c,pushAllParent:u}=t.BranchHelper;const{worldBounds:f}=t.LeafBoundsHelper;class g{constructor(e){this.updatedBounds=new t.Bounds,this.beforeBounds=new t.Bounds,this.afterBounds=new t.Bounds,t.isArray(e)&&(e=new t.LeafList(e)),this.updatedList=e}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,f)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,f),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:p,updateAllChange:_}=t.LeafHelper,y=t.Debug.get("Layouter");class m{constructor(e,i){this.totalTimes=0,this.config={},this.__levelList=new t.LeafLevelList,this.target=e,i&&(this.config=t.DataHelper.default(i,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:e}=this;this.times=0;try{e.emit(t.LayoutEvent.START),this.layoutOnce(),e.emitEvent(new t.LayoutEvent(t.LayoutEvent.END,this.layoutedBlocks,this.times))}catch(t){y.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?y.warn("layouting"):this.times>3?y.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(t.WatchEvent.REQUEST),this.totalTimes>1?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var e;if(!(null===(e=this.__updatedList)||void 0===e?void 0:e.length))return;const i=t.Run.start("PartLayout"),{target:n,__updatedList:a}=this,{BEFORE:s,LAYOUT:r,AFTER:o}=t.LayoutEvent,f=this.getBlocks(a);f.forEach(t=>t.setBefore()),n.emitEvent(new t.LayoutEvent(s,f,this.times)),this.extraBlock=null,a.sort(),function(t,e){let i;t.list.forEach(t=>{i=t.__layout,e.without(t)&&!i.proxyZoom&&(i.matrixChanged?(l(t,!0),e.add(t),t.isBranch&&c(t,e),u(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),u(t,e)))})}(a,this.__levelList),function(t){let e,i,n;t.sort(!0),t.levels.forEach(a=>{e=t.levelMap[a];for(let t=0,a=e.length;t<a;t++){if(i=e[t],i.isBranch&&i.__tempNumber){n=i.children;for(let t=0,e=n.length;t<e;t++)n[t].isBranch||d(n[t])}d(i)}})}(this.__levelList),function(t){t.list.forEach(h)}(a),this.extraBlock&&f.push(this.extraBlock),f.forEach(t=>t.setAfter()),n.emitEvent(new t.LayoutEvent(r,f,this.times)),n.emitEvent(new t.LayoutEvent(o,f,this.times)),this.addBlocks(f),this.__levelList.reset(),this.__updatedList=null,t.Run.end(i)}fullLayout(){const e=t.Run.start("FullLayout"),{target:i}=this,{BEFORE:n,LAYOUT:a,AFTER:s}=t.LayoutEvent,r=this.getBlocks(new t.LeafList(i));i.emitEvent(new t.LayoutEvent(n,r,this.times)),m.fullLayout(i),r.forEach(t=>{t.setAfter()}),i.emitEvent(new t.LayoutEvent(a,r,this.times)),i.emitEvent(new t.LayoutEvent(s,r,this.times)),this.addBlocks(r),t.Run.end(e)}static fullLayout(e){p(e,!0),e.isBranch?t.BranchHelper.updateBounds(e):t.LeafHelper.updateBounds(e),_(e)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new g([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new g(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_([[t.LayoutEvent.REQUEST,this.layout,this],[t.LayoutEvent.AGAIN,this.layoutAgain,this],[t.WatchEvent.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const w=t.Debug.get("Renderer");class v{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(e,i,n){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:120},this.target=e,this.canvas=i,n&&(this.config=t.DataHelper.default(n,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(t.LayoutEvent.REQUEST)}checkRender(){if(this.running){const{target:e}=this;e.isApp&&(e.emit(t.RenderEvent.CHILD_START,e),e.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),e.emit(t.RenderEvent.CHILD_END,e)),this.changed&&this.canvas.view&&this.render(),this.target.emit(t.RenderEvent.NEXT)}}render(e){if(!this.running||!this.canvas.view)return this.update();const{target:i}=this;this.times=0,this.totalBounds=new t.Bounds,w.log(i.innerName,"---\x3e");try{this.emitRender(t.RenderEvent.START),this.renderOnce(e),this.emitRender(t.RenderEvent.END,this.totalBounds),t.ImageManager.clearRecycled()}catch(t){this.rendering=!1,w.error(t)}w.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(e){if(this.rendering)return w.warn("rendering");if(this.times>3)return w.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new t.Bounds,this.renderOptions={},e)this.emitRender(t.RenderEvent.BEFORE),e();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(t.RenderEvent.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(t.RenderEvent.RENDER,this.renderBounds,this.renderOptions),this.emitRender(t.RenderEvent.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(e){const i=t.Run.start("PartRender"),{canvas:n}=this,a=e.getIntersect(n.bounds),s=new t.Bounds(a);n.save(),a.spread(v.clipSpread).ceil(),n.clearWorld(a),n.clipWorld(a),this.__render(a,s),n.restore(),t.Run.end(i)}fullRender(){const e=t.Run.start("FullRender"),{canvas:i}=this;i.save(),i.clear(),this.__render(i.bounds),i.restore(),t.Run.end(e)}__render(e,i){const{canvas:n}=this,a=e.includes(this.target.__world),s=a?{includes:a}:{bounds:e,includes:a};this.needFill&&n.fillWorld(e,this.config.fill),t.Debug.showRepaint&&t.Debug.drawRepaint(n,e),this.target.__render(n,s),this.renderBounds=i=i||e,this.renderOptions=s,this.totalBounds.isEmpty()?this.totalBounds=i:this.totalBounds.add(i),n.updateRender(i)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:e}=this;if(e){const i=new t.Bounds;i.setList(e),e.length=0,e.push(i)}}__requestRender(){const e=this.target;if(this.requestTime||!e)return;if(e.parentApp)return e.parentApp.requestRender(!1);const i=this.requestTime=Date.now(),n=()=>{const e=1e3/(Date.now()-i),{maxFPS:a}=this.config;if(a&&e>a-.5)return t.Platform.requestRender(n);this.FPS=Math.min(120,Math.ceil(e)),this.requestTime=0,this.checkRender()};t.Platform.requestRender(n)}__onResize(e){if(!this.canvas.unreal){if(e.bigger||!e.samePixelRatio){const{width:i,height:n}=e.old;if(!new t.Bounds(0,0,i,n).includes(this.target.__world)||this.needFill||!e.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new t.Bounds(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||w.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(e,i,n){this.target.emitEvent(new t.RenderEvent(e,this.times,i,n))}__listenEvents(){this.__eventIds=[this.target.on_([[t.RenderEvent.REQUEST,this.update,this],[t.LayoutEvent.END,this.__onLayoutEnd,this],[t.RenderEvent.AGAIN,this.renderAgain,this],[t.ResizeEvent.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}v.clipSpread=10;const{hitRadiusPoint:x}=t.BoundsHelper;class b{constructor(t,e){this.target=t,this.selector=e}getByPoint(e,i,n){i||(i=0),n||(n={});const a=n.through||!1,s=n.ignoreHittable||!1,r=n.target||this.target;this.exclude=n.exclude||null,this.point={x:e.x,y:e.y,radiusX:i,radiusY:i},this.findList=new t.LeafList(n.findList),n.findList||this.hitBranch(r.isBranchLeaf?{children:[r]}:r);const{list:o}=this.findList,l=this.getBestMatchLeaf(o,n.bottomList,s),d=s?this.getPath(l):this.getHitablePath(l);return this.clear(),a?{path:d,target:l,throughPath:o.length?this.getThroughPath(o):d}:{path:d,target:l}}hitPoint(t,e,i){return!!this.getByPoint(t,e,i).target}getBestMatchLeaf(e,i,n){const a=this.findList=new t.LeafList;if(e.length){let i;const{x:s,y:r}=this.point,o={x:s,y:r,radiusX:0,radiusY:0};for(let s=0,r=e.length;s<r;s++)if(i=e[s],(n||t.LeafHelper.worldHittable(i))&&(this.hitChild(i,o),a.length)){if(i.isBranchLeaf&&e.some(e=>e!==i&&t.LeafHelper.hasParent(e,i))){a.reset();break}return a.list[0]}}if(i)for(let t=0,e=i.length;t<e;t++)if(this.hitChild(i[t].target,this.point,i[t].proxy),a.length)return a.list[0];return n?e[0]:e.find(e=>t.LeafHelper.worldHittable(e))}getPath(e){const i=new t.LeafList;for(;e;)i.add(e),e=e.parent;return this.target&&i.add(this.target),i}getHitablePath(e){const i=this.getPath(e&&e.hittable?e:null);let n,a=new t.LeafList;for(let t=i.list.length-1;t>-1&&(n=i.list[t],n.__.hittable)&&(a.addAt(n,0),n.__.hitChildren);t--);return a}getThroughPath(e){const i=new t.LeafList,n=[];for(let t=e.length-1;t>-1;t--)n.push(this.getPath(e[t]));let a,s,r;for(let t=0,e=n.length;t<e;t++){a=n[t],s=n[t+1];for(let t=0,e=a.length;t<e&&(r=a.list[t],!s||!s.has(r));t++)i.add(r)}return i}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,n;const{point:a}=this;for(let s=t.length-1;s>-1;s--)i=t[s],!i.__.visible||e&&!i.__.mask||(n=!!i.__.hitRadius||x(i.__world,a),i.isBranch?(n||i.__ignoreHitWorld)&&(i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,a)):n&&this.hitChild(i,a))}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:n}=t;if(n&&n.__hasMask&&!t.__.mask){let i,a=[];const{children:s}=n;for(let n=0,r=s.length;n<r;n++)if(i=s[n],i.__.mask&&a.push(i),i===t){if(a&&!a.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 B{constructor(e,i){this.config={},i&&(this.config=t.DataHelper.default(i,this.config)),this.picker=new b(this.target=e,this),this.finder=t.Creator.finder&&t.Creator.finder()}getByPoint(e,i,n){const{target:a,picker:s}=this;return t.Platform.backgrounder&&a&&a.updateLayout(),s.getByPoint(e,i,n)}hitPoint(t,e,i){return this.picker.hitPoint(t,e,i)}getBy(e,i,n,a){return this.finder?this.finder.getBy(e,i,n,a):t.Plugin.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function E(t,e){const i=t.__,{rows:n,decorationY:a}=i.__textDrawData;let s;i.__isPlacehold&&i.placeholderColor&&(e.fillStyle=i.placeholderColor);for(let t=0,i=n.length;t<i;t++)s=n[t],s.text?e.fillText(s.text,s.x,s.y):s.data&&s.data.forEach(t=>{e.fillText(t.char,t.x,s.y)});if(a){const{decorationColor:t,decorationHeight:s}=i.__textDrawData;t&&(e.fillStyle=t),n.forEach(t=>a.forEach(i=>e.fillRect(t.x,t.y+i,t.width,s)))}}function L(t,e){t.__.__font?E(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function k(t,e,i){switch(e.__.strokeAlign){case"center":S(t,1,e,i);break;case"inside":P(t,"inside",e,i);break;case"outside":e.__.__fillAfterStroke?S(t,2,e,i):P(t,"outside",e,i)}}function S(e,i,n,a){const s=n.__;t.isObject(e)?C(e,i,!0,n,a):(a.setStroke(e,s.__strokeWidth*i,s),R(n,a))}function P(e,i,n,a){const s=a.getSameCanvas(!0,!0);s.font=n.__.__font,S(e,2,n,s),s.blendMode="outside"===i?"destination-out":"destination-in",E(n,s),s.blendMode="normal",t.LeafHelper.copyCanvasByWorld(n,a,s),s.recycle(n.__nowWorld)}function R(t,e){let i,n=t.__.__textDrawData;const{rows:a,decorationY:s}=n;for(let t=0,n=a.length;t<n;t++)i=a[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(s){const{decorationHeight:t}=n;a.forEach(i=>s.forEach(n=>e.strokeRect(i.x,i.y+n,i.width,t)))}}function C(t,e,n,a,s){let r;const o=a.__,{__hasMultiStrokeStyle:l}=o;l||s.setStroke(void 0,o.__strokeWidth*e,o);for(let d=0,h=t.length;d<h;d++)if(r=t[d],(!r.image||!i.PaintImage.checkImage(a,s,r,!1))&&r.style){if(l){const{strokeStyle:t}=r;t?s.setStroke(r.style,o.__getRealStrokeWidth(t)*e,o,t):s.setStroke(r.style,o.__strokeWidth*e,o)}else s.strokeStyle=r.style;r.blendMode?(s.saveBlendMode(r.blendMode),n?R(a,s):s.stroke(),s.restoreBlendMode()):n?R(a,s):s.stroke()}}function A(e,i,n){const a=i.__;if(a.__strokeWidth)if(a.__font)k(e,i,n);else switch(a.strokeAlign){case"center":O(e,1,i,n);break;case"inside":!function(t,e,i){i.save(),i.clipUI(e),O(t,2,e,i),i.restore()}(e,i,n);break;case"outside":!function(e,i,n){const a=i.__;if(a.__fillAfterStroke)O(e,2,i,n);else{const{renderBounds:s}=i.__layout,r=n.getSameCanvas(!0,!0);i.__drawRenderPath(r),O(e,2,i,r),r.clipUI(a),r.clearWorld(s),t.LeafHelper.copyCanvasByWorld(i,n,r),r.recycle(i.__nowWorld)}}(e,i,n)}}function O(e,n,a,s){const r=a.__;t.isObject(e)?C(e,n,!1,a,s):(s.setStroke(e,r.__strokeWidth*n,r),s.stroke()),r.__useArrow&&i.Paint.strokeArrow(e,a,s)}Object.assign(t.Creator,{watcher:(t,e)=>new o(t,e),layouter:(t,e)=>new m(t,e),renderer:(t,e,i)=>new v(t,e,i),selector:(t,e)=>new B(t,e)}),t.Platform.layout=m.fullLayout;const{getSpread:M,getOuterOf:T,getByMove:W,getIntersectData:D}=t.BoundsHelper;let H;const{stintSet:I}=t.DataHelper,{hasTransparent:F}=i.ColorConvert;function j(e,n,a){if(!t.isObject(n)||!1===n.visible||0===n.opacity)return;let s;const{boxBounds:r}=a.__layout;switch(n.type){case"image":s=i.PaintImage.image(a,e,n,r,!H||!H[n.url]);break;case"linear":s=i.PaintGradient.linearGradient(n,r);break;case"radial":s=i.PaintGradient.radialGradient(n,r);break;case"angular":s=i.PaintGradient.conicGradient(n,r);break;case"solid":const{type:o,color:l,opacity:d}=n;s={type:o,style:i.ColorConvert.string(l,d)};break;default:t.isUndefined(n.r)||(s={type:"solid",style:i.ColorConvert.string(n)})}if(s){if(t.isString(s.style)&&F(s.style)&&(s.isTransparent=!0),n.style){if(0===n.style.strokeWidth)return;s.strokeStyle=n.style}n.editing&&(s.editing=n.editing),n.blendMode&&(s.blendMode=n.blendMode)}return s}const G={compute:function(e,n){const a=n.__,s=[];let r,o,l,d=a.__input[e];t.isArray(d)||(d=[d]),H=i.PaintImage.recycleImage(e,a);for(let t,i=0,a=d.length;i<a;i++)(t=j(e,d[i],n))&&(s.push(t),t.strokeStyle&&(l||(l=1),t.strokeStyle.strokeWidth&&(l=Math.max(l,t.strokeStyle.strokeWidth))));a["_"+e]=s.length?s:void 0,s.length&&s.every(t=>t.isTransparent)&&(s.some(t=>t.image)&&(r=!0),o=!0),"fill"===e?(I(a,"__isAlphaPixelFill",r),I(a,"__isTransparentFill",o)):(I(a,"__isAlphaPixelStroke",r),I(a,"__isTransparentStroke",o),I(a,"__hasMultiStrokeStyle",l))},fill:function(t,e,i){i.fillStyle=t,L(e,i)},fills:function(t,e,n){let a;for(let s=0,r=t.length;s<r;s++){if(a=t[s],a.image){if(i.PaintImage.checkImage(e,n,a,!e.__.__font))continue;if(!a.style){!s&&a.image.isPlacehold&&e.drawImagePlaceholder(n,a.image);continue}}if(n.fillStyle=a.style,a.transform||a.scaleFixed){if(n.save(),a.transform&&n.transform(a.transform),a.scaleFixed){const{scaleX:t,scaleY:i}=e.getRenderScaleData(!0);(!0===a.scaleFixed||"zoom-in"===a.scaleFixed&&t>1&&i>1)&&n.scale(1/t,1/i)}a.blendMode&&(n.blendMode=a.blendMode),L(e,n),n.restore()}else a.blendMode?(n.saveBlendMode(a.blendMode),L(e,n),n.restoreBlendMode()):L(e,n)}},fillPathOrText:L,fillText:E,stroke:A,strokes:function(t,e,i){A(t,e,i)},strokeText:k,drawTextStroke:R,shape:function(e,i,n){const a=i.getSameCanvas(),s=e.__nowWorld,r=i.bounds;let o,l,d,h,c,{scaleX:u,scaleY:f}=e.getRenderScaleData(!0);if(r.includes(s))c=a,o=h=s;else{const{renderShapeSpread:a}=e.__layout;let g;if(t.Platform.fullImageShadow)g=s;else{const t=a?M(r,u===f?a*u:[a*f,a*u]):r;g=D(t,s)}d=r.getFitMatrix(g);let{a:p,d:_}=d;d.a<1&&(c=i.getSameCanvas(),e.__renderShape(c,n),u*=p,f*=_),h=T(s,d),o=W(h,-d.e,-d.f);const y=n.matrix;y?(l=new t.Matrix(d),l.multiply(y),p*=y.scaleX,_*=y.scaleY):l=d,l.withScale(p,_),n=Object.assign(Object.assign({},n),{matrix:l})}return e.__renderShape(a,n),{canvas:a,matrix:l,fitMatrix:d,bounds:o,worldCanvas:c,shapeBounds:h,scaleX:u,scaleY:f}}};let z={},Y=t.getMatrixData();const{get:U,rotateOfOuter:q,translate:X,scaleOfOuter:N,multiplyParent:V,scale:Q,rotate:Z,skew:K}=t.MatrixHelper;function $(t,e,i,n,a,s,r){const o=U();X(o,e.x+i,e.y+n),Q(o,a,s),r&&q(o,{x:e.x+e.width/2,y:e.y+e.height/2},r),t.transform=o}function J(t,e,i,n,a,s,r,o,l){const d=U();et(d,e,i,n,a,s,r,o),l&&(Y.a=e.width/l.width,Y.d=e.height/l.height,V(d,Y)),t.transform=d}function tt(t,e,i,n,a,s,r,o,l,d,h,c){const u=U();if(c)et(u,e,a,s,r,o,l,d);else{if(l)if("center"===h)q(u,{x:i/2,y:n/2},l);else switch(Z(u,l),l){case 90:X(u,n,0);break;case 180:X(u,i,n);break;case 270:X(u,0,i)}z.x=e.x+a,z.y=e.y+s,X(u,z.x,z.y),r&&N(u,z,r,o)}t.transform=u}function et(t,e,i,n,a,s,r,o){r&&Z(t,r),o&&K(t,o.x,o.y),a&&Q(t,a,s),X(t,e.x+i,e.y+n)}const{get:it,translate:nt}=t.MatrixHelper,at=new t.Bounds,st={},rt={};function ot(t,e,i,n){const{changeful:a,sync:s,scaleFixed:r}=i;a&&(t.changeful=a),s&&(t.sync=s),r&&(t.scaleFixed=r),t.data=lt(i,n,e)}function lt(e,i,n){e.padding&&(i=at.set(i).shrink(e.padding)),"strench"===e.mode&&(e.mode="stretch");let{width:a,height:s}=n;const{opacity:r,mode:o,align:l,offset:d,scale:h,size:c,rotation:u,skew:f,clipSize:g,repeat:p,gap:_,filters:y}=e,m=i.width===a&&i.height===s,w={mode:o},v="center"!==l&&(u||0)%180==90;let x,b;switch(t.BoundsHelper.set(rt,0,0,v?s:a,v?a:s),o&&"cover"!==o&&"fit"!==o?((h||c)&&(t.MathHelper.getScaleData(h,c,n,st),x=st.scaleX,b=st.scaleY),(l||_||p)&&(x&&t.BoundsHelper.scale(rt,x,b,!0),l&&t.AlignHelper.toPoint(l,rt,i,rt,!0,!0))):m&&!u||(x=b=t.BoundsHelper.getFitScale(i,rt,"fit"!==o),t.BoundsHelper.put(i,n,l,x,!1,rt),t.BoundsHelper.scale(rt,x,b,!0)),d&&t.PointHelper.move(rt,d),o){case"stretch":m||(a=i.width,s=i.height);break;case"normal":case"clip":(rt.x||rt.y||x||g||u||f)&&J(w,i,rt.x,rt.y,x,b,u,f,e.clipSize);break;case"repeat":(!m||x||u||f)&&tt(w,i,a,s,rt.x,rt.y,x,b,u,f,l,e.freeTransform),p||(w.repeat="repeat");const n=t.isObject(p);(_||n)&&(w.gap=function(e,i,n,a,s){let r,o;t.isObject(e)?(r=e.x,o=e.y):r=o=e;return{x:dt(r,n,s.width,i&&i.x),y:dt(o,a,s.height,i&&i.y)}}(_,n&&p,rt.width,rt.height,i));break;default:x&&$(w,i,rt.x,rt.y,x,b,u)}return w.transform||(i.x||i.y)&&(w.transform=it(),nt(w.transform,i.x,i.y)),x&&"stretch"!==o&&(w.scaleX=x,w.scaleY=b),w.width=a,w.height=s,r&&(w.opacity=r),y&&(w.filters=y),p&&(w.repeat=t.isString(p)?"x"===p?"repeat-x":"repeat-y":"repeat"),w}function dt(e,i,n,a){const s=t.isString(e)||a?(a?n-a*i:n%i)/((a||Math.floor(n/i))-1):e;return"auto"===e&&s<0?0:s}let ht,ct=new t.Bounds;const{isSame:ut}=t.BoundsHelper;function ft(t,e,i,n,a,s){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=n.width/e.pixelRatio,e.__naturalHeight=n.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return a.data||ot(a,n,i,s),!0}function gt(e,i){yt(e,t.ImageEvent.LOAD,i)}function pt(e,i){yt(e,t.ImageEvent.LOADED,i)}function _t(e,i,n){i.error=n,e.forceUpdate("surface"),yt(e,t.ImageEvent.ERROR,i)}function yt(e,i,n){e.hasEvent(i)&&e.emitEvent(new t.ImageEvent(i,n))}function mt(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:wt,scale:vt,copy:xt}=t.MatrixHelper,{floor:bt,ceil:Bt,max:Et,abs:Lt}=Math;function kt(e,i,n){let{scaleX:a,scaleY:s}=e.getRenderScaleData(!0,i.scaleFixed);const r=a+"-"+s+"-"+n;if(i.patternId===r||e.destroyed)return!1;{const{image:o,data:l}=i;let d,h,{width:c,height:u,scaleX:f,scaleY:g,transform:p,repeat:_,gap:y}=l;a*=n,s*=n,f&&(f=Lt(f),g=Lt(g),h=wt(),xt(h,p),vt(h,1/f,1/g),a*=f,s*=g),c*=a,u*=s;const m=c*u;if(!_&&m>t.Platform.image.maxCacheSize)return!1;let w=t.Platform.image.maxPatternSize;if(o.isSVG){const t=c/o.width;t>1&&(d=t/Bt(t))}else{const t=o.width*o.height;w>t&&(w=t)}m>w&&(d=Math.sqrt(m/w)),d&&(a/=d,s/=d,c/=d,u/=d),f&&(a/=f,s/=g);const v=y&&y.x*a,x=y&&y.y*s;if(p||1!==a||1!==s){const t=c+(v||0),e=u+(x||0);a/=t/Et(bt(t),1),s/=e/Et(bt(e),1),h||(h=wt(),p&&xt(h,p)),vt(h,1/a,1/s)}const b=o.getCanvas(c,u,l.opacity,l.filters,v,x,e.leafer&&e.leafer.config.smooth),B=o.getPattern(b,_||t.Platform.origin.noRepeat||"no-repeat",h,i);return i.style=B,i.patternId=r,!0}}function St(t,e,i,n){return new(i||(i=Promise))(function(a,s){function r(t){try{l(n.next(t))}catch(t){s(t)}}function o(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?a(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(r,o)}l((n=n.apply(t,e||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const Pt={image:function(e,i,n,a,s){let r,o;const l=t.ImageManager.get(n);return ht&&n===ht.paint&&ut(a,ht.boxBounds)?r=ht.leafPaint:(r={type:n.type,image:l},l.hasAlphaPixel&&(r.isTransparent=!0),ht=l.use>1?{leafPaint:r,paint:n,boxBounds:ct.set(a)}:null),(s||l.loading)&&(o={image:l,attrName:i,attrValue:n}),l.ready?(ft(e,i,n,l,r,a),s&&(gt(e,o),pt(e,o))):l.error?s&&_t(e,o,l.error):(s&&(mt(e,!0),gt(e,o)),r.loadId=l.load(()=>{mt(e,!1),e.destroyed||(ft(e,i,n,l,r,a)&&(l.hasAlphaPixel&&(e.__layout.hitCanvasChanged=!0),e.forceUpdate("surface")),pt(e,o)),r.loadId=void 0},t=>{mt(e,!1),_t(e,o,t),r.loadId=void 0}),e.placeholderColor&&(e.placeholderDelay?setTimeout(()=>{l.ready||(l.isPlacehold=!0,e.forceUpdate("surface"))},e.placeholderDelay):l.isPlacehold=!0)),r},checkImage:function(e,n,a,s){const{scaleX:r,scaleY:o}=e.getRenderScaleData(!0,a.scaleFixed),{pixelRatio:l}=n,{data:d}=a;if(!d||a.patternId===r+"-"+o+"-"+l&&!i.Export.running)return!1;if(s)if(d.repeat)s=!1;else if(!(a.changeful||"miniapp"===t.Platform.name&&t.ResizeEvent.isResizing(e)||i.Export.running)){let{width:e,height:i}=d;e*=r*l,i*=o*l,d.scaleX&&(e*=d.scaleX,i*=d.scaleY),s=e*i>t.Platform.image.maxCacheSize}return s?(e.__.__isFastShadow&&(n.fillStyle=a.style||"#000",n.fill()),function(t,e,i,n){e.save(),e.clipUI(t),i.blendMode&&(e.blendMode=i.blendMode);n.opacity&&(e.opacity*=n.opacity);n.transform&&e.transform(n.transform);e.drawImage(i.image.getFull(n.filters),0,0,n.width,n.height),e.restore()}(e,n,a,d),!0):(!a.style||a.sync||i.Export.running?kt(e,a,l):a.patternTask||(a.patternTask=t.ImageManager.patternTasker.add(()=>St(this,void 0,void 0,function*(){a.patternTask=null,n.bounds.hit(e.__nowWorld)&&kt(e,a,l),e.forceUpdate("surface")}),300)),!1)},createPattern:kt,recycleImage:function(e,i){const n=i["_"+e];if(t.isArray(n)){let a,s,r,o,l;for(let d=0,h=n.length;d<h;d++)a=n[d],s=a.image,l=s&&s.url,l&&(r||(r={}),r[l]=!0,t.ImageManager.recycle(s),s.loading&&(o||(o=i.__input&&i.__input[e]||[],t.isArray(o)||(o=[o])),s.unload(n[d].loadId,!o.some(t=>t.url===l))));return r}return null},createData:ot,getPatternData:lt,fillOrFitMode:$,clipMode:J,repeatMode:tt},{toPoint:Rt}=t.AroundHelper,{hasTransparent:Ct}=i.ColorConvert,At={},Ot={};function Mt(e,n,a,s){if(a){let r,o,l,d;for(let e=0,h=a.length;e<h;e++)r=a[e],t.isString(r)?(l=e/(h-1),o=i.ColorConvert.string(r,s)):(l=r.offset,o=i.ColorConvert.string(r.color,s)),n.addColorStop(l,o),!d&&Ct(o)&&(d=!0);d&&(e.isTransparent=!0)}}const{getAngle:Tt,getDistance:Wt}=t.PointHelper,{get:Dt,rotateOfOuter:Ht,scaleOfOuter:It}=t.MatrixHelper,{toPoint:Ft}=t.AroundHelper,jt={},Gt={};function zt(t,e,i,n,a){let s;const{width:r,height:o}=t;if(r!==o||n){const t=Tt(e,i);s=Dt(),a?(It(s,e,r/o*(n||1),1),Ht(s,e,t+90)):(It(s,e,1,r/o*(n||1)),Ht(s,e,t))}return s}const{getDistance:Yt}=t.PointHelper,{toPoint:Ut}=t.AroundHelper,qt={},Xt={};const Nt={linearGradient:function(e,i){let{from:n,to:a,type:s,opacity:r}=e;Rt(n||"top",i,At),Rt(a||"bottom",i,Ot);const o=t.Platform.canvas.createLinearGradient(At.x,At.y,Ot.x,Ot.y),l={type:s,style:o};return Mt(l,o,e.stops,r),l},radialGradient:function(e,i){let{from:n,to:a,type:s,opacity:r,stretch:o}=e;Ft(n||"center",i,jt),Ft(a||"bottom",i,Gt);const l=t.Platform.canvas.createRadialGradient(jt.x,jt.y,0,jt.x,jt.y,Wt(jt,Gt)),d={type:s,style:l};Mt(d,l,e.stops,r);const h=zt(i,jt,Gt,o,!0);return h&&(d.transform=h),d},conicGradient:function(e,i){let{from:n,to:a,type:s,opacity:r,stretch:o}=e;Ut(n||"center",i,qt),Ut(a||"bottom",i,Xt);const l=t.Platform.conicGradientSupport?t.Platform.canvas.createConicGradient(0,qt.x,qt.y):t.Platform.canvas.createRadialGradient(qt.x,qt.y,0,qt.x,qt.y,Yt(qt,Xt)),d={type:s,style:l};Mt(d,l,e.stops,r);const h=zt(i,qt,Xt,o||1,t.Platform.conicGradientRotate90);return h&&(d.transform=h),d},getTransform:zt},{copy:Vt,toOffsetOutBounds:Qt}=t.BoundsHelper,Zt={},Kt={};function $t(e,i,n,a){const{bounds:s,shapeBounds:r}=a;if(t.Platform.fullImageShadow){if(Vt(Zt,e.bounds),Zt.x+=i.x-r.x,Zt.y+=i.y-r.y,n){const{fitMatrix:t}=a;Zt.x-=(s.x+(t?t.e:0)+s.width/2)*(n-1),Zt.y-=(s.y+(t?t.f:0)+s.height/2)*(n-1),Zt.width*=n,Zt.height*=n}e.copyWorld(a.canvas,e.bounds,Zt)}else n&&(Vt(Zt,i),Zt.x-=i.width/2*(n-1),Zt.y-=i.height/2*(n-1),Zt.width*=n,Zt.height*=n),e.copyWorld(a.canvas,r,n?Zt:i)}const{toOffsetOutBounds:Jt}=t.BoundsHelper,te={};const ee={shadow:function(e,n,a){let s,r;const{__nowWorld:o,__layout:l}=e,{shadow:d}=e.__,{worldCanvas:h,bounds:c,shapeBounds:u,scaleX:f,scaleY:g}=a,p=n.getSameCanvas(),_=d.length-1;Qt(c,Kt),d.forEach((d,y)=>{let m=1;if(d.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(m=1/t)}p.setWorldShadow(Kt.offsetX+d.x*f*m,Kt.offsetY+d.y*g*m,d.blur*f*m,i.ColorConvert.string(d.color)),r=d.spread?1+2*d.spread/(l.boxBounds.width+2*(l.strokeBoxSpread||0))*m:0,$t(p,Kt,r,a),s=c,d.box&&(p.restore(),p.save(),h&&(p.copyWorld(p,c,o,"copy"),s=o),h?p.copyWorld(h,o,o,"destination-out"):p.copyWorld(a.canvas,u,c,"destination-out")),t.LeafHelper.copyCanvasByWorld(e,n,p,s,d.blendMode),_&&y<_&&p.clearWorld(s)}),p.recycle(s)},innerShadow:function(e,n,a){let s,r;const{__nowWorld:o,__layout:l}=e,{innerShadow:d}=e.__,{worldCanvas:h,bounds:c,shapeBounds:u,scaleX:f,scaleY:g}=a,p=n.getSameCanvas(),_=d.length-1;Jt(c,te),d.forEach((d,y)=>{let m=1;if(d.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(m=1/t)}p.save(),p.setWorldShadow(te.offsetX+d.x*f*m,te.offsetY+d.y*g*m,d.blur*f*m),r=d.spread?1-2*d.spread/(l.boxBounds.width+2*(l.strokeBoxSpread||0))*m:0,$t(p,te,r,a),p.restore(),h?(p.copyWorld(p,c,o,"copy"),p.copyWorld(h,o,o,"source-out"),s=o):(p.copyWorld(a.canvas,u,c,"source-out"),s=c),p.fillWorld(s,i.ColorConvert.string(d.color),"source-in"),t.LeafHelper.copyCanvasByWorld(e,n,p,s,d.blendMode),_&&y<_&&p.clearWorld(s)}),p.recycle(s)},blur:function(t,e,i){const{blur:n}=t.__;i.setWorldBlur(n*t.__nowWorld.a),i.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),i.filter="none"},backgroundBlur:function(t,e,i){}},{excludeRenderBounds:ie}=t.LeafBoundsHelper;let ne;function ae(t,e,i,n,a,s,r,o){switch(e){case"grayscale":ne||(ne=!0,a.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,n,a,s){const r=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(n,r),s&&n.recycle(r);re(t,e,i,1,a,s)}(t,i,n,a,r,o);break;case"opacity-path":re(t,i,n,s,r,o);break;case"path":o&&i.restore()}}function se(t){return t.getSameCanvas(!1,!0)}function re(t,e,i,n,a,s){const r=t.__nowWorld;e.resetTransform(),e.opacity=n,e.copyWorld(i,r,void 0,a),s?i.recycle(r):i.clearWorld(r)}i.Group.prototype.__renderMask=function(t,e){let i,n,a,s,r,o;const{children:l}=this;for(let d=0,h=l.length;d<h;d++){if(i=l[d],o=i.__.mask,o){r&&(ae(this,r,t,a,n,s,void 0,!0),n=a=null),s=i.__.opacity,ne=!1,"path"===o||"clipping-path"===o?(s<1?(r="opacity-path",a||(a=se(t))):(r="path",t.save()),i.__clip(a||t,e)):(r="grayscale"===o?"grayscale":"alpha",n||(n=se(t)),a||(a=se(t)),i.__render(n,e)),"clipping"!==o&&"clipping-path"!==o||ie(i,e)||i.__render(t,e);continue}const h=1===s&&i.__.__blendMode;h&&ae(this,r,t,a,n,s,void 0,!1),ie(i,e)||i.__render(a||t,e),h&&ae(this,r,t,a,n,s,h,!1)}ae(this,r,t,a,n,s,void 0,!0)};const oe=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",le=oe+"_#~&*+\\=|≮≯≈≠=…",de=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 he(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const ce=he("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),ue=he("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),fe=he(oe),ge=he(le),pe=he("- —/~|┆·");var _e;!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"}(_e||(_e={}));const{Letter:ye,Single:me,Before:we,After:ve,Symbol:xe,Break:be}=_e;function Be(t){return ce[t]?ye:pe[t]?be:ue[t]?we:fe[t]?ve:ge[t]?xe:de.test(t)?me:ye}const Ee={trimRight(t){const{words:e}=t;let i,n=0,a=e.length;for(let s=a-1;s>-1&&(i=e[s].data[0]," "===i.char);s--)n++,t.width-=i.width;n&&e.splice(a-n,n)}};function Le(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:ke}=Ee,{Letter:Se,Single:Pe,Before:Re,After:Ce,Symbol:Ae,Break:Oe}=_e;let Me,Te,We,De,He,Ie,Fe,je,Ge,ze,Ye,Ue,qe,Xe,Ne,Ve,Qe,Ze=[];function Ke(t,e){Ge&&!je&&(je=Ge),Me.data.push({char:t,width:e}),We+=e}function $e(){De+=We,Me.width=We,Te.words.push(Me),Me={data:[]},We=0}function Je(){Xe&&(Ne.paraNumber++,Te.paraStart=!0,Xe=!1),Ge&&(Te.startCharSize=je,Te.endCharSize=Ge,je=0),Te.width=De,Ve.width?ke(Te):Qe&&ti(),Ze.push(Te),Te={words:[]},De=0}function ti(){De>(Ne.maxWidth||0)&&(Ne.maxWidth=De)}const{top:ei,right:ii,bottom:ni,left:ai}=t.Direction4;function si(t,e,i){const{bounds:n,rows:a}=t;n[e]+=i;for(let t=0;t<a.length;t++)a[t][e]+=i}const ri={getDrawData:function(e,n){t.isString(e)||(e=String(e));let a=0,s=0,r=n.__getInput("width")||0,o=n.__getInput("height")||0;const{textDecoration:l,__font:d,__padding:h}=n;h&&(r?(a=h[ai],r-=h[ii]+h[ai]):n.autoSizeAlign||(a=h[ai]),o?(s=h[ei],o-=h[ei]+h[ni]):n.autoSizeAlign||(s=h[ei]));const c={bounds:{x:a,y:s,width:r,height:o},rows:[],paraNumber:0,font:t.Platform.canvas.font=d};return function(e,i,n){Ne=e,Ze=e.rows,Ve=e.bounds,Qe=!Ve.width&&!n.autoSizeAlign;const{__letterSpacing:a,paraIndent:s,textCase:r}=n,{canvas:o}=t.Platform,{width:l,height:d}=Ve;if(l||d||a||"none"!==r){const t="none"!==n.textWrap,e="break"===n.textWrap;Xe=!0,Ye=null,je=Fe=Ge=We=De=0,Me={data:[]},Te={words:[]},a&&(i=[...i]);for(let n=0,d=i.length;n<d;n++)Ie=i[n],"\n"===Ie?(We&&$e(),Te.paraEnd=!0,Je(),Xe=!0):(ze=Be(Ie),ze===Se&&"none"!==r&&(Ie=Le(Ie,r,!We)),Fe=o.measureText(Ie).width,a&&(a<0&&(Ge=Fe),Fe+=a),Ue=ze===Pe&&(Ye===Pe||Ye===Se)||Ye===Pe&&ze!==Ce,qe=!(ze!==Re&&ze!==Pe||Ye!==Ae&&Ye!==Ce),He=Xe&&s?l-s:l,t&&l&&De+We+Fe>He&&(e?(We&&$e(),De&&Je()):(qe||(qe=ze===Se&&Ye==Ce),Ue||qe||ze===Oe||ze===Re||ze===Pe||We+Fe>He?(We&&$e(),De&&Je()):De&&Je()))," "===Ie&&!0!==Xe&&De+We===0||(ze===Oe?(" "===Ie&&We&&$e(),Ke(Ie,Fe),$e()):Ue||qe?(We&&$e(),Ke(Ie,Fe)):Ke(Ie,Fe)),Ye=ze);We&&$e(),De&&Je(),Ze.length>0&&(Ze[Ze.length-1].paraEnd=!0)}else i.split("\n").forEach(t=>{Ne.paraNumber++,De=o.measureText(t).width,Ze.push({x:s||0,text:t,width:De,paraStart:!0}),Qe&&ti()})}(c,e,n),h&&function(t,e,i,n,a){if(!n&&i.autoSizeAlign)switch(i.textAlign){case"left":si(e,"x",t[ai]);break;case"right":si(e,"x",-t[ii])}if(!a&&i.autoSizeAlign)switch(i.verticalAlign){case"top":si(e,"y",t[ei]);break;case"bottom":si(e,"y",-t[ni])}}(h,c,n,r,o),function(t,e){const{rows:i,bounds:n}=t,a=i.length,{__lineHeight:s,__baseLine:r,__letterSpacing:o,__clipText:l,textAlign:d,verticalAlign:h,paraSpacing:c,autoSizeAlign:u}=e;let{x:f,y:g,width:p,height:_}=n,y=s*a+(c?c*(t.paraNumber-1):0),m=r;if(l&&y>_)y=Math.max(_,s),a>1&&(t.overflow=a);else if(_||u)switch(h){case"middle":g+=(_-y)/2;break;case"bottom":g+=_-y}m+=g;let w,v,x,b=p||u?p:t.maxWidth;for(let r=0,h=a;r<h;r++){if(w=i[r],w.x=f,w.width<p||w.width>p&&!l)switch(d){case"center":w.x+=(b-w.width)/2;break;case"right":w.x+=b-w.width}w.paraStart&&c&&r>0&&(m+=c),w.y=m,m+=s,t.overflow>r&&m>y&&(w.isOverflow=!0,t.overflow=r+1),v=w.x,x=w.width,o<0&&(w.width<0?(x=-w.width+e.fontSize+o,v-=x,x+=e.fontSize):x-=o),v<n.x&&(n.x=v),x>n.width&&(n.width=x),l&&p&&p<x&&(w.isOverflow=!0,t.overflow||(t.overflow=i.length))}n.y=g,n.height=y}(c,n),function(t,e,i){const{rows:n}=t,{textAlign:a,paraIndent:s,letterSpacing:r}=e;let o,l,d,h,c,u;n.forEach(t=>{t.words&&(d=s&&t.paraStart?s:0,u=t.words.length,l=i&&("justify"===a||"both"===a)&&u>1?(i-t.width-d)/(u-1):0,h=r||t.isOverflow?0:l>.01?1:2,t.isOverflow&&!r&&(t.textMode=!0),2===h?(t.x+=d,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=d,o=t.x,t.data=[],t.words.forEach((e,i)=>{1===h?(c={char:"",x:o},o=function(t,e,i){return t.forEach(t=>{i.char+=t.char,e+=t.width}),e}(e.data,o,c),(t.isOverflow||" "!==c.char)&&t.data.push(c)):o=function(t,e,i,n){return t.forEach(t=>{(n||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width}),e}(e.data,o,t.data,t.isOverflow),!l||t.paraEnd&&"both"!==a||i===u-1||(o+=l,t.width+=l)})),t.words=null)})}(c,n,r),c.overflow&&function(e,i,n,a){if(!a)return;const{rows:s,overflow:r}=e;let{textOverflow:o}=i;if(s.splice(r),o&&"show"!==o){let e,l;"hide"===o?o="":"ellipsis"===o&&(o="...");const d=o?t.Platform.canvas.measureText(o).width:0,h=n+a-d;("none"===i.textWrap?s:[s[r-1]]).forEach(t=>{if(t.isOverflow&&t.data){let i=t.data.length-1;for(let n=i;n>-1&&(e=t.data[n],l=e.x+e.width,!(n===i&&l<h));n--){if(l<h&&" "!==e.char||!n){t.data.splice(n+1),t.width-=e.width;break}t.width-=e.width}t.width+=d,t.data.push({char:o,x:l}),t.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(t)}})}}(c,n,a,r),"none"!==l&&function(e,n){let a;const{fontSize:s,textDecoration:r}=n;switch(e.decorationHeight=s/11,t.isObject(r)?(a=r.type,r.color&&(e.decorationColor=i.ColorConvert.string(r.color))):a=r,a){case"under":e.decorationY=[.15*s];break;case"delete":e.decorationY=[.35*-s];break;case"under-delete":e.decorationY=[.15*s,.35*-s]}}(c,n),c}};const oi={string:function(e,n){const a=t.isNumber(n)&&n<1;if(t.isString(e)){if(!a||!i.ColorConvert.object)return e;e=i.ColorConvert.object(e)}let s=t.isUndefined(e.a)?1:e.a;a&&(s*=n);const r=e.r+","+e.g+","+e.b;return 1===s?"rgb("+r+")":"rgba("+r+","+s+")"}};Object.assign(i.TextConvert,ri),Object.assign(i.ColorConvert,oi),Object.assign(i.Paint,G),Object.assign(i.PaintImage,Pt),Object.assign(i.PaintGradient,Nt),Object.assign(i.Effect,ee),Object.assign(t.Creator,{interaction:(t,i,n,a)=>new e.InteractionBase(t,i,n,a),hitCanvas:(t,e)=>new n(t,e),hitCanvasManager:()=>new e.HitCanvasManager}),s(),Object.defineProperty(exports,"LeaferImage",{enumerable:!0,get:function(){return t.LeaferImage}}),exports.Layouter=m,exports.LeaferCanvas=n,exports.Picker=b,exports.Renderer=v,exports.Selector=B,exports.Watcher=o,exports.useCanvas=s,Object.keys(t).forEach(function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}})}),Object.keys(e).forEach(function(t){"default"===t||Object.prototype.hasOwnProperty.call(exports,t)||Object.defineProperty(exports,t,{enumerable:!0,get:function(){return e[t]}})});
|
|
1
|
+
"use strict";var t=require("@leafer/core"),e=require("@leafer-ui/core"),i=require("@leafer-ui/draw");class n extends t.LeaferCanvasBase{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=t.Platform.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this;this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i),this.clientBounds=this.bounds}}t.canvasPatch(OffscreenCanvasRenderingContext2D.prototype),t.canvasPatch(Path2D.prototype);const{mineType:a}=t.FileHelper;function s(e,i){t.Platform.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,i)=>new Promise((n,s)=>{t.convertToBlob({type:a(e),quality:i}).then(t=>{var e=new FileReader;e.onload=t=>n(t.target.result),e.onerror=t=>s(t),e.readAsDataURL(t)}).catch(t=>{s(t)})}),canvasToBolb:(t,e,i)=>t.convertToBlob({type:a(e),quality:i}),canvasSaveAs:(t,e,i)=>new Promise(t=>t()),download(t,e){},loadImage:e=>new Promise((i,n)=>{let a=new XMLHttpRequest;a.open("GET",t.Platform.image.getRealURL(e),!0),a.responseType="blob",a.onload=()=>{createImageBitmap(a.response).then(t=>{i(t)}).catch(t=>{n(t)})},a.onerror=t=>n(t),a.send()})},t.Platform.canvas=t.Creator.canvas(),t.Platform.conicGradientSupport=!!t.Platform.canvas.context.createConicGradient}Object.assign(t.Creator,{canvas:(t,e)=>new n(t,e),image:e=>new t.LeaferImage(e)}),t.Platform.name="web",t.Platform.isWorker=!0,t.Platform.backgrounder=!0,t.Platform.requestRender=function(t){requestAnimationFrame(t)},t.defineKey(t.Platform,"devicePixelRatio",{get:()=>1});const{userAgent:r}=navigator;r.indexOf("Firefox")>-1?(t.Platform.conicGradientRotate90=!0,t.Platform.intWheelDeltaY=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(t.Platform.fullImageShadow=!0),r.indexOf("Windows")>-1?(t.Platform.os="Windows",t.Platform.intWheelDeltaY=!0):r.indexOf("Mac")>-1?t.Platform.os="Mac":r.indexOf("Linux")>-1&&(t.Platform.os="Linux");class o{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const e=new t.LeafList;return this.__updatedList.list.forEach(t=>{t.leafer&&e.add(t)}),e}return this.__updatedList}constructor(e,i){this.totalTimes=0,this.config={},this.__updatedList=new t.LeafList,this.target=e,i&&(this.config=t.DataHelper.default(i,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(t.RenderEvent.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(e){e.type===t.ChildEvent.ADD?(this.hasAdd=!0,this.__pushChild(e.child)):(this.hasRemove=!0,this.__updatedList.add(e.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 t.WatchEvent(t.WatchEvent.DATA,{updatedList:this.updatedList})),this.__updatedList=new t.LeafList,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[t.PropertyEvent.CHANGE,this.__onAttrChange,this],[[t.ChildEvent.ADD,t.ChildEvent.REMOVE],this.__onChildEvent,this],[t.WatchEvent.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:l,updateBounds:d,updateChange:h}=t.LeafHelper,{pushAllChildBranch:c,pushAllParent:u}=t.BranchHelper;const{worldBounds:f}=t.LeafBoundsHelper;class g{constructor(e){this.updatedBounds=new t.Bounds,this.beforeBounds=new t.Bounds,this.afterBounds=new t.Bounds,t.isArray(e)&&(e=new t.LeafList(e)),this.updatedList=e}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,f)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,f),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:p,updateAllChange:_}=t.LeafHelper,y=t.Debug.get("Layouter");class m{constructor(e,i){this.totalTimes=0,this.config={},this.__levelList=new t.LeafLevelList,this.target=e,i&&(this.config=t.DataHelper.default(i,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:e}=this;this.times=0;try{e.emit(t.LayoutEvent.START),this.layoutOnce(),e.emitEvent(new t.LayoutEvent(t.LayoutEvent.END,this.layoutedBlocks,this.times))}catch(t){y.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?y.warn("layouting"):this.times>3?y.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(t.WatchEvent.REQUEST),this.totalTimes>1?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var e;if(!(null===(e=this.__updatedList)||void 0===e?void 0:e.length))return;const i=t.Run.start("PartLayout"),{target:n,__updatedList:a}=this,{BEFORE:s,LAYOUT:r,AFTER:o}=t.LayoutEvent,f=this.getBlocks(a);f.forEach(t=>t.setBefore()),n.emitEvent(new t.LayoutEvent(s,f,this.times)),this.extraBlock=null,a.sort(),function(t,e){let i;t.list.forEach(t=>{i=t.__layout,e.without(t)&&!i.proxyZoom&&(i.matrixChanged?(l(t,!0),e.add(t),t.isBranch&&c(t,e),u(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),u(t,e)))})}(a,this.__levelList),function(t){let e,i,n;t.sort(!0),t.levels.forEach(a=>{e=t.levelMap[a];for(let t=0,a=e.length;t<a;t++){if(i=e[t],i.isBranch&&i.__tempNumber){n=i.children;for(let t=0,e=n.length;t<e;t++)n[t].isBranch||d(n[t])}d(i)}})}(this.__levelList),function(t){t.list.forEach(h)}(a),this.extraBlock&&f.push(this.extraBlock),f.forEach(t=>t.setAfter()),n.emitEvent(new t.LayoutEvent(r,f,this.times)),n.emitEvent(new t.LayoutEvent(o,f,this.times)),this.addBlocks(f),this.__levelList.reset(),this.__updatedList=null,t.Run.end(i)}fullLayout(){const e=t.Run.start("FullLayout"),{target:i}=this,{BEFORE:n,LAYOUT:a,AFTER:s}=t.LayoutEvent,r=this.getBlocks(new t.LeafList(i));i.emitEvent(new t.LayoutEvent(n,r,this.times)),m.fullLayout(i),r.forEach(t=>{t.setAfter()}),i.emitEvent(new t.LayoutEvent(a,r,this.times)),i.emitEvent(new t.LayoutEvent(s,r,this.times)),this.addBlocks(r),t.Run.end(e)}static fullLayout(e){p(e,!0),e.isBranch?t.BranchHelper.updateBounds(e):t.LeafHelper.updateBounds(e),_(e)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new g([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new g(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_([[t.LayoutEvent.REQUEST,this.layout,this],[t.LayoutEvent.AGAIN,this.layoutAgain,this],[t.WatchEvent.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const w=t.Debug.get("Renderer");class v{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(e,i,n){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:120},this.target=e,this.canvas=i,n&&(this.config=t.DataHelper.default(n,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(t.LayoutEvent.REQUEST)}checkRender(){if(this.running){const{target:e}=this;e.isApp&&(e.emit(t.RenderEvent.CHILD_START,e),e.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),e.emit(t.RenderEvent.CHILD_END,e)),this.changed&&this.canvas.view&&this.render(),this.target.emit(t.RenderEvent.NEXT)}}render(e){if(!this.running||!this.canvas.view)return this.update();const{target:i}=this;this.times=0,this.totalBounds=new t.Bounds,w.log(i.innerName,"---\x3e");try{this.emitRender(t.RenderEvent.START),this.renderOnce(e),this.emitRender(t.RenderEvent.END,this.totalBounds),t.ImageManager.clearRecycled()}catch(t){this.rendering=!1,w.error(t)}w.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(e){if(this.rendering)return w.warn("rendering");if(this.times>3)return w.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new t.Bounds,this.renderOptions={},e)this.emitRender(t.RenderEvent.BEFORE),e();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(t.RenderEvent.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(t.RenderEvent.RENDER,this.renderBounds,this.renderOptions),this.emitRender(t.RenderEvent.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(e){const i=t.Run.start("PartRender"),{canvas:n}=this,a=e.getIntersect(n.bounds),s=new t.Bounds(a);n.save(),a.spread(v.clipSpread).ceil(),n.clearWorld(a),n.clipWorld(a),this.__render(a,s),n.restore(),t.Run.end(i)}fullRender(){const e=t.Run.start("FullRender"),{canvas:i}=this;i.save(),i.clear(),this.__render(i.bounds),i.restore(),t.Run.end(e)}__render(e,i){const{canvas:n}=this,a=e.includes(this.target.__world),s=a?{includes:a}:{bounds:e,includes:a};this.needFill&&n.fillWorld(e,this.config.fill),t.Debug.showRepaint&&t.Debug.drawRepaint(n,e),this.target.__render(n,s),this.renderBounds=i=i||e,this.renderOptions=s,this.totalBounds.isEmpty()?this.totalBounds=i:this.totalBounds.add(i),n.updateRender(i)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:e}=this;if(e){const i=new t.Bounds;i.setList(e),e.length=0,e.push(i)}}__requestRender(){const e=this.target;if(this.requestTime||!e)return;if(e.parentApp)return e.parentApp.requestRender(!1);const i=this.requestTime=Date.now(),n=()=>{const e=1e3/(Date.now()-i),{maxFPS:a}=this.config;if(a&&e>a-.5)return t.Platform.requestRender(n);this.FPS=Math.min(120,Math.ceil(e)),this.requestTime=0,this.checkRender()};t.Platform.requestRender(n)}__onResize(e){if(!this.canvas.unreal){if(e.bigger||!e.samePixelRatio){const{width:i,height:n}=e.old;if(!new t.Bounds(0,0,i,n).includes(this.target.__world)||this.needFill||!e.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new t.Bounds(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||w.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(e,i,n){this.target.emitEvent(new t.RenderEvent(e,this.times,i,n))}__listenEvents(){this.__eventIds=[this.target.on_([[t.RenderEvent.REQUEST,this.update,this],[t.LayoutEvent.END,this.__onLayoutEnd,this],[t.RenderEvent.AGAIN,this.renderAgain,this],[t.ResizeEvent.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}v.clipSpread=10;const{hitRadiusPoint:x}=t.BoundsHelper;class b{constructor(t,e){this.target=t,this.selector=e}getByPoint(e,i,n){i||(i=0),n||(n={});const a=n.through||!1,s=n.ignoreHittable||!1,r=n.target||this.target;this.exclude=n.exclude||null,this.point={x:e.x,y:e.y,radiusX:i,radiusY:i},this.findList=new t.LeafList(n.findList),n.findList||this.hitBranch(r.isBranchLeaf?{children:[r]}:r);const{list:o}=this.findList,l=this.getBestMatchLeaf(o,n.bottomList,s),d=s?this.getPath(l):this.getHitablePath(l);return this.clear(),a?{path:d,target:l,throughPath:o.length?this.getThroughPath(o):d}:{path:d,target:l}}hitPoint(t,e,i){return!!this.getByPoint(t,e,i).target}getBestMatchLeaf(e,i,n){const a=this.findList=new t.LeafList;if(e.length){let i;const{x:s,y:r}=this.point,o={x:s,y:r,radiusX:0,radiusY:0};for(let s=0,r=e.length;s<r;s++)if(i=e[s],(n||t.LeafHelper.worldHittable(i))&&(this.hitChild(i,o),a.length)){if(i.isBranchLeaf&&e.some(e=>e!==i&&t.LeafHelper.hasParent(e,i))){a.reset();break}return a.list[0]}}if(i)for(let t=0,e=i.length;t<e;t++)if(this.hitChild(i[t].target,this.point,i[t].proxy),a.length)return a.list[0];return n?e[0]:e.find(e=>t.LeafHelper.worldHittable(e))}getPath(e){const i=new t.LeafList;for(;e;)i.add(e),e=e.parent;return this.target&&i.add(this.target),i}getHitablePath(e){const i=this.getPath(e&&e.hittable?e:null);let n,a=new t.LeafList;for(let t=i.list.length-1;t>-1&&(n=i.list[t],n.__.hittable)&&(a.addAt(n,0),n.__.hitChildren&&(!n.isLeafer||"draw"!==n.mode));t--);return a}getThroughPath(e){const i=new t.LeafList,n=[];for(let t=e.length-1;t>-1;t--)n.push(this.getPath(e[t]));let a,s,r;for(let t=0,e=n.length;t<e;t++){a=n[t],s=n[t+1];for(let t=0,e=a.length;t<e&&(r=a.list[t],!s||!s.has(r));t++)i.add(r)}return i}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,n;const{point:a}=this;for(let s=t.length-1;s>-1;s--)i=t[s],!i.__.visible||e&&!i.__.mask||(n=!!i.__.hitRadius||x(i.__world,a),i.isBranch?(n||i.__ignoreHitWorld)&&(i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,a)):n&&this.hitChild(i,a))}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:n}=t;if(n&&n.__hasMask&&!t.__.mask){let i,a=[];const{children:s}=n;for(let n=0,r=s.length;n<r;n++)if(i=s[n],i.__.mask&&a.push(i),i===t){if(a&&!a.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 B{constructor(e,i){this.config={},i&&(this.config=t.DataHelper.default(i,this.config)),this.picker=new b(this.target=e,this),this.finder=t.Creator.finder&&t.Creator.finder()}getByPoint(e,i,n){const{target:a,picker:s}=this;return t.Platform.backgrounder&&a&&a.updateLayout(),s.getByPoint(e,i,n)}hitPoint(t,e,i){return this.picker.hitPoint(t,e,i)}getBy(e,i,n,a){return this.finder?this.finder.getBy(e,i,n,a):t.Plugin.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function E(t,e){const i=t.__,{rows:n,decorationY:a}=i.__textDrawData;let s;i.__isPlacehold&&i.placeholderColor&&(e.fillStyle=i.placeholderColor);for(let t=0,i=n.length;t<i;t++)s=n[t],s.text?e.fillText(s.text,s.x,s.y):s.data&&s.data.forEach(t=>{e.fillText(t.char,t.x,s.y)});if(a){const{decorationColor:t,decorationHeight:s}=i.__textDrawData;t&&(e.fillStyle=t),n.forEach(t=>a.forEach(i=>e.fillRect(t.x,t.y+i,t.width,s)))}}function L(t,e){t.__.__font?E(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function k(t,e,i){switch(e.__.strokeAlign){case"center":S(t,1,e,i);break;case"inside":P(t,"inside",e,i);break;case"outside":e.__.__fillAfterStroke?S(t,2,e,i):P(t,"outside",e,i)}}function S(e,i,n,a){const s=n.__;t.isObject(e)?C(e,i,!0,n,a):(a.setStroke(e,s.__strokeWidth*i,s),R(n,a))}function P(e,i,n,a){const s=a.getSameCanvas(!0,!0);s.font=n.__.__font,S(e,2,n,s),s.blendMode="outside"===i?"destination-out":"destination-in",E(n,s),s.blendMode="normal",t.LeafHelper.copyCanvasByWorld(n,a,s),s.recycle(n.__nowWorld)}function R(t,e){let i,n=t.__.__textDrawData;const{rows:a,decorationY:s}=n;for(let t=0,n=a.length;t<n;t++)i=a[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(s){const{decorationHeight:t}=n;a.forEach(i=>s.forEach(n=>e.strokeRect(i.x,i.y+n,i.width,t)))}}function C(t,e,n,a,s){let r;const o=a.__,{__hasMultiStrokeStyle:l}=o;l||s.setStroke(void 0,o.__strokeWidth*e,o);for(let d=0,h=t.length;d<h;d++)if(r=t[d],(!r.image||!i.PaintImage.checkImage(a,s,r,!1))&&r.style){if(l){const{strokeStyle:t}=r;t?s.setStroke(r.style,o.__getRealStrokeWidth(t)*e,o,t):s.setStroke(r.style,o.__strokeWidth*e,o)}else s.strokeStyle=r.style;r.blendMode?(s.saveBlendMode(r.blendMode),n?R(a,s):s.stroke(),s.restoreBlendMode()):n?R(a,s):s.stroke()}}function A(e,i,n){const a=i.__;if(a.__strokeWidth)if(a.__font)k(e,i,n);else switch(a.strokeAlign){case"center":M(e,1,i,n);break;case"inside":!function(t,e,i){i.save(),i.clipUI(e),M(t,2,e,i),i.restore()}(e,i,n);break;case"outside":!function(e,i,n){const a=i.__;if(a.__fillAfterStroke)M(e,2,i,n);else{const{renderBounds:s}=i.__layout,r=n.getSameCanvas(!0,!0);i.__drawRenderPath(r),M(e,2,i,r),r.clipUI(a),r.clearWorld(s),t.LeafHelper.copyCanvasByWorld(i,n,r),r.recycle(i.__nowWorld)}}(e,i,n)}}function M(e,n,a,s){const r=a.__;t.isObject(e)?C(e,n,!1,a,s):(s.setStroke(e,r.__strokeWidth*n,r),s.stroke()),r.__useArrow&&i.Paint.strokeArrow(e,a,s)}Object.assign(t.Creator,{watcher:(t,e)=>new o(t,e),layouter:(t,e)=>new m(t,e),renderer:(t,e,i)=>new v(t,e,i),selector:(t,e)=>new B(t,e)}),t.Platform.layout=m.fullLayout;const{getSpread:O,getOuterOf:T,getByMove:W,getIntersectData:D}=t.BoundsHelper;let H;const{stintSet:I}=t.DataHelper,{hasTransparent:F}=i.ColorConvert;function j(e,n,a){if(!t.isObject(n)||!1===n.visible||0===n.opacity)return;let s;const{boxBounds:r}=a.__layout;switch(n.type){case"image":s=i.PaintImage.image(a,e,n,r,!H||!H[n.url]);break;case"linear":s=i.PaintGradient.linearGradient(n,r);break;case"radial":s=i.PaintGradient.radialGradient(n,r);break;case"angular":s=i.PaintGradient.conicGradient(n,r);break;case"solid":const{type:o,color:l,opacity:d}=n;s={type:o,style:i.ColorConvert.string(l,d)};break;default:t.isUndefined(n.r)||(s={type:"solid",style:i.ColorConvert.string(n)})}if(s){if(t.isString(s.style)&&F(s.style)&&(s.isTransparent=!0),n.style){if(0===n.style.strokeWidth)return;s.strokeStyle=n.style}n.editing&&(s.editing=n.editing),n.blendMode&&(s.blendMode=n.blendMode)}return s}const G={compute:function(e,n){const a=n.__,s=[];let r,o,l,d=a.__input[e];t.isArray(d)||(d=[d]),H=i.PaintImage.recycleImage(e,a);for(let t,i=0,a=d.length;i<a;i++)(t=j(e,d[i],n))&&(s.push(t),t.strokeStyle&&(l||(l=1),t.strokeStyle.strokeWidth&&(l=Math.max(l,t.strokeStyle.strokeWidth))));a["_"+e]=s.length?s:void 0,s.length&&s.every(t=>t.isTransparent)&&(s.some(t=>t.image)&&(r=!0),o=!0),"fill"===e?(I(a,"__isAlphaPixelFill",r),I(a,"__isTransparentFill",o)):(I(a,"__isAlphaPixelStroke",r),I(a,"__isTransparentStroke",o),I(a,"__hasMultiStrokeStyle",l))},fill:function(t,e,i){i.fillStyle=t,L(e,i)},fills:function(t,e,n){let a;for(let s=0,r=t.length;s<r;s++){if(a=t[s],a.image){if(i.PaintImage.checkImage(e,n,a,!e.__.__font))continue;if(!a.style){!s&&a.image.isPlacehold&&e.drawImagePlaceholder(n,a.image);continue}}if(n.fillStyle=a.style,a.transform||a.scaleFixed){if(n.save(),a.transform&&n.transform(a.transform),a.scaleFixed){const{scaleX:t,scaleY:i}=e.getRenderScaleData(!0);(!0===a.scaleFixed||"zoom-in"===a.scaleFixed&&t>1&&i>1)&&n.scale(1/t,1/i)}a.blendMode&&(n.blendMode=a.blendMode),L(e,n),n.restore()}else a.blendMode?(n.saveBlendMode(a.blendMode),L(e,n),n.restoreBlendMode()):L(e,n)}},fillPathOrText:L,fillText:E,stroke:A,strokes:function(t,e,i){A(t,e,i)},strokeText:k,drawTextStroke:R,shape:function(e,i,n){const a=i.getSameCanvas(),s=e.__nowWorld,r=i.bounds;let o,l,d,h,c,{scaleX:u,scaleY:f}=e.getRenderScaleData(!0);if(r.includes(s))c=a,o=h=s;else{const{renderShapeSpread:a}=e.__layout;let g;if(t.Platform.fullImageShadow)g=s;else{const t=a?O(r,u===f?a*u:[a*f,a*u]):r;g=D(t,s)}d=r.getFitMatrix(g);let{a:p,d:_}=d;d.a<1&&(c=i.getSameCanvas(),e.__renderShape(c,n),u*=p,f*=_),h=T(s,d),o=W(h,-d.e,-d.f);const y=n.matrix;y?(l=new t.Matrix(d),l.multiply(y),p*=y.scaleX,_*=y.scaleY):l=d,l.withScale(p,_),n=Object.assign(Object.assign({},n),{matrix:l})}return e.__renderShape(a,n),{canvas:a,matrix:l,fitMatrix:d,bounds:o,worldCanvas:c,shapeBounds:h,scaleX:u,scaleY:f}}};let z={},Y=t.getMatrixData();const{get:U,rotateOfOuter:q,translate:X,scaleOfOuter:N,multiplyParent:V,scale:Q,rotate:Z,skew:K}=t.MatrixHelper;function $(t,e,i,n,a,s,r){const o=U();X(o,e.x+i,e.y+n),Q(o,a,s),r&&q(o,{x:e.x+e.width/2,y:e.y+e.height/2},r),t.transform=o}function J(t,e,i,n,a,s,r,o,l){const d=U();et(d,e,i,n,a,s,r,o),l&&(Y.a=e.width/l.width,Y.d=e.height/l.height,V(d,Y)),t.transform=d}function tt(t,e,i,n,a,s,r,o,l,d,h,c){const u=U();if(c)et(u,e,a,s,r,o,l,d);else{if(l)if("center"===h)q(u,{x:i/2,y:n/2},l);else switch(Z(u,l),l){case 90:X(u,n,0);break;case 180:X(u,i,n);break;case 270:X(u,0,i)}z.x=e.x+a,z.y=e.y+s,X(u,z.x,z.y),r&&N(u,z,r,o)}t.transform=u}function et(t,e,i,n,a,s,r,o){r&&Z(t,r),o&&K(t,o.x,o.y),a&&Q(t,a,s),X(t,e.x+i,e.y+n)}const{get:it,translate:nt}=t.MatrixHelper,at=new t.Bounds,st={},rt={};function ot(t,e,i,n){const{changeful:a,sync:s,scaleFixed:r}=i;a&&(t.changeful=a),s&&(t.sync=s),r&&(t.scaleFixed=r),t.data=lt(i,n,e)}function lt(e,i,n){e.padding&&(i=at.set(i).shrink(e.padding)),"strench"===e.mode&&(e.mode="stretch");let{width:a,height:s}=n;const{opacity:r,mode:o,align:l,offset:d,scale:h,size:c,rotation:u,skew:f,clipSize:g,repeat:p,gap:_,filters:y}=e,m=i.width===a&&i.height===s,w={mode:o},v="center"!==l&&(u||0)%180==90;let x,b;switch(t.BoundsHelper.set(rt,0,0,v?s:a,v?a:s),o&&"cover"!==o&&"fit"!==o?((h||c)&&(t.MathHelper.getScaleData(h,c,n,st),x=st.scaleX,b=st.scaleY),(l||_||p)&&(x&&t.BoundsHelper.scale(rt,x,b,!0),l&&t.AlignHelper.toPoint(l,rt,i,rt,!0,!0))):m&&!u||(x=b=t.BoundsHelper.getFitScale(i,rt,"fit"!==o),t.BoundsHelper.put(i,n,l,x,!1,rt),t.BoundsHelper.scale(rt,x,b,!0)),d&&t.PointHelper.move(rt,d),o){case"stretch":m||(a=i.width,s=i.height);break;case"normal":case"clip":(rt.x||rt.y||x||g||u||f)&&J(w,i,rt.x,rt.y,x,b,u,f,e.clipSize);break;case"repeat":(!m||x||u||f)&&tt(w,i,a,s,rt.x,rt.y,x,b,u,f,l,e.freeTransform),p||(w.repeat="repeat");const n=t.isObject(p);(_||n)&&(w.gap=function(e,i,n,a,s){let r,o;t.isObject(e)?(r=e.x,o=e.y):r=o=e;return{x:dt(r,n,s.width,i&&i.x),y:dt(o,a,s.height,i&&i.y)}}(_,n&&p,rt.width,rt.height,i));break;default:x&&$(w,i,rt.x,rt.y,x,b,u)}return w.transform||(i.x||i.y)&&(w.transform=it(),nt(w.transform,i.x,i.y)),x&&"stretch"!==o&&(w.scaleX=x,w.scaleY=b),w.width=a,w.height=s,r&&(w.opacity=r),y&&(w.filters=y),p&&(w.repeat=t.isString(p)?"x"===p?"repeat-x":"repeat-y":"repeat"),w}function dt(e,i,n,a){const s=t.isString(e)||a?(a?n-a*i:n%i)/((a||Math.floor(n/i))-1):e;return"auto"===e&&s<0?0:s}let ht,ct=new t.Bounds;const{isSame:ut}=t.BoundsHelper;function ft(t,e,i,n,a,s){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=n.width/e.pixelRatio,e.__naturalHeight=n.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return a.data||ot(a,n,i,s),!0}function gt(e,i){yt(e,t.ImageEvent.LOAD,i)}function pt(e,i){yt(e,t.ImageEvent.LOADED,i)}function _t(e,i,n){i.error=n,e.forceUpdate("surface"),yt(e,t.ImageEvent.ERROR,i)}function yt(e,i,n){e.hasEvent(i)&&e.emitEvent(new t.ImageEvent(i,n))}function mt(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:wt,scale:vt,copy:xt}=t.MatrixHelper,{floor:bt,ceil:Bt,max:Et,abs:Lt}=Math;function kt(e,i,n){let{scaleX:a,scaleY:s}=e.getRenderScaleData(!0,i.scaleFixed);const r=a+"-"+s+"-"+n;if(i.patternId===r||e.destroyed)return!1;{const{image:o,data:l}=i;let d,h,{width:c,height:u,scaleX:f,scaleY:g,transform:p,repeat:_,gap:y}=l;a*=n,s*=n,f&&(f=Lt(f),g=Lt(g),h=wt(),xt(h,p),vt(h,1/f,1/g),a*=f,s*=g),c*=a,u*=s;const m=c*u;if(!_&&m>t.Platform.image.maxCacheSize)return!1;let w=t.Platform.image.maxPatternSize;if(o.isSVG){const t=c/o.width;t>1&&(d=t/Bt(t))}else{const t=o.width*o.height;w>t&&(w=t)}m>w&&(d=Math.sqrt(m/w)),d&&(a/=d,s/=d,c/=d,u/=d),f&&(a/=f,s/=g);const v=y&&y.x*a,x=y&&y.y*s;if(p||1!==a||1!==s){const t=c+(v||0),e=u+(x||0);a/=t/Et(bt(t),1),s/=e/Et(bt(e),1),h||(h=wt(),p&&xt(h,p)),vt(h,1/a,1/s)}const b=o.getCanvas(c,u,l.opacity,l.filters,v,x,e.leafer&&e.leafer.config.smooth),B=o.getPattern(b,_||t.Platform.origin.noRepeat||"no-repeat",h,i);return i.style=B,i.patternId=r,!0}}function St(t,e,i,n){return new(i||(i=Promise))(function(a,s){function r(t){try{l(n.next(t))}catch(t){s(t)}}function o(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?a(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(r,o)}l((n=n.apply(t,e||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const Pt={image:function(e,i,n,a,s){let r,o;const l=t.ImageManager.get(n);return ht&&n===ht.paint&&ut(a,ht.boxBounds)?r=ht.leafPaint:(r={type:n.type,image:l},l.hasAlphaPixel&&(r.isTransparent=!0),ht=l.use>1?{leafPaint:r,paint:n,boxBounds:ct.set(a)}:null),(s||l.loading)&&(o={image:l,attrName:i,attrValue:n}),l.ready?(ft(e,i,n,l,r,a),s&&(gt(e,o),pt(e,o))):l.error?s&&_t(e,o,l.error):(s&&(mt(e,!0),gt(e,o)),r.loadId=l.load(()=>{mt(e,!1),e.destroyed||(ft(e,i,n,l,r,a)&&(l.hasAlphaPixel&&(e.__layout.hitCanvasChanged=!0),e.forceUpdate("surface")),pt(e,o)),r.loadId=void 0},t=>{mt(e,!1),_t(e,o,t),r.loadId=void 0}),e.placeholderColor&&(e.placeholderDelay?setTimeout(()=>{l.ready||(l.isPlacehold=!0,e.forceUpdate("surface"))},e.placeholderDelay):l.isPlacehold=!0)),r},checkImage:function(e,n,a,s){const{scaleX:r,scaleY:o}=e.getRenderScaleData(!0,a.scaleFixed),{pixelRatio:l}=n,{data:d}=a;if(!d||a.patternId===r+"-"+o+"-"+l&&!i.Export.running)return!1;if(s)if(d.repeat)s=!1;else if(!(a.changeful||"miniapp"===t.Platform.name&&t.ResizeEvent.isResizing(e)||i.Export.running)){let{width:e,height:i}=d;e*=r*l,i*=o*l,d.scaleX&&(e*=d.scaleX,i*=d.scaleY),s=e*i>t.Platform.image.maxCacheSize}return s?(e.__.__isFastShadow&&(n.fillStyle=a.style||"#000",n.fill()),function(t,e,i,n){e.save(),e.clipUI(t),i.blendMode&&(e.blendMode=i.blendMode);n.opacity&&(e.opacity*=n.opacity);n.transform&&e.transform(n.transform);e.drawImage(i.image.getFull(n.filters),0,0,n.width,n.height),e.restore()}(e,n,a,d),!0):(!a.style||a.sync||i.Export.running?kt(e,a,l):a.patternTask||(a.patternTask=t.ImageManager.patternTasker.add(()=>St(this,void 0,void 0,function*(){a.patternTask=null,n.bounds.hit(e.__nowWorld)&&kt(e,a,l),e.forceUpdate("surface")}),300)),!1)},createPattern:kt,recycleImage:function(e,i){const n=i["_"+e];if(t.isArray(n)){let a,s,r,o,l;for(let d=0,h=n.length;d<h;d++)a=n[d],s=a.image,l=s&&s.url,l&&(r||(r={}),r[l]=!0,t.ImageManager.recycle(s),s.loading&&(o||(o=i.__input&&i.__input[e]||[],t.isArray(o)||(o=[o])),s.unload(n[d].loadId,!o.some(t=>t.url===l))));return r}return null},createData:ot,getPatternData:lt,fillOrFitMode:$,clipMode:J,repeatMode:tt},{toPoint:Rt}=t.AroundHelper,{hasTransparent:Ct}=i.ColorConvert,At={},Mt={};function Ot(e,n,a,s){if(a){let r,o,l,d;for(let e=0,h=a.length;e<h;e++)r=a[e],t.isString(r)?(l=e/(h-1),o=i.ColorConvert.string(r,s)):(l=r.offset,o=i.ColorConvert.string(r.color,s)),n.addColorStop(l,o),!d&&Ct(o)&&(d=!0);d&&(e.isTransparent=!0)}}const{getAngle:Tt,getDistance:Wt}=t.PointHelper,{get:Dt,rotateOfOuter:Ht,scaleOfOuter:It}=t.MatrixHelper,{toPoint:Ft}=t.AroundHelper,jt={},Gt={};function zt(t,e,i,n,a){let s;const{width:r,height:o}=t;if(r!==o||n){const t=Tt(e,i);s=Dt(),a?(It(s,e,r/o*(n||1),1),Ht(s,e,t+90)):(It(s,e,1,r/o*(n||1)),Ht(s,e,t))}return s}const{getDistance:Yt}=t.PointHelper,{toPoint:Ut}=t.AroundHelper,qt={},Xt={};const Nt={linearGradient:function(e,i){let{from:n,to:a,type:s,opacity:r}=e;Rt(n||"top",i,At),Rt(a||"bottom",i,Mt);const o=t.Platform.canvas.createLinearGradient(At.x,At.y,Mt.x,Mt.y),l={type:s,style:o};return Ot(l,o,e.stops,r),l},radialGradient:function(e,i){let{from:n,to:a,type:s,opacity:r,stretch:o}=e;Ft(n||"center",i,jt),Ft(a||"bottom",i,Gt);const l=t.Platform.canvas.createRadialGradient(jt.x,jt.y,0,jt.x,jt.y,Wt(jt,Gt)),d={type:s,style:l};Ot(d,l,e.stops,r);const h=zt(i,jt,Gt,o,!0);return h&&(d.transform=h),d},conicGradient:function(e,i){let{from:n,to:a,type:s,opacity:r,stretch:o}=e;Ut(n||"center",i,qt),Ut(a||"bottom",i,Xt);const l=t.Platform.conicGradientSupport?t.Platform.canvas.createConicGradient(0,qt.x,qt.y):t.Platform.canvas.createRadialGradient(qt.x,qt.y,0,qt.x,qt.y,Yt(qt,Xt)),d={type:s,style:l};Ot(d,l,e.stops,r);const h=zt(i,qt,Xt,o||1,t.Platform.conicGradientRotate90);return h&&(d.transform=h),d},getTransform:zt},{copy:Vt,toOffsetOutBounds:Qt}=t.BoundsHelper,Zt={},Kt={};function $t(e,i,n,a){const{bounds:s,shapeBounds:r}=a;if(t.Platform.fullImageShadow){if(Vt(Zt,e.bounds),Zt.x+=i.x-r.x,Zt.y+=i.y-r.y,n){const{fitMatrix:t}=a;Zt.x-=(s.x+(t?t.e:0)+s.width/2)*(n-1),Zt.y-=(s.y+(t?t.f:0)+s.height/2)*(n-1),Zt.width*=n,Zt.height*=n}e.copyWorld(a.canvas,e.bounds,Zt)}else n&&(Vt(Zt,i),Zt.x-=i.width/2*(n-1),Zt.y-=i.height/2*(n-1),Zt.width*=n,Zt.height*=n),e.copyWorld(a.canvas,r,n?Zt:i)}const{toOffsetOutBounds:Jt}=t.BoundsHelper,te={};const ee={shadow:function(e,n,a){let s,r;const{__nowWorld:o,__layout:l}=e,{shadow:d}=e.__,{worldCanvas:h,bounds:c,shapeBounds:u,scaleX:f,scaleY:g}=a,p=n.getSameCanvas(),_=d.length-1;Qt(c,Kt),d.forEach((d,y)=>{let m=1;if(d.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(m=1/t)}p.setWorldShadow(Kt.offsetX+d.x*f*m,Kt.offsetY+d.y*g*m,d.blur*f*m,i.ColorConvert.string(d.color)),r=d.spread?1+2*d.spread/(l.boxBounds.width+2*(l.strokeBoxSpread||0))*m:0,$t(p,Kt,r,a),s=c,d.box&&(p.restore(),p.save(),h&&(p.copyWorld(p,c,o,"copy"),s=o),h?p.copyWorld(h,o,o,"destination-out"):p.copyWorld(a.canvas,u,c,"destination-out")),i.Effect.isTransformShadow(d)?i.Effect.renderTransformShadow(e,n,p,s,d):t.LeafHelper.copyCanvasByWorld(e,n,p,s,d.blendMode),_&&y<_&&p.clearWorld(s)}),p.recycle(s)},innerShadow:function(e,n,a){let s,r;const{__nowWorld:o,__layout:l}=e,{innerShadow:d}=e.__,{worldCanvas:h,bounds:c,shapeBounds:u,scaleX:f,scaleY:g}=a,p=n.getSameCanvas(),_=d.length-1;Jt(c,te),d.forEach((d,y)=>{let m=1;if(d.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(m=1/t)}p.save(),p.setWorldShadow(te.offsetX+d.x*f*m,te.offsetY+d.y*g*m,d.blur*f*m),r=d.spread?1-2*d.spread/(l.boxBounds.width+2*(l.strokeBoxSpread||0))*m:0,$t(p,te,r,a),p.restore(),h?(p.copyWorld(p,c,o,"copy"),p.copyWorld(h,o,o,"source-out"),s=o):(p.copyWorld(a.canvas,u,c,"source-out"),s=c),p.fillWorld(s,i.ColorConvert.string(d.color),"source-in"),t.LeafHelper.copyCanvasByWorld(e,n,p,s,d.blendMode),_&&y<_&&p.clearWorld(s)}),p.recycle(s)},blur:function(t,e,i){const{blur:n}=t.__;i.setWorldBlur(n*t.__nowWorld.a),i.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),i.filter="none"},backgroundBlur:function(t,e,i){},getShadowSpread:function(t,e){let i=0;return e.forEach(t=>i=Math.max(i,Math.max(Math.abs(t.y),Math.abs(t.x))+(t.spread>0?t.spread:0)+1.5*t.blur)),i},isTransformShadow(t){}},{excludeRenderBounds:ie}=t.LeafBoundsHelper;let ne;function ae(t,e,i,n,a,s,r,o){switch(e){case"grayscale":ne||(ne=!0,a.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,n,a,s){const r=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(n,r),s&&n.recycle(r);re(t,e,i,1,a,s)}(t,i,n,a,r,o);break;case"opacity-path":re(t,i,n,s,r,o);break;case"path":o&&i.restore()}}function se(t){return t.getSameCanvas(!1,!0)}function re(t,e,i,n,a,s){const r=t.__nowWorld;e.resetTransform(),e.opacity=n,e.copyWorld(i,r,void 0,a),s?i.recycle(r):i.clearWorld(r)}i.Group.prototype.__renderMask=function(t,e){let i,n,a,s,r,o;const{children:l}=this;for(let d=0,h=l.length;d<h;d++){if(i=l[d],o=i.__.mask,o){r&&(ae(this,r,t,a,n,s,void 0,!0),n=a=null),s=i.__.opacity,ne=!1,"path"===o||"clipping-path"===o?(s<1?(r="opacity-path",a||(a=se(t))):(r="path",t.save()),i.__clip(a||t,e)):(r="grayscale"===o?"grayscale":"alpha",n||(n=se(t)),a||(a=se(t)),i.__render(n,e)),"clipping"!==o&&"clipping-path"!==o||ie(i,e)||i.__render(t,e);continue}const h=1===s&&i.__.__blendMode;h&&ae(this,r,t,a,n,s,void 0,!1),ie(i,e)||i.__render(a||t,e),h&&ae(this,r,t,a,n,s,h,!1)}ae(this,r,t,a,n,s,void 0,!0)};const oe=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",le=oe+"_#~&*+\\=|≮≯≈≠=…",de=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 he(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const ce=he("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),ue=he("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),fe=he(oe),ge=he(le),pe=he("- —/~|┆·");var _e;!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"}(_e||(_e={}));const{Letter:ye,Single:me,Before:we,After:ve,Symbol:xe,Break:be}=_e;function Be(t){return ce[t]?ye:pe[t]?be:ue[t]?we:fe[t]?ve:ge[t]?xe:de.test(t)?me:ye}const Ee={trimRight(t){const{words:e}=t;let i,n=0,a=e.length;for(let s=a-1;s>-1&&(i=e[s].data[0]," "===i.char);s--)n++,t.width-=i.width;n&&e.splice(a-n,n)}};function Le(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:ke}=Ee,{Letter:Se,Single:Pe,Before:Re,After:Ce,Symbol:Ae,Break:Me}=_e;let Oe,Te,We,De,He,Ie,Fe,je,Ge,ze,Ye,Ue,qe,Xe,Ne,Ve,Qe,Ze=[];function Ke(t,e){Ge&&!je&&(je=Ge),Oe.data.push({char:t,width:e}),We+=e}function $e(){De+=We,Oe.width=We,Te.words.push(Oe),Oe={data:[]},We=0}function Je(){Xe&&(Ne.paraNumber++,Te.paraStart=!0,Xe=!1),Ge&&(Te.startCharSize=je,Te.endCharSize=Ge,je=0),Te.width=De,Ve.width?ke(Te):Qe&&ti(),Ze.push(Te),Te={words:[]},De=0}function ti(){De>(Ne.maxWidth||0)&&(Ne.maxWidth=De)}const{top:ei,right:ii,bottom:ni,left:ai}=t.Direction4;function si(t,e,i){const{bounds:n,rows:a}=t;n[e]+=i;for(let t=0;t<a.length;t++)a[t][e]+=i}const ri={getDrawData:function(e,n){t.isString(e)||(e=String(e));let a=0,s=0,r=n.__getInput("width")||0,o=n.__getInput("height")||0;const{textDecoration:l,__font:d,__padding:h}=n;h&&(r?(a=h[ai],r-=h[ii]+h[ai]):n.autoSizeAlign||(a=h[ai]),o?(s=h[ei],o-=h[ei]+h[ni]):n.autoSizeAlign||(s=h[ei]));const c={bounds:{x:a,y:s,width:r,height:o},rows:[],paraNumber:0,font:t.Platform.canvas.font=d};return function(e,i,n){Ne=e,Ze=e.rows,Ve=e.bounds,Qe=!Ve.width&&!n.autoSizeAlign;const{__letterSpacing:a,paraIndent:s,textCase:r}=n,{canvas:o}=t.Platform,{width:l,height:d}=Ve;if(l||d||a||"none"!==r){const t="none"!==n.textWrap,e="break"===n.textWrap;Xe=!0,Ye=null,je=Fe=Ge=We=De=0,Oe={data:[]},Te={words:[]},a&&(i=[...i]);for(let n=0,d=i.length;n<d;n++)Ie=i[n],"\n"===Ie?(We&&$e(),Te.paraEnd=!0,Je(),Xe=!0):(ze=Be(Ie),ze===Se&&"none"!==r&&(Ie=Le(Ie,r,!We)),Fe=o.measureText(Ie).width,a&&(a<0&&(Ge=Fe),Fe+=a),Ue=ze===Pe&&(Ye===Pe||Ye===Se)||Ye===Pe&&ze!==Ce,qe=!(ze!==Re&&ze!==Pe||Ye!==Ae&&Ye!==Ce),He=Xe&&s?l-s:l,t&&l&&De+We+Fe>He&&(e?(We&&$e(),De&&Je()):(qe||(qe=ze===Se&&Ye==Ce),Ue||qe||ze===Me||ze===Re||ze===Pe||We+Fe>He?(We&&$e(),De&&Je()):De&&Je()))," "===Ie&&!0!==Xe&&De+We===0||(ze===Me?(" "===Ie&&We&&$e(),Ke(Ie,Fe),$e()):Ue||qe?(We&&$e(),Ke(Ie,Fe)):Ke(Ie,Fe)),Ye=ze);We&&$e(),De&&Je(),Ze.length>0&&(Ze[Ze.length-1].paraEnd=!0)}else i.split("\n").forEach(t=>{Ne.paraNumber++,De=o.measureText(t).width,Ze.push({x:s||0,text:t,width:De,paraStart:!0}),Qe&&ti()})}(c,e,n),h&&function(t,e,i,n,a){if(!n&&i.autoSizeAlign)switch(i.textAlign){case"left":si(e,"x",t[ai]);break;case"right":si(e,"x",-t[ii])}if(!a&&i.autoSizeAlign)switch(i.verticalAlign){case"top":si(e,"y",t[ei]);break;case"bottom":si(e,"y",-t[ni])}}(h,c,n,r,o),function(t,e){const{rows:i,bounds:n}=t,a=i.length,{__lineHeight:s,__baseLine:r,__letterSpacing:o,__clipText:l,textAlign:d,verticalAlign:h,paraSpacing:c,autoSizeAlign:u}=e;let{x:f,y:g,width:p,height:_}=n,y=s*a+(c?c*(t.paraNumber-1):0),m=r;if(l&&y>_)y=Math.max(_,s),a>1&&(t.overflow=a);else if(_||u)switch(h){case"middle":g+=(_-y)/2;break;case"bottom":g+=_-y}m+=g;let w,v,x,b=p||u?p:t.maxWidth;for(let r=0,h=a;r<h;r++){if(w=i[r],w.x=f,w.width<p||w.width>p&&!l)switch(d){case"center":w.x+=(b-w.width)/2;break;case"right":w.x+=b-w.width}w.paraStart&&c&&r>0&&(m+=c),w.y=m,m+=s,t.overflow>r&&m>y&&(w.isOverflow=!0,t.overflow=r+1),v=w.x,x=w.width,o<0&&(w.width<0?(x=-w.width+e.fontSize+o,v-=x,x+=e.fontSize):x-=o),v<n.x&&(n.x=v),x>n.width&&(n.width=x),l&&p&&p<x&&(w.isOverflow=!0,t.overflow||(t.overflow=i.length))}n.y=g,n.height=y}(c,n),function(t,e,i){const{rows:n}=t,{textAlign:a,paraIndent:s,letterSpacing:r}=e;let o,l,d,h,c,u;n.forEach(t=>{t.words&&(d=s&&t.paraStart?s:0,u=t.words.length,l=i&&("justify"===a||"both"===a)&&u>1?(i-t.width-d)/(u-1):0,h=r||t.isOverflow?0:l>.01?1:2,t.isOverflow&&!r&&(t.textMode=!0),2===h?(t.x+=d,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=d,o=t.x,t.data=[],t.words.forEach((e,i)=>{1===h?(c={char:"",x:o},o=function(t,e,i){return t.forEach(t=>{i.char+=t.char,e+=t.width}),e}(e.data,o,c),(t.isOverflow||" "!==c.char)&&t.data.push(c)):o=function(t,e,i,n){return t.forEach(t=>{(n||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width}),e}(e.data,o,t.data,t.isOverflow),!l||t.paraEnd&&"both"!==a||i===u-1||(o+=l,t.width+=l)})),t.words=null)})}(c,n,r),c.overflow&&function(e,i,n,a){if(!a)return;const{rows:s,overflow:r}=e;let{textOverflow:o}=i;if(s.splice(r),o&&"show"!==o){let e,l;"hide"===o?o="":"ellipsis"===o&&(o="...");const d=o?t.Platform.canvas.measureText(o).width:0,h=n+a-d;("none"===i.textWrap?s:[s[r-1]]).forEach(t=>{if(t.isOverflow&&t.data){let i=t.data.length-1;for(let n=i;n>-1&&(e=t.data[n],l=e.x+e.width,!(n===i&&l<h));n--){if(l<h&&" "!==e.char||!n){t.data.splice(n+1),t.width-=e.width;break}t.width-=e.width}t.width+=d,t.data.push({char:o,x:l}),t.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(t)}})}}(c,n,a,r),"none"!==l&&function(e,n){let a,s=0;const{fontSize:r,textDecoration:o}=n;switch(e.decorationHeight=r/11,t.isObject(o)?(a=o.type,o.color&&(e.decorationColor=i.ColorConvert.string(o.color)),o.offset&&(s=Math.min(.3*r,Math.max(o.offset,.15*-r)))):a=o,a){case"under":e.decorationY=[.15*r+s];break;case"delete":e.decorationY=[.35*-r];break;case"under-delete":e.decorationY=[.15*r+s,.35*-r]}}(c,n),c}};const oi={string:function(e,n){const a=t.isNumber(n)&&n<1;if(t.isString(e)){if(!a||!i.ColorConvert.object)return e;e=i.ColorConvert.object(e)}let s=t.isUndefined(e.a)?1:e.a;a&&(s*=n);const r=e.r+","+e.g+","+e.b;return 1===s?"rgb("+r+")":"rgba("+r+","+s+")"}};Object.assign(i.TextConvert,ri),Object.assign(i.ColorConvert,oi),Object.assign(i.Paint,G),Object.assign(i.PaintImage,Pt),Object.assign(i.PaintGradient,Nt),Object.assign(i.Effect,ee),Object.assign(t.Creator,{interaction:(t,i,n,a)=>new e.InteractionBase(t,i,n,a),hitCanvas:(t,e)=>new n(t,e),hitCanvasManager:()=>new e.HitCanvasManager}),s(),Object.defineProperty(exports,"LeaferImage",{enumerable:!0,get:function(){return t.LeaferImage}}),exports.Layouter=m,exports.LeaferCanvas=n,exports.Picker=b,exports.Renderer=v,exports.Selector=B,exports.Watcher=o,exports.useCanvas=s,Object.keys(t).forEach(function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}})}),Object.keys(e).forEach(function(t){"default"===t||Object.prototype.hasOwnProperty.call(exports,t)||Object.defineProperty(exports,t,{enumerable:!0,get:function(){return e[t]}})});
|
|
2
2
|
//# sourceMappingURL=worker.min.cjs.map
|