@leafer-draw/worker 2.2.6 → 2.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/worker.cjs +70 -46
- package/dist/worker.esm.js +69 -47
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.esm.min.js.map +1 -1
- package/dist/worker.js +98 -66
- package/dist/worker.min.cjs +1 -1
- package/dist/worker.min.cjs.map +1 -1
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +98 -68
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +7 -7
package/dist/worker.js
CHANGED
|
@@ -4513,7 +4513,7 @@ var LeaferUI = function(exports) {
|
|
|
4513
4513
|
const LeafHelper = {
|
|
4514
4514
|
updateAllMatrix(leaf, checkAutoLayout, waitAutoLayout) {
|
|
4515
4515
|
if (checkAutoLayout && leaf.__hasAutoLayout && leaf.__layout.matrixChanged) waitAutoLayout = true;
|
|
4516
|
-
updateMatrix$
|
|
4516
|
+
updateMatrix$1(leaf, checkAutoLayout, waitAutoLayout);
|
|
4517
4517
|
if (leaf.isBranch) {
|
|
4518
4518
|
const {children: children} = leaf;
|
|
4519
4519
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
@@ -4534,9 +4534,10 @@ var LeaferUI = function(exports) {
|
|
|
4534
4534
|
if (layout.matrixChanged) leaf.__updateLocalMatrix();
|
|
4535
4535
|
if (!layout.waitAutoLayout) leaf.__updateWorldMatrix();
|
|
4536
4536
|
},
|
|
4537
|
-
updateBounds(leaf) {
|
|
4537
|
+
updateBounds(leaf, noUpdateSize) {
|
|
4538
4538
|
const layout = leaf.__layout;
|
|
4539
4539
|
if (layout.boundsChanged) leaf.__updateLocalBounds();
|
|
4540
|
+
if (noUpdateSize) layout.resized = undefined;
|
|
4540
4541
|
if (!layout.waitAutoLayout) leaf.__updateWorldBounds();
|
|
4541
4542
|
},
|
|
4542
4543
|
updateAllWorldOpacity(leaf) {
|
|
@@ -4559,7 +4560,7 @@ var LeaferUI = function(exports) {
|
|
|
4559
4560
|
}
|
|
4560
4561
|
},
|
|
4561
4562
|
updateAllChange(leaf) {
|
|
4562
|
-
updateChange
|
|
4563
|
+
updateChange(leaf);
|
|
4563
4564
|
if (leaf.isBranch) {
|
|
4564
4565
|
const {children: children} = leaf;
|
|
4565
4566
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
@@ -4729,7 +4730,7 @@ var LeaferUI = function(exports) {
|
|
|
4729
4730
|
}
|
|
4730
4731
|
};
|
|
4731
4732
|
const L = LeafHelper;
|
|
4732
|
-
const {updateAllMatrix: updateAllMatrix$3, updateMatrix: updateMatrix$
|
|
4733
|
+
const {updateAllMatrix: updateAllMatrix$3, updateMatrix: updateMatrix$1, updateAllWorldOpacity: updateAllWorldOpacity, updateAllChange: updateAllChange$1, updateChange: updateChange} = L;
|
|
4733
4734
|
function getTempLocal(t, worldPoint) {
|
|
4734
4735
|
t.updateLayout();
|
|
4735
4736
|
return t.parent ? PointHelper.tempToInnerOf(worldPoint, t.parent.scrollWorldTransform) : worldPoint;
|
|
@@ -4770,7 +4771,7 @@ var LeaferUI = function(exports) {
|
|
|
4770
4771
|
if (target.__.mask) findMask = 1;
|
|
4771
4772
|
return findMask < 0 ? null : (findMask && (findMask = -1), true);
|
|
4772
4773
|
}
|
|
4773
|
-
const {updateBounds: updateBounds$
|
|
4774
|
+
const {updateBounds: updateBounds$2} = LeafHelper;
|
|
4774
4775
|
const BranchHelper = {
|
|
4775
4776
|
sort(a, b) {
|
|
4776
4777
|
return a.__.zIndex === b.__.zIndex ? a.__tempNumber - b.__tempNumber : a.__.zIndex - b.__.zIndex;
|
|
@@ -4830,10 +4831,10 @@ var LeaferUI = function(exports) {
|
|
|
4830
4831
|
branch = branchStack[i];
|
|
4831
4832
|
children = branch.children;
|
|
4832
4833
|
for (let j = 0, len = children.length; j < len; j++) {
|
|
4833
|
-
updateBounds$
|
|
4834
|
+
updateBounds$2(children[j]);
|
|
4834
4835
|
}
|
|
4835
4836
|
if (exclude && exclude === branch) continue;
|
|
4836
|
-
updateBounds$
|
|
4837
|
+
updateBounds$2(branch);
|
|
4837
4838
|
}
|
|
4838
4839
|
},
|
|
4839
4840
|
move(branch, x, y) {
|
|
@@ -4892,7 +4893,7 @@ var LeaferUI = function(exports) {
|
|
|
4892
4893
|
}
|
|
4893
4894
|
}
|
|
4894
4895
|
};
|
|
4895
|
-
const {getRelativeWorld: getRelativeWorld$1, updateBounds: updateBounds$
|
|
4896
|
+
const {getRelativeWorld: getRelativeWorld$1, updateBounds: updateBounds$1} = LeafHelper;
|
|
4896
4897
|
const {toOuterOf: toOuterOf$3, getPoints: getPoints, copy: copy$4} = BoundsHelper;
|
|
4897
4898
|
const localContent = "_localContentBounds";
|
|
4898
4899
|
const worldContent = "_worldContentBounds", worldBox = "_worldBoxBounds", worldStroke = "_worldStrokeBounds";
|
|
@@ -4996,7 +4997,7 @@ var LeaferUI = function(exports) {
|
|
|
4996
4997
|
}
|
|
4997
4998
|
update() {
|
|
4998
4999
|
const {leaf: leaf} = this, {leafer: leafer} = leaf;
|
|
4999
|
-
if (leaf.isApp) return updateBounds$
|
|
5000
|
+
if (leaf.isApp) return updateBounds$1(leaf);
|
|
5000
5001
|
if (leafer) {
|
|
5001
5002
|
if (leafer.ready) leafer.watcher.changed && leafer.layouter.layout(); else leafer.start();
|
|
5002
5003
|
} else {
|
|
@@ -5658,9 +5659,12 @@ var LeaferUI = function(exports) {
|
|
|
5658
5659
|
}
|
|
5659
5660
|
},
|
|
5660
5661
|
emitPropertyEvent(type, name, oldValue, newValue) {
|
|
5661
|
-
const
|
|
5662
|
-
|
|
5663
|
-
|
|
5662
|
+
const {leafer: leafer} = this;
|
|
5663
|
+
if (leafer.config.trackChanges || leafer.zoomLayer === this) {
|
|
5664
|
+
const event = new PropertyEvent(type, this, name, oldValue, newValue);
|
|
5665
|
+
this.isLeafer || this.hasEvent(type) && this.emitEvent(event);
|
|
5666
|
+
leafer.emitEvent(event);
|
|
5667
|
+
} else leafer.watcher.add(this);
|
|
5664
5668
|
},
|
|
5665
5669
|
__realSetAttr(name, newValue) {
|
|
5666
5670
|
const data = this.__;
|
|
@@ -5701,8 +5705,8 @@ var LeaferUI = function(exports) {
|
|
|
5701
5705
|
this.__layout.matrixChanged = undefined;
|
|
5702
5706
|
}
|
|
5703
5707
|
};
|
|
5704
|
-
const {updateMatrix: updateMatrix
|
|
5705
|
-
const {updateBounds: updateBounds
|
|
5708
|
+
const {updateMatrix: updateMatrix, updateAllMatrix: updateAllMatrix$2} = LeafHelper;
|
|
5709
|
+
const {updateBounds: updateBounds} = BranchHelper;
|
|
5706
5710
|
const {toOuterOf: toOuterOf$2, copyAndSpread: copyAndSpread$2, copy: copy$3} = BoundsHelper;
|
|
5707
5711
|
const {toBounds: toBounds} = PathBounds;
|
|
5708
5712
|
const LeafBounds = {
|
|
@@ -5802,14 +5806,14 @@ var LeaferUI = function(exports) {
|
|
|
5802
5806
|
if (this.__layout.childrenSortChanged) this.__updateSortChildren();
|
|
5803
5807
|
if (this.__layout.boxChanged) this.__updateFlowLayout();
|
|
5804
5808
|
updateAllMatrix$2(this);
|
|
5805
|
-
updateBounds
|
|
5809
|
+
updateBounds(this, this);
|
|
5806
5810
|
if (this.__.__autoSide) this.__updateBoxBounds(true);
|
|
5807
5811
|
} else {
|
|
5808
5812
|
updateAllMatrix$2(this);
|
|
5809
|
-
updateBounds
|
|
5813
|
+
updateBounds(this, this);
|
|
5810
5814
|
}
|
|
5811
5815
|
} else {
|
|
5812
|
-
updateMatrix
|
|
5816
|
+
updateMatrix(this);
|
|
5813
5817
|
}
|
|
5814
5818
|
},
|
|
5815
5819
|
__updateNaturalSize() {
|
|
@@ -6465,9 +6469,12 @@ var LeaferUI = function(exports) {
|
|
|
6465
6469
|
if (this.isFrame) child.__bindFrame(null);
|
|
6466
6470
|
}
|
|
6467
6471
|
__emitChildEvent(type, child) {
|
|
6468
|
-
const
|
|
6469
|
-
if (
|
|
6470
|
-
|
|
6472
|
+
const {leafer: leafer} = this;
|
|
6473
|
+
if (leafer.config.trackChanges || leafer.zoomLayer === this) {
|
|
6474
|
+
const event = new ChildEvent(type, child, this);
|
|
6475
|
+
if (this.hasEvent(type) && !this.isLeafer) this.emitEvent(event);
|
|
6476
|
+
leafer.emitEvent(event);
|
|
6477
|
+
} else leafer.watcher.addChild(child, this, type);
|
|
6471
6478
|
}
|
|
6472
6479
|
};
|
|
6473
6480
|
exports.Branch = __decorate([ useModule(BranchRender) ], exports.Branch);
|
|
@@ -6616,7 +6623,7 @@ var LeaferUI = function(exports) {
|
|
|
6616
6623
|
this.levelMap = null;
|
|
6617
6624
|
}
|
|
6618
6625
|
}
|
|
6619
|
-
const version = "2.2.
|
|
6626
|
+
const version = "2.2.7";
|
|
6620
6627
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6621
6628
|
get allowBackgroundColor() {
|
|
6622
6629
|
return true;
|
|
@@ -6736,6 +6743,7 @@ var LeaferUI = function(exports) {
|
|
|
6736
6743
|
}
|
|
6737
6744
|
constructor(target, userConfig) {
|
|
6738
6745
|
this.totalTimes = 0;
|
|
6746
|
+
this.changed = 0;
|
|
6739
6747
|
this.config = {};
|
|
6740
6748
|
this.__updatedList = new LeafList;
|
|
6741
6749
|
this.target = target;
|
|
@@ -6755,8 +6763,10 @@ var LeaferUI = function(exports) {
|
|
|
6755
6763
|
this.disabled = true;
|
|
6756
6764
|
}
|
|
6757
6765
|
update() {
|
|
6758
|
-
this.changed
|
|
6759
|
-
|
|
6766
|
+
if (this.changed < 100) {
|
|
6767
|
+
this.changed++;
|
|
6768
|
+
if (this.running) this.target.emit(RenderEvent.REQUEST);
|
|
6769
|
+
}
|
|
6760
6770
|
}
|
|
6761
6771
|
__onAttrChange(event) {
|
|
6762
6772
|
this.add(event.target);
|
|
@@ -6765,18 +6775,21 @@ var LeaferUI = function(exports) {
|
|
|
6765
6775
|
if (this.config.usePartLayout) this.__updatedList.add(leaf);
|
|
6766
6776
|
this.update();
|
|
6767
6777
|
}
|
|
6768
|
-
|
|
6778
|
+
addChild(child, parent, eventType) {
|
|
6769
6779
|
if (this.config.usePartLayout) {
|
|
6770
|
-
if (
|
|
6780
|
+
if (eventType === ChildEvent.ADD) {
|
|
6771
6781
|
this.hasAdd = true;
|
|
6772
|
-
this.__pushChild(
|
|
6782
|
+
this.__pushChild(child);
|
|
6773
6783
|
} else {
|
|
6774
6784
|
this.hasRemove = true;
|
|
6775
|
-
this.__updatedList.add(
|
|
6785
|
+
this.__updatedList.add(parent);
|
|
6776
6786
|
}
|
|
6777
6787
|
}
|
|
6778
6788
|
this.update();
|
|
6779
6789
|
}
|
|
6790
|
+
__onChildEvent(event) {
|
|
6791
|
+
this.addChild(event.child, event.parent, event.type);
|
|
6792
|
+
}
|
|
6780
6793
|
__pushChild(child) {
|
|
6781
6794
|
this.__updatedList.add(child);
|
|
6782
6795
|
if (child.isBranch) this.__loopChildren(child);
|
|
@@ -6791,7 +6804,8 @@ var LeaferUI = function(exports) {
|
|
|
6791
6804
|
}));
|
|
6792
6805
|
this.__updatedList = new LeafList;
|
|
6793
6806
|
this.totalTimes++;
|
|
6794
|
-
this.
|
|
6807
|
+
this.hasVisible = this.hasRemove = this.hasAdd = false;
|
|
6808
|
+
this.changed = 0;
|
|
6795
6809
|
}
|
|
6796
6810
|
__listenEvents() {
|
|
6797
6811
|
this.__eventIds = [ this.target.on_([ [ PropertyEvent.CHANGE, this.__onAttrChange, this ], [ [ ChildEvent.ADD, ChildEvent.REMOVE ], this.__onChildEvent, this ], [ WatchEvent.REQUEST, this.__onRquestData, this ] ]) ];
|
|
@@ -6809,45 +6823,56 @@ var LeaferUI = function(exports) {
|
|
|
6809
6823
|
}
|
|
6810
6824
|
const {updateAllMatrix: updateAllMatrix$1, updateBounds: updateOneBounds, updateChange: updateOneChange} = LeafHelper;
|
|
6811
6825
|
const {pushAllChildBranch: pushAllChildBranch, pushAllParent: pushAllParent} = BranchHelper;
|
|
6812
|
-
|
|
6813
|
-
|
|
6814
|
-
|
|
6815
|
-
|
|
6816
|
-
|
|
6817
|
-
|
|
6818
|
-
|
|
6819
|
-
|
|
6820
|
-
if (
|
|
6821
|
-
|
|
6822
|
-
|
|
6823
|
-
|
|
6824
|
-
if (
|
|
6825
|
-
|
|
6826
|
+
const LayouterHelper = {
|
|
6827
|
+
updateMatrix(updateList, levelList) {
|
|
6828
|
+
let index = 0, leaf, layout;
|
|
6829
|
+
const {list: list} = updateList;
|
|
6830
|
+
while (index < list.length) {
|
|
6831
|
+
leaf = list[index];
|
|
6832
|
+
layout = leaf.__layout;
|
|
6833
|
+
if (levelList.without(leaf) && !layout.proxyZoom) {
|
|
6834
|
+
if (layout.matrixChanged) {
|
|
6835
|
+
updateAllMatrix$1(leaf, true);
|
|
6836
|
+
if (leaf.isBranch) pushAllChildBranch(leaf, levelList);
|
|
6837
|
+
push(leaf, levelList);
|
|
6838
|
+
} else if (layout.boundsChanged) {
|
|
6839
|
+
if (leaf.isBranch) leaf.__tempNumber = 0;
|
|
6840
|
+
push(leaf, levelList);
|
|
6841
|
+
}
|
|
6826
6842
|
}
|
|
6843
|
+
index++;
|
|
6827
6844
|
}
|
|
6828
|
-
}
|
|
6829
|
-
|
|
6830
|
-
|
|
6831
|
-
|
|
6832
|
-
|
|
6833
|
-
|
|
6834
|
-
|
|
6835
|
-
|
|
6836
|
-
|
|
6837
|
-
|
|
6838
|
-
|
|
6839
|
-
|
|
6840
|
-
|
|
6841
|
-
|
|
6845
|
+
},
|
|
6846
|
+
updateBounds(boundsList) {
|
|
6847
|
+
let index = 0, level, list, branch, children;
|
|
6848
|
+
const {levels: levels, levelMap: levelMap} = boundsList;
|
|
6849
|
+
boundsList.sort(true);
|
|
6850
|
+
while (index < levels.length) {
|
|
6851
|
+
level = levels[index];
|
|
6852
|
+
list = levelMap[level];
|
|
6853
|
+
for (let i = 0, len = list.length; i < len; i++) {
|
|
6854
|
+
branch = list[i];
|
|
6855
|
+
if (branch.isBranch && branch.__tempNumber) {
|
|
6856
|
+
children = branch.children;
|
|
6857
|
+
for (let j = 0, jLen = children.length; j < jLen; j++) {
|
|
6858
|
+
if (!children[j].isBranch) {
|
|
6859
|
+
updateOneBounds(children[j]);
|
|
6860
|
+
}
|
|
6842
6861
|
}
|
|
6843
6862
|
}
|
|
6863
|
+
updateOneBounds(branch);
|
|
6844
6864
|
}
|
|
6845
|
-
|
|
6865
|
+
index++;
|
|
6846
6866
|
}
|
|
6847
|
-
}
|
|
6848
|
-
|
|
6849
|
-
|
|
6850
|
-
|
|
6867
|
+
},
|
|
6868
|
+
updateChange(updateList) {
|
|
6869
|
+
updateList.list.forEach(updateOneChange);
|
|
6870
|
+
},
|
|
6871
|
+
push: push
|
|
6872
|
+
};
|
|
6873
|
+
function push(leaf, levelList) {
|
|
6874
|
+
levelList.add(leaf);
|
|
6875
|
+
pushAllParent(leaf, levelList);
|
|
6851
6876
|
}
|
|
6852
6877
|
const {worldBounds: worldBounds} = LeafBoundsHelper;
|
|
6853
6878
|
class LayoutBlockData {
|
|
@@ -6949,9 +6974,9 @@ var LeaferUI = function(exports) {
|
|
|
6949
6974
|
target.emitEvent(new LayoutEvent(BEFORE, blocks, this.times));
|
|
6950
6975
|
this.extraBlock = null;
|
|
6951
6976
|
updateList.sort();
|
|
6952
|
-
updateMatrix(updateList, this.__levelList);
|
|
6953
|
-
updateBounds(this.__levelList);
|
|
6954
|
-
updateChange(updateList);
|
|
6977
|
+
LayouterHelper.updateMatrix(updateList, this.__levelList);
|
|
6978
|
+
LayouterHelper.updateBounds(this.__levelList);
|
|
6979
|
+
LayouterHelper.updateChange(updateList);
|
|
6955
6980
|
if (this.extraBlock) blocks.push(this.extraBlock);
|
|
6956
6981
|
blocks.forEach(item => item.setAfter());
|
|
6957
6982
|
target.emitEvent(new LayoutEvent(LAYOUT, blocks, this.times));
|
|
@@ -6981,11 +7006,16 @@ var LeaferUI = function(exports) {
|
|
|
6981
7006
|
if (target.isBranch) BranchHelper.updateBounds(target); else LeafHelper.updateBounds(target);
|
|
6982
7007
|
updateAllChange(target);
|
|
6983
7008
|
}
|
|
6984
|
-
addExtra(leaf) {
|
|
7009
|
+
addExtra(leaf, updateBounds) {
|
|
6985
7010
|
if (!this.__updatedList.has(leaf)) {
|
|
6986
7011
|
const {updatedList: updatedList, beforeBounds: beforeBounds} = this.extraBlock || (this.extraBlock = new LayoutBlockData([]));
|
|
6987
7012
|
updatedList.length ? beforeBounds.add(leaf.__world) : beforeBounds.set(leaf.__world);
|
|
6988
7013
|
updatedList.add(leaf);
|
|
7014
|
+
if (updateBounds) {
|
|
7015
|
+
const list = this.__levelList;
|
|
7016
|
+
LayouterHelper.push(leaf, list);
|
|
7017
|
+
list.sort(true);
|
|
7018
|
+
}
|
|
6989
7019
|
}
|
|
6990
7020
|
}
|
|
6991
7021
|
createBlock(data) {
|
|
@@ -8098,6 +8128,7 @@ var LeaferUI = function(exports) {
|
|
|
8098
8128
|
start: true,
|
|
8099
8129
|
hittable: true,
|
|
8100
8130
|
smooth: true,
|
|
8131
|
+
trackChanges: true,
|
|
8101
8132
|
lazySpeard: 100
|
|
8102
8133
|
};
|
|
8103
8134
|
this.leafs = 0;
|
|
@@ -9356,7 +9387,7 @@ var LeaferUI = function(exports) {
|
|
|
9356
9387
|
data.__naturalHeight = image.height / data.pixelRatio;
|
|
9357
9388
|
if (data.__autoSide) {
|
|
9358
9389
|
ui.forceUpdate();
|
|
9359
|
-
LeafHelper.updateBounds(ui);
|
|
9390
|
+
LeafHelper.updateBounds(ui, true);
|
|
9360
9391
|
ui.__layout.boundsChanged = true;
|
|
9361
9392
|
if (ui.__proxyData) {
|
|
9362
9393
|
ui.setProxyAttr("width", data.width);
|
|
@@ -10535,6 +10566,7 @@ var LeaferUI = function(exports) {
|
|
|
10535
10566
|
exports.IncrementId = IncrementId;
|
|
10536
10567
|
exports.LayoutEvent = LayoutEvent;
|
|
10537
10568
|
exports.Layouter = Layouter;
|
|
10569
|
+
exports.LayouterHelper = LayouterHelper;
|
|
10538
10570
|
exports.LeafBounds = LeafBounds;
|
|
10539
10571
|
exports.LeafBoundsHelper = LeafBoundsHelper;
|
|
10540
10572
|
exports.LeafData = LeafData;
|
package/dist/worker.min.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e,t=require("@leafer/core"),a=require("@leafer-ui/draw");function n(e,t,a,n){return new(a||(a=Promise))(function(r,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof a?t:new a(function(e){e(t)})).then(s,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;class r extends t.LeaferCanvasBase{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=t.Platform.origin.createCanvas(1,1)}updateViewSize(){const{width:e,height:t,pixelRatio:a}=this;this.view.width=Math.ceil(e*a),this.view.height=Math.ceil(t*a),this.clientBounds=this.bounds}}function i(e,a){t.Platform.origin={createCanvas:(e,t)=>new OffscreenCanvas(e,t),canvasToDataURL:(e,a,n)=>new Promise((r,i)=>{e.convertToBlob({type:t.FileHelper.mimeType(a),quality:n}).then(e=>{var t=new FileReader;t.onload=e=>r(e.target.result),t.onerror=e=>i(e),t.readAsDataURL(e)}).catch(e=>{i(e)})}),canvasToBolb:(e,a,n)=>e.convertToBlob({type:t.FileHelper.mimeType(a),quality:n}),canvasSaveAs:(e,t,a)=>new Promise(e=>e()),download(e,t){},loadImage:(e,a,n)=>new Promise((a,n)=>{let r=new XMLHttpRequest;r.open("GET",t.Platform.image.getRealURL(e),!0),r.responseType="blob",r.onload=()=>{createImageBitmap(r.response).then(e=>{a(e)}).catch(e=>{n(e)})},r.onerror=e=>n(e),r.send()}),loadContent(e){return n(this,arguments,void 0,function*(e,t="text"){const a=yield fetch(e);if(!a.ok)throw new Error(`${a.status}`);return yield a[t]()})}},t.Platform.canvas=t.Creator.canvas(),t.Platform.conicGradientSupport=!!t.Platform.canvas.context.createConicGradient}t.canvasPatch(OffscreenCanvasRenderingContext2D.prototype),t.canvasPatch(Path2D.prototype),Object.assign(t.Creator,{canvas:(e,t)=>new r(e,t),image:e=>new t.LeaferImage(e)}),t.Platform.name="web",t.Platform.isWorker=!0,t.Platform.backgrounder=!0,t.Platform.requestRender=function(e){requestAnimationFrame(e)},t.defineKey(t.Platform,"devicePixelRatio",{get:()=>1});const{userAgent:s}=navigator;s.indexOf("Firefox")>-1?(t.Platform.conicGradientRotate90=!0,t.Platform.intWheelDeltaY=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(t.Platform.fullImageShadow=!0),s.indexOf("Windows")>-1?(t.Platform.os="Windows",t.Platform.intWheelDeltaY=!0):s.indexOf("Mac")>-1?t.Platform.os="Mac":s.indexOf("Linux")>-1&&(t.Platform.os="Linux");class o{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,a){this.totalTimes=0,this.config={},this.__updatedList=new t.LeafList,this.target=e,a&&(this.config=t.DataHelper.default(a,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(t.RenderEvent.REQUEST)}__onAttrChange(e){this.add(e.target)}add(e){this.config.usePartLayout&&this.__updatedList.add(e),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,a=t.length;e<a;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:l,updateBounds:d,updateChange:c}=t.LeafHelper,{pushAllChildBranch:h,pushAllParent:u}=t.BranchHelper;const{worldBounds:f}=t.LeafBoundsHelper;class p{constructor(e){this.updatedBounds=new t.Bounds,this.beforeBounds=new t.Bounds,this.afterBounds=new t.Bounds,t.isArray(e)&&(e=new t.LeafList(e)),this.updatedList=e}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,f)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,f),this.updatedBounds.setList([this.beforeBounds,this.afterBounds])}merge(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:g,updateAllChange:_}=t.LeafHelper,m=t.Debug.get("Layouter");class y{constructor(e,a){this.totalTimes=0,this.config={usePartLayout:!0},this.__levelList=new t.LeafLevelList,this.target=e,a&&(this.config=t.DataHelper.default(a,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(this.layouting||!this.running)return;const{target: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){m.error(e)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?m.warn("layouting"):this.times>3?m.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 a=t.Run.start("PartLayout"),{target:n,__updatedList:r}=this,{BEFORE:i,LAYOUT:s,AFTER:o}=t.LayoutEvent,f=this.getBlocks(r);f.forEach(e=>e.setBefore()),n.emitEvent(new t.LayoutEvent(i,f,this.times)),this.extraBlock=null,r.sort(),function(e,t){let a;e.list.forEach(e=>{a=e.__layout,t.without(e)&&!a.proxyZoom&&(a.matrixChanged?(l(e,!0),t.add(e),e.isBranch&&h(e,t),u(e,t)):a.boundsChanged&&(t.add(e),e.isBranch&&(e.__tempNumber=0),u(e,t)))})}(r,this.__levelList),function(e){let t,a,n;e.sort(!0),e.levels.forEach(r=>{t=e.levelMap[r];for(let e=0,r=t.length;e<r;e++){if(a=t[e],a.isBranch&&a.__tempNumber){n=a.children;for(let e=0,t=n.length;e<t;e++)n[e].isBranch||d(n[e])}d(a)}})}(this.__levelList),function(e){e.list.forEach(c)}(r),this.extraBlock&&f.push(this.extraBlock),f.forEach(e=>e.setAfter()),n.emitEvent(new t.LayoutEvent(s,f,this.times)),n.emitEvent(new t.LayoutEvent(o,f,this.times)),this.addBlocks(f),this.__levelList.reset(),this.__updatedList=null,t.Run.end(a)}fullLayout(){const e=t.Run.start("FullLayout"),{target:a}=this,{BEFORE:n,LAYOUT:r,AFTER:i}=t.LayoutEvent,s=this.getBlocks(new t.LeafList(a));a.emitEvent(new t.LayoutEvent(n,s,this.times)),y.fullLayout(a),s.forEach(e=>{e.setAfter()}),a.emitEvent(new t.LayoutEvent(r,s,this.times)),a.emitEvent(new t.LayoutEvent(i,s,this.times)),this.addBlocks(s),t.Run.end(e)}static fullLayout(e){g(e,!0),e.isBranch?t.BranchHelper.updateBounds(e):t.LeafHelper.updateBounds(e),_(e)}addExtra(e){if(!this.__updatedList.has(e)){const{updatedList:t,beforeBounds:a}=this.extraBlock||(this.extraBlock=new p([]));t.length?a.add(e.__world):a.set(e.__world),t.add(e)}}createBlock(e){return new p(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 w=t.Debug.get("Renderer");class v{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(e,a,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=a,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:a}=this;this.times=0,this.totalBounds=new t.Bounds,w.log(a.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,w.error(e)}w.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(e){if(this.rendering)return w.warn("rendering");if(this.times>3)return w.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new t.Bounds,this.renderOptions={},e)this.emitRender(t.RenderEvent.BEFORE),e();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(t.RenderEvent.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(t.RenderEvent.RENDER,this.renderBounds,this.renderOptions),this.emitRender(t.RenderEvent.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,this.waitAgain&&(this.waitAgain=!1,this.renderOnce())}partRender(){const{canvas:e,updateBlocks:t}=this;t&&(this.mergeBlocks(),t.forEach(t=>{e.bounds.hit(t)&&!t.isEmpty()&&this.clipRender(t)}))}clipRender(e){const a=t.Run.start("PartRender"),{canvas:n}=this,r=e.getIntersect(n.bounds),i=new t.Bounds(r);n.save(),r.spread(v.clipSpread).ceil();const{ceilPartPixel:s}=this.config;n.clipWorld(r,s),n.clearWorld(r,s),this.__render(r,i),n.restore(),t.Run.end(a)}fullRender(){const e=t.Run.start("FullRender"),{canvas:a}=this;a.save(),a.clear(),this.__render(a.bounds),a.restore(),t.Run.end(e)}__render(e,a){const{canvas:n,target:r}=this,i=e.includes(r.__world),s=i?{includes:i}:{bounds:e,includes:i};this.needFill&&n.fillWorld(e,this.config.fill),t.Debug.showRepaint&&t.Debug.drawRepaint(n,e),this.config.useCellRender&&(s.cellList=this.getCellList()),t.Platform.render(r,n,s),this.renderBounds=a=a||e,this.renderOptions=s,this.totalBounds.isEmpty()?this.totalBounds=a:this.totalBounds.add(a),n.updateRender(a)}getCellList(){}addBlock(e,t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(e)}mergeBlocks(){const{updateBlocks:e}=this;if(e){const a=new t.Bounds;a.setList(e),e.length=0,e.push(a)}}__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 a=()=>{const e=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:n}=this.config;if(n&&e>n)return t.Platform.requestRender(a);const{frames:r}=this;r.length>30&&r.shift(),r.push(e),this.FPS=Math.round(r.reduce((e,t)=>e+t,0)/r.length),this.requestTime=0,this.checkRender()};t.Platform.requestRender(a)}__onResize(e){if(!this.canvas.unreal){if(e.bigger||!e.samePixelRatio){const{width:a,height:n}=e.old;if(!new t.Bounds(0,0,a,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:a}=e;a&&a.list.some(e=>(t=!e.__world.width||!e.__world.height,t&&(e.isLeafer||w.tip(e.innerName,": empty"),t=!e.isBranch||e.isBranchLeaf),t)),this.addBlock(t?this.canvas.bounds:e.updatedBounds,a)})}emitRender(e,a,n){this.target.emitEvent(new t.RenderEvent(e,this.times,a,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 x(e,t,n){e.__.__font?a.Paint.fillText(e,t,n):e.__.windingRule?t.fill(e.__.windingRule):t.fill()}function b(e,n,r,i,s){const o=r.__;t.isObject(e)?a.Paint.drawStrokesStyle(e,n,!1,r,i,s):(i.setStroke(e,o.__strokeWidth*n,o),i.stroke()),o.__useArrow&&a.Paint.strokeArrow(e,r,i,s)}function P(e,n,r,i,s){const o=r.__;t.isObject(e)?a.Paint.drawStrokesStyle(e,n,!0,r,i,s):(i.setStroke(e,o.__strokeWidth*n,o),a.Paint.drawTextStroke(r,i,s))}function S(e,n,r,i,s){const o=i.getSameCanvas(!0,!0);o.font=r.__.__font,P(e,2,r,o,s),o.blendMode="outside"===n?"destination-out":"destination-in",a.Paint.fillText(r,o,s),o.blendMode="normal",t.LeafHelper.copyCanvasByWorld(r,i,o),o.recycle(r.__nowWorld)}v.clipSpread=10,Object.assign(t.Creator,{watcher:(e,t)=>new o(e,t),layouter:(e,t)=>new y(e,t),renderer:(e,t,a)=>new v(e,t,a),selector:(e,t)=>{},interaction:(e,t,a,n)=>{}}),t.Platform.layout=y.fullLayout,t.Platform.render=function(e,a,n){const r=Object.assign(Object.assign({},n),{topRendering:!0});n.topList=new t.LeafList,e.__render(a,n),n.topList.length&&n.topList.forEach(e=>e.__render(a,r))};const{getSpread:E,copyAndSpread:B,toOuterOf:L,getOuterOf:k,getByMove:R,move:C,getIntersectData:T}=t.BoundsHelper,A={};let O;const{stintSet:I}=t.DataHelper,{hasTransparent:M}=a.ColorConvert;function W(e,n,r){if(!t.isObject(n)||!1===n.visible||0===n.opacity)return;let i;const{boxBounds:s}=r.__layout,{type:o}=n;switch(o){case"image":case"film":case"video":if(!n.url)return;i=a.PaintImage.image(r,e,n,s,!O||!O[n.url]),"image"!==o&&a.PaintImage[o](i);break;case"linear":i=a.PaintGradient.linearGradient(n,s);break;case"radial":i=a.PaintGradient.radialGradient(n,s);break;case"angular":i=a.PaintGradient.conicGradient(n,s);break;case"solid":const{color:l,opacity:d}=n;i={type:o,style:a.ColorConvert.string(l,d)};break;default:t.isUndefined(n.r)||(i={type:"solid",style:a.ColorConvert.string(n)})}if(i&&(i.originPaint=n,t.isString(i.style)&&M(i.style)&&(i.isTransparent=!0),n.style)){if(0===n.style.strokeWidth)return;i.strokeStyle=n.style}return i}const D={compute:function(e,n){const r=n.__,i=[];let s,o,l,d=r.__input[e];t.isArray(d)||(d=[d]),O=a.PaintImage.recycleImage(e,r);for(let t,a=0,r=d.length;a<r;a++)(t=W(e,d[a],n))&&(i.push(t),t.strokeStyle&&(l||(l=1),t.strokeStyle.strokeWidth&&(l=Math.max(l,t.strokeStyle.strokeWidth))));i.length?(r["_"+e]=i,i.every(e=>e.isTransparent)&&(i.some(e=>e.image)&&(s=!0),o=!0),"fill"===e?(I(r,"__isAlphaPixelFill",s),I(r,"__isTransparentFill",o)):(I(r,"__isAlphaPixelStroke",s),I(r,"__isTransparentStroke",o),I(r,"__hasMultiStrokeStyle",l))):(r.__removePaint(e,!1),r["_"+e]="")},fill:function(e,t,a,n){a.fillStyle=e,x(t,a,n)},fills:function(e,t,n,r){let i,s,o;for(let l=0,d=e.length;l<d;l++){if(i=e[l],s=i.originPaint,i.image){if(o?o++:o=1,a.PaintImage.checkImage(i,!t.__.__font,t,n,r))continue;if(!i.style){1===o&&i.image.isPlacehold&&t.drawImagePlaceholder(i,n,r);continue}}if(n.fillStyle=i.style,i.transform||s.scaleFixed){if(n.save(),i.transform&&n.transform(i.transform),s.scaleFixed){const{scaleX:e,scaleY:a}=t.getRenderScaleData(!0,s.scaleFixed,!1);1!==e&&n.scale(e,a)}s.blendMode&&(n.blendMode=s.blendMode),x(t,n,r),n.restore()}else s.blendMode?(n.saveBlendMode(s.blendMode),x(t,n,r),n.restoreBlendMode()):x(t,n,r)}},fillPathOrText:x,fillText:function(e,t,n){if(e.motionText)return a.Paint.fillMotionText(e,t,n);const r=e.__,{rows:i,decorationY:s}=r.__textDrawData;let o;r.__isPlacehold&&r.placeholderColor&&(t.fillStyle=r.placeholderColor);for(let e=0,a=i.length;e<a;e++)o=i[e],o.text?t.fillText(o.text,o.x,o.y):o.data&&o.data.forEach(e=>{t.fillText(e.char,e.x,o.y)});if(s){const{decorationColor:e,decorationHeight:a}=r.__textDrawData;e&&(t.fillStyle=e),i.forEach(e=>s.forEach(n=>t.fillRect(e.x,e.y+n,e.width,a)))}},stroke:function(e,n,r,i){const s=n.__;if(s.__strokeWidth)if(s.__font)a.Paint.strokeText(e,n,r,i);else if(s.__pathForStroke)a.Paint.fillStroke(e,n,r,i);else switch(s.strokeAlign){case"center":b(e,1,n,r,i);break;case"inside":!function(e,t,a,n){a.save(),a.clipUI(t),b(e,2,t,a,n),a.restore()}(e,n,r,i);break;case"outside":!function(e,a,n,r){const i=a.__;if(i.__fillAfterStroke)b(e,2,a,n,r);else{const{renderBounds:s}=a.__layout,o=n.getSameCanvas(!0,!0);a.__drawRenderPath(o),b(e,2,a,o,r),o.clipUI(i),o.clearWorld(s),t.LeafHelper.copyCanvasByWorld(a,n,o),o.recycle(a.__nowWorld)}}(e,n,r,i)}},strokes:function(e,t,n,r){a.Paint.stroke(e,t,n,r)},strokeText:function(e,t,a,n){switch(t.__.strokeAlign){case"center":P(e,1,t,a,n);break;case"inside":S(e,"inside",t,a,n);break;case"outside":t.__.__fillAfterStroke?P(e,2,t,a,n):S(e,"outside",t,a,n)}},drawTextStroke:function(e,t,a){let n,r=e.__.__textDrawData;const{rows:i,decorationY:s}=r;for(let e=0,a=i.length;e<a;e++)n=i[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(s){const{decorationHeight:e}=r;i.forEach(a=>s.forEach(n=>t.strokeRect(a.x,a.y+n,a.width,e)))}},drawStrokesStyle:function(e,t,n,r,i,s){let o;const l=r.__,{__hasMultiStrokeStyle:d}=l;d||i.setStroke(void 0,l.__strokeWidth*t,l);for(let c=0,h=e.length;c<h;c++)if(o=e[c],(!o.image||!a.PaintImage.checkImage(o,!1,r,i,s))&&o.style){if(d){const{strokeStyle:e}=o;e?i.setStroke(o.style,l.__getRealStrokeWidth(e)*t,l,e):i.setStroke(o.style,l.__strokeWidth*t,l)}else i.strokeStyle=o.style;o.originPaint.blendMode?(i.saveBlendMode(o.originPaint.blendMode),n?a.Paint.drawTextStroke(r,i,s):i.stroke(),i.restoreBlendMode()):n?a.Paint.drawTextStroke(r,i,s):i.stroke()}},shape:function(e,a,n){const r=a.getSameCanvas(),i=a.bounds,s=e.__nowWorld,o=e.__layout,l=e.__nowWorldShapeBounds||(e.__nowWorldShapeBounds={});let d,c,h,u,f,p;L(o.strokeSpread?(B(A,o.boxBounds,o.strokeSpread),A):o.boxBounds,s,l);let{scaleX:g,scaleY:_}=e.getRenderScaleData(!0);if(i.includes(l))p=r,d=f=l,c=s;else{let r;if(t.Platform.fullImageShadow)r=l;else{const e=o.renderShapeSpread?E(i,t.FourNumberHelper.swapAndScale(o.renderShapeSpread,g,_)):i;r=T(e,l)}u=i.getFitMatrix(r);let{a:m,d:y}=u;u.a<1&&(p=a.getSameCanvas(),e.__renderShape(p,n),g*=m,_*=y),f=k(l,u),d=R(f,-u.e,-u.f),c=k(s,u),C(c,-u.e,-u.f);const w=n.matrix;w?(h=new t.Matrix(u),h.multiply(w),m*=w.scaleX,y*=w.scaleY):h=u,h.withScale(m,y),n=Object.assign(Object.assign({},n),{matrix:h})}return e.__renderShape(r,n),{canvas:r,matrix:h,fitMatrix:u,bounds:d,renderBounds:c,worldCanvas:p,shapeBounds:f,scaleX:g,scaleY:_}}};let H,F=new t.Bounds;const{isSame:j}=t.BoundsHelper;function G(e,n,r,i,s,o){let l=!0;const d=e.__;if("fill"!==n||d.__naturalWidth||(d.__naturalWidth=i.width/d.pixelRatio,d.__naturalHeight=i.height/d.pixelRatio,d.__autoSide&&(e.forceUpdate(),t.LeafHelper.updateBounds(e),e.__layout.boundsChanged=!0,e.__proxyData&&(e.setProxyAttr("width",d.width),e.setProxyAttr("height",d.height)),l=!1)),"brush"===r.mode&&a.PaintImage.brush(e,n,s),!s.data){a.PaintImage.createData(s,i,r,o);const{transform:e}=s.data,{opacity:t}=r,n=(e&&!e.onlyScale||d.path||d.cornerRadius)&&!s.brush;(n||t&&t<1||r.blendMode)&&(s.complex=!n||2)}return r.filter&&a.PaintImage.applyFilter(s,i,r.filter,e),l}function Y(e,a){X(e,t.ImageEvent.LOAD,a)}function N(e,a){X(e,t.ImageEvent.LOADED,a)}function U(e,a,n){a.error=n,e.forceUpdate("surface"),X(e,t.ImageEvent.ERROR,a)}function X(e,a,n){e.hasEvent(a)&&e.emitEvent(new t.ImageEvent(a,n))}function q(e,t){const{leafer:a}=e;a&&a.viewReady&&(a.renderer.ignore=t)}const{get:z,translate:V}=t.MatrixHelper,Q=new t.Bounds,Z={},$={};function K(e,a,n,r){const i=t.isString(e)||r?(r?n-r*a:n%a)/((r||Math.floor(n/a))-1):e;return"auto"===e&&i<0?0:i}let J={},ee=t.getMatrixData();const{get:te,set:ae,rotateOfOuter:ne,translate:re,scaleOfOuter:ie,multiplyParent:se,scale:oe,rotate:le,skew:de}=t.MatrixHelper;function ce(e,t,a,n,r,i,s,o){s&&le(e,s),o&&de(e,o.x,o.y),r&&oe(e,r,i),re(e,t.x+a,t.y+n)}const{get:he,scale:ue,copy:fe}=t.MatrixHelper,{getFloorScale:pe}=t.MathHelper,{abs:ge}=Math;const _e={image:function(e,a,n,r,i){let s,o;const l=t.ImageManager.get(n,n.type);return H&&n===H.paint&&j(r,H.boxBounds)?s=H.leafPaint:(s={type:n.type,image:l},l.hasAlphaPixel&&(s.isTransparent=!0),H=l.use>1?{leafPaint:s,paint:n,boxBounds:F.set(r)}:null),(i||l.loading)&&(o={image:l,attrName:a,attrValue:n}),l.ready?(G(e,a,n,l,s,r),i&&(Y(e,o),N(e,o))):l.error?i&&U(e,o,l.error):(i&&(q(e,!0),Y(e,o)),s.loadId=l.load(()=>{q(e,!1),e.destroyed||(G(e,a,n,l,s,r)&&(l.hasAlphaPixel&&(e.__layout.hitCanvasChanged=!0),e.forceUpdate("surface")),N(e,o)),s.loadId=void 0},t=>{q(e,!1),U(e,o,t),s.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)),s},checkImage:function(e,n,r,i,s){const{scaleX:o,scaleY:l}=a.PaintImage.getImageRenderScaleData(e,r,i,s),d=e.film?e.nowIndex:o+"-"+l,{image:c,brush:h,data:u,originPaint:f}=e,{exporting:p,snapshot:g}=s;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)r.__.__isFastShadow&&(i.fillStyle=e.style||"#000",i.fill());else if(!e.style||f.sync||p?a.PaintImage.createPattern(e,r,i,s):a.PaintImage.createPatternTask(e,r,i,s),!h||!e.style)return!1;return a.PaintImage.drawImage(e,o,l,r,i,s),!0},drawImage:function(e,t,a,n,r,i){const{data:s,image:o,brush:l,complex:d}=e;let{width:c,height:h}=o,u=l||o;if(d){const{blendMode:i,opacity:o}=e.originPaint,{transform:l}=s;r.save(),2===d&&r.clipUI(n),i&&(r.blendMode=i),o&&(r.opacity*=o),l&&r.transform(l),u.render(r,0,0,c,h,n,e,t,a),r.restore()}else s.scaleX&&(c*=s.scaleX,h*=s.scaleY),u.render(r,0,0,c,h,n,e,t,a)},getImageRenderScaleData:function(e,t,n,r){const i=t.getRenderScaleData(!0,e.originPaint.scaleFixed),{data:s}=e;if(e.brush&&a.PaintImage.addBrushScale(i,e,t),n){const{pixelRatio:e}=n;i.scaleX*=e,i.scaleY*=e}return s&&s.scaleX&&(i.scaleX*=Math.abs(s.scaleX),i.scaleY*=Math.abs(s.scaleY)),i},recycleImage:function(e,n){const r=n["_"+e];if(t.isArray(r)){let i,s,o,l,d;const c=n.__leaf;for(let h=0,u=r.length;h<u;h++)i=r[h],s=i.image,d=s&&s.url,d&&(o||(o={}),o[d]=!0,t.ImageManager.recyclePaint(i),i.brush&&a.PaintImage.recycleBrush(i,c),n.__willDestroy&&s.parent&&a.PaintImage.recycleFilter(s,c),s.loading&&(l||(l=n.__input&&n.__input[e]||[],t.isArray(l)||(l=[l])),s.unload(r[h].loadId,!l.some(e=>e.url===d))));return o}return null},createPatternTask:function(e,r,i,s){e.patternTask||(e.patternTask=t.ImageManager.patternTasker.add(()=>n(this,void 0,void 0,function*(){a.PaintImage.createPattern(e,r,i,s),r.forceUpdate("surface")}),0,()=>(e.patternTask=null,i.bounds.hit(r.__nowWorld))))},createPattern:function(e,n,r,i){let{scaleX:s,scaleY:o}=a.PaintImage.getImageRenderScaleData(e,n,r,i),l=e.film?e.nowIndex:s+"-"+o;if(e.patternId!==l&&!n.destroyed&&(!t.Platform.image.isLarge(e.image,s,o)||e.data.repeat)){const{image:d,brush:c,data:h}=e,{transform:u,gap:f}=h,p=a.PaintImage.getPatternFixScale(e,s,o);let g,_,m,{width:y,height:w}=d,{opacity:v}=e.originPaint;(c||1===v)&&(v=void 0),p&&(s*=p,o*=p),y*=s,w*=o,f&&!c&&(_=f.x*s/ge(h.scaleX||1),m=f.y*o/ge(h.scaleY||1)),(u||1!==s||1!==o)&&(s*=pe(y+(_||0)),o*=pe(w+(m||0)),g=he(),u&&fe(g,u),ue(g,1/s,1/o));const x=d.getCanvas(y,w,v,void 0,_,m,n.leafer&&n.leafer.config.smooth,h.interlace);c?(e.style=x,a.PaintImage.cacheBrush(e,n,r,i)):e.style=d.getPattern(x,h.repeat||t.Platform.origin.noRepeat||"no-repeat",g,e),e.patternId=l}},getPatternFixScale:function(e,a,n){const{image:r}=e;let i,s=t.Platform.image.maxPatternSize,o=r.width*r.height;return r.isSVG?a>1&&(i=Math.ceil(a)/a):s>o&&(s=o),(o*=a*n)>s&&(i=Math.sqrt(s/o)),i},createData:function(e,t,n,r){e.data=a.PaintImage.getPatternData(n,r,t)},getPatternData:function(e,n,r){e.padding&&(n=Q.set(n).shrink(e.padding)),"strench"===e.mode&&(e.mode="stretch");const{width:i,height:s}=r,{mode:o,align:l,offset:d,scale:c,size:h,rotation:u,skew:f,clipSize:p,repeat:g,gap:_,interlace:m}=e,y=n.width===i&&n.height===s,w={mode:o},v="center"!==l&&(u||0)%180==90;let x,b;switch(t.BoundsHelper.set($,0,0,v?s:i,v?i:s),o&&"cover"!==o&&"fit"!==o?((c||h)&&(t.MathHelper.getScaleData(c,h,r,Z),x=Z.scaleX,b=Z.scaleY),(l||_||g)&&(x&&t.BoundsHelper.scale($,x,b,!0),l&&t.AlignHelper.toPoint(l,$,n,$,!0,!0))):y&&!u||(x=b=t.BoundsHelper.getFitScale(n,$,"fit"!==o),t.BoundsHelper.put(n,r,l,x,!1,$),t.BoundsHelper.scale($,x,b,!0)),d&&t.PointHelper.move($,d),o){case"stretch":y?x&&(x=b=void 0):(x=n.width/i,b=n.height/s,a.PaintImage.stretchMode(w,n,x,b));break;case"normal":case"clip":if($.x||$.y||x||p||u||f){let e,t;p&&(e=n.width/p.width,t=n.height/p.height),a.PaintImage.clipMode(w,n,$.x,$.y,x,b,u,f,e,t),e&&(x=x?x*e:e,b=b?b*t:t)}break;case"repeat":(!y||x||u||f)&&a.PaintImage.repeatMode(w,n,i,s,$.x,$.y,x,b,u,f,l,e.freeTransform);case"brush":g||(w.repeat="repeat");const r=t.isObject(g);(_||r)&&(w.gap=function(e,a,n,r,i){let s,o;t.isObject(e)?(s=e.x,o=e.y):s=o=e;return{x:K(s,n,i.width,a&&a.x),y:K(o,r,i.height,a&&a.y)}}(_,r&&g,$.width,$.height,n));break;default:x&&a.PaintImage.fillOrFitMode(w,n,$.x,$.y,x,b,u)}return w.transform||"brush"===o||(n.x||n.y)&&V(w.transform=z(),n.x,n.y),x&&(w.scaleX=x,w.scaleY=b),g&&(w.repeat=t.isString(g)?"x"===g?"repeat-x":"repeat-y":"repeat"),m&&(w.interlace=t.isNumber(m)||"percent"===m.type?{type:"x",offset:m}:m),w},stretchMode:function(e,t,a,n){const r=te(),{x:i,y:s}=t;i||s?re(r,i,s):a>0&&n>0&&(r.onlyScale=!0),oe(r,a,n),e.transform=r},fillOrFitMode:function(e,t,a,n,r,i,s){const o=te();re(o,t.x+a,t.y+n),oe(o,r,i),s&&ne(o,{x:t.x+t.width/2,y:t.y+t.height/2},s),e.transform=o},clipMode:function(e,t,a,n,r,i,s,o,l,d){const c=te();ce(c,t,a,n,r,i,s,o),l&&(s||o?(ae(ee),ie(ee,t,l,d),se(c,ee)):ie(c,t,l,d)),e.transform=c},repeatMode:function(e,t,a,n,r,i,s,o,l,d,c,h){const u=te();if(h)ce(u,t,r,i,s,o,l,d);else{if(l)if("center"===c)ne(u,{x:a/2,y:n/2},l);else switch(le(u,l),l){case 90:re(u,n,0);break;case 180:re(u,a,n);break;case 270:re(u,0,a)}J.x=t.x+r,J.y=t.y+i,re(u,J.x,J.y),s&&ie(u,J,s,o)}e.transform=u}},{toPoint:me}=t.AroundHelper,{hasTransparent:ye}=a.ColorConvert,we={},ve={};function xe(e,n,r,i){if(r){let s,o,l,d;for(let e=0,c=r.length;e<c;e++)s=r[e],t.isString(s)?(l=e/(c-1),o=a.ColorConvert.string(s,i)):(l=s.offset,o=a.ColorConvert.string(s.color,i)),n.addColorStop(l,o),!d&&ye(o)&&(d=!0);d&&(e.isTransparent=!0)}}const{getAngle:be,getDistance:Pe}=t.PointHelper,{get:Se,rotateOfOuter:Ee,scaleOfOuter:Be}=t.MatrixHelper,{toPoint:Le}=t.AroundHelper,ke={},Re={};function Ce(e,t,a,n,r){let i;const{width:s,height:o}=e;if(s!==o||n){const e=be(t,a);i=Se(),r?(Be(i,t,s/o*(n||1),1),Ee(i,t,e+90)):(Be(i,t,1,s/o*(n||1)),Ee(i,t,e))}return i}const{getDistance:Te}=t.PointHelper,{toPoint:Ae}=t.AroundHelper,Oe={},Ie={};const Me={linearGradient:function(e,a){let{from:n,to:r,type:i,opacity:s}=e;me(n||"top",a,we),me(r||"bottom",a,ve);const o=t.Platform.canvas.createLinearGradient(we.x,we.y,ve.x,ve.y),l={type:i,style:o};return xe(l,o,e.stops,s),l},radialGradient:function(e,a){let{from:n,to:r,type:i,opacity:s,stretch:o}=e;Le(n||"center",a,ke),Le(r||"bottom",a,Re);const l=t.Platform.canvas.createRadialGradient(ke.x,ke.y,0,ke.x,ke.y,Pe(ke,Re)),d={type:i,style:l};xe(d,l,e.stops,s);const c=Ce(a,ke,Re,o,!0);return c&&(d.transform=c),d},conicGradient:function(e,a){let{from:n,to:r,type:i,opacity:s,rotation:o,stretch:l}=e;Ae(n||"center",a,Oe),Ae(r||"bottom",a,Ie);const d=t.Platform.conicGradientSupport?t.Platform.canvas.createConicGradient(o?o*t.OneRadian:0,Oe.x,Oe.y):t.Platform.canvas.createRadialGradient(Oe.x,Oe.y,0,Oe.x,Oe.y,Te(Oe,Ie)),c={type:i,style:d};xe(c,d,e.stops,s);const h=Ce(a,Oe,Ie,l||1,t.Platform.conicGradientRotate90);return h&&(c.transform=h),c},getTransform:Ce},{copy:We,move:De,toOffsetOutBounds:He}=t.BoundsHelper,{max:Fe,abs:je}=Math,Ge={},Ye=new t.Matrix,Ne={};function Ue(e,t){let a,n,r,i,s=0,o=0,l=0,d=0;return t.forEach(e=>{a=e.x||0,n=e.y||0,i=1.5*(e.blur||0),r=je(e.spread||0),s=Fe(s,r+i-n),o=Fe(o,r+i+a),l=Fe(l,r+i+n),d=Fe(d,r+i-a)}),s===o&&o===l&&l===d?s:[s,o,l,d]}function Xe(e,a,n){const{shapeBounds:r}=n;let i,s;t.Platform.fullImageShadow?(We(Ge,e.bounds),De(Ge,a.x-r.x,a.y-r.y),i=e.bounds,s=Ge):(i=r,s=a),e.copyWorld(n.canvas,i,s)}const{toOffsetOutBounds:qe}=t.BoundsHelper,ze={};const Ve=Ue;const Qe={shadow:function(e,n,r){let i,s;const{__nowWorld:o}=e,{shadow:l}=e.__,{worldCanvas:d,bounds:c,renderBounds:h,shapeBounds:u,scaleX:f,scaleY:p}=r,g=n.getSameCanvas(),_=l.length-1;He(c,Ne,h),l.forEach((l,m)=>{let y=1;if(l.scaleFixed){const e=Math.abs(o.scaleX);e>1&&(y=1/e)}g.setWorldShadow(Ne.offsetX+(l.x||0)*f*y,Ne.offsetY+(l.y||0)*p*y,(l.blur||0)*f*y,a.ColorConvert.string(l.color)),s=a.Effect.getShadowTransform(e,g,r,l,Ne,y),s&&g.setTransform(s),Xe(g,Ne,r),s&&g.resetTransform(),i=h,l.box&&(g.restore(),g.save(),d&&(g.copyWorld(g,h,o,"copy"),i=o),d?g.copyWorld(d,o,o,"destination-out"):g.copyWorld(r.canvas,u,c,"destination-out")),t.LeafHelper.copyCanvasByWorld(e,n,g,i,l.blendMode),_&&m<_&&g.clearWorld(i)}),g.recycle(i)},innerShadow:function(e,n,r){let i,s;const{__nowWorld:o}=e,{innerShadow:l}=e.__,{worldCanvas:d,bounds:c,renderBounds:h,shapeBounds:u,scaleX:f,scaleY:p}=r,g=n.getSameCanvas(),_=l.length-1;qe(c,ze,h),l.forEach((l,m)=>{let y=1;if(l.scaleFixed){const e=Math.abs(o.scaleX);e>1&&(y=1/e)}g.save(),g.setWorldShadow(ze.offsetX+(l.x||0)*f*y,ze.offsetY+(l.y||0)*p*y,(l.blur||0)*f*y),s=a.Effect.getShadowTransform(e,g,r,l,ze,y,!0),s&&g.setTransform(s),Xe(g,ze,r),g.restore(),d?(g.copyWorld(g,h,o,"copy"),g.copyWorld(d,o,o,"source-out"),i=o):(g.copyWorld(r.canvas,u,c,"source-out"),i=h),g.fillWorld(i,a.ColorConvert.string(l.color),"source-in"),t.LeafHelper.copyCanvasByWorld(e,n,g,i,l.blendMode),_&&m<_&&g.clearWorld(i)}),g.recycle(i)},blur:function(e,t,a){const{blur:n}=e.__;a.setWorldBlur(n*e.__nowWorld.a),a.copyWorldToInner(t,e.__nowWorld,e.__layout.renderBounds),a.filter="none"},backgroundBlur:function(e,t,a){},getShadowRenderSpread:Ue,getShadowTransform:function(e,t,a,n,r,i,s){if(n.spread){const a=2*n.spread*i*(s?-1:1),{width:o,height:l}=e.__layout.strokeBounds;return Ye.set().scaleOfOuter({x:(r.x+r.width/2)*t.pixelRatio,y:(r.y+r.height/2)*t.pixelRatio},1+a/o,1+a/l),Ye}},isTransformShadow(e){},getInnerShadowSpread:Ve},{excludeRenderBounds:Ze}=t.LeafBoundsHelper;let $e;function Ke(e,t,a,n,r,i,s,o){switch(t){case"grayscale":$e||($e=!0,r.useGrayscaleAlpha(e.__nowWorld));case"alpha":!function(e,t,a,n,r,i){const s=e.__nowWorld;a.resetTransform(),a.opacity=1,a.useMask(n,s),i&&n.recycle(s);et(e,t,a,1,r,i)}(e,a,n,r,s,o);break;case"opacity-path":et(e,a,n,i,s,o);break;case"path":o&&a.restore()}}function Je(e){return e.getSameCanvas(!1,!0)}function et(e,t,a,n,r,i){const s=e.__nowWorld;t.resetTransform(),t.opacity=n,t.copyWorld(a,s,void 0,r),i?a.recycle(s):a.clearWorld(s)}a.Group.prototype.__renderMask=function(e,t){let a,n,r,i,s,o;const{children:l}=this;for(let d=0,c=l.length;d<c;d++){if(a=l[d],o=a.__.mask,o){s&&(Ke(this,s,e,r,n,i,void 0,!0),n=r=null),"clipping"!==o&&"clipping-path"!==o||Ze(a,t)||a.__render(e,t),i=a.__.opacity,$e=!1,"path"===o||"clipping-path"===o?(i<1?(s="opacity-path",r||(r=Je(e))):(s="path",e.save()),a.__clip(r||e,t)):(s="grayscale"===o?"grayscale":"alpha",n||(n=Je(e)),r||(r=Je(e)),a.__render(n,t));continue}const c=1===i&&a.__.__blendMode;c&&Ke(this,s,e,r,n,i,void 0,!1),Ze(a,t)||a.__render(r||e,t),c&&Ke(this,s,e,r,n,i,c,!1)}Ke(this,s,e,r,n,i,void 0,!0)};const tt=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",at=tt+"_#~&*+\\=|≮≯≈≠=…",nt=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 rt(e){const t={};return e.split("").forEach(e=>t[e]=!0),t}const it=rt("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),st=rt("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),ot=rt(tt),lt=rt(at),dt=rt("- —/~|┆·");var ct;!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"}(ct||(ct={}));const{Letter:ht,Single:ut,Before:ft,After:pt,Symbol:gt,Break:_t}=ct;function mt(e){return it[e]?ht:dt[e]?_t:st[e]?ft:ot[e]?pt:lt[e]?gt:nt.test(e)?ut:ht}const yt={trimRight(e){const{words:t}=e;let a,n=0,r=t.length;for(let i=r-1;i>-1&&(a=t[i].data[0]," "===a.char);i--)n++,e.width-=a.width;n&&t.splice(r-n,n)}};function wt(e,t,a){switch(t){case"title":return a?e.toUpperCase():e;case"upper":return e.toUpperCase();case"lower":return e.toLowerCase();default:return e}}const{trimRight:vt}=yt,{Letter:xt,Single:bt,Before:Pt,After:St,Symbol:Et,Break:Bt}=ct;let Lt,kt,Rt,Ct,Tt,At,Ot,It,Mt,Wt,Dt,Ht,Ft,jt,Gt,Yt,Nt,Ut=[];function Xt(e,t){Mt&&!It&&(It=Mt),Lt.data.push({char:e,width:t}),Rt+=t}function qt(){Ct+=Rt,Lt.width=Rt,kt.words.push(Lt),Lt={data:[]},Rt=0}function zt(){jt&&(Gt.paraNumber++,kt.paraStart=!0,jt=!1),Mt&&(kt.startCharSize=It,kt.endCharSize=Mt,It=0),kt.width=Ct,Yt.width?vt(kt):Nt&&Vt(),Ut.push(kt),kt={words:[]},Ct=0}function Vt(){Ct>(Gt.maxWidth||0)&&(Gt.maxWidth=Ct)}const{top:Qt,right:Zt,bottom:$t,left:Kt}=t.Direction4;function Jt(e,t,a){const{bounds:n,rows:r}=e;n[t]+=a;for(let e=0;e<r.length;e++)r[e][t]+=a}const ea={getDrawData:function(e,n){t.isString(e)||(e=String(e));let r=0,i=0,s=n.__getInput("width")||0,o=n.__getInput("height")||0;const{__padding:l}=n;n.motionText&&(s=o=0),l&&(s?(r=l[Kt],s-=l[Zt]+l[Kt],!s&&(s=.01)):n.autoSizeAlign||(r=l[Kt]),o?(i=l[Qt],o-=l[Qt]+l[$t],!o&&(o=.01)):n.autoSizeAlign||(i=l[Qt]));const d={bounds:{x:r,y:i,width:s,height:o},rows:[],paraNumber:0,font:t.Platform.canvas.font=n.__font};return function(e,a,n){Gt=e,Ut=e.rows,Yt=e.bounds,Nt=!Yt.width&&!n.autoSizeAlign;const{__letterSpacing:r,paraIndent:i,textCase:s}=n,{canvas:o}=t.Platform,{width:l}=Yt;if(n.__isCharMode){const e="none"!==n.textWrap,t="break"===n.textWrap;jt=!0,Dt=null,It=Ot=Mt=Rt=Ct=0,Lt={data:[]},kt={words:[]};for(let n=0,d=(a=[...a]).length;n<d;n++)At=a[n],"\n"===At?(Rt&&qt(),kt.paraEnd=!0,zt(),jt=!0):(Wt=mt(At),Wt===xt&&"none"!==s&&(At=wt(At,s,!Rt)),Ot=o.measureText(At).width,r&&(r<0&&(Mt=Ot),Ot+=r),Ht=Wt===bt&&(Dt===bt||Dt===xt)||Dt===bt&&Wt!==St,Ft=!(Wt!==Pt&&Wt!==bt||Dt!==Et&&Dt!==St),Tt=jt&&i?l-i:l,e&&l&&Ct+Rt+Ot>Tt&&(t?(Rt&&qt(),Ct&&zt()):(Ft||(Ft=Wt===xt&&Dt==St),Ht||Ft||Wt===Bt||Wt===Pt||Wt===bt||Rt+Ot>Tt?(Rt&&qt(),Ct&&zt()):Ct&&zt()))," "===At&&!0!==jt&&Ct+Rt===0||(Wt===Bt?(" "===At&&Rt&&qt(),Xt(At,Ot),qt()):Ht||Ft?(Rt&&qt(),Xt(At,Ot)):Xt(At,Ot)),Dt=Wt);Rt&&qt(),Ct&&zt(),Ut.length>0&&(Ut[Ut.length-1].paraEnd=!0)}else a.split("\n").forEach(e=>{Gt.paraNumber++,Ct=o.measureText(e).width,Ut.push({x:i||0,text:e,width:Ct,paraStart:!0}),Nt&&Vt()})}(d,e,n),l&&function(e,t,a,n,r){if(!n&&a.autoSizeAlign)switch(a.textAlign){case"left":Jt(t,"x",e[Kt]);break;case"right":Jt(t,"x",-e[Zt])}if(!r&&a.autoSizeAlign)switch(a.verticalAlign){case"top":Jt(t,"y",e[Qt]);break;case"bottom":Jt(t,"y",-e[$t])}}(l,d,n,s,o),function(e,t){const{rows:a,bounds:n}=e,r=a.length,{__lineHeight:i,__baseLine:s,__letterSpacing:o,__clipText:l,textAlign:d,verticalAlign:c,paraSpacing:h,autoSizeAlign:u}=t;let{x:f,y:p,width:g,height:_}=n,m=i*r+(h?h*(e.paraNumber-1):0),y=s;if(l&&m>_)m=Math.max(t.__autoHeight?m:_,i),r>1&&(e.overflow=r);else if(_||u)switch(c){case"middle":p+=(_-m)/2;break;case"bottom":p+=_-m}y+=p;let w,v,x,b=g||u?g:e.maxWidth;for(let s=0,c=r;s<c;s++){if(w=a[s],w.x=f,w.width<g||w.width>g&&!l)switch(d){case"center":w.x+=(b-w.width)/2;break;case"right":w.x+=b-w.width}w.paraStart&&h&&s>0&&(y+=h),w.y=y,y+=i,e.overflow>s&&y>m&&(w.isOverflow=!0,e.overflow=s+1),v=w.x,x=w.width,o<0&&(w.width<0?(x=-w.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&&(w.isOverflow=!0,e.overflow||(e.overflow=a.length))}n.y=p,n.height=m}(d,n),n.__isCharMode&&function(e,t,a){const{rows:n}=e,{textAlign:r,paraIndent:i}=t,s=t.__letterSpacing||t.motionText,o=a&&r.includes("both"),l=o||a&&r.includes("justify"),d=l&&r.includes("letter");let c,h,u,f,p,g,_,m,y,w;n.forEach(e=>{e.words&&(p=i&&e.paraStart?i:0,m=e.words.length,l&&(w=!e.paraEnd||o,h=a-e.width-p,d?f=h/(e.words.reduce((e,t)=>e+t.data.length,0)-1):u=m>1?h/(m-1):0),g=s||e.isOverflow||d?0:u?1:2,e.isOverflow&&!s&&(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,a)=>{1===g?(_={char:"",x:c},c=function(e,t,a){return e.forEach(e=>{a.char+=e.char,t+=e.width}),t}(t.data,c,_),(e.isOverflow||" "!==_.char)&&e.data.push(_)):c=function(e,t,a,n,r){return e.forEach(e=>{(n||" "!==e.char)&&(e.x=t,a.push(e)),t+=e.width,r&&(t+=r)}),t}(t.data,c,e.data,e.isOverflow,w&&f),w&&(y=a===m-1,u?y||(c+=u,e.width+=u):f&&(e.width+=f*(t.data.length-(y?1:0))))})),e.words=null)})}(d,n,s),d.overflow&&function(e,a,n,r){const{rows:i,overflow:s}=e;let{textOverflow:o}=a;if(s&&i.splice(s),r&&o&&"show"!==o){let e,l;"hide"===o?o="":"ellipsis"===o&&(o="...");const d=o?t.Platform.canvas.measureText(o).width:0,c=n+r-d;("none"===a.textWrap?i:[i[s-1]]).forEach(t=>{if(t.isOverflow&&t.data){let a=t.data.length-1;for(let n=a;n>-1&&(e=t.data[n],l=e.x+e.width,!(n===a&&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,r,s),"none"!==n.textDecoration&&function(e,n){let r,i=0;const{fontSize:s,textDecoration:o}=n;switch(e.decorationHeight=s/11,t.isObject(o)?(r=o.type,o.color&&(e.decorationColor=a.ColorConvert.string(o.color)),o.offset&&(i=Math.min(.3*s,Math.max(o.offset,.15*-s)))):r=o,r){case"under":e.decorationY=[.15*s+i];break;case"delete":e.decorationY=[.35*-s];break;case"under-delete":e.decorationY=[.15*s+i,.35*-s]}}(d,n),d}};const ta={string:function(e,n){if(!e)return"#000";const r=t.isNumber(n)&&n<1;if(t.isString(e)){if(!r||!a.ColorConvert.object)return e;e=a.ColorConvert.object(e)}let i=t.isUndefined(e.a)?1:e.a;r&&(i*=n);const s=e.r+","+e.g+","+e.b;return 1===i?"rgb("+s+")":"rgba("+s+","+i+")"}};Object.assign(a.TextConvert,ea),Object.assign(a.ColorConvert,ta),Object.assign(a.Paint,D),Object.assign(a.PaintImage,_e),Object.assign(a.PaintGradient,Me),Object.assign(a.Effect,Qe),i(),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=r,exports.Renderer=v,exports.Watcher=o,exports.useCanvas=i,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(a).forEach(function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return a[e]}})});
|
|
1
|
+
"use strict";var e,t=require("@leafer/core"),a=require("@leafer-ui/draw");function n(e,t,a,n){return new(a||(a=Promise))(function(r,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof a?t:new a(function(e){e(t)})).then(s,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;class r extends t.LeaferCanvasBase{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=t.Platform.origin.createCanvas(1,1)}updateViewSize(){const{width:e,height:t,pixelRatio:a}=this;this.view.width=Math.ceil(e*a),this.view.height=Math.ceil(t*a),this.clientBounds=this.bounds}}function i(e,a){t.Platform.origin={createCanvas:(e,t)=>new OffscreenCanvas(e,t),canvasToDataURL:(e,a,n)=>new Promise((r,i)=>{e.convertToBlob({type:t.FileHelper.mimeType(a),quality:n}).then(e=>{var t=new FileReader;t.onload=e=>r(e.target.result),t.onerror=e=>i(e),t.readAsDataURL(e)}).catch(e=>{i(e)})}),canvasToBolb:(e,a,n)=>e.convertToBlob({type:t.FileHelper.mimeType(a),quality:n}),canvasSaveAs:(e,t,a)=>new Promise(e=>e()),download(e,t){},loadImage:(e,a,n)=>new Promise((a,n)=>{let r=new XMLHttpRequest;r.open("GET",t.Platform.image.getRealURL(e),!0),r.responseType="blob",r.onload=()=>{createImageBitmap(r.response).then(e=>{a(e)}).catch(e=>{n(e)})},r.onerror=e=>n(e),r.send()}),loadContent(e){return n(this,arguments,void 0,function*(e,t="text"){const a=yield fetch(e);if(!a.ok)throw new Error(`${a.status}`);return yield a[t]()})}},t.Platform.canvas=t.Creator.canvas(),t.Platform.conicGradientSupport=!!t.Platform.canvas.context.createConicGradient}t.canvasPatch(OffscreenCanvasRenderingContext2D.prototype),t.canvasPatch(Path2D.prototype),Object.assign(t.Creator,{canvas:(e,t)=>new r(e,t),image:e=>new t.LeaferImage(e)}),t.Platform.name="web",t.Platform.isWorker=!0,t.Platform.backgrounder=!0,t.Platform.requestRender=function(e){requestAnimationFrame(e)},t.defineKey(t.Platform,"devicePixelRatio",{get:()=>1});const{userAgent:s}=navigator;s.indexOf("Firefox")>-1?(t.Platform.conicGradientRotate90=!0,t.Platform.intWheelDeltaY=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(t.Platform.fullImageShadow=!0),s.indexOf("Windows")>-1?(t.Platform.os="Windows",t.Platform.intWheelDeltaY=!0):s.indexOf("Mac")>-1?t.Platform.os="Mac":s.indexOf("Linux")>-1&&(t.Platform.os="Linux");class o{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,a){this.totalTimes=0,this.changed=0,this.config={},this.__updatedList=new t.LeafList,this.target=e,a&&(this.config=t.DataHelper.default(a,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed<100&&(this.changed++,this.running&&this.target.emit(t.RenderEvent.REQUEST))}__onAttrChange(e){this.add(e.target)}add(e){this.config.usePartLayout&&this.__updatedList.add(e),this.update()}addChild(e,a,n){this.config.usePartLayout&&(n===t.ChildEvent.ADD?(this.hasAdd=!0,this.__pushChild(e)):(this.hasRemove=!0,this.__updatedList.add(a))),this.update()}__onChildEvent(e){this.addChild(e.child,e.parent,e.type)}__pushChild(e){this.__updatedList.add(e),e.isBranch&&this.__loopChildren(e)}__loopChildren(e){const{children:t}=e;for(let e=0,a=t.length;e<a;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.hasVisible=this.hasRemove=this.hasAdd=!1,this.changed=0}__listenEvents(){this.__eventIds=[this.target.on_([[t.PropertyEvent.CHANGE,this.__onAttrChange,this],[[t.ChildEvent.ADD,t.ChildEvent.REMOVE],this.__onChildEvent,this],[t.WatchEvent.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:l,updateBounds:d,updateChange:c}=t.LeafHelper,{pushAllChildBranch:h,pushAllParent:u}=t.BranchHelper,f={updateMatrix(e,t){let a,n,r=0;const{list:i}=e;for(;r<i.length;)a=i[r],n=a.__layout,t.without(a)&&!n.proxyZoom&&(n.matrixChanged?(l(a,!0),a.isBranch&&h(a,t),p(a,t)):n.boundsChanged&&(a.isBranch&&(a.__tempNumber=0),p(a,t))),r++},updateBounds(e){let t,a,n,r,i=0;const{levels:s,levelMap:o}=e;for(e.sort(!0);i<s.length;){t=s[i],a=o[t];for(let e=0,t=a.length;e<t;e++){if(n=a[e],n.isBranch&&n.__tempNumber){r=n.children;for(let e=0,t=r.length;e<t;e++)r[e].isBranch||d(r[e])}d(n)}i++}},updateChange(e){e.list.forEach(c)},push:p};function p(e,t){t.add(e),u(e,t)}const{worldBounds:g}=t.LeafBoundsHelper;class _{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,g)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,g),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:y}=t.LeafHelper,w=t.Debug.get("Layouter");class v{constructor(e,a){this.totalTimes=0,this.config={usePartLayout:!0},this.__levelList=new t.LeafLevelList,this.target=e,a&&(this.config=t.DataHelper.default(a,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(this.layouting||!this.running)return;const{target: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 a=t.Run.start("PartLayout"),{target:n,__updatedList:r}=this,{BEFORE:i,LAYOUT:s,AFTER:o}=t.LayoutEvent,l=this.getBlocks(r);l.forEach(e=>e.setBefore()),n.emitEvent(new t.LayoutEvent(i,l,this.times)),this.extraBlock=null,r.sort(),f.updateMatrix(r,this.__levelList),f.updateBounds(this.__levelList),f.updateChange(r),this.extraBlock&&l.push(this.extraBlock),l.forEach(e=>e.setAfter()),n.emitEvent(new t.LayoutEvent(s,l,this.times)),n.emitEvent(new t.LayoutEvent(o,l,this.times)),this.addBlocks(l),this.__levelList.reset(),this.__updatedList=null,t.Run.end(a)}fullLayout(){const e=t.Run.start("FullLayout"),{target:a}=this,{BEFORE:n,LAYOUT:r,AFTER:i}=t.LayoutEvent,s=this.getBlocks(new t.LeafList(a));a.emitEvent(new t.LayoutEvent(n,s,this.times)),v.fullLayout(a),s.forEach(e=>{e.setAfter()}),a.emitEvent(new t.LayoutEvent(r,s,this.times)),a.emitEvent(new t.LayoutEvent(i,s,this.times)),this.addBlocks(s),t.Run.end(e)}static fullLayout(e){m(e,!0),e.isBranch?t.BranchHelper.updateBounds(e):t.LeafHelper.updateBounds(e),y(e)}addExtra(e,t){if(!this.__updatedList.has(e)){const{updatedList:a,beforeBounds:n}=this.extraBlock||(this.extraBlock=new _([]));if(a.length?n.add(e.__world):n.set(e.__world),a.add(e),t){const t=this.__levelList;f.push(e,t),t.sort(!0)}}}createBlock(e){return new _(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 x=t.Debug.get("Renderer");class b{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(e,a,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=a,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:a}=this;this.times=0,this.totalBounds=new t.Bounds,x.log(a.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,x.error(e)}x.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(e){if(this.rendering)return x.warn("rendering");if(this.times>3)return x.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 a=t.Run.start("PartRender"),{canvas:n}=this,r=e.getIntersect(n.bounds),i=new t.Bounds(r);n.save(),r.spread(b.clipSpread).ceil();const{ceilPartPixel:s}=this.config;n.clipWorld(r,s),n.clearWorld(r,s),this.__render(r,i),n.restore(),t.Run.end(a)}fullRender(){const e=t.Run.start("FullRender"),{canvas:a}=this;a.save(),a.clear(),this.__render(a.bounds),a.restore(),t.Run.end(e)}__render(e,a){const{canvas:n,target:r}=this,i=e.includes(r.__world),s=i?{includes:i}:{bounds:e,includes:i};this.needFill&&n.fillWorld(e,this.config.fill),t.Debug.showRepaint&&t.Debug.drawRepaint(n,e),this.config.useCellRender&&(s.cellList=this.getCellList()),t.Platform.render(r,n,s),this.renderBounds=a=a||e,this.renderOptions=s,this.totalBounds.isEmpty()?this.totalBounds=a:this.totalBounds.add(a),n.updateRender(a)}getCellList(){}addBlock(e,t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(e)}mergeBlocks(){const{updateBlocks:e}=this;if(e){const a=new t.Bounds;a.setList(e),e.length=0,e.push(a)}}__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 a=()=>{const e=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:n}=this.config;if(n&&e>n)return t.Platform.requestRender(a);const{frames:r}=this;r.length>30&&r.shift(),r.push(e),this.FPS=Math.round(r.reduce((e,t)=>e+t,0)/r.length),this.requestTime=0,this.checkRender()};t.Platform.requestRender(a)}__onResize(e){if(!this.canvas.unreal){if(e.bigger||!e.samePixelRatio){const{width:a,height:n}=e.old;if(!new t.Bounds(0,0,a,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:a}=e;a&&a.list.some(e=>(t=!e.__world.width||!e.__world.height,t&&(e.isLeafer||x.tip(e.innerName,": empty"),t=!e.isBranch||e.isBranchLeaf),t)),this.addBlock(t?this.canvas.bounds:e.updatedBounds,a)})}emitRender(e,a,n){this.target.emitEvent(new t.RenderEvent(e,this.times,a,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 P(e,t,n){e.__.__font?a.Paint.fillText(e,t,n):e.__.windingRule?t.fill(e.__.windingRule):t.fill()}function S(e,n,r,i,s){const o=r.__;t.isObject(e)?a.Paint.drawStrokesStyle(e,n,!1,r,i,s):(i.setStroke(e,o.__strokeWidth*n,o),i.stroke()),o.__useArrow&&a.Paint.strokeArrow(e,r,i,s)}function B(e,n,r,i,s){const o=r.__;t.isObject(e)?a.Paint.drawStrokesStyle(e,n,!0,r,i,s):(i.setStroke(e,o.__strokeWidth*n,o),a.Paint.drawTextStroke(r,i,s))}function E(e,n,r,i,s){const o=i.getSameCanvas(!0,!0);o.font=r.__.__font,B(e,2,r,o,s),o.blendMode="outside"===n?"destination-out":"destination-in",a.Paint.fillText(r,o,s),o.blendMode="normal",t.LeafHelper.copyCanvasByWorld(r,i,o),o.recycle(r.__nowWorld)}b.clipSpread=10,Object.assign(t.Creator,{watcher:(e,t)=>new o(e,t),layouter:(e,t)=>new v(e,t),renderer:(e,t,a)=>new b(e,t,a),selector:(e,t)=>{},interaction:(e,t,a,n)=>{}}),t.Platform.layout=v.fullLayout,t.Platform.render=function(e,a,n){const r=Object.assign(Object.assign({},n),{topRendering:!0});n.topList=new t.LeafList,e.__render(a,n),n.topList.length&&n.topList.forEach(e=>e.__render(a,r))};const{getSpread:L,copyAndSpread:k,toOuterOf:R,getOuterOf:C,getByMove:T,move:A,getIntersectData:O}=t.BoundsHelper,I={};let M;const{stintSet:W}=t.DataHelper,{hasTransparent:D}=a.ColorConvert;function H(e,n,r){if(!t.isObject(n)||!1===n.visible||0===n.opacity)return;let i;const{boxBounds:s}=r.__layout,{type:o}=n;switch(o){case"image":case"film":case"video":if(!n.url)return;i=a.PaintImage.image(r,e,n,s,!M||!M[n.url]),"image"!==o&&a.PaintImage[o](i);break;case"linear":i=a.PaintGradient.linearGradient(n,s);break;case"radial":i=a.PaintGradient.radialGradient(n,s);break;case"angular":i=a.PaintGradient.conicGradient(n,s);break;case"solid":const{color:l,opacity:d}=n;i={type:o,style:a.ColorConvert.string(l,d)};break;default:t.isUndefined(n.r)||(i={type:"solid",style:a.ColorConvert.string(n)})}if(i&&(i.originPaint=n,t.isString(i.style)&&D(i.style)&&(i.isTransparent=!0),n.style)){if(0===n.style.strokeWidth)return;i.strokeStyle=n.style}return i}const F={compute:function(e,n){const r=n.__,i=[];let s,o,l,d=r.__input[e];t.isArray(d)||(d=[d]),M=a.PaintImage.recycleImage(e,r);for(let t,a=0,r=d.length;a<r;a++)(t=H(e,d[a],n))&&(i.push(t),t.strokeStyle&&(l||(l=1),t.strokeStyle.strokeWidth&&(l=Math.max(l,t.strokeStyle.strokeWidth))));i.length?(r["_"+e]=i,i.every(e=>e.isTransparent)&&(i.some(e=>e.image)&&(s=!0),o=!0),"fill"===e?(W(r,"__isAlphaPixelFill",s),W(r,"__isTransparentFill",o)):(W(r,"__isAlphaPixelStroke",s),W(r,"__isTransparentStroke",o),W(r,"__hasMultiStrokeStyle",l))):(r.__removePaint(e,!1),r["_"+e]="")},fill:function(e,t,a,n){a.fillStyle=e,P(t,a,n)},fills:function(e,t,n,r){let i,s,o;for(let l=0,d=e.length;l<d;l++){if(i=e[l],s=i.originPaint,i.image){if(o?o++:o=1,a.PaintImage.checkImage(i,!t.__.__font,t,n,r))continue;if(!i.style){1===o&&i.image.isPlacehold&&t.drawImagePlaceholder(i,n,r);continue}}if(n.fillStyle=i.style,i.transform||s.scaleFixed){if(n.save(),i.transform&&n.transform(i.transform),s.scaleFixed){const{scaleX:e,scaleY:a}=t.getRenderScaleData(!0,s.scaleFixed,!1);1!==e&&n.scale(e,a)}s.blendMode&&(n.blendMode=s.blendMode),P(t,n,r),n.restore()}else s.blendMode?(n.saveBlendMode(s.blendMode),P(t,n,r),n.restoreBlendMode()):P(t,n,r)}},fillPathOrText:P,fillText:function(e,t,n){if(e.motionText)return a.Paint.fillMotionText(e,t,n);const r=e.__,{rows:i,decorationY:s}=r.__textDrawData;let o;r.__isPlacehold&&r.placeholderColor&&(t.fillStyle=r.placeholderColor);for(let e=0,a=i.length;e<a;e++)o=i[e],o.text?t.fillText(o.text,o.x,o.y):o.data&&o.data.forEach(e=>{t.fillText(e.char,e.x,o.y)});if(s){const{decorationColor:e,decorationHeight:a}=r.__textDrawData;e&&(t.fillStyle=e),i.forEach(e=>s.forEach(n=>t.fillRect(e.x,e.y+n,e.width,a)))}},stroke:function(e,n,r,i){const s=n.__;if(s.__strokeWidth)if(s.__font)a.Paint.strokeText(e,n,r,i);else if(s.__pathForStroke)a.Paint.fillStroke(e,n,r,i);else switch(s.strokeAlign){case"center":S(e,1,n,r,i);break;case"inside":!function(e,t,a,n){a.save(),a.clipUI(t),S(e,2,t,a,n),a.restore()}(e,n,r,i);break;case"outside":!function(e,a,n,r){const i=a.__;if(i.__fillAfterStroke)S(e,2,a,n,r);else{const{renderBounds:s}=a.__layout,o=n.getSameCanvas(!0,!0);a.__drawRenderPath(o),S(e,2,a,o,r),o.clipUI(i),o.clearWorld(s),t.LeafHelper.copyCanvasByWorld(a,n,o),o.recycle(a.__nowWorld)}}(e,n,r,i)}},strokes:function(e,t,n,r){a.Paint.stroke(e,t,n,r)},strokeText:function(e,t,a,n){switch(t.__.strokeAlign){case"center":B(e,1,t,a,n);break;case"inside":E(e,"inside",t,a,n);break;case"outside":t.__.__fillAfterStroke?B(e,2,t,a,n):E(e,"outside",t,a,n)}},drawTextStroke:function(e,t,a){let n,r=e.__.__textDrawData;const{rows:i,decorationY:s}=r;for(let e=0,a=i.length;e<a;e++)n=i[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(s){const{decorationHeight:e}=r;i.forEach(a=>s.forEach(n=>t.strokeRect(a.x,a.y+n,a.width,e)))}},drawStrokesStyle:function(e,t,n,r,i,s){let o;const l=r.__,{__hasMultiStrokeStyle:d}=l;d||i.setStroke(void 0,l.__strokeWidth*t,l);for(let c=0,h=e.length;c<h;c++)if(o=e[c],(!o.image||!a.PaintImage.checkImage(o,!1,r,i,s))&&o.style){if(d){const{strokeStyle:e}=o;e?i.setStroke(o.style,l.__getRealStrokeWidth(e)*t,l,e):i.setStroke(o.style,l.__strokeWidth*t,l)}else i.strokeStyle=o.style;o.originPaint.blendMode?(i.saveBlendMode(o.originPaint.blendMode),n?a.Paint.drawTextStroke(r,i,s):i.stroke(),i.restoreBlendMode()):n?a.Paint.drawTextStroke(r,i,s):i.stroke()}},shape:function(e,a,n){const r=a.getSameCanvas(),i=a.bounds,s=e.__nowWorld,o=e.__layout,l=e.__nowWorldShapeBounds||(e.__nowWorldShapeBounds={});let d,c,h,u,f,p;R(o.strokeSpread?(k(I,o.boxBounds,o.strokeSpread),I):o.boxBounds,s,l);let{scaleX:g,scaleY:_}=e.getRenderScaleData(!0);if(i.includes(l))p=r,d=f=l,c=s;else{let r;if(t.Platform.fullImageShadow)r=l;else{const e=o.renderShapeSpread?L(i,t.FourNumberHelper.swapAndScale(o.renderShapeSpread,g,_)):i;r=O(e,l)}u=i.getFitMatrix(r);let{a:m,d:y}=u;u.a<1&&(p=a.getSameCanvas(),e.__renderShape(p,n),g*=m,_*=y),f=C(l,u),d=T(f,-u.e,-u.f),c=C(s,u),A(c,-u.e,-u.f);const w=n.matrix;w?(h=new t.Matrix(u),h.multiply(w),m*=w.scaleX,y*=w.scaleY):h=u,h.withScale(m,y),n=Object.assign(Object.assign({},n),{matrix:h})}return e.__renderShape(r,n),{canvas:r,matrix:h,fitMatrix:u,bounds:d,renderBounds:c,worldCanvas:p,shapeBounds:f,scaleX:g,scaleY:_}}};let j,G=new t.Bounds;const{isSame:Y}=t.BoundsHelper;function N(e,n,r,i,s,o){let l=!0;const d=e.__;if("fill"!==n||d.__naturalWidth||(d.__naturalWidth=i.width/d.pixelRatio,d.__naturalHeight=i.height/d.pixelRatio,d.__autoSide&&(e.forceUpdate(),t.LeafHelper.updateBounds(e,!0),e.__layout.boundsChanged=!0,e.__proxyData&&(e.setProxyAttr("width",d.width),e.setProxyAttr("height",d.height)),l=!1)),"brush"===r.mode&&a.PaintImage.brush(e,n,s),!s.data){a.PaintImage.createData(s,i,r,o);const{transform:e}=s.data,{opacity:t}=r,n=(e&&!e.onlyScale||d.path||d.cornerRadius)&&!s.brush;(n||t&&t<1||r.blendMode)&&(s.complex=!n||2)}return r.filter&&a.PaintImage.applyFilter(s,i,r.filter,e),l}function U(e,a){z(e,t.ImageEvent.LOAD,a)}function X(e,a){z(e,t.ImageEvent.LOADED,a)}function q(e,a,n){a.error=n,e.forceUpdate("surface"),z(e,t.ImageEvent.ERROR,a)}function z(e,a,n){e.hasEvent(a)&&e.emitEvent(new t.ImageEvent(a,n))}function V(e,t){const{leafer:a}=e;a&&a.viewReady&&(a.renderer.ignore=t)}const{get:Q,translate:Z}=t.MatrixHelper,$=new t.Bounds,K={},J={};function ee(e,a,n,r){const i=t.isString(e)||r?(r?n-r*a:n%a)/((r||Math.floor(n/a))-1):e;return"auto"===e&&i<0?0:i}let te={},ae=t.getMatrixData();const{get:ne,set:re,rotateOfOuter:ie,translate:se,scaleOfOuter:oe,multiplyParent:le,scale:de,rotate:ce,skew:he}=t.MatrixHelper;function ue(e,t,a,n,r,i,s,o){s&&ce(e,s),o&&he(e,o.x,o.y),r&&de(e,r,i),se(e,t.x+a,t.y+n)}const{get:fe,scale:pe,copy:ge}=t.MatrixHelper,{getFloorScale:_e}=t.MathHelper,{abs:me}=Math;const ye={image:function(e,a,n,r,i){let s,o;const l=t.ImageManager.get(n,n.type);return j&&n===j.paint&&Y(r,j.boxBounds)?s=j.leafPaint:(s={type:n.type,image:l},l.hasAlphaPixel&&(s.isTransparent=!0),j=l.use>1?{leafPaint:s,paint:n,boxBounds:G.set(r)}:null),(i||l.loading)&&(o={image:l,attrName:a,attrValue:n}),l.ready?(N(e,a,n,l,s,r),i&&(U(e,o),X(e,o))):l.error?i&&q(e,o,l.error):(i&&(V(e,!0),U(e,o)),s.loadId=l.load(()=>{V(e,!1),e.destroyed||(N(e,a,n,l,s,r)&&(l.hasAlphaPixel&&(e.__layout.hitCanvasChanged=!0),e.forceUpdate("surface")),X(e,o)),s.loadId=void 0},t=>{V(e,!1),q(e,o,t),s.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)),s},checkImage:function(e,n,r,i,s){const{scaleX:o,scaleY:l}=a.PaintImage.getImageRenderScaleData(e,r,i,s),d=e.film?e.nowIndex:o+"-"+l,{image:c,brush:h,data:u,originPaint:f}=e,{exporting:p,snapshot:g}=s;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)r.__.__isFastShadow&&(i.fillStyle=e.style||"#000",i.fill());else if(!e.style||f.sync||p?a.PaintImage.createPattern(e,r,i,s):a.PaintImage.createPatternTask(e,r,i,s),!h||!e.style)return!1;return a.PaintImage.drawImage(e,o,l,r,i,s),!0},drawImage:function(e,t,a,n,r,i){const{data:s,image:o,brush:l,complex:d}=e;let{width:c,height:h}=o,u=l||o;if(d){const{blendMode:i,opacity:o}=e.originPaint,{transform:l}=s;r.save(),2===d&&r.clipUI(n),i&&(r.blendMode=i),o&&(r.opacity*=o),l&&r.transform(l),u.render(r,0,0,c,h,n,e,t,a),r.restore()}else s.scaleX&&(c*=s.scaleX,h*=s.scaleY),u.render(r,0,0,c,h,n,e,t,a)},getImageRenderScaleData:function(e,t,n,r){const i=t.getRenderScaleData(!0,e.originPaint.scaleFixed),{data:s}=e;if(e.brush&&a.PaintImage.addBrushScale(i,e,t),n){const{pixelRatio:e}=n;i.scaleX*=e,i.scaleY*=e}return s&&s.scaleX&&(i.scaleX*=Math.abs(s.scaleX),i.scaleY*=Math.abs(s.scaleY)),i},recycleImage:function(e,n){const r=n["_"+e];if(t.isArray(r)){let i,s,o,l,d;const c=n.__leaf;for(let h=0,u=r.length;h<u;h++)i=r[h],s=i.image,d=s&&s.url,d&&(o||(o={}),o[d]=!0,t.ImageManager.recyclePaint(i),i.brush&&a.PaintImage.recycleBrush(i,c),n.__willDestroy&&s.parent&&a.PaintImage.recycleFilter(s,c),s.loading&&(l||(l=n.__input&&n.__input[e]||[],t.isArray(l)||(l=[l])),s.unload(r[h].loadId,!l.some(e=>e.url===d))));return o}return null},createPatternTask:function(e,r,i,s){e.patternTask||(e.patternTask=t.ImageManager.patternTasker.add(()=>n(this,void 0,void 0,function*(){a.PaintImage.createPattern(e,r,i,s),r.forceUpdate("surface")}),0,()=>(e.patternTask=null,i.bounds.hit(r.__nowWorld))))},createPattern:function(e,n,r,i){let{scaleX:s,scaleY:o}=a.PaintImage.getImageRenderScaleData(e,n,r,i),l=e.film?e.nowIndex:s+"-"+o;if(e.patternId!==l&&!n.destroyed&&(!t.Platform.image.isLarge(e.image,s,o)||e.data.repeat)){const{image:d,brush:c,data:h}=e,{transform:u,gap:f}=h,p=a.PaintImage.getPatternFixScale(e,s,o);let g,_,m,{width:y,height:w}=d,{opacity:v}=e.originPaint;(c||1===v)&&(v=void 0),p&&(s*=p,o*=p),y*=s,w*=o,f&&!c&&(_=f.x*s/me(h.scaleX||1),m=f.y*o/me(h.scaleY||1)),(u||1!==s||1!==o)&&(s*=_e(y+(_||0)),o*=_e(w+(m||0)),g=fe(),u&&ge(g,u),pe(g,1/s,1/o));const x=d.getCanvas(y,w,v,void 0,_,m,n.leafer&&n.leafer.config.smooth,h.interlace);c?(e.style=x,a.PaintImage.cacheBrush(e,n,r,i)):e.style=d.getPattern(x,h.repeat||t.Platform.origin.noRepeat||"no-repeat",g,e),e.patternId=l}},getPatternFixScale:function(e,a,n){const{image:r}=e;let i,s=t.Platform.image.maxPatternSize,o=r.width*r.height;return r.isSVG?a>1&&(i=Math.ceil(a)/a):s>o&&(s=o),(o*=a*n)>s&&(i=Math.sqrt(s/o)),i},createData:function(e,t,n,r){e.data=a.PaintImage.getPatternData(n,r,t)},getPatternData:function(e,n,r){e.padding&&(n=$.set(n).shrink(e.padding)),"strench"===e.mode&&(e.mode="stretch");const{width:i,height:s}=r,{mode:o,align:l,offset:d,scale:c,size:h,rotation:u,skew:f,clipSize:p,repeat:g,gap:_,interlace:m}=e,y=n.width===i&&n.height===s,w={mode:o},v="center"!==l&&(u||0)%180==90;let x,b;switch(t.BoundsHelper.set(J,0,0,v?s:i,v?i:s),o&&"cover"!==o&&"fit"!==o?((c||h)&&(t.MathHelper.getScaleData(c,h,r,K),x=K.scaleX,b=K.scaleY),(l||_||g)&&(x&&t.BoundsHelper.scale(J,x,b,!0),l&&t.AlignHelper.toPoint(l,J,n,J,!0,!0))):y&&!u||(x=b=t.BoundsHelper.getFitScale(n,J,"fit"!==o),t.BoundsHelper.put(n,r,l,x,!1,J),t.BoundsHelper.scale(J,x,b,!0)),d&&t.PointHelper.move(J,d),o){case"stretch":y?x&&(x=b=void 0):(x=n.width/i,b=n.height/s,a.PaintImage.stretchMode(w,n,x,b));break;case"normal":case"clip":if(J.x||J.y||x||p||u||f){let e,t;p&&(e=n.width/p.width,t=n.height/p.height),a.PaintImage.clipMode(w,n,J.x,J.y,x,b,u,f,e,t),e&&(x=x?x*e:e,b=b?b*t:t)}break;case"repeat":(!y||x||u||f)&&a.PaintImage.repeatMode(w,n,i,s,J.x,J.y,x,b,u,f,l,e.freeTransform);case"brush":g||(w.repeat="repeat");const r=t.isObject(g);(_||r)&&(w.gap=function(e,a,n,r,i){let s,o;t.isObject(e)?(s=e.x,o=e.y):s=o=e;return{x:ee(s,n,i.width,a&&a.x),y:ee(o,r,i.height,a&&a.y)}}(_,r&&g,J.width,J.height,n));break;default:x&&a.PaintImage.fillOrFitMode(w,n,J.x,J.y,x,b,u)}return w.transform||"brush"===o||(n.x||n.y)&&Z(w.transform=Q(),n.x,n.y),x&&(w.scaleX=x,w.scaleY=b),g&&(w.repeat=t.isString(g)?"x"===g?"repeat-x":"repeat-y":"repeat"),m&&(w.interlace=t.isNumber(m)||"percent"===m.type?{type:"x",offset:m}:m),w},stretchMode:function(e,t,a,n){const r=ne(),{x:i,y:s}=t;i||s?se(r,i,s):a>0&&n>0&&(r.onlyScale=!0),de(r,a,n),e.transform=r},fillOrFitMode:function(e,t,a,n,r,i,s){const o=ne();se(o,t.x+a,t.y+n),de(o,r,i),s&&ie(o,{x:t.x+t.width/2,y:t.y+t.height/2},s),e.transform=o},clipMode:function(e,t,a,n,r,i,s,o,l,d){const c=ne();ue(c,t,a,n,r,i,s,o),l&&(s||o?(re(ae),oe(ae,t,l,d),le(c,ae)):oe(c,t,l,d)),e.transform=c},repeatMode:function(e,t,a,n,r,i,s,o,l,d,c,h){const u=ne();if(h)ue(u,t,r,i,s,o,l,d);else{if(l)if("center"===c)ie(u,{x:a/2,y:n/2},l);else switch(ce(u,l),l){case 90:se(u,n,0);break;case 180:se(u,a,n);break;case 270:se(u,0,a)}te.x=t.x+r,te.y=t.y+i,se(u,te.x,te.y),s&&oe(u,te,s,o)}e.transform=u}},{toPoint:we}=t.AroundHelper,{hasTransparent:ve}=a.ColorConvert,xe={},be={};function Pe(e,n,r,i){if(r){let s,o,l,d;for(let e=0,c=r.length;e<c;e++)s=r[e],t.isString(s)?(l=e/(c-1),o=a.ColorConvert.string(s,i)):(l=s.offset,o=a.ColorConvert.string(s.color,i)),n.addColorStop(l,o),!d&&ve(o)&&(d=!0);d&&(e.isTransparent=!0)}}const{getAngle:Se,getDistance:Be}=t.PointHelper,{get:Ee,rotateOfOuter:Le,scaleOfOuter:ke}=t.MatrixHelper,{toPoint:Re}=t.AroundHelper,Ce={},Te={};function Ae(e,t,a,n,r){let i;const{width:s,height:o}=e;if(s!==o||n){const e=Se(t,a);i=Ee(),r?(ke(i,t,s/o*(n||1),1),Le(i,t,e+90)):(ke(i,t,1,s/o*(n||1)),Le(i,t,e))}return i}const{getDistance:Oe}=t.PointHelper,{toPoint:Ie}=t.AroundHelper,Me={},We={};const De={linearGradient:function(e,a){let{from:n,to:r,type:i,opacity:s}=e;we(n||"top",a,xe),we(r||"bottom",a,be);const o=t.Platform.canvas.createLinearGradient(xe.x,xe.y,be.x,be.y),l={type:i,style:o};return Pe(l,o,e.stops,s),l},radialGradient:function(e,a){let{from:n,to:r,type:i,opacity:s,stretch:o}=e;Re(n||"center",a,Ce),Re(r||"bottom",a,Te);const l=t.Platform.canvas.createRadialGradient(Ce.x,Ce.y,0,Ce.x,Ce.y,Be(Ce,Te)),d={type:i,style:l};Pe(d,l,e.stops,s);const c=Ae(a,Ce,Te,o,!0);return c&&(d.transform=c),d},conicGradient:function(e,a){let{from:n,to:r,type:i,opacity:s,rotation:o,stretch:l}=e;Ie(n||"center",a,Me),Ie(r||"bottom",a,We);const d=t.Platform.conicGradientSupport?t.Platform.canvas.createConicGradient(o?o*t.OneRadian:0,Me.x,Me.y):t.Platform.canvas.createRadialGradient(Me.x,Me.y,0,Me.x,Me.y,Oe(Me,We)),c={type:i,style:d};Pe(c,d,e.stops,s);const h=Ae(a,Me,We,l||1,t.Platform.conicGradientRotate90);return h&&(c.transform=h),c},getTransform:Ae},{copy:He,move:Fe,toOffsetOutBounds:je}=t.BoundsHelper,{max:Ge,abs:Ye}=Math,Ne={},Ue=new t.Matrix,Xe={};function qe(e,t){let a,n,r,i,s=0,o=0,l=0,d=0;return t.forEach(e=>{a=e.x||0,n=e.y||0,i=1.5*(e.blur||0),r=Ye(e.spread||0),s=Ge(s,r+i-n),o=Ge(o,r+i+a),l=Ge(l,r+i+n),d=Ge(d,r+i-a)}),s===o&&o===l&&l===d?s:[s,o,l,d]}function ze(e,a,n){const{shapeBounds:r}=n;let i,s;t.Platform.fullImageShadow?(He(Ne,e.bounds),Fe(Ne,a.x-r.x,a.y-r.y),i=e.bounds,s=Ne):(i=r,s=a),e.copyWorld(n.canvas,i,s)}const{toOffsetOutBounds:Ve}=t.BoundsHelper,Qe={};const Ze=qe;const $e={shadow:function(e,n,r){let i,s;const{__nowWorld:o}=e,{shadow:l}=e.__,{worldCanvas:d,bounds:c,renderBounds:h,shapeBounds:u,scaleX:f,scaleY:p}=r,g=n.getSameCanvas(),_=l.length-1;je(c,Xe,h),l.forEach((l,m)=>{let y=1;if(l.scaleFixed){const e=Math.abs(o.scaleX);e>1&&(y=1/e)}g.setWorldShadow(Xe.offsetX+(l.x||0)*f*y,Xe.offsetY+(l.y||0)*p*y,(l.blur||0)*f*y,a.ColorConvert.string(l.color)),s=a.Effect.getShadowTransform(e,g,r,l,Xe,y),s&&g.setTransform(s),ze(g,Xe,r),s&&g.resetTransform(),i=h,l.box&&(g.restore(),g.save(),d&&(g.copyWorld(g,h,o,"copy"),i=o),d?g.copyWorld(d,o,o,"destination-out"):g.copyWorld(r.canvas,u,c,"destination-out")),t.LeafHelper.copyCanvasByWorld(e,n,g,i,l.blendMode),_&&m<_&&g.clearWorld(i)}),g.recycle(i)},innerShadow:function(e,n,r){let i,s;const{__nowWorld:o}=e,{innerShadow:l}=e.__,{worldCanvas:d,bounds:c,renderBounds:h,shapeBounds:u,scaleX:f,scaleY:p}=r,g=n.getSameCanvas(),_=l.length-1;Ve(c,Qe,h),l.forEach((l,m)=>{let y=1;if(l.scaleFixed){const e=Math.abs(o.scaleX);e>1&&(y=1/e)}g.save(),g.setWorldShadow(Qe.offsetX+(l.x||0)*f*y,Qe.offsetY+(l.y||0)*p*y,(l.blur||0)*f*y),s=a.Effect.getShadowTransform(e,g,r,l,Qe,y,!0),s&&g.setTransform(s),ze(g,Qe,r),g.restore(),d?(g.copyWorld(g,h,o,"copy"),g.copyWorld(d,o,o,"source-out"),i=o):(g.copyWorld(r.canvas,u,c,"source-out"),i=h),g.fillWorld(i,a.ColorConvert.string(l.color),"source-in"),t.LeafHelper.copyCanvasByWorld(e,n,g,i,l.blendMode),_&&m<_&&g.clearWorld(i)}),g.recycle(i)},blur:function(e,t,a){const{blur:n}=e.__;a.setWorldBlur(n*e.__nowWorld.a),a.copyWorldToInner(t,e.__nowWorld,e.__layout.renderBounds),a.filter="none"},backgroundBlur:function(e,t,a){},getShadowRenderSpread:qe,getShadowTransform:function(e,t,a,n,r,i,s){if(n.spread){const a=2*n.spread*i*(s?-1:1),{width:o,height:l}=e.__layout.strokeBounds;return Ue.set().scaleOfOuter({x:(r.x+r.width/2)*t.pixelRatio,y:(r.y+r.height/2)*t.pixelRatio},1+a/o,1+a/l),Ue}},isTransformShadow(e){},getInnerShadowSpread:Ze},{excludeRenderBounds:Ke}=t.LeafBoundsHelper;let Je;function et(e,t,a,n,r,i,s,o){switch(t){case"grayscale":Je||(Je=!0,r.useGrayscaleAlpha(e.__nowWorld));case"alpha":!function(e,t,a,n,r,i){const s=e.__nowWorld;a.resetTransform(),a.opacity=1,a.useMask(n,s),i&&n.recycle(s);at(e,t,a,1,r,i)}(e,a,n,r,s,o);break;case"opacity-path":at(e,a,n,i,s,o);break;case"path":o&&a.restore()}}function tt(e){return e.getSameCanvas(!1,!0)}function at(e,t,a,n,r,i){const s=e.__nowWorld;t.resetTransform(),t.opacity=n,t.copyWorld(a,s,void 0,r),i?a.recycle(s):a.clearWorld(s)}a.Group.prototype.__renderMask=function(e,t){let a,n,r,i,s,o;const{children:l}=this;for(let d=0,c=l.length;d<c;d++){if(a=l[d],o=a.__.mask,o){s&&(et(this,s,e,r,n,i,void 0,!0),n=r=null),"clipping"!==o&&"clipping-path"!==o||Ke(a,t)||a.__render(e,t),i=a.__.opacity,Je=!1,"path"===o||"clipping-path"===o?(i<1?(s="opacity-path",r||(r=tt(e))):(s="path",e.save()),a.__clip(r||e,t)):(s="grayscale"===o?"grayscale":"alpha",n||(n=tt(e)),r||(r=tt(e)),a.__render(n,t));continue}const c=1===i&&a.__.__blendMode;c&&et(this,s,e,r,n,i,void 0,!1),Ke(a,t)||a.__render(r||e,t),c&&et(this,s,e,r,n,i,c,!1)}et(this,s,e,r,n,i,void 0,!0)};const nt=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",rt=nt+"_#~&*+\\=|≮≯≈≠=…",it=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 ot=st("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),lt=st("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),dt=st(nt),ct=st(rt),ht=st("- —/~|┆·");var ut;!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"}(ut||(ut={}));const{Letter:ft,Single:pt,Before:gt,After:_t,Symbol:mt,Break:yt}=ut;function wt(e){return ot[e]?ft:ht[e]?yt:lt[e]?gt:dt[e]?_t:ct[e]?mt:it.test(e)?pt:ft}const vt={trimRight(e){const{words:t}=e;let a,n=0,r=t.length;for(let i=r-1;i>-1&&(a=t[i].data[0]," "===a.char);i--)n++,e.width-=a.width;n&&t.splice(r-n,n)}};function xt(e,t,a){switch(t){case"title":return a?e.toUpperCase():e;case"upper":return e.toUpperCase();case"lower":return e.toLowerCase();default:return e}}const{trimRight:bt}=vt,{Letter:Pt,Single:St,Before:Bt,After:Et,Symbol:Lt,Break:kt}=ut;let Rt,Ct,Tt,At,Ot,It,Mt,Wt,Dt,Ht,Ft,jt,Gt,Yt,Nt,Ut,Xt,qt=[];function zt(e,t){Dt&&!Wt&&(Wt=Dt),Rt.data.push({char:e,width:t}),Tt+=t}function Vt(){At+=Tt,Rt.width=Tt,Ct.words.push(Rt),Rt={data:[]},Tt=0}function Qt(){Yt&&(Nt.paraNumber++,Ct.paraStart=!0,Yt=!1),Dt&&(Ct.startCharSize=Wt,Ct.endCharSize=Dt,Wt=0),Ct.width=At,Ut.width?bt(Ct):Xt&&Zt(),qt.push(Ct),Ct={words:[]},At=0}function Zt(){At>(Nt.maxWidth||0)&&(Nt.maxWidth=At)}const{top:$t,right:Kt,bottom:Jt,left:ea}=t.Direction4;function ta(e,t,a){const{bounds:n,rows:r}=e;n[t]+=a;for(let e=0;e<r.length;e++)r[e][t]+=a}const aa={getDrawData:function(e,n){t.isString(e)||(e=String(e));let r=0,i=0,s=n.__getInput("width")||0,o=n.__getInput("height")||0;const{__padding:l}=n;n.motionText&&(s=o=0),l&&(s?(r=l[ea],s-=l[Kt]+l[ea],!s&&(s=.01)):n.autoSizeAlign||(r=l[ea]),o?(i=l[$t],o-=l[$t]+l[Jt],!o&&(o=.01)):n.autoSizeAlign||(i=l[$t]));const d={bounds:{x:r,y:i,width:s,height:o},rows:[],paraNumber:0,font:t.Platform.canvas.font=n.__font};return function(e,a,n){Nt=e,qt=e.rows,Ut=e.bounds,Xt=!Ut.width&&!n.autoSizeAlign;const{__letterSpacing:r,paraIndent:i,textCase:s}=n,{canvas:o}=t.Platform,{width:l}=Ut;if(n.__isCharMode){const e="none"!==n.textWrap,t="break"===n.textWrap;Yt=!0,Ft=null,Wt=Mt=Dt=Tt=At=0,Rt={data:[]},Ct={words:[]};for(let n=0,d=(a=[...a]).length;n<d;n++)It=a[n],"\n"===It?(Tt&&Vt(),Ct.paraEnd=!0,Qt(),Yt=!0):(Ht=wt(It),Ht===Pt&&"none"!==s&&(It=xt(It,s,!Tt)),Mt=o.measureText(It).width,r&&(r<0&&(Dt=Mt),Mt+=r),jt=Ht===St&&(Ft===St||Ft===Pt)||Ft===St&&Ht!==Et,Gt=!(Ht!==Bt&&Ht!==St||Ft!==Lt&&Ft!==Et),Ot=Yt&&i?l-i:l,e&&l&&At+Tt+Mt>Ot&&(t?(Tt&&Vt(),At&&Qt()):(Gt||(Gt=Ht===Pt&&Ft==Et),jt||Gt||Ht===kt||Ht===Bt||Ht===St||Tt+Mt>Ot?(Tt&&Vt(),At&&Qt()):At&&Qt()))," "===It&&!0!==Yt&&At+Tt===0||(Ht===kt?(" "===It&&Tt&&Vt(),zt(It,Mt),Vt()):jt||Gt?(Tt&&Vt(),zt(It,Mt)):zt(It,Mt)),Ft=Ht);Tt&&Vt(),At&&Qt(),qt.length>0&&(qt[qt.length-1].paraEnd=!0)}else a.split("\n").forEach(e=>{Nt.paraNumber++,At=o.measureText(e).width,qt.push({x:i||0,text:e,width:At,paraStart:!0}),Xt&&Zt()})}(d,e,n),l&&function(e,t,a,n,r){if(!n&&a.autoSizeAlign)switch(a.textAlign){case"left":ta(t,"x",e[ea]);break;case"right":ta(t,"x",-e[Kt])}if(!r&&a.autoSizeAlign)switch(a.verticalAlign){case"top":ta(t,"y",e[$t]);break;case"bottom":ta(t,"y",-e[Jt])}}(l,d,n,s,o),function(e,t){const{rows:a,bounds:n}=e,r=a.length,{__lineHeight:i,__baseLine:s,__letterSpacing:o,__clipText:l,textAlign:d,verticalAlign:c,paraSpacing:h,autoSizeAlign:u}=t;let{x:f,y:p,width:g,height:_}=n,m=i*r+(h?h*(e.paraNumber-1):0),y=s;if(l&&m>_)m=Math.max(t.__autoHeight?m:_,i),r>1&&(e.overflow=r);else if(_||u)switch(c){case"middle":p+=(_-m)/2;break;case"bottom":p+=_-m}y+=p;let w,v,x,b=g||u?g:e.maxWidth;for(let s=0,c=r;s<c;s++){if(w=a[s],w.x=f,w.width<g||w.width>g&&!l)switch(d){case"center":w.x+=(b-w.width)/2;break;case"right":w.x+=b-w.width}w.paraStart&&h&&s>0&&(y+=h),w.y=y,y+=i,e.overflow>s&&y>m&&(w.isOverflow=!0,e.overflow=s+1),v=w.x,x=w.width,o<0&&(w.width<0?(x=-w.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&&(w.isOverflow=!0,e.overflow||(e.overflow=a.length))}n.y=p,n.height=m}(d,n),n.__isCharMode&&function(e,t,a){const{rows:n}=e,{textAlign:r,paraIndent:i}=t,s=t.__letterSpacing||t.motionText,o=a&&r.includes("both"),l=o||a&&r.includes("justify"),d=l&&r.includes("letter");let c,h,u,f,p,g,_,m,y,w;n.forEach(e=>{e.words&&(p=i&&e.paraStart?i:0,m=e.words.length,l&&(w=!e.paraEnd||o,h=a-e.width-p,d?f=h/(e.words.reduce((e,t)=>e+t.data.length,0)-1):u=m>1?h/(m-1):0),g=s||e.isOverflow||d?0:u?1:2,e.isOverflow&&!s&&(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,a)=>{1===g?(_={char:"",x:c},c=function(e,t,a){return e.forEach(e=>{a.char+=e.char,t+=e.width}),t}(t.data,c,_),(e.isOverflow||" "!==_.char)&&e.data.push(_)):c=function(e,t,a,n,r){return e.forEach(e=>{(n||" "!==e.char)&&(e.x=t,a.push(e)),t+=e.width,r&&(t+=r)}),t}(t.data,c,e.data,e.isOverflow,w&&f),w&&(y=a===m-1,u?y||(c+=u,e.width+=u):f&&(e.width+=f*(t.data.length-(y?1:0))))})),e.words=null)})}(d,n,s),d.overflow&&function(e,a,n,r){const{rows:i,overflow:s}=e;let{textOverflow:o}=a;if(s&&i.splice(s),r&&o&&"show"!==o){let e,l;"hide"===o?o="":"ellipsis"===o&&(o="...");const d=o?t.Platform.canvas.measureText(o).width:0,c=n+r-d;("none"===a.textWrap?i:[i[s-1]]).forEach(t=>{if(t.isOverflow&&t.data){let a=t.data.length-1;for(let n=a;n>-1&&(e=t.data[n],l=e.x+e.width,!(n===a&&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,r,s),"none"!==n.textDecoration&&function(e,n){let r,i=0;const{fontSize:s,textDecoration:o}=n;switch(e.decorationHeight=s/11,t.isObject(o)?(r=o.type,o.color&&(e.decorationColor=a.ColorConvert.string(o.color)),o.offset&&(i=Math.min(.3*s,Math.max(o.offset,.15*-s)))):r=o,r){case"under":e.decorationY=[.15*s+i];break;case"delete":e.decorationY=[.35*-s];break;case"under-delete":e.decorationY=[.15*s+i,.35*-s]}}(d,n),d}};const na={string:function(e,n){if(!e)return"#000";const r=t.isNumber(n)&&n<1;if(t.isString(e)){if(!r||!a.ColorConvert.object)return e;e=a.ColorConvert.object(e)}let i=t.isUndefined(e.a)?1:e.a;r&&(i*=n);const s=e.r+","+e.g+","+e.b;return 1===i?"rgb("+s+")":"rgba("+s+","+i+")"}};Object.assign(a.TextConvert,aa),Object.assign(a.ColorConvert,na),Object.assign(a.Paint,F),Object.assign(a.PaintImage,ye),Object.assign(a.PaintGradient,De),Object.assign(a.Effect,$e),i(),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=v,exports.LayouterHelper=f,exports.LeaferCanvas=r,exports.Renderer=b,exports.Watcher=o,exports.useCanvas=i,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(a).forEach(function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return a[e]}})});
|
|
2
2
|
//# sourceMappingURL=worker.min.cjs.map
|