@leafer-draw/miniapp 1.9.9 → 1.9.11
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/miniapp.cjs +30 -19
- package/dist/miniapp.esm.js +30 -19
- package/dist/miniapp.esm.min.js +1 -1
- package/dist/miniapp.esm.min.js.map +1 -1
- package/dist/miniapp.min.cjs +1 -1
- package/dist/miniapp.min.cjs.map +1 -1
- package/dist/miniapp.module.js +91 -144
- package/dist/miniapp.module.min.js +1 -1
- package/dist/miniapp.module.min.js.map +1 -1
- package/package.json +9 -9
package/dist/miniapp.cjs
CHANGED
|
@@ -1168,7 +1168,14 @@ const PaintModule = {
|
|
|
1168
1168
|
|
|
1169
1169
|
let origin = {}, tempMatrix$1 = core.getMatrixData();
|
|
1170
1170
|
|
|
1171
|
-
const {get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = core.MatrixHelper;
|
|
1171
|
+
const {get: get$3, set: set, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = core.MatrixHelper;
|
|
1172
|
+
|
|
1173
|
+
function stretchMode(data, box, scaleX, scaleY) {
|
|
1174
|
+
const transform = get$3();
|
|
1175
|
+
translate$1(transform, box.x, box.y);
|
|
1176
|
+
if (scaleX) scaleHelper(transform, scaleX, scaleY);
|
|
1177
|
+
data.transform = transform;
|
|
1178
|
+
}
|
|
1172
1179
|
|
|
1173
1180
|
function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
1174
1181
|
const transform = get$3();
|
|
@@ -1185,8 +1192,11 @@ function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipScaleX, c
|
|
|
1185
1192
|
const transform = get$3();
|
|
1186
1193
|
layout(transform, box, x, y, scaleX, scaleY, rotation, skew);
|
|
1187
1194
|
if (clipScaleX) {
|
|
1188
|
-
|
|
1189
|
-
|
|
1195
|
+
if (rotation || skew) {
|
|
1196
|
+
set(tempMatrix$1);
|
|
1197
|
+
scaleOfOuter$1(tempMatrix$1, box, clipScaleX, clipScaleY);
|
|
1198
|
+
multiplyParent(transform, tempMatrix$1);
|
|
1199
|
+
} else scaleOfOuter$1(transform, box, clipScaleX, clipScaleY);
|
|
1190
1200
|
}
|
|
1191
1201
|
data.transform = transform;
|
|
1192
1202
|
}
|
|
@@ -1282,7 +1292,10 @@ function getPatternData(paint, box, image) {
|
|
|
1282
1292
|
if (offset) core.PointHelper.move(tempImage, offset);
|
|
1283
1293
|
switch (mode) {
|
|
1284
1294
|
case "stretch":
|
|
1285
|
-
if (!sameBox)
|
|
1295
|
+
if (!sameBox) {
|
|
1296
|
+
scaleX = box.width / width, scaleY = box.height / height;
|
|
1297
|
+
stretchMode(data, box, scaleX, scaleY);
|
|
1298
|
+
}
|
|
1286
1299
|
break;
|
|
1287
1300
|
|
|
1288
1301
|
case "normal":
|
|
@@ -1291,7 +1304,7 @@ function getPatternData(paint, box, image) {
|
|
|
1291
1304
|
let clipScaleX, clipScaleY;
|
|
1292
1305
|
if (clipSize) clipScaleX = box.width / clipSize.width, clipScaleY = box.height / clipSize.height;
|
|
1293
1306
|
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY);
|
|
1294
|
-
if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX :
|
|
1307
|
+
if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX : clipScaleX, scaleY = scaleY ? scaleY * clipScaleY : clipScaleY;
|
|
1295
1308
|
}
|
|
1296
1309
|
break;
|
|
1297
1310
|
|
|
@@ -1308,17 +1321,14 @@ function getPatternData(paint, box, image) {
|
|
|
1308
1321
|
if (scaleX) fillOrFitMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
1309
1322
|
}
|
|
1310
1323
|
if (!data.transform) {
|
|
1311
|
-
if (box.x || box.y)
|
|
1312
|
-
data.transform = get$2();
|
|
1313
|
-
translate(data.transform, box.x, box.y);
|
|
1314
|
-
}
|
|
1324
|
+
if (box.x || box.y) translate(data.transform = get$2(), box.x, box.y);
|
|
1315
1325
|
}
|
|
1316
|
-
|
|
1326
|
+
data.width = width;
|
|
1327
|
+
data.height = height;
|
|
1328
|
+
if (scaleX) {
|
|
1317
1329
|
data.scaleX = scaleX;
|
|
1318
1330
|
data.scaleY = scaleY;
|
|
1319
1331
|
}
|
|
1320
|
-
data.width = width;
|
|
1321
|
-
data.height = height;
|
|
1322
1332
|
if (opacity) data.opacity = opacity;
|
|
1323
1333
|
if (filters) data.filters = filters;
|
|
1324
1334
|
if (repeat) data.repeat = core.isString(repeat) ? repeat === "x" ? "repeat-x" : "repeat-y" : "repeat";
|
|
@@ -1450,7 +1460,7 @@ function ignoreRender(ui, value) {
|
|
|
1450
1460
|
|
|
1451
1461
|
const {get: get$1, scale: scale, copy: copy$1} = core.MatrixHelper;
|
|
1452
1462
|
|
|
1453
|
-
const {floor: floor, ceil: ceil, max: max$1, abs: abs} = Math;
|
|
1463
|
+
const {floor: floor, ceil: ceil, max: max$1, abs: abs$1} = Math;
|
|
1454
1464
|
|
|
1455
1465
|
function createPattern(ui, paint, pixelRatio) {
|
|
1456
1466
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
@@ -1461,8 +1471,8 @@ function createPattern(ui, paint, pixelRatio) {
|
|
|
1461
1471
|
scaleX *= pixelRatio;
|
|
1462
1472
|
scaleY *= pixelRatio;
|
|
1463
1473
|
if (sx) {
|
|
1464
|
-
sx = abs(sx);
|
|
1465
|
-
sy = abs(sy);
|
|
1474
|
+
sx = abs$1(sx);
|
|
1475
|
+
sy = abs$1(sy);
|
|
1466
1476
|
imageMatrix = get$1();
|
|
1467
1477
|
copy$1(imageMatrix, transform);
|
|
1468
1478
|
scale(imageMatrix, 1 / sx, 1 / sy);
|
|
@@ -1637,6 +1647,7 @@ const PaintImageModule = {
|
|
|
1637
1647
|
recycleImage: recycleImage,
|
|
1638
1648
|
createData: createData,
|
|
1639
1649
|
getPatternData: getPatternData,
|
|
1650
|
+
stretchMode: stretchMode,
|
|
1640
1651
|
fillOrFitMode: fillOrFitMode,
|
|
1641
1652
|
clipMode: clipMode,
|
|
1642
1653
|
repeatMode: repeatMode
|
|
@@ -1747,7 +1758,7 @@ const PaintGradientModule = {
|
|
|
1747
1758
|
getTransform: getTransform
|
|
1748
1759
|
};
|
|
1749
1760
|
|
|
1750
|
-
const {copy: copy, move: move, toOffsetOutBounds: toOffsetOutBounds$1} = core.BoundsHelper, {max: max} = Math;
|
|
1761
|
+
const {copy: copy, move: move, toOffsetOutBounds: toOffsetOutBounds$1} = core.BoundsHelper, {max: max, abs: abs} = Math;
|
|
1751
1762
|
|
|
1752
1763
|
const tempBounds = {}, tempMatrix = new core.Matrix;
|
|
1753
1764
|
|
|
@@ -1791,7 +1802,7 @@ function shadow(ui, current, shape) {
|
|
|
1791
1802
|
function getShadowRenderSpread(_ui, shadow) {
|
|
1792
1803
|
let top = 0, right = 0, bottom = 0, left = 0, x, y, spread, blur;
|
|
1793
1804
|
shadow.forEach(item => {
|
|
1794
|
-
x = item.x || 0, y = item.y || 0,
|
|
1805
|
+
x = item.x || 0, y = item.y || 0, blur = (item.blur || 0) * 1.5, spread = abs(item.spread || 0);
|
|
1795
1806
|
top = max(top, spread + blur - y);
|
|
1796
1807
|
right = max(right, spread + blur + x);
|
|
1797
1808
|
bottom = max(bottom, spread + blur + y);
|
|
@@ -1802,11 +1813,11 @@ function getShadowRenderSpread(_ui, shadow) {
|
|
|
1802
1813
|
|
|
1803
1814
|
function getShadowTransform(ui, canvas, _shape, shadow, outBounds, otherScale, isInnerShaodw) {
|
|
1804
1815
|
if (shadow.spread) {
|
|
1805
|
-
const
|
|
1816
|
+
const spread = shadow.spread * 2 * otherScale * (isInnerShaodw ? -1 : 1), {width: width, height: height} = ui.__layout.strokeBounds;
|
|
1806
1817
|
tempMatrix.set().scaleOfOuter({
|
|
1807
1818
|
x: (outBounds.x + outBounds.width / 2) * canvas.pixelRatio,
|
|
1808
1819
|
y: (outBounds.y + outBounds.height / 2) * canvas.pixelRatio
|
|
1809
|
-
},
|
|
1820
|
+
}, 1 + spread / width, 1 + spread / height);
|
|
1810
1821
|
return tempMatrix;
|
|
1811
1822
|
}
|
|
1812
1823
|
return undefined;
|
package/dist/miniapp.esm.js
CHANGED
|
@@ -1172,7 +1172,14 @@ const PaintModule = {
|
|
|
1172
1172
|
|
|
1173
1173
|
let origin = {}, tempMatrix$1 = getMatrixData();
|
|
1174
1174
|
|
|
1175
|
-
const {get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = MatrixHelper;
|
|
1175
|
+
const {get: get$3, set: set, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = MatrixHelper;
|
|
1176
|
+
|
|
1177
|
+
function stretchMode(data, box, scaleX, scaleY) {
|
|
1178
|
+
const transform = get$3();
|
|
1179
|
+
translate$1(transform, box.x, box.y);
|
|
1180
|
+
if (scaleX) scaleHelper(transform, scaleX, scaleY);
|
|
1181
|
+
data.transform = transform;
|
|
1182
|
+
}
|
|
1176
1183
|
|
|
1177
1184
|
function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
1178
1185
|
const transform = get$3();
|
|
@@ -1189,8 +1196,11 @@ function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipScaleX, c
|
|
|
1189
1196
|
const transform = get$3();
|
|
1190
1197
|
layout(transform, box, x, y, scaleX, scaleY, rotation, skew);
|
|
1191
1198
|
if (clipScaleX) {
|
|
1192
|
-
|
|
1193
|
-
|
|
1199
|
+
if (rotation || skew) {
|
|
1200
|
+
set(tempMatrix$1);
|
|
1201
|
+
scaleOfOuter$1(tempMatrix$1, box, clipScaleX, clipScaleY);
|
|
1202
|
+
multiplyParent(transform, tempMatrix$1);
|
|
1203
|
+
} else scaleOfOuter$1(transform, box, clipScaleX, clipScaleY);
|
|
1194
1204
|
}
|
|
1195
1205
|
data.transform = transform;
|
|
1196
1206
|
}
|
|
@@ -1286,7 +1296,10 @@ function getPatternData(paint, box, image) {
|
|
|
1286
1296
|
if (offset) PointHelper.move(tempImage, offset);
|
|
1287
1297
|
switch (mode) {
|
|
1288
1298
|
case "stretch":
|
|
1289
|
-
if (!sameBox)
|
|
1299
|
+
if (!sameBox) {
|
|
1300
|
+
scaleX = box.width / width, scaleY = box.height / height;
|
|
1301
|
+
stretchMode(data, box, scaleX, scaleY);
|
|
1302
|
+
}
|
|
1290
1303
|
break;
|
|
1291
1304
|
|
|
1292
1305
|
case "normal":
|
|
@@ -1295,7 +1308,7 @@ function getPatternData(paint, box, image) {
|
|
|
1295
1308
|
let clipScaleX, clipScaleY;
|
|
1296
1309
|
if (clipSize) clipScaleX = box.width / clipSize.width, clipScaleY = box.height / clipSize.height;
|
|
1297
1310
|
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY);
|
|
1298
|
-
if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX :
|
|
1311
|
+
if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX : clipScaleX, scaleY = scaleY ? scaleY * clipScaleY : clipScaleY;
|
|
1299
1312
|
}
|
|
1300
1313
|
break;
|
|
1301
1314
|
|
|
@@ -1312,17 +1325,14 @@ function getPatternData(paint, box, image) {
|
|
|
1312
1325
|
if (scaleX) fillOrFitMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
1313
1326
|
}
|
|
1314
1327
|
if (!data.transform) {
|
|
1315
|
-
if (box.x || box.y)
|
|
1316
|
-
data.transform = get$2();
|
|
1317
|
-
translate(data.transform, box.x, box.y);
|
|
1318
|
-
}
|
|
1328
|
+
if (box.x || box.y) translate(data.transform = get$2(), box.x, box.y);
|
|
1319
1329
|
}
|
|
1320
|
-
|
|
1330
|
+
data.width = width;
|
|
1331
|
+
data.height = height;
|
|
1332
|
+
if (scaleX) {
|
|
1321
1333
|
data.scaleX = scaleX;
|
|
1322
1334
|
data.scaleY = scaleY;
|
|
1323
1335
|
}
|
|
1324
|
-
data.width = width;
|
|
1325
|
-
data.height = height;
|
|
1326
1336
|
if (opacity) data.opacity = opacity;
|
|
1327
1337
|
if (filters) data.filters = filters;
|
|
1328
1338
|
if (repeat) data.repeat = isString(repeat) ? repeat === "x" ? "repeat-x" : "repeat-y" : "repeat";
|
|
@@ -1454,7 +1464,7 @@ function ignoreRender(ui, value) {
|
|
|
1454
1464
|
|
|
1455
1465
|
const {get: get$1, scale: scale, copy: copy$1} = MatrixHelper;
|
|
1456
1466
|
|
|
1457
|
-
const {floor: floor, ceil: ceil, max: max$1, abs: abs} = Math;
|
|
1467
|
+
const {floor: floor, ceil: ceil, max: max$1, abs: abs$1} = Math;
|
|
1458
1468
|
|
|
1459
1469
|
function createPattern(ui, paint, pixelRatio) {
|
|
1460
1470
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
@@ -1465,8 +1475,8 @@ function createPattern(ui, paint, pixelRatio) {
|
|
|
1465
1475
|
scaleX *= pixelRatio;
|
|
1466
1476
|
scaleY *= pixelRatio;
|
|
1467
1477
|
if (sx) {
|
|
1468
|
-
sx = abs(sx);
|
|
1469
|
-
sy = abs(sy);
|
|
1478
|
+
sx = abs$1(sx);
|
|
1479
|
+
sy = abs$1(sy);
|
|
1470
1480
|
imageMatrix = get$1();
|
|
1471
1481
|
copy$1(imageMatrix, transform);
|
|
1472
1482
|
scale(imageMatrix, 1 / sx, 1 / sy);
|
|
@@ -1641,6 +1651,7 @@ const PaintImageModule = {
|
|
|
1641
1651
|
recycleImage: recycleImage,
|
|
1642
1652
|
createData: createData,
|
|
1643
1653
|
getPatternData: getPatternData,
|
|
1654
|
+
stretchMode: stretchMode,
|
|
1644
1655
|
fillOrFitMode: fillOrFitMode,
|
|
1645
1656
|
clipMode: clipMode,
|
|
1646
1657
|
repeatMode: repeatMode
|
|
@@ -1751,7 +1762,7 @@ const PaintGradientModule = {
|
|
|
1751
1762
|
getTransform: getTransform
|
|
1752
1763
|
};
|
|
1753
1764
|
|
|
1754
|
-
const {copy: copy, move: move, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max} = Math;
|
|
1765
|
+
const {copy: copy, move: move, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max, abs: abs} = Math;
|
|
1755
1766
|
|
|
1756
1767
|
const tempBounds = {}, tempMatrix = new Matrix;
|
|
1757
1768
|
|
|
@@ -1795,7 +1806,7 @@ function shadow(ui, current, shape) {
|
|
|
1795
1806
|
function getShadowRenderSpread(_ui, shadow) {
|
|
1796
1807
|
let top = 0, right = 0, bottom = 0, left = 0, x, y, spread, blur;
|
|
1797
1808
|
shadow.forEach(item => {
|
|
1798
|
-
x = item.x || 0, y = item.y || 0,
|
|
1809
|
+
x = item.x || 0, y = item.y || 0, blur = (item.blur || 0) * 1.5, spread = abs(item.spread || 0);
|
|
1799
1810
|
top = max(top, spread + blur - y);
|
|
1800
1811
|
right = max(right, spread + blur + x);
|
|
1801
1812
|
bottom = max(bottom, spread + blur + y);
|
|
@@ -1806,11 +1817,11 @@ function getShadowRenderSpread(_ui, shadow) {
|
|
|
1806
1817
|
|
|
1807
1818
|
function getShadowTransform(ui, canvas, _shape, shadow, outBounds, otherScale, isInnerShaodw) {
|
|
1808
1819
|
if (shadow.spread) {
|
|
1809
|
-
const
|
|
1820
|
+
const spread = shadow.spread * 2 * otherScale * (isInnerShaodw ? -1 : 1), {width: width, height: height} = ui.__layout.strokeBounds;
|
|
1810
1821
|
tempMatrix.set().scaleOfOuter({
|
|
1811
1822
|
x: (outBounds.x + outBounds.width / 2) * canvas.pixelRatio,
|
|
1812
1823
|
y: (outBounds.y + outBounds.height / 2) * canvas.pixelRatio
|
|
1813
|
-
},
|
|
1824
|
+
}, 1 + spread / width, 1 + spread / height);
|
|
1814
1825
|
return tempMatrix;
|
|
1815
1826
|
}
|
|
1816
1827
|
return undefined;
|
package/dist/miniapp.esm.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{LeaferCanvasBase as t,isString as e,Platform as i,isNumber as s,canvasPatch as n,DataHelper as a,canvasSizeAttrs as o,isUndefined as r,ResizeEvent as l,FileHelper as d,Creator as c,LeaferImage as h,defineKey as u,LeafList as f,RenderEvent as p,ChildEvent as g,WatchEvent as _,PropertyEvent as w,LeafHelper as m,BranchHelper as y,LeafBoundsHelper as v,Bounds as x,isArray as S,Debug as b,LeafLevelList as k,LayoutEvent as B,Run as R,ImageManager as E,isObject as A,BoundsHelper as L,FourNumberHelper as T,Matrix as C,getMatrixData as O,MatrixHelper as W,MathHelper as M,AlignHelper as P,PointHelper as D,ImageEvent as I,AroundHelper as z,Direction4 as F}from"@leafer/core";export*from"@leafer/core";export{LeaferImage}from"@leafer/core";import{PaintImage as U,Paint as Y,ColorConvert as G,PaintGradient as N,Export as q,Effect as X,Group as j,TextConvert as V}from"@leafer-ui/draw";export*from"@leafer-ui/draw";class H extends t{get allowBackgroundColor(){return!1}init(){const{config:t}=this;let s=t.view||t.canvas;s?(e(s)?("#"!==s[0]&&(s="#"+s),this.viewSelect=i.miniapp.select(s)):s.fields?this.viewSelect=s:this.initView(s),this.viewSelect&&i.miniapp.getSizeView(this.viewSelect).then(t=>{this.initView(t)})):this.initView()}initView(t){t?this.view=t.view||t:(t={},this.__createView()),this.view.getContext?this.__createContext():this.unrealCanvas();const{width:e,height:a,pixelRatio:o}=this.config,r={width:e||t.width,height:a||t.height,pixelRatio:o};this.resize(r),this.context&&(this.viewSelect&&(i.renderCanvas=this),this.context.roundRect&&(this.roundRect=function(t,e,i,n,a){this.context.roundRect(t,e,i,n,s(a)?[a]:a)}),n(this.context.__proto__))}__createView(){this.view=i.origin.createCanvas(1,1)}updateViewSize(){if(this.unreal)return;const{width:t,height:e,pixelRatio:i}=this;this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i)}updateClientBounds(t){this.viewSelect&&i.miniapp.getBounds(this.viewSelect).then(e=>{this.clientBounds=e,t&&t()})}startAutoLayout(t,e){this.resizeListener||(this.resizeListener=e,t&&(this.checkSize=this.checkSize.bind(this),i.miniapp.onWindowResize(this.checkSize)))}checkSize(){this.viewSelect&&setTimeout(()=>{this.updateClientBounds(()=>{const{width:t,height:e}=this.clientBounds,{pixelRatio:i}=this,s={width:t,height:e,pixelRatio:i};this.isSameSize(s)||this.emitResize(s)})},500)}stopAutoLayout(){this.autoLayout=!1,this.resizeListener=null,i.miniapp.offWindowResize(this.checkSize)}unrealCanvas(){this.unreal=!0}emitResize(t){const e={};a.copyAttrs(e,this,o),this.resize(t),r(this.width)||this.resizeListener(new l(t,e))}}const{mineType:Q,fileType:Z}=d;function $(t,e){i.origin={createCanvas:(t,i,s)=>{const n={type:"2d",width:t,height:i};return e.createOffscreenCanvas?e.createOffscreenCanvas(n):e.createOffScreenCanvas(n)},canvasToDataURL:(t,e,i)=>t.toDataURL(Q(e),i),canvasToBolb:(t,e,i)=>t.toBuffer(e,{quality:i}),canvasSaveAs:(t,e,s)=>{let n=t.toDataURL(Q(Z(e)),s);return n=n.substring(n.indexOf("64,")+3),i.origin.download(n,e)},download:(t,s)=>new Promise((n,a)=>{let o;s.includes("/")||(s=`${e.env.USER_DATA_PATH}/`+s,o=!0);const r=e.getFileSystemManager();r.writeFile({filePath:s,data:t,encoding:"base64",success(){o?i.miniapp.saveToAlbum(s).then(()=>{r.unlink({filePath:s}),n()}):n()},fail(t){a(t)}})}),loadImage:t=>new Promise((e,s)=>{const n=i.canvas.view.createImage();n.onload=()=>{e(n)},n.onerror=t=>{s(t)},n.src=i.image.getRealURL(t)}),noRepeat:"repeat-x"},i.miniapp={select:t=>e.createSelectorQuery().select(t),getBounds:t=>new Promise(e=>{t.boundingClientRect().exec(t=>{const i=t[1];e({x:i.top,y:i.left,width:i.width,height:i.height})})}),getSizeView:t=>new Promise(e=>{t.fields({node:!0,size:!0}).exec(t=>{const i=t[0];e({view:i.node,width:i.width,height:i.height})})}),saveToAlbum:t=>new Promise(i=>{e.getSetting({success:s=>{s.authSetting["scope.writePhotosAlbum"]?e.saveImageToPhotosAlbum({filePath:t,success(){i(!0)}}):e.authorize({scope:"scope.writePhotosAlbum",success:()=>{e.saveImageToPhotosAlbum({filePath:t,success(){i(!0)}})},fail:()=>{}})}})}),onWindowResize(t){e.onWindowResize(t)},offWindowResize(t){e.offWindowResize(t)}},i.event={stopDefault(t){},stopNow(t){},stop(t){}},i.canvas=c.canvas(),i.conicGradientSupport=!!i.canvas.context.createConicGradient}Object.assign(c,{canvas:(t,e)=>new H(t,e),image:t=>new h(t)}),i.name="miniapp",i.requestRender=function(t){const{view:e}=i.renderCanvas||i.canvas;e.requestAnimationFrame?e.requestAnimationFrame(t):setTimeout(t,16)},u(i,"devicePixelRatio",{get:()=>Math.max(1,wx.getWindowInfo?wx.getWindowInfo().pixelRatio:wx.getSystemInfoSync().pixelRatio)});class J{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new f;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 f,this.target=t,e&&(this.config=a.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(p.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===g.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 _(_.DATA,{updatedList:this.updatedList})),this.__updatedList=new f,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[w.CHANGE,this.__onAttrChange,this],[[g.ADD,g.REMOVE],this.__onChildEvent,this],[_.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:K,updateBounds:tt,updateChange:et}=m,{pushAllChildBranch:it,pushAllParent:st}=y;const{worldBounds:nt}=v;class at{constructor(t){this.updatedBounds=new x,this.beforeBounds=new x,this.afterBounds=new x,S(t)&&(t=new f(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,nt)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,nt),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:rt}=m,lt=b.get("Layouter");class dt{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new k,this.target=t,e&&(this.config=a.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(B.START),this.layoutOnce(),t.emitEvent(new B(B.END,this.layoutedBlocks,this.times))}catch(t){lt.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?lt.warn("layouting"):this.times>3?lt.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(_.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=R.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:n,LAYOUT:a,AFTER:o}=B,r=this.getBlocks(s);r.forEach(t=>t.setBefore()),i.emitEvent(new B(n,r,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?(K(t,!0),e.add(t),t.isBranch&&it(t,e),st(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),st(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||tt(s[t])}tt(i)}})}(this.__levelList),function(t){t.list.forEach(et)}(s),this.extraBlock&&r.push(this.extraBlock),r.forEach(t=>t.setAfter()),i.emitEvent(new B(a,r,this.times)),i.emitEvent(new B(o,r,this.times)),this.addBlocks(r),this.__levelList.reset(),this.__updatedList=null,R.end(e)}fullLayout(){const t=R.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:n}=B,a=this.getBlocks(new f(e));e.emitEvent(new B(i,a,this.times)),dt.fullLayout(e),a.forEach(t=>{t.setAfter()}),e.emitEvent(new B(s,a,this.times)),e.emitEvent(new B(n,a,this.times)),this.addBlocks(a),R.end(t)}static fullLayout(t){ot(t,!0),t.isBranch?y.updateBounds(t):m.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_([[B.REQUEST,this.layout,this],[B.AGAIN,this.layoutAgain,this],[_.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const ct=b.get("Renderer");class ht{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=a.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(B.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(p.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(p.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(p.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new x,ct.log(e.innerName,"---\x3e");try{this.emitRender(p.START),this.renderOnce(t),this.emitRender(p.END,this.totalBounds),E.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 x,this.renderOptions={},t)this.emitRender(p.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(p.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(p.RENDER,this.renderBounds,this.renderOptions),this.emitRender(p.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=R.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),n=new x(s);i.save(),s.spread(ht.clipSpread).ceil(),i.clearWorld(s),i.clipWorld(s),this.__render(s,n),i.restore(),R.end(e)}fullRender(){const t=R.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),R.end(t)}__render(t,e){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),b.showRepaint&&b.drawRepaint(s,t),i.render(this.target,s,a),this.renderBounds=e=e||t,this.renderOptions=a,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),s.updateRender(e)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new x;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 e=()=>{const t=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:s}=this.config;if(s&&t>s)return i.requestRender(e);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()};i.requestRender(e)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new x(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 x(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 p(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[p.REQUEST,this.update,this],[B.END,this.__onLayoutEnd,this],[p.AGAIN,this.renderAgain,this],[l.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 ut(t,e){const i=t.__,{rows:s,decorationY:n}=i.__textDrawData;let a;i.__isPlacehold&&i.placeholderColor&&(e.fillStyle=i.placeholderColor);for(let t=0,i=s.length;t<i;t++)a=s[t],a.text?e.fillText(a.text,a.x,a.y):a.data&&a.data.forEach(t=>{e.fillText(t.char,t.x,a.y)});if(n){const{decorationColor:t,decorationHeight:a}=i.__textDrawData;t&&(e.fillStyle=t),s.forEach(t=>n.forEach(i=>e.fillRect(t.x,t.y+i,t.width,a)))}}function ft(t,e){t.__.__font?ut(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function pt(t,e,i){switch(e.__.strokeAlign){case"center":gt(t,1,e,i);break;case"inside":_t(t,"inside",e,i);break;case"outside":e.__.__fillAfterStroke?gt(t,2,e,i):_t(t,"outside",e,i)}}function gt(t,e,i,s){const n=i.__;A(t)?mt(t,e,!0,i,s):(s.setStroke(t,n.__strokeWidth*e,n),wt(i,s))}function _t(t,e,i,s){const n=s.getSameCanvas(!0,!0);n.font=i.__.__font,gt(t,2,i,n),n.blendMode="outside"===e?"destination-out":"destination-in",ut(i,n),n.blendMode="normal",m.copyCanvasByWorld(i,s,n),n.recycle(i.__nowWorld)}function wt(t,e){let i,s=t.__.__textDrawData;const{rows:n,decorationY:a}=s;for(let t=0,s=n.length;t<s;t++)i=n[t],i.text?e.strokeText(i.text,i.x,i.y):i.data&&i.data.forEach(t=>{e.strokeText(t.char,t.x,i.y)});if(a){const{decorationHeight:t}=s;n.forEach(i=>a.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}}function mt(t,e,i,s,n){let a;const o=s.__,{__hasMultiStrokeStyle:r}=o;r||n.setStroke(void 0,o.__strokeWidth*e,o);for(let l=0,d=t.length;l<d;l++)if(a=t[l],(!a.image||!U.checkImage(s,n,a,!1))&&a.style){if(r){const{strokeStyle:t}=a;t?n.setStroke(a.style,o.__getRealStrokeWidth(t)*e,o,t):n.setStroke(a.style,o.__strokeWidth*e,o)}else n.strokeStyle=a.style;a.blendMode?(n.saveBlendMode(a.blendMode),i?wt(s,n):n.stroke(),n.restoreBlendMode()):i?wt(s,n):n.stroke()}}function yt(t,e,i){const s=e.__;if(s.__strokeWidth)if(s.__font)pt(t,e,i);else switch(s.strokeAlign){case"center":vt(t,1,e,i);break;case"inside":!function(t,e,i){i.save(),i.clipUI(e),vt(t,2,e,i),i.restore()}(t,e,i);break;case"outside":!function(t,e,i){const s=e.__;if(s.__fillAfterStroke)vt(t,2,e,i);else{const{renderBounds:n}=e.__layout,a=i.getSameCanvas(!0,!0);e.__drawRenderPath(a),vt(t,2,e,a),a.clipUI(s),a.clearWorld(n),m.copyCanvasByWorld(e,i,a),a.recycle(e.__nowWorld)}}(t,e,i)}}function vt(t,e,i,s){const n=i.__;A(t)?mt(t,e,!1,i,s):(s.setStroke(t,n.__strokeWidth*e,n),s.stroke()),n.__useArrow&&Y.strokeArrow(t,i,s)}ht.clipSpread=10,Object.assign(c,{watcher:(t,e)=>new J(t,e),layouter:(t,e)=>new dt(t,e),renderer:(t,e,i)=>new ht(t,e,i),selector:(t,e)=>{},interaction:(t,e,i,s)=>{}}),i.layout=dt.fullLayout,i.render=function(t,e,i){const s=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new f,t.__render(e,i),i.topList.length&&i.topList.forEach(t=>t.__render(e,s))};const{getSpread:xt,copyAndSpread:St,toOuterOf:bt,getOuterOf:kt,getByMove:Bt,move:Rt,getIntersectData:Et}=L,At={};let Lt;const{stintSet:Tt}=a,{hasTransparent:Ct}=G;function Ot(t,i,s){if(!A(i)||!1===i.visible||0===i.opacity)return;let n;const{boxBounds:a}=s.__layout;switch(i.type){case"image":n=U.image(s,t,i,a,!Lt||!Lt[i.url]);break;case"linear":n=N.linearGradient(i,a);break;case"radial":n=N.radialGradient(i,a);break;case"angular":n=N.conicGradient(i,a);break;case"solid":const{type:e,color:o,opacity:l}=i;n={type:e,style:G.string(o,l)};break;default:r(i.r)||(n={type:"solid",style:G.string(i)})}if(n){if(e(n.style)&&Ct(n.style)&&(n.isTransparent=!0),i.style){if(0===i.style.strokeWidth)return;n.strokeStyle=i.style}i.editing&&(n.editing=i.editing),i.blendMode&&(n.blendMode=i.blendMode)}return n}const Wt={compute:function(t,e){const i=e.__,s=[];let n,a,o,r=i.__input[t];S(r)||(r=[r]),Lt=U.recycleImage(t,i);for(let i,n=0,a=r.length;n<a;n++)(i=Ot(t,r[n],e))&&(s.push(i),i.strokeStyle&&(o||(o=1),i.strokeStyle.strokeWidth&&(o=Math.max(o,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",o))},fill:function(t,e,i){i.fillStyle=t,ft(e,i)},fills:function(t,e,i){let s;for(let n=0,a=t.length;n<a;n++){if(s=t[n],s.image){if(U.checkImage(e,i,s,!e.__.__font))continue;if(!s.style){!n&&s.image.isPlacehold&&e.drawImagePlaceholder(i,s.image);continue}}if(i.fillStyle=s.style,s.transform||s.scaleFixed){if(i.save(),s.transform&&i.transform(s.transform),s.scaleFixed){const{scaleX:t,scaleY:n}=e.getRenderScaleData(!0);(!0===s.scaleFixed||"zoom-in"===s.scaleFixed&&t>1&&n>1)&&i.scale(1/t,1/n)}s.blendMode&&(i.blendMode=s.blendMode),ft(e,i),i.restore()}else s.blendMode?(i.saveBlendMode(s.blendMode),ft(e,i),i.restoreBlendMode()):ft(e,i)}},fillPathOrText:ft,fillText:ut,stroke:yt,strokes:function(t,e,i){yt(t,e,i)},strokeText:pt,drawTextStroke:wt,shape:function(t,e,s){const n=e.getSameCanvas(),a=e.bounds,o=t.__nowWorld,r=t.__layout,l=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let d,c,h,u,f,p;bt(r.strokeSpread?(St(At,r.boxBounds,r.strokeSpread),At):r.boxBounds,o,l);let{scaleX:g,scaleY:_}=t.getRenderScaleData(!0);if(a.includes(l))p=n,d=f=l,c=o;else{let n;if(i.fullImageShadow)n=l;else{const t=r.renderShapeSpread?xt(a,T.swapAndScale(r.renderShapeSpread,g,_)):a;n=Et(t,l)}u=a.getFitMatrix(n);let{a:w,d:m}=u;u.a<1&&(p=e.getSameCanvas(),t.__renderShape(p,s),g*=w,_*=m),f=kt(l,u),d=Bt(f,-u.e,-u.f),c=kt(o,u),Rt(c,-u.e,-u.f);const y=s.matrix;y?(h=new C(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(n,s),{canvas:n,matrix:h,fitMatrix:u,bounds:d,renderBounds:c,worldCanvas:p,shapeBounds:f,scaleX:g,scaleY:_}}};let Mt={},Pt=O();const{get:Dt,rotateOfOuter:It,translate:zt,scaleOfOuter:Ft,multiplyParent:Ut,scale:Yt,rotate:Gt,skew:Nt}=W;function qt(t,e,i,s,n,a,o){const r=Dt();zt(r,e.x+i,e.y+s),Yt(r,n,a),o&&It(r,{x:e.x+e.width/2,y:e.y+e.height/2},o),t.transform=r}function Xt(t,e,i,s,n,a,o,r,l,d){const c=Dt();Vt(c,e,i,s,n,a,o,r),l&&(Pt.a=l,Pt.d=d,Ut(c,Pt)),t.transform=c}function jt(t,e,i,s,n,a,o,r,l,d,c,h){const u=Dt();if(h)Vt(u,e,n,a,o,r,l,d);else{if(l)if("center"===c)It(u,{x:i/2,y:s/2},l);else switch(Gt(u,l),l){case 90:zt(u,s,0);break;case 180:zt(u,i,s);break;case 270:zt(u,0,i)}Mt.x=e.x+n,Mt.y=e.y+a,zt(u,Mt.x,Mt.y),o&&Ft(u,Mt,o,r)}t.transform=u}function Vt(t,e,i,s,n,a,o,r){o&&Gt(t,o),r&&Nt(t,r.x,r.y),n&&Yt(t,n,a),zt(t,e.x+i,e.y+s)}const{get:Ht,translate:Qt}=W,Zt=new x,$t={},Jt={};function Kt(t,e,i,s){const{changeful:n,sync:a,scaleFixed:o}=i;n&&(t.changeful=n),a&&(t.sync=a),o&&(t.scaleFixed=o),t.data=te(i,s,e)}function te(t,i,s){t.padding&&(i=Zt.set(i).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");let{width:n,height:a}=s;const{opacity:o,mode:r,align:l,offset:d,scale:c,size:h,rotation:u,skew:f,clipSize:p,repeat:g,gap:_,filters:w}=t,m=i.width===n&&i.height===a,y={mode:r},v="center"!==l&&(u||0)%180==90;let x,S;switch(L.set(Jt,0,0,v?a:n,v?n:a),r&&"cover"!==r&&"fit"!==r?((c||h)&&(M.getScaleData(c,h,s,$t),x=$t.scaleX,S=$t.scaleY),(l||_||g)&&(x&&L.scale(Jt,x,S,!0),l&&P.toPoint(l,Jt,i,Jt,!0,!0))):m&&!u||(x=S=L.getFitScale(i,Jt,"fit"!==r),L.put(i,s,l,x,!1,Jt),L.scale(Jt,x,S,!0)),d&&D.move(Jt,d),r){case"stretch":m||(n=i.width,a=i.height);break;case"normal":case"clip":if(Jt.x||Jt.y||x||p||u||f){let t,e;p&&(t=i.width/p.width,e=i.height/p.height),Xt(y,i,Jt.x,Jt.y,x,S,u,f,t,e),t&&(x=x?x*t:x,S=S?S*e:e)}break;case"repeat":(!m||x||u||f)&&jt(y,i,n,a,Jt.x,Jt.y,x,S,u,f,l,t.freeTransform),g||(y.repeat="repeat");const e=A(g);(_||e)&&(y.gap=function(t,e,i,s,n){let a,o;A(t)?(a=t.x,o=t.y):a=o=t;return{x:ee(a,i,n.width,e&&e.x),y:ee(o,s,n.height,e&&e.y)}}(_,e&&g,Jt.width,Jt.height,i));break;default:x&&qt(y,i,Jt.x,Jt.y,x,S,u)}return y.transform||(i.x||i.y)&&(y.transform=Ht(),Qt(y.transform,i.x,i.y)),x&&"stretch"!==r&&(y.scaleX=x,y.scaleY=S),y.width=n,y.height=a,o&&(y.opacity=o),w&&(y.filters=w),g&&(y.repeat=e(g)?"x"===g?"repeat-x":"repeat-y":"repeat"),y}function ee(t,i,s,n){const a=e(t)||n?(n?s-n*i:s%i)/((n||Math.floor(s/i))-1):t;return"auto"===t&&a<0?0:a}let ie,se=new x;const{isSame:ne}=L;function ae(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||Kt(n,s,i,a),!0}function oe(t,e){de(t,I.LOAD,e)}function re(t,e){de(t,I.LOADED,e)}function le(t,e,i){e.error=i,t.forceUpdate("surface"),de(t,I.ERROR,e)}function de(t,e,i){t.hasEvent(e)&&t.emitEvent(new I(e,i))}function ce(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:he,scale:ue,copy:fe}=W,{floor:pe,ceil:ge,max:_e,abs:we}=Math;function me(t,e,s){let{scaleX:n,scaleY:a}=t.getRenderScaleData(!0,e.scaleFixed);const o=n+"-"+a+"-"+s;if(e.patternId===o||t.destroyed)return!1;{const{image:r,data:l}=e;let d,c,{width:h,height:u,scaleX:f,scaleY:p,transform:g,repeat:_,gap:w}=l;n*=s,a*=s,f&&(f=we(f),p=we(p),c=he(),fe(c,g),ue(c,1/f,1/p),n*=f,a*=p),h*=n,u*=a;const m=h*u;if(!_&&m>i.image.maxCacheSize)return!1;let y=i.image.maxPatternSize;if(r.isSVG){const t=h/r.width;t>1&&(d=t/ge(t))}else{const t=r.width*r.height;y>t&&(y=t)}m>y&&(d=Math.sqrt(m/y)),d&&(n/=d,a/=d,h/=d,u/=d),f&&(n/=f,a/=p);const v=w&&w.x*n,x=w&&w.y*a;if(g||1!==n||1!==a){const t=h+(v||0),e=u+(x||0);n/=t/_e(pe(t),1),a/=e/_e(pe(e),1),c||(c=he(),g&&fe(c,g)),ue(c,1/n,1/a)}const S=r.getCanvas(h,u,l.opacity,l.filters,v,x,t.leafer&&t.leafer.config.smooth),b=r.getPattern(S,_||i.origin.noRepeat||"no-repeat",c,e);return e.style=b,e.patternId=o,!0}}function ye(t,e,i,s){return new(i||(i=Promise))(function(n,a){function o(t){try{l(s.next(t))}catch(t){a(t)}}function r(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(o,r)}l((s=s.apply(t,e||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const ve={image:function(t,e,i,s,n){let a,o;const r=E.get(i);return ie&&i===ie.paint&&ne(s,ie.boxBounds)?a=ie.leafPaint:(a={type:i.type,image:r},r.hasAlphaPixel&&(a.isTransparent=!0),ie=r.use>1?{leafPaint:a,paint:i,boxBounds:se.set(s)}:null),(n||r.loading)&&(o={image:r,attrName:e,attrValue:i}),r.ready?(ae(t,e,i,r,a,s),n&&(oe(t,o),re(t,o))):r.error?n&&le(t,o,r.error):(n&&(ce(t,!0),oe(t,o)),a.loadId=r.load(()=>{ce(t,!1),t.destroyed||(ae(t,e,i,r,a,s)&&(r.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),re(t,o)),a.loadId=void 0},e=>{ce(t,!1),le(t,o,e),a.loadId=void 0}),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{r.ready||(r.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):r.isPlacehold=!0)),a},checkImage:function(t,e,s,n){const{scaleX:a,scaleY:o}=t.getRenderScaleData(!0,s.scaleFixed),{pixelRatio:r}=e,{data:d}=s;if(!d||s.patternId===a+"-"+o+"-"+r&&!q.running)return!1;if(n)if(d.repeat)n=!1;else if(!(s.changeful||"miniapp"===i.name&&l.isResizing(t)||q.running)){let{width:t,height:e}=d;t*=a*r,e*=o*r,d.scaleX&&(t*=d.scaleX,e*=d.scaleY),n=t*e>i.image.maxCacheSize}return n?(t.__.__isFastShadow&&(e.fillStyle=s.style||"#000",e.fill()),function(t,e,i,s){e.save(),e.clipUI(t),i.blendMode&&(e.blendMode=i.blendMode);s.opacity&&(e.opacity*=s.opacity);s.transform&&e.transform(s.transform);e.drawImage(i.image.getFull(s.filters),0,0,s.width,s.height),e.restore()}(t,e,s,d),!0):(!s.style||s.sync||q.running?me(t,s,r):s.patternTask||(s.patternTask=E.patternTasker.add(()=>ye(this,void 0,void 0,function*(){s.patternTask=null,e.bounds.hit(t.__nowWorld)&&me(t,s,r),t.forceUpdate("surface")}),300)),!1)},createPattern:me,recycleImage:function(t,e){const i=e["_"+t];if(S(i)){let s,n,a,o,r;for(let l=0,d=i.length;l<d;l++)s=i[l],n=s.image,r=n&&n.url,r&&(a||(a={}),a[r]=!0,E.recycle(n),n.loading&&(o||(o=e.__input&&e.__input[t]||[],S(o)||(o=[o])),n.unload(i[l].loadId,!o.some(t=>t.url===r))));return a}return null},createData:Kt,getPatternData:te,fillOrFitMode:qt,clipMode:Xt,repeatMode:jt},{toPoint:xe}=z,{hasTransparent:Se}=G,be={},ke={};function Be(t,i,s,n){if(s){let a,o,r,l;for(let t=0,d=s.length;t<d;t++)a=s[t],e(a)?(r=t/(d-1),o=G.string(a,n)):(r=a.offset,o=G.string(a.color,n)),i.addColorStop(r,o),!l&&Se(o)&&(l=!0);l&&(t.isTransparent=!0)}}const{getAngle:Re,getDistance:Ee}=D,{get:Ae,rotateOfOuter:Le,scaleOfOuter:Te}=W,{toPoint:Ce}=z,Oe={},We={};function Me(t,e,i,s,n){let a;const{width:o,height:r}=t;if(o!==r||s){const t=Re(e,i);a=Ae(),n?(Te(a,e,o/r*(s||1),1),Le(a,e,t+90)):(Te(a,e,1,o/r*(s||1)),Le(a,e,t))}return a}const{getDistance:Pe}=D,{toPoint:De}=z,Ie={},ze={};const Fe={linearGradient:function(t,e){let{from:s,to:n,type:a,opacity:o}=t;xe(s||"top",e,be),xe(n||"bottom",e,ke);const r=i.canvas.createLinearGradient(be.x,be.y,ke.x,ke.y),l={type:a,style:r};return Be(l,r,t.stops,o),l},radialGradient:function(t,e){let{from:s,to:n,type:a,opacity:o,stretch:r}=t;Ce(s||"center",e,Oe),Ce(n||"bottom",e,We);const l=i.canvas.createRadialGradient(Oe.x,Oe.y,0,Oe.x,Oe.y,Ee(Oe,We)),d={type:a,style:l};Be(d,l,t.stops,o);const c=Me(e,Oe,We,r,!0);return c&&(d.transform=c),d},conicGradient:function(t,e){let{from:s,to:n,type:a,opacity:o,stretch:r}=t;De(s||"center",e,Ie),De(n||"bottom",e,ze);const l=i.conicGradientSupport?i.canvas.createConicGradient(0,Ie.x,Ie.y):i.canvas.createRadialGradient(Ie.x,Ie.y,0,Ie.x,Ie.y,Pe(Ie,ze)),d={type:a,style:l};Be(d,l,t.stops,o);const c=Me(e,Ie,ze,r||1,i.conicGradientRotate90);return c&&(d.transform=c),d},getTransform:Me},{copy:Ue,move:Ye,toOffsetOutBounds:Ge}=L,{max:Ne}=Math,qe={},Xe=new C,je={};function Ve(t,e){let i,s,n,a,o=0,r=0,l=0,d=0;return e.forEach(t=>{i=t.x||0,s=t.y||0,n=t.spread||0,a=1.5*(t.blur||0),o=Ne(o,n+a-s),r=Ne(r,n+a+i),l=Ne(l,n+a+s),d=Ne(d,n+a-i)}),o===r&&r===l&&l===d?o:[o,r,l,d]}function He(t,e,s){const{shapeBounds:n}=s;let a,o;i.fullImageShadow?(Ue(qe,t.bounds),Ye(qe,e.x-n.x,e.y-n.y),a=t.bounds,o=qe):(a=n,o=e),t.copyWorld(s.canvas,a,o)}const{toOffsetOutBounds:Qe}=L,Ze={};const $e=Ve;const Je={shadow:function(t,e,i){let s,n;const{__nowWorld:a}=t,{shadow:o}=t.__,{worldCanvas:r,bounds:l,renderBounds:d,shapeBounds:c,scaleX:h,scaleY:u}=i,f=e.getSameCanvas(),p=o.length-1;Ge(l,je,d),o.forEach((o,g)=>{let _=1;if(o.scaleFixed){const t=Math.abs(a.scaleX);t>1&&(_=1/t)}f.setWorldShadow(je.offsetX+(o.x||0)*h*_,je.offsetY+(o.y||0)*u*_,(o.blur||0)*h*_,G.string(o.color)),n=X.getShadowTransform(t,f,i,o,je,_),n&&f.setTransform(n),He(f,je,i),n&&f.resetTransform(),s=d,o.box&&(f.restore(),f.save(),r&&(f.copyWorld(f,d,a,"copy"),s=a),r?f.copyWorld(r,a,a,"destination-out"):f.copyWorld(i.canvas,c,l,"destination-out")),m.copyCanvasByWorld(t,e,f,s,o.blendMode),p&&g<p&&f.clearWorld(s)}),f.recycle(s)},innerShadow:function(t,e,i){let s,n;const{__nowWorld:a}=t,{innerShadow:o}=t.__,{worldCanvas:r,bounds:l,renderBounds:d,shapeBounds:c,scaleX:h,scaleY:u}=i,f=e.getSameCanvas(),p=o.length-1;Qe(l,Ze,d),o.forEach((o,g)=>{let _=1;if(o.scaleFixed){const t=Math.abs(a.scaleX);t>1&&(_=1/t)}f.save(),f.setWorldShadow(Ze.offsetX+(o.x||0)*h*_,Ze.offsetY+(o.y||0)*u*_,(o.blur||0)*h*_),n=X.getShadowTransform(t,f,i,o,Ze,_,!0),n&&f.setTransform(n),He(f,Ze,i),f.restore(),r?(f.copyWorld(f,d,a,"copy"),f.copyWorld(r,a,a,"source-out"),s=a):(f.copyWorld(i.canvas,c,l,"source-out"),s=d),f.fillWorld(s,G.string(o.color),"source-in"),m.copyCanvasByWorld(t,e,f,s,o.blendMode),p&&g<p&&f.clearWorld(s)}),f.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:Ve,getShadowTransform:function(t,e,i,s,n,a,o){if(s.spread){const i=1+2*s.spread/t.__layout.strokeBounds.width*a*(o?-1:1);return Xe.set().scaleOfOuter({x:(n.x+n.width/2)*e.pixelRatio,y:(n.y+n.height/2)*e.pixelRatio},i),Xe}},isTransformShadow(t){},getInnerShadowSpread:$e},{excludeRenderBounds:Ke}=v;let ti;function ei(t,e,i,s,n,a,o,r){switch(e){case"grayscale":ti||(ti=!0,n.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,n,a){const o=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,o),a&&s.recycle(o);si(t,e,i,1,n,a)}(t,i,s,n,o,r);break;case"opacity-path":si(t,i,s,a,o,r);break;case"path":r&&i.restore()}}function ii(t){return t.getSameCanvas(!1,!0)}function si(t,e,i,s,n,a){const o=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,o,void 0,n),a?i.recycle(o):i.clearWorld(o)}j.prototype.__renderMask=function(t,e){let i,s,n,a,o,r;const{children:l}=this;for(let d=0,c=l.length;d<c;d++){if(i=l[d],r=i.__.mask,r){o&&(ei(this,o,t,n,s,a,void 0,!0),s=n=null),"clipping"!==r&&"clipping-path"!==r||Ke(i,e)||i.__render(t,e),a=i.__.opacity,ti=!1,"path"===r||"clipping-path"===r?(a<1?(o="opacity-path",n||(n=ii(t))):(o="path",t.save()),i.__clip(n||t,e)):(o="grayscale"===r?"grayscale":"alpha",s||(s=ii(t)),n||(n=ii(t)),i.__render(s,e));continue}const c=1===a&&i.__.__blendMode;c&&ei(this,o,t,n,s,a,void 0,!1),Ke(i,e)||i.__render(n||t,e),c&&ei(this,o,t,n,s,a,c,!1)}ei(this,o,t,n,s,a,void 0,!0)};const ni=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",ai=ni+"_#~&*+\\=|≮≯≈≠=…",oi=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 ri(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const li=ri("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),di=ri("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),ci=ri(ni),hi=ri(ai),ui=ri("- —/~|┆·");var fi;!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"}(fi||(fi={}));const{Letter:pi,Single:gi,Before:_i,After:wi,Symbol:mi,Break:yi}=fi;function vi(t){return li[t]?pi:ui[t]?yi:di[t]?_i:ci[t]?wi:hi[t]?mi:oi.test(t)?gi:pi}const xi={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 Si(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:bi}=xi,{Letter:ki,Single:Bi,Before:Ri,After:Ei,Symbol:Ai,Break:Li}=fi;let Ti,Ci,Oi,Wi,Mi,Pi,Di,Ii,zi,Fi,Ui,Yi,Gi,Ni,qi,Xi,ji,Vi=[];function Hi(t,e){zi&&!Ii&&(Ii=zi),Ti.data.push({char:t,width:e}),Oi+=e}function Qi(){Wi+=Oi,Ti.width=Oi,Ci.words.push(Ti),Ti={data:[]},Oi=0}function Zi(){Ni&&(qi.paraNumber++,Ci.paraStart=!0,Ni=!1),zi&&(Ci.startCharSize=Ii,Ci.endCharSize=zi,Ii=0),Ci.width=Wi,Xi.width?bi(Ci):ji&&$i(),Vi.push(Ci),Ci={words:[]},Wi=0}function $i(){Wi>(qi.maxWidth||0)&&(qi.maxWidth=Wi)}const{top:Ji,right:Ki,bottom:ts,left:es}=F;function is(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 ss={getDrawData:function(t,s){e(t)||(t=String(t));let n=0,a=0,o=s.__getInput("width")||0,r=s.__getInput("height")||0;const{textDecoration:l,__font:d,__padding:c}=s;c&&(o?(n=c[es],o-=c[Ki]+c[es]):s.autoSizeAlign||(n=c[es]),r?(a=c[Ji],r-=c[Ji]+c[ts]):s.autoSizeAlign||(a=c[Ji]));const h={bounds:{x:n,y:a,width:o,height:r},rows:[],paraNumber:0,font:i.canvas.font=d};return function(t,e,s){qi=t,Vi=t.rows,Xi=t.bounds,ji=!Xi.width&&!s.autoSizeAlign;const{__letterSpacing:n,paraIndent:a,textCase:o}=s,{canvas:r}=i,{width:l,height:d}=Xi;if(l||d||n||"none"!==o){const t="none"!==s.textWrap,i="break"===s.textWrap;Ni=!0,Ui=null,Ii=Di=zi=Oi=Wi=0,Ti={data:[]},Ci={words:[]},n&&(e=[...e]);for(let s=0,d=e.length;s<d;s++)Pi=e[s],"\n"===Pi?(Oi&&Qi(),Ci.paraEnd=!0,Zi(),Ni=!0):(Fi=vi(Pi),Fi===ki&&"none"!==o&&(Pi=Si(Pi,o,!Oi)),Di=r.measureText(Pi).width,n&&(n<0&&(zi=Di),Di+=n),Yi=Fi===Bi&&(Ui===Bi||Ui===ki)||Ui===Bi&&Fi!==Ei,Gi=!(Fi!==Ri&&Fi!==Bi||Ui!==Ai&&Ui!==Ei),Mi=Ni&&a?l-a:l,t&&l&&Wi+Oi+Di>Mi&&(i?(Oi&&Qi(),Wi&&Zi()):(Gi||(Gi=Fi===ki&&Ui==Ei),Yi||Gi||Fi===Li||Fi===Ri||Fi===Bi||Oi+Di>Mi?(Oi&&Qi(),Wi&&Zi()):Wi&&Zi()))," "===Pi&&!0!==Ni&&Wi+Oi===0||(Fi===Li?(" "===Pi&&Oi&&Qi(),Hi(Pi,Di),Qi()):Yi||Gi?(Oi&&Qi(),Hi(Pi,Di)):Hi(Pi,Di)),Ui=Fi);Oi&&Qi(),Wi&&Zi(),Vi.length>0&&(Vi[Vi.length-1].paraEnd=!0)}else e.split("\n").forEach(t=>{qi.paraNumber++,Wi=r.measureText(t).width,Vi.push({x:a||0,text:t,width:Wi,paraStart:!0}),ji&&$i()})}(h,t,s),c&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":is(e,"x",t[es]);break;case"right":is(e,"x",-t[Ki])}if(!n&&i.autoSizeAlign)switch(i.verticalAlign){case"top":is(e,"y",t[Ji]);break;case"bottom":is(e,"y",-t[ts])}}(c,h,s,o,r),function(t,e){const{rows:i,bounds:s}=t,n=i.length,{__lineHeight:a,__baseLine:o,__letterSpacing:r,__clipText:l,textAlign:d,verticalAlign:c,paraSpacing:h,autoSizeAlign:u}=e;let{x:f,y:p,width:g,height:_}=s,w=a*n+(h?h*(t.paraNumber-1):0),m=o;if(l&&w>_)w=Math.max(_,a),n>1&&(t.overflow=n);else if(_||u)switch(c){case"middle":p+=(_-w)/2;break;case"bottom":p+=_-w}m+=p;let y,v,x,S=g||u?g:t.maxWidth;for(let o=0,c=n;o<c;o++){if(y=i[o],y.x=f,y.width<g||y.width>g&&!l)switch(d){case"center":y.x+=(S-y.width)/2;break;case"right":y.x+=S-y.width}y.paraStart&&h&&o>0&&(m+=h),y.y=m,m+=a,t.overflow>o&&m>w&&(y.isOverflow=!0,t.overflow=o+1),v=y.x,x=y.width,r<0&&(y.width<0?(x=-y.width+e.fontSize+r,v-=x,x+=e.fontSize):x-=r),v<s.x&&(s.x=v),x>s.width&&(s.width=x),l&&g&&g<x&&(y.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=p,s.height=w}(h,s),function(t,e,i){const{rows:s}=t,{textAlign:n,paraIndent:a,letterSpacing:o}=e;let r,l,d,c,h,u;s.forEach(t=>{t.words&&(d=a&&t.paraStart?a:0,u=t.words.length,l=i&&("justify"===n||"both"===n)&&u>1?(i-t.width-d)/(u-1):0,c=o||t.isOverflow?0:l>.01?1:2,t.isOverflow&&!o&&(t.textMode=!0),2===c?(t.x+=d,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=d,r=t.x,t.data=[],t.words.forEach((e,i)=>{1===c?(h={char:"",x:r},r=function(t,e,i){return t.forEach(t=>{i.char+=t.char,e+=t.width}),e}(e.data,r,h),(t.isOverflow||" "!==h.char)&&t.data.push(h)):r=function(t,e,i,s){return t.forEach(t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width}),e}(e.data,r,t.data,t.isOverflow),!l||t.paraEnd&&"both"!==n||i===u-1||(r+=l,t.width+=l)})),t.words=null)})}(h,s,o),h.overflow&&function(t,e,s,n){if(!n)return;const{rows:a,overflow:o}=t;let{textOverflow:r}=e;if(a.splice(o),r&&"show"!==r){let t,l;"hide"===r?r="":"ellipsis"===r&&(r="...");const d=r?i.canvas.measureText(r).width:0,c=s+n-d;("none"===e.textWrap?a:[a[o-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:r,x:l}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(h,s,n,o),"none"!==l&&function(t,e){let i,s=0;const{fontSize:n,textDecoration:a}=e;switch(t.decorationHeight=n/11,A(a)?(i=a.type,a.color&&(t.decorationColor=G.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]}}(h,s),h}};const ns={string:function(t,i){if(!t)return"#000";const n=s(i)&&i<1;if(e(t)){if(!n||!G.object)return t;t=G.object(t)}let a=r(t.a)?1:t.a;n&&(a*=i);const o=t.r+","+t.g+","+t.b;return 1===a?"rgb("+o+")":"rgba("+o+","+a+")"}};Object.assign(V,ss),Object.assign(G,ns),Object.assign(Y,Wt),Object.assign(U,ve),Object.assign(N,Fe),Object.assign(X,Je);try{wx&&$(0,wx)}catch(t){}export{dt as Layouter,H as LeaferCanvas,ht as Renderer,J as Watcher,$ as useCanvas};
|
|
1
|
+
import{LeaferCanvasBase as t,isString as e,Platform as i,isNumber as s,canvasPatch as n,DataHelper as a,canvasSizeAttrs as o,isUndefined as r,ResizeEvent as l,FileHelper as c,Creator as d,LeaferImage as h,defineKey as u,LeafList as f,RenderEvent as p,ChildEvent as g,WatchEvent as _,PropertyEvent as w,LeafHelper as m,BranchHelper as y,LeafBoundsHelper as v,Bounds as x,isArray as S,Debug as b,LeafLevelList as k,LayoutEvent as B,Run as R,ImageManager as E,isObject as A,BoundsHelper as L,FourNumberHelper as T,Matrix as C,getMatrixData as O,MatrixHelper as W,MathHelper as M,AlignHelper as P,PointHelper as D,ImageEvent as I,AroundHelper as z,Direction4 as F}from"@leafer/core";export*from"@leafer/core";export{LeaferImage}from"@leafer/core";import{PaintImage as U,Paint as Y,ColorConvert as G,PaintGradient as N,Export as q,Effect as X,Group as j,TextConvert as V}from"@leafer-ui/draw";export*from"@leafer-ui/draw";class H extends t{get allowBackgroundColor(){return!1}init(){const{config:t}=this;let s=t.view||t.canvas;s?(e(s)?("#"!==s[0]&&(s="#"+s),this.viewSelect=i.miniapp.select(s)):s.fields?this.viewSelect=s:this.initView(s),this.viewSelect&&i.miniapp.getSizeView(this.viewSelect).then(t=>{this.initView(t)})):this.initView()}initView(t){t?this.view=t.view||t:(t={},this.__createView()),this.view.getContext?this.__createContext():this.unrealCanvas();const{width:e,height:a,pixelRatio:o}=this.config,r={width:e||t.width,height:a||t.height,pixelRatio:o};this.resize(r),this.context&&(this.viewSelect&&(i.renderCanvas=this),this.context.roundRect&&(this.roundRect=function(t,e,i,n,a){this.context.roundRect(t,e,i,n,s(a)?[a]:a)}),n(this.context.__proto__))}__createView(){this.view=i.origin.createCanvas(1,1)}updateViewSize(){if(this.unreal)return;const{width:t,height:e,pixelRatio:i}=this;this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i)}updateClientBounds(t){this.viewSelect&&i.miniapp.getBounds(this.viewSelect).then(e=>{this.clientBounds=e,t&&t()})}startAutoLayout(t,e){this.resizeListener||(this.resizeListener=e,t&&(this.checkSize=this.checkSize.bind(this),i.miniapp.onWindowResize(this.checkSize)))}checkSize(){this.viewSelect&&setTimeout(()=>{this.updateClientBounds(()=>{const{width:t,height:e}=this.clientBounds,{pixelRatio:i}=this,s={width:t,height:e,pixelRatio:i};this.isSameSize(s)||this.emitResize(s)})},500)}stopAutoLayout(){this.autoLayout=!1,this.resizeListener=null,i.miniapp.offWindowResize(this.checkSize)}unrealCanvas(){this.unreal=!0}emitResize(t){const e={};a.copyAttrs(e,this,o),this.resize(t),r(this.width)||this.resizeListener(new l(t,e))}}const{mineType:Q,fileType:Z}=c;function $(t,e){i.origin={createCanvas:(t,i,s)=>{const n={type:"2d",width:t,height:i};return e.createOffscreenCanvas?e.createOffscreenCanvas(n):e.createOffScreenCanvas(n)},canvasToDataURL:(t,e,i)=>t.toDataURL(Q(e),i),canvasToBolb:(t,e,i)=>t.toBuffer(e,{quality:i}),canvasSaveAs:(t,e,s)=>{let n=t.toDataURL(Q(Z(e)),s);return n=n.substring(n.indexOf("64,")+3),i.origin.download(n,e)},download:(t,s)=>new Promise((n,a)=>{let o;s.includes("/")||(s=`${e.env.USER_DATA_PATH}/`+s,o=!0);const r=e.getFileSystemManager();r.writeFile({filePath:s,data:t,encoding:"base64",success(){o?i.miniapp.saveToAlbum(s).then(()=>{r.unlink({filePath:s}),n()}):n()},fail(t){a(t)}})}),loadImage:t=>new Promise((e,s)=>{const n=i.canvas.view.createImage();n.onload=()=>{e(n)},n.onerror=t=>{s(t)},n.src=i.image.getRealURL(t)}),noRepeat:"repeat-x"},i.miniapp={select:t=>e.createSelectorQuery().select(t),getBounds:t=>new Promise(e=>{t.boundingClientRect().exec(t=>{const i=t[1];e({x:i.top,y:i.left,width:i.width,height:i.height})})}),getSizeView:t=>new Promise(e=>{t.fields({node:!0,size:!0}).exec(t=>{const i=t[0];e({view:i.node,width:i.width,height:i.height})})}),saveToAlbum:t=>new Promise(i=>{e.getSetting({success:s=>{s.authSetting["scope.writePhotosAlbum"]?e.saveImageToPhotosAlbum({filePath:t,success(){i(!0)}}):e.authorize({scope:"scope.writePhotosAlbum",success:()=>{e.saveImageToPhotosAlbum({filePath:t,success(){i(!0)}})},fail:()=>{}})}})}),onWindowResize(t){e.onWindowResize(t)},offWindowResize(t){e.offWindowResize(t)}},i.event={stopDefault(t){},stopNow(t){},stop(t){}},i.canvas=d.canvas(),i.conicGradientSupport=!!i.canvas.context.createConicGradient}Object.assign(d,{canvas:(t,e)=>new H(t,e),image:t=>new h(t)}),i.name="miniapp",i.requestRender=function(t){const{view:e}=i.renderCanvas||i.canvas;e.requestAnimationFrame?e.requestAnimationFrame(t):setTimeout(t,16)},u(i,"devicePixelRatio",{get:()=>Math.max(1,wx.getWindowInfo?wx.getWindowInfo().pixelRatio:wx.getSystemInfoSync().pixelRatio)});class J{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new f;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 f,this.target=t,e&&(this.config=a.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(p.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===g.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 _(_.DATA,{updatedList:this.updatedList})),this.__updatedList=new f,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[w.CHANGE,this.__onAttrChange,this],[[g.ADD,g.REMOVE],this.__onChildEvent,this],[_.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:K,updateBounds:tt,updateChange:et}=m,{pushAllChildBranch:it,pushAllParent:st}=y;const{worldBounds:nt}=v;class at{constructor(t){this.updatedBounds=new x,this.beforeBounds=new x,this.afterBounds=new x,S(t)&&(t=new f(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,nt)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,nt),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:rt}=m,lt=b.get("Layouter");class ct{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new k,this.target=t,e&&(this.config=a.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(B.START),this.layoutOnce(),t.emitEvent(new B(B.END,this.layoutedBlocks,this.times))}catch(t){lt.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?lt.warn("layouting"):this.times>3?lt.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(_.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=R.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:n,LAYOUT:a,AFTER:o}=B,r=this.getBlocks(s);r.forEach(t=>t.setBefore()),i.emitEvent(new B(n,r,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?(K(t,!0),e.add(t),t.isBranch&&it(t,e),st(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),st(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||tt(s[t])}tt(i)}})}(this.__levelList),function(t){t.list.forEach(et)}(s),this.extraBlock&&r.push(this.extraBlock),r.forEach(t=>t.setAfter()),i.emitEvent(new B(a,r,this.times)),i.emitEvent(new B(o,r,this.times)),this.addBlocks(r),this.__levelList.reset(),this.__updatedList=null,R.end(e)}fullLayout(){const t=R.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:n}=B,a=this.getBlocks(new f(e));e.emitEvent(new B(i,a,this.times)),ct.fullLayout(e),a.forEach(t=>{t.setAfter()}),e.emitEvent(new B(s,a,this.times)),e.emitEvent(new B(n,a,this.times)),this.addBlocks(a),R.end(t)}static fullLayout(t){ot(t,!0),t.isBranch?y.updateBounds(t):m.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_([[B.REQUEST,this.layout,this],[B.AGAIN,this.layoutAgain,this],[_.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const dt=b.get("Renderer");class ht{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=a.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(B.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(p.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(p.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(p.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new x,dt.log(e.innerName,"---\x3e");try{this.emitRender(p.START),this.renderOnce(t),this.emitRender(p.END,this.totalBounds),E.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 x,this.renderOptions={},t)this.emitRender(p.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(p.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(p.RENDER,this.renderBounds,this.renderOptions),this.emitRender(p.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=R.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),n=new x(s);i.save(),s.spread(ht.clipSpread).ceil(),i.clearWorld(s),i.clipWorld(s),this.__render(s,n),i.restore(),R.end(e)}fullRender(){const t=R.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),R.end(t)}__render(t,e){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),b.showRepaint&&b.drawRepaint(s,t),i.render(this.target,s,a),this.renderBounds=e=e||t,this.renderOptions=a,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),s.updateRender(e)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new x;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 e=()=>{const t=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:s}=this.config;if(s&&t>s)return i.requestRender(e);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()};i.requestRender(e)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new x(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 x(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 p(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[p.REQUEST,this.update,this],[B.END,this.__onLayoutEnd,this],[p.AGAIN,this.renderAgain,this],[l.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 ut(t,e){const i=t.__,{rows:s,decorationY:n}=i.__textDrawData;let a;i.__isPlacehold&&i.placeholderColor&&(e.fillStyle=i.placeholderColor);for(let t=0,i=s.length;t<i;t++)a=s[t],a.text?e.fillText(a.text,a.x,a.y):a.data&&a.data.forEach(t=>{e.fillText(t.char,t.x,a.y)});if(n){const{decorationColor:t,decorationHeight:a}=i.__textDrawData;t&&(e.fillStyle=t),s.forEach(t=>n.forEach(i=>e.fillRect(t.x,t.y+i,t.width,a)))}}function ft(t,e){t.__.__font?ut(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function pt(t,e,i){switch(e.__.strokeAlign){case"center":gt(t,1,e,i);break;case"inside":_t(t,"inside",e,i);break;case"outside":e.__.__fillAfterStroke?gt(t,2,e,i):_t(t,"outside",e,i)}}function gt(t,e,i,s){const n=i.__;A(t)?mt(t,e,!0,i,s):(s.setStroke(t,n.__strokeWidth*e,n),wt(i,s))}function _t(t,e,i,s){const n=s.getSameCanvas(!0,!0);n.font=i.__.__font,gt(t,2,i,n),n.blendMode="outside"===e?"destination-out":"destination-in",ut(i,n),n.blendMode="normal",m.copyCanvasByWorld(i,s,n),n.recycle(i.__nowWorld)}function wt(t,e){let i,s=t.__.__textDrawData;const{rows:n,decorationY:a}=s;for(let t=0,s=n.length;t<s;t++)i=n[t],i.text?e.strokeText(i.text,i.x,i.y):i.data&&i.data.forEach(t=>{e.strokeText(t.char,t.x,i.y)});if(a){const{decorationHeight:t}=s;n.forEach(i=>a.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}}function mt(t,e,i,s,n){let a;const o=s.__,{__hasMultiStrokeStyle:r}=o;r||n.setStroke(void 0,o.__strokeWidth*e,o);for(let l=0,c=t.length;l<c;l++)if(a=t[l],(!a.image||!U.checkImage(s,n,a,!1))&&a.style){if(r){const{strokeStyle:t}=a;t?n.setStroke(a.style,o.__getRealStrokeWidth(t)*e,o,t):n.setStroke(a.style,o.__strokeWidth*e,o)}else n.strokeStyle=a.style;a.blendMode?(n.saveBlendMode(a.blendMode),i?wt(s,n):n.stroke(),n.restoreBlendMode()):i?wt(s,n):n.stroke()}}function yt(t,e,i){const s=e.__;if(s.__strokeWidth)if(s.__font)pt(t,e,i);else switch(s.strokeAlign){case"center":vt(t,1,e,i);break;case"inside":!function(t,e,i){i.save(),i.clipUI(e),vt(t,2,e,i),i.restore()}(t,e,i);break;case"outside":!function(t,e,i){const s=e.__;if(s.__fillAfterStroke)vt(t,2,e,i);else{const{renderBounds:n}=e.__layout,a=i.getSameCanvas(!0,!0);e.__drawRenderPath(a),vt(t,2,e,a),a.clipUI(s),a.clearWorld(n),m.copyCanvasByWorld(e,i,a),a.recycle(e.__nowWorld)}}(t,e,i)}}function vt(t,e,i,s){const n=i.__;A(t)?mt(t,e,!1,i,s):(s.setStroke(t,n.__strokeWidth*e,n),s.stroke()),n.__useArrow&&Y.strokeArrow(t,i,s)}ht.clipSpread=10,Object.assign(d,{watcher:(t,e)=>new J(t,e),layouter:(t,e)=>new ct(t,e),renderer:(t,e,i)=>new ht(t,e,i),selector:(t,e)=>{},interaction:(t,e,i,s)=>{}}),i.layout=ct.fullLayout,i.render=function(t,e,i){const s=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new f,t.__render(e,i),i.topList.length&&i.topList.forEach(t=>t.__render(e,s))};const{getSpread:xt,copyAndSpread:St,toOuterOf:bt,getOuterOf:kt,getByMove:Bt,move:Rt,getIntersectData:Et}=L,At={};let Lt;const{stintSet:Tt}=a,{hasTransparent:Ct}=G;function Ot(t,i,s){if(!A(i)||!1===i.visible||0===i.opacity)return;let n;const{boxBounds:a}=s.__layout;switch(i.type){case"image":n=U.image(s,t,i,a,!Lt||!Lt[i.url]);break;case"linear":n=N.linearGradient(i,a);break;case"radial":n=N.radialGradient(i,a);break;case"angular":n=N.conicGradient(i,a);break;case"solid":const{type:e,color:o,opacity:l}=i;n={type:e,style:G.string(o,l)};break;default:r(i.r)||(n={type:"solid",style:G.string(i)})}if(n){if(e(n.style)&&Ct(n.style)&&(n.isTransparent=!0),i.style){if(0===i.style.strokeWidth)return;n.strokeStyle=i.style}i.editing&&(n.editing=i.editing),i.blendMode&&(n.blendMode=i.blendMode)}return n}const Wt={compute:function(t,e){const i=e.__,s=[];let n,a,o,r=i.__input[t];S(r)||(r=[r]),Lt=U.recycleImage(t,i);for(let i,n=0,a=r.length;n<a;n++)(i=Ot(t,r[n],e))&&(s.push(i),i.strokeStyle&&(o||(o=1),i.strokeStyle.strokeWidth&&(o=Math.max(o,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",o))},fill:function(t,e,i){i.fillStyle=t,ft(e,i)},fills:function(t,e,i){let s;for(let n=0,a=t.length;n<a;n++){if(s=t[n],s.image){if(U.checkImage(e,i,s,!e.__.__font))continue;if(!s.style){!n&&s.image.isPlacehold&&e.drawImagePlaceholder(i,s.image);continue}}if(i.fillStyle=s.style,s.transform||s.scaleFixed){if(i.save(),s.transform&&i.transform(s.transform),s.scaleFixed){const{scaleX:t,scaleY:n}=e.getRenderScaleData(!0);(!0===s.scaleFixed||"zoom-in"===s.scaleFixed&&t>1&&n>1)&&i.scale(1/t,1/n)}s.blendMode&&(i.blendMode=s.blendMode),ft(e,i),i.restore()}else s.blendMode?(i.saveBlendMode(s.blendMode),ft(e,i),i.restoreBlendMode()):ft(e,i)}},fillPathOrText:ft,fillText:ut,stroke:yt,strokes:function(t,e,i){yt(t,e,i)},strokeText:pt,drawTextStroke:wt,shape:function(t,e,s){const n=e.getSameCanvas(),a=e.bounds,o=t.__nowWorld,r=t.__layout,l=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let c,d,h,u,f,p;bt(r.strokeSpread?(St(At,r.boxBounds,r.strokeSpread),At):r.boxBounds,o,l);let{scaleX:g,scaleY:_}=t.getRenderScaleData(!0);if(a.includes(l))p=n,c=f=l,d=o;else{let n;if(i.fullImageShadow)n=l;else{const t=r.renderShapeSpread?xt(a,T.swapAndScale(r.renderShapeSpread,g,_)):a;n=Et(t,l)}u=a.getFitMatrix(n);let{a:w,d:m}=u;u.a<1&&(p=e.getSameCanvas(),t.__renderShape(p,s),g*=w,_*=m),f=kt(l,u),c=Bt(f,-u.e,-u.f),d=kt(o,u),Rt(d,-u.e,-u.f);const y=s.matrix;y?(h=new C(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(n,s),{canvas:n,matrix:h,fitMatrix:u,bounds:c,renderBounds:d,worldCanvas:p,shapeBounds:f,scaleX:g,scaleY:_}}};let Mt={},Pt=O();const{get:Dt,set:It,rotateOfOuter:zt,translate:Ft,scaleOfOuter:Ut,multiplyParent:Yt,scale:Gt,rotate:Nt,skew:qt}=W;function Xt(t,e,i,s){const n=Dt();Ft(n,e.x,e.y),i&&Gt(n,i,s),t.transform=n}function jt(t,e,i,s,n,a,o){const r=Dt();Ft(r,e.x+i,e.y+s),Gt(r,n,a),o&&zt(r,{x:e.x+e.width/2,y:e.y+e.height/2},o),t.transform=r}function Vt(t,e,i,s,n,a,o,r,l,c){const d=Dt();Qt(d,e,i,s,n,a,o,r),l&&(o||r?(It(Pt),Ut(Pt,e,l,c),Yt(d,Pt)):Ut(d,e,l,c)),t.transform=d}function Ht(t,e,i,s,n,a,o,r,l,c,d,h){const u=Dt();if(h)Qt(u,e,n,a,o,r,l,c);else{if(l)if("center"===d)zt(u,{x:i/2,y:s/2},l);else switch(Nt(u,l),l){case 90:Ft(u,s,0);break;case 180:Ft(u,i,s);break;case 270:Ft(u,0,i)}Mt.x=e.x+n,Mt.y=e.y+a,Ft(u,Mt.x,Mt.y),o&&Ut(u,Mt,o,r)}t.transform=u}function Qt(t,e,i,s,n,a,o,r){o&&Nt(t,o),r&&qt(t,r.x,r.y),n&&Gt(t,n,a),Ft(t,e.x+i,e.y+s)}const{get:Zt,translate:$t}=W,Jt=new x,Kt={},te={};function ee(t,e,i,s){const{changeful:n,sync:a,scaleFixed:o}=i;n&&(t.changeful=n),a&&(t.sync=a),o&&(t.scaleFixed=o),t.data=ie(i,s,e)}function ie(t,i,s){t.padding&&(i=Jt.set(i).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");let{width:n,height:a}=s;const{opacity:o,mode:r,align:l,offset:c,scale:d,size:h,rotation:u,skew:f,clipSize:p,repeat:g,gap:_,filters:w}=t,m=i.width===n&&i.height===a,y={mode:r},v="center"!==l&&(u||0)%180==90;let x,S;switch(L.set(te,0,0,v?a:n,v?n:a),r&&"cover"!==r&&"fit"!==r?((d||h)&&(M.getScaleData(d,h,s,Kt),x=Kt.scaleX,S=Kt.scaleY),(l||_||g)&&(x&&L.scale(te,x,S,!0),l&&P.toPoint(l,te,i,te,!0,!0))):m&&!u||(x=S=L.getFitScale(i,te,"fit"!==r),L.put(i,s,l,x,!1,te),L.scale(te,x,S,!0)),c&&D.move(te,c),r){case"stretch":m||(x=i.width/n,S=i.height/a,Xt(y,i,x,S));break;case"normal":case"clip":if(te.x||te.y||x||p||u||f){let t,e;p&&(t=i.width/p.width,e=i.height/p.height),Vt(y,i,te.x,te.y,x,S,u,f,t,e),t&&(x=x?x*t:t,S=S?S*e:e)}break;case"repeat":(!m||x||u||f)&&Ht(y,i,n,a,te.x,te.y,x,S,u,f,l,t.freeTransform),g||(y.repeat="repeat");const e=A(g);(_||e)&&(y.gap=function(t,e,i,s,n){let a,o;A(t)?(a=t.x,o=t.y):a=o=t;return{x:se(a,i,n.width,e&&e.x),y:se(o,s,n.height,e&&e.y)}}(_,e&&g,te.width,te.height,i));break;default:x&&jt(y,i,te.x,te.y,x,S,u)}return y.transform||(i.x||i.y)&&$t(y.transform=Zt(),i.x,i.y),y.width=n,y.height=a,x&&(y.scaleX=x,y.scaleY=S),o&&(y.opacity=o),w&&(y.filters=w),g&&(y.repeat=e(g)?"x"===g?"repeat-x":"repeat-y":"repeat"),y}function se(t,i,s,n){const a=e(t)||n?(n?s-n*i:s%i)/((n||Math.floor(s/i))-1):t;return"auto"===t&&a<0?0:a}let ne,ae=new x;const{isSame:oe}=L;function re(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||ee(n,s,i,a),!0}function le(t,e){he(t,I.LOAD,e)}function ce(t,e){he(t,I.LOADED,e)}function de(t,e,i){e.error=i,t.forceUpdate("surface"),he(t,I.ERROR,e)}function he(t,e,i){t.hasEvent(e)&&t.emitEvent(new I(e,i))}function ue(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:fe,scale:pe,copy:ge}=W,{floor:_e,ceil:we,max:me,abs:ye}=Math;function ve(t,e,s){let{scaleX:n,scaleY:a}=t.getRenderScaleData(!0,e.scaleFixed);const o=n+"-"+a+"-"+s;if(e.patternId===o||t.destroyed)return!1;{const{image:r,data:l}=e;let c,d,{width:h,height:u,scaleX:f,scaleY:p,transform:g,repeat:_,gap:w}=l;n*=s,a*=s,f&&(f=ye(f),p=ye(p),d=fe(),ge(d,g),pe(d,1/f,1/p),n*=f,a*=p),h*=n,u*=a;const m=h*u;if(!_&&m>i.image.maxCacheSize)return!1;let y=i.image.maxPatternSize;if(r.isSVG){const t=h/r.width;t>1&&(c=t/we(t))}else{const t=r.width*r.height;y>t&&(y=t)}m>y&&(c=Math.sqrt(m/y)),c&&(n/=c,a/=c,h/=c,u/=c),f&&(n/=f,a/=p);const v=w&&w.x*n,x=w&&w.y*a;if(g||1!==n||1!==a){const t=h+(v||0),e=u+(x||0);n/=t/me(_e(t),1),a/=e/me(_e(e),1),d||(d=fe(),g&&ge(d,g)),pe(d,1/n,1/a)}const S=r.getCanvas(h,u,l.opacity,l.filters,v,x,t.leafer&&t.leafer.config.smooth),b=r.getPattern(S,_||i.origin.noRepeat||"no-repeat",d,e);return e.style=b,e.patternId=o,!0}}function xe(t,e,i,s){return new(i||(i=Promise))(function(n,a){function o(t){try{l(s.next(t))}catch(t){a(t)}}function r(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(o,r)}l((s=s.apply(t,e||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const Se={image:function(t,e,i,s,n){let a,o;const r=E.get(i);return ne&&i===ne.paint&&oe(s,ne.boxBounds)?a=ne.leafPaint:(a={type:i.type,image:r},r.hasAlphaPixel&&(a.isTransparent=!0),ne=r.use>1?{leafPaint:a,paint:i,boxBounds:ae.set(s)}:null),(n||r.loading)&&(o={image:r,attrName:e,attrValue:i}),r.ready?(re(t,e,i,r,a,s),n&&(le(t,o),ce(t,o))):r.error?n&&de(t,o,r.error):(n&&(ue(t,!0),le(t,o)),a.loadId=r.load(()=>{ue(t,!1),t.destroyed||(re(t,e,i,r,a,s)&&(r.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),ce(t,o)),a.loadId=void 0},e=>{ue(t,!1),de(t,o,e),a.loadId=void 0}),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{r.ready||(r.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):r.isPlacehold=!0)),a},checkImage:function(t,e,s,n){const{scaleX:a,scaleY:o}=t.getRenderScaleData(!0,s.scaleFixed),{pixelRatio:r}=e,{data:c}=s;if(!c||s.patternId===a+"-"+o+"-"+r&&!q.running)return!1;if(n)if(c.repeat)n=!1;else if(!(s.changeful||"miniapp"===i.name&&l.isResizing(t)||q.running)){let{width:t,height:e}=c;t*=a*r,e*=o*r,c.scaleX&&(t*=c.scaleX,e*=c.scaleY),n=t*e>i.image.maxCacheSize}return n?(t.__.__isFastShadow&&(e.fillStyle=s.style||"#000",e.fill()),function(t,e,i,s){e.save(),e.clipUI(t),i.blendMode&&(e.blendMode=i.blendMode);s.opacity&&(e.opacity*=s.opacity);s.transform&&e.transform(s.transform);e.drawImage(i.image.getFull(s.filters),0,0,s.width,s.height),e.restore()}(t,e,s,c),!0):(!s.style||s.sync||q.running?ve(t,s,r):s.patternTask||(s.patternTask=E.patternTasker.add(()=>xe(this,void 0,void 0,function*(){s.patternTask=null,e.bounds.hit(t.__nowWorld)&&ve(t,s,r),t.forceUpdate("surface")}),300)),!1)},createPattern:ve,recycleImage:function(t,e){const i=e["_"+t];if(S(i)){let s,n,a,o,r;for(let l=0,c=i.length;l<c;l++)s=i[l],n=s.image,r=n&&n.url,r&&(a||(a={}),a[r]=!0,E.recycle(n),n.loading&&(o||(o=e.__input&&e.__input[t]||[],S(o)||(o=[o])),n.unload(i[l].loadId,!o.some(t=>t.url===r))));return a}return null},createData:ee,getPatternData:ie,stretchMode:Xt,fillOrFitMode:jt,clipMode:Vt,repeatMode:Ht},{toPoint:be}=z,{hasTransparent:ke}=G,Be={},Re={};function Ee(t,i,s,n){if(s){let a,o,r,l;for(let t=0,c=s.length;t<c;t++)a=s[t],e(a)?(r=t/(c-1),o=G.string(a,n)):(r=a.offset,o=G.string(a.color,n)),i.addColorStop(r,o),!l&&ke(o)&&(l=!0);l&&(t.isTransparent=!0)}}const{getAngle:Ae,getDistance:Le}=D,{get:Te,rotateOfOuter:Ce,scaleOfOuter:Oe}=W,{toPoint:We}=z,Me={},Pe={};function De(t,e,i,s,n){let a;const{width:o,height:r}=t;if(o!==r||s){const t=Ae(e,i);a=Te(),n?(Oe(a,e,o/r*(s||1),1),Ce(a,e,t+90)):(Oe(a,e,1,o/r*(s||1)),Ce(a,e,t))}return a}const{getDistance:Ie}=D,{toPoint:ze}=z,Fe={},Ue={};const Ye={linearGradient:function(t,e){let{from:s,to:n,type:a,opacity:o}=t;be(s||"top",e,Be),be(n||"bottom",e,Re);const r=i.canvas.createLinearGradient(Be.x,Be.y,Re.x,Re.y),l={type:a,style:r};return Ee(l,r,t.stops,o),l},radialGradient:function(t,e){let{from:s,to:n,type:a,opacity:o,stretch:r}=t;We(s||"center",e,Me),We(n||"bottom",e,Pe);const l=i.canvas.createRadialGradient(Me.x,Me.y,0,Me.x,Me.y,Le(Me,Pe)),c={type:a,style:l};Ee(c,l,t.stops,o);const d=De(e,Me,Pe,r,!0);return d&&(c.transform=d),c},conicGradient:function(t,e){let{from:s,to:n,type:a,opacity:o,stretch:r}=t;ze(s||"center",e,Fe),ze(n||"bottom",e,Ue);const l=i.conicGradientSupport?i.canvas.createConicGradient(0,Fe.x,Fe.y):i.canvas.createRadialGradient(Fe.x,Fe.y,0,Fe.x,Fe.y,Ie(Fe,Ue)),c={type:a,style:l};Ee(c,l,t.stops,o);const d=De(e,Fe,Ue,r||1,i.conicGradientRotate90);return d&&(c.transform=d),c},getTransform:De},{copy:Ge,move:Ne,toOffsetOutBounds:qe}=L,{max:Xe,abs:je}=Math,Ve={},He=new C,Qe={};function Ze(t,e){let i,s,n,a,o=0,r=0,l=0,c=0;return e.forEach(t=>{i=t.x||0,s=t.y||0,a=1.5*(t.blur||0),n=je(t.spread||0),o=Xe(o,n+a-s),r=Xe(r,n+a+i),l=Xe(l,n+a+s),c=Xe(c,n+a-i)}),o===r&&r===l&&l===c?o:[o,r,l,c]}function $e(t,e,s){const{shapeBounds:n}=s;let a,o;i.fullImageShadow?(Ge(Ve,t.bounds),Ne(Ve,e.x-n.x,e.y-n.y),a=t.bounds,o=Ve):(a=n,o=e),t.copyWorld(s.canvas,a,o)}const{toOffsetOutBounds:Je}=L,Ke={};const ti=Ze;const ei={shadow:function(t,e,i){let s,n;const{__nowWorld:a}=t,{shadow:o}=t.__,{worldCanvas:r,bounds:l,renderBounds:c,shapeBounds:d,scaleX:h,scaleY:u}=i,f=e.getSameCanvas(),p=o.length-1;qe(l,Qe,c),o.forEach((o,g)=>{let _=1;if(o.scaleFixed){const t=Math.abs(a.scaleX);t>1&&(_=1/t)}f.setWorldShadow(Qe.offsetX+(o.x||0)*h*_,Qe.offsetY+(o.y||0)*u*_,(o.blur||0)*h*_,G.string(o.color)),n=X.getShadowTransform(t,f,i,o,Qe,_),n&&f.setTransform(n),$e(f,Qe,i),n&&f.resetTransform(),s=c,o.box&&(f.restore(),f.save(),r&&(f.copyWorld(f,c,a,"copy"),s=a),r?f.copyWorld(r,a,a,"destination-out"):f.copyWorld(i.canvas,d,l,"destination-out")),m.copyCanvasByWorld(t,e,f,s,o.blendMode),p&&g<p&&f.clearWorld(s)}),f.recycle(s)},innerShadow:function(t,e,i){let s,n;const{__nowWorld:a}=t,{innerShadow:o}=t.__,{worldCanvas:r,bounds:l,renderBounds:c,shapeBounds:d,scaleX:h,scaleY:u}=i,f=e.getSameCanvas(),p=o.length-1;Je(l,Ke,c),o.forEach((o,g)=>{let _=1;if(o.scaleFixed){const t=Math.abs(a.scaleX);t>1&&(_=1/t)}f.save(),f.setWorldShadow(Ke.offsetX+(o.x||0)*h*_,Ke.offsetY+(o.y||0)*u*_,(o.blur||0)*h*_),n=X.getShadowTransform(t,f,i,o,Ke,_,!0),n&&f.setTransform(n),$e(f,Ke,i),f.restore(),r?(f.copyWorld(f,c,a,"copy"),f.copyWorld(r,a,a,"source-out"),s=a):(f.copyWorld(i.canvas,d,l,"source-out"),s=c),f.fillWorld(s,G.string(o.color),"source-in"),m.copyCanvasByWorld(t,e,f,s,o.blendMode),p&&g<p&&f.clearWorld(s)}),f.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:Ze,getShadowTransform:function(t,e,i,s,n,a,o){if(s.spread){const i=2*s.spread*a*(o?-1:1),{width:r,height:l}=t.__layout.strokeBounds;return He.set().scaleOfOuter({x:(n.x+n.width/2)*e.pixelRatio,y:(n.y+n.height/2)*e.pixelRatio},1+i/r,1+i/l),He}},isTransformShadow(t){},getInnerShadowSpread:ti},{excludeRenderBounds:ii}=v;let si;function ni(t,e,i,s,n,a,o,r){switch(e){case"grayscale":si||(si=!0,n.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,n,a){const o=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,o),a&&s.recycle(o);oi(t,e,i,1,n,a)}(t,i,s,n,o,r);break;case"opacity-path":oi(t,i,s,a,o,r);break;case"path":r&&i.restore()}}function ai(t){return t.getSameCanvas(!1,!0)}function oi(t,e,i,s,n,a){const o=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,o,void 0,n),a?i.recycle(o):i.clearWorld(o)}j.prototype.__renderMask=function(t,e){let i,s,n,a,o,r;const{children:l}=this;for(let c=0,d=l.length;c<d;c++){if(i=l[c],r=i.__.mask,r){o&&(ni(this,o,t,n,s,a,void 0,!0),s=n=null),"clipping"!==r&&"clipping-path"!==r||ii(i,e)||i.__render(t,e),a=i.__.opacity,si=!1,"path"===r||"clipping-path"===r?(a<1?(o="opacity-path",n||(n=ai(t))):(o="path",t.save()),i.__clip(n||t,e)):(o="grayscale"===r?"grayscale":"alpha",s||(s=ai(t)),n||(n=ai(t)),i.__render(s,e));continue}const d=1===a&&i.__.__blendMode;d&&ni(this,o,t,n,s,a,void 0,!1),ii(i,e)||i.__render(n||t,e),d&&ni(this,o,t,n,s,a,d,!1)}ni(this,o,t,n,s,a,void 0,!0)};const ri=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",li=ri+"_#~&*+\\=|≮≯≈≠=…",ci=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 di(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const hi=di("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),ui=di("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),fi=di(ri),pi=di(li),gi=di("- —/~|┆·");var _i;!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"}(_i||(_i={}));const{Letter:wi,Single:mi,Before:yi,After:vi,Symbol:xi,Break:Si}=_i;function bi(t){return hi[t]?wi:gi[t]?Si:ui[t]?yi:fi[t]?vi:pi[t]?xi:ci.test(t)?mi:wi}const ki={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 Bi(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:Ri}=ki,{Letter:Ei,Single:Ai,Before:Li,After:Ti,Symbol:Ci,Break:Oi}=_i;let Wi,Mi,Pi,Di,Ii,zi,Fi,Ui,Yi,Gi,Ni,qi,Xi,ji,Vi,Hi,Qi,Zi=[];function $i(t,e){Yi&&!Ui&&(Ui=Yi),Wi.data.push({char:t,width:e}),Pi+=e}function Ji(){Di+=Pi,Wi.width=Pi,Mi.words.push(Wi),Wi={data:[]},Pi=0}function Ki(){ji&&(Vi.paraNumber++,Mi.paraStart=!0,ji=!1),Yi&&(Mi.startCharSize=Ui,Mi.endCharSize=Yi,Ui=0),Mi.width=Di,Hi.width?Ri(Mi):Qi&&ts(),Zi.push(Mi),Mi={words:[]},Di=0}function ts(){Di>(Vi.maxWidth||0)&&(Vi.maxWidth=Di)}const{top:es,right:is,bottom:ss,left:ns}=F;function as(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 os={getDrawData:function(t,s){e(t)||(t=String(t));let n=0,a=0,o=s.__getInput("width")||0,r=s.__getInput("height")||0;const{textDecoration:l,__font:c,__padding:d}=s;d&&(o?(n=d[ns],o-=d[is]+d[ns]):s.autoSizeAlign||(n=d[ns]),r?(a=d[es],r-=d[es]+d[ss]):s.autoSizeAlign||(a=d[es]));const h={bounds:{x:n,y:a,width:o,height:r},rows:[],paraNumber:0,font:i.canvas.font=c};return function(t,e,s){Vi=t,Zi=t.rows,Hi=t.bounds,Qi=!Hi.width&&!s.autoSizeAlign;const{__letterSpacing:n,paraIndent:a,textCase:o}=s,{canvas:r}=i,{width:l,height:c}=Hi;if(l||c||n||"none"!==o){const t="none"!==s.textWrap,i="break"===s.textWrap;ji=!0,Ni=null,Ui=Fi=Yi=Pi=Di=0,Wi={data:[]},Mi={words:[]},n&&(e=[...e]);for(let s=0,c=e.length;s<c;s++)zi=e[s],"\n"===zi?(Pi&&Ji(),Mi.paraEnd=!0,Ki(),ji=!0):(Gi=bi(zi),Gi===Ei&&"none"!==o&&(zi=Bi(zi,o,!Pi)),Fi=r.measureText(zi).width,n&&(n<0&&(Yi=Fi),Fi+=n),qi=Gi===Ai&&(Ni===Ai||Ni===Ei)||Ni===Ai&&Gi!==Ti,Xi=!(Gi!==Li&&Gi!==Ai||Ni!==Ci&&Ni!==Ti),Ii=ji&&a?l-a:l,t&&l&&Di+Pi+Fi>Ii&&(i?(Pi&&Ji(),Di&&Ki()):(Xi||(Xi=Gi===Ei&&Ni==Ti),qi||Xi||Gi===Oi||Gi===Li||Gi===Ai||Pi+Fi>Ii?(Pi&&Ji(),Di&&Ki()):Di&&Ki()))," "===zi&&!0!==ji&&Di+Pi===0||(Gi===Oi?(" "===zi&&Pi&&Ji(),$i(zi,Fi),Ji()):qi||Xi?(Pi&&Ji(),$i(zi,Fi)):$i(zi,Fi)),Ni=Gi);Pi&&Ji(),Di&&Ki(),Zi.length>0&&(Zi[Zi.length-1].paraEnd=!0)}else e.split("\n").forEach(t=>{Vi.paraNumber++,Di=r.measureText(t).width,Zi.push({x:a||0,text:t,width:Di,paraStart:!0}),Qi&&ts()})}(h,t,s),d&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":as(e,"x",t[ns]);break;case"right":as(e,"x",-t[is])}if(!n&&i.autoSizeAlign)switch(i.verticalAlign){case"top":as(e,"y",t[es]);break;case"bottom":as(e,"y",-t[ss])}}(d,h,s,o,r),function(t,e){const{rows:i,bounds:s}=t,n=i.length,{__lineHeight:a,__baseLine:o,__letterSpacing:r,__clipText:l,textAlign:c,verticalAlign:d,paraSpacing:h,autoSizeAlign:u}=e;let{x:f,y:p,width:g,height:_}=s,w=a*n+(h?h*(t.paraNumber-1):0),m=o;if(l&&w>_)w=Math.max(_,a),n>1&&(t.overflow=n);else if(_||u)switch(d){case"middle":p+=(_-w)/2;break;case"bottom":p+=_-w}m+=p;let y,v,x,S=g||u?g:t.maxWidth;for(let o=0,d=n;o<d;o++){if(y=i[o],y.x=f,y.width<g||y.width>g&&!l)switch(c){case"center":y.x+=(S-y.width)/2;break;case"right":y.x+=S-y.width}y.paraStart&&h&&o>0&&(m+=h),y.y=m,m+=a,t.overflow>o&&m>w&&(y.isOverflow=!0,t.overflow=o+1),v=y.x,x=y.width,r<0&&(y.width<0?(x=-y.width+e.fontSize+r,v-=x,x+=e.fontSize):x-=r),v<s.x&&(s.x=v),x>s.width&&(s.width=x),l&&g&&g<x&&(y.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=p,s.height=w}(h,s),function(t,e,i){const{rows:s}=t,{textAlign:n,paraIndent:a,letterSpacing:o}=e;let r,l,c,d,h,u;s.forEach(t=>{t.words&&(c=a&&t.paraStart?a:0,u=t.words.length,l=i&&("justify"===n||"both"===n)&&u>1?(i-t.width-c)/(u-1):0,d=o||t.isOverflow?0:l>.01?1:2,t.isOverflow&&!o&&(t.textMode=!0),2===d?(t.x+=c,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=c,r=t.x,t.data=[],t.words.forEach((e,i)=>{1===d?(h={char:"",x:r},r=function(t,e,i){return t.forEach(t=>{i.char+=t.char,e+=t.width}),e}(e.data,r,h),(t.isOverflow||" "!==h.char)&&t.data.push(h)):r=function(t,e,i,s){return t.forEach(t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width}),e}(e.data,r,t.data,t.isOverflow),!l||t.paraEnd&&"both"!==n||i===u-1||(r+=l,t.width+=l)})),t.words=null)})}(h,s,o),h.overflow&&function(t,e,s,n){if(!n)return;const{rows:a,overflow:o}=t;let{textOverflow:r}=e;if(a.splice(o),r&&"show"!==r){let t,l;"hide"===r?r="":"ellipsis"===r&&(r="...");const c=r?i.canvas.measureText(r).width:0,d=s+n-c;("none"===e.textWrap?a:[a[o-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<d));s--){if(l<d&&" "!==t.char||!s){e.data.splice(s+1),e.width-=t.width;break}e.width-=t.width}e.width+=c,e.data.push({char:r,x:l}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(h,s,n,o),"none"!==l&&function(t,e){let i,s=0;const{fontSize:n,textDecoration:a}=e;switch(t.decorationHeight=n/11,A(a)?(i=a.type,a.color&&(t.decorationColor=G.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]}}(h,s),h}};const rs={string:function(t,i){if(!t)return"#000";const n=s(i)&&i<1;if(e(t)){if(!n||!G.object)return t;t=G.object(t)}let a=r(t.a)?1:t.a;n&&(a*=i);const o=t.r+","+t.g+","+t.b;return 1===a?"rgb("+o+")":"rgba("+o+","+a+")"}};Object.assign(V,os),Object.assign(G,rs),Object.assign(Y,Wt),Object.assign(U,Se),Object.assign(N,Ye),Object.assign(X,ei);try{wx&&$(0,wx)}catch(t){}export{ct as Layouter,H as LeaferCanvas,ht as Renderer,J as Watcher,$ as useCanvas};
|
|
2
2
|
//# sourceMappingURL=miniapp.esm.min.js.map
|