@leafer-ui/worker 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/worker.cjs +3 -3
- package/dist/worker.esm.js +3 -3
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.esm.min.js.map +1 -1
- package/dist/worker.js +17 -17
- package/dist/worker.min.cjs +1 -1
- package/dist/worker.min.cjs.map +1 -1
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +17 -17
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +11 -11
package/dist/worker.js
CHANGED
|
@@ -1650,7 +1650,7 @@ var LeaferUI = function(exports) {
|
|
|
1650
1650
|
resize(view, width, height, xGap, yGap, clip, smooth, opacity, _filters, interlace) {
|
|
1651
1651
|
const realWidth = max$3(floor(width + (xGap || 0)), 1), realHeight = max$3(floor(height + (yGap || 0)), 1);
|
|
1652
1652
|
let interlaceX, interlaceY, interlaceOffset;
|
|
1653
|
-
if (interlace && (interlaceOffset = UnitConvertHelper.number(interlace.offset,
|
|
1653
|
+
if (interlace && (interlaceOffset = UnitConvertHelper.number(interlace.offset, interlace.type === "x" ? width : height))) interlace.type === "x" ? interlaceX = true : interlaceY = true;
|
|
1654
1654
|
const canvas = Platform.origin.createCanvas(interlaceY ? realWidth * 2 : realWidth, interlaceX ? realHeight * 2 : realHeight);
|
|
1655
1655
|
const ctx = canvas.getContext("2d");
|
|
1656
1656
|
if (opacity) ctx.globalAlpha = opacity;
|
|
@@ -3114,10 +3114,10 @@ var LeaferUI = function(exports) {
|
|
|
3114
3114
|
data.push(O$2, x, y, radius, startAngle, endAngle, anticlockwise ? 1 : 0);
|
|
3115
3115
|
}
|
|
3116
3116
|
},
|
|
3117
|
-
arcTo(data, x1, y1, x2, y2, radius, lastX, lastY) {
|
|
3117
|
+
arcTo(data, x1, y1, x2, y2, radius, lastX, lastY, fullRadius) {
|
|
3118
3118
|
if (!isUndefined(lastX)) {
|
|
3119
|
-
const
|
|
3120
|
-
radius = min$1(radius, min$1(
|
|
3119
|
+
const r = getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2) / (fullRadius ? 1 : 2);
|
|
3120
|
+
radius = min$1(radius, min$1(r, r * abs$3(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
|
|
3121
3121
|
}
|
|
3122
3122
|
data.push(U$2, x1, y1, x2, y2, radius);
|
|
3123
3123
|
},
|
|
@@ -3442,7 +3442,7 @@ var LeaferUI = function(exports) {
|
|
|
3442
3442
|
let command, lastCommand, commandLen;
|
|
3443
3443
|
let i = 0, x = 0, y = 0, startX = 0, startY = 0, secondX = 0, secondY = 0, lastX = 0, lastY = 0;
|
|
3444
3444
|
if (isArray(cornerRadius)) cornerRadius = cornerRadius[0] || 0;
|
|
3445
|
-
const len = data.length;
|
|
3445
|
+
const len = data.length, three = len === 9;
|
|
3446
3446
|
const smooth = [];
|
|
3447
3447
|
while (i < len) {
|
|
3448
3448
|
command = data[i];
|
|
@@ -3454,7 +3454,7 @@ var LeaferUI = function(exports) {
|
|
|
3454
3454
|
if (data[i] === L$1) {
|
|
3455
3455
|
secondX = data[i + 1];
|
|
3456
3456
|
secondY = data[i + 2];
|
|
3457
|
-
smooth.push(M, getCenterX(startX, secondX), getCenterY(startY, secondY));
|
|
3457
|
+
three ? smooth.push(M, startX, startY) : smooth.push(M, getCenterX(startX, secondX), getCenterY(startY, secondY));
|
|
3458
3458
|
} else {
|
|
3459
3459
|
smooth.push(M, startX, startY);
|
|
3460
3460
|
}
|
|
@@ -3466,11 +3466,11 @@ var LeaferUI = function(exports) {
|
|
|
3466
3466
|
i += 3;
|
|
3467
3467
|
switch (data[i]) {
|
|
3468
3468
|
case L$1:
|
|
3469
|
-
arcTo(smooth, x, y, data[i + 1], data[i + 2], cornerRadius, lastX, lastY);
|
|
3469
|
+
arcTo(smooth, x, y, data[i + 1], data[i + 2], cornerRadius, lastX, lastY, three);
|
|
3470
3470
|
break;
|
|
3471
3471
|
|
|
3472
3472
|
case Z:
|
|
3473
|
-
arcTo(smooth, x, y, startX, startY, cornerRadius, lastX, lastY);
|
|
3473
|
+
arcTo(smooth, x, y, startX, startY, cornerRadius, lastX, lastY, three);
|
|
3474
3474
|
break;
|
|
3475
3475
|
|
|
3476
3476
|
default:
|
|
@@ -3482,7 +3482,7 @@ var LeaferUI = function(exports) {
|
|
|
3482
3482
|
|
|
3483
3483
|
case Z:
|
|
3484
3484
|
if (lastCommand !== Z) {
|
|
3485
|
-
arcTo(smooth, startX, startY, secondX, secondY, cornerRadius, lastX, lastY);
|
|
3485
|
+
arcTo(smooth, startX, startY, secondX, secondY, cornerRadius, lastX, lastY, three);
|
|
3486
3486
|
smooth.push(Z);
|
|
3487
3487
|
}
|
|
3488
3488
|
i += 1;
|
|
@@ -6567,7 +6567,7 @@ var LeaferUI = function(exports) {
|
|
|
6567
6567
|
this.levelMap = null;
|
|
6568
6568
|
}
|
|
6569
6569
|
}
|
|
6570
|
-
const version = "2.0.
|
|
6570
|
+
const version = "2.0.1";
|
|
6571
6571
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6572
6572
|
get allowBackgroundColor() {
|
|
6573
6573
|
return true;
|
|
@@ -7523,16 +7523,16 @@ var LeaferUI = function(exports) {
|
|
|
7523
7523
|
return t.fill || t.stroke;
|
|
7524
7524
|
}
|
|
7525
7525
|
get __autoWidth() {
|
|
7526
|
-
return
|
|
7526
|
+
return this._width == null;
|
|
7527
7527
|
}
|
|
7528
7528
|
get __autoHeight() {
|
|
7529
|
-
return
|
|
7529
|
+
return this._height == null;
|
|
7530
7530
|
}
|
|
7531
7531
|
get __autoSide() {
|
|
7532
|
-
return
|
|
7532
|
+
return this._width == null || this._height == null;
|
|
7533
7533
|
}
|
|
7534
7534
|
get __autoSize() {
|
|
7535
|
-
return
|
|
7535
|
+
return this._width == null && this._height == null;
|
|
7536
7536
|
}
|
|
7537
7537
|
setVisible(value) {
|
|
7538
7538
|
this._visible = value;
|
|
@@ -11774,7 +11774,7 @@ var LeaferUI = function(exports) {
|
|
|
11774
11774
|
let {x: x, y: y, width: width, height: height} = bounds, realHeight = __lineHeight * countRows + (paraSpacing ? paraSpacing * (drawData.paraNumber - 1) : 0);
|
|
11775
11775
|
let starY = __baseLine;
|
|
11776
11776
|
if (__clipText && realHeight > height) {
|
|
11777
|
-
realHeight = Math.max(height, __lineHeight);
|
|
11777
|
+
realHeight = Math.max(style.__autoHeight ? realHeight : height, __lineHeight);
|
|
11778
11778
|
if (countRows > 1) drawData.overflow = countRows;
|
|
11779
11779
|
} else if (height || autoSizeAlign) {
|
|
11780
11780
|
switch (verticalAlign) {
|
|
@@ -11830,10 +11830,10 @@ var LeaferUI = function(exports) {
|
|
|
11830
11830
|
bounds.height = realHeight;
|
|
11831
11831
|
}
|
|
11832
11832
|
function clipText(drawData, style, x, width) {
|
|
11833
|
-
if (!width) return;
|
|
11834
11833
|
const {rows: rows, overflow: overflow} = drawData;
|
|
11835
11834
|
let {textOverflow: textOverflow} = style;
|
|
11836
|
-
rows.splice(overflow);
|
|
11835
|
+
if (overflow) rows.splice(overflow);
|
|
11836
|
+
if (!width) return;
|
|
11837
11837
|
if (textOverflow && textOverflow !== "show") {
|
|
11838
11838
|
if (textOverflow === "hide") textOverflow = ""; else if (textOverflow === "ellipsis") textOverflow = "...";
|
|
11839
11839
|
let char, charRight;
|
package/dist/worker.min.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var t,e=require("@leafer/core"),a=require("@leafer-ui/core"),n=require("@leafer-ui/draw");exports.PathNodeHandleType=void 0,(t=exports.PathNodeHandleType||(exports.PathNodeHandleType={}))[t.none=1]="none",t[t.free=2]="free",t[t.mirrorAngle=3]="mirrorAngle",t[t.mirror=4]="mirror";class i extends e.LeaferCanvasBase{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=e.Platform.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:a}=this;this.view.width=Math.ceil(t*a),this.view.height=Math.ceil(e*a),this.clientBounds=this.bounds}}e.canvasPatch(OffscreenCanvasRenderingContext2D.prototype),e.canvasPatch(Path2D.prototype);const{mineType:r}=e.FileHelper;function s(t,a){e.Platform.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,a)=>new Promise((n,i)=>{t.convertToBlob({type:r(e),quality:a}).then(t=>{var e=new FileReader;e.onload=t=>n(t.target.result),e.onerror=t=>i(t),e.readAsDataURL(t)}).catch(t=>{i(t)})}),canvasToBolb:(t,e,a)=>t.convertToBlob({type:r(e),quality:a}),canvasSaveAs:(t,e,a)=>new Promise(t=>t()),download(t,e){},loadImage:t=>new Promise((a,n)=>{let i=new XMLHttpRequest;i.open("GET",e.Platform.image.getRealURL(t),!0),i.responseType="blob",i.onload=()=>{createImageBitmap(i.response).then(t=>{a(t)}).catch(t=>{n(t)})},i.onerror=t=>n(t),i.send()})},e.Platform.canvas=e.Creator.canvas(),e.Platform.conicGradientSupport=!!e.Platform.canvas.context.createConicGradient}Object.assign(e.Creator,{canvas:(t,e)=>new i(t,e),image:t=>new e.LeaferImage(t)}),e.Platform.name="web",e.Platform.isWorker=!0,e.Platform.backgrounder=!0,e.Platform.requestRender=function(t){requestAnimationFrame(t)},e.defineKey(e.Platform,"devicePixelRatio",{get:()=>1});const{userAgent:o}=navigator;o.indexOf("Firefox")>-1?(e.Platform.conicGradientRotate90=!0,e.Platform.intWheelDeltaY=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(e.Platform.fullImageShadow=!0),o.indexOf("Windows")>-1?(e.Platform.os="Windows",e.Platform.intWheelDeltaY=!0):o.indexOf("Mac")>-1?e.Platform.os="Mac":o.indexOf("Linux")>-1&&(e.Platform.os="Linux");class l{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove&&this.config.usePartLayout){const t=new e.LeafList;return this.__updatedList.list.forEach(e=>{e.leafer&&t.add(e)}),t}return this.__updatedList}constructor(t,a){this.totalTimes=0,this.config={},this.__updatedList=new e.LeafList,this.target=t,a&&(this.config=e.DataHelper.default(a,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(e.RenderEvent.REQUEST)}__onAttrChange(t){this.config.usePartLayout&&this.__updatedList.add(t.target),this.update()}__onChildEvent(t){this.config.usePartLayout&&(t.type===e.ChildEvent.ADD?(this.hasAdd=!0,this.__pushChild(t.child)):(this.hasRemove=!0,this.__updatedList.add(t.parent))),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,a=e.length;t<a;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new e.WatchEvent(e.WatchEvent.DATA,{updatedList:this.updatedList})),this.__updatedList=new e.LeafList,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[e.PropertyEvent.CHANGE,this.__onAttrChange,this],[[e.ChildEvent.ADD,e.ChildEvent.REMOVE],this.__onChildEvent,this],[e.WatchEvent.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:d,updateBounds:h,updateChange:c}=e.LeafHelper,{pushAllChildBranch:u,pushAllParent:f}=e.BranchHelper;const{worldBounds:g}=e.LeafBoundsHelper;class p{constructor(t){this.updatedBounds=new e.Bounds,this.beforeBounds=new e.Bounds,this.afterBounds=new e.Bounds,e.isArray(t)&&(t=new e.LeafList(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,g)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,g),this.updatedBounds.setList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.addList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllMatrix:_,updateAllChange:m}=e.LeafHelper,y=e.Debug.get("Layouter");class w{constructor(t,a){this.totalTimes=0,this.config={usePartLayout:!0},this.__levelList=new e.LeafLevelList,this.target=t,a&&(this.config=e.DataHelper.default(a,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(this.layouting||!this.running)return;const{target:t}=this;this.times=0;try{t.emit(e.LayoutEvent.START),this.layoutOnce(),t.emitEvent(new e.LayoutEvent(e.LayoutEvent.END,this.layoutedBlocks,this.times))}catch(t){y.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?y.warn("layouting"):this.times>3?y.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(e.WatchEvent.REQUEST),this.totalTimes>1&&this.config.usePartLayout?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const a=e.Run.start("PartLayout"),{target:n,__updatedList:i}=this,{BEFORE:r,LAYOUT:s,AFTER:o}=e.LayoutEvent,l=this.getBlocks(i);l.forEach(t=>t.setBefore()),n.emitEvent(new e.LayoutEvent(r,l,this.times)),this.extraBlock=null,i.sort(),function(t,e){let a;t.list.forEach(t=>{a=t.__layout,e.without(t)&&!a.proxyZoom&&(a.matrixChanged?(d(t,!0),e.add(t),t.isBranch&&u(t,e),f(t,e)):a.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),f(t,e)))})}(i,this.__levelList),function(t){let e,a,n;t.sort(!0),t.levels.forEach(i=>{e=t.levelMap[i];for(let t=0,i=e.length;t<i;t++){if(a=e[t],a.isBranch&&a.__tempNumber){n=a.children;for(let t=0,e=n.length;t<e;t++)n[t].isBranch||h(n[t])}h(a)}})}(this.__levelList),function(t){t.list.forEach(c)}(i),this.extraBlock&&l.push(this.extraBlock),l.forEach(t=>t.setAfter()),n.emitEvent(new e.LayoutEvent(s,l,this.times)),n.emitEvent(new e.LayoutEvent(o,l,this.times)),this.addBlocks(l),this.__levelList.reset(),this.__updatedList=null,e.Run.end(a)}fullLayout(){const t=e.Run.start("FullLayout"),{target:a}=this,{BEFORE:n,LAYOUT:i,AFTER:r}=e.LayoutEvent,s=this.getBlocks(new e.LeafList(a));a.emitEvent(new e.LayoutEvent(n,s,this.times)),w.fullLayout(a),s.forEach(t=>{t.setAfter()}),a.emitEvent(new e.LayoutEvent(i,s,this.times)),a.emitEvent(new e.LayoutEvent(r,s,this.times)),this.addBlocks(s),e.Run.end(t)}static fullLayout(t){_(t,!0),t.isBranch?e.BranchHelper.updateBounds(t):e.LeafHelper.updateBounds(t),m(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:a}=this.extraBlock||(this.extraBlock=new p([]));e.length?a.add(t.__world):a.set(t.__world),e.add(t)}}createBlock(t){return new p(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){this.__eventIds=[this.target.on_([[e.LayoutEvent.REQUEST,this.layout,this],[e.LayoutEvent.AGAIN,this.layoutAgain,this],[e.WatchEvent.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const v=e.Debug.get("Renderer");class x{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,a,n){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,ceilPartPixel:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=a,n&&(this.config=e.DataHelper.default(n,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.requestTime||this.__requestRender()}requestLayout(){this.target.emit(e.LayoutEvent.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(e.RenderEvent.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(e.RenderEvent.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(e.RenderEvent.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:a}=this;this.times=0,this.totalBounds=new e.Bounds,v.log(a.innerName,"---\x3e");try{this.emitRender(e.RenderEvent.START),this.renderOnce(t),this.emitRender(e.RenderEvent.END,this.totalBounds),e.ImageManager.clearRecycled()}catch(t){this.rendering=!1,v.error(t)}v.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return v.warn("rendering");if(this.times>3)return v.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new e.Bounds,this.renderOptions={},t)this.emitRender(e.RenderEvent.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(e.RenderEvent.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(e.RenderEvent.RENDER,this.renderBounds,this.renderOptions),this.emitRender(e.RenderEvent.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,this.waitAgain&&(this.waitAgain=!1,this.renderOnce())}partRender(){const{canvas:t,updateBlocks:e}=this;e&&(this.mergeBlocks(),e.forEach(e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(t){const a=e.Run.start("PartRender"),{canvas:n}=this,i=t.getIntersect(n.bounds),r=new e.Bounds(i);n.save(),i.spread(x.clipSpread).ceil();const{ceilPartPixel:s}=this.config;n.clipWorld(i,s),n.clearWorld(i,s),this.__render(i,r),n.restore(),e.Run.end(a)}fullRender(){const t=e.Run.start("FullRender"),{canvas:a}=this;a.save(),a.clear(),this.__render(a.bounds),a.restore(),e.Run.end(t)}__render(t,a){const{canvas:n,target:i}=this,r=t.includes(i.__world),s=r?{includes:r}:{bounds:t,includes:r};this.needFill&&n.fillWorld(t,this.config.fill),e.Debug.showRepaint&&e.Debug.drawRepaint(n,t),this.config.useCellRender&&(s.cellList=this.getCellList()),e.Platform.render(i,n,s),this.renderBounds=a=a||t,this.renderOptions=s,this.totalBounds.isEmpty()?this.totalBounds=a:this.totalBounds.add(a),n.updateRender(a)}getCellList(){}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const a=new e.Bounds;a.setList(t),t.length=0,t.push(a)}}__requestRender(){const t=this.target;if(this.requestTime||!t)return;if(t.parentApp)return t.parentApp.requestRender(!1);this.requestTime=this.frameTime||Date.now();const a=()=>{const t=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:n}=this.config;if(n&&t>n)return e.Platform.requestRender(a);const{frames:i}=this;i.length>30&&i.shift(),i.push(t),this.FPS=Math.round(i.reduce((t,e)=>t+e,0)/i.length),this.requestTime=0,this.checkRender()};e.Platform.requestRender(a)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:a,height:n}=t.old;if(!new e.Bounds(0,0,a,n).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new e.Bounds(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;t.updatedList&&t.updatedList.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||v.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(t,a,n){this.target.emitEvent(new e.RenderEvent(t,this.times,a,n))}__listenEvents(){this.__eventIds=[this.target.on_([[e.RenderEvent.REQUEST,this.update,this],[e.LayoutEvent.END,this.__onLayoutEnd,this],[e.RenderEvent.AGAIN,this.renderAgain,this],[e.ResizeEvent.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}x.clipSpread=10;const P={},{copyRadiusPoint:b}=e.PointHelper,{hitRadiusPoint:L}=e.BoundsHelper;class B{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,a,n){a||(a=0),n||(n={});const i=n.through||!1,r=n.ignoreHittable||!1,s=n.target||this.target;this.exclude=n.exclude||null,this.point={x:t.x,y:t.y,radiusX:a,radiusY:a},this.findList=new e.LeafList(n.findList),n.findList||this.hitBranch(s.isBranchLeaf?{children:[s]}:s);const{list:o}=this.findList,l=this.getBestMatchLeaf(o,n.bottomList,r,!!n.findList),d=r?this.getPath(l):this.getHitablePath(l);return this.clear(),i?{path:d,target:l,throughPath:o.length?this.getThroughPath(o):d}:{path:d,target:l}}hitPoint(t,e,a){return!!this.getByPoint(t,e,a).target}getBestMatchLeaf(t,a,n,i){const r=this.findList=new e.LeafList;if(t.length){let a;const{x:i,y:s}=this.point,o={x:i,y:s,radiusX:0,radiusY:0};for(let i=0,s=t.length;i<s;i++)if(a=t[i],(n||e.LeafHelper.worldHittable(a))&&(this.hitChild(a,o),r.length)){if(a.isBranchLeaf&&t.some(t=>t!==a&&e.LeafHelper.hasParent(t,a))){r.reset();break}return r.list[0]}}if(a)for(let t=0,e=a.length;t<e;t++)if(this.hitChild(a[t].target,this.point,a[t].proxy),r.length)return r.list[0];return i?null:n?t[0]:t.find(t=>e.LeafHelper.worldHittable(t))}getPath(t){const a=new e.LeafList,n=[],{target:i}=this;for(;t&&(t.syncEventer&&n.push(t.syncEventer),a.add(t),(t=t.parent)!==i););return n.length&&n.forEach(t=>{for(;t&&(t.__.hittable&&a.add(t),(t=t.parent)!==i););}),i&&a.add(i),a}getHitablePath(t){const a=this.getPath(t&&t.hittable?t:null);let n,i=new e.LeafList;for(let t=a.list.length-1;t>-1&&(n=a.list[t],n.__.hittable)&&(i.addAt(n,0),n.__.hitChildren&&(!n.isLeafer||"draw"!==n.mode));t--);return i}getThroughPath(t){const a=new e.LeafList,n=[];for(let e=t.length-1;e>-1;e--)n.push(this.getPath(t[e]));let i,r,s;for(let t=0,e=n.length;t<e;t++){i=n[t],r=n[t+1];for(let t=0,e=i.length;t<e&&(s=i.list[t],!r||!r.has(s));t++)a.add(s)}return a}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let a,n,i;const{point:r}=this;for(let s=t.length-1;s>-1;s--)if(a=t[s],i=a.__,i.visible&&(!e||i.mask))if(n=L(a.__world,i.hitRadius?b(P,r,i.hitRadius):r),a.isBranch){if(n||a.__ignoreHitWorld){if(a.isBranchLeaf&&i.__clipAfterFill&&!a.__hitWorld(r,!0))continue;a.topChildren&&this.eachFind(a.topChildren,!1),this.eachFind(a.children,a.__onlyHitMask),a.isBranchLeaf&&this.hitChild(a,r)}}else n&&this.hitChild(a,r)}hitChild(t,e,a){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:n}=t;if(n&&n.__hasMask&&!t.__.mask){let a,i=[];const{children:r}=n;for(let n=0,s=r.length;n<s;n++)if(a=r[n],a.__.mask&&i.push(a),a===t){if(i&&!i.every(t=>t.__hitWorld(e)))return;break}}this.findList.add(a||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class E{constructor(t,a){this.config={},a&&(this.config=e.DataHelper.default(a,this.config)),this.picker=new B(this.target=t,this),this.finder=e.Creator.finder&&e.Creator.finder()}getByPoint(t,a,n){const{target:i,picker:r}=this;return e.Platform.backgrounder&&i&&i.updateLayout(),r.getByPoint(t,a,n)}hitPoint(t,e,a){return this.picker.hitPoint(t,e,a)}getBy(t,a,n,i){return this.finder?this.finder.getBy(t,a,n,i):e.Plugin.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function S(t,e,a){t.__.__font?n.Paint.fillText(t,e,a):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function k(t,a,i,r,s){const o=i.__;e.isObject(t)?n.Paint.drawStrokesStyle(t,a,!1,i,r,s):(r.setStroke(t,o.__strokeWidth*a,o),r.stroke()),o.__useArrow&&n.Paint.strokeArrow(t,i,r,s)}function R(t,a,i,r,s){const o=i.__;e.isObject(t)?n.Paint.drawStrokesStyle(t,a,!0,i,r,s):(r.setStroke(t,o.__strokeWidth*a,o),n.Paint.drawTextStroke(i,r,s))}function C(t,a,i,r,s){const o=r.getSameCanvas(!0,!0);o.font=i.__.__font,R(t,2,i,o,s),o.blendMode="outside"===a?"destination-out":"destination-in",n.Paint.fillText(i,o,s),o.blendMode="normal",e.LeafHelper.copyCanvasByWorld(i,r,o),o.recycle(i.__nowWorld)}Object.assign(e.Creator,{watcher:(t,e)=>new l(t,e),layouter:(t,e)=>new w(t,e),renderer:(t,e,a)=>new x(t,e,a),selector:(t,e)=>new E(t,e)}),e.Platform.layout=w.fullLayout,e.Platform.render=function(t,a,n){const i=Object.assign(Object.assign({},n),{topRendering:!0});n.topList=new e.LeafList,t.__render(a,n),n.topList.length&&n.topList.forEach(t=>t.__render(a,i))};const{getSpread:A,copyAndSpread:T,toOuterOf:O,getOuterOf:M,getByMove:I,move:W,getIntersectData:D}=e.BoundsHelper,H={};let F;const{stintSet:j}=e.DataHelper,{hasTransparent:Y}=n.ColorConvert;function G(t,a,i){if(!e.isObject(a)||!1===a.visible||0===a.opacity)return;let r;const{boxBounds:s}=i.__layout;switch(a.type){case"image":if(!a.url)return;r=n.PaintImage.image(i,t,a,s,!F||!F[a.url]);break;case"linear":r=n.PaintGradient.linearGradient(a,s);break;case"radial":r=n.PaintGradient.radialGradient(a,s);break;case"angular":r=n.PaintGradient.conicGradient(a,s);break;case"solid":const{type:o,color:l,opacity:d}=a;r={type:o,style:n.ColorConvert.string(l,d)};break;default:e.isUndefined(a.r)||(r={type:"solid",style:n.ColorConvert.string(a)})}if(r&&(r.originPaint=a,e.isString(r.style)&&Y(r.style)&&(r.isTransparent=!0),a.style)){if(0===a.style.strokeWidth)return;r.strokeStyle=a.style}return r}const X={compute:function(t,a){const i=a.__,r=[];let s,o,l,d=i.__input[t];e.isArray(d)||(d=[d]),F=n.PaintImage.recycleImage(t,i);for(let e,n=0,i=d.length;n<i;n++)(e=G(t,d[n],a))&&(r.push(e),e.strokeStyle&&(l||(l=1),e.strokeStyle.strokeWidth&&(l=Math.max(l,e.strokeStyle.strokeWidth))));i["_"+t]=r.length?r:void 0,r.length?(r.every(t=>t.isTransparent)&&(r.some(t=>t.image)&&(s=!0),o=!0),"fill"===t?(j(i,"__isAlphaPixelFill",s),j(i,"__isTransparentFill",o)):(j(i,"__isAlphaPixelStroke",s),j(i,"__isTransparentStroke",o),j(i,"__hasMultiStrokeStyle",l))):i.__removePaint(t,!1)},fill:function(t,e,a,n){a.fillStyle=t,S(e,a,n)},fills:function(t,e,a,i){let r,s,o;for(let l=0,d=t.length;l<d;l++){if(r=t[l],s=r.originPaint,r.image){if(o?o++:o=1,n.PaintImage.checkImage(r,!e.__.__font,e,a,i))continue;if(!r.style){1===o&&r.image.isPlacehold&&e.drawImagePlaceholder(r,a,i);continue}}if(a.fillStyle=r.style,r.transform||s.scaleFixed){if(a.save(),r.transform&&a.transform(r.transform),s.scaleFixed){const{scaleX:t,scaleY:n}=e.getRenderScaleData(!0);(!0===s.scaleFixed||"zoom-in"===s.scaleFixed&&t>1&&n>1)&&a.scale(1/t,1/n)}s.blendMode&&(a.blendMode=s.blendMode),S(e,a,i),a.restore()}else s.blendMode?(a.saveBlendMode(s.blendMode),S(e,a,i),a.restoreBlendMode()):S(e,a,i)}},fillPathOrText:S,fillText:function(t,e,a){const n=t.__,{rows:i,decorationY:r}=n.__textDrawData;let s;n.__isPlacehold&&n.placeholderColor&&(e.fillStyle=n.placeholderColor);for(let t=0,a=i.length;t<a;t++)s=i[t],s.text?e.fillText(s.text,s.x,s.y):s.data&&s.data.forEach(t=>{e.fillText(t.char,t.x,s.y)});if(r){const{decorationColor:t,decorationHeight:a}=n.__textDrawData;t&&(e.fillStyle=t),i.forEach(t=>r.forEach(n=>e.fillRect(t.x,t.y+n,t.width,a)))}},stroke:function(t,a,i,r){const s=a.__;if(s.__strokeWidth)if(s.__font)n.Paint.strokeText(t,a,i,r);else switch(s.strokeAlign){case"center":k(t,1,a,i,r);break;case"inside":!function(t,e,a,n){a.save(),a.clipUI(e),k(t,2,e,a,n),a.restore()}(t,a,i,r);break;case"outside":!function(t,a,n,i){const r=a.__;if(r.__fillAfterStroke)k(t,2,a,n,i);else{const{renderBounds:s}=a.__layout,o=n.getSameCanvas(!0,!0);a.__drawRenderPath(o),k(t,2,a,o,i),o.clipUI(r),o.clearWorld(s),e.LeafHelper.copyCanvasByWorld(a,n,o),o.recycle(a.__nowWorld)}}(t,a,i,r)}},strokes:function(t,e,a,i){n.Paint.stroke(t,e,a,i)},strokeText:function(t,e,a,n){switch(e.__.strokeAlign){case"center":R(t,1,e,a,n);break;case"inside":C(t,"inside",e,a,n);break;case"outside":e.__.__fillAfterStroke?R(t,2,e,a,n):C(t,"outside",e,a,n)}},drawTextStroke:function(t,e,a){let n,i=t.__.__textDrawData;const{rows:r,decorationY:s}=i;for(let t=0,a=r.length;t<a;t++)n=r[t],n.text?e.strokeText(n.text,n.x,n.y):n.data&&n.data.forEach(t=>{e.strokeText(t.char,t.x,n.y)});if(s){const{decorationHeight:t}=i;r.forEach(a=>s.forEach(n=>e.strokeRect(a.x,a.y+n,a.width,t)))}},drawStrokesStyle:function(t,e,a,i,r,s){let o;const l=i.__,{__hasMultiStrokeStyle:d}=l;d||r.setStroke(void 0,l.__strokeWidth*e,l);for(let h=0,c=t.length;h<c;h++)if(o=t[h],(!o.image||!n.PaintImage.checkImage(o,!1,i,r,s))&&o.style){if(d){const{strokeStyle:t}=o;t?r.setStroke(o.style,l.__getRealStrokeWidth(t)*e,l,t):r.setStroke(o.style,l.__strokeWidth*e,l)}else r.strokeStyle=o.style;o.originPaint.blendMode?(r.saveBlendMode(o.originPaint.blendMode),a?n.Paint.drawTextStroke(i,r,s):r.stroke(),r.restoreBlendMode()):a?n.Paint.drawTextStroke(i,r,s):r.stroke()}},shape:function(t,a,n){const i=a.getSameCanvas(),r=a.bounds,s=t.__nowWorld,o=t.__layout,l=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let d,h,c,u,f,g;O(o.strokeSpread?(T(H,o.boxBounds,o.strokeSpread),H):o.boxBounds,s,l);let{scaleX:p,scaleY:_}=t.getRenderScaleData(!0);if(r.includes(l))g=i,d=f=l,h=s;else{let i;if(e.Platform.fullImageShadow)i=l;else{const t=o.renderShapeSpread?A(r,e.FourNumberHelper.swapAndScale(o.renderShapeSpread,p,_)):r;i=D(t,l)}u=r.getFitMatrix(i);let{a:m,d:y}=u;u.a<1&&(g=a.getSameCanvas(),t.__renderShape(g,n),p*=m,_*=y),f=M(l,u),d=I(f,-u.e,-u.f),h=M(s,u),W(h,-u.e,-u.f);const w=n.matrix;w?(c=new e.Matrix(u),c.multiply(w),m*=w.scaleX,y*=w.scaleY):c=u,c.withScale(m,y),n=Object.assign(Object.assign({},n),{matrix:c})}return t.__renderShape(i,n),{canvas:i,matrix:c,fitMatrix:u,bounds:d,renderBounds:h,worldCanvas:g,shapeBounds:f,scaleX:p,scaleY:_}}};let N,U=new e.Bounds;const{isSame:q}=e.BoundsHelper;function z(t,e,a,i,r,s){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=i.width/e.pixelRatio,e.__naturalHeight=i.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return r.data||n.PaintImage.createData(r,i,a,s),!0}function V(t,a){K(t,e.ImageEvent.LOAD,a)}function Q(t,a){K(t,e.ImageEvent.LOADED,a)}function Z(t,a,n){a.error=n,t.forceUpdate("surface"),K(t,e.ImageEvent.ERROR,a)}function K(t,a,n){t.hasEvent(a)&&t.emitEvent(new e.ImageEvent(a,n))}function $(t,e){const{leafer:a}=t;a&&a.viewReady&&(a.renderer.ignore=e)}const{get:J,translate:tt}=e.MatrixHelper,et=new e.Bounds,at={},nt={};function it(t,a,n,i){const r=e.isString(t)||i?(i?n-i*a:n%a)/((i||Math.floor(n/a))-1):t;return"auto"===t&&r<0?0:r}let rt={},st=e.getMatrixData();const{get:ot,set:lt,rotateOfOuter:dt,translate:ht,scaleOfOuter:ct,multiplyParent:ut,scale:ft,rotate:gt,skew:pt}=e.MatrixHelper;function _t(t,e,a,n,i,r,s,o){s&>(t,s),o&&pt(t,o.x,o.y),i&&ft(t,i,r),ht(t,e.x+a,e.y+n)}function mt(t,e,a,n){return new(a||(a=Promise))(function(i,r){function s(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof a?e:new a(function(t){t(e)})).then(s,o)}l((n=n.apply(t,e||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const{get:yt,scale:wt,copy:vt}=e.MatrixHelper,{getFloorScale:xt}=e.MathHelper,{abs:Pt}=Math;const bt={image:function(t,a,n,i,r){let s,o;const l=e.ImageManager.get(n);return N&&n===N.paint&&q(i,N.boxBounds)?s=N.leafPaint:(s={type:n.type,image:l},l.hasAlphaPixel&&(s.isTransparent=!0),N=l.use>1?{leafPaint:s,paint:n,boxBounds:U.set(i)}:null),(r||l.loading)&&(o={image:l,attrName:a,attrValue:n}),l.ready?(z(t,a,n,l,s,i),r&&(V(t,o),Q(t,o))):l.error?r&&Z(t,o,l.error):(r&&($(t,!0),V(t,o)),s.loadId=l.load(()=>{$(t,!1),t.destroyed||(z(t,a,n,l,s,i)&&(l.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),Q(t,o)),s.loadId=void 0},e=>{$(t,!1),Z(t,o,e),s.loadId=void 0},n.lod&&l.getThumbSize(n.lod)),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{l.ready||(l.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):l.isPlacehold=!0)),s},checkImage:function(t,a,i,r,s){const{scaleX:o,scaleY:l}=n.PaintImage.getImageRenderScaleData(t,i,r,s),{image:d,data:h,originPaint:c}=t,{exporting:u,snapshot:f}=s;return!(!h||t.patternId===o+"-"+l&&!u||f)&&(a&&(h.repeat?a=!1:c.changeful||"miniapp"===e.Platform.name&&e.ResizeEvent.isResizing(i)||u||(a=e.Platform.image.isLarge(d,o,l)||d.width*o>8096||d.height*l>8096)),a?(i.__.__isFastShadow&&(r.fillStyle=t.style||"#000",r.fill()),n.PaintImage.drawImage(t,o,l,i,r,s),!0):(!t.style||c.sync||u?n.PaintImage.createPattern(t,i,r,s):n.PaintImage.createPatternTask(t,i,r,s),!1))},drawImage:function(t,e,a,n,i,r){const{data:s,image:o}=t,{blendMode:l}=t.originPaint,{opacity:d,transform:h}=s,c=o.getFull(s.filters),u=n.__;let f,{width:g,height:p}=o;(f=h&&!h.onlyScale||u.path||u.cornerRadius)||d||l?(i.save(),f&&i.clipUI(n),l&&(i.blendMode=l),d&&(i.opacity*=d),h&&i.transform(h),i.drawImage(c,0,0,g,p),i.restore()):(s.scaleX&&(g*=s.scaleX,p*=s.scaleY),i.drawImage(c,0,0,g,p))},getImageRenderScaleData:function(t,e,a,n){const i=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:r}=t;if(a){const{pixelRatio:t}=a;i.scaleX*=t,i.scaleY*=t}return r&&r.scaleX&&(i.scaleX*=Math.abs(r.scaleX),i.scaleY*=Math.abs(r.scaleY)),i},recycleImage:function(t,a){const n=a["_"+t];if(e.isArray(n)){let i,r,s,o,l;for(let d=0,h=n.length;d<h;d++)i=n[d],r=i.image,l=r&&r.url,l&&(s||(s={}),s[l]=!0,e.ImageManager.recyclePaint(i),r.loading&&(o||(o=a.__input&&a.__input[t]||[],e.isArray(o)||(o=[o])),r.unload(n[d].loadId,!o.some(t=>t.url===l))));return s}return null},createPatternTask:function(t,a,i,r){t.patternTask||(t.patternTask=e.ImageManager.patternTasker.add(()=>mt(this,void 0,void 0,function*(){n.PaintImage.createPattern(t,a,i,r),a.forceUpdate("surface")}),0,()=>(t.patternTask=null,i.bounds.hit(a.__nowWorld))))},createPattern:function(t,a,i,r){let{scaleX:s,scaleY:o}=n.PaintImage.getImageRenderScaleData(t,a,i,r),l=s+"-"+o;if(t.patternId!==l&&!a.destroyed&&(!e.Platform.image.isLarge(t.image,s,o)||t.data.repeat)){const{image:i,data:r}=t,{transform:d,gap:h}=r,c=n.PaintImage.getPatternFixScale(t,s,o);let u,f,g,{width:p,height:_}=i;c&&(s*=c,o*=c),p*=s,_*=o,h&&(f=h.x*s/Pt(r.scaleX||1),g=h.y*o/Pt(r.scaleY||1)),(d||1!==s||1!==o)&&(s*=xt(p+(f||0)),o*=xt(_+(g||0)),u=yt(),d&&vt(u,d),wt(u,1/s,1/o));const m=i.getCanvas(p,_,r.opacity,r.filters,f,g,a.leafer&&a.leafer.config.smooth,r.interlace),y=i.getPattern(m,r.repeat||e.Platform.origin.noRepeat||"no-repeat",u,t);t.style=y,t.patternId=l}},getPatternFixScale:function(t,a,n){const{image:i}=t;let r,s=e.Platform.image.maxPatternSize,o=i.width*i.height;return i.isSVG?a>1&&(r=Math.ceil(a)/a):s>o&&(s=o),(o*=a*n)>s&&(r=Math.sqrt(s/o)),r},createData:function(t,e,a,i){t.data=n.PaintImage.getPatternData(a,i,e)},getPatternData:function(t,a,i){t.padding&&(a=et.set(a).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:r,height:s}=i,{opacity:o,mode:l,align:d,offset:h,scale:c,size:u,rotation:f,skew:g,clipSize:p,repeat:_,gap:m,filters:y,interlace:w}=t,v=a.width===r&&a.height===s,x={mode:l},P="center"!==d&&(f||0)%180==90;let b,L;switch(e.BoundsHelper.set(nt,0,0,P?s:r,P?r:s),l&&"cover"!==l&&"fit"!==l?((c||u)&&(e.MathHelper.getScaleData(c,u,i,at),b=at.scaleX,L=at.scaleY),(d||m||_)&&(b&&e.BoundsHelper.scale(nt,b,L,!0),d&&e.AlignHelper.toPoint(d,nt,a,nt,!0,!0))):v&&!f||(b=L=e.BoundsHelper.getFitScale(a,nt,"fit"!==l),e.BoundsHelper.put(a,i,d,b,!1,nt),e.BoundsHelper.scale(nt,b,L,!0)),h&&e.PointHelper.move(nt,h),l){case"stretch":v?b&&(b=L=void 0):(b=a.width/r,L=a.height/s,n.PaintImage.stretchMode(x,a,b,L));break;case"normal":case"clip":if(nt.x||nt.y||b||p||f||g){let t,e;p&&(t=a.width/p.width,e=a.height/p.height),n.PaintImage.clipMode(x,a,nt.x,nt.y,b,L,f,g,t,e),t&&(b=b?b*t:t,L=L?L*e:e)}break;case"repeat":(!v||b||f||g)&&n.PaintImage.repeatMode(x,a,r,s,nt.x,nt.y,b,L,f,g,d,t.freeTransform),_||(x.repeat="repeat");const i=e.isObject(_);(m||i)&&(x.gap=function(t,a,n,i,r){let s,o;e.isObject(t)?(s=t.x,o=t.y):s=o=t;return{x:it(s,n,r.width,a&&a.x),y:it(o,i,r.height,a&&a.y)}}(m,i&&_,nt.width,nt.height,a));break;default:b&&n.PaintImage.fillOrFitMode(x,a,nt.x,nt.y,b,L,f)}return x.transform||(a.x||a.y)&&tt(x.transform=J(),a.x,a.y),b&&(x.scaleX=b,x.scaleY=L),o&&o<1&&(x.opacity=o),y&&(x.filters=y),_&&(x.repeat=e.isString(_)?"x"===_?"repeat-x":"repeat-y":"repeat"),w&&(x.interlace=e.isNumber(w)||"percent"===w.type?{type:"x",offset:w}:w),x},stretchMode:function(t,e,a,n){const i=ot(),{x:r,y:s}=e;r||s?ht(i,r,s):i.onlyScale=!0,ft(i,a,n),t.transform=i},fillOrFitMode:function(t,e,a,n,i,r,s){const o=ot();ht(o,e.x+a,e.y+n),ft(o,i,r),s&&dt(o,{x:e.x+e.width/2,y:e.y+e.height/2},s),t.transform=o},clipMode:function(t,e,a,n,i,r,s,o,l,d){const h=ot();_t(h,e,a,n,i,r,s,o),l&&(s||o?(lt(st),ct(st,e,l,d),ut(h,st)):ct(h,e,l,d)),t.transform=h},repeatMode:function(t,e,a,n,i,r,s,o,l,d,h,c){const u=ot();if(c)_t(u,e,i,r,s,o,l,d);else{if(l)if("center"===h)dt(u,{x:a/2,y:n/2},l);else switch(gt(u,l),l){case 90:ht(u,n,0);break;case 180:ht(u,a,n);break;case 270:ht(u,0,a)}rt.x=e.x+i,rt.y=e.y+r,ht(u,rt.x,rt.y),s&&ct(u,rt,s,o)}t.transform=u}},{toPoint:Lt}=e.AroundHelper,{hasTransparent:Bt}=n.ColorConvert,Et={},St={};function kt(t,a,i,r){if(i){let s,o,l,d;for(let t=0,h=i.length;t<h;t++)s=i[t],e.isString(s)?(l=t/(h-1),o=n.ColorConvert.string(s,r)):(l=s.offset,o=n.ColorConvert.string(s.color,r)),a.addColorStop(l,o),!d&&Bt(o)&&(d=!0);d&&(t.isTransparent=!0)}}const{getAngle:Rt,getDistance:Ct}=e.PointHelper,{get:At,rotateOfOuter:Tt,scaleOfOuter:Ot}=e.MatrixHelper,{toPoint:Mt}=e.AroundHelper,It={},Wt={};function Dt(t,e,a,n,i){let r;const{width:s,height:o}=t;if(s!==o||n){const t=Rt(e,a);r=At(),i?(Ot(r,e,s/o*(n||1),1),Tt(r,e,t+90)):(Ot(r,e,1,s/o*(n||1)),Tt(r,e,t))}return r}const{getDistance:Ht}=e.PointHelper,{toPoint:Ft}=e.AroundHelper,jt={},Yt={};const Gt={linearGradient:function(t,a){let{from:n,to:i,type:r,opacity:s}=t;Lt(n||"top",a,Et),Lt(i||"bottom",a,St);const o=e.Platform.canvas.createLinearGradient(Et.x,Et.y,St.x,St.y),l={type:r,style:o};return kt(l,o,t.stops,s),l},radialGradient:function(t,a){let{from:n,to:i,type:r,opacity:s,stretch:o}=t;Mt(n||"center",a,It),Mt(i||"bottom",a,Wt);const l=e.Platform.canvas.createRadialGradient(It.x,It.y,0,It.x,It.y,Ct(It,Wt)),d={type:r,style:l};kt(d,l,t.stops,s);const h=Dt(a,It,Wt,o,!0);return h&&(d.transform=h),d},conicGradient:function(t,a){let{from:n,to:i,type:r,opacity:s,stretch:o}=t;Ft(n||"center",a,jt),Ft(i||"bottom",a,Yt);const l=e.Platform.conicGradientSupport?e.Platform.canvas.createConicGradient(0,jt.x,jt.y):e.Platform.canvas.createRadialGradient(jt.x,jt.y,0,jt.x,jt.y,Ht(jt,Yt)),d={type:r,style:l};kt(d,l,t.stops,s);const h=Dt(a,jt,Yt,o||1,e.Platform.conicGradientRotate90);return h&&(d.transform=h),d},getTransform:Dt},{copy:Xt,move:Nt,toOffsetOutBounds:Ut}=e.BoundsHelper,{max:qt,abs:zt}=Math,Vt={},Qt=new e.Matrix,Zt={};function Kt(t,e){let a,n,i,r,s=0,o=0,l=0,d=0;return e.forEach(t=>{a=t.x||0,n=t.y||0,r=1.5*(t.blur||0),i=zt(t.spread||0),s=qt(s,i+r-n),o=qt(o,i+r+a),l=qt(l,i+r+n),d=qt(d,i+r-a)}),s===o&&o===l&&l===d?s:[s,o,l,d]}function $t(t,a,n){const{shapeBounds:i}=n;let r,s;e.Platform.fullImageShadow?(Xt(Vt,t.bounds),Nt(Vt,a.x-i.x,a.y-i.y),r=t.bounds,s=Vt):(r=i,s=a),t.copyWorld(n.canvas,r,s)}const{toOffsetOutBounds:Jt}=e.BoundsHelper,te={};const ee=Kt;const ae={shadow:function(t,a,i){let r,s;const{__nowWorld:o}=t,{shadow:l}=t.__,{worldCanvas:d,bounds:h,renderBounds:c,shapeBounds:u,scaleX:f,scaleY:g}=i,p=a.getSameCanvas(),_=l.length-1;Ut(h,Zt,c),l.forEach((l,m)=>{let y=1;if(l.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(y=1/t)}p.setWorldShadow(Zt.offsetX+(l.x||0)*f*y,Zt.offsetY+(l.y||0)*g*y,(l.blur||0)*f*y,n.ColorConvert.string(l.color)),s=n.Effect.getShadowTransform(t,p,i,l,Zt,y),s&&p.setTransform(s),$t(p,Zt,i),s&&p.resetTransform(),r=c,l.box&&(p.restore(),p.save(),d&&(p.copyWorld(p,c,o,"copy"),r=o),d?p.copyWorld(d,o,o,"destination-out"):p.copyWorld(i.canvas,u,h,"destination-out")),e.LeafHelper.copyCanvasByWorld(t,a,p,r,l.blendMode),_&&m<_&&p.clearWorld(r)}),p.recycle(r)},innerShadow:function(t,a,i){let r,s;const{__nowWorld:o}=t,{innerShadow:l}=t.__,{worldCanvas:d,bounds:h,renderBounds:c,shapeBounds:u,scaleX:f,scaleY:g}=i,p=a.getSameCanvas(),_=l.length-1;Jt(h,te,c),l.forEach((l,m)=>{let y=1;if(l.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(y=1/t)}p.save(),p.setWorldShadow(te.offsetX+(l.x||0)*f*y,te.offsetY+(l.y||0)*g*y,(l.blur||0)*f*y),s=n.Effect.getShadowTransform(t,p,i,l,te,y,!0),s&&p.setTransform(s),$t(p,te,i),p.restore(),d?(p.copyWorld(p,c,o,"copy"),p.copyWorld(d,o,o,"source-out"),r=o):(p.copyWorld(i.canvas,u,h,"source-out"),r=c),p.fillWorld(r,n.ColorConvert.string(l.color),"source-in"),e.LeafHelper.copyCanvasByWorld(t,a,p,r,l.blendMode),_&&m<_&&p.clearWorld(r)}),p.recycle(r)},blur:function(t,e,a){const{blur:n}=t.__;a.setWorldBlur(n*t.__nowWorld.a),a.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),a.filter="none"},backgroundBlur:function(t,e,a){},getShadowRenderSpread:Kt,getShadowTransform:function(t,e,a,n,i,r,s){if(n.spread){const a=2*n.spread*r*(s?-1:1),{width:o,height:l}=t.__layout.strokeBounds;return Qt.set().scaleOfOuter({x:(i.x+i.width/2)*e.pixelRatio,y:(i.y+i.height/2)*e.pixelRatio},1+a/o,1+a/l),Qt}},isTransformShadow(t){},getInnerShadowSpread:ee},{excludeRenderBounds:ne}=e.LeafBoundsHelper;let ie;function re(t,e,a,n,i,r,s,o){switch(e){case"grayscale":ie||(ie=!0,i.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,a,n,i,r){const s=t.__nowWorld;a.resetTransform(),a.opacity=1,a.useMask(n,s),r&&n.recycle(s);oe(t,e,a,1,i,r)}(t,a,n,i,s,o);break;case"opacity-path":oe(t,a,n,r,s,o);break;case"path":o&&a.restore()}}function se(t){return t.getSameCanvas(!1,!0)}function oe(t,e,a,n,i,r){const s=t.__nowWorld;e.resetTransform(),e.opacity=n,e.copyWorld(a,s,void 0,i),r?a.recycle(s):a.clearWorld(s)}n.Group.prototype.__renderMask=function(t,e){let a,n,i,r,s,o;const{children:l}=this;for(let d=0,h=l.length;d<h;d++){if(a=l[d],o=a.__.mask,o){s&&(re(this,s,t,i,n,r,void 0,!0),n=i=null),"clipping"!==o&&"clipping-path"!==o||ne(a,e)||a.__render(t,e),r=a.__.opacity,ie=!1,"path"===o||"clipping-path"===o?(r<1?(s="opacity-path",i||(i=se(t))):(s="path",t.save()),a.__clip(i||t,e)):(s="grayscale"===o?"grayscale":"alpha",n||(n=se(t)),i||(i=se(t)),a.__render(n,e));continue}const h=1===r&&a.__.__blendMode;h&&re(this,s,t,i,n,r,void 0,!1),ne(a,e)||a.__render(i||t,e),h&&re(this,s,t,i,n,r,h,!1)}re(this,s,t,i,n,r,void 0,!0)};const le=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",de=le+"_#~&*+\\=|≮≯≈≠=…",he=new RegExp([[19968,40959],[13312,19903],[131072,173791],[173824,177983],[177984,178207],[178208,183983],[183984,191471],[196608,201551],[201552,205743],[11904,12031],[12032,12255],[12272,12287],[12288,12351],[12736,12783],[12800,13055],[13056,13311],[63744,64255],[65072,65103],[127488,127743],[194560,195103]].map(([t,e])=>`[\\u${t.toString(16)}-\\u${e.toString(16)}]`).join("|"));function ce(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const ue=ce("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),fe=ce("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),ge=ce(le),pe=ce(de),_e=ce("- —/~|┆·");var me;!function(t){t[t.Letter=0]="Letter",t[t.Single=1]="Single",t[t.Before=2]="Before",t[t.After=3]="After",t[t.Symbol=4]="Symbol",t[t.Break=5]="Break"}(me||(me={}));const{Letter:ye,Single:we,Before:ve,After:xe,Symbol:Pe,Break:be}=me;function Le(t){return ue[t]?ye:_e[t]?be:fe[t]?ve:ge[t]?xe:pe[t]?Pe:he.test(t)?we:ye}const Be={trimRight(t){const{words:e}=t;let a,n=0,i=e.length;for(let r=i-1;r>-1&&(a=e[r].data[0]," "===a.char);r--)n++,t.width-=a.width;n&&e.splice(i-n,n)}};function Ee(t,e,a){switch(e){case"title":return a?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:Se}=Be,{Letter:ke,Single:Re,Before:Ce,After:Ae,Symbol:Te,Break:Oe}=me;let Me,Ie,We,De,He,Fe,je,Ye,Ge,Xe,Ne,Ue,qe,ze,Ve,Qe,Ze,Ke=[];function $e(t,e){Ge&&!Ye&&(Ye=Ge),Me.data.push({char:t,width:e}),We+=e}function Je(){De+=We,Me.width=We,Ie.words.push(Me),Me={data:[]},We=0}function ta(){ze&&(Ve.paraNumber++,Ie.paraStart=!0,ze=!1),Ge&&(Ie.startCharSize=Ye,Ie.endCharSize=Ge,Ye=0),Ie.width=De,Qe.width?Se(Ie):Ze&&ea(),Ke.push(Ie),Ie={words:[]},De=0}function ea(){De>(Ve.maxWidth||0)&&(Ve.maxWidth=De)}const{top:aa,right:na,bottom:ia,left:ra}=e.Direction4;function sa(t,e,a){const{bounds:n,rows:i}=t;n[e]+=a;for(let t=0;t<i.length;t++)i[t][e]+=a}const oa={getDrawData:function(t,a){e.isString(t)||(t=String(t));let i=0,r=0,s=a.__getInput("width")||0,o=a.__getInput("height")||0;const{__padding:l}=a;l&&(s?(i=l[ra],s-=l[na]+l[ra],!s&&(s=.01)):a.autoSizeAlign||(i=l[ra]),o?(r=l[aa],o-=l[aa]+l[ia],!o&&(o=.01)):a.autoSizeAlign||(r=l[aa]));const d={bounds:{x:i,y:r,width:s,height:o},rows:[],paraNumber:0,font:e.Platform.canvas.font=a.__font};return function(t,a,n){Ve=t,Ke=t.rows,Qe=t.bounds,Ze=!Qe.width&&!n.autoSizeAlign;const{__letterSpacing:i,paraIndent:r,textCase:s}=n,{canvas:o}=e.Platform,{width:l}=Qe;if(n.__isCharMode){const t="none"!==n.textWrap,e="break"===n.textWrap;ze=!0,Ne=null,Ye=je=Ge=We=De=0,Me={data:[]},Ie={words:[]},i&&(a=[...a]);for(let n=0,d=a.length;n<d;n++)Fe=a[n],"\n"===Fe?(We&&Je(),Ie.paraEnd=!0,ta(),ze=!0):(Xe=Le(Fe),Xe===ke&&"none"!==s&&(Fe=Ee(Fe,s,!We)),je=o.measureText(Fe).width,i&&(i<0&&(Ge=je),je+=i),Ue=Xe===Re&&(Ne===Re||Ne===ke)||Ne===Re&&Xe!==Ae,qe=!(Xe!==Ce&&Xe!==Re||Ne!==Te&&Ne!==Ae),He=ze&&r?l-r:l,t&&l&&De+We+je>He&&(e?(We&&Je(),De&&ta()):(qe||(qe=Xe===ke&&Ne==Ae),Ue||qe||Xe===Oe||Xe===Ce||Xe===Re||We+je>He?(We&&Je(),De&&ta()):De&&ta()))," "===Fe&&!0!==ze&&De+We===0||(Xe===Oe?(" "===Fe&&We&&Je(),$e(Fe,je),Je()):Ue||qe?(We&&Je(),$e(Fe,je)):$e(Fe,je)),Ne=Xe);We&&Je(),De&&ta(),Ke.length>0&&(Ke[Ke.length-1].paraEnd=!0)}else a.split("\n").forEach(t=>{Ve.paraNumber++,De=o.measureText(t).width,Ke.push({x:r||0,text:t,width:De,paraStart:!0}),Ze&&ea()})}(d,t,a),l&&function(t,e,a,n,i){if(!n&&a.autoSizeAlign)switch(a.textAlign){case"left":sa(e,"x",t[ra]);break;case"right":sa(e,"x",-t[na])}if(!i&&a.autoSizeAlign)switch(a.verticalAlign){case"top":sa(e,"y",t[aa]);break;case"bottom":sa(e,"y",-t[ia])}}(l,d,a,s,o),function(t,e){const{rows:a,bounds:n}=t,i=a.length,{__lineHeight:r,__baseLine:s,__letterSpacing:o,__clipText:l,textAlign:d,verticalAlign:h,paraSpacing:c,autoSizeAlign:u}=e;let{x:f,y:g,width:p,height:_}=n,m=r*i+(c?c*(t.paraNumber-1):0),y=s;if(l&&m>_)m=Math.max(_,r),i>1&&(t.overflow=i);else if(_||u)switch(h){case"middle":g+=(_-m)/2;break;case"bottom":g+=_-m}y+=g;let w,v,x,P=p||u?p:t.maxWidth;for(let s=0,h=i;s<h;s++){if(w=a[s],w.x=f,w.width<p||w.width>p&&!l)switch(d){case"center":w.x+=(P-w.width)/2;break;case"right":w.x+=P-w.width}w.paraStart&&c&&s>0&&(y+=c),w.y=y,y+=r,t.overflow>s&&y>m&&(w.isOverflow=!0,t.overflow=s+1),v=w.x,x=w.width,o<0&&(w.width<0?(x=-w.width+e.fontSize+o,v-=x,x+=e.fontSize):x-=o),v<n.x&&(n.x=v),x>n.width&&(n.width=x),l&&p&&p<x&&(w.isOverflow=!0,t.overflow||(t.overflow=a.length))}n.y=g,n.height=m}(d,a),a.__isCharMode&&function(t,e,a){const{rows:n}=t,{textAlign:i,paraIndent:r,__letterSpacing:s}=e,o=a&&i.includes("both"),l=o||a&&i.includes("justify"),d=l&&i.includes("letter");let h,c,u,f,g,p,_,m,y,w;n.forEach(t=>{t.words&&(g=r&&t.paraStart?r:0,m=t.words.length,l&&(w=!t.paraEnd||o,c=a-t.width-g,d?f=c/(t.words.reduce((t,e)=>t+e.data.length,0)-1):u=m>1?c/(m-1):0),p=s||t.isOverflow||d?0:u?1:2,t.isOverflow&&!s&&(t.textMode=!0),2===p?(t.x+=g,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=g,h=t.x,t.data=[],t.words.forEach((e,a)=>{1===p?(_={char:"",x:h},h=function(t,e,a){return t.forEach(t=>{a.char+=t.char,e+=t.width}),e}(e.data,h,_),(t.isOverflow||" "!==_.char)&&t.data.push(_)):h=function(t,e,a,n,i){return t.forEach(t=>{(n||" "!==t.char)&&(t.x=e,a.push(t)),e+=t.width,i&&(e+=i)}),e}(e.data,h,t.data,t.isOverflow,w&&f),w&&(y=a===m-1,u?y||(h+=u,t.width+=u):f&&(t.width+=f*(e.data.length-(y?1:0))))})),t.words=null)})}(d,a,s),d.overflow&&function(t,a,n,i){if(!i)return;const{rows:r,overflow:s}=t;let{textOverflow:o}=a;if(r.splice(s),o&&"show"!==o){let t,l;"hide"===o?o="":"ellipsis"===o&&(o="...");const d=o?e.Platform.canvas.measureText(o).width:0,h=n+i-d;("none"===a.textWrap?r:[r[s-1]]).forEach(e=>{if(e.isOverflow&&e.data){let a=e.data.length-1;for(let n=a;n>-1&&(t=e.data[n],l=t.x+t.width,!(n===a&&l<h));n--){if(l<h&&" "!==t.char||!n){e.data.splice(n+1),e.width-=t.width;break}e.width-=t.width}e.width+=d,e.data.push({char:o,x:l}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(d,a,i,s),"none"!==a.textDecoration&&function(t,a){let i,r=0;const{fontSize:s,textDecoration:o}=a;switch(t.decorationHeight=s/11,e.isObject(o)?(i=o.type,o.color&&(t.decorationColor=n.ColorConvert.string(o.color)),o.offset&&(r=Math.min(.3*s,Math.max(o.offset,.15*-s)))):i=o,i){case"under":t.decorationY=[.15*s+r];break;case"delete":t.decorationY=[.35*-s];break;case"under-delete":t.decorationY=[.15*s+r,.35*-s]}}(d,a),d}};const la={string:function(t,a){if(!t)return"#000";const i=e.isNumber(a)&&a<1;if(e.isString(t)){if(!i||!n.ColorConvert.object)return t;t=n.ColorConvert.object(t)}let r=e.isUndefined(t.a)?1:t.a;i&&(r*=a);const s=t.r+","+t.g+","+t.b;return 1===r?"rgb("+s+")":"rgba("+s+","+r+")"}};Object.assign(n.TextConvert,oa),Object.assign(n.ColorConvert,la),Object.assign(n.Paint,X),Object.assign(n.PaintImage,bt),Object.assign(n.PaintGradient,Gt),Object.assign(n.Effect,ae),Object.assign(e.Creator,{interaction:(t,e,n,i)=>new a.InteractionBase(t,e,n,i),hitCanvas:(t,e)=>new i(t,e),hitCanvasManager:()=>new a.HitCanvasManager}),s(),Object.defineProperty(exports,"LeaferImage",{enumerable:!0,get:function(){return e.LeaferImage}}),exports.Layouter=w,exports.LeaferCanvas=i,exports.Picker=B,exports.Renderer=x,exports.Selector=E,exports.Watcher=l,exports.useCanvas=s,Object.keys(e).forEach(function(t){"default"===t||Object.prototype.hasOwnProperty.call(exports,t)||Object.defineProperty(exports,t,{enumerable:!0,get:function(){return e[t]}})}),Object.keys(a).forEach(function(t){"default"===t||Object.prototype.hasOwnProperty.call(exports,t)||Object.defineProperty(exports,t,{enumerable:!0,get:function(){return a[t]}})});
|
|
1
|
+
"use strict";var t,e=require("@leafer/core"),a=require("@leafer-ui/core"),i=require("@leafer-ui/draw");exports.PathNodeHandleType=void 0,(t=exports.PathNodeHandleType||(exports.PathNodeHandleType={}))[t.none=1]="none",t[t.free=2]="free",t[t.mirrorAngle=3]="mirrorAngle",t[t.mirror=4]="mirror";class n extends e.LeaferCanvasBase{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=e.Platform.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:a}=this;this.view.width=Math.ceil(t*a),this.view.height=Math.ceil(e*a),this.clientBounds=this.bounds}}e.canvasPatch(OffscreenCanvasRenderingContext2D.prototype),e.canvasPatch(Path2D.prototype);const{mineType:r}=e.FileHelper;function s(t,a){e.Platform.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,a)=>new Promise((i,n)=>{t.convertToBlob({type:r(e),quality:a}).then(t=>{var e=new FileReader;e.onload=t=>i(t.target.result),e.onerror=t=>n(t),e.readAsDataURL(t)}).catch(t=>{n(t)})}),canvasToBolb:(t,e,a)=>t.convertToBlob({type:r(e),quality:a}),canvasSaveAs:(t,e,a)=>new Promise(t=>t()),download(t,e){},loadImage:t=>new Promise((a,i)=>{let n=new XMLHttpRequest;n.open("GET",e.Platform.image.getRealURL(t),!0),n.responseType="blob",n.onload=()=>{createImageBitmap(n.response).then(t=>{a(t)}).catch(t=>{i(t)})},n.onerror=t=>i(t),n.send()})},e.Platform.canvas=e.Creator.canvas(),e.Platform.conicGradientSupport=!!e.Platform.canvas.context.createConicGradient}Object.assign(e.Creator,{canvas:(t,e)=>new n(t,e),image:t=>new e.LeaferImage(t)}),e.Platform.name="web",e.Platform.isWorker=!0,e.Platform.backgrounder=!0,e.Platform.requestRender=function(t){requestAnimationFrame(t)},e.defineKey(e.Platform,"devicePixelRatio",{get:()=>1});const{userAgent:o}=navigator;o.indexOf("Firefox")>-1?(e.Platform.conicGradientRotate90=!0,e.Platform.intWheelDeltaY=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(e.Platform.fullImageShadow=!0),o.indexOf("Windows")>-1?(e.Platform.os="Windows",e.Platform.intWheelDeltaY=!0):o.indexOf("Mac")>-1?e.Platform.os="Mac":o.indexOf("Linux")>-1&&(e.Platform.os="Linux");class l{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove&&this.config.usePartLayout){const t=new e.LeafList;return this.__updatedList.list.forEach(e=>{e.leafer&&t.add(e)}),t}return this.__updatedList}constructor(t,a){this.totalTimes=0,this.config={},this.__updatedList=new e.LeafList,this.target=t,a&&(this.config=e.DataHelper.default(a,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(e.RenderEvent.REQUEST)}__onAttrChange(t){this.config.usePartLayout&&this.__updatedList.add(t.target),this.update()}__onChildEvent(t){this.config.usePartLayout&&(t.type===e.ChildEvent.ADD?(this.hasAdd=!0,this.__pushChild(t.child)):(this.hasRemove=!0,this.__updatedList.add(t.parent))),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,a=e.length;t<a;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new e.WatchEvent(e.WatchEvent.DATA,{updatedList:this.updatedList})),this.__updatedList=new e.LeafList,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[e.PropertyEvent.CHANGE,this.__onAttrChange,this],[[e.ChildEvent.ADD,e.ChildEvent.REMOVE],this.__onChildEvent,this],[e.WatchEvent.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:d,updateBounds:h,updateChange:c}=e.LeafHelper,{pushAllChildBranch:u,pushAllParent:f}=e.BranchHelper;const{worldBounds:g}=e.LeafBoundsHelper;class p{constructor(t){this.updatedBounds=new e.Bounds,this.beforeBounds=new e.Bounds,this.afterBounds=new e.Bounds,e.isArray(t)&&(t=new e.LeafList(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,g)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,g),this.updatedBounds.setList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.addList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllMatrix:_,updateAllChange:m}=e.LeafHelper,y=e.Debug.get("Layouter");class w{constructor(t,a){this.totalTimes=0,this.config={usePartLayout:!0},this.__levelList=new e.LeafLevelList,this.target=t,a&&(this.config=e.DataHelper.default(a,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(this.layouting||!this.running)return;const{target:t}=this;this.times=0;try{t.emit(e.LayoutEvent.START),this.layoutOnce(),t.emitEvent(new e.LayoutEvent(e.LayoutEvent.END,this.layoutedBlocks,this.times))}catch(t){y.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?y.warn("layouting"):this.times>3?y.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(e.WatchEvent.REQUEST),this.totalTimes>1&&this.config.usePartLayout?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const a=e.Run.start("PartLayout"),{target:i,__updatedList:n}=this,{BEFORE:r,LAYOUT:s,AFTER:o}=e.LayoutEvent,l=this.getBlocks(n);l.forEach(t=>t.setBefore()),i.emitEvent(new e.LayoutEvent(r,l,this.times)),this.extraBlock=null,n.sort(),function(t,e){let a;t.list.forEach(t=>{a=t.__layout,e.without(t)&&!a.proxyZoom&&(a.matrixChanged?(d(t,!0),e.add(t),t.isBranch&&u(t,e),f(t,e)):a.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),f(t,e)))})}(n,this.__levelList),function(t){let e,a,i;t.sort(!0),t.levels.forEach(n=>{e=t.levelMap[n];for(let t=0,n=e.length;t<n;t++){if(a=e[t],a.isBranch&&a.__tempNumber){i=a.children;for(let t=0,e=i.length;t<e;t++)i[t].isBranch||h(i[t])}h(a)}})}(this.__levelList),function(t){t.list.forEach(c)}(n),this.extraBlock&&l.push(this.extraBlock),l.forEach(t=>t.setAfter()),i.emitEvent(new e.LayoutEvent(s,l,this.times)),i.emitEvent(new e.LayoutEvent(o,l,this.times)),this.addBlocks(l),this.__levelList.reset(),this.__updatedList=null,e.Run.end(a)}fullLayout(){const t=e.Run.start("FullLayout"),{target:a}=this,{BEFORE:i,LAYOUT:n,AFTER:r}=e.LayoutEvent,s=this.getBlocks(new e.LeafList(a));a.emitEvent(new e.LayoutEvent(i,s,this.times)),w.fullLayout(a),s.forEach(t=>{t.setAfter()}),a.emitEvent(new e.LayoutEvent(n,s,this.times)),a.emitEvent(new e.LayoutEvent(r,s,this.times)),this.addBlocks(s),e.Run.end(t)}static fullLayout(t){_(t,!0),t.isBranch?e.BranchHelper.updateBounds(t):e.LeafHelper.updateBounds(t),m(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:a}=this.extraBlock||(this.extraBlock=new p([]));e.length?a.add(t.__world):a.set(t.__world),e.add(t)}}createBlock(t){return new p(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){this.__eventIds=[this.target.on_([[e.LayoutEvent.REQUEST,this.layout,this],[e.LayoutEvent.AGAIN,this.layoutAgain,this],[e.WatchEvent.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const v=e.Debug.get("Renderer");class x{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,a,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,ceilPartPixel:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=a,i&&(this.config=e.DataHelper.default(i,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.requestTime||this.__requestRender()}requestLayout(){this.target.emit(e.LayoutEvent.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(e.RenderEvent.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(e.RenderEvent.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(e.RenderEvent.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:a}=this;this.times=0,this.totalBounds=new e.Bounds,v.log(a.innerName,"---\x3e");try{this.emitRender(e.RenderEvent.START),this.renderOnce(t),this.emitRender(e.RenderEvent.END,this.totalBounds),e.ImageManager.clearRecycled()}catch(t){this.rendering=!1,v.error(t)}v.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return v.warn("rendering");if(this.times>3)return v.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new e.Bounds,this.renderOptions={},t)this.emitRender(e.RenderEvent.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(e.RenderEvent.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(e.RenderEvent.RENDER,this.renderBounds,this.renderOptions),this.emitRender(e.RenderEvent.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,this.waitAgain&&(this.waitAgain=!1,this.renderOnce())}partRender(){const{canvas:t,updateBlocks:e}=this;e&&(this.mergeBlocks(),e.forEach(e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(t){const a=e.Run.start("PartRender"),{canvas:i}=this,n=t.getIntersect(i.bounds),r=new e.Bounds(n);i.save(),n.spread(x.clipSpread).ceil();const{ceilPartPixel:s}=this.config;i.clipWorld(n,s),i.clearWorld(n,s),this.__render(n,r),i.restore(),e.Run.end(a)}fullRender(){const t=e.Run.start("FullRender"),{canvas:a}=this;a.save(),a.clear(),this.__render(a.bounds),a.restore(),e.Run.end(t)}__render(t,a){const{canvas:i,target:n}=this,r=t.includes(n.__world),s=r?{includes:r}:{bounds:t,includes:r};this.needFill&&i.fillWorld(t,this.config.fill),e.Debug.showRepaint&&e.Debug.drawRepaint(i,t),this.config.useCellRender&&(s.cellList=this.getCellList()),e.Platform.render(n,i,s),this.renderBounds=a=a||t,this.renderOptions=s,this.totalBounds.isEmpty()?this.totalBounds=a:this.totalBounds.add(a),i.updateRender(a)}getCellList(){}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const a=new e.Bounds;a.setList(t),t.length=0,t.push(a)}}__requestRender(){const t=this.target;if(this.requestTime||!t)return;if(t.parentApp)return t.parentApp.requestRender(!1);this.requestTime=this.frameTime||Date.now();const a=()=>{const t=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:i}=this.config;if(i&&t>i)return e.Platform.requestRender(a);const{frames:n}=this;n.length>30&&n.shift(),n.push(t),this.FPS=Math.round(n.reduce((t,e)=>t+e,0)/n.length),this.requestTime=0,this.checkRender()};e.Platform.requestRender(a)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:a,height:i}=t.old;if(!new e.Bounds(0,0,a,i).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new e.Bounds(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;t.updatedList&&t.updatedList.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||v.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(t,a,i){this.target.emitEvent(new e.RenderEvent(t,this.times,a,i))}__listenEvents(){this.__eventIds=[this.target.on_([[e.RenderEvent.REQUEST,this.update,this],[e.LayoutEvent.END,this.__onLayoutEnd,this],[e.RenderEvent.AGAIN,this.renderAgain,this],[e.ResizeEvent.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}x.clipSpread=10;const P={},{copyRadiusPoint:b}=e.PointHelper,{hitRadiusPoint:L}=e.BoundsHelper;class B{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,a,i){a||(a=0),i||(i={});const n=i.through||!1,r=i.ignoreHittable||!1,s=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:a,radiusY:a},this.findList=new e.LeafList(i.findList),i.findList||this.hitBranch(s.isBranchLeaf?{children:[s]}:s);const{list:o}=this.findList,l=this.getBestMatchLeaf(o,i.bottomList,r,!!i.findList),d=r?this.getPath(l):this.getHitablePath(l);return this.clear(),n?{path:d,target:l,throughPath:o.length?this.getThroughPath(o):d}:{path:d,target:l}}hitPoint(t,e,a){return!!this.getByPoint(t,e,a).target}getBestMatchLeaf(t,a,i,n){const r=this.findList=new e.LeafList;if(t.length){let a;const{x:n,y:s}=this.point,o={x:n,y:s,radiusX:0,radiusY:0};for(let n=0,s=t.length;n<s;n++)if(a=t[n],(i||e.LeafHelper.worldHittable(a))&&(this.hitChild(a,o),r.length)){if(a.isBranchLeaf&&t.some(t=>t!==a&&e.LeafHelper.hasParent(t,a))){r.reset();break}return r.list[0]}}if(a)for(let t=0,e=a.length;t<e;t++)if(this.hitChild(a[t].target,this.point,a[t].proxy),r.length)return r.list[0];return n?null:i?t[0]:t.find(t=>e.LeafHelper.worldHittable(t))}getPath(t){const a=new e.LeafList,i=[],{target:n}=this;for(;t&&(t.syncEventer&&i.push(t.syncEventer),a.add(t),(t=t.parent)!==n););return i.length&&i.forEach(t=>{for(;t&&(t.__.hittable&&a.add(t),(t=t.parent)!==n););}),n&&a.add(n),a}getHitablePath(t){const a=this.getPath(t&&t.hittable?t:null);let i,n=new e.LeafList;for(let t=a.list.length-1;t>-1&&(i=a.list[t],i.__.hittable)&&(n.addAt(i,0),i.__.hitChildren&&(!i.isLeafer||"draw"!==i.mode));t--);return n}getThroughPath(t){const a=new e.LeafList,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let n,r,s;for(let t=0,e=i.length;t<e;t++){n=i[t],r=i[t+1];for(let t=0,e=n.length;t<e&&(s=n.list[t],!r||!r.has(s));t++)a.add(s)}return a}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let a,i,n;const{point:r}=this;for(let s=t.length-1;s>-1;s--)if(a=t[s],n=a.__,n.visible&&(!e||n.mask))if(i=L(a.__world,n.hitRadius?b(P,r,n.hitRadius):r),a.isBranch){if(i||a.__ignoreHitWorld){if(a.isBranchLeaf&&n.__clipAfterFill&&!a.__hitWorld(r,!0))continue;a.topChildren&&this.eachFind(a.topChildren,!1),this.eachFind(a.children,a.__onlyHitMask),a.isBranchLeaf&&this.hitChild(a,r)}}else i&&this.hitChild(a,r)}hitChild(t,e,a){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:i}=t;if(i&&i.__hasMask&&!t.__.mask){let a,n=[];const{children:r}=i;for(let i=0,s=r.length;i<s;i++)if(a=r[i],a.__.mask&&n.push(a),a===t){if(n&&!n.every(t=>t.__hitWorld(e)))return;break}}this.findList.add(a||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class E{constructor(t,a){this.config={},a&&(this.config=e.DataHelper.default(a,this.config)),this.picker=new B(this.target=t,this),this.finder=e.Creator.finder&&e.Creator.finder()}getByPoint(t,a,i){const{target:n,picker:r}=this;return e.Platform.backgrounder&&n&&n.updateLayout(),r.getByPoint(t,a,i)}hitPoint(t,e,a){return this.picker.hitPoint(t,e,a)}getBy(t,a,i,n){return this.finder?this.finder.getBy(t,a,i,n):e.Plugin.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function S(t,e,a){t.__.__font?i.Paint.fillText(t,e,a):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function k(t,a,n,r,s){const o=n.__;e.isObject(t)?i.Paint.drawStrokesStyle(t,a,!1,n,r,s):(r.setStroke(t,o.__strokeWidth*a,o),r.stroke()),o.__useArrow&&i.Paint.strokeArrow(t,n,r,s)}function R(t,a,n,r,s){const o=n.__;e.isObject(t)?i.Paint.drawStrokesStyle(t,a,!0,n,r,s):(r.setStroke(t,o.__strokeWidth*a,o),i.Paint.drawTextStroke(n,r,s))}function C(t,a,n,r,s){const o=r.getSameCanvas(!0,!0);o.font=n.__.__font,R(t,2,n,o,s),o.blendMode="outside"===a?"destination-out":"destination-in",i.Paint.fillText(n,o,s),o.blendMode="normal",e.LeafHelper.copyCanvasByWorld(n,r,o),o.recycle(n.__nowWorld)}Object.assign(e.Creator,{watcher:(t,e)=>new l(t,e),layouter:(t,e)=>new w(t,e),renderer:(t,e,a)=>new x(t,e,a),selector:(t,e)=>new E(t,e)}),e.Platform.layout=w.fullLayout,e.Platform.render=function(t,a,i){const n=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new e.LeafList,t.__render(a,i),i.topList.length&&i.topList.forEach(t=>t.__render(a,n))};const{getSpread:A,copyAndSpread:T,toOuterOf:O,getOuterOf:M,getByMove:I,move:W,getIntersectData:H}=e.BoundsHelper,D={};let F;const{stintSet:j}=e.DataHelper,{hasTransparent:Y}=i.ColorConvert;function G(t,a,n){if(!e.isObject(a)||!1===a.visible||0===a.opacity)return;let r;const{boxBounds:s}=n.__layout;switch(a.type){case"image":if(!a.url)return;r=i.PaintImage.image(n,t,a,s,!F||!F[a.url]);break;case"linear":r=i.PaintGradient.linearGradient(a,s);break;case"radial":r=i.PaintGradient.radialGradient(a,s);break;case"angular":r=i.PaintGradient.conicGradient(a,s);break;case"solid":const{type:o,color:l,opacity:d}=a;r={type:o,style:i.ColorConvert.string(l,d)};break;default:e.isUndefined(a.r)||(r={type:"solid",style:i.ColorConvert.string(a)})}if(r&&(r.originPaint=a,e.isString(r.style)&&Y(r.style)&&(r.isTransparent=!0),a.style)){if(0===a.style.strokeWidth)return;r.strokeStyle=a.style}return r}const X={compute:function(t,a){const n=a.__,r=[];let s,o,l,d=n.__input[t];e.isArray(d)||(d=[d]),F=i.PaintImage.recycleImage(t,n);for(let e,i=0,n=d.length;i<n;i++)(e=G(t,d[i],a))&&(r.push(e),e.strokeStyle&&(l||(l=1),e.strokeStyle.strokeWidth&&(l=Math.max(l,e.strokeStyle.strokeWidth))));n["_"+t]=r.length?r:void 0,r.length?(r.every(t=>t.isTransparent)&&(r.some(t=>t.image)&&(s=!0),o=!0),"fill"===t?(j(n,"__isAlphaPixelFill",s),j(n,"__isTransparentFill",o)):(j(n,"__isAlphaPixelStroke",s),j(n,"__isTransparentStroke",o),j(n,"__hasMultiStrokeStyle",l))):n.__removePaint(t,!1)},fill:function(t,e,a,i){a.fillStyle=t,S(e,a,i)},fills:function(t,e,a,n){let r,s,o;for(let l=0,d=t.length;l<d;l++){if(r=t[l],s=r.originPaint,r.image){if(o?o++:o=1,i.PaintImage.checkImage(r,!e.__.__font,e,a,n))continue;if(!r.style){1===o&&r.image.isPlacehold&&e.drawImagePlaceholder(r,a,n);continue}}if(a.fillStyle=r.style,r.transform||s.scaleFixed){if(a.save(),r.transform&&a.transform(r.transform),s.scaleFixed){const{scaleX:t,scaleY:i}=e.getRenderScaleData(!0);(!0===s.scaleFixed||"zoom-in"===s.scaleFixed&&t>1&&i>1)&&a.scale(1/t,1/i)}s.blendMode&&(a.blendMode=s.blendMode),S(e,a,n),a.restore()}else s.blendMode?(a.saveBlendMode(s.blendMode),S(e,a,n),a.restoreBlendMode()):S(e,a,n)}},fillPathOrText:S,fillText:function(t,e,a){const i=t.__,{rows:n,decorationY:r}=i.__textDrawData;let s;i.__isPlacehold&&i.placeholderColor&&(e.fillStyle=i.placeholderColor);for(let t=0,a=n.length;t<a;t++)s=n[t],s.text?e.fillText(s.text,s.x,s.y):s.data&&s.data.forEach(t=>{e.fillText(t.char,t.x,s.y)});if(r){const{decorationColor:t,decorationHeight:a}=i.__textDrawData;t&&(e.fillStyle=t),n.forEach(t=>r.forEach(i=>e.fillRect(t.x,t.y+i,t.width,a)))}},stroke:function(t,a,n,r){const s=a.__;if(s.__strokeWidth)if(s.__font)i.Paint.strokeText(t,a,n,r);else switch(s.strokeAlign){case"center":k(t,1,a,n,r);break;case"inside":!function(t,e,a,i){a.save(),a.clipUI(e),k(t,2,e,a,i),a.restore()}(t,a,n,r);break;case"outside":!function(t,a,i,n){const r=a.__;if(r.__fillAfterStroke)k(t,2,a,i,n);else{const{renderBounds:s}=a.__layout,o=i.getSameCanvas(!0,!0);a.__drawRenderPath(o),k(t,2,a,o,n),o.clipUI(r),o.clearWorld(s),e.LeafHelper.copyCanvasByWorld(a,i,o),o.recycle(a.__nowWorld)}}(t,a,n,r)}},strokes:function(t,e,a,n){i.Paint.stroke(t,e,a,n)},strokeText:function(t,e,a,i){switch(e.__.strokeAlign){case"center":R(t,1,e,a,i);break;case"inside":C(t,"inside",e,a,i);break;case"outside":e.__.__fillAfterStroke?R(t,2,e,a,i):C(t,"outside",e,a,i)}},drawTextStroke:function(t,e,a){let i,n=t.__.__textDrawData;const{rows:r,decorationY:s}=n;for(let t=0,a=r.length;t<a;t++)i=r[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(s){const{decorationHeight:t}=n;r.forEach(a=>s.forEach(i=>e.strokeRect(a.x,a.y+i,a.width,t)))}},drawStrokesStyle:function(t,e,a,n,r,s){let o;const l=n.__,{__hasMultiStrokeStyle:d}=l;d||r.setStroke(void 0,l.__strokeWidth*e,l);for(let h=0,c=t.length;h<c;h++)if(o=t[h],(!o.image||!i.PaintImage.checkImage(o,!1,n,r,s))&&o.style){if(d){const{strokeStyle:t}=o;t?r.setStroke(o.style,l.__getRealStrokeWidth(t)*e,l,t):r.setStroke(o.style,l.__strokeWidth*e,l)}else r.strokeStyle=o.style;o.originPaint.blendMode?(r.saveBlendMode(o.originPaint.blendMode),a?i.Paint.drawTextStroke(n,r,s):r.stroke(),r.restoreBlendMode()):a?i.Paint.drawTextStroke(n,r,s):r.stroke()}},shape:function(t,a,i){const n=a.getSameCanvas(),r=a.bounds,s=t.__nowWorld,o=t.__layout,l=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let d,h,c,u,f,g;O(o.strokeSpread?(T(D,o.boxBounds,o.strokeSpread),D):o.boxBounds,s,l);let{scaleX:p,scaleY:_}=t.getRenderScaleData(!0);if(r.includes(l))g=n,d=f=l,h=s;else{let n;if(e.Platform.fullImageShadow)n=l;else{const t=o.renderShapeSpread?A(r,e.FourNumberHelper.swapAndScale(o.renderShapeSpread,p,_)):r;n=H(t,l)}u=r.getFitMatrix(n);let{a:m,d:y}=u;u.a<1&&(g=a.getSameCanvas(),t.__renderShape(g,i),p*=m,_*=y),f=M(l,u),d=I(f,-u.e,-u.f),h=M(s,u),W(h,-u.e,-u.f);const w=i.matrix;w?(c=new e.Matrix(u),c.multiply(w),m*=w.scaleX,y*=w.scaleY):c=u,c.withScale(m,y),i=Object.assign(Object.assign({},i),{matrix:c})}return t.__renderShape(n,i),{canvas:n,matrix:c,fitMatrix:u,bounds:d,renderBounds:h,worldCanvas:g,shapeBounds:f,scaleX:p,scaleY:_}}};let N,U=new e.Bounds;const{isSame:q}=e.BoundsHelper;function z(t,e,a,n,r,s){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 r.data||i.PaintImage.createData(r,n,a,s),!0}function V(t,a){K(t,e.ImageEvent.LOAD,a)}function Q(t,a){K(t,e.ImageEvent.LOADED,a)}function Z(t,a,i){a.error=i,t.forceUpdate("surface"),K(t,e.ImageEvent.ERROR,a)}function K(t,a,i){t.hasEvent(a)&&t.emitEvent(new e.ImageEvent(a,i))}function $(t,e){const{leafer:a}=t;a&&a.viewReady&&(a.renderer.ignore=e)}const{get:J,translate:tt}=e.MatrixHelper,et=new e.Bounds,at={},it={};function nt(t,a,i,n){const r=e.isString(t)||n?(n?i-n*a:i%a)/((n||Math.floor(i/a))-1):t;return"auto"===t&&r<0?0:r}let rt={},st=e.getMatrixData();const{get:ot,set:lt,rotateOfOuter:dt,translate:ht,scaleOfOuter:ct,multiplyParent:ut,scale:ft,rotate:gt,skew:pt}=e.MatrixHelper;function _t(t,e,a,i,n,r,s,o){s&>(t,s),o&&pt(t,o.x,o.y),n&&ft(t,n,r),ht(t,e.x+a,e.y+i)}function mt(t,e,a,i){return new(a||(a=Promise))(function(n,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function o(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof a?e:new a(function(t){t(e)})).then(s,o)}l((i=i.apply(t,e||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const{get:yt,scale:wt,copy:vt}=e.MatrixHelper,{getFloorScale:xt}=e.MathHelper,{abs:Pt}=Math;const bt={image:function(t,a,i,n,r){let s,o;const l=e.ImageManager.get(i);return N&&i===N.paint&&q(n,N.boxBounds)?s=N.leafPaint:(s={type:i.type,image:l},l.hasAlphaPixel&&(s.isTransparent=!0),N=l.use>1?{leafPaint:s,paint:i,boxBounds:U.set(n)}:null),(r||l.loading)&&(o={image:l,attrName:a,attrValue:i}),l.ready?(z(t,a,i,l,s,n),r&&(V(t,o),Q(t,o))):l.error?r&&Z(t,o,l.error):(r&&($(t,!0),V(t,o)),s.loadId=l.load(()=>{$(t,!1),t.destroyed||(z(t,a,i,l,s,n)&&(l.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),Q(t,o)),s.loadId=void 0},e=>{$(t,!1),Z(t,o,e),s.loadId=void 0},i.lod&&l.getThumbSize(i.lod)),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{l.ready||(l.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):l.isPlacehold=!0)),s},checkImage:function(t,a,n,r,s){const{scaleX:o,scaleY:l}=i.PaintImage.getImageRenderScaleData(t,n,r,s),{image:d,data:h,originPaint:c}=t,{exporting:u,snapshot:f}=s;return!(!h||t.patternId===o+"-"+l&&!u||f)&&(a&&(h.repeat?a=!1:c.changeful||"miniapp"===e.Platform.name&&e.ResizeEvent.isResizing(n)||u||(a=e.Platform.image.isLarge(d,o,l)||d.width*o>8096||d.height*l>8096)),a?(n.__.__isFastShadow&&(r.fillStyle=t.style||"#000",r.fill()),i.PaintImage.drawImage(t,o,l,n,r,s),!0):(!t.style||c.sync||u?i.PaintImage.createPattern(t,n,r,s):i.PaintImage.createPatternTask(t,n,r,s),!1))},drawImage:function(t,e,a,i,n,r){const{data:s,image:o}=t,{blendMode:l}=t.originPaint,{opacity:d,transform:h}=s,c=o.getFull(s.filters),u=i.__;let f,{width:g,height:p}=o;(f=h&&!h.onlyScale||u.path||u.cornerRadius)||d||l?(n.save(),f&&n.clipUI(i),l&&(n.blendMode=l),d&&(n.opacity*=d),h&&n.transform(h),n.drawImage(c,0,0,g,p),n.restore()):(s.scaleX&&(g*=s.scaleX,p*=s.scaleY),n.drawImage(c,0,0,g,p))},getImageRenderScaleData:function(t,e,a,i){const n=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:r}=t;if(a){const{pixelRatio:t}=a;n.scaleX*=t,n.scaleY*=t}return r&&r.scaleX&&(n.scaleX*=Math.abs(r.scaleX),n.scaleY*=Math.abs(r.scaleY)),n},recycleImage:function(t,a){const i=a["_"+t];if(e.isArray(i)){let n,r,s,o,l;for(let d=0,h=i.length;d<h;d++)n=i[d],r=n.image,l=r&&r.url,l&&(s||(s={}),s[l]=!0,e.ImageManager.recyclePaint(n),r.loading&&(o||(o=a.__input&&a.__input[t]||[],e.isArray(o)||(o=[o])),r.unload(i[d].loadId,!o.some(t=>t.url===l))));return s}return null},createPatternTask:function(t,a,n,r){t.patternTask||(t.patternTask=e.ImageManager.patternTasker.add(()=>mt(this,void 0,void 0,function*(){i.PaintImage.createPattern(t,a,n,r),a.forceUpdate("surface")}),0,()=>(t.patternTask=null,n.bounds.hit(a.__nowWorld))))},createPattern:function(t,a,n,r){let{scaleX:s,scaleY:o}=i.PaintImage.getImageRenderScaleData(t,a,n,r),l=s+"-"+o;if(t.patternId!==l&&!a.destroyed&&(!e.Platform.image.isLarge(t.image,s,o)||t.data.repeat)){const{image:n,data:r}=t,{transform:d,gap:h}=r,c=i.PaintImage.getPatternFixScale(t,s,o);let u,f,g,{width:p,height:_}=n;c&&(s*=c,o*=c),p*=s,_*=o,h&&(f=h.x*s/Pt(r.scaleX||1),g=h.y*o/Pt(r.scaleY||1)),(d||1!==s||1!==o)&&(s*=xt(p+(f||0)),o*=xt(_+(g||0)),u=yt(),d&&vt(u,d),wt(u,1/s,1/o));const m=n.getCanvas(p,_,r.opacity,r.filters,f,g,a.leafer&&a.leafer.config.smooth,r.interlace),y=n.getPattern(m,r.repeat||e.Platform.origin.noRepeat||"no-repeat",u,t);t.style=y,t.patternId=l}},getPatternFixScale:function(t,a,i){const{image:n}=t;let r,s=e.Platform.image.maxPatternSize,o=n.width*n.height;return n.isSVG?a>1&&(r=Math.ceil(a)/a):s>o&&(s=o),(o*=a*i)>s&&(r=Math.sqrt(s/o)),r},createData:function(t,e,a,n){t.data=i.PaintImage.getPatternData(a,n,e)},getPatternData:function(t,a,n){t.padding&&(a=et.set(a).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:r,height:s}=n,{opacity:o,mode:l,align:d,offset:h,scale:c,size:u,rotation:f,skew:g,clipSize:p,repeat:_,gap:m,filters:y,interlace:w}=t,v=a.width===r&&a.height===s,x={mode:l},P="center"!==d&&(f||0)%180==90;let b,L;switch(e.BoundsHelper.set(it,0,0,P?s:r,P?r:s),l&&"cover"!==l&&"fit"!==l?((c||u)&&(e.MathHelper.getScaleData(c,u,n,at),b=at.scaleX,L=at.scaleY),(d||m||_)&&(b&&e.BoundsHelper.scale(it,b,L,!0),d&&e.AlignHelper.toPoint(d,it,a,it,!0,!0))):v&&!f||(b=L=e.BoundsHelper.getFitScale(a,it,"fit"!==l),e.BoundsHelper.put(a,n,d,b,!1,it),e.BoundsHelper.scale(it,b,L,!0)),h&&e.PointHelper.move(it,h),l){case"stretch":v?b&&(b=L=void 0):(b=a.width/r,L=a.height/s,i.PaintImage.stretchMode(x,a,b,L));break;case"normal":case"clip":if(it.x||it.y||b||p||f||g){let t,e;p&&(t=a.width/p.width,e=a.height/p.height),i.PaintImage.clipMode(x,a,it.x,it.y,b,L,f,g,t,e),t&&(b=b?b*t:t,L=L?L*e:e)}break;case"repeat":(!v||b||f||g)&&i.PaintImage.repeatMode(x,a,r,s,it.x,it.y,b,L,f,g,d,t.freeTransform),_||(x.repeat="repeat");const n=e.isObject(_);(m||n)&&(x.gap=function(t,a,i,n,r){let s,o;e.isObject(t)?(s=t.x,o=t.y):s=o=t;return{x:nt(s,i,r.width,a&&a.x),y:nt(o,n,r.height,a&&a.y)}}(m,n&&_,it.width,it.height,a));break;default:b&&i.PaintImage.fillOrFitMode(x,a,it.x,it.y,b,L,f)}return x.transform||(a.x||a.y)&&tt(x.transform=J(),a.x,a.y),b&&(x.scaleX=b,x.scaleY=L),o&&o<1&&(x.opacity=o),y&&(x.filters=y),_&&(x.repeat=e.isString(_)?"x"===_?"repeat-x":"repeat-y":"repeat"),w&&(x.interlace=e.isNumber(w)||"percent"===w.type?{type:"x",offset:w}:w),x},stretchMode:function(t,e,a,i){const n=ot(),{x:r,y:s}=e;r||s?ht(n,r,s):n.onlyScale=!0,ft(n,a,i),t.transform=n},fillOrFitMode:function(t,e,a,i,n,r,s){const o=ot();ht(o,e.x+a,e.y+i),ft(o,n,r),s&&dt(o,{x:e.x+e.width/2,y:e.y+e.height/2},s),t.transform=o},clipMode:function(t,e,a,i,n,r,s,o,l,d){const h=ot();_t(h,e,a,i,n,r,s,o),l&&(s||o?(lt(st),ct(st,e,l,d),ut(h,st)):ct(h,e,l,d)),t.transform=h},repeatMode:function(t,e,a,i,n,r,s,o,l,d,h,c){const u=ot();if(c)_t(u,e,n,r,s,o,l,d);else{if(l)if("center"===h)dt(u,{x:a/2,y:i/2},l);else switch(gt(u,l),l){case 90:ht(u,i,0);break;case 180:ht(u,a,i);break;case 270:ht(u,0,a)}rt.x=e.x+n,rt.y=e.y+r,ht(u,rt.x,rt.y),s&&ct(u,rt,s,o)}t.transform=u}},{toPoint:Lt}=e.AroundHelper,{hasTransparent:Bt}=i.ColorConvert,Et={},St={};function kt(t,a,n,r){if(n){let s,o,l,d;for(let t=0,h=n.length;t<h;t++)s=n[t],e.isString(s)?(l=t/(h-1),o=i.ColorConvert.string(s,r)):(l=s.offset,o=i.ColorConvert.string(s.color,r)),a.addColorStop(l,o),!d&&Bt(o)&&(d=!0);d&&(t.isTransparent=!0)}}const{getAngle:Rt,getDistance:Ct}=e.PointHelper,{get:At,rotateOfOuter:Tt,scaleOfOuter:Ot}=e.MatrixHelper,{toPoint:Mt}=e.AroundHelper,It={},Wt={};function Ht(t,e,a,i,n){let r;const{width:s,height:o}=t;if(s!==o||i){const t=Rt(e,a);r=At(),n?(Ot(r,e,s/o*(i||1),1),Tt(r,e,t+90)):(Ot(r,e,1,s/o*(i||1)),Tt(r,e,t))}return r}const{getDistance:Dt}=e.PointHelper,{toPoint:Ft}=e.AroundHelper,jt={},Yt={};const Gt={linearGradient:function(t,a){let{from:i,to:n,type:r,opacity:s}=t;Lt(i||"top",a,Et),Lt(n||"bottom",a,St);const o=e.Platform.canvas.createLinearGradient(Et.x,Et.y,St.x,St.y),l={type:r,style:o};return kt(l,o,t.stops,s),l},radialGradient:function(t,a){let{from:i,to:n,type:r,opacity:s,stretch:o}=t;Mt(i||"center",a,It),Mt(n||"bottom",a,Wt);const l=e.Platform.canvas.createRadialGradient(It.x,It.y,0,It.x,It.y,Ct(It,Wt)),d={type:r,style:l};kt(d,l,t.stops,s);const h=Ht(a,It,Wt,o,!0);return h&&(d.transform=h),d},conicGradient:function(t,a){let{from:i,to:n,type:r,opacity:s,stretch:o}=t;Ft(i||"center",a,jt),Ft(n||"bottom",a,Yt);const l=e.Platform.conicGradientSupport?e.Platform.canvas.createConicGradient(0,jt.x,jt.y):e.Platform.canvas.createRadialGradient(jt.x,jt.y,0,jt.x,jt.y,Dt(jt,Yt)),d={type:r,style:l};kt(d,l,t.stops,s);const h=Ht(a,jt,Yt,o||1,e.Platform.conicGradientRotate90);return h&&(d.transform=h),d},getTransform:Ht},{copy:Xt,move:Nt,toOffsetOutBounds:Ut}=e.BoundsHelper,{max:qt,abs:zt}=Math,Vt={},Qt=new e.Matrix,Zt={};function Kt(t,e){let a,i,n,r,s=0,o=0,l=0,d=0;return e.forEach(t=>{a=t.x||0,i=t.y||0,r=1.5*(t.blur||0),n=zt(t.spread||0),s=qt(s,n+r-i),o=qt(o,n+r+a),l=qt(l,n+r+i),d=qt(d,n+r-a)}),s===o&&o===l&&l===d?s:[s,o,l,d]}function $t(t,a,i){const{shapeBounds:n}=i;let r,s;e.Platform.fullImageShadow?(Xt(Vt,t.bounds),Nt(Vt,a.x-n.x,a.y-n.y),r=t.bounds,s=Vt):(r=n,s=a),t.copyWorld(i.canvas,r,s)}const{toOffsetOutBounds:Jt}=e.BoundsHelper,te={};const ee=Kt;const ae={shadow:function(t,a,n){let r,s;const{__nowWorld:o}=t,{shadow:l}=t.__,{worldCanvas:d,bounds:h,renderBounds:c,shapeBounds:u,scaleX:f,scaleY:g}=n,p=a.getSameCanvas(),_=l.length-1;Ut(h,Zt,c),l.forEach((l,m)=>{let y=1;if(l.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(y=1/t)}p.setWorldShadow(Zt.offsetX+(l.x||0)*f*y,Zt.offsetY+(l.y||0)*g*y,(l.blur||0)*f*y,i.ColorConvert.string(l.color)),s=i.Effect.getShadowTransform(t,p,n,l,Zt,y),s&&p.setTransform(s),$t(p,Zt,n),s&&p.resetTransform(),r=c,l.box&&(p.restore(),p.save(),d&&(p.copyWorld(p,c,o,"copy"),r=o),d?p.copyWorld(d,o,o,"destination-out"):p.copyWorld(n.canvas,u,h,"destination-out")),e.LeafHelper.copyCanvasByWorld(t,a,p,r,l.blendMode),_&&m<_&&p.clearWorld(r)}),p.recycle(r)},innerShadow:function(t,a,n){let r,s;const{__nowWorld:o}=t,{innerShadow:l}=t.__,{worldCanvas:d,bounds:h,renderBounds:c,shapeBounds:u,scaleX:f,scaleY:g}=n,p=a.getSameCanvas(),_=l.length-1;Jt(h,te,c),l.forEach((l,m)=>{let y=1;if(l.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(y=1/t)}p.save(),p.setWorldShadow(te.offsetX+(l.x||0)*f*y,te.offsetY+(l.y||0)*g*y,(l.blur||0)*f*y),s=i.Effect.getShadowTransform(t,p,n,l,te,y,!0),s&&p.setTransform(s),$t(p,te,n),p.restore(),d?(p.copyWorld(p,c,o,"copy"),p.copyWorld(d,o,o,"source-out"),r=o):(p.copyWorld(n.canvas,u,h,"source-out"),r=c),p.fillWorld(r,i.ColorConvert.string(l.color),"source-in"),e.LeafHelper.copyCanvasByWorld(t,a,p,r,l.blendMode),_&&m<_&&p.clearWorld(r)}),p.recycle(r)},blur:function(t,e,a){const{blur:i}=t.__;a.setWorldBlur(i*t.__nowWorld.a),a.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),a.filter="none"},backgroundBlur:function(t,e,a){},getShadowRenderSpread:Kt,getShadowTransform:function(t,e,a,i,n,r,s){if(i.spread){const a=2*i.spread*r*(s?-1:1),{width:o,height:l}=t.__layout.strokeBounds;return Qt.set().scaleOfOuter({x:(n.x+n.width/2)*e.pixelRatio,y:(n.y+n.height/2)*e.pixelRatio},1+a/o,1+a/l),Qt}},isTransformShadow(t){},getInnerShadowSpread:ee},{excludeRenderBounds:ie}=e.LeafBoundsHelper;let ne;function re(t,e,a,i,n,r,s,o){switch(e){case"grayscale":ne||(ne=!0,n.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,a,i,n,r){const s=t.__nowWorld;a.resetTransform(),a.opacity=1,a.useMask(i,s),r&&i.recycle(s);oe(t,e,a,1,n,r)}(t,a,i,n,s,o);break;case"opacity-path":oe(t,a,i,r,s,o);break;case"path":o&&a.restore()}}function se(t){return t.getSameCanvas(!1,!0)}function oe(t,e,a,i,n,r){const s=t.__nowWorld;e.resetTransform(),e.opacity=i,e.copyWorld(a,s,void 0,n),r?a.recycle(s):a.clearWorld(s)}i.Group.prototype.__renderMask=function(t,e){let a,i,n,r,s,o;const{children:l}=this;for(let d=0,h=l.length;d<h;d++){if(a=l[d],o=a.__.mask,o){s&&(re(this,s,t,n,i,r,void 0,!0),i=n=null),"clipping"!==o&&"clipping-path"!==o||ie(a,e)||a.__render(t,e),r=a.__.opacity,ne=!1,"path"===o||"clipping-path"===o?(r<1?(s="opacity-path",n||(n=se(t))):(s="path",t.save()),a.__clip(n||t,e)):(s="grayscale"===o?"grayscale":"alpha",i||(i=se(t)),n||(n=se(t)),a.__render(i,e));continue}const h=1===r&&a.__.__blendMode;h&&re(this,s,t,n,i,r,void 0,!1),ie(a,e)||a.__render(n||t,e),h&&re(this,s,t,n,i,r,h,!1)}re(this,s,t,n,i,r,void 0,!0)};const le=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",de=le+"_#~&*+\\=|≮≯≈≠=…",he=new RegExp([[19968,40959],[13312,19903],[131072,173791],[173824,177983],[177984,178207],[178208,183983],[183984,191471],[196608,201551],[201552,205743],[11904,12031],[12032,12255],[12272,12287],[12288,12351],[12736,12783],[12800,13055],[13056,13311],[63744,64255],[65072,65103],[127488,127743],[194560,195103]].map(([t,e])=>`[\\u${t.toString(16)}-\\u${e.toString(16)}]`).join("|"));function ce(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const ue=ce("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),fe=ce("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),ge=ce(le),pe=ce(de),_e=ce("- —/~|┆·");var me;!function(t){t[t.Letter=0]="Letter",t[t.Single=1]="Single",t[t.Before=2]="Before",t[t.After=3]="After",t[t.Symbol=4]="Symbol",t[t.Break=5]="Break"}(me||(me={}));const{Letter:ye,Single:we,Before:ve,After:xe,Symbol:Pe,Break:be}=me;function Le(t){return ue[t]?ye:_e[t]?be:fe[t]?ve:ge[t]?xe:pe[t]?Pe:he.test(t)?we:ye}const Be={trimRight(t){const{words:e}=t;let a,i=0,n=e.length;for(let r=n-1;r>-1&&(a=e[r].data[0]," "===a.char);r--)i++,t.width-=a.width;i&&e.splice(n-i,i)}};function Ee(t,e,a){switch(e){case"title":return a?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:Se}=Be,{Letter:ke,Single:Re,Before:Ce,After:Ae,Symbol:Te,Break:Oe}=me;let Me,Ie,We,He,De,Fe,je,Ye,Ge,Xe,Ne,Ue,qe,ze,Ve,Qe,Ze,Ke=[];function $e(t,e){Ge&&!Ye&&(Ye=Ge),Me.data.push({char:t,width:e}),We+=e}function Je(){He+=We,Me.width=We,Ie.words.push(Me),Me={data:[]},We=0}function ta(){ze&&(Ve.paraNumber++,Ie.paraStart=!0,ze=!1),Ge&&(Ie.startCharSize=Ye,Ie.endCharSize=Ge,Ye=0),Ie.width=He,Qe.width?Se(Ie):Ze&&ea(),Ke.push(Ie),Ie={words:[]},He=0}function ea(){He>(Ve.maxWidth||0)&&(Ve.maxWidth=He)}const{top:aa,right:ia,bottom:na,left:ra}=e.Direction4;function sa(t,e,a){const{bounds:i,rows:n}=t;i[e]+=a;for(let t=0;t<n.length;t++)n[t][e]+=a}const oa={getDrawData:function(t,a){e.isString(t)||(t=String(t));let n=0,r=0,s=a.__getInput("width")||0,o=a.__getInput("height")||0;const{__padding:l}=a;l&&(s?(n=l[ra],s-=l[ia]+l[ra],!s&&(s=.01)):a.autoSizeAlign||(n=l[ra]),o?(r=l[aa],o-=l[aa]+l[na],!o&&(o=.01)):a.autoSizeAlign||(r=l[aa]));const d={bounds:{x:n,y:r,width:s,height:o},rows:[],paraNumber:0,font:e.Platform.canvas.font=a.__font};return function(t,a,i){Ve=t,Ke=t.rows,Qe=t.bounds,Ze=!Qe.width&&!i.autoSizeAlign;const{__letterSpacing:n,paraIndent:r,textCase:s}=i,{canvas:o}=e.Platform,{width:l}=Qe;if(i.__isCharMode){const t="none"!==i.textWrap,e="break"===i.textWrap;ze=!0,Ne=null,Ye=je=Ge=We=He=0,Me={data:[]},Ie={words:[]},n&&(a=[...a]);for(let i=0,d=a.length;i<d;i++)Fe=a[i],"\n"===Fe?(We&&Je(),Ie.paraEnd=!0,ta(),ze=!0):(Xe=Le(Fe),Xe===ke&&"none"!==s&&(Fe=Ee(Fe,s,!We)),je=o.measureText(Fe).width,n&&(n<0&&(Ge=je),je+=n),Ue=Xe===Re&&(Ne===Re||Ne===ke)||Ne===Re&&Xe!==Ae,qe=!(Xe!==Ce&&Xe!==Re||Ne!==Te&&Ne!==Ae),De=ze&&r?l-r:l,t&&l&&He+We+je>De&&(e?(We&&Je(),He&&ta()):(qe||(qe=Xe===ke&&Ne==Ae),Ue||qe||Xe===Oe||Xe===Ce||Xe===Re||We+je>De?(We&&Je(),He&&ta()):He&&ta()))," "===Fe&&!0!==ze&&He+We===0||(Xe===Oe?(" "===Fe&&We&&Je(),$e(Fe,je),Je()):Ue||qe?(We&&Je(),$e(Fe,je)):$e(Fe,je)),Ne=Xe);We&&Je(),He&&ta(),Ke.length>0&&(Ke[Ke.length-1].paraEnd=!0)}else a.split("\n").forEach(t=>{Ve.paraNumber++,He=o.measureText(t).width,Ke.push({x:r||0,text:t,width:He,paraStart:!0}),Ze&&ea()})}(d,t,a),l&&function(t,e,a,i,n){if(!i&&a.autoSizeAlign)switch(a.textAlign){case"left":sa(e,"x",t[ra]);break;case"right":sa(e,"x",-t[ia])}if(!n&&a.autoSizeAlign)switch(a.verticalAlign){case"top":sa(e,"y",t[aa]);break;case"bottom":sa(e,"y",-t[na])}}(l,d,a,s,o),function(t,e){const{rows:a,bounds:i}=t,n=a.length,{__lineHeight:r,__baseLine:s,__letterSpacing:o,__clipText:l,textAlign:d,verticalAlign:h,paraSpacing:c,autoSizeAlign:u}=e;let{x:f,y:g,width:p,height:_}=i,m=r*n+(c?c*(t.paraNumber-1):0),y=s;if(l&&m>_)m=Math.max(e.__autoHeight?m:_,r),n>1&&(t.overflow=n);else if(_||u)switch(h){case"middle":g+=(_-m)/2;break;case"bottom":g+=_-m}y+=g;let w,v,x,P=p||u?p:t.maxWidth;for(let s=0,h=n;s<h;s++){if(w=a[s],w.x=f,w.width<p||w.width>p&&!l)switch(d){case"center":w.x+=(P-w.width)/2;break;case"right":w.x+=P-w.width}w.paraStart&&c&&s>0&&(y+=c),w.y=y,y+=r,t.overflow>s&&y>m&&(w.isOverflow=!0,t.overflow=s+1),v=w.x,x=w.width,o<0&&(w.width<0?(x=-w.width+e.fontSize+o,v-=x,x+=e.fontSize):x-=o),v<i.x&&(i.x=v),x>i.width&&(i.width=x),l&&p&&p<x&&(w.isOverflow=!0,t.overflow||(t.overflow=a.length))}i.y=g,i.height=m}(d,a),a.__isCharMode&&function(t,e,a){const{rows:i}=t,{textAlign:n,paraIndent:r,__letterSpacing:s}=e,o=a&&n.includes("both"),l=o||a&&n.includes("justify"),d=l&&n.includes("letter");let h,c,u,f,g,p,_,m,y,w;i.forEach(t=>{t.words&&(g=r&&t.paraStart?r:0,m=t.words.length,l&&(w=!t.paraEnd||o,c=a-t.width-g,d?f=c/(t.words.reduce((t,e)=>t+e.data.length,0)-1):u=m>1?c/(m-1):0),p=s||t.isOverflow||d?0:u?1:2,t.isOverflow&&!s&&(t.textMode=!0),2===p?(t.x+=g,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=g,h=t.x,t.data=[],t.words.forEach((e,a)=>{1===p?(_={char:"",x:h},h=function(t,e,a){return t.forEach(t=>{a.char+=t.char,e+=t.width}),e}(e.data,h,_),(t.isOverflow||" "!==_.char)&&t.data.push(_)):h=function(t,e,a,i,n){return t.forEach(t=>{(i||" "!==t.char)&&(t.x=e,a.push(t)),e+=t.width,n&&(e+=n)}),e}(e.data,h,t.data,t.isOverflow,w&&f),w&&(y=a===m-1,u?y||(h+=u,t.width+=u):f&&(t.width+=f*(e.data.length-(y?1:0))))})),t.words=null)})}(d,a,s),d.overflow&&function(t,a,i,n){const{rows:r,overflow:s}=t;let{textOverflow:o}=a;if(s&&r.splice(s),n&&o&&"show"!==o){let t,l;"hide"===o?o="":"ellipsis"===o&&(o="...");const d=o?e.Platform.canvas.measureText(o).width:0,h=i+n-d;("none"===a.textWrap?r:[r[s-1]]).forEach(e=>{if(e.isOverflow&&e.data){let a=e.data.length-1;for(let i=a;i>-1&&(t=e.data[i],l=t.x+t.width,!(i===a&&l<h));i--){if(l<h&&" "!==t.char||!i){e.data.splice(i+1),e.width-=t.width;break}e.width-=t.width}e.width+=d,e.data.push({char:o,x:l}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(d,a,n,s),"none"!==a.textDecoration&&function(t,a){let n,r=0;const{fontSize:s,textDecoration:o}=a;switch(t.decorationHeight=s/11,e.isObject(o)?(n=o.type,o.color&&(t.decorationColor=i.ColorConvert.string(o.color)),o.offset&&(r=Math.min(.3*s,Math.max(o.offset,.15*-s)))):n=o,n){case"under":t.decorationY=[.15*s+r];break;case"delete":t.decorationY=[.35*-s];break;case"under-delete":t.decorationY=[.15*s+r,.35*-s]}}(d,a),d}};const la={string:function(t,a){if(!t)return"#000";const n=e.isNumber(a)&&a<1;if(e.isString(t)){if(!n||!i.ColorConvert.object)return t;t=i.ColorConvert.object(t)}let r=e.isUndefined(t.a)?1:t.a;n&&(r*=a);const s=t.r+","+t.g+","+t.b;return 1===r?"rgb("+s+")":"rgba("+s+","+r+")"}};Object.assign(i.TextConvert,oa),Object.assign(i.ColorConvert,la),Object.assign(i.Paint,X),Object.assign(i.PaintImage,bt),Object.assign(i.PaintGradient,Gt),Object.assign(i.Effect,ae),Object.assign(e.Creator,{interaction:(t,e,i,n)=>new a.InteractionBase(t,e,i,n),hitCanvas:(t,e)=>new n(t,e),hitCanvasManager:()=>new a.HitCanvasManager}),s(),Object.defineProperty(exports,"LeaferImage",{enumerable:!0,get:function(){return e.LeaferImage}}),exports.Layouter=w,exports.LeaferCanvas=n,exports.Picker=B,exports.Renderer=x,exports.Selector=E,exports.Watcher=l,exports.useCanvas=s,Object.keys(e).forEach(function(t){"default"===t||Object.prototype.hasOwnProperty.call(exports,t)||Object.defineProperty(exports,t,{enumerable:!0,get:function(){return e[t]}})}),Object.keys(a).forEach(function(t){"default"===t||Object.prototype.hasOwnProperty.call(exports,t)||Object.defineProperty(exports,t,{enumerable:!0,get:function(){return a[t]}})});
|
|
2
2
|
//# sourceMappingURL=worker.min.cjs.map
|