leafer-ui 1.6.1 → 1.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/web.cjs +43 -36
- package/dist/web.esm.js +43 -36
- package/dist/web.esm.min.js +1 -1
- package/dist/web.esm.min.js.map +1 -1
- package/dist/web.js +90 -54
- package/dist/web.min.cjs +1 -1
- package/dist/web.min.cjs.map +1 -1
- package/dist/web.min.js +1 -1
- package/dist/web.min.js.map +1 -1
- package/dist/web.module.js +86 -54
- package/dist/web.module.min.js +1 -1
- package/dist/web.module.min.js.map +1 -1
- package/package.json +11 -11
- package/dist/web.cjs.map +0 -1
- package/dist/web.esm.js.map +0 -1
- package/dist/web.js.map +0 -1
- package/dist/web.module.js.map +0 -1
package/dist/web.js
CHANGED
|
@@ -2592,7 +2592,11 @@ var LeaferUI = (function (exports) {
|
|
|
2592
2592
|
const point = {};
|
|
2593
2593
|
getPointAndSet(t, fromX, fromY, x1, y1, x2, y2, toX, toY, point);
|
|
2594
2594
|
return point;
|
|
2595
|
-
}
|
|
2595
|
+
},
|
|
2596
|
+
getDerivative(t, fromV, v1, v2, toV) {
|
|
2597
|
+
const o = 1 - t;
|
|
2598
|
+
return 3 * o * o * (v1 - fromV) + 6 * o * t * (v2 - v1) + 3 * t * t * (toV - v2);
|
|
2599
|
+
},
|
|
2596
2600
|
};
|
|
2597
2601
|
const { getPointAndSet, toTwoPointBounds: toTwoPointBounds$1, ellipse: ellipse$6 } = BezierHelper;
|
|
2598
2602
|
|
|
@@ -3773,8 +3777,11 @@ var LeaferUI = (function (exports) {
|
|
|
3773
3777
|
load(onSuccess, onError) {
|
|
3774
3778
|
if (!this.loading) {
|
|
3775
3779
|
this.loading = true;
|
|
3780
|
+
let { loadImage, loadImageWithProgress } = Platform.origin, onProgress = this.config.showProgress && loadImageWithProgress && this.onProgress.bind(this);
|
|
3781
|
+
if (onProgress)
|
|
3782
|
+
loadImage = loadImageWithProgress;
|
|
3776
3783
|
Resource.tasker.add(() => __awaiter(this, void 0, void 0, function* () {
|
|
3777
|
-
return yield
|
|
3784
|
+
return yield loadImage(this.url, onProgress).then(img => this.setView(img)).catch((e) => {
|
|
3778
3785
|
this.error = e;
|
|
3779
3786
|
this.onComplete(false);
|
|
3780
3787
|
});
|
|
@@ -3799,6 +3806,9 @@ var LeaferUI = (function (exports) {
|
|
|
3799
3806
|
this.view = img;
|
|
3800
3807
|
this.onComplete(true);
|
|
3801
3808
|
}
|
|
3809
|
+
onProgress(progress) {
|
|
3810
|
+
this.progress = progress;
|
|
3811
|
+
}
|
|
3802
3812
|
onComplete(isSuccess) {
|
|
3803
3813
|
let odd;
|
|
3804
3814
|
this.waitComplete.forEach((item, index) => {
|
|
@@ -4264,13 +4274,20 @@ var LeaferUI = (function (exports) {
|
|
|
4264
4274
|
if (leaf.isBranch) {
|
|
4265
4275
|
const { children } = leaf;
|
|
4266
4276
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
4267
|
-
updateAllWorldOpacity
|
|
4277
|
+
updateAllWorldOpacity(children[i]);
|
|
4268
4278
|
}
|
|
4269
4279
|
}
|
|
4270
4280
|
},
|
|
4271
|
-
|
|
4272
|
-
|
|
4281
|
+
updateChange(leaf) {
|
|
4282
|
+
const layout = leaf.__layout;
|
|
4283
|
+
if (layout.stateStyleChanged)
|
|
4284
|
+
leaf.updateState();
|
|
4285
|
+
if (layout.opacityChanged)
|
|
4286
|
+
updateAllWorldOpacity(leaf);
|
|
4273
4287
|
leaf.__updateChange();
|
|
4288
|
+
},
|
|
4289
|
+
updateAllChange(leaf) {
|
|
4290
|
+
updateChange$1(leaf);
|
|
4274
4291
|
if (leaf.isBranch) {
|
|
4275
4292
|
const { children } = leaf;
|
|
4276
4293
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
@@ -4406,7 +4423,7 @@ var LeaferUI = (function (exports) {
|
|
|
4406
4423
|
}
|
|
4407
4424
|
};
|
|
4408
4425
|
const L = LeafHelper;
|
|
4409
|
-
const { updateAllMatrix: updateAllMatrix$3, updateMatrix: updateMatrix$2, updateAllWorldOpacity:
|
|
4426
|
+
const { updateAllMatrix: updateAllMatrix$3, updateMatrix: updateMatrix$2, updateAllWorldOpacity, updateAllChange: updateAllChange$1, updateChange: updateChange$1 } = L;
|
|
4410
4427
|
function getTempLocal(t, world) {
|
|
4411
4428
|
t.__layout.update();
|
|
4412
4429
|
return t.parent ? PointHelper.tempToInnerOf(world, t.parent.__world) : world;
|
|
@@ -6128,7 +6145,7 @@ var LeaferUI = (function (exports) {
|
|
|
6128
6145
|
}
|
|
6129
6146
|
}
|
|
6130
6147
|
|
|
6131
|
-
const version = "1.6.
|
|
6148
|
+
const version = "1.6.2";
|
|
6132
6149
|
|
|
6133
6150
|
const debug$5 = Debug.get('LeaferCanvas');
|
|
6134
6151
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
@@ -6494,7 +6511,7 @@ var LeaferUI = (function (exports) {
|
|
|
6494
6511
|
}
|
|
6495
6512
|
}
|
|
6496
6513
|
|
|
6497
|
-
const { updateAllMatrix: updateAllMatrix$1, updateBounds: updateOneBounds,
|
|
6514
|
+
const { updateAllMatrix: updateAllMatrix$1, updateBounds: updateOneBounds, updateChange: updateOneChange } = LeafHelper;
|
|
6498
6515
|
const { pushAllChildBranch, pushAllParent } = BranchHelper;
|
|
6499
6516
|
function updateMatrix(updateList, levelList) {
|
|
6500
6517
|
let layout;
|
|
@@ -6537,15 +6554,7 @@ var LeaferUI = (function (exports) {
|
|
|
6537
6554
|
});
|
|
6538
6555
|
}
|
|
6539
6556
|
function updateChange(updateList) {
|
|
6540
|
-
|
|
6541
|
-
updateList.list.forEach(leaf => {
|
|
6542
|
-
layout = leaf.__layout;
|
|
6543
|
-
if (layout.opacityChanged)
|
|
6544
|
-
updateAllWorldOpacity(leaf);
|
|
6545
|
-
if (layout.stateStyleChanged)
|
|
6546
|
-
setTimeout(() => layout.stateStyleChanged && leaf.updateState());
|
|
6547
|
-
leaf.__updateChange();
|
|
6548
|
-
});
|
|
6557
|
+
updateList.list.forEach(updateOneChange);
|
|
6549
6558
|
}
|
|
6550
6559
|
|
|
6551
6560
|
const { worldBounds } = LeafBoundsHelper;
|
|
@@ -7390,13 +7399,11 @@ var LeaferUI = (function (exports) {
|
|
|
7390
7399
|
setFontWeight(value) {
|
|
7391
7400
|
if (typeof value === 'string') {
|
|
7392
7401
|
this.__setInput('fontWeight', value);
|
|
7393
|
-
|
|
7394
|
-
}
|
|
7395
|
-
else {
|
|
7396
|
-
if (this.__input)
|
|
7397
|
-
this.__removeInput('fontWeight');
|
|
7398
|
-
this._fontWeight = value;
|
|
7402
|
+
value = fontWeightMap[value] || 400;
|
|
7399
7403
|
}
|
|
7404
|
+
else if (this.__input)
|
|
7405
|
+
this.__removeInput('fontWeight');
|
|
7406
|
+
this._fontWeight = value;
|
|
7400
7407
|
}
|
|
7401
7408
|
setBoxStyle(value) {
|
|
7402
7409
|
let t = this.__leaf, box = t.__box;
|
|
@@ -7723,6 +7730,9 @@ var LeaferUI = (function (exports) {
|
|
|
7723
7730
|
else
|
|
7724
7731
|
drawer.rect(x, y, width, height);
|
|
7725
7732
|
}
|
|
7733
|
+
drawImagePlaceholder(canvas, _image) {
|
|
7734
|
+
Paint.fill(this.__.placeholderColor, this, canvas);
|
|
7735
|
+
}
|
|
7726
7736
|
animate(_keyframe, _options, _type, _isTemp) {
|
|
7727
7737
|
return Plugin.need('animate');
|
|
7728
7738
|
}
|
|
@@ -7959,6 +7969,9 @@ var LeaferUI = (function (exports) {
|
|
|
7959
7969
|
__decorate([
|
|
7960
7970
|
effectType()
|
|
7961
7971
|
], exports.UI.prototype, "filter", void 0);
|
|
7972
|
+
__decorate([
|
|
7973
|
+
surfaceType()
|
|
7974
|
+
], exports.UI.prototype, "placeholderColor", void 0);
|
|
7962
7975
|
__decorate([
|
|
7963
7976
|
dataType({})
|
|
7964
7977
|
], exports.UI.prototype, "data", void 0);
|
|
@@ -8789,10 +8802,11 @@ var LeaferUI = (function (exports) {
|
|
|
8789
8802
|
get ready() { return this.image ? this.image.ready : false; }
|
|
8790
8803
|
constructor(data) {
|
|
8791
8804
|
super(data);
|
|
8792
|
-
this.
|
|
8793
|
-
|
|
8794
|
-
|
|
8795
|
-
|
|
8805
|
+
this.on_(ImageEvent.LOADED, this.__onLoaded, this);
|
|
8806
|
+
}
|
|
8807
|
+
__onLoaded(e) {
|
|
8808
|
+
if (e.attrName === 'fill' && e.attrValue.url === this.url)
|
|
8809
|
+
this.image = e.image;
|
|
8796
8810
|
}
|
|
8797
8811
|
destroy() {
|
|
8798
8812
|
this.image = null;
|
|
@@ -8906,7 +8920,7 @@ var LeaferUI = (function (exports) {
|
|
|
8906
8920
|
data.__baseLine = data.__lineHeight - (data.__lineHeight - fontSize * 0.7) / 2;
|
|
8907
8921
|
data.__font = `${italic ? 'italic ' : ''}${textCase === 'small-caps' ? 'small-caps ' : ''}${fontWeight !== 'normal' ? fontWeight + ' ' : ''}${fontSize}px ${fontFamily}`;
|
|
8908
8922
|
data.__clipText = textOverflow !== 'show' && !data.__autoSize;
|
|
8909
|
-
data.__textDrawData = TextConvert.getDrawData(data.text, this.__);
|
|
8923
|
+
data.__textDrawData = TextConvert.getDrawData((data.__isPlacehold = data.placeholder && data.text === '') ? data.placeholder : data.text, this.__);
|
|
8910
8924
|
}
|
|
8911
8925
|
__updateBoxBounds() {
|
|
8912
8926
|
const data = this.__;
|
|
@@ -9004,6 +9018,9 @@ var LeaferUI = (function (exports) {
|
|
|
9004
9018
|
__decorate([
|
|
9005
9019
|
boundsType('')
|
|
9006
9020
|
], exports.Text.prototype, "text", void 0);
|
|
9021
|
+
__decorate([
|
|
9022
|
+
boundsType('')
|
|
9023
|
+
], exports.Text.prototype, "placeholder", void 0);
|
|
9007
9024
|
__decorate([
|
|
9008
9025
|
boundsType('caption')
|
|
9009
9026
|
], exports.Text.prototype, "fontFamily", void 0);
|
|
@@ -10738,8 +10755,10 @@ var LeaferUI = (function (exports) {
|
|
|
10738
10755
|
}
|
|
10739
10756
|
|
|
10740
10757
|
function fillText(ui, canvas) {
|
|
10741
|
-
|
|
10742
|
-
|
|
10758
|
+
const data = ui.__, { rows, decorationY } = data.__textDrawData;
|
|
10759
|
+
if (data.__isPlacehold && data.placeholderColor)
|
|
10760
|
+
canvas.fillStyle = data.placeholderColor;
|
|
10761
|
+
let row;
|
|
10743
10762
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
10744
10763
|
row = rows[i];
|
|
10745
10764
|
if (row.text)
|
|
@@ -10748,7 +10767,7 @@ var LeaferUI = (function (exports) {
|
|
|
10748
10767
|
row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y); });
|
|
10749
10768
|
}
|
|
10750
10769
|
if (decorationY) {
|
|
10751
|
-
const { decorationColor, decorationHeight } = data;
|
|
10770
|
+
const { decorationColor, decorationHeight } = data.__textDrawData;
|
|
10752
10771
|
if (decorationColor)
|
|
10753
10772
|
canvas.fillStyle = decorationColor;
|
|
10754
10773
|
rows.forEach(row => decorationY.forEach(value => canvas.fillRect(row.x, row.y + value, row.width, decorationHeight)));
|
|
@@ -10757,38 +10776,44 @@ var LeaferUI = (function (exports) {
|
|
|
10757
10776
|
|
|
10758
10777
|
function fill(fill, ui, canvas) {
|
|
10759
10778
|
canvas.fillStyle = fill;
|
|
10760
|
-
|
|
10779
|
+
fillPathOrText(ui, canvas);
|
|
10761
10780
|
}
|
|
10762
10781
|
function fills(fills, ui, canvas) {
|
|
10763
10782
|
let item;
|
|
10764
|
-
const { windingRule, __font } = ui.__;
|
|
10765
10783
|
for (let i = 0, len = fills.length; i < len; i++) {
|
|
10766
10784
|
item = fills[i];
|
|
10767
|
-
if (item.image
|
|
10768
|
-
|
|
10769
|
-
|
|
10770
|
-
|
|
10771
|
-
|
|
10772
|
-
|
|
10773
|
-
|
|
10774
|
-
if (item.blendMode)
|
|
10775
|
-
canvas.blendMode = item.blendMode;
|
|
10776
|
-
__font ? fillText(ui, canvas) : (windingRule ? canvas.fill(windingRule) : canvas.fill());
|
|
10777
|
-
canvas.restore();
|
|
10785
|
+
if (item.image) {
|
|
10786
|
+
if (PaintImage.checkImage(ui, canvas, item, !ui.__.__font))
|
|
10787
|
+
continue;
|
|
10788
|
+
if (!item.style) {
|
|
10789
|
+
if (!i && item.image.isPlacehold)
|
|
10790
|
+
ui.drawImagePlaceholder(canvas, item.image);
|
|
10791
|
+
continue;
|
|
10778
10792
|
}
|
|
10779
|
-
|
|
10780
|
-
|
|
10781
|
-
|
|
10782
|
-
|
|
10783
|
-
|
|
10784
|
-
|
|
10785
|
-
|
|
10786
|
-
|
|
10787
|
-
|
|
10793
|
+
}
|
|
10794
|
+
canvas.fillStyle = item.style;
|
|
10795
|
+
if (item.transform) {
|
|
10796
|
+
canvas.save();
|
|
10797
|
+
canvas.transform(item.transform);
|
|
10798
|
+
if (item.blendMode)
|
|
10799
|
+
canvas.blendMode = item.blendMode;
|
|
10800
|
+
fillPathOrText(ui, canvas);
|
|
10801
|
+
canvas.restore();
|
|
10802
|
+
}
|
|
10803
|
+
else {
|
|
10804
|
+
if (item.blendMode) {
|
|
10805
|
+
canvas.saveBlendMode(item.blendMode);
|
|
10806
|
+
fillPathOrText(ui, canvas);
|
|
10807
|
+
canvas.restoreBlendMode();
|
|
10788
10808
|
}
|
|
10809
|
+
else
|
|
10810
|
+
fillPathOrText(ui, canvas);
|
|
10789
10811
|
}
|
|
10790
10812
|
}
|
|
10791
10813
|
}
|
|
10814
|
+
function fillPathOrText(ui, canvas) {
|
|
10815
|
+
ui.__.__font ? fillText(ui, canvas) : (ui.__.windingRule ? canvas.fill(ui.__.windingRule) : canvas.fill());
|
|
10816
|
+
}
|
|
10792
10817
|
|
|
10793
10818
|
function strokeText(stroke, ui, canvas) {
|
|
10794
10819
|
const { strokeAlign } = ui.__;
|
|
@@ -11028,6 +11053,7 @@ var LeaferUI = (function (exports) {
|
|
|
11028
11053
|
compute,
|
|
11029
11054
|
fill,
|
|
11030
11055
|
fills,
|
|
11056
|
+
fillPathOrText,
|
|
11031
11057
|
fillText,
|
|
11032
11058
|
stroke,
|
|
11033
11059
|
strokes,
|
|
@@ -11220,6 +11246,13 @@ var LeaferUI = (function (exports) {
|
|
|
11220
11246
|
onLoadError(ui, event, error);
|
|
11221
11247
|
leafPaint.loadId = null;
|
|
11222
11248
|
});
|
|
11249
|
+
if (ui.placeholderColor)
|
|
11250
|
+
setTimeout(() => {
|
|
11251
|
+
if (!(image.ready || image.isPlacehold)) {
|
|
11252
|
+
image.isPlacehold = true;
|
|
11253
|
+
ui.forceUpdate('surface');
|
|
11254
|
+
}
|
|
11255
|
+
}, 100);
|
|
11223
11256
|
}
|
|
11224
11257
|
return leafPaint;
|
|
11225
11258
|
}
|
|
@@ -12431,4 +12464,7 @@ var LeaferUI = (function (exports) {
|
|
|
12431
12464
|
return exports;
|
|
12432
12465
|
|
|
12433
12466
|
})({});
|
|
12434
|
-
|
|
12467
|
+
|
|
12468
|
+
function Leafer(opt) { return new LeaferUI.Leafer(opt); }
|
|
12469
|
+
Object.setPrototypeOf(Leafer, LeaferUI);
|
|
12470
|
+
Leafer.prototype = LeaferUI.Leafer.prototype;
|
package/dist/web.min.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var t=require("@leafer/core"),e=require("@leafer-ui/core"),i=require("@leafer-ui/draw");const n=t.Debug.get("LeaferCanvas");class s extends t.LeaferCanvasBase{set zIndex(t){const{style:e}=this.view;e.zIndex=t,this.setAbsolute(this.view)}set childIndex(t){const{view:e,parentView:i}=this;if(e&&i){const n=i.children[t];n?(this.setAbsolute(n),i.insertBefore(e,n)):i.appendChild(n)}}init(){const{config:e}=this,i=e.view||e.canvas;i?this.__createViewFrom(i):this.__createView();const{style:n}=this.view;if(n.display||(n.display="block"),this.parentView=this.view.parentElement,this.parentView){const t=this.parentView.style;t.webkitUserSelect=t.userSelect="none"}t.Platform.syncDomFont&&!this.parentView&&(n.display="none",document.body.appendChild(this.view)),this.__createContext(),this.autoLayout||this.resize(e)}set backgroundColor(t){this.view.style.backgroundColor=t}get backgroundColor(){return this.view.style.backgroundColor}set hittable(t){this.view.style.pointerEvents=t?"auto":"none"}get hittable(){return"none"!==this.view.style.pointerEvents}__createView(){this.view=document.createElement("canvas")}__createViewFrom(t){let e="string"==typeof t?document.getElementById(t):t;if(e)if(e instanceof HTMLCanvasElement)this.view=e;else{let t=e;if(e===window||e===document){const e=document.createElement("div"),{style:i}=e;i.position="absolute",i.top=i.bottom=i.left=i.right="0px",document.body.appendChild(e),t=e}this.__createView();const i=this.view;t.hasChildNodes()&&(this.setAbsolute(i),t.style.position||(t.style.position="relative")),t.appendChild(i)}else n.error(`no id: ${t}`),this.__createView()}setAbsolute(t){const{style:e}=t;e.position="absolute",e.top=e.left="0px"}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this,{style:n}=this.view;n.width=t+"px",n.height=e+"px",this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i)}updateClientBounds(){this.view.parentElement&&(this.clientBounds=this.view.getBoundingClientRect())}startAutoLayout(e,i){if(this.resizeListener=i,e){this.autoBounds=e;try{this.resizeObserver=new ResizeObserver((t=>{this.updateClientBounds();for(const e of t)this.checkAutoBounds(e.contentRect)}));const t=this.parentView;t?(this.resizeObserver.observe(t),this.checkAutoBounds(t.getBoundingClientRect())):(this.checkAutoBounds(this.view),n.warn("no parent"))}catch(t){this.imitateResizeObserver()}}else window.addEventListener("resize",this.windowListener=()=>{const e=t.Platform.devicePixelRatio;if(!this.config.pixelRatio&&this.pixelRatio!==e){const{width:t,height:i}=this;this.emitResize({width:t,height:i,pixelRatio:e})}})}imitateResizeObserver(){this.autoLayout&&(this.parentView&&this.checkAutoBounds(this.parentView.getBoundingClientRect()),t.Platform.requestRender(this.imitateResizeObserver.bind(this)))}checkAutoBounds(e){const i=this.view,{x:n,y:s,width:o,height:r}=this.autoBounds.getBoundsFrom(e),a={width:o,height:r,pixelRatio:this.config.pixelRatio?this.pixelRatio:t.Platform.devicePixelRatio};if(!this.isSameSize(a)){const{style:t}=i;t.marginLeft=n+"px",t.marginTop=s+"px",this.emitResize(a)}}stopAutoLayout(){this.autoLayout=!1,this.resizeObserver&&this.resizeObserver.disconnect(),this.resizeListener=this.resizeObserver=null}emitResize(e){const i={};t.DataHelper.copyAttrs(i,this,t.canvasSizeAttrs),this.resize(e),this.resizeListener&&void 0!==this.width&&this.resizeListener(new t.ResizeEvent(e,i))}unrealCanvas(){if(!this.unreal&&this.parentView){const t=this.view;t&&t.remove(),this.view=this.parentView,this.unreal=!0}}destroy(){if(this.view){if(this.stopAutoLayout(),this.windowListener&&(window.removeEventListener("resize",this.windowListener),this.windowListener=null),!this.unreal){const t=this.view;t.parentElement&&t.remove()}super.destroy()}}}t.canvasPatch(CanvasRenderingContext2D.prototype),t.canvasPatch(Path2D.prototype);const{mineType:o,fileType:r}=t.FileHelper;function a(e,i){t.Platform.origin={createCanvas(t,e){const i=document.createElement("canvas");return i.width=t,i.height=e,i},canvasToDataURL:(t,e,i)=>{const n=o(e),s=t.toDataURL(n,i);return"image/bmp"===n?s.replace("image/png;","image/bmp;"):s},canvasToBolb:(t,e,i)=>new Promise((n=>t.toBlob(n,o(e),i))),canvasSaveAs:(e,i,n)=>{const s=e.toDataURL(o(r(i)),n);return t.Platform.origin.download(s,i)},download:(t,e)=>new Promise((i=>{let n=document.createElement("a");n.href=t,n.download=e,document.body.appendChild(n),n.click(),document.body.removeChild(n),i()})),loadImage:e=>new Promise(((i,n)=>{const s=new t.Platform.origin.Image,{crossOrigin:o}=t.Platform.image;o&&(s.setAttribute("crossOrigin",o),s.crossOrigin=o),s.onload=()=>{i(s)},s.onerror=t=>{n(t)},s.src=t.Platform.image.getRealURL(e)})),Image:Image,PointerEvent:PointerEvent,DragEvent:DragEvent},t.Platform.event={stopDefault(t){t.preventDefault()},stopNow(t){t.stopImmediatePropagation()},stop(t){t.stopPropagation()}},t.Platform.canvas=t.Creator.canvas(),t.Platform.conicGradientSupport=!!t.Platform.canvas.context.createConicGradient}Object.assign(t.Creator,{canvas:(t,e)=>new s(t,e),image:e=>new t.LeaferImage(e)}),t.Platform.name="web",t.Platform.isMobile="ontouchstart"in window,t.Platform.requestRender=function(t){window.requestAnimationFrame(t)},t.defineKey(t.Platform,"devicePixelRatio",{get:()=>devicePixelRatio});const{userAgent:h}=navigator;h.indexOf("Firefox")>-1?(t.Platform.conicGradientRotate90=!0,t.Platform.intWheelDeltaY=!0,t.Platform.syncDomFont=!0):h.indexOf("AppleWebKit")>-1&&(t.Platform.fullImageShadow=!0),h.indexOf("Windows")>-1?(t.Platform.os="Windows",t.Platform.intWheelDeltaY=!0):h.indexOf("Mac")>-1?t.Platform.os="Mac":h.indexOf("Linux")>-1&&(t.Platform.os="Linux");class l{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const e=new t.LeafList;return this.__updatedList.list.forEach((t=>{t.leafer&&e.add(t)})),e}return this.__updatedList}constructor(e,i){this.totalTimes=0,this.config={},this.__updatedList=new t.LeafList,this.target=e,i&&(this.config=t.DataHelper.default(i,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(t.RenderEvent.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(e){e.type===t.ChildEvent.ADD?(this.hasAdd=!0,this.__pushChild(e.child)):(this.hasRemove=!0,this.__updatedList.add(e.parent)),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new t.WatchEvent(t.WatchEvent.DATA,{updatedList:this.updatedList})),this.__updatedList=new t.LeafList,this.totalTimes++,this.changed=!1,this.hasVisible=!1,this.hasRemove=!1,this.hasAdd=!1}__listenEvents(){const{target:e}=this;this.__eventIds=[e.on_(t.PropertyEvent.CHANGE,this.__onAttrChange,this),e.on_([t.ChildEvent.ADD,t.ChildEvent.REMOVE],this.__onChildEvent,this),e.on_(t.WatchEvent.REQUEST,this.__onRquestData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.__updatedList=null)}}const{updateAllMatrix:c,updateBounds:d,updateAllWorldOpacity:u}=t.LeafHelper,{pushAllChildBranch:p,pushAllParent:f}=t.BranchHelper;const{worldBounds:g}=t.LeafBoundsHelper;class _{constructor(e){this.updatedBounds=new t.Bounds,this.beforeBounds=new t.Bounds,this.afterBounds=new t.Bounds,e instanceof Array&&(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(t){this.updatedList.addList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllMatrix:w,updateAllChange:v}=t.LeafHelper,m=t.Debug.get("Layouter");class y{constructor(e,i){this.totalTimes=0,this.config={},this.__levelList=new t.LeafLevelList,this.target=e,i&&(this.config=t.DataHelper.default(i,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(!this.running)return;const{target:e}=this;this.times=0;try{e.emit(t.LayoutEvent.START),this.layoutOnce(),e.emitEvent(new t.LayoutEvent(t.LayoutEvent.END,this.layoutedBlocks,this.times))}catch(t){m.error(t)}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.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var e;if(!(null===(e=this.__updatedList)||void 0===e?void 0:e.length))return;const i=t.Run.start("PartLayout"),{target:n,__updatedList:s}=this,{BEFORE:o,LAYOUT:r,AFTER:a}=t.LayoutEvent,h=this.getBlocks(s);h.forEach((t=>t.setBefore())),n.emitEvent(new t.LayoutEvent(o,h,this.times)),this.extraBlock=null,s.sort(),function(t,e){let i;t.list.forEach((t=>{i=t.__layout,e.without(t)&&!i.proxyZoom&&(i.matrixChanged?(c(t,!0),e.add(t),t.isBranch&&p(t,e),f(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),f(t,e)))}))}(s,this.__levelList),function(t){let e,i,n;t.sort(!0),t.levels.forEach((s=>{e=t.levelMap[s];for(let t=0,s=e.length;t<s;t++){if(i=e[t],i.isBranch&&i.__tempNumber){n=i.children;for(let t=0,e=n.length;t<e;t++)n[t].isBranch||d(n[t])}d(i)}}))}(this.__levelList),function(t){let e;t.list.forEach((t=>{e=t.__layout,e.opacityChanged&&u(t),e.stateStyleChanged&&setTimeout((()=>e.stateStyleChanged&&t.updateState())),t.__updateChange()}))}(s),this.extraBlock&&h.push(this.extraBlock),h.forEach((t=>t.setAfter())),n.emitEvent(new t.LayoutEvent(r,h,this.times)),n.emitEvent(new t.LayoutEvent(a,h,this.times)),this.addBlocks(h),this.__levelList.reset(),this.__updatedList=null,t.Run.end(i)}fullLayout(){const e=t.Run.start("FullLayout"),{target:i}=this,{BEFORE:n,LAYOUT:s,AFTER:o}=t.LayoutEvent,r=this.getBlocks(new t.LeafList(i));i.emitEvent(new t.LayoutEvent(n,r,this.times)),y.fullLayout(i),r.forEach((t=>{t.setAfter()})),i.emitEvent(new t.LayoutEvent(s,r,this.times)),i.emitEvent(new t.LayoutEvent(o,r,this.times)),this.addBlocks(r),t.Run.end(e)}static fullLayout(e){w(e,!0),e.isBranch?t.BranchHelper.updateBounds(e):t.LeafHelper.updateBounds(e),v(e)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new _([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new _(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){const{target:e}=this;this.__eventIds=[e.on_(t.LayoutEvent.REQUEST,this.layout,this),e.on_(t.LayoutEvent.AGAIN,this.layoutAgain,this),e.on_(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 b=t.Debug.get("Renderer");class x{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(e,i,n){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:60},this.target=e,this.canvas=i,n&&(this.config=t.DataHelper.default(n,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.__requestRender()}requestLayout(){this.target.emit(t.LayoutEvent.REQUEST)}checkRender(){if(this.running){const{target:e}=this;e.isApp&&(e.emit(t.RenderEvent.CHILD_START,e),e.children.forEach((t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()})),e.emit(t.RenderEvent.CHILD_END,e)),this.changed&&this.canvas.view&&this.render(),this.target.emit(t.RenderEvent.NEXT)}}render(e){if(!this.running||!this.canvas.view)return this.update();const{target:i}=this;this.times=0,this.totalBounds=new t.Bounds,b.log(i.innerName,"---\x3e");try{this.emitRender(t.RenderEvent.START),this.renderOnce(e),this.emitRender(t.RenderEvent.END,this.totalBounds),t.ImageManager.clearRecycled()}catch(t){this.rendering=!1,b.error(t)}b.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(e){if(this.rendering)return b.warn("rendering");if(this.times>3)return b.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new t.Bounds,this.renderOptions={},e)this.emitRender(t.RenderEvent.BEFORE),e();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(t.RenderEvent.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(t.RenderEvent.RENDER,this.renderBounds,this.renderOptions),this.emitRender(t.RenderEvent.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,this.waitAgain&&(this.waitAgain=!1,this.renderOnce())}partRender(){const{canvas:t,updateBlocks:e}=this;e&&(this.mergeBlocks(),e.forEach((e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)})))}clipRender(e){const i=t.Run.start("PartRender"),{canvas:n}=this,s=e.getIntersect(n.bounds),o=new t.Bounds(s);n.save(),s.spread(x.clipSpread).ceil(),n.clearWorld(s,!0),n.clipWorld(s,!0),this.__render(s,o),n.restore(),t.Run.end(i)}fullRender(){const e=t.Run.start("FullRender"),{canvas:i}=this;i.save(),i.clear(),this.__render(i.bounds),i.restore(),t.Run.end(e)}__render(e,i){const{canvas:n}=this,s=e.includes(this.target.__world),o=s?{includes:s}:{bounds:e,includes:s};this.needFill&&n.fillWorld(e,this.config.fill),t.Debug.showRepaint&&t.Debug.drawRepaint(n,e),this.target.__render(n,o),this.renderBounds=i=i||e,this.renderOptions=o,this.totalBounds.isEmpty()?this.totalBounds=i:this.totalBounds.add(i),n.updateRender(i)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:e}=this;if(e){const i=new t.Bounds;i.setList(e),e.length=0,e.push(i)}}__requestRender(){const e=this.target;if(this.requestTime||!e)return;if(e.parentApp)return e.parentApp.requestRender(!1);const i=this.requestTime=Date.now();t.Platform.requestRender((()=>{this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-i))),this.requestTime=0,this.checkRender()}))}__onResize(e){if(!this.canvas.unreal){if(e.bigger||!e.samePixelRatio){const{width:i,height:n}=e.old;if(!new t.Bounds(0,0,i,n).includes(this.target.__world)||this.needFill||!e.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new t.Bounds(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map((t=>{let e;t.updatedList&&t.updatedList.list.some((t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||b.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e))),this.addBlock(e?this.canvas.bounds:t.updatedBounds)}))}emitRender(e,i,n){this.target.emitEvent(new t.RenderEvent(e,this.times,i,n))}__listenEvents(){const{target:e}=this;this.__eventIds=[e.on_(t.RenderEvent.REQUEST,this.update,this),e.on_(t.LayoutEvent.END,this.__onLayoutEnd,this),e.on_(t.RenderEvent.AGAIN,this.renderAgain,this),e.on_(t.ResizeEvent.RESIZE,this.__onResize,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.canvas=this.config=null)}}x.clipSpread=10;const{hitRadiusPoint:E}=t.BoundsHelper;class L{constructor(t,e){this.target=t,this.selector=e}getByPoint(e,i,n){i||(i=0),n||(n={});const s=n.through||!1,o=n.ignoreHittable||!1,r=n.target||this.target;this.exclude=n.exclude||null,this.point={x:e.x,y:e.y,radiusX:i,radiusY:i},this.findList=new t.LeafList(n.findList),n.findList||this.hitBranch(r);const{list:a}=this.findList,h=this.getBestMatchLeaf(a,n.bottomList,o),l=o?this.getPath(h):this.getHitablePath(h);return this.clear(),s?{path:l,target:h,throughPath:a.length?this.getThroughPath(a):l}:{path:l,target:h}}getBestMatchLeaf(e,i,n){if(e.length){let i;this.findList=new t.LeafList;const{x:s,y:o}=this.point,r={x:s,y:o,radiusX:0,radiusY:0};for(let s=0,o=e.length;s<o;s++)if(i=e[s],(n||t.LeafHelper.worldHittable(i))&&(this.hitChild(i,r),this.findList.length))return this.findList.list[0]}if(i)for(let t=0,e=i.length;t<e;t++)if(this.hitChild(i[t].target,this.point,i[t].proxy),this.findList.length)return this.findList.list[0];return e[0]}getPath(e){const i=new t.LeafList;for(;e;)i.add(e),e=e.parent;return this.target&&i.add(this.target),i}getHitablePath(e){const i=this.getPath(e&&e.hittable?e:null);let n,s=new t.LeafList;for(let t=i.list.length-1;t>-1&&(n=i.list[t],n.__.hittable)&&(s.addAt(n,0),n.__.hitChildren);t--);return s}getThroughPath(e){const i=new t.LeafList,n=[];for(let t=e.length-1;t>-1;t--)n.push(this.getPath(e[t]));let s,o,r;for(let t=0,e=n.length;t<e;t++){s=n[t],o=n[t+1];for(let t=0,e=s.length;t<e&&(r=s.list[t],!o||!o.has(r));t++)i.add(r)}return i}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,n;const{point:s}=this;for(let o=t.length-1;o>-1;o--)i=t[o],!i.__.visible||e&&!i.__.mask||(n=!!i.__.hitRadius||E(i.__world,s),i.isBranch?(n||i.__ignoreHitWorld)&&(this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,s)):n&&this.hitChild(i,s))}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:n}=t;if(n&&n.__hasMask&&!t.__.mask&&!n.children.some((t=>t.__.mask&&t.__hitWorld(e))))return;this.findList.add(i||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class B{constructor(e,i){this.config={},i&&(this.config=t.DataHelper.default(i,this.config)),this.picker=new L(this.target=e,this),this.finder=t.Creator.finder&&t.Creator.finder()}getByPoint(e,i,n){const{target:s,picker:o}=this;return t.Platform.backgrounder&&s&&s.updateLayout(),o.getByPoint(e,i,n)}getBy(e,i,n,s){return this.finder?this.finder.getBy(e,i,n,s):t.Plugin.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}Object.assign(t.Creator,{watcher:(t,e)=>new l(t,e),layouter:(t,e)=>new y(t,e),renderer:(t,e,i)=>new x(t,e,i),selector:(t,e)=>new B(t,e)}),t.Platform.layout=y.fullLayout;const P={convert(t,i){const n=e.InteractionHelper.getBase(t),s=Object.assign(Object.assign({},n),{x:i.x,y:i.y,width:t.width,height:t.height,pointerType:t.pointerType,pressure:t.pressure});return"pen"===s.pointerType&&(s.tangentialPressure=t.tangentialPressure,s.tiltX=t.tiltX,s.tiltY=t.tiltY,s.twist=t.twist),s},convertMouse(t,i){const n=e.InteractionHelper.getBase(t);return Object.assign(Object.assign({},n),{x:i.x,y:i.y,width:1,height:1,pointerType:"mouse",pressure:.5})},convertTouch(t,i){const n=P.getTouch(t),s=e.InteractionHelper.getBase(t);return Object.assign(Object.assign({},s),{x:i.x,y:i.y,width:1,height:1,pointerType:"touch",multiTouch:t.touches.length>1,pressure:n.force})},getTouch:t=>t.targetTouches[0]||t.changedTouches[0]},R={convert(t){const i=e.InteractionHelper.getBase(t);return Object.assign(Object.assign({},i),{code:t.code,key:t.key})}},{pathCanDrag:k}=e.InteractionHelper;class C extends e.InteractionBase{__listenEvents(){super.__listenEvents();const t=this.view=this.canvas.view;this.viewEvents={pointerdown:this.onPointerDown,mousedown:this.onMouseDown,touchstart:this.onTouchStart,pointerleave:this.onPointerLeave,contextmenu:this.onContextMenu,wheel:this.onWheel,gesturestart:this.onGesturestart,gesturechange:this.onGesturechange,gestureend:this.onGestureend},this.windowEvents={pointermove:this.onPointerMove,pointerup:this.onPointerUp,pointercancel:this.onPointerCancel,mousemove:this.onMouseMove,mouseup:this.onMouseUp,touchmove:this.onTouchMove,touchend:this.onTouchEnd,touchcancel:this.onTouchCancel,keydown:this.onKeyDown,keyup:this.onKeyUp,scroll:this.onScroll};const{viewEvents:e,windowEvents:i}=this;for(let i in e)e[i]=e[i].bind(this),t.addEventListener(i,e[i]);for(let t in i)i[t]=i[t].bind(this),window.addEventListener(t,i[t])}__removeListenEvents(){super.__removeListenEvents();const{viewEvents:t,windowEvents:e}=this;for(let e in t)this.view.removeEventListener(e,t[e]),this.viewEvents={};for(let t in e)window.removeEventListener(t,e[t]),this.windowEvents={}}getTouches(t){const e=[];for(let i=0,n=t.length;i<n;i++)e.push(t[i]);return e}preventDefaultPointer(t){const{pointer:e}=this.config;e.preventDefault&&t.preventDefault()}preventDefaultWheel(t){const{wheel:e}=this.config;e.preventDefault&&t.preventDefault()}preventWindowPointer(t){return!this.downData&&t.target!==this.view}onKeyDown(t){this.keyDown(R.convert(t))}onKeyUp(t){this.keyUp(R.convert(t))}onContextMenu(t){this.config.pointer.preventDefaultMenu&&t.preventDefault(),this.menu(P.convert(t,this.getLocal(t)))}onScroll(){this.canvas.updateClientBounds()}onPointerDown(t){this.preventDefaultPointer(t),this.config.pointer.touch||this.useMultiTouch||(this.usePointer||(this.usePointer=!0),this.pointerDown(P.convert(t,this.getLocal(t))))}onPointerMove(t,e){if(this.config.pointer.touch||this.useMultiTouch||this.preventWindowPointer(t))return;this.usePointer||(this.usePointer=!0);const i=P.convert(t,this.getLocal(t,!0));e?this.pointerHover(i):this.pointerMove(i)}onPointerLeave(t){this.onPointerMove(t,!0)}onPointerUp(t){this.downData&&this.preventDefaultPointer(t),this.config.pointer.touch||this.useMultiTouch||this.preventWindowPointer(t)||this.pointerUp(P.convert(t,this.getLocal(t)))}onPointerCancel(){this.useMultiTouch||this.pointerCancel()}onMouseDown(t){this.preventDefaultPointer(t),this.useTouch||this.usePointer||this.pointerDown(P.convertMouse(t,this.getLocal(t)))}onMouseMove(t){this.useTouch||this.usePointer||this.preventWindowPointer(t)||this.pointerMove(P.convertMouse(t,this.getLocal(t,!0)))}onMouseUp(t){this.downData&&this.preventDefaultPointer(t),this.useTouch||this.usePointer||this.preventWindowPointer(t)||this.pointerUp(P.convertMouse(t,this.getLocal(t)))}onMouseCancel(){this.useTouch||this.usePointer||this.pointerCancel()}onTouchStart(t){const e=P.getTouch(t),i=this.getLocal(e,!0),{preventDefault:n}=this.config.touch;(!0===n||"auto"===n&&k(this.findPath(i)))&&t.preventDefault(),this.multiTouchStart(t),this.usePointer||(this.touchTimer&&(window.clearTimeout(this.touchTimer),this.touchTimer=0),this.useTouch=!0,this.pointerDown(P.convertTouch(t,i)))}onTouchMove(t){if(this.multiTouchMove(t),this.usePointer||this.preventWindowPointer(t))return;const e=P.getTouch(t);this.pointerMove(P.convertTouch(t,this.getLocal(e)))}onTouchEnd(t){if(this.multiTouchEnd(),this.usePointer||this.preventWindowPointer(t))return;this.touchTimer&&clearTimeout(this.touchTimer),this.touchTimer=setTimeout((()=>{this.useTouch=!1}),500);const e=P.getTouch(t);this.pointerUp(P.convertTouch(t,this.getLocal(e)))}onTouchCancel(){this.usePointer||this.pointerCancel()}multiTouchStart(t){this.useMultiTouch=t.touches.length>1,this.touches=this.useMultiTouch?this.getTouches(t.touches):void 0,this.useMultiTouch&&this.pointerCancel()}multiTouchMove(t){if(this.useMultiTouch&&t.touches.length>1){const i=this.getTouches(t.touches),n=this.getKeepTouchList(this.touches,i);n.length>1&&(this.multiTouch(e.InteractionHelper.getBase(t),n),this.touches=i)}}multiTouchEnd(){this.touches=null,this.useMultiTouch=!1,this.transformEnd()}getKeepTouchList(t,e){let i;const n=[];return t.forEach((t=>{i=e.find((e=>e.identifier===t.identifier)),i&&n.push({from:this.getLocal(t),to:this.getLocal(i)})})),n}getLocalTouchs(t){return t.map((t=>this.getLocal(t)))}onWheel(t){this.preventDefaultWheel(t),this.wheel(Object.assign(Object.assign(Object.assign({},e.InteractionHelper.getBase(t)),this.getLocal(t)),{deltaX:t.deltaX,deltaY:t.deltaY}))}onGesturestart(t){this.useMultiTouch||(this.preventDefaultWheel(t),this.lastGestureScale=1,this.lastGestureRotation=0)}onGesturechange(i){if(this.useMultiTouch)return;this.preventDefaultWheel(i);const n=e.InteractionHelper.getBase(i);Object.assign(n,this.getLocal(i));const s=i.scale/this.lastGestureScale,o=(i.rotation-this.lastGestureRotation)/Math.PI*180*(t.MathHelper.within(this.config.wheel.rotateSpeed,0,1)/4+.1);this.zoom(Object.assign(Object.assign({},n),{scale:s*s})),this.rotate(Object.assign(Object.assign({},n),{rotation:o})),this.lastGestureScale=i.scale,this.lastGestureRotation=i.rotation}onGestureend(t){this.useMultiTouch||(this.preventDefaultWheel(t),this.transformEnd())}setCursor(t){super.setCursor(t);const e=[];this.eachCursor(t,e),"object"==typeof e[e.length-1]&&e.push("default"),this.canvas.view.style.cursor=e.map((t=>"object"==typeof t?`url(${t.url}) ${t.x||0} ${t.y||0}`:t)).join(",")}eachCursor(t,i,n=0){if(n++,t instanceof Array)t.forEach((t=>this.eachCursor(t,i,n)));else{const s="string"==typeof t&&e.Cursor.get(t);s&&n<2?this.eachCursor(s,i,n):i.push(t)}}destroy(){this.view&&(super.destroy(),this.view=null,this.touches=null)}}function T(t,e){let i,n=t.__.__textDrawData;const{rows:s,decorationY:o}=n;for(let t=0,n=s.length;t<n;t++)i=s[t],i.text?e.fillText(i.text,i.x,i.y):i.data&&i.data.forEach((t=>{e.fillText(t.char,t.x,i.y)}));if(o){const{decorationColor:t,decorationHeight:i}=n;t&&(e.fillStyle=t),s.forEach((t=>o.forEach((n=>e.fillRect(t.x,t.y+n,t.width,i)))))}}function S(t,e,i){const{strokeAlign:n}=e.__,s="string"!=typeof t;switch(n){case"center":i.setStroke(s?void 0:t,e.__.strokeWidth,e.__),s?O(t,!0,e,i):A(e,i);break;case"inside":M("inside",t,s,e,i);break;case"outside":M("outside",t,s,e,i)}}function M(t,e,i,n,s){const{__strokeWidth:o,__font:r}=n.__,a=s.getSameCanvas(!0,!0);a.setStroke(i?void 0:e,2*o,n.__),a.font=r,i?O(e,!0,n,a):A(n,a),a.blendMode="outside"===t?"destination-out":"destination-in",T(n,a),a.blendMode="normal",n.__worldFlipped?s.copyWorldByReset(a,n.__nowWorld):s.copyWorldToInner(a,n.__nowWorld,n.__layout.renderBounds),a.recycle(n.__nowWorld)}function A(t,e){let i,n=t.__.__textDrawData;const{rows:s,decorationY:o}=n;for(let t=0,n=s.length;t<n;t++)i=s[t],i.text?e.strokeText(i.text,i.x,i.y):i.data&&i.data.forEach((t=>{e.strokeText(t.char,t.x,i.y)}));if(o){const{decorationHeight:t}=n;s.forEach((i=>o.forEach((n=>e.strokeRect(i.x,i.y+n,i.width,t)))))}}function O(t,e,n,s){let o;for(let r=0,a=t.length;r<a;r++)o=t[r],o.image&&i.PaintImage.checkImage(n,s,o,!1)||o.style&&(s.strokeStyle=o.style,o.blendMode?(s.saveBlendMode(o.blendMode),e?A(n,s):s.stroke(),s.restoreBlendMode()):e?A(n,s):s.stroke())}function W(t,e){t.__.dashPattern&&(e.beginPath(),t.__drawPathByData(e,t.__.__pathForArrow),e.dashPattern=null,e.stroke())}const{getSpread:D,getOuterOf:I,getByMove:H,getIntersectData:z}=t.BoundsHelper;let j;function F(t,e,n){if("object"!=typeof e||!1===e.visible||0===e.opacity)return;const{boxBounds:s}=n.__layout;switch(e.type){case"solid":let{type:o,blendMode:r,color:a,opacity:h}=e;return{type:o,blendMode:r,style:i.ColorConvert.string(a,h)};case"image":return i.PaintImage.image(n,t,e,s,!j||!j[e.url]);case"linear":return i.PaintGradient.linearGradient(e,s);case"radial":return i.PaintGradient.radialGradient(e,s);case"angular":return i.PaintGradient.conicGradient(e,s);default:return void 0!==e.r?{type:"solid",style:i.ColorConvert.string(e)}:void 0}}const G={compute:function(t,e){const n=e.__,s=[];let o,r=n.__input[t];r instanceof Array||(r=[r]),j=i.PaintImage.recycleImage(t,n);for(let i,n=0,o=r.length;n<o;n++)i=F(t,r[n],e),i&&s.push(i);n["_"+t]=s.length?s:void 0,s.length&&s[0].image&&(o=s[0].image.hasOpacityPixel),"fill"===t?n.__pixelFill=o:n.__pixelStroke=o},fill:function(t,e,i){i.fillStyle=t,e.__.__font?T(e,i):e.__.windingRule?i.fill(e.__.windingRule):i.fill()},fills:function(t,e,n){let s;const{windingRule:o,__font:r}=e.__;for(let a=0,h=t.length;a<h;a++)s=t[a],s.image&&i.PaintImage.checkImage(e,n,s,!r)||s.style&&(n.fillStyle=s.style,s.transform?(n.save(),n.transform(s.transform),s.blendMode&&(n.blendMode=s.blendMode),r?T(e,n):o?n.fill(o):n.fill(),n.restore()):s.blendMode?(n.saveBlendMode(s.blendMode),r?T(e,n):o?n.fill(o):n.fill(),n.restoreBlendMode()):r?T(e,n):o?n.fill(o):n.fill())},fillText:T,stroke:function(t,e,i){const n=e.__,{__strokeWidth:s,strokeAlign:o,__font:r}=n;if(s)if(r)S(t,e,i);else switch(o){case"center":i.setStroke(t,s,n),i.stroke(),n.__useArrow&&W(e,i);break;case"inside":i.save(),i.setStroke(t,2*s,n),n.windingRule?i.clip(n.windingRule):i.clip(),i.stroke(),i.restore();break;case"outside":const o=i.getSameCanvas(!0,!0);o.setStroke(t,2*s,n),e.__drawRenderPath(o),o.stroke(),n.windingRule?o.clip(n.windingRule):o.clip(),o.clearWorld(e.__layout.renderBounds),e.__worldFlipped?i.copyWorldByReset(o,e.__nowWorld):i.copyWorldToInner(o,e.__nowWorld,e.__layout.renderBounds),o.recycle(e.__nowWorld)}},strokes:function(t,e,i){const n=e.__,{__strokeWidth:s,strokeAlign:o,__font:r}=n;if(s)if(r)S(t,e,i);else switch(o){case"center":i.setStroke(void 0,s,n),O(t,!1,e,i),n.__useArrow&&W(e,i);break;case"inside":i.save(),i.setStroke(void 0,2*s,n),n.windingRule?i.clip(n.windingRule):i.clip(),O(t,!1,e,i),i.restore();break;case"outside":const{renderBounds:o}=e.__layout,r=i.getSameCanvas(!0,!0);e.__drawRenderPath(r),r.setStroke(void 0,2*s,n),O(t,!1,e,r),n.windingRule?r.clip(n.windingRule):r.clip(),r.clearWorld(o),e.__worldFlipped?i.copyWorldByReset(r,e.__nowWorld):i.copyWorldToInner(r,e.__nowWorld,o),r.recycle(e.__nowWorld)}},strokeText:S,drawTextStroke:A,shape:function(t,e,i){const n=e.getSameCanvas(),s=t.__nowWorld;let o,r,a,h,{scaleX:l,scaleY:c}=s;if(l<0&&(l=-l),c<0&&(c=-c),e.bounds.includes(s))h=n,o=a=s;else{const{renderShapeSpread:n}=t.__layout,d=z(n?D(e.bounds,l===c?n*l:[n*c,n*l]):e.bounds,s);r=e.bounds.getFitMatrix(d);let{a:u,d:p}=r;if(r.a<1&&(h=e.getSameCanvas(),t.__renderShape(h,i),l*=u,c*=p),a=I(s,r),o=H(a,-r.e,-r.f),i.matrix){const{matrix:t}=i;r.multiply(t),u*=t.scaleX,p*=t.scaleY}i=Object.assign(Object.assign({},i),{matrix:r.withScale(u,p)})}return t.__renderShape(n,i),{canvas:n,matrix:r,bounds:o,worldCanvas:h,shapeBounds:a,scaleX:l,scaleY:c}}};let U={};const{get:Y,rotateOfOuter:V,translate:X,scaleOfOuter:N,scale:q,rotate:K}=t.MatrixHelper;function Q(t,e,i,n,s,o,r){const a=Y();X(a,e.x+i,e.y+n),q(a,s,o),r&&V(a,{x:e.x+e.width/2,y:e.y+e.height/2},r),t.transform=a}function $(t,e,i,n,s,o,r){const a=Y();X(a,e.x+i,e.y+n),s&&q(a,s,o),r&&K(a,r),t.transform=a}function Z(t,e,i,n,s,o,r,a,h,l){const c=Y();if(h)if("center"===l)V(c,{x:i/2,y:n/2},h);else switch(K(c,h),h){case 90:X(c,n,0);break;case 180:X(c,i,n);break;case 270:X(c,0,i)}U.x=e.x+s,U.y=e.y+o,X(c,U.x,U.y),r&&N(c,U,r,a),t.transform=c}const{get:J,translate:tt}=t.MatrixHelper,et=new t.Bounds,it={},nt={};function st(t,e,i,n){const{blendMode:s,changeful:o,sync:r}=i;s&&(t.blendMode=s),o&&(t.changeful=o),r&&(t.sync=r),t.data=ot(i,n,e)}function ot(e,i,n){let{width:s,height:o}=n;e.padding&&(i=et.set(i).shrink(e.padding)),"strench"===e.mode&&(e.mode="stretch");const{opacity:r,mode:a,align:h,offset:l,scale:c,size:d,rotation:u,repeat:p,filters:f}=e,g=i.width===s&&i.height===o,_={mode:a},w="center"!==h&&(u||0)%180==90,v=w?o:s,m=w?s:o;let y,b,x=0,E=0;if(a&&"cover"!==a&&"fit"!==a)(c||d)&&(t.MathHelper.getScaleData(c,d,n,nt),y=nt.scaleX,b=nt.scaleY);else if(!g||u){const t=i.width/v,e=i.height/m;y=b="fit"===a?Math.min(t,e):Math.max(t,e),x+=(i.width-s*y)/2,E+=(i.height-o*b)/2}if(h){const e={x:x,y:E,width:v,height:m};y&&(e.width*=y,e.height*=b),t.AlignHelper.toPoint(h,e,i,it,!0),x+=it.x,E+=it.y}switch(l&&(x+=l.x,E+=l.y),a){case"stretch":g||(s=i.width,o=i.height);break;case"normal":case"clip":(x||E||y||u)&&$(_,i,x,E,y,b,u);break;case"repeat":(!g||y||u)&&Z(_,i,s,o,x,E,y,b,u,h),p||(_.repeat="repeat");break;default:y&&Q(_,i,x,E,y,b,u)}return _.transform||(i.x||i.y)&&(_.transform=J(),tt(_.transform,i.x,i.y)),y&&"stretch"!==a&&(_.scaleX=y,_.scaleY=b),_.width=s,_.height=o,r&&(_.opacity=r),f&&(_.filters=f),p&&(_.repeat="string"==typeof p?"x"===p?"repeat-x":"repeat-y":"repeat"),_}let rt,at=new t.Bounds;const{isSame:ht}=t.BoundsHelper;function lt(t,e,i,n,s,o){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=n.width/e.pixelRatio,e.__naturalHeight=n.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return s.data||st(s,n,i,o),!0}function ct(e,i){pt(e,t.ImageEvent.LOAD,i)}function dt(e,i){pt(e,t.ImageEvent.LOADED,i)}function ut(e,i,n){i.error=n,e.forceUpdate("surface"),pt(e,t.ImageEvent.ERROR,i)}function pt(e,i,n){e.hasEvent(i)&&e.emitEvent(new t.ImageEvent(i,n))}function ft(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:gt,scale:_t,copy:wt}=t.MatrixHelper,{ceil:vt,abs:mt}=Math;function yt(e,i,n){let{scaleX:s,scaleY:o}=t.ImageManager.patternLocked?e.__world:e.__nowWorld;const r=s+"-"+o+"-"+n;if(i.patternId===r||e.destroyed)return!1;{s=mt(s),o=mt(o);const{image:e,data:a}=i;let h,l,{width:c,height:d,scaleX:u,scaleY:p,transform:f,repeat:g}=a;u&&(l=gt(),wt(l,f),_t(l,1/u,1/p),s*=u,o*=p),s*=n,o*=n,c*=s,d*=o;const _=c*d;if(!g&&_>t.Platform.image.maxCacheSize)return!1;let w=t.Platform.image.maxPatternSize;if(!e.isSVG){const t=e.width*e.height;w>t&&(w=t)}_>w&&(h=Math.sqrt(_/w)),h&&(s/=h,o/=h,c/=h,d/=h),u&&(s/=u,o/=p),(f||1!==s||1!==o)&&(l||(l=gt(),f&&wt(l,f)),_t(l,1/s,1/o));const v=e.getCanvas(vt(c)||1,vt(d)||1,a.opacity,a.filters),m=e.getPattern(v,g||t.Platform.origin.noRepeat||"no-repeat",l,i);return i.style=m,i.patternId=r,!0}}function bt(t,e,i,n){return new(i||(i=Promise))((function(s,o){function r(t){try{h(n.next(t))}catch(t){o(t)}}function a(t){try{h(n.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(r,a)}h((n=n.apply(t,e||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const{abs:xt}=Math;const Et={image:function(e,i,n,s,o){let r,a;const h=t.ImageManager.get(n);return rt&&n===rt.paint&&ht(s,rt.boxBounds)?r=rt.leafPaint:(r={type:n.type,image:h},rt=h.use>1?{leafPaint:r,paint:n,boxBounds:at.set(s)}:null),(o||h.loading)&&(a={image:h,attrName:i,attrValue:n}),h.ready?(lt(e,i,n,h,r,s),o&&(ct(e,a),dt(e,a))):h.error?o&&ut(e,a,h.error):(o&&(ft(e,!0),ct(e,a)),r.loadId=h.load((()=>{ft(e,!1),e.destroyed||(lt(e,i,n,h,r,s)&&(h.hasOpacityPixel&&(e.__layout.hitCanvasChanged=!0),e.forceUpdate("surface")),dt(e,a)),r.loadId=null}),(t=>{ft(e,!1),ut(e,a,t),r.loadId=null}))),r},checkImage:function(e,n,s,o){const{scaleX:r,scaleY:a}=t.ImageManager.patternLocked?e.__world:e.__nowWorld,{pixelRatio:h}=n,{data:l}=s;if(!l||s.patternId===r+"-"+a+"-"+h&&!i.Export.running)return!1;if(o)if(l.repeat)o=!1;else if(!(s.changeful||t.ResizeEvent.isResizing(e)||i.Export.running)){let{width:e,height:i}=l;e*=xt(r)*h,i*=xt(a)*h,l.scaleX&&(e*=l.scaleX,i*=l.scaleY),o=e*i>t.Platform.image.maxCacheSize}return o?(function(t,e,i,n){e.save(),t.windingRule?e.clip(t.windingRule):e.clip(),i.blendMode&&(e.blendMode=i.blendMode);n.opacity&&(e.opacity*=n.opacity);n.transform&&e.transform(n.transform);e.drawImage(i.image.getFull(n.filters),0,0,n.width,n.height),e.restore()}(e,n,s,l),!0):(!s.style||s.sync||i.Export.running?yt(e,s,h):s.patternTask||(s.patternTask=t.ImageManager.patternTasker.add((()=>bt(this,void 0,void 0,(function*(){s.patternTask=null,n.bounds.hit(e.__nowWorld)&&yt(e,s,h),e.forceUpdate("surface")}))),300)),!1)},createPattern:yt,recycleImage:function(e,i){const n=i["_"+e];if(n instanceof Array){let s,o,r,a,h;for(let l=0,c=n.length;l<c;l++)s=n[l],o=s.image,h=o&&o.url,h&&(r||(r={}),r[h]=!0,t.ImageManager.recycle(o),o.loading&&(a||(a=i.__input&&i.__input[e]||[],a instanceof Array||(a=[a])),o.unload(n[l].loadId,!a.some((t=>t.url===h)))));return r}return null},createData:st,getPatternData:ot,fillOrFitMode:Q,clipMode:$,repeatMode:Z},{toPoint:Lt}=t.AroundHelper,Bt={},Pt={};function Rt(t,e,n){if(e){let s;for(let o=0,r=e.length;o<r;o++)s=e[o],"string"==typeof s?t.addColorStop(o/(r-1),i.ColorConvert.string(s,n)):t.addColorStop(s.offset,i.ColorConvert.string(s.color,n))}}const{getAngle:kt,getDistance:Ct}=t.PointHelper,{get:Tt,rotateOfOuter:St,scaleOfOuter:Mt}=t.MatrixHelper,{toPoint:At}=t.AroundHelper,Ot={},Wt={};function Dt(t,e,i,n,s){let o;const{width:r,height:a}=t;if(r!==a||n){const t=kt(e,i);o=Tt(),s?(Mt(o,e,r/a*(n||1),1),St(o,e,t+90)):(Mt(o,e,1,r/a*(n||1)),St(o,e,t))}return o}const{getDistance:It}=t.PointHelper,{toPoint:Ht}=t.AroundHelper,zt={},jt={};const Ft={linearGradient:function(e,i){let{from:n,to:s,type:o,blendMode:r,opacity:a}=e;Lt(n||"top",i,Bt),Lt(s||"bottom",i,Pt);const h=t.Platform.canvas.createLinearGradient(Bt.x,Bt.y,Pt.x,Pt.y);Rt(h,e.stops,a);const l={type:o,style:h};return r&&(l.blendMode=r),l},radialGradient:function(e,i){let{from:n,to:s,type:o,opacity:r,blendMode:a,stretch:h}=e;At(n||"center",i,Ot),At(s||"bottom",i,Wt);const l=t.Platform.canvas.createRadialGradient(Ot.x,Ot.y,0,Ot.x,Ot.y,Ct(Ot,Wt));Rt(l,e.stops,r);const c={type:o,style:l},d=Dt(i,Ot,Wt,h,!0);return d&&(c.transform=d),a&&(c.blendMode=a),c},conicGradient:function(e,i){let{from:n,to:s,type:o,opacity:r,blendMode:a,stretch:h}=e;Ht(n||"center",i,zt),Ht(s||"bottom",i,jt);const l=t.Platform.conicGradientSupport?t.Platform.canvas.createConicGradient(0,zt.x,zt.y):t.Platform.canvas.createRadialGradient(zt.x,zt.y,0,zt.x,zt.y,It(zt,jt));Rt(l,e.stops,r);const c={type:o,style:l},d=Dt(i,zt,jt,h||1,t.Platform.conicGradientRotate90);return d&&(c.transform=d),a&&(c.blendMode=a),c},getTransform:Dt},{copy:Gt,toOffsetOutBounds:Ut}=t.BoundsHelper,Yt={},Vt={};function Xt(e,i,n,s){const{bounds:o,shapeBounds:r}=s;if(t.Platform.fullImageShadow){if(Gt(Yt,e.bounds),Yt.x+=i.x-r.x,Yt.y+=i.y-r.y,n){const{matrix:t}=s;Yt.x-=(o.x+(t?t.e:0)+o.width/2)*(n-1),Yt.y-=(o.y+(t?t.f:0)+o.height/2)*(n-1),Yt.width*=n,Yt.height*=n}e.copyWorld(s.canvas,e.bounds,Yt)}else n&&(Gt(Yt,i),Yt.x-=i.width/2*(n-1),Yt.y-=i.height/2*(n-1),Yt.width*=n,Yt.height*=n),e.copyWorld(s.canvas,r,n?Yt:i)}const{toOffsetOutBounds:Nt}=t.BoundsHelper,qt={};const Kt={shadow:function(t,e,n){let s,o;const{__nowWorld:r,__layout:a}=t,{shadow:h}=t.__,{worldCanvas:l,bounds:c,shapeBounds:d,scaleX:u,scaleY:p}=n,f=e.getSameCanvas(),g=h.length-1;Ut(c,Vt),h.forEach(((h,_)=>{f.setWorldShadow(Vt.offsetX+h.x*u,Vt.offsetY+h.y*p,h.blur*u,i.ColorConvert.string(h.color)),o=h.spread?1+2*h.spread/(a.boxBounds.width+2*(a.strokeBoxSpread||0)):0,Xt(f,Vt,o,n),s=c,h.box&&(f.restore(),f.save(),l&&(f.copyWorld(f,c,r,"copy"),s=r),l?f.copyWorld(l,r,r,"destination-out"):f.copyWorld(n.canvas,d,c,"destination-out")),t.__worldFlipped?e.copyWorldByReset(f,s,r,h.blendMode):e.copyWorldToInner(f,s,a.renderBounds,h.blendMode),g&&_<g&&f.clearWorld(s,!0)})),f.recycle(s)},innerShadow:function(t,e,n){let s,o;const{__nowWorld:r,__layout:a}=t,{innerShadow:h}=t.__,{worldCanvas:l,bounds:c,shapeBounds:d,scaleX:u,scaleY:p}=n,f=e.getSameCanvas(),g=h.length-1;Nt(c,qt),h.forEach(((h,_)=>{f.save(),f.setWorldShadow(qt.offsetX+h.x*u,qt.offsetY+h.y*p,h.blur*u),o=h.spread?1-2*h.spread/(a.boxBounds.width+2*(a.strokeBoxSpread||0)):0,Xt(f,qt,o,n),f.restore(),l?(f.copyWorld(f,c,r,"copy"),f.copyWorld(l,r,r,"source-out"),s=r):(f.copyWorld(n.canvas,d,c,"source-out"),s=c),f.fillWorld(s,i.ColorConvert.string(h.color),"source-in"),t.__worldFlipped?e.copyWorldByReset(f,s,r,h.blendMode):e.copyWorldToInner(f,s,a.renderBounds,h.blendMode),g&&_<g&&f.clearWorld(s,!0)})),f.recycle(s)},blur:function(t,e,i){const{blur:n}=t.__;i.setWorldBlur(n*t.__nowWorld.a),i.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),i.filter="none"},backgroundBlur:function(t,e,i){}},{excludeRenderBounds:Qt}=t.LeafBoundsHelper;function $t(t,e,i,n,s,o){switch(e){case"grayscale":s.useGrayscaleAlpha(t.__nowWorld);case"alpha":!function(t,e,i,n){const s=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(n,s),n.recycle(s),Jt(t,e,i,1)}(t,i,n,s);break;case"opacity-path":Jt(t,i,n,o);break;case"path":i.restore()}}function Zt(t){return t.getSameCanvas(!1,!0)}function Jt(t,e,i,n){const s=t.__nowWorld;e.resetTransform(),e.opacity=n,e.copyWorld(i,s),i.recycle(s)}i.Group.prototype.__renderMask=function(t,e){let i,n,s,o,r,a;const{children:h}=this;for(let l=0,c=h.length;l<c;l++)i=h[l],a=i.__.mask,a&&(r&&($t(this,r,t,s,n,o),n=s=null),"path"===a||"clipping-path"===a?(i.opacity<1?(r="opacity-path",o=i.opacity,s||(s=Zt(t))):(r="path",t.save()),i.__clip(s||t,e)):(r="grayscale"===a?"grayscale":"alpha",n||(n=Zt(t)),s||(s=Zt(t)),i.__render(n,e)),"clipping"!==a&&"clipping-path"!==a)||Qt(i,e)||i.__render(s||t,e);$t(this,r,t,s,n,o)};const te=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",ee=te+"_#~&*+\\=|≮≯≈≠=…",ie=new RegExp([[19968,40959],[13312,19903],[131072,173791],[173824,177983],[177984,178207],[178208,183983],[183984,191471],[196608,201551],[201552,205743],[11904,12031],[12032,12255],[12272,12287],[12288,12351],[12736,12783],[12800,13055],[13056,13311],[63744,64255],[65072,65103],[127488,127743],[194560,195103]].map((([t,e])=>`[\\u${t.toString(16)}-\\u${e.toString(16)}]`)).join("|"));function ne(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const se=ne("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),oe=ne("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),re=ne(te),ae=ne(ee),he=ne("- —/~|┆·");var le;!function(t){t[t.Letter=0]="Letter",t[t.Single=1]="Single",t[t.Before=2]="Before",t[t.After=3]="After",t[t.Symbol=4]="Symbol",t[t.Break=5]="Break"}(le||(le={}));const{Letter:ce,Single:de,Before:ue,After:pe,Symbol:fe,Break:ge}=le;function _e(t){return se[t]?ce:he[t]?ge:oe[t]?ue:re[t]?pe:ae[t]?fe:ie.test(t)?de:ce}const we={trimRight(t){const{words:e}=t;let i,n=0,s=e.length;for(let o=s-1;o>-1&&(i=e[o].data[0]," "===i.char);o--)n++,t.width-=i.width;n&&e.splice(s-n,n)}};function ve(t,e,i){switch(e){case"title":return i?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:me}=we,{Letter:ye,Single:be,Before:xe,After:Ee,Symbol:Le,Break:Be}=le;let Pe,Re,ke,Ce,Te,Se,Me,Ae,Oe,We,De,Ie,He,ze,je,Fe,Ge,Ue=[];function Ye(t,e){Oe&&!Ae&&(Ae=Oe),Pe.data.push({char:t,width:e}),ke+=e}function Ve(){Ce+=ke,Pe.width=ke,Re.words.push(Pe),Pe={data:[]},ke=0}function Xe(){ze&&(je.paraNumber++,Re.paraStart=!0,ze=!1),Oe&&(Re.startCharSize=Ae,Re.endCharSize=Oe,Ae=0),Re.width=Ce,Fe.width?me(Re):Ge&&Ne(),Ue.push(Re),Re={words:[]},Ce=0}function Ne(){Ce>(je.maxWidth||0)&&(je.maxWidth=Ce)}const{top:qe,right:Ke,bottom:Qe,left:$e}=t.Direction4;function Ze(t,e,i){const{bounds:n,rows:s}=t;n[e]+=i;for(let t=0;t<s.length;t++)s[t][e]+=i}const Je={getDrawData:function(e,n){"string"!=typeof e&&(e=String(e));let s=0,o=0,r=n.__getInput("width")||0,a=n.__getInput("height")||0;const{textDecoration:h,__font:l,__padding:c}=n;c&&(r?(s=c[$e],r-=c[Ke]+c[$e]):n.autoSizeAlign||(s=c[$e]),a?(o=c[qe],a-=c[qe]+c[Qe]):n.autoSizeAlign||(o=c[qe]));const d={bounds:{x:s,y:o,width:r,height:a},rows:[],paraNumber:0,font:t.Platform.canvas.font=l};return function(e,i,n){je=e,Ue=e.rows,Fe=e.bounds,Ge=!Fe.width&&!n.autoSizeAlign;const{__letterSpacing:s,paraIndent:o,textCase:r}=n,{canvas:a}=t.Platform,{width:h,height:l}=Fe;if(h||l||s||"none"!==r){const t="none"!==n.textWrap,e="break"===n.textWrap;ze=!0,De=null,Ae=Me=Oe=ke=Ce=0,Pe={data:[]},Re={words:[]};for(let n=0,l=i.length;n<l;n++)Se=i[n],"\n"===Se?(ke&&Ve(),Re.paraEnd=!0,Xe(),ze=!0):(We=_e(Se),We===ye&&"none"!==r&&(Se=ve(Se,r,!ke)),Me=a.measureText(Se).width,s&&(s<0&&(Oe=Me),Me+=s),Ie=We===be&&(De===be||De===ye)||De===be&&We!==Ee,He=!(We!==xe&&We!==be||De!==Le&&De!==Ee),Te=ze&&o?h-o:h,t&&h&&Ce+ke+Me>Te&&(e?(ke&&Ve(),Ce&&Xe()):(He||(He=We===ye&&De==Ee),Ie||He||We===Be||We===xe||We===be||ke+Me>Te?(ke&&Ve(),Ce&&Xe()):Ce&&Xe()))," "===Se&&!0!==ze&&Ce+ke===0||(We===Be?(" "===Se&&ke&&Ve(),Ye(Se,Me),Ve()):Ie||He?(ke&&Ve(),Ye(Se,Me)):Ye(Se,Me)),De=We);ke&&Ve(),Ce&&Xe(),Ue.length>0&&(Ue[Ue.length-1].paraEnd=!0)}else i.split("\n").forEach((t=>{je.paraNumber++,Ce=a.measureText(t).width,Ue.push({x:o||0,text:t,width:Ce,paraStart:!0}),Ge&&Ne()}))}(d,e,n),c&&function(t,e,i,n,s){if(!n&&i.autoSizeAlign)switch(i.textAlign){case"left":Ze(e,"x",t[$e]);break;case"right":Ze(e,"x",-t[Ke])}if(!s&&i.autoSizeAlign)switch(i.verticalAlign){case"top":Ze(e,"y",t[qe]);break;case"bottom":Ze(e,"y",-t[Qe])}}(c,d,n,r,a),function(t,e){const{rows:i,bounds:n}=t,s=i.length,{__lineHeight:o,__baseLine:r,__letterSpacing:a,__clipText:h,textAlign:l,verticalAlign:c,paraSpacing:d,autoSizeAlign:u}=e;let{x:p,y:f,width:g,height:_}=n,w=o*s+(d?d*(t.paraNumber-1):0),v=r;if(h&&w>_)w=Math.max(_,o),s>1&&(t.overflow=s);else if(_||u)switch(c){case"middle":f+=(_-w)/2;break;case"bottom":f+=_-w}v+=f;let m,y,b,x=g||u?g:t.maxWidth;for(let r=0,c=s;r<c;r++){if(m=i[r],m.x=p,m.width<g||m.width>g&&!h)switch(l){case"center":m.x+=(x-m.width)/2;break;case"right":m.x+=x-m.width}m.paraStart&&d&&r>0&&(v+=d),m.y=v,v+=o,t.overflow>r&&v>w&&(m.isOverflow=!0,t.overflow=r+1),y=m.x,b=m.width,a<0&&(m.width<0?(b=-m.width+e.fontSize+a,y-=b,b+=e.fontSize):b-=a),y<n.x&&(n.x=y),b>n.width&&(n.width=b),h&&g&&g<b&&(m.isOverflow=!0,t.overflow||(t.overflow=i.length))}n.y=f,n.height=w}(d,n),function(t,e,i){const{rows:n}=t,{textAlign:s,paraIndent:o,letterSpacing:r}=e;let a,h,l,c,d,u;n.forEach((t=>{t.words&&(l=o&&t.paraStart?o:0,u=t.words.length,h=i&&("justify"===s||"both"===s)&&u>1?(i-t.width-l)/(u-1):0,c=r||t.isOverflow?0:h>.01?1:2,t.isOverflow&&!r&&(t.textMode=!0),2===c?(t.x+=l,function(t){t.text="",t.words.forEach((e=>{e.data.forEach((e=>{t.text+=e.char}))}))}(t)):(t.x+=l,a=t.x,t.data=[],t.words.forEach(((e,i)=>{1===c?(d={char:"",x:a},a=function(t,e,i){return t.forEach((t=>{i.char+=t.char,e+=t.width})),e}(e.data,a,d),(t.isOverflow||" "!==d.char)&&t.data.push(d)):a=function(t,e,i,n){return t.forEach((t=>{(n||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width})),e}(e.data,a,t.data,t.isOverflow),!h||t.paraEnd&&"both"!==s||i===u-1||(a+=h,t.width+=h)}))),t.words=null)}))}(d,n,r),d.overflow&&function(e,i,n,s){if(!s)return;const{rows:o,overflow:r}=e;let{textOverflow:a}=i;if(o.splice(r),a&&"show"!==a){let e,h;"hide"===a?a="":"ellipsis"===a&&(a="...");const l=a?t.Platform.canvas.measureText(a).width:0,c=n+s-l;("none"===i.textWrap?o:[o[r-1]]).forEach((t=>{if(t.isOverflow&&t.data){let i=t.data.length-1;for(let n=i;n>-1&&(e=t.data[n],h=e.x+e.width,!(n===i&&h<c));n--){if(h<c&&" "!==e.char||!n){t.data.splice(n+1),t.width-=e.width;break}t.width-=e.width}t.width+=l,t.data.push({char:a,x:h}),t.textMode&&function(t){t.text="",t.data.forEach((e=>{t.text+=e.char})),t.data=null}(t)}}))}}(d,n,s,r),"none"!==h&&function(t,e){let n;const{fontSize:s,textDecoration:o}=e;switch(t.decorationHeight=s/11,"object"==typeof o?(n=o.type,o.color&&(t.decorationColor=i.ColorConvert.string(o.color))):n=o,n){case"under":t.decorationY=[.15*s];break;case"delete":t.decorationY=[.35*-s];break;case"under-delete":t.decorationY=[.15*s,.35*-s]}}(d,n),d}};const ti={string:function(t,e){const n="number"==typeof e&&1!==e;if("string"==typeof t){if(!n||!i.ColorConvert.object)return t;t=i.ColorConvert.object(t)}let s=void 0===t.a?1:t.a;n&&(s*=e);const o=t.r+","+t.g+","+t.b;return 1===s?"rgb("+o+")":"rgba("+o+","+s+")"}};Object.assign(i.TextConvert,Je),Object.assign(i.ColorConvert,ti),Object.assign(i.Paint,G),Object.assign(i.PaintImage,Et),Object.assign(i.PaintGradient,Ft),Object.assign(i.Effect,Kt),Object.assign(t.Creator,{interaction:(t,e,i,n)=>new C(t,e,i,n),hitCanvas:(t,e)=>new s(t,e),hitCanvasManager:()=>new e.HitCanvasManager}),a(),Object.defineProperty(exports,"LeaferImage",{enumerable:!0,get:function(){return t.LeaferImage}}),exports.Interaction=C,exports.Layouter=y,exports.LeaferCanvas=s,exports.Picker=L,exports.Renderer=x,exports.Selector=B,exports.Watcher=l,exports.useCanvas=a,Object.keys(t).forEach((function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}})})),Object.keys(e).forEach((function(t){"default"===t||Object.prototype.hasOwnProperty.call(exports,t)||Object.defineProperty(exports,t,{enumerable:!0,get:function(){return e[t]}})}));
|
|
1
|
+
"use strict";var t=require("@leafer/core"),e=require("@leafer-ui/core"),i=require("@leafer-ui/draw");const n=t.Debug.get("LeaferCanvas");class s extends t.LeaferCanvasBase{set zIndex(t){const{style:e}=this.view;e.zIndex=t,this.setAbsolute(this.view)}set childIndex(t){const{view:e,parentView:i}=this;if(e&&i){const n=i.children[t];n?(this.setAbsolute(n),i.insertBefore(e,n)):i.appendChild(n)}}init(){const{config:e}=this,i=e.view||e.canvas;i?this.__createViewFrom(i):this.__createView();const{style:n}=this.view;if(n.display||(n.display="block"),this.parentView=this.view.parentElement,this.parentView){const t=this.parentView.style;t.webkitUserSelect=t.userSelect="none"}t.Platform.syncDomFont&&!this.parentView&&(n.display="none",document.body.appendChild(this.view)),this.__createContext(),this.autoLayout||this.resize(e)}set backgroundColor(t){this.view.style.backgroundColor=t}get backgroundColor(){return this.view.style.backgroundColor}set hittable(t){this.view.style.pointerEvents=t?"auto":"none"}get hittable(){return"none"!==this.view.style.pointerEvents}__createView(){this.view=document.createElement("canvas")}__createViewFrom(t){let e="string"==typeof t?document.getElementById(t):t;if(e)if(e instanceof HTMLCanvasElement)this.view=e;else{let t=e;if(e===window||e===document){const e=document.createElement("div"),{style:i}=e;i.position="absolute",i.top=i.bottom=i.left=i.right="0px",document.body.appendChild(e),t=e}this.__createView();const i=this.view;t.hasChildNodes()&&(this.setAbsolute(i),t.style.position||(t.style.position="relative")),t.appendChild(i)}else n.error(`no id: ${t}`),this.__createView()}setAbsolute(t){const{style:e}=t;e.position="absolute",e.top=e.left="0px"}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this,{style:n}=this.view;n.width=t+"px",n.height=e+"px",this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i)}updateClientBounds(){this.view.parentElement&&(this.clientBounds=this.view.getBoundingClientRect())}startAutoLayout(e,i){if(this.resizeListener=i,e){this.autoBounds=e;try{this.resizeObserver=new ResizeObserver((t=>{this.updateClientBounds();for(const e of t)this.checkAutoBounds(e.contentRect)}));const t=this.parentView;t?(this.resizeObserver.observe(t),this.checkAutoBounds(t.getBoundingClientRect())):(this.checkAutoBounds(this.view),n.warn("no parent"))}catch(t){this.imitateResizeObserver()}}else window.addEventListener("resize",this.windowListener=()=>{const e=t.Platform.devicePixelRatio;if(!this.config.pixelRatio&&this.pixelRatio!==e){const{width:t,height:i}=this;this.emitResize({width:t,height:i,pixelRatio:e})}})}imitateResizeObserver(){this.autoLayout&&(this.parentView&&this.checkAutoBounds(this.parentView.getBoundingClientRect()),t.Platform.requestRender(this.imitateResizeObserver.bind(this)))}checkAutoBounds(e){const i=this.view,{x:n,y:s,width:o,height:r}=this.autoBounds.getBoundsFrom(e),a={width:o,height:r,pixelRatio:this.config.pixelRatio?this.pixelRatio:t.Platform.devicePixelRatio};if(!this.isSameSize(a)){const{style:t}=i;t.marginLeft=n+"px",t.marginTop=s+"px",this.emitResize(a)}}stopAutoLayout(){this.autoLayout=!1,this.resizeObserver&&this.resizeObserver.disconnect(),this.resizeListener=this.resizeObserver=null}emitResize(e){const i={};t.DataHelper.copyAttrs(i,this,t.canvasSizeAttrs),this.resize(e),this.resizeListener&&void 0!==this.width&&this.resizeListener(new t.ResizeEvent(e,i))}unrealCanvas(){if(!this.unreal&&this.parentView){const t=this.view;t&&t.remove(),this.view=this.parentView,this.unreal=!0}}destroy(){if(this.view){if(this.stopAutoLayout(),this.windowListener&&(window.removeEventListener("resize",this.windowListener),this.windowListener=null),!this.unreal){const t=this.view;t.parentElement&&t.remove()}super.destroy()}}}t.canvasPatch(CanvasRenderingContext2D.prototype),t.canvasPatch(Path2D.prototype);const{mineType:o,fileType:r}=t.FileHelper;function a(e,i){t.Platform.origin={createCanvas(t,e){const i=document.createElement("canvas");return i.width=t,i.height=e,i},canvasToDataURL:(t,e,i)=>{const n=o(e),s=t.toDataURL(n,i);return"image/bmp"===n?s.replace("image/png;","image/bmp;"):s},canvasToBolb:(t,e,i)=>new Promise((n=>t.toBlob(n,o(e),i))),canvasSaveAs:(e,i,n)=>{const s=e.toDataURL(o(r(i)),n);return t.Platform.origin.download(s,i)},download:(t,e)=>new Promise((i=>{let n=document.createElement("a");n.href=t,n.download=e,document.body.appendChild(n),n.click(),document.body.removeChild(n),i()})),loadImage:e=>new Promise(((i,n)=>{const s=new t.Platform.origin.Image,{crossOrigin:o}=t.Platform.image;o&&(s.setAttribute("crossOrigin",o),s.crossOrigin=o),s.onload=()=>{i(s)},s.onerror=t=>{n(t)},s.src=t.Platform.image.getRealURL(e)})),Image:Image,PointerEvent:PointerEvent,DragEvent:DragEvent},t.Platform.event={stopDefault(t){t.preventDefault()},stopNow(t){t.stopImmediatePropagation()},stop(t){t.stopPropagation()}},t.Platform.canvas=t.Creator.canvas(),t.Platform.conicGradientSupport=!!t.Platform.canvas.context.createConicGradient}Object.assign(t.Creator,{canvas:(t,e)=>new s(t,e),image:e=>new t.LeaferImage(e)}),t.Platform.name="web",t.Platform.isMobile="ontouchstart"in window,t.Platform.requestRender=function(t){window.requestAnimationFrame(t)},t.defineKey(t.Platform,"devicePixelRatio",{get:()=>devicePixelRatio});const{userAgent:h}=navigator;h.indexOf("Firefox")>-1?(t.Platform.conicGradientRotate90=!0,t.Platform.intWheelDeltaY=!0,t.Platform.syncDomFont=!0):h.indexOf("AppleWebKit")>-1&&(t.Platform.fullImageShadow=!0),h.indexOf("Windows")>-1?(t.Platform.os="Windows",t.Platform.intWheelDeltaY=!0):h.indexOf("Mac")>-1?t.Platform.os="Mac":h.indexOf("Linux")>-1&&(t.Platform.os="Linux");class l{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const e=new t.LeafList;return this.__updatedList.list.forEach((t=>{t.leafer&&e.add(t)})),e}return this.__updatedList}constructor(e,i){this.totalTimes=0,this.config={},this.__updatedList=new t.LeafList,this.target=e,i&&(this.config=t.DataHelper.default(i,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(t.RenderEvent.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(e){e.type===t.ChildEvent.ADD?(this.hasAdd=!0,this.__pushChild(e.child)):(this.hasRemove=!0,this.__updatedList.add(e.parent)),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new t.WatchEvent(t.WatchEvent.DATA,{updatedList:this.updatedList})),this.__updatedList=new t.LeafList,this.totalTimes++,this.changed=!1,this.hasVisible=!1,this.hasRemove=!1,this.hasAdd=!1}__listenEvents(){const{target:e}=this;this.__eventIds=[e.on_(t.PropertyEvent.CHANGE,this.__onAttrChange,this),e.on_([t.ChildEvent.ADD,t.ChildEvent.REMOVE],this.__onChildEvent,this),e.on_(t.WatchEvent.REQUEST,this.__onRquestData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.__updatedList=null)}}const{updateAllMatrix:c,updateBounds:d,updateChange:u}=t.LeafHelper,{pushAllChildBranch:p,pushAllParent:f}=t.BranchHelper;const{worldBounds:g}=t.LeafBoundsHelper;class _{constructor(e){this.updatedBounds=new t.Bounds,this.beforeBounds=new t.Bounds,this.afterBounds=new t.Bounds,e instanceof Array&&(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(t){this.updatedList.addList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllMatrix:w,updateAllChange:v}=t.LeafHelper,m=t.Debug.get("Layouter");class y{constructor(e,i){this.totalTimes=0,this.config={},this.__levelList=new t.LeafLevelList,this.target=e,i&&(this.config=t.DataHelper.default(i,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(!this.running)return;const{target:e}=this;this.times=0;try{e.emit(t.LayoutEvent.START),this.layoutOnce(),e.emitEvent(new t.LayoutEvent(t.LayoutEvent.END,this.layoutedBlocks,this.times))}catch(t){m.error(t)}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.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var e;if(!(null===(e=this.__updatedList)||void 0===e?void 0:e.length))return;const i=t.Run.start("PartLayout"),{target:n,__updatedList:s}=this,{BEFORE:o,LAYOUT:r,AFTER:a}=t.LayoutEvent,h=this.getBlocks(s);h.forEach((t=>t.setBefore())),n.emitEvent(new t.LayoutEvent(o,h,this.times)),this.extraBlock=null,s.sort(),function(t,e){let i;t.list.forEach((t=>{i=t.__layout,e.without(t)&&!i.proxyZoom&&(i.matrixChanged?(c(t,!0),e.add(t),t.isBranch&&p(t,e),f(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),f(t,e)))}))}(s,this.__levelList),function(t){let e,i,n;t.sort(!0),t.levels.forEach((s=>{e=t.levelMap[s];for(let t=0,s=e.length;t<s;t++){if(i=e[t],i.isBranch&&i.__tempNumber){n=i.children;for(let t=0,e=n.length;t<e;t++)n[t].isBranch||d(n[t])}d(i)}}))}(this.__levelList),function(t){t.list.forEach(u)}(s),this.extraBlock&&h.push(this.extraBlock),h.forEach((t=>t.setAfter())),n.emitEvent(new t.LayoutEvent(r,h,this.times)),n.emitEvent(new t.LayoutEvent(a,h,this.times)),this.addBlocks(h),this.__levelList.reset(),this.__updatedList=null,t.Run.end(i)}fullLayout(){const e=t.Run.start("FullLayout"),{target:i}=this,{BEFORE:n,LAYOUT:s,AFTER:o}=t.LayoutEvent,r=this.getBlocks(new t.LeafList(i));i.emitEvent(new t.LayoutEvent(n,r,this.times)),y.fullLayout(i),r.forEach((t=>{t.setAfter()})),i.emitEvent(new t.LayoutEvent(s,r,this.times)),i.emitEvent(new t.LayoutEvent(o,r,this.times)),this.addBlocks(r),t.Run.end(e)}static fullLayout(e){w(e,!0),e.isBranch?t.BranchHelper.updateBounds(e):t.LeafHelper.updateBounds(e),v(e)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new _([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new _(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){const{target:e}=this;this.__eventIds=[e.on_(t.LayoutEvent.REQUEST,this.layout,this),e.on_(t.LayoutEvent.AGAIN,this.layoutAgain,this),e.on_(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 b=t.Debug.get("Renderer");class x{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(e,i,n){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:60},this.target=e,this.canvas=i,n&&(this.config=t.DataHelper.default(n,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.__requestRender()}requestLayout(){this.target.emit(t.LayoutEvent.REQUEST)}checkRender(){if(this.running){const{target:e}=this;e.isApp&&(e.emit(t.RenderEvent.CHILD_START,e),e.children.forEach((t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()})),e.emit(t.RenderEvent.CHILD_END,e)),this.changed&&this.canvas.view&&this.render(),this.target.emit(t.RenderEvent.NEXT)}}render(e){if(!this.running||!this.canvas.view)return this.update();const{target:i}=this;this.times=0,this.totalBounds=new t.Bounds,b.log(i.innerName,"---\x3e");try{this.emitRender(t.RenderEvent.START),this.renderOnce(e),this.emitRender(t.RenderEvent.END,this.totalBounds),t.ImageManager.clearRecycled()}catch(t){this.rendering=!1,b.error(t)}b.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(e){if(this.rendering)return b.warn("rendering");if(this.times>3)return b.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new t.Bounds,this.renderOptions={},e)this.emitRender(t.RenderEvent.BEFORE),e();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(t.RenderEvent.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(t.RenderEvent.RENDER,this.renderBounds,this.renderOptions),this.emitRender(t.RenderEvent.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,this.waitAgain&&(this.waitAgain=!1,this.renderOnce())}partRender(){const{canvas:t,updateBlocks:e}=this;e&&(this.mergeBlocks(),e.forEach((e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)})))}clipRender(e){const i=t.Run.start("PartRender"),{canvas:n}=this,s=e.getIntersect(n.bounds),o=new t.Bounds(s);n.save(),s.spread(x.clipSpread).ceil(),n.clearWorld(s,!0),n.clipWorld(s,!0),this.__render(s,o),n.restore(),t.Run.end(i)}fullRender(){const e=t.Run.start("FullRender"),{canvas:i}=this;i.save(),i.clear(),this.__render(i.bounds),i.restore(),t.Run.end(e)}__render(e,i){const{canvas:n}=this,s=e.includes(this.target.__world),o=s?{includes:s}:{bounds:e,includes:s};this.needFill&&n.fillWorld(e,this.config.fill),t.Debug.showRepaint&&t.Debug.drawRepaint(n,e),this.target.__render(n,o),this.renderBounds=i=i||e,this.renderOptions=o,this.totalBounds.isEmpty()?this.totalBounds=i:this.totalBounds.add(i),n.updateRender(i)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:e}=this;if(e){const i=new t.Bounds;i.setList(e),e.length=0,e.push(i)}}__requestRender(){const e=this.target;if(this.requestTime||!e)return;if(e.parentApp)return e.parentApp.requestRender(!1);const i=this.requestTime=Date.now();t.Platform.requestRender((()=>{this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-i))),this.requestTime=0,this.checkRender()}))}__onResize(e){if(!this.canvas.unreal){if(e.bigger||!e.samePixelRatio){const{width:i,height:n}=e.old;if(!new t.Bounds(0,0,i,n).includes(this.target.__world)||this.needFill||!e.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new t.Bounds(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map((t=>{let e;t.updatedList&&t.updatedList.list.some((t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||b.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e))),this.addBlock(e?this.canvas.bounds:t.updatedBounds)}))}emitRender(e,i,n){this.target.emitEvent(new t.RenderEvent(e,this.times,i,n))}__listenEvents(){const{target:e}=this;this.__eventIds=[e.on_(t.RenderEvent.REQUEST,this.update,this),e.on_(t.LayoutEvent.END,this.__onLayoutEnd,this),e.on_(t.RenderEvent.AGAIN,this.renderAgain,this),e.on_(t.ResizeEvent.RESIZE,this.__onResize,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.canvas=this.config=null)}}x.clipSpread=10;const{hitRadiusPoint:E}=t.BoundsHelper;class L{constructor(t,e){this.target=t,this.selector=e}getByPoint(e,i,n){i||(i=0),n||(n={});const s=n.through||!1,o=n.ignoreHittable||!1,r=n.target||this.target;this.exclude=n.exclude||null,this.point={x:e.x,y:e.y,radiusX:i,radiusY:i},this.findList=new t.LeafList(n.findList),n.findList||this.hitBranch(r);const{list:a}=this.findList,h=this.getBestMatchLeaf(a,n.bottomList,o),l=o?this.getPath(h):this.getHitablePath(h);return this.clear(),s?{path:l,target:h,throughPath:a.length?this.getThroughPath(a):l}:{path:l,target:h}}getBestMatchLeaf(e,i,n){if(e.length){let i;this.findList=new t.LeafList;const{x:s,y:o}=this.point,r={x:s,y:o,radiusX:0,radiusY:0};for(let s=0,o=e.length;s<o;s++)if(i=e[s],(n||t.LeafHelper.worldHittable(i))&&(this.hitChild(i,r),this.findList.length))return this.findList.list[0]}if(i)for(let t=0,e=i.length;t<e;t++)if(this.hitChild(i[t].target,this.point,i[t].proxy),this.findList.length)return this.findList.list[0];return e[0]}getPath(e){const i=new t.LeafList;for(;e;)i.add(e),e=e.parent;return this.target&&i.add(this.target),i}getHitablePath(e){const i=this.getPath(e&&e.hittable?e:null);let n,s=new t.LeafList;for(let t=i.list.length-1;t>-1&&(n=i.list[t],n.__.hittable)&&(s.addAt(n,0),n.__.hitChildren);t--);return s}getThroughPath(e){const i=new t.LeafList,n=[];for(let t=e.length-1;t>-1;t--)n.push(this.getPath(e[t]));let s,o,r;for(let t=0,e=n.length;t<e;t++){s=n[t],o=n[t+1];for(let t=0,e=s.length;t<e&&(r=s.list[t],!o||!o.has(r));t++)i.add(r)}return i}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,n;const{point:s}=this;for(let o=t.length-1;o>-1;o--)i=t[o],!i.__.visible||e&&!i.__.mask||(n=!!i.__.hitRadius||E(i.__world,s),i.isBranch?(n||i.__ignoreHitWorld)&&(this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,s)):n&&this.hitChild(i,s))}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:n}=t;if(n&&n.__hasMask&&!t.__.mask&&!n.children.some((t=>t.__.mask&&t.__hitWorld(e))))return;this.findList.add(i||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class B{constructor(e,i){this.config={},i&&(this.config=t.DataHelper.default(i,this.config)),this.picker=new L(this.target=e,this),this.finder=t.Creator.finder&&t.Creator.finder()}getByPoint(e,i,n){const{target:s,picker:o}=this;return t.Platform.backgrounder&&s&&s.updateLayout(),o.getByPoint(e,i,n)}getBy(e,i,n,s){return this.finder?this.finder.getBy(e,i,n,s):t.Plugin.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}Object.assign(t.Creator,{watcher:(t,e)=>new l(t,e),layouter:(t,e)=>new y(t,e),renderer:(t,e,i)=>new x(t,e,i),selector:(t,e)=>new B(t,e)}),t.Platform.layout=y.fullLayout;const P={convert(t,i){const n=e.InteractionHelper.getBase(t),s=Object.assign(Object.assign({},n),{x:i.x,y:i.y,width:t.width,height:t.height,pointerType:t.pointerType,pressure:t.pressure});return"pen"===s.pointerType&&(s.tangentialPressure=t.tangentialPressure,s.tiltX=t.tiltX,s.tiltY=t.tiltY,s.twist=t.twist),s},convertMouse(t,i){const n=e.InteractionHelper.getBase(t);return Object.assign(Object.assign({},n),{x:i.x,y:i.y,width:1,height:1,pointerType:"mouse",pressure:.5})},convertTouch(t,i){const n=P.getTouch(t),s=e.InteractionHelper.getBase(t);return Object.assign(Object.assign({},s),{x:i.x,y:i.y,width:1,height:1,pointerType:"touch",multiTouch:t.touches.length>1,pressure:n.force})},getTouch:t=>t.targetTouches[0]||t.changedTouches[0]},R={convert(t){const i=e.InteractionHelper.getBase(t);return Object.assign(Object.assign({},i),{code:t.code,key:t.key})}},{pathCanDrag:k}=e.InteractionHelper;class C extends e.InteractionBase{__listenEvents(){super.__listenEvents();const t=this.view=this.canvas.view;this.viewEvents={pointerdown:this.onPointerDown,mousedown:this.onMouseDown,touchstart:this.onTouchStart,pointerleave:this.onPointerLeave,contextmenu:this.onContextMenu,wheel:this.onWheel,gesturestart:this.onGesturestart,gesturechange:this.onGesturechange,gestureend:this.onGestureend},this.windowEvents={pointermove:this.onPointerMove,pointerup:this.onPointerUp,pointercancel:this.onPointerCancel,mousemove:this.onMouseMove,mouseup:this.onMouseUp,touchmove:this.onTouchMove,touchend:this.onTouchEnd,touchcancel:this.onTouchCancel,keydown:this.onKeyDown,keyup:this.onKeyUp,scroll:this.onScroll};const{viewEvents:e,windowEvents:i}=this;for(let i in e)e[i]=e[i].bind(this),t.addEventListener(i,e[i]);for(let t in i)i[t]=i[t].bind(this),window.addEventListener(t,i[t])}__removeListenEvents(){super.__removeListenEvents();const{viewEvents:t,windowEvents:e}=this;for(let e in t)this.view.removeEventListener(e,t[e]),this.viewEvents={};for(let t in e)window.removeEventListener(t,e[t]),this.windowEvents={}}getTouches(t){const e=[];for(let i=0,n=t.length;i<n;i++)e.push(t[i]);return e}preventDefaultPointer(t){const{pointer:e}=this.config;e.preventDefault&&t.preventDefault()}preventDefaultWheel(t){const{wheel:e}=this.config;e.preventDefault&&t.preventDefault()}preventWindowPointer(t){return!this.downData&&t.target!==this.view}onKeyDown(t){this.keyDown(R.convert(t))}onKeyUp(t){this.keyUp(R.convert(t))}onContextMenu(t){this.config.pointer.preventDefaultMenu&&t.preventDefault(),this.menu(P.convert(t,this.getLocal(t)))}onScroll(){this.canvas.updateClientBounds()}onPointerDown(t){this.preventDefaultPointer(t),this.config.pointer.touch||this.useMultiTouch||(this.usePointer||(this.usePointer=!0),this.pointerDown(P.convert(t,this.getLocal(t))))}onPointerMove(t,e){if(this.config.pointer.touch||this.useMultiTouch||this.preventWindowPointer(t))return;this.usePointer||(this.usePointer=!0);const i=P.convert(t,this.getLocal(t,!0));e?this.pointerHover(i):this.pointerMove(i)}onPointerLeave(t){this.onPointerMove(t,!0)}onPointerUp(t){this.downData&&this.preventDefaultPointer(t),this.config.pointer.touch||this.useMultiTouch||this.preventWindowPointer(t)||this.pointerUp(P.convert(t,this.getLocal(t)))}onPointerCancel(){this.useMultiTouch||this.pointerCancel()}onMouseDown(t){this.preventDefaultPointer(t),this.useTouch||this.usePointer||this.pointerDown(P.convertMouse(t,this.getLocal(t)))}onMouseMove(t){this.useTouch||this.usePointer||this.preventWindowPointer(t)||this.pointerMove(P.convertMouse(t,this.getLocal(t,!0)))}onMouseUp(t){this.downData&&this.preventDefaultPointer(t),this.useTouch||this.usePointer||this.preventWindowPointer(t)||this.pointerUp(P.convertMouse(t,this.getLocal(t)))}onMouseCancel(){this.useTouch||this.usePointer||this.pointerCancel()}onTouchStart(t){const e=P.getTouch(t),i=this.getLocal(e,!0),{preventDefault:n}=this.config.touch;(!0===n||"auto"===n&&k(this.findPath(i)))&&t.preventDefault(),this.multiTouchStart(t),this.usePointer||(this.touchTimer&&(window.clearTimeout(this.touchTimer),this.touchTimer=0),this.useTouch=!0,this.pointerDown(P.convertTouch(t,i)))}onTouchMove(t){if(this.multiTouchMove(t),this.usePointer||this.preventWindowPointer(t))return;const e=P.getTouch(t);this.pointerMove(P.convertTouch(t,this.getLocal(e)))}onTouchEnd(t){if(this.multiTouchEnd(),this.usePointer||this.preventWindowPointer(t))return;this.touchTimer&&clearTimeout(this.touchTimer),this.touchTimer=setTimeout((()=>{this.useTouch=!1}),500);const e=P.getTouch(t);this.pointerUp(P.convertTouch(t,this.getLocal(e)))}onTouchCancel(){this.usePointer||this.pointerCancel()}multiTouchStart(t){this.useMultiTouch=t.touches.length>1,this.touches=this.useMultiTouch?this.getTouches(t.touches):void 0,this.useMultiTouch&&this.pointerCancel()}multiTouchMove(t){if(this.useMultiTouch&&t.touches.length>1){const i=this.getTouches(t.touches),n=this.getKeepTouchList(this.touches,i);n.length>1&&(this.multiTouch(e.InteractionHelper.getBase(t),n),this.touches=i)}}multiTouchEnd(){this.touches=null,this.useMultiTouch=!1,this.transformEnd()}getKeepTouchList(t,e){let i;const n=[];return t.forEach((t=>{i=e.find((e=>e.identifier===t.identifier)),i&&n.push({from:this.getLocal(t),to:this.getLocal(i)})})),n}getLocalTouchs(t){return t.map((t=>this.getLocal(t)))}onWheel(t){this.preventDefaultWheel(t),this.wheel(Object.assign(Object.assign(Object.assign({},e.InteractionHelper.getBase(t)),this.getLocal(t)),{deltaX:t.deltaX,deltaY:t.deltaY}))}onGesturestart(t){this.useMultiTouch||(this.preventDefaultWheel(t),this.lastGestureScale=1,this.lastGestureRotation=0)}onGesturechange(i){if(this.useMultiTouch)return;this.preventDefaultWheel(i);const n=e.InteractionHelper.getBase(i);Object.assign(n,this.getLocal(i));const s=i.scale/this.lastGestureScale,o=(i.rotation-this.lastGestureRotation)/Math.PI*180*(t.MathHelper.within(this.config.wheel.rotateSpeed,0,1)/4+.1);this.zoom(Object.assign(Object.assign({},n),{scale:s*s})),this.rotate(Object.assign(Object.assign({},n),{rotation:o})),this.lastGestureScale=i.scale,this.lastGestureRotation=i.rotation}onGestureend(t){this.useMultiTouch||(this.preventDefaultWheel(t),this.transformEnd())}setCursor(t){super.setCursor(t);const e=[];this.eachCursor(t,e),"object"==typeof e[e.length-1]&&e.push("default"),this.canvas.view.style.cursor=e.map((t=>"object"==typeof t?`url(${t.url}) ${t.x||0} ${t.y||0}`:t)).join(",")}eachCursor(t,i,n=0){if(n++,t instanceof Array)t.forEach((t=>this.eachCursor(t,i,n)));else{const s="string"==typeof t&&e.Cursor.get(t);s&&n<2?this.eachCursor(s,i,n):i.push(t)}}destroy(){this.view&&(super.destroy(),this.view=null,this.touches=null)}}function T(t,e){const i=t.__,{rows:n,decorationY:s}=i.__textDrawData;let o;i.__isPlacehold&&i.placeholderColor&&(e.fillStyle=i.placeholderColor);for(let t=0,i=n.length;t<i;t++)o=n[t],o.text?e.fillText(o.text,o.x,o.y):o.data&&o.data.forEach((t=>{e.fillText(t.char,t.x,o.y)}));if(s){const{decorationColor:t,decorationHeight:o}=i.__textDrawData;t&&(e.fillStyle=t),n.forEach((t=>s.forEach((i=>e.fillRect(t.x,t.y+i,t.width,o)))))}}function M(t,e){t.__.__font?T(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function S(t,e,i){const{strokeAlign:n}=e.__,s="string"!=typeof t;switch(n){case"center":i.setStroke(s?void 0:t,e.__.strokeWidth,e.__),s?D(t,!0,e,i):O(e,i);break;case"inside":A("inside",t,s,e,i);break;case"outside":A("outside",t,s,e,i)}}function A(t,e,i,n,s){const{__strokeWidth:o,__font:r}=n.__,a=s.getSameCanvas(!0,!0);a.setStroke(i?void 0:e,2*o,n.__),a.font=r,i?D(e,!0,n,a):O(n,a),a.blendMode="outside"===t?"destination-out":"destination-in",T(n,a),a.blendMode="normal",n.__worldFlipped?s.copyWorldByReset(a,n.__nowWorld):s.copyWorldToInner(a,n.__nowWorld,n.__layout.renderBounds),a.recycle(n.__nowWorld)}function O(t,e){let i,n=t.__.__textDrawData;const{rows:s,decorationY:o}=n;for(let t=0,n=s.length;t<n;t++)i=s[t],i.text?e.strokeText(i.text,i.x,i.y):i.data&&i.data.forEach((t=>{e.strokeText(t.char,t.x,i.y)}));if(o){const{decorationHeight:t}=n;s.forEach((i=>o.forEach((n=>e.strokeRect(i.x,i.y+n,i.width,t)))))}}function D(t,e,n,s){let o;for(let r=0,a=t.length;r<a;r++)o=t[r],o.image&&i.PaintImage.checkImage(n,s,o,!1)||o.style&&(s.strokeStyle=o.style,o.blendMode?(s.saveBlendMode(o.blendMode),e?O(n,s):s.stroke(),s.restoreBlendMode()):e?O(n,s):s.stroke())}function W(t,e){t.__.dashPattern&&(e.beginPath(),t.__drawPathByData(e,t.__.__pathForArrow),e.dashPattern=null,e.stroke())}const{getSpread:I,getOuterOf:H,getByMove:z,getIntersectData:j}=t.BoundsHelper;let F;function G(t,e,n){if("object"!=typeof e||!1===e.visible||0===e.opacity)return;const{boxBounds:s}=n.__layout;switch(e.type){case"solid":let{type:o,blendMode:r,color:a,opacity:h}=e;return{type:o,blendMode:r,style:i.ColorConvert.string(a,h)};case"image":return i.PaintImage.image(n,t,e,s,!F||!F[e.url]);case"linear":return i.PaintGradient.linearGradient(e,s);case"radial":return i.PaintGradient.radialGradient(e,s);case"angular":return i.PaintGradient.conicGradient(e,s);default:return void 0!==e.r?{type:"solid",style:i.ColorConvert.string(e)}:void 0}}const U={compute:function(t,e){const n=e.__,s=[];let o,r=n.__input[t];r instanceof Array||(r=[r]),F=i.PaintImage.recycleImage(t,n);for(let i,n=0,o=r.length;n<o;n++)i=G(t,r[n],e),i&&s.push(i);n["_"+t]=s.length?s:void 0,s.length&&s[0].image&&(o=s[0].image.hasOpacityPixel),"fill"===t?n.__pixelFill=o:n.__pixelStroke=o},fill:function(t,e,i){i.fillStyle=t,M(e,i)},fills:function(t,e,n){let s;for(let o=0,r=t.length;o<r;o++){if(s=t[o],s.image){if(i.PaintImage.checkImage(e,n,s,!e.__.__font))continue;if(!s.style){!o&&s.image.isPlacehold&&e.drawImagePlaceholder(n,s.image);continue}}n.fillStyle=s.style,s.transform?(n.save(),n.transform(s.transform),s.blendMode&&(n.blendMode=s.blendMode),M(e,n),n.restore()):s.blendMode?(n.saveBlendMode(s.blendMode),M(e,n),n.restoreBlendMode()):M(e,n)}},fillPathOrText:M,fillText:T,stroke:function(t,e,i){const n=e.__,{__strokeWidth:s,strokeAlign:o,__font:r}=n;if(s)if(r)S(t,e,i);else switch(o){case"center":i.setStroke(t,s,n),i.stroke(),n.__useArrow&&W(e,i);break;case"inside":i.save(),i.setStroke(t,2*s,n),n.windingRule?i.clip(n.windingRule):i.clip(),i.stroke(),i.restore();break;case"outside":const o=i.getSameCanvas(!0,!0);o.setStroke(t,2*s,n),e.__drawRenderPath(o),o.stroke(),n.windingRule?o.clip(n.windingRule):o.clip(),o.clearWorld(e.__layout.renderBounds),e.__worldFlipped?i.copyWorldByReset(o,e.__nowWorld):i.copyWorldToInner(o,e.__nowWorld,e.__layout.renderBounds),o.recycle(e.__nowWorld)}},strokes:function(t,e,i){const n=e.__,{__strokeWidth:s,strokeAlign:o,__font:r}=n;if(s)if(r)S(t,e,i);else switch(o){case"center":i.setStroke(void 0,s,n),D(t,!1,e,i),n.__useArrow&&W(e,i);break;case"inside":i.save(),i.setStroke(void 0,2*s,n),n.windingRule?i.clip(n.windingRule):i.clip(),D(t,!1,e,i),i.restore();break;case"outside":const{renderBounds:o}=e.__layout,r=i.getSameCanvas(!0,!0);e.__drawRenderPath(r),r.setStroke(void 0,2*s,n),D(t,!1,e,r),n.windingRule?r.clip(n.windingRule):r.clip(),r.clearWorld(o),e.__worldFlipped?i.copyWorldByReset(r,e.__nowWorld):i.copyWorldToInner(r,e.__nowWorld,o),r.recycle(e.__nowWorld)}},strokeText:S,drawTextStroke:O,shape:function(t,e,i){const n=e.getSameCanvas(),s=t.__nowWorld;let o,r,a,h,{scaleX:l,scaleY:c}=s;if(l<0&&(l=-l),c<0&&(c=-c),e.bounds.includes(s))h=n,o=a=s;else{const{renderShapeSpread:n}=t.__layout,d=j(n?I(e.bounds,l===c?n*l:[n*c,n*l]):e.bounds,s);r=e.bounds.getFitMatrix(d);let{a:u,d:p}=r;if(r.a<1&&(h=e.getSameCanvas(),t.__renderShape(h,i),l*=u,c*=p),a=H(s,r),o=z(a,-r.e,-r.f),i.matrix){const{matrix:t}=i;r.multiply(t),u*=t.scaleX,p*=t.scaleY}i=Object.assign(Object.assign({},i),{matrix:r.withScale(u,p)})}return t.__renderShape(n,i),{canvas:n,matrix:r,bounds:o,worldCanvas:h,shapeBounds:a,scaleX:l,scaleY:c}}};let Y={};const{get:V,rotateOfOuter:X,translate:N,scaleOfOuter:q,scale:K,rotate:Q}=t.MatrixHelper;function $(t,e,i,n,s,o,r){const a=V();N(a,e.x+i,e.y+n),K(a,s,o),r&&X(a,{x:e.x+e.width/2,y:e.y+e.height/2},r),t.transform=a}function Z(t,e,i,n,s,o,r){const a=V();N(a,e.x+i,e.y+n),s&&K(a,s,o),r&&Q(a,r),t.transform=a}function J(t,e,i,n,s,o,r,a,h,l){const c=V();if(h)if("center"===l)X(c,{x:i/2,y:n/2},h);else switch(Q(c,h),h){case 90:N(c,n,0);break;case 180:N(c,i,n);break;case 270:N(c,0,i)}Y.x=e.x+s,Y.y=e.y+o,N(c,Y.x,Y.y),r&&q(c,Y,r,a),t.transform=c}const{get:tt,translate:et}=t.MatrixHelper,it=new t.Bounds,nt={},st={};function ot(t,e,i,n){const{blendMode:s,changeful:o,sync:r}=i;s&&(t.blendMode=s),o&&(t.changeful=o),r&&(t.sync=r),t.data=rt(i,n,e)}function rt(e,i,n){let{width:s,height:o}=n;e.padding&&(i=it.set(i).shrink(e.padding)),"strench"===e.mode&&(e.mode="stretch");const{opacity:r,mode:a,align:h,offset:l,scale:c,size:d,rotation:u,repeat:p,filters:f}=e,g=i.width===s&&i.height===o,_={mode:a},w="center"!==h&&(u||0)%180==90,v=w?o:s,m=w?s:o;let y,b,x=0,E=0;if(a&&"cover"!==a&&"fit"!==a)(c||d)&&(t.MathHelper.getScaleData(c,d,n,st),y=st.scaleX,b=st.scaleY);else if(!g||u){const t=i.width/v,e=i.height/m;y=b="fit"===a?Math.min(t,e):Math.max(t,e),x+=(i.width-s*y)/2,E+=(i.height-o*b)/2}if(h){const e={x:x,y:E,width:v,height:m};y&&(e.width*=y,e.height*=b),t.AlignHelper.toPoint(h,e,i,nt,!0),x+=nt.x,E+=nt.y}switch(l&&(x+=l.x,E+=l.y),a){case"stretch":g||(s=i.width,o=i.height);break;case"normal":case"clip":(x||E||y||u)&&Z(_,i,x,E,y,b,u);break;case"repeat":(!g||y||u)&&J(_,i,s,o,x,E,y,b,u,h),p||(_.repeat="repeat");break;default:y&&$(_,i,x,E,y,b,u)}return _.transform||(i.x||i.y)&&(_.transform=tt(),et(_.transform,i.x,i.y)),y&&"stretch"!==a&&(_.scaleX=y,_.scaleY=b),_.width=s,_.height=o,r&&(_.opacity=r),f&&(_.filters=f),p&&(_.repeat="string"==typeof p?"x"===p?"repeat-x":"repeat-y":"repeat"),_}let at,ht=new t.Bounds;const{isSame:lt}=t.BoundsHelper;function ct(t,e,i,n,s,o){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=n.width/e.pixelRatio,e.__naturalHeight=n.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return s.data||ot(s,n,i,o),!0}function dt(e,i){ft(e,t.ImageEvent.LOAD,i)}function ut(e,i){ft(e,t.ImageEvent.LOADED,i)}function pt(e,i,n){i.error=n,e.forceUpdate("surface"),ft(e,t.ImageEvent.ERROR,i)}function ft(e,i,n){e.hasEvent(i)&&e.emitEvent(new t.ImageEvent(i,n))}function gt(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:_t,scale:wt,copy:vt}=t.MatrixHelper,{ceil:mt,abs:yt}=Math;function bt(e,i,n){let{scaleX:s,scaleY:o}=t.ImageManager.patternLocked?e.__world:e.__nowWorld;const r=s+"-"+o+"-"+n;if(i.patternId===r||e.destroyed)return!1;{s=yt(s),o=yt(o);const{image:e,data:a}=i;let h,l,{width:c,height:d,scaleX:u,scaleY:p,transform:f,repeat:g}=a;u&&(l=_t(),vt(l,f),wt(l,1/u,1/p),s*=u,o*=p),s*=n,o*=n,c*=s,d*=o;const _=c*d;if(!g&&_>t.Platform.image.maxCacheSize)return!1;let w=t.Platform.image.maxPatternSize;if(!e.isSVG){const t=e.width*e.height;w>t&&(w=t)}_>w&&(h=Math.sqrt(_/w)),h&&(s/=h,o/=h,c/=h,d/=h),u&&(s/=u,o/=p),(f||1!==s||1!==o)&&(l||(l=_t(),f&&vt(l,f)),wt(l,1/s,1/o));const v=e.getCanvas(mt(c)||1,mt(d)||1,a.opacity,a.filters),m=e.getPattern(v,g||t.Platform.origin.noRepeat||"no-repeat",l,i);return i.style=m,i.patternId=r,!0}}function xt(t,e,i,n){return new(i||(i=Promise))((function(s,o){function r(t){try{h(n.next(t))}catch(t){o(t)}}function a(t){try{h(n.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(r,a)}h((n=n.apply(t,e||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const{abs:Et}=Math;const Lt={image:function(e,i,n,s,o){let r,a;const h=t.ImageManager.get(n);return at&&n===at.paint&<(s,at.boxBounds)?r=at.leafPaint:(r={type:n.type,image:h},at=h.use>1?{leafPaint:r,paint:n,boxBounds:ht.set(s)}:null),(o||h.loading)&&(a={image:h,attrName:i,attrValue:n}),h.ready?(ct(e,i,n,h,r,s),o&&(dt(e,a),ut(e,a))):h.error?o&&pt(e,a,h.error):(o&&(gt(e,!0),dt(e,a)),r.loadId=h.load((()=>{gt(e,!1),e.destroyed||(ct(e,i,n,h,r,s)&&(h.hasOpacityPixel&&(e.__layout.hitCanvasChanged=!0),e.forceUpdate("surface")),ut(e,a)),r.loadId=null}),(t=>{gt(e,!1),pt(e,a,t),r.loadId=null})),e.placeholderColor&&setTimeout((()=>{h.ready||h.isPlacehold||(h.isPlacehold=!0,e.forceUpdate("surface"))}),100)),r},checkImage:function(e,n,s,o){const{scaleX:r,scaleY:a}=t.ImageManager.patternLocked?e.__world:e.__nowWorld,{pixelRatio:h}=n,{data:l}=s;if(!l||s.patternId===r+"-"+a+"-"+h&&!i.Export.running)return!1;if(o)if(l.repeat)o=!1;else if(!(s.changeful||t.ResizeEvent.isResizing(e)||i.Export.running)){let{width:e,height:i}=l;e*=Et(r)*h,i*=Et(a)*h,l.scaleX&&(e*=l.scaleX,i*=l.scaleY),o=e*i>t.Platform.image.maxCacheSize}return o?(function(t,e,i,n){e.save(),t.windingRule?e.clip(t.windingRule):e.clip(),i.blendMode&&(e.blendMode=i.blendMode);n.opacity&&(e.opacity*=n.opacity);n.transform&&e.transform(n.transform);e.drawImage(i.image.getFull(n.filters),0,0,n.width,n.height),e.restore()}(e,n,s,l),!0):(!s.style||s.sync||i.Export.running?bt(e,s,h):s.patternTask||(s.patternTask=t.ImageManager.patternTasker.add((()=>xt(this,void 0,void 0,(function*(){s.patternTask=null,n.bounds.hit(e.__nowWorld)&&bt(e,s,h),e.forceUpdate("surface")}))),300)),!1)},createPattern:bt,recycleImage:function(e,i){const n=i["_"+e];if(n instanceof Array){let s,o,r,a,h;for(let l=0,c=n.length;l<c;l++)s=n[l],o=s.image,h=o&&o.url,h&&(r||(r={}),r[h]=!0,t.ImageManager.recycle(o),o.loading&&(a||(a=i.__input&&i.__input[e]||[],a instanceof Array||(a=[a])),o.unload(n[l].loadId,!a.some((t=>t.url===h)))));return r}return null},createData:ot,getPatternData:rt,fillOrFitMode:$,clipMode:Z,repeatMode:J},{toPoint:Bt}=t.AroundHelper,Pt={},Rt={};function kt(t,e,n){if(e){let s;for(let o=0,r=e.length;o<r;o++)s=e[o],"string"==typeof s?t.addColorStop(o/(r-1),i.ColorConvert.string(s,n)):t.addColorStop(s.offset,i.ColorConvert.string(s.color,n))}}const{getAngle:Ct,getDistance:Tt}=t.PointHelper,{get:Mt,rotateOfOuter:St,scaleOfOuter:At}=t.MatrixHelper,{toPoint:Ot}=t.AroundHelper,Dt={},Wt={};function It(t,e,i,n,s){let o;const{width:r,height:a}=t;if(r!==a||n){const t=Ct(e,i);o=Mt(),s?(At(o,e,r/a*(n||1),1),St(o,e,t+90)):(At(o,e,1,r/a*(n||1)),St(o,e,t))}return o}const{getDistance:Ht}=t.PointHelper,{toPoint:zt}=t.AroundHelper,jt={},Ft={};const Gt={linearGradient:function(e,i){let{from:n,to:s,type:o,blendMode:r,opacity:a}=e;Bt(n||"top",i,Pt),Bt(s||"bottom",i,Rt);const h=t.Platform.canvas.createLinearGradient(Pt.x,Pt.y,Rt.x,Rt.y);kt(h,e.stops,a);const l={type:o,style:h};return r&&(l.blendMode=r),l},radialGradient:function(e,i){let{from:n,to:s,type:o,opacity:r,blendMode:a,stretch:h}=e;Ot(n||"center",i,Dt),Ot(s||"bottom",i,Wt);const l=t.Platform.canvas.createRadialGradient(Dt.x,Dt.y,0,Dt.x,Dt.y,Tt(Dt,Wt));kt(l,e.stops,r);const c={type:o,style:l},d=It(i,Dt,Wt,h,!0);return d&&(c.transform=d),a&&(c.blendMode=a),c},conicGradient:function(e,i){let{from:n,to:s,type:o,opacity:r,blendMode:a,stretch:h}=e;zt(n||"center",i,jt),zt(s||"bottom",i,Ft);const l=t.Platform.conicGradientSupport?t.Platform.canvas.createConicGradient(0,jt.x,jt.y):t.Platform.canvas.createRadialGradient(jt.x,jt.y,0,jt.x,jt.y,Ht(jt,Ft));kt(l,e.stops,r);const c={type:o,style:l},d=It(i,jt,Ft,h||1,t.Platform.conicGradientRotate90);return d&&(c.transform=d),a&&(c.blendMode=a),c},getTransform:It},{copy:Ut,toOffsetOutBounds:Yt}=t.BoundsHelper,Vt={},Xt={};function Nt(e,i,n,s){const{bounds:o,shapeBounds:r}=s;if(t.Platform.fullImageShadow){if(Ut(Vt,e.bounds),Vt.x+=i.x-r.x,Vt.y+=i.y-r.y,n){const{matrix:t}=s;Vt.x-=(o.x+(t?t.e:0)+o.width/2)*(n-1),Vt.y-=(o.y+(t?t.f:0)+o.height/2)*(n-1),Vt.width*=n,Vt.height*=n}e.copyWorld(s.canvas,e.bounds,Vt)}else n&&(Ut(Vt,i),Vt.x-=i.width/2*(n-1),Vt.y-=i.height/2*(n-1),Vt.width*=n,Vt.height*=n),e.copyWorld(s.canvas,r,n?Vt:i)}const{toOffsetOutBounds:qt}=t.BoundsHelper,Kt={};const Qt={shadow:function(t,e,n){let s,o;const{__nowWorld:r,__layout:a}=t,{shadow:h}=t.__,{worldCanvas:l,bounds:c,shapeBounds:d,scaleX:u,scaleY:p}=n,f=e.getSameCanvas(),g=h.length-1;Yt(c,Xt),h.forEach(((h,_)=>{f.setWorldShadow(Xt.offsetX+h.x*u,Xt.offsetY+h.y*p,h.blur*u,i.ColorConvert.string(h.color)),o=h.spread?1+2*h.spread/(a.boxBounds.width+2*(a.strokeBoxSpread||0)):0,Nt(f,Xt,o,n),s=c,h.box&&(f.restore(),f.save(),l&&(f.copyWorld(f,c,r,"copy"),s=r),l?f.copyWorld(l,r,r,"destination-out"):f.copyWorld(n.canvas,d,c,"destination-out")),t.__worldFlipped?e.copyWorldByReset(f,s,r,h.blendMode):e.copyWorldToInner(f,s,a.renderBounds,h.blendMode),g&&_<g&&f.clearWorld(s,!0)})),f.recycle(s)},innerShadow:function(t,e,n){let s,o;const{__nowWorld:r,__layout:a}=t,{innerShadow:h}=t.__,{worldCanvas:l,bounds:c,shapeBounds:d,scaleX:u,scaleY:p}=n,f=e.getSameCanvas(),g=h.length-1;qt(c,Kt),h.forEach(((h,_)=>{f.save(),f.setWorldShadow(Kt.offsetX+h.x*u,Kt.offsetY+h.y*p,h.blur*u),o=h.spread?1-2*h.spread/(a.boxBounds.width+2*(a.strokeBoxSpread||0)):0,Nt(f,Kt,o,n),f.restore(),l?(f.copyWorld(f,c,r,"copy"),f.copyWorld(l,r,r,"source-out"),s=r):(f.copyWorld(n.canvas,d,c,"source-out"),s=c),f.fillWorld(s,i.ColorConvert.string(h.color),"source-in"),t.__worldFlipped?e.copyWorldByReset(f,s,r,h.blendMode):e.copyWorldToInner(f,s,a.renderBounds,h.blendMode),g&&_<g&&f.clearWorld(s,!0)})),f.recycle(s)},blur:function(t,e,i){const{blur:n}=t.__;i.setWorldBlur(n*t.__nowWorld.a),i.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),i.filter="none"},backgroundBlur:function(t,e,i){}},{excludeRenderBounds:$t}=t.LeafBoundsHelper;function Zt(t,e,i,n,s,o){switch(e){case"grayscale":s.useGrayscaleAlpha(t.__nowWorld);case"alpha":!function(t,e,i,n){const s=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(n,s),n.recycle(s),te(t,e,i,1)}(t,i,n,s);break;case"opacity-path":te(t,i,n,o);break;case"path":i.restore()}}function Jt(t){return t.getSameCanvas(!1,!0)}function te(t,e,i,n){const s=t.__nowWorld;e.resetTransform(),e.opacity=n,e.copyWorld(i,s),i.recycle(s)}i.Group.prototype.__renderMask=function(t,e){let i,n,s,o,r,a;const{children:h}=this;for(let l=0,c=h.length;l<c;l++)i=h[l],a=i.__.mask,a&&(r&&(Zt(this,r,t,s,n,o),n=s=null),"path"===a||"clipping-path"===a?(i.opacity<1?(r="opacity-path",o=i.opacity,s||(s=Jt(t))):(r="path",t.save()),i.__clip(s||t,e)):(r="grayscale"===a?"grayscale":"alpha",n||(n=Jt(t)),s||(s=Jt(t)),i.__render(n,e)),"clipping"!==a&&"clipping-path"!==a)||$t(i,e)||i.__render(s||t,e);Zt(this,r,t,s,n,o)};const ee=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",ie=ee+"_#~&*+\\=|≮≯≈≠=…",ne=new RegExp([[19968,40959],[13312,19903],[131072,173791],[173824,177983],[177984,178207],[178208,183983],[183984,191471],[196608,201551],[201552,205743],[11904,12031],[12032,12255],[12272,12287],[12288,12351],[12736,12783],[12800,13055],[13056,13311],[63744,64255],[65072,65103],[127488,127743],[194560,195103]].map((([t,e])=>`[\\u${t.toString(16)}-\\u${e.toString(16)}]`)).join("|"));function se(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const oe=se("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),re=se("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),ae=se(ee),he=se(ie),le=se("- —/~|┆·");var ce;!function(t){t[t.Letter=0]="Letter",t[t.Single=1]="Single",t[t.Before=2]="Before",t[t.After=3]="After",t[t.Symbol=4]="Symbol",t[t.Break=5]="Break"}(ce||(ce={}));const{Letter:de,Single:ue,Before:pe,After:fe,Symbol:ge,Break:_e}=ce;function we(t){return oe[t]?de:le[t]?_e:re[t]?pe:ae[t]?fe:he[t]?ge:ne.test(t)?ue:de}const ve={trimRight(t){const{words:e}=t;let i,n=0,s=e.length;for(let o=s-1;o>-1&&(i=e[o].data[0]," "===i.char);o--)n++,t.width-=i.width;n&&e.splice(s-n,n)}};function me(t,e,i){switch(e){case"title":return i?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:ye}=ve,{Letter:be,Single:xe,Before:Ee,After:Le,Symbol:Be,Break:Pe}=ce;let Re,ke,Ce,Te,Me,Se,Ae,Oe,De,We,Ie,He,ze,je,Fe,Ge,Ue,Ye=[];function Ve(t,e){De&&!Oe&&(Oe=De),Re.data.push({char:t,width:e}),Ce+=e}function Xe(){Te+=Ce,Re.width=Ce,ke.words.push(Re),Re={data:[]},Ce=0}function Ne(){je&&(Fe.paraNumber++,ke.paraStart=!0,je=!1),De&&(ke.startCharSize=Oe,ke.endCharSize=De,Oe=0),ke.width=Te,Ge.width?ye(ke):Ue&&qe(),Ye.push(ke),ke={words:[]},Te=0}function qe(){Te>(Fe.maxWidth||0)&&(Fe.maxWidth=Te)}const{top:Ke,right:Qe,bottom:$e,left:Ze}=t.Direction4;function Je(t,e,i){const{bounds:n,rows:s}=t;n[e]+=i;for(let t=0;t<s.length;t++)s[t][e]+=i}const ti={getDrawData:function(e,n){"string"!=typeof e&&(e=String(e));let s=0,o=0,r=n.__getInput("width")||0,a=n.__getInput("height")||0;const{textDecoration:h,__font:l,__padding:c}=n;c&&(r?(s=c[Ze],r-=c[Qe]+c[Ze]):n.autoSizeAlign||(s=c[Ze]),a?(o=c[Ke],a-=c[Ke]+c[$e]):n.autoSizeAlign||(o=c[Ke]));const d={bounds:{x:s,y:o,width:r,height:a},rows:[],paraNumber:0,font:t.Platform.canvas.font=l};return function(e,i,n){Fe=e,Ye=e.rows,Ge=e.bounds,Ue=!Ge.width&&!n.autoSizeAlign;const{__letterSpacing:s,paraIndent:o,textCase:r}=n,{canvas:a}=t.Platform,{width:h,height:l}=Ge;if(h||l||s||"none"!==r){const t="none"!==n.textWrap,e="break"===n.textWrap;je=!0,Ie=null,Oe=Ae=De=Ce=Te=0,Re={data:[]},ke={words:[]};for(let n=0,l=i.length;n<l;n++)Se=i[n],"\n"===Se?(Ce&&Xe(),ke.paraEnd=!0,Ne(),je=!0):(We=we(Se),We===be&&"none"!==r&&(Se=me(Se,r,!Ce)),Ae=a.measureText(Se).width,s&&(s<0&&(De=Ae),Ae+=s),He=We===xe&&(Ie===xe||Ie===be)||Ie===xe&&We!==Le,ze=!(We!==Ee&&We!==xe||Ie!==Be&&Ie!==Le),Me=je&&o?h-o:h,t&&h&&Te+Ce+Ae>Me&&(e?(Ce&&Xe(),Te&&Ne()):(ze||(ze=We===be&&Ie==Le),He||ze||We===Pe||We===Ee||We===xe||Ce+Ae>Me?(Ce&&Xe(),Te&&Ne()):Te&&Ne()))," "===Se&&!0!==je&&Te+Ce===0||(We===Pe?(" "===Se&&Ce&&Xe(),Ve(Se,Ae),Xe()):He||ze?(Ce&&Xe(),Ve(Se,Ae)):Ve(Se,Ae)),Ie=We);Ce&&Xe(),Te&&Ne(),Ye.length>0&&(Ye[Ye.length-1].paraEnd=!0)}else i.split("\n").forEach((t=>{Fe.paraNumber++,Te=a.measureText(t).width,Ye.push({x:o||0,text:t,width:Te,paraStart:!0}),Ue&&qe()}))}(d,e,n),c&&function(t,e,i,n,s){if(!n&&i.autoSizeAlign)switch(i.textAlign){case"left":Je(e,"x",t[Ze]);break;case"right":Je(e,"x",-t[Qe])}if(!s&&i.autoSizeAlign)switch(i.verticalAlign){case"top":Je(e,"y",t[Ke]);break;case"bottom":Je(e,"y",-t[$e])}}(c,d,n,r,a),function(t,e){const{rows:i,bounds:n}=t,s=i.length,{__lineHeight:o,__baseLine:r,__letterSpacing:a,__clipText:h,textAlign:l,verticalAlign:c,paraSpacing:d,autoSizeAlign:u}=e;let{x:p,y:f,width:g,height:_}=n,w=o*s+(d?d*(t.paraNumber-1):0),v=r;if(h&&w>_)w=Math.max(_,o),s>1&&(t.overflow=s);else if(_||u)switch(c){case"middle":f+=(_-w)/2;break;case"bottom":f+=_-w}v+=f;let m,y,b,x=g||u?g:t.maxWidth;for(let r=0,c=s;r<c;r++){if(m=i[r],m.x=p,m.width<g||m.width>g&&!h)switch(l){case"center":m.x+=(x-m.width)/2;break;case"right":m.x+=x-m.width}m.paraStart&&d&&r>0&&(v+=d),m.y=v,v+=o,t.overflow>r&&v>w&&(m.isOverflow=!0,t.overflow=r+1),y=m.x,b=m.width,a<0&&(m.width<0?(b=-m.width+e.fontSize+a,y-=b,b+=e.fontSize):b-=a),y<n.x&&(n.x=y),b>n.width&&(n.width=b),h&&g&&g<b&&(m.isOverflow=!0,t.overflow||(t.overflow=i.length))}n.y=f,n.height=w}(d,n),function(t,e,i){const{rows:n}=t,{textAlign:s,paraIndent:o,letterSpacing:r}=e;let a,h,l,c,d,u;n.forEach((t=>{t.words&&(l=o&&t.paraStart?o:0,u=t.words.length,h=i&&("justify"===s||"both"===s)&&u>1?(i-t.width-l)/(u-1):0,c=r||t.isOverflow?0:h>.01?1:2,t.isOverflow&&!r&&(t.textMode=!0),2===c?(t.x+=l,function(t){t.text="",t.words.forEach((e=>{e.data.forEach((e=>{t.text+=e.char}))}))}(t)):(t.x+=l,a=t.x,t.data=[],t.words.forEach(((e,i)=>{1===c?(d={char:"",x:a},a=function(t,e,i){return t.forEach((t=>{i.char+=t.char,e+=t.width})),e}(e.data,a,d),(t.isOverflow||" "!==d.char)&&t.data.push(d)):a=function(t,e,i,n){return t.forEach((t=>{(n||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width})),e}(e.data,a,t.data,t.isOverflow),!h||t.paraEnd&&"both"!==s||i===u-1||(a+=h,t.width+=h)}))),t.words=null)}))}(d,n,r),d.overflow&&function(e,i,n,s){if(!s)return;const{rows:o,overflow:r}=e;let{textOverflow:a}=i;if(o.splice(r),a&&"show"!==a){let e,h;"hide"===a?a="":"ellipsis"===a&&(a="...");const l=a?t.Platform.canvas.measureText(a).width:0,c=n+s-l;("none"===i.textWrap?o:[o[r-1]]).forEach((t=>{if(t.isOverflow&&t.data){let i=t.data.length-1;for(let n=i;n>-1&&(e=t.data[n],h=e.x+e.width,!(n===i&&h<c));n--){if(h<c&&" "!==e.char||!n){t.data.splice(n+1),t.width-=e.width;break}t.width-=e.width}t.width+=l,t.data.push({char:a,x:h}),t.textMode&&function(t){t.text="",t.data.forEach((e=>{t.text+=e.char})),t.data=null}(t)}}))}}(d,n,s,r),"none"!==h&&function(t,e){let n;const{fontSize:s,textDecoration:o}=e;switch(t.decorationHeight=s/11,"object"==typeof o?(n=o.type,o.color&&(t.decorationColor=i.ColorConvert.string(o.color))):n=o,n){case"under":t.decorationY=[.15*s];break;case"delete":t.decorationY=[.35*-s];break;case"under-delete":t.decorationY=[.15*s,.35*-s]}}(d,n),d}};const ei={string:function(t,e){const n="number"==typeof e&&1!==e;if("string"==typeof t){if(!n||!i.ColorConvert.object)return t;t=i.ColorConvert.object(t)}let s=void 0===t.a?1:t.a;n&&(s*=e);const o=t.r+","+t.g+","+t.b;return 1===s?"rgb("+o+")":"rgba("+o+","+s+")"}};Object.assign(i.TextConvert,ti),Object.assign(i.ColorConvert,ei),Object.assign(i.Paint,U),Object.assign(i.PaintImage,Lt),Object.assign(i.PaintGradient,Gt),Object.assign(i.Effect,Qt),Object.assign(t.Creator,{interaction:(t,e,i,n)=>new C(t,e,i,n),hitCanvas:(t,e)=>new s(t,e),hitCanvasManager:()=>new e.HitCanvasManager}),a(),Object.defineProperty(exports,"LeaferImage",{enumerable:!0,get:function(){return t.LeaferImage}}),exports.Interaction=C,exports.Layouter=y,exports.LeaferCanvas=s,exports.Picker=L,exports.Renderer=x,exports.Selector=B,exports.Watcher=l,exports.useCanvas=a,Object.keys(t).forEach((function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}})})),Object.keys(e).forEach((function(t){"default"===t||Object.prototype.hasOwnProperty.call(exports,t)||Object.defineProperty(exports,t,{enumerable:!0,get:function(){return e[t]}})}));
|
|
2
2
|
//# sourceMappingURL=web.min.cjs.map
|