leafer-draw 2.1.4 → 2.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/web.cjs +7 -5
- package/dist/web.esm.js +7 -5
- package/dist/web.esm.min.js +1 -1
- package/dist/web.esm.min.js.map +1 -1
- package/dist/web.js +28 -192
- package/dist/web.min.cjs +1 -1
- package/dist/web.min.cjs.map +1 -1
- package/dist/web.min.js +1 -1
- package/dist/web.min.js.map +1 -1
- package/dist/web.module.js +28 -193
- package/dist/web.module.min.js +1 -1
- package/dist/web.module.min.js.map +1 -1
- package/package.json +3 -3
package/dist/web.js
CHANGED
|
@@ -240,7 +240,7 @@ var LeaferUI = function(exports) {
|
|
|
240
240
|
RUNTIME: "runtime",
|
|
241
241
|
LEAF: "leaf",
|
|
242
242
|
TASK: "task",
|
|
243
|
-
|
|
243
|
+
CANVAS: "canvas",
|
|
244
244
|
IMAGE: "image",
|
|
245
245
|
types: {},
|
|
246
246
|
create(typeName) {
|
|
@@ -869,7 +869,7 @@ var LeaferUI = function(exports) {
|
|
|
869
869
|
return quick ? t.x === point.x && t.y === point.y : float$1(t.x) === float$1(point.x) && float$1(t.y) === float$1(point.y);
|
|
870
870
|
},
|
|
871
871
|
reset(t) {
|
|
872
|
-
|
|
872
|
+
t.x = t.y = 0;
|
|
873
873
|
}
|
|
874
874
|
};
|
|
875
875
|
const P$5 = PointHelper;
|
|
@@ -1073,6 +1073,7 @@ var LeaferUI = function(exports) {
|
|
|
1073
1073
|
}
|
|
1074
1074
|
reset() {
|
|
1075
1075
|
MatrixHelper.reset(this);
|
|
1076
|
+
return this;
|
|
1076
1077
|
}
|
|
1077
1078
|
}
|
|
1078
1079
|
const tempMatrix$2 = new Matrix;
|
|
@@ -2177,7 +2178,7 @@ var LeaferUI = function(exports) {
|
|
|
2177
2178
|
this.worldTransform = {};
|
|
2178
2179
|
if (!config) config = minSize;
|
|
2179
2180
|
this.manager = manager;
|
|
2180
|
-
this.innerId = IncrementId.create(IncrementId.
|
|
2181
|
+
this.innerId = IncrementId.create(IncrementId.CANVAS);
|
|
2181
2182
|
const {width: width, height: height, pixelRatio: pixelRatio} = config;
|
|
2182
2183
|
this.autoLayout = !width || !height;
|
|
2183
2184
|
this.size.pixelRatio = pixelRatio || Platform.devicePixelRatio;
|
|
@@ -2327,6 +2328,7 @@ var LeaferUI = function(exports) {
|
|
|
2327
2328
|
}
|
|
2328
2329
|
useGrayscaleAlpha(bounds) {
|
|
2329
2330
|
this.setTempPixelBounds(bounds, true, true);
|
|
2331
|
+
if (!tempPixelBounds.width || !tempPixelBounds.height) return;
|
|
2330
2332
|
let alpha, pixel;
|
|
2331
2333
|
const {context: context} = this, imageData = context.getImageData(tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height), {data: data} = imageData;
|
|
2332
2334
|
for (let i = 0, len = data.length; i < len; i += 4) {
|
|
@@ -3497,7 +3499,7 @@ var LeaferUI = function(exports) {
|
|
|
3497
3499
|
const {arcTo: arcTo} = PathCommandDataHelper;
|
|
3498
3500
|
const PathCorner = {
|
|
3499
3501
|
smooth(data, cornerRadius, _cornerSmoothing) {
|
|
3500
|
-
let command, lastCommand, commandLen;
|
|
3502
|
+
let command, lastCommand, commandLen, startXIndex, startYIndex, smoothLen;
|
|
3501
3503
|
let i = 0, x = 0, y = 0, startX = 0, startY = 0, secondX = 0, secondY = 0, lastX = 0, lastY = 0;
|
|
3502
3504
|
if (isArray(cornerRadius)) cornerRadius = cornerRadius[0] || 0;
|
|
3503
3505
|
const len = data.length, three = len === 9;
|
|
@@ -3506,6 +3508,11 @@ var LeaferUI = function(exports) {
|
|
|
3506
3508
|
command = data[i];
|
|
3507
3509
|
switch (command) {
|
|
3508
3510
|
case M:
|
|
3511
|
+
smoothLen = smooth.length;
|
|
3512
|
+
if (smoothLen && lastCommand !== Z) {
|
|
3513
|
+
smooth[startXIndex] = startX;
|
|
3514
|
+
smooth[startYIndex] = startY;
|
|
3515
|
+
}
|
|
3509
3516
|
startX = lastX = data[i + 1];
|
|
3510
3517
|
startY = lastY = data[i + 2];
|
|
3511
3518
|
i += 3;
|
|
@@ -3516,6 +3523,8 @@ var LeaferUI = function(exports) {
|
|
|
3516
3523
|
} else {
|
|
3517
3524
|
smooth.push(M, startX, startY);
|
|
3518
3525
|
}
|
|
3526
|
+
startXIndex = smoothLen + 1;
|
|
3527
|
+
startYIndex = smoothLen + 2;
|
|
3519
3528
|
break;
|
|
3520
3529
|
|
|
3521
3530
|
case L$1:
|
|
@@ -3554,8 +3563,8 @@ var LeaferUI = function(exports) {
|
|
|
3554
3563
|
lastCommand = command;
|
|
3555
3564
|
}
|
|
3556
3565
|
if (command !== Z) {
|
|
3557
|
-
smooth[
|
|
3558
|
-
smooth[
|
|
3566
|
+
smooth[startXIndex] = startX;
|
|
3567
|
+
smooth[startYIndex] = startY;
|
|
3559
3568
|
}
|
|
3560
3569
|
return smooth;
|
|
3561
3570
|
}
|
|
@@ -5207,6 +5216,7 @@ var LeaferUI = function(exports) {
|
|
|
5207
5216
|
this.renderChanged = true;
|
|
5208
5217
|
this.renderSpread || (this.renderSpread = 1);
|
|
5209
5218
|
this.boundsChanged = true;
|
|
5219
|
+
this.hitCanvasChanged = true;
|
|
5210
5220
|
}
|
|
5211
5221
|
scaleChange() {
|
|
5212
5222
|
this.scaleChanged = true;
|
|
@@ -6053,10 +6063,6 @@ var LeaferUI = function(exports) {
|
|
|
6053
6063
|
}
|
|
6054
6064
|
}
|
|
6055
6065
|
}
|
|
6056
|
-
set(_data, _isTemp) {}
|
|
6057
|
-
get(_name) {
|
|
6058
|
-
return undefined;
|
|
6059
|
-
}
|
|
6060
6066
|
setAttr(name, value) {
|
|
6061
6067
|
this[name] = value;
|
|
6062
6068
|
}
|
|
@@ -6073,37 +6079,10 @@ var LeaferUI = function(exports) {
|
|
|
6073
6079
|
toString(options) {
|
|
6074
6080
|
return JSON.stringify(this.toJSON(options));
|
|
6075
6081
|
}
|
|
6076
|
-
|
|
6077
|
-
|
|
6078
|
-
|
|
6079
|
-
__SVG(_data) {}
|
|
6080
|
-
toHTML() {
|
|
6081
|
-
return undefined;
|
|
6082
|
-
}
|
|
6083
|
-
__setAttr(_attrName, _newValue) {
|
|
6084
|
-
return true;
|
|
6085
|
-
}
|
|
6086
|
-
__getAttr(_attrName) {
|
|
6087
|
-
return undefined;
|
|
6088
|
-
}
|
|
6089
|
-
setProxyAttr(_attrName, _newValue) {}
|
|
6090
|
-
getProxyAttr(_attrName) {
|
|
6091
|
-
return undefined;
|
|
6092
|
-
}
|
|
6093
|
-
find(_condition, _options) {
|
|
6094
|
-
return undefined;
|
|
6095
|
-
}
|
|
6096
|
-
findTag(_tag) {
|
|
6097
|
-
return undefined;
|
|
6098
|
-
}
|
|
6099
|
-
findOne(_condition, _options) {
|
|
6100
|
-
return undefined;
|
|
6101
|
-
}
|
|
6102
|
-
findId(_id) {
|
|
6103
|
-
return undefined;
|
|
6082
|
+
scaleResize(scaleX, scaleY = scaleX, _noResize, _boundsType) {
|
|
6083
|
+
this.scaleX *= scaleX;
|
|
6084
|
+
this.scaleY *= scaleY;
|
|
6104
6085
|
}
|
|
6105
|
-
focus(_value) {}
|
|
6106
|
-
updateState() {}
|
|
6107
6086
|
updateLayout() {
|
|
6108
6087
|
this.__layout.update();
|
|
6109
6088
|
}
|
|
@@ -6119,27 +6098,6 @@ var LeaferUI = function(exports) {
|
|
|
6119
6098
|
__extraUpdate() {
|
|
6120
6099
|
if (this.leaferIsReady) this.leafer.layouter.addExtra(this);
|
|
6121
6100
|
}
|
|
6122
|
-
__updateWorldMatrix() {}
|
|
6123
|
-
__updateLocalMatrix() {}
|
|
6124
|
-
__updateWorldBounds() {}
|
|
6125
|
-
__updateLocalBounds() {}
|
|
6126
|
-
__updateLocalBoxBounds() {}
|
|
6127
|
-
__updateLocalStrokeBounds() {}
|
|
6128
|
-
__updateLocalRenderBounds() {}
|
|
6129
|
-
__updateBoxBounds(_secondLayout, _bounds) {}
|
|
6130
|
-
__updateContentBounds() {}
|
|
6131
|
-
__updateStrokeBounds(_bounds) {}
|
|
6132
|
-
__updateRenderBounds(_bounds) {}
|
|
6133
|
-
__updateAutoLayout() {}
|
|
6134
|
-
__updateFlowLayout() {}
|
|
6135
|
-
__updateNaturalSize() {}
|
|
6136
|
-
__updateStrokeSpread() {
|
|
6137
|
-
return 0;
|
|
6138
|
-
}
|
|
6139
|
-
__updateRenderSpread() {
|
|
6140
|
-
return 0;
|
|
6141
|
-
}
|
|
6142
|
-
__onUpdateSize() {}
|
|
6143
6101
|
__updateEraser(value) {
|
|
6144
6102
|
this.__hasEraser = value ? true : this.children.some(item => item.__.eraser);
|
|
6145
6103
|
}
|
|
@@ -6153,7 +6111,6 @@ var LeaferUI = function(exports) {
|
|
|
6153
6111
|
__updateMask(_value) {
|
|
6154
6112
|
this.__hasMask = this.children.some(item => item.__.mask && item.__.visible && item.__.opacity);
|
|
6155
6113
|
}
|
|
6156
|
-
__renderMask(_canvas, _options) {}
|
|
6157
6114
|
__getNowWorld(options) {
|
|
6158
6115
|
if (options.matrix) {
|
|
6159
6116
|
if (!this.__cameraWorld) this.__cameraWorld = {};
|
|
@@ -6309,76 +6266,12 @@ var LeaferUI = function(exports) {
|
|
|
6309
6266
|
flip(axis, transition) {
|
|
6310
6267
|
transform(this, getFlipTransform(this, axis), false, transition);
|
|
6311
6268
|
}
|
|
6312
|
-
scaleResize(scaleX, scaleY = scaleX, _noResize, _boundsType) {
|
|
6313
|
-
this.scaleX *= scaleX;
|
|
6314
|
-
this.scaleY *= scaleY;
|
|
6315
|
-
}
|
|
6316
|
-
__scaleResize(_scaleX, _scaleY) {}
|
|
6317
|
-
resizeWidth(_width) {}
|
|
6318
|
-
resizeHeight(_height) {}
|
|
6319
|
-
hit(_world, _hitRadius) {
|
|
6320
|
-
return true;
|
|
6321
|
-
}
|
|
6322
|
-
__hitWorld(_point, _forceHitFill) {
|
|
6323
|
-
return true;
|
|
6324
|
-
}
|
|
6325
|
-
__hit(_local, _forceHitFill) {
|
|
6326
|
-
return true;
|
|
6327
|
-
}
|
|
6328
|
-
__hitFill(_inner) {
|
|
6329
|
-
return true;
|
|
6330
|
-
}
|
|
6331
|
-
__hitStroke(_inner, _strokeWidth) {
|
|
6332
|
-
return true;
|
|
6333
|
-
}
|
|
6334
|
-
__hitPixel(_inner) {
|
|
6335
|
-
return true;
|
|
6336
|
-
}
|
|
6337
|
-
__drawHitPath(_canvas) {}
|
|
6338
|
-
__updateHitCanvas() {}
|
|
6339
|
-
__render(_canvas, _options) {}
|
|
6340
|
-
__drawFast(_canvas, _options) {}
|
|
6341
|
-
__draw(_canvas, _options, _originCanvas) {}
|
|
6342
|
-
__clip(_canvas, _options) {}
|
|
6343
|
-
__renderShape(_canvas, _options) {}
|
|
6344
|
-
__drawShape(_canvas, _options) {}
|
|
6345
|
-
__updateWorldOpacity() {}
|
|
6346
|
-
__updateChange() {}
|
|
6347
|
-
__drawPath(_canvas) {}
|
|
6348
|
-
__drawRenderPath(_canvas) {}
|
|
6349
|
-
__updatePath() {}
|
|
6350
|
-
__updateRenderPath(_updateCache) {}
|
|
6351
|
-
getMotionPathData() {
|
|
6352
|
-
return Plugin.need("path");
|
|
6353
|
-
}
|
|
6354
|
-
getMotionPoint(_motionDistance) {
|
|
6355
|
-
return Plugin.need("path");
|
|
6356
|
-
}
|
|
6357
|
-
getMotionTotal() {
|
|
6358
|
-
return 0;
|
|
6359
|
-
}
|
|
6360
|
-
__updateMotionPath() {}
|
|
6361
|
-
__runAnimation(_type, _complete) {}
|
|
6362
|
-
__updateSortChildren() {}
|
|
6363
|
-
add(_child, _index) {}
|
|
6364
6269
|
remove(_child, destroy) {
|
|
6365
6270
|
if (this.parent) this.parent.remove(this, destroy);
|
|
6366
6271
|
}
|
|
6367
6272
|
dropTo(parent, index, resize) {
|
|
6368
6273
|
drop(this, parent, index, resize);
|
|
6369
6274
|
}
|
|
6370
|
-
on(_type, _listener, _options) {}
|
|
6371
|
-
off(_type, _listener, _options) {}
|
|
6372
|
-
on_(_type, _listener, _bind, _options) {
|
|
6373
|
-
return undefined;
|
|
6374
|
-
}
|
|
6375
|
-
off_(_id) {}
|
|
6376
|
-
once(_type, _listener, _captureOrBind, _capture) {}
|
|
6377
|
-
emit(_type, _event, _capture) {}
|
|
6378
|
-
emitEvent(_event, _capture) {}
|
|
6379
|
-
hasEvent(_type, _capture) {
|
|
6380
|
-
return false;
|
|
6381
|
-
}
|
|
6382
6275
|
static changeAttr(attrName, defaultValue, fn) {
|
|
6383
6276
|
fn ? this.addAttr(attrName, defaultValue, fn) : defineDataProcessor(this.prototype, attrName, defaultValue);
|
|
6384
6277
|
}
|
|
@@ -6674,7 +6567,7 @@ var LeaferUI = function(exports) {
|
|
|
6674
6567
|
this.levelMap = null;
|
|
6675
6568
|
}
|
|
6676
6569
|
}
|
|
6677
|
-
const version = "2.1.
|
|
6570
|
+
const version = "2.1.6";
|
|
6678
6571
|
const debug$4 = Debug.get("LeaferCanvas");
|
|
6679
6572
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6680
6573
|
set zIndex(zIndex) {
|
|
@@ -8079,17 +7972,12 @@ var LeaferUI = function(exports) {
|
|
|
8079
7972
|
if (!path) this.__drawPathByBox(pen);
|
|
8080
7973
|
return pen;
|
|
8081
7974
|
}
|
|
8082
|
-
reset(_data) {}
|
|
8083
7975
|
set(data, _transition) {
|
|
8084
7976
|
if (data) Object.assign(this, data);
|
|
8085
7977
|
}
|
|
8086
7978
|
get(name) {
|
|
8087
7979
|
return isString(name) ? this.__.__getInput(name) : this.__.__getInputData(name);
|
|
8088
7980
|
}
|
|
8089
|
-
createProxyData() {
|
|
8090
|
-
return undefined;
|
|
8091
|
-
}
|
|
8092
|
-
clearProxyData() {}
|
|
8093
7981
|
find(_condition, _options) {
|
|
8094
7982
|
return Plugin.need("find");
|
|
8095
7983
|
}
|
|
@@ -8127,6 +8015,7 @@ var LeaferUI = function(exports) {
|
|
|
8127
8015
|
data.lazy && !this.__inLazyBounds && !Export.running ? data.__needComputePaint = true : data.__computePaint();
|
|
8128
8016
|
}
|
|
8129
8017
|
}
|
|
8018
|
+
__updatePath() {}
|
|
8130
8019
|
__updateRenderPath(updateCache) {
|
|
8131
8020
|
const data = this.__;
|
|
8132
8021
|
if (data.path) {
|
|
@@ -8162,7 +8051,6 @@ var LeaferUI = function(exports) {
|
|
|
8162
8051
|
this.set(keyframe);
|
|
8163
8052
|
return Plugin.need("animate");
|
|
8164
8053
|
}
|
|
8165
|
-
killAnimate(_type, _nextStyle) {}
|
|
8166
8054
|
export(_filename, _options) {
|
|
8167
8055
|
return Plugin.need("export");
|
|
8168
8056
|
}
|
|
@@ -8265,7 +8153,6 @@ var LeaferUI = function(exports) {
|
|
|
8265
8153
|
__decorate([ surfaceType() ], exports.UI.prototype, "placeholderColor", void 0);
|
|
8266
8154
|
__decorate([ dataType(100) ], exports.UI.prototype, "placeholderDelay", void 0);
|
|
8267
8155
|
__decorate([ dataType({}) ], exports.UI.prototype, "data", void 0);
|
|
8268
|
-
__decorate([ rewrite(exports.Leaf.prototype.reset) ], exports.UI.prototype, "reset", null);
|
|
8269
8156
|
exports.UI = UI_1 = __decorate([ useModule(UIBounds), useModule(UIRender), rewriteAble() ], exports.UI);
|
|
8270
8157
|
exports.Group = class Group extends exports.UI {
|
|
8271
8158
|
get __tag() {
|
|
@@ -8301,9 +8188,6 @@ var LeaferUI = function(exports) {
|
|
|
8301
8188
|
}
|
|
8302
8189
|
return data;
|
|
8303
8190
|
}
|
|
8304
|
-
pick(_hitPoint, _options) {
|
|
8305
|
-
return undefined;
|
|
8306
|
-
}
|
|
8307
8191
|
addAt(child, index) {
|
|
8308
8192
|
this.add(child, index);
|
|
8309
8193
|
}
|
|
@@ -8313,11 +8197,6 @@ var LeaferUI = function(exports) {
|
|
|
8313
8197
|
addBefore(child, before) {
|
|
8314
8198
|
this.add(child, this.children.indexOf(before));
|
|
8315
8199
|
}
|
|
8316
|
-
add(_child, _index) {}
|
|
8317
|
-
addMany(..._children) {}
|
|
8318
|
-
remove(_child, _destroy) {}
|
|
8319
|
-
removeAll(_destroy) {}
|
|
8320
|
-
clear() {}
|
|
8321
8200
|
};
|
|
8322
8201
|
__decorate([ dataProcessor(GroupData) ], exports.Group.prototype, "__", void 0);
|
|
8323
8202
|
__decorate([ boundsType(0) ], exports.Group.prototype, "width", void 0);
|
|
@@ -9171,51 +9050,6 @@ var LeaferUI = function(exports) {
|
|
|
9171
9050
|
this.add(path);
|
|
9172
9051
|
return this;
|
|
9173
9052
|
}
|
|
9174
|
-
beginPath() {
|
|
9175
|
-
return this;
|
|
9176
|
-
}
|
|
9177
|
-
moveTo(_x, _y) {
|
|
9178
|
-
return this;
|
|
9179
|
-
}
|
|
9180
|
-
lineTo(_x, _y) {
|
|
9181
|
-
return this;
|
|
9182
|
-
}
|
|
9183
|
-
bezierCurveTo(_x1, _y1, _x2, _y2, _x, _y) {
|
|
9184
|
-
return this;
|
|
9185
|
-
}
|
|
9186
|
-
quadraticCurveTo(_x1, _y1, _x, _y) {
|
|
9187
|
-
return this;
|
|
9188
|
-
}
|
|
9189
|
-
closePath() {
|
|
9190
|
-
return this;
|
|
9191
|
-
}
|
|
9192
|
-
rect(_x, _y, _width, _height) {
|
|
9193
|
-
return this;
|
|
9194
|
-
}
|
|
9195
|
-
roundRect(_x, _y, _width, _height, _cornerRadius) {
|
|
9196
|
-
return this;
|
|
9197
|
-
}
|
|
9198
|
-
ellipse(_x, _y, _radiusX, _radiusY, _rotation, _startAngle, _endAngle, _anticlockwise) {
|
|
9199
|
-
return this;
|
|
9200
|
-
}
|
|
9201
|
-
arc(_x, _y, _radius, _startAngle, _endAngle, _anticlockwise) {
|
|
9202
|
-
return this;
|
|
9203
|
-
}
|
|
9204
|
-
arcTo(_x1, _y1, _x2, _y2, _radius) {
|
|
9205
|
-
return this;
|
|
9206
|
-
}
|
|
9207
|
-
drawEllipse(_x, _y, _radiusX, _radiusY, _rotation, _startAngle, _endAngle, _anticlockwise) {
|
|
9208
|
-
return this;
|
|
9209
|
-
}
|
|
9210
|
-
drawArc(_x, _y, _radius, _startAngle, _endAngle, _anticlockwise) {
|
|
9211
|
-
return this;
|
|
9212
|
-
}
|
|
9213
|
-
drawPoints(_points, _curve, _close) {
|
|
9214
|
-
return this;
|
|
9215
|
-
}
|
|
9216
|
-
clearPath() {
|
|
9217
|
-
return this;
|
|
9218
|
-
}
|
|
9219
9053
|
paint() {
|
|
9220
9054
|
const {pathElement: pathElement} = this;
|
|
9221
9055
|
if (!pathElement.__layout.boxChanged) pathElement.forceUpdate("path");
|
|
@@ -9651,7 +9485,7 @@ var LeaferUI = function(exports) {
|
|
|
9651
9485
|
needUpdate = false;
|
|
9652
9486
|
}
|
|
9653
9487
|
}
|
|
9654
|
-
if (paint.mode === "brush") PaintImage.brush(leafPaint, ui);
|
|
9488
|
+
if (paint.mode === "brush") PaintImage.brush(leafPaint, ui, attrName);
|
|
9655
9489
|
if (!leafPaint.data) {
|
|
9656
9490
|
PaintImage.createData(leafPaint, image, paint, boxBounds);
|
|
9657
9491
|
const {transform: transform} = leafPaint.data, {opacity: opacity} = paint;
|
|
@@ -9735,8 +9569,9 @@ var LeaferUI = function(exports) {
|
|
|
9735
9569
|
break;
|
|
9736
9570
|
|
|
9737
9571
|
case "repeat":
|
|
9738
|
-
case "brush":
|
|
9739
9572
|
if (!sameBox || scaleX || rotation || skew) PaintImage.repeatMode(data, box, width, height, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, align, paint.freeTransform);
|
|
9573
|
+
|
|
9574
|
+
case "brush":
|
|
9740
9575
|
if (!repeat) data.repeat = "repeat";
|
|
9741
9576
|
const count = isObject(repeat);
|
|
9742
9577
|
if (gap || count) data.gap = getGapData(gap, count && repeat, tempImage.width, tempImage.height, box);
|
|
@@ -9747,7 +9582,7 @@ var LeaferUI = function(exports) {
|
|
|
9747
9582
|
default:
|
|
9748
9583
|
if (scaleX) PaintImage.fillOrFitMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
9749
9584
|
}
|
|
9750
|
-
if (!data.transform) {
|
|
9585
|
+
if (!data.transform && mode !== "brush") {
|
|
9751
9586
|
if (box.x || box.y) translate$1(data.transform = get$3(), box.x, box.y);
|
|
9752
9587
|
}
|
|
9753
9588
|
if (scaleX) {
|
|
@@ -9863,8 +9698,9 @@ var LeaferUI = function(exports) {
|
|
|
9863
9698
|
let {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions), id = paint.film ? paint.nowIndex : scaleX + "-" + scaleY;
|
|
9864
9699
|
if (paint.patternId !== id && !ui.destroyed) {
|
|
9865
9700
|
if (!(Platform.image.isLarge(paint.image, scaleX, scaleY) && !paint.data.repeat)) {
|
|
9866
|
-
const {image: image, brush: brush, data: data} = paint, {
|
|
9867
|
-
let imageMatrix, xGap, yGap, {width: width, height: height} = image;
|
|
9701
|
+
const {image: image, brush: brush, data: data} = paint, {transform: transform, gap: gap} = data, fixScale = PaintImage.getPatternFixScale(paint, scaleX, scaleY);
|
|
9702
|
+
let imageMatrix, xGap, yGap, {width: width, height: height} = image, {opacity: opacity} = paint.originPaint;
|
|
9703
|
+
if (brush || opacity === 1) opacity = undefined;
|
|
9868
9704
|
if (fixScale) scaleX *= fixScale, scaleY *= fixScale;
|
|
9869
9705
|
width *= scaleX;
|
|
9870
9706
|
height *= scaleY;
|
package/dist/web.min.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e,t=require("@leafer/core"),i=require("@leafer-ui/draw");function n(e,t,i,n){return new(i||(i=Promise))(function(a,s){function r(e){try{l(n.next(e))}catch(e){s(e)}}function o(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(r,o)}l((n=n.apply(e,t||[])).next())})}exports.PathNodeHandleType=void 0,(e=exports.PathNodeHandleType||(exports.PathNodeHandleType={}))[e.none=1]="none",e[e.free=2]="free",e[e.mirrorAngle=3]="mirrorAngle",e[e.mirror=4]="mirror","function"==typeof SuppressedError&&SuppressedError;const a=t.Debug.get("LeaferCanvas");class s extends t.LeaferCanvasBase{set zIndex(e){const{style:t}=this.view;t.zIndex=e,this.setAbsolute(this.view)}set childIndex(e){const{view:t,parentView:i}=this;if(t&&i){const n=i.children[e];n?(this.setAbsolute(n),i.insertBefore(t,n)):i.appendChild(n)}}init(){const{config:e}=this,i=e.view||e.canvas;i?this.__createViewFrom(i):this.__createView();const{style:n}=this.view;if(n.display||(n.display="block"),this.parentView=this.view.parentElement,this.parentView){const e=this.parentView.style;e.webkitUserSelect=e.userSelect="none",this.view.classList.add("leafer-canvas-view")}t.Platform.syncDomFont&&!this.parentView&&(n.display="none",document.body&&document.body.appendChild(this.view)),this.__createContext(),this.autoLayout||this.resize(e)}set backgroundColor(e){this.view.style.backgroundColor=e}get backgroundColor(){return this.view.style.backgroundColor}set hittable(e){this.view.style.pointerEvents=e?"auto":"none"}get hittable(){return"none"!==this.view.style.pointerEvents}__createView(){this.view=document.createElement("canvas")}__createViewFrom(e){let i=t.isString(e)?document.getElementById(e):e;if(i)if(i instanceof HTMLCanvasElement)this.view=i;else{let e=i;if(i===window||i===document){const t=document.createElement("div"),{style:i}=t;i.position="absolute",i.top=i.bottom=i.left=i.right="0px",document.body.appendChild(t),e=t}this.__createView();const t=this.view;e.hasChildNodes()&&(this.setAbsolute(t),e.style.position||(e.style.position="relative")),e.appendChild(t)}else a.error(`no id: ${e}`),this.__createView()}setAbsolute(e){const{style:t}=e;t.position="absolute",t.top=t.left="0px"}updateViewSize(){const{width:e,height:t,pixelRatio:i}=this,{style:n}=this.view;n.width=e+"px",n.height=t+"px",this.unreal||(this.view.width=Math.ceil(e*i),this.view.height=Math.ceil(t*i))}updateClientBounds(){this.view.parentElement&&(this.clientBounds=this.view.getBoundingClientRect())}startAutoLayout(e,t){if(this.resizeListener=t,e){if(this.autoBounds=e,this.resizeObserver)return;try{this.resizeObserver=new ResizeObserver(e=>{this.updateClientBounds();for(const t of e)this.checkAutoBounds(t.contentRect)});const e=this.parentView;e?(this.resizeObserver.observe(e),this.checkAutoBounds(e.getBoundingClientRect())):(this.checkAutoBounds(this.view),a.warn("no parent"))}catch(e){this.imitateResizeObserver()}this.stopListenPixelRatio()}else this.listenPixelRatio(),this.unreal&&this.updateViewSize()}imitateResizeObserver(){this.autoLayout&&(this.parentView&&this.checkAutoBounds(this.parentView.getBoundingClientRect()),t.Platform.requestRender(this.imitateResizeObserver.bind(this)))}listenPixelRatio(){this.windowListener||window.addEventListener("resize",this.windowListener=()=>{const e=t.Platform.devicePixelRatio;if(!this.config.pixelRatio&&this.pixelRatio!==e){const{width:t,height:i}=this;this.emitResize({width:t,height:i,pixelRatio:e})}})}stopListenPixelRatio(){this.windowListener&&(window.removeEventListener("resize",this.windowListener),this.windowListener=null)}checkAutoBounds(e){const i=this.view,{x:n,y:a,width:s,height:r}=this.autoBounds.getBoundsFrom(e),o={width:s,height:r,pixelRatio:this.config.pixelRatio?this.pixelRatio:t.Platform.devicePixelRatio};if(!this.isSameSize(o)){const{style:e}=i;e.marginLeft=n+"px",e.marginTop=a+"px",this.emitResize(o)}}stopAutoLayout(){this.autoLayout=!1,this.resizeObserver&&this.resizeObserver.disconnect(),this.resizeListener=this.resizeObserver=null}emitResize(e){const i={};t.DataHelper.copyAttrs(i,this,t.canvasSizeAttrs),this.resize(e),this.resizeListener&&!t.isUndefined(this.width)&&this.resizeListener(new t.ResizeEvent(e,i))}unrealCanvas(){if(!this.unreal&&this.parentView){let e=this.view;e&&e.remove(),e=this.view=document.createElement("div"),this.parentView.appendChild(this.view),e.classList.add("leafer-app-view"),this.unreal=!0}}destroy(){const{view:e}=this;e&&(this.stopAutoLayout(),this.stopListenPixelRatio(),e.parentElement&&e.remove(),super.destroy())}}function r(e,i){t.Platform.origin={createCanvas(e,t){const i=document.createElement("canvas");return i.width=e,i.height=t,i},canvasToDataURL:(e,i,n)=>{const a=t.FileHelper.mimeType(i),s=e.toDataURL(a,n);return"image/bmp"===a?s.replace("image/png;","image/bmp;"):s},canvasToBolb:(e,i,n)=>new Promise(a=>e.toBlob(a,t.FileHelper.mimeType(i),n)),canvasSaveAs:(e,i,n)=>{const a=e.toDataURL(t.FileHelper.mimeType(t.FileHelper.fileType(i)),n);return t.Platform.origin.download(a,i)},download(e,t){return n(this,void 0,void 0,function*(){let i=document.createElement("a");i.href=e,i.download=t,document.body.appendChild(i),i.click(),document.body.removeChild(i)})},loadImage:(e,i,n)=>new Promise((n,a)=>{const s=new t.Platform.origin.Image;i&&(s.setAttribute("crossOrigin",i),s.crossOrigin=i),s.onload=()=>{n(s)},s.onerror=e=>{a(e)},s.src=t.Platform.image.getRealURL(e)}),loadContent(e){return n(this,arguments,void 0,function*(e,t="text"){const i=yield fetch(e);if(!i.ok)throw new Error(`${i.status}`);return yield i[t]()})},Image:Image,PointerEvent:PointerEvent,DragEvent:DragEvent},t.Platform.event={stopDefault(e){e.preventDefault()},stopNow(e){e.stopImmediatePropagation()},stop(e){e.stopPropagation()}},t.Platform.canvas=t.Creator.canvas(),t.Platform.conicGradientSupport=!!t.Platform.canvas.context.createConicGradient}t.canvasPatch(CanvasRenderingContext2D.prototype),t.canvasPatch(Path2D.prototype),Object.assign(t.Creator,{canvas:(e,t)=>new s(e,t),image:e=>new t.LeaferImage(e)}),t.Platform.name="web",t.Platform.isMobile="ontouchstart"in window,t.Platform.requestRender=function(e){window.requestAnimationFrame(e)},t.defineKey(t.Platform,"devicePixelRatio",{get:()=>devicePixelRatio});const{userAgent:o}=navigator;o.indexOf("Firefox")>-1?(t.Platform.intWheelDeltaY=!0,t.Platform.syncDomFont=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(t.Platform.fullImageShadow=!0),o.indexOf("Windows")>-1?(t.Platform.os="Windows",t.Platform.intWheelDeltaY=!0):o.indexOf("Mac")>-1?t.Platform.os="Mac":o.indexOf("Linux")>-1&&(t.Platform.os="Linux");class l{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove&&this.config.usePartLayout){const e=new t.LeafList;return this.__updatedList.list.forEach(t=>{t.leafer&&e.add(t)}),e}return this.__updatedList}constructor(e,i){this.totalTimes=0,this.config={},this.__updatedList=new t.LeafList,this.target=e,i&&(this.config=t.DataHelper.default(i,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(t.RenderEvent.REQUEST)}__onAttrChange(e){this.config.usePartLayout&&this.__updatedList.add(e.target),this.update()}__onChildEvent(e){this.config.usePartLayout&&(e.type===t.ChildEvent.ADD?(this.hasAdd=!0,this.__pushChild(e.child)):(this.hasRemove=!0,this.__updatedList.add(e.parent))),this.update()}__pushChild(e){this.__updatedList.add(e),e.isBranch&&this.__loopChildren(e)}__loopChildren(e){const{children:t}=e;for(let e=0,i=t.length;e<i;e++)this.__pushChild(t[e])}__onRquestData(){this.target.emitEvent(new t.WatchEvent(t.WatchEvent.DATA,{updatedList:this.updatedList})),this.__updatedList=new t.LeafList,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[t.PropertyEvent.CHANGE,this.__onAttrChange,this],[[t.ChildEvent.ADD,t.ChildEvent.REMOVE],this.__onChildEvent,this],[t.WatchEvent.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:d,updateBounds:c,updateChange:h}=t.LeafHelper,{pushAllChildBranch:u,pushAllParent:f}=t.BranchHelper;const{worldBounds:p}=t.LeafBoundsHelper;class g{constructor(e){this.updatedBounds=new t.Bounds,this.beforeBounds=new t.Bounds,this.afterBounds=new t.Bounds,t.isArray(e)&&(e=new t.LeafList(e)),this.updatedList=e}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,p)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,p),this.updatedBounds.setList([this.beforeBounds,this.afterBounds])}merge(e){this.updatedList.addList(e.updatedList.list),this.beforeBounds.add(e.beforeBounds),this.afterBounds.add(e.afterBounds),this.updatedBounds.add(e.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllMatrix:m,updateAllChange:_}=t.LeafHelper,w=t.Debug.get("Layouter");class y{constructor(e,i){this.totalTimes=0,this.config={usePartLayout:!0},this.__levelList=new t.LeafLevelList,this.target=e,i&&(this.config=t.DataHelper.default(i,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(this.layouting||!this.running)return;const{target:e}=this;this.times=0;try{e.emit(t.LayoutEvent.START),this.layoutOnce(),e.emitEvent(new t.LayoutEvent(t.LayoutEvent.END,this.layoutedBlocks,this.times))}catch(e){w.error(e)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?w.warn("layouting"):this.times>3?w.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(t.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 e;if(!(null===(e=this.__updatedList)||void 0===e?void 0:e.length))return;const i=t.Run.start("PartLayout"),{target:n,__updatedList:a}=this,{BEFORE:s,LAYOUT:r,AFTER:o}=t.LayoutEvent,l=this.getBlocks(a);l.forEach(e=>e.setBefore()),n.emitEvent(new t.LayoutEvent(s,l,this.times)),this.extraBlock=null,a.sort(),function(e,t){let i;e.list.forEach(e=>{i=e.__layout,t.without(e)&&!i.proxyZoom&&(i.matrixChanged?(d(e,!0),t.add(e),e.isBranch&&u(e,t),f(e,t)):i.boundsChanged&&(t.add(e),e.isBranch&&(e.__tempNumber=0),f(e,t)))})}(a,this.__levelList),function(e){let t,i,n;e.sort(!0),e.levels.forEach(a=>{t=e.levelMap[a];for(let e=0,a=t.length;e<a;e++){if(i=t[e],i.isBranch&&i.__tempNumber){n=i.children;for(let e=0,t=n.length;e<t;e++)n[e].isBranch||c(n[e])}c(i)}})}(this.__levelList),function(e){e.list.forEach(h)}(a),this.extraBlock&&l.push(this.extraBlock),l.forEach(e=>e.setAfter()),n.emitEvent(new t.LayoutEvent(r,l,this.times)),n.emitEvent(new t.LayoutEvent(o,l,this.times)),this.addBlocks(l),this.__levelList.reset(),this.__updatedList=null,t.Run.end(i)}fullLayout(){const e=t.Run.start("FullLayout"),{target:i}=this,{BEFORE:n,LAYOUT:a,AFTER:s}=t.LayoutEvent,r=this.getBlocks(new t.LeafList(i));i.emitEvent(new t.LayoutEvent(n,r,this.times)),y.fullLayout(i),r.forEach(e=>{e.setAfter()}),i.emitEvent(new t.LayoutEvent(a,r,this.times)),i.emitEvent(new t.LayoutEvent(s,r,this.times)),this.addBlocks(r),t.Run.end(e)}static fullLayout(e){m(e,!0),e.isBranch?t.BranchHelper.updateBounds(e):t.LeafHelper.updateBounds(e),_(e)}addExtra(e){if(!this.__updatedList.has(e)){const{updatedList:t,beforeBounds:i}=this.extraBlock||(this.extraBlock=new g([]));t.length?i.add(e.__world):i.set(e.__world),t.add(e)}}createBlock(e){return new g(e)}getBlocks(e){return[this.createBlock(e)]}addBlocks(e){this.layoutedBlocks?this.layoutedBlocks.push(...e):this.layoutedBlocks=e}__onReceiveWatchData(e){this.__updatedList=e.data.updatedList}__listenEvents(){this.__eventIds=[this.target.on_([[t.LayoutEvent.REQUEST,this.layout,this],[t.LayoutEvent.AGAIN,this.layoutAgain,this],[t.WatchEvent.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const v=t.Debug.get("Renderer");class x{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(e,i,n){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,ceilPartPixel:!0,maxFPS:120},this.frames=[],this.target=e,this.canvas=i,n&&(this.config=t.DataHelper.default(n,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(e=!0){this.changed||(this.changed=e),this.requestTime||this.__requestRender()}requestLayout(){this.target.emit(t.LayoutEvent.REQUEST)}checkRender(){if(this.running){const{target:e}=this;e.isApp&&(e.emit(t.RenderEvent.CHILD_START,e),e.children.forEach(e=>{e.renderer.FPS=this.FPS,e.renderer.checkRender()}),e.emit(t.RenderEvent.CHILD_END,e)),this.changed&&this.canvas.view&&this.render(),this.target.emit(t.RenderEvent.NEXT)}}render(e){if(!this.running||!this.canvas.view)return this.update();const{target:i}=this;this.times=0,this.totalBounds=new t.Bounds,v.log(i.innerName,"---\x3e");try{this.emitRender(t.RenderEvent.START),this.renderOnce(e),this.emitRender(t.RenderEvent.END,this.totalBounds),t.ImageManager.clearRecycled()}catch(e){this.rendering=!1,v.error(e)}v.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(e){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 t.Bounds,this.renderOptions={},e)this.emitRender(t.RenderEvent.BEFORE),e();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(t.RenderEvent.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(t.RenderEvent.RENDER,this.renderBounds,this.renderOptions),this.emitRender(t.RenderEvent.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,this.waitAgain&&(this.waitAgain=!1,this.renderOnce())}partRender(){const{canvas:e,updateBlocks:t}=this;t&&(this.mergeBlocks(),t.forEach(t=>{e.bounds.hit(t)&&!t.isEmpty()&&this.clipRender(t)}))}clipRender(e){const i=t.Run.start("PartRender"),{canvas:n}=this,a=e.getIntersect(n.bounds),s=new t.Bounds(a);n.save(),a.spread(x.clipSpread).ceil();const{ceilPartPixel:r}=this.config;n.clipWorld(a,r),n.clearWorld(a,r),this.__render(a,s),n.restore(),t.Run.end(i)}fullRender(){const e=t.Run.start("FullRender"),{canvas:i}=this;i.save(),i.clear(),this.__render(i.bounds),i.restore(),t.Run.end(e)}__render(e,i){const{canvas:n,target:a}=this,s=e.includes(a.__world),r=s?{includes:s}:{bounds:e,includes:s};this.needFill&&n.fillWorld(e,this.config.fill),t.Debug.showRepaint&&t.Debug.drawRepaint(n,e),this.config.useCellRender&&(r.cellList=this.getCellList()),t.Platform.render(a,n,r),this.renderBounds=i=i||e,this.renderOptions=r,this.totalBounds.isEmpty()?this.totalBounds=i:this.totalBounds.add(i),n.updateRender(i)}getCellList(){}addBlock(e,t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(e)}mergeBlocks(){const{updateBlocks:e}=this;if(e){const i=new t.Bounds;i.setList(e),e.length=0,e.push(i)}}__requestRender(){const e=this.target;if(this.requestTime||!e)return;if(e.parentApp)return e.parentApp.requestRender(!1);this.requestTime=this.frameTime||Date.now();const i=()=>{const e=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:n}=this.config;if(n&&e>n)return t.Platform.requestRender(i);const{frames:a}=this;a.length>30&&a.shift(),a.push(e),this.FPS=Math.round(a.reduce((e,t)=>e+t,0)/a.length),this.requestTime=0,this.checkRender()};t.Platform.requestRender(i)}__onResize(e){if(!this.canvas.unreal){if(e.bigger||!e.samePixelRatio){const{width:i,height:n}=e.old;if(!new t.Bounds(0,0,i,n).includes(this.target.__world)||this.needFill||!e.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new t.Bounds(0,0,1,1)),this.update()}}__onLayoutEnd(e){e.data&&e.data.map(e=>{let t;const{updatedList:i}=e;i&&i.list.some(e=>(t=!e.__world.width||!e.__world.height,t&&(e.isLeafer||v.tip(e.innerName,": empty"),t=!e.isBranch||e.isBranchLeaf),t)),this.addBlock(t?this.canvas.bounds:e.updatedBounds,i)})}emitRender(e,i,n){this.target.emitEvent(new t.RenderEvent(e,this.times,i,n))}__listenEvents(){this.__eventIds=[this.target.on_([[t.RenderEvent.REQUEST,this.update,this],[t.LayoutEvent.END,this.__onLayoutEnd,this],[t.RenderEvent.AGAIN,this.renderAgain,this],[t.ResizeEvent.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}function b(e,t,n){e.__.__font?i.Paint.fillText(e,t,n):e.__.windingRule?t.fill(e.__.windingRule):t.fill()}function P(e,n,a,s,r){const o=a.__;t.isObject(e)?i.Paint.drawStrokesStyle(e,n,!1,a,s,r):(s.setStroke(e,o.__strokeWidth*n,o),s.stroke()),o.__useArrow&&i.Paint.strokeArrow(e,a,s,r)}function E(e,n,a,s,r){const o=a.__;t.isObject(e)?i.Paint.drawStrokesStyle(e,n,!0,a,s,r):(s.setStroke(e,o.__strokeWidth*n,o),i.Paint.drawTextStroke(a,s,r))}function L(e,n,a,s,r){const o=s.getSameCanvas(!0,!0);o.font=a.__.__font,E(e,2,a,o,r),o.blendMode="outside"===n?"destination-out":"destination-in",i.Paint.fillText(a,o,r),o.blendMode="normal",t.LeafHelper.copyCanvasByWorld(a,s,o),o.recycle(a.__nowWorld)}x.clipSpread=10,Object.assign(t.Creator,{watcher:(e,t)=>new l(e,t),layouter:(e,t)=>new y(e,t),renderer:(e,t,i)=>new x(e,t,i),selector:(e,t)=>{},interaction:(e,t,i,n)=>{}}),t.Platform.layout=y.fullLayout,t.Platform.render=function(e,i,n){const a=Object.assign(Object.assign({},n),{topRendering:!0});n.topList=new t.LeafList,e.__render(i,n),n.topList.length&&n.topList.forEach(e=>e.__render(i,a))};const{getSpread:S,copyAndSpread:B,toOuterOf:R,getOuterOf:k,getByMove:C,move:A,getIntersectData:O}=t.BoundsHelper,T={};let I;const{stintSet:M}=t.DataHelper,{hasTransparent:D}=i.ColorConvert;function W(e,n,a){if(!t.isObject(n)||!1===n.visible||0===n.opacity)return;let s;const{boxBounds:r}=a.__layout,{type:o}=n;switch(o){case"image":case"film":case"video":if(!n.url)return;s=i.PaintImage.image(a,e,n,r,!I||!I[n.url]),"image"!==o&&i.PaintImage[o](s);break;case"linear":s=i.PaintGradient.linearGradient(n,r);break;case"radial":s=i.PaintGradient.radialGradient(n,r);break;case"angular":s=i.PaintGradient.conicGradient(n,r);break;case"solid":const{color:l,opacity:d}=n;s={type:o,style:i.ColorConvert.string(l,d)};break;default:t.isUndefined(n.r)||(s={type:"solid",style:i.ColorConvert.string(n)})}if(s&&(s.originPaint=n,t.isString(s.style)&&D(s.style)&&(s.isTransparent=!0),n.style)){if(0===n.style.strokeWidth)return;s.strokeStyle=n.style}return s}const H={compute:function(e,n){const a=n.__,s=[];let r,o,l,d=a.__input[e];t.isArray(d)||(d=[d]),I=i.PaintImage.recycleImage(e,a);for(let t,i=0,a=d.length;i<a;i++)(t=W(e,d[i],n))&&(s.push(t),t.strokeStyle&&(l||(l=1),t.strokeStyle.strokeWidth&&(l=Math.max(l,t.strokeStyle.strokeWidth))));s.length?(a["_"+e]=s,s.every(e=>e.isTransparent)&&(s.some(e=>e.image)&&(r=!0),o=!0),"fill"===e?(M(a,"__isAlphaPixelFill",r),M(a,"__isTransparentFill",o)):(M(a,"__isAlphaPixelStroke",r),M(a,"__isTransparentStroke",o),M(a,"__hasMultiStrokeStyle",l))):(a.__removePaint(e,!1),a["_"+e]="")},fill:function(e,t,i,n){i.fillStyle=e,b(t,i,n)},fills:function(e,t,n,a){let s,r,o;for(let l=0,d=e.length;l<d;l++){if(s=e[l],r=s.originPaint,s.image){if(o?o++:o=1,i.PaintImage.checkImage(s,!t.__.__font,t,n,a))continue;if(!s.style){1===o&&s.image.isPlacehold&&t.drawImagePlaceholder(s,n,a);continue}}if(n.fillStyle=s.style,s.transform||r.scaleFixed){if(n.save(),s.transform&&n.transform(s.transform),r.scaleFixed){const{scaleX:e,scaleY:i}=t.getRenderScaleData(!0,r.scaleFixed,!1);1!==e&&n.scale(e,i)}r.blendMode&&(n.blendMode=r.blendMode),b(t,n,a),n.restore()}else r.blendMode?(n.saveBlendMode(r.blendMode),b(t,n,a),n.restoreBlendMode()):b(t,n,a)}},fillPathOrText:b,fillText:function(e,t,i){const n=e.__,{rows:a,decorationY:s}=n.__textDrawData;let r;n.__isPlacehold&&n.placeholderColor&&(t.fillStyle=n.placeholderColor);for(let e=0,i=a.length;e<i;e++)r=a[e],r.text?t.fillText(r.text,r.x,r.y):r.data&&r.data.forEach(e=>{t.fillText(e.char,e.x,r.y)});if(s){const{decorationColor:e,decorationHeight:i}=n.__textDrawData;e&&(t.fillStyle=e),a.forEach(e=>s.forEach(n=>t.fillRect(e.x,e.y+n,e.width,i)))}},stroke:function(e,n,a,s){const r=n.__;if(r.__strokeWidth)if(r.__font)i.Paint.strokeText(e,n,a,s);else if(r.__pathForStroke)i.Paint.fillStroke(e,n,a,s);else switch(r.strokeAlign){case"center":P(e,1,n,a,s);break;case"inside":!function(e,t,i,n){i.save(),i.clipUI(t),P(e,2,t,i,n),i.restore()}(e,n,a,s);break;case"outside":!function(e,i,n,a){const s=i.__;if(s.__fillAfterStroke)P(e,2,i,n,a);else{const{renderBounds:r}=i.__layout,o=n.getSameCanvas(!0,!0);i.__drawRenderPath(o),P(e,2,i,o,a),o.clipUI(s),o.clearWorld(r),t.LeafHelper.copyCanvasByWorld(i,n,o),o.recycle(i.__nowWorld)}}(e,n,a,s)}},strokes:function(e,t,n,a){i.Paint.stroke(e,t,n,a)},strokeText:function(e,t,i,n){switch(t.__.strokeAlign){case"center":E(e,1,t,i,n);break;case"inside":L(e,"inside",t,i,n);break;case"outside":t.__.__fillAfterStroke?E(e,2,t,i,n):L(e,"outside",t,i,n)}},drawTextStroke:function(e,t,i){let n,a=e.__.__textDrawData;const{rows:s,decorationY:r}=a;for(let e=0,i=s.length;e<i;e++)n=s[e],n.text?t.strokeText(n.text,n.x,n.y):n.data&&n.data.forEach(e=>{t.strokeText(e.char,e.x,n.y)});if(r){const{decorationHeight:e}=a;s.forEach(i=>r.forEach(n=>t.strokeRect(i.x,i.y+n,i.width,e)))}},drawStrokesStyle:function(e,t,n,a,s,r){let o;const l=a.__,{__hasMultiStrokeStyle:d}=l;d||s.setStroke(void 0,l.__strokeWidth*t,l);for(let c=0,h=e.length;c<h;c++)if(o=e[c],(!o.image||!i.PaintImage.checkImage(o,!1,a,s,r))&&o.style){if(d){const{strokeStyle:e}=o;e?s.setStroke(o.style,l.__getRealStrokeWidth(e)*t,l,e):s.setStroke(o.style,l.__strokeWidth*t,l)}else s.strokeStyle=o.style;o.originPaint.blendMode?(s.saveBlendMode(o.originPaint.blendMode),n?i.Paint.drawTextStroke(a,s,r):s.stroke(),s.restoreBlendMode()):n?i.Paint.drawTextStroke(a,s,r):s.stroke()}},shape:function(e,i,n){const a=i.getSameCanvas(),s=i.bounds,r=e.__nowWorld,o=e.__layout,l=e.__nowWorldShapeBounds||(e.__nowWorldShapeBounds={});let d,c,h,u,f,p;R(o.strokeSpread?(B(T,o.boxBounds,o.strokeSpread),T):o.boxBounds,r,l);let{scaleX:g,scaleY:m}=e.getRenderScaleData(!0);if(s.includes(l))p=a,d=f=l,c=r;else{let a;if(t.Platform.fullImageShadow)a=l;else{const e=o.renderShapeSpread?S(s,t.FourNumberHelper.swapAndScale(o.renderShapeSpread,g,m)):s;a=O(e,l)}u=s.getFitMatrix(a);let{a:_,d:w}=u;u.a<1&&(p=i.getSameCanvas(),e.__renderShape(p,n),g*=_,m*=w),f=k(l,u),d=C(f,-u.e,-u.f),c=k(r,u),A(c,-u.e,-u.f);const y=n.matrix;y?(h=new t.Matrix(u),h.multiply(y),_*=y.scaleX,w*=y.scaleY):h=u,h.withScale(_,w),n=Object.assign(Object.assign({},n),{matrix:h})}return e.__renderShape(a,n),{canvas:a,matrix:h,fitMatrix:u,bounds:d,renderBounds:c,worldCanvas:p,shapeBounds:f,scaleX:g,scaleY:m}}};let F,z=new t.Bounds;const{isSame:j}=t.BoundsHelper;function U(e,n,a,s,r,o){let l=!0;const d=e.__;if("fill"!==n||d.__naturalWidth||(d.__naturalWidth=s.width/d.pixelRatio,d.__naturalHeight=s.height/d.pixelRatio,d.__autoSide&&(e.forceUpdate("width"),t.LeafHelper.updateBounds(e),e.__proxyData&&(e.setProxyAttr("width",d.width),e.setProxyAttr("height",d.height)),l=!1)),"brush"===a.mode&&i.PaintImage.brush(r,e),!r.data){i.PaintImage.createData(r,s,a,o);const{transform:e}=r.data,{opacity:t}=a,n=(e&&!e.onlyScale||d.path||d.cornerRadius)&&!r.brush;(n||t&&t<1||a.blendMode)&&(r.complex=!n||2)}return a.filter&&i.PaintImage.applyFilter(r,s,a.filter,e),l}function N(e,i){G(e,t.ImageEvent.LOAD,i)}function V(e,i){G(e,t.ImageEvent.LOADED,i)}function Y(e,i,n){i.error=n,e.forceUpdate("surface"),G(e,t.ImageEvent.ERROR,i)}function G(e,i,n){e.hasEvent(i)&&e.emitEvent(new t.ImageEvent(i,n))}function X(e,t){const{leafer:i}=e;i&&i.viewReady&&(i.renderer.ignore=t)}const{get:q,translate:Q}=t.MatrixHelper,$=new t.Bounds,Z={},K={};function J(e,i,n,a){const s=t.isString(e)||a?(a?n-a*i:n%i)/((a||Math.floor(n/i))-1):e;return"auto"===e&&s<0?0:s}let ee={},te=t.getMatrixData();const{get:ie,set:ne,rotateOfOuter:ae,translate:se,scaleOfOuter:re,multiplyParent:oe,scale:le,rotate:de,skew:ce}=t.MatrixHelper;function he(e,t,i,n,a,s,r,o){r&&de(e,r),o&&ce(e,o.x,o.y),a&&le(e,a,s),se(e,t.x+i,t.y+n)}const{get:ue,scale:fe,copy:pe}=t.MatrixHelper,{getFloorScale:ge}=t.MathHelper,{abs:me}=Math;const _e={image:function(e,i,n,a,s){let r,o;const l=t.ImageManager.get(n,n.type);return F&&n===F.paint&&j(a,F.boxBounds)?r=F.leafPaint:(r={type:n.type,image:l},l.hasAlphaPixel&&(r.isTransparent=!0),F=l.use>1?{leafPaint:r,paint:n,boxBounds:z.set(a)}:null),(s||l.loading)&&(o={image:l,attrName:i,attrValue:n}),l.ready?(U(e,i,n,l,r,a),s&&(N(e,o),V(e,o))):l.error?s&&Y(e,o,l.error):(s&&(X(e,!0),N(e,o)),r.loadId=l.load(()=>{X(e,!1),e.destroyed||(U(e,i,n,l,r,a)&&(l.hasAlphaPixel&&(e.__layout.hitCanvasChanged=!0),e.forceUpdate("surface")),V(e,o)),r.loadId=void 0},t=>{X(e,!1),Y(e,o,t),r.loadId=void 0},n.lod&&l.getThumbSize(n.lod)),e.placeholderColor&&(e.placeholderDelay?setTimeout(()=>{l.ready||(l.isPlacehold=!0,e.forceUpdate("surface"))},e.placeholderDelay):l.isPlacehold=!0)),r},checkImage:function(e,n,a,s,r){const{scaleX:o,scaleY:l}=i.PaintImage.getImageRenderScaleData(e,a,s,r),d=e.film?e.nowIndex:o+"-"+l,{image:c,brush:h,data:u,originPaint:f}=e,{exporting:p,snapshot:g}=r;if(!u||e.patternId===d&&!p||g){if(!h||!e.style)return!1}else if(n&&(u.repeat?n=!1:f.changeful||e.film||"miniapp"===t.Platform.name||p||(n=t.Platform.image.isLarge(c,o,l)||c.width*o>8096||c.height*l>8096)),n)a.__.__isFastShadow&&(s.fillStyle=e.style||"#000",s.fill());else if(!e.style||f.sync||p?i.PaintImage.createPattern(e,a,s,r):i.PaintImage.createPatternTask(e,a,s,r),!h||!e.style)return!1;return i.PaintImage.drawImage(e,o,l,a,s,r),!0},drawImage:function(e,t,i,n,a,s){const{data:r,image:o,brush:l,complex:d}=e;let{width:c,height:h}=o,u=l||o;if(d){const{blendMode:s,opacity:o}=e.originPaint,{transform:l}=r;a.save(),2===d&&a.clipUI(n),s&&(a.blendMode=s),o&&(a.opacity*=o),l&&a.transform(l),u.render(a,0,0,c,h,n,e,t,i),a.restore()}else r.scaleX&&(c*=r.scaleX,h*=r.scaleY),u.render(a,0,0,c,h,n,e,t,i)},getImageRenderScaleData:function(e,t,n,a){const s=t.getRenderScaleData(!0,e.originPaint.scaleFixed),{data:r}=e;if(e.brush&&i.PaintImage.addBrushScale(s,e,t),n){const{pixelRatio:e}=n;s.scaleX*=e,s.scaleY*=e}return r&&r.scaleX&&(s.scaleX*=Math.abs(r.scaleX),s.scaleY*=Math.abs(r.scaleY)),s},recycleImage:function(e,n){const a=n["_"+e];if(t.isArray(a)){let s,r,o,l,d;const c=n.__leaf;for(let h=0,u=a.length;h<u;h++)s=a[h],r=s.image,d=r&&r.url,d&&(o||(o={}),o[d]=!0,t.ImageManager.recyclePaint(s),s.brush&&i.PaintImage.recycleBrush(s,c),n.__willDestroy&&r.parent&&i.PaintImage.recycleFilter(r,c),r.loading&&(l||(l=n.__input&&n.__input[e]||[],t.isArray(l)||(l=[l])),r.unload(a[h].loadId,!l.some(e=>e.url===d))));return o}return null},createPatternTask:function(e,a,s,r){e.patternTask||(e.patternTask=t.ImageManager.patternTasker.add(()=>n(this,void 0,void 0,function*(){i.PaintImage.createPattern(e,a,s,r),a.forceUpdate("surface")}),0,()=>(e.patternTask=null,s.bounds.hit(a.__nowWorld))))},createPattern:function(e,n,a,s){let{scaleX:r,scaleY:o}=i.PaintImage.getImageRenderScaleData(e,n,a,s),l=e.film?e.nowIndex:r+"-"+o;if(e.patternId!==l&&!n.destroyed&&(!t.Platform.image.isLarge(e.image,r,o)||e.data.repeat)){const{image:d,brush:c,data:h}=e,{opacity:u}=e.originPaint,{transform:f,gap:p}=h,g=i.PaintImage.getPatternFixScale(e,r,o);let m,_,w,{width:y,height:v}=d;if(g&&(r*=g,o*=g),y*=r,v*=o,p&&(_=p.x*r/me(h.scaleX||1),w=p.y*o/me(h.scaleY||1),c)){const t=i.PaintImage.getBrushScale(e,n);_/=t,w/=t}(f||1!==r||1!==o)&&(r*=ge(y+(_||0)),o*=ge(v+(w||0)),m=ue(),f&&pe(m,f),fe(m,1/r,1/o));const x=d.getCanvas(y,v,u,void 0,_,w,n.leafer&&n.leafer.config.smooth,h.interlace);c?(e.style=x,i.PaintImage.cacheBrush(e,n,a,s)):e.style=d.getPattern(x,h.repeat||t.Platform.origin.noRepeat||"no-repeat",m,e),e.patternId=l}},getPatternFixScale:function(e,i,n){const{image:a}=e;let s,r=t.Platform.image.maxPatternSize,o=a.width*a.height;return a.isSVG?i>1&&(s=Math.ceil(i)/i):r>o&&(r=o),(o*=i*n)>r&&(s=Math.sqrt(r/o)),s},createData:function(e,t,n,a){e.data=i.PaintImage.getPatternData(n,a,t)},getPatternData:function(e,n,a){e.padding&&(n=$.set(n).shrink(e.padding)),"strench"===e.mode&&(e.mode="stretch");const{width:s,height:r}=a,{mode:o,align:l,offset:d,scale:c,size:h,rotation:u,skew:f,clipSize:p,repeat:g,gap:m,interlace:_}=e,w=n.width===s&&n.height===r,y={mode:o},v="center"!==l&&(u||0)%180==90;let x,b;switch(t.BoundsHelper.set(K,0,0,v?r:s,v?s:r),o&&"cover"!==o&&"fit"!==o?((c||h)&&(t.MathHelper.getScaleData(c,h,a,Z),x=Z.scaleX,b=Z.scaleY),(l||m||g)&&(x&&t.BoundsHelper.scale(K,x,b,!0),l&&t.AlignHelper.toPoint(l,K,n,K,!0,!0))):w&&!u||(x=b=t.BoundsHelper.getFitScale(n,K,"fit"!==o),t.BoundsHelper.put(n,a,l,x,!1,K),t.BoundsHelper.scale(K,x,b,!0)),d&&t.PointHelper.move(K,d),o){case"stretch":w?x&&(x=b=void 0):(x=n.width/s,b=n.height/r,i.PaintImage.stretchMode(y,n,x,b));break;case"normal":case"clip":if(K.x||K.y||x||p||u||f){let e,t;p&&(e=n.width/p.width,t=n.height/p.height),i.PaintImage.clipMode(y,n,K.x,K.y,x,b,u,f,e,t),e&&(x=x?x*e:e,b=b?b*t:t)}break;case"repeat":case"brush":(!w||x||u||f)&&i.PaintImage.repeatMode(y,n,s,r,K.x,K.y,x,b,u,f,l,e.freeTransform),g||(y.repeat="repeat");const a=t.isObject(g);(m||a)&&(y.gap=function(e,i,n,a,s){let r,o;t.isObject(e)?(r=e.x,o=e.y):r=o=e;return{x:J(r,n,s.width,i&&i.x),y:J(o,a,s.height,i&&i.y)}}(m,a&&g,K.width,K.height,n));break;default:x&&i.PaintImage.fillOrFitMode(y,n,K.x,K.y,x,b,u)}return y.transform||(n.x||n.y)&&Q(y.transform=q(),n.x,n.y),x&&(y.scaleX=x,y.scaleY=b),g&&(y.repeat=t.isString(g)?"x"===g?"repeat-x":"repeat-y":"repeat"),_&&(y.interlace=t.isNumber(_)||"percent"===_.type?{type:"x",offset:_}:_),y},stretchMode:function(e,t,i,n){const a=ie(),{x:s,y:r}=t;s||r?se(a,s,r):i>0&&n>0&&(a.onlyScale=!0),le(a,i,n),e.transform=a},fillOrFitMode:function(e,t,i,n,a,s,r){const o=ie();se(o,t.x+i,t.y+n),le(o,a,s),r&&ae(o,{x:t.x+t.width/2,y:t.y+t.height/2},r),e.transform=o},clipMode:function(e,t,i,n,a,s,r,o,l,d){const c=ie();he(c,t,i,n,a,s,r,o),l&&(r||o?(ne(te),re(te,t,l,d),oe(c,te)):re(c,t,l,d)),e.transform=c},repeatMode:function(e,t,i,n,a,s,r,o,l,d,c,h){const u=ie();if(h)he(u,t,a,s,r,o,l,d);else{if(l)if("center"===c)ae(u,{x:i/2,y:n/2},l);else switch(de(u,l),l){case 90:se(u,n,0);break;case 180:se(u,i,n);break;case 270:se(u,0,i)}ee.x=t.x+a,ee.y=t.y+s,se(u,ee.x,ee.y),r&&re(u,ee,r,o)}e.transform=u}},{toPoint:we}=t.AroundHelper,{hasTransparent:ye}=i.ColorConvert,ve={},xe={};function be(e,n,a,s){if(a){let r,o,l,d;for(let e=0,c=a.length;e<c;e++)r=a[e],t.isString(r)?(l=e/(c-1),o=i.ColorConvert.string(r,s)):(l=r.offset,o=i.ColorConvert.string(r.color,s)),n.addColorStop(l,o),!d&&ye(o)&&(d=!0);d&&(e.isTransparent=!0)}}const{getAngle:Pe,getDistance:Ee}=t.PointHelper,{get:Le,rotateOfOuter:Se,scaleOfOuter:Be}=t.MatrixHelper,{toPoint:Re}=t.AroundHelper,ke={},Ce={};function Ae(e,t,i,n,a){let s;const{width:r,height:o}=e;if(r!==o||n){const e=Pe(t,i);s=Le(),a?(Be(s,t,r/o*(n||1),1),Se(s,t,e+90)):(Be(s,t,1,r/o*(n||1)),Se(s,t,e))}return s}const{getDistance:Oe}=t.PointHelper,{toPoint:Te}=t.AroundHelper,Ie={},Me={};const De={linearGradient:function(e,i){let{from:n,to:a,type:s,opacity:r}=e;we(n||"top",i,ve),we(a||"bottom",i,xe);const o=t.Platform.canvas.createLinearGradient(ve.x,ve.y,xe.x,xe.y),l={type:s,style:o};return be(l,o,e.stops,r),l},radialGradient:function(e,i){let{from:n,to:a,type:s,opacity:r,stretch:o}=e;Re(n||"center",i,ke),Re(a||"bottom",i,Ce);const l=t.Platform.canvas.createRadialGradient(ke.x,ke.y,0,ke.x,ke.y,Ee(ke,Ce)),d={type:s,style:l};be(d,l,e.stops,r);const c=Ae(i,ke,Ce,o,!0);return c&&(d.transform=c),d},conicGradient:function(e,i){let{from:n,to:a,type:s,opacity:r,rotation:o,stretch:l}=e;Te(n||"center",i,Ie),Te(a||"bottom",i,Me);const d=t.Platform.conicGradientSupport?t.Platform.canvas.createConicGradient(o?o*t.OneRadian:0,Ie.x,Ie.y):t.Platform.canvas.createRadialGradient(Ie.x,Ie.y,0,Ie.x,Ie.y,Oe(Ie,Me)),c={type:s,style:d};be(c,d,e.stops,r);const h=Ae(i,Ie,Me,l||1,t.Platform.conicGradientRotate90);return h&&(c.transform=h),c},getTransform:Ae},{copy:We,move:He,toOffsetOutBounds:Fe}=t.BoundsHelper,{max:ze,abs:je}=Math,Ue={},Ne=new t.Matrix,Ve={};function Ye(e,t){let i,n,a,s,r=0,o=0,l=0,d=0;return t.forEach(e=>{i=e.x||0,n=e.y||0,s=1.5*(e.blur||0),a=je(e.spread||0),r=ze(r,a+s-n),o=ze(o,a+s+i),l=ze(l,a+s+n),d=ze(d,a+s-i)}),r===o&&o===l&&l===d?r:[r,o,l,d]}function Ge(e,i,n){const{shapeBounds:a}=n;let s,r;t.Platform.fullImageShadow?(We(Ue,e.bounds),He(Ue,i.x-a.x,i.y-a.y),s=e.bounds,r=Ue):(s=a,r=i),e.copyWorld(n.canvas,s,r)}const{toOffsetOutBounds:Xe}=t.BoundsHelper,qe={};const Qe=Ye;const $e={shadow:function(e,n,a){let s,r;const{__nowWorld:o}=e,{shadow:l}=e.__,{worldCanvas:d,bounds:c,renderBounds:h,shapeBounds:u,scaleX:f,scaleY:p}=a,g=n.getSameCanvas(),m=l.length-1;Fe(c,Ve,h),l.forEach((l,_)=>{let w=1;if(l.scaleFixed){const e=Math.abs(o.scaleX);e>1&&(w=1/e)}g.setWorldShadow(Ve.offsetX+(l.x||0)*f*w,Ve.offsetY+(l.y||0)*p*w,(l.blur||0)*f*w,i.ColorConvert.string(l.color)),r=i.Effect.getShadowTransform(e,g,a,l,Ve,w),r&&g.setTransform(r),Ge(g,Ve,a),r&&g.resetTransform(),s=h,l.box&&(g.restore(),g.save(),d&&(g.copyWorld(g,h,o,"copy"),s=o),d?g.copyWorld(d,o,o,"destination-out"):g.copyWorld(a.canvas,u,c,"destination-out")),t.LeafHelper.copyCanvasByWorld(e,n,g,s,l.blendMode),m&&_<m&&g.clearWorld(s)}),g.recycle(s)},innerShadow:function(e,n,a){let s,r;const{__nowWorld:o}=e,{innerShadow:l}=e.__,{worldCanvas:d,bounds:c,renderBounds:h,shapeBounds:u,scaleX:f,scaleY:p}=a,g=n.getSameCanvas(),m=l.length-1;Xe(c,qe,h),l.forEach((l,_)=>{let w=1;if(l.scaleFixed){const e=Math.abs(o.scaleX);e>1&&(w=1/e)}g.save(),g.setWorldShadow(qe.offsetX+(l.x||0)*f*w,qe.offsetY+(l.y||0)*p*w,(l.blur||0)*f*w),r=i.Effect.getShadowTransform(e,g,a,l,qe,w,!0),r&&g.setTransform(r),Ge(g,qe,a),g.restore(),d?(g.copyWorld(g,h,o,"copy"),g.copyWorld(d,o,o,"source-out"),s=o):(g.copyWorld(a.canvas,u,c,"source-out"),s=h),g.fillWorld(s,i.ColorConvert.string(l.color),"source-in"),t.LeafHelper.copyCanvasByWorld(e,n,g,s,l.blendMode),m&&_<m&&g.clearWorld(s)}),g.recycle(s)},blur:function(e,t,i){const{blur:n}=e.__;i.setWorldBlur(n*e.__nowWorld.a),i.copyWorldToInner(t,e.__nowWorld,e.__layout.renderBounds),i.filter="none"},backgroundBlur:function(e,t,i){},getShadowRenderSpread:Ye,getShadowTransform:function(e,t,i,n,a,s,r){if(n.spread){const i=2*n.spread*s*(r?-1:1),{width:o,height:l}=e.__layout.strokeBounds;return Ne.set().scaleOfOuter({x:(a.x+a.width/2)*t.pixelRatio,y:(a.y+a.height/2)*t.pixelRatio},1+i/o,1+i/l),Ne}},isTransformShadow(e){},getInnerShadowSpread:Qe},{excludeRenderBounds:Ze}=t.LeafBoundsHelper;let Ke;function Je(e,t,i,n,a,s,r,o){switch(t){case"grayscale":Ke||(Ke=!0,a.useGrayscaleAlpha(e.__nowWorld));case"alpha":!function(e,t,i,n,a,s){const r=e.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(n,r),s&&n.recycle(r);tt(e,t,i,1,a,s)}(e,i,n,a,r,o);break;case"opacity-path":tt(e,i,n,s,r,o);break;case"path":o&&i.restore()}}function et(e){return e.getSameCanvas(!1,!0)}function tt(e,t,i,n,a,s){const r=e.__nowWorld;t.resetTransform(),t.opacity=n,t.copyWorld(i,r,void 0,a),s?i.recycle(r):i.clearWorld(r)}i.Group.prototype.__renderMask=function(e,t){let i,n,a,s,r,o;const{children:l}=this;for(let d=0,c=l.length;d<c;d++){if(i=l[d],o=i.__.mask,o){r&&(Je(this,r,e,a,n,s,void 0,!0),n=a=null),"clipping"!==o&&"clipping-path"!==o||Ze(i,t)||i.__render(e,t),s=i.__.opacity,Ke=!1,"path"===o||"clipping-path"===o?(s<1?(r="opacity-path",a||(a=et(e))):(r="path",e.save()),i.__clip(a||e,t)):(r="grayscale"===o?"grayscale":"alpha",n||(n=et(e)),a||(a=et(e)),i.__render(n,t));continue}const c=1===s&&i.__.__blendMode;c&&Je(this,r,e,a,n,s,void 0,!1),Ze(i,t)||i.__render(a||e,t),c&&Je(this,r,e,a,n,s,c,!1)}Je(this,r,e,a,n,s,void 0,!0)};const it=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",nt=it+"_#~&*+\\=|≮≯≈≠=…",at=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(([e,t])=>`[\\u${e.toString(16)}-\\u${t.toString(16)}]`).join("|"));function st(e){const t={};return e.split("").forEach(e=>t[e]=!0),t}const rt=st("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),ot=st("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),lt=st(it),dt=st(nt),ct=st("- —/~|┆·");var ht;!function(e){e[e.Letter=0]="Letter",e[e.Single=1]="Single",e[e.Before=2]="Before",e[e.After=3]="After",e[e.Symbol=4]="Symbol",e[e.Break=5]="Break"}(ht||(ht={}));const{Letter:ut,Single:ft,Before:pt,After:gt,Symbol:mt,Break:_t}=ht;function wt(e){return rt[e]?ut:ct[e]?_t:ot[e]?pt:lt[e]?gt:dt[e]?mt:at.test(e)?ft:ut}const yt={trimRight(e){const{words:t}=e;let i,n=0,a=t.length;for(let s=a-1;s>-1&&(i=t[s].data[0]," "===i.char);s--)n++,e.width-=i.width;n&&t.splice(a-n,n)}};function vt(e,t,i){switch(t){case"title":return i?e.toUpperCase():e;case"upper":return e.toUpperCase();case"lower":return e.toLowerCase();default:return e}}const{trimRight:xt}=yt,{Letter:bt,Single:Pt,Before:Et,After:Lt,Symbol:St,Break:Bt}=ht;let Rt,kt,Ct,At,Ot,Tt,It,Mt,Dt,Wt,Ht,Ft,zt,jt,Ut,Nt,Vt,Yt=[];function Gt(e,t){Dt&&!Mt&&(Mt=Dt),Rt.data.push({char:e,width:t}),Ct+=t}function Xt(){At+=Ct,Rt.width=Ct,kt.words.push(Rt),Rt={data:[]},Ct=0}function qt(){jt&&(Ut.paraNumber++,kt.paraStart=!0,jt=!1),Dt&&(kt.startCharSize=Mt,kt.endCharSize=Dt,Mt=0),kt.width=At,Nt.width?xt(kt):Vt&&Qt(),Yt.push(kt),kt={words:[]},At=0}function Qt(){At>(Ut.maxWidth||0)&&(Ut.maxWidth=At)}const{top:$t,right:Zt,bottom:Kt,left:Jt}=t.Direction4;function ei(e,t,i){const{bounds:n,rows:a}=e;n[t]+=i;for(let e=0;e<a.length;e++)a[e][t]+=i}const ti={getDrawData:function(e,n){t.isString(e)||(e=String(e));let a=0,s=0,r=n.__getInput("width")||0,o=n.__getInput("height")||0;const{__padding:l}=n;l&&(r?(a=l[Jt],r-=l[Zt]+l[Jt],!r&&(r=.01)):n.autoSizeAlign||(a=l[Jt]),o?(s=l[$t],o-=l[$t]+l[Kt],!o&&(o=.01)):n.autoSizeAlign||(s=l[$t]));const d={bounds:{x:a,y:s,width:r,height:o},rows:[],paraNumber:0,font:t.Platform.canvas.font=n.__font};return function(e,i,n){Ut=e,Yt=e.rows,Nt=e.bounds,Vt=!Nt.width&&!n.autoSizeAlign;const{__letterSpacing:a,paraIndent:s,textCase:r}=n,{canvas:o}=t.Platform,{width:l}=Nt;if(n.__isCharMode){const e="none"!==n.textWrap,t="break"===n.textWrap;jt=!0,Ht=null,Mt=It=Dt=Ct=At=0,Rt={data:[]},kt={words:[]};for(let n=0,d=(i=[...i]).length;n<d;n++)Tt=i[n],"\n"===Tt?(Ct&&Xt(),kt.paraEnd=!0,qt(),jt=!0):(Wt=wt(Tt),Wt===bt&&"none"!==r&&(Tt=vt(Tt,r,!Ct)),It=o.measureText(Tt).width,a&&(a<0&&(Dt=It),It+=a),Ft=Wt===Pt&&(Ht===Pt||Ht===bt)||Ht===Pt&&Wt!==Lt,zt=!(Wt!==Et&&Wt!==Pt||Ht!==St&&Ht!==Lt),Ot=jt&&s?l-s:l,e&&l&&At+Ct+It>Ot&&(t?(Ct&&Xt(),At&&qt()):(zt||(zt=Wt===bt&&Ht==Lt),Ft||zt||Wt===Bt||Wt===Et||Wt===Pt||Ct+It>Ot?(Ct&&Xt(),At&&qt()):At&&qt()))," "===Tt&&!0!==jt&&At+Ct===0||(Wt===Bt?(" "===Tt&&Ct&&Xt(),Gt(Tt,It),Xt()):Ft||zt?(Ct&&Xt(),Gt(Tt,It)):Gt(Tt,It)),Ht=Wt);Ct&&Xt(),At&&qt(),Yt.length>0&&(Yt[Yt.length-1].paraEnd=!0)}else i.split("\n").forEach(e=>{Ut.paraNumber++,At=o.measureText(e).width,Yt.push({x:s||0,text:e,width:At,paraStart:!0}),Vt&&Qt()})}(d,e,n),l&&function(e,t,i,n,a){if(!n&&i.autoSizeAlign)switch(i.textAlign){case"left":ei(t,"x",e[Jt]);break;case"right":ei(t,"x",-e[Zt])}if(!a&&i.autoSizeAlign)switch(i.verticalAlign){case"top":ei(t,"y",e[$t]);break;case"bottom":ei(t,"y",-e[Kt])}}(l,d,n,r,o),function(e,t){const{rows:i,bounds:n}=e,a=i.length,{__lineHeight:s,__baseLine:r,__letterSpacing:o,__clipText:l,textAlign:d,verticalAlign:c,paraSpacing:h,autoSizeAlign:u}=t;let{x:f,y:p,width:g,height:m}=n,_=s*a+(h?h*(e.paraNumber-1):0),w=r;if(l&&_>m)_=Math.max(t.__autoHeight?_:m,s),a>1&&(e.overflow=a);else if(m||u)switch(c){case"middle":p+=(m-_)/2;break;case"bottom":p+=m-_}w+=p;let y,v,x,b=g||u?g:e.maxWidth;for(let r=0,c=a;r<c;r++){if(y=i[r],y.x=f,y.width<g||y.width>g&&!l)switch(d){case"center":y.x+=(b-y.width)/2;break;case"right":y.x+=b-y.width}y.paraStart&&h&&r>0&&(w+=h),y.y=w,w+=s,e.overflow>r&&w>_&&(y.isOverflow=!0,e.overflow=r+1),v=y.x,x=y.width,o<0&&(y.width<0?(x=-y.width+t.fontSize+o,v-=x,x+=t.fontSize):x-=o),v<n.x&&(n.x=v),x>n.width&&(n.width=x),l&&g&&g<x&&(y.isOverflow=!0,e.overflow||(e.overflow=i.length))}n.y=p,n.height=_}(d,n),n.__isCharMode&&function(e,t,i){const{rows:n}=e,{textAlign:a,paraIndent:s,__letterSpacing:r}=t,o=i&&a.includes("both"),l=o||i&&a.includes("justify"),d=l&&a.includes("letter");let c,h,u,f,p,g,m,_,w,y;n.forEach(e=>{e.words&&(p=s&&e.paraStart?s:0,_=e.words.length,l&&(y=!e.paraEnd||o,h=i-e.width-p,d?f=h/(e.words.reduce((e,t)=>e+t.data.length,0)-1):u=_>1?h/(_-1):0),g=r||e.isOverflow||d?0:u?1:2,e.isOverflow&&!r&&(e.textMode=!0),2===g?(e.x+=p,function(e){e.text="",e.words.forEach(t=>{t.data.forEach(t=>{e.text+=t.char})})}(e)):(e.x+=p,c=e.x,e.data=[],e.words.forEach((t,i)=>{1===g?(m={char:"",x:c},c=function(e,t,i){return e.forEach(e=>{i.char+=e.char,t+=e.width}),t}(t.data,c,m),(e.isOverflow||" "!==m.char)&&e.data.push(m)):c=function(e,t,i,n,a){return e.forEach(e=>{(n||" "!==e.char)&&(e.x=t,i.push(e)),t+=e.width,a&&(t+=a)}),t}(t.data,c,e.data,e.isOverflow,y&&f),y&&(w=i===_-1,u?w||(c+=u,e.width+=u):f&&(e.width+=f*(t.data.length-(w?1:0))))})),e.words=null)})}(d,n,r),d.overflow&&function(e,i,n,a){const{rows:s,overflow:r}=e;let{textOverflow:o}=i;if(r&&s.splice(r),a&&o&&"show"!==o){let e,l;"hide"===o?o="":"ellipsis"===o&&(o="...");const d=o?t.Platform.canvas.measureText(o).width:0,c=n+a-d;("none"===i.textWrap?s:[s[r-1]]).forEach(t=>{if(t.isOverflow&&t.data){let i=t.data.length-1;for(let n=i;n>-1&&(e=t.data[n],l=e.x+e.width,!(n===i&&l<c));n--){if(l<c&&" "!==e.char||!n){t.data.splice(n+1),t.width-=e.width;break}t.width-=e.width}t.width+=d,t.data.push({char:o,x:l}),t.textMode&&function(e){e.text="",e.data.forEach(t=>{e.text+=t.char}),e.data=null}(t)}})}}(d,n,a,r),"none"!==n.textDecoration&&function(e,n){let a,s=0;const{fontSize:r,textDecoration:o}=n;switch(e.decorationHeight=r/11,t.isObject(o)?(a=o.type,o.color&&(e.decorationColor=i.ColorConvert.string(o.color)),o.offset&&(s=Math.min(.3*r,Math.max(o.offset,.15*-r)))):a=o,a){case"under":e.decorationY=[.15*r+s];break;case"delete":e.decorationY=[.35*-r];break;case"under-delete":e.decorationY=[.15*r+s,.35*-r]}}(d,n),d}};const ii={string:function(e,n){if(!e)return"#000";const a=t.isNumber(n)&&n<1;if(t.isString(e)){if(!a||!i.ColorConvert.object)return e;e=i.ColorConvert.object(e)}let s=t.isUndefined(e.a)?1:e.a;a&&(s*=n);const r=e.r+","+e.g+","+e.b;return 1===s?"rgb("+r+")":"rgba("+r+","+s+")"}};Object.assign(i.TextConvert,ti),Object.assign(i.ColorConvert,ii),Object.assign(i.Paint,H),Object.assign(i.PaintImage,_e),Object.assign(i.PaintGradient,De),Object.assign(i.Effect,$e),r(),Object.defineProperty(exports,"LeaferFilm",{enumerable:!0,get:function(){return t.LeaferFilm}}),Object.defineProperty(exports,"LeaferImage",{enumerable:!0,get:function(){return t.LeaferImage}}),Object.defineProperty(exports,"LeaferVideo",{enumerable:!0,get:function(){return t.LeaferVideo}}),exports.Layouter=y,exports.LeaferCanvas=s,exports.Renderer=x,exports.Watcher=l,exports.useCanvas=r,Object.keys(t).forEach(function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}})}),Object.keys(i).forEach(function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return i[e]}})});
|
|
1
|
+
"use strict";var e,t=require("@leafer/core"),i=require("@leafer-ui/draw");function n(e,t,i,n){return new(i||(i=Promise))(function(a,s){function r(e){try{l(n.next(e))}catch(e){s(e)}}function o(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(r,o)}l((n=n.apply(e,t||[])).next())})}exports.PathNodeHandleType=void 0,(e=exports.PathNodeHandleType||(exports.PathNodeHandleType={}))[e.none=1]="none",e[e.free=2]="free",e[e.mirrorAngle=3]="mirrorAngle",e[e.mirror=4]="mirror","function"==typeof SuppressedError&&SuppressedError;const a=t.Debug.get("LeaferCanvas");class s extends t.LeaferCanvasBase{set zIndex(e){const{style:t}=this.view;t.zIndex=e,this.setAbsolute(this.view)}set childIndex(e){const{view:t,parentView:i}=this;if(t&&i){const n=i.children[e];n?(this.setAbsolute(n),i.insertBefore(t,n)):i.appendChild(n)}}init(){const{config:e}=this,i=e.view||e.canvas;i?this.__createViewFrom(i):this.__createView();const{style:n}=this.view;if(n.display||(n.display="block"),this.parentView=this.view.parentElement,this.parentView){const e=this.parentView.style;e.webkitUserSelect=e.userSelect="none",this.view.classList.add("leafer-canvas-view")}t.Platform.syncDomFont&&!this.parentView&&(n.display="none",document.body&&document.body.appendChild(this.view)),this.__createContext(),this.autoLayout||this.resize(e)}set backgroundColor(e){this.view.style.backgroundColor=e}get backgroundColor(){return this.view.style.backgroundColor}set hittable(e){this.view.style.pointerEvents=e?"auto":"none"}get hittable(){return"none"!==this.view.style.pointerEvents}__createView(){this.view=document.createElement("canvas")}__createViewFrom(e){let i=t.isString(e)?document.getElementById(e):e;if(i)if(i instanceof HTMLCanvasElement)this.view=i;else{let e=i;if(i===window||i===document){const t=document.createElement("div"),{style:i}=t;i.position="absolute",i.top=i.bottom=i.left=i.right="0px",document.body.appendChild(t),e=t}this.__createView();const t=this.view;e.hasChildNodes()&&(this.setAbsolute(t),e.style.position||(e.style.position="relative")),e.appendChild(t)}else a.error(`no id: ${e}`),this.__createView()}setAbsolute(e){const{style:t}=e;t.position="absolute",t.top=t.left="0px"}updateViewSize(){const{width:e,height:t,pixelRatio:i}=this,{style:n}=this.view;n.width=e+"px",n.height=t+"px",this.unreal||(this.view.width=Math.ceil(e*i),this.view.height=Math.ceil(t*i))}updateClientBounds(){this.view.parentElement&&(this.clientBounds=this.view.getBoundingClientRect())}startAutoLayout(e,t){if(this.resizeListener=t,e){if(this.autoBounds=e,this.resizeObserver)return;try{this.resizeObserver=new ResizeObserver(e=>{this.updateClientBounds();for(const t of e)this.checkAutoBounds(t.contentRect)});const e=this.parentView;e?(this.resizeObserver.observe(e),this.checkAutoBounds(e.getBoundingClientRect())):(this.checkAutoBounds(this.view),a.warn("no parent"))}catch(e){this.imitateResizeObserver()}this.stopListenPixelRatio()}else this.listenPixelRatio(),this.unreal&&this.updateViewSize()}imitateResizeObserver(){this.autoLayout&&(this.parentView&&this.checkAutoBounds(this.parentView.getBoundingClientRect()),t.Platform.requestRender(this.imitateResizeObserver.bind(this)))}listenPixelRatio(){this.windowListener||window.addEventListener("resize",this.windowListener=()=>{const e=t.Platform.devicePixelRatio;if(!this.config.pixelRatio&&this.pixelRatio!==e){const{width:t,height:i}=this;this.emitResize({width:t,height:i,pixelRatio:e})}})}stopListenPixelRatio(){this.windowListener&&(window.removeEventListener("resize",this.windowListener),this.windowListener=null)}checkAutoBounds(e){const i=this.view,{x:n,y:a,width:s,height:r}=this.autoBounds.getBoundsFrom(e),o={width:s,height:r,pixelRatio:this.config.pixelRatio?this.pixelRatio:t.Platform.devicePixelRatio};if(!this.isSameSize(o)){const{style:e}=i;e.marginLeft=n+"px",e.marginTop=a+"px",this.emitResize(o)}}stopAutoLayout(){this.autoLayout=!1,this.resizeObserver&&this.resizeObserver.disconnect(),this.resizeListener=this.resizeObserver=null}emitResize(e){const i={};t.DataHelper.copyAttrs(i,this,t.canvasSizeAttrs),this.resize(e),this.resizeListener&&!t.isUndefined(this.width)&&this.resizeListener(new t.ResizeEvent(e,i))}unrealCanvas(){if(!this.unreal&&this.parentView){let e=this.view;e&&e.remove(),e=this.view=document.createElement("div"),this.parentView.appendChild(this.view),e.classList.add("leafer-app-view"),this.unreal=!0}}destroy(){const{view:e}=this;e&&(this.stopAutoLayout(),this.stopListenPixelRatio(),e.parentElement&&e.remove(),super.destroy())}}function r(e,i){t.Platform.origin={createCanvas(e,t){const i=document.createElement("canvas");return i.width=e,i.height=t,i},canvasToDataURL:(e,i,n)=>{const a=t.FileHelper.mimeType(i),s=e.toDataURL(a,n);return"image/bmp"===a?s.replace("image/png;","image/bmp;"):s},canvasToBolb:(e,i,n)=>new Promise(a=>e.toBlob(a,t.FileHelper.mimeType(i),n)),canvasSaveAs:(e,i,n)=>{const a=e.toDataURL(t.FileHelper.mimeType(t.FileHelper.fileType(i)),n);return t.Platform.origin.download(a,i)},download(e,t){return n(this,void 0,void 0,function*(){let i=document.createElement("a");i.href=e,i.download=t,document.body.appendChild(i),i.click(),document.body.removeChild(i)})},loadImage:(e,i,n)=>new Promise((n,a)=>{const s=new t.Platform.origin.Image;i&&(s.setAttribute("crossOrigin",i),s.crossOrigin=i),s.onload=()=>{n(s)},s.onerror=e=>{a(e)},s.src=t.Platform.image.getRealURL(e)}),loadContent(e){return n(this,arguments,void 0,function*(e,t="text"){const i=yield fetch(e);if(!i.ok)throw new Error(`${i.status}`);return yield i[t]()})},Image:Image,PointerEvent:PointerEvent,DragEvent:DragEvent},t.Platform.event={stopDefault(e){e.preventDefault()},stopNow(e){e.stopImmediatePropagation()},stop(e){e.stopPropagation()}},t.Platform.canvas=t.Creator.canvas(),t.Platform.conicGradientSupport=!!t.Platform.canvas.context.createConicGradient}t.canvasPatch(CanvasRenderingContext2D.prototype),t.canvasPatch(Path2D.prototype),Object.assign(t.Creator,{canvas:(e,t)=>new s(e,t),image:e=>new t.LeaferImage(e)}),t.Platform.name="web",t.Platform.isMobile="ontouchstart"in window,t.Platform.requestRender=function(e){window.requestAnimationFrame(e)},t.defineKey(t.Platform,"devicePixelRatio",{get:()=>devicePixelRatio});const{userAgent:o}=navigator;o.indexOf("Firefox")>-1?(t.Platform.intWheelDeltaY=!0,t.Platform.syncDomFont=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(t.Platform.fullImageShadow=!0),o.indexOf("Windows")>-1?(t.Platform.os="Windows",t.Platform.intWheelDeltaY=!0):o.indexOf("Mac")>-1?t.Platform.os="Mac":o.indexOf("Linux")>-1&&(t.Platform.os="Linux");class l{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove&&this.config.usePartLayout){const e=new t.LeafList;return this.__updatedList.list.forEach(t=>{t.leafer&&e.add(t)}),e}return this.__updatedList}constructor(e,i){this.totalTimes=0,this.config={},this.__updatedList=new t.LeafList,this.target=e,i&&(this.config=t.DataHelper.default(i,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(t.RenderEvent.REQUEST)}__onAttrChange(e){this.config.usePartLayout&&this.__updatedList.add(e.target),this.update()}__onChildEvent(e){this.config.usePartLayout&&(e.type===t.ChildEvent.ADD?(this.hasAdd=!0,this.__pushChild(e.child)):(this.hasRemove=!0,this.__updatedList.add(e.parent))),this.update()}__pushChild(e){this.__updatedList.add(e),e.isBranch&&this.__loopChildren(e)}__loopChildren(e){const{children:t}=e;for(let e=0,i=t.length;e<i;e++)this.__pushChild(t[e])}__onRquestData(){this.target.emitEvent(new t.WatchEvent(t.WatchEvent.DATA,{updatedList:this.updatedList})),this.__updatedList=new t.LeafList,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[t.PropertyEvent.CHANGE,this.__onAttrChange,this],[[t.ChildEvent.ADD,t.ChildEvent.REMOVE],this.__onChildEvent,this],[t.WatchEvent.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:d,updateBounds:c,updateChange:h}=t.LeafHelper,{pushAllChildBranch:u,pushAllParent:f}=t.BranchHelper;const{worldBounds:p}=t.LeafBoundsHelper;class g{constructor(e){this.updatedBounds=new t.Bounds,this.beforeBounds=new t.Bounds,this.afterBounds=new t.Bounds,t.isArray(e)&&(e=new t.LeafList(e)),this.updatedList=e}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,p)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,p),this.updatedBounds.setList([this.beforeBounds,this.afterBounds])}merge(e){this.updatedList.addList(e.updatedList.list),this.beforeBounds.add(e.beforeBounds),this.afterBounds.add(e.afterBounds),this.updatedBounds.add(e.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllMatrix:m,updateAllChange:_}=t.LeafHelper,w=t.Debug.get("Layouter");class y{constructor(e,i){this.totalTimes=0,this.config={usePartLayout:!0},this.__levelList=new t.LeafLevelList,this.target=e,i&&(this.config=t.DataHelper.default(i,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(this.layouting||!this.running)return;const{target:e}=this;this.times=0;try{e.emit(t.LayoutEvent.START),this.layoutOnce(),e.emitEvent(new t.LayoutEvent(t.LayoutEvent.END,this.layoutedBlocks,this.times))}catch(e){w.error(e)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?w.warn("layouting"):this.times>3?w.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(t.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 e;if(!(null===(e=this.__updatedList)||void 0===e?void 0:e.length))return;const i=t.Run.start("PartLayout"),{target:n,__updatedList:a}=this,{BEFORE:s,LAYOUT:r,AFTER:o}=t.LayoutEvent,l=this.getBlocks(a);l.forEach(e=>e.setBefore()),n.emitEvent(new t.LayoutEvent(s,l,this.times)),this.extraBlock=null,a.sort(),function(e,t){let i;e.list.forEach(e=>{i=e.__layout,t.without(e)&&!i.proxyZoom&&(i.matrixChanged?(d(e,!0),t.add(e),e.isBranch&&u(e,t),f(e,t)):i.boundsChanged&&(t.add(e),e.isBranch&&(e.__tempNumber=0),f(e,t)))})}(a,this.__levelList),function(e){let t,i,n;e.sort(!0),e.levels.forEach(a=>{t=e.levelMap[a];for(let e=0,a=t.length;e<a;e++){if(i=t[e],i.isBranch&&i.__tempNumber){n=i.children;for(let e=0,t=n.length;e<t;e++)n[e].isBranch||c(n[e])}c(i)}})}(this.__levelList),function(e){e.list.forEach(h)}(a),this.extraBlock&&l.push(this.extraBlock),l.forEach(e=>e.setAfter()),n.emitEvent(new t.LayoutEvent(r,l,this.times)),n.emitEvent(new t.LayoutEvent(o,l,this.times)),this.addBlocks(l),this.__levelList.reset(),this.__updatedList=null,t.Run.end(i)}fullLayout(){const e=t.Run.start("FullLayout"),{target:i}=this,{BEFORE:n,LAYOUT:a,AFTER:s}=t.LayoutEvent,r=this.getBlocks(new t.LeafList(i));i.emitEvent(new t.LayoutEvent(n,r,this.times)),y.fullLayout(i),r.forEach(e=>{e.setAfter()}),i.emitEvent(new t.LayoutEvent(a,r,this.times)),i.emitEvent(new t.LayoutEvent(s,r,this.times)),this.addBlocks(r),t.Run.end(e)}static fullLayout(e){m(e,!0),e.isBranch?t.BranchHelper.updateBounds(e):t.LeafHelper.updateBounds(e),_(e)}addExtra(e){if(!this.__updatedList.has(e)){const{updatedList:t,beforeBounds:i}=this.extraBlock||(this.extraBlock=new g([]));t.length?i.add(e.__world):i.set(e.__world),t.add(e)}}createBlock(e){return new g(e)}getBlocks(e){return[this.createBlock(e)]}addBlocks(e){this.layoutedBlocks?this.layoutedBlocks.push(...e):this.layoutedBlocks=e}__onReceiveWatchData(e){this.__updatedList=e.data.updatedList}__listenEvents(){this.__eventIds=[this.target.on_([[t.LayoutEvent.REQUEST,this.layout,this],[t.LayoutEvent.AGAIN,this.layoutAgain,this],[t.WatchEvent.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const v=t.Debug.get("Renderer");class x{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(e,i,n){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,ceilPartPixel:!0,maxFPS:120},this.frames=[],this.target=e,this.canvas=i,n&&(this.config=t.DataHelper.default(n,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(e=!0){this.changed||(this.changed=e),this.requestTime||this.__requestRender()}requestLayout(){this.target.emit(t.LayoutEvent.REQUEST)}checkRender(){if(this.running){const{target:e}=this;e.isApp&&(e.emit(t.RenderEvent.CHILD_START,e),e.children.forEach(e=>{e.renderer.FPS=this.FPS,e.renderer.checkRender()}),e.emit(t.RenderEvent.CHILD_END,e)),this.changed&&this.canvas.view&&this.render(),this.target.emit(t.RenderEvent.NEXT)}}render(e){if(!this.running||!this.canvas.view)return this.update();const{target:i}=this;this.times=0,this.totalBounds=new t.Bounds,v.log(i.innerName,"---\x3e");try{this.emitRender(t.RenderEvent.START),this.renderOnce(e),this.emitRender(t.RenderEvent.END,this.totalBounds),t.ImageManager.clearRecycled()}catch(e){this.rendering=!1,v.error(e)}v.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(e){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 t.Bounds,this.renderOptions={},e)this.emitRender(t.RenderEvent.BEFORE),e();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(t.RenderEvent.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(t.RenderEvent.RENDER,this.renderBounds,this.renderOptions),this.emitRender(t.RenderEvent.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,this.waitAgain&&(this.waitAgain=!1,this.renderOnce())}partRender(){const{canvas:e,updateBlocks:t}=this;t&&(this.mergeBlocks(),t.forEach(t=>{e.bounds.hit(t)&&!t.isEmpty()&&this.clipRender(t)}))}clipRender(e){const i=t.Run.start("PartRender"),{canvas:n}=this,a=e.getIntersect(n.bounds),s=new t.Bounds(a);n.save(),a.spread(x.clipSpread).ceil();const{ceilPartPixel:r}=this.config;n.clipWorld(a,r),n.clearWorld(a,r),this.__render(a,s),n.restore(),t.Run.end(i)}fullRender(){const e=t.Run.start("FullRender"),{canvas:i}=this;i.save(),i.clear(),this.__render(i.bounds),i.restore(),t.Run.end(e)}__render(e,i){const{canvas:n,target:a}=this,s=e.includes(a.__world),r=s?{includes:s}:{bounds:e,includes:s};this.needFill&&n.fillWorld(e,this.config.fill),t.Debug.showRepaint&&t.Debug.drawRepaint(n,e),this.config.useCellRender&&(r.cellList=this.getCellList()),t.Platform.render(a,n,r),this.renderBounds=i=i||e,this.renderOptions=r,this.totalBounds.isEmpty()?this.totalBounds=i:this.totalBounds.add(i),n.updateRender(i)}getCellList(){}addBlock(e,t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(e)}mergeBlocks(){const{updateBlocks:e}=this;if(e){const i=new t.Bounds;i.setList(e),e.length=0,e.push(i)}}__requestRender(){const e=this.target;if(this.requestTime||!e)return;if(e.parentApp)return e.parentApp.requestRender(!1);this.requestTime=this.frameTime||Date.now();const i=()=>{const e=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:n}=this.config;if(n&&e>n)return t.Platform.requestRender(i);const{frames:a}=this;a.length>30&&a.shift(),a.push(e),this.FPS=Math.round(a.reduce((e,t)=>e+t,0)/a.length),this.requestTime=0,this.checkRender()};t.Platform.requestRender(i)}__onResize(e){if(!this.canvas.unreal){if(e.bigger||!e.samePixelRatio){const{width:i,height:n}=e.old;if(!new t.Bounds(0,0,i,n).includes(this.target.__world)||this.needFill||!e.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new t.Bounds(0,0,1,1)),this.update()}}__onLayoutEnd(e){e.data&&e.data.map(e=>{let t;const{updatedList:i}=e;i&&i.list.some(e=>(t=!e.__world.width||!e.__world.height,t&&(e.isLeafer||v.tip(e.innerName,": empty"),t=!e.isBranch||e.isBranchLeaf),t)),this.addBlock(t?this.canvas.bounds:e.updatedBounds,i)})}emitRender(e,i,n){this.target.emitEvent(new t.RenderEvent(e,this.times,i,n))}__listenEvents(){this.__eventIds=[this.target.on_([[t.RenderEvent.REQUEST,this.update,this],[t.LayoutEvent.END,this.__onLayoutEnd,this],[t.RenderEvent.AGAIN,this.renderAgain,this],[t.ResizeEvent.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}function b(e,t,n){e.__.__font?i.Paint.fillText(e,t,n):e.__.windingRule?t.fill(e.__.windingRule):t.fill()}function P(e,n,a,s,r){const o=a.__;t.isObject(e)?i.Paint.drawStrokesStyle(e,n,!1,a,s,r):(s.setStroke(e,o.__strokeWidth*n,o),s.stroke()),o.__useArrow&&i.Paint.strokeArrow(e,a,s,r)}function E(e,n,a,s,r){const o=a.__;t.isObject(e)?i.Paint.drawStrokesStyle(e,n,!0,a,s,r):(s.setStroke(e,o.__strokeWidth*n,o),i.Paint.drawTextStroke(a,s,r))}function L(e,n,a,s,r){const o=s.getSameCanvas(!0,!0);o.font=a.__.__font,E(e,2,a,o,r),o.blendMode="outside"===n?"destination-out":"destination-in",i.Paint.fillText(a,o,r),o.blendMode="normal",t.LeafHelper.copyCanvasByWorld(a,s,o),o.recycle(a.__nowWorld)}x.clipSpread=10,Object.assign(t.Creator,{watcher:(e,t)=>new l(e,t),layouter:(e,t)=>new y(e,t),renderer:(e,t,i)=>new x(e,t,i),selector:(e,t)=>{},interaction:(e,t,i,n)=>{}}),t.Platform.layout=y.fullLayout,t.Platform.render=function(e,i,n){const a=Object.assign(Object.assign({},n),{topRendering:!0});n.topList=new t.LeafList,e.__render(i,n),n.topList.length&&n.topList.forEach(e=>e.__render(i,a))};const{getSpread:S,copyAndSpread:B,toOuterOf:R,getOuterOf:k,getByMove:C,move:A,getIntersectData:O}=t.BoundsHelper,T={};let I;const{stintSet:M}=t.DataHelper,{hasTransparent:D}=i.ColorConvert;function W(e,n,a){if(!t.isObject(n)||!1===n.visible||0===n.opacity)return;let s;const{boxBounds:r}=a.__layout,{type:o}=n;switch(o){case"image":case"film":case"video":if(!n.url)return;s=i.PaintImage.image(a,e,n,r,!I||!I[n.url]),"image"!==o&&i.PaintImage[o](s);break;case"linear":s=i.PaintGradient.linearGradient(n,r);break;case"radial":s=i.PaintGradient.radialGradient(n,r);break;case"angular":s=i.PaintGradient.conicGradient(n,r);break;case"solid":const{color:l,opacity:d}=n;s={type:o,style:i.ColorConvert.string(l,d)};break;default:t.isUndefined(n.r)||(s={type:"solid",style:i.ColorConvert.string(n)})}if(s&&(s.originPaint=n,t.isString(s.style)&&D(s.style)&&(s.isTransparent=!0),n.style)){if(0===n.style.strokeWidth)return;s.strokeStyle=n.style}return s}const H={compute:function(e,n){const a=n.__,s=[];let r,o,l,d=a.__input[e];t.isArray(d)||(d=[d]),I=i.PaintImage.recycleImage(e,a);for(let t,i=0,a=d.length;i<a;i++)(t=W(e,d[i],n))&&(s.push(t),t.strokeStyle&&(l||(l=1),t.strokeStyle.strokeWidth&&(l=Math.max(l,t.strokeStyle.strokeWidth))));s.length?(a["_"+e]=s,s.every(e=>e.isTransparent)&&(s.some(e=>e.image)&&(r=!0),o=!0),"fill"===e?(M(a,"__isAlphaPixelFill",r),M(a,"__isTransparentFill",o)):(M(a,"__isAlphaPixelStroke",r),M(a,"__isTransparentStroke",o),M(a,"__hasMultiStrokeStyle",l))):(a.__removePaint(e,!1),a["_"+e]="")},fill:function(e,t,i,n){i.fillStyle=e,b(t,i,n)},fills:function(e,t,n,a){let s,r,o;for(let l=0,d=e.length;l<d;l++){if(s=e[l],r=s.originPaint,s.image){if(o?o++:o=1,i.PaintImage.checkImage(s,!t.__.__font,t,n,a))continue;if(!s.style){1===o&&s.image.isPlacehold&&t.drawImagePlaceholder(s,n,a);continue}}if(n.fillStyle=s.style,s.transform||r.scaleFixed){if(n.save(),s.transform&&n.transform(s.transform),r.scaleFixed){const{scaleX:e,scaleY:i}=t.getRenderScaleData(!0,r.scaleFixed,!1);1!==e&&n.scale(e,i)}r.blendMode&&(n.blendMode=r.blendMode),b(t,n,a),n.restore()}else r.blendMode?(n.saveBlendMode(r.blendMode),b(t,n,a),n.restoreBlendMode()):b(t,n,a)}},fillPathOrText:b,fillText:function(e,t,i){const n=e.__,{rows:a,decorationY:s}=n.__textDrawData;let r;n.__isPlacehold&&n.placeholderColor&&(t.fillStyle=n.placeholderColor);for(let e=0,i=a.length;e<i;e++)r=a[e],r.text?t.fillText(r.text,r.x,r.y):r.data&&r.data.forEach(e=>{t.fillText(e.char,e.x,r.y)});if(s){const{decorationColor:e,decorationHeight:i}=n.__textDrawData;e&&(t.fillStyle=e),a.forEach(e=>s.forEach(n=>t.fillRect(e.x,e.y+n,e.width,i)))}},stroke:function(e,n,a,s){const r=n.__;if(r.__strokeWidth)if(r.__font)i.Paint.strokeText(e,n,a,s);else if(r.__pathForStroke)i.Paint.fillStroke(e,n,a,s);else switch(r.strokeAlign){case"center":P(e,1,n,a,s);break;case"inside":!function(e,t,i,n){i.save(),i.clipUI(t),P(e,2,t,i,n),i.restore()}(e,n,a,s);break;case"outside":!function(e,i,n,a){const s=i.__;if(s.__fillAfterStroke)P(e,2,i,n,a);else{const{renderBounds:r}=i.__layout,o=n.getSameCanvas(!0,!0);i.__drawRenderPath(o),P(e,2,i,o,a),o.clipUI(s),o.clearWorld(r),t.LeafHelper.copyCanvasByWorld(i,n,o),o.recycle(i.__nowWorld)}}(e,n,a,s)}},strokes:function(e,t,n,a){i.Paint.stroke(e,t,n,a)},strokeText:function(e,t,i,n){switch(t.__.strokeAlign){case"center":E(e,1,t,i,n);break;case"inside":L(e,"inside",t,i,n);break;case"outside":t.__.__fillAfterStroke?E(e,2,t,i,n):L(e,"outside",t,i,n)}},drawTextStroke:function(e,t,i){let n,a=e.__.__textDrawData;const{rows:s,decorationY:r}=a;for(let e=0,i=s.length;e<i;e++)n=s[e],n.text?t.strokeText(n.text,n.x,n.y):n.data&&n.data.forEach(e=>{t.strokeText(e.char,e.x,n.y)});if(r){const{decorationHeight:e}=a;s.forEach(i=>r.forEach(n=>t.strokeRect(i.x,i.y+n,i.width,e)))}},drawStrokesStyle:function(e,t,n,a,s,r){let o;const l=a.__,{__hasMultiStrokeStyle:d}=l;d||s.setStroke(void 0,l.__strokeWidth*t,l);for(let c=0,h=e.length;c<h;c++)if(o=e[c],(!o.image||!i.PaintImage.checkImage(o,!1,a,s,r))&&o.style){if(d){const{strokeStyle:e}=o;e?s.setStroke(o.style,l.__getRealStrokeWidth(e)*t,l,e):s.setStroke(o.style,l.__strokeWidth*t,l)}else s.strokeStyle=o.style;o.originPaint.blendMode?(s.saveBlendMode(o.originPaint.blendMode),n?i.Paint.drawTextStroke(a,s,r):s.stroke(),s.restoreBlendMode()):n?i.Paint.drawTextStroke(a,s,r):s.stroke()}},shape:function(e,i,n){const a=i.getSameCanvas(),s=i.bounds,r=e.__nowWorld,o=e.__layout,l=e.__nowWorldShapeBounds||(e.__nowWorldShapeBounds={});let d,c,h,u,f,p;R(o.strokeSpread?(B(T,o.boxBounds,o.strokeSpread),T):o.boxBounds,r,l);let{scaleX:g,scaleY:m}=e.getRenderScaleData(!0);if(s.includes(l))p=a,d=f=l,c=r;else{let a;if(t.Platform.fullImageShadow)a=l;else{const e=o.renderShapeSpread?S(s,t.FourNumberHelper.swapAndScale(o.renderShapeSpread,g,m)):s;a=O(e,l)}u=s.getFitMatrix(a);let{a:_,d:w}=u;u.a<1&&(p=i.getSameCanvas(),e.__renderShape(p,n),g*=_,m*=w),f=k(l,u),d=C(f,-u.e,-u.f),c=k(r,u),A(c,-u.e,-u.f);const y=n.matrix;y?(h=new t.Matrix(u),h.multiply(y),_*=y.scaleX,w*=y.scaleY):h=u,h.withScale(_,w),n=Object.assign(Object.assign({},n),{matrix:h})}return e.__renderShape(a,n),{canvas:a,matrix:h,fitMatrix:u,bounds:d,renderBounds:c,worldCanvas:p,shapeBounds:f,scaleX:g,scaleY:m}}};let F,z=new t.Bounds;const{isSame:j}=t.BoundsHelper;function U(e,n,a,s,r,o){let l=!0;const d=e.__;if("fill"!==n||d.__naturalWidth||(d.__naturalWidth=s.width/d.pixelRatio,d.__naturalHeight=s.height/d.pixelRatio,d.__autoSide&&(e.forceUpdate("width"),t.LeafHelper.updateBounds(e),e.__proxyData&&(e.setProxyAttr("width",d.width),e.setProxyAttr("height",d.height)),l=!1)),"brush"===a.mode&&i.PaintImage.brush(r,e,n),!r.data){i.PaintImage.createData(r,s,a,o);const{transform:e}=r.data,{opacity:t}=a,n=(e&&!e.onlyScale||d.path||d.cornerRadius)&&!r.brush;(n||t&&t<1||a.blendMode)&&(r.complex=!n||2)}return a.filter&&i.PaintImage.applyFilter(r,s,a.filter,e),l}function N(e,i){G(e,t.ImageEvent.LOAD,i)}function V(e,i){G(e,t.ImageEvent.LOADED,i)}function Y(e,i,n){i.error=n,e.forceUpdate("surface"),G(e,t.ImageEvent.ERROR,i)}function G(e,i,n){e.hasEvent(i)&&e.emitEvent(new t.ImageEvent(i,n))}function X(e,t){const{leafer:i}=e;i&&i.viewReady&&(i.renderer.ignore=t)}const{get:q,translate:Q}=t.MatrixHelper,$=new t.Bounds,Z={},K={};function J(e,i,n,a){const s=t.isString(e)||a?(a?n-a*i:n%i)/((a||Math.floor(n/i))-1):e;return"auto"===e&&s<0?0:s}let ee={},te=t.getMatrixData();const{get:ie,set:ne,rotateOfOuter:ae,translate:se,scaleOfOuter:re,multiplyParent:oe,scale:le,rotate:de,skew:ce}=t.MatrixHelper;function he(e,t,i,n,a,s,r,o){r&&de(e,r),o&&ce(e,o.x,o.y),a&&le(e,a,s),se(e,t.x+i,t.y+n)}const{get:ue,scale:fe,copy:pe}=t.MatrixHelper,{getFloorScale:ge}=t.MathHelper,{abs:me}=Math;const _e={image:function(e,i,n,a,s){let r,o;const l=t.ImageManager.get(n,n.type);return F&&n===F.paint&&j(a,F.boxBounds)?r=F.leafPaint:(r={type:n.type,image:l},l.hasAlphaPixel&&(r.isTransparent=!0),F=l.use>1?{leafPaint:r,paint:n,boxBounds:z.set(a)}:null),(s||l.loading)&&(o={image:l,attrName:i,attrValue:n}),l.ready?(U(e,i,n,l,r,a),s&&(N(e,o),V(e,o))):l.error?s&&Y(e,o,l.error):(s&&(X(e,!0),N(e,o)),r.loadId=l.load(()=>{X(e,!1),e.destroyed||(U(e,i,n,l,r,a)&&(l.hasAlphaPixel&&(e.__layout.hitCanvasChanged=!0),e.forceUpdate("surface")),V(e,o)),r.loadId=void 0},t=>{X(e,!1),Y(e,o,t),r.loadId=void 0},n.lod&&l.getThumbSize(n.lod)),e.placeholderColor&&(e.placeholderDelay?setTimeout(()=>{l.ready||(l.isPlacehold=!0,e.forceUpdate("surface"))},e.placeholderDelay):l.isPlacehold=!0)),r},checkImage:function(e,n,a,s,r){const{scaleX:o,scaleY:l}=i.PaintImage.getImageRenderScaleData(e,a,s,r),d=e.film?e.nowIndex:o+"-"+l,{image:c,brush:h,data:u,originPaint:f}=e,{exporting:p,snapshot:g}=r;if(!u||e.patternId===d&&!p||g){if(!h||!e.style)return!1}else if(n&&(u.repeat?n=!1:f.changeful||e.film||"miniapp"===t.Platform.name||p||(n=t.Platform.image.isLarge(c,o,l)||c.width*o>8096||c.height*l>8096)),n)a.__.__isFastShadow&&(s.fillStyle=e.style||"#000",s.fill());else if(!e.style||f.sync||p?i.PaintImage.createPattern(e,a,s,r):i.PaintImage.createPatternTask(e,a,s,r),!h||!e.style)return!1;return i.PaintImage.drawImage(e,o,l,a,s,r),!0},drawImage:function(e,t,i,n,a,s){const{data:r,image:o,brush:l,complex:d}=e;let{width:c,height:h}=o,u=l||o;if(d){const{blendMode:s,opacity:o}=e.originPaint,{transform:l}=r;a.save(),2===d&&a.clipUI(n),s&&(a.blendMode=s),o&&(a.opacity*=o),l&&a.transform(l),u.render(a,0,0,c,h,n,e,t,i),a.restore()}else r.scaleX&&(c*=r.scaleX,h*=r.scaleY),u.render(a,0,0,c,h,n,e,t,i)},getImageRenderScaleData:function(e,t,n,a){const s=t.getRenderScaleData(!0,e.originPaint.scaleFixed),{data:r}=e;if(e.brush&&i.PaintImage.addBrushScale(s,e,t),n){const{pixelRatio:e}=n;s.scaleX*=e,s.scaleY*=e}return r&&r.scaleX&&(s.scaleX*=Math.abs(r.scaleX),s.scaleY*=Math.abs(r.scaleY)),s},recycleImage:function(e,n){const a=n["_"+e];if(t.isArray(a)){let s,r,o,l,d;const c=n.__leaf;for(let h=0,u=a.length;h<u;h++)s=a[h],r=s.image,d=r&&r.url,d&&(o||(o={}),o[d]=!0,t.ImageManager.recyclePaint(s),s.brush&&i.PaintImage.recycleBrush(s,c),n.__willDestroy&&r.parent&&i.PaintImage.recycleFilter(r,c),r.loading&&(l||(l=n.__input&&n.__input[e]||[],t.isArray(l)||(l=[l])),r.unload(a[h].loadId,!l.some(e=>e.url===d))));return o}return null},createPatternTask:function(e,a,s,r){e.patternTask||(e.patternTask=t.ImageManager.patternTasker.add(()=>n(this,void 0,void 0,function*(){i.PaintImage.createPattern(e,a,s,r),a.forceUpdate("surface")}),0,()=>(e.patternTask=null,s.bounds.hit(a.__nowWorld))))},createPattern:function(e,n,a,s){let{scaleX:r,scaleY:o}=i.PaintImage.getImageRenderScaleData(e,n,a,s),l=e.film?e.nowIndex:r+"-"+o;if(e.patternId!==l&&!n.destroyed&&(!t.Platform.image.isLarge(e.image,r,o)||e.data.repeat)){const{image:d,brush:c,data:h}=e,{transform:u,gap:f}=h,p=i.PaintImage.getPatternFixScale(e,r,o);let g,m,_,{width:w,height:y}=d,{opacity:v}=e.originPaint;if((c||1===v)&&(v=void 0),p&&(r*=p,o*=p),w*=r,y*=o,f&&(m=f.x*r/me(h.scaleX||1),_=f.y*o/me(h.scaleY||1),c)){const t=i.PaintImage.getBrushScale(e,n);m/=t,_/=t}(u||1!==r||1!==o)&&(r*=ge(w+(m||0)),o*=ge(y+(_||0)),g=ue(),u&&pe(g,u),fe(g,1/r,1/o));const x=d.getCanvas(w,y,v,void 0,m,_,n.leafer&&n.leafer.config.smooth,h.interlace);c?(e.style=x,i.PaintImage.cacheBrush(e,n,a,s)):e.style=d.getPattern(x,h.repeat||t.Platform.origin.noRepeat||"no-repeat",g,e),e.patternId=l}},getPatternFixScale:function(e,i,n){const{image:a}=e;let s,r=t.Platform.image.maxPatternSize,o=a.width*a.height;return a.isSVG?i>1&&(s=Math.ceil(i)/i):r>o&&(r=o),(o*=i*n)>r&&(s=Math.sqrt(r/o)),s},createData:function(e,t,n,a){e.data=i.PaintImage.getPatternData(n,a,t)},getPatternData:function(e,n,a){e.padding&&(n=$.set(n).shrink(e.padding)),"strench"===e.mode&&(e.mode="stretch");const{width:s,height:r}=a,{mode:o,align:l,offset:d,scale:c,size:h,rotation:u,skew:f,clipSize:p,repeat:g,gap:m,interlace:_}=e,w=n.width===s&&n.height===r,y={mode:o},v="center"!==l&&(u||0)%180==90;let x,b;switch(t.BoundsHelper.set(K,0,0,v?r:s,v?s:r),o&&"cover"!==o&&"fit"!==o?((c||h)&&(t.MathHelper.getScaleData(c,h,a,Z),x=Z.scaleX,b=Z.scaleY),(l||m||g)&&(x&&t.BoundsHelper.scale(K,x,b,!0),l&&t.AlignHelper.toPoint(l,K,n,K,!0,!0))):w&&!u||(x=b=t.BoundsHelper.getFitScale(n,K,"fit"!==o),t.BoundsHelper.put(n,a,l,x,!1,K),t.BoundsHelper.scale(K,x,b,!0)),d&&t.PointHelper.move(K,d),o){case"stretch":w?x&&(x=b=void 0):(x=n.width/s,b=n.height/r,i.PaintImage.stretchMode(y,n,x,b));break;case"normal":case"clip":if(K.x||K.y||x||p||u||f){let e,t;p&&(e=n.width/p.width,t=n.height/p.height),i.PaintImage.clipMode(y,n,K.x,K.y,x,b,u,f,e,t),e&&(x=x?x*e:e,b=b?b*t:t)}break;case"repeat":(!w||x||u||f)&&i.PaintImage.repeatMode(y,n,s,r,K.x,K.y,x,b,u,f,l,e.freeTransform);case"brush":g||(y.repeat="repeat");const a=t.isObject(g);(m||a)&&(y.gap=function(e,i,n,a,s){let r,o;t.isObject(e)?(r=e.x,o=e.y):r=o=e;return{x:J(r,n,s.width,i&&i.x),y:J(o,a,s.height,i&&i.y)}}(m,a&&g,K.width,K.height,n));break;default:x&&i.PaintImage.fillOrFitMode(y,n,K.x,K.y,x,b,u)}return y.transform||"brush"===o||(n.x||n.y)&&Q(y.transform=q(),n.x,n.y),x&&(y.scaleX=x,y.scaleY=b),g&&(y.repeat=t.isString(g)?"x"===g?"repeat-x":"repeat-y":"repeat"),_&&(y.interlace=t.isNumber(_)||"percent"===_.type?{type:"x",offset:_}:_),y},stretchMode:function(e,t,i,n){const a=ie(),{x:s,y:r}=t;s||r?se(a,s,r):i>0&&n>0&&(a.onlyScale=!0),le(a,i,n),e.transform=a},fillOrFitMode:function(e,t,i,n,a,s,r){const o=ie();se(o,t.x+i,t.y+n),le(o,a,s),r&&ae(o,{x:t.x+t.width/2,y:t.y+t.height/2},r),e.transform=o},clipMode:function(e,t,i,n,a,s,r,o,l,d){const c=ie();he(c,t,i,n,a,s,r,o),l&&(r||o?(ne(te),re(te,t,l,d),oe(c,te)):re(c,t,l,d)),e.transform=c},repeatMode:function(e,t,i,n,a,s,r,o,l,d,c,h){const u=ie();if(h)he(u,t,a,s,r,o,l,d);else{if(l)if("center"===c)ae(u,{x:i/2,y:n/2},l);else switch(de(u,l),l){case 90:se(u,n,0);break;case 180:se(u,i,n);break;case 270:se(u,0,i)}ee.x=t.x+a,ee.y=t.y+s,se(u,ee.x,ee.y),r&&re(u,ee,r,o)}e.transform=u}},{toPoint:we}=t.AroundHelper,{hasTransparent:ye}=i.ColorConvert,ve={},xe={};function be(e,n,a,s){if(a){let r,o,l,d;for(let e=0,c=a.length;e<c;e++)r=a[e],t.isString(r)?(l=e/(c-1),o=i.ColorConvert.string(r,s)):(l=r.offset,o=i.ColorConvert.string(r.color,s)),n.addColorStop(l,o),!d&&ye(o)&&(d=!0);d&&(e.isTransparent=!0)}}const{getAngle:Pe,getDistance:Ee}=t.PointHelper,{get:Le,rotateOfOuter:Se,scaleOfOuter:Be}=t.MatrixHelper,{toPoint:Re}=t.AroundHelper,ke={},Ce={};function Ae(e,t,i,n,a){let s;const{width:r,height:o}=e;if(r!==o||n){const e=Pe(t,i);s=Le(),a?(Be(s,t,r/o*(n||1),1),Se(s,t,e+90)):(Be(s,t,1,r/o*(n||1)),Se(s,t,e))}return s}const{getDistance:Oe}=t.PointHelper,{toPoint:Te}=t.AroundHelper,Ie={},Me={};const De={linearGradient:function(e,i){let{from:n,to:a,type:s,opacity:r}=e;we(n||"top",i,ve),we(a||"bottom",i,xe);const o=t.Platform.canvas.createLinearGradient(ve.x,ve.y,xe.x,xe.y),l={type:s,style:o};return be(l,o,e.stops,r),l},radialGradient:function(e,i){let{from:n,to:a,type:s,opacity:r,stretch:o}=e;Re(n||"center",i,ke),Re(a||"bottom",i,Ce);const l=t.Platform.canvas.createRadialGradient(ke.x,ke.y,0,ke.x,ke.y,Ee(ke,Ce)),d={type:s,style:l};be(d,l,e.stops,r);const c=Ae(i,ke,Ce,o,!0);return c&&(d.transform=c),d},conicGradient:function(e,i){let{from:n,to:a,type:s,opacity:r,rotation:o,stretch:l}=e;Te(n||"center",i,Ie),Te(a||"bottom",i,Me);const d=t.Platform.conicGradientSupport?t.Platform.canvas.createConicGradient(o?o*t.OneRadian:0,Ie.x,Ie.y):t.Platform.canvas.createRadialGradient(Ie.x,Ie.y,0,Ie.x,Ie.y,Oe(Ie,Me)),c={type:s,style:d};be(c,d,e.stops,r);const h=Ae(i,Ie,Me,l||1,t.Platform.conicGradientRotate90);return h&&(c.transform=h),c},getTransform:Ae},{copy:We,move:He,toOffsetOutBounds:Fe}=t.BoundsHelper,{max:ze,abs:je}=Math,Ue={},Ne=new t.Matrix,Ve={};function Ye(e,t){let i,n,a,s,r=0,o=0,l=0,d=0;return t.forEach(e=>{i=e.x||0,n=e.y||0,s=1.5*(e.blur||0),a=je(e.spread||0),r=ze(r,a+s-n),o=ze(o,a+s+i),l=ze(l,a+s+n),d=ze(d,a+s-i)}),r===o&&o===l&&l===d?r:[r,o,l,d]}function Ge(e,i,n){const{shapeBounds:a}=n;let s,r;t.Platform.fullImageShadow?(We(Ue,e.bounds),He(Ue,i.x-a.x,i.y-a.y),s=e.bounds,r=Ue):(s=a,r=i),e.copyWorld(n.canvas,s,r)}const{toOffsetOutBounds:Xe}=t.BoundsHelper,qe={};const Qe=Ye;const $e={shadow:function(e,n,a){let s,r;const{__nowWorld:o}=e,{shadow:l}=e.__,{worldCanvas:d,bounds:c,renderBounds:h,shapeBounds:u,scaleX:f,scaleY:p}=a,g=n.getSameCanvas(),m=l.length-1;Fe(c,Ve,h),l.forEach((l,_)=>{let w=1;if(l.scaleFixed){const e=Math.abs(o.scaleX);e>1&&(w=1/e)}g.setWorldShadow(Ve.offsetX+(l.x||0)*f*w,Ve.offsetY+(l.y||0)*p*w,(l.blur||0)*f*w,i.ColorConvert.string(l.color)),r=i.Effect.getShadowTransform(e,g,a,l,Ve,w),r&&g.setTransform(r),Ge(g,Ve,a),r&&g.resetTransform(),s=h,l.box&&(g.restore(),g.save(),d&&(g.copyWorld(g,h,o,"copy"),s=o),d?g.copyWorld(d,o,o,"destination-out"):g.copyWorld(a.canvas,u,c,"destination-out")),t.LeafHelper.copyCanvasByWorld(e,n,g,s,l.blendMode),m&&_<m&&g.clearWorld(s)}),g.recycle(s)},innerShadow:function(e,n,a){let s,r;const{__nowWorld:o}=e,{innerShadow:l}=e.__,{worldCanvas:d,bounds:c,renderBounds:h,shapeBounds:u,scaleX:f,scaleY:p}=a,g=n.getSameCanvas(),m=l.length-1;Xe(c,qe,h),l.forEach((l,_)=>{let w=1;if(l.scaleFixed){const e=Math.abs(o.scaleX);e>1&&(w=1/e)}g.save(),g.setWorldShadow(qe.offsetX+(l.x||0)*f*w,qe.offsetY+(l.y||0)*p*w,(l.blur||0)*f*w),r=i.Effect.getShadowTransform(e,g,a,l,qe,w,!0),r&&g.setTransform(r),Ge(g,qe,a),g.restore(),d?(g.copyWorld(g,h,o,"copy"),g.copyWorld(d,o,o,"source-out"),s=o):(g.copyWorld(a.canvas,u,c,"source-out"),s=h),g.fillWorld(s,i.ColorConvert.string(l.color),"source-in"),t.LeafHelper.copyCanvasByWorld(e,n,g,s,l.blendMode),m&&_<m&&g.clearWorld(s)}),g.recycle(s)},blur:function(e,t,i){const{blur:n}=e.__;i.setWorldBlur(n*e.__nowWorld.a),i.copyWorldToInner(t,e.__nowWorld,e.__layout.renderBounds),i.filter="none"},backgroundBlur:function(e,t,i){},getShadowRenderSpread:Ye,getShadowTransform:function(e,t,i,n,a,s,r){if(n.spread){const i=2*n.spread*s*(r?-1:1),{width:o,height:l}=e.__layout.strokeBounds;return Ne.set().scaleOfOuter({x:(a.x+a.width/2)*t.pixelRatio,y:(a.y+a.height/2)*t.pixelRatio},1+i/o,1+i/l),Ne}},isTransformShadow(e){},getInnerShadowSpread:Qe},{excludeRenderBounds:Ze}=t.LeafBoundsHelper;let Ke;function Je(e,t,i,n,a,s,r,o){switch(t){case"grayscale":Ke||(Ke=!0,a.useGrayscaleAlpha(e.__nowWorld));case"alpha":!function(e,t,i,n,a,s){const r=e.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(n,r),s&&n.recycle(r);tt(e,t,i,1,a,s)}(e,i,n,a,r,o);break;case"opacity-path":tt(e,i,n,s,r,o);break;case"path":o&&i.restore()}}function et(e){return e.getSameCanvas(!1,!0)}function tt(e,t,i,n,a,s){const r=e.__nowWorld;t.resetTransform(),t.opacity=n,t.copyWorld(i,r,void 0,a),s?i.recycle(r):i.clearWorld(r)}i.Group.prototype.__renderMask=function(e,t){let i,n,a,s,r,o;const{children:l}=this;for(let d=0,c=l.length;d<c;d++){if(i=l[d],o=i.__.mask,o){r&&(Je(this,r,e,a,n,s,void 0,!0),n=a=null),"clipping"!==o&&"clipping-path"!==o||Ze(i,t)||i.__render(e,t),s=i.__.opacity,Ke=!1,"path"===o||"clipping-path"===o?(s<1?(r="opacity-path",a||(a=et(e))):(r="path",e.save()),i.__clip(a||e,t)):(r="grayscale"===o?"grayscale":"alpha",n||(n=et(e)),a||(a=et(e)),i.__render(n,t));continue}const c=1===s&&i.__.__blendMode;c&&Je(this,r,e,a,n,s,void 0,!1),Ze(i,t)||i.__render(a||e,t),c&&Je(this,r,e,a,n,s,c,!1)}Je(this,r,e,a,n,s,void 0,!0)};const it=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",nt=it+"_#~&*+\\=|≮≯≈≠=…",at=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(([e,t])=>`[\\u${e.toString(16)}-\\u${t.toString(16)}]`).join("|"));function st(e){const t={};return e.split("").forEach(e=>t[e]=!0),t}const rt=st("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),ot=st("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),lt=st(it),dt=st(nt),ct=st("- —/~|┆·");var ht;!function(e){e[e.Letter=0]="Letter",e[e.Single=1]="Single",e[e.Before=2]="Before",e[e.After=3]="After",e[e.Symbol=4]="Symbol",e[e.Break=5]="Break"}(ht||(ht={}));const{Letter:ut,Single:ft,Before:pt,After:gt,Symbol:mt,Break:_t}=ht;function wt(e){return rt[e]?ut:ct[e]?_t:ot[e]?pt:lt[e]?gt:dt[e]?mt:at.test(e)?ft:ut}const yt={trimRight(e){const{words:t}=e;let i,n=0,a=t.length;for(let s=a-1;s>-1&&(i=t[s].data[0]," "===i.char);s--)n++,e.width-=i.width;n&&t.splice(a-n,n)}};function vt(e,t,i){switch(t){case"title":return i?e.toUpperCase():e;case"upper":return e.toUpperCase();case"lower":return e.toLowerCase();default:return e}}const{trimRight:xt}=yt,{Letter:bt,Single:Pt,Before:Et,After:Lt,Symbol:St,Break:Bt}=ht;let Rt,kt,Ct,At,Ot,Tt,It,Mt,Dt,Wt,Ht,Ft,zt,jt,Ut,Nt,Vt,Yt=[];function Gt(e,t){Dt&&!Mt&&(Mt=Dt),Rt.data.push({char:e,width:t}),Ct+=t}function Xt(){At+=Ct,Rt.width=Ct,kt.words.push(Rt),Rt={data:[]},Ct=0}function qt(){jt&&(Ut.paraNumber++,kt.paraStart=!0,jt=!1),Dt&&(kt.startCharSize=Mt,kt.endCharSize=Dt,Mt=0),kt.width=At,Nt.width?xt(kt):Vt&&Qt(),Yt.push(kt),kt={words:[]},At=0}function Qt(){At>(Ut.maxWidth||0)&&(Ut.maxWidth=At)}const{top:$t,right:Zt,bottom:Kt,left:Jt}=t.Direction4;function ei(e,t,i){const{bounds:n,rows:a}=e;n[t]+=i;for(let e=0;e<a.length;e++)a[e][t]+=i}const ti={getDrawData:function(e,n){t.isString(e)||(e=String(e));let a=0,s=0,r=n.__getInput("width")||0,o=n.__getInput("height")||0;const{__padding:l}=n;l&&(r?(a=l[Jt],r-=l[Zt]+l[Jt],!r&&(r=.01)):n.autoSizeAlign||(a=l[Jt]),o?(s=l[$t],o-=l[$t]+l[Kt],!o&&(o=.01)):n.autoSizeAlign||(s=l[$t]));const d={bounds:{x:a,y:s,width:r,height:o},rows:[],paraNumber:0,font:t.Platform.canvas.font=n.__font};return function(e,i,n){Ut=e,Yt=e.rows,Nt=e.bounds,Vt=!Nt.width&&!n.autoSizeAlign;const{__letterSpacing:a,paraIndent:s,textCase:r}=n,{canvas:o}=t.Platform,{width:l}=Nt;if(n.__isCharMode){const e="none"!==n.textWrap,t="break"===n.textWrap;jt=!0,Ht=null,Mt=It=Dt=Ct=At=0,Rt={data:[]},kt={words:[]};for(let n=0,d=(i=[...i]).length;n<d;n++)Tt=i[n],"\n"===Tt?(Ct&&Xt(),kt.paraEnd=!0,qt(),jt=!0):(Wt=wt(Tt),Wt===bt&&"none"!==r&&(Tt=vt(Tt,r,!Ct)),It=o.measureText(Tt).width,a&&(a<0&&(Dt=It),It+=a),Ft=Wt===Pt&&(Ht===Pt||Ht===bt)||Ht===Pt&&Wt!==Lt,zt=!(Wt!==Et&&Wt!==Pt||Ht!==St&&Ht!==Lt),Ot=jt&&s?l-s:l,e&&l&&At+Ct+It>Ot&&(t?(Ct&&Xt(),At&&qt()):(zt||(zt=Wt===bt&&Ht==Lt),Ft||zt||Wt===Bt||Wt===Et||Wt===Pt||Ct+It>Ot?(Ct&&Xt(),At&&qt()):At&&qt()))," "===Tt&&!0!==jt&&At+Ct===0||(Wt===Bt?(" "===Tt&&Ct&&Xt(),Gt(Tt,It),Xt()):Ft||zt?(Ct&&Xt(),Gt(Tt,It)):Gt(Tt,It)),Ht=Wt);Ct&&Xt(),At&&qt(),Yt.length>0&&(Yt[Yt.length-1].paraEnd=!0)}else i.split("\n").forEach(e=>{Ut.paraNumber++,At=o.measureText(e).width,Yt.push({x:s||0,text:e,width:At,paraStart:!0}),Vt&&Qt()})}(d,e,n),l&&function(e,t,i,n,a){if(!n&&i.autoSizeAlign)switch(i.textAlign){case"left":ei(t,"x",e[Jt]);break;case"right":ei(t,"x",-e[Zt])}if(!a&&i.autoSizeAlign)switch(i.verticalAlign){case"top":ei(t,"y",e[$t]);break;case"bottom":ei(t,"y",-e[Kt])}}(l,d,n,r,o),function(e,t){const{rows:i,bounds:n}=e,a=i.length,{__lineHeight:s,__baseLine:r,__letterSpacing:o,__clipText:l,textAlign:d,verticalAlign:c,paraSpacing:h,autoSizeAlign:u}=t;let{x:f,y:p,width:g,height:m}=n,_=s*a+(h?h*(e.paraNumber-1):0),w=r;if(l&&_>m)_=Math.max(t.__autoHeight?_:m,s),a>1&&(e.overflow=a);else if(m||u)switch(c){case"middle":p+=(m-_)/2;break;case"bottom":p+=m-_}w+=p;let y,v,x,b=g||u?g:e.maxWidth;for(let r=0,c=a;r<c;r++){if(y=i[r],y.x=f,y.width<g||y.width>g&&!l)switch(d){case"center":y.x+=(b-y.width)/2;break;case"right":y.x+=b-y.width}y.paraStart&&h&&r>0&&(w+=h),y.y=w,w+=s,e.overflow>r&&w>_&&(y.isOverflow=!0,e.overflow=r+1),v=y.x,x=y.width,o<0&&(y.width<0?(x=-y.width+t.fontSize+o,v-=x,x+=t.fontSize):x-=o),v<n.x&&(n.x=v),x>n.width&&(n.width=x),l&&g&&g<x&&(y.isOverflow=!0,e.overflow||(e.overflow=i.length))}n.y=p,n.height=_}(d,n),n.__isCharMode&&function(e,t,i){const{rows:n}=e,{textAlign:a,paraIndent:s,__letterSpacing:r}=t,o=i&&a.includes("both"),l=o||i&&a.includes("justify"),d=l&&a.includes("letter");let c,h,u,f,p,g,m,_,w,y;n.forEach(e=>{e.words&&(p=s&&e.paraStart?s:0,_=e.words.length,l&&(y=!e.paraEnd||o,h=i-e.width-p,d?f=h/(e.words.reduce((e,t)=>e+t.data.length,0)-1):u=_>1?h/(_-1):0),g=r||e.isOverflow||d?0:u?1:2,e.isOverflow&&!r&&(e.textMode=!0),2===g?(e.x+=p,function(e){e.text="",e.words.forEach(t=>{t.data.forEach(t=>{e.text+=t.char})})}(e)):(e.x+=p,c=e.x,e.data=[],e.words.forEach((t,i)=>{1===g?(m={char:"",x:c},c=function(e,t,i){return e.forEach(e=>{i.char+=e.char,t+=e.width}),t}(t.data,c,m),(e.isOverflow||" "!==m.char)&&e.data.push(m)):c=function(e,t,i,n,a){return e.forEach(e=>{(n||" "!==e.char)&&(e.x=t,i.push(e)),t+=e.width,a&&(t+=a)}),t}(t.data,c,e.data,e.isOverflow,y&&f),y&&(w=i===_-1,u?w||(c+=u,e.width+=u):f&&(e.width+=f*(t.data.length-(w?1:0))))})),e.words=null)})}(d,n,r),d.overflow&&function(e,i,n,a){const{rows:s,overflow:r}=e;let{textOverflow:o}=i;if(r&&s.splice(r),a&&o&&"show"!==o){let e,l;"hide"===o?o="":"ellipsis"===o&&(o="...");const d=o?t.Platform.canvas.measureText(o).width:0,c=n+a-d;("none"===i.textWrap?s:[s[r-1]]).forEach(t=>{if(t.isOverflow&&t.data){let i=t.data.length-1;for(let n=i;n>-1&&(e=t.data[n],l=e.x+e.width,!(n===i&&l<c));n--){if(l<c&&" "!==e.char||!n){t.data.splice(n+1),t.width-=e.width;break}t.width-=e.width}t.width+=d,t.data.push({char:o,x:l}),t.textMode&&function(e){e.text="",e.data.forEach(t=>{e.text+=t.char}),e.data=null}(t)}})}}(d,n,a,r),"none"!==n.textDecoration&&function(e,n){let a,s=0;const{fontSize:r,textDecoration:o}=n;switch(e.decorationHeight=r/11,t.isObject(o)?(a=o.type,o.color&&(e.decorationColor=i.ColorConvert.string(o.color)),o.offset&&(s=Math.min(.3*r,Math.max(o.offset,.15*-r)))):a=o,a){case"under":e.decorationY=[.15*r+s];break;case"delete":e.decorationY=[.35*-r];break;case"under-delete":e.decorationY=[.15*r+s,.35*-r]}}(d,n),d}};const ii={string:function(e,n){if(!e)return"#000";const a=t.isNumber(n)&&n<1;if(t.isString(e)){if(!a||!i.ColorConvert.object)return e;e=i.ColorConvert.object(e)}let s=t.isUndefined(e.a)?1:e.a;a&&(s*=n);const r=e.r+","+e.g+","+e.b;return 1===s?"rgb("+r+")":"rgba("+r+","+s+")"}};Object.assign(i.TextConvert,ti),Object.assign(i.ColorConvert,ii),Object.assign(i.Paint,H),Object.assign(i.PaintImage,_e),Object.assign(i.PaintGradient,De),Object.assign(i.Effect,$e),r(),Object.defineProperty(exports,"LeaferFilm",{enumerable:!0,get:function(){return t.LeaferFilm}}),Object.defineProperty(exports,"LeaferImage",{enumerable:!0,get:function(){return t.LeaferImage}}),Object.defineProperty(exports,"LeaferVideo",{enumerable:!0,get:function(){return t.LeaferVideo}}),exports.Layouter=y,exports.LeaferCanvas=s,exports.Renderer=x,exports.Watcher=l,exports.useCanvas=r,Object.keys(t).forEach(function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}})}),Object.keys(i).forEach(function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return i[e]}})});
|
|
2
2
|
//# sourceMappingURL=web.min.cjs.map
|