@leafer-ui/worker 1.11.1 → 1.12.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 +33 -15
- package/dist/worker.esm.js +34 -16
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.esm.min.js.map +1 -1
- package/dist/worker.js +59 -22
- 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 +62 -23
- 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
|
@@ -6,6 +6,15 @@ var core$1 = require("@leafer-ui/core");
|
|
|
6
6
|
|
|
7
7
|
var draw = require("@leafer-ui/draw");
|
|
8
8
|
|
|
9
|
+
exports.PathNodeHandleType = void 0;
|
|
10
|
+
|
|
11
|
+
(function(PathNodeHandleType) {
|
|
12
|
+
PathNodeHandleType[PathNodeHandleType["none"] = 1] = "none";
|
|
13
|
+
PathNodeHandleType[PathNodeHandleType["free"] = 2] = "free";
|
|
14
|
+
PathNodeHandleType[PathNodeHandleType["mirrorAngle"] = 3] = "mirrorAngle";
|
|
15
|
+
PathNodeHandleType[PathNodeHandleType["mirror"] = 4] = "mirror";
|
|
16
|
+
})(exports.PathNodeHandleType || (exports.PathNodeHandleType = {}));
|
|
17
|
+
|
|
9
18
|
class LeaferCanvas extends core.LeaferCanvasBase {
|
|
10
19
|
get allowBackgroundColor() {
|
|
11
20
|
return true;
|
|
@@ -121,7 +130,7 @@ class Watcher {
|
|
|
121
130
|
return this.hasAdd || this.hasRemove || this.hasVisible;
|
|
122
131
|
}
|
|
123
132
|
get updatedList() {
|
|
124
|
-
if (this.hasRemove) {
|
|
133
|
+
if (this.hasRemove && this.config.usePartLayout) {
|
|
125
134
|
const updatedList = new core.LeafList;
|
|
126
135
|
this.__updatedList.list.forEach(item => {
|
|
127
136
|
if (item.leafer) updatedList.add(item);
|
|
@@ -156,16 +165,18 @@ class Watcher {
|
|
|
156
165
|
if (this.running) this.target.emit(core.RenderEvent.REQUEST);
|
|
157
166
|
}
|
|
158
167
|
__onAttrChange(event) {
|
|
159
|
-
this.__updatedList.add(event.target);
|
|
168
|
+
if (this.config.usePartLayout) this.__updatedList.add(event.target);
|
|
160
169
|
this.update();
|
|
161
170
|
}
|
|
162
171
|
__onChildEvent(event) {
|
|
163
|
-
if (
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
172
|
+
if (this.config.usePartLayout) {
|
|
173
|
+
if (event.type === core.ChildEvent.ADD) {
|
|
174
|
+
this.hasAdd = true;
|
|
175
|
+
this.__pushChild(event.child);
|
|
176
|
+
} else {
|
|
177
|
+
this.hasRemove = true;
|
|
178
|
+
this.__updatedList.add(event.parent);
|
|
179
|
+
}
|
|
169
180
|
}
|
|
170
181
|
this.update();
|
|
171
182
|
}
|
|
@@ -282,7 +293,9 @@ const debug$1 = core.Debug.get("Layouter");
|
|
|
282
293
|
class Layouter {
|
|
283
294
|
constructor(target, userConfig) {
|
|
284
295
|
this.totalTimes = 0;
|
|
285
|
-
this.config = {
|
|
296
|
+
this.config = {
|
|
297
|
+
usePartLayout: true
|
|
298
|
+
};
|
|
286
299
|
this.__levelList = new core.LeafLevelList;
|
|
287
300
|
this.target = target;
|
|
288
301
|
if (userConfig) this.config = core.DataHelper.default(userConfig, this.config);
|
|
@@ -327,7 +340,7 @@ class Layouter {
|
|
|
327
340
|
this.totalTimes++;
|
|
328
341
|
this.layouting = true;
|
|
329
342
|
this.target.emit(core.WatchEvent.REQUEST);
|
|
330
|
-
if (this.totalTimes > 1) {
|
|
343
|
+
if (this.totalTimes > 1 && this.config.usePartLayout) {
|
|
331
344
|
this.partLayout();
|
|
332
345
|
} else {
|
|
333
346
|
this.fullLayout();
|
|
@@ -444,7 +457,7 @@ class Renderer {
|
|
|
444
457
|
}
|
|
445
458
|
update(change = true) {
|
|
446
459
|
if (!this.changed) this.changed = change;
|
|
447
|
-
this.__requestRender();
|
|
460
|
+
if (!this.requestTime) this.__requestRender();
|
|
448
461
|
}
|
|
449
462
|
requestLayout() {
|
|
450
463
|
this.target.emit(core.LayoutEvent.REQUEST);
|
|
@@ -551,7 +564,7 @@ class Renderer {
|
|
|
551
564
|
core.Run.end(t);
|
|
552
565
|
}
|
|
553
566
|
__render(bounds, realBounds) {
|
|
554
|
-
const {canvas: canvas} = this, includes = bounds.includes(
|
|
567
|
+
const {canvas: canvas, target: target} = this, includes = bounds.includes(target.__world), options = includes ? {
|
|
555
568
|
includes: includes
|
|
556
569
|
} : {
|
|
557
570
|
bounds: bounds,
|
|
@@ -559,12 +572,16 @@ class Renderer {
|
|
|
559
572
|
};
|
|
560
573
|
if (this.needFill) canvas.fillWorld(bounds, this.config.fill);
|
|
561
574
|
if (core.Debug.showRepaint) core.Debug.drawRepaint(canvas, bounds);
|
|
562
|
-
|
|
575
|
+
if (this.config.useCellRender) options.cellList = this.getCellList();
|
|
576
|
+
core.Platform.render(target, canvas, options);
|
|
563
577
|
this.renderBounds = realBounds = realBounds || bounds;
|
|
564
578
|
this.renderOptions = options;
|
|
565
579
|
this.totalBounds.isEmpty() ? this.totalBounds = realBounds : this.totalBounds.add(realBounds);
|
|
566
580
|
canvas.updateRender(realBounds);
|
|
567
581
|
}
|
|
582
|
+
getCellList() {
|
|
583
|
+
return undefined;
|
|
584
|
+
}
|
|
568
585
|
addBlock(block) {
|
|
569
586
|
if (!this.updateBlocks) this.updateBlocks = [];
|
|
570
587
|
this.updateBlocks.push(block);
|
|
@@ -1160,6 +1177,7 @@ function getLeafPaint(attrName, paint, ui) {
|
|
|
1160
1177
|
const {boxBounds: boxBounds} = ui.__layout;
|
|
1161
1178
|
switch (paint.type) {
|
|
1162
1179
|
case "image":
|
|
1180
|
+
if (!paint.url) return undefined;
|
|
1163
1181
|
leafPaint = draw.PaintImage.image(ui, attrName, paint, boxBounds, !recycleMap || !recycleMap[paint.url]);
|
|
1164
1182
|
break;
|
|
1165
1183
|
|
|
@@ -1597,7 +1615,7 @@ function checkImage(paint, drawImage, ui, canvas, renderOptions) {
|
|
|
1597
1615
|
if (data.repeat) {
|
|
1598
1616
|
drawImage = false;
|
|
1599
1617
|
} else if (!(originPaint.changeful || core.Platform.name === "miniapp" && core.ResizeEvent.isResizing(ui) || exporting)) {
|
|
1600
|
-
drawImage = core.Platform.image.isLarge(image, scaleX, scaleY);
|
|
1618
|
+
drawImage = core.Platform.image.isLarge(image, scaleX, scaleY) || image.width * scaleX > 8096 || image.height * scaleY > 8096;
|
|
1601
1619
|
}
|
|
1602
1620
|
}
|
|
1603
1621
|
if (drawImage) {
|
|
@@ -1656,7 +1674,7 @@ function recycleImage(attrName, data) {
|
|
|
1656
1674
|
if (url) {
|
|
1657
1675
|
if (!recycleMap) recycleMap = {};
|
|
1658
1676
|
recycleMap[url] = true;
|
|
1659
|
-
core.ImageManager.
|
|
1677
|
+
core.ImageManager.recyclePaint(paint);
|
|
1660
1678
|
if (image.loading) {
|
|
1661
1679
|
if (!input) {
|
|
1662
1680
|
input = data.__input && data.__input[attrName] || [];
|
package/dist/worker.esm.js
CHANGED
|
@@ -10,6 +10,15 @@ export * from "@leafer-ui/core";
|
|
|
10
10
|
|
|
11
11
|
import { Paint, PaintImage, ColorConvert, PaintGradient, Effect, Group, TextConvert } from "@leafer-ui/draw";
|
|
12
12
|
|
|
13
|
+
var PathNodeHandleType;
|
|
14
|
+
|
|
15
|
+
(function(PathNodeHandleType) {
|
|
16
|
+
PathNodeHandleType[PathNodeHandleType["none"] = 1] = "none";
|
|
17
|
+
PathNodeHandleType[PathNodeHandleType["free"] = 2] = "free";
|
|
18
|
+
PathNodeHandleType[PathNodeHandleType["mirrorAngle"] = 3] = "mirrorAngle";
|
|
19
|
+
PathNodeHandleType[PathNodeHandleType["mirror"] = 4] = "mirror";
|
|
20
|
+
})(PathNodeHandleType || (PathNodeHandleType = {}));
|
|
21
|
+
|
|
13
22
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
14
23
|
get allowBackgroundColor() {
|
|
15
24
|
return true;
|
|
@@ -125,7 +134,7 @@ class Watcher {
|
|
|
125
134
|
return this.hasAdd || this.hasRemove || this.hasVisible;
|
|
126
135
|
}
|
|
127
136
|
get updatedList() {
|
|
128
|
-
if (this.hasRemove) {
|
|
137
|
+
if (this.hasRemove && this.config.usePartLayout) {
|
|
129
138
|
const updatedList = new LeafList;
|
|
130
139
|
this.__updatedList.list.forEach(item => {
|
|
131
140
|
if (item.leafer) updatedList.add(item);
|
|
@@ -160,16 +169,18 @@ class Watcher {
|
|
|
160
169
|
if (this.running) this.target.emit(RenderEvent.REQUEST);
|
|
161
170
|
}
|
|
162
171
|
__onAttrChange(event) {
|
|
163
|
-
this.__updatedList.add(event.target);
|
|
172
|
+
if (this.config.usePartLayout) this.__updatedList.add(event.target);
|
|
164
173
|
this.update();
|
|
165
174
|
}
|
|
166
175
|
__onChildEvent(event) {
|
|
167
|
-
if (
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
176
|
+
if (this.config.usePartLayout) {
|
|
177
|
+
if (event.type === ChildEvent.ADD) {
|
|
178
|
+
this.hasAdd = true;
|
|
179
|
+
this.__pushChild(event.child);
|
|
180
|
+
} else {
|
|
181
|
+
this.hasRemove = true;
|
|
182
|
+
this.__updatedList.add(event.parent);
|
|
183
|
+
}
|
|
173
184
|
}
|
|
174
185
|
this.update();
|
|
175
186
|
}
|
|
@@ -286,7 +297,9 @@ const debug$1 = Debug.get("Layouter");
|
|
|
286
297
|
class Layouter {
|
|
287
298
|
constructor(target, userConfig) {
|
|
288
299
|
this.totalTimes = 0;
|
|
289
|
-
this.config = {
|
|
300
|
+
this.config = {
|
|
301
|
+
usePartLayout: true
|
|
302
|
+
};
|
|
290
303
|
this.__levelList = new LeafLevelList;
|
|
291
304
|
this.target = target;
|
|
292
305
|
if (userConfig) this.config = DataHelper.default(userConfig, this.config);
|
|
@@ -331,7 +344,7 @@ class Layouter {
|
|
|
331
344
|
this.totalTimes++;
|
|
332
345
|
this.layouting = true;
|
|
333
346
|
this.target.emit(WatchEvent.REQUEST);
|
|
334
|
-
if (this.totalTimes > 1) {
|
|
347
|
+
if (this.totalTimes > 1 && this.config.usePartLayout) {
|
|
335
348
|
this.partLayout();
|
|
336
349
|
} else {
|
|
337
350
|
this.fullLayout();
|
|
@@ -448,7 +461,7 @@ class Renderer {
|
|
|
448
461
|
}
|
|
449
462
|
update(change = true) {
|
|
450
463
|
if (!this.changed) this.changed = change;
|
|
451
|
-
this.__requestRender();
|
|
464
|
+
if (!this.requestTime) this.__requestRender();
|
|
452
465
|
}
|
|
453
466
|
requestLayout() {
|
|
454
467
|
this.target.emit(LayoutEvent.REQUEST);
|
|
@@ -555,7 +568,7 @@ class Renderer {
|
|
|
555
568
|
Run.end(t);
|
|
556
569
|
}
|
|
557
570
|
__render(bounds, realBounds) {
|
|
558
|
-
const {canvas: canvas} = this, includes = bounds.includes(
|
|
571
|
+
const {canvas: canvas, target: target} = this, includes = bounds.includes(target.__world), options = includes ? {
|
|
559
572
|
includes: includes
|
|
560
573
|
} : {
|
|
561
574
|
bounds: bounds,
|
|
@@ -563,12 +576,16 @@ class Renderer {
|
|
|
563
576
|
};
|
|
564
577
|
if (this.needFill) canvas.fillWorld(bounds, this.config.fill);
|
|
565
578
|
if (Debug.showRepaint) Debug.drawRepaint(canvas, bounds);
|
|
566
|
-
|
|
579
|
+
if (this.config.useCellRender) options.cellList = this.getCellList();
|
|
580
|
+
Platform.render(target, canvas, options);
|
|
567
581
|
this.renderBounds = realBounds = realBounds || bounds;
|
|
568
582
|
this.renderOptions = options;
|
|
569
583
|
this.totalBounds.isEmpty() ? this.totalBounds = realBounds : this.totalBounds.add(realBounds);
|
|
570
584
|
canvas.updateRender(realBounds);
|
|
571
585
|
}
|
|
586
|
+
getCellList() {
|
|
587
|
+
return undefined;
|
|
588
|
+
}
|
|
572
589
|
addBlock(block) {
|
|
573
590
|
if (!this.updateBlocks) this.updateBlocks = [];
|
|
574
591
|
this.updateBlocks.push(block);
|
|
@@ -1164,6 +1181,7 @@ function getLeafPaint(attrName, paint, ui) {
|
|
|
1164
1181
|
const {boxBounds: boxBounds} = ui.__layout;
|
|
1165
1182
|
switch (paint.type) {
|
|
1166
1183
|
case "image":
|
|
1184
|
+
if (!paint.url) return undefined;
|
|
1167
1185
|
leafPaint = PaintImage.image(ui, attrName, paint, boxBounds, !recycleMap || !recycleMap[paint.url]);
|
|
1168
1186
|
break;
|
|
1169
1187
|
|
|
@@ -1601,7 +1619,7 @@ function checkImage(paint, drawImage, ui, canvas, renderOptions) {
|
|
|
1601
1619
|
if (data.repeat) {
|
|
1602
1620
|
drawImage = false;
|
|
1603
1621
|
} else if (!(originPaint.changeful || Platform.name === "miniapp" && ResizeEvent.isResizing(ui) || exporting)) {
|
|
1604
|
-
drawImage = Platform.image.isLarge(image, scaleX, scaleY);
|
|
1622
|
+
drawImage = Platform.image.isLarge(image, scaleX, scaleY) || image.width * scaleX > 8096 || image.height * scaleY > 8096;
|
|
1605
1623
|
}
|
|
1606
1624
|
}
|
|
1607
1625
|
if (drawImage) {
|
|
@@ -1660,7 +1678,7 @@ function recycleImage(attrName, data) {
|
|
|
1660
1678
|
if (url) {
|
|
1661
1679
|
if (!recycleMap) recycleMap = {};
|
|
1662
1680
|
recycleMap[url] = true;
|
|
1663
|
-
ImageManager.
|
|
1681
|
+
ImageManager.recyclePaint(paint);
|
|
1664
1682
|
if (image.loading) {
|
|
1665
1683
|
if (!input) {
|
|
1666
1684
|
input = data.__input && data.__input[attrName] || [];
|
|
@@ -2576,4 +2594,4 @@ Object.assign(Creator, {
|
|
|
2576
2594
|
|
|
2577
2595
|
useCanvas();
|
|
2578
2596
|
|
|
2579
|
-
export { Layouter, LeaferCanvas, Picker, Renderer, Selector, Watcher, useCanvas };
|
|
2597
|
+
export { Layouter, LeaferCanvas, PathNodeHandleType, Picker, Renderer, Selector, Watcher, useCanvas };
|
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,BoundsHelper as k,Plugin as B,isObject as E,FourNumberHelper as R,Matrix as L,isUndefined as T,isString as A,ImageEvent as P,MatrixHelper as O,MathHelper as C,AlignHelper as M,PointHelper 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 G,PaintImage as z,ColorConvert as q,PaintGradient as N,Effect as j,Group as H,TextConvert as V}from"@leafer-ui/draw";class Q 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:Z}=s;function $(t,i){e.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,i)=>new Promise((s,n)=>{t.convertToBlob({type:Z(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:Z(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 Q(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:J}=navigator;J.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),J.indexOf("Windows")>-1?(e.os="Windows",e.intWheelDeltaY=!0):J.indexOf("Mac")>-1?e.os="Mac":J.indexOf("Linux")>-1&&(e.os="Linux");class K{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){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.__updatedList.add(t.target),this.update()}__onChildEvent(t){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:tt,updateBounds:et,updateChange:it}=f,{pushAllChildBranch:st,pushAllParent:nt}=g;const{worldBounds:at}=p;class rt{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,at)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,at),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:ot,updateAllChange:lt}=f,dt=y.get("Layouter");class ht{constructor(t,e){this.totalTimes=0,this.config={},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){dt.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?dt.warn("layouting"):this.times>3?dt.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(c.REQUEST),this.totalTimes>1?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?(tt(t,!0),e.add(t),t.isBranch&&st(t,e),nt(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),nt(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||et(s[t])}et(i)}})}(this.__levelList),function(t){t.list.forEach(it)}(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)),ht.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){ot(t,!0),t.isBranch?g.updateBounds(t):f.updateBounds(t),lt(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new rt([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new rt(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 ct=y.get("Renderer");class ut{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.__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 _,ct.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,ct.error(t)}ct.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return ct.warn("rendering");if(this.times>3)return ct.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(ut.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}=this,n=t.includes(this.target.__world),a=n?{includes:n}:{bounds:t,includes:n};this.needFill&&s.fillWorld(t,this.config.fill),y.showRepaint&&y.drawRepaint(s,t),e.render(this.target,s,a),this.renderBounds=i=i||t,this.renderOptions=a,this.totalBounds.isEmpty()?this.totalBounds=i:this.totalBounds.add(i),s.updateRender(i)}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||ct.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)}}ut.clipSpread=10;const{hitRadiusPoint:ft}=k;class gt{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;const{point:n}=this;for(let a=t.length-1;a>-1;a--)if(i=t[a],i.__.visible&&(!e||i.__.mask))if(s=!!i.__.hitRadius||ft(i.__world,n),i.isBranch){if(s||i.__ignoreHitWorld){if(i.isBranchLeaf&&i.__.__clipAfterFill&&!i.__hitWorld(n))continue;i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,n)}}else s&&this.hitChild(i,n)}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 pt{constructor(t,e){this.config={},e&&(this.config=l.default(e,this.config)),this.picker=new gt(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):B.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function _t(t,e,i){t.__.__font?G.fillText(t,e,i):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function wt(t,e,i,s,n){const a=i.__;E(t)?G.drawStrokesStyle(t,e,!1,i,s,n):(s.setStroke(t,a.__strokeWidth*e,a),s.stroke()),a.__useArrow&&G.strokeArrow(t,i,s,n)}function yt(t,e,i,s,n){const a=i.__;E(t)?G.drawStrokesStyle(t,e,!0,i,s,n):(s.setStroke(t,a.__strokeWidth*e,a),G.drawTextStroke(i,s,n))}function mt(t,e,i,s,n){const a=s.getSameCanvas(!0,!0);a.font=i.__.__font,yt(t,2,i,a,n),a.blendMode="outside"===e?"destination-out":"destination-in",G.fillText(i,a,n),a.blendMode="normal",f.copyCanvasByWorld(i,s,a),a.recycle(i.__nowWorld)}Object.assign(n,{watcher:(t,e)=>new K(t,e),layouter:(t,e)=>new ht(t,e),renderer:(t,e,i)=>new ut(t,e,i),selector:(t,e)=>new pt(t,e)}),e.layout=ht.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:xt,copyAndSpread:vt,toOuterOf:bt,getOuterOf:St,getByMove:kt,move:Bt,getIntersectData:Et}=k,Rt={};let Lt;const{stintSet:Tt}=l,{hasTransparent:At}=q;function Pt(t,e,i){if(!E(e)||!1===e.visible||0===e.opacity)return;let s;const{boxBounds:n}=i.__layout;switch(e.type){case"image":s=z.image(i,t,e,n,!Lt||!Lt[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)&&At(s.style)&&(s.isTransparent=!0),e.style)){if(0===e.style.strokeWidth)return;s.strokeStyle=e.style}return s}const Ot={compute:function(t,e){const i=e.__,s=[];let n,a,r,o=i.__input[t];w(o)||(o=[o]),Lt=z.recycleImage(t,i);for(let i,n=0,a=o.length;n<a;n++)(i=Pt(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?(Tt(i,"__isAlphaPixelFill",n),Tt(i,"__isTransparentFill",a)):(Tt(i,"__isAlphaPixelStroke",n),Tt(i,"__isTransparentStroke",a),Tt(i,"__hasMultiStrokeStyle",r))):i.__removePaint(t,!1)},fill:function(t,e,i,s){i.fillStyle=t,_t(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,z.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),_t(e,i,s),i.restore()}else a.blendMode?(i.saveBlendMode(a.blendMode),_t(e,i,s),i.restoreBlendMode()):_t(e,i,s)}},fillPathOrText:_t,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)G.strokeText(t,e,i,s);else switch(n.strokeAlign){case"center":wt(t,1,e,i,s);break;case"inside":!function(t,e,i,s){i.save(),i.clipUI(e),wt(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)wt(t,2,e,i,s);else{const{renderBounds:a}=e.__layout,r=i.getSameCanvas(!0,!0);e.__drawRenderPath(r),wt(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){G.stroke(t,e,i,s)},strokeText:function(t,e,i,s){switch(e.__.strokeAlign){case"center":yt(t,1,e,i,s);break;case"inside":mt(t,"inside",e,i,s);break;case"outside":e.__.__fillAfterStroke?yt(t,2,e,i,s):mt(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||!z.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?G.drawTextStroke(s,n,a):n.stroke(),n.restoreBlendMode()):i?G.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?(vt(Rt,o.boxBounds,o.strokeSpread),Rt):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?xt(a,R.swapAndScale(o.renderShapeSpread,p,_)):a;n=Et(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=St(l,u),d=kt(f,-u.e,-u.f),h=St(r,u),Bt(h,-u.e,-u.f);const m=s.matrix;m?(c=new L(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 Ct,Mt=new _;const{isSame:Wt}=k;function Dt(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||z.createData(n,s,i,a),!0}function It(t,e){Xt(t,P.LOAD,e)}function Ft(t,e){Xt(t,P.LOADED,e)}function Yt(t,e,i){e.error=i,t.forceUpdate("surface"),Xt(t,P.ERROR,e)}function Xt(t,e,i){t.hasEvent(e)&&t.emitEvent(new P(e,i))}function Ut(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:Gt,translate:zt}=O,qt=new _,Nt={},jt={};function Ht(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 Vt={},Qt=D();const{get:Zt,set:$t,rotateOfOuter:Jt,translate:Kt,scaleOfOuter:te,multiplyParent:ee,scale:ie,rotate:se,skew:ne}=O;function ae(t,e,i,s,n,a,r,o){r&&se(t,r),o&&ne(t,o.x,o.y),n&&ie(t,n,a),Kt(t,e.x+i,e.y+s)}function re(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:oe,scale:le,copy:de}=O,{getFloorScale:he}=C,{abs:ce}=Math;const ue={image:function(t,e,i,s,n){let a,r;const o=b.get(i);return Ct&&i===Ct.paint&&Wt(s,Ct.boxBounds)?a=Ct.leafPaint:(a={type:i.type,image:o},o.hasAlphaPixel&&(a.isTransparent=!0),Ct=o.use>1?{leafPaint:a,paint:i,boxBounds:Mt.set(s)}:null),(n||o.loading)&&(r={image:o,attrName:e,attrValue:i}),o.ready?(Dt(t,e,i,o,a,s),n&&(It(t,r),Ft(t,r))):o.error?n&&Yt(t,r,o.error):(n&&(Ut(t,!0),It(t,r)),a.loadId=o.load(()=>{Ut(t,!1),t.destroyed||(Dt(t,e,i,o,a,s)&&(o.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),Ft(t,r)),a.loadId=void 0},e=>{Ut(t,!1),Yt(t,r,e),a.loadId=void 0}),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}=z.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))),i?(s.__.__isFastShadow&&(n.fillStyle=t.style||"#000",n.fill()),z.drawImage(t,r,o,s,n,a),!0):(!t.style||h.sync||c?z.createPattern(t,s,n,a):z.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.recycle(n),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(()=>re(this,void 0,void 0,function*(){t.patternTask=null,i.bounds.hit(e.__nowWorld)&&z.createPattern(t,e,i,s),e.forceUpdate("surface")}),300))},createPattern:function(t,i,s,n){let{scaleX:a,scaleY:r}=z.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=z.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/ce(n.scaleX||1),f=d.y*r/ce(n.scaleY||1)),(l||1!==a||1!==r)&&(a*=he(g+(u||0)),r*=he(p+(f||0)),c=oe(),l&&de(c,l),le(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=z.getPatternData(i,s,e)},getPatternData:function(t,e,i){t.padding&&(e=qt.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(k.set(jt,0,0,m?n:s,m?s:n),r&&"cover"!==r&&"fit"!==r?((d||h)&&(C.getScaleData(d,h,i,Nt),x=Nt.scaleX,v=Nt.scaleY),(o||p||g)&&(x&&k.scale(jt,x,v,!0),o&&M.toPoint(o,jt,e,jt,!0,!0))):w&&!c||(x=v=k.getFitScale(e,jt,"fit"!==r),k.put(e,i,o,x,!1,jt),k.scale(jt,x,v,!0)),l&&W.move(jt,l),r){case"stretch":w?x&&(x=v=void 0):(x=e.width/s,v=e.height/n,z.stretchMode(y,e,x,v));break;case"normal":case"clip":if(jt.x||jt.y||x||f||c||u){let t,i;f&&(t=e.width/f.width,i=e.height/f.height),z.clipMode(y,e,jt.x,jt.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)&&z.repeatMode(y,e,s,n,jt.x,jt.y,x,v,c,u,o,t.freeTransform),g||(y.repeat="repeat");const i=E(g);(p||i)&&(y.gap=function(t,e,i,s,n){let a,r;E(t)?(a=t.x,r=t.y):a=r=t;return{x:Ht(a,i,n.width,e&&e.x),y:Ht(r,s,n.height,e&&e.y)}}(p,i&&g,jt.width,jt.height,e));break;default:x&&z.fillOrFitMode(y,e,jt.x,jt.y,x,v,c)}return y.transform||(e.x||e.y)&&zt(y.transform=Gt(),e.x,e.y),x&&(y.scaleX=x,y.scaleY=v),a&&a<1&&(y.opacity=a),_&&(y.filters=_),g&&(y.repeat=A(g)?"x"===g?"repeat-x":"repeat-y":"repeat"),y},stretchMode:function(t,e,i,s){const n=Zt(),{x:a,y:r}=e;a||r?Kt(n,a,r):n.onlyScale=!0,ie(n,i,s),t.transform=n},fillOrFitMode:function(t,e,i,s,n,a,r){const o=Zt();Kt(o,e.x+i,e.y+s),ie(o,n,a),r&&Jt(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=Zt();ae(h,e,i,s,n,a,r,o),l&&(r||o?($t(Qt),te(Qt,e,l,d),ee(h,Qt)):te(h,e,l,d)),t.transform=h},repeatMode:function(t,e,i,s,n,a,r,o,l,d,h,c){const u=Zt();if(c)ae(u,e,n,a,r,o,l,d);else{if(l)if("center"===h)Jt(u,{x:i/2,y:s/2},l);else switch(se(u,l),l){case 90:Kt(u,s,0);break;case 180:Kt(u,i,s);break;case 270:Kt(u,0,i)}Vt.x=e.x+n,Vt.y=e.y+a,Kt(u,Vt.x,Vt.y),r&&te(u,Vt,r,o)}t.transform=u}},{toPoint:fe}=I,{hasTransparent:ge}=q,pe={},_e={};function we(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&&ge(a)&&(o=!0);o&&(t.isTransparent=!0)}}const{getAngle:ye,getDistance:me}=W,{get:xe,rotateOfOuter:ve,scaleOfOuter:be}=O,{toPoint:Se}=I,ke={},Be={};function Ee(t,e,i,s,n){let a;const{width:r,height:o}=t;if(r!==o||s){const t=ye(e,i);a=xe(),n?(be(a,e,r/o*(s||1),1),ve(a,e,t+90)):(be(a,e,1,r/o*(s||1)),ve(a,e,t))}return a}const{getDistance:Re}=W,{toPoint:Le}=I,Te={},Ae={};const Pe={linearGradient:function(t,i){let{from:s,to:n,type:a,opacity:r}=t;fe(s||"top",i,pe),fe(n||"bottom",i,_e);const o=e.canvas.createLinearGradient(pe.x,pe.y,_e.x,_e.y),l={type:a,style:o};return we(l,o,t.stops,r),l},radialGradient:function(t,i){let{from:s,to:n,type:a,opacity:r,stretch:o}=t;Se(s||"center",i,ke),Se(n||"bottom",i,Be);const l=e.canvas.createRadialGradient(ke.x,ke.y,0,ke.x,ke.y,me(ke,Be)),d={type:a,style:l};we(d,l,t.stops,r);const h=Ee(i,ke,Be,o,!0);return h&&(d.transform=h),d},conicGradient:function(t,i){let{from:s,to:n,type:a,opacity:r,stretch:o}=t;Le(s||"center",i,Te),Le(n||"bottom",i,Ae);const l=e.conicGradientSupport?e.canvas.createConicGradient(0,Te.x,Te.y):e.canvas.createRadialGradient(Te.x,Te.y,0,Te.x,Te.y,Re(Te,Ae)),d={type:a,style:l};we(d,l,t.stops,r);const h=Ee(i,Te,Ae,o||1,e.conicGradientRotate90);return h&&(d.transform=h),d},getTransform:Ee},{copy:Oe,move:Ce,toOffsetOutBounds:Me}=k,{max:We,abs:De}=Math,Ie={},Fe=new L,Ye={};function Xe(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=De(t.spread||0),r=We(r,n+a-s),o=We(o,n+a+i),l=We(l,n+a+s),d=We(d,n+a-i)}),r===o&&o===l&&l===d?r:[r,o,l,d]}function Ue(t,i,s){const{shapeBounds:n}=s;let a,r;e.fullImageShadow?(Oe(Ie,t.bounds),Ce(Ie,i.x-n.x,i.y-n.y),a=t.bounds,r=Ie):(a=n,r=i),t.copyWorld(s.canvas,a,r)}const{toOffsetOutBounds:Ge}=k,ze={};const qe=Xe;const Ne={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;Me(l,Ye,d),r.forEach((r,_)=>{let w=1;if(r.scaleFixed){const t=Math.abs(a.scaleX);t>1&&(w=1/t)}g.setWorldShadow(Ye.offsetX+(r.x||0)*c*w,Ye.offsetY+(r.y||0)*u*w,(r.blur||0)*c*w,q.string(r.color)),n=j.getShadowTransform(t,g,i,r,Ye,w),n&&g.setTransform(n),Ue(g,Ye,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;Ge(l,ze,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(ze.offsetX+(r.x||0)*c*w,ze.offsetY+(r.y||0)*u*w,(r.blur||0)*c*w),n=j.getShadowTransform(t,g,i,r,ze,w,!0),n&&g.setTransform(n),Ue(g,ze,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:Xe,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 Fe.set().scaleOfOuter({x:(n.x+n.width/2)*e.pixelRatio,y:(n.y+n.height/2)*e.pixelRatio},1+i/o,1+i/l),Fe}},isTransformShadow(t){},getInnerShadowSpread:qe},{excludeRenderBounds:je}=p;let He;function Ve(t,e,i,s,n,a,r,o){switch(e){case"grayscale":He||(He=!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);Ze(t,e,i,1,n,a)}(t,i,s,n,r,o);break;case"opacity-path":Ze(t,i,s,a,r,o);break;case"path":o&&i.restore()}}function Qe(t){return t.getSameCanvas(!1,!0)}function Ze(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&&(Ve(this,r,t,n,s,a,void 0,!0),s=n=null),"clipping"!==o&&"clipping-path"!==o||je(i,e)||i.__render(t,e),a=i.__.opacity,He=!1,"path"===o||"clipping-path"===o?(a<1?(r="opacity-path",n||(n=Qe(t))):(r="path",t.save()),i.__clip(n||t,e)):(r="grayscale"===o?"grayscale":"alpha",s||(s=Qe(t)),n||(n=Qe(t)),i.__render(s,e));continue}const h=1===a&&i.__.__blendMode;h&&Ve(this,r,t,n,s,a,void 0,!1),je(i,e)||i.__render(n||t,e),h&&Ve(this,r,t,n,s,a,h,!1)}Ve(this,r,t,n,s,a,void 0,!0)};const $e=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Je=$e+"_#~&*+\\=|≮≯≈≠=…",Ke=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 ti(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const ei=ti("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),ii=ti("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),si=ti($e),ni=ti(Je),ai=ti("- —/~|┆·");var ri;!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"}(ri||(ri={}));const{Letter:oi,Single:li,Before:di,After:hi,Symbol:ci,Break:ui}=ri;function fi(t){return ei[t]?oi:ai[t]?ui:ii[t]?di:si[t]?hi:ni[t]?ci:Ke.test(t)?li:oi}const gi={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 pi(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:_i}=gi,{Letter:wi,Single:yi,Before:mi,After:xi,Symbol:vi,Break:bi}=ri;let Si,ki,Bi,Ei,Ri,Li,Ti,Ai,Pi,Oi,Ci,Mi,Wi,Di,Ii,Fi,Yi,Xi=[];function Ui(t,e){Pi&&!Ai&&(Ai=Pi),Si.data.push({char:t,width:e}),Bi+=e}function Gi(){Ei+=Bi,Si.width=Bi,ki.words.push(Si),Si={data:[]},Bi=0}function zi(){Di&&(Ii.paraNumber++,ki.paraStart=!0,Di=!1),Pi&&(ki.startCharSize=Ai,ki.endCharSize=Pi,Ai=0),ki.width=Ei,Fi.width?_i(ki):Yi&&qi(),Xi.push(ki),ki={words:[]},Ei=0}function qi(){Ei>(Ii.maxWidth||0)&&(Ii.maxWidth=Ei)}const{top:Ni,right:ji,bottom:Hi,left:Vi}=F;function Qi(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 Zi={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[Vi],a-=o[ji]+o[Vi],!a&&(a=.01)):i.autoSizeAlign||(s=o[Vi]),r?(n=o[Ni],r-=o[Ni]+o[Hi],!r&&(r=.01)):i.autoSizeAlign||(n=o[Ni]));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){Ii=t,Xi=t.rows,Fi=t.bounds,Yi=!Fi.width&&!s.autoSizeAlign;const{__letterSpacing:n,paraIndent:a,textCase:r}=s,{canvas:o}=e,{width:l}=Fi;if(s.__isCharMode){const t="none"!==s.textWrap,e="break"===s.textWrap;Di=!0,Ci=null,Ai=Ti=Pi=Bi=Ei=0,Si={data:[]},ki={words:[]},n&&(i=[...i]);for(let s=0,d=i.length;s<d;s++)Li=i[s],"\n"===Li?(Bi&&Gi(),ki.paraEnd=!0,zi(),Di=!0):(Oi=fi(Li),Oi===wi&&"none"!==r&&(Li=pi(Li,r,!Bi)),Ti=o.measureText(Li).width,n&&(n<0&&(Pi=Ti),Ti+=n),Mi=Oi===yi&&(Ci===yi||Ci===wi)||Ci===yi&&Oi!==xi,Wi=!(Oi!==mi&&Oi!==yi||Ci!==vi&&Ci!==xi),Ri=Di&&a?l-a:l,t&&l&&Ei+Bi+Ti>Ri&&(e?(Bi&&Gi(),Ei&&zi()):(Wi||(Wi=Oi===wi&&Ci==xi),Mi||Wi||Oi===bi||Oi===mi||Oi===yi||Bi+Ti>Ri?(Bi&&Gi(),Ei&&zi()):Ei&&zi()))," "===Li&&!0!==Di&&Ei+Bi===0||(Oi===bi?(" "===Li&&Bi&&Gi(),Ui(Li,Ti),Gi()):Mi||Wi?(Bi&&Gi(),Ui(Li,Ti)):Ui(Li,Ti)),Ci=Oi);Bi&&Gi(),Ei&&zi(),Xi.length>0&&(Xi[Xi.length-1].paraEnd=!0)}else i.split("\n").forEach(t=>{Ii.paraNumber++,Ei=o.measureText(t).width,Xi.push({x:a||0,text:t,width:Ei,paraStart:!0}),Yi&&qi()})}(l,t,i),o&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":Qi(e,"x",t[Vi]);break;case"right":Qi(e,"x",-t[ji])}if(!n&&i.autoSizeAlign)switch(i.verticalAlign){case"top":Qi(e,"y",t[Ni]);break;case"bottom":Qi(e,"y",-t[Hi])}}(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,E(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 $i={string:function(t,e){if(!t)return"#000";const i=Y(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,Zi),Object.assign(q,$i),Object.assign(G,Ot),Object.assign(z,ue),Object.assign(N,Pe),Object.assign(j,Ne),Object.assign(n,{interaction:(t,e,i,s)=>new U(t,e,i,s),hitCanvas:(t,e)=>new Q(t,e),hitCanvasManager:()=>new X}),$();export{ht as Layouter,Q as LeaferCanvas,gt as Picker,ut as Renderer,pt as Selector,K as Watcher,$ 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,BoundsHelper as k,Plugin as B,isObject as L,FourNumberHelper as R,Matrix as E,isUndefined as A,isString as T,ImageEvent as P,MatrixHelper as C,MathHelper as O,AlignHelper as M,PointHelper 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 G,PaintImage as q,ColorConvert as z,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{hitRadiusPoint:gt}=k;class pt{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;const{point:n}=this;for(let a=t.length-1;a>-1;a--)if(i=t[a],i.__.visible&&(!e||i.__.mask))if(s=!!i.__.hitRadius||gt(i.__world,n),i.isBranch){if(s||i.__ignoreHitWorld){if(i.isBranchLeaf&&i.__.__clipAfterFill&&!i.__hitWorld(n))continue;i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,n)}}else s&&this.hitChild(i,n)}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 _t{constructor(t,e){this.config={},e&&(this.config=l.default(e,this.config)),this.picker=new pt(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):B.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function wt(t,e,i){t.__.__font?G.fillText(t,e,i):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function yt(t,e,i,s,n){const a=i.__;L(t)?G.drawStrokesStyle(t,e,!1,i,s,n):(s.setStroke(t,a.__strokeWidth*e,a),s.stroke()),a.__useArrow&&G.strokeArrow(t,i,s,n)}function mt(t,e,i,s,n){const a=i.__;L(t)?G.drawStrokesStyle(t,e,!0,i,s,n):(s.setStroke(t,a.__strokeWidth*e,a),G.drawTextStroke(i,s,n))}function xt(t,e,i,s,n){const a=s.getSameCanvas(!0,!0);a.font=i.__.__font,mt(t,2,i,a,n),a.blendMode="outside"===e?"destination-out":"destination-in",G.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 _t(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:vt,copyAndSpread:bt,toOuterOf:St,getOuterOf:kt,getByMove:Bt,move:Lt,getIntersectData:Rt}=k,Et={};let At;const{stintSet:Tt}=l,{hasTransparent:Pt}=z;function Ct(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=q.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:z.string(r,o)};break;default:A(e.r)||(s={type:"solid",style:z.string(e)})}if(s&&(s.originPaint=e,T(s.style)&&Pt(s.style)&&(s.isTransparent=!0),e.style)){if(0===e.style.strokeWidth)return;s.strokeStyle=e.style}return s}const Ot={compute:function(t,e){const i=e.__,s=[];let n,a,r,o=i.__input[t];w(o)||(o=[o]),At=q.recycleImage(t,i);for(let i,n=0,a=o.length;n<a;n++)(i=Ct(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?(Tt(i,"__isAlphaPixelFill",n),Tt(i,"__isTransparentFill",a)):(Tt(i,"__isAlphaPixelStroke",n),Tt(i,"__isTransparentStroke",a),Tt(i,"__hasMultiStrokeStyle",r))):i.__removePaint(t,!1)},fill:function(t,e,i,s){i.fillStyle=t,wt(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,q.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),wt(e,i,s),i.restore()}else a.blendMode?(i.saveBlendMode(a.blendMode),wt(e,i,s),i.restoreBlendMode()):wt(e,i,s)}},fillPathOrText:wt,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)G.strokeText(t,e,i,s);else switch(n.strokeAlign){case"center":yt(t,1,e,i,s);break;case"inside":!function(t,e,i,s){i.save(),i.clipUI(e),yt(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)yt(t,2,e,i,s);else{const{renderBounds:a}=e.__layout,r=i.getSameCanvas(!0,!0);e.__drawRenderPath(r),yt(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){G.stroke(t,e,i,s)},strokeText:function(t,e,i,s){switch(e.__.strokeAlign){case"center":mt(t,1,e,i,s);break;case"inside":xt(t,"inside",e,i,s);break;case"outside":e.__.__fillAfterStroke?mt(t,2,e,i,s):xt(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||!q.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?G.drawTextStroke(s,n,a):n.stroke(),n.restoreBlendMode()):i?G.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;St(o.strokeSpread?(bt(Et,o.boxBounds,o.strokeSpread),Et):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?vt(a,R.swapAndScale(o.renderShapeSpread,p,_)):a;n=Rt(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=kt(l,u),d=Bt(f,-u.e,-u.f),h=kt(r,u),Lt(h,-u.e,-u.f);const m=s.matrix;m?(c=new E(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 Mt,Wt=new _;const{isSame:Dt}=k;function It(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||q.createData(n,s,i,a),!0}function Ft(t,e){Ut(t,P.LOAD,e)}function Yt(t,e){Ut(t,P.LOADED,e)}function Xt(t,e,i){e.error=i,t.forceUpdate("surface"),Ut(t,P.ERROR,e)}function Ut(t,e,i){t.hasEvent(e)&&t.emitEvent(new P(e,i))}function Gt(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:qt,translate:zt}=C,Nt=new _,jt={},Ht={};function Vt(t,e,i,s){const n=T(t)||s?(s?i-s*e:i%e)/((s||Math.floor(i/e))-1):t;return"auto"===t&&n<0?0:n}let Qt={},Zt=D();const{get:$t,set:Jt,rotateOfOuter:Kt,translate:te,scaleOfOuter:ee,multiplyParent:ie,scale:se,rotate:ne,skew:ae}=C;function re(t,e,i,s,n,a,r,o){r&&ne(t,r),o&&ae(t,o.x,o.y),n&&se(t,n,a),te(t,e.x+i,e.y+s)}function oe(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:le,scale:de,copy:he}=C,{getFloorScale:ce}=O,{abs:ue}=Math;const fe={image:function(t,e,i,s,n){let a,r;const o=b.get(i);return Mt&&i===Mt.paint&&Dt(s,Mt.boxBounds)?a=Mt.leafPaint:(a={type:i.type,image:o},o.hasAlphaPixel&&(a.isTransparent=!0),Mt=o.use>1?{leafPaint:a,paint:i,boxBounds:Wt.set(s)}:null),(n||o.loading)&&(r={image:o,attrName:e,attrValue:i}),o.ready?(It(t,e,i,o,a,s),n&&(Ft(t,r),Yt(t,r))):o.error?n&&Xt(t,r,o.error):(n&&(Gt(t,!0),Ft(t,r)),a.loadId=o.load(()=>{Gt(t,!1),t.destroyed||(It(t,e,i,o,a,s)&&(o.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),Yt(t,r)),a.loadId=void 0},e=>{Gt(t,!1),Xt(t,r,e),a.loadId=void 0}),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}=q.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()),q.drawImage(t,r,o,s,n,a),!0):(!t.style||h.sync||c?q.createPattern(t,s,n,a):q.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(()=>oe(this,void 0,void 0,function*(){t.patternTask=null,i.bounds.hit(e.__nowWorld)&&q.createPattern(t,e,i,s),e.forceUpdate("surface")}),300))},createPattern:function(t,i,s,n){let{scaleX:a,scaleY:r}=q.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=q.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/ue(n.scaleX||1),f=d.y*r/ue(n.scaleY||1)),(l||1!==a||1!==r)&&(a*=ce(g+(u||0)),r*=ce(p+(f||0)),c=le(),l&&he(c,l),de(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=q.getPatternData(i,s,e)},getPatternData:function(t,e,i){t.padding&&(e=Nt.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(k.set(Ht,0,0,m?n:s,m?s:n),r&&"cover"!==r&&"fit"!==r?((d||h)&&(O.getScaleData(d,h,i,jt),x=jt.scaleX,v=jt.scaleY),(o||p||g)&&(x&&k.scale(Ht,x,v,!0),o&&M.toPoint(o,Ht,e,Ht,!0,!0))):w&&!c||(x=v=k.getFitScale(e,Ht,"fit"!==r),k.put(e,i,o,x,!1,Ht),k.scale(Ht,x,v,!0)),l&&W.move(Ht,l),r){case"stretch":w?x&&(x=v=void 0):(x=e.width/s,v=e.height/n,q.stretchMode(y,e,x,v));break;case"normal":case"clip":if(Ht.x||Ht.y||x||f||c||u){let t,i;f&&(t=e.width/f.width,i=e.height/f.height),q.clipMode(y,e,Ht.x,Ht.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)&&q.repeatMode(y,e,s,n,Ht.x,Ht.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:Vt(a,i,n.width,e&&e.x),y:Vt(r,s,n.height,e&&e.y)}}(p,i&&g,Ht.width,Ht.height,e));break;default:x&&q.fillOrFitMode(y,e,Ht.x,Ht.y,x,v,c)}return y.transform||(e.x||e.y)&&zt(y.transform=qt(),e.x,e.y),x&&(y.scaleX=x,y.scaleY=v),a&&a<1&&(y.opacity=a),_&&(y.filters=_),g&&(y.repeat=T(g)?"x"===g?"repeat-x":"repeat-y":"repeat"),y},stretchMode:function(t,e,i,s){const n=$t(),{x:a,y:r}=e;a||r?te(n,a,r):n.onlyScale=!0,se(n,i,s),t.transform=n},fillOrFitMode:function(t,e,i,s,n,a,r){const o=$t();te(o,e.x+i,e.y+s),se(o,n,a),r&&Kt(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=$t();re(h,e,i,s,n,a,r,o),l&&(r||o?(Jt(Zt),ee(Zt,e,l,d),ie(h,Zt)):ee(h,e,l,d)),t.transform=h},repeatMode:function(t,e,i,s,n,a,r,o,l,d,h,c){const u=$t();if(c)re(u,e,n,a,r,o,l,d);else{if(l)if("center"===h)Kt(u,{x:i/2,y:s/2},l);else switch(ne(u,l),l){case 90:te(u,s,0);break;case 180:te(u,i,s);break;case 270:te(u,0,i)}Qt.x=e.x+n,Qt.y=e.y+a,te(u,Qt.x,Qt.y),r&&ee(u,Qt,r,o)}t.transform=u}},{toPoint:ge}=I,{hasTransparent:pe}=z,_e={},we={};function ye(t,e,i,s){if(i){let n,a,r,o;for(let t=0,l=i.length;t<l;t++)n=i[t],T(n)?(r=t/(l-1),a=z.string(n,s)):(r=n.offset,a=z.string(n.color,s)),e.addColorStop(r,a),!o&&pe(a)&&(o=!0);o&&(t.isTransparent=!0)}}const{getAngle:me,getDistance:xe}=W,{get:ve,rotateOfOuter:be,scaleOfOuter:Se}=C,{toPoint:ke}=I,Be={},Le={};function Re(t,e,i,s,n){let a;const{width:r,height:o}=t;if(r!==o||s){const t=me(e,i);a=ve(),n?(Se(a,e,r/o*(s||1),1),be(a,e,t+90)):(Se(a,e,1,r/o*(s||1)),be(a,e,t))}return a}const{getDistance:Ee}=W,{toPoint:Ae}=I,Te={},Pe={};const Ce={linearGradient:function(t,i){let{from:s,to:n,type:a,opacity:r}=t;ge(s||"top",i,_e),ge(n||"bottom",i,we);const o=e.canvas.createLinearGradient(_e.x,_e.y,we.x,we.y),l={type:a,style:o};return ye(l,o,t.stops,r),l},radialGradient:function(t,i){let{from:s,to:n,type:a,opacity:r,stretch:o}=t;ke(s||"center",i,Be),ke(n||"bottom",i,Le);const l=e.canvas.createRadialGradient(Be.x,Be.y,0,Be.x,Be.y,xe(Be,Le)),d={type:a,style:l};ye(d,l,t.stops,r);const h=Re(i,Be,Le,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,Te),Ae(n||"bottom",i,Pe);const l=e.conicGradientSupport?e.canvas.createConicGradient(0,Te.x,Te.y):e.canvas.createRadialGradient(Te.x,Te.y,0,Te.x,Te.y,Ee(Te,Pe)),d={type:a,style:l};ye(d,l,t.stops,r);const h=Re(i,Te,Pe,o||1,e.conicGradientRotate90);return h&&(d.transform=h),d},getTransform:Re},{copy:Oe,move:Me,toOffsetOutBounds:We}=k,{max:De,abs:Ie}=Math,Fe={},Ye=new E,Xe={};function Ue(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=Ie(t.spread||0),r=De(r,n+a-s),o=De(o,n+a+i),l=De(l,n+a+s),d=De(d,n+a-i)}),r===o&&o===l&&l===d?r:[r,o,l,d]}function Ge(t,i,s){const{shapeBounds:n}=s;let a,r;e.fullImageShadow?(Oe(Fe,t.bounds),Me(Fe,i.x-n.x,i.y-n.y),a=t.bounds,r=Fe):(a=n,r=i),t.copyWorld(s.canvas,a,r)}const{toOffsetOutBounds:qe}=k,ze={};const Ne=Ue;const je={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;We(l,Xe,d),r.forEach((r,_)=>{let w=1;if(r.scaleFixed){const t=Math.abs(a.scaleX);t>1&&(w=1/t)}g.setWorldShadow(Xe.offsetX+(r.x||0)*c*w,Xe.offsetY+(r.y||0)*u*w,(r.blur||0)*c*w,z.string(r.color)),n=j.getShadowTransform(t,g,i,r,Xe,w),n&&g.setTransform(n),Ge(g,Xe,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;qe(l,ze,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(ze.offsetX+(r.x||0)*c*w,ze.offsetY+(r.y||0)*u*w,(r.blur||0)*c*w),n=j.getShadowTransform(t,g,i,r,ze,w,!0),n&&g.setTransform(n),Ge(g,ze,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,z.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:Ue,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 Ye.set().scaleOfOuter({x:(n.x+n.width/2)*e.pixelRatio,y:(n.y+n.height/2)*e.pixelRatio},1+i/o,1+i/l),Ye}},isTransformShadow(t){},getInnerShadowSpread:Ne},{excludeRenderBounds:He}=p;let Ve;function Qe(t,e,i,s,n,a,r,o){switch(e){case"grayscale":Ve||(Ve=!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);$e(t,e,i,1,n,a)}(t,i,s,n,r,o);break;case"opacity-path":$e(t,i,s,a,r,o);break;case"path":o&&i.restore()}}function Ze(t){return t.getSameCanvas(!1,!0)}function $e(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&&(Qe(this,r,t,n,s,a,void 0,!0),s=n=null),"clipping"!==o&&"clipping-path"!==o||He(i,e)||i.__render(t,e),a=i.__.opacity,Ve=!1,"path"===o||"clipping-path"===o?(a<1?(r="opacity-path",n||(n=Ze(t))):(r="path",t.save()),i.__clip(n||t,e)):(r="grayscale"===o?"grayscale":"alpha",s||(s=Ze(t)),n||(n=Ze(t)),i.__render(s,e));continue}const h=1===a&&i.__.__blendMode;h&&Qe(this,r,t,n,s,a,void 0,!1),He(i,e)||i.__render(n||t,e),h&&Qe(this,r,t,n,s,a,h,!1)}Qe(this,r,t,n,s,a,void 0,!0)};const Je=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Ke=Je+"_#~&*+\\=|≮≯≈≠=…",ti=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 ei(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const ii=ei("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),si=ei("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),ni=ei(Je),ai=ei(Ke),ri=ei("- —/~|┆·");var oi;!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"}(oi||(oi={}));const{Letter:li,Single:di,Before:hi,After:ci,Symbol:ui,Break:fi}=oi;function gi(t){return ii[t]?li:ri[t]?fi:si[t]?hi:ni[t]?ci:ai[t]?ui:ti.test(t)?di:li}const pi={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 _i(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:wi}=pi,{Letter:yi,Single:mi,Before:xi,After:vi,Symbol:bi,Break:Si}=oi;let ki,Bi,Li,Ri,Ei,Ai,Ti,Pi,Ci,Oi,Mi,Wi,Di,Ii,Fi,Yi,Xi,Ui=[];function Gi(t,e){Ci&&!Pi&&(Pi=Ci),ki.data.push({char:t,width:e}),Li+=e}function qi(){Ri+=Li,ki.width=Li,Bi.words.push(ki),ki={data:[]},Li=0}function zi(){Ii&&(Fi.paraNumber++,Bi.paraStart=!0,Ii=!1),Ci&&(Bi.startCharSize=Pi,Bi.endCharSize=Ci,Pi=0),Bi.width=Ri,Yi.width?wi(Bi):Xi&&Ni(),Ui.push(Bi),Bi={words:[]},Ri=0}function Ni(){Ri>(Fi.maxWidth||0)&&(Fi.maxWidth=Ri)}const{top:ji,right:Hi,bottom:Vi,left:Qi}=F;function Zi(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 $i={getDrawData:function(t,i){T(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[Qi],a-=o[Hi]+o[Qi],!a&&(a=.01)):i.autoSizeAlign||(s=o[Qi]),r?(n=o[ji],r-=o[ji]+o[Vi],!r&&(r=.01)):i.autoSizeAlign||(n=o[ji]));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){Fi=t,Ui=t.rows,Yi=t.bounds,Xi=!Yi.width&&!s.autoSizeAlign;const{__letterSpacing:n,paraIndent:a,textCase:r}=s,{canvas:o}=e,{width:l}=Yi;if(s.__isCharMode){const t="none"!==s.textWrap,e="break"===s.textWrap;Ii=!0,Mi=null,Pi=Ti=Ci=Li=Ri=0,ki={data:[]},Bi={words:[]},n&&(i=[...i]);for(let s=0,d=i.length;s<d;s++)Ai=i[s],"\n"===Ai?(Li&&qi(),Bi.paraEnd=!0,zi(),Ii=!0):(Oi=gi(Ai),Oi===yi&&"none"!==r&&(Ai=_i(Ai,r,!Li)),Ti=o.measureText(Ai).width,n&&(n<0&&(Ci=Ti),Ti+=n),Wi=Oi===mi&&(Mi===mi||Mi===yi)||Mi===mi&&Oi!==vi,Di=!(Oi!==xi&&Oi!==mi||Mi!==bi&&Mi!==vi),Ei=Ii&&a?l-a:l,t&&l&&Ri+Li+Ti>Ei&&(e?(Li&&qi(),Ri&&zi()):(Di||(Di=Oi===yi&&Mi==vi),Wi||Di||Oi===Si||Oi===xi||Oi===mi||Li+Ti>Ei?(Li&&qi(),Ri&&zi()):Ri&&zi()))," "===Ai&&!0!==Ii&&Ri+Li===0||(Oi===Si?(" "===Ai&&Li&&qi(),Gi(Ai,Ti),qi()):Wi||Di?(Li&&qi(),Gi(Ai,Ti)):Gi(Ai,Ti)),Mi=Oi);Li&&qi(),Ri&&zi(),Ui.length>0&&(Ui[Ui.length-1].paraEnd=!0)}else i.split("\n").forEach(t=>{Fi.paraNumber++,Ri=o.measureText(t).width,Ui.push({x:a||0,text:t,width:Ri,paraStart:!0}),Xi&&Ni()})}(l,t,i),o&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":Zi(e,"x",t[Qi]);break;case"right":Zi(e,"x",-t[Hi])}if(!n&&i.autoSizeAlign)switch(i.verticalAlign){case"top":Zi(e,"y",t[ji]);break;case"bottom":Zi(e,"y",-t[Vi])}}(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=z.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 Ji={string:function(t,e){if(!t)return"#000";const i=Y(e)&&e<1;if(T(t)){if(!i||!z.object)return t;t=z.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,$i),Object.assign(z,Ji),Object.assign(G,Ot),Object.assign(q,fe),Object.assign(N,Ce),Object.assign(j,je),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,pt as Picker,ft as Renderer,_t as Selector,tt as Watcher,J as useCanvas};
|
|
2
2
|
//# sourceMappingURL=worker.esm.min.js.map
|