leafer-draw 1.9.6 → 1.9.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/web.cjs +10 -1
- package/dist/web.esm.js +10 -1
- package/dist/web.esm.min.js +1 -1
- package/dist/web.esm.min.js.map +1 -1
- package/dist/web.js +45 -14
- 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 +47 -15
- package/dist/web.module.min.js +1 -1
- package/dist/web.module.min.js.map +1 -1
- package/package.json +3 -3
package/dist/web.js
CHANGED
|
@@ -392,6 +392,15 @@ var LeaferUI = function(exports) {
|
|
|
392
392
|
t.c *= scaleY;
|
|
393
393
|
t.d *= scaleY;
|
|
394
394
|
},
|
|
395
|
+
pixelScale(t, pixelRatio, to) {
|
|
396
|
+
to || (to = t);
|
|
397
|
+
to.a = t.a * pixelRatio;
|
|
398
|
+
to.b = t.b * pixelRatio;
|
|
399
|
+
to.c = t.c * pixelRatio;
|
|
400
|
+
to.d = t.d * pixelRatio;
|
|
401
|
+
to.e = t.e * pixelRatio;
|
|
402
|
+
to.f = t.f * pixelRatio;
|
|
403
|
+
},
|
|
395
404
|
scaleOfOuter(t, origin, scaleX, scaleY) {
|
|
396
405
|
M$6.toInnerPoint(t, origin, tempPoint$3);
|
|
397
406
|
M$6.scaleOfInner(t, tempPoint$3, scaleX, scaleY);
|
|
@@ -882,6 +891,10 @@ var LeaferUI = function(exports) {
|
|
|
882
891
|
this.scaleY *= y || x;
|
|
883
892
|
return this;
|
|
884
893
|
}
|
|
894
|
+
pixelScale(pixelRatio) {
|
|
895
|
+
MatrixHelper.pixelScale(this, pixelRatio);
|
|
896
|
+
return this;
|
|
897
|
+
}
|
|
885
898
|
scaleOfOuter(origin, x, y) {
|
|
886
899
|
MatrixHelper.scaleOfOuter(this, origin, x, y);
|
|
887
900
|
return this;
|
|
@@ -1991,7 +2004,7 @@ var LeaferUI = function(exports) {
|
|
|
1991
2004
|
__decorate([ contextMethod() ], Canvas.prototype, "fillText", null);
|
|
1992
2005
|
__decorate([ contextMethod() ], Canvas.prototype, "measureText", null);
|
|
1993
2006
|
__decorate([ contextMethod() ], Canvas.prototype, "strokeText", null);
|
|
1994
|
-
const {copy: copy$7, multiplyParent: multiplyParent$4} = MatrixHelper, {round: round$1} = Math, tempPixelBounds = new Bounds, tempPixelBounds2 = new Bounds;
|
|
2007
|
+
const {copy: copy$7, multiplyParent: multiplyParent$4, pixelScale: pixelScale} = MatrixHelper, {round: round$1} = Math, tempPixelBounds = new Bounds, tempPixelBounds2 = new Bounds;
|
|
1995
2008
|
const minSize = {
|
|
1996
2009
|
width: 1,
|
|
1997
2010
|
height: 1,
|
|
@@ -2089,12 +2102,7 @@ var LeaferUI = function(exports) {
|
|
|
2089
2102
|
setWorld(matrix, parentMatrix) {
|
|
2090
2103
|
const {pixelRatio: pixelRatio, pixelSnap: pixelSnap} = this, w = this.worldTransform;
|
|
2091
2104
|
if (parentMatrix) multiplyParent$4(matrix, parentMatrix, w);
|
|
2092
|
-
|
|
2093
|
-
w.b = matrix.b * pixelRatio;
|
|
2094
|
-
w.c = matrix.c * pixelRatio;
|
|
2095
|
-
w.d = matrix.d * pixelRatio;
|
|
2096
|
-
w.e = matrix.e * pixelRatio;
|
|
2097
|
-
w.f = matrix.f * pixelRatio;
|
|
2105
|
+
pixelScale(matrix, pixelRatio, w);
|
|
2098
2106
|
if (pixelSnap) {
|
|
2099
2107
|
if (matrix.half && matrix.half * pixelRatio % 2) w.e = round$1(w.e - .5) + .5, w.f = round$1(w.f - .5) + .5; else w.e = round$1(w.e),
|
|
2100
2108
|
w.f = round$1(w.f);
|
|
@@ -4008,6 +4016,17 @@ var LeaferUI = function(exports) {
|
|
|
4008
4016
|
}
|
|
4009
4017
|
}));
|
|
4010
4018
|
}
|
|
4019
|
+
function dimType(defaultValue) {
|
|
4020
|
+
return decorateLeafAttr(defaultValue, key => attr({
|
|
4021
|
+
set(value) {
|
|
4022
|
+
if (this.__setAttr(key, value)) {
|
|
4023
|
+
const data = this.__;
|
|
4024
|
+
DataHelper.stintSet(data, "__useDim", data.dim || data.bright || data.dimskip);
|
|
4025
|
+
this.__layout.surfaceChange();
|
|
4026
|
+
}
|
|
4027
|
+
}
|
|
4028
|
+
}));
|
|
4029
|
+
}
|
|
4011
4030
|
function opacityType(defaultValue) {
|
|
4012
4031
|
return decorateLeafAttr(defaultValue, key => attr({
|
|
4013
4032
|
set(value) {
|
|
@@ -4048,7 +4067,7 @@ var LeaferUI = function(exports) {
|
|
|
4048
4067
|
return decorateLeafAttr(defaultValue, key => attr({
|
|
4049
4068
|
set(value) {
|
|
4050
4069
|
if (this.__setAttr(key, value)) {
|
|
4051
|
-
this.__layout.
|
|
4070
|
+
this.__layout.surfaceChange();
|
|
4052
4071
|
this.waitParent(() => {
|
|
4053
4072
|
this.parent.__layout.childrenSortChange();
|
|
4054
4073
|
});
|
|
@@ -4082,7 +4101,7 @@ var LeaferUI = function(exports) {
|
|
|
4082
4101
|
set(value) {
|
|
4083
4102
|
if (this.__setAttr(key, value)) {
|
|
4084
4103
|
this.__layout.hitCanvasChanged = true;
|
|
4085
|
-
if (Debug.showBounds === "hit") this.__layout.
|
|
4104
|
+
if (Debug.showBounds === "hit") this.__layout.surfaceChange();
|
|
4086
4105
|
if (this.leafer) this.leafer.updateCursor();
|
|
4087
4106
|
}
|
|
4088
4107
|
}
|
|
@@ -5480,6 +5499,7 @@ var LeaferUI = function(exports) {
|
|
|
5480
5499
|
if (options.shape) return this.__renderShape(canvas, options);
|
|
5481
5500
|
if (this.__worldOpacity) {
|
|
5482
5501
|
const data = this.__;
|
|
5502
|
+
if (data.bright && !options.topRendering) return options.topList.add(this);
|
|
5483
5503
|
canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
|
|
5484
5504
|
canvas.opacity = options.dimOpacity && !data.dimskip ? data.opacity * options.dimOpacity : data.opacity;
|
|
5485
5505
|
if (this.__.__single) {
|
|
@@ -5526,7 +5546,9 @@ var LeaferUI = function(exports) {
|
|
|
5526
5546
|
this.__nowWorld = this.__getNowWorld(options);
|
|
5527
5547
|
if (this.__worldOpacity) {
|
|
5528
5548
|
const data = this.__;
|
|
5529
|
-
if (data.
|
|
5549
|
+
if (data.__useDim) {
|
|
5550
|
+
if (data.dim) options.dimOpacity = data.dim === true ? .2 : data.dim; else if (data.bright && !options.topRendering) return options.topList.add(this); else if (data.dimskip) options.dimOpacity && (options.dimOpacity = 0);
|
|
5551
|
+
}
|
|
5530
5552
|
if (data.__single && !this.isBranchLeaf) {
|
|
5531
5553
|
if (data.eraser === "path") return this.__renderEraser(canvas, options);
|
|
5532
5554
|
const tempCanvas = canvas.getSameCanvas(false, true);
|
|
@@ -6351,7 +6373,7 @@ var LeaferUI = function(exports) {
|
|
|
6351
6373
|
this.levelMap = null;
|
|
6352
6374
|
}
|
|
6353
6375
|
}
|
|
6354
|
-
const version = "1.9.
|
|
6376
|
+
const version = "1.9.7";
|
|
6355
6377
|
const debug$4 = Debug.get("LeaferCanvas");
|
|
6356
6378
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6357
6379
|
set zIndex(zIndex) {
|
|
@@ -7084,7 +7106,7 @@ var LeaferUI = function(exports) {
|
|
|
7084
7106
|
};
|
|
7085
7107
|
if (this.needFill) canvas.fillWorld(bounds, this.config.fill);
|
|
7086
7108
|
if (Debug.showRepaint) Debug.drawRepaint(canvas, bounds);
|
|
7087
|
-
this.target
|
|
7109
|
+
Platform.render(this.target, canvas, options);
|
|
7088
7110
|
this.renderBounds = realBounds = realBounds || bounds;
|
|
7089
7111
|
this.renderOptions = options;
|
|
7090
7112
|
this.totalBounds.isEmpty() ? this.totalBounds = realBounds : this.totalBounds.add(realBounds);
|
|
@@ -7173,6 +7195,14 @@ var LeaferUI = function(exports) {
|
|
|
7173
7195
|
interaction: (_target, _canvas, _selector, _options) => undefined
|
|
7174
7196
|
});
|
|
7175
7197
|
Platform.layout = Layouter.fullLayout;
|
|
7198
|
+
Platform.render = function(target, canvas, options) {
|
|
7199
|
+
const topOptions = Object.assign(Object.assign({}, options), {
|
|
7200
|
+
topRendering: true
|
|
7201
|
+
});
|
|
7202
|
+
options.topList = new LeafList;
|
|
7203
|
+
target.__render(canvas, options);
|
|
7204
|
+
if (options.topList.length) options.topList.forEach(item => item.__render(canvas, topOptions));
|
|
7205
|
+
};
|
|
7176
7206
|
function effectType(defaultValue) {
|
|
7177
7207
|
return decorateLeafAttr(defaultValue, key => attr({
|
|
7178
7208
|
set(value) {
|
|
@@ -7890,8 +7920,8 @@ var LeaferUI = function(exports) {
|
|
|
7890
7920
|
__decorate([ opacityType(1) ], exports.UI.prototype, "opacity", void 0);
|
|
7891
7921
|
__decorate([ visibleType(true) ], exports.UI.prototype, "visible", void 0);
|
|
7892
7922
|
__decorate([ surfaceType(false) ], exports.UI.prototype, "locked", void 0);
|
|
7893
|
-
__decorate([
|
|
7894
|
-
__decorate([
|
|
7923
|
+
__decorate([ dimType(false) ], exports.UI.prototype, "dim", void 0);
|
|
7924
|
+
__decorate([ dimType(false) ], exports.UI.prototype, "dimskip", void 0);
|
|
7895
7925
|
__decorate([ sortType(0) ], exports.UI.prototype, "zIndex", void 0);
|
|
7896
7926
|
__decorate([ maskType(false) ], exports.UI.prototype, "mask", void 0);
|
|
7897
7927
|
__decorate([ eraserType(false) ], exports.UI.prototype, "eraser", void 0);
|
|
@@ -10511,6 +10541,7 @@ var LeaferUI = function(exports) {
|
|
|
10511
10541
|
exports.defineDataProcessor = defineDataProcessor;
|
|
10512
10542
|
exports.defineKey = defineKey;
|
|
10513
10543
|
exports.defineLeafAttr = defineLeafAttr;
|
|
10544
|
+
exports.dimType = dimType;
|
|
10514
10545
|
exports.doBoundsType = doBoundsType;
|
|
10515
10546
|
exports.doStrokeType = doStrokeType;
|
|
10516
10547
|
exports.effectType = effectType;
|
package/dist/web.min.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var t=require("@leafer/core"),e=require("@leafer-ui/draw");const i=t.Debug.get("LeaferCanvas");class n 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(e){let n=t.isString(e)?document.getElementById(e):e;if(n)if(n instanceof HTMLCanvasElement)this.view=n;else{let t=n;if(n===window||n===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 e=this.view;t.hasChildNodes()&&(this.setAbsolute(e),t.style.position||(t.style.position="relative")),t.appendChild(e)}else i.error(`no id: ${e}`),this.__createView()}setAbsolute(t){const{style:e}=t;e.position="absolute",e.top=e.left="0px"}updateViewSize(){const{width:e,height:i,pixelRatio:n}=this,{style:s}=this.view;if(this.unreal){const{config:e,autoWidthStr:i,autoHeightStr:n}=this;e.width?(t.isUndefined(i)&&(this.autoWidthStr=s.width||""),s.width=e.width+"px"):t.isUndefined(i)||(s.width=i),e.height?(t.isUndefined(n)&&(this.autoHeightStr=s.height||""),s.height=e.height+"px"):t.isUndefined(n)||(s.height=n)}else s.width=e+"px",s.height=i+"px",this.view.width=Math.ceil(e*n),this.view.height=Math.ceil(i*n)}updateClientBounds(){this.view.parentElement&&(this.clientBounds=this.view.getBoundingClientRect())}startAutoLayout(t,e){if(this.resizeListener=e,t){if(this.autoBounds=t,this.resizeObserver)return;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),i.warn("no parent"))}catch(t){this.imitateResizeObserver()}this.stopListenPixelRatio()}else this.listenPixelRatio(),this.unreal&&this.updateViewSize()}imitateResizeObserver(){this.autoLayout&&(this.parentView&&this.checkAutoBounds(this.parentView.getBoundingClientRect()),t.Platform.requestRender(this.imitateResizeObserver.bind(this)))}listenPixelRatio(){this.windowListener||window.addEventListener("resize",this.windowListener=()=>{const e=t.Platform.devicePixelRatio;if(!this.config.pixelRatio&&this.pixelRatio!==e){const{width:t,height:i}=this;this.emitResize({width:t,height:i,pixelRatio:e})}})}stopListenPixelRatio(){this.windowListener&&(window.removeEventListener("resize",this.windowListener),this.windowListener=null)}checkAutoBounds(e){const i=this.view,{x:n,y:s,width:a,height:r}=this.autoBounds.getBoundsFrom(e),o={width:a,height:r,pixelRatio:this.config.pixelRatio?this.pixelRatio:t.Platform.devicePixelRatio};if(!this.isSameSize(o)){const{style:t}=i;t.marginLeft=n+"px",t.marginTop=s+"px",this.emitResize(o)}}stopAutoLayout(){this.autoLayout=!1,this.resizeObserver&&this.resizeObserver.disconnect(),this.resizeListener=this.resizeObserver=null}emitResize(e){const i={};t.DataHelper.copyAttrs(i,this,t.canvasSizeAttrs),this.resize(e),this.resizeListener&&!t.isUndefined(this.width)&&this.resizeListener(new t.ResizeEvent(e,i))}unrealCanvas(){if(!this.unreal&&this.parentView){const t=this.view;t&&t.remove(),this.view=this.parentView,this.unreal=!0}}destroy(){if(this.view){if(this.stopAutoLayout(),this.stopListenPixelRatio(),!this.unreal){const t=this.view;t.parentElement&&t.remove()}super.destroy()}}}t.canvasPatch(CanvasRenderingContext2D.prototype),t.canvasPatch(Path2D.prototype);const{mineType:s,fileType:a}=t.FileHelper;function r(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=s(e),a=t.toDataURL(n,i);return"image/bmp"===n?a.replace("image/png;","image/bmp;"):a},canvasToBolb:(t,e,i)=>new Promise(n=>t.toBlob(n,s(e),i)),canvasSaveAs:(e,i,n)=>{const r=e.toDataURL(s(a(i)),n);return t.Platform.origin.download(r,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:a}=t.Platform.image;a&&(s.setAttribute("crossOrigin",a),s.crossOrigin=a),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 n(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:o}=navigator;o.indexOf("Firefox")>-1?(t.Platform.conicGradientRotate90=!0,t.Platform.intWheelDeltaY=!0,t.Platform.syncDomFont=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(t.Platform.fullImageShadow=!0),o.indexOf("Windows")>-1?(t.Platform.os="Windows",t.Platform.intWheelDeltaY=!0):o.indexOf("Mac")>-1?t.Platform.os="Mac":o.indexOf("Linux")>-1&&(t.Platform.os="Linux");class l{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const e=new t.LeafList;return this.__updatedList.list.forEach(t=>{t.leafer&&e.add(t)}),e}return this.__updatedList}constructor(e,i){this.totalTimes=0,this.config={},this.__updatedList=new t.LeafList,this.target=e,i&&(this.config=t.DataHelper.default(i,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(t.RenderEvent.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(e){e.type===t.ChildEvent.ADD?(this.hasAdd=!0,this.__pushChild(e.child)):(this.hasRemove=!0,this.__updatedList.add(e.parent)),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new t.WatchEvent(t.WatchEvent.DATA,{updatedList:this.updatedList})),this.__updatedList=new t.LeafList,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[t.PropertyEvent.CHANGE,this.__onAttrChange,this],[[t.ChildEvent.ADD,t.ChildEvent.REMOVE],this.__onChildEvent,this],[t.WatchEvent.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:d,updateBounds:h,updateChange:c}=t.LeafHelper,{pushAllChildBranch:u,pushAllParent:f}=t.BranchHelper;const{worldBounds:p}=t.LeafBoundsHelper;class g{constructor(e){this.updatedBounds=new t.Bounds,this.beforeBounds=new t.Bounds,this.afterBounds=new t.Bounds,t.isArray(e)&&(e=new t.LeafList(e)),this.updatedList=e}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,p)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,p),this.updatedBounds.setList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.addList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllMatrix:_,updateAllChange:m}=t.LeafHelper,w=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.layouting||!this.running)return;const{target:e}=this;this.times=0;try{e.emit(t.LayoutEvent.START),this.layoutOnce(),e.emitEvent(new t.LayoutEvent(t.LayoutEvent.END,this.layoutedBlocks,this.times))}catch(t){w.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?w.warn("layouting"):this.times>3?w.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(t.WatchEvent.REQUEST),this.totalTimes>1?this.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:a,LAYOUT:r,AFTER:o}=t.LayoutEvent,l=this.getBlocks(s);l.forEach(t=>t.setBefore()),n.emitEvent(new t.LayoutEvent(a,l,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?(d(t,!0),e.add(t),t.isBranch&&u(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||h(n[t])}h(i)}})}(this.__levelList),function(t){t.list.forEach(c)}(s),this.extraBlock&&l.push(this.extraBlock),l.forEach(t=>t.setAfter()),n.emitEvent(new t.LayoutEvent(r,l,this.times)),n.emitEvent(new t.LayoutEvent(o,l,this.times)),this.addBlocks(l),this.__levelList.reset(),this.__updatedList=null,t.Run.end(i)}fullLayout(){const e=t.Run.start("FullLayout"),{target:i}=this,{BEFORE:n,LAYOUT:s,AFTER:a}=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(a,r,this.times)),this.addBlocks(r),t.Run.end(e)}static fullLayout(e){_(e,!0),e.isBranch?t.BranchHelper.updateBounds(e):t.LeafHelper.updateBounds(e),m(e)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new g([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new g(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){this.__eventIds=[this.target.on_([[t.LayoutEvent.REQUEST,this.layout,this],[t.LayoutEvent.AGAIN,this.layoutAgain,this],[t.WatchEvent.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const v=t.Debug.get("Renderer");class x{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(e,i,n){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:120},this.target=e,this.canvas=i,n&&(this.config=t.DataHelper.default(n,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.__requestRender()}requestLayout(){this.target.emit(t.LayoutEvent.REQUEST)}checkRender(){if(this.running){const{target:e}=this;e.isApp&&(e.emit(t.RenderEvent.CHILD_START,e),e.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),e.emit(t.RenderEvent.CHILD_END,e)),this.changed&&this.canvas.view&&this.render(),this.target.emit(t.RenderEvent.NEXT)}}render(e){if(!this.running||!this.canvas.view)return this.update();const{target:i}=this;this.times=0,this.totalBounds=new t.Bounds,v.log(i.innerName,"---\x3e");try{this.emitRender(t.RenderEvent.START),this.renderOnce(e),this.emitRender(t.RenderEvent.END,this.totalBounds),t.ImageManager.clearRecycled()}catch(t){this.rendering=!1,v.error(t)}v.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(e){if(this.rendering)return v.warn("rendering");if(this.times>3)return v.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new t.Bounds,this.renderOptions={},e)this.emitRender(t.RenderEvent.BEFORE),e();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(t.RenderEvent.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(t.RenderEvent.RENDER,this.renderBounds,this.renderOptions),this.emitRender(t.RenderEvent.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,this.waitAgain&&(this.waitAgain=!1,this.renderOnce())}partRender(){const{canvas: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),a=new t.Bounds(s);n.save(),s.spread(x.clipSpread).ceil(),n.clearWorld(s),n.clipWorld(s),this.__render(s,a),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),a=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,a),this.renderBounds=i=i||e,this.renderOptions=a,this.totalBounds.isEmpty()?this.totalBounds=i:this.totalBounds.add(i),n.updateRender(i)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:e}=this;if(e){const i=new t.Bounds;i.setList(e),e.length=0,e.push(i)}}__requestRender(){const e=this.target;if(this.requestTime||!e)return;if(e.parentApp)return e.parentApp.requestRender(!1);const i=this.requestTime=Date.now(),n=()=>{const e=1e3/(Date.now()-i),{maxFPS:s}=this.config;if(s&&e>s-.5)return t.Platform.requestRender(n);this.FPS=Math.min(120,Math.ceil(e)),this.requestTime=0,this.checkRender()};t.Platform.requestRender(n)}__onResize(e){if(!this.canvas.unreal){if(e.bigger||!e.samePixelRatio){const{width:i,height:n}=e.old;if(!new t.Bounds(0,0,i,n).includes(this.target.__world)||this.needFill||!e.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new t.Bounds(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;t.updatedList&&t.updatedList.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||v.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(e,i,n){this.target.emitEvent(new t.RenderEvent(e,this.times,i,n))}__listenEvents(){this.__eventIds=[this.target.on_([[t.RenderEvent.REQUEST,this.update,this],[t.LayoutEvent.END,this.__onLayoutEnd,this],[t.RenderEvent.AGAIN,this.renderAgain,this],[t.ResizeEvent.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}function b(t,e){const i=t.__,{rows:n,decorationY:s}=i.__textDrawData;let a;i.__isPlacehold&&i.placeholderColor&&(e.fillStyle=i.placeholderColor);for(let t=0,i=n.length;t<i;t++)a=n[t],a.text?e.fillText(a.text,a.x,a.y):a.data&&a.data.forEach(t=>{e.fillText(t.char,t.x,a.y)});if(s){const{decorationColor:t,decorationHeight:a}=i.__textDrawData;t&&(e.fillStyle=t),n.forEach(t=>s.forEach(i=>e.fillRect(t.x,t.y+i,t.width,a)))}}function E(t,e){t.__.__font?b(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function B(t,e,i){switch(e.__.strokeAlign){case"center":R(t,1,e,i);break;case"inside":L(t,"inside",e,i);break;case"outside":e.__.__fillAfterStroke?R(t,2,e,i):L(t,"outside",e,i)}}function R(e,i,n,s){const a=n.__;t.isObject(e)?k(e,i,!0,n,s):(s.setStroke(e,a.__strokeWidth*i,a),S(n,s))}function L(e,i,n,s){const a=s.getSameCanvas(!0,!0);a.font=n.__.__font,R(e,2,n,a),a.blendMode="outside"===i?"destination-out":"destination-in",b(n,a),a.blendMode="normal",t.LeafHelper.copyCanvasByWorld(n,s,a),a.recycle(n.__nowWorld)}function S(t,e){let i,n=t.__.__textDrawData;const{rows:s,decorationY:a}=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(a){const{decorationHeight:t}=n;s.forEach(i=>a.forEach(n=>e.strokeRect(i.x,i.y+n,i.width,t)))}}function k(t,i,n,s,a){let r;const o=s.__,{__hasMultiStrokeStyle:l}=o;l||a.setStroke(void 0,o.__strokeWidth*i,o);for(let d=0,h=t.length;d<h;d++)if(r=t[d],(!r.image||!e.PaintImage.checkImage(s,a,r,!1))&&r.style){if(l){const{strokeStyle:t}=r;t?a.setStroke(r.style,o.__getRealStrokeWidth(t)*i,o,t):a.setStroke(r.style,o.__strokeWidth*i,o)}else a.strokeStyle=r.style;r.blendMode?(a.saveBlendMode(r.blendMode),n?S(s,a):a.stroke(),a.restoreBlendMode()):n?S(s,a):a.stroke()}}function P(e,i,n){const s=i.__;if(s.__strokeWidth)if(s.__font)B(e,i,n);else switch(s.strokeAlign){case"center":C(e,1,i,n);break;case"inside":!function(t,e,i){i.save(),i.clipUI(e),C(t,2,e,i),i.restore()}(e,i,n);break;case"outside":!function(e,i,n){const s=i.__;if(s.__fillAfterStroke)C(e,2,i,n);else{const{renderBounds:a}=i.__layout,r=n.getSameCanvas(!0,!0);i.__drawRenderPath(r),C(e,2,i,r),r.clipUI(s),r.clearWorld(a),t.LeafHelper.copyCanvasByWorld(i,n,r),r.recycle(i.__nowWorld)}}(e,i,n)}}function C(i,n,s,a){const r=s.__;t.isObject(i)?k(i,n,!1,s,a):(a.setStroke(i,r.__strokeWidth*n,r),a.stroke()),r.__useArrow&&e.Paint.strokeArrow(i,s,a)}x.clipSpread=10,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)=>{},interaction:(t,e,i,n)=>{}}),t.Platform.layout=y.fullLayout;const{getSpread:A,getOuterOf:O,getByMove:M,getIntersectData:T}=t.BoundsHelper;let D;const{stintSet:W}=t.DataHelper,{hasTransparent:I}=e.ColorConvert;function z(i,n,s){if(!t.isObject(n)||!1===n.visible||0===n.opacity)return;let a;const{boxBounds:r}=s.__layout;switch(n.type){case"image":a=e.PaintImage.image(s,i,n,r,!D||!D[n.url]);break;case"linear":a=e.PaintGradient.linearGradient(n,r);break;case"radial":a=e.PaintGradient.radialGradient(n,r);break;case"angular":a=e.PaintGradient.conicGradient(n,r);break;case"solid":const{type:o,color:l,opacity:d}=n;a={type:o,style:e.ColorConvert.string(l,d)};break;default:t.isUndefined(n.r)||(a={type:"solid",style:e.ColorConvert.string(n)})}if(a){if(t.isString(a.style)&&I(a.style)&&(a.isTransparent=!0),n.style){if(0===n.style.strokeWidth)return;a.strokeStyle=n.style}n.editing&&(a.editing=n.editing),n.blendMode&&(a.blendMode=n.blendMode)}return a}const H={compute:function(i,n){const s=n.__,a=[];let r,o,l,d=s.__input[i];t.isArray(d)||(d=[d]),D=e.PaintImage.recycleImage(i,s);for(let t,e=0,s=d.length;e<s;e++)(t=z(i,d[e],n))&&(a.push(t),t.strokeStyle&&(l||(l=1),t.strokeStyle.strokeWidth&&(l=Math.max(l,t.strokeStyle.strokeWidth))));s["_"+i]=a.length?a:void 0,a.length&&a.every(t=>t.isTransparent)&&(a.some(t=>t.image)&&(r=!0),o=!0),"fill"===i?(W(s,"__isAlphaPixelFill",r),W(s,"__isTransparentFill",o)):(W(s,"__isAlphaPixelStroke",r),W(s,"__isTransparentStroke",o),W(s,"__hasMultiStrokeStyle",l))},fill:function(t,e,i){i.fillStyle=t,E(e,i)},fills:function(t,i,n){let s;for(let a=0,r=t.length;a<r;a++){if(s=t[a],s.image){if(e.PaintImage.checkImage(i,n,s,!i.__.__font))continue;if(!s.style){!a&&s.image.isPlacehold&&i.drawImagePlaceholder(n,s.image);continue}}if(n.fillStyle=s.style,s.transform||s.scaleFixed){if(n.save(),s.transform&&n.transform(s.transform),s.scaleFixed){const{scaleX:t,scaleY:e}=i.getRenderScaleData(!0);(!0===s.scaleFixed||"zoom-in"===s.scaleFixed&&t>1&&e>1)&&n.scale(1/t,1/e)}s.blendMode&&(n.blendMode=s.blendMode),E(i,n),n.restore()}else s.blendMode?(n.saveBlendMode(s.blendMode),E(i,n),n.restoreBlendMode()):E(i,n)}},fillPathOrText:E,fillText:b,stroke:P,strokes:function(t,e,i){P(t,e,i)},strokeText:B,drawTextStroke:S,shape:function(e,i,n){const s=i.getSameCanvas(),a=e.__nowWorld,r=i.bounds;let o,l,d,h,c,{scaleX:u,scaleY:f}=e.getRenderScaleData(!0);if(r.includes(a))c=s,o=h=a;else{const{renderShapeSpread:s}=e.__layout;let p;if(t.Platform.fullImageShadow)p=a;else{const t=s?A(r,u===f?s*u:[s*f,s*u]):r;p=T(t,a)}d=r.getFitMatrix(p);let{a:g,d:_}=d;d.a<1&&(c=i.getSameCanvas(),e.__renderShape(c,n),u*=g,f*=_),h=O(a,d),o=M(h,-d.e,-d.f);const m=n.matrix;m?(l=new t.Matrix(d),l.multiply(m),g*=m.scaleX,_*=m.scaleY):l=d,l.withScale(g,_),n=Object.assign(Object.assign({},n),{matrix:l})}return e.__renderShape(s,n),{canvas:s,matrix:l,fitMatrix:d,bounds:o,worldCanvas:c,shapeBounds:h,scaleX:u,scaleY:f}}};let F={},U=t.getMatrixData();const{get:j,rotateOfOuter:G,translate:V,scaleOfOuter:Y,multiplyParent:N,scale:q,rotate:X,skew:Q}=t.MatrixHelper;function Z(t,e,i,n,s,a,r){const o=j();V(o,e.x+i,e.y+n),q(o,s,a),r&&G(o,{x:e.x+e.width/2,y:e.y+e.height/2},r),t.transform=o}function $(t,e,i,n,s,a,r,o,l){const d=j();J(d,e,i,n,s,a,r,o),l&&(U.a=e.width/l.width,U.d=e.height/l.height,N(d,U)),t.transform=d}function K(t,e,i,n,s,a,r,o,l,d,h,c){const u=j();if(c)J(u,e,s,a,r,o,l,d);else{if(l)if("center"===h)G(u,{x:i/2,y:n/2},l);else switch(X(u,l),l){case 90:V(u,n,0);break;case 180:V(u,i,n);break;case 270:V(u,0,i)}F.x=e.x+s,F.y=e.y+a,V(u,F.x,F.y),r&&Y(u,F,r,o)}t.transform=u}function J(t,e,i,n,s,a,r,o){r&&X(t,r),o&&Q(t,o.x,o.y),s&&q(t,s,a),V(t,e.x+i,e.y+n)}const{get:tt,translate:et}=t.MatrixHelper,it=new t.Bounds,nt={},st={};function at(t,e,i,n){const{changeful:s,sync:a,scaleFixed:r}=i;s&&(t.changeful=s),a&&(t.sync=a),r&&(t.scaleFixed=r),t.data=rt(i,n,e)}function rt(e,i,n){e.padding&&(i=it.set(i).shrink(e.padding)),"strench"===e.mode&&(e.mode="stretch");let{width:s,height:a}=n;const{opacity:r,mode:o,align:l,offset:d,scale:h,size:c,rotation:u,skew:f,clipSize:p,repeat:g,gap:_,filters:m}=e,w=i.width===s&&i.height===a,y={mode:o},v="center"!==l&&(u||0)%180==90;let x,b;switch(t.BoundsHelper.set(st,0,0,v?a:s,v?s:a),o&&"cover"!==o&&"fit"!==o?((h||c)&&(t.MathHelper.getScaleData(h,c,n,nt),x=nt.scaleX,b=nt.scaleY),(l||_||g)&&(x&&t.BoundsHelper.scale(st,x,b,!0),l&&t.AlignHelper.toPoint(l,st,i,st,!0,!0))):w&&!u||(x=b=t.BoundsHelper.getFitScale(i,st,"fit"!==o),t.BoundsHelper.put(i,n,l,x,!1,st),t.BoundsHelper.scale(st,x,b,!0)),d&&t.PointHelper.move(st,d),o){case"stretch":w||(s=i.width,a=i.height);break;case"normal":case"clip":(st.x||st.y||x||p||u||f)&&$(y,i,st.x,st.y,x,b,u,f,e.clipSize);break;case"repeat":(!w||x||u||f)&&K(y,i,s,a,st.x,st.y,x,b,u,f,l,e.freeTransform),g||(y.repeat="repeat");const n=t.isObject(g);(_||n)&&(y.gap=function(e,i,n,s,a){let r,o;t.isObject(e)?(r=e.x,o=e.y):r=o=e;return{x:ot(r,n,a.width,i&&i.x),y:ot(o,s,a.height,i&&i.y)}}(_,n&&g,st.width,st.height,i));break;default:x&&Z(y,i,st.x,st.y,x,b,u)}return y.transform||(i.x||i.y)&&(y.transform=tt(),et(y.transform,i.x,i.y)),x&&"stretch"!==o&&(y.scaleX=x,y.scaleY=b),y.width=s,y.height=a,r&&(y.opacity=r),m&&(y.filters=m),g&&(y.repeat=t.isString(g)?"x"===g?"repeat-x":"repeat-y":"repeat"),y}function ot(e,i,n,s){const a=t.isString(e)||s?(s?n-s*i:n%i)/((s||Math.floor(n/i))-1):e;return"auto"===e&&a<0?0:a}let lt,dt=new t.Bounds;const{isSame:ht}=t.BoundsHelper;function ct(t,e,i,n,s,a){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||at(s,n,i,a),!0}function ut(e,i){gt(e,t.ImageEvent.LOAD,i)}function ft(e,i){gt(e,t.ImageEvent.LOADED,i)}function pt(e,i,n){i.error=n,e.forceUpdate("surface"),gt(e,t.ImageEvent.ERROR,i)}function gt(e,i,n){e.hasEvent(i)&&e.emitEvent(new t.ImageEvent(i,n))}function _t(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:mt,scale:wt,copy:yt}=t.MatrixHelper,{floor:vt,ceil:xt,max:bt,abs:Et}=Math;function Bt(e,i,n){let{scaleX:s,scaleY:a}=e.getRenderScaleData(!0,i.scaleFixed);const r=s+"-"+a+"-"+n;if(i.patternId===r||e.destroyed)return!1;{const{image:o,data:l}=i;let d,h,{width:c,height:u,scaleX:f,scaleY:p,transform:g,repeat:_,gap:m}=l;s*=n,a*=n,f&&(f=Et(f),p=Et(p),h=mt(),yt(h,g),wt(h,1/f,1/p),s*=f,a*=p),c*=s,u*=a;const w=c*u;if(!_&&w>t.Platform.image.maxCacheSize)return!1;let y=t.Platform.image.maxPatternSize;if(o.isSVG){const t=c/o.width;t>1&&(d=t/xt(t))}else{const t=o.width*o.height;y>t&&(y=t)}w>y&&(d=Math.sqrt(w/y)),d&&(s/=d,a/=d,c/=d,u/=d),f&&(s/=f,a/=p);const v=m&&m.x*s,x=m&&m.y*a;if(g||1!==s||1!==a){const t=c+(v||0),e=u+(x||0);s/=t/bt(vt(t),1),a/=e/bt(vt(e),1),h||(h=mt(),g&&yt(h,g)),wt(h,1/s,1/a)}const b=o.getCanvas(c,u,l.opacity,l.filters,v,x,e.leafer&&e.leafer.config.smooth),E=o.getPattern(b,_||t.Platform.origin.noRepeat||"no-repeat",h,i);return i.style=E,i.patternId=r,!0}}function Rt(t,e,i,n){return new(i||(i=Promise))(function(s,a){function r(t){try{l(n.next(t))}catch(t){a(t)}}function o(t){try{l(n.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(r,o)}l((n=n.apply(t,e||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const Lt={image:function(e,i,n,s,a){let r,o;const l=t.ImageManager.get(n);return lt&&n===lt.paint&&ht(s,lt.boxBounds)?r=lt.leafPaint:(r={type:n.type,image:l},l.hasAlphaPixel&&(r.isTransparent=!0),lt=l.use>1?{leafPaint:r,paint:n,boxBounds:dt.set(s)}:null),(a||l.loading)&&(o={image:l,attrName:i,attrValue:n}),l.ready?(ct(e,i,n,l,r,s),a&&(ut(e,o),ft(e,o))):l.error?a&&pt(e,o,l.error):(a&&(_t(e,!0),ut(e,o)),r.loadId=l.load(()=>{_t(e,!1),e.destroyed||(ct(e,i,n,l,r,s)&&(l.hasAlphaPixel&&(e.__layout.hitCanvasChanged=!0),e.forceUpdate("surface")),ft(e,o)),r.loadId=void 0},t=>{_t(e,!1),pt(e,o,t),r.loadId=void 0}),e.placeholderColor&&(e.placeholderDelay?setTimeout(()=>{l.ready||(l.isPlacehold=!0,e.forceUpdate("surface"))},e.placeholderDelay):l.isPlacehold=!0)),r},checkImage:function(i,n,s,a){const{scaleX:r,scaleY:o}=i.getRenderScaleData(!0,s.scaleFixed),{pixelRatio:l}=n,{data:d}=s;if(!d||s.patternId===r+"-"+o+"-"+l&&!e.Export.running)return!1;if(a)if(d.repeat)a=!1;else if(!(s.changeful||"miniapp"===t.Platform.name&&t.ResizeEvent.isResizing(i)||e.Export.running)){let{width:e,height:i}=d;e*=r*l,i*=o*l,d.scaleX&&(e*=d.scaleX,i*=d.scaleY),a=e*i>t.Platform.image.maxCacheSize}return a?(i.__.__isFastShadow&&(n.fillStyle=s.style||"#000",n.fill()),function(t,e,i,n){e.save(),e.clipUI(t),i.blendMode&&(e.blendMode=i.blendMode);n.opacity&&(e.opacity*=n.opacity);n.transform&&e.transform(n.transform);e.drawImage(i.image.getFull(n.filters),0,0,n.width,n.height),e.restore()}(i,n,s,d),!0):(!s.style||s.sync||e.Export.running?Bt(i,s,l):s.patternTask||(s.patternTask=t.ImageManager.patternTasker.add(()=>Rt(this,void 0,void 0,function*(){s.patternTask=null,n.bounds.hit(i.__nowWorld)&&Bt(i,s,l),i.forceUpdate("surface")}),300)),!1)},createPattern:Bt,recycleImage:function(e,i){const n=i["_"+e];if(t.isArray(n)){let s,a,r,o,l;for(let d=0,h=n.length;d<h;d++)s=n[d],a=s.image,l=a&&a.url,l&&(r||(r={}),r[l]=!0,t.ImageManager.recycle(a),a.loading&&(o||(o=i.__input&&i.__input[e]||[],t.isArray(o)||(o=[o])),a.unload(n[d].loadId,!o.some(t=>t.url===l))));return r}return null},createData:at,getPatternData:rt,fillOrFitMode:Z,clipMode:$,repeatMode:K},{toPoint:St}=t.AroundHelper,{hasTransparent:kt}=e.ColorConvert,Pt={},Ct={};function At(i,n,s,a){if(s){let r,o,l,d;for(let i=0,h=s.length;i<h;i++)r=s[i],t.isString(r)?(l=i/(h-1),o=e.ColorConvert.string(r,a)):(l=r.offset,o=e.ColorConvert.string(r.color,a)),n.addColorStop(l,o),!d&&kt(o)&&(d=!0);d&&(i.isTransparent=!0)}}const{getAngle:Ot,getDistance:Mt}=t.PointHelper,{get:Tt,rotateOfOuter:Dt,scaleOfOuter:Wt}=t.MatrixHelper,{toPoint:It}=t.AroundHelper,zt={},Ht={};function Ft(t,e,i,n,s){let a;const{width:r,height:o}=t;if(r!==o||n){const t=Ot(e,i);a=Tt(),s?(Wt(a,e,r/o*(n||1),1),Dt(a,e,t+90)):(Wt(a,e,1,r/o*(n||1)),Dt(a,e,t))}return a}const{getDistance:Ut}=t.PointHelper,{toPoint:jt}=t.AroundHelper,Gt={},Vt={};const Yt={linearGradient:function(e,i){let{from:n,to:s,type:a,opacity:r}=e;St(n||"top",i,Pt),St(s||"bottom",i,Ct);const o=t.Platform.canvas.createLinearGradient(Pt.x,Pt.y,Ct.x,Ct.y),l={type:a,style:o};return At(l,o,e.stops,r),l},radialGradient:function(e,i){let{from:n,to:s,type:a,opacity:r,stretch:o}=e;It(n||"center",i,zt),It(s||"bottom",i,Ht);const l=t.Platform.canvas.createRadialGradient(zt.x,zt.y,0,zt.x,zt.y,Mt(zt,Ht)),d={type:a,style:l};At(d,l,e.stops,r);const h=Ft(i,zt,Ht,o,!0);return h&&(d.transform=h),d},conicGradient:function(e,i){let{from:n,to:s,type:a,opacity:r,stretch:o}=e;jt(n||"center",i,Gt),jt(s||"bottom",i,Vt);const l=t.Platform.conicGradientSupport?t.Platform.canvas.createConicGradient(0,Gt.x,Gt.y):t.Platform.canvas.createRadialGradient(Gt.x,Gt.y,0,Gt.x,Gt.y,Ut(Gt,Vt)),d={type:a,style:l};At(d,l,e.stops,r);const h=Ft(i,Gt,Vt,o||1,t.Platform.conicGradientRotate90);return h&&(d.transform=h),d},getTransform:Ft},{copy:Nt,toOffsetOutBounds:qt}=t.BoundsHelper,Xt={},Qt={};function Zt(e,i,n,s){const{bounds:a,shapeBounds:r}=s;if(t.Platform.fullImageShadow){if(Nt(Xt,e.bounds),Xt.x+=i.x-r.x,Xt.y+=i.y-r.y,n){const{fitMatrix:t}=s;Xt.x-=(a.x+(t?t.e:0)+a.width/2)*(n-1),Xt.y-=(a.y+(t?t.f:0)+a.height/2)*(n-1),Xt.width*=n,Xt.height*=n}e.copyWorld(s.canvas,e.bounds,Xt)}else n&&(Nt(Xt,i),Xt.x-=i.width/2*(n-1),Xt.y-=i.height/2*(n-1),Xt.width*=n,Xt.height*=n),e.copyWorld(s.canvas,r,n?Xt:i)}const{toOffsetOutBounds:$t}=t.BoundsHelper,Kt={};const Jt={shadow:function(i,n,s){let a,r;const{__nowWorld:o,__layout:l}=i,{shadow:d}=i.__,{worldCanvas:h,bounds:c,shapeBounds:u,scaleX:f,scaleY:p}=s,g=n.getSameCanvas(),_=d.length-1;qt(c,Qt),d.forEach((d,m)=>{let w=1;if(d.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(w=1/t)}g.setWorldShadow(Qt.offsetX+d.x*f*w,Qt.offsetY+d.y*p*w,d.blur*f*w,e.ColorConvert.string(d.color)),r=d.spread?1+2*d.spread/(l.boxBounds.width+2*(l.strokeBoxSpread||0))*w:0,Zt(g,Qt,r,s),a=c,d.box&&(g.restore(),g.save(),h&&(g.copyWorld(g,c,o,"copy"),a=o),h?g.copyWorld(h,o,o,"destination-out"):g.copyWorld(s.canvas,u,c,"destination-out")),e.Effect.isTransformShadow(d)?e.Effect.renderTransformShadow(i,n,g,a,d):t.LeafHelper.copyCanvasByWorld(i,n,g,a,d.blendMode),_&&m<_&&g.clearWorld(a)}),g.recycle(a)},innerShadow:function(i,n,s){let a,r;const{__nowWorld:o,__layout:l}=i,{innerShadow:d}=i.__,{worldCanvas:h,bounds:c,shapeBounds:u,scaleX:f,scaleY:p}=s,g=n.getSameCanvas(),_=d.length-1;$t(c,Kt),d.forEach((d,m)=>{let w=1;if(d.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(w=1/t)}g.save(),g.setWorldShadow(Kt.offsetX+d.x*f*w,Kt.offsetY+d.y*p*w,d.blur*f*w),r=d.spread?1-2*d.spread/(l.boxBounds.width+2*(l.strokeBoxSpread||0))*w:0,Zt(g,Kt,r,s),g.restore(),h?(g.copyWorld(g,c,o,"copy"),g.copyWorld(h,o,o,"source-out"),a=o):(g.copyWorld(s.canvas,u,c,"source-out"),a=c),g.fillWorld(a,e.ColorConvert.string(d.color),"source-in"),t.LeafHelper.copyCanvasByWorld(i,n,g,a,d.blendMode),_&&m<_&&g.clearWorld(a)}),g.recycle(a)},blur:function(t,e,i){const{blur:n}=t.__;i.setWorldBlur(n*t.__nowWorld.a),i.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),i.filter="none"},backgroundBlur:function(t,e,i){},getShadowSpread:function(t,e){let i=0;return e.forEach(t=>i=Math.max(i,Math.max(Math.abs(t.y),Math.abs(t.x))+(t.spread>0?t.spread:0)+1.5*t.blur)),i},isTransformShadow(t){}},{excludeRenderBounds:te}=t.LeafBoundsHelper;let ee;function ie(t,e,i,n,s,a,r,o){switch(e){case"grayscale":ee||(ee=!0,s.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,n,s,a){const r=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(n,r),a&&n.recycle(r);se(t,e,i,1,s,a)}(t,i,n,s,r,o);break;case"opacity-path":se(t,i,n,a,r,o);break;case"path":o&&i.restore()}}function ne(t){return t.getSameCanvas(!1,!0)}function se(t,e,i,n,s,a){const r=t.__nowWorld;e.resetTransform(),e.opacity=n,e.copyWorld(i,r,void 0,s),a?i.recycle(r):i.clearWorld(r)}e.Group.prototype.__renderMask=function(t,e){let i,n,s,a,r,o;const{children:l}=this;for(let d=0,h=l.length;d<h;d++){if(i=l[d],o=i.__.mask,o){r&&(ie(this,r,t,s,n,a,void 0,!0),n=s=null),a=i.__.opacity,ee=!1,"path"===o||"clipping-path"===o?(a<1?(r="opacity-path",s||(s=ne(t))):(r="path",t.save()),i.__clip(s||t,e)):(r="grayscale"===o?"grayscale":"alpha",n||(n=ne(t)),s||(s=ne(t)),i.__render(n,e)),"clipping"!==o&&"clipping-path"!==o||te(i,e)||i.__render(t,e);continue}const h=1===a&&i.__.__blendMode;h&&ie(this,r,t,s,n,a,void 0,!1),te(i,e)||i.__render(s||t,e),h&&ie(this,r,t,s,n,a,h,!1)}ie(this,r,t,s,n,a,void 0,!0)};const ae=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",re=ae+"_#~&*+\\=|≮≯≈≠=…",oe=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 le(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const de=le("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),he=le("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),ce=le(ae),ue=le(re),fe=le("- —/~|┆·");var pe;!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"}(pe||(pe={}));const{Letter:ge,Single:_e,Before:me,After:we,Symbol:ye,Break:ve}=pe;function xe(t){return de[t]?ge:fe[t]?ve:he[t]?me:ce[t]?we:ue[t]?ye:oe.test(t)?_e:ge}const be={trimRight(t){const{words:e}=t;let i,n=0,s=e.length;for(let a=s-1;a>-1&&(i=e[a].data[0]," "===i.char);a--)n++,t.width-=i.width;n&&e.splice(s-n,n)}};function Ee(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:Be}=be,{Letter:Re,Single:Le,Before:Se,After:ke,Symbol:Pe,Break:Ce}=pe;let Ae,Oe,Me,Te,De,We,Ie,ze,He,Fe,Ue,je,Ge,Ve,Ye,Ne,qe,Xe=[];function Qe(t,e){He&&!ze&&(ze=He),Ae.data.push({char:t,width:e}),Me+=e}function Ze(){Te+=Me,Ae.width=Me,Oe.words.push(Ae),Ae={data:[]},Me=0}function $e(){Ve&&(Ye.paraNumber++,Oe.paraStart=!0,Ve=!1),He&&(Oe.startCharSize=ze,Oe.endCharSize=He,ze=0),Oe.width=Te,Ne.width?Be(Oe):qe&&Ke(),Xe.push(Oe),Oe={words:[]},Te=0}function Ke(){Te>(Ye.maxWidth||0)&&(Ye.maxWidth=Te)}const{top:Je,right:ti,bottom:ei,left:ii}=t.Direction4;function ni(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 si={getDrawData:function(i,n){t.isString(i)||(i=String(i));let s=0,a=0,r=n.__getInput("width")||0,o=n.__getInput("height")||0;const{textDecoration:l,__font:d,__padding:h}=n;h&&(r?(s=h[ii],r-=h[ti]+h[ii]):n.autoSizeAlign||(s=h[ii]),o?(a=h[Je],o-=h[Je]+h[ei]):n.autoSizeAlign||(a=h[Je]));const c={bounds:{x:s,y:a,width:r,height:o},rows:[],paraNumber:0,font:t.Platform.canvas.font=d};return function(e,i,n){Ye=e,Xe=e.rows,Ne=e.bounds,qe=!Ne.width&&!n.autoSizeAlign;const{__letterSpacing:s,paraIndent:a,textCase:r}=n,{canvas:o}=t.Platform,{width:l,height:d}=Ne;if(l||d||s||"none"!==r){const t="none"!==n.textWrap,e="break"===n.textWrap;Ve=!0,Ue=null,ze=Ie=He=Me=Te=0,Ae={data:[]},Oe={words:[]},s&&(i=[...i]);for(let n=0,d=i.length;n<d;n++)We=i[n],"\n"===We?(Me&&Ze(),Oe.paraEnd=!0,$e(),Ve=!0):(Fe=xe(We),Fe===Re&&"none"!==r&&(We=Ee(We,r,!Me)),Ie=o.measureText(We).width,s&&(s<0&&(He=Ie),Ie+=s),je=Fe===Le&&(Ue===Le||Ue===Re)||Ue===Le&&Fe!==ke,Ge=!(Fe!==Se&&Fe!==Le||Ue!==Pe&&Ue!==ke),De=Ve&&a?l-a:l,t&&l&&Te+Me+Ie>De&&(e?(Me&&Ze(),Te&&$e()):(Ge||(Ge=Fe===Re&&Ue==ke),je||Ge||Fe===Ce||Fe===Se||Fe===Le||Me+Ie>De?(Me&&Ze(),Te&&$e()):Te&&$e()))," "===We&&!0!==Ve&&Te+Me===0||(Fe===Ce?(" "===We&&Me&&Ze(),Qe(We,Ie),Ze()):je||Ge?(Me&&Ze(),Qe(We,Ie)):Qe(We,Ie)),Ue=Fe);Me&&Ze(),Te&&$e(),Xe.length>0&&(Xe[Xe.length-1].paraEnd=!0)}else i.split("\n").forEach(t=>{Ye.paraNumber++,Te=o.measureText(t).width,Xe.push({x:a||0,text:t,width:Te,paraStart:!0}),qe&&Ke()})}(c,i,n),h&&function(t,e,i,n,s){if(!n&&i.autoSizeAlign)switch(i.textAlign){case"left":ni(e,"x",t[ii]);break;case"right":ni(e,"x",-t[ti])}if(!s&&i.autoSizeAlign)switch(i.verticalAlign){case"top":ni(e,"y",t[Je]);break;case"bottom":ni(e,"y",-t[ei])}}(h,c,n,r,o),function(t,e){const{rows:i,bounds:n}=t,s=i.length,{__lineHeight:a,__baseLine:r,__letterSpacing:o,__clipText:l,textAlign:d,verticalAlign:h,paraSpacing:c,autoSizeAlign:u}=e;let{x:f,y:p,width:g,height:_}=n,m=a*s+(c?c*(t.paraNumber-1):0),w=r;if(l&&m>_)m=Math.max(_,a),s>1&&(t.overflow=s);else if(_||u)switch(h){case"middle":p+=(_-m)/2;break;case"bottom":p+=_-m}w+=p;let y,v,x,b=g||u?g:t.maxWidth;for(let r=0,h=s;r<h;r++){if(y=i[r],y.x=f,y.width<g||y.width>g&&!l)switch(d){case"center":y.x+=(b-y.width)/2;break;case"right":y.x+=b-y.width}y.paraStart&&c&&r>0&&(w+=c),y.y=w,w+=a,t.overflow>r&&w>m&&(y.isOverflow=!0,t.overflow=r+1),v=y.x,x=y.width,o<0&&(y.width<0?(x=-y.width+e.fontSize+o,v-=x,x+=e.fontSize):x-=o),v<n.x&&(n.x=v),x>n.width&&(n.width=x),l&&g&&g<x&&(y.isOverflow=!0,t.overflow||(t.overflow=i.length))}n.y=p,n.height=m}(c,n),function(t,e,i){const{rows:n}=t,{textAlign:s,paraIndent:a,letterSpacing:r}=e;let o,l,d,h,c,u;n.forEach(t=>{t.words&&(d=a&&t.paraStart?a:0,u=t.words.length,l=i&&("justify"===s||"both"===s)&&u>1?(i-t.width-d)/(u-1):0,h=r||t.isOverflow?0:l>.01?1:2,t.isOverflow&&!r&&(t.textMode=!0),2===h?(t.x+=d,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=d,o=t.x,t.data=[],t.words.forEach((e,i)=>{1===h?(c={char:"",x:o},o=function(t,e,i){return t.forEach(t=>{i.char+=t.char,e+=t.width}),e}(e.data,o,c),(t.isOverflow||" "!==c.char)&&t.data.push(c)):o=function(t,e,i,n){return t.forEach(t=>{(n||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width}),e}(e.data,o,t.data,t.isOverflow),!l||t.paraEnd&&"both"!==s||i===u-1||(o+=l,t.width+=l)})),t.words=null)})}(c,n,r),c.overflow&&function(e,i,n,s){if(!s)return;const{rows:a,overflow:r}=e;let{textOverflow:o}=i;if(a.splice(r),o&&"show"!==o){let e,l;"hide"===o?o="":"ellipsis"===o&&(o="...");const d=o?t.Platform.canvas.measureText(o).width:0,h=n+s-d;("none"===i.textWrap?a:[a[r-1]]).forEach(t=>{if(t.isOverflow&&t.data){let i=t.data.length-1;for(let n=i;n>-1&&(e=t.data[n],l=e.x+e.width,!(n===i&&l<h));n--){if(l<h&&" "!==e.char||!n){t.data.splice(n+1),t.width-=e.width;break}t.width-=e.width}t.width+=d,t.data.push({char:o,x:l}),t.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(t)}})}}(c,n,s,r),"none"!==l&&function(i,n){let s,a=0;const{fontSize:r,textDecoration:o}=n;switch(i.decorationHeight=r/11,t.isObject(o)?(s=o.type,o.color&&(i.decorationColor=e.ColorConvert.string(o.color)),o.offset&&(a=Math.min(.3*r,Math.max(o.offset,.15*-r)))):s=o,s){case"under":i.decorationY=[.15*r+a];break;case"delete":i.decorationY=[.35*-r];break;case"under-delete":i.decorationY=[.15*r+a,.35*-r]}}(c,n),c}};const ai={string:function(i,n){const s=t.isNumber(n)&&n<1;if(t.isString(i)){if(!s||!e.ColorConvert.object)return i;i=e.ColorConvert.object(i)}let a=t.isUndefined(i.a)?1:i.a;s&&(a*=n);const r=i.r+","+i.g+","+i.b;return 1===a?"rgb("+r+")":"rgba("+r+","+a+")"}};Object.assign(e.TextConvert,si),Object.assign(e.ColorConvert,ai),Object.assign(e.Paint,H),Object.assign(e.PaintImage,Lt),Object.assign(e.PaintGradient,Yt),Object.assign(e.Effect,Jt),r(),Object.defineProperty(exports,"LeaferImage",{enumerable:!0,get:function(){return t.LeaferImage}}),exports.Layouter=y,exports.LeaferCanvas=n,exports.Renderer=x,exports.Watcher=l,exports.useCanvas=r,Object.keys(t).forEach(function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}})}),Object.keys(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/draw");const i=t.Debug.get("LeaferCanvas");class n 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(e){let n=t.isString(e)?document.getElementById(e):e;if(n)if(n instanceof HTMLCanvasElement)this.view=n;else{let t=n;if(n===window||n===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 e=this.view;t.hasChildNodes()&&(this.setAbsolute(e),t.style.position||(t.style.position="relative")),t.appendChild(e)}else i.error(`no id: ${e}`),this.__createView()}setAbsolute(t){const{style:e}=t;e.position="absolute",e.top=e.left="0px"}updateViewSize(){const{width:e,height:i,pixelRatio:n}=this,{style:s}=this.view;if(this.unreal){const{config:e,autoWidthStr:i,autoHeightStr:n}=this;e.width?(t.isUndefined(i)&&(this.autoWidthStr=s.width||""),s.width=e.width+"px"):t.isUndefined(i)||(s.width=i),e.height?(t.isUndefined(n)&&(this.autoHeightStr=s.height||""),s.height=e.height+"px"):t.isUndefined(n)||(s.height=n)}else s.width=e+"px",s.height=i+"px",this.view.width=Math.ceil(e*n),this.view.height=Math.ceil(i*n)}updateClientBounds(){this.view.parentElement&&(this.clientBounds=this.view.getBoundingClientRect())}startAutoLayout(t,e){if(this.resizeListener=e,t){if(this.autoBounds=t,this.resizeObserver)return;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),i.warn("no parent"))}catch(t){this.imitateResizeObserver()}this.stopListenPixelRatio()}else this.listenPixelRatio(),this.unreal&&this.updateViewSize()}imitateResizeObserver(){this.autoLayout&&(this.parentView&&this.checkAutoBounds(this.parentView.getBoundingClientRect()),t.Platform.requestRender(this.imitateResizeObserver.bind(this)))}listenPixelRatio(){this.windowListener||window.addEventListener("resize",this.windowListener=()=>{const e=t.Platform.devicePixelRatio;if(!this.config.pixelRatio&&this.pixelRatio!==e){const{width:t,height:i}=this;this.emitResize({width:t,height:i,pixelRatio:e})}})}stopListenPixelRatio(){this.windowListener&&(window.removeEventListener("resize",this.windowListener),this.windowListener=null)}checkAutoBounds(e){const i=this.view,{x:n,y:s,width:a,height:r}=this.autoBounds.getBoundsFrom(e),o={width:a,height:r,pixelRatio:this.config.pixelRatio?this.pixelRatio:t.Platform.devicePixelRatio};if(!this.isSameSize(o)){const{style:t}=i;t.marginLeft=n+"px",t.marginTop=s+"px",this.emitResize(o)}}stopAutoLayout(){this.autoLayout=!1,this.resizeObserver&&this.resizeObserver.disconnect(),this.resizeListener=this.resizeObserver=null}emitResize(e){const i={};t.DataHelper.copyAttrs(i,this,t.canvasSizeAttrs),this.resize(e),this.resizeListener&&!t.isUndefined(this.width)&&this.resizeListener(new t.ResizeEvent(e,i))}unrealCanvas(){if(!this.unreal&&this.parentView){const t=this.view;t&&t.remove(),this.view=this.parentView,this.unreal=!0}}destroy(){if(this.view){if(this.stopAutoLayout(),this.stopListenPixelRatio(),!this.unreal){const t=this.view;t.parentElement&&t.remove()}super.destroy()}}}t.canvasPatch(CanvasRenderingContext2D.prototype),t.canvasPatch(Path2D.prototype);const{mineType:s,fileType:a}=t.FileHelper;function r(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=s(e),a=t.toDataURL(n,i);return"image/bmp"===n?a.replace("image/png;","image/bmp;"):a},canvasToBolb:(t,e,i)=>new Promise(n=>t.toBlob(n,s(e),i)),canvasSaveAs:(e,i,n)=>{const r=e.toDataURL(s(a(i)),n);return t.Platform.origin.download(r,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:a}=t.Platform.image;a&&(s.setAttribute("crossOrigin",a),s.crossOrigin=a),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 n(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:o}=navigator;o.indexOf("Firefox")>-1?(t.Platform.conicGradientRotate90=!0,t.Platform.intWheelDeltaY=!0,t.Platform.syncDomFont=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(t.Platform.fullImageShadow=!0),o.indexOf("Windows")>-1?(t.Platform.os="Windows",t.Platform.intWheelDeltaY=!0):o.indexOf("Mac")>-1?t.Platform.os="Mac":o.indexOf("Linux")>-1&&(t.Platform.os="Linux");class l{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const e=new t.LeafList;return this.__updatedList.list.forEach(t=>{t.leafer&&e.add(t)}),e}return this.__updatedList}constructor(e,i){this.totalTimes=0,this.config={},this.__updatedList=new t.LeafList,this.target=e,i&&(this.config=t.DataHelper.default(i,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(t.RenderEvent.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(e){e.type===t.ChildEvent.ADD?(this.hasAdd=!0,this.__pushChild(e.child)):(this.hasRemove=!0,this.__updatedList.add(e.parent)),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new t.WatchEvent(t.WatchEvent.DATA,{updatedList:this.updatedList})),this.__updatedList=new t.LeafList,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[t.PropertyEvent.CHANGE,this.__onAttrChange,this],[[t.ChildEvent.ADD,t.ChildEvent.REMOVE],this.__onChildEvent,this],[t.WatchEvent.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:d,updateBounds:h,updateChange:c}=t.LeafHelper,{pushAllChildBranch:u,pushAllParent:f}=t.BranchHelper;const{worldBounds:p}=t.LeafBoundsHelper;class g{constructor(e){this.updatedBounds=new t.Bounds,this.beforeBounds=new t.Bounds,this.afterBounds=new t.Bounds,t.isArray(e)&&(e=new t.LeafList(e)),this.updatedList=e}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,p)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,p),this.updatedBounds.setList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.addList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllMatrix:_,updateAllChange:m}=t.LeafHelper,w=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.layouting||!this.running)return;const{target:e}=this;this.times=0;try{e.emit(t.LayoutEvent.START),this.layoutOnce(),e.emitEvent(new t.LayoutEvent(t.LayoutEvent.END,this.layoutedBlocks,this.times))}catch(t){w.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?w.warn("layouting"):this.times>3?w.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(t.WatchEvent.REQUEST),this.totalTimes>1?this.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:a,LAYOUT:r,AFTER:o}=t.LayoutEvent,l=this.getBlocks(s);l.forEach(t=>t.setBefore()),n.emitEvent(new t.LayoutEvent(a,l,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?(d(t,!0),e.add(t),t.isBranch&&u(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||h(n[t])}h(i)}})}(this.__levelList),function(t){t.list.forEach(c)}(s),this.extraBlock&&l.push(this.extraBlock),l.forEach(t=>t.setAfter()),n.emitEvent(new t.LayoutEvent(r,l,this.times)),n.emitEvent(new t.LayoutEvent(o,l,this.times)),this.addBlocks(l),this.__levelList.reset(),this.__updatedList=null,t.Run.end(i)}fullLayout(){const e=t.Run.start("FullLayout"),{target:i}=this,{BEFORE:n,LAYOUT:s,AFTER:a}=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(a,r,this.times)),this.addBlocks(r),t.Run.end(e)}static fullLayout(e){_(e,!0),e.isBranch?t.BranchHelper.updateBounds(e):t.LeafHelper.updateBounds(e),m(e)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new g([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new g(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){this.__eventIds=[this.target.on_([[t.LayoutEvent.REQUEST,this.layout,this],[t.LayoutEvent.AGAIN,this.layoutAgain,this],[t.WatchEvent.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const v=t.Debug.get("Renderer");class x{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(e,i,n){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:120},this.target=e,this.canvas=i,n&&(this.config=t.DataHelper.default(n,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.__requestRender()}requestLayout(){this.target.emit(t.LayoutEvent.REQUEST)}checkRender(){if(this.running){const{target:e}=this;e.isApp&&(e.emit(t.RenderEvent.CHILD_START,e),e.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),e.emit(t.RenderEvent.CHILD_END,e)),this.changed&&this.canvas.view&&this.render(),this.target.emit(t.RenderEvent.NEXT)}}render(e){if(!this.running||!this.canvas.view)return this.update();const{target:i}=this;this.times=0,this.totalBounds=new t.Bounds,v.log(i.innerName,"---\x3e");try{this.emitRender(t.RenderEvent.START),this.renderOnce(e),this.emitRender(t.RenderEvent.END,this.totalBounds),t.ImageManager.clearRecycled()}catch(t){this.rendering=!1,v.error(t)}v.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(e){if(this.rendering)return v.warn("rendering");if(this.times>3)return v.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new t.Bounds,this.renderOptions={},e)this.emitRender(t.RenderEvent.BEFORE),e();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(t.RenderEvent.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(t.RenderEvent.RENDER,this.renderBounds,this.renderOptions),this.emitRender(t.RenderEvent.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,this.waitAgain&&(this.waitAgain=!1,this.renderOnce())}partRender(){const{canvas: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),a=new t.Bounds(s);n.save(),s.spread(x.clipSpread).ceil(),n.clearWorld(s),n.clipWorld(s),this.__render(s,a),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),a=s?{includes:s}:{bounds:e,includes:s};this.needFill&&n.fillWorld(e,this.config.fill),t.Debug.showRepaint&&t.Debug.drawRepaint(n,e),t.Platform.render(this.target,n,a),this.renderBounds=i=i||e,this.renderOptions=a,this.totalBounds.isEmpty()?this.totalBounds=i:this.totalBounds.add(i),n.updateRender(i)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:e}=this;if(e){const i=new t.Bounds;i.setList(e),e.length=0,e.push(i)}}__requestRender(){const e=this.target;if(this.requestTime||!e)return;if(e.parentApp)return e.parentApp.requestRender(!1);const i=this.requestTime=Date.now(),n=()=>{const e=1e3/(Date.now()-i),{maxFPS:s}=this.config;if(s&&e>s-.5)return t.Platform.requestRender(n);this.FPS=Math.min(120,Math.ceil(e)),this.requestTime=0,this.checkRender()};t.Platform.requestRender(n)}__onResize(e){if(!this.canvas.unreal){if(e.bigger||!e.samePixelRatio){const{width:i,height:n}=e.old;if(!new t.Bounds(0,0,i,n).includes(this.target.__world)||this.needFill||!e.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new t.Bounds(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;t.updatedList&&t.updatedList.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||v.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(e,i,n){this.target.emitEvent(new t.RenderEvent(e,this.times,i,n))}__listenEvents(){this.__eventIds=[this.target.on_([[t.RenderEvent.REQUEST,this.update,this],[t.LayoutEvent.END,this.__onLayoutEnd,this],[t.RenderEvent.AGAIN,this.renderAgain,this],[t.ResizeEvent.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}function b(t,e){const i=t.__,{rows:n,decorationY:s}=i.__textDrawData;let a;i.__isPlacehold&&i.placeholderColor&&(e.fillStyle=i.placeholderColor);for(let t=0,i=n.length;t<i;t++)a=n[t],a.text?e.fillText(a.text,a.x,a.y):a.data&&a.data.forEach(t=>{e.fillText(t.char,t.x,a.y)});if(s){const{decorationColor:t,decorationHeight:a}=i.__textDrawData;t&&(e.fillStyle=t),n.forEach(t=>s.forEach(i=>e.fillRect(t.x,t.y+i,t.width,a)))}}function E(t,e){t.__.__font?b(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function B(t,e,i){switch(e.__.strokeAlign){case"center":R(t,1,e,i);break;case"inside":L(t,"inside",e,i);break;case"outside":e.__.__fillAfterStroke?R(t,2,e,i):L(t,"outside",e,i)}}function R(e,i,n,s){const a=n.__;t.isObject(e)?k(e,i,!0,n,s):(s.setStroke(e,a.__strokeWidth*i,a),S(n,s))}function L(e,i,n,s){const a=s.getSameCanvas(!0,!0);a.font=n.__.__font,R(e,2,n,a),a.blendMode="outside"===i?"destination-out":"destination-in",b(n,a),a.blendMode="normal",t.LeafHelper.copyCanvasByWorld(n,s,a),a.recycle(n.__nowWorld)}function S(t,e){let i,n=t.__.__textDrawData;const{rows:s,decorationY:a}=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(a){const{decorationHeight:t}=n;s.forEach(i=>a.forEach(n=>e.strokeRect(i.x,i.y+n,i.width,t)))}}function k(t,i,n,s,a){let r;const o=s.__,{__hasMultiStrokeStyle:l}=o;l||a.setStroke(void 0,o.__strokeWidth*i,o);for(let d=0,h=t.length;d<h;d++)if(r=t[d],(!r.image||!e.PaintImage.checkImage(s,a,r,!1))&&r.style){if(l){const{strokeStyle:t}=r;t?a.setStroke(r.style,o.__getRealStrokeWidth(t)*i,o,t):a.setStroke(r.style,o.__strokeWidth*i,o)}else a.strokeStyle=r.style;r.blendMode?(a.saveBlendMode(r.blendMode),n?S(s,a):a.stroke(),a.restoreBlendMode()):n?S(s,a):a.stroke()}}function P(e,i,n){const s=i.__;if(s.__strokeWidth)if(s.__font)B(e,i,n);else switch(s.strokeAlign){case"center":C(e,1,i,n);break;case"inside":!function(t,e,i){i.save(),i.clipUI(e),C(t,2,e,i),i.restore()}(e,i,n);break;case"outside":!function(e,i,n){const s=i.__;if(s.__fillAfterStroke)C(e,2,i,n);else{const{renderBounds:a}=i.__layout,r=n.getSameCanvas(!0,!0);i.__drawRenderPath(r),C(e,2,i,r),r.clipUI(s),r.clearWorld(a),t.LeafHelper.copyCanvasByWorld(i,n,r),r.recycle(i.__nowWorld)}}(e,i,n)}}function C(i,n,s,a){const r=s.__;t.isObject(i)?k(i,n,!1,s,a):(a.setStroke(i,r.__strokeWidth*n,r),a.stroke()),r.__useArrow&&e.Paint.strokeArrow(i,s,a)}x.clipSpread=10,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)=>{},interaction:(t,e,i,n)=>{}}),t.Platform.layout=y.fullLayout,t.Platform.render=function(e,i,n){const s=Object.assign(Object.assign({},n),{topRendering:!0});n.topList=new t.LeafList,e.__render(i,n),n.topList.length&&n.topList.forEach(t=>t.__render(i,s))};const{getSpread:A,getOuterOf:O,getByMove:M,getIntersectData:T}=t.BoundsHelper;let D;const{stintSet:W}=t.DataHelper,{hasTransparent:I}=e.ColorConvert;function z(i,n,s){if(!t.isObject(n)||!1===n.visible||0===n.opacity)return;let a;const{boxBounds:r}=s.__layout;switch(n.type){case"image":a=e.PaintImage.image(s,i,n,r,!D||!D[n.url]);break;case"linear":a=e.PaintGradient.linearGradient(n,r);break;case"radial":a=e.PaintGradient.radialGradient(n,r);break;case"angular":a=e.PaintGradient.conicGradient(n,r);break;case"solid":const{type:o,color:l,opacity:d}=n;a={type:o,style:e.ColorConvert.string(l,d)};break;default:t.isUndefined(n.r)||(a={type:"solid",style:e.ColorConvert.string(n)})}if(a){if(t.isString(a.style)&&I(a.style)&&(a.isTransparent=!0),n.style){if(0===n.style.strokeWidth)return;a.strokeStyle=n.style}n.editing&&(a.editing=n.editing),n.blendMode&&(a.blendMode=n.blendMode)}return a}const H={compute:function(i,n){const s=n.__,a=[];let r,o,l,d=s.__input[i];t.isArray(d)||(d=[d]),D=e.PaintImage.recycleImage(i,s);for(let t,e=0,s=d.length;e<s;e++)(t=z(i,d[e],n))&&(a.push(t),t.strokeStyle&&(l||(l=1),t.strokeStyle.strokeWidth&&(l=Math.max(l,t.strokeStyle.strokeWidth))));s["_"+i]=a.length?a:void 0,a.length&&a.every(t=>t.isTransparent)&&(a.some(t=>t.image)&&(r=!0),o=!0),"fill"===i?(W(s,"__isAlphaPixelFill",r),W(s,"__isTransparentFill",o)):(W(s,"__isAlphaPixelStroke",r),W(s,"__isTransparentStroke",o),W(s,"__hasMultiStrokeStyle",l))},fill:function(t,e,i){i.fillStyle=t,E(e,i)},fills:function(t,i,n){let s;for(let a=0,r=t.length;a<r;a++){if(s=t[a],s.image){if(e.PaintImage.checkImage(i,n,s,!i.__.__font))continue;if(!s.style){!a&&s.image.isPlacehold&&i.drawImagePlaceholder(n,s.image);continue}}if(n.fillStyle=s.style,s.transform||s.scaleFixed){if(n.save(),s.transform&&n.transform(s.transform),s.scaleFixed){const{scaleX:t,scaleY:e}=i.getRenderScaleData(!0);(!0===s.scaleFixed||"zoom-in"===s.scaleFixed&&t>1&&e>1)&&n.scale(1/t,1/e)}s.blendMode&&(n.blendMode=s.blendMode),E(i,n),n.restore()}else s.blendMode?(n.saveBlendMode(s.blendMode),E(i,n),n.restoreBlendMode()):E(i,n)}},fillPathOrText:E,fillText:b,stroke:P,strokes:function(t,e,i){P(t,e,i)},strokeText:B,drawTextStroke:S,shape:function(e,i,n){const s=i.getSameCanvas(),a=e.__nowWorld,r=i.bounds;let o,l,d,h,c,{scaleX:u,scaleY:f}=e.getRenderScaleData(!0);if(r.includes(a))c=s,o=h=a;else{const{renderShapeSpread:s}=e.__layout;let p;if(t.Platform.fullImageShadow)p=a;else{const t=s?A(r,u===f?s*u:[s*f,s*u]):r;p=T(t,a)}d=r.getFitMatrix(p);let{a:g,d:_}=d;d.a<1&&(c=i.getSameCanvas(),e.__renderShape(c,n),u*=g,f*=_),h=O(a,d),o=M(h,-d.e,-d.f);const m=n.matrix;m?(l=new t.Matrix(d),l.multiply(m),g*=m.scaleX,_*=m.scaleY):l=d,l.withScale(g,_),n=Object.assign(Object.assign({},n),{matrix:l})}return e.__renderShape(s,n),{canvas:s,matrix:l,fitMatrix:d,bounds:o,worldCanvas:c,shapeBounds:h,scaleX:u,scaleY:f}}};let F={},U=t.getMatrixData();const{get:j,rotateOfOuter:G,translate:V,scaleOfOuter:Y,multiplyParent:N,scale:q,rotate:X,skew:Q}=t.MatrixHelper;function Z(t,e,i,n,s,a,r){const o=j();V(o,e.x+i,e.y+n),q(o,s,a),r&&G(o,{x:e.x+e.width/2,y:e.y+e.height/2},r),t.transform=o}function $(t,e,i,n,s,a,r,o,l){const d=j();J(d,e,i,n,s,a,r,o),l&&(U.a=e.width/l.width,U.d=e.height/l.height,N(d,U)),t.transform=d}function K(t,e,i,n,s,a,r,o,l,d,h,c){const u=j();if(c)J(u,e,s,a,r,o,l,d);else{if(l)if("center"===h)G(u,{x:i/2,y:n/2},l);else switch(X(u,l),l){case 90:V(u,n,0);break;case 180:V(u,i,n);break;case 270:V(u,0,i)}F.x=e.x+s,F.y=e.y+a,V(u,F.x,F.y),r&&Y(u,F,r,o)}t.transform=u}function J(t,e,i,n,s,a,r,o){r&&X(t,r),o&&Q(t,o.x,o.y),s&&q(t,s,a),V(t,e.x+i,e.y+n)}const{get:tt,translate:et}=t.MatrixHelper,it=new t.Bounds,nt={},st={};function at(t,e,i,n){const{changeful:s,sync:a,scaleFixed:r}=i;s&&(t.changeful=s),a&&(t.sync=a),r&&(t.scaleFixed=r),t.data=rt(i,n,e)}function rt(e,i,n){e.padding&&(i=it.set(i).shrink(e.padding)),"strench"===e.mode&&(e.mode="stretch");let{width:s,height:a}=n;const{opacity:r,mode:o,align:l,offset:d,scale:h,size:c,rotation:u,skew:f,clipSize:p,repeat:g,gap:_,filters:m}=e,w=i.width===s&&i.height===a,y={mode:o},v="center"!==l&&(u||0)%180==90;let x,b;switch(t.BoundsHelper.set(st,0,0,v?a:s,v?s:a),o&&"cover"!==o&&"fit"!==o?((h||c)&&(t.MathHelper.getScaleData(h,c,n,nt),x=nt.scaleX,b=nt.scaleY),(l||_||g)&&(x&&t.BoundsHelper.scale(st,x,b,!0),l&&t.AlignHelper.toPoint(l,st,i,st,!0,!0))):w&&!u||(x=b=t.BoundsHelper.getFitScale(i,st,"fit"!==o),t.BoundsHelper.put(i,n,l,x,!1,st),t.BoundsHelper.scale(st,x,b,!0)),d&&t.PointHelper.move(st,d),o){case"stretch":w||(s=i.width,a=i.height);break;case"normal":case"clip":(st.x||st.y||x||p||u||f)&&$(y,i,st.x,st.y,x,b,u,f,e.clipSize);break;case"repeat":(!w||x||u||f)&&K(y,i,s,a,st.x,st.y,x,b,u,f,l,e.freeTransform),g||(y.repeat="repeat");const n=t.isObject(g);(_||n)&&(y.gap=function(e,i,n,s,a){let r,o;t.isObject(e)?(r=e.x,o=e.y):r=o=e;return{x:ot(r,n,a.width,i&&i.x),y:ot(o,s,a.height,i&&i.y)}}(_,n&&g,st.width,st.height,i));break;default:x&&Z(y,i,st.x,st.y,x,b,u)}return y.transform||(i.x||i.y)&&(y.transform=tt(),et(y.transform,i.x,i.y)),x&&"stretch"!==o&&(y.scaleX=x,y.scaleY=b),y.width=s,y.height=a,r&&(y.opacity=r),m&&(y.filters=m),g&&(y.repeat=t.isString(g)?"x"===g?"repeat-x":"repeat-y":"repeat"),y}function ot(e,i,n,s){const a=t.isString(e)||s?(s?n-s*i:n%i)/((s||Math.floor(n/i))-1):e;return"auto"===e&&a<0?0:a}let lt,dt=new t.Bounds;const{isSame:ht}=t.BoundsHelper;function ct(t,e,i,n,s,a){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||at(s,n,i,a),!0}function ut(e,i){gt(e,t.ImageEvent.LOAD,i)}function ft(e,i){gt(e,t.ImageEvent.LOADED,i)}function pt(e,i,n){i.error=n,e.forceUpdate("surface"),gt(e,t.ImageEvent.ERROR,i)}function gt(e,i,n){e.hasEvent(i)&&e.emitEvent(new t.ImageEvent(i,n))}function _t(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:mt,scale:wt,copy:yt}=t.MatrixHelper,{floor:vt,ceil:xt,max:bt,abs:Et}=Math;function Bt(e,i,n){let{scaleX:s,scaleY:a}=e.getRenderScaleData(!0,i.scaleFixed);const r=s+"-"+a+"-"+n;if(i.patternId===r||e.destroyed)return!1;{const{image:o,data:l}=i;let d,h,{width:c,height:u,scaleX:f,scaleY:p,transform:g,repeat:_,gap:m}=l;s*=n,a*=n,f&&(f=Et(f),p=Et(p),h=mt(),yt(h,g),wt(h,1/f,1/p),s*=f,a*=p),c*=s,u*=a;const w=c*u;if(!_&&w>t.Platform.image.maxCacheSize)return!1;let y=t.Platform.image.maxPatternSize;if(o.isSVG){const t=c/o.width;t>1&&(d=t/xt(t))}else{const t=o.width*o.height;y>t&&(y=t)}w>y&&(d=Math.sqrt(w/y)),d&&(s/=d,a/=d,c/=d,u/=d),f&&(s/=f,a/=p);const v=m&&m.x*s,x=m&&m.y*a;if(g||1!==s||1!==a){const t=c+(v||0),e=u+(x||0);s/=t/bt(vt(t),1),a/=e/bt(vt(e),1),h||(h=mt(),g&&yt(h,g)),wt(h,1/s,1/a)}const b=o.getCanvas(c,u,l.opacity,l.filters,v,x,e.leafer&&e.leafer.config.smooth),E=o.getPattern(b,_||t.Platform.origin.noRepeat||"no-repeat",h,i);return i.style=E,i.patternId=r,!0}}function Rt(t,e,i,n){return new(i||(i=Promise))(function(s,a){function r(t){try{l(n.next(t))}catch(t){a(t)}}function o(t){try{l(n.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(r,o)}l((n=n.apply(t,e||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const Lt={image:function(e,i,n,s,a){let r,o;const l=t.ImageManager.get(n);return lt&&n===lt.paint&&ht(s,lt.boxBounds)?r=lt.leafPaint:(r={type:n.type,image:l},l.hasAlphaPixel&&(r.isTransparent=!0),lt=l.use>1?{leafPaint:r,paint:n,boxBounds:dt.set(s)}:null),(a||l.loading)&&(o={image:l,attrName:i,attrValue:n}),l.ready?(ct(e,i,n,l,r,s),a&&(ut(e,o),ft(e,o))):l.error?a&&pt(e,o,l.error):(a&&(_t(e,!0),ut(e,o)),r.loadId=l.load(()=>{_t(e,!1),e.destroyed||(ct(e,i,n,l,r,s)&&(l.hasAlphaPixel&&(e.__layout.hitCanvasChanged=!0),e.forceUpdate("surface")),ft(e,o)),r.loadId=void 0},t=>{_t(e,!1),pt(e,o,t),r.loadId=void 0}),e.placeholderColor&&(e.placeholderDelay?setTimeout(()=>{l.ready||(l.isPlacehold=!0,e.forceUpdate("surface"))},e.placeholderDelay):l.isPlacehold=!0)),r},checkImage:function(i,n,s,a){const{scaleX:r,scaleY:o}=i.getRenderScaleData(!0,s.scaleFixed),{pixelRatio:l}=n,{data:d}=s;if(!d||s.patternId===r+"-"+o+"-"+l&&!e.Export.running)return!1;if(a)if(d.repeat)a=!1;else if(!(s.changeful||"miniapp"===t.Platform.name&&t.ResizeEvent.isResizing(i)||e.Export.running)){let{width:e,height:i}=d;e*=r*l,i*=o*l,d.scaleX&&(e*=d.scaleX,i*=d.scaleY),a=e*i>t.Platform.image.maxCacheSize}return a?(i.__.__isFastShadow&&(n.fillStyle=s.style||"#000",n.fill()),function(t,e,i,n){e.save(),e.clipUI(t),i.blendMode&&(e.blendMode=i.blendMode);n.opacity&&(e.opacity*=n.opacity);n.transform&&e.transform(n.transform);e.drawImage(i.image.getFull(n.filters),0,0,n.width,n.height),e.restore()}(i,n,s,d),!0):(!s.style||s.sync||e.Export.running?Bt(i,s,l):s.patternTask||(s.patternTask=t.ImageManager.patternTasker.add(()=>Rt(this,void 0,void 0,function*(){s.patternTask=null,n.bounds.hit(i.__nowWorld)&&Bt(i,s,l),i.forceUpdate("surface")}),300)),!1)},createPattern:Bt,recycleImage:function(e,i){const n=i["_"+e];if(t.isArray(n)){let s,a,r,o,l;for(let d=0,h=n.length;d<h;d++)s=n[d],a=s.image,l=a&&a.url,l&&(r||(r={}),r[l]=!0,t.ImageManager.recycle(a),a.loading&&(o||(o=i.__input&&i.__input[e]||[],t.isArray(o)||(o=[o])),a.unload(n[d].loadId,!o.some(t=>t.url===l))));return r}return null},createData:at,getPatternData:rt,fillOrFitMode:Z,clipMode:$,repeatMode:K},{toPoint:St}=t.AroundHelper,{hasTransparent:kt}=e.ColorConvert,Pt={},Ct={};function At(i,n,s,a){if(s){let r,o,l,d;for(let i=0,h=s.length;i<h;i++)r=s[i],t.isString(r)?(l=i/(h-1),o=e.ColorConvert.string(r,a)):(l=r.offset,o=e.ColorConvert.string(r.color,a)),n.addColorStop(l,o),!d&&kt(o)&&(d=!0);d&&(i.isTransparent=!0)}}const{getAngle:Ot,getDistance:Mt}=t.PointHelper,{get:Tt,rotateOfOuter:Dt,scaleOfOuter:Wt}=t.MatrixHelper,{toPoint:It}=t.AroundHelper,zt={},Ht={};function Ft(t,e,i,n,s){let a;const{width:r,height:o}=t;if(r!==o||n){const t=Ot(e,i);a=Tt(),s?(Wt(a,e,r/o*(n||1),1),Dt(a,e,t+90)):(Wt(a,e,1,r/o*(n||1)),Dt(a,e,t))}return a}const{getDistance:Ut}=t.PointHelper,{toPoint:jt}=t.AroundHelper,Gt={},Vt={};const Yt={linearGradient:function(e,i){let{from:n,to:s,type:a,opacity:r}=e;St(n||"top",i,Pt),St(s||"bottom",i,Ct);const o=t.Platform.canvas.createLinearGradient(Pt.x,Pt.y,Ct.x,Ct.y),l={type:a,style:o};return At(l,o,e.stops,r),l},radialGradient:function(e,i){let{from:n,to:s,type:a,opacity:r,stretch:o}=e;It(n||"center",i,zt),It(s||"bottom",i,Ht);const l=t.Platform.canvas.createRadialGradient(zt.x,zt.y,0,zt.x,zt.y,Mt(zt,Ht)),d={type:a,style:l};At(d,l,e.stops,r);const h=Ft(i,zt,Ht,o,!0);return h&&(d.transform=h),d},conicGradient:function(e,i){let{from:n,to:s,type:a,opacity:r,stretch:o}=e;jt(n||"center",i,Gt),jt(s||"bottom",i,Vt);const l=t.Platform.conicGradientSupport?t.Platform.canvas.createConicGradient(0,Gt.x,Gt.y):t.Platform.canvas.createRadialGradient(Gt.x,Gt.y,0,Gt.x,Gt.y,Ut(Gt,Vt)),d={type:a,style:l};At(d,l,e.stops,r);const h=Ft(i,Gt,Vt,o||1,t.Platform.conicGradientRotate90);return h&&(d.transform=h),d},getTransform:Ft},{copy:Nt,toOffsetOutBounds:qt}=t.BoundsHelper,Xt={},Qt={};function Zt(e,i,n,s){const{bounds:a,shapeBounds:r}=s;if(t.Platform.fullImageShadow){if(Nt(Xt,e.bounds),Xt.x+=i.x-r.x,Xt.y+=i.y-r.y,n){const{fitMatrix:t}=s;Xt.x-=(a.x+(t?t.e:0)+a.width/2)*(n-1),Xt.y-=(a.y+(t?t.f:0)+a.height/2)*(n-1),Xt.width*=n,Xt.height*=n}e.copyWorld(s.canvas,e.bounds,Xt)}else n&&(Nt(Xt,i),Xt.x-=i.width/2*(n-1),Xt.y-=i.height/2*(n-1),Xt.width*=n,Xt.height*=n),e.copyWorld(s.canvas,r,n?Xt:i)}const{toOffsetOutBounds:$t}=t.BoundsHelper,Kt={};const Jt={shadow:function(i,n,s){let a,r;const{__nowWorld:o,__layout:l}=i,{shadow:d}=i.__,{worldCanvas:h,bounds:c,shapeBounds:u,scaleX:f,scaleY:p}=s,g=n.getSameCanvas(),_=d.length-1;qt(c,Qt),d.forEach((d,m)=>{let w=1;if(d.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(w=1/t)}g.setWorldShadow(Qt.offsetX+d.x*f*w,Qt.offsetY+d.y*p*w,d.blur*f*w,e.ColorConvert.string(d.color)),r=d.spread?1+2*d.spread/(l.boxBounds.width+2*(l.strokeBoxSpread||0))*w:0,Zt(g,Qt,r,s),a=c,d.box&&(g.restore(),g.save(),h&&(g.copyWorld(g,c,o,"copy"),a=o),h?g.copyWorld(h,o,o,"destination-out"):g.copyWorld(s.canvas,u,c,"destination-out")),e.Effect.isTransformShadow(d)?e.Effect.renderTransformShadow(i,n,g,a,d):t.LeafHelper.copyCanvasByWorld(i,n,g,a,d.blendMode),_&&m<_&&g.clearWorld(a)}),g.recycle(a)},innerShadow:function(i,n,s){let a,r;const{__nowWorld:o,__layout:l}=i,{innerShadow:d}=i.__,{worldCanvas:h,bounds:c,shapeBounds:u,scaleX:f,scaleY:p}=s,g=n.getSameCanvas(),_=d.length-1;$t(c,Kt),d.forEach((d,m)=>{let w=1;if(d.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(w=1/t)}g.save(),g.setWorldShadow(Kt.offsetX+d.x*f*w,Kt.offsetY+d.y*p*w,d.blur*f*w),r=d.spread?1-2*d.spread/(l.boxBounds.width+2*(l.strokeBoxSpread||0))*w:0,Zt(g,Kt,r,s),g.restore(),h?(g.copyWorld(g,c,o,"copy"),g.copyWorld(h,o,o,"source-out"),a=o):(g.copyWorld(s.canvas,u,c,"source-out"),a=c),g.fillWorld(a,e.ColorConvert.string(d.color),"source-in"),t.LeafHelper.copyCanvasByWorld(i,n,g,a,d.blendMode),_&&m<_&&g.clearWorld(a)}),g.recycle(a)},blur:function(t,e,i){const{blur:n}=t.__;i.setWorldBlur(n*t.__nowWorld.a),i.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),i.filter="none"},backgroundBlur:function(t,e,i){},getShadowSpread:function(t,e){let i=0;return e.forEach(t=>i=Math.max(i,Math.max(Math.abs(t.y),Math.abs(t.x))+(t.spread>0?t.spread:0)+1.5*t.blur)),i},isTransformShadow(t){}},{excludeRenderBounds:te}=t.LeafBoundsHelper;let ee;function ie(t,e,i,n,s,a,r,o){switch(e){case"grayscale":ee||(ee=!0,s.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,n,s,a){const r=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(n,r),a&&n.recycle(r);se(t,e,i,1,s,a)}(t,i,n,s,r,o);break;case"opacity-path":se(t,i,n,a,r,o);break;case"path":o&&i.restore()}}function ne(t){return t.getSameCanvas(!1,!0)}function se(t,e,i,n,s,a){const r=t.__nowWorld;e.resetTransform(),e.opacity=n,e.copyWorld(i,r,void 0,s),a?i.recycle(r):i.clearWorld(r)}e.Group.prototype.__renderMask=function(t,e){let i,n,s,a,r,o;const{children:l}=this;for(let d=0,h=l.length;d<h;d++){if(i=l[d],o=i.__.mask,o){r&&(ie(this,r,t,s,n,a,void 0,!0),n=s=null),a=i.__.opacity,ee=!1,"path"===o||"clipping-path"===o?(a<1?(r="opacity-path",s||(s=ne(t))):(r="path",t.save()),i.__clip(s||t,e)):(r="grayscale"===o?"grayscale":"alpha",n||(n=ne(t)),s||(s=ne(t)),i.__render(n,e)),"clipping"!==o&&"clipping-path"!==o||te(i,e)||i.__render(t,e);continue}const h=1===a&&i.__.__blendMode;h&&ie(this,r,t,s,n,a,void 0,!1),te(i,e)||i.__render(s||t,e),h&&ie(this,r,t,s,n,a,h,!1)}ie(this,r,t,s,n,a,void 0,!0)};const ae=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",re=ae+"_#~&*+\\=|≮≯≈≠=…",oe=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 le(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const de=le("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),he=le("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),ce=le(ae),ue=le(re),fe=le("- —/~|┆·");var pe;!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"}(pe||(pe={}));const{Letter:ge,Single:_e,Before:me,After:we,Symbol:ye,Break:ve}=pe;function xe(t){return de[t]?ge:fe[t]?ve:he[t]?me:ce[t]?we:ue[t]?ye:oe.test(t)?_e:ge}const be={trimRight(t){const{words:e}=t;let i,n=0,s=e.length;for(let a=s-1;a>-1&&(i=e[a].data[0]," "===i.char);a--)n++,t.width-=i.width;n&&e.splice(s-n,n)}};function Ee(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:Be}=be,{Letter:Re,Single:Le,Before:Se,After:ke,Symbol:Pe,Break:Ce}=pe;let Ae,Oe,Me,Te,De,We,Ie,ze,He,Fe,Ue,je,Ge,Ve,Ye,Ne,qe,Xe=[];function Qe(t,e){He&&!ze&&(ze=He),Ae.data.push({char:t,width:e}),Me+=e}function Ze(){Te+=Me,Ae.width=Me,Oe.words.push(Ae),Ae={data:[]},Me=0}function $e(){Ve&&(Ye.paraNumber++,Oe.paraStart=!0,Ve=!1),He&&(Oe.startCharSize=ze,Oe.endCharSize=He,ze=0),Oe.width=Te,Ne.width?Be(Oe):qe&&Ke(),Xe.push(Oe),Oe={words:[]},Te=0}function Ke(){Te>(Ye.maxWidth||0)&&(Ye.maxWidth=Te)}const{top:Je,right:ti,bottom:ei,left:ii}=t.Direction4;function ni(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 si={getDrawData:function(i,n){t.isString(i)||(i=String(i));let s=0,a=0,r=n.__getInput("width")||0,o=n.__getInput("height")||0;const{textDecoration:l,__font:d,__padding:h}=n;h&&(r?(s=h[ii],r-=h[ti]+h[ii]):n.autoSizeAlign||(s=h[ii]),o?(a=h[Je],o-=h[Je]+h[ei]):n.autoSizeAlign||(a=h[Je]));const c={bounds:{x:s,y:a,width:r,height:o},rows:[],paraNumber:0,font:t.Platform.canvas.font=d};return function(e,i,n){Ye=e,Xe=e.rows,Ne=e.bounds,qe=!Ne.width&&!n.autoSizeAlign;const{__letterSpacing:s,paraIndent:a,textCase:r}=n,{canvas:o}=t.Platform,{width:l,height:d}=Ne;if(l||d||s||"none"!==r){const t="none"!==n.textWrap,e="break"===n.textWrap;Ve=!0,Ue=null,ze=Ie=He=Me=Te=0,Ae={data:[]},Oe={words:[]},s&&(i=[...i]);for(let n=0,d=i.length;n<d;n++)We=i[n],"\n"===We?(Me&&Ze(),Oe.paraEnd=!0,$e(),Ve=!0):(Fe=xe(We),Fe===Re&&"none"!==r&&(We=Ee(We,r,!Me)),Ie=o.measureText(We).width,s&&(s<0&&(He=Ie),Ie+=s),je=Fe===Le&&(Ue===Le||Ue===Re)||Ue===Le&&Fe!==ke,Ge=!(Fe!==Se&&Fe!==Le||Ue!==Pe&&Ue!==ke),De=Ve&&a?l-a:l,t&&l&&Te+Me+Ie>De&&(e?(Me&&Ze(),Te&&$e()):(Ge||(Ge=Fe===Re&&Ue==ke),je||Ge||Fe===Ce||Fe===Se||Fe===Le||Me+Ie>De?(Me&&Ze(),Te&&$e()):Te&&$e()))," "===We&&!0!==Ve&&Te+Me===0||(Fe===Ce?(" "===We&&Me&&Ze(),Qe(We,Ie),Ze()):je||Ge?(Me&&Ze(),Qe(We,Ie)):Qe(We,Ie)),Ue=Fe);Me&&Ze(),Te&&$e(),Xe.length>0&&(Xe[Xe.length-1].paraEnd=!0)}else i.split("\n").forEach(t=>{Ye.paraNumber++,Te=o.measureText(t).width,Xe.push({x:a||0,text:t,width:Te,paraStart:!0}),qe&&Ke()})}(c,i,n),h&&function(t,e,i,n,s){if(!n&&i.autoSizeAlign)switch(i.textAlign){case"left":ni(e,"x",t[ii]);break;case"right":ni(e,"x",-t[ti])}if(!s&&i.autoSizeAlign)switch(i.verticalAlign){case"top":ni(e,"y",t[Je]);break;case"bottom":ni(e,"y",-t[ei])}}(h,c,n,r,o),function(t,e){const{rows:i,bounds:n}=t,s=i.length,{__lineHeight:a,__baseLine:r,__letterSpacing:o,__clipText:l,textAlign:d,verticalAlign:h,paraSpacing:c,autoSizeAlign:u}=e;let{x:f,y:p,width:g,height:_}=n,m=a*s+(c?c*(t.paraNumber-1):0),w=r;if(l&&m>_)m=Math.max(_,a),s>1&&(t.overflow=s);else if(_||u)switch(h){case"middle":p+=(_-m)/2;break;case"bottom":p+=_-m}w+=p;let y,v,x,b=g||u?g:t.maxWidth;for(let r=0,h=s;r<h;r++){if(y=i[r],y.x=f,y.width<g||y.width>g&&!l)switch(d){case"center":y.x+=(b-y.width)/2;break;case"right":y.x+=b-y.width}y.paraStart&&c&&r>0&&(w+=c),y.y=w,w+=a,t.overflow>r&&w>m&&(y.isOverflow=!0,t.overflow=r+1),v=y.x,x=y.width,o<0&&(y.width<0?(x=-y.width+e.fontSize+o,v-=x,x+=e.fontSize):x-=o),v<n.x&&(n.x=v),x>n.width&&(n.width=x),l&&g&&g<x&&(y.isOverflow=!0,t.overflow||(t.overflow=i.length))}n.y=p,n.height=m}(c,n),function(t,e,i){const{rows:n}=t,{textAlign:s,paraIndent:a,letterSpacing:r}=e;let o,l,d,h,c,u;n.forEach(t=>{t.words&&(d=a&&t.paraStart?a:0,u=t.words.length,l=i&&("justify"===s||"both"===s)&&u>1?(i-t.width-d)/(u-1):0,h=r||t.isOverflow?0:l>.01?1:2,t.isOverflow&&!r&&(t.textMode=!0),2===h?(t.x+=d,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=d,o=t.x,t.data=[],t.words.forEach((e,i)=>{1===h?(c={char:"",x:o},o=function(t,e,i){return t.forEach(t=>{i.char+=t.char,e+=t.width}),e}(e.data,o,c),(t.isOverflow||" "!==c.char)&&t.data.push(c)):o=function(t,e,i,n){return t.forEach(t=>{(n||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width}),e}(e.data,o,t.data,t.isOverflow),!l||t.paraEnd&&"both"!==s||i===u-1||(o+=l,t.width+=l)})),t.words=null)})}(c,n,r),c.overflow&&function(e,i,n,s){if(!s)return;const{rows:a,overflow:r}=e;let{textOverflow:o}=i;if(a.splice(r),o&&"show"!==o){let e,l;"hide"===o?o="":"ellipsis"===o&&(o="...");const d=o?t.Platform.canvas.measureText(o).width:0,h=n+s-d;("none"===i.textWrap?a:[a[r-1]]).forEach(t=>{if(t.isOverflow&&t.data){let i=t.data.length-1;for(let n=i;n>-1&&(e=t.data[n],l=e.x+e.width,!(n===i&&l<h));n--){if(l<h&&" "!==e.char||!n){t.data.splice(n+1),t.width-=e.width;break}t.width-=e.width}t.width+=d,t.data.push({char:o,x:l}),t.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(t)}})}}(c,n,s,r),"none"!==l&&function(i,n){let s,a=0;const{fontSize:r,textDecoration:o}=n;switch(i.decorationHeight=r/11,t.isObject(o)?(s=o.type,o.color&&(i.decorationColor=e.ColorConvert.string(o.color)),o.offset&&(a=Math.min(.3*r,Math.max(o.offset,.15*-r)))):s=o,s){case"under":i.decorationY=[.15*r+a];break;case"delete":i.decorationY=[.35*-r];break;case"under-delete":i.decorationY=[.15*r+a,.35*-r]}}(c,n),c}};const ai={string:function(i,n){const s=t.isNumber(n)&&n<1;if(t.isString(i)){if(!s||!e.ColorConvert.object)return i;i=e.ColorConvert.object(i)}let a=t.isUndefined(i.a)?1:i.a;s&&(a*=n);const r=i.r+","+i.g+","+i.b;return 1===a?"rgb("+r+")":"rgba("+r+","+a+")"}};Object.assign(e.TextConvert,si),Object.assign(e.ColorConvert,ai),Object.assign(e.Paint,H),Object.assign(e.PaintImage,Lt),Object.assign(e.PaintGradient,Yt),Object.assign(e.Effect,Jt),r(),Object.defineProperty(exports,"LeaferImage",{enumerable:!0,get:function(){return t.LeaferImage}}),exports.Layouter=y,exports.LeaferCanvas=n,exports.Renderer=x,exports.Watcher=l,exports.useCanvas=r,Object.keys(t).forEach(function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}})}),Object.keys(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
|