@leafer-ui/worker 1.12.3 → 2.0.0
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 +16 -10
- package/dist/worker.esm.js +17 -11
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.esm.min.js.map +1 -1
- package/dist/worker.js +110 -85
- 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 +114 -89
- 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.cjs
CHANGED
|
@@ -440,6 +440,7 @@ class Renderer {
|
|
|
440
440
|
this.times = 0;
|
|
441
441
|
this.config = {
|
|
442
442
|
usePartRender: true,
|
|
443
|
+
ceilPartPixel: true,
|
|
443
444
|
maxFPS: 120
|
|
444
445
|
};
|
|
445
446
|
this.frames = [];
|
|
@@ -548,8 +549,9 @@ class Renderer {
|
|
|
548
549
|
const {canvas: canvas} = this, bounds = block.getIntersect(canvas.bounds), realBounds = new core.Bounds(bounds);
|
|
549
550
|
canvas.save();
|
|
550
551
|
bounds.spread(Renderer.clipSpread).ceil();
|
|
551
|
-
|
|
552
|
-
canvas.clipWorld(bounds);
|
|
552
|
+
const {ceilPartPixel: ceilPartPixel} = this.config;
|
|
553
|
+
canvas.clipWorld(bounds, ceilPartPixel);
|
|
554
|
+
canvas.clearWorld(bounds, ceilPartPixel);
|
|
553
555
|
this.__render(bounds, realBounds);
|
|
554
556
|
canvas.restore();
|
|
555
557
|
core.Run.end(t);
|
|
@@ -1289,7 +1291,7 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
|
1289
1291
|
ignoreRender(ui, false);
|
|
1290
1292
|
onLoadError(ui, event, error);
|
|
1291
1293
|
leafPaint.loadId = undefined;
|
|
1292
|
-
}, paint.lod && image.getThumbSize());
|
|
1294
|
+
}, paint.lod && image.getThumbSize(paint.lod));
|
|
1293
1295
|
if (ui.placeholderColor) {
|
|
1294
1296
|
if (!ui.placeholderDelay) image.isPlacehold = true; else setTimeout(() => {
|
|
1295
1297
|
if (!image.ready) {
|
|
@@ -1359,7 +1361,7 @@ function getPatternData(paint, box, image) {
|
|
|
1359
1361
|
if (paint.padding) box = tempBox.set(box).shrink(paint.padding);
|
|
1360
1362
|
if (paint.mode === "strench") paint.mode = "stretch";
|
|
1361
1363
|
const {width: width, height: height} = image;
|
|
1362
|
-
const {opacity: opacity, mode: mode, align: align, offset: offset, scale: scale, size: size, rotation: rotation, skew: skew, clipSize: clipSize, repeat: repeat, gap: gap, filters: filters} = paint;
|
|
1364
|
+
const {opacity: opacity, mode: mode, align: align, offset: offset, scale: scale, size: size, rotation: rotation, skew: skew, clipSize: clipSize, repeat: repeat, gap: gap, filters: filters, interlace: interlace} = paint;
|
|
1363
1365
|
const sameBox = box.width === width && box.height === height;
|
|
1364
1366
|
const data = {
|
|
1365
1367
|
mode: mode
|
|
@@ -1425,6 +1427,10 @@ function getPatternData(paint, box, image) {
|
|
|
1425
1427
|
if (opacity && opacity < 1) data.opacity = opacity;
|
|
1426
1428
|
if (filters) data.filters = filters;
|
|
1427
1429
|
if (repeat) data.repeat = core.isString(repeat) ? repeat === "x" ? "repeat-x" : "repeat-y" : "repeat";
|
|
1430
|
+
if (interlace) data.interlace = core.isNumber(interlace) || interlace.type === "percent" ? {
|
|
1431
|
+
type: "x",
|
|
1432
|
+
offset: interlace
|
|
1433
|
+
} : interlace;
|
|
1428
1434
|
return data;
|
|
1429
1435
|
}
|
|
1430
1436
|
|
|
@@ -1591,7 +1597,7 @@ function createPattern(paint, ui, canvas, renderOptions) {
|
|
|
1591
1597
|
if (transform) copy$1(imageMatrix, transform);
|
|
1592
1598
|
scale(imageMatrix, 1 / scaleX, 1 / scaleY);
|
|
1593
1599
|
}
|
|
1594
|
-
const imageCanvas = image.getCanvas(width, height, data.opacity, data.filters, xGap, yGap, ui.leafer && ui.leafer.config.smooth);
|
|
1600
|
+
const imageCanvas = image.getCanvas(width, height, data.opacity, data.filters, xGap, yGap, ui.leafer && ui.leafer.config.smooth, data.interlace);
|
|
1595
1601
|
const pattern = image.getPattern(imageCanvas, data.repeat || (core.Platform.origin.noRepeat || "no-repeat"), imageMatrix, paint);
|
|
1596
1602
|
paint.style = pattern;
|
|
1597
1603
|
paint.patternId = id;
|
|
@@ -1613,8 +1619,8 @@ function getPatternFixScale(paint, imageScaleX, imageScaleY) {
|
|
|
1613
1619
|
|
|
1614
1620
|
function checkImage(paint, drawImage, ui, canvas, renderOptions) {
|
|
1615
1621
|
const {scaleX: scaleX, scaleY: scaleY} = draw.PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions);
|
|
1616
|
-
const {image: image, data: data, originPaint: originPaint} = paint, {exporting: exporting} = renderOptions;
|
|
1617
|
-
if (!data || paint.patternId === scaleX + "-" + scaleY && !exporting) {
|
|
1622
|
+
const {image: image, data: data, originPaint: originPaint} = paint, {exporting: exporting, snapshot: snapshot} = renderOptions;
|
|
1623
|
+
if (!data || paint.patternId === scaleX + "-" + scaleY && !exporting || snapshot) {
|
|
1618
1624
|
return false;
|
|
1619
1625
|
} else {
|
|
1620
1626
|
if (drawImage) {
|
|
@@ -2288,7 +2294,7 @@ const TextMode = 2;
|
|
|
2288
2294
|
|
|
2289
2295
|
function layoutChar(drawData, style, width, _height) {
|
|
2290
2296
|
const {rows: rows} = drawData;
|
|
2291
|
-
const {textAlign: textAlign, paraIndent: paraIndent,
|
|
2297
|
+
const {textAlign: textAlign, paraIndent: paraIndent, __letterSpacing: __letterSpacing} = style;
|
|
2292
2298
|
const justifyLast = width && textAlign.includes("both");
|
|
2293
2299
|
const justify = justifyLast || width && textAlign.includes("justify");
|
|
2294
2300
|
const justifyLetter = justify && textAlign.includes("letter");
|
|
@@ -2301,8 +2307,8 @@ function layoutChar(drawData, style, width, _height) {
|
|
|
2301
2307
|
remainingWidth = width - row.width - indentWidth;
|
|
2302
2308
|
if (justifyLetter) addLetterWidth = remainingWidth / (row.words.reduce((total, item) => total + item.data.length, 0) - 1); else addWordWidth = wordsLength > 1 ? remainingWidth / (wordsLength - 1) : 0;
|
|
2303
2309
|
}
|
|
2304
|
-
mode =
|
|
2305
|
-
if (row.isOverflow && !
|
|
2310
|
+
mode = __letterSpacing || row.isOverflow || justifyLetter ? CharMode : addWordWidth ? WordMode : TextMode;
|
|
2311
|
+
if (row.isOverflow && !__letterSpacing) row.textMode = true;
|
|
2306
2312
|
if (mode === TextMode) {
|
|
2307
2313
|
row.x += indentWidth;
|
|
2308
2314
|
toTextChar$1(row);
|
package/dist/worker.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LeaferCanvasBase, Platform, canvasPatch, FileHelper, Creator, LeaferImage, defineKey, LeafList, DataHelper, RenderEvent, ChildEvent, WatchEvent, PropertyEvent, LeafHelper, BranchHelper, LeafBoundsHelper, Bounds, isArray, Debug, LeafLevelList, LayoutEvent, Run, ImageManager, ResizeEvent, PointHelper, BoundsHelper, Plugin, isObject, FourNumberHelper, Matrix, isUndefined, isString, ImageEvent, MatrixHelper, MathHelper, AlignHelper, getMatrixData, AroundHelper, Direction4
|
|
1
|
+
import { LeaferCanvasBase, Platform, canvasPatch, FileHelper, Creator, LeaferImage, defineKey, LeafList, DataHelper, RenderEvent, ChildEvent, WatchEvent, PropertyEvent, LeafHelper, BranchHelper, LeafBoundsHelper, Bounds, isArray, Debug, LeafLevelList, LayoutEvent, Run, ImageManager, ResizeEvent, PointHelper, BoundsHelper, Plugin, isObject, FourNumberHelper, Matrix, isUndefined, isString, ImageEvent, MatrixHelper, MathHelper, AlignHelper, isNumber, getMatrixData, AroundHelper, Direction4 } from "@leafer/core";
|
|
2
2
|
|
|
3
3
|
export * from "@leafer/core";
|
|
4
4
|
|
|
@@ -444,6 +444,7 @@ class Renderer {
|
|
|
444
444
|
this.times = 0;
|
|
445
445
|
this.config = {
|
|
446
446
|
usePartRender: true,
|
|
447
|
+
ceilPartPixel: true,
|
|
447
448
|
maxFPS: 120
|
|
448
449
|
};
|
|
449
450
|
this.frames = [];
|
|
@@ -552,8 +553,9 @@ class Renderer {
|
|
|
552
553
|
const {canvas: canvas} = this, bounds = block.getIntersect(canvas.bounds), realBounds = new Bounds(bounds);
|
|
553
554
|
canvas.save();
|
|
554
555
|
bounds.spread(Renderer.clipSpread).ceil();
|
|
555
|
-
|
|
556
|
-
canvas.clipWorld(bounds);
|
|
556
|
+
const {ceilPartPixel: ceilPartPixel} = this.config;
|
|
557
|
+
canvas.clipWorld(bounds, ceilPartPixel);
|
|
558
|
+
canvas.clearWorld(bounds, ceilPartPixel);
|
|
557
559
|
this.__render(bounds, realBounds);
|
|
558
560
|
canvas.restore();
|
|
559
561
|
Run.end(t);
|
|
@@ -1293,7 +1295,7 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
|
1293
1295
|
ignoreRender(ui, false);
|
|
1294
1296
|
onLoadError(ui, event, error);
|
|
1295
1297
|
leafPaint.loadId = undefined;
|
|
1296
|
-
}, paint.lod && image.getThumbSize());
|
|
1298
|
+
}, paint.lod && image.getThumbSize(paint.lod));
|
|
1297
1299
|
if (ui.placeholderColor) {
|
|
1298
1300
|
if (!ui.placeholderDelay) image.isPlacehold = true; else setTimeout(() => {
|
|
1299
1301
|
if (!image.ready) {
|
|
@@ -1363,7 +1365,7 @@ function getPatternData(paint, box, image) {
|
|
|
1363
1365
|
if (paint.padding) box = tempBox.set(box).shrink(paint.padding);
|
|
1364
1366
|
if (paint.mode === "strench") paint.mode = "stretch";
|
|
1365
1367
|
const {width: width, height: height} = image;
|
|
1366
|
-
const {opacity: opacity, mode: mode, align: align, offset: offset, scale: scale, size: size, rotation: rotation, skew: skew, clipSize: clipSize, repeat: repeat, gap: gap, filters: filters} = paint;
|
|
1368
|
+
const {opacity: opacity, mode: mode, align: align, offset: offset, scale: scale, size: size, rotation: rotation, skew: skew, clipSize: clipSize, repeat: repeat, gap: gap, filters: filters, interlace: interlace} = paint;
|
|
1367
1369
|
const sameBox = box.width === width && box.height === height;
|
|
1368
1370
|
const data = {
|
|
1369
1371
|
mode: mode
|
|
@@ -1429,6 +1431,10 @@ function getPatternData(paint, box, image) {
|
|
|
1429
1431
|
if (opacity && opacity < 1) data.opacity = opacity;
|
|
1430
1432
|
if (filters) data.filters = filters;
|
|
1431
1433
|
if (repeat) data.repeat = isString(repeat) ? repeat === "x" ? "repeat-x" : "repeat-y" : "repeat";
|
|
1434
|
+
if (interlace) data.interlace = isNumber(interlace) || interlace.type === "percent" ? {
|
|
1435
|
+
type: "x",
|
|
1436
|
+
offset: interlace
|
|
1437
|
+
} : interlace;
|
|
1432
1438
|
return data;
|
|
1433
1439
|
}
|
|
1434
1440
|
|
|
@@ -1595,7 +1601,7 @@ function createPattern(paint, ui, canvas, renderOptions) {
|
|
|
1595
1601
|
if (transform) copy$1(imageMatrix, transform);
|
|
1596
1602
|
scale(imageMatrix, 1 / scaleX, 1 / scaleY);
|
|
1597
1603
|
}
|
|
1598
|
-
const imageCanvas = image.getCanvas(width, height, data.opacity, data.filters, xGap, yGap, ui.leafer && ui.leafer.config.smooth);
|
|
1604
|
+
const imageCanvas = image.getCanvas(width, height, data.opacity, data.filters, xGap, yGap, ui.leafer && ui.leafer.config.smooth, data.interlace);
|
|
1599
1605
|
const pattern = image.getPattern(imageCanvas, data.repeat || (Platform.origin.noRepeat || "no-repeat"), imageMatrix, paint);
|
|
1600
1606
|
paint.style = pattern;
|
|
1601
1607
|
paint.patternId = id;
|
|
@@ -1617,8 +1623,8 @@ function getPatternFixScale(paint, imageScaleX, imageScaleY) {
|
|
|
1617
1623
|
|
|
1618
1624
|
function checkImage(paint, drawImage, ui, canvas, renderOptions) {
|
|
1619
1625
|
const {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions);
|
|
1620
|
-
const {image: image, data: data, originPaint: originPaint} = paint, {exporting: exporting} = renderOptions;
|
|
1621
|
-
if (!data || paint.patternId === scaleX + "-" + scaleY && !exporting) {
|
|
1626
|
+
const {image: image, data: data, originPaint: originPaint} = paint, {exporting: exporting, snapshot: snapshot} = renderOptions;
|
|
1627
|
+
if (!data || paint.patternId === scaleX + "-" + scaleY && !exporting || snapshot) {
|
|
1622
1628
|
return false;
|
|
1623
1629
|
} else {
|
|
1624
1630
|
if (drawImage) {
|
|
@@ -2292,7 +2298,7 @@ const TextMode = 2;
|
|
|
2292
2298
|
|
|
2293
2299
|
function layoutChar(drawData, style, width, _height) {
|
|
2294
2300
|
const {rows: rows} = drawData;
|
|
2295
|
-
const {textAlign: textAlign, paraIndent: paraIndent,
|
|
2301
|
+
const {textAlign: textAlign, paraIndent: paraIndent, __letterSpacing: __letterSpacing} = style;
|
|
2296
2302
|
const justifyLast = width && textAlign.includes("both");
|
|
2297
2303
|
const justify = justifyLast || width && textAlign.includes("justify");
|
|
2298
2304
|
const justifyLetter = justify && textAlign.includes("letter");
|
|
@@ -2305,8 +2311,8 @@ function layoutChar(drawData, style, width, _height) {
|
|
|
2305
2311
|
remainingWidth = width - row.width - indentWidth;
|
|
2306
2312
|
if (justifyLetter) addLetterWidth = remainingWidth / (row.words.reduce((total, item) => total + item.data.length, 0) - 1); else addWordWidth = wordsLength > 1 ? remainingWidth / (wordsLength - 1) : 0;
|
|
2307
2313
|
}
|
|
2308
|
-
mode =
|
|
2309
|
-
if (row.isOverflow && !
|
|
2314
|
+
mode = __letterSpacing || row.isOverflow || justifyLetter ? CharMode : addWordWidth ? WordMode : TextMode;
|
|
2315
|
+
if (row.isOverflow && !__letterSpacing) row.textMode = true;
|
|
2310
2316
|
if (mode === TextMode) {
|
|
2311
2317
|
row.x += indentWidth;
|
|
2312
2318
|
toTextChar$1(row);
|
package/dist/worker.esm.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{LeaferCanvasBase as t,Platform as e,canvasPatch as i,FileHelper as s,Creator as n,LeaferImage as a,defineKey as r,LeafList as o,DataHelper as l,RenderEvent as d,ChildEvent as h,WatchEvent as c,PropertyEvent as u,LeafHelper as f,BranchHelper as g,LeafBoundsHelper as p,Bounds as _,isArray as w,Debug as y,LeafLevelList as m,LayoutEvent as x,Run as v,ImageManager as b,ResizeEvent as S,PointHelper as k,BoundsHelper as B,Plugin as R,isObject as L,FourNumberHelper as E,Matrix as T,isUndefined as A,isString as P,ImageEvent as C,MatrixHelper as O,MathHelper as M,AlignHelper as W,getMatrixData as D,AroundHelper as I,Direction4 as F,isNumber as Y}from"@leafer/core";export*from"@leafer/core";export{LeaferImage}from"@leafer/core";import{HitCanvasManager as X,InteractionBase as U}from"@leafer-ui/core";export*from"@leafer-ui/core";import{Paint as z,PaintImage as G,ColorConvert as q,PaintGradient as N,Effect as j,Group as H,TextConvert as V}from"@leafer-ui/draw";var Q;!function(t){t[t.none=1]="none",t[t.free=2]="free",t[t.mirrorAngle=3]="mirrorAngle",t[t.mirror=4]="mirror"}(Q||(Q={}));class Z extends t{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=e.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this;this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i),this.clientBounds=this.bounds}}i(OffscreenCanvasRenderingContext2D.prototype),i(Path2D.prototype);const{mineType:$}=s;function J(t,i){e.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,i)=>new Promise((s,n)=>{t.convertToBlob({type:$(e),quality:i}).then(t=>{var e=new FileReader;e.onload=t=>s(t.target.result),e.onerror=t=>n(t),e.readAsDataURL(t)}).catch(t=>{n(t)})}),canvasToBolb:(t,e,i)=>t.convertToBlob({type:$(e),quality:i}),canvasSaveAs:(t,e,i)=>new Promise(t=>t()),download(t,e){},loadImage:t=>new Promise((i,s)=>{let n=new XMLHttpRequest;n.open("GET",e.image.getRealURL(t),!0),n.responseType="blob",n.onload=()=>{createImageBitmap(n.response).then(t=>{i(t)}).catch(t=>{s(t)})},n.onerror=t=>s(t),n.send()})},e.canvas=n.canvas(),e.conicGradientSupport=!!e.canvas.context.createConicGradient}Object.assign(n,{canvas:(t,e)=>new Z(t,e),image:t=>new a(t)}),e.name="web",e.isWorker=!0,e.backgrounder=!0,e.requestRender=function(t){requestAnimationFrame(t)},r(e,"devicePixelRatio",{get:()=>1});const{userAgent:K}=navigator;K.indexOf("Firefox")>-1?(e.conicGradientRotate90=!0,e.intWheelDeltaY=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(e.fullImageShadow=!0),K.indexOf("Windows")>-1?(e.os="Windows",e.intWheelDeltaY=!0):K.indexOf("Mac")>-1?e.os="Mac":K.indexOf("Linux")>-1&&(e.os="Linux");class tt{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove&&this.config.usePartLayout){const t=new o;return this.__updatedList.list.forEach(e=>{e.leafer&&t.add(e)}),t}return this.__updatedList}constructor(t,e){this.totalTimes=0,this.config={},this.__updatedList=new o,this.target=t,e&&(this.config=l.default(e,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(d.REQUEST)}__onAttrChange(t){this.config.usePartLayout&&this.__updatedList.add(t.target),this.update()}__onChildEvent(t){this.config.usePartLayout&&(t.type===h.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,i=e.length;t<i;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new c(c.DATA,{updatedList:this.updatedList})),this.__updatedList=new o,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[u.CHANGE,this.__onAttrChange,this],[[h.ADD,h.REMOVE],this.__onChildEvent,this],[c.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:et,updateBounds:it,updateChange:st}=f,{pushAllChildBranch:nt,pushAllParent:at}=g;const{worldBounds:rt}=p;class ot{constructor(t){this.updatedBounds=new _,this.beforeBounds=new _,this.afterBounds=new _,w(t)&&(t=new o(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,rt)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,rt),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:lt,updateAllChange:dt}=f,ht=y.get("Layouter");class ct{constructor(t,e){this.totalTimes=0,this.config={usePartLayout:!0},this.__levelList=new m,this.target=t,e&&(this.config=l.default(e,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(x.START),this.layoutOnce(),t.emitEvent(new x(x.END,this.layoutedBlocks,this.times))}catch(t){ht.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?ht.warn("layouting"):this.times>3?ht.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(c.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 e=v.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:n,LAYOUT:a,AFTER:r}=x,o=this.getBlocks(s);o.forEach(t=>t.setBefore()),i.emitEvent(new x(n,o,this.times)),this.extraBlock=null,s.sort(),function(t,e){let i;t.list.forEach(t=>{i=t.__layout,e.without(t)&&!i.proxyZoom&&(i.matrixChanged?(et(t,!0),e.add(t),t.isBranch&&nt(t,e),at(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),at(t,e)))})}(s,this.__levelList),function(t){let e,i,s;t.sort(!0),t.levels.forEach(n=>{e=t.levelMap[n];for(let t=0,n=e.length;t<n;t++){if(i=e[t],i.isBranch&&i.__tempNumber){s=i.children;for(let t=0,e=s.length;t<e;t++)s[t].isBranch||it(s[t])}it(i)}})}(this.__levelList),function(t){t.list.forEach(st)}(s),this.extraBlock&&o.push(this.extraBlock),o.forEach(t=>t.setAfter()),i.emitEvent(new x(a,o,this.times)),i.emitEvent(new x(r,o,this.times)),this.addBlocks(o),this.__levelList.reset(),this.__updatedList=null,v.end(e)}fullLayout(){const t=v.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:n}=x,a=this.getBlocks(new o(e));e.emitEvent(new x(i,a,this.times)),ct.fullLayout(e),a.forEach(t=>{t.setAfter()}),e.emitEvent(new x(s,a,this.times)),e.emitEvent(new x(n,a,this.times)),this.addBlocks(a),v.end(t)}static fullLayout(t){lt(t,!0),t.isBranch?g.updateBounds(t):f.updateBounds(t),dt(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new ot([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new ot(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_([[x.REQUEST,this.layout,this],[x.AGAIN,this.layoutAgain,this],[c.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const ut=y.get("Renderer");class ft{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=e,i&&(this.config=l.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(x.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(d.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(d.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(d.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new _,ut.log(e.innerName,"---\x3e");try{this.emitRender(d.START),this.renderOnce(t),this.emitRender(d.END,this.totalBounds),b.clearRecycled()}catch(t){this.rendering=!1,ut.error(t)}ut.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return ut.warn("rendering");if(this.times>3)return ut.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new _,this.renderOptions={},t)this.emitRender(d.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(d.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(d.RENDER,this.renderBounds,this.renderOptions),this.emitRender(d.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 e=v.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),n=new _(s);i.save(),s.spread(ft.clipSpread).ceil(),i.clearWorld(s),i.clipWorld(s),this.__render(s,n),i.restore(),v.end(e)}fullRender(){const t=v.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),v.end(t)}__render(t,i){const{canvas:s,target:n}=this,a=t.includes(n.__world),r=a?{includes:a}:{bounds:t,includes:a};this.needFill&&s.fillWorld(t,this.config.fill),y.showRepaint&&y.drawRepaint(s,t),this.config.useCellRender&&(r.cellList=this.getCellList()),e.render(n,s,r),this.renderBounds=i=i||t,this.renderOptions=r,this.totalBounds.isEmpty()?this.totalBounds=i:this.totalBounds.add(i),s.updateRender(i)}getCellList(){}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new _;e.setList(t),t.length=0,t.push(e)}}__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 i=()=>{const t=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:s}=this.config;if(s&&t>s)return e.requestRender(i);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.requestRender(i)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new _(0,0,e,i).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new _(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||ut.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(t,e,i){this.target.emitEvent(new d(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[d.REQUEST,this.update,this],[x.END,this.__onLayoutEnd,this],[d.AGAIN,this.renderAgain,this],[S.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}ft.clipSpread=10;const gt={},{copyRadiusPoint:pt}=k,{hitRadiusPoint:_t}=B;class wt{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,n=i.ignoreHittable||!1,a=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new o(i.findList),i.findList||this.hitBranch(a.isBranchLeaf?{children:[a]}:a);const{list:r}=this.findList,l=this.getBestMatchLeaf(r,i.bottomList,n,!!i.findList),d=n?this.getPath(l):this.getHitablePath(l);return this.clear(),s?{path:d,target:l,throughPath:r.length?this.getThroughPath(r):d}:{path:d,target:l}}hitPoint(t,e,i){return!!this.getByPoint(t,e,i).target}getBestMatchLeaf(t,e,i,s){const n=this.findList=new o;if(t.length){let e;const{x:s,y:a}=this.point,r={x:s,y:a,radiusX:0,radiusY:0};for(let s=0,a=t.length;s<a;s++)if(e=t[s],(i||f.worldHittable(e))&&(this.hitChild(e,r),n.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&f.hasParent(t,e))){n.reset();break}return n.list[0]}}if(e)for(let t=0,i=e.length;t<i;t++)if(this.hitChild(e[t].target,this.point,e[t].proxy),n.length)return n.list[0];return s?null:i?t[0]:t.find(t=>f.worldHittable(t))}getPath(t){const e=new o,i=[],{target:s}=this;for(;t&&(t.syncEventer&&i.push(t.syncEventer),e.add(t),(t=t.parent)!==s););return i.length&&i.forEach(t=>{for(;t&&(t.__.hittable&&e.add(t),(t=t.parent)!==s););}),s&&e.add(s),e}getHitablePath(t){const e=this.getPath(t&&t.hittable?t:null);let i,s=new o;for(let t=e.list.length-1;t>-1&&(i=e.list[t],i.__.hittable)&&(s.addAt(i,0),i.__.hitChildren&&(!i.isLeafer||"draw"!==i.mode));t--);return s}getThroughPath(t){const e=new o,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,n,a;for(let t=0,r=i.length;t<r;t++){s=i[t],n=i[t+1];for(let t=0,i=s.length;t<i&&(a=s.list[t],!n||!n.has(a));t++)e.add(a)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s,n;const{point:a}=this;for(let r=t.length-1;r>-1;r--)if(i=t[r],n=i.__,n.visible&&(!e||n.mask))if(s=_t(i.__world,n.hitRadius?pt(gt,a,n.hitRadius):a),i.isBranch){if(s||i.__ignoreHitWorld){if(i.isBranchLeaf&&n.__clipAfterFill&&!i.__hitWorld(a,!0))continue;i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,a)}}else s&&this.hitChild(i,a)}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:s}=t;if(s&&s.__hasMask&&!t.__.mask){let i,n=[];const{children:a}=s;for(let s=0,r=a.length;s<r;s++)if(i=a[s],i.__.mask&&n.push(i),i===t){if(n&&!n.every(t=>t.__hitWorld(e)))return;break}}this.findList.add(i||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class yt{constructor(t,e){this.config={},e&&(this.config=l.default(e,this.config)),this.picker=new wt(this.target=t,this),this.finder=n.finder&&n.finder()}getByPoint(t,i,s){const{target:n,picker:a}=this;return e.backgrounder&&n&&n.updateLayout(),a.getByPoint(t,i,s)}hitPoint(t,e,i){return this.picker.hitPoint(t,e,i)}getBy(t,e,i,s){return this.finder?this.finder.getBy(t,e,i,s):R.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function mt(t,e,i){t.__.__font?z.fillText(t,e,i):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function xt(t,e,i,s,n){const a=i.__;L(t)?z.drawStrokesStyle(t,e,!1,i,s,n):(s.setStroke(t,a.__strokeWidth*e,a),s.stroke()),a.__useArrow&&z.strokeArrow(t,i,s,n)}function vt(t,e,i,s,n){const a=i.__;L(t)?z.drawStrokesStyle(t,e,!0,i,s,n):(s.setStroke(t,a.__strokeWidth*e,a),z.drawTextStroke(i,s,n))}function bt(t,e,i,s,n){const a=s.getSameCanvas(!0,!0);a.font=i.__.__font,vt(t,2,i,a,n),a.blendMode="outside"===e?"destination-out":"destination-in",z.fillText(i,a,n),a.blendMode="normal",f.copyCanvasByWorld(i,s,a),a.recycle(i.__nowWorld)}Object.assign(n,{watcher:(t,e)=>new tt(t,e),layouter:(t,e)=>new ct(t,e),renderer:(t,e,i)=>new ft(t,e,i),selector:(t,e)=>new yt(t,e)}),e.layout=ct.fullLayout,e.render=function(t,e,i){const s=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new o,t.__render(e,i),i.topList.length&&i.topList.forEach(t=>t.__render(e,s))};const{getSpread:St,copyAndSpread:kt,toOuterOf:Bt,getOuterOf:Rt,getByMove:Lt,move:Et,getIntersectData:Tt}=B,At={};let Pt;const{stintSet:Ct}=l,{hasTransparent:Ot}=q;function Mt(t,e,i){if(!L(e)||!1===e.visible||0===e.opacity)return;let s;const{boxBounds:n}=i.__layout;switch(e.type){case"image":if(!e.url)return;s=G.image(i,t,e,n,!Pt||!Pt[e.url]);break;case"linear":s=N.linearGradient(e,n);break;case"radial":s=N.radialGradient(e,n);break;case"angular":s=N.conicGradient(e,n);break;case"solid":const{type:a,color:r,opacity:o}=e;s={type:a,style:q.string(r,o)};break;default:A(e.r)||(s={type:"solid",style:q.string(e)})}if(s&&(s.originPaint=e,P(s.style)&&Ot(s.style)&&(s.isTransparent=!0),e.style)){if(0===e.style.strokeWidth)return;s.strokeStyle=e.style}return s}const Wt={compute:function(t,e){const i=e.__,s=[];let n,a,r,o=i.__input[t];w(o)||(o=[o]),Pt=G.recycleImage(t,i);for(let i,n=0,a=o.length;n<a;n++)(i=Mt(t,o[n],e))&&(s.push(i),i.strokeStyle&&(r||(r=1),i.strokeStyle.strokeWidth&&(r=Math.max(r,i.strokeStyle.strokeWidth))));i["_"+t]=s.length?s:void 0,s.length?(s.every(t=>t.isTransparent)&&(s.some(t=>t.image)&&(n=!0),a=!0),"fill"===t?(Ct(i,"__isAlphaPixelFill",n),Ct(i,"__isTransparentFill",a)):(Ct(i,"__isAlphaPixelStroke",n),Ct(i,"__isTransparentStroke",a),Ct(i,"__hasMultiStrokeStyle",r))):i.__removePaint(t,!1)},fill:function(t,e,i,s){i.fillStyle=t,mt(e,i,s)},fills:function(t,e,i,s){let n,a,r;for(let o=0,l=t.length;o<l;o++){if(n=t[o],a=n.originPaint,n.image){if(r?r++:r=1,G.checkImage(n,!e.__.__font,e,i,s))continue;if(!n.style){1===r&&n.image.isPlacehold&&e.drawImagePlaceholder(n,i,s);continue}}if(i.fillStyle=n.style,n.transform||a.scaleFixed){if(i.save(),n.transform&&i.transform(n.transform),a.scaleFixed){const{scaleX:t,scaleY:s}=e.getRenderScaleData(!0);(!0===a.scaleFixed||"zoom-in"===a.scaleFixed&&t>1&&s>1)&&i.scale(1/t,1/s)}a.blendMode&&(i.blendMode=a.blendMode),mt(e,i,s),i.restore()}else a.blendMode?(i.saveBlendMode(a.blendMode),mt(e,i,s),i.restoreBlendMode()):mt(e,i,s)}},fillPathOrText:mt,fillText:function(t,e,i){const s=t.__,{rows:n,decorationY:a}=s.__textDrawData;let r;s.__isPlacehold&&s.placeholderColor&&(e.fillStyle=s.placeholderColor);for(let t=0,i=n.length;t<i;t++)r=n[t],r.text?e.fillText(r.text,r.x,r.y):r.data&&r.data.forEach(t=>{e.fillText(t.char,t.x,r.y)});if(a){const{decorationColor:t,decorationHeight:i}=s.__textDrawData;t&&(e.fillStyle=t),n.forEach(t=>a.forEach(s=>e.fillRect(t.x,t.y+s,t.width,i)))}},stroke:function(t,e,i,s){const n=e.__;if(n.__strokeWidth)if(n.__font)z.strokeText(t,e,i,s);else switch(n.strokeAlign){case"center":xt(t,1,e,i,s);break;case"inside":!function(t,e,i,s){i.save(),i.clipUI(e),xt(t,2,e,i,s),i.restore()}(t,e,i,s);break;case"outside":!function(t,e,i,s){const n=e.__;if(n.__fillAfterStroke)xt(t,2,e,i,s);else{const{renderBounds:a}=e.__layout,r=i.getSameCanvas(!0,!0);e.__drawRenderPath(r),xt(t,2,e,r,s),r.clipUI(n),r.clearWorld(a),f.copyCanvasByWorld(e,i,r),r.recycle(e.__nowWorld)}}(t,e,i,s)}},strokes:function(t,e,i,s){z.stroke(t,e,i,s)},strokeText:function(t,e,i,s){switch(e.__.strokeAlign){case"center":vt(t,1,e,i,s);break;case"inside":bt(t,"inside",e,i,s);break;case"outside":e.__.__fillAfterStroke?vt(t,2,e,i,s):bt(t,"outside",e,i,s)}},drawTextStroke:function(t,e,i){let s,n=t.__.__textDrawData;const{rows:a,decorationY:r}=n;for(let t=0,i=a.length;t<i;t++)s=a[t],s.text?e.strokeText(s.text,s.x,s.y):s.data&&s.data.forEach(t=>{e.strokeText(t.char,t.x,s.y)});if(r){const{decorationHeight:t}=n;a.forEach(i=>r.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}},drawStrokesStyle:function(t,e,i,s,n,a){let r;const o=s.__,{__hasMultiStrokeStyle:l}=o;l||n.setStroke(void 0,o.__strokeWidth*e,o);for(let d=0,h=t.length;d<h;d++)if(r=t[d],(!r.image||!G.checkImage(r,!1,s,n,a))&&r.style){if(l){const{strokeStyle:t}=r;t?n.setStroke(r.style,o.__getRealStrokeWidth(t)*e,o,t):n.setStroke(r.style,o.__strokeWidth*e,o)}else n.strokeStyle=r.style;r.originPaint.blendMode?(n.saveBlendMode(r.originPaint.blendMode),i?z.drawTextStroke(s,n,a):n.stroke(),n.restoreBlendMode()):i?z.drawTextStroke(s,n,a):n.stroke()}},shape:function(t,i,s){const n=i.getSameCanvas(),a=i.bounds,r=t.__nowWorld,o=t.__layout,l=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let d,h,c,u,f,g;Bt(o.strokeSpread?(kt(At,o.boxBounds,o.strokeSpread),At):o.boxBounds,r,l);let{scaleX:p,scaleY:_}=t.getRenderScaleData(!0);if(a.includes(l))g=n,d=f=l,h=r;else{let n;if(e.fullImageShadow)n=l;else{const t=o.renderShapeSpread?St(a,E.swapAndScale(o.renderShapeSpread,p,_)):a;n=Tt(t,l)}u=a.getFitMatrix(n);let{a:w,d:y}=u;u.a<1&&(g=i.getSameCanvas(),t.__renderShape(g,s),p*=w,_*=y),f=Rt(l,u),d=Lt(f,-u.e,-u.f),h=Rt(r,u),Et(h,-u.e,-u.f);const m=s.matrix;m?(c=new T(u),c.multiply(m),w*=m.scaleX,y*=m.scaleY):c=u,c.withScale(w,y),s=Object.assign(Object.assign({},s),{matrix:c})}return t.__renderShape(n,s),{canvas:n,matrix:c,fitMatrix:u,bounds:d,renderBounds:h,worldCanvas:g,shapeBounds:f,scaleX:p,scaleY:_}}};let Dt,It=new _;const{isSame:Ft}=B;function Yt(t,e,i,s,n,a){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=s.width/e.pixelRatio,e.__naturalHeight=s.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return n.data||G.createData(n,s,i,a),!0}function Xt(t,e){Gt(t,C.LOAD,e)}function Ut(t,e){Gt(t,C.LOADED,e)}function zt(t,e,i){e.error=i,t.forceUpdate("surface"),Gt(t,C.ERROR,e)}function Gt(t,e,i){t.hasEvent(e)&&t.emitEvent(new C(e,i))}function qt(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:Nt,translate:jt}=O,Ht=new _,Vt={},Qt={};function Zt(t,e,i,s){const n=P(t)||s?(s?i-s*e:i%e)/((s||Math.floor(i/e))-1):t;return"auto"===t&&n<0?0:n}let $t={},Jt=D();const{get:Kt,set:te,rotateOfOuter:ee,translate:ie,scaleOfOuter:se,multiplyParent:ne,scale:ae,rotate:re,skew:oe}=O;function le(t,e,i,s,n,a,r,o){r&&re(t,r),o&&oe(t,o.x,o.y),n&&ae(t,n,a),ie(t,e.x+i,e.y+s)}function de(t,e,i,s){return new(i||(i=Promise))(function(n,a){function r(t){try{l(s.next(t))}catch(t){a(t)}}function o(t){try{l(s.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(r,o)}l((s=s.apply(t,e||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const{get:he,scale:ce,copy:ue}=O,{getFloorScale:fe}=M,{abs:ge}=Math;const pe={image:function(t,e,i,s,n){let a,r;const o=b.get(i);return Dt&&i===Dt.paint&&Ft(s,Dt.boxBounds)?a=Dt.leafPaint:(a={type:i.type,image:o},o.hasAlphaPixel&&(a.isTransparent=!0),Dt=o.use>1?{leafPaint:a,paint:i,boxBounds:It.set(s)}:null),(n||o.loading)&&(r={image:o,attrName:e,attrValue:i}),o.ready?(Yt(t,e,i,o,a,s),n&&(Xt(t,r),Ut(t,r))):o.error?n&&zt(t,r,o.error):(n&&(qt(t,!0),Xt(t,r)),a.loadId=o.load(()=>{qt(t,!1),t.destroyed||(Yt(t,e,i,o,a,s)&&(o.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),Ut(t,r)),a.loadId=void 0},e=>{qt(t,!1),zt(t,r,e),a.loadId=void 0},i.lod&&o.getThumbSize()),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{o.ready||(o.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):o.isPlacehold=!0)),a},checkImage:function(t,i,s,n,a){const{scaleX:r,scaleY:o}=G.getImageRenderScaleData(t,s,n,a),{image:l,data:d,originPaint:h}=t,{exporting:c}=a;return!(!d||t.patternId===r+"-"+o&&!c)&&(i&&(d.repeat?i=!1:h.changeful||"miniapp"===e.name&&S.isResizing(s)||c||(i=e.image.isLarge(l,r,o)||l.width*r>8096||l.height*o>8096)),i?(s.__.__isFastShadow&&(n.fillStyle=t.style||"#000",n.fill()),G.drawImage(t,r,o,s,n,a),!0):(!t.style||h.sync||c?G.createPattern(t,s,n,a):G.createPatternTask(t,s,n,a),!1))},drawImage:function(t,e,i,s,n,a){const{data:r,image:o}=t,{blendMode:l}=t.originPaint,{opacity:d,transform:h}=r,c=o.getFull(r.filters),u=s.__;let f,{width:g,height:p}=o;(f=h&&!h.onlyScale||u.path||u.cornerRadius)||d||l?(n.save(),f&&n.clipUI(s),l&&(n.blendMode=l),d&&(n.opacity*=d),h&&n.transform(h),n.drawImage(c,0,0,g,p),n.restore()):(r.scaleX&&(g*=r.scaleX,p*=r.scaleY),n.drawImage(c,0,0,g,p))},getImageRenderScaleData:function(t,e,i,s){const n=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:a}=t;if(i){const{pixelRatio:t}=i;n.scaleX*=t,n.scaleY*=t}return a&&a.scaleX&&(n.scaleX*=Math.abs(a.scaleX),n.scaleY*=Math.abs(a.scaleY)),n},recycleImage:function(t,e){const i=e["_"+t];if(w(i)){let s,n,a,r,o;for(let l=0,d=i.length;l<d;l++)s=i[l],n=s.image,o=n&&n.url,o&&(a||(a={}),a[o]=!0,b.recyclePaint(s),n.loading&&(r||(r=e.__input&&e.__input[t]||[],w(r)||(r=[r])),n.unload(i[l].loadId,!r.some(t=>t.url===o))));return a}return null},createPatternTask:function(t,e,i,s){t.patternTask||(t.patternTask=b.patternTasker.add(()=>de(this,void 0,void 0,function*(){G.createPattern(t,e,i,s),e.forceUpdate("surface")}),0,()=>(t.patternTask=null,i.bounds.hit(e.__nowWorld))))},createPattern:function(t,i,s,n){let{scaleX:a,scaleY:r}=G.getImageRenderScaleData(t,i,s,n),o=a+"-"+r;if(t.patternId!==o&&!i.destroyed&&(!e.image.isLarge(t.image,a,r)||t.data.repeat)){const{image:s,data:n}=t,{transform:l,gap:d}=n,h=G.getPatternFixScale(t,a,r);let c,u,f,{width:g,height:p}=s;h&&(a*=h,r*=h),g*=a,p*=r,d&&(u=d.x*a/ge(n.scaleX||1),f=d.y*r/ge(n.scaleY||1)),(l||1!==a||1!==r)&&(a*=fe(g+(u||0)),r*=fe(p+(f||0)),c=he(),l&&ue(c,l),ce(c,1/a,1/r));const _=s.getCanvas(g,p,n.opacity,n.filters,u,f,i.leafer&&i.leafer.config.smooth),w=s.getPattern(_,n.repeat||e.origin.noRepeat||"no-repeat",c,t);t.style=w,t.patternId=o}},getPatternFixScale:function(t,i,s){const{image:n}=t;let a,r=e.image.maxPatternSize,o=n.width*n.height;return n.isSVG?i>1&&(a=Math.ceil(i)/i):r>o&&(r=o),(o*=i*s)>r&&(a=Math.sqrt(r/o)),a},createData:function(t,e,i,s){t.data=G.getPatternData(i,s,e)},getPatternData:function(t,e,i){t.padding&&(e=Ht.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:s,height:n}=i,{opacity:a,mode:r,align:o,offset:l,scale:d,size:h,rotation:c,skew:u,clipSize:f,repeat:g,gap:p,filters:_}=t,w=e.width===s&&e.height===n,y={mode:r},m="center"!==o&&(c||0)%180==90;let x,v;switch(B.set(Qt,0,0,m?n:s,m?s:n),r&&"cover"!==r&&"fit"!==r?((d||h)&&(M.getScaleData(d,h,i,Vt),x=Vt.scaleX,v=Vt.scaleY),(o||p||g)&&(x&&B.scale(Qt,x,v,!0),o&&W.toPoint(o,Qt,e,Qt,!0,!0))):w&&!c||(x=v=B.getFitScale(e,Qt,"fit"!==r),B.put(e,i,o,x,!1,Qt),B.scale(Qt,x,v,!0)),l&&k.move(Qt,l),r){case"stretch":w?x&&(x=v=void 0):(x=e.width/s,v=e.height/n,G.stretchMode(y,e,x,v));break;case"normal":case"clip":if(Qt.x||Qt.y||x||f||c||u){let t,i;f&&(t=e.width/f.width,i=e.height/f.height),G.clipMode(y,e,Qt.x,Qt.y,x,v,c,u,t,i),t&&(x=x?x*t:t,v=v?v*i:i)}break;case"repeat":(!w||x||c||u)&&G.repeatMode(y,e,s,n,Qt.x,Qt.y,x,v,c,u,o,t.freeTransform),g||(y.repeat="repeat");const i=L(g);(p||i)&&(y.gap=function(t,e,i,s,n){let a,r;L(t)?(a=t.x,r=t.y):a=r=t;return{x:Zt(a,i,n.width,e&&e.x),y:Zt(r,s,n.height,e&&e.y)}}(p,i&&g,Qt.width,Qt.height,e));break;default:x&&G.fillOrFitMode(y,e,Qt.x,Qt.y,x,v,c)}return y.transform||(e.x||e.y)&&jt(y.transform=Nt(),e.x,e.y),x&&(y.scaleX=x,y.scaleY=v),a&&a<1&&(y.opacity=a),_&&(y.filters=_),g&&(y.repeat=P(g)?"x"===g?"repeat-x":"repeat-y":"repeat"),y},stretchMode:function(t,e,i,s){const n=Kt(),{x:a,y:r}=e;a||r?ie(n,a,r):n.onlyScale=!0,ae(n,i,s),t.transform=n},fillOrFitMode:function(t,e,i,s,n,a,r){const o=Kt();ie(o,e.x+i,e.y+s),ae(o,n,a),r&&ee(o,{x:e.x+e.width/2,y:e.y+e.height/2},r),t.transform=o},clipMode:function(t,e,i,s,n,a,r,o,l,d){const h=Kt();le(h,e,i,s,n,a,r,o),l&&(r||o?(te(Jt),se(Jt,e,l,d),ne(h,Jt)):se(h,e,l,d)),t.transform=h},repeatMode:function(t,e,i,s,n,a,r,o,l,d,h,c){const u=Kt();if(c)le(u,e,n,a,r,o,l,d);else{if(l)if("center"===h)ee(u,{x:i/2,y:s/2},l);else switch(re(u,l),l){case 90:ie(u,s,0);break;case 180:ie(u,i,s);break;case 270:ie(u,0,i)}$t.x=e.x+n,$t.y=e.y+a,ie(u,$t.x,$t.y),r&&se(u,$t,r,o)}t.transform=u}},{toPoint:_e}=I,{hasTransparent:we}=q,ye={},me={};function xe(t,e,i,s){if(i){let n,a,r,o;for(let t=0,l=i.length;t<l;t++)n=i[t],P(n)?(r=t/(l-1),a=q.string(n,s)):(r=n.offset,a=q.string(n.color,s)),e.addColorStop(r,a),!o&&we(a)&&(o=!0);o&&(t.isTransparent=!0)}}const{getAngle:ve,getDistance:be}=k,{get:Se,rotateOfOuter:ke,scaleOfOuter:Be}=O,{toPoint:Re}=I,Le={},Ee={};function Te(t,e,i,s,n){let a;const{width:r,height:o}=t;if(r!==o||s){const t=ve(e,i);a=Se(),n?(Be(a,e,r/o*(s||1),1),ke(a,e,t+90)):(Be(a,e,1,r/o*(s||1)),ke(a,e,t))}return a}const{getDistance:Ae}=k,{toPoint:Pe}=I,Ce={},Oe={};const Me={linearGradient:function(t,i){let{from:s,to:n,type:a,opacity:r}=t;_e(s||"top",i,ye),_e(n||"bottom",i,me);const o=e.canvas.createLinearGradient(ye.x,ye.y,me.x,me.y),l={type:a,style:o};return xe(l,o,t.stops,r),l},radialGradient:function(t,i){let{from:s,to:n,type:a,opacity:r,stretch:o}=t;Re(s||"center",i,Le),Re(n||"bottom",i,Ee);const l=e.canvas.createRadialGradient(Le.x,Le.y,0,Le.x,Le.y,be(Le,Ee)),d={type:a,style:l};xe(d,l,t.stops,r);const h=Te(i,Le,Ee,o,!0);return h&&(d.transform=h),d},conicGradient:function(t,i){let{from:s,to:n,type:a,opacity:r,stretch:o}=t;Pe(s||"center",i,Ce),Pe(n||"bottom",i,Oe);const l=e.conicGradientSupport?e.canvas.createConicGradient(0,Ce.x,Ce.y):e.canvas.createRadialGradient(Ce.x,Ce.y,0,Ce.x,Ce.y,Ae(Ce,Oe)),d={type:a,style:l};xe(d,l,t.stops,r);const h=Te(i,Ce,Oe,o||1,e.conicGradientRotate90);return h&&(d.transform=h),d},getTransform:Te},{copy:We,move:De,toOffsetOutBounds:Ie}=B,{max:Fe,abs:Ye}=Math,Xe={},Ue=new T,ze={};function Ge(t,e){let i,s,n,a,r=0,o=0,l=0,d=0;return e.forEach(t=>{i=t.x||0,s=t.y||0,a=1.5*(t.blur||0),n=Ye(t.spread||0),r=Fe(r,n+a-s),o=Fe(o,n+a+i),l=Fe(l,n+a+s),d=Fe(d,n+a-i)}),r===o&&o===l&&l===d?r:[r,o,l,d]}function qe(t,i,s){const{shapeBounds:n}=s;let a,r;e.fullImageShadow?(We(Xe,t.bounds),De(Xe,i.x-n.x,i.y-n.y),a=t.bounds,r=Xe):(a=n,r=i),t.copyWorld(s.canvas,a,r)}const{toOffsetOutBounds:Ne}=B,je={};const He=Ge;const Ve={shadow:function(t,e,i){let s,n;const{__nowWorld:a}=t,{shadow:r}=t.__,{worldCanvas:o,bounds:l,renderBounds:d,shapeBounds:h,scaleX:c,scaleY:u}=i,g=e.getSameCanvas(),p=r.length-1;Ie(l,ze,d),r.forEach((r,_)=>{let w=1;if(r.scaleFixed){const t=Math.abs(a.scaleX);t>1&&(w=1/t)}g.setWorldShadow(ze.offsetX+(r.x||0)*c*w,ze.offsetY+(r.y||0)*u*w,(r.blur||0)*c*w,q.string(r.color)),n=j.getShadowTransform(t,g,i,r,ze,w),n&&g.setTransform(n),qe(g,ze,i),n&&g.resetTransform(),s=d,r.box&&(g.restore(),g.save(),o&&(g.copyWorld(g,d,a,"copy"),s=a),o?g.copyWorld(o,a,a,"destination-out"):g.copyWorld(i.canvas,h,l,"destination-out")),f.copyCanvasByWorld(t,e,g,s,r.blendMode),p&&_<p&&g.clearWorld(s)}),g.recycle(s)},innerShadow:function(t,e,i){let s,n;const{__nowWorld:a}=t,{innerShadow:r}=t.__,{worldCanvas:o,bounds:l,renderBounds:d,shapeBounds:h,scaleX:c,scaleY:u}=i,g=e.getSameCanvas(),p=r.length-1;Ne(l,je,d),r.forEach((r,_)=>{let w=1;if(r.scaleFixed){const t=Math.abs(a.scaleX);t>1&&(w=1/t)}g.save(),g.setWorldShadow(je.offsetX+(r.x||0)*c*w,je.offsetY+(r.y||0)*u*w,(r.blur||0)*c*w),n=j.getShadowTransform(t,g,i,r,je,w,!0),n&&g.setTransform(n),qe(g,je,i),g.restore(),o?(g.copyWorld(g,d,a,"copy"),g.copyWorld(o,a,a,"source-out"),s=a):(g.copyWorld(i.canvas,h,l,"source-out"),s=d),g.fillWorld(s,q.string(r.color),"source-in"),f.copyCanvasByWorld(t,e,g,s,r.blendMode),p&&_<p&&g.clearWorld(s)}),g.recycle(s)},blur:function(t,e,i){const{blur:s}=t.__;i.setWorldBlur(s*t.__nowWorld.a),i.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),i.filter="none"},backgroundBlur:function(t,e,i){},getShadowRenderSpread:Ge,getShadowTransform:function(t,e,i,s,n,a,r){if(s.spread){const i=2*s.spread*a*(r?-1:1),{width:o,height:l}=t.__layout.strokeBounds;return Ue.set().scaleOfOuter({x:(n.x+n.width/2)*e.pixelRatio,y:(n.y+n.height/2)*e.pixelRatio},1+i/o,1+i/l),Ue}},isTransformShadow(t){},getInnerShadowSpread:He},{excludeRenderBounds:Qe}=p;let Ze;function $e(t,e,i,s,n,a,r,o){switch(e){case"grayscale":Ze||(Ze=!0,n.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,n,a){const r=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,r),a&&s.recycle(r);Ke(t,e,i,1,n,a)}(t,i,s,n,r,o);break;case"opacity-path":Ke(t,i,s,a,r,o);break;case"path":o&&i.restore()}}function Je(t){return t.getSameCanvas(!1,!0)}function Ke(t,e,i,s,n,a){const r=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,r,void 0,n),a?i.recycle(r):i.clearWorld(r)}H.prototype.__renderMask=function(t,e){let i,s,n,a,r,o;const{children:l}=this;for(let d=0,h=l.length;d<h;d++){if(i=l[d],o=i.__.mask,o){r&&($e(this,r,t,n,s,a,void 0,!0),s=n=null),"clipping"!==o&&"clipping-path"!==o||Qe(i,e)||i.__render(t,e),a=i.__.opacity,Ze=!1,"path"===o||"clipping-path"===o?(a<1?(r="opacity-path",n||(n=Je(t))):(r="path",t.save()),i.__clip(n||t,e)):(r="grayscale"===o?"grayscale":"alpha",s||(s=Je(t)),n||(n=Je(t)),i.__render(s,e));continue}const h=1===a&&i.__.__blendMode;h&&$e(this,r,t,n,s,a,void 0,!1),Qe(i,e)||i.__render(n||t,e),h&&$e(this,r,t,n,s,a,h,!1)}$e(this,r,t,n,s,a,void 0,!0)};const ti=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",ei=ti+"_#~&*+\\=|≮≯≈≠=…",ii=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 si(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const ni=si("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),ai=si("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),ri=si(ti),oi=si(ei),li=si("- —/~|┆·");var di;!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"}(di||(di={}));const{Letter:hi,Single:ci,Before:ui,After:fi,Symbol:gi,Break:pi}=di;function _i(t){return ni[t]?hi:li[t]?pi:ai[t]?ui:ri[t]?fi:oi[t]?gi:ii.test(t)?ci:hi}const wi={trimRight(t){const{words:e}=t;let i,s=0,n=e.length;for(let a=n-1;a>-1&&(i=e[a].data[0]," "===i.char);a--)s++,t.width-=i.width;s&&e.splice(n-s,s)}};function yi(t,e,i){switch(e){case"title":return i?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:mi}=wi,{Letter:xi,Single:vi,Before:bi,After:Si,Symbol:ki,Break:Bi}=di;let Ri,Li,Ei,Ti,Ai,Pi,Ci,Oi,Mi,Wi,Di,Ii,Fi,Yi,Xi,Ui,zi,Gi=[];function qi(t,e){Mi&&!Oi&&(Oi=Mi),Ri.data.push({char:t,width:e}),Ei+=e}function Ni(){Ti+=Ei,Ri.width=Ei,Li.words.push(Ri),Ri={data:[]},Ei=0}function ji(){Yi&&(Xi.paraNumber++,Li.paraStart=!0,Yi=!1),Mi&&(Li.startCharSize=Oi,Li.endCharSize=Mi,Oi=0),Li.width=Ti,Ui.width?mi(Li):zi&&Hi(),Gi.push(Li),Li={words:[]},Ti=0}function Hi(){Ti>(Xi.maxWidth||0)&&(Xi.maxWidth=Ti)}const{top:Vi,right:Qi,bottom:Zi,left:$i}=F;function Ji(t,e,i){const{bounds:s,rows:n}=t;s[e]+=i;for(let t=0;t<n.length;t++)n[t][e]+=i}const Ki={getDrawData:function(t,i){P(t)||(t=String(t));let s=0,n=0,a=i.__getInput("width")||0,r=i.__getInput("height")||0;const{__padding:o}=i;o&&(a?(s=o[$i],a-=o[Qi]+o[$i],!a&&(a=.01)):i.autoSizeAlign||(s=o[$i]),r?(n=o[Vi],r-=o[Vi]+o[Zi],!r&&(r=.01)):i.autoSizeAlign||(n=o[Vi]));const l={bounds:{x:s,y:n,width:a,height:r},rows:[],paraNumber:0,font:e.canvas.font=i.__font};return function(t,i,s){Xi=t,Gi=t.rows,Ui=t.bounds,zi=!Ui.width&&!s.autoSizeAlign;const{__letterSpacing:n,paraIndent:a,textCase:r}=s,{canvas:o}=e,{width:l}=Ui;if(s.__isCharMode){const t="none"!==s.textWrap,e="break"===s.textWrap;Yi=!0,Di=null,Oi=Ci=Mi=Ei=Ti=0,Ri={data:[]},Li={words:[]},n&&(i=[...i]);for(let s=0,d=i.length;s<d;s++)Pi=i[s],"\n"===Pi?(Ei&&Ni(),Li.paraEnd=!0,ji(),Yi=!0):(Wi=_i(Pi),Wi===xi&&"none"!==r&&(Pi=yi(Pi,r,!Ei)),Ci=o.measureText(Pi).width,n&&(n<0&&(Mi=Ci),Ci+=n),Ii=Wi===vi&&(Di===vi||Di===xi)||Di===vi&&Wi!==Si,Fi=!(Wi!==bi&&Wi!==vi||Di!==ki&&Di!==Si),Ai=Yi&&a?l-a:l,t&&l&&Ti+Ei+Ci>Ai&&(e?(Ei&&Ni(),Ti&&ji()):(Fi||(Fi=Wi===xi&&Di==Si),Ii||Fi||Wi===Bi||Wi===bi||Wi===vi||Ei+Ci>Ai?(Ei&&Ni(),Ti&&ji()):Ti&&ji()))," "===Pi&&!0!==Yi&&Ti+Ei===0||(Wi===Bi?(" "===Pi&&Ei&&Ni(),qi(Pi,Ci),Ni()):Ii||Fi?(Ei&&Ni(),qi(Pi,Ci)):qi(Pi,Ci)),Di=Wi);Ei&&Ni(),Ti&&ji(),Gi.length>0&&(Gi[Gi.length-1].paraEnd=!0)}else i.split("\n").forEach(t=>{Xi.paraNumber++,Ti=o.measureText(t).width,Gi.push({x:a||0,text:t,width:Ti,paraStart:!0}),zi&&Hi()})}(l,t,i),o&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":Ji(e,"x",t[$i]);break;case"right":Ji(e,"x",-t[Qi])}if(!n&&i.autoSizeAlign)switch(i.verticalAlign){case"top":Ji(e,"y",t[Vi]);break;case"bottom":Ji(e,"y",-t[Zi])}}(o,l,i,a,r),function(t,e){const{rows:i,bounds:s}=t,n=i.length,{__lineHeight:a,__baseLine:r,__letterSpacing:o,__clipText:l,textAlign:d,verticalAlign:h,paraSpacing:c,autoSizeAlign:u}=e;let{x:f,y:g,width:p,height:_}=s,w=a*n+(c?c*(t.paraNumber-1):0),y=r;if(l&&w>_)w=Math.max(_,a),n>1&&(t.overflow=n);else if(_||u)switch(h){case"middle":g+=(_-w)/2;break;case"bottom":g+=_-w}y+=g;let m,x,v,b=p||u?p:t.maxWidth;for(let r=0,h=n;r<h;r++){if(m=i[r],m.x=f,m.width<p||m.width>p&&!l)switch(d){case"center":m.x+=(b-m.width)/2;break;case"right":m.x+=b-m.width}m.paraStart&&c&&r>0&&(y+=c),m.y=y,y+=a,t.overflow>r&&y>w&&(m.isOverflow=!0,t.overflow=r+1),x=m.x,v=m.width,o<0&&(m.width<0?(v=-m.width+e.fontSize+o,x-=v,v+=e.fontSize):v-=o),x<s.x&&(s.x=x),v>s.width&&(s.width=v),l&&p&&p<v&&(m.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=g,s.height=w}(l,i),i.__isCharMode&&function(t,e,i){const{rows:s}=t,{textAlign:n,paraIndent:a,letterSpacing:r}=e,o=i&&n.includes("both"),l=o||i&&n.includes("justify"),d=l&&n.includes("letter");let h,c,u,f,g,p,_,w,y,m;s.forEach(t=>{t.words&&(g=a&&t.paraStart?a:0,w=t.words.length,l&&(m=!t.paraEnd||o,c=i-t.width-g,d?f=c/(t.words.reduce((t,e)=>t+e.data.length,0)-1):u=w>1?c/(w-1):0),p=r||t.isOverflow||d?0:u?1:2,t.isOverflow&&!r&&(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,i)=>{1===p?(_={char:"",x:h},h=function(t,e,i){return t.forEach(t=>{i.char+=t.char,e+=t.width}),e}(e.data,h,_),(t.isOverflow||" "!==_.char)&&t.data.push(_)):h=function(t,e,i,s,n){return t.forEach(t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width,n&&(e+=n)}),e}(e.data,h,t.data,t.isOverflow,m&&f),m&&(y=i===w-1,u?y||(h+=u,t.width+=u):f&&(t.width+=f*(e.data.length-(y?1:0))))})),t.words=null)})}(l,i,a),l.overflow&&function(t,i,s,n){if(!n)return;const{rows:a,overflow:r}=t;let{textOverflow:o}=i;if(a.splice(r),o&&"show"!==o){let t,l;"hide"===o?o="":"ellipsis"===o&&(o="...");const d=o?e.canvas.measureText(o).width:0,h=s+n-d;("none"===i.textWrap?a:[a[r-1]]).forEach(e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let s=i;s>-1&&(t=e.data[s],l=t.x+t.width,!(s===i&&l<h));s--){if(l<h&&" "!==t.char||!s){e.data.splice(s+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)}})}}(l,i,s,a),"none"!==i.textDecoration&&function(t,e){let i,s=0;const{fontSize:n,textDecoration:a}=e;switch(t.decorationHeight=n/11,L(a)?(i=a.type,a.color&&(t.decorationColor=q.string(a.color)),a.offset&&(s=Math.min(.3*n,Math.max(a.offset,.15*-n)))):i=a,i){case"under":t.decorationY=[.15*n+s];break;case"delete":t.decorationY=[.35*-n];break;case"under-delete":t.decorationY=[.15*n+s,.35*-n]}}(l,i),l}};const ts={string:function(t,e){if(!t)return"#000";const i=Y(e)&&e<1;if(P(t)){if(!i||!q.object)return t;t=q.object(t)}let s=A(t.a)?1:t.a;i&&(s*=e);const n=t.r+","+t.g+","+t.b;return 1===s?"rgb("+n+")":"rgba("+n+","+s+")"}};Object.assign(V,Ki),Object.assign(q,ts),Object.assign(z,Wt),Object.assign(G,pe),Object.assign(N,Me),Object.assign(j,Ve),Object.assign(n,{interaction:(t,e,i,s)=>new U(t,e,i,s),hitCanvas:(t,e)=>new Z(t,e),hitCanvasManager:()=>new X}),J();export{ct as Layouter,Z as LeaferCanvas,Q as PathNodeHandleType,wt as Picker,ft as Renderer,yt as Selector,tt as Watcher,J as useCanvas};
|
|
1
|
+
import{LeaferCanvasBase as t,Platform as e,canvasPatch as i,FileHelper as s,Creator as n,LeaferImage as a,defineKey as r,LeafList as o,DataHelper as l,RenderEvent as d,ChildEvent as h,WatchEvent as c,PropertyEvent as u,LeafHelper as f,BranchHelper as g,LeafBoundsHelper as p,Bounds as _,isArray as w,Debug as y,LeafLevelList as m,LayoutEvent as x,Run as v,ImageManager as b,ResizeEvent as S,PointHelper as k,BoundsHelper as B,Plugin as R,isObject as L,FourNumberHelper as E,Matrix as P,isUndefined as T,isString as A,ImageEvent as C,MatrixHelper as O,MathHelper as M,AlignHelper as W,isNumber as D,getMatrixData as I,AroundHelper as F,Direction4 as Y}from"@leafer/core";export*from"@leafer/core";export{LeaferImage}from"@leafer/core";import{HitCanvasManager as X,InteractionBase as U}from"@leafer-ui/core";export*from"@leafer-ui/core";import{Paint as z,PaintImage as G,ColorConvert as q,PaintGradient as N,Effect as j,Group as H,TextConvert as V}from"@leafer-ui/draw";var Q;!function(t){t[t.none=1]="none",t[t.free=2]="free",t[t.mirrorAngle=3]="mirrorAngle",t[t.mirror=4]="mirror"}(Q||(Q={}));class Z extends t{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=e.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this;this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i),this.clientBounds=this.bounds}}i(OffscreenCanvasRenderingContext2D.prototype),i(Path2D.prototype);const{mineType:$}=s;function J(t,i){e.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,i)=>new Promise((s,n)=>{t.convertToBlob({type:$(e),quality:i}).then(t=>{var e=new FileReader;e.onload=t=>s(t.target.result),e.onerror=t=>n(t),e.readAsDataURL(t)}).catch(t=>{n(t)})}),canvasToBolb:(t,e,i)=>t.convertToBlob({type:$(e),quality:i}),canvasSaveAs:(t,e,i)=>new Promise(t=>t()),download(t,e){},loadImage:t=>new Promise((i,s)=>{let n=new XMLHttpRequest;n.open("GET",e.image.getRealURL(t),!0),n.responseType="blob",n.onload=()=>{createImageBitmap(n.response).then(t=>{i(t)}).catch(t=>{s(t)})},n.onerror=t=>s(t),n.send()})},e.canvas=n.canvas(),e.conicGradientSupport=!!e.canvas.context.createConicGradient}Object.assign(n,{canvas:(t,e)=>new Z(t,e),image:t=>new a(t)}),e.name="web",e.isWorker=!0,e.backgrounder=!0,e.requestRender=function(t){requestAnimationFrame(t)},r(e,"devicePixelRatio",{get:()=>1});const{userAgent:K}=navigator;K.indexOf("Firefox")>-1?(e.conicGradientRotate90=!0,e.intWheelDeltaY=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(e.fullImageShadow=!0),K.indexOf("Windows")>-1?(e.os="Windows",e.intWheelDeltaY=!0):K.indexOf("Mac")>-1?e.os="Mac":K.indexOf("Linux")>-1&&(e.os="Linux");class tt{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove&&this.config.usePartLayout){const t=new o;return this.__updatedList.list.forEach(e=>{e.leafer&&t.add(e)}),t}return this.__updatedList}constructor(t,e){this.totalTimes=0,this.config={},this.__updatedList=new o,this.target=t,e&&(this.config=l.default(e,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(d.REQUEST)}__onAttrChange(t){this.config.usePartLayout&&this.__updatedList.add(t.target),this.update()}__onChildEvent(t){this.config.usePartLayout&&(t.type===h.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,i=e.length;t<i;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new c(c.DATA,{updatedList:this.updatedList})),this.__updatedList=new o,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[u.CHANGE,this.__onAttrChange,this],[[h.ADD,h.REMOVE],this.__onChildEvent,this],[c.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:et,updateBounds:it,updateChange:st}=f,{pushAllChildBranch:nt,pushAllParent:at}=g;const{worldBounds:rt}=p;class ot{constructor(t){this.updatedBounds=new _,this.beforeBounds=new _,this.afterBounds=new _,w(t)&&(t=new o(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,rt)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,rt),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:lt,updateAllChange:dt}=f,ht=y.get("Layouter");class ct{constructor(t,e){this.totalTimes=0,this.config={usePartLayout:!0},this.__levelList=new m,this.target=t,e&&(this.config=l.default(e,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(x.START),this.layoutOnce(),t.emitEvent(new x(x.END,this.layoutedBlocks,this.times))}catch(t){ht.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?ht.warn("layouting"):this.times>3?ht.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(c.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 e=v.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:n,LAYOUT:a,AFTER:r}=x,o=this.getBlocks(s);o.forEach(t=>t.setBefore()),i.emitEvent(new x(n,o,this.times)),this.extraBlock=null,s.sort(),function(t,e){let i;t.list.forEach(t=>{i=t.__layout,e.without(t)&&!i.proxyZoom&&(i.matrixChanged?(et(t,!0),e.add(t),t.isBranch&&nt(t,e),at(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),at(t,e)))})}(s,this.__levelList),function(t){let e,i,s;t.sort(!0),t.levels.forEach(n=>{e=t.levelMap[n];for(let t=0,n=e.length;t<n;t++){if(i=e[t],i.isBranch&&i.__tempNumber){s=i.children;for(let t=0,e=s.length;t<e;t++)s[t].isBranch||it(s[t])}it(i)}})}(this.__levelList),function(t){t.list.forEach(st)}(s),this.extraBlock&&o.push(this.extraBlock),o.forEach(t=>t.setAfter()),i.emitEvent(new x(a,o,this.times)),i.emitEvent(new x(r,o,this.times)),this.addBlocks(o),this.__levelList.reset(),this.__updatedList=null,v.end(e)}fullLayout(){const t=v.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:n}=x,a=this.getBlocks(new o(e));e.emitEvent(new x(i,a,this.times)),ct.fullLayout(e),a.forEach(t=>{t.setAfter()}),e.emitEvent(new x(s,a,this.times)),e.emitEvent(new x(n,a,this.times)),this.addBlocks(a),v.end(t)}static fullLayout(t){lt(t,!0),t.isBranch?g.updateBounds(t):f.updateBounds(t),dt(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new ot([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new ot(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_([[x.REQUEST,this.layout,this],[x.AGAIN,this.layoutAgain,this],[c.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const ut=y.get("Renderer");class ft{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,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=e,i&&(this.config=l.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(x.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(d.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(d.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(d.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new _,ut.log(e.innerName,"---\x3e");try{this.emitRender(d.START),this.renderOnce(t),this.emitRender(d.END,this.totalBounds),b.clearRecycled()}catch(t){this.rendering=!1,ut.error(t)}ut.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return ut.warn("rendering");if(this.times>3)return ut.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new _,this.renderOptions={},t)this.emitRender(d.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(d.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(d.RENDER,this.renderBounds,this.renderOptions),this.emitRender(d.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 e=v.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),n=new _(s);i.save(),s.spread(ft.clipSpread).ceil();const{ceilPartPixel:a}=this.config;i.clipWorld(s,a),i.clearWorld(s,a),this.__render(s,n),i.restore(),v.end(e)}fullRender(){const t=v.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),v.end(t)}__render(t,i){const{canvas:s,target:n}=this,a=t.includes(n.__world),r=a?{includes:a}:{bounds:t,includes:a};this.needFill&&s.fillWorld(t,this.config.fill),y.showRepaint&&y.drawRepaint(s,t),this.config.useCellRender&&(r.cellList=this.getCellList()),e.render(n,s,r),this.renderBounds=i=i||t,this.renderOptions=r,this.totalBounds.isEmpty()?this.totalBounds=i:this.totalBounds.add(i),s.updateRender(i)}getCellList(){}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new _;e.setList(t),t.length=0,t.push(e)}}__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 i=()=>{const t=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:s}=this.config;if(s&&t>s)return e.requestRender(i);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.requestRender(i)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new _(0,0,e,i).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new _(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||ut.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(t,e,i){this.target.emitEvent(new d(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[d.REQUEST,this.update,this],[x.END,this.__onLayoutEnd,this],[d.AGAIN,this.renderAgain,this],[S.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}ft.clipSpread=10;const gt={},{copyRadiusPoint:pt}=k,{hitRadiusPoint:_t}=B;class wt{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,n=i.ignoreHittable||!1,a=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new o(i.findList),i.findList||this.hitBranch(a.isBranchLeaf?{children:[a]}:a);const{list:r}=this.findList,l=this.getBestMatchLeaf(r,i.bottomList,n,!!i.findList),d=n?this.getPath(l):this.getHitablePath(l);return this.clear(),s?{path:d,target:l,throughPath:r.length?this.getThroughPath(r):d}:{path:d,target:l}}hitPoint(t,e,i){return!!this.getByPoint(t,e,i).target}getBestMatchLeaf(t,e,i,s){const n=this.findList=new o;if(t.length){let e;const{x:s,y:a}=this.point,r={x:s,y:a,radiusX:0,radiusY:0};for(let s=0,a=t.length;s<a;s++)if(e=t[s],(i||f.worldHittable(e))&&(this.hitChild(e,r),n.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&f.hasParent(t,e))){n.reset();break}return n.list[0]}}if(e)for(let t=0,i=e.length;t<i;t++)if(this.hitChild(e[t].target,this.point,e[t].proxy),n.length)return n.list[0];return s?null:i?t[0]:t.find(t=>f.worldHittable(t))}getPath(t){const e=new o,i=[],{target:s}=this;for(;t&&(t.syncEventer&&i.push(t.syncEventer),e.add(t),(t=t.parent)!==s););return i.length&&i.forEach(t=>{for(;t&&(t.__.hittable&&e.add(t),(t=t.parent)!==s););}),s&&e.add(s),e}getHitablePath(t){const e=this.getPath(t&&t.hittable?t:null);let i,s=new o;for(let t=e.list.length-1;t>-1&&(i=e.list[t],i.__.hittable)&&(s.addAt(i,0),i.__.hitChildren&&(!i.isLeafer||"draw"!==i.mode));t--);return s}getThroughPath(t){const e=new o,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,n,a;for(let t=0,r=i.length;t<r;t++){s=i[t],n=i[t+1];for(let t=0,i=s.length;t<i&&(a=s.list[t],!n||!n.has(a));t++)e.add(a)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s,n;const{point:a}=this;for(let r=t.length-1;r>-1;r--)if(i=t[r],n=i.__,n.visible&&(!e||n.mask))if(s=_t(i.__world,n.hitRadius?pt(gt,a,n.hitRadius):a),i.isBranch){if(s||i.__ignoreHitWorld){if(i.isBranchLeaf&&n.__clipAfterFill&&!i.__hitWorld(a,!0))continue;i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,a)}}else s&&this.hitChild(i,a)}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:s}=t;if(s&&s.__hasMask&&!t.__.mask){let i,n=[];const{children:a}=s;for(let s=0,r=a.length;s<r;s++)if(i=a[s],i.__.mask&&n.push(i),i===t){if(n&&!n.every(t=>t.__hitWorld(e)))return;break}}this.findList.add(i||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class yt{constructor(t,e){this.config={},e&&(this.config=l.default(e,this.config)),this.picker=new wt(this.target=t,this),this.finder=n.finder&&n.finder()}getByPoint(t,i,s){const{target:n,picker:a}=this;return e.backgrounder&&n&&n.updateLayout(),a.getByPoint(t,i,s)}hitPoint(t,e,i){return this.picker.hitPoint(t,e,i)}getBy(t,e,i,s){return this.finder?this.finder.getBy(t,e,i,s):R.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function mt(t,e,i){t.__.__font?z.fillText(t,e,i):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function xt(t,e,i,s,n){const a=i.__;L(t)?z.drawStrokesStyle(t,e,!1,i,s,n):(s.setStroke(t,a.__strokeWidth*e,a),s.stroke()),a.__useArrow&&z.strokeArrow(t,i,s,n)}function vt(t,e,i,s,n){const a=i.__;L(t)?z.drawStrokesStyle(t,e,!0,i,s,n):(s.setStroke(t,a.__strokeWidth*e,a),z.drawTextStroke(i,s,n))}function bt(t,e,i,s,n){const a=s.getSameCanvas(!0,!0);a.font=i.__.__font,vt(t,2,i,a,n),a.blendMode="outside"===e?"destination-out":"destination-in",z.fillText(i,a,n),a.blendMode="normal",f.copyCanvasByWorld(i,s,a),a.recycle(i.__nowWorld)}Object.assign(n,{watcher:(t,e)=>new tt(t,e),layouter:(t,e)=>new ct(t,e),renderer:(t,e,i)=>new ft(t,e,i),selector:(t,e)=>new yt(t,e)}),e.layout=ct.fullLayout,e.render=function(t,e,i){const s=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new o,t.__render(e,i),i.topList.length&&i.topList.forEach(t=>t.__render(e,s))};const{getSpread:St,copyAndSpread:kt,toOuterOf:Bt,getOuterOf:Rt,getByMove:Lt,move:Et,getIntersectData:Pt}=B,Tt={};let At;const{stintSet:Ct}=l,{hasTransparent:Ot}=q;function Mt(t,e,i){if(!L(e)||!1===e.visible||0===e.opacity)return;let s;const{boxBounds:n}=i.__layout;switch(e.type){case"image":if(!e.url)return;s=G.image(i,t,e,n,!At||!At[e.url]);break;case"linear":s=N.linearGradient(e,n);break;case"radial":s=N.radialGradient(e,n);break;case"angular":s=N.conicGradient(e,n);break;case"solid":const{type:a,color:r,opacity:o}=e;s={type:a,style:q.string(r,o)};break;default:T(e.r)||(s={type:"solid",style:q.string(e)})}if(s&&(s.originPaint=e,A(s.style)&&Ot(s.style)&&(s.isTransparent=!0),e.style)){if(0===e.style.strokeWidth)return;s.strokeStyle=e.style}return s}const Wt={compute:function(t,e){const i=e.__,s=[];let n,a,r,o=i.__input[t];w(o)||(o=[o]),At=G.recycleImage(t,i);for(let i,n=0,a=o.length;n<a;n++)(i=Mt(t,o[n],e))&&(s.push(i),i.strokeStyle&&(r||(r=1),i.strokeStyle.strokeWidth&&(r=Math.max(r,i.strokeStyle.strokeWidth))));i["_"+t]=s.length?s:void 0,s.length?(s.every(t=>t.isTransparent)&&(s.some(t=>t.image)&&(n=!0),a=!0),"fill"===t?(Ct(i,"__isAlphaPixelFill",n),Ct(i,"__isTransparentFill",a)):(Ct(i,"__isAlphaPixelStroke",n),Ct(i,"__isTransparentStroke",a),Ct(i,"__hasMultiStrokeStyle",r))):i.__removePaint(t,!1)},fill:function(t,e,i,s){i.fillStyle=t,mt(e,i,s)},fills:function(t,e,i,s){let n,a,r;for(let o=0,l=t.length;o<l;o++){if(n=t[o],a=n.originPaint,n.image){if(r?r++:r=1,G.checkImage(n,!e.__.__font,e,i,s))continue;if(!n.style){1===r&&n.image.isPlacehold&&e.drawImagePlaceholder(n,i,s);continue}}if(i.fillStyle=n.style,n.transform||a.scaleFixed){if(i.save(),n.transform&&i.transform(n.transform),a.scaleFixed){const{scaleX:t,scaleY:s}=e.getRenderScaleData(!0);(!0===a.scaleFixed||"zoom-in"===a.scaleFixed&&t>1&&s>1)&&i.scale(1/t,1/s)}a.blendMode&&(i.blendMode=a.blendMode),mt(e,i,s),i.restore()}else a.blendMode?(i.saveBlendMode(a.blendMode),mt(e,i,s),i.restoreBlendMode()):mt(e,i,s)}},fillPathOrText:mt,fillText:function(t,e,i){const s=t.__,{rows:n,decorationY:a}=s.__textDrawData;let r;s.__isPlacehold&&s.placeholderColor&&(e.fillStyle=s.placeholderColor);for(let t=0,i=n.length;t<i;t++)r=n[t],r.text?e.fillText(r.text,r.x,r.y):r.data&&r.data.forEach(t=>{e.fillText(t.char,t.x,r.y)});if(a){const{decorationColor:t,decorationHeight:i}=s.__textDrawData;t&&(e.fillStyle=t),n.forEach(t=>a.forEach(s=>e.fillRect(t.x,t.y+s,t.width,i)))}},stroke:function(t,e,i,s){const n=e.__;if(n.__strokeWidth)if(n.__font)z.strokeText(t,e,i,s);else switch(n.strokeAlign){case"center":xt(t,1,e,i,s);break;case"inside":!function(t,e,i,s){i.save(),i.clipUI(e),xt(t,2,e,i,s),i.restore()}(t,e,i,s);break;case"outside":!function(t,e,i,s){const n=e.__;if(n.__fillAfterStroke)xt(t,2,e,i,s);else{const{renderBounds:a}=e.__layout,r=i.getSameCanvas(!0,!0);e.__drawRenderPath(r),xt(t,2,e,r,s),r.clipUI(n),r.clearWorld(a),f.copyCanvasByWorld(e,i,r),r.recycle(e.__nowWorld)}}(t,e,i,s)}},strokes:function(t,e,i,s){z.stroke(t,e,i,s)},strokeText:function(t,e,i,s){switch(e.__.strokeAlign){case"center":vt(t,1,e,i,s);break;case"inside":bt(t,"inside",e,i,s);break;case"outside":e.__.__fillAfterStroke?vt(t,2,e,i,s):bt(t,"outside",e,i,s)}},drawTextStroke:function(t,e,i){let s,n=t.__.__textDrawData;const{rows:a,decorationY:r}=n;for(let t=0,i=a.length;t<i;t++)s=a[t],s.text?e.strokeText(s.text,s.x,s.y):s.data&&s.data.forEach(t=>{e.strokeText(t.char,t.x,s.y)});if(r){const{decorationHeight:t}=n;a.forEach(i=>r.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}},drawStrokesStyle:function(t,e,i,s,n,a){let r;const o=s.__,{__hasMultiStrokeStyle:l}=o;l||n.setStroke(void 0,o.__strokeWidth*e,o);for(let d=0,h=t.length;d<h;d++)if(r=t[d],(!r.image||!G.checkImage(r,!1,s,n,a))&&r.style){if(l){const{strokeStyle:t}=r;t?n.setStroke(r.style,o.__getRealStrokeWidth(t)*e,o,t):n.setStroke(r.style,o.__strokeWidth*e,o)}else n.strokeStyle=r.style;r.originPaint.blendMode?(n.saveBlendMode(r.originPaint.blendMode),i?z.drawTextStroke(s,n,a):n.stroke(),n.restoreBlendMode()):i?z.drawTextStroke(s,n,a):n.stroke()}},shape:function(t,i,s){const n=i.getSameCanvas(),a=i.bounds,r=t.__nowWorld,o=t.__layout,l=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let d,h,c,u,f,g;Bt(o.strokeSpread?(kt(Tt,o.boxBounds,o.strokeSpread),Tt):o.boxBounds,r,l);let{scaleX:p,scaleY:_}=t.getRenderScaleData(!0);if(a.includes(l))g=n,d=f=l,h=r;else{let n;if(e.fullImageShadow)n=l;else{const t=o.renderShapeSpread?St(a,E.swapAndScale(o.renderShapeSpread,p,_)):a;n=Pt(t,l)}u=a.getFitMatrix(n);let{a:w,d:y}=u;u.a<1&&(g=i.getSameCanvas(),t.__renderShape(g,s),p*=w,_*=y),f=Rt(l,u),d=Lt(f,-u.e,-u.f),h=Rt(r,u),Et(h,-u.e,-u.f);const m=s.matrix;m?(c=new P(u),c.multiply(m),w*=m.scaleX,y*=m.scaleY):c=u,c.withScale(w,y),s=Object.assign(Object.assign({},s),{matrix:c})}return t.__renderShape(n,s),{canvas:n,matrix:c,fitMatrix:u,bounds:d,renderBounds:h,worldCanvas:g,shapeBounds:f,scaleX:p,scaleY:_}}};let Dt,It=new _;const{isSame:Ft}=B;function Yt(t,e,i,s,n,a){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=s.width/e.pixelRatio,e.__naturalHeight=s.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return n.data||G.createData(n,s,i,a),!0}function Xt(t,e){Gt(t,C.LOAD,e)}function Ut(t,e){Gt(t,C.LOADED,e)}function zt(t,e,i){e.error=i,t.forceUpdate("surface"),Gt(t,C.ERROR,e)}function Gt(t,e,i){t.hasEvent(e)&&t.emitEvent(new C(e,i))}function qt(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:Nt,translate:jt}=O,Ht=new _,Vt={},Qt={};function Zt(t,e,i,s){const n=A(t)||s?(s?i-s*e:i%e)/((s||Math.floor(i/e))-1):t;return"auto"===t&&n<0?0:n}let $t={},Jt=I();const{get:Kt,set:te,rotateOfOuter:ee,translate:ie,scaleOfOuter:se,multiplyParent:ne,scale:ae,rotate:re,skew:oe}=O;function le(t,e,i,s,n,a,r,o){r&&re(t,r),o&&oe(t,o.x,o.y),n&&ae(t,n,a),ie(t,e.x+i,e.y+s)}function de(t,e,i,s){return new(i||(i=Promise))(function(n,a){function r(t){try{l(s.next(t))}catch(t){a(t)}}function o(t){try{l(s.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(r,o)}l((s=s.apply(t,e||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const{get:he,scale:ce,copy:ue}=O,{getFloorScale:fe}=M,{abs:ge}=Math;const pe={image:function(t,e,i,s,n){let a,r;const o=b.get(i);return Dt&&i===Dt.paint&&Ft(s,Dt.boxBounds)?a=Dt.leafPaint:(a={type:i.type,image:o},o.hasAlphaPixel&&(a.isTransparent=!0),Dt=o.use>1?{leafPaint:a,paint:i,boxBounds:It.set(s)}:null),(n||o.loading)&&(r={image:o,attrName:e,attrValue:i}),o.ready?(Yt(t,e,i,o,a,s),n&&(Xt(t,r),Ut(t,r))):o.error?n&&zt(t,r,o.error):(n&&(qt(t,!0),Xt(t,r)),a.loadId=o.load(()=>{qt(t,!1),t.destroyed||(Yt(t,e,i,o,a,s)&&(o.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),Ut(t,r)),a.loadId=void 0},e=>{qt(t,!1),zt(t,r,e),a.loadId=void 0},i.lod&&o.getThumbSize(i.lod)),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{o.ready||(o.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):o.isPlacehold=!0)),a},checkImage:function(t,i,s,n,a){const{scaleX:r,scaleY:o}=G.getImageRenderScaleData(t,s,n,a),{image:l,data:d,originPaint:h}=t,{exporting:c,snapshot:u}=a;return!(!d||t.patternId===r+"-"+o&&!c||u)&&(i&&(d.repeat?i=!1:h.changeful||"miniapp"===e.name&&S.isResizing(s)||c||(i=e.image.isLarge(l,r,o)||l.width*r>8096||l.height*o>8096)),i?(s.__.__isFastShadow&&(n.fillStyle=t.style||"#000",n.fill()),G.drawImage(t,r,o,s,n,a),!0):(!t.style||h.sync||c?G.createPattern(t,s,n,a):G.createPatternTask(t,s,n,a),!1))},drawImage:function(t,e,i,s,n,a){const{data:r,image:o}=t,{blendMode:l}=t.originPaint,{opacity:d,transform:h}=r,c=o.getFull(r.filters),u=s.__;let f,{width:g,height:p}=o;(f=h&&!h.onlyScale||u.path||u.cornerRadius)||d||l?(n.save(),f&&n.clipUI(s),l&&(n.blendMode=l),d&&(n.opacity*=d),h&&n.transform(h),n.drawImage(c,0,0,g,p),n.restore()):(r.scaleX&&(g*=r.scaleX,p*=r.scaleY),n.drawImage(c,0,0,g,p))},getImageRenderScaleData:function(t,e,i,s){const n=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:a}=t;if(i){const{pixelRatio:t}=i;n.scaleX*=t,n.scaleY*=t}return a&&a.scaleX&&(n.scaleX*=Math.abs(a.scaleX),n.scaleY*=Math.abs(a.scaleY)),n},recycleImage:function(t,e){const i=e["_"+t];if(w(i)){let s,n,a,r,o;for(let l=0,d=i.length;l<d;l++)s=i[l],n=s.image,o=n&&n.url,o&&(a||(a={}),a[o]=!0,b.recyclePaint(s),n.loading&&(r||(r=e.__input&&e.__input[t]||[],w(r)||(r=[r])),n.unload(i[l].loadId,!r.some(t=>t.url===o))));return a}return null},createPatternTask:function(t,e,i,s){t.patternTask||(t.patternTask=b.patternTasker.add(()=>de(this,void 0,void 0,function*(){G.createPattern(t,e,i,s),e.forceUpdate("surface")}),0,()=>(t.patternTask=null,i.bounds.hit(e.__nowWorld))))},createPattern:function(t,i,s,n){let{scaleX:a,scaleY:r}=G.getImageRenderScaleData(t,i,s,n),o=a+"-"+r;if(t.patternId!==o&&!i.destroyed&&(!e.image.isLarge(t.image,a,r)||t.data.repeat)){const{image:s,data:n}=t,{transform:l,gap:d}=n,h=G.getPatternFixScale(t,a,r);let c,u,f,{width:g,height:p}=s;h&&(a*=h,r*=h),g*=a,p*=r,d&&(u=d.x*a/ge(n.scaleX||1),f=d.y*r/ge(n.scaleY||1)),(l||1!==a||1!==r)&&(a*=fe(g+(u||0)),r*=fe(p+(f||0)),c=he(),l&&ue(c,l),ce(c,1/a,1/r));const _=s.getCanvas(g,p,n.opacity,n.filters,u,f,i.leafer&&i.leafer.config.smooth,n.interlace),w=s.getPattern(_,n.repeat||e.origin.noRepeat||"no-repeat",c,t);t.style=w,t.patternId=o}},getPatternFixScale:function(t,i,s){const{image:n}=t;let a,r=e.image.maxPatternSize,o=n.width*n.height;return n.isSVG?i>1&&(a=Math.ceil(i)/i):r>o&&(r=o),(o*=i*s)>r&&(a=Math.sqrt(r/o)),a},createData:function(t,e,i,s){t.data=G.getPatternData(i,s,e)},getPatternData:function(t,e,i){t.padding&&(e=Ht.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:s,height:n}=i,{opacity:a,mode:r,align:o,offset:l,scale:d,size:h,rotation:c,skew:u,clipSize:f,repeat:g,gap:p,filters:_,interlace:w}=t,y=e.width===s&&e.height===n,m={mode:r},x="center"!==o&&(c||0)%180==90;let v,b;switch(B.set(Qt,0,0,x?n:s,x?s:n),r&&"cover"!==r&&"fit"!==r?((d||h)&&(M.getScaleData(d,h,i,Vt),v=Vt.scaleX,b=Vt.scaleY),(o||p||g)&&(v&&B.scale(Qt,v,b,!0),o&&W.toPoint(o,Qt,e,Qt,!0,!0))):y&&!c||(v=b=B.getFitScale(e,Qt,"fit"!==r),B.put(e,i,o,v,!1,Qt),B.scale(Qt,v,b,!0)),l&&k.move(Qt,l),r){case"stretch":y?v&&(v=b=void 0):(v=e.width/s,b=e.height/n,G.stretchMode(m,e,v,b));break;case"normal":case"clip":if(Qt.x||Qt.y||v||f||c||u){let t,i;f&&(t=e.width/f.width,i=e.height/f.height),G.clipMode(m,e,Qt.x,Qt.y,v,b,c,u,t,i),t&&(v=v?v*t:t,b=b?b*i:i)}break;case"repeat":(!y||v||c||u)&&G.repeatMode(m,e,s,n,Qt.x,Qt.y,v,b,c,u,o,t.freeTransform),g||(m.repeat="repeat");const i=L(g);(p||i)&&(m.gap=function(t,e,i,s,n){let a,r;L(t)?(a=t.x,r=t.y):a=r=t;return{x:Zt(a,i,n.width,e&&e.x),y:Zt(r,s,n.height,e&&e.y)}}(p,i&&g,Qt.width,Qt.height,e));break;default:v&&G.fillOrFitMode(m,e,Qt.x,Qt.y,v,b,c)}return m.transform||(e.x||e.y)&&jt(m.transform=Nt(),e.x,e.y),v&&(m.scaleX=v,m.scaleY=b),a&&a<1&&(m.opacity=a),_&&(m.filters=_),g&&(m.repeat=A(g)?"x"===g?"repeat-x":"repeat-y":"repeat"),w&&(m.interlace=D(w)||"percent"===w.type?{type:"x",offset:w}:w),m},stretchMode:function(t,e,i,s){const n=Kt(),{x:a,y:r}=e;a||r?ie(n,a,r):n.onlyScale=!0,ae(n,i,s),t.transform=n},fillOrFitMode:function(t,e,i,s,n,a,r){const o=Kt();ie(o,e.x+i,e.y+s),ae(o,n,a),r&&ee(o,{x:e.x+e.width/2,y:e.y+e.height/2},r),t.transform=o},clipMode:function(t,e,i,s,n,a,r,o,l,d){const h=Kt();le(h,e,i,s,n,a,r,o),l&&(r||o?(te(Jt),se(Jt,e,l,d),ne(h,Jt)):se(h,e,l,d)),t.transform=h},repeatMode:function(t,e,i,s,n,a,r,o,l,d,h,c){const u=Kt();if(c)le(u,e,n,a,r,o,l,d);else{if(l)if("center"===h)ee(u,{x:i/2,y:s/2},l);else switch(re(u,l),l){case 90:ie(u,s,0);break;case 180:ie(u,i,s);break;case 270:ie(u,0,i)}$t.x=e.x+n,$t.y=e.y+a,ie(u,$t.x,$t.y),r&&se(u,$t,r,o)}t.transform=u}},{toPoint:_e}=F,{hasTransparent:we}=q,ye={},me={};function xe(t,e,i,s){if(i){let n,a,r,o;for(let t=0,l=i.length;t<l;t++)n=i[t],A(n)?(r=t/(l-1),a=q.string(n,s)):(r=n.offset,a=q.string(n.color,s)),e.addColorStop(r,a),!o&&we(a)&&(o=!0);o&&(t.isTransparent=!0)}}const{getAngle:ve,getDistance:be}=k,{get:Se,rotateOfOuter:ke,scaleOfOuter:Be}=O,{toPoint:Re}=F,Le={},Ee={};function Pe(t,e,i,s,n){let a;const{width:r,height:o}=t;if(r!==o||s){const t=ve(e,i);a=Se(),n?(Be(a,e,r/o*(s||1),1),ke(a,e,t+90)):(Be(a,e,1,r/o*(s||1)),ke(a,e,t))}return a}const{getDistance:Te}=k,{toPoint:Ae}=F,Ce={},Oe={};const Me={linearGradient:function(t,i){let{from:s,to:n,type:a,opacity:r}=t;_e(s||"top",i,ye),_e(n||"bottom",i,me);const o=e.canvas.createLinearGradient(ye.x,ye.y,me.x,me.y),l={type:a,style:o};return xe(l,o,t.stops,r),l},radialGradient:function(t,i){let{from:s,to:n,type:a,opacity:r,stretch:o}=t;Re(s||"center",i,Le),Re(n||"bottom",i,Ee);const l=e.canvas.createRadialGradient(Le.x,Le.y,0,Le.x,Le.y,be(Le,Ee)),d={type:a,style:l};xe(d,l,t.stops,r);const h=Pe(i,Le,Ee,o,!0);return h&&(d.transform=h),d},conicGradient:function(t,i){let{from:s,to:n,type:a,opacity:r,stretch:o}=t;Ae(s||"center",i,Ce),Ae(n||"bottom",i,Oe);const l=e.conicGradientSupport?e.canvas.createConicGradient(0,Ce.x,Ce.y):e.canvas.createRadialGradient(Ce.x,Ce.y,0,Ce.x,Ce.y,Te(Ce,Oe)),d={type:a,style:l};xe(d,l,t.stops,r);const h=Pe(i,Ce,Oe,o||1,e.conicGradientRotate90);return h&&(d.transform=h),d},getTransform:Pe},{copy:We,move:De,toOffsetOutBounds:Ie}=B,{max:Fe,abs:Ye}=Math,Xe={},Ue=new P,ze={};function Ge(t,e){let i,s,n,a,r=0,o=0,l=0,d=0;return e.forEach(t=>{i=t.x||0,s=t.y||0,a=1.5*(t.blur||0),n=Ye(t.spread||0),r=Fe(r,n+a-s),o=Fe(o,n+a+i),l=Fe(l,n+a+s),d=Fe(d,n+a-i)}),r===o&&o===l&&l===d?r:[r,o,l,d]}function qe(t,i,s){const{shapeBounds:n}=s;let a,r;e.fullImageShadow?(We(Xe,t.bounds),De(Xe,i.x-n.x,i.y-n.y),a=t.bounds,r=Xe):(a=n,r=i),t.copyWorld(s.canvas,a,r)}const{toOffsetOutBounds:Ne}=B,je={};const He=Ge;const Ve={shadow:function(t,e,i){let s,n;const{__nowWorld:a}=t,{shadow:r}=t.__,{worldCanvas:o,bounds:l,renderBounds:d,shapeBounds:h,scaleX:c,scaleY:u}=i,g=e.getSameCanvas(),p=r.length-1;Ie(l,ze,d),r.forEach((r,_)=>{let w=1;if(r.scaleFixed){const t=Math.abs(a.scaleX);t>1&&(w=1/t)}g.setWorldShadow(ze.offsetX+(r.x||0)*c*w,ze.offsetY+(r.y||0)*u*w,(r.blur||0)*c*w,q.string(r.color)),n=j.getShadowTransform(t,g,i,r,ze,w),n&&g.setTransform(n),qe(g,ze,i),n&&g.resetTransform(),s=d,r.box&&(g.restore(),g.save(),o&&(g.copyWorld(g,d,a,"copy"),s=a),o?g.copyWorld(o,a,a,"destination-out"):g.copyWorld(i.canvas,h,l,"destination-out")),f.copyCanvasByWorld(t,e,g,s,r.blendMode),p&&_<p&&g.clearWorld(s)}),g.recycle(s)},innerShadow:function(t,e,i){let s,n;const{__nowWorld:a}=t,{innerShadow:r}=t.__,{worldCanvas:o,bounds:l,renderBounds:d,shapeBounds:h,scaleX:c,scaleY:u}=i,g=e.getSameCanvas(),p=r.length-1;Ne(l,je,d),r.forEach((r,_)=>{let w=1;if(r.scaleFixed){const t=Math.abs(a.scaleX);t>1&&(w=1/t)}g.save(),g.setWorldShadow(je.offsetX+(r.x||0)*c*w,je.offsetY+(r.y||0)*u*w,(r.blur||0)*c*w),n=j.getShadowTransform(t,g,i,r,je,w,!0),n&&g.setTransform(n),qe(g,je,i),g.restore(),o?(g.copyWorld(g,d,a,"copy"),g.copyWorld(o,a,a,"source-out"),s=a):(g.copyWorld(i.canvas,h,l,"source-out"),s=d),g.fillWorld(s,q.string(r.color),"source-in"),f.copyCanvasByWorld(t,e,g,s,r.blendMode),p&&_<p&&g.clearWorld(s)}),g.recycle(s)},blur:function(t,e,i){const{blur:s}=t.__;i.setWorldBlur(s*t.__nowWorld.a),i.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),i.filter="none"},backgroundBlur:function(t,e,i){},getShadowRenderSpread:Ge,getShadowTransform:function(t,e,i,s,n,a,r){if(s.spread){const i=2*s.spread*a*(r?-1:1),{width:o,height:l}=t.__layout.strokeBounds;return Ue.set().scaleOfOuter({x:(n.x+n.width/2)*e.pixelRatio,y:(n.y+n.height/2)*e.pixelRatio},1+i/o,1+i/l),Ue}},isTransformShadow(t){},getInnerShadowSpread:He},{excludeRenderBounds:Qe}=p;let Ze;function $e(t,e,i,s,n,a,r,o){switch(e){case"grayscale":Ze||(Ze=!0,n.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,n,a){const r=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,r),a&&s.recycle(r);Ke(t,e,i,1,n,a)}(t,i,s,n,r,o);break;case"opacity-path":Ke(t,i,s,a,r,o);break;case"path":o&&i.restore()}}function Je(t){return t.getSameCanvas(!1,!0)}function Ke(t,e,i,s,n,a){const r=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,r,void 0,n),a?i.recycle(r):i.clearWorld(r)}H.prototype.__renderMask=function(t,e){let i,s,n,a,r,o;const{children:l}=this;for(let d=0,h=l.length;d<h;d++){if(i=l[d],o=i.__.mask,o){r&&($e(this,r,t,n,s,a,void 0,!0),s=n=null),"clipping"!==o&&"clipping-path"!==o||Qe(i,e)||i.__render(t,e),a=i.__.opacity,Ze=!1,"path"===o||"clipping-path"===o?(a<1?(r="opacity-path",n||(n=Je(t))):(r="path",t.save()),i.__clip(n||t,e)):(r="grayscale"===o?"grayscale":"alpha",s||(s=Je(t)),n||(n=Je(t)),i.__render(s,e));continue}const h=1===a&&i.__.__blendMode;h&&$e(this,r,t,n,s,a,void 0,!1),Qe(i,e)||i.__render(n||t,e),h&&$e(this,r,t,n,s,a,h,!1)}$e(this,r,t,n,s,a,void 0,!0)};const ti=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",ei=ti+"_#~&*+\\=|≮≯≈≠=…",ii=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 si(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const ni=si("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),ai=si("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),ri=si(ti),oi=si(ei),li=si("- —/~|┆·");var di;!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"}(di||(di={}));const{Letter:hi,Single:ci,Before:ui,After:fi,Symbol:gi,Break:pi}=di;function _i(t){return ni[t]?hi:li[t]?pi:ai[t]?ui:ri[t]?fi:oi[t]?gi:ii.test(t)?ci:hi}const wi={trimRight(t){const{words:e}=t;let i,s=0,n=e.length;for(let a=n-1;a>-1&&(i=e[a].data[0]," "===i.char);a--)s++,t.width-=i.width;s&&e.splice(n-s,s)}};function yi(t,e,i){switch(e){case"title":return i?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:mi}=wi,{Letter:xi,Single:vi,Before:bi,After:Si,Symbol:ki,Break:Bi}=di;let Ri,Li,Ei,Pi,Ti,Ai,Ci,Oi,Mi,Wi,Di,Ii,Fi,Yi,Xi,Ui,zi,Gi=[];function qi(t,e){Mi&&!Oi&&(Oi=Mi),Ri.data.push({char:t,width:e}),Ei+=e}function Ni(){Pi+=Ei,Ri.width=Ei,Li.words.push(Ri),Ri={data:[]},Ei=0}function ji(){Yi&&(Xi.paraNumber++,Li.paraStart=!0,Yi=!1),Mi&&(Li.startCharSize=Oi,Li.endCharSize=Mi,Oi=0),Li.width=Pi,Ui.width?mi(Li):zi&&Hi(),Gi.push(Li),Li={words:[]},Pi=0}function Hi(){Pi>(Xi.maxWidth||0)&&(Xi.maxWidth=Pi)}const{top:Vi,right:Qi,bottom:Zi,left:$i}=Y;function Ji(t,e,i){const{bounds:s,rows:n}=t;s[e]+=i;for(let t=0;t<n.length;t++)n[t][e]+=i}const Ki={getDrawData:function(t,i){A(t)||(t=String(t));let s=0,n=0,a=i.__getInput("width")||0,r=i.__getInput("height")||0;const{__padding:o}=i;o&&(a?(s=o[$i],a-=o[Qi]+o[$i],!a&&(a=.01)):i.autoSizeAlign||(s=o[$i]),r?(n=o[Vi],r-=o[Vi]+o[Zi],!r&&(r=.01)):i.autoSizeAlign||(n=o[Vi]));const l={bounds:{x:s,y:n,width:a,height:r},rows:[],paraNumber:0,font:e.canvas.font=i.__font};return function(t,i,s){Xi=t,Gi=t.rows,Ui=t.bounds,zi=!Ui.width&&!s.autoSizeAlign;const{__letterSpacing:n,paraIndent:a,textCase:r}=s,{canvas:o}=e,{width:l}=Ui;if(s.__isCharMode){const t="none"!==s.textWrap,e="break"===s.textWrap;Yi=!0,Di=null,Oi=Ci=Mi=Ei=Pi=0,Ri={data:[]},Li={words:[]},n&&(i=[...i]);for(let s=0,d=i.length;s<d;s++)Ai=i[s],"\n"===Ai?(Ei&&Ni(),Li.paraEnd=!0,ji(),Yi=!0):(Wi=_i(Ai),Wi===xi&&"none"!==r&&(Ai=yi(Ai,r,!Ei)),Ci=o.measureText(Ai).width,n&&(n<0&&(Mi=Ci),Ci+=n),Ii=Wi===vi&&(Di===vi||Di===xi)||Di===vi&&Wi!==Si,Fi=!(Wi!==bi&&Wi!==vi||Di!==ki&&Di!==Si),Ti=Yi&&a?l-a:l,t&&l&&Pi+Ei+Ci>Ti&&(e?(Ei&&Ni(),Pi&&ji()):(Fi||(Fi=Wi===xi&&Di==Si),Ii||Fi||Wi===Bi||Wi===bi||Wi===vi||Ei+Ci>Ti?(Ei&&Ni(),Pi&&ji()):Pi&&ji()))," "===Ai&&!0!==Yi&&Pi+Ei===0||(Wi===Bi?(" "===Ai&&Ei&&Ni(),qi(Ai,Ci),Ni()):Ii||Fi?(Ei&&Ni(),qi(Ai,Ci)):qi(Ai,Ci)),Di=Wi);Ei&&Ni(),Pi&&ji(),Gi.length>0&&(Gi[Gi.length-1].paraEnd=!0)}else i.split("\n").forEach(t=>{Xi.paraNumber++,Pi=o.measureText(t).width,Gi.push({x:a||0,text:t,width:Pi,paraStart:!0}),zi&&Hi()})}(l,t,i),o&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":Ji(e,"x",t[$i]);break;case"right":Ji(e,"x",-t[Qi])}if(!n&&i.autoSizeAlign)switch(i.verticalAlign){case"top":Ji(e,"y",t[Vi]);break;case"bottom":Ji(e,"y",-t[Zi])}}(o,l,i,a,r),function(t,e){const{rows:i,bounds:s}=t,n=i.length,{__lineHeight:a,__baseLine:r,__letterSpacing:o,__clipText:l,textAlign:d,verticalAlign:h,paraSpacing:c,autoSizeAlign:u}=e;let{x:f,y:g,width:p,height:_}=s,w=a*n+(c?c*(t.paraNumber-1):0),y=r;if(l&&w>_)w=Math.max(_,a),n>1&&(t.overflow=n);else if(_||u)switch(h){case"middle":g+=(_-w)/2;break;case"bottom":g+=_-w}y+=g;let m,x,v,b=p||u?p:t.maxWidth;for(let r=0,h=n;r<h;r++){if(m=i[r],m.x=f,m.width<p||m.width>p&&!l)switch(d){case"center":m.x+=(b-m.width)/2;break;case"right":m.x+=b-m.width}m.paraStart&&c&&r>0&&(y+=c),m.y=y,y+=a,t.overflow>r&&y>w&&(m.isOverflow=!0,t.overflow=r+1),x=m.x,v=m.width,o<0&&(m.width<0?(v=-m.width+e.fontSize+o,x-=v,v+=e.fontSize):v-=o),x<s.x&&(s.x=x),v>s.width&&(s.width=v),l&&p&&p<v&&(m.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=g,s.height=w}(l,i),i.__isCharMode&&function(t,e,i){const{rows:s}=t,{textAlign:n,paraIndent:a,__letterSpacing:r}=e,o=i&&n.includes("both"),l=o||i&&n.includes("justify"),d=l&&n.includes("letter");let h,c,u,f,g,p,_,w,y,m;s.forEach(t=>{t.words&&(g=a&&t.paraStart?a:0,w=t.words.length,l&&(m=!t.paraEnd||o,c=i-t.width-g,d?f=c/(t.words.reduce((t,e)=>t+e.data.length,0)-1):u=w>1?c/(w-1):0),p=r||t.isOverflow||d?0:u?1:2,t.isOverflow&&!r&&(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,i)=>{1===p?(_={char:"",x:h},h=function(t,e,i){return t.forEach(t=>{i.char+=t.char,e+=t.width}),e}(e.data,h,_),(t.isOverflow||" "!==_.char)&&t.data.push(_)):h=function(t,e,i,s,n){return t.forEach(t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width,n&&(e+=n)}),e}(e.data,h,t.data,t.isOverflow,m&&f),m&&(y=i===w-1,u?y||(h+=u,t.width+=u):f&&(t.width+=f*(e.data.length-(y?1:0))))})),t.words=null)})}(l,i,a),l.overflow&&function(t,i,s,n){if(!n)return;const{rows:a,overflow:r}=t;let{textOverflow:o}=i;if(a.splice(r),o&&"show"!==o){let t,l;"hide"===o?o="":"ellipsis"===o&&(o="...");const d=o?e.canvas.measureText(o).width:0,h=s+n-d;("none"===i.textWrap?a:[a[r-1]]).forEach(e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let s=i;s>-1&&(t=e.data[s],l=t.x+t.width,!(s===i&&l<h));s--){if(l<h&&" "!==t.char||!s){e.data.splice(s+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)}})}}(l,i,s,a),"none"!==i.textDecoration&&function(t,e){let i,s=0;const{fontSize:n,textDecoration:a}=e;switch(t.decorationHeight=n/11,L(a)?(i=a.type,a.color&&(t.decorationColor=q.string(a.color)),a.offset&&(s=Math.min(.3*n,Math.max(a.offset,.15*-n)))):i=a,i){case"under":t.decorationY=[.15*n+s];break;case"delete":t.decorationY=[.35*-n];break;case"under-delete":t.decorationY=[.15*n+s,.35*-n]}}(l,i),l}};const ts={string:function(t,e){if(!t)return"#000";const i=D(e)&&e<1;if(A(t)){if(!i||!q.object)return t;t=q.object(t)}let s=T(t.a)?1:t.a;i&&(s*=e);const n=t.r+","+t.g+","+t.b;return 1===s?"rgb("+n+")":"rgba("+n+","+s+")"}};Object.assign(V,Ki),Object.assign(q,ts),Object.assign(z,Wt),Object.assign(G,pe),Object.assign(N,Me),Object.assign(j,Ve),Object.assign(n,{interaction:(t,e,i,s)=>new U(t,e,i,s),hitCanvas:(t,e)=>new Z(t,e),hitCanvasManager:()=>new X}),J();export{ct as Layouter,Z as LeaferCanvas,Q as PathNodeHandleType,wt as Picker,ft as Renderer,yt as Selector,tt as Watcher,J as useCanvas};
|
|
2
2
|
//# sourceMappingURL=worker.esm.min.js.map
|