@leafer-ui/worker 1.12.3 → 2.0.0
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 +16 -10
- package/dist/worker.esm.js +17 -11
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.esm.min.js.map +1 -1
- package/dist/worker.js +110 -85
- 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 +114 -89
- 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
|
@@ -199,54 +199,6 @@ var LeaferUI = function(exports) {
|
|
|
199
199
|
this.__input = this.__middle = null;
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
|
-
const {floor: floor$2, max: max$5} = Math;
|
|
203
|
-
const Platform = {
|
|
204
|
-
toURL(text, fileType) {
|
|
205
|
-
let url = encodeURIComponent(text);
|
|
206
|
-
if (fileType === "text") url = "data:text/plain;charset=utf-8," + url; else if (fileType === "svg") url = "data:image/svg+xml," + url;
|
|
207
|
-
return url;
|
|
208
|
-
},
|
|
209
|
-
image: {
|
|
210
|
-
hitCanvasSize: 100,
|
|
211
|
-
maxCacheSize: 2560 * 1600,
|
|
212
|
-
maxPatternSize: 4096 * 2160,
|
|
213
|
-
crossOrigin: "anonymous",
|
|
214
|
-
isLarge(size, scaleX, scaleY, largeSize) {
|
|
215
|
-
return size.width * size.height * (scaleX ? scaleX * scaleY : 1) > (largeSize || image$1.maxCacheSize);
|
|
216
|
-
},
|
|
217
|
-
isSuperLarge(size, scaleX, scaleY) {
|
|
218
|
-
return image$1.isLarge(size, scaleX, scaleY, image$1.maxPatternSize);
|
|
219
|
-
},
|
|
220
|
-
getRealURL(url) {
|
|
221
|
-
const {prefix: prefix, suffix: suffix} = Platform.image;
|
|
222
|
-
if (suffix && !url.startsWith("data:") && !url.startsWith("blob:")) url += (url.includes("?") ? "&" : "?") + suffix;
|
|
223
|
-
if (prefix && url[0] === "/") url = prefix + url;
|
|
224
|
-
return url;
|
|
225
|
-
},
|
|
226
|
-
resize(image, width, height, xGap, yGap, clip, smooth, opacity, _filters) {
|
|
227
|
-
const canvas = Platform.origin.createCanvas(max$5(floor$2(width + (xGap || 0)), 1), max$5(floor$2(height + (yGap || 0)), 1));
|
|
228
|
-
const ctx = canvas.getContext("2d");
|
|
229
|
-
if (opacity) ctx.globalAlpha = opacity;
|
|
230
|
-
ctx.imageSmoothingEnabled = smooth === false ? false : true;
|
|
231
|
-
if (clip) {
|
|
232
|
-
const scaleX = width / clip.width, scaleY = height / clip.height;
|
|
233
|
-
ctx.setTransform(scaleX, 0, 0, scaleY, -clip.x * scaleX, -clip.y * scaleY);
|
|
234
|
-
ctx.drawImage(image, 0, 0, image.width, image.height);
|
|
235
|
-
} else ctx.drawImage(image, 0, 0, width, height);
|
|
236
|
-
return canvas;
|
|
237
|
-
},
|
|
238
|
-
setPatternTransform(pattern, transform, paint) {
|
|
239
|
-
try {
|
|
240
|
-
if (transform && pattern.setTransform) {
|
|
241
|
-
pattern.setTransform(transform);
|
|
242
|
-
transform = undefined;
|
|
243
|
-
}
|
|
244
|
-
} catch (_a) {}
|
|
245
|
-
if (paint) DataHelper.stintSet(paint, "transform", transform);
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
};
|
|
249
|
-
const {image: image$1} = Platform;
|
|
250
202
|
const IncrementId = {
|
|
251
203
|
RUNTIME: "runtime",
|
|
252
204
|
LEAF: "leaf",
|
|
@@ -266,7 +218,7 @@ var LeaferUI = function(exports) {
|
|
|
266
218
|
};
|
|
267
219
|
const I$2 = IncrementId;
|
|
268
220
|
let tempA, tempB, tempTo;
|
|
269
|
-
const {max: max$
|
|
221
|
+
const {max: max$5} = Math, tempFour = [ 0, 0, 0, 0 ];
|
|
270
222
|
const FourNumberHelper = {
|
|
271
223
|
zero: [ ...tempFour ],
|
|
272
224
|
tempFour: tempFour,
|
|
@@ -317,9 +269,9 @@ var LeaferUI = function(exports) {
|
|
|
317
269
|
return data;
|
|
318
270
|
},
|
|
319
271
|
max(t, other, change) {
|
|
320
|
-
if (isNumber(t) && isNumber(other)) return max$
|
|
272
|
+
if (isNumber(t) && isNumber(other)) return max$5(t, other);
|
|
321
273
|
toTempAB(t, other, change);
|
|
322
|
-
return set$2(tempTo, max$
|
|
274
|
+
return set$2(tempTo, max$5(tempA[0], tempB[0]), max$5(tempA[1], tempB[1]), max$5(tempA[2], tempB[2]), max$5(tempA[3], tempB[3]));
|
|
323
275
|
},
|
|
324
276
|
add(t, other, change) {
|
|
325
277
|
if (isNumber(t) && isNumber(other)) return t + other;
|
|
@@ -334,7 +286,7 @@ var LeaferUI = function(exports) {
|
|
|
334
286
|
}
|
|
335
287
|
};
|
|
336
288
|
const {set: set$2, get: get$5, setTemp: setTemp, toTempAB: toTempAB} = FourNumberHelper;
|
|
337
|
-
const {round: round$3, pow: pow$1, max: max$
|
|
289
|
+
const {round: round$3, pow: pow$1, max: max$4, floor: floor$2, PI: PI$3} = Math;
|
|
338
290
|
const MathHelper = {
|
|
339
291
|
within(value, min, max) {
|
|
340
292
|
if (isObject(min)) max = min.max, min = min.min;
|
|
@@ -387,7 +339,7 @@ var LeaferUI = function(exports) {
|
|
|
387
339
|
}
|
|
388
340
|
},
|
|
389
341
|
getFloorScale(num, min = 1) {
|
|
390
|
-
return max$
|
|
342
|
+
return max$4(floor$2(num), min) / num;
|
|
391
343
|
},
|
|
392
344
|
randInt: randInt,
|
|
393
345
|
randColor(opacity) {
|
|
@@ -1193,7 +1145,7 @@ var LeaferUI = function(exports) {
|
|
|
1193
1145
|
const {tempPointBounds: tempPointBounds$1, setPoint: setPoint$2, addPoint: addPoint$2, toBounds: toBounds$2} = TwoPointBoundsHelper;
|
|
1194
1146
|
const {toOuterPoint: toOuterPoint$2} = MatrixHelper;
|
|
1195
1147
|
const {float: float$1, fourNumber: fourNumber} = MathHelper;
|
|
1196
|
-
const {floor: floor, ceil: ceil$1} = Math;
|
|
1148
|
+
const {floor: floor$1, ceil: ceil$1} = Math;
|
|
1197
1149
|
let right$1, bottom$1, boundsRight, boundsBottom;
|
|
1198
1150
|
const point = {};
|
|
1199
1151
|
const toPoint$4 = {};
|
|
@@ -1345,8 +1297,8 @@ var LeaferUI = function(exports) {
|
|
|
1345
1297
|
},
|
|
1346
1298
|
ceil(t) {
|
|
1347
1299
|
const {x: x, y: y} = t;
|
|
1348
|
-
t.x = floor(t.x);
|
|
1349
|
-
t.y = floor(t.y);
|
|
1300
|
+
t.x = floor$1(t.x);
|
|
1301
|
+
t.y = floor$1(t.y);
|
|
1350
1302
|
t.width = x > t.x ? ceil$1(t.width + x - t.x) : ceil$1(t.width);
|
|
1351
1303
|
t.height = y > t.y ? ceil$1(t.height + y - t.y) : ceil$1(t.height);
|
|
1352
1304
|
},
|
|
@@ -1478,6 +1430,9 @@ var LeaferUI = function(exports) {
|
|
|
1478
1430
|
isEmpty(t) {
|
|
1479
1431
|
return t.x === 0 && t.y === 0 && t.width === 0 && t.height === 0;
|
|
1480
1432
|
},
|
|
1433
|
+
hasSize(t) {
|
|
1434
|
+
return t.width && t.height;
|
|
1435
|
+
},
|
|
1481
1436
|
reset(t) {
|
|
1482
1437
|
B.set(t);
|
|
1483
1438
|
}
|
|
@@ -1648,6 +1603,11 @@ var LeaferUI = function(exports) {
|
|
|
1648
1603
|
return new Bounds(left, top, width ? width : parent.width - left - right, height ? height : parent.height - top - bottom);
|
|
1649
1604
|
}
|
|
1650
1605
|
}
|
|
1606
|
+
const UnitConvertHelper = {
|
|
1607
|
+
number(value, percentRefer) {
|
|
1608
|
+
return isObject(value) ? value.type === "percent" ? value.value * percentRefer : value.value : value;
|
|
1609
|
+
}
|
|
1610
|
+
};
|
|
1651
1611
|
const StringNumberMap = {
|
|
1652
1612
|
0: 1,
|
|
1653
1613
|
1: 1,
|
|
@@ -1663,6 +1623,66 @@ var LeaferUI = function(exports) {
|
|
|
1663
1623
|
e: 1,
|
|
1664
1624
|
E: 1
|
|
1665
1625
|
};
|
|
1626
|
+
const {floor: floor, max: max$3} = Math;
|
|
1627
|
+
const Platform = {
|
|
1628
|
+
toURL(text, fileType) {
|
|
1629
|
+
let url = encodeURIComponent(text);
|
|
1630
|
+
if (fileType === "text") url = "data:text/plain;charset=utf-8," + url; else if (fileType === "svg") url = "data:image/svg+xml," + url;
|
|
1631
|
+
return url;
|
|
1632
|
+
},
|
|
1633
|
+
image: {
|
|
1634
|
+
hitCanvasSize: 100,
|
|
1635
|
+
maxCacheSize: 2560 * 1600,
|
|
1636
|
+
maxPatternSize: 4096 * 2160,
|
|
1637
|
+
crossOrigin: "anonymous",
|
|
1638
|
+
isLarge(size, scaleX, scaleY, largeSize) {
|
|
1639
|
+
return size.width * size.height * (scaleX ? scaleX * scaleY : 1) > (largeSize || image$1.maxCacheSize);
|
|
1640
|
+
},
|
|
1641
|
+
isSuperLarge(size, scaleX, scaleY) {
|
|
1642
|
+
return image$1.isLarge(size, scaleX, scaleY, image$1.maxPatternSize);
|
|
1643
|
+
},
|
|
1644
|
+
getRealURL(url) {
|
|
1645
|
+
const {prefix: prefix, suffix: suffix} = image$1;
|
|
1646
|
+
if (suffix && !url.startsWith("data:") && !url.startsWith("blob:")) url += (url.includes("?") ? "&" : "?") + suffix;
|
|
1647
|
+
if (prefix && url[0] === "/") url = prefix + url;
|
|
1648
|
+
return url;
|
|
1649
|
+
},
|
|
1650
|
+
resize(view, width, height, xGap, yGap, clip, smooth, opacity, _filters, interlace) {
|
|
1651
|
+
const realWidth = max$3(floor(width + (xGap || 0)), 1), realHeight = max$3(floor(height + (yGap || 0)), 1);
|
|
1652
|
+
let interlaceX, interlaceY, interlaceOffset;
|
|
1653
|
+
if (interlace && (interlaceOffset = UnitConvertHelper.number(interlace.offset, (interlaceX = interlace.type === "x") ? width : height))) interlaceX || (interlaceY = true);
|
|
1654
|
+
const canvas = Platform.origin.createCanvas(interlaceY ? realWidth * 2 : realWidth, interlaceX ? realHeight * 2 : realHeight);
|
|
1655
|
+
const ctx = canvas.getContext("2d");
|
|
1656
|
+
if (opacity) ctx.globalAlpha = opacity;
|
|
1657
|
+
ctx.imageSmoothingEnabled = smooth === false ? false : true;
|
|
1658
|
+
if (image$1.canUse(view)) {
|
|
1659
|
+
if (clip) {
|
|
1660
|
+
const scaleX = width / clip.width, scaleY = height / clip.height;
|
|
1661
|
+
ctx.setTransform(scaleX, 0, 0, scaleY, -clip.x * scaleX, -clip.y * scaleY);
|
|
1662
|
+
ctx.drawImage(view, 0, 0, view.width, view.height);
|
|
1663
|
+
} else ctx.drawImage(view, 0, 0, width, height);
|
|
1664
|
+
if (interlaceOffset) {
|
|
1665
|
+
ctx.drawImage(canvas, 0, 0, realWidth, realHeight, interlaceX ? interlaceOffset - realWidth : realWidth, interlaceX ? realHeight : interlaceOffset - realHeight, realWidth, realHeight);
|
|
1666
|
+
ctx.drawImage(canvas, 0, 0, realWidth, realHeight, interlaceX ? interlaceOffset : realWidth, interlaceX ? realHeight : interlaceOffset, realWidth, realHeight);
|
|
1667
|
+
}
|
|
1668
|
+
}
|
|
1669
|
+
return canvas;
|
|
1670
|
+
},
|
|
1671
|
+
canUse(view) {
|
|
1672
|
+
return view && view.width && !view.__closed;
|
|
1673
|
+
},
|
|
1674
|
+
setPatternTransform(pattern, transform, paint) {
|
|
1675
|
+
try {
|
|
1676
|
+
if (transform && pattern.setTransform) {
|
|
1677
|
+
pattern.setTransform(transform);
|
|
1678
|
+
transform = undefined;
|
|
1679
|
+
}
|
|
1680
|
+
} catch (_a) {}
|
|
1681
|
+
if (paint) DataHelper.stintSet(paint, "transform", transform);
|
|
1682
|
+
}
|
|
1683
|
+
}
|
|
1684
|
+
};
|
|
1685
|
+
const {image: image$1} = Platform;
|
|
1666
1686
|
const {randColor: randColor} = MathHelper;
|
|
1667
1687
|
class Debug {
|
|
1668
1688
|
constructor(name) {
|
|
@@ -3549,9 +3569,10 @@ var LeaferUI = function(exports) {
|
|
|
3549
3569
|
run() {
|
|
3550
3570
|
return __awaiter(this, void 0, void 0, function*() {
|
|
3551
3571
|
try {
|
|
3552
|
-
if (this.isComplete) return;
|
|
3572
|
+
if (this.isComplete || this.runing) return;
|
|
3573
|
+
this.runing = true;
|
|
3553
3574
|
if (this.canUse && !this.canUse()) return this.cancel();
|
|
3554
|
-
if (this.task
|
|
3575
|
+
if (this.task) yield this.task();
|
|
3555
3576
|
} catch (error) {
|
|
3556
3577
|
debug$9.error(error);
|
|
3557
3578
|
}
|
|
@@ -3666,7 +3687,7 @@ var LeaferUI = function(exports) {
|
|
|
3666
3687
|
stop() {
|
|
3667
3688
|
this.isComplete = true;
|
|
3668
3689
|
this.list.forEach(task => {
|
|
3669
|
-
if (!task.isComplete) task.
|
|
3690
|
+
if (!task.isComplete) task.run();
|
|
3670
3691
|
});
|
|
3671
3692
|
this.pause();
|
|
3672
3693
|
this.empty();
|
|
@@ -3949,7 +3970,7 @@ var LeaferUI = function(exports) {
|
|
|
3949
3970
|
getFull(_filters) {
|
|
3950
3971
|
return this.view;
|
|
3951
3972
|
}
|
|
3952
|
-
getCanvas(width, height, opacity, filters, xGap, yGap, smooth) {
|
|
3973
|
+
getCanvas(width, height, opacity, filters, xGap, yGap, smooth, interlace) {
|
|
3953
3974
|
width || (width = this.width);
|
|
3954
3975
|
height || (height = this.height);
|
|
3955
3976
|
if (this.cache) {
|
|
@@ -3962,7 +3983,7 @@ var LeaferUI = function(exports) {
|
|
|
3962
3983
|
}
|
|
3963
3984
|
if (data) return data;
|
|
3964
3985
|
}
|
|
3965
|
-
const canvas = Platform.image.resize(this.view, width, height, xGap, yGap, undefined, smooth, opacity, filters);
|
|
3986
|
+
const canvas = Platform.image.resize(this.view, width, height, xGap, yGap, undefined, smooth, opacity, filters, interlace);
|
|
3966
3987
|
this.cache = this.use > 1 ? {
|
|
3967
3988
|
data: canvas,
|
|
3968
3989
|
params: arguments
|
|
@@ -3978,13 +3999,13 @@ var LeaferUI = function(exports) {
|
|
|
3978
3999
|
return this.url;
|
|
3979
4000
|
}
|
|
3980
4001
|
setThumbView(_view) {}
|
|
3981
|
-
getThumbSize() {
|
|
4002
|
+
getThumbSize(_lod) {
|
|
3982
4003
|
return undefined;
|
|
3983
4004
|
}
|
|
3984
4005
|
getMinLevel() {
|
|
3985
4006
|
return undefined;
|
|
3986
4007
|
}
|
|
3987
|
-
getLevelData(_level) {
|
|
4008
|
+
getLevelData(_level, _width, _height) {
|
|
3988
4009
|
return undefined;
|
|
3989
4010
|
}
|
|
3990
4011
|
clearLevels(_checkUse) {}
|
|
@@ -5704,7 +5725,7 @@ var LeaferUI = function(exports) {
|
|
|
5704
5725
|
if (this.__layout.opacityChanged) this.__layout.opacityChanged = false;
|
|
5705
5726
|
}
|
|
5706
5727
|
};
|
|
5707
|
-
const {excludeRenderBounds: excludeRenderBounds$1} = LeafBoundsHelper;
|
|
5728
|
+
const {excludeRenderBounds: excludeRenderBounds$1} = LeafBoundsHelper, {hasSize: hasSize} = BoundsHelper;
|
|
5708
5729
|
const BranchRender = {
|
|
5709
5730
|
__updateChange() {
|
|
5710
5731
|
const {__layout: layout} = this;
|
|
@@ -5715,8 +5736,8 @@ var LeaferUI = function(exports) {
|
|
|
5715
5736
|
this.__.__checkSingle();
|
|
5716
5737
|
},
|
|
5717
5738
|
__render(canvas, options) {
|
|
5718
|
-
this.__nowWorld = this.__getNowWorld(options);
|
|
5719
|
-
if (this.__worldOpacity) {
|
|
5739
|
+
const nowWorld = this.__nowWorld = this.__getNowWorld(options);
|
|
5740
|
+
if (this.__worldOpacity && hasSize(nowWorld)) {
|
|
5720
5741
|
const data = this.__;
|
|
5721
5742
|
if (data.__useDim) {
|
|
5722
5743
|
if (data.dim) options.dimOpacity = data.dim === true ? .2 : data.dim; else if (data.bright && !options.topRendering) return options.topList.add(this); else if (data.dimskip) options.dimOpacity && (options.dimOpacity = 0);
|
|
@@ -5725,7 +5746,6 @@ var LeaferUI = function(exports) {
|
|
|
5725
5746
|
if (data.eraser === "path") return this.__renderEraser(canvas, options);
|
|
5726
5747
|
const tempCanvas = canvas.getSameCanvas(false, true);
|
|
5727
5748
|
this.__renderBranch(tempCanvas, options);
|
|
5728
|
-
const nowWorld = this.__nowWorld;
|
|
5729
5749
|
canvas.opacity = options.dimOpacity ? data.opacity * options.dimOpacity : data.opacity;
|
|
5730
5750
|
canvas.copyWorldByReset(tempCanvas, nowWorld, nowWorld, data.__blendMode, true);
|
|
5731
5751
|
tempCanvas.recycle(nowWorld);
|
|
@@ -6547,7 +6567,7 @@ var LeaferUI = function(exports) {
|
|
|
6547
6567
|
this.levelMap = null;
|
|
6548
6568
|
}
|
|
6549
6569
|
}
|
|
6550
|
-
const version = "
|
|
6570
|
+
const version = "2.0.0";
|
|
6551
6571
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6552
6572
|
get allowBackgroundColor() {
|
|
6553
6573
|
return true;
|
|
@@ -6947,6 +6967,7 @@ var LeaferUI = function(exports) {
|
|
|
6947
6967
|
this.times = 0;
|
|
6948
6968
|
this.config = {
|
|
6949
6969
|
usePartRender: true,
|
|
6970
|
+
ceilPartPixel: true,
|
|
6950
6971
|
maxFPS: 120
|
|
6951
6972
|
};
|
|
6952
6973
|
this.frames = [];
|
|
@@ -7055,8 +7076,9 @@ var LeaferUI = function(exports) {
|
|
|
7055
7076
|
const {canvas: canvas} = this, bounds = block.getIntersect(canvas.bounds), realBounds = new Bounds(bounds);
|
|
7056
7077
|
canvas.save();
|
|
7057
7078
|
bounds.spread(Renderer.clipSpread).ceil();
|
|
7058
|
-
|
|
7059
|
-
canvas.clipWorld(bounds);
|
|
7079
|
+
const {ceilPartPixel: ceilPartPixel} = this.config;
|
|
7080
|
+
canvas.clipWorld(bounds, ceilPartPixel);
|
|
7081
|
+
canvas.clearWorld(bounds, ceilPartPixel);
|
|
7060
7082
|
this.__render(bounds, realBounds);
|
|
7061
7083
|
canvas.restore();
|
|
7062
7084
|
Run.end(t);
|
|
@@ -7438,11 +7460,7 @@ var LeaferUI = function(exports) {
|
|
|
7438
7460
|
const ColorConvert = {
|
|
7439
7461
|
hasTransparent: hasTransparent$3
|
|
7440
7462
|
};
|
|
7441
|
-
const UnitConvert =
|
|
7442
|
-
number(value, percentRefer) {
|
|
7443
|
-
return isObject(value) ? value.type === "percent" ? value.value * percentRefer : value.value : value;
|
|
7444
|
-
}
|
|
7445
|
-
};
|
|
7463
|
+
const UnitConvert = UnitConvertHelper;
|
|
7446
7464
|
const PathArrow = {};
|
|
7447
7465
|
const Paint = {};
|
|
7448
7466
|
const PaintImage = {};
|
|
@@ -8660,9 +8678,10 @@ var LeaferUI = function(exports) {
|
|
|
8660
8678
|
const {width: width, height: height, innerRadius: innerRadius, startAngle: startAngle, endAngle: endAngle} = this.__;
|
|
8661
8679
|
const rx = width / 2, ry = height / 2;
|
|
8662
8680
|
const path = this.__.path = [];
|
|
8681
|
+
let open;
|
|
8663
8682
|
if (innerRadius) {
|
|
8664
8683
|
if (startAngle || endAngle) {
|
|
8665
|
-
if (innerRadius < 1) ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius, 0, startAngle, endAngle, false);
|
|
8684
|
+
if (innerRadius < 1) ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius, 0, startAngle, endAngle, false); else open = true;
|
|
8666
8685
|
ellipse(path, rx, ry, rx, ry, 0, endAngle, startAngle, true);
|
|
8667
8686
|
} else {
|
|
8668
8687
|
if (innerRadius < 1) {
|
|
@@ -8679,7 +8698,7 @@ var LeaferUI = function(exports) {
|
|
|
8679
8698
|
ellipse(path, rx, ry, rx, ry);
|
|
8680
8699
|
}
|
|
8681
8700
|
}
|
|
8682
|
-
closePath$2(path);
|
|
8701
|
+
if (!open) closePath$2(path);
|
|
8683
8702
|
if (Platform.ellipseToCurve) this.__.path = this.getPath(true);
|
|
8684
8703
|
}
|
|
8685
8704
|
};
|
|
@@ -10345,6 +10364,7 @@ var LeaferUI = function(exports) {
|
|
|
10345
10364
|
ImageManager.patternLocked = true;
|
|
10346
10365
|
this.__renderShape(h, {
|
|
10347
10366
|
matrix: matrix.setWith(this.__world).scaleWith(1 / scale).invertWith().translate(-x, -y),
|
|
10367
|
+
snapshot: true,
|
|
10348
10368
|
ignoreFill: !isHitPixelFill,
|
|
10349
10369
|
ignoreStroke: !isHitPixelStroke
|
|
10350
10370
|
});
|
|
@@ -10813,7 +10833,7 @@ var LeaferUI = function(exports) {
|
|
|
10813
10833
|
ignoreRender(ui, false);
|
|
10814
10834
|
onLoadError(ui, event, error);
|
|
10815
10835
|
leafPaint.loadId = undefined;
|
|
10816
|
-
}, paint.lod && image.getThumbSize());
|
|
10836
|
+
}, paint.lod && image.getThumbSize(paint.lod));
|
|
10817
10837
|
if (ui.placeholderColor) {
|
|
10818
10838
|
if (!ui.placeholderDelay) image.isPlacehold = true; else setTimeout(() => {
|
|
10819
10839
|
if (!image.ready) {
|
|
@@ -10871,7 +10891,7 @@ var LeaferUI = function(exports) {
|
|
|
10871
10891
|
if (paint.padding) box = tempBox.set(box).shrink(paint.padding);
|
|
10872
10892
|
if (paint.mode === "strench") paint.mode = "stretch";
|
|
10873
10893
|
const {width: width, height: height} = image;
|
|
10874
|
-
const {opacity: opacity, mode: mode, align: align, offset: offset, scale: scale, size: size, rotation: rotation, skew: skew, clipSize: clipSize, repeat: repeat, gap: gap, filters: filters} = paint;
|
|
10894
|
+
const {opacity: opacity, mode: mode, align: align, offset: offset, scale: scale, size: size, rotation: rotation, skew: skew, clipSize: clipSize, repeat: repeat, gap: gap, filters: filters, interlace: interlace} = paint;
|
|
10875
10895
|
const sameBox = box.width === width && box.height === height;
|
|
10876
10896
|
const data = {
|
|
10877
10897
|
mode: mode
|
|
@@ -10937,6 +10957,10 @@ var LeaferUI = function(exports) {
|
|
|
10937
10957
|
if (opacity && opacity < 1) data.opacity = opacity;
|
|
10938
10958
|
if (filters) data.filters = filters;
|
|
10939
10959
|
if (repeat) data.repeat = isString(repeat) ? repeat === "x" ? "repeat-x" : "repeat-y" : "repeat";
|
|
10960
|
+
if (interlace) data.interlace = isNumber(interlace) || interlace.type === "percent" ? {
|
|
10961
|
+
type: "x",
|
|
10962
|
+
offset: interlace
|
|
10963
|
+
} : interlace;
|
|
10940
10964
|
return data;
|
|
10941
10965
|
}
|
|
10942
10966
|
function getGapData(gap, repeat, width, height, box) {
|
|
@@ -11057,7 +11081,7 @@ var LeaferUI = function(exports) {
|
|
|
11057
11081
|
if (transform) copy$1(imageMatrix, transform);
|
|
11058
11082
|
scale(imageMatrix, 1 / scaleX, 1 / scaleY);
|
|
11059
11083
|
}
|
|
11060
|
-
const imageCanvas = image.getCanvas(width, height, data.opacity, data.filters, xGap, yGap, ui.leafer && ui.leafer.config.smooth);
|
|
11084
|
+
const imageCanvas = image.getCanvas(width, height, data.opacity, data.filters, xGap, yGap, ui.leafer && ui.leafer.config.smooth, data.interlace);
|
|
11061
11085
|
const pattern = image.getPattern(imageCanvas, data.repeat || (Platform.origin.noRepeat || "no-repeat"), imageMatrix, paint);
|
|
11062
11086
|
paint.style = pattern;
|
|
11063
11087
|
paint.patternId = id;
|
|
@@ -11077,8 +11101,8 @@ var LeaferUI = function(exports) {
|
|
|
11077
11101
|
}
|
|
11078
11102
|
function checkImage(paint, drawImage, ui, canvas, renderOptions) {
|
|
11079
11103
|
const {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions);
|
|
11080
|
-
const {image: image, data: data, originPaint: originPaint} = paint, {exporting: exporting} = renderOptions;
|
|
11081
|
-
if (!data || paint.patternId === scaleX + "-" + scaleY && !exporting) {
|
|
11104
|
+
const {image: image, data: data, originPaint: originPaint} = paint, {exporting: exporting, snapshot: snapshot} = renderOptions;
|
|
11105
|
+
if (!data || paint.patternId === scaleX + "-" + scaleY && !exporting || snapshot) {
|
|
11082
11106
|
return false;
|
|
11083
11107
|
} else {
|
|
11084
11108
|
if (drawImage) {
|
|
@@ -11671,7 +11695,7 @@ var LeaferUI = function(exports) {
|
|
|
11671
11695
|
const TextMode = 2;
|
|
11672
11696
|
function layoutChar(drawData, style, width, _height) {
|
|
11673
11697
|
const {rows: rows} = drawData;
|
|
11674
|
-
const {textAlign: textAlign, paraIndent: paraIndent,
|
|
11698
|
+
const {textAlign: textAlign, paraIndent: paraIndent, __letterSpacing: __letterSpacing} = style;
|
|
11675
11699
|
const justifyLast = width && textAlign.includes("both");
|
|
11676
11700
|
const justify = justifyLast || width && textAlign.includes("justify");
|
|
11677
11701
|
const justifyLetter = justify && textAlign.includes("letter");
|
|
@@ -11684,8 +11708,8 @@ var LeaferUI = function(exports) {
|
|
|
11684
11708
|
remainingWidth = width - row.width - indentWidth;
|
|
11685
11709
|
if (justifyLetter) addLetterWidth = remainingWidth / (row.words.reduce((total, item) => total + item.data.length, 0) - 1); else addWordWidth = wordsLength > 1 ? remainingWidth / (wordsLength - 1) : 0;
|
|
11686
11710
|
}
|
|
11687
|
-
mode =
|
|
11688
|
-
if (row.isOverflow && !
|
|
11711
|
+
mode = __letterSpacing || row.isOverflow || justifyLetter ? CharMode : addWordWidth ? WordMode : TextMode;
|
|
11712
|
+
if (row.isOverflow && !__letterSpacing) row.textMode = true;
|
|
11689
11713
|
if (mode === TextMode) {
|
|
11690
11714
|
row.x += indentWidth;
|
|
11691
11715
|
toTextChar$1(row);
|
|
@@ -12075,6 +12099,7 @@ var LeaferUI = function(exports) {
|
|
|
12075
12099
|
exports.UIEvent = UIEvent;
|
|
12076
12100
|
exports.UIRender = UIRender;
|
|
12077
12101
|
exports.UnitConvert = UnitConvert;
|
|
12102
|
+
exports.UnitConvertHelper = UnitConvertHelper;
|
|
12078
12103
|
exports.WaitHelper = WaitHelper;
|
|
12079
12104
|
exports.WatchEvent = WatchEvent;
|
|
12080
12105
|
exports.Watcher = Watcher;
|
package/dist/worker.min.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var t,e=require("@leafer/core"),a=require("@leafer-ui/core"),n=require("@leafer-ui/draw");exports.PathNodeHandleType=void 0,(t=exports.PathNodeHandleType||(exports.PathNodeHandleType={}))[t.none=1]="none",t[t.free=2]="free",t[t.mirrorAngle=3]="mirrorAngle",t[t.mirror=4]="mirror";class i extends e.LeaferCanvasBase{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=e.Platform.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:a}=this;this.view.width=Math.ceil(t*a),this.view.height=Math.ceil(e*a),this.clientBounds=this.bounds}}e.canvasPatch(OffscreenCanvasRenderingContext2D.prototype),e.canvasPatch(Path2D.prototype);const{mineType:r}=e.FileHelper;function s(t,a){e.Platform.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,a)=>new Promise((n,i)=>{t.convertToBlob({type:r(e),quality:a}).then(t=>{var e=new FileReader;e.onload=t=>n(t.target.result),e.onerror=t=>i(t),e.readAsDataURL(t)}).catch(t=>{i(t)})}),canvasToBolb:(t,e,a)=>t.convertToBlob({type:r(e),quality:a}),canvasSaveAs:(t,e,a)=>new Promise(t=>t()),download(t,e){},loadImage:t=>new Promise((a,n)=>{let i=new XMLHttpRequest;i.open("GET",e.Platform.image.getRealURL(t),!0),i.responseType="blob",i.onload=()=>{createImageBitmap(i.response).then(t=>{a(t)}).catch(t=>{n(t)})},i.onerror=t=>n(t),i.send()})},e.Platform.canvas=e.Creator.canvas(),e.Platform.conicGradientSupport=!!e.Platform.canvas.context.createConicGradient}Object.assign(e.Creator,{canvas:(t,e)=>new i(t,e),image:t=>new e.LeaferImage(t)}),e.Platform.name="web",e.Platform.isWorker=!0,e.Platform.backgrounder=!0,e.Platform.requestRender=function(t){requestAnimationFrame(t)},e.defineKey(e.Platform,"devicePixelRatio",{get:()=>1});const{userAgent:o}=navigator;o.indexOf("Firefox")>-1?(e.Platform.conicGradientRotate90=!0,e.Platform.intWheelDeltaY=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(e.Platform.fullImageShadow=!0),o.indexOf("Windows")>-1?(e.Platform.os="Windows",e.Platform.intWheelDeltaY=!0):o.indexOf("Mac")>-1?e.Platform.os="Mac":o.indexOf("Linux")>-1&&(e.Platform.os="Linux");class l{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove&&this.config.usePartLayout){const t=new e.LeafList;return this.__updatedList.list.forEach(e=>{e.leafer&&t.add(e)}),t}return this.__updatedList}constructor(t,a){this.totalTimes=0,this.config={},this.__updatedList=new e.LeafList,this.target=t,a&&(this.config=e.DataHelper.default(a,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(e.RenderEvent.REQUEST)}__onAttrChange(t){this.config.usePartLayout&&this.__updatedList.add(t.target),this.update()}__onChildEvent(t){this.config.usePartLayout&&(t.type===e.ChildEvent.ADD?(this.hasAdd=!0,this.__pushChild(t.child)):(this.hasRemove=!0,this.__updatedList.add(t.parent))),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,a=e.length;t<a;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new e.WatchEvent(e.WatchEvent.DATA,{updatedList:this.updatedList})),this.__updatedList=new e.LeafList,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[e.PropertyEvent.CHANGE,this.__onAttrChange,this],[[e.ChildEvent.ADD,e.ChildEvent.REMOVE],this.__onChildEvent,this],[e.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:d,updateBounds:h,updateChange:c}=e.LeafHelper,{pushAllChildBranch:u,pushAllParent:f}=e.BranchHelper;const{worldBounds:g}=e.LeafBoundsHelper;class p{constructor(t){this.updatedBounds=new e.Bounds,this.beforeBounds=new e.Bounds,this.afterBounds=new e.Bounds,e.isArray(t)&&(t=new e.LeafList(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,g)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,g),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:_,updateAllChange:m}=e.LeafHelper,y=e.Debug.get("Layouter");class w{constructor(t,a){this.totalTimes=0,this.config={usePartLayout:!0},this.__levelList=new e.LeafLevelList,this.target=t,a&&(this.config=e.DataHelper.default(a,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(this.layouting||!this.running)return;const{target:t}=this;this.times=0;try{t.emit(e.LayoutEvent.START),this.layoutOnce(),t.emitEvent(new e.LayoutEvent(e.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(e.WatchEvent.REQUEST),this.totalTimes>1&&this.config.usePartLayout?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const a=e.Run.start("PartLayout"),{target:n,__updatedList:i}=this,{BEFORE:r,LAYOUT:s,AFTER:o}=e.LayoutEvent,l=this.getBlocks(i);l.forEach(t=>t.setBefore()),n.emitEvent(new e.LayoutEvent(r,l,this.times)),this.extraBlock=null,i.sort(),function(t,e){let a;t.list.forEach(t=>{a=t.__layout,e.without(t)&&!a.proxyZoom&&(a.matrixChanged?(d(t,!0),e.add(t),t.isBranch&&u(t,e),f(t,e)):a.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),f(t,e)))})}(i,this.__levelList),function(t){let e,a,n;t.sort(!0),t.levels.forEach(i=>{e=t.levelMap[i];for(let t=0,i=e.length;t<i;t++){if(a=e[t],a.isBranch&&a.__tempNumber){n=a.children;for(let t=0,e=n.length;t<e;t++)n[t].isBranch||h(n[t])}h(a)}})}(this.__levelList),function(t){t.list.forEach(c)}(i),this.extraBlock&&l.push(this.extraBlock),l.forEach(t=>t.setAfter()),n.emitEvent(new e.LayoutEvent(s,l,this.times)),n.emitEvent(new e.LayoutEvent(o,l,this.times)),this.addBlocks(l),this.__levelList.reset(),this.__updatedList=null,e.Run.end(a)}fullLayout(){const t=e.Run.start("FullLayout"),{target:a}=this,{BEFORE:n,LAYOUT:i,AFTER:r}=e.LayoutEvent,s=this.getBlocks(new e.LeafList(a));a.emitEvent(new e.LayoutEvent(n,s,this.times)),w.fullLayout(a),s.forEach(t=>{t.setAfter()}),a.emitEvent(new e.LayoutEvent(i,s,this.times)),a.emitEvent(new e.LayoutEvent(r,s,this.times)),this.addBlocks(s),e.Run.end(t)}static fullLayout(t){_(t,!0),t.isBranch?e.BranchHelper.updateBounds(t):e.LeafHelper.updateBounds(t),m(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:a}=this.extraBlock||(this.extraBlock=new p([]));e.length?a.add(t.__world):a.set(t.__world),e.add(t)}}createBlock(t){return new p(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_([[e.LayoutEvent.REQUEST,this.layout,this],[e.LayoutEvent.AGAIN,this.layoutAgain,this],[e.WatchEvent.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const v=e.Debug.get("Renderer");class x{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,a,n){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=a,n&&(this.config=e.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.requestTime||this.__requestRender()}requestLayout(){this.target.emit(e.LayoutEvent.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(e.RenderEvent.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(e.RenderEvent.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(e.RenderEvent.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:a}=this;this.times=0,this.totalBounds=new e.Bounds,v.log(a.innerName,"---\x3e");try{this.emitRender(e.RenderEvent.START),this.renderOnce(t),this.emitRender(e.RenderEvent.END,this.totalBounds),e.ImageManager.clearRecycled()}catch(t){this.rendering=!1,v.error(t)}v.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return v.warn("rendering");if(this.times>3)return v.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new e.Bounds,this.renderOptions={},t)this.emitRender(e.RenderEvent.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(e.RenderEvent.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(e.RenderEvent.RENDER,this.renderBounds,this.renderOptions),this.emitRender(e.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(t){const a=e.Run.start("PartRender"),{canvas:n}=this,i=t.getIntersect(n.bounds),r=new e.Bounds(i);n.save(),i.spread(x.clipSpread).ceil(),n.clearWorld(i),n.clipWorld(i),this.__render(i,r),n.restore(),e.Run.end(a)}fullRender(){const t=e.Run.start("FullRender"),{canvas:a}=this;a.save(),a.clear(),this.__render(a.bounds),a.restore(),e.Run.end(t)}__render(t,a){const{canvas:n,target:i}=this,r=t.includes(i.__world),s=r?{includes:r}:{bounds:t,includes:r};this.needFill&&n.fillWorld(t,this.config.fill),e.Debug.showRepaint&&e.Debug.drawRepaint(n,t),this.config.useCellRender&&(s.cellList=this.getCellList()),e.Platform.render(i,n,s),this.renderBounds=a=a||t,this.renderOptions=s,this.totalBounds.isEmpty()?this.totalBounds=a:this.totalBounds.add(a),n.updateRender(a)}getCellList(){}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const a=new e.Bounds;a.setList(t),t.length=0,t.push(a)}}__requestRender(){const t=this.target;if(this.requestTime||!t)return;if(t.parentApp)return t.parentApp.requestRender(!1);this.requestTime=this.frameTime||Date.now();const a=()=>{const t=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:n}=this.config;if(n&&t>n)return e.Platform.requestRender(a);const{frames:i}=this;i.length>30&&i.shift(),i.push(t),this.FPS=Math.round(i.reduce((t,e)=>t+e,0)/i.length),this.requestTime=0,this.checkRender()};e.Platform.requestRender(a)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:a,height:n}=t.old;if(!new e.Bounds(0,0,a,n).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new e.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||v.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(t,a,n){this.target.emitEvent(new e.RenderEvent(t,this.times,a,n))}__listenEvents(){this.__eventIds=[this.target.on_([[e.RenderEvent.REQUEST,this.update,this],[e.LayoutEvent.END,this.__onLayoutEnd,this],[e.RenderEvent.AGAIN,this.renderAgain,this],[e.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)}}x.clipSpread=10;const P={},{copyRadiusPoint:b}=e.PointHelper,{hitRadiusPoint:L}=e.BoundsHelper;class B{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,a,n){a||(a=0),n||(n={});const i=n.through||!1,r=n.ignoreHittable||!1,s=n.target||this.target;this.exclude=n.exclude||null,this.point={x:t.x,y:t.y,radiusX:a,radiusY:a},this.findList=new e.LeafList(n.findList),n.findList||this.hitBranch(s.isBranchLeaf?{children:[s]}:s);const{list:o}=this.findList,l=this.getBestMatchLeaf(o,n.bottomList,r,!!n.findList),d=r?this.getPath(l):this.getHitablePath(l);return this.clear(),i?{path:d,target:l,throughPath:o.length?this.getThroughPath(o):d}:{path:d,target:l}}hitPoint(t,e,a){return!!this.getByPoint(t,e,a).target}getBestMatchLeaf(t,a,n,i){const r=this.findList=new e.LeafList;if(t.length){let a;const{x:i,y:s}=this.point,o={x:i,y:s,radiusX:0,radiusY:0};for(let i=0,s=t.length;i<s;i++)if(a=t[i],(n||e.LeafHelper.worldHittable(a))&&(this.hitChild(a,o),r.length)){if(a.isBranchLeaf&&t.some(t=>t!==a&&e.LeafHelper.hasParent(t,a))){r.reset();break}return r.list[0]}}if(a)for(let t=0,e=a.length;t<e;t++)if(this.hitChild(a[t].target,this.point,a[t].proxy),r.length)return r.list[0];return i?null:n?t[0]:t.find(t=>e.LeafHelper.worldHittable(t))}getPath(t){const a=new e.LeafList,n=[],{target:i}=this;for(;t&&(t.syncEventer&&n.push(t.syncEventer),a.add(t),(t=t.parent)!==i););return n.length&&n.forEach(t=>{for(;t&&(t.__.hittable&&a.add(t),(t=t.parent)!==i););}),i&&a.add(i),a}getHitablePath(t){const a=this.getPath(t&&t.hittable?t:null);let n,i=new e.LeafList;for(let t=a.list.length-1;t>-1&&(n=a.list[t],n.__.hittable)&&(i.addAt(n,0),n.__.hitChildren&&(!n.isLeafer||"draw"!==n.mode));t--);return i}getThroughPath(t){const a=new e.LeafList,n=[];for(let e=t.length-1;e>-1;e--)n.push(this.getPath(t[e]));let i,r,s;for(let t=0,e=n.length;t<e;t++){i=n[t],r=n[t+1];for(let t=0,e=i.length;t<e&&(s=i.list[t],!r||!r.has(s));t++)a.add(s)}return a}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let a,n,i;const{point:r}=this;for(let s=t.length-1;s>-1;s--)if(a=t[s],i=a.__,i.visible&&(!e||i.mask))if(n=L(a.__world,i.hitRadius?b(P,r,i.hitRadius):r),a.isBranch){if(n||a.__ignoreHitWorld){if(a.isBranchLeaf&&i.__clipAfterFill&&!a.__hitWorld(r,!0))continue;a.topChildren&&this.eachFind(a.topChildren,!1),this.eachFind(a.children,a.__onlyHitMask),a.isBranchLeaf&&this.hitChild(a,r)}}else n&&this.hitChild(a,r)}hitChild(t,e,a){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:n}=t;if(n&&n.__hasMask&&!t.__.mask){let a,i=[];const{children:r}=n;for(let n=0,s=r.length;n<s;n++)if(a=r[n],a.__.mask&&i.push(a),a===t){if(i&&!i.every(t=>t.__hitWorld(e)))return;break}}this.findList.add(a||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class E{constructor(t,a){this.config={},a&&(this.config=e.DataHelper.default(a,this.config)),this.picker=new B(this.target=t,this),this.finder=e.Creator.finder&&e.Creator.finder()}getByPoint(t,a,n){const{target:i,picker:r}=this;return e.Platform.backgrounder&&i&&i.updateLayout(),r.getByPoint(t,a,n)}hitPoint(t,e,a){return this.picker.hitPoint(t,e,a)}getBy(t,a,n,i){return this.finder?this.finder.getBy(t,a,n,i):e.Plugin.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function S(t,e,a){t.__.__font?n.Paint.fillText(t,e,a):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function k(t,a,i,r,s){const o=i.__;e.isObject(t)?n.Paint.drawStrokesStyle(t,a,!1,i,r,s):(r.setStroke(t,o.__strokeWidth*a,o),r.stroke()),o.__useArrow&&n.Paint.strokeArrow(t,i,r,s)}function R(t,a,i,r,s){const o=i.__;e.isObject(t)?n.Paint.drawStrokesStyle(t,a,!0,i,r,s):(r.setStroke(t,o.__strokeWidth*a,o),n.Paint.drawTextStroke(i,r,s))}function C(t,a,i,r,s){const o=r.getSameCanvas(!0,!0);o.font=i.__.__font,R(t,2,i,o,s),o.blendMode="outside"===a?"destination-out":"destination-in",n.Paint.fillText(i,o,s),o.blendMode="normal",e.LeafHelper.copyCanvasByWorld(i,r,o),o.recycle(i.__nowWorld)}Object.assign(e.Creator,{watcher:(t,e)=>new l(t,e),layouter:(t,e)=>new w(t,e),renderer:(t,e,a)=>new x(t,e,a),selector:(t,e)=>new E(t,e)}),e.Platform.layout=w.fullLayout,e.Platform.render=function(t,a,n){const i=Object.assign(Object.assign({},n),{topRendering:!0});n.topList=new e.LeafList,t.__render(a,n),n.topList.length&&n.topList.forEach(t=>t.__render(a,i))};const{getSpread:A,copyAndSpread:T,toOuterOf:O,getOuterOf:M,getByMove:I,move:W,getIntersectData:D}=e.BoundsHelper,H={};let F;const{stintSet:j}=e.DataHelper,{hasTransparent:Y}=n.ColorConvert;function G(t,a,i){if(!e.isObject(a)||!1===a.visible||0===a.opacity)return;let r;const{boxBounds:s}=i.__layout;switch(a.type){case"image":if(!a.url)return;r=n.PaintImage.image(i,t,a,s,!F||!F[a.url]);break;case"linear":r=n.PaintGradient.linearGradient(a,s);break;case"radial":r=n.PaintGradient.radialGradient(a,s);break;case"angular":r=n.PaintGradient.conicGradient(a,s);break;case"solid":const{type:o,color:l,opacity:d}=a;r={type:o,style:n.ColorConvert.string(l,d)};break;default:e.isUndefined(a.r)||(r={type:"solid",style:n.ColorConvert.string(a)})}if(r&&(r.originPaint=a,e.isString(r.style)&&Y(r.style)&&(r.isTransparent=!0),a.style)){if(0===a.style.strokeWidth)return;r.strokeStyle=a.style}return r}const X={compute:function(t,a){const i=a.__,r=[];let s,o,l,d=i.__input[t];e.isArray(d)||(d=[d]),F=n.PaintImage.recycleImage(t,i);for(let e,n=0,i=d.length;n<i;n++)(e=G(t,d[n],a))&&(r.push(e),e.strokeStyle&&(l||(l=1),e.strokeStyle.strokeWidth&&(l=Math.max(l,e.strokeStyle.strokeWidth))));i["_"+t]=r.length?r:void 0,r.length?(r.every(t=>t.isTransparent)&&(r.some(t=>t.image)&&(s=!0),o=!0),"fill"===t?(j(i,"__isAlphaPixelFill",s),j(i,"__isTransparentFill",o)):(j(i,"__isAlphaPixelStroke",s),j(i,"__isTransparentStroke",o),j(i,"__hasMultiStrokeStyle",l))):i.__removePaint(t,!1)},fill:function(t,e,a,n){a.fillStyle=t,S(e,a,n)},fills:function(t,e,a,i){let r,s,o;for(let l=0,d=t.length;l<d;l++){if(r=t[l],s=r.originPaint,r.image){if(o?o++:o=1,n.PaintImage.checkImage(r,!e.__.__font,e,a,i))continue;if(!r.style){1===o&&r.image.isPlacehold&&e.drawImagePlaceholder(r,a,i);continue}}if(a.fillStyle=r.style,r.transform||s.scaleFixed){if(a.save(),r.transform&&a.transform(r.transform),s.scaleFixed){const{scaleX:t,scaleY:n}=e.getRenderScaleData(!0);(!0===s.scaleFixed||"zoom-in"===s.scaleFixed&&t>1&&n>1)&&a.scale(1/t,1/n)}s.blendMode&&(a.blendMode=s.blendMode),S(e,a,i),a.restore()}else s.blendMode?(a.saveBlendMode(s.blendMode),S(e,a,i),a.restoreBlendMode()):S(e,a,i)}},fillPathOrText:S,fillText:function(t,e,a){const n=t.__,{rows:i,decorationY:r}=n.__textDrawData;let s;n.__isPlacehold&&n.placeholderColor&&(e.fillStyle=n.placeholderColor);for(let t=0,a=i.length;t<a;t++)s=i[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(r){const{decorationColor:t,decorationHeight:a}=n.__textDrawData;t&&(e.fillStyle=t),i.forEach(t=>r.forEach(n=>e.fillRect(t.x,t.y+n,t.width,a)))}},stroke:function(t,a,i,r){const s=a.__;if(s.__strokeWidth)if(s.__font)n.Paint.strokeText(t,a,i,r);else switch(s.strokeAlign){case"center":k(t,1,a,i,r);break;case"inside":!function(t,e,a,n){a.save(),a.clipUI(e),k(t,2,e,a,n),a.restore()}(t,a,i,r);break;case"outside":!function(t,a,n,i){const r=a.__;if(r.__fillAfterStroke)k(t,2,a,n,i);else{const{renderBounds:s}=a.__layout,o=n.getSameCanvas(!0,!0);a.__drawRenderPath(o),k(t,2,a,o,i),o.clipUI(r),o.clearWorld(s),e.LeafHelper.copyCanvasByWorld(a,n,o),o.recycle(a.__nowWorld)}}(t,a,i,r)}},strokes:function(t,e,a,i){n.Paint.stroke(t,e,a,i)},strokeText:function(t,e,a,n){switch(e.__.strokeAlign){case"center":R(t,1,e,a,n);break;case"inside":C(t,"inside",e,a,n);break;case"outside":e.__.__fillAfterStroke?R(t,2,e,a,n):C(t,"outside",e,a,n)}},drawTextStroke:function(t,e,a){let n,i=t.__.__textDrawData;const{rows:r,decorationY:s}=i;for(let t=0,a=r.length;t<a;t++)n=r[t],n.text?e.strokeText(n.text,n.x,n.y):n.data&&n.data.forEach(t=>{e.strokeText(t.char,t.x,n.y)});if(s){const{decorationHeight:t}=i;r.forEach(a=>s.forEach(n=>e.strokeRect(a.x,a.y+n,a.width,t)))}},drawStrokesStyle:function(t,e,a,i,r,s){let o;const l=i.__,{__hasMultiStrokeStyle:d}=l;d||r.setStroke(void 0,l.__strokeWidth*e,l);for(let h=0,c=t.length;h<c;h++)if(o=t[h],(!o.image||!n.PaintImage.checkImage(o,!1,i,r,s))&&o.style){if(d){const{strokeStyle:t}=o;t?r.setStroke(o.style,l.__getRealStrokeWidth(t)*e,l,t):r.setStroke(o.style,l.__strokeWidth*e,l)}else r.strokeStyle=o.style;o.originPaint.blendMode?(r.saveBlendMode(o.originPaint.blendMode),a?n.Paint.drawTextStroke(i,r,s):r.stroke(),r.restoreBlendMode()):a?n.Paint.drawTextStroke(i,r,s):r.stroke()}},shape:function(t,a,n){const i=a.getSameCanvas(),r=a.bounds,s=t.__nowWorld,o=t.__layout,l=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let d,h,c,u,f,g;O(o.strokeSpread?(T(H,o.boxBounds,o.strokeSpread),H):o.boxBounds,s,l);let{scaleX:p,scaleY:_}=t.getRenderScaleData(!0);if(r.includes(l))g=i,d=f=l,h=s;else{let i;if(e.Platform.fullImageShadow)i=l;else{const t=o.renderShapeSpread?A(r,e.FourNumberHelper.swapAndScale(o.renderShapeSpread,p,_)):r;i=D(t,l)}u=r.getFitMatrix(i);let{a:m,d:y}=u;u.a<1&&(g=a.getSameCanvas(),t.__renderShape(g,n),p*=m,_*=y),f=M(l,u),d=I(f,-u.e,-u.f),h=M(s,u),W(h,-u.e,-u.f);const w=n.matrix;w?(c=new e.Matrix(u),c.multiply(w),m*=w.scaleX,y*=w.scaleY):c=u,c.withScale(m,y),n=Object.assign(Object.assign({},n),{matrix:c})}return t.__renderShape(i,n),{canvas:i,matrix:c,fitMatrix:u,bounds:d,renderBounds:h,worldCanvas:g,shapeBounds:f,scaleX:p,scaleY:_}}};let U,q=new e.Bounds;const{isSame:z}=e.BoundsHelper;function N(t,e,a,i,r,s){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=i.width/e.pixelRatio,e.__naturalHeight=i.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return r.data||n.PaintImage.createData(r,i,a,s),!0}function V(t,a){K(t,e.ImageEvent.LOAD,a)}function Q(t,a){K(t,e.ImageEvent.LOADED,a)}function Z(t,a,n){a.error=n,t.forceUpdate("surface"),K(t,e.ImageEvent.ERROR,a)}function K(t,a,n){t.hasEvent(a)&&t.emitEvent(new e.ImageEvent(a,n))}function $(t,e){const{leafer:a}=t;a&&a.viewReady&&(a.renderer.ignore=e)}const{get:J,translate:tt}=e.MatrixHelper,et=new e.Bounds,at={},nt={};function it(t,a,n,i){const r=e.isString(t)||i?(i?n-i*a:n%a)/((i||Math.floor(n/a))-1):t;return"auto"===t&&r<0?0:r}let rt={},st=e.getMatrixData();const{get:ot,set:lt,rotateOfOuter:dt,translate:ht,scaleOfOuter:ct,multiplyParent:ut,scale:ft,rotate:gt,skew:pt}=e.MatrixHelper;function _t(t,e,a,n,i,r,s,o){s&>(t,s),o&&pt(t,o.x,o.y),i&&ft(t,i,r),ht(t,e.x+a,e.y+n)}function mt(t,e,a,n){return new(a||(a=Promise))(function(i,r){function s(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof a?e:new a(function(t){t(e)})).then(s,o)}l((n=n.apply(t,e||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const{get:yt,scale:wt,copy:vt}=e.MatrixHelper,{getFloorScale:xt}=e.MathHelper,{abs:Pt}=Math;const bt={image:function(t,a,n,i,r){let s,o;const l=e.ImageManager.get(n);return U&&n===U.paint&&z(i,U.boxBounds)?s=U.leafPaint:(s={type:n.type,image:l},l.hasAlphaPixel&&(s.isTransparent=!0),U=l.use>1?{leafPaint:s,paint:n,boxBounds:q.set(i)}:null),(r||l.loading)&&(o={image:l,attrName:a,attrValue:n}),l.ready?(N(t,a,n,l,s,i),r&&(V(t,o),Q(t,o))):l.error?r&&Z(t,o,l.error):(r&&($(t,!0),V(t,o)),s.loadId=l.load(()=>{$(t,!1),t.destroyed||(N(t,a,n,l,s,i)&&(l.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),Q(t,o)),s.loadId=void 0},e=>{$(t,!1),Z(t,o,e),s.loadId=void 0},n.lod&&l.getThumbSize()),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{l.ready||(l.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):l.isPlacehold=!0)),s},checkImage:function(t,a,i,r,s){const{scaleX:o,scaleY:l}=n.PaintImage.getImageRenderScaleData(t,i,r,s),{image:d,data:h,originPaint:c}=t,{exporting:u}=s;return!(!h||t.patternId===o+"-"+l&&!u)&&(a&&(h.repeat?a=!1:c.changeful||"miniapp"===e.Platform.name&&e.ResizeEvent.isResizing(i)||u||(a=e.Platform.image.isLarge(d,o,l)||d.width*o>8096||d.height*l>8096)),a?(i.__.__isFastShadow&&(r.fillStyle=t.style||"#000",r.fill()),n.PaintImage.drawImage(t,o,l,i,r,s),!0):(!t.style||c.sync||u?n.PaintImage.createPattern(t,i,r,s):n.PaintImage.createPatternTask(t,i,r,s),!1))},drawImage:function(t,e,a,n,i,r){const{data:s,image:o}=t,{blendMode:l}=t.originPaint,{opacity:d,transform:h}=s,c=o.getFull(s.filters),u=n.__;let f,{width:g,height:p}=o;(f=h&&!h.onlyScale||u.path||u.cornerRadius)||d||l?(i.save(),f&&i.clipUI(n),l&&(i.blendMode=l),d&&(i.opacity*=d),h&&i.transform(h),i.drawImage(c,0,0,g,p),i.restore()):(s.scaleX&&(g*=s.scaleX,p*=s.scaleY),i.drawImage(c,0,0,g,p))},getImageRenderScaleData:function(t,e,a,n){const i=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:r}=t;if(a){const{pixelRatio:t}=a;i.scaleX*=t,i.scaleY*=t}return r&&r.scaleX&&(i.scaleX*=Math.abs(r.scaleX),i.scaleY*=Math.abs(r.scaleY)),i},recycleImage:function(t,a){const n=a["_"+t];if(e.isArray(n)){let i,r,s,o,l;for(let d=0,h=n.length;d<h;d++)i=n[d],r=i.image,l=r&&r.url,l&&(s||(s={}),s[l]=!0,e.ImageManager.recyclePaint(i),r.loading&&(o||(o=a.__input&&a.__input[t]||[],e.isArray(o)||(o=[o])),r.unload(n[d].loadId,!o.some(t=>t.url===l))));return s}return null},createPatternTask:function(t,a,i,r){t.patternTask||(t.patternTask=e.ImageManager.patternTasker.add(()=>mt(this,void 0,void 0,function*(){n.PaintImage.createPattern(t,a,i,r),a.forceUpdate("surface")}),0,()=>(t.patternTask=null,i.bounds.hit(a.__nowWorld))))},createPattern:function(t,a,i,r){let{scaleX:s,scaleY:o}=n.PaintImage.getImageRenderScaleData(t,a,i,r),l=s+"-"+o;if(t.patternId!==l&&!a.destroyed&&(!e.Platform.image.isLarge(t.image,s,o)||t.data.repeat)){const{image:i,data:r}=t,{transform:d,gap:h}=r,c=n.PaintImage.getPatternFixScale(t,s,o);let u,f,g,{width:p,height:_}=i;c&&(s*=c,o*=c),p*=s,_*=o,h&&(f=h.x*s/Pt(r.scaleX||1),g=h.y*o/Pt(r.scaleY||1)),(d||1!==s||1!==o)&&(s*=xt(p+(f||0)),o*=xt(_+(g||0)),u=yt(),d&&vt(u,d),wt(u,1/s,1/o));const m=i.getCanvas(p,_,r.opacity,r.filters,f,g,a.leafer&&a.leafer.config.smooth),y=i.getPattern(m,r.repeat||e.Platform.origin.noRepeat||"no-repeat",u,t);t.style=y,t.patternId=l}},getPatternFixScale:function(t,a,n){const{image:i}=t;let r,s=e.Platform.image.maxPatternSize,o=i.width*i.height;return i.isSVG?a>1&&(r=Math.ceil(a)/a):s>o&&(s=o),(o*=a*n)>s&&(r=Math.sqrt(s/o)),r},createData:function(t,e,a,i){t.data=n.PaintImage.getPatternData(a,i,e)},getPatternData:function(t,a,i){t.padding&&(a=et.set(a).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:r,height:s}=i,{opacity:o,mode:l,align:d,offset:h,scale:c,size:u,rotation:f,skew:g,clipSize:p,repeat:_,gap:m,filters:y}=t,w=a.width===r&&a.height===s,v={mode:l},x="center"!==d&&(f||0)%180==90;let P,b;switch(e.BoundsHelper.set(nt,0,0,x?s:r,x?r:s),l&&"cover"!==l&&"fit"!==l?((c||u)&&(e.MathHelper.getScaleData(c,u,i,at),P=at.scaleX,b=at.scaleY),(d||m||_)&&(P&&e.BoundsHelper.scale(nt,P,b,!0),d&&e.AlignHelper.toPoint(d,nt,a,nt,!0,!0))):w&&!f||(P=b=e.BoundsHelper.getFitScale(a,nt,"fit"!==l),e.BoundsHelper.put(a,i,d,P,!1,nt),e.BoundsHelper.scale(nt,P,b,!0)),h&&e.PointHelper.move(nt,h),l){case"stretch":w?P&&(P=b=void 0):(P=a.width/r,b=a.height/s,n.PaintImage.stretchMode(v,a,P,b));break;case"normal":case"clip":if(nt.x||nt.y||P||p||f||g){let t,e;p&&(t=a.width/p.width,e=a.height/p.height),n.PaintImage.clipMode(v,a,nt.x,nt.y,P,b,f,g,t,e),t&&(P=P?P*t:t,b=b?b*e:e)}break;case"repeat":(!w||P||f||g)&&n.PaintImage.repeatMode(v,a,r,s,nt.x,nt.y,P,b,f,g,d,t.freeTransform),_||(v.repeat="repeat");const i=e.isObject(_);(m||i)&&(v.gap=function(t,a,n,i,r){let s,o;e.isObject(t)?(s=t.x,o=t.y):s=o=t;return{x:it(s,n,r.width,a&&a.x),y:it(o,i,r.height,a&&a.y)}}(m,i&&_,nt.width,nt.height,a));break;default:P&&n.PaintImage.fillOrFitMode(v,a,nt.x,nt.y,P,b,f)}return v.transform||(a.x||a.y)&&tt(v.transform=J(),a.x,a.y),P&&(v.scaleX=P,v.scaleY=b),o&&o<1&&(v.opacity=o),y&&(v.filters=y),_&&(v.repeat=e.isString(_)?"x"===_?"repeat-x":"repeat-y":"repeat"),v},stretchMode:function(t,e,a,n){const i=ot(),{x:r,y:s}=e;r||s?ht(i,r,s):i.onlyScale=!0,ft(i,a,n),t.transform=i},fillOrFitMode:function(t,e,a,n,i,r,s){const o=ot();ht(o,e.x+a,e.y+n),ft(o,i,r),s&&dt(o,{x:e.x+e.width/2,y:e.y+e.height/2},s),t.transform=o},clipMode:function(t,e,a,n,i,r,s,o,l,d){const h=ot();_t(h,e,a,n,i,r,s,o),l&&(s||o?(lt(st),ct(st,e,l,d),ut(h,st)):ct(h,e,l,d)),t.transform=h},repeatMode:function(t,e,a,n,i,r,s,o,l,d,h,c){const u=ot();if(c)_t(u,e,i,r,s,o,l,d);else{if(l)if("center"===h)dt(u,{x:a/2,y:n/2},l);else switch(gt(u,l),l){case 90:ht(u,n,0);break;case 180:ht(u,a,n);break;case 270:ht(u,0,a)}rt.x=e.x+i,rt.y=e.y+r,ht(u,rt.x,rt.y),s&&ct(u,rt,s,o)}t.transform=u}},{toPoint:Lt}=e.AroundHelper,{hasTransparent:Bt}=n.ColorConvert,Et={},St={};function kt(t,a,i,r){if(i){let s,o,l,d;for(let t=0,h=i.length;t<h;t++)s=i[t],e.isString(s)?(l=t/(h-1),o=n.ColorConvert.string(s,r)):(l=s.offset,o=n.ColorConvert.string(s.color,r)),a.addColorStop(l,o),!d&&Bt(o)&&(d=!0);d&&(t.isTransparent=!0)}}const{getAngle:Rt,getDistance:Ct}=e.PointHelper,{get:At,rotateOfOuter:Tt,scaleOfOuter:Ot}=e.MatrixHelper,{toPoint:Mt}=e.AroundHelper,It={},Wt={};function Dt(t,e,a,n,i){let r;const{width:s,height:o}=t;if(s!==o||n){const t=Rt(e,a);r=At(),i?(Ot(r,e,s/o*(n||1),1),Tt(r,e,t+90)):(Ot(r,e,1,s/o*(n||1)),Tt(r,e,t))}return r}const{getDistance:Ht}=e.PointHelper,{toPoint:Ft}=e.AroundHelper,jt={},Yt={};const Gt={linearGradient:function(t,a){let{from:n,to:i,type:r,opacity:s}=t;Lt(n||"top",a,Et),Lt(i||"bottom",a,St);const o=e.Platform.canvas.createLinearGradient(Et.x,Et.y,St.x,St.y),l={type:r,style:o};return kt(l,o,t.stops,s),l},radialGradient:function(t,a){let{from:n,to:i,type:r,opacity:s,stretch:o}=t;Mt(n||"center",a,It),Mt(i||"bottom",a,Wt);const l=e.Platform.canvas.createRadialGradient(It.x,It.y,0,It.x,It.y,Ct(It,Wt)),d={type:r,style:l};kt(d,l,t.stops,s);const h=Dt(a,It,Wt,o,!0);return h&&(d.transform=h),d},conicGradient:function(t,a){let{from:n,to:i,type:r,opacity:s,stretch:o}=t;Ft(n||"center",a,jt),Ft(i||"bottom",a,Yt);const l=e.Platform.conicGradientSupport?e.Platform.canvas.createConicGradient(0,jt.x,jt.y):e.Platform.canvas.createRadialGradient(jt.x,jt.y,0,jt.x,jt.y,Ht(jt,Yt)),d={type:r,style:l};kt(d,l,t.stops,s);const h=Dt(a,jt,Yt,o||1,e.Platform.conicGradientRotate90);return h&&(d.transform=h),d},getTransform:Dt},{copy:Xt,move:Ut,toOffsetOutBounds:qt}=e.BoundsHelper,{max:zt,abs:Nt}=Math,Vt={},Qt=new e.Matrix,Zt={};function Kt(t,e){let a,n,i,r,s=0,o=0,l=0,d=0;return e.forEach(t=>{a=t.x||0,n=t.y||0,r=1.5*(t.blur||0),i=Nt(t.spread||0),s=zt(s,i+r-n),o=zt(o,i+r+a),l=zt(l,i+r+n),d=zt(d,i+r-a)}),s===o&&o===l&&l===d?s:[s,o,l,d]}function $t(t,a,n){const{shapeBounds:i}=n;let r,s;e.Platform.fullImageShadow?(Xt(Vt,t.bounds),Ut(Vt,a.x-i.x,a.y-i.y),r=t.bounds,s=Vt):(r=i,s=a),t.copyWorld(n.canvas,r,s)}const{toOffsetOutBounds:Jt}=e.BoundsHelper,te={};const ee=Kt;const ae={shadow:function(t,a,i){let r,s;const{__nowWorld:o}=t,{shadow:l}=t.__,{worldCanvas:d,bounds:h,renderBounds:c,shapeBounds:u,scaleX:f,scaleY:g}=i,p=a.getSameCanvas(),_=l.length-1;qt(h,Zt,c),l.forEach((l,m)=>{let y=1;if(l.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(y=1/t)}p.setWorldShadow(Zt.offsetX+(l.x||0)*f*y,Zt.offsetY+(l.y||0)*g*y,(l.blur||0)*f*y,n.ColorConvert.string(l.color)),s=n.Effect.getShadowTransform(t,p,i,l,Zt,y),s&&p.setTransform(s),$t(p,Zt,i),s&&p.resetTransform(),r=c,l.box&&(p.restore(),p.save(),d&&(p.copyWorld(p,c,o,"copy"),r=o),d?p.copyWorld(d,o,o,"destination-out"):p.copyWorld(i.canvas,u,h,"destination-out")),e.LeafHelper.copyCanvasByWorld(t,a,p,r,l.blendMode),_&&m<_&&p.clearWorld(r)}),p.recycle(r)},innerShadow:function(t,a,i){let r,s;const{__nowWorld:o}=t,{innerShadow:l}=t.__,{worldCanvas:d,bounds:h,renderBounds:c,shapeBounds:u,scaleX:f,scaleY:g}=i,p=a.getSameCanvas(),_=l.length-1;Jt(h,te,c),l.forEach((l,m)=>{let y=1;if(l.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(y=1/t)}p.save(),p.setWorldShadow(te.offsetX+(l.x||0)*f*y,te.offsetY+(l.y||0)*g*y,(l.blur||0)*f*y),s=n.Effect.getShadowTransform(t,p,i,l,te,y,!0),s&&p.setTransform(s),$t(p,te,i),p.restore(),d?(p.copyWorld(p,c,o,"copy"),p.copyWorld(d,o,o,"source-out"),r=o):(p.copyWorld(i.canvas,u,h,"source-out"),r=c),p.fillWorld(r,n.ColorConvert.string(l.color),"source-in"),e.LeafHelper.copyCanvasByWorld(t,a,p,r,l.blendMode),_&&m<_&&p.clearWorld(r)}),p.recycle(r)},blur:function(t,e,a){const{blur:n}=t.__;a.setWorldBlur(n*t.__nowWorld.a),a.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),a.filter="none"},backgroundBlur:function(t,e,a){},getShadowRenderSpread:Kt,getShadowTransform:function(t,e,a,n,i,r,s){if(n.spread){const a=2*n.spread*r*(s?-1:1),{width:o,height:l}=t.__layout.strokeBounds;return Qt.set().scaleOfOuter({x:(i.x+i.width/2)*e.pixelRatio,y:(i.y+i.height/2)*e.pixelRatio},1+a/o,1+a/l),Qt}},isTransformShadow(t){},getInnerShadowSpread:ee},{excludeRenderBounds:ne}=e.LeafBoundsHelper;let ie;function re(t,e,a,n,i,r,s,o){switch(e){case"grayscale":ie||(ie=!0,i.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,a,n,i,r){const s=t.__nowWorld;a.resetTransform(),a.opacity=1,a.useMask(n,s),r&&n.recycle(s);oe(t,e,a,1,i,r)}(t,a,n,i,s,o);break;case"opacity-path":oe(t,a,n,r,s,o);break;case"path":o&&a.restore()}}function se(t){return t.getSameCanvas(!1,!0)}function oe(t,e,a,n,i,r){const s=t.__nowWorld;e.resetTransform(),e.opacity=n,e.copyWorld(a,s,void 0,i),r?a.recycle(s):a.clearWorld(s)}n.Group.prototype.__renderMask=function(t,e){let a,n,i,r,s,o;const{children:l}=this;for(let d=0,h=l.length;d<h;d++){if(a=l[d],o=a.__.mask,o){s&&(re(this,s,t,i,n,r,void 0,!0),n=i=null),"clipping"!==o&&"clipping-path"!==o||ne(a,e)||a.__render(t,e),r=a.__.opacity,ie=!1,"path"===o||"clipping-path"===o?(r<1?(s="opacity-path",i||(i=se(t))):(s="path",t.save()),a.__clip(i||t,e)):(s="grayscale"===o?"grayscale":"alpha",n||(n=se(t)),i||(i=se(t)),a.__render(n,e));continue}const h=1===r&&a.__.__blendMode;h&&re(this,s,t,i,n,r,void 0,!1),ne(a,e)||a.__render(i||t,e),h&&re(this,s,t,i,n,r,h,!1)}re(this,s,t,i,n,r,void 0,!0)};const le=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",de=le+"_#~&*+\\=|≮≯≈≠=…",he=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 ce(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const ue=ce("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),fe=ce("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),ge=ce(le),pe=ce(de),_e=ce("- —/~|┆·");var me;!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"}(me||(me={}));const{Letter:ye,Single:we,Before:ve,After:xe,Symbol:Pe,Break:be}=me;function Le(t){return ue[t]?ye:_e[t]?be:fe[t]?ve:ge[t]?xe:pe[t]?Pe:he.test(t)?we:ye}const Be={trimRight(t){const{words:e}=t;let a,n=0,i=e.length;for(let r=i-1;r>-1&&(a=e[r].data[0]," "===a.char);r--)n++,t.width-=a.width;n&&e.splice(i-n,n)}};function Ee(t,e,a){switch(e){case"title":return a?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:Se}=Be,{Letter:ke,Single:Re,Before:Ce,After:Ae,Symbol:Te,Break:Oe}=me;let Me,Ie,We,De,He,Fe,je,Ye,Ge,Xe,Ue,qe,ze,Ne,Ve,Qe,Ze,Ke=[];function $e(t,e){Ge&&!Ye&&(Ye=Ge),Me.data.push({char:t,width:e}),We+=e}function Je(){De+=We,Me.width=We,Ie.words.push(Me),Me={data:[]},We=0}function ta(){Ne&&(Ve.paraNumber++,Ie.paraStart=!0,Ne=!1),Ge&&(Ie.startCharSize=Ye,Ie.endCharSize=Ge,Ye=0),Ie.width=De,Qe.width?Se(Ie):Ze&&ea(),Ke.push(Ie),Ie={words:[]},De=0}function ea(){De>(Ve.maxWidth||0)&&(Ve.maxWidth=De)}const{top:aa,right:na,bottom:ia,left:ra}=e.Direction4;function sa(t,e,a){const{bounds:n,rows:i}=t;n[e]+=a;for(let t=0;t<i.length;t++)i[t][e]+=a}const oa={getDrawData:function(t,a){e.isString(t)||(t=String(t));let i=0,r=0,s=a.__getInput("width")||0,o=a.__getInput("height")||0;const{__padding:l}=a;l&&(s?(i=l[ra],s-=l[na]+l[ra],!s&&(s=.01)):a.autoSizeAlign||(i=l[ra]),o?(r=l[aa],o-=l[aa]+l[ia],!o&&(o=.01)):a.autoSizeAlign||(r=l[aa]));const d={bounds:{x:i,y:r,width:s,height:o},rows:[],paraNumber:0,font:e.Platform.canvas.font=a.__font};return function(t,a,n){Ve=t,Ke=t.rows,Qe=t.bounds,Ze=!Qe.width&&!n.autoSizeAlign;const{__letterSpacing:i,paraIndent:r,textCase:s}=n,{canvas:o}=e.Platform,{width:l}=Qe;if(n.__isCharMode){const t="none"!==n.textWrap,e="break"===n.textWrap;Ne=!0,Ue=null,Ye=je=Ge=We=De=0,Me={data:[]},Ie={words:[]},i&&(a=[...a]);for(let n=0,d=a.length;n<d;n++)Fe=a[n],"\n"===Fe?(We&&Je(),Ie.paraEnd=!0,ta(),Ne=!0):(Xe=Le(Fe),Xe===ke&&"none"!==s&&(Fe=Ee(Fe,s,!We)),je=o.measureText(Fe).width,i&&(i<0&&(Ge=je),je+=i),qe=Xe===Re&&(Ue===Re||Ue===ke)||Ue===Re&&Xe!==Ae,ze=!(Xe!==Ce&&Xe!==Re||Ue!==Te&&Ue!==Ae),He=Ne&&r?l-r:l,t&&l&&De+We+je>He&&(e?(We&&Je(),De&&ta()):(ze||(ze=Xe===ke&&Ue==Ae),qe||ze||Xe===Oe||Xe===Ce||Xe===Re||We+je>He?(We&&Je(),De&&ta()):De&&ta()))," "===Fe&&!0!==Ne&&De+We===0||(Xe===Oe?(" "===Fe&&We&&Je(),$e(Fe,je),Je()):qe||ze?(We&&Je(),$e(Fe,je)):$e(Fe,je)),Ue=Xe);We&&Je(),De&&ta(),Ke.length>0&&(Ke[Ke.length-1].paraEnd=!0)}else a.split("\n").forEach(t=>{Ve.paraNumber++,De=o.measureText(t).width,Ke.push({x:r||0,text:t,width:De,paraStart:!0}),Ze&&ea()})}(d,t,a),l&&function(t,e,a,n,i){if(!n&&a.autoSizeAlign)switch(a.textAlign){case"left":sa(e,"x",t[ra]);break;case"right":sa(e,"x",-t[na])}if(!i&&a.autoSizeAlign)switch(a.verticalAlign){case"top":sa(e,"y",t[aa]);break;case"bottom":sa(e,"y",-t[ia])}}(l,d,a,s,o),function(t,e){const{rows:a,bounds:n}=t,i=a.length,{__lineHeight:r,__baseLine:s,__letterSpacing:o,__clipText:l,textAlign:d,verticalAlign:h,paraSpacing:c,autoSizeAlign:u}=e;let{x:f,y:g,width:p,height:_}=n,m=r*i+(c?c*(t.paraNumber-1):0),y=s;if(l&&m>_)m=Math.max(_,r),i>1&&(t.overflow=i);else if(_||u)switch(h){case"middle":g+=(_-m)/2;break;case"bottom":g+=_-m}y+=g;let w,v,x,P=p||u?p:t.maxWidth;for(let s=0,h=i;s<h;s++){if(w=a[s],w.x=f,w.width<p||w.width>p&&!l)switch(d){case"center":w.x+=(P-w.width)/2;break;case"right":w.x+=P-w.width}w.paraStart&&c&&s>0&&(y+=c),w.y=y,y+=r,t.overflow>s&&y>m&&(w.isOverflow=!0,t.overflow=s+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=a.length))}n.y=g,n.height=m}(d,a),a.__isCharMode&&function(t,e,a){const{rows:n}=t,{textAlign:i,paraIndent:r,letterSpacing:s}=e,o=a&&i.includes("both"),l=o||a&&i.includes("justify"),d=l&&i.includes("letter");let h,c,u,f,g,p,_,m,y,w;n.forEach(t=>{t.words&&(g=r&&t.paraStart?r:0,m=t.words.length,l&&(w=!t.paraEnd||o,c=a-t.width-g,d?f=c/(t.words.reduce((t,e)=>t+e.data.length,0)-1):u=m>1?c/(m-1):0),p=s||t.isOverflow||d?0:u?1:2,t.isOverflow&&!s&&(t.textMode=!0),2===p?(t.x+=g,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=g,h=t.x,t.data=[],t.words.forEach((e,a)=>{1===p?(_={char:"",x:h},h=function(t,e,a){return t.forEach(t=>{a.char+=t.char,e+=t.width}),e}(e.data,h,_),(t.isOverflow||" "!==_.char)&&t.data.push(_)):h=function(t,e,a,n,i){return t.forEach(t=>{(n||" "!==t.char)&&(t.x=e,a.push(t)),e+=t.width,i&&(e+=i)}),e}(e.data,h,t.data,t.isOverflow,w&&f),w&&(y=a===m-1,u?y||(h+=u,t.width+=u):f&&(t.width+=f*(e.data.length-(y?1:0))))})),t.words=null)})}(d,a,s),d.overflow&&function(t,a,n,i){if(!i)return;const{rows:r,overflow:s}=t;let{textOverflow:o}=a;if(r.splice(s),o&&"show"!==o){let t,l;"hide"===o?o="":"ellipsis"===o&&(o="...");const d=o?e.Platform.canvas.measureText(o).width:0,h=n+i-d;("none"===a.textWrap?r:[r[s-1]]).forEach(e=>{if(e.isOverflow&&e.data){let a=e.data.length-1;for(let n=a;n>-1&&(t=e.data[n],l=t.x+t.width,!(n===a&&l<h));n--){if(l<h&&" "!==t.char||!n){e.data.splice(n+1),e.width-=t.width;break}e.width-=t.width}e.width+=d,e.data.push({char:o,x:l}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(d,a,i,s),"none"!==a.textDecoration&&function(t,a){let i,r=0;const{fontSize:s,textDecoration:o}=a;switch(t.decorationHeight=s/11,e.isObject(o)?(i=o.type,o.color&&(t.decorationColor=n.ColorConvert.string(o.color)),o.offset&&(r=Math.min(.3*s,Math.max(o.offset,.15*-s)))):i=o,i){case"under":t.decorationY=[.15*s+r];break;case"delete":t.decorationY=[.35*-s];break;case"under-delete":t.decorationY=[.15*s+r,.35*-s]}}(d,a),d}};const la={string:function(t,a){if(!t)return"#000";const i=e.isNumber(a)&&a<1;if(e.isString(t)){if(!i||!n.ColorConvert.object)return t;t=n.ColorConvert.object(t)}let r=e.isUndefined(t.a)?1:t.a;i&&(r*=a);const s=t.r+","+t.g+","+t.b;return 1===r?"rgb("+s+")":"rgba("+s+","+r+")"}};Object.assign(n.TextConvert,oa),Object.assign(n.ColorConvert,la),Object.assign(n.Paint,X),Object.assign(n.PaintImage,bt),Object.assign(n.PaintGradient,Gt),Object.assign(n.Effect,ae),Object.assign(e.Creator,{interaction:(t,e,n,i)=>new a.InteractionBase(t,e,n,i),hitCanvas:(t,e)=>new i(t,e),hitCanvasManager:()=>new a.HitCanvasManager}),s(),Object.defineProperty(exports,"LeaferImage",{enumerable:!0,get:function(){return e.LeaferImage}}),exports.Layouter=w,exports.LeaferCanvas=i,exports.Picker=B,exports.Renderer=x,exports.Selector=E,exports.Watcher=l,exports.useCanvas=s,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]}})}),Object.keys(a).forEach(function(t){"default"===t||Object.prototype.hasOwnProperty.call(exports,t)||Object.defineProperty(exports,t,{enumerable:!0,get:function(){return a[t]}})});
|
|
1
|
+
"use strict";var t,e=require("@leafer/core"),a=require("@leafer-ui/core"),n=require("@leafer-ui/draw");exports.PathNodeHandleType=void 0,(t=exports.PathNodeHandleType||(exports.PathNodeHandleType={}))[t.none=1]="none",t[t.free=2]="free",t[t.mirrorAngle=3]="mirrorAngle",t[t.mirror=4]="mirror";class i extends e.LeaferCanvasBase{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=e.Platform.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:a}=this;this.view.width=Math.ceil(t*a),this.view.height=Math.ceil(e*a),this.clientBounds=this.bounds}}e.canvasPatch(OffscreenCanvasRenderingContext2D.prototype),e.canvasPatch(Path2D.prototype);const{mineType:r}=e.FileHelper;function s(t,a){e.Platform.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,a)=>new Promise((n,i)=>{t.convertToBlob({type:r(e),quality:a}).then(t=>{var e=new FileReader;e.onload=t=>n(t.target.result),e.onerror=t=>i(t),e.readAsDataURL(t)}).catch(t=>{i(t)})}),canvasToBolb:(t,e,a)=>t.convertToBlob({type:r(e),quality:a}),canvasSaveAs:(t,e,a)=>new Promise(t=>t()),download(t,e){},loadImage:t=>new Promise((a,n)=>{let i=new XMLHttpRequest;i.open("GET",e.Platform.image.getRealURL(t),!0),i.responseType="blob",i.onload=()=>{createImageBitmap(i.response).then(t=>{a(t)}).catch(t=>{n(t)})},i.onerror=t=>n(t),i.send()})},e.Platform.canvas=e.Creator.canvas(),e.Platform.conicGradientSupport=!!e.Platform.canvas.context.createConicGradient}Object.assign(e.Creator,{canvas:(t,e)=>new i(t,e),image:t=>new e.LeaferImage(t)}),e.Platform.name="web",e.Platform.isWorker=!0,e.Platform.backgrounder=!0,e.Platform.requestRender=function(t){requestAnimationFrame(t)},e.defineKey(e.Platform,"devicePixelRatio",{get:()=>1});const{userAgent:o}=navigator;o.indexOf("Firefox")>-1?(e.Platform.conicGradientRotate90=!0,e.Platform.intWheelDeltaY=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(e.Platform.fullImageShadow=!0),o.indexOf("Windows")>-1?(e.Platform.os="Windows",e.Platform.intWheelDeltaY=!0):o.indexOf("Mac")>-1?e.Platform.os="Mac":o.indexOf("Linux")>-1&&(e.Platform.os="Linux");class l{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove&&this.config.usePartLayout){const t=new e.LeafList;return this.__updatedList.list.forEach(e=>{e.leafer&&t.add(e)}),t}return this.__updatedList}constructor(t,a){this.totalTimes=0,this.config={},this.__updatedList=new e.LeafList,this.target=t,a&&(this.config=e.DataHelper.default(a,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(e.RenderEvent.REQUEST)}__onAttrChange(t){this.config.usePartLayout&&this.__updatedList.add(t.target),this.update()}__onChildEvent(t){this.config.usePartLayout&&(t.type===e.ChildEvent.ADD?(this.hasAdd=!0,this.__pushChild(t.child)):(this.hasRemove=!0,this.__updatedList.add(t.parent))),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,a=e.length;t<a;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new e.WatchEvent(e.WatchEvent.DATA,{updatedList:this.updatedList})),this.__updatedList=new e.LeafList,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[e.PropertyEvent.CHANGE,this.__onAttrChange,this],[[e.ChildEvent.ADD,e.ChildEvent.REMOVE],this.__onChildEvent,this],[e.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:d,updateBounds:h,updateChange:c}=e.LeafHelper,{pushAllChildBranch:u,pushAllParent:f}=e.BranchHelper;const{worldBounds:g}=e.LeafBoundsHelper;class p{constructor(t){this.updatedBounds=new e.Bounds,this.beforeBounds=new e.Bounds,this.afterBounds=new e.Bounds,e.isArray(t)&&(t=new e.LeafList(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,g)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,g),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:_,updateAllChange:m}=e.LeafHelper,y=e.Debug.get("Layouter");class w{constructor(t,a){this.totalTimes=0,this.config={usePartLayout:!0},this.__levelList=new e.LeafLevelList,this.target=t,a&&(this.config=e.DataHelper.default(a,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(this.layouting||!this.running)return;const{target:t}=this;this.times=0;try{t.emit(e.LayoutEvent.START),this.layoutOnce(),t.emitEvent(new e.LayoutEvent(e.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(e.WatchEvent.REQUEST),this.totalTimes>1&&this.config.usePartLayout?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const a=e.Run.start("PartLayout"),{target:n,__updatedList:i}=this,{BEFORE:r,LAYOUT:s,AFTER:o}=e.LayoutEvent,l=this.getBlocks(i);l.forEach(t=>t.setBefore()),n.emitEvent(new e.LayoutEvent(r,l,this.times)),this.extraBlock=null,i.sort(),function(t,e){let a;t.list.forEach(t=>{a=t.__layout,e.without(t)&&!a.proxyZoom&&(a.matrixChanged?(d(t,!0),e.add(t),t.isBranch&&u(t,e),f(t,e)):a.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),f(t,e)))})}(i,this.__levelList),function(t){let e,a,n;t.sort(!0),t.levels.forEach(i=>{e=t.levelMap[i];for(let t=0,i=e.length;t<i;t++){if(a=e[t],a.isBranch&&a.__tempNumber){n=a.children;for(let t=0,e=n.length;t<e;t++)n[t].isBranch||h(n[t])}h(a)}})}(this.__levelList),function(t){t.list.forEach(c)}(i),this.extraBlock&&l.push(this.extraBlock),l.forEach(t=>t.setAfter()),n.emitEvent(new e.LayoutEvent(s,l,this.times)),n.emitEvent(new e.LayoutEvent(o,l,this.times)),this.addBlocks(l),this.__levelList.reset(),this.__updatedList=null,e.Run.end(a)}fullLayout(){const t=e.Run.start("FullLayout"),{target:a}=this,{BEFORE:n,LAYOUT:i,AFTER:r}=e.LayoutEvent,s=this.getBlocks(new e.LeafList(a));a.emitEvent(new e.LayoutEvent(n,s,this.times)),w.fullLayout(a),s.forEach(t=>{t.setAfter()}),a.emitEvent(new e.LayoutEvent(i,s,this.times)),a.emitEvent(new e.LayoutEvent(r,s,this.times)),this.addBlocks(s),e.Run.end(t)}static fullLayout(t){_(t,!0),t.isBranch?e.BranchHelper.updateBounds(t):e.LeafHelper.updateBounds(t),m(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:a}=this.extraBlock||(this.extraBlock=new p([]));e.length?a.add(t.__world):a.set(t.__world),e.add(t)}}createBlock(t){return new p(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_([[e.LayoutEvent.REQUEST,this.layout,this],[e.LayoutEvent.AGAIN,this.layoutAgain,this],[e.WatchEvent.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const v=e.Debug.get("Renderer");class x{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,a,n){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,ceilPartPixel:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=a,n&&(this.config=e.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.requestTime||this.__requestRender()}requestLayout(){this.target.emit(e.LayoutEvent.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(e.RenderEvent.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(e.RenderEvent.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(e.RenderEvent.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:a}=this;this.times=0,this.totalBounds=new e.Bounds,v.log(a.innerName,"---\x3e");try{this.emitRender(e.RenderEvent.START),this.renderOnce(t),this.emitRender(e.RenderEvent.END,this.totalBounds),e.ImageManager.clearRecycled()}catch(t){this.rendering=!1,v.error(t)}v.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return v.warn("rendering");if(this.times>3)return v.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new e.Bounds,this.renderOptions={},t)this.emitRender(e.RenderEvent.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(e.RenderEvent.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(e.RenderEvent.RENDER,this.renderBounds,this.renderOptions),this.emitRender(e.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(t){const a=e.Run.start("PartRender"),{canvas:n}=this,i=t.getIntersect(n.bounds),r=new e.Bounds(i);n.save(),i.spread(x.clipSpread).ceil();const{ceilPartPixel:s}=this.config;n.clipWorld(i,s),n.clearWorld(i,s),this.__render(i,r),n.restore(),e.Run.end(a)}fullRender(){const t=e.Run.start("FullRender"),{canvas:a}=this;a.save(),a.clear(),this.__render(a.bounds),a.restore(),e.Run.end(t)}__render(t,a){const{canvas:n,target:i}=this,r=t.includes(i.__world),s=r?{includes:r}:{bounds:t,includes:r};this.needFill&&n.fillWorld(t,this.config.fill),e.Debug.showRepaint&&e.Debug.drawRepaint(n,t),this.config.useCellRender&&(s.cellList=this.getCellList()),e.Platform.render(i,n,s),this.renderBounds=a=a||t,this.renderOptions=s,this.totalBounds.isEmpty()?this.totalBounds=a:this.totalBounds.add(a),n.updateRender(a)}getCellList(){}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const a=new e.Bounds;a.setList(t),t.length=0,t.push(a)}}__requestRender(){const t=this.target;if(this.requestTime||!t)return;if(t.parentApp)return t.parentApp.requestRender(!1);this.requestTime=this.frameTime||Date.now();const a=()=>{const t=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:n}=this.config;if(n&&t>n)return e.Platform.requestRender(a);const{frames:i}=this;i.length>30&&i.shift(),i.push(t),this.FPS=Math.round(i.reduce((t,e)=>t+e,0)/i.length),this.requestTime=0,this.checkRender()};e.Platform.requestRender(a)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:a,height:n}=t.old;if(!new e.Bounds(0,0,a,n).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new e.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||v.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(t,a,n){this.target.emitEvent(new e.RenderEvent(t,this.times,a,n))}__listenEvents(){this.__eventIds=[this.target.on_([[e.RenderEvent.REQUEST,this.update,this],[e.LayoutEvent.END,this.__onLayoutEnd,this],[e.RenderEvent.AGAIN,this.renderAgain,this],[e.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)}}x.clipSpread=10;const P={},{copyRadiusPoint:b}=e.PointHelper,{hitRadiusPoint:L}=e.BoundsHelper;class B{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,a,n){a||(a=0),n||(n={});const i=n.through||!1,r=n.ignoreHittable||!1,s=n.target||this.target;this.exclude=n.exclude||null,this.point={x:t.x,y:t.y,radiusX:a,radiusY:a},this.findList=new e.LeafList(n.findList),n.findList||this.hitBranch(s.isBranchLeaf?{children:[s]}:s);const{list:o}=this.findList,l=this.getBestMatchLeaf(o,n.bottomList,r,!!n.findList),d=r?this.getPath(l):this.getHitablePath(l);return this.clear(),i?{path:d,target:l,throughPath:o.length?this.getThroughPath(o):d}:{path:d,target:l}}hitPoint(t,e,a){return!!this.getByPoint(t,e,a).target}getBestMatchLeaf(t,a,n,i){const r=this.findList=new e.LeafList;if(t.length){let a;const{x:i,y:s}=this.point,o={x:i,y:s,radiusX:0,radiusY:0};for(let i=0,s=t.length;i<s;i++)if(a=t[i],(n||e.LeafHelper.worldHittable(a))&&(this.hitChild(a,o),r.length)){if(a.isBranchLeaf&&t.some(t=>t!==a&&e.LeafHelper.hasParent(t,a))){r.reset();break}return r.list[0]}}if(a)for(let t=0,e=a.length;t<e;t++)if(this.hitChild(a[t].target,this.point,a[t].proxy),r.length)return r.list[0];return i?null:n?t[0]:t.find(t=>e.LeafHelper.worldHittable(t))}getPath(t){const a=new e.LeafList,n=[],{target:i}=this;for(;t&&(t.syncEventer&&n.push(t.syncEventer),a.add(t),(t=t.parent)!==i););return n.length&&n.forEach(t=>{for(;t&&(t.__.hittable&&a.add(t),(t=t.parent)!==i););}),i&&a.add(i),a}getHitablePath(t){const a=this.getPath(t&&t.hittable?t:null);let n,i=new e.LeafList;for(let t=a.list.length-1;t>-1&&(n=a.list[t],n.__.hittable)&&(i.addAt(n,0),n.__.hitChildren&&(!n.isLeafer||"draw"!==n.mode));t--);return i}getThroughPath(t){const a=new e.LeafList,n=[];for(let e=t.length-1;e>-1;e--)n.push(this.getPath(t[e]));let i,r,s;for(let t=0,e=n.length;t<e;t++){i=n[t],r=n[t+1];for(let t=0,e=i.length;t<e&&(s=i.list[t],!r||!r.has(s));t++)a.add(s)}return a}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let a,n,i;const{point:r}=this;for(let s=t.length-1;s>-1;s--)if(a=t[s],i=a.__,i.visible&&(!e||i.mask))if(n=L(a.__world,i.hitRadius?b(P,r,i.hitRadius):r),a.isBranch){if(n||a.__ignoreHitWorld){if(a.isBranchLeaf&&i.__clipAfterFill&&!a.__hitWorld(r,!0))continue;a.topChildren&&this.eachFind(a.topChildren,!1),this.eachFind(a.children,a.__onlyHitMask),a.isBranchLeaf&&this.hitChild(a,r)}}else n&&this.hitChild(a,r)}hitChild(t,e,a){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:n}=t;if(n&&n.__hasMask&&!t.__.mask){let a,i=[];const{children:r}=n;for(let n=0,s=r.length;n<s;n++)if(a=r[n],a.__.mask&&i.push(a),a===t){if(i&&!i.every(t=>t.__hitWorld(e)))return;break}}this.findList.add(a||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class E{constructor(t,a){this.config={},a&&(this.config=e.DataHelper.default(a,this.config)),this.picker=new B(this.target=t,this),this.finder=e.Creator.finder&&e.Creator.finder()}getByPoint(t,a,n){const{target:i,picker:r}=this;return e.Platform.backgrounder&&i&&i.updateLayout(),r.getByPoint(t,a,n)}hitPoint(t,e,a){return this.picker.hitPoint(t,e,a)}getBy(t,a,n,i){return this.finder?this.finder.getBy(t,a,n,i):e.Plugin.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function S(t,e,a){t.__.__font?n.Paint.fillText(t,e,a):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function k(t,a,i,r,s){const o=i.__;e.isObject(t)?n.Paint.drawStrokesStyle(t,a,!1,i,r,s):(r.setStroke(t,o.__strokeWidth*a,o),r.stroke()),o.__useArrow&&n.Paint.strokeArrow(t,i,r,s)}function R(t,a,i,r,s){const o=i.__;e.isObject(t)?n.Paint.drawStrokesStyle(t,a,!0,i,r,s):(r.setStroke(t,o.__strokeWidth*a,o),n.Paint.drawTextStroke(i,r,s))}function C(t,a,i,r,s){const o=r.getSameCanvas(!0,!0);o.font=i.__.__font,R(t,2,i,o,s),o.blendMode="outside"===a?"destination-out":"destination-in",n.Paint.fillText(i,o,s),o.blendMode="normal",e.LeafHelper.copyCanvasByWorld(i,r,o),o.recycle(i.__nowWorld)}Object.assign(e.Creator,{watcher:(t,e)=>new l(t,e),layouter:(t,e)=>new w(t,e),renderer:(t,e,a)=>new x(t,e,a),selector:(t,e)=>new E(t,e)}),e.Platform.layout=w.fullLayout,e.Platform.render=function(t,a,n){const i=Object.assign(Object.assign({},n),{topRendering:!0});n.topList=new e.LeafList,t.__render(a,n),n.topList.length&&n.topList.forEach(t=>t.__render(a,i))};const{getSpread:A,copyAndSpread:T,toOuterOf:O,getOuterOf:M,getByMove:I,move:W,getIntersectData:D}=e.BoundsHelper,H={};let F;const{stintSet:j}=e.DataHelper,{hasTransparent:Y}=n.ColorConvert;function G(t,a,i){if(!e.isObject(a)||!1===a.visible||0===a.opacity)return;let r;const{boxBounds:s}=i.__layout;switch(a.type){case"image":if(!a.url)return;r=n.PaintImage.image(i,t,a,s,!F||!F[a.url]);break;case"linear":r=n.PaintGradient.linearGradient(a,s);break;case"radial":r=n.PaintGradient.radialGradient(a,s);break;case"angular":r=n.PaintGradient.conicGradient(a,s);break;case"solid":const{type:o,color:l,opacity:d}=a;r={type:o,style:n.ColorConvert.string(l,d)};break;default:e.isUndefined(a.r)||(r={type:"solid",style:n.ColorConvert.string(a)})}if(r&&(r.originPaint=a,e.isString(r.style)&&Y(r.style)&&(r.isTransparent=!0),a.style)){if(0===a.style.strokeWidth)return;r.strokeStyle=a.style}return r}const X={compute:function(t,a){const i=a.__,r=[];let s,o,l,d=i.__input[t];e.isArray(d)||(d=[d]),F=n.PaintImage.recycleImage(t,i);for(let e,n=0,i=d.length;n<i;n++)(e=G(t,d[n],a))&&(r.push(e),e.strokeStyle&&(l||(l=1),e.strokeStyle.strokeWidth&&(l=Math.max(l,e.strokeStyle.strokeWidth))));i["_"+t]=r.length?r:void 0,r.length?(r.every(t=>t.isTransparent)&&(r.some(t=>t.image)&&(s=!0),o=!0),"fill"===t?(j(i,"__isAlphaPixelFill",s),j(i,"__isTransparentFill",o)):(j(i,"__isAlphaPixelStroke",s),j(i,"__isTransparentStroke",o),j(i,"__hasMultiStrokeStyle",l))):i.__removePaint(t,!1)},fill:function(t,e,a,n){a.fillStyle=t,S(e,a,n)},fills:function(t,e,a,i){let r,s,o;for(let l=0,d=t.length;l<d;l++){if(r=t[l],s=r.originPaint,r.image){if(o?o++:o=1,n.PaintImage.checkImage(r,!e.__.__font,e,a,i))continue;if(!r.style){1===o&&r.image.isPlacehold&&e.drawImagePlaceholder(r,a,i);continue}}if(a.fillStyle=r.style,r.transform||s.scaleFixed){if(a.save(),r.transform&&a.transform(r.transform),s.scaleFixed){const{scaleX:t,scaleY:n}=e.getRenderScaleData(!0);(!0===s.scaleFixed||"zoom-in"===s.scaleFixed&&t>1&&n>1)&&a.scale(1/t,1/n)}s.blendMode&&(a.blendMode=s.blendMode),S(e,a,i),a.restore()}else s.blendMode?(a.saveBlendMode(s.blendMode),S(e,a,i),a.restoreBlendMode()):S(e,a,i)}},fillPathOrText:S,fillText:function(t,e,a){const n=t.__,{rows:i,decorationY:r}=n.__textDrawData;let s;n.__isPlacehold&&n.placeholderColor&&(e.fillStyle=n.placeholderColor);for(let t=0,a=i.length;t<a;t++)s=i[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(r){const{decorationColor:t,decorationHeight:a}=n.__textDrawData;t&&(e.fillStyle=t),i.forEach(t=>r.forEach(n=>e.fillRect(t.x,t.y+n,t.width,a)))}},stroke:function(t,a,i,r){const s=a.__;if(s.__strokeWidth)if(s.__font)n.Paint.strokeText(t,a,i,r);else switch(s.strokeAlign){case"center":k(t,1,a,i,r);break;case"inside":!function(t,e,a,n){a.save(),a.clipUI(e),k(t,2,e,a,n),a.restore()}(t,a,i,r);break;case"outside":!function(t,a,n,i){const r=a.__;if(r.__fillAfterStroke)k(t,2,a,n,i);else{const{renderBounds:s}=a.__layout,o=n.getSameCanvas(!0,!0);a.__drawRenderPath(o),k(t,2,a,o,i),o.clipUI(r),o.clearWorld(s),e.LeafHelper.copyCanvasByWorld(a,n,o),o.recycle(a.__nowWorld)}}(t,a,i,r)}},strokes:function(t,e,a,i){n.Paint.stroke(t,e,a,i)},strokeText:function(t,e,a,n){switch(e.__.strokeAlign){case"center":R(t,1,e,a,n);break;case"inside":C(t,"inside",e,a,n);break;case"outside":e.__.__fillAfterStroke?R(t,2,e,a,n):C(t,"outside",e,a,n)}},drawTextStroke:function(t,e,a){let n,i=t.__.__textDrawData;const{rows:r,decorationY:s}=i;for(let t=0,a=r.length;t<a;t++)n=r[t],n.text?e.strokeText(n.text,n.x,n.y):n.data&&n.data.forEach(t=>{e.strokeText(t.char,t.x,n.y)});if(s){const{decorationHeight:t}=i;r.forEach(a=>s.forEach(n=>e.strokeRect(a.x,a.y+n,a.width,t)))}},drawStrokesStyle:function(t,e,a,i,r,s){let o;const l=i.__,{__hasMultiStrokeStyle:d}=l;d||r.setStroke(void 0,l.__strokeWidth*e,l);for(let h=0,c=t.length;h<c;h++)if(o=t[h],(!o.image||!n.PaintImage.checkImage(o,!1,i,r,s))&&o.style){if(d){const{strokeStyle:t}=o;t?r.setStroke(o.style,l.__getRealStrokeWidth(t)*e,l,t):r.setStroke(o.style,l.__strokeWidth*e,l)}else r.strokeStyle=o.style;o.originPaint.blendMode?(r.saveBlendMode(o.originPaint.blendMode),a?n.Paint.drawTextStroke(i,r,s):r.stroke(),r.restoreBlendMode()):a?n.Paint.drawTextStroke(i,r,s):r.stroke()}},shape:function(t,a,n){const i=a.getSameCanvas(),r=a.bounds,s=t.__nowWorld,o=t.__layout,l=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let d,h,c,u,f,g;O(o.strokeSpread?(T(H,o.boxBounds,o.strokeSpread),H):o.boxBounds,s,l);let{scaleX:p,scaleY:_}=t.getRenderScaleData(!0);if(r.includes(l))g=i,d=f=l,h=s;else{let i;if(e.Platform.fullImageShadow)i=l;else{const t=o.renderShapeSpread?A(r,e.FourNumberHelper.swapAndScale(o.renderShapeSpread,p,_)):r;i=D(t,l)}u=r.getFitMatrix(i);let{a:m,d:y}=u;u.a<1&&(g=a.getSameCanvas(),t.__renderShape(g,n),p*=m,_*=y),f=M(l,u),d=I(f,-u.e,-u.f),h=M(s,u),W(h,-u.e,-u.f);const w=n.matrix;w?(c=new e.Matrix(u),c.multiply(w),m*=w.scaleX,y*=w.scaleY):c=u,c.withScale(m,y),n=Object.assign(Object.assign({},n),{matrix:c})}return t.__renderShape(i,n),{canvas:i,matrix:c,fitMatrix:u,bounds:d,renderBounds:h,worldCanvas:g,shapeBounds:f,scaleX:p,scaleY:_}}};let N,U=new e.Bounds;const{isSame:q}=e.BoundsHelper;function z(t,e,a,i,r,s){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=i.width/e.pixelRatio,e.__naturalHeight=i.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return r.data||n.PaintImage.createData(r,i,a,s),!0}function V(t,a){K(t,e.ImageEvent.LOAD,a)}function Q(t,a){K(t,e.ImageEvent.LOADED,a)}function Z(t,a,n){a.error=n,t.forceUpdate("surface"),K(t,e.ImageEvent.ERROR,a)}function K(t,a,n){t.hasEvent(a)&&t.emitEvent(new e.ImageEvent(a,n))}function $(t,e){const{leafer:a}=t;a&&a.viewReady&&(a.renderer.ignore=e)}const{get:J,translate:tt}=e.MatrixHelper,et=new e.Bounds,at={},nt={};function it(t,a,n,i){const r=e.isString(t)||i?(i?n-i*a:n%a)/((i||Math.floor(n/a))-1):t;return"auto"===t&&r<0?0:r}let rt={},st=e.getMatrixData();const{get:ot,set:lt,rotateOfOuter:dt,translate:ht,scaleOfOuter:ct,multiplyParent:ut,scale:ft,rotate:gt,skew:pt}=e.MatrixHelper;function _t(t,e,a,n,i,r,s,o){s&>(t,s),o&&pt(t,o.x,o.y),i&&ft(t,i,r),ht(t,e.x+a,e.y+n)}function mt(t,e,a,n){return new(a||(a=Promise))(function(i,r){function s(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof a?e:new a(function(t){t(e)})).then(s,o)}l((n=n.apply(t,e||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const{get:yt,scale:wt,copy:vt}=e.MatrixHelper,{getFloorScale:xt}=e.MathHelper,{abs:Pt}=Math;const bt={image:function(t,a,n,i,r){let s,o;const l=e.ImageManager.get(n);return N&&n===N.paint&&q(i,N.boxBounds)?s=N.leafPaint:(s={type:n.type,image:l},l.hasAlphaPixel&&(s.isTransparent=!0),N=l.use>1?{leafPaint:s,paint:n,boxBounds:U.set(i)}:null),(r||l.loading)&&(o={image:l,attrName:a,attrValue:n}),l.ready?(z(t,a,n,l,s,i),r&&(V(t,o),Q(t,o))):l.error?r&&Z(t,o,l.error):(r&&($(t,!0),V(t,o)),s.loadId=l.load(()=>{$(t,!1),t.destroyed||(z(t,a,n,l,s,i)&&(l.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),Q(t,o)),s.loadId=void 0},e=>{$(t,!1),Z(t,o,e),s.loadId=void 0},n.lod&&l.getThumbSize(n.lod)),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{l.ready||(l.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):l.isPlacehold=!0)),s},checkImage:function(t,a,i,r,s){const{scaleX:o,scaleY:l}=n.PaintImage.getImageRenderScaleData(t,i,r,s),{image:d,data:h,originPaint:c}=t,{exporting:u,snapshot:f}=s;return!(!h||t.patternId===o+"-"+l&&!u||f)&&(a&&(h.repeat?a=!1:c.changeful||"miniapp"===e.Platform.name&&e.ResizeEvent.isResizing(i)||u||(a=e.Platform.image.isLarge(d,o,l)||d.width*o>8096||d.height*l>8096)),a?(i.__.__isFastShadow&&(r.fillStyle=t.style||"#000",r.fill()),n.PaintImage.drawImage(t,o,l,i,r,s),!0):(!t.style||c.sync||u?n.PaintImage.createPattern(t,i,r,s):n.PaintImage.createPatternTask(t,i,r,s),!1))},drawImage:function(t,e,a,n,i,r){const{data:s,image:o}=t,{blendMode:l}=t.originPaint,{opacity:d,transform:h}=s,c=o.getFull(s.filters),u=n.__;let f,{width:g,height:p}=o;(f=h&&!h.onlyScale||u.path||u.cornerRadius)||d||l?(i.save(),f&&i.clipUI(n),l&&(i.blendMode=l),d&&(i.opacity*=d),h&&i.transform(h),i.drawImage(c,0,0,g,p),i.restore()):(s.scaleX&&(g*=s.scaleX,p*=s.scaleY),i.drawImage(c,0,0,g,p))},getImageRenderScaleData:function(t,e,a,n){const i=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:r}=t;if(a){const{pixelRatio:t}=a;i.scaleX*=t,i.scaleY*=t}return r&&r.scaleX&&(i.scaleX*=Math.abs(r.scaleX),i.scaleY*=Math.abs(r.scaleY)),i},recycleImage:function(t,a){const n=a["_"+t];if(e.isArray(n)){let i,r,s,o,l;for(let d=0,h=n.length;d<h;d++)i=n[d],r=i.image,l=r&&r.url,l&&(s||(s={}),s[l]=!0,e.ImageManager.recyclePaint(i),r.loading&&(o||(o=a.__input&&a.__input[t]||[],e.isArray(o)||(o=[o])),r.unload(n[d].loadId,!o.some(t=>t.url===l))));return s}return null},createPatternTask:function(t,a,i,r){t.patternTask||(t.patternTask=e.ImageManager.patternTasker.add(()=>mt(this,void 0,void 0,function*(){n.PaintImage.createPattern(t,a,i,r),a.forceUpdate("surface")}),0,()=>(t.patternTask=null,i.bounds.hit(a.__nowWorld))))},createPattern:function(t,a,i,r){let{scaleX:s,scaleY:o}=n.PaintImage.getImageRenderScaleData(t,a,i,r),l=s+"-"+o;if(t.patternId!==l&&!a.destroyed&&(!e.Platform.image.isLarge(t.image,s,o)||t.data.repeat)){const{image:i,data:r}=t,{transform:d,gap:h}=r,c=n.PaintImage.getPatternFixScale(t,s,o);let u,f,g,{width:p,height:_}=i;c&&(s*=c,o*=c),p*=s,_*=o,h&&(f=h.x*s/Pt(r.scaleX||1),g=h.y*o/Pt(r.scaleY||1)),(d||1!==s||1!==o)&&(s*=xt(p+(f||0)),o*=xt(_+(g||0)),u=yt(),d&&vt(u,d),wt(u,1/s,1/o));const m=i.getCanvas(p,_,r.opacity,r.filters,f,g,a.leafer&&a.leafer.config.smooth,r.interlace),y=i.getPattern(m,r.repeat||e.Platform.origin.noRepeat||"no-repeat",u,t);t.style=y,t.patternId=l}},getPatternFixScale:function(t,a,n){const{image:i}=t;let r,s=e.Platform.image.maxPatternSize,o=i.width*i.height;return i.isSVG?a>1&&(r=Math.ceil(a)/a):s>o&&(s=o),(o*=a*n)>s&&(r=Math.sqrt(s/o)),r},createData:function(t,e,a,i){t.data=n.PaintImage.getPatternData(a,i,e)},getPatternData:function(t,a,i){t.padding&&(a=et.set(a).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:r,height:s}=i,{opacity:o,mode:l,align:d,offset:h,scale:c,size:u,rotation:f,skew:g,clipSize:p,repeat:_,gap:m,filters:y,interlace:w}=t,v=a.width===r&&a.height===s,x={mode:l},P="center"!==d&&(f||0)%180==90;let b,L;switch(e.BoundsHelper.set(nt,0,0,P?s:r,P?r:s),l&&"cover"!==l&&"fit"!==l?((c||u)&&(e.MathHelper.getScaleData(c,u,i,at),b=at.scaleX,L=at.scaleY),(d||m||_)&&(b&&e.BoundsHelper.scale(nt,b,L,!0),d&&e.AlignHelper.toPoint(d,nt,a,nt,!0,!0))):v&&!f||(b=L=e.BoundsHelper.getFitScale(a,nt,"fit"!==l),e.BoundsHelper.put(a,i,d,b,!1,nt),e.BoundsHelper.scale(nt,b,L,!0)),h&&e.PointHelper.move(nt,h),l){case"stretch":v?b&&(b=L=void 0):(b=a.width/r,L=a.height/s,n.PaintImage.stretchMode(x,a,b,L));break;case"normal":case"clip":if(nt.x||nt.y||b||p||f||g){let t,e;p&&(t=a.width/p.width,e=a.height/p.height),n.PaintImage.clipMode(x,a,nt.x,nt.y,b,L,f,g,t,e),t&&(b=b?b*t:t,L=L?L*e:e)}break;case"repeat":(!v||b||f||g)&&n.PaintImage.repeatMode(x,a,r,s,nt.x,nt.y,b,L,f,g,d,t.freeTransform),_||(x.repeat="repeat");const i=e.isObject(_);(m||i)&&(x.gap=function(t,a,n,i,r){let s,o;e.isObject(t)?(s=t.x,o=t.y):s=o=t;return{x:it(s,n,r.width,a&&a.x),y:it(o,i,r.height,a&&a.y)}}(m,i&&_,nt.width,nt.height,a));break;default:b&&n.PaintImage.fillOrFitMode(x,a,nt.x,nt.y,b,L,f)}return x.transform||(a.x||a.y)&&tt(x.transform=J(),a.x,a.y),b&&(x.scaleX=b,x.scaleY=L),o&&o<1&&(x.opacity=o),y&&(x.filters=y),_&&(x.repeat=e.isString(_)?"x"===_?"repeat-x":"repeat-y":"repeat"),w&&(x.interlace=e.isNumber(w)||"percent"===w.type?{type:"x",offset:w}:w),x},stretchMode:function(t,e,a,n){const i=ot(),{x:r,y:s}=e;r||s?ht(i,r,s):i.onlyScale=!0,ft(i,a,n),t.transform=i},fillOrFitMode:function(t,e,a,n,i,r,s){const o=ot();ht(o,e.x+a,e.y+n),ft(o,i,r),s&&dt(o,{x:e.x+e.width/2,y:e.y+e.height/2},s),t.transform=o},clipMode:function(t,e,a,n,i,r,s,o,l,d){const h=ot();_t(h,e,a,n,i,r,s,o),l&&(s||o?(lt(st),ct(st,e,l,d),ut(h,st)):ct(h,e,l,d)),t.transform=h},repeatMode:function(t,e,a,n,i,r,s,o,l,d,h,c){const u=ot();if(c)_t(u,e,i,r,s,o,l,d);else{if(l)if("center"===h)dt(u,{x:a/2,y:n/2},l);else switch(gt(u,l),l){case 90:ht(u,n,0);break;case 180:ht(u,a,n);break;case 270:ht(u,0,a)}rt.x=e.x+i,rt.y=e.y+r,ht(u,rt.x,rt.y),s&&ct(u,rt,s,o)}t.transform=u}},{toPoint:Lt}=e.AroundHelper,{hasTransparent:Bt}=n.ColorConvert,Et={},St={};function kt(t,a,i,r){if(i){let s,o,l,d;for(let t=0,h=i.length;t<h;t++)s=i[t],e.isString(s)?(l=t/(h-1),o=n.ColorConvert.string(s,r)):(l=s.offset,o=n.ColorConvert.string(s.color,r)),a.addColorStop(l,o),!d&&Bt(o)&&(d=!0);d&&(t.isTransparent=!0)}}const{getAngle:Rt,getDistance:Ct}=e.PointHelper,{get:At,rotateOfOuter:Tt,scaleOfOuter:Ot}=e.MatrixHelper,{toPoint:Mt}=e.AroundHelper,It={},Wt={};function Dt(t,e,a,n,i){let r;const{width:s,height:o}=t;if(s!==o||n){const t=Rt(e,a);r=At(),i?(Ot(r,e,s/o*(n||1),1),Tt(r,e,t+90)):(Ot(r,e,1,s/o*(n||1)),Tt(r,e,t))}return r}const{getDistance:Ht}=e.PointHelper,{toPoint:Ft}=e.AroundHelper,jt={},Yt={};const Gt={linearGradient:function(t,a){let{from:n,to:i,type:r,opacity:s}=t;Lt(n||"top",a,Et),Lt(i||"bottom",a,St);const o=e.Platform.canvas.createLinearGradient(Et.x,Et.y,St.x,St.y),l={type:r,style:o};return kt(l,o,t.stops,s),l},radialGradient:function(t,a){let{from:n,to:i,type:r,opacity:s,stretch:o}=t;Mt(n||"center",a,It),Mt(i||"bottom",a,Wt);const l=e.Platform.canvas.createRadialGradient(It.x,It.y,0,It.x,It.y,Ct(It,Wt)),d={type:r,style:l};kt(d,l,t.stops,s);const h=Dt(a,It,Wt,o,!0);return h&&(d.transform=h),d},conicGradient:function(t,a){let{from:n,to:i,type:r,opacity:s,stretch:o}=t;Ft(n||"center",a,jt),Ft(i||"bottom",a,Yt);const l=e.Platform.conicGradientSupport?e.Platform.canvas.createConicGradient(0,jt.x,jt.y):e.Platform.canvas.createRadialGradient(jt.x,jt.y,0,jt.x,jt.y,Ht(jt,Yt)),d={type:r,style:l};kt(d,l,t.stops,s);const h=Dt(a,jt,Yt,o||1,e.Platform.conicGradientRotate90);return h&&(d.transform=h),d},getTransform:Dt},{copy:Xt,move:Nt,toOffsetOutBounds:Ut}=e.BoundsHelper,{max:qt,abs:zt}=Math,Vt={},Qt=new e.Matrix,Zt={};function Kt(t,e){let a,n,i,r,s=0,o=0,l=0,d=0;return e.forEach(t=>{a=t.x||0,n=t.y||0,r=1.5*(t.blur||0),i=zt(t.spread||0),s=qt(s,i+r-n),o=qt(o,i+r+a),l=qt(l,i+r+n),d=qt(d,i+r-a)}),s===o&&o===l&&l===d?s:[s,o,l,d]}function $t(t,a,n){const{shapeBounds:i}=n;let r,s;e.Platform.fullImageShadow?(Xt(Vt,t.bounds),Nt(Vt,a.x-i.x,a.y-i.y),r=t.bounds,s=Vt):(r=i,s=a),t.copyWorld(n.canvas,r,s)}const{toOffsetOutBounds:Jt}=e.BoundsHelper,te={};const ee=Kt;const ae={shadow:function(t,a,i){let r,s;const{__nowWorld:o}=t,{shadow:l}=t.__,{worldCanvas:d,bounds:h,renderBounds:c,shapeBounds:u,scaleX:f,scaleY:g}=i,p=a.getSameCanvas(),_=l.length-1;Ut(h,Zt,c),l.forEach((l,m)=>{let y=1;if(l.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(y=1/t)}p.setWorldShadow(Zt.offsetX+(l.x||0)*f*y,Zt.offsetY+(l.y||0)*g*y,(l.blur||0)*f*y,n.ColorConvert.string(l.color)),s=n.Effect.getShadowTransform(t,p,i,l,Zt,y),s&&p.setTransform(s),$t(p,Zt,i),s&&p.resetTransform(),r=c,l.box&&(p.restore(),p.save(),d&&(p.copyWorld(p,c,o,"copy"),r=o),d?p.copyWorld(d,o,o,"destination-out"):p.copyWorld(i.canvas,u,h,"destination-out")),e.LeafHelper.copyCanvasByWorld(t,a,p,r,l.blendMode),_&&m<_&&p.clearWorld(r)}),p.recycle(r)},innerShadow:function(t,a,i){let r,s;const{__nowWorld:o}=t,{innerShadow:l}=t.__,{worldCanvas:d,bounds:h,renderBounds:c,shapeBounds:u,scaleX:f,scaleY:g}=i,p=a.getSameCanvas(),_=l.length-1;Jt(h,te,c),l.forEach((l,m)=>{let y=1;if(l.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(y=1/t)}p.save(),p.setWorldShadow(te.offsetX+(l.x||0)*f*y,te.offsetY+(l.y||0)*g*y,(l.blur||0)*f*y),s=n.Effect.getShadowTransform(t,p,i,l,te,y,!0),s&&p.setTransform(s),$t(p,te,i),p.restore(),d?(p.copyWorld(p,c,o,"copy"),p.copyWorld(d,o,o,"source-out"),r=o):(p.copyWorld(i.canvas,u,h,"source-out"),r=c),p.fillWorld(r,n.ColorConvert.string(l.color),"source-in"),e.LeafHelper.copyCanvasByWorld(t,a,p,r,l.blendMode),_&&m<_&&p.clearWorld(r)}),p.recycle(r)},blur:function(t,e,a){const{blur:n}=t.__;a.setWorldBlur(n*t.__nowWorld.a),a.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),a.filter="none"},backgroundBlur:function(t,e,a){},getShadowRenderSpread:Kt,getShadowTransform:function(t,e,a,n,i,r,s){if(n.spread){const a=2*n.spread*r*(s?-1:1),{width:o,height:l}=t.__layout.strokeBounds;return Qt.set().scaleOfOuter({x:(i.x+i.width/2)*e.pixelRatio,y:(i.y+i.height/2)*e.pixelRatio},1+a/o,1+a/l),Qt}},isTransformShadow(t){},getInnerShadowSpread:ee},{excludeRenderBounds:ne}=e.LeafBoundsHelper;let ie;function re(t,e,a,n,i,r,s,o){switch(e){case"grayscale":ie||(ie=!0,i.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,a,n,i,r){const s=t.__nowWorld;a.resetTransform(),a.opacity=1,a.useMask(n,s),r&&n.recycle(s);oe(t,e,a,1,i,r)}(t,a,n,i,s,o);break;case"opacity-path":oe(t,a,n,r,s,o);break;case"path":o&&a.restore()}}function se(t){return t.getSameCanvas(!1,!0)}function oe(t,e,a,n,i,r){const s=t.__nowWorld;e.resetTransform(),e.opacity=n,e.copyWorld(a,s,void 0,i),r?a.recycle(s):a.clearWorld(s)}n.Group.prototype.__renderMask=function(t,e){let a,n,i,r,s,o;const{children:l}=this;for(let d=0,h=l.length;d<h;d++){if(a=l[d],o=a.__.mask,o){s&&(re(this,s,t,i,n,r,void 0,!0),n=i=null),"clipping"!==o&&"clipping-path"!==o||ne(a,e)||a.__render(t,e),r=a.__.opacity,ie=!1,"path"===o||"clipping-path"===o?(r<1?(s="opacity-path",i||(i=se(t))):(s="path",t.save()),a.__clip(i||t,e)):(s="grayscale"===o?"grayscale":"alpha",n||(n=se(t)),i||(i=se(t)),a.__render(n,e));continue}const h=1===r&&a.__.__blendMode;h&&re(this,s,t,i,n,r,void 0,!1),ne(a,e)||a.__render(i||t,e),h&&re(this,s,t,i,n,r,h,!1)}re(this,s,t,i,n,r,void 0,!0)};const le=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",de=le+"_#~&*+\\=|≮≯≈≠=…",he=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 ce(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const ue=ce("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),fe=ce("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),ge=ce(le),pe=ce(de),_e=ce("- —/~|┆·");var me;!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"}(me||(me={}));const{Letter:ye,Single:we,Before:ve,After:xe,Symbol:Pe,Break:be}=me;function Le(t){return ue[t]?ye:_e[t]?be:fe[t]?ve:ge[t]?xe:pe[t]?Pe:he.test(t)?we:ye}const Be={trimRight(t){const{words:e}=t;let a,n=0,i=e.length;for(let r=i-1;r>-1&&(a=e[r].data[0]," "===a.char);r--)n++,t.width-=a.width;n&&e.splice(i-n,n)}};function Ee(t,e,a){switch(e){case"title":return a?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:Se}=Be,{Letter:ke,Single:Re,Before:Ce,After:Ae,Symbol:Te,Break:Oe}=me;let Me,Ie,We,De,He,Fe,je,Ye,Ge,Xe,Ne,Ue,qe,ze,Ve,Qe,Ze,Ke=[];function $e(t,e){Ge&&!Ye&&(Ye=Ge),Me.data.push({char:t,width:e}),We+=e}function Je(){De+=We,Me.width=We,Ie.words.push(Me),Me={data:[]},We=0}function ta(){ze&&(Ve.paraNumber++,Ie.paraStart=!0,ze=!1),Ge&&(Ie.startCharSize=Ye,Ie.endCharSize=Ge,Ye=0),Ie.width=De,Qe.width?Se(Ie):Ze&&ea(),Ke.push(Ie),Ie={words:[]},De=0}function ea(){De>(Ve.maxWidth||0)&&(Ve.maxWidth=De)}const{top:aa,right:na,bottom:ia,left:ra}=e.Direction4;function sa(t,e,a){const{bounds:n,rows:i}=t;n[e]+=a;for(let t=0;t<i.length;t++)i[t][e]+=a}const oa={getDrawData:function(t,a){e.isString(t)||(t=String(t));let i=0,r=0,s=a.__getInput("width")||0,o=a.__getInput("height")||0;const{__padding:l}=a;l&&(s?(i=l[ra],s-=l[na]+l[ra],!s&&(s=.01)):a.autoSizeAlign||(i=l[ra]),o?(r=l[aa],o-=l[aa]+l[ia],!o&&(o=.01)):a.autoSizeAlign||(r=l[aa]));const d={bounds:{x:i,y:r,width:s,height:o},rows:[],paraNumber:0,font:e.Platform.canvas.font=a.__font};return function(t,a,n){Ve=t,Ke=t.rows,Qe=t.bounds,Ze=!Qe.width&&!n.autoSizeAlign;const{__letterSpacing:i,paraIndent:r,textCase:s}=n,{canvas:o}=e.Platform,{width:l}=Qe;if(n.__isCharMode){const t="none"!==n.textWrap,e="break"===n.textWrap;ze=!0,Ne=null,Ye=je=Ge=We=De=0,Me={data:[]},Ie={words:[]},i&&(a=[...a]);for(let n=0,d=a.length;n<d;n++)Fe=a[n],"\n"===Fe?(We&&Je(),Ie.paraEnd=!0,ta(),ze=!0):(Xe=Le(Fe),Xe===ke&&"none"!==s&&(Fe=Ee(Fe,s,!We)),je=o.measureText(Fe).width,i&&(i<0&&(Ge=je),je+=i),Ue=Xe===Re&&(Ne===Re||Ne===ke)||Ne===Re&&Xe!==Ae,qe=!(Xe!==Ce&&Xe!==Re||Ne!==Te&&Ne!==Ae),He=ze&&r?l-r:l,t&&l&&De+We+je>He&&(e?(We&&Je(),De&&ta()):(qe||(qe=Xe===ke&&Ne==Ae),Ue||qe||Xe===Oe||Xe===Ce||Xe===Re||We+je>He?(We&&Je(),De&&ta()):De&&ta()))," "===Fe&&!0!==ze&&De+We===0||(Xe===Oe?(" "===Fe&&We&&Je(),$e(Fe,je),Je()):Ue||qe?(We&&Je(),$e(Fe,je)):$e(Fe,je)),Ne=Xe);We&&Je(),De&&ta(),Ke.length>0&&(Ke[Ke.length-1].paraEnd=!0)}else a.split("\n").forEach(t=>{Ve.paraNumber++,De=o.measureText(t).width,Ke.push({x:r||0,text:t,width:De,paraStart:!0}),Ze&&ea()})}(d,t,a),l&&function(t,e,a,n,i){if(!n&&a.autoSizeAlign)switch(a.textAlign){case"left":sa(e,"x",t[ra]);break;case"right":sa(e,"x",-t[na])}if(!i&&a.autoSizeAlign)switch(a.verticalAlign){case"top":sa(e,"y",t[aa]);break;case"bottom":sa(e,"y",-t[ia])}}(l,d,a,s,o),function(t,e){const{rows:a,bounds:n}=t,i=a.length,{__lineHeight:r,__baseLine:s,__letterSpacing:o,__clipText:l,textAlign:d,verticalAlign:h,paraSpacing:c,autoSizeAlign:u}=e;let{x:f,y:g,width:p,height:_}=n,m=r*i+(c?c*(t.paraNumber-1):0),y=s;if(l&&m>_)m=Math.max(_,r),i>1&&(t.overflow=i);else if(_||u)switch(h){case"middle":g+=(_-m)/2;break;case"bottom":g+=_-m}y+=g;let w,v,x,P=p||u?p:t.maxWidth;for(let s=0,h=i;s<h;s++){if(w=a[s],w.x=f,w.width<p||w.width>p&&!l)switch(d){case"center":w.x+=(P-w.width)/2;break;case"right":w.x+=P-w.width}w.paraStart&&c&&s>0&&(y+=c),w.y=y,y+=r,t.overflow>s&&y>m&&(w.isOverflow=!0,t.overflow=s+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=a.length))}n.y=g,n.height=m}(d,a),a.__isCharMode&&function(t,e,a){const{rows:n}=t,{textAlign:i,paraIndent:r,__letterSpacing:s}=e,o=a&&i.includes("both"),l=o||a&&i.includes("justify"),d=l&&i.includes("letter");let h,c,u,f,g,p,_,m,y,w;n.forEach(t=>{t.words&&(g=r&&t.paraStart?r:0,m=t.words.length,l&&(w=!t.paraEnd||o,c=a-t.width-g,d?f=c/(t.words.reduce((t,e)=>t+e.data.length,0)-1):u=m>1?c/(m-1):0),p=s||t.isOverflow||d?0:u?1:2,t.isOverflow&&!s&&(t.textMode=!0),2===p?(t.x+=g,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=g,h=t.x,t.data=[],t.words.forEach((e,a)=>{1===p?(_={char:"",x:h},h=function(t,e,a){return t.forEach(t=>{a.char+=t.char,e+=t.width}),e}(e.data,h,_),(t.isOverflow||" "!==_.char)&&t.data.push(_)):h=function(t,e,a,n,i){return t.forEach(t=>{(n||" "!==t.char)&&(t.x=e,a.push(t)),e+=t.width,i&&(e+=i)}),e}(e.data,h,t.data,t.isOverflow,w&&f),w&&(y=a===m-1,u?y||(h+=u,t.width+=u):f&&(t.width+=f*(e.data.length-(y?1:0))))})),t.words=null)})}(d,a,s),d.overflow&&function(t,a,n,i){if(!i)return;const{rows:r,overflow:s}=t;let{textOverflow:o}=a;if(r.splice(s),o&&"show"!==o){let t,l;"hide"===o?o="":"ellipsis"===o&&(o="...");const d=o?e.Platform.canvas.measureText(o).width:0,h=n+i-d;("none"===a.textWrap?r:[r[s-1]]).forEach(e=>{if(e.isOverflow&&e.data){let a=e.data.length-1;for(let n=a;n>-1&&(t=e.data[n],l=t.x+t.width,!(n===a&&l<h));n--){if(l<h&&" "!==t.char||!n){e.data.splice(n+1),e.width-=t.width;break}e.width-=t.width}e.width+=d,e.data.push({char:o,x:l}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(d,a,i,s),"none"!==a.textDecoration&&function(t,a){let i,r=0;const{fontSize:s,textDecoration:o}=a;switch(t.decorationHeight=s/11,e.isObject(o)?(i=o.type,o.color&&(t.decorationColor=n.ColorConvert.string(o.color)),o.offset&&(r=Math.min(.3*s,Math.max(o.offset,.15*-s)))):i=o,i){case"under":t.decorationY=[.15*s+r];break;case"delete":t.decorationY=[.35*-s];break;case"under-delete":t.decorationY=[.15*s+r,.35*-s]}}(d,a),d}};const la={string:function(t,a){if(!t)return"#000";const i=e.isNumber(a)&&a<1;if(e.isString(t)){if(!i||!n.ColorConvert.object)return t;t=n.ColorConvert.object(t)}let r=e.isUndefined(t.a)?1:t.a;i&&(r*=a);const s=t.r+","+t.g+","+t.b;return 1===r?"rgb("+s+")":"rgba("+s+","+r+")"}};Object.assign(n.TextConvert,oa),Object.assign(n.ColorConvert,la),Object.assign(n.Paint,X),Object.assign(n.PaintImage,bt),Object.assign(n.PaintGradient,Gt),Object.assign(n.Effect,ae),Object.assign(e.Creator,{interaction:(t,e,n,i)=>new a.InteractionBase(t,e,n,i),hitCanvas:(t,e)=>new i(t,e),hitCanvasManager:()=>new a.HitCanvasManager}),s(),Object.defineProperty(exports,"LeaferImage",{enumerable:!0,get:function(){return e.LeaferImage}}),exports.Layouter=w,exports.LeaferCanvas=i,exports.Picker=B,exports.Renderer=x,exports.Selector=E,exports.Watcher=l,exports.useCanvas=s,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]}})}),Object.keys(a).forEach(function(t){"default"===t||Object.prototype.hasOwnProperty.call(exports,t)||Object.defineProperty(exports,t,{enumerable:!0,get:function(){return a[t]}})});
|
|
2
2
|
//# sourceMappingURL=worker.min.cjs.map
|