@leafer-draw/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 +9 -9
package/dist/worker.cjs
CHANGED
|
@@ -4,6 +4,15 @@ var core = require("@leafer/core");
|
|
|
4
4
|
|
|
5
5
|
var draw = require("@leafer-ui/draw");
|
|
6
6
|
|
|
7
|
+
exports.PathNodeHandleType = void 0;
|
|
8
|
+
|
|
9
|
+
(function(PathNodeHandleType) {
|
|
10
|
+
PathNodeHandleType[PathNodeHandleType["none"] = 1] = "none";
|
|
11
|
+
PathNodeHandleType[PathNodeHandleType["free"] = 2] = "free";
|
|
12
|
+
PathNodeHandleType[PathNodeHandleType["mirrorAngle"] = 3] = "mirrorAngle";
|
|
13
|
+
PathNodeHandleType[PathNodeHandleType["mirror"] = 4] = "mirror";
|
|
14
|
+
})(exports.PathNodeHandleType || (exports.PathNodeHandleType = {}));
|
|
15
|
+
|
|
7
16
|
class LeaferCanvas extends core.LeaferCanvasBase {
|
|
8
17
|
get allowBackgroundColor() {
|
|
9
18
|
return true;
|
|
@@ -119,7 +128,7 @@ class Watcher {
|
|
|
119
128
|
return this.hasAdd || this.hasRemove || this.hasVisible;
|
|
120
129
|
}
|
|
121
130
|
get updatedList() {
|
|
122
|
-
if (this.hasRemove) {
|
|
131
|
+
if (this.hasRemove && this.config.usePartLayout) {
|
|
123
132
|
const updatedList = new core.LeafList;
|
|
124
133
|
this.__updatedList.list.forEach(item => {
|
|
125
134
|
if (item.leafer) updatedList.add(item);
|
|
@@ -154,16 +163,18 @@ class Watcher {
|
|
|
154
163
|
if (this.running) this.target.emit(core.RenderEvent.REQUEST);
|
|
155
164
|
}
|
|
156
165
|
__onAttrChange(event) {
|
|
157
|
-
this.__updatedList.add(event.target);
|
|
166
|
+
if (this.config.usePartLayout) this.__updatedList.add(event.target);
|
|
158
167
|
this.update();
|
|
159
168
|
}
|
|
160
169
|
__onChildEvent(event) {
|
|
161
|
-
if (
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
170
|
+
if (this.config.usePartLayout) {
|
|
171
|
+
if (event.type === core.ChildEvent.ADD) {
|
|
172
|
+
this.hasAdd = true;
|
|
173
|
+
this.__pushChild(event.child);
|
|
174
|
+
} else {
|
|
175
|
+
this.hasRemove = true;
|
|
176
|
+
this.__updatedList.add(event.parent);
|
|
177
|
+
}
|
|
167
178
|
}
|
|
168
179
|
this.update();
|
|
169
180
|
}
|
|
@@ -280,7 +291,9 @@ const debug$1 = core.Debug.get("Layouter");
|
|
|
280
291
|
class Layouter {
|
|
281
292
|
constructor(target, userConfig) {
|
|
282
293
|
this.totalTimes = 0;
|
|
283
|
-
this.config = {
|
|
294
|
+
this.config = {
|
|
295
|
+
usePartLayout: true
|
|
296
|
+
};
|
|
284
297
|
this.__levelList = new core.LeafLevelList;
|
|
285
298
|
this.target = target;
|
|
286
299
|
if (userConfig) this.config = core.DataHelper.default(userConfig, this.config);
|
|
@@ -325,7 +338,7 @@ class Layouter {
|
|
|
325
338
|
this.totalTimes++;
|
|
326
339
|
this.layouting = true;
|
|
327
340
|
this.target.emit(core.WatchEvent.REQUEST);
|
|
328
|
-
if (this.totalTimes > 1) {
|
|
341
|
+
if (this.totalTimes > 1 && this.config.usePartLayout) {
|
|
329
342
|
this.partLayout();
|
|
330
343
|
} else {
|
|
331
344
|
this.fullLayout();
|
|
@@ -442,7 +455,7 @@ class Renderer {
|
|
|
442
455
|
}
|
|
443
456
|
update(change = true) {
|
|
444
457
|
if (!this.changed) this.changed = change;
|
|
445
|
-
this.__requestRender();
|
|
458
|
+
if (!this.requestTime) this.__requestRender();
|
|
446
459
|
}
|
|
447
460
|
requestLayout() {
|
|
448
461
|
this.target.emit(core.LayoutEvent.REQUEST);
|
|
@@ -549,7 +562,7 @@ class Renderer {
|
|
|
549
562
|
core.Run.end(t);
|
|
550
563
|
}
|
|
551
564
|
__render(bounds, realBounds) {
|
|
552
|
-
const {canvas: canvas} = this, includes = bounds.includes(
|
|
565
|
+
const {canvas: canvas, target: target} = this, includes = bounds.includes(target.__world), options = includes ? {
|
|
553
566
|
includes: includes
|
|
554
567
|
} : {
|
|
555
568
|
bounds: bounds,
|
|
@@ -557,12 +570,16 @@ class Renderer {
|
|
|
557
570
|
};
|
|
558
571
|
if (this.needFill) canvas.fillWorld(bounds, this.config.fill);
|
|
559
572
|
if (core.Debug.showRepaint) core.Debug.drawRepaint(canvas, bounds);
|
|
560
|
-
|
|
573
|
+
if (this.config.useCellRender) options.cellList = this.getCellList();
|
|
574
|
+
core.Platform.render(target, canvas, options);
|
|
561
575
|
this.renderBounds = realBounds = realBounds || bounds;
|
|
562
576
|
this.renderOptions = options;
|
|
563
577
|
this.totalBounds.isEmpty() ? this.totalBounds = realBounds : this.totalBounds.add(realBounds);
|
|
564
578
|
canvas.updateRender(realBounds);
|
|
565
579
|
}
|
|
580
|
+
getCellList() {
|
|
581
|
+
return undefined;
|
|
582
|
+
}
|
|
566
583
|
addBlock(block) {
|
|
567
584
|
if (!this.updateBlocks) this.updateBlocks = [];
|
|
568
585
|
this.updateBlocks.push(block);
|
|
@@ -962,6 +979,7 @@ function getLeafPaint(attrName, paint, ui) {
|
|
|
962
979
|
const {boxBounds: boxBounds} = ui.__layout;
|
|
963
980
|
switch (paint.type) {
|
|
964
981
|
case "image":
|
|
982
|
+
if (!paint.url) return undefined;
|
|
965
983
|
leafPaint = draw.PaintImage.image(ui, attrName, paint, boxBounds, !recycleMap || !recycleMap[paint.url]);
|
|
966
984
|
break;
|
|
967
985
|
|
|
@@ -1399,7 +1417,7 @@ function checkImage(paint, drawImage, ui, canvas, renderOptions) {
|
|
|
1399
1417
|
if (data.repeat) {
|
|
1400
1418
|
drawImage = false;
|
|
1401
1419
|
} else if (!(originPaint.changeful || core.Platform.name === "miniapp" && core.ResizeEvent.isResizing(ui) || exporting)) {
|
|
1402
|
-
drawImage = core.Platform.image.isLarge(image, scaleX, scaleY);
|
|
1420
|
+
drawImage = core.Platform.image.isLarge(image, scaleX, scaleY) || image.width * scaleX > 8096 || image.height * scaleY > 8096;
|
|
1403
1421
|
}
|
|
1404
1422
|
}
|
|
1405
1423
|
if (drawImage) {
|
|
@@ -1458,7 +1476,7 @@ function recycleImage(attrName, data) {
|
|
|
1458
1476
|
if (url) {
|
|
1459
1477
|
if (!recycleMap) recycleMap = {};
|
|
1460
1478
|
recycleMap[url] = true;
|
|
1461
|
-
core.ImageManager.
|
|
1479
|
+
core.ImageManager.recyclePaint(paint);
|
|
1462
1480
|
if (image.loading) {
|
|
1463
1481
|
if (!input) {
|
|
1464
1482
|
input = data.__input && data.__input[attrName] || [];
|
package/dist/worker.esm.js
CHANGED
|
@@ -8,6 +8,15 @@ import { Paint, PaintImage, ColorConvert, PaintGradient, Effect, Group, TextConv
|
|
|
8
8
|
|
|
9
9
|
export * from "@leafer-ui/draw";
|
|
10
10
|
|
|
11
|
+
var PathNodeHandleType;
|
|
12
|
+
|
|
13
|
+
(function(PathNodeHandleType) {
|
|
14
|
+
PathNodeHandleType[PathNodeHandleType["none"] = 1] = "none";
|
|
15
|
+
PathNodeHandleType[PathNodeHandleType["free"] = 2] = "free";
|
|
16
|
+
PathNodeHandleType[PathNodeHandleType["mirrorAngle"] = 3] = "mirrorAngle";
|
|
17
|
+
PathNodeHandleType[PathNodeHandleType["mirror"] = 4] = "mirror";
|
|
18
|
+
})(PathNodeHandleType || (PathNodeHandleType = {}));
|
|
19
|
+
|
|
11
20
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
12
21
|
get allowBackgroundColor() {
|
|
13
22
|
return true;
|
|
@@ -123,7 +132,7 @@ class Watcher {
|
|
|
123
132
|
return this.hasAdd || this.hasRemove || this.hasVisible;
|
|
124
133
|
}
|
|
125
134
|
get updatedList() {
|
|
126
|
-
if (this.hasRemove) {
|
|
135
|
+
if (this.hasRemove && this.config.usePartLayout) {
|
|
127
136
|
const updatedList = new LeafList;
|
|
128
137
|
this.__updatedList.list.forEach(item => {
|
|
129
138
|
if (item.leafer) updatedList.add(item);
|
|
@@ -158,16 +167,18 @@ class Watcher {
|
|
|
158
167
|
if (this.running) this.target.emit(RenderEvent.REQUEST);
|
|
159
168
|
}
|
|
160
169
|
__onAttrChange(event) {
|
|
161
|
-
this.__updatedList.add(event.target);
|
|
170
|
+
if (this.config.usePartLayout) this.__updatedList.add(event.target);
|
|
162
171
|
this.update();
|
|
163
172
|
}
|
|
164
173
|
__onChildEvent(event) {
|
|
165
|
-
if (
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
174
|
+
if (this.config.usePartLayout) {
|
|
175
|
+
if (event.type === ChildEvent.ADD) {
|
|
176
|
+
this.hasAdd = true;
|
|
177
|
+
this.__pushChild(event.child);
|
|
178
|
+
} else {
|
|
179
|
+
this.hasRemove = true;
|
|
180
|
+
this.__updatedList.add(event.parent);
|
|
181
|
+
}
|
|
171
182
|
}
|
|
172
183
|
this.update();
|
|
173
184
|
}
|
|
@@ -284,7 +295,9 @@ const debug$1 = Debug.get("Layouter");
|
|
|
284
295
|
class Layouter {
|
|
285
296
|
constructor(target, userConfig) {
|
|
286
297
|
this.totalTimes = 0;
|
|
287
|
-
this.config = {
|
|
298
|
+
this.config = {
|
|
299
|
+
usePartLayout: true
|
|
300
|
+
};
|
|
288
301
|
this.__levelList = new LeafLevelList;
|
|
289
302
|
this.target = target;
|
|
290
303
|
if (userConfig) this.config = DataHelper.default(userConfig, this.config);
|
|
@@ -329,7 +342,7 @@ class Layouter {
|
|
|
329
342
|
this.totalTimes++;
|
|
330
343
|
this.layouting = true;
|
|
331
344
|
this.target.emit(WatchEvent.REQUEST);
|
|
332
|
-
if (this.totalTimes > 1) {
|
|
345
|
+
if (this.totalTimes > 1 && this.config.usePartLayout) {
|
|
333
346
|
this.partLayout();
|
|
334
347
|
} else {
|
|
335
348
|
this.fullLayout();
|
|
@@ -446,7 +459,7 @@ class Renderer {
|
|
|
446
459
|
}
|
|
447
460
|
update(change = true) {
|
|
448
461
|
if (!this.changed) this.changed = change;
|
|
449
|
-
this.__requestRender();
|
|
462
|
+
if (!this.requestTime) this.__requestRender();
|
|
450
463
|
}
|
|
451
464
|
requestLayout() {
|
|
452
465
|
this.target.emit(LayoutEvent.REQUEST);
|
|
@@ -553,7 +566,7 @@ class Renderer {
|
|
|
553
566
|
Run.end(t);
|
|
554
567
|
}
|
|
555
568
|
__render(bounds, realBounds) {
|
|
556
|
-
const {canvas: canvas} = this, includes = bounds.includes(
|
|
569
|
+
const {canvas: canvas, target: target} = this, includes = bounds.includes(target.__world), options = includes ? {
|
|
557
570
|
includes: includes
|
|
558
571
|
} : {
|
|
559
572
|
bounds: bounds,
|
|
@@ -561,12 +574,16 @@ class Renderer {
|
|
|
561
574
|
};
|
|
562
575
|
if (this.needFill) canvas.fillWorld(bounds, this.config.fill);
|
|
563
576
|
if (Debug.showRepaint) Debug.drawRepaint(canvas, bounds);
|
|
564
|
-
|
|
577
|
+
if (this.config.useCellRender) options.cellList = this.getCellList();
|
|
578
|
+
Platform.render(target, canvas, options);
|
|
565
579
|
this.renderBounds = realBounds = realBounds || bounds;
|
|
566
580
|
this.renderOptions = options;
|
|
567
581
|
this.totalBounds.isEmpty() ? this.totalBounds = realBounds : this.totalBounds.add(realBounds);
|
|
568
582
|
canvas.updateRender(realBounds);
|
|
569
583
|
}
|
|
584
|
+
getCellList() {
|
|
585
|
+
return undefined;
|
|
586
|
+
}
|
|
570
587
|
addBlock(block) {
|
|
571
588
|
if (!this.updateBlocks) this.updateBlocks = [];
|
|
572
589
|
this.updateBlocks.push(block);
|
|
@@ -966,6 +983,7 @@ function getLeafPaint(attrName, paint, ui) {
|
|
|
966
983
|
const {boxBounds: boxBounds} = ui.__layout;
|
|
967
984
|
switch (paint.type) {
|
|
968
985
|
case "image":
|
|
986
|
+
if (!paint.url) return undefined;
|
|
969
987
|
leafPaint = PaintImage.image(ui, attrName, paint, boxBounds, !recycleMap || !recycleMap[paint.url]);
|
|
970
988
|
break;
|
|
971
989
|
|
|
@@ -1403,7 +1421,7 @@ function checkImage(paint, drawImage, ui, canvas, renderOptions) {
|
|
|
1403
1421
|
if (data.repeat) {
|
|
1404
1422
|
drawImage = false;
|
|
1405
1423
|
} else if (!(originPaint.changeful || Platform.name === "miniapp" && ResizeEvent.isResizing(ui) || exporting)) {
|
|
1406
|
-
drawImage = Platform.image.isLarge(image, scaleX, scaleY);
|
|
1424
|
+
drawImage = Platform.image.isLarge(image, scaleX, scaleY) || image.width * scaleX > 8096 || image.height * scaleY > 8096;
|
|
1407
1425
|
}
|
|
1408
1426
|
}
|
|
1409
1427
|
if (drawImage) {
|
|
@@ -1462,7 +1480,7 @@ function recycleImage(attrName, data) {
|
|
|
1462
1480
|
if (url) {
|
|
1463
1481
|
if (!recycleMap) recycleMap = {};
|
|
1464
1482
|
recycleMap[url] = true;
|
|
1465
|
-
ImageManager.
|
|
1483
|
+
ImageManager.recyclePaint(paint);
|
|
1466
1484
|
if (image.loading) {
|
|
1467
1485
|
if (!input) {
|
|
1468
1486
|
input = data.__input && data.__input[attrName] || [];
|
|
@@ -2372,4 +2390,4 @@ Object.assign(Effect, EffectModule);
|
|
|
2372
2390
|
|
|
2373
2391
|
useCanvas();
|
|
2374
2392
|
|
|
2375
|
-
export { Layouter, LeaferCanvas, Renderer, Watcher, useCanvas };
|
|
2393
|
+
export { Layouter, LeaferCanvas, PathNodeHandleType, Renderer, Watcher, useCanvas };
|
package/dist/worker.esm.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{LeaferCanvasBase as t,Platform as e,canvasPatch as a,FileHelper as s,Creator as i,LeaferImage as n,defineKey as r,LeafList as o,DataHelper as l,RenderEvent as d,ChildEvent as c,WatchEvent as h,PropertyEvent as u,LeafHelper as f,BranchHelper as g,LeafBoundsHelper as p,Bounds as _,isArray as w,Debug as m,LeafLevelList as y,LayoutEvent as x,Run as v,ImageManager as S,ResizeEvent as b,isObject as k,BoundsHelper as B,FourNumberHelper as R,Matrix as E,isUndefined as T,isString as A,ImageEvent as L,MatrixHelper as O,MathHelper as W,AlignHelper as M,PointHelper as P,getMatrixData as C,AroundHelper as D,Direction4 as I,isNumber as F}from"@leafer/core";export*from"@leafer/core";export{LeaferImage}from"@leafer/core";import{Paint as Y,PaintImage as X,ColorConvert as U,PaintGradient as G,Effect as z,Group as q,TextConvert as N}from"@leafer-ui/draw";export*from"@leafer-ui/draw";class j 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:a}=this;this.view.width=Math.ceil(t*a),this.view.height=Math.ceil(e*a),this.clientBounds=this.bounds}}a(OffscreenCanvasRenderingContext2D.prototype),a(Path2D.prototype);const{mineType:H}=s;function V(t,a){e.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,a)=>new Promise((s,i)=>{t.convertToBlob({type:H(e),quality:a}).then(t=>{var e=new FileReader;e.onload=t=>s(t.target.result),e.onerror=t=>i(t),e.readAsDataURL(t)}).catch(t=>{i(t)})}),canvasToBolb:(t,e,a)=>t.convertToBlob({type:H(e),quality:a}),canvasSaveAs:(t,e,a)=>new Promise(t=>t()),download(t,e){},loadImage:t=>new Promise((a,s)=>{let i=new XMLHttpRequest;i.open("GET",e.image.getRealURL(t),!0),i.responseType="blob",i.onload=()=>{createImageBitmap(i.response).then(t=>{a(t)}).catch(t=>{s(t)})},i.onerror=t=>s(t),i.send()})},e.canvas=i.canvas(),e.conicGradientSupport=!!e.canvas.context.createConicGradient}Object.assign(i,{canvas:(t,e)=>new j(t,e),image:t=>new n(t)}),e.name="web",e.isWorker=!0,e.backgrounder=!0,e.requestRender=function(t){requestAnimationFrame(t)},r(e,"devicePixelRatio",{get:()=>1});const{userAgent:Q}=navigator;Q.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),Q.indexOf("Windows")>-1?(e.os="Windows",e.intWheelDeltaY=!0):Q.indexOf("Mac")>-1?e.os="Mac":Q.indexOf("Linux")>-1&&(e.os="Linux");class Z{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===c.ADD?(this.hasAdd=!0,this.__pushChild(t.child)):(this.hasRemove=!0,this.__updatedList.add(t.parent)),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,a=e.length;t<a;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new h(h.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],[[c.ADD,c.REMOVE],this.__onChildEvent,this],[h.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:$,updateBounds:J,updateChange:K}=f,{pushAllChildBranch:tt,pushAllParent:et}=g;const{worldBounds:at}=p;class st{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:it,updateAllChange:nt}=f,rt=m.get("Layouter");class ot{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new y,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){rt.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?rt.warn("layouting"):this.times>3?rt.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(h.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:a,__updatedList:s}=this,{BEFORE:i,LAYOUT:n,AFTER:r}=x,o=this.getBlocks(s);o.forEach(t=>t.setBefore()),a.emitEvent(new x(i,o,this.times)),this.extraBlock=null,s.sort(),function(t,e){let a;t.list.forEach(t=>{a=t.__layout,e.without(t)&&!a.proxyZoom&&(a.matrixChanged?($(t,!0),e.add(t),t.isBranch&&tt(t,e),et(t,e)):a.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),et(t,e)))})}(s,this.__levelList),function(t){let e,a,s;t.sort(!0),t.levels.forEach(i=>{e=t.levelMap[i];for(let t=0,i=e.length;t<i;t++){if(a=e[t],a.isBranch&&a.__tempNumber){s=a.children;for(let t=0,e=s.length;t<e;t++)s[t].isBranch||J(s[t])}J(a)}})}(this.__levelList),function(t){t.list.forEach(K)}(s),this.extraBlock&&o.push(this.extraBlock),o.forEach(t=>t.setAfter()),a.emitEvent(new x(n,o,this.times)),a.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:a,LAYOUT:s,AFTER:i}=x,n=this.getBlocks(new o(e));e.emitEvent(new x(a,n,this.times)),ot.fullLayout(e),n.forEach(t=>{t.setAfter()}),e.emitEvent(new x(s,n,this.times)),e.emitEvent(new x(i,n,this.times)),this.addBlocks(n),v.end(t)}static fullLayout(t){it(t,!0),t.isBranch?g.updateBounds(t):f.updateBounds(t),nt(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:a}=this.extraBlock||(this.extraBlock=new st([]));e.length?a.add(t.__world):a.set(t.__world),e.add(t)}}createBlock(t){return new st(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],[h.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const lt=m.get("Renderer");class dt{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,a){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=e,a&&(this.config=l.default(a,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 _,lt.log(e.innerName,"---\x3e");try{this.emitRender(d.START),this.renderOnce(t),this.emitRender(d.END,this.totalBounds),S.clearRecycled()}catch(t){this.rendering=!1,lt.error(t)}lt.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return lt.warn("rendering");if(this.times>3)return lt.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:a}=this,s=t.getIntersect(a.bounds),i=new _(s);a.save(),s.spread(dt.clipSpread).ceil(),a.clearWorld(s),a.clipWorld(s),this.__render(s,i),a.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,a){const{canvas:s}=this,i=t.includes(this.target.__world),n=i?{includes:i}:{bounds:t,includes:i};this.needFill&&s.fillWorld(t,this.config.fill),m.showRepaint&&m.drawRepaint(s,t),e.render(this.target,s,n),this.renderBounds=a=a||t,this.renderOptions=n,this.totalBounds.isEmpty()?this.totalBounds=a:this.totalBounds.add(a),s.updateRender(a)}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 a=()=>{const t=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:s}=this.config;if(s&&t>s)return e.requestRender(a);const{frames:i}=this;i.length>30&&i.shift(),i.push(t),this.FPS=Math.round(i.reduce((t,e)=>t+e,0)/i.length),this.requestTime=0,this.checkRender()};e.requestRender(a)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:a}=t.old;if(!new _(0,0,e,a).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||lt.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(t,e,a){this.target.emitEvent(new d(t,this.times,e,a))}__listenEvents(){this.__eventIds=[this.target.on_([[d.REQUEST,this.update,this],[x.END,this.__onLayoutEnd,this],[d.AGAIN,this.renderAgain,this],[b.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}function ct(t,e,a){t.__.__font?Y.fillText(t,e,a):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function ht(t,e,a,s,i){const n=a.__;k(t)?Y.drawStrokesStyle(t,e,!1,a,s,i):(s.setStroke(t,n.__strokeWidth*e,n),s.stroke()),n.__useArrow&&Y.strokeArrow(t,a,s,i)}function ut(t,e,a,s,i){const n=a.__;k(t)?Y.drawStrokesStyle(t,e,!0,a,s,i):(s.setStroke(t,n.__strokeWidth*e,n),Y.drawTextStroke(a,s,i))}function ft(t,e,a,s,i){const n=s.getSameCanvas(!0,!0);n.font=a.__.__font,ut(t,2,a,n,i),n.blendMode="outside"===e?"destination-out":"destination-in",Y.fillText(a,n,i),n.blendMode="normal",f.copyCanvasByWorld(a,s,n),n.recycle(a.__nowWorld)}dt.clipSpread=10,Object.assign(i,{watcher:(t,e)=>new Z(t,e),layouter:(t,e)=>new ot(t,e),renderer:(t,e,a)=>new dt(t,e,a),selector:(t,e)=>{},interaction:(t,e,a,s)=>{}}),e.layout=ot.fullLayout,e.render=function(t,e,a){const s=Object.assign(Object.assign({},a),{topRendering:!0});a.topList=new o,t.__render(e,a),a.topList.length&&a.topList.forEach(t=>t.__render(e,s))};const{getSpread:gt,copyAndSpread:pt,toOuterOf:_t,getOuterOf:wt,getByMove:mt,move:yt,getIntersectData:xt}=B,vt={};let St;const{stintSet:bt}=l,{hasTransparent:kt}=U;function Bt(t,e,a){if(!k(e)||!1===e.visible||0===e.opacity)return;let s;const{boxBounds:i}=a.__layout;switch(e.type){case"image":s=X.image(a,t,e,i,!St||!St[e.url]);break;case"linear":s=G.linearGradient(e,i);break;case"radial":s=G.radialGradient(e,i);break;case"angular":s=G.conicGradient(e,i);break;case"solid":const{type:n,color:r,opacity:o}=e;s={type:n,style:U.string(r,o)};break;default:T(e.r)||(s={type:"solid",style:U.string(e)})}if(s&&(s.originPaint=e,A(s.style)&&kt(s.style)&&(s.isTransparent=!0),e.style)){if(0===e.style.strokeWidth)return;s.strokeStyle=e.style}return s}const Rt={compute:function(t,e){const a=e.__,s=[];let i,n,r,o=a.__input[t];w(o)||(o=[o]),St=X.recycleImage(t,a);for(let a,i=0,n=o.length;i<n;i++)(a=Bt(t,o[i],e))&&(s.push(a),a.strokeStyle&&(r||(r=1),a.strokeStyle.strokeWidth&&(r=Math.max(r,a.strokeStyle.strokeWidth))));a["_"+t]=s.length?s:void 0,s.length?(s.every(t=>t.isTransparent)&&(s.some(t=>t.image)&&(i=!0),n=!0),"fill"===t?(bt(a,"__isAlphaPixelFill",i),bt(a,"__isTransparentFill",n)):(bt(a,"__isAlphaPixelStroke",i),bt(a,"__isTransparentStroke",n),bt(a,"__hasMultiStrokeStyle",r))):a.__removePaint(t,!1)},fill:function(t,e,a,s){a.fillStyle=t,ct(e,a,s)},fills:function(t,e,a,s){let i,n,r;for(let o=0,l=t.length;o<l;o++){if(i=t[o],n=i.originPaint,i.image){if(r?r++:r=1,X.checkImage(i,!e.__.__font,e,a,s))continue;if(!i.style){1===r&&i.image.isPlacehold&&e.drawImagePlaceholder(i,a,s);continue}}if(a.fillStyle=i.style,i.transform||n.scaleFixed){if(a.save(),i.transform&&a.transform(i.transform),n.scaleFixed){const{scaleX:t,scaleY:s}=e.getRenderScaleData(!0);(!0===n.scaleFixed||"zoom-in"===n.scaleFixed&&t>1&&s>1)&&a.scale(1/t,1/s)}n.blendMode&&(a.blendMode=n.blendMode),ct(e,a,s),a.restore()}else n.blendMode?(a.saveBlendMode(n.blendMode),ct(e,a,s),a.restoreBlendMode()):ct(e,a,s)}},fillPathOrText:ct,fillText:function(t,e,a){const s=t.__,{rows:i,decorationY:n}=s.__textDrawData;let r;s.__isPlacehold&&s.placeholderColor&&(e.fillStyle=s.placeholderColor);for(let t=0,a=i.length;t<a;t++)r=i[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(n){const{decorationColor:t,decorationHeight:a}=s.__textDrawData;t&&(e.fillStyle=t),i.forEach(t=>n.forEach(s=>e.fillRect(t.x,t.y+s,t.width,a)))}},stroke:function(t,e,a,s){const i=e.__;if(i.__strokeWidth)if(i.__font)Y.strokeText(t,e,a,s);else switch(i.strokeAlign){case"center":ht(t,1,e,a,s);break;case"inside":!function(t,e,a,s){a.save(),a.clipUI(e),ht(t,2,e,a,s),a.restore()}(t,e,a,s);break;case"outside":!function(t,e,a,s){const i=e.__;if(i.__fillAfterStroke)ht(t,2,e,a,s);else{const{renderBounds:n}=e.__layout,r=a.getSameCanvas(!0,!0);e.__drawRenderPath(r),ht(t,2,e,r,s),r.clipUI(i),r.clearWorld(n),f.copyCanvasByWorld(e,a,r),r.recycle(e.__nowWorld)}}(t,e,a,s)}},strokes:function(t,e,a,s){Y.stroke(t,e,a,s)},strokeText:function(t,e,a,s){switch(e.__.strokeAlign){case"center":ut(t,1,e,a,s);break;case"inside":ft(t,"inside",e,a,s);break;case"outside":e.__.__fillAfterStroke?ut(t,2,e,a,s):ft(t,"outside",e,a,s)}},drawTextStroke:function(t,e,a){let s,i=t.__.__textDrawData;const{rows:n,decorationY:r}=i;for(let t=0,a=n.length;t<a;t++)s=n[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}=i;n.forEach(a=>r.forEach(s=>e.strokeRect(a.x,a.y+s,a.width,t)))}},drawStrokesStyle:function(t,e,a,s,i,n){let r;const o=s.__,{__hasMultiStrokeStyle:l}=o;l||i.setStroke(void 0,o.__strokeWidth*e,o);for(let d=0,c=t.length;d<c;d++)if(r=t[d],(!r.image||!X.checkImage(r,!1,s,i,n))&&r.style){if(l){const{strokeStyle:t}=r;t?i.setStroke(r.style,o.__getRealStrokeWidth(t)*e,o,t):i.setStroke(r.style,o.__strokeWidth*e,o)}else i.strokeStyle=r.style;r.originPaint.blendMode?(i.saveBlendMode(r.originPaint.blendMode),a?Y.drawTextStroke(s,i,n):i.stroke(),i.restoreBlendMode()):a?Y.drawTextStroke(s,i,n):i.stroke()}},shape:function(t,a,s){const i=a.getSameCanvas(),n=a.bounds,r=t.__nowWorld,o=t.__layout,l=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let d,c,h,u,f,g;_t(o.strokeSpread?(pt(vt,o.boxBounds,o.strokeSpread),vt):o.boxBounds,r,l);let{scaleX:p,scaleY:_}=t.getRenderScaleData(!0);if(n.includes(l))g=i,d=f=l,c=r;else{let i;if(e.fullImageShadow)i=l;else{const t=o.renderShapeSpread?gt(n,R.swapAndScale(o.renderShapeSpread,p,_)):n;i=xt(t,l)}u=n.getFitMatrix(i);let{a:w,d:m}=u;u.a<1&&(g=a.getSameCanvas(),t.__renderShape(g,s),p*=w,_*=m),f=wt(l,u),d=mt(f,-u.e,-u.f),c=wt(r,u),yt(c,-u.e,-u.f);const y=s.matrix;y?(h=new E(u),h.multiply(y),w*=y.scaleX,m*=y.scaleY):h=u,h.withScale(w,m),s=Object.assign(Object.assign({},s),{matrix:h})}return t.__renderShape(i,s),{canvas:i,matrix:h,fitMatrix:u,bounds:d,renderBounds:c,worldCanvas:g,shapeBounds:f,scaleX:p,scaleY:_}}};let Et,Tt=new _;const{isSame:At}=B;function Lt(t,e,a,s,i,n){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 i.data||X.createData(i,s,a,n),!0}function Ot(t,e){Pt(t,L.LOAD,e)}function Wt(t,e){Pt(t,L.LOADED,e)}function Mt(t,e,a){e.error=a,t.forceUpdate("surface"),Pt(t,L.ERROR,e)}function Pt(t,e,a){t.hasEvent(e)&&t.emitEvent(new L(e,a))}function Ct(t,e){const{leafer:a}=t;a&&a.viewReady&&(a.renderer.ignore=e)}const{get:Dt,translate:It}=O,Ft=new _,Yt={},Xt={};function Ut(t,e,a,s){const i=A(t)||s?(s?a-s*e:a%e)/((s||Math.floor(a/e))-1):t;return"auto"===t&&i<0?0:i}let Gt={},zt=C();const{get:qt,set:Nt,rotateOfOuter:jt,translate:Ht,scaleOfOuter:Vt,multiplyParent:Qt,scale:Zt,rotate:$t,skew:Jt}=O;function Kt(t,e,a,s,i,n,r,o){r&&$t(t,r),o&&Jt(t,o.x,o.y),i&&Zt(t,i,n),Ht(t,e.x+a,e.y+s)}function te(t,e,a,s){return new(a||(a=Promise))(function(i,n){function r(t){try{l(s.next(t))}catch(t){n(t)}}function o(t){try{l(s.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof a?e:new a(function(t){t(e)})).then(r,o)}l((s=s.apply(t,e||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const{get:ee,scale:ae,copy:se}=O,{getFloorScale:ie}=W,{abs:ne}=Math;const re={image:function(t,e,a,s,i){let n,r;const o=S.get(a);return Et&&a===Et.paint&&At(s,Et.boxBounds)?n=Et.leafPaint:(n={type:a.type,image:o},o.hasAlphaPixel&&(n.isTransparent=!0),Et=o.use>1?{leafPaint:n,paint:a,boxBounds:Tt.set(s)}:null),(i||o.loading)&&(r={image:o,attrName:e,attrValue:a}),o.ready?(Lt(t,e,a,o,n,s),i&&(Ot(t,r),Wt(t,r))):o.error?i&&Mt(t,r,o.error):(i&&(Ct(t,!0),Ot(t,r)),n.loadId=o.load(()=>{Ct(t,!1),t.destroyed||(Lt(t,e,a,o,n,s)&&(o.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),Wt(t,r)),n.loadId=void 0},e=>{Ct(t,!1),Mt(t,r,e),n.loadId=void 0}),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{o.ready||(o.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):o.isPlacehold=!0)),n},checkImage:function(t,a,s,i,n){const{scaleX:r,scaleY:o}=X.getImageRenderScaleData(t,s,i,n),{image:l,data:d,originPaint:c}=t,{exporting:h}=n;return!(!d||t.patternId===r+"-"+o&&!h)&&(a&&(d.repeat?a=!1:c.changeful||"miniapp"===e.name&&b.isResizing(s)||h||(a=e.image.isLarge(l,r,o))),a?(s.__.__isFastShadow&&(i.fillStyle=t.style||"#000",i.fill()),X.drawImage(t,r,o,s,i,n),!0):(!t.style||c.sync||h?X.createPattern(t,s,i,n):X.createPatternTask(t,s,i,n),!1))},drawImage:function(t,e,a,s,i,n){const{data:r,image:o}=t,{blendMode:l}=t.originPaint,{opacity:d,transform:c}=r,h=o.getFull(r.filters),u=s.__;let f,{width:g,height:p}=o;(f=c&&!c.onlyScale||u.path||u.cornerRadius)||d||l?(i.save(),f&&i.clipUI(s),l&&(i.blendMode=l),d&&(i.opacity*=d),c&&i.transform(c),i.drawImage(h,0,0,g,p),i.restore()):(r.scaleX&&(g*=r.scaleX,p*=r.scaleY),i.drawImage(h,0,0,g,p))},getImageRenderScaleData:function(t,e,a,s){const i=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:n}=t;if(a){const{pixelRatio:t}=a;i.scaleX*=t,i.scaleY*=t}return n&&n.scaleX&&(i.scaleX*=Math.abs(n.scaleX),i.scaleY*=Math.abs(n.scaleY)),i},recycleImage:function(t,e){const a=e["_"+t];if(w(a)){let s,i,n,r,o;for(let l=0,d=a.length;l<d;l++)s=a[l],i=s.image,o=i&&i.url,o&&(n||(n={}),n[o]=!0,S.recycle(i),i.loading&&(r||(r=e.__input&&e.__input[t]||[],w(r)||(r=[r])),i.unload(a[l].loadId,!r.some(t=>t.url===o))));return n}return null},createPatternTask:function(t,e,a,s){t.patternTask||(t.patternTask=S.patternTasker.add(()=>te(this,void 0,void 0,function*(){t.patternTask=null,a.bounds.hit(e.__nowWorld)&&X.createPattern(t,e,a,s),e.forceUpdate("surface")}),300))},createPattern:function(t,a,s,i){let{scaleX:n,scaleY:r}=X.getImageRenderScaleData(t,a,s,i),o=n+"-"+r;if(t.patternId!==o&&!a.destroyed&&(!e.image.isLarge(t.image,n,r)||t.data.repeat)){const{image:s,data:i}=t,{transform:l,gap:d}=i,c=X.getPatternFixScale(t,n,r);let h,u,f,{width:g,height:p}=s;c&&(n*=c,r*=c),g*=n,p*=r,d&&(u=d.x*n/ne(i.scaleX||1),f=d.y*r/ne(i.scaleY||1)),(l||1!==n||1!==r)&&(n*=ie(g+(u||0)),r*=ie(p+(f||0)),h=ee(),l&&se(h,l),ae(h,1/n,1/r));const _=s.getCanvas(g,p,i.opacity,i.filters,u,f,a.leafer&&a.leafer.config.smooth),w=s.getPattern(_,i.repeat||e.origin.noRepeat||"no-repeat",h,t);t.style=w,t.patternId=o}},getPatternFixScale:function(t,a,s){const{image:i}=t;let n,r=e.image.maxPatternSize,o=i.width*i.height;return i.isSVG?a>1&&(n=Math.ceil(a)/a):r>o&&(r=o),(o*=a*s)>r&&(n=Math.sqrt(r/o)),n},createData:function(t,e,a,s){t.data=X.getPatternData(a,s,e)},getPatternData:function(t,e,a){t.padding&&(e=Ft.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:s,height:i}=a,{opacity:n,mode:r,align:o,offset:l,scale:d,size:c,rotation:h,skew:u,clipSize:f,repeat:g,gap:p,filters:_}=t,w=e.width===s&&e.height===i,m={mode:r},y="center"!==o&&(h||0)%180==90;let x,v;switch(B.set(Xt,0,0,y?i:s,y?s:i),r&&"cover"!==r&&"fit"!==r?((d||c)&&(W.getScaleData(d,c,a,Yt),x=Yt.scaleX,v=Yt.scaleY),(o||p||g)&&(x&&B.scale(Xt,x,v,!0),o&&M.toPoint(o,Xt,e,Xt,!0,!0))):w&&!h||(x=v=B.getFitScale(e,Xt,"fit"!==r),B.put(e,a,o,x,!1,Xt),B.scale(Xt,x,v,!0)),l&&P.move(Xt,l),r){case"stretch":w?x&&(x=v=void 0):(x=e.width/s,v=e.height/i,X.stretchMode(m,e,x,v));break;case"normal":case"clip":if(Xt.x||Xt.y||x||f||h||u){let t,a;f&&(t=e.width/f.width,a=e.height/f.height),X.clipMode(m,e,Xt.x,Xt.y,x,v,h,u,t,a),t&&(x=x?x*t:t,v=v?v*a:a)}break;case"repeat":(!w||x||h||u)&&X.repeatMode(m,e,s,i,Xt.x,Xt.y,x,v,h,u,o,t.freeTransform),g||(m.repeat="repeat");const a=k(g);(p||a)&&(m.gap=function(t,e,a,s,i){let n,r;k(t)?(n=t.x,r=t.y):n=r=t;return{x:Ut(n,a,i.width,e&&e.x),y:Ut(r,s,i.height,e&&e.y)}}(p,a&&g,Xt.width,Xt.height,e));break;default:x&&X.fillOrFitMode(m,e,Xt.x,Xt.y,x,v,h)}return m.transform||(e.x||e.y)&&It(m.transform=Dt(),e.x,e.y),x&&(m.scaleX=x,m.scaleY=v),n&&n<1&&(m.opacity=n),_&&(m.filters=_),g&&(m.repeat=A(g)?"x"===g?"repeat-x":"repeat-y":"repeat"),m},stretchMode:function(t,e,a,s){const i=qt(),{x:n,y:r}=e;n||r?Ht(i,n,r):i.onlyScale=!0,Zt(i,a,s),t.transform=i},fillOrFitMode:function(t,e,a,s,i,n,r){const o=qt();Ht(o,e.x+a,e.y+s),Zt(o,i,n),r&&jt(o,{x:e.x+e.width/2,y:e.y+e.height/2},r),t.transform=o},clipMode:function(t,e,a,s,i,n,r,o,l,d){const c=qt();Kt(c,e,a,s,i,n,r,o),l&&(r||o?(Nt(zt),Vt(zt,e,l,d),Qt(c,zt)):Vt(c,e,l,d)),t.transform=c},repeatMode:function(t,e,a,s,i,n,r,o,l,d,c,h){const u=qt();if(h)Kt(u,e,i,n,r,o,l,d);else{if(l)if("center"===c)jt(u,{x:a/2,y:s/2},l);else switch($t(u,l),l){case 90:Ht(u,s,0);break;case 180:Ht(u,a,s);break;case 270:Ht(u,0,a)}Gt.x=e.x+i,Gt.y=e.y+n,Ht(u,Gt.x,Gt.y),r&&Vt(u,Gt,r,o)}t.transform=u}},{toPoint:oe}=D,{hasTransparent:le}=U,de={},ce={};function he(t,e,a,s){if(a){let i,n,r,o;for(let t=0,l=a.length;t<l;t++)i=a[t],A(i)?(r=t/(l-1),n=U.string(i,s)):(r=i.offset,n=U.string(i.color,s)),e.addColorStop(r,n),!o&&le(n)&&(o=!0);o&&(t.isTransparent=!0)}}const{getAngle:ue,getDistance:fe}=P,{get:ge,rotateOfOuter:pe,scaleOfOuter:_e}=O,{toPoint:we}=D,me={},ye={};function xe(t,e,a,s,i){let n;const{width:r,height:o}=t;if(r!==o||s){const t=ue(e,a);n=ge(),i?(_e(n,e,r/o*(s||1),1),pe(n,e,t+90)):(_e(n,e,1,r/o*(s||1)),pe(n,e,t))}return n}const{getDistance:ve}=P,{toPoint:Se}=D,be={},ke={};const Be={linearGradient:function(t,a){let{from:s,to:i,type:n,opacity:r}=t;oe(s||"top",a,de),oe(i||"bottom",a,ce);const o=e.canvas.createLinearGradient(de.x,de.y,ce.x,ce.y),l={type:n,style:o};return he(l,o,t.stops,r),l},radialGradient:function(t,a){let{from:s,to:i,type:n,opacity:r,stretch:o}=t;we(s||"center",a,me),we(i||"bottom",a,ye);const l=e.canvas.createRadialGradient(me.x,me.y,0,me.x,me.y,fe(me,ye)),d={type:n,style:l};he(d,l,t.stops,r);const c=xe(a,me,ye,o,!0);return c&&(d.transform=c),d},conicGradient:function(t,a){let{from:s,to:i,type:n,opacity:r,stretch:o}=t;Se(s||"center",a,be),Se(i||"bottom",a,ke);const l=e.conicGradientSupport?e.canvas.createConicGradient(0,be.x,be.y):e.canvas.createRadialGradient(be.x,be.y,0,be.x,be.y,ve(be,ke)),d={type:n,style:l};he(d,l,t.stops,r);const c=xe(a,be,ke,o||1,e.conicGradientRotate90);return c&&(d.transform=c),d},getTransform:xe},{copy:Re,move:Ee,toOffsetOutBounds:Te}=B,{max:Ae,abs:Le}=Math,Oe={},We=new E,Me={};function Pe(t,e){let a,s,i,n,r=0,o=0,l=0,d=0;return e.forEach(t=>{a=t.x||0,s=t.y||0,n=1.5*(t.blur||0),i=Le(t.spread||0),r=Ae(r,i+n-s),o=Ae(o,i+n+a),l=Ae(l,i+n+s),d=Ae(d,i+n-a)}),r===o&&o===l&&l===d?r:[r,o,l,d]}function Ce(t,a,s){const{shapeBounds:i}=s;let n,r;e.fullImageShadow?(Re(Oe,t.bounds),Ee(Oe,a.x-i.x,a.y-i.y),n=t.bounds,r=Oe):(n=i,r=a),t.copyWorld(s.canvas,n,r)}const{toOffsetOutBounds:De}=B,Ie={};const Fe=Pe;const Ye={shadow:function(t,e,a){let s,i;const{__nowWorld:n}=t,{shadow:r}=t.__,{worldCanvas:o,bounds:l,renderBounds:d,shapeBounds:c,scaleX:h,scaleY:u}=a,g=e.getSameCanvas(),p=r.length-1;Te(l,Me,d),r.forEach((r,_)=>{let w=1;if(r.scaleFixed){const t=Math.abs(n.scaleX);t>1&&(w=1/t)}g.setWorldShadow(Me.offsetX+(r.x||0)*h*w,Me.offsetY+(r.y||0)*u*w,(r.blur||0)*h*w,U.string(r.color)),i=z.getShadowTransform(t,g,a,r,Me,w),i&&g.setTransform(i),Ce(g,Me,a),i&&g.resetTransform(),s=d,r.box&&(g.restore(),g.save(),o&&(g.copyWorld(g,d,n,"copy"),s=n),o?g.copyWorld(o,n,n,"destination-out"):g.copyWorld(a.canvas,c,l,"destination-out")),f.copyCanvasByWorld(t,e,g,s,r.blendMode),p&&_<p&&g.clearWorld(s)}),g.recycle(s)},innerShadow:function(t,e,a){let s,i;const{__nowWorld:n}=t,{innerShadow:r}=t.__,{worldCanvas:o,bounds:l,renderBounds:d,shapeBounds:c,scaleX:h,scaleY:u}=a,g=e.getSameCanvas(),p=r.length-1;De(l,Ie,d),r.forEach((r,_)=>{let w=1;if(r.scaleFixed){const t=Math.abs(n.scaleX);t>1&&(w=1/t)}g.save(),g.setWorldShadow(Ie.offsetX+(r.x||0)*h*w,Ie.offsetY+(r.y||0)*u*w,(r.blur||0)*h*w),i=z.getShadowTransform(t,g,a,r,Ie,w,!0),i&&g.setTransform(i),Ce(g,Ie,a),g.restore(),o?(g.copyWorld(g,d,n,"copy"),g.copyWorld(o,n,n,"source-out"),s=n):(g.copyWorld(a.canvas,c,l,"source-out"),s=d),g.fillWorld(s,U.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,a){const{blur:s}=t.__;a.setWorldBlur(s*t.__nowWorld.a),a.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),a.filter="none"},backgroundBlur:function(t,e,a){},getShadowRenderSpread:Pe,getShadowTransform:function(t,e,a,s,i,n,r){if(s.spread){const a=2*s.spread*n*(r?-1:1),{width:o,height:l}=t.__layout.strokeBounds;return We.set().scaleOfOuter({x:(i.x+i.width/2)*e.pixelRatio,y:(i.y+i.height/2)*e.pixelRatio},1+a/o,1+a/l),We}},isTransformShadow(t){},getInnerShadowSpread:Fe},{excludeRenderBounds:Xe}=p;let Ue;function Ge(t,e,a,s,i,n,r,o){switch(e){case"grayscale":Ue||(Ue=!0,i.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,a,s,i,n){const r=t.__nowWorld;a.resetTransform(),a.opacity=1,a.useMask(s,r),n&&s.recycle(r);qe(t,e,a,1,i,n)}(t,a,s,i,r,o);break;case"opacity-path":qe(t,a,s,n,r,o);break;case"path":o&&a.restore()}}function ze(t){return t.getSameCanvas(!1,!0)}function qe(t,e,a,s,i,n){const r=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(a,r,void 0,i),n?a.recycle(r):a.clearWorld(r)}q.prototype.__renderMask=function(t,e){let a,s,i,n,r,o;const{children:l}=this;for(let d=0,c=l.length;d<c;d++){if(a=l[d],o=a.__.mask,o){r&&(Ge(this,r,t,i,s,n,void 0,!0),s=i=null),"clipping"!==o&&"clipping-path"!==o||Xe(a,e)||a.__render(t,e),n=a.__.opacity,Ue=!1,"path"===o||"clipping-path"===o?(n<1?(r="opacity-path",i||(i=ze(t))):(r="path",t.save()),a.__clip(i||t,e)):(r="grayscale"===o?"grayscale":"alpha",s||(s=ze(t)),i||(i=ze(t)),a.__render(s,e));continue}const c=1===n&&a.__.__blendMode;c&&Ge(this,r,t,i,s,n,void 0,!1),Xe(a,e)||a.__render(i||t,e),c&&Ge(this,r,t,i,s,n,c,!1)}Ge(this,r,t,i,s,n,void 0,!0)};const Ne=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",je=Ne+"_#~&*+\\=|≮≯≈≠=…",He=new RegExp([[19968,40959],[13312,19903],[131072,173791],[173824,177983],[177984,178207],[178208,183983],[183984,191471],[196608,201551],[201552,205743],[11904,12031],[12032,12255],[12272,12287],[12288,12351],[12736,12783],[12800,13055],[13056,13311],[63744,64255],[65072,65103],[127488,127743],[194560,195103]].map(([t,e])=>`[\\u${t.toString(16)}-\\u${e.toString(16)}]`).join("|"));function Ve(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const Qe=Ve("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Ze=Ve("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),$e=Ve(Ne),Je=Ve(je),Ke=Ve("- —/~|┆·");var ta;!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"}(ta||(ta={}));const{Letter:ea,Single:aa,Before:sa,After:ia,Symbol:na,Break:ra}=ta;function oa(t){return Qe[t]?ea:Ke[t]?ra:Ze[t]?sa:$e[t]?ia:Je[t]?na:He.test(t)?aa:ea}const la={trimRight(t){const{words:e}=t;let a,s=0,i=e.length;for(let n=i-1;n>-1&&(a=e[n].data[0]," "===a.char);n--)s++,t.width-=a.width;s&&e.splice(i-s,s)}};function da(t,e,a){switch(e){case"title":return a?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:ca}=la,{Letter:ha,Single:ua,Before:fa,After:ga,Symbol:pa,Break:_a}=ta;let wa,ma,ya,xa,va,Sa,ba,ka,Ba,Ra,Ea,Ta,Aa,La,Oa,Wa,Ma,Pa=[];function Ca(t,e){Ba&&!ka&&(ka=Ba),wa.data.push({char:t,width:e}),ya+=e}function Da(){xa+=ya,wa.width=ya,ma.words.push(wa),wa={data:[]},ya=0}function Ia(){La&&(Oa.paraNumber++,ma.paraStart=!0,La=!1),Ba&&(ma.startCharSize=ka,ma.endCharSize=Ba,ka=0),ma.width=xa,Wa.width?ca(ma):Ma&&Fa(),Pa.push(ma),ma={words:[]},xa=0}function Fa(){xa>(Oa.maxWidth||0)&&(Oa.maxWidth=xa)}const{top:Ya,right:Xa,bottom:Ua,left:Ga}=I;function za(t,e,a){const{bounds:s,rows:i}=t;s[e]+=a;for(let t=0;t<i.length;t++)i[t][e]+=a}const qa={getDrawData:function(t,a){A(t)||(t=String(t));let s=0,i=0,n=a.__getInput("width")||0,r=a.__getInput("height")||0;const{__padding:o}=a;o&&(n?(s=o[Ga],n-=o[Xa]+o[Ga],!n&&(n=.01)):a.autoSizeAlign||(s=o[Ga]),r?(i=o[Ya],r-=o[Ya]+o[Ua],!r&&(r=.01)):a.autoSizeAlign||(i=o[Ya]));const l={bounds:{x:s,y:i,width:n,height:r},rows:[],paraNumber:0,font:e.canvas.font=a.__font};return function(t,a,s){Oa=t,Pa=t.rows,Wa=t.bounds,Ma=!Wa.width&&!s.autoSizeAlign;const{__letterSpacing:i,paraIndent:n,textCase:r}=s,{canvas:o}=e,{width:l}=Wa;if(s.__isCharMode){const t="none"!==s.textWrap,e="break"===s.textWrap;La=!0,Ea=null,ka=ba=Ba=ya=xa=0,wa={data:[]},ma={words:[]},i&&(a=[...a]);for(let s=0,d=a.length;s<d;s++)Sa=a[s],"\n"===Sa?(ya&&Da(),ma.paraEnd=!0,Ia(),La=!0):(Ra=oa(Sa),Ra===ha&&"none"!==r&&(Sa=da(Sa,r,!ya)),ba=o.measureText(Sa).width,i&&(i<0&&(Ba=ba),ba+=i),Ta=Ra===ua&&(Ea===ua||Ea===ha)||Ea===ua&&Ra!==ga,Aa=!(Ra!==fa&&Ra!==ua||Ea!==pa&&Ea!==ga),va=La&&n?l-n:l,t&&l&&xa+ya+ba>va&&(e?(ya&&Da(),xa&&Ia()):(Aa||(Aa=Ra===ha&&Ea==ga),Ta||Aa||Ra===_a||Ra===fa||Ra===ua||ya+ba>va?(ya&&Da(),xa&&Ia()):xa&&Ia()))," "===Sa&&!0!==La&&xa+ya===0||(Ra===_a?(" "===Sa&&ya&&Da(),Ca(Sa,ba),Da()):Ta||Aa?(ya&&Da(),Ca(Sa,ba)):Ca(Sa,ba)),Ea=Ra);ya&&Da(),xa&&Ia(),Pa.length>0&&(Pa[Pa.length-1].paraEnd=!0)}else a.split("\n").forEach(t=>{Oa.paraNumber++,xa=o.measureText(t).width,Pa.push({x:n||0,text:t,width:xa,paraStart:!0}),Ma&&Fa()})}(l,t,a),o&&function(t,e,a,s,i){if(!s&&a.autoSizeAlign)switch(a.textAlign){case"left":za(e,"x",t[Ga]);break;case"right":za(e,"x",-t[Xa])}if(!i&&a.autoSizeAlign)switch(a.verticalAlign){case"top":za(e,"y",t[Ya]);break;case"bottom":za(e,"y",-t[Ua])}}(o,l,a,n,r),function(t,e){const{rows:a,bounds:s}=t,i=a.length,{__lineHeight:n,__baseLine:r,__letterSpacing:o,__clipText:l,textAlign:d,verticalAlign:c,paraSpacing:h,autoSizeAlign:u}=e;let{x:f,y:g,width:p,height:_}=s,w=n*i+(h?h*(t.paraNumber-1):0),m=r;if(l&&w>_)w=Math.max(_,n),i>1&&(t.overflow=i);else if(_||u)switch(c){case"middle":g+=(_-w)/2;break;case"bottom":g+=_-w}m+=g;let y,x,v,S=p||u?p:t.maxWidth;for(let r=0,c=i;r<c;r++){if(y=a[r],y.x=f,y.width<p||y.width>p&&!l)switch(d){case"center":y.x+=(S-y.width)/2;break;case"right":y.x+=S-y.width}y.paraStart&&h&&r>0&&(m+=h),y.y=m,m+=n,t.overflow>r&&m>w&&(y.isOverflow=!0,t.overflow=r+1),x=y.x,v=y.width,o<0&&(y.width<0?(v=-y.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&&(y.isOverflow=!0,t.overflow||(t.overflow=a.length))}s.y=g,s.height=w}(l,a),a.__isCharMode&&function(t,e,a){const{rows:s}=t,{textAlign:i,paraIndent:n,letterSpacing:r}=e,o=a&&i.includes("both"),l=o||a&&i.includes("justify"),d=l&&i.includes("letter");let c,h,u,f,g,p,_,w,m,y;s.forEach(t=>{t.words&&(g=n&&t.paraStart?n:0,w=t.words.length,l&&(y=!t.paraEnd||o,h=a-t.width-g,d?f=h/(t.words.reduce((t,e)=>t+e.data.length,0)-1):u=w>1?h/(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,c=t.x,t.data=[],t.words.forEach((e,a)=>{1===p?(_={char:"",x:c},c=function(t,e,a){return t.forEach(t=>{a.char+=t.char,e+=t.width}),e}(e.data,c,_),(t.isOverflow||" "!==_.char)&&t.data.push(_)):c=function(t,e,a,s,i){return t.forEach(t=>{(s||" "!==t.char)&&(t.x=e,a.push(t)),e+=t.width,i&&(e+=i)}),e}(e.data,c,t.data,t.isOverflow,y&&f),y&&(m=a===w-1,u?m||(c+=u,t.width+=u):f&&(t.width+=f*(e.data.length-(m?1:0))))})),t.words=null)})}(l,a,n),l.overflow&&function(t,a,s,i){if(!i)return;const{rows:n,overflow:r}=t;let{textOverflow:o}=a;if(n.splice(r),o&&"show"!==o){let t,l;"hide"===o?o="":"ellipsis"===o&&(o="...");const d=o?e.canvas.measureText(o).width:0,c=s+i-d;("none"===a.textWrap?n:[n[r-1]]).forEach(e=>{if(e.isOverflow&&e.data){let a=e.data.length-1;for(let s=a;s>-1&&(t=e.data[s],l=t.x+t.width,!(s===a&&l<c));s--){if(l<c&&" "!==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,a,s,n),"none"!==a.textDecoration&&function(t,e){let a,s=0;const{fontSize:i,textDecoration:n}=e;switch(t.decorationHeight=i/11,k(n)?(a=n.type,n.color&&(t.decorationColor=U.string(n.color)),n.offset&&(s=Math.min(.3*i,Math.max(n.offset,.15*-i)))):a=n,a){case"under":t.decorationY=[.15*i+s];break;case"delete":t.decorationY=[.35*-i];break;case"under-delete":t.decorationY=[.15*i+s,.35*-i]}}(l,a),l}};const Na={string:function(t,e){if(!t)return"#000";const a=F(e)&&e<1;if(A(t)){if(!a||!U.object)return t;t=U.object(t)}let s=T(t.a)?1:t.a;a&&(s*=e);const i=t.r+","+t.g+","+t.b;return 1===s?"rgb("+i+")":"rgba("+i+","+s+")"}};Object.assign(N,qa),Object.assign(U,Na),Object.assign(Y,Rt),Object.assign(X,re),Object.assign(G,Be),Object.assign(z,Ye),V();export{ot as Layouter,j as LeaferCanvas,dt as Renderer,Z as Watcher,V as useCanvas};
|
|
1
|
+
import{LeaferCanvasBase as t,Platform as e,canvasPatch as i,FileHelper as s,Creator as a,LeaferImage as n,defineKey as r,LeafList as o,DataHelper as l,RenderEvent as d,ChildEvent as c,WatchEvent as h,PropertyEvent as u,LeafHelper as f,BranchHelper as g,LeafBoundsHelper as p,Bounds as _,isArray as w,Debug as m,LeafLevelList as y,LayoutEvent as x,Run as v,ImageManager as S,ResizeEvent as b,isObject as k,BoundsHelper as B,FourNumberHelper as R,Matrix as E,isUndefined as L,isString as A,ImageEvent as T,MatrixHelper as O,MathHelper as P,AlignHelper as W,PointHelper as C,getMatrixData as M,AroundHelper as D,Direction4 as I,isNumber as F}from"@leafer/core";export*from"@leafer/core";export{LeaferImage}from"@leafer/core";import{Paint as Y,PaintImage as X,ColorConvert as U,PaintGradient as G,Effect as q,Group as z,TextConvert as N}from"@leafer-ui/draw";export*from"@leafer-ui/draw";var j;!function(t){t[t.none=1]="none",t[t.free=2]="free",t[t.mirrorAngle=3]="mirrorAngle",t[t.mirror=4]="mirror"}(j||(j={}));class H 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:V}=s;function Q(t,i){e.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,i)=>new Promise((s,a)=>{t.convertToBlob({type:V(e),quality:i}).then(t=>{var e=new FileReader;e.onload=t=>s(t.target.result),e.onerror=t=>a(t),e.readAsDataURL(t)}).catch(t=>{a(t)})}),canvasToBolb:(t,e,i)=>t.convertToBlob({type:V(e),quality:i}),canvasSaveAs:(t,e,i)=>new Promise(t=>t()),download(t,e){},loadImage:t=>new Promise((i,s)=>{let a=new XMLHttpRequest;a.open("GET",e.image.getRealURL(t),!0),a.responseType="blob",a.onload=()=>{createImageBitmap(a.response).then(t=>{i(t)}).catch(t=>{s(t)})},a.onerror=t=>s(t),a.send()})},e.canvas=a.canvas(),e.conicGradientSupport=!!e.canvas.context.createConicGradient}Object.assign(a,{canvas:(t,e)=>new H(t,e),image:t=>new n(t)}),e.name="web",e.isWorker=!0,e.backgrounder=!0,e.requestRender=function(t){requestAnimationFrame(t)},r(e,"devicePixelRatio",{get:()=>1});const{userAgent:Z}=navigator;Z.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),Z.indexOf("Windows")>-1?(e.os="Windows",e.intWheelDeltaY=!0):Z.indexOf("Mac")>-1?e.os="Mac":Z.indexOf("Linux")>-1&&(e.os="Linux");class ${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===c.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 h(h.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],[[c.ADD,c.REMOVE],this.__onChildEvent,this],[h.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:J,updateBounds:K,updateChange:tt}=f,{pushAllChildBranch:et,pushAllParent:it}=g;const{worldBounds:st}=p;class at{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,st)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,st),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:nt,updateAllChange:rt}=f,ot=m.get("Layouter");class lt{constructor(t,e){this.totalTimes=0,this.config={usePartLayout:!0},this.__levelList=new y,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){ot.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?ot.warn("layouting"):this.times>3?ot.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(h.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:a,LAYOUT:n,AFTER:r}=x,o=this.getBlocks(s);o.forEach(t=>t.setBefore()),i.emitEvent(new x(a,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?(J(t,!0),e.add(t),t.isBranch&&et(t,e),it(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),it(t,e)))})}(s,this.__levelList),function(t){let e,i,s;t.sort(!0),t.levels.forEach(a=>{e=t.levelMap[a];for(let t=0,a=e.length;t<a;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||K(s[t])}K(i)}})}(this.__levelList),function(t){t.list.forEach(tt)}(s),this.extraBlock&&o.push(this.extraBlock),o.forEach(t=>t.setAfter()),i.emitEvent(new x(n,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:a}=x,n=this.getBlocks(new o(e));e.emitEvent(new x(i,n,this.times)),lt.fullLayout(e),n.forEach(t=>{t.setAfter()}),e.emitEvent(new x(s,n,this.times)),e.emitEvent(new x(a,n,this.times)),this.addBlocks(n),v.end(t)}static fullLayout(t){nt(t,!0),t.isBranch?g.updateBounds(t):f.updateBounds(t),rt(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new at([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new at(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],[h.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const dt=m.get("Renderer");class ct{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 _,dt.log(e.innerName,"---\x3e");try{this.emitRender(d.START),this.renderOnce(t),this.emitRender(d.END,this.totalBounds),S.clearRecycled()}catch(t){this.rendering=!1,dt.error(t)}dt.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return dt.warn("rendering");if(this.times>3)return dt.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),a=new _(s);i.save(),s.spread(ct.clipSpread).ceil(),i.clearWorld(s),i.clipWorld(s),this.__render(s,a),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:a}=this,n=t.includes(a.__world),r=n?{includes:n}:{bounds:t,includes:n};this.needFill&&s.fillWorld(t,this.config.fill),m.showRepaint&&m.drawRepaint(s,t),this.config.useCellRender&&(r.cellList=this.getCellList()),e.render(a,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:a}=this;a.length>30&&a.shift(),a.push(t),this.FPS=Math.round(a.reduce((t,e)=>t+e,0)/a.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||dt.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],[b.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}function ht(t,e,i){t.__.__font?Y.fillText(t,e,i):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function ut(t,e,i,s,a){const n=i.__;k(t)?Y.drawStrokesStyle(t,e,!1,i,s,a):(s.setStroke(t,n.__strokeWidth*e,n),s.stroke()),n.__useArrow&&Y.strokeArrow(t,i,s,a)}function ft(t,e,i,s,a){const n=i.__;k(t)?Y.drawStrokesStyle(t,e,!0,i,s,a):(s.setStroke(t,n.__strokeWidth*e,n),Y.drawTextStroke(i,s,a))}function gt(t,e,i,s,a){const n=s.getSameCanvas(!0,!0);n.font=i.__.__font,ft(t,2,i,n,a),n.blendMode="outside"===e?"destination-out":"destination-in",Y.fillText(i,n,a),n.blendMode="normal",f.copyCanvasByWorld(i,s,n),n.recycle(i.__nowWorld)}ct.clipSpread=10,Object.assign(a,{watcher:(t,e)=>new $(t,e),layouter:(t,e)=>new lt(t,e),renderer:(t,e,i)=>new ct(t,e,i),selector:(t,e)=>{},interaction:(t,e,i,s)=>{}}),e.layout=lt.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:pt,copyAndSpread:_t,toOuterOf:wt,getOuterOf:mt,getByMove:yt,move:xt,getIntersectData:vt}=B,St={};let bt;const{stintSet:kt}=l,{hasTransparent:Bt}=U;function Rt(t,e,i){if(!k(e)||!1===e.visible||0===e.opacity)return;let s;const{boxBounds:a}=i.__layout;switch(e.type){case"image":if(!e.url)return;s=X.image(i,t,e,a,!bt||!bt[e.url]);break;case"linear":s=G.linearGradient(e,a);break;case"radial":s=G.radialGradient(e,a);break;case"angular":s=G.conicGradient(e,a);break;case"solid":const{type:n,color:r,opacity:o}=e;s={type:n,style:U.string(r,o)};break;default:L(e.r)||(s={type:"solid",style:U.string(e)})}if(s&&(s.originPaint=e,A(s.style)&&Bt(s.style)&&(s.isTransparent=!0),e.style)){if(0===e.style.strokeWidth)return;s.strokeStyle=e.style}return s}const Et={compute:function(t,e){const i=e.__,s=[];let a,n,r,o=i.__input[t];w(o)||(o=[o]),bt=X.recycleImage(t,i);for(let i,a=0,n=o.length;a<n;a++)(i=Rt(t,o[a],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)&&(a=!0),n=!0),"fill"===t?(kt(i,"__isAlphaPixelFill",a),kt(i,"__isTransparentFill",n)):(kt(i,"__isAlphaPixelStroke",a),kt(i,"__isTransparentStroke",n),kt(i,"__hasMultiStrokeStyle",r))):i.__removePaint(t,!1)},fill:function(t,e,i,s){i.fillStyle=t,ht(e,i,s)},fills:function(t,e,i,s){let a,n,r;for(let o=0,l=t.length;o<l;o++){if(a=t[o],n=a.originPaint,a.image){if(r?r++:r=1,X.checkImage(a,!e.__.__font,e,i,s))continue;if(!a.style){1===r&&a.image.isPlacehold&&e.drawImagePlaceholder(a,i,s);continue}}if(i.fillStyle=a.style,a.transform||n.scaleFixed){if(i.save(),a.transform&&i.transform(a.transform),n.scaleFixed){const{scaleX:t,scaleY:s}=e.getRenderScaleData(!0);(!0===n.scaleFixed||"zoom-in"===n.scaleFixed&&t>1&&s>1)&&i.scale(1/t,1/s)}n.blendMode&&(i.blendMode=n.blendMode),ht(e,i,s),i.restore()}else n.blendMode?(i.saveBlendMode(n.blendMode),ht(e,i,s),i.restoreBlendMode()):ht(e,i,s)}},fillPathOrText:ht,fillText:function(t,e,i){const s=t.__,{rows:a,decorationY:n}=s.__textDrawData;let r;s.__isPlacehold&&s.placeholderColor&&(e.fillStyle=s.placeholderColor);for(let t=0,i=a.length;t<i;t++)r=a[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(n){const{decorationColor:t,decorationHeight:i}=s.__textDrawData;t&&(e.fillStyle=t),a.forEach(t=>n.forEach(s=>e.fillRect(t.x,t.y+s,t.width,i)))}},stroke:function(t,e,i,s){const a=e.__;if(a.__strokeWidth)if(a.__font)Y.strokeText(t,e,i,s);else switch(a.strokeAlign){case"center":ut(t,1,e,i,s);break;case"inside":!function(t,e,i,s){i.save(),i.clipUI(e),ut(t,2,e,i,s),i.restore()}(t,e,i,s);break;case"outside":!function(t,e,i,s){const a=e.__;if(a.__fillAfterStroke)ut(t,2,e,i,s);else{const{renderBounds:n}=e.__layout,r=i.getSameCanvas(!0,!0);e.__drawRenderPath(r),ut(t,2,e,r,s),r.clipUI(a),r.clearWorld(n),f.copyCanvasByWorld(e,i,r),r.recycle(e.__nowWorld)}}(t,e,i,s)}},strokes:function(t,e,i,s){Y.stroke(t,e,i,s)},strokeText:function(t,e,i,s){switch(e.__.strokeAlign){case"center":ft(t,1,e,i,s);break;case"inside":gt(t,"inside",e,i,s);break;case"outside":e.__.__fillAfterStroke?ft(t,2,e,i,s):gt(t,"outside",e,i,s)}},drawTextStroke:function(t,e,i){let s,a=t.__.__textDrawData;const{rows:n,decorationY:r}=a;for(let t=0,i=n.length;t<i;t++)s=n[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}=a;n.forEach(i=>r.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}},drawStrokesStyle:function(t,e,i,s,a,n){let r;const o=s.__,{__hasMultiStrokeStyle:l}=o;l||a.setStroke(void 0,o.__strokeWidth*e,o);for(let d=0,c=t.length;d<c;d++)if(r=t[d],(!r.image||!X.checkImage(r,!1,s,a,n))&&r.style){if(l){const{strokeStyle:t}=r;t?a.setStroke(r.style,o.__getRealStrokeWidth(t)*e,o,t):a.setStroke(r.style,o.__strokeWidth*e,o)}else a.strokeStyle=r.style;r.originPaint.blendMode?(a.saveBlendMode(r.originPaint.blendMode),i?Y.drawTextStroke(s,a,n):a.stroke(),a.restoreBlendMode()):i?Y.drawTextStroke(s,a,n):a.stroke()}},shape:function(t,i,s){const a=i.getSameCanvas(),n=i.bounds,r=t.__nowWorld,o=t.__layout,l=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let d,c,h,u,f,g;wt(o.strokeSpread?(_t(St,o.boxBounds,o.strokeSpread),St):o.boxBounds,r,l);let{scaleX:p,scaleY:_}=t.getRenderScaleData(!0);if(n.includes(l))g=a,d=f=l,c=r;else{let a;if(e.fullImageShadow)a=l;else{const t=o.renderShapeSpread?pt(n,R.swapAndScale(o.renderShapeSpread,p,_)):n;a=vt(t,l)}u=n.getFitMatrix(a);let{a:w,d:m}=u;u.a<1&&(g=i.getSameCanvas(),t.__renderShape(g,s),p*=w,_*=m),f=mt(l,u),d=yt(f,-u.e,-u.f),c=mt(r,u),xt(c,-u.e,-u.f);const y=s.matrix;y?(h=new E(u),h.multiply(y),w*=y.scaleX,m*=y.scaleY):h=u,h.withScale(w,m),s=Object.assign(Object.assign({},s),{matrix:h})}return t.__renderShape(a,s),{canvas:a,matrix:h,fitMatrix:u,bounds:d,renderBounds:c,worldCanvas:g,shapeBounds:f,scaleX:p,scaleY:_}}};let Lt,At=new _;const{isSame:Tt}=B;function Ot(t,e,i,s,a,n){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 a.data||X.createData(a,s,i,n),!0}function Pt(t,e){Mt(t,T.LOAD,e)}function Wt(t,e){Mt(t,T.LOADED,e)}function Ct(t,e,i){e.error=i,t.forceUpdate("surface"),Mt(t,T.ERROR,e)}function Mt(t,e,i){t.hasEvent(e)&&t.emitEvent(new T(e,i))}function Dt(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:It,translate:Ft}=O,Yt=new _,Xt={},Ut={};function Gt(t,e,i,s){const a=A(t)||s?(s?i-s*e:i%e)/((s||Math.floor(i/e))-1):t;return"auto"===t&&a<0?0:a}let qt={},zt=M();const{get:Nt,set:jt,rotateOfOuter:Ht,translate:Vt,scaleOfOuter:Qt,multiplyParent:Zt,scale:$t,rotate:Jt,skew:Kt}=O;function te(t,e,i,s,a,n,r,o){r&&Jt(t,r),o&&Kt(t,o.x,o.y),a&&$t(t,a,n),Vt(t,e.x+i,e.y+s)}function ee(t,e,i,s){return new(i||(i=Promise))(function(a,n){function r(t){try{l(s.next(t))}catch(t){n(t)}}function o(t){try{l(s.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?a(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:ie,scale:se,copy:ae}=O,{getFloorScale:ne}=P,{abs:re}=Math;const oe={image:function(t,e,i,s,a){let n,r;const o=S.get(i);return Lt&&i===Lt.paint&&Tt(s,Lt.boxBounds)?n=Lt.leafPaint:(n={type:i.type,image:o},o.hasAlphaPixel&&(n.isTransparent=!0),Lt=o.use>1?{leafPaint:n,paint:i,boxBounds:At.set(s)}:null),(a||o.loading)&&(r={image:o,attrName:e,attrValue:i}),o.ready?(Ot(t,e,i,o,n,s),a&&(Pt(t,r),Wt(t,r))):o.error?a&&Ct(t,r,o.error):(a&&(Dt(t,!0),Pt(t,r)),n.loadId=o.load(()=>{Dt(t,!1),t.destroyed||(Ot(t,e,i,o,n,s)&&(o.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),Wt(t,r)),n.loadId=void 0},e=>{Dt(t,!1),Ct(t,r,e),n.loadId=void 0}),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{o.ready||(o.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):o.isPlacehold=!0)),n},checkImage:function(t,i,s,a,n){const{scaleX:r,scaleY:o}=X.getImageRenderScaleData(t,s,a,n),{image:l,data:d,originPaint:c}=t,{exporting:h}=n;return!(!d||t.patternId===r+"-"+o&&!h)&&(i&&(d.repeat?i=!1:c.changeful||"miniapp"===e.name&&b.isResizing(s)||h||(i=e.image.isLarge(l,r,o)||l.width*r>8096||l.height*o>8096)),i?(s.__.__isFastShadow&&(a.fillStyle=t.style||"#000",a.fill()),X.drawImage(t,r,o,s,a,n),!0):(!t.style||c.sync||h?X.createPattern(t,s,a,n):X.createPatternTask(t,s,a,n),!1))},drawImage:function(t,e,i,s,a,n){const{data:r,image:o}=t,{blendMode:l}=t.originPaint,{opacity:d,transform:c}=r,h=o.getFull(r.filters),u=s.__;let f,{width:g,height:p}=o;(f=c&&!c.onlyScale||u.path||u.cornerRadius)||d||l?(a.save(),f&&a.clipUI(s),l&&(a.blendMode=l),d&&(a.opacity*=d),c&&a.transform(c),a.drawImage(h,0,0,g,p),a.restore()):(r.scaleX&&(g*=r.scaleX,p*=r.scaleY),a.drawImage(h,0,0,g,p))},getImageRenderScaleData:function(t,e,i,s){const a=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:n}=t;if(i){const{pixelRatio:t}=i;a.scaleX*=t,a.scaleY*=t}return n&&n.scaleX&&(a.scaleX*=Math.abs(n.scaleX),a.scaleY*=Math.abs(n.scaleY)),a},recycleImage:function(t,e){const i=e["_"+t];if(w(i)){let s,a,n,r,o;for(let l=0,d=i.length;l<d;l++)s=i[l],a=s.image,o=a&&a.url,o&&(n||(n={}),n[o]=!0,S.recyclePaint(s),a.loading&&(r||(r=e.__input&&e.__input[t]||[],w(r)||(r=[r])),a.unload(i[l].loadId,!r.some(t=>t.url===o))));return n}return null},createPatternTask:function(t,e,i,s){t.patternTask||(t.patternTask=S.patternTasker.add(()=>ee(this,void 0,void 0,function*(){t.patternTask=null,i.bounds.hit(e.__nowWorld)&&X.createPattern(t,e,i,s),e.forceUpdate("surface")}),300))},createPattern:function(t,i,s,a){let{scaleX:n,scaleY:r}=X.getImageRenderScaleData(t,i,s,a),o=n+"-"+r;if(t.patternId!==o&&!i.destroyed&&(!e.image.isLarge(t.image,n,r)||t.data.repeat)){const{image:s,data:a}=t,{transform:l,gap:d}=a,c=X.getPatternFixScale(t,n,r);let h,u,f,{width:g,height:p}=s;c&&(n*=c,r*=c),g*=n,p*=r,d&&(u=d.x*n/re(a.scaleX||1),f=d.y*r/re(a.scaleY||1)),(l||1!==n||1!==r)&&(n*=ne(g+(u||0)),r*=ne(p+(f||0)),h=ie(),l&&ae(h,l),se(h,1/n,1/r));const _=s.getCanvas(g,p,a.opacity,a.filters,u,f,i.leafer&&i.leafer.config.smooth),w=s.getPattern(_,a.repeat||e.origin.noRepeat||"no-repeat",h,t);t.style=w,t.patternId=o}},getPatternFixScale:function(t,i,s){const{image:a}=t;let n,r=e.image.maxPatternSize,o=a.width*a.height;return a.isSVG?i>1&&(n=Math.ceil(i)/i):r>o&&(r=o),(o*=i*s)>r&&(n=Math.sqrt(r/o)),n},createData:function(t,e,i,s){t.data=X.getPatternData(i,s,e)},getPatternData:function(t,e,i){t.padding&&(e=Yt.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:s,height:a}=i,{opacity:n,mode:r,align:o,offset:l,scale:d,size:c,rotation:h,skew:u,clipSize:f,repeat:g,gap:p,filters:_}=t,w=e.width===s&&e.height===a,m={mode:r},y="center"!==o&&(h||0)%180==90;let x,v;switch(B.set(Ut,0,0,y?a:s,y?s:a),r&&"cover"!==r&&"fit"!==r?((d||c)&&(P.getScaleData(d,c,i,Xt),x=Xt.scaleX,v=Xt.scaleY),(o||p||g)&&(x&&B.scale(Ut,x,v,!0),o&&W.toPoint(o,Ut,e,Ut,!0,!0))):w&&!h||(x=v=B.getFitScale(e,Ut,"fit"!==r),B.put(e,i,o,x,!1,Ut),B.scale(Ut,x,v,!0)),l&&C.move(Ut,l),r){case"stretch":w?x&&(x=v=void 0):(x=e.width/s,v=e.height/a,X.stretchMode(m,e,x,v));break;case"normal":case"clip":if(Ut.x||Ut.y||x||f||h||u){let t,i;f&&(t=e.width/f.width,i=e.height/f.height),X.clipMode(m,e,Ut.x,Ut.y,x,v,h,u,t,i),t&&(x=x?x*t:t,v=v?v*i:i)}break;case"repeat":(!w||x||h||u)&&X.repeatMode(m,e,s,a,Ut.x,Ut.y,x,v,h,u,o,t.freeTransform),g||(m.repeat="repeat");const i=k(g);(p||i)&&(m.gap=function(t,e,i,s,a){let n,r;k(t)?(n=t.x,r=t.y):n=r=t;return{x:Gt(n,i,a.width,e&&e.x),y:Gt(r,s,a.height,e&&e.y)}}(p,i&&g,Ut.width,Ut.height,e));break;default:x&&X.fillOrFitMode(m,e,Ut.x,Ut.y,x,v,h)}return m.transform||(e.x||e.y)&&Ft(m.transform=It(),e.x,e.y),x&&(m.scaleX=x,m.scaleY=v),n&&n<1&&(m.opacity=n),_&&(m.filters=_),g&&(m.repeat=A(g)?"x"===g?"repeat-x":"repeat-y":"repeat"),m},stretchMode:function(t,e,i,s){const a=Nt(),{x:n,y:r}=e;n||r?Vt(a,n,r):a.onlyScale=!0,$t(a,i,s),t.transform=a},fillOrFitMode:function(t,e,i,s,a,n,r){const o=Nt();Vt(o,e.x+i,e.y+s),$t(o,a,n),r&&Ht(o,{x:e.x+e.width/2,y:e.y+e.height/2},r),t.transform=o},clipMode:function(t,e,i,s,a,n,r,o,l,d){const c=Nt();te(c,e,i,s,a,n,r,o),l&&(r||o?(jt(zt),Qt(zt,e,l,d),Zt(c,zt)):Qt(c,e,l,d)),t.transform=c},repeatMode:function(t,e,i,s,a,n,r,o,l,d,c,h){const u=Nt();if(h)te(u,e,a,n,r,o,l,d);else{if(l)if("center"===c)Ht(u,{x:i/2,y:s/2},l);else switch(Jt(u,l),l){case 90:Vt(u,s,0);break;case 180:Vt(u,i,s);break;case 270:Vt(u,0,i)}qt.x=e.x+a,qt.y=e.y+n,Vt(u,qt.x,qt.y),r&&Qt(u,qt,r,o)}t.transform=u}},{toPoint:le}=D,{hasTransparent:de}=U,ce={},he={};function ue(t,e,i,s){if(i){let a,n,r,o;for(let t=0,l=i.length;t<l;t++)a=i[t],A(a)?(r=t/(l-1),n=U.string(a,s)):(r=a.offset,n=U.string(a.color,s)),e.addColorStop(r,n),!o&&de(n)&&(o=!0);o&&(t.isTransparent=!0)}}const{getAngle:fe,getDistance:ge}=C,{get:pe,rotateOfOuter:_e,scaleOfOuter:we}=O,{toPoint:me}=D,ye={},xe={};function ve(t,e,i,s,a){let n;const{width:r,height:o}=t;if(r!==o||s){const t=fe(e,i);n=pe(),a?(we(n,e,r/o*(s||1),1),_e(n,e,t+90)):(we(n,e,1,r/o*(s||1)),_e(n,e,t))}return n}const{getDistance:Se}=C,{toPoint:be}=D,ke={},Be={};const Re={linearGradient:function(t,i){let{from:s,to:a,type:n,opacity:r}=t;le(s||"top",i,ce),le(a||"bottom",i,he);const o=e.canvas.createLinearGradient(ce.x,ce.y,he.x,he.y),l={type:n,style:o};return ue(l,o,t.stops,r),l},radialGradient:function(t,i){let{from:s,to:a,type:n,opacity:r,stretch:o}=t;me(s||"center",i,ye),me(a||"bottom",i,xe);const l=e.canvas.createRadialGradient(ye.x,ye.y,0,ye.x,ye.y,ge(ye,xe)),d={type:n,style:l};ue(d,l,t.stops,r);const c=ve(i,ye,xe,o,!0);return c&&(d.transform=c),d},conicGradient:function(t,i){let{from:s,to:a,type:n,opacity:r,stretch:o}=t;be(s||"center",i,ke),be(a||"bottom",i,Be);const l=e.conicGradientSupport?e.canvas.createConicGradient(0,ke.x,ke.y):e.canvas.createRadialGradient(ke.x,ke.y,0,ke.x,ke.y,Se(ke,Be)),d={type:n,style:l};ue(d,l,t.stops,r);const c=ve(i,ke,Be,o||1,e.conicGradientRotate90);return c&&(d.transform=c),d},getTransform:ve},{copy:Ee,move:Le,toOffsetOutBounds:Ae}=B,{max:Te,abs:Oe}=Math,Pe={},We=new E,Ce={};function Me(t,e){let i,s,a,n,r=0,o=0,l=0,d=0;return e.forEach(t=>{i=t.x||0,s=t.y||0,n=1.5*(t.blur||0),a=Oe(t.spread||0),r=Te(r,a+n-s),o=Te(o,a+n+i),l=Te(l,a+n+s),d=Te(d,a+n-i)}),r===o&&o===l&&l===d?r:[r,o,l,d]}function De(t,i,s){const{shapeBounds:a}=s;let n,r;e.fullImageShadow?(Ee(Pe,t.bounds),Le(Pe,i.x-a.x,i.y-a.y),n=t.bounds,r=Pe):(n=a,r=i),t.copyWorld(s.canvas,n,r)}const{toOffsetOutBounds:Ie}=B,Fe={};const Ye=Me;const Xe={shadow:function(t,e,i){let s,a;const{__nowWorld:n}=t,{shadow:r}=t.__,{worldCanvas:o,bounds:l,renderBounds:d,shapeBounds:c,scaleX:h,scaleY:u}=i,g=e.getSameCanvas(),p=r.length-1;Ae(l,Ce,d),r.forEach((r,_)=>{let w=1;if(r.scaleFixed){const t=Math.abs(n.scaleX);t>1&&(w=1/t)}g.setWorldShadow(Ce.offsetX+(r.x||0)*h*w,Ce.offsetY+(r.y||0)*u*w,(r.blur||0)*h*w,U.string(r.color)),a=q.getShadowTransform(t,g,i,r,Ce,w),a&&g.setTransform(a),De(g,Ce,i),a&&g.resetTransform(),s=d,r.box&&(g.restore(),g.save(),o&&(g.copyWorld(g,d,n,"copy"),s=n),o?g.copyWorld(o,n,n,"destination-out"):g.copyWorld(i.canvas,c,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,a;const{__nowWorld:n}=t,{innerShadow:r}=t.__,{worldCanvas:o,bounds:l,renderBounds:d,shapeBounds:c,scaleX:h,scaleY:u}=i,g=e.getSameCanvas(),p=r.length-1;Ie(l,Fe,d),r.forEach((r,_)=>{let w=1;if(r.scaleFixed){const t=Math.abs(n.scaleX);t>1&&(w=1/t)}g.save(),g.setWorldShadow(Fe.offsetX+(r.x||0)*h*w,Fe.offsetY+(r.y||0)*u*w,(r.blur||0)*h*w),a=q.getShadowTransform(t,g,i,r,Fe,w,!0),a&&g.setTransform(a),De(g,Fe,i),g.restore(),o?(g.copyWorld(g,d,n,"copy"),g.copyWorld(o,n,n,"source-out"),s=n):(g.copyWorld(i.canvas,c,l,"source-out"),s=d),g.fillWorld(s,U.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:Me,getShadowTransform:function(t,e,i,s,a,n,r){if(s.spread){const i=2*s.spread*n*(r?-1:1),{width:o,height:l}=t.__layout.strokeBounds;return We.set().scaleOfOuter({x:(a.x+a.width/2)*e.pixelRatio,y:(a.y+a.height/2)*e.pixelRatio},1+i/o,1+i/l),We}},isTransformShadow(t){},getInnerShadowSpread:Ye},{excludeRenderBounds:Ue}=p;let Ge;function qe(t,e,i,s,a,n,r,o){switch(e){case"grayscale":Ge||(Ge=!0,a.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,a,n){const r=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,r),n&&s.recycle(r);Ne(t,e,i,1,a,n)}(t,i,s,a,r,o);break;case"opacity-path":Ne(t,i,s,n,r,o);break;case"path":o&&i.restore()}}function ze(t){return t.getSameCanvas(!1,!0)}function Ne(t,e,i,s,a,n){const r=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,r,void 0,a),n?i.recycle(r):i.clearWorld(r)}z.prototype.__renderMask=function(t,e){let i,s,a,n,r,o;const{children:l}=this;for(let d=0,c=l.length;d<c;d++){if(i=l[d],o=i.__.mask,o){r&&(qe(this,r,t,a,s,n,void 0,!0),s=a=null),"clipping"!==o&&"clipping-path"!==o||Ue(i,e)||i.__render(t,e),n=i.__.opacity,Ge=!1,"path"===o||"clipping-path"===o?(n<1?(r="opacity-path",a||(a=ze(t))):(r="path",t.save()),i.__clip(a||t,e)):(r="grayscale"===o?"grayscale":"alpha",s||(s=ze(t)),a||(a=ze(t)),i.__render(s,e));continue}const c=1===n&&i.__.__blendMode;c&&qe(this,r,t,a,s,n,void 0,!1),Ue(i,e)||i.__render(a||t,e),c&&qe(this,r,t,a,s,n,c,!1)}qe(this,r,t,a,s,n,void 0,!0)};const je=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",He=je+"_#~&*+\\=|≮≯≈≠=…",Ve=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 Qe(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const Ze=Qe("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),$e=Qe("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Je=Qe(je),Ke=Qe(He),ti=Qe("- —/~|┆·");var ei;!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"}(ei||(ei={}));const{Letter:ii,Single:si,Before:ai,After:ni,Symbol:ri,Break:oi}=ei;function li(t){return Ze[t]?ii:ti[t]?oi:$e[t]?ai:Je[t]?ni:Ke[t]?ri:Ve.test(t)?si:ii}const di={trimRight(t){const{words:e}=t;let i,s=0,a=e.length;for(let n=a-1;n>-1&&(i=e[n].data[0]," "===i.char);n--)s++,t.width-=i.width;s&&e.splice(a-s,s)}};function ci(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:hi}=di,{Letter:ui,Single:fi,Before:gi,After:pi,Symbol:_i,Break:wi}=ei;let mi,yi,xi,vi,Si,bi,ki,Bi,Ri,Ei,Li,Ai,Ti,Oi,Pi,Wi,Ci,Mi=[];function Di(t,e){Ri&&!Bi&&(Bi=Ri),mi.data.push({char:t,width:e}),xi+=e}function Ii(){vi+=xi,mi.width=xi,yi.words.push(mi),mi={data:[]},xi=0}function Fi(){Oi&&(Pi.paraNumber++,yi.paraStart=!0,Oi=!1),Ri&&(yi.startCharSize=Bi,yi.endCharSize=Ri,Bi=0),yi.width=vi,Wi.width?hi(yi):Ci&&Yi(),Mi.push(yi),yi={words:[]},vi=0}function Yi(){vi>(Pi.maxWidth||0)&&(Pi.maxWidth=vi)}const{top:Xi,right:Ui,bottom:Gi,left:qi}=I;function zi(t,e,i){const{bounds:s,rows:a}=t;s[e]+=i;for(let t=0;t<a.length;t++)a[t][e]+=i}const Ni={getDrawData:function(t,i){A(t)||(t=String(t));let s=0,a=0,n=i.__getInput("width")||0,r=i.__getInput("height")||0;const{__padding:o}=i;o&&(n?(s=o[qi],n-=o[Ui]+o[qi],!n&&(n=.01)):i.autoSizeAlign||(s=o[qi]),r?(a=o[Xi],r-=o[Xi]+o[Gi],!r&&(r=.01)):i.autoSizeAlign||(a=o[Xi]));const l={bounds:{x:s,y:a,width:n,height:r},rows:[],paraNumber:0,font:e.canvas.font=i.__font};return function(t,i,s){Pi=t,Mi=t.rows,Wi=t.bounds,Ci=!Wi.width&&!s.autoSizeAlign;const{__letterSpacing:a,paraIndent:n,textCase:r}=s,{canvas:o}=e,{width:l}=Wi;if(s.__isCharMode){const t="none"!==s.textWrap,e="break"===s.textWrap;Oi=!0,Li=null,Bi=ki=Ri=xi=vi=0,mi={data:[]},yi={words:[]},a&&(i=[...i]);for(let s=0,d=i.length;s<d;s++)bi=i[s],"\n"===bi?(xi&&Ii(),yi.paraEnd=!0,Fi(),Oi=!0):(Ei=li(bi),Ei===ui&&"none"!==r&&(bi=ci(bi,r,!xi)),ki=o.measureText(bi).width,a&&(a<0&&(Ri=ki),ki+=a),Ai=Ei===fi&&(Li===fi||Li===ui)||Li===fi&&Ei!==pi,Ti=!(Ei!==gi&&Ei!==fi||Li!==_i&&Li!==pi),Si=Oi&&n?l-n:l,t&&l&&vi+xi+ki>Si&&(e?(xi&&Ii(),vi&&Fi()):(Ti||(Ti=Ei===ui&&Li==pi),Ai||Ti||Ei===wi||Ei===gi||Ei===fi||xi+ki>Si?(xi&&Ii(),vi&&Fi()):vi&&Fi()))," "===bi&&!0!==Oi&&vi+xi===0||(Ei===wi?(" "===bi&&xi&&Ii(),Di(bi,ki),Ii()):Ai||Ti?(xi&&Ii(),Di(bi,ki)):Di(bi,ki)),Li=Ei);xi&&Ii(),vi&&Fi(),Mi.length>0&&(Mi[Mi.length-1].paraEnd=!0)}else i.split("\n").forEach(t=>{Pi.paraNumber++,vi=o.measureText(t).width,Mi.push({x:n||0,text:t,width:vi,paraStart:!0}),Ci&&Yi()})}(l,t,i),o&&function(t,e,i,s,a){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":zi(e,"x",t[qi]);break;case"right":zi(e,"x",-t[Ui])}if(!a&&i.autoSizeAlign)switch(i.verticalAlign){case"top":zi(e,"y",t[Xi]);break;case"bottom":zi(e,"y",-t[Gi])}}(o,l,i,n,r),function(t,e){const{rows:i,bounds:s}=t,a=i.length,{__lineHeight:n,__baseLine:r,__letterSpacing:o,__clipText:l,textAlign:d,verticalAlign:c,paraSpacing:h,autoSizeAlign:u}=e;let{x:f,y:g,width:p,height:_}=s,w=n*a+(h?h*(t.paraNumber-1):0),m=r;if(l&&w>_)w=Math.max(_,n),a>1&&(t.overflow=a);else if(_||u)switch(c){case"middle":g+=(_-w)/2;break;case"bottom":g+=_-w}m+=g;let y,x,v,S=p||u?p:t.maxWidth;for(let r=0,c=a;r<c;r++){if(y=i[r],y.x=f,y.width<p||y.width>p&&!l)switch(d){case"center":y.x+=(S-y.width)/2;break;case"right":y.x+=S-y.width}y.paraStart&&h&&r>0&&(m+=h),y.y=m,m+=n,t.overflow>r&&m>w&&(y.isOverflow=!0,t.overflow=r+1),x=y.x,v=y.width,o<0&&(y.width<0?(v=-y.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&&(y.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:a,paraIndent:n,letterSpacing:r}=e,o=i&&a.includes("both"),l=o||i&&a.includes("justify"),d=l&&a.includes("letter");let c,h,u,f,g,p,_,w,m,y;s.forEach(t=>{t.words&&(g=n&&t.paraStart?n:0,w=t.words.length,l&&(y=!t.paraEnd||o,h=i-t.width-g,d?f=h/(t.words.reduce((t,e)=>t+e.data.length,0)-1):u=w>1?h/(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,c=t.x,t.data=[],t.words.forEach((e,i)=>{1===p?(_={char:"",x:c},c=function(t,e,i){return t.forEach(t=>{i.char+=t.char,e+=t.width}),e}(e.data,c,_),(t.isOverflow||" "!==_.char)&&t.data.push(_)):c=function(t,e,i,s,a){return t.forEach(t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width,a&&(e+=a)}),e}(e.data,c,t.data,t.isOverflow,y&&f),y&&(m=i===w-1,u?m||(c+=u,t.width+=u):f&&(t.width+=f*(e.data.length-(m?1:0))))})),t.words=null)})}(l,i,n),l.overflow&&function(t,i,s,a){if(!a)return;const{rows:n,overflow:r}=t;let{textOverflow:o}=i;if(n.splice(r),o&&"show"!==o){let t,l;"hide"===o?o="":"ellipsis"===o&&(o="...");const d=o?e.canvas.measureText(o).width:0,c=s+a-d;("none"===i.textWrap?n:[n[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<c));s--){if(l<c&&" "!==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,n),"none"!==i.textDecoration&&function(t,e){let i,s=0;const{fontSize:a,textDecoration:n}=e;switch(t.decorationHeight=a/11,k(n)?(i=n.type,n.color&&(t.decorationColor=U.string(n.color)),n.offset&&(s=Math.min(.3*a,Math.max(n.offset,.15*-a)))):i=n,i){case"under":t.decorationY=[.15*a+s];break;case"delete":t.decorationY=[.35*-a];break;case"under-delete":t.decorationY=[.15*a+s,.35*-a]}}(l,i),l}};const ji={string:function(t,e){if(!t)return"#000";const i=F(e)&&e<1;if(A(t)){if(!i||!U.object)return t;t=U.object(t)}let s=L(t.a)?1:t.a;i&&(s*=e);const a=t.r+","+t.g+","+t.b;return 1===s?"rgb("+a+")":"rgba("+a+","+s+")"}};Object.assign(N,Ni),Object.assign(U,ji),Object.assign(Y,Et),Object.assign(X,oe),Object.assign(G,Re),Object.assign(q,Xe),Q();export{lt as Layouter,H as LeaferCanvas,j as PathNodeHandleType,ct as Renderer,$ as Watcher,Q as useCanvas};
|
|
2
2
|
//# sourceMappingURL=worker.esm.min.js.map
|