@leafer-ui/miniapp 1.6.3 → 1.6.5
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 +17 -26
- package/dist/miniapp.esm.js +19 -28
- 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 +28 -29
- package/dist/miniapp.module.min.js +1 -1
- package/dist/miniapp.module.min.js.map +1 -1
- package/package.json +12 -12
package/dist/miniapp.cjs
CHANGED
|
@@ -1122,8 +1122,6 @@ function fillPathOrText(ui, canvas) {
|
|
|
1122
1122
|
ui.__.__font ? fillText(ui, canvas) : (ui.__.windingRule ? canvas.fill(ui.__.windingRule) : canvas.fill());
|
|
1123
1123
|
}
|
|
1124
1124
|
|
|
1125
|
-
const Paint = {};
|
|
1126
|
-
|
|
1127
1125
|
function strokeText(stroke, ui, canvas) {
|
|
1128
1126
|
switch (ui.__.strokeAlign) {
|
|
1129
1127
|
case 'center':
|
|
@@ -1149,11 +1147,14 @@ function drawAlign(stroke, align, ui, canvas) {
|
|
|
1149
1147
|
out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
|
|
1150
1148
|
fillText(ui, out);
|
|
1151
1149
|
out.blendMode = 'normal';
|
|
1152
|
-
|
|
1150
|
+
copyWorld(canvas, out, ui);
|
|
1151
|
+
out.recycle(ui.__nowWorld);
|
|
1152
|
+
}
|
|
1153
|
+
function copyWorld(canvas, out, ui) {
|
|
1154
|
+
if (ui.__worldFlipped || core.Platform.fullImageShadow)
|
|
1153
1155
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
1154
1156
|
else
|
|
1155
1157
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
1156
|
-
out.recycle(ui.__nowWorld);
|
|
1157
1158
|
}
|
|
1158
1159
|
function drawTextStroke(ui, canvas) {
|
|
1159
1160
|
let row, data = ui.__.__textDrawData;
|
|
@@ -1219,12 +1220,11 @@ function drawCenter(stroke, strokeWidthScale, ui, canvas) {
|
|
|
1219
1220
|
canvas.setStroke(!data.__isStrokes && stroke, data.__strokeWidth * strokeWidthScale, data);
|
|
1220
1221
|
data.__isStrokes ? drawStrokesStyle(stroke, false, ui, canvas) : canvas.stroke();
|
|
1221
1222
|
if (data.__useArrow)
|
|
1222
|
-
Paint.strokeArrow(stroke, ui, canvas);
|
|
1223
|
+
draw.Paint.strokeArrow(stroke, ui, canvas);
|
|
1223
1224
|
}
|
|
1224
1225
|
function drawInside(stroke, ui, canvas) {
|
|
1225
|
-
const data = ui.__;
|
|
1226
1226
|
canvas.save();
|
|
1227
|
-
|
|
1227
|
+
canvas.clipUI(ui);
|
|
1228
1228
|
drawCenter(stroke, 2, ui, canvas);
|
|
1229
1229
|
canvas.restore();
|
|
1230
1230
|
}
|
|
@@ -1238,12 +1238,9 @@ function drawOutside(stroke, ui, canvas) {
|
|
|
1238
1238
|
const out = canvas.getSameCanvas(true, true);
|
|
1239
1239
|
ui.__drawRenderPath(out);
|
|
1240
1240
|
drawCenter(stroke, 2, ui, out);
|
|
1241
|
-
|
|
1241
|
+
out.clipUI(data);
|
|
1242
1242
|
out.clearWorld(renderBounds);
|
|
1243
|
-
|
|
1244
|
-
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
1245
|
-
else
|
|
1246
|
-
canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
|
|
1243
|
+
copyWorld(canvas, out, ui);
|
|
1247
1244
|
out.recycle(ui.__nowWorld);
|
|
1248
1245
|
}
|
|
1249
1246
|
}
|
|
@@ -1299,9 +1296,7 @@ function compute(attrName, ui) {
|
|
|
1299
1296
|
paints = [paints];
|
|
1300
1297
|
recycleMap = draw.PaintImage.recycleImage(attrName, data);
|
|
1301
1298
|
for (let i = 0, len = paints.length, item; i < len; i++) {
|
|
1302
|
-
item = getLeafPaint(attrName, paints[i], ui);
|
|
1303
|
-
if (item)
|
|
1304
|
-
leafPaints.push(item);
|
|
1299
|
+
(item = getLeafPaint(attrName, paints[i], ui)) && leafPaints.push(item);
|
|
1305
1300
|
}
|
|
1306
1301
|
data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
|
|
1307
1302
|
if (leafPaints.length) {
|
|
@@ -1339,8 +1334,8 @@ function getLeafPaint(attrName, paint, ui) {
|
|
|
1339
1334
|
data = draw.PaintGradient.conicGradient(paint, boxBounds);
|
|
1340
1335
|
break;
|
|
1341
1336
|
case 'solid':
|
|
1342
|
-
const { type,
|
|
1343
|
-
data = { type,
|
|
1337
|
+
const { type, color, opacity } = paint;
|
|
1338
|
+
data = { type, style: draw.ColorConvert.string(color, opacity) };
|
|
1344
1339
|
break;
|
|
1345
1340
|
default:
|
|
1346
1341
|
if (paint.r !== undefined)
|
|
@@ -1749,7 +1744,7 @@ function checkImage(ui, canvas, paint, allowDraw) {
|
|
|
1749
1744
|
}
|
|
1750
1745
|
function drawImage(ui, canvas, paint, data) {
|
|
1751
1746
|
canvas.save();
|
|
1752
|
-
|
|
1747
|
+
canvas.clipUI(ui);
|
|
1753
1748
|
if (paint.blendMode)
|
|
1754
1749
|
canvas.blendMode = paint.blendMode;
|
|
1755
1750
|
if (data.opacity)
|
|
@@ -1914,12 +1909,10 @@ function shadow(ui, current, shape) {
|
|
|
1914
1909
|
}
|
|
1915
1910
|
worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, 'destination-out') : other.copyWorld(shape.canvas, shapeBounds, bounds, 'destination-out');
|
|
1916
1911
|
}
|
|
1917
|
-
if (ui.__worldFlipped)
|
|
1912
|
+
if (ui.__worldFlipped)
|
|
1918
1913
|
current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
|
|
1919
|
-
|
|
1920
|
-
else {
|
|
1914
|
+
else
|
|
1921
1915
|
current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
|
|
1922
|
-
}
|
|
1923
1916
|
if (end && index < end)
|
|
1924
1917
|
other.clearWorld(copyBounds, true);
|
|
1925
1918
|
});
|
|
@@ -1978,12 +1971,10 @@ function innerShadow(ui, current, shape) {
|
|
|
1978
1971
|
copyBounds = bounds;
|
|
1979
1972
|
}
|
|
1980
1973
|
other.fillWorld(copyBounds, draw.ColorConvert.string(item.color), 'source-in');
|
|
1981
|
-
if (ui.__worldFlipped)
|
|
1974
|
+
if (ui.__worldFlipped)
|
|
1982
1975
|
current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
|
|
1983
|
-
|
|
1984
|
-
else {
|
|
1976
|
+
else
|
|
1985
1977
|
current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
|
|
1986
|
-
}
|
|
1987
1978
|
if (end && index < end)
|
|
1988
1979
|
other.clearWorld(copyBounds, true);
|
|
1989
1980
|
});
|
package/dist/miniapp.esm.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { LeaferCanvasBase, Platform, canvasPatch, DataHelper, canvasSizeAttrs, ResizeEvent, FileHelper, Creator, LeaferImage, defineKey, LeafList, RenderEvent, ChildEvent, WatchEvent, PropertyEvent, LeafHelper, BranchHelper, LeafBoundsHelper, Bounds, Debug, LeafLevelList, LayoutEvent, Run, ImageManager, BoundsHelper, Plugin, MatrixHelper, MathHelper, AlignHelper, PointHelper, ImageEvent, AroundHelper, Direction4 } from '@leafer/core';
|
|
2
2
|
export * from '@leafer/core';
|
|
3
3
|
export { LeaferImage } from '@leafer/core';
|
|
4
|
-
import { InteractionHelper, InteractionBase,
|
|
4
|
+
import { InteractionHelper, InteractionBase, HitCanvasManager } from '@leafer-ui/core';
|
|
5
5
|
export * from '@leafer-ui/core';
|
|
6
|
-
import { PaintImage, ColorConvert, PaintGradient, Export, Group, TextConvert,
|
|
6
|
+
import { PaintImage, Paint, ColorConvert, PaintGradient, Export, Group, TextConvert, Effect, Leafer } from '@leafer-ui/draw';
|
|
7
7
|
|
|
8
8
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
9
9
|
get allowBackgroundColor() { return false; }
|
|
@@ -1123,8 +1123,6 @@ function fillPathOrText(ui, canvas) {
|
|
|
1123
1123
|
ui.__.__font ? fillText(ui, canvas) : (ui.__.windingRule ? canvas.fill(ui.__.windingRule) : canvas.fill());
|
|
1124
1124
|
}
|
|
1125
1125
|
|
|
1126
|
-
const Paint = {};
|
|
1127
|
-
|
|
1128
1126
|
function strokeText(stroke, ui, canvas) {
|
|
1129
1127
|
switch (ui.__.strokeAlign) {
|
|
1130
1128
|
case 'center':
|
|
@@ -1150,11 +1148,14 @@ function drawAlign(stroke, align, ui, canvas) {
|
|
|
1150
1148
|
out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
|
|
1151
1149
|
fillText(ui, out);
|
|
1152
1150
|
out.blendMode = 'normal';
|
|
1153
|
-
|
|
1151
|
+
copyWorld(canvas, out, ui);
|
|
1152
|
+
out.recycle(ui.__nowWorld);
|
|
1153
|
+
}
|
|
1154
|
+
function copyWorld(canvas, out, ui) {
|
|
1155
|
+
if (ui.__worldFlipped || Platform.fullImageShadow)
|
|
1154
1156
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
1155
1157
|
else
|
|
1156
1158
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
1157
|
-
out.recycle(ui.__nowWorld);
|
|
1158
1159
|
}
|
|
1159
1160
|
function drawTextStroke(ui, canvas) {
|
|
1160
1161
|
let row, data = ui.__.__textDrawData;
|
|
@@ -1223,9 +1224,8 @@ function drawCenter(stroke, strokeWidthScale, ui, canvas) {
|
|
|
1223
1224
|
Paint.strokeArrow(stroke, ui, canvas);
|
|
1224
1225
|
}
|
|
1225
1226
|
function drawInside(stroke, ui, canvas) {
|
|
1226
|
-
const data = ui.__;
|
|
1227
1227
|
canvas.save();
|
|
1228
|
-
|
|
1228
|
+
canvas.clipUI(ui);
|
|
1229
1229
|
drawCenter(stroke, 2, ui, canvas);
|
|
1230
1230
|
canvas.restore();
|
|
1231
1231
|
}
|
|
@@ -1239,12 +1239,9 @@ function drawOutside(stroke, ui, canvas) {
|
|
|
1239
1239
|
const out = canvas.getSameCanvas(true, true);
|
|
1240
1240
|
ui.__drawRenderPath(out);
|
|
1241
1241
|
drawCenter(stroke, 2, ui, out);
|
|
1242
|
-
|
|
1242
|
+
out.clipUI(data);
|
|
1243
1243
|
out.clearWorld(renderBounds);
|
|
1244
|
-
|
|
1245
|
-
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
1246
|
-
else
|
|
1247
|
-
canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
|
|
1244
|
+
copyWorld(canvas, out, ui);
|
|
1248
1245
|
out.recycle(ui.__nowWorld);
|
|
1249
1246
|
}
|
|
1250
1247
|
}
|
|
@@ -1300,9 +1297,7 @@ function compute(attrName, ui) {
|
|
|
1300
1297
|
paints = [paints];
|
|
1301
1298
|
recycleMap = PaintImage.recycleImage(attrName, data);
|
|
1302
1299
|
for (let i = 0, len = paints.length, item; i < len; i++) {
|
|
1303
|
-
item = getLeafPaint(attrName, paints[i], ui);
|
|
1304
|
-
if (item)
|
|
1305
|
-
leafPaints.push(item);
|
|
1300
|
+
(item = getLeafPaint(attrName, paints[i], ui)) && leafPaints.push(item);
|
|
1306
1301
|
}
|
|
1307
1302
|
data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
|
|
1308
1303
|
if (leafPaints.length) {
|
|
@@ -1340,8 +1335,8 @@ function getLeafPaint(attrName, paint, ui) {
|
|
|
1340
1335
|
data = PaintGradient.conicGradient(paint, boxBounds);
|
|
1341
1336
|
break;
|
|
1342
1337
|
case 'solid':
|
|
1343
|
-
const { type,
|
|
1344
|
-
data = { type,
|
|
1338
|
+
const { type, color, opacity } = paint;
|
|
1339
|
+
data = { type, style: ColorConvert.string(color, opacity) };
|
|
1345
1340
|
break;
|
|
1346
1341
|
default:
|
|
1347
1342
|
if (paint.r !== undefined)
|
|
@@ -1750,7 +1745,7 @@ function checkImage(ui, canvas, paint, allowDraw) {
|
|
|
1750
1745
|
}
|
|
1751
1746
|
function drawImage(ui, canvas, paint, data) {
|
|
1752
1747
|
canvas.save();
|
|
1753
|
-
|
|
1748
|
+
canvas.clipUI(ui);
|
|
1754
1749
|
if (paint.blendMode)
|
|
1755
1750
|
canvas.blendMode = paint.blendMode;
|
|
1756
1751
|
if (data.opacity)
|
|
@@ -1915,12 +1910,10 @@ function shadow(ui, current, shape) {
|
|
|
1915
1910
|
}
|
|
1916
1911
|
worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, 'destination-out') : other.copyWorld(shape.canvas, shapeBounds, bounds, 'destination-out');
|
|
1917
1912
|
}
|
|
1918
|
-
if (ui.__worldFlipped)
|
|
1913
|
+
if (ui.__worldFlipped)
|
|
1919
1914
|
current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
|
|
1920
|
-
|
|
1921
|
-
else {
|
|
1915
|
+
else
|
|
1922
1916
|
current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
|
|
1923
|
-
}
|
|
1924
1917
|
if (end && index < end)
|
|
1925
1918
|
other.clearWorld(copyBounds, true);
|
|
1926
1919
|
});
|
|
@@ -1979,12 +1972,10 @@ function innerShadow(ui, current, shape) {
|
|
|
1979
1972
|
copyBounds = bounds;
|
|
1980
1973
|
}
|
|
1981
1974
|
other.fillWorld(copyBounds, ColorConvert.string(item.color), 'source-in');
|
|
1982
|
-
if (ui.__worldFlipped)
|
|
1975
|
+
if (ui.__worldFlipped)
|
|
1983
1976
|
current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
|
|
1984
|
-
|
|
1985
|
-
else {
|
|
1977
|
+
else
|
|
1986
1978
|
current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
|
|
1987
|
-
}
|
|
1988
1979
|
if (end && index < end)
|
|
1989
1980
|
other.clearWorld(copyBounds, true);
|
|
1990
1981
|
});
|
|
@@ -2620,7 +2611,7 @@ const ColorConvertModule = {
|
|
|
2620
2611
|
|
|
2621
2612
|
Object.assign(TextConvert, TextConvertModule);
|
|
2622
2613
|
Object.assign(ColorConvert, ColorConvertModule);
|
|
2623
|
-
Object.assign(Paint
|
|
2614
|
+
Object.assign(Paint, PaintModule);
|
|
2624
2615
|
Object.assign(PaintImage, PaintImageModule);
|
|
2625
2616
|
Object.assign(PaintGradient, PaintGradientModule);
|
|
2626
2617
|
Object.assign(Effect, EffectModule);
|
package/dist/miniapp.esm.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{LeaferCanvasBase as t,Platform as e,canvasPatch as i,DataHelper as s,canvasSizeAttrs as n,ResizeEvent as o,FileHelper as a,Creator as r,LeaferImage as h,defineKey as c,LeafList as l,RenderEvent as d,ChildEvent as u,WatchEvent as f,PropertyEvent as g,LeafHelper as p,BranchHelper as _,LeafBoundsHelper as w,Bounds as y,Debug as m,LeafLevelList as v,LayoutEvent as x,Run as b,ImageManager as B,BoundsHelper as S,Plugin as k,MatrixHelper as R,MathHelper as T,AlignHelper as E,PointHelper as L,ImageEvent as A,AroundHelper as C,Direction4 as W}from"@leafer/core";export*from"@leafer/core";export{LeaferImage}from"@leafer/core";import{InteractionHelper as P,InteractionBase as M,Platform as O,HitCanvasManager as D}from"@leafer-ui/core";export*from"@leafer-ui/core";import{PaintImage as I,ColorConvert as z,PaintGradient as F,Export as U,Group as Y,TextConvert as j,Paint as G,Effect as N,Leafer as X}from"@leafer-ui/draw";class q extends t{get allowBackgroundColor(){return!1}init(){const{config:t}=this;let i=t.view||t.canvas;i?("string"==typeof i?("#"!==i[0]&&(i="#"+i),this.viewSelect=e.miniapp.select(i)):i.fields?this.viewSelect=i:this.initView(i),this.viewSelect&&e.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:s,height:n,pixelRatio:o}=this.config,a={width:s||t.width,height:n||t.height,pixelRatio:o};this.resize(a),this.context&&(this.viewSelect&&(e.renderCanvas=this),this.context.roundRect&&(this.roundRect=function(t,e,i,s,n){this.context.roundRect(t,e,i,s,"number"==typeof n?[n]:n)}),i(this.context.__proto__))}__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)}updateClientBounds(t){this.viewSelect&&e.miniapp.getBounds(this.viewSelect).then((e=>{this.clientBounds=e,t&&t()}))}startAutoLayout(t,i){this.resizeListener=i,t&&(this.checkSize=this.checkSize.bind(this),e.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,e.miniapp.offWindowResize(this.checkSize)}unrealCanvas(){this.unreal=!0}emitResize(t){const e={};s.copyAttrs(e,this,n),this.resize(t),void 0!==this.width&&this.resizeListener(new o(t,e))}}const{mineType:H,fileType:V}=a;function Q(t,i){e.origin={createCanvas:(t,e,s)=>{const n={type:"2d",width:t,height:e};return i.createOffscreenCanvas?i.createOffscreenCanvas(n):i.createOffScreenCanvas(n)},canvasToDataURL:(t,e,i)=>t.toDataURL(H(e),i),canvasToBolb:(t,e,i)=>t.toBuffer(e,{quality:i}),canvasSaveAs:(t,i,s)=>{let n=t.toDataURL(H(V(i)),s);return n=n.substring(n.indexOf("64,")+3),e.origin.download(n,i)},download:(t,s)=>new Promise(((n,o)=>{let a;s.includes("/")||(s=`${i.env.USER_DATA_PATH}/`+s,a=!0);const r=i.getFileSystemManager();r.writeFile({filePath:s,data:t,encoding:"base64",success(){a?e.miniapp.saveToAlbum(s).then((()=>{r.unlink({filePath:s}),n()})):n()},fail(t){o(t)}})})),loadImage:t=>new Promise(((i,s)=>{const n=e.canvas.view.createImage();n.onload=()=>{i(n)},n.onerror=t=>{s(t)},n.src=e.image.getRealURL(t)})),noRepeat:"repeat-x"},e.miniapp={select:t=>i.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((e=>{i.getSetting({success:s=>{s.authSetting["scope.writePhotosAlbum"]?i.saveImageToPhotosAlbum({filePath:t,success(){e(!0)}}):i.authorize({scope:"scope.writePhotosAlbum",success:()=>{i.saveImageToPhotosAlbum({filePath:t,success(){e(!0)}})},fail:()=>{}})}})})),onWindowResize(t){i.onWindowResize(t)},offWindowResize(t){i.offWindowResize(t)}},e.event={stopDefault(t){},stopNow(t){},stop(t){}},e.canvas=r.canvas(),e.conicGradientSupport=!!e.canvas.context.createConicGradient}Object.assign(r,{canvas:(t,e)=>new q(t,e),image:t=>new h(t)}),e.name="miniapp",e.requestRender=function(t){const{view:i}=e.renderCanvas||e.canvas;i.requestAnimationFrame?i.requestAnimationFrame(t):setTimeout(t,16)},c(e,"devicePixelRatio",{get:()=>Math.max(1,wx.getSystemInfoSync().pixelRatio)});class K{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new l;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 l,this.target=t,e&&(this.config=s.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===u.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 f(f.DATA,{updatedList:this.updatedList})),this.__updatedList=new l,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[g.CHANGE,this.__onAttrChange,this],[[u.ADD,u.REMOVE],this.__onChildEvent,this],[f.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:Z,updateBounds:$,updateChange:J}=p,{pushAllChildBranch:tt,pushAllParent:et}=_;const{worldBounds:it}=w;class st{constructor(t){this.updatedBounds=new y,this.beforeBounds=new y,this.afterBounds=new y,t instanceof Array&&(t=new l(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,it)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,it),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:ot}=p,at=m.get("Layouter");class rt{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new v,this.target=t,e&&(this.config=s.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){at.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?at.warn("layouting"):this.times>3?at.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(f.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=b.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:n,LAYOUT:o,AFTER:a}=x,r=this.getBlocks(s);r.forEach((t=>t.setBefore())),i.emitEvent(new x(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?(Z(t,!0),e.add(t),t.isBranch&&tt(t,e),et(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),et(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||$(s[t])}$(i)}}))}(this.__levelList),function(t){t.list.forEach(J)}(s),this.extraBlock&&r.push(this.extraBlock),r.forEach((t=>t.setAfter())),i.emitEvent(new x(o,r,this.times)),i.emitEvent(new x(a,r,this.times)),this.addBlocks(r),this.__levelList.reset(),this.__updatedList=null,b.end(e)}fullLayout(){const t=b.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:n}=x,o=this.getBlocks(new l(e));e.emitEvent(new x(i,o,this.times)),rt.fullLayout(e),o.forEach((t=>{t.setAfter()})),e.emitEvent(new x(s,o,this.times)),e.emitEvent(new x(n,o,this.times)),this.addBlocks(o),b.end(t)}static fullLayout(t){nt(t,!0),t.isBranch?_.updateBounds(t):p.updateBounds(t),ot(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new st([]));e.length?i.add(t.__world):i.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],[f.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const ht=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:60},this.target=t,this.canvas=e,i&&(this.config=s.default(i,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.__requestRender()}requestLayout(){this.target.emit(x.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(d.CHILD_START,t),t.children.forEach((t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()})),t.emit(d.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(d.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new y,ht.log(e.innerName,"---\x3e");try{this.emitRender(d.START),this.renderOnce(t),this.emitRender(d.END,this.totalBounds),B.clearRecycled()}catch(t){this.rendering=!1,ht.error(t)}ht.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return ht.warn("rendering");if(this.times>3)return ht.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new y,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=b.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),n=new y(s);i.save(),s.spread(ct.clipSpread).ceil(),i.clearWorld(s,!0),i.clipWorld(s,!0),this.__render(s,n),i.restore(),b.end(e)}fullRender(){const t=b.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),b.end(t)}__render(t,e){const{canvas:i}=this,s=t.includes(this.target.__world),n=s?{includes:s}:{bounds:t,includes:s};this.needFill&&i.fillWorld(t,this.config.fill),m.showRepaint&&m.drawRepaint(i,t),this.target.__render(i,n),this.renderBounds=e=e||t,this.renderOptions=n,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),i.updateRender(e)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new y;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);const i=this.requestTime=Date.now();e.requestRender((()=>{this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-i))),this.requestTime=0,this.checkRender()}))}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new y(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 y(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||ht.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],[o.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.canvas=this.config=null)}}ct.clipSpread=10;const{hitRadiusPoint:lt}=S;class dt{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,n=i.ignoreHittable||!1,o=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new l(i.findList),i.findList||this.hitBranch(o);const{list:a}=this.findList,r=this.getBestMatchLeaf(a,i.bottomList,n),h=n?this.getPath(r):this.getHitablePath(r);return this.clear(),s?{path:h,target:r,throughPath:a.length?this.getThroughPath(a):h}:{path:h,target:r}}getBestMatchLeaf(t,e,i){if(t.length){let e;this.findList=new l;const{x:s,y:n}=this.point,o={x:s,y:n,radiusX:0,radiusY:0};for(let s=0,n=t.length;s<n;s++)if(e=t[s],(i||p.worldHittable(e))&&(this.hitChild(e,o),this.findList.length))return this.findList.list[0]}if(e)for(let t=0,i=e.length;t<i;t++)if(this.hitChild(e[t].target,this.point,e[t].proxy),this.findList.length)return this.findList.list[0];return t[0]}getPath(t){const e=new l;for(;t;)e.add(t),t=t.parent;return this.target&&e.add(this.target),e}getHitablePath(t){const e=this.getPath(t&&t.hittable?t:null);let i,s=new l;for(let t=e.list.length-1;t>-1&&(i=e.list[t],i.__.hittable)&&(s.addAt(i,0),i.__.hitChildren);t--);return s}getThroughPath(t){const e=new l,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,n,o;for(let t=0,a=i.length;t<a;t++){s=i[t],n=i[t+1];for(let t=0,i=s.length;t<i&&(o=s.list[t],!n||!n.has(o));t++)e.add(o)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s;const{point:n}=this;for(let o=t.length-1;o>-1;o--)i=t[o],!i.__.visible||e&&!i.__.mask||(s=!!i.__.hitRadius||lt(i.__world,n),i.isBranch?(s||i.__ignoreHitWorld)&&(this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,n)):s&&this.hitChild(i,n))}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:s}=t;if(s&&s.__hasMask&&!t.__.mask&&!s.children.some((t=>t.__.mask&&t.__hitWorld(e))))return;this.findList.add(i||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class ut{constructor(t,e){this.config={},e&&(this.config=s.default(e,this.config)),this.picker=new dt(this.target=t,this),this.finder=r.finder&&r.finder()}getByPoint(t,i,s){const{target:n,picker:o}=this;return e.backgrounder&&n&&n.updateLayout(),o.getByPoint(t,i,s)}getBy(t,e,i,s){return this.finder?this.finder.getBy(t,e,i,s):k.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}Object.assign(r,{watcher:(t,e)=>new K(t,e),layouter:(t,e)=>new rt(t,e),renderer:(t,e,i)=>new ct(t,e,i),selector:(t,e)=>new ut(t,e)}),e.layout=rt.fullLayout;const ft={convertTouch(t,e){const i=ft.getTouch(t),s=P.getBase(t);return Object.assign(Object.assign({},s),{x:e.x,y:e.y,width:1,height:1,pointerType:"touch",multiTouch:t.touches.length>1,pressure:i.force||1})},getTouch:t=>t.touches[0]||t.changedTouches[0]};class gt extends M{__listenEvents(){super.__listenEvents(),this.config.eventer&&(this.config.eventer.receiveEvent=this.receive.bind(this))}receive(t){switch(t.type){case"touchstart":this.onTouchStart(t);break;case"touchmove":this.onTouchMove(t);break;case"touchend":this.onTouchEnd(t);break;case"touchcancel":this.onTouchCancel()}}getLocal(t,e){return void 0!==t.x?{x:t.x,y:t.y}:super.getLocal(t,e)}getTouches(t){return t}onTouchStart(t){this.multiTouchStart(t);const e=ft.getTouch(t);this.pointerDown(ft.convertTouch(t,this.getLocal(e,!0)))}onTouchMove(t){if(this.multiTouchMove(t),this.useMultiTouch)return;const e=ft.getTouch(t);this.pointerMove(ft.convertTouch(t,this.getLocal(e)))}onTouchEnd(t){this.multiTouchEnd();const e=ft.getTouch(t);this.pointerUp(ft.convertTouch(t,this.getLocal(e)))}onTouchCancel(){this.pointerCancel()}multiTouchStart(t){this.useMultiTouch=t.touches.length>1,this.touches=this.useMultiTouch?this.getTouches(t.touches):void 0,this.useMultiTouch&&this.pointerCancel()}multiTouchMove(t){if(this.useMultiTouch&&t.touches.length>1){const e=this.getTouches(t.touches),i=this.getKeepTouchList(this.touches,e);i.length>1&&(this.multiTouch(P.getBase(t),i),this.touches=e)}}multiTouchEnd(){this.touches=null,this.useMultiTouch=!1,this.transformEnd()}getKeepTouchList(t,e){let i;const s=[];return t.forEach((t=>{i=e.find((e=>e.identifier===t.identifier)),i&&s.push({from:this.getLocal(t),to:this.getLocal(i)})})),s}getLocalTouchs(t){return t.map((t=>this.getLocal(t)))}destroy(){super.destroy(),this.touches=null}}function pt(t,e){const i=t.__,{rows:s,decorationY:n}=i.__textDrawData;let o;i.__isPlacehold&&i.placeholderColor&&(e.fillStyle=i.placeholderColor);for(let t=0,i=s.length;t<i;t++)o=s[t],o.text?e.fillText(o.text,o.x,o.y):o.data&&o.data.forEach((t=>{e.fillText(t.char,t.x,o.y)}));if(n){const{decorationColor:t,decorationHeight:o}=i.__textDrawData;t&&(e.fillStyle=t),s.forEach((t=>n.forEach((i=>e.fillRect(t.x,t.y+i,t.width,o)))))}}function _t(t,e){t.__.__font?pt(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}const wt={};function yt(t,e,i){switch(e.__.strokeAlign){case"center":mt(t,1,e,i);break;case"inside":vt(t,"inside",e,i);break;case"outside":e.__.__fillAfterStroke?mt(t,2,e,i):vt(t,"outside",e,i)}}function mt(t,e,i,s){const n=i.__;s.setStroke(!n.__isStrokes&&t,n.strokeWidth*e,n),n.__isStrokes?bt(t,!0,i,s):xt(i,s)}function vt(t,e,i,s){const n=s.getSameCanvas(!0,!0);n.font=i.__.__font,mt(t,2,i,n),n.blendMode="outside"===e?"destination-out":"destination-in",pt(i,n),n.blendMode="normal",i.__worldFlipped||O.fullImageShadow?s.copyWorldByReset(n,i.__nowWorld):s.copyWorldToInner(n,i.__nowWorld,i.__layout.renderBounds),n.recycle(i.__nowWorld)}function xt(t,e){let i,s=t.__.__textDrawData;const{rows:n,decorationY:o}=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(o){const{decorationHeight:t}=s;n.forEach((i=>o.forEach((s=>e.strokeRect(i.x,i.y+s,i.width,t)))))}}function bt(t,e,i,s){let n;for(let o=0,a=t.length;o<a;o++)n=t[o],n.image&&I.checkImage(i,s,n,!1)||n.style&&(s.strokeStyle=n.style,n.blendMode?(s.saveBlendMode(n.blendMode),e?xt(i,s):s.stroke(),s.restoreBlendMode()):e?xt(i,s):s.stroke())}function Bt(t,e,i){const s=e.__;if(s.__strokeWidth)if(s.__font)yt(t,e,i);else switch(s.strokeAlign){case"center":St(t,1,e,i);break;case"inside":!function(t,e,i){const s=e.__;i.save(),s.windingRule?i.clip(s.windingRule):i.clip(),St(t,2,e,i),i.restore()}(t,e,i);break;case"outside":!function(t,e,i){const s=e.__;if(s.__fillAfterStroke)St(t,2,e,i);else{const{renderBounds:n}=e.__layout,o=i.getSameCanvas(!0,!0);e.__drawRenderPath(o),St(t,2,e,o),s.windingRule?o.clip(s.windingRule):o.clip(),o.clearWorld(n),e.__worldFlipped||O.fullImageShadow?i.copyWorldByReset(o,e.__nowWorld):i.copyWorldToInner(o,e.__nowWorld,n),o.recycle(e.__nowWorld)}}(t,e,i)}}function St(t,e,i,s){const n=i.__;s.setStroke(!n.__isStrokes&&t,n.__strokeWidth*e,n),n.__isStrokes?bt(t,!1,i,s):s.stroke(),n.__useArrow&&wt.strokeArrow(t,i,s)}const{getSpread:kt,getOuterOf:Rt,getByMove:Tt,getIntersectData:Et}=S;let Lt;const{stintSet:At}=s,{hasTransparent:Ct}=z;function Wt(t,e,i){if("object"!=typeof e||!1===e.visible||0===e.opacity)return;let s;const{boxBounds:n}=i.__layout;switch(e.type){case"image":s=I.image(i,t,e,n,!Lt||!Lt[e.url]);break;case"linear":s=F.linearGradient(e,n);break;case"radial":s=F.radialGradient(e,n);break;case"angular":s=F.conicGradient(e,n);break;case"solid":const{type:o,blendMode:a,color:r,opacity:h}=e;s={type:o,blendMode:a,style:z.string(r,h)};break;default:void 0!==e.r&&(s={type:"solid",style:z.string(e)})}return s&&("string"==typeof s.style&&Ct(s.style)&&(s.isTransparent=!0),e.blendMode&&(s.blendMode=e.blendMode)),s}const Pt={compute:function(t,e){const i=e.__,s=[];let n,o,a=i.__input[t];a instanceof Array||(a=[a]),Lt=I.recycleImage(t,i);for(let i,n=0,o=a.length;n<o;n++)i=Wt(t,a[n],e),i&&s.push(i);i["_"+t]=s.length?s:void 0,s.length&&s.every((t=>t.isTransparent))&&(s.some((t=>t.image))&&(n=!0),o=!0),"fill"===t?(At(i,"__isAlphaPixelFill",n),At(i,"__isTransparentFill",o)):(At(i,"__isAlphaPixelStroke",n),At(i,"__isTransparentStroke",o))},fill:function(t,e,i){i.fillStyle=t,_t(e,i)},fills:function(t,e,i){let s;for(let n=0,o=t.length;n<o;n++){if(s=t[n],s.image){if(I.checkImage(e,i,s,!e.__.__font))continue;if(!s.style){!n&&s.image.isPlacehold&&e.drawImagePlaceholder(i,s.image);continue}}i.fillStyle=s.style,s.transform?(i.save(),i.transform(s.transform),s.blendMode&&(i.blendMode=s.blendMode),_t(e,i),i.restore()):s.blendMode?(i.saveBlendMode(s.blendMode),_t(e,i),i.restoreBlendMode()):_t(e,i)}},fillPathOrText:_t,fillText:pt,stroke:Bt,strokes:function(t,e,i){Bt(t,e,i)},strokeText:yt,drawTextStroke:xt,shape:function(t,e,i){const s=e.getSameCanvas(),n=t.__nowWorld;let o,a,r,h,{scaleX:c,scaleY:l}=n;if(c<0&&(c=-c),l<0&&(l=-l),e.bounds.includes(n))h=s,o=r=n;else{const{renderShapeSpread:s}=t.__layout,d=Et(s?kt(e.bounds,c===l?s*c:[s*l,s*c]):e.bounds,n);a=e.bounds.getFitMatrix(d);let{a:u,d:f}=a;if(a.a<1&&(h=e.getSameCanvas(),t.__renderShape(h,i),c*=u,l*=f),r=Rt(n,a),o=Tt(r,-a.e,-a.f),i.matrix){const{matrix:t}=i;a.multiply(t),u*=t.scaleX,f*=t.scaleY}i=Object.assign(Object.assign({},i),{matrix:a.withScale(u,f)})}return t.__renderShape(s,i),{canvas:s,matrix:a,bounds:o,worldCanvas:h,shapeBounds:r,scaleX:c,scaleY:l}}};let Mt={};const{get:Ot,rotateOfOuter:Dt,translate:It,scaleOfOuter:zt,scale:Ft,rotate:Ut}=R;function Yt(t,e,i,s,n,o,a){const r=Ot();It(r,e.x+i,e.y+s),Ft(r,n,o),a&&Dt(r,{x:e.x+e.width/2,y:e.y+e.height/2},a),t.transform=r}function jt(t,e,i,s,n,o,a){const r=Ot();It(r,e.x+i,e.y+s),n&&Ft(r,n,o),a&&Ut(r,a),t.transform=r}function Gt(t,e,i,s,n,o,a,r,h,c){const l=Ot();if(h)if("center"===c)Dt(l,{x:i/2,y:s/2},h);else switch(Ut(l,h),h){case 90:It(l,s,0);break;case 180:It(l,i,s);break;case 270:It(l,0,i)}Mt.x=e.x+n,Mt.y=e.y+o,It(l,Mt.x,Mt.y),a&&zt(l,Mt,a,r),t.transform=l}const{get:Nt,translate:Xt}=R,qt=new y,Ht={},Vt={};function Qt(t,e,i,s){const{changeful:n,sync:o}=i;n&&(t.changeful=n),o&&(t.sync=o),t.data=Kt(i,s,e)}function Kt(t,e,i){t.padding&&(e=qt.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");let{width:s,height:n}=i;const{opacity:o,mode:a,align:r,offset:h,scale:c,size:l,rotation:d,repeat:u,filters:f}=t,g=e.width===s&&e.height===n,p={mode:a},_="center"!==r&&(d||0)%180==90;let w,y;switch(S.set(Vt,0,0,_?n:s,_?s:n),a&&"cover"!==a&&"fit"!==a?((c||l)&&(T.getScaleData(c,l,i,Ht),w=Ht.scaleX,y=Ht.scaleY),r&&(w&&S.scale(Vt,w,y,!0),E.toPoint(r,Vt,e,Vt,!0,!0))):g&&!d||(w=y=S.getFitScale(e,Vt,"fit"!==a),S.put(e,i,r,w,!1,Vt),S.scale(Vt,w,y,!0)),h&&L.move(Vt,h),a){case"stretch":g||(s=e.width,n=e.height);break;case"normal":case"clip":(Vt.x||Vt.y||w||d)&&jt(p,e,Vt.x,Vt.y,w,y,d);break;case"repeat":(!g||w||d)&&Gt(p,e,s,n,Vt.x,Vt.y,w,y,d,r),u||(p.repeat="repeat");break;default:w&&Yt(p,e,Vt.x,Vt.y,w,y,d)}return p.transform||(e.x||e.y)&&(p.transform=Nt(),Xt(p.transform,e.x,e.y)),w&&"stretch"!==a&&(p.scaleX=w,p.scaleY=y),p.width=s,p.height=n,o&&(p.opacity=o),f&&(p.filters=f),u&&(p.repeat="string"==typeof u?"x"===u?"repeat-x":"repeat-y":"repeat"),p}let Zt,$t=new y;const{isSame:Jt}=S;function te(t,e,i,s,n,o){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||Qt(n,s,i,o),!0}function ee(t,e){ne(t,A.LOAD,e)}function ie(t,e){ne(t,A.LOADED,e)}function se(t,e,i){e.error=i,t.forceUpdate("surface"),ne(t,A.ERROR,e)}function ne(t,e,i){t.hasEvent(e)&&t.emitEvent(new A(e,i))}function oe(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:ae,scale:re,copy:he}=R,{ceil:ce,abs:le}=Math;function de(t,i,s){let{scaleX:n,scaleY:o}=B.patternLocked?t.__world:t.__nowWorld;const a=n+"-"+o+"-"+s;if(i.patternId===a||t.destroyed)return!1;{n=le(n),o=le(o);const{image:t,data:r}=i;let h,c,{width:l,height:d,scaleX:u,scaleY:f,transform:g,repeat:p}=r;u&&(c=ae(),he(c,g),re(c,1/u,1/f),n*=u,o*=f),n*=s,o*=s,l*=n,d*=o;const _=l*d;if(!p&&_>e.image.maxCacheSize)return!1;let w=e.image.maxPatternSize;if(!t.isSVG){const e=t.width*t.height;w>e&&(w=e)}_>w&&(h=Math.sqrt(_/w)),h&&(n/=h,o/=h,l/=h,d/=h),u&&(n/=u,o/=f),(g||1!==n||1!==o)&&(c||(c=ae(),g&&he(c,g)),re(c,1/n,1/o));const y=t.getCanvas(ce(l)||1,ce(d)||1,r.opacity,r.filters),m=t.getPattern(y,p||e.origin.noRepeat||"no-repeat",c,i);return i.style=m,i.patternId=a,!0}}function ue(t,e,i,s){return new(i||(i=Promise))((function(n,o){function a(t){try{h(s.next(t))}catch(t){o(t)}}function r(t){try{h(s.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,r)}h((s=s.apply(t,e||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const{abs:fe}=Math;const ge={image:function(t,e,i,s,n){let o,a;const r=B.get(i);return Zt&&i===Zt.paint&&Jt(s,Zt.boxBounds)?o=Zt.leafPaint:(o={type:i.type,image:r},r.hasAlphaPixel&&(o.isTransparent=!0),Zt=r.use>1?{leafPaint:o,paint:i,boxBounds:$t.set(s)}:null),(n||r.loading)&&(a={image:r,attrName:e,attrValue:i}),r.ready?(te(t,e,i,r,o,s),n&&(ee(t,a),ie(t,a))):r.error?n&&se(t,a,r.error):(n&&(oe(t,!0),ee(t,a)),o.loadId=r.load((()=>{oe(t,!1),t.destroyed||(te(t,e,i,r,o,s)&&(r.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),ie(t,a)),o.loadId=null}),(e=>{oe(t,!1),se(t,a,e),o.loadId=null})),t.placeholderColor&&(t.placeholderDelay?setTimeout((()=>{r.ready||(r.isPlacehold=!0,t.forceUpdate("surface"))}),t.placeholderDelay):r.isPlacehold=!0)),o},checkImage:function(t,i,s,n){const{scaleX:a,scaleY:r}=B.patternLocked?t.__world:t.__nowWorld,{pixelRatio:h}=i,{data:c}=s;if(!c||s.patternId===a+"-"+r+"-"+h&&!U.running)return!1;if(n)if(c.repeat)n=!1;else if(!(s.changeful||o.isResizing(t)||U.running)){let{width:t,height:i}=c;t*=fe(a)*h,i*=fe(r)*h,c.scaleX&&(t*=c.scaleX,i*=c.scaleY),n=t*i>e.image.maxCacheSize}return n?(function(t,e,i,s){e.save(),t.windingRule?e.clip(t.windingRule):e.clip(),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,i,s,c),!0):(!s.style||s.sync||U.running?de(t,s,h):s.patternTask||(s.patternTask=B.patternTasker.add((()=>ue(this,void 0,void 0,(function*(){s.patternTask=null,i.bounds.hit(t.__nowWorld)&&de(t,s,h),t.forceUpdate("surface")}))),300)),!1)},createPattern:de,recycleImage:function(t,e){const i=e["_"+t];if(i instanceof Array){let s,n,o,a,r;for(let h=0,c=i.length;h<c;h++)s=i[h],n=s.image,r=n&&n.url,r&&(o||(o={}),o[r]=!0,B.recycle(n),n.loading&&(a||(a=e.__input&&e.__input[t]||[],a instanceof Array||(a=[a])),n.unload(i[h].loadId,!a.some((t=>t.url===r)))));return o}return null},createData:Qt,getPatternData:Kt,fillOrFitMode:Yt,clipMode:jt,repeatMode:Gt},{toPoint:pe}=C,{hasTransparent:_e}=z,we={},ye={};function me(t,e,i,s){if(i){let n,o,a,r;for(let t=0,h=i.length;t<h;t++)n=i[t],"string"==typeof n?(a=t/(h-1),o=z.string(n,s)):(a=n.offset,o=z.string(n.color,s)),e.addColorStop(a,o),!r&&_e(o)&&(r=!0);r&&(t.isTransparent=!0)}}const{getAngle:ve,getDistance:xe}=L,{get:be,rotateOfOuter:Be,scaleOfOuter:Se}=R,{toPoint:ke}=C,Re={},Te={};function Ee(t,e,i,s,n){let o;const{width:a,height:r}=t;if(a!==r||s){const t=ve(e,i);o=be(),n?(Se(o,e,a/r*(s||1),1),Be(o,e,t+90)):(Se(o,e,1,a/r*(s||1)),Be(o,e,t))}return o}const{getDistance:Le}=L,{toPoint:Ae}=C,Ce={},We={};const Pe={linearGradient:function(t,i){let{from:s,to:n,type:o,opacity:a}=t;pe(s||"top",i,we),pe(n||"bottom",i,ye);const r=e.canvas.createLinearGradient(we.x,we.y,ye.x,ye.y),h={type:o,style:r};return me(h,r,t.stops,a),h},radialGradient:function(t,i){let{from:s,to:n,type:o,opacity:a,stretch:r}=t;ke(s||"center",i,Re),ke(n||"bottom",i,Te);const h=e.canvas.createRadialGradient(Re.x,Re.y,0,Re.x,Re.y,xe(Re,Te)),c={type:o,style:h};me(c,h,t.stops,a);const l=Ee(i,Re,Te,r,!0);return l&&(c.transform=l),c},conicGradient:function(t,i){let{from:s,to:n,type:o,opacity:a,stretch:r}=t;Ae(s||"center",i,Ce),Ae(n||"bottom",i,We);const h=e.conicGradientSupport?e.canvas.createConicGradient(0,Ce.x,Ce.y):e.canvas.createRadialGradient(Ce.x,Ce.y,0,Ce.x,Ce.y,Le(Ce,We)),c={type:o,style:h};me(c,h,t.stops,a);const l=Ee(i,Ce,We,r||1,e.conicGradientRotate90);return l&&(c.transform=l),c},getTransform:Ee},{copy:Me,toOffsetOutBounds:Oe}=S,De={},Ie={};function ze(t,i,s,n){const{bounds:o,shapeBounds:a}=n;if(e.fullImageShadow){if(Me(De,t.bounds),De.x+=i.x-a.x,De.y+=i.y-a.y,s){const{matrix:t}=n;De.x-=(o.x+(t?t.e:0)+o.width/2)*(s-1),De.y-=(o.y+(t?t.f:0)+o.height/2)*(s-1),De.width*=s,De.height*=s}t.copyWorld(n.canvas,t.bounds,De)}else s&&(Me(De,i),De.x-=i.width/2*(s-1),De.y-=i.height/2*(s-1),De.width*=s,De.height*=s),t.copyWorld(n.canvas,a,s?De:i)}const{toOffsetOutBounds:Fe}=S,Ue={};const Ye={shadow:function(t,e,i){let s,n;const{__nowWorld:o,__layout:a}=t,{shadow:r}=t.__,{worldCanvas:h,bounds:c,shapeBounds:l,scaleX:d,scaleY:u}=i,f=e.getSameCanvas(),g=r.length-1;Oe(c,Ie),r.forEach(((r,p)=>{f.setWorldShadow(Ie.offsetX+r.x*d,Ie.offsetY+r.y*u,r.blur*d,z.string(r.color)),n=r.spread?1+2*r.spread/(a.boxBounds.width+2*(a.strokeBoxSpread||0)):0,ze(f,Ie,n,i),s=c,r.box&&(f.restore(),f.save(),h&&(f.copyWorld(f,c,o,"copy"),s=o),h?f.copyWorld(h,o,o,"destination-out"):f.copyWorld(i.canvas,l,c,"destination-out")),t.__worldFlipped?e.copyWorldByReset(f,s,o,r.blendMode):e.copyWorldToInner(f,s,a.renderBounds,r.blendMode),g&&p<g&&f.clearWorld(s,!0)})),f.recycle(s)},innerShadow:function(t,e,i){let s,n;const{__nowWorld:o,__layout:a}=t,{innerShadow:r}=t.__,{worldCanvas:h,bounds:c,shapeBounds:l,scaleX:d,scaleY:u}=i,f=e.getSameCanvas(),g=r.length-1;Fe(c,Ue),r.forEach(((r,p)=>{f.save(),f.setWorldShadow(Ue.offsetX+r.x*d,Ue.offsetY+r.y*u,r.blur*d),n=r.spread?1-2*r.spread/(a.boxBounds.width+2*(a.strokeBoxSpread||0)):0,ze(f,Ue,n,i),f.restore(),h?(f.copyWorld(f,c,o,"copy"),f.copyWorld(h,o,o,"source-out"),s=o):(f.copyWorld(i.canvas,l,c,"source-out"),s=c),f.fillWorld(s,z.string(r.color),"source-in"),t.__worldFlipped?e.copyWorldByReset(f,s,o,r.blendMode):e.copyWorldToInner(f,s,a.renderBounds,r.blendMode),g&&p<g&&f.clearWorld(s,!0)})),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){}},{excludeRenderBounds:je}=w;function Ge(t,e,i,s,n,o){switch(e){case"grayscale":n.useGrayscaleAlpha(t.__nowWorld);case"alpha":!function(t,e,i,s){const n=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,n),s.recycle(n),Xe(t,e,i,1)}(t,i,s,n);break;case"opacity-path":Xe(t,i,s,o);break;case"path":i.restore()}}function Ne(t){return t.getSameCanvas(!1,!0)}function Xe(t,e,i,s){const n=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,n),i.recycle(n)}Y.prototype.__renderMask=function(t,e){let i,s,n,o,a,r;const{children:h}=this;for(let c=0,l=h.length;c<l;c++)i=h[c],r=i.__.mask,r&&(a&&(Ge(this,a,t,n,s,o),s=n=null),"path"===r||"clipping-path"===r?(i.opacity<1?(a="opacity-path",o=i.opacity,n||(n=Ne(t))):(a="path",t.save()),i.__clip(n||t,e)):(a="grayscale"===r?"grayscale":"alpha",s||(s=Ne(t)),n||(n=Ne(t)),i.__render(s,e)),"clipping"!==r&&"clipping-path"!==r)||je(i,e)||i.__render(n||t,e);Ge(this,a,t,n,s,o)};const qe=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",He=qe+"_#~&*+\\=|≮≯≈≠=…",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 Ke=Qe("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Ze=Qe("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),$e=Qe(qe),Je=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:ni,After:oi,Symbol:ai,Break:ri}=ei;function hi(t){return Ke[t]?ii:ti[t]?ri:Ze[t]?ni:$e[t]?oi:Je[t]?ai:Ve.test(t)?si:ii}const ci={trimRight(t){const{words:e}=t;let i,s=0,n=e.length;for(let o=n-1;o>-1&&(i=e[o].data[0]," "===i.char);o--)s++,t.width-=i.width;s&&e.splice(n-s,s)}};function li(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:di}=ci,{Letter:ui,Single:fi,Before:gi,After:pi,Symbol:_i,Break:wi}=ei;let yi,mi,vi,xi,bi,Bi,Si,ki,Ri,Ti,Ei,Li,Ai,Ci,Wi,Pi,Mi,Oi=[];function Di(t,e){Ri&&!ki&&(ki=Ri),yi.data.push({char:t,width:e}),vi+=e}function Ii(){xi+=vi,yi.width=vi,mi.words.push(yi),yi={data:[]},vi=0}function zi(){Ci&&(Wi.paraNumber++,mi.paraStart=!0,Ci=!1),Ri&&(mi.startCharSize=ki,mi.endCharSize=Ri,ki=0),mi.width=xi,Pi.width?di(mi):Mi&&Fi(),Oi.push(mi),mi={words:[]},xi=0}function Fi(){xi>(Wi.maxWidth||0)&&(Wi.maxWidth=xi)}const{top:Ui,right:Yi,bottom:ji,left:Gi}=W;function Ni(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 Xi={getDrawData:function(t,i){"string"!=typeof t&&(t=String(t));let s=0,n=0,o=i.__getInput("width")||0,a=i.__getInput("height")||0;const{textDecoration:r,__font:h,__padding:c}=i;c&&(o?(s=c[Gi],o-=c[Yi]+c[Gi]):i.autoSizeAlign||(s=c[Gi]),a?(n=c[Ui],a-=c[Ui]+c[ji]):i.autoSizeAlign||(n=c[Ui]));const l={bounds:{x:s,y:n,width:o,height:a},rows:[],paraNumber:0,font:e.canvas.font=h};return function(t,i,s){Wi=t,Oi=t.rows,Pi=t.bounds,Mi=!Pi.width&&!s.autoSizeAlign;const{__letterSpacing:n,paraIndent:o,textCase:a}=s,{canvas:r}=e,{width:h,height:c}=Pi;if(h||c||n||"none"!==a){const t="none"!==s.textWrap,e="break"===s.textWrap;Ci=!0,Ei=null,ki=Si=Ri=vi=xi=0,yi={data:[]},mi={words:[]},n&&(i=[...i]);for(let s=0,c=i.length;s<c;s++)Bi=i[s],"\n"===Bi?(vi&&Ii(),mi.paraEnd=!0,zi(),Ci=!0):(Ti=hi(Bi),Ti===ui&&"none"!==a&&(Bi=li(Bi,a,!vi)),Si=r.measureText(Bi).width,n&&(n<0&&(Ri=Si),Si+=n),Li=Ti===fi&&(Ei===fi||Ei===ui)||Ei===fi&&Ti!==pi,Ai=!(Ti!==gi&&Ti!==fi||Ei!==_i&&Ei!==pi),bi=Ci&&o?h-o:h,t&&h&&xi+vi+Si>bi&&(e?(vi&&Ii(),xi&&zi()):(Ai||(Ai=Ti===ui&&Ei==pi),Li||Ai||Ti===wi||Ti===gi||Ti===fi||vi+Si>bi?(vi&&Ii(),xi&&zi()):xi&&zi()))," "===Bi&&!0!==Ci&&xi+vi===0||(Ti===wi?(" "===Bi&&vi&&Ii(),Di(Bi,Si),Ii()):Li||Ai?(vi&&Ii(),Di(Bi,Si)):Di(Bi,Si)),Ei=Ti);vi&&Ii(),xi&&zi(),Oi.length>0&&(Oi[Oi.length-1].paraEnd=!0)}else i.split("\n").forEach((t=>{Wi.paraNumber++,xi=r.measureText(t).width,Oi.push({x:o||0,text:t,width:xi,paraStart:!0}),Mi&&Fi()}))}(l,t,i),c&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":Ni(e,"x",t[Gi]);break;case"right":Ni(e,"x",-t[Yi])}if(!n&&i.autoSizeAlign)switch(i.verticalAlign){case"top":Ni(e,"y",t[Ui]);break;case"bottom":Ni(e,"y",-t[ji])}}(c,l,i,o,a),function(t,e){const{rows:i,bounds:s}=t,n=i.length,{__lineHeight:o,__baseLine:a,__letterSpacing:r,__clipText:h,textAlign:c,verticalAlign:l,paraSpacing:d,autoSizeAlign:u}=e;let{x:f,y:g,width:p,height:_}=s,w=o*n+(d?d*(t.paraNumber-1):0),y=a;if(h&&w>_)w=Math.max(_,o),n>1&&(t.overflow=n);else if(_||u)switch(l){case"middle":g+=(_-w)/2;break;case"bottom":g+=_-w}y+=g;let m,v,x,b=p||u?p:t.maxWidth;for(let a=0,l=n;a<l;a++){if(m=i[a],m.x=f,m.width<p||m.width>p&&!h)switch(c){case"center":m.x+=(b-m.width)/2;break;case"right":m.x+=b-m.width}m.paraStart&&d&&a>0&&(y+=d),m.y=y,y+=o,t.overflow>a&&y>w&&(m.isOverflow=!0,t.overflow=a+1),v=m.x,x=m.width,r<0&&(m.width<0?(x=-m.width+e.fontSize+r,v-=x,x+=e.fontSize):x-=r),v<s.x&&(s.x=v),x>s.width&&(s.width=x),h&&p&&p<x&&(m.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=g,s.height=w}(l,i),function(t,e,i){const{rows:s}=t,{textAlign:n,paraIndent:o,letterSpacing:a}=e;let r,h,c,l,d,u;s.forEach((t=>{t.words&&(c=o&&t.paraStart?o:0,u=t.words.length,h=i&&("justify"===n||"both"===n)&&u>1?(i-t.width-c)/(u-1):0,l=a||t.isOverflow?0:h>.01?1:2,t.isOverflow&&!a&&(t.textMode=!0),2===l?(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===l?(d={char:"",x:r},r=function(t,e,i){return t.forEach((t=>{i.char+=t.char,e+=t.width})),e}(e.data,r,d),(t.isOverflow||" "!==d.char)&&t.data.push(d)):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),!h||t.paraEnd&&"both"!==n||i===u-1||(r+=h,t.width+=h)}))),t.words=null)}))}(l,i,o),l.overflow&&function(t,i,s,n){if(!n)return;const{rows:o,overflow:a}=t;let{textOverflow:r}=i;if(o.splice(a),r&&"show"!==r){let t,h;"hide"===r?r="":"ellipsis"===r&&(r="...");const c=r?e.canvas.measureText(r).width:0,l=s+n-c;("none"===i.textWrap?o:[o[a-1]]).forEach((e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let s=i;s>-1&&(t=e.data[s],h=t.x+t.width,!(s===i&&h<l));s--){if(h<l&&" "!==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:h}),e.textMode&&function(t){t.text="",t.data.forEach((e=>{t.text+=e.char})),t.data=null}(e)}}))}}(l,i,s,o),"none"!==r&&function(t,e){let i;const{fontSize:s,textDecoration:n}=e;switch(t.decorationHeight=s/11,"object"==typeof n?(i=n.type,n.color&&(t.decorationColor=z.string(n.color))):i=n,i){case"under":t.decorationY=[.15*s];break;case"delete":t.decorationY=[.35*-s];break;case"under-delete":t.decorationY=[.15*s,.35*-s]}}(l,i),l}};const qi={string:function(t,e){const i="number"==typeof e&&1!==e;if("string"==typeof t){if(!i||!z.object)return t;t=z.object(t)}let s=void 0===t.a?1:t.a;i&&(s*=e);const n=t.r+","+t.g+","+t.b;return 1===s?"rgb("+n+")":"rgba("+n+","+s+")"}};Object.assign(j,Xi),Object.assign(z,qi),Object.assign(G,Pt),Object.assign(I,ge),Object.assign(F,Pe),Object.assign(N,Ye),Object.assign(r,{interaction:(t,e,i,s)=>new gt(t,e,i,s),hitCanvas:(t,e)=>new q(t,e),hitCanvasManager:()=>new D}),X.prototype.receiveEvent=function(t){this.interaction&&this.interaction.receive(t)};try{wx&&Q(0,wx)}catch(t){}export{gt as Interaction,rt as Layouter,q as LeaferCanvas,dt as Picker,ct as Renderer,ut as Selector,K as Watcher,Q as useCanvas};
|
|
1
|
+
import{LeaferCanvasBase as t,Platform as e,canvasPatch as i,DataHelper as s,canvasSizeAttrs as n,ResizeEvent as o,FileHelper as a,Creator as r,LeaferImage as h,defineKey as c,LeafList as l,RenderEvent as d,ChildEvent as u,WatchEvent as f,PropertyEvent as g,LeafHelper as p,BranchHelper as _,LeafBoundsHelper as w,Bounds as y,Debug as m,LeafLevelList as v,LayoutEvent as x,Run as b,ImageManager as B,BoundsHelper as S,Plugin as k,MatrixHelper as T,MathHelper as R,AlignHelper as E,PointHelper as L,ImageEvent as A,AroundHelper as C,Direction4 as W}from"@leafer/core";export*from"@leafer/core";export{LeaferImage}from"@leafer/core";import{InteractionHelper as P,InteractionBase as M,HitCanvasManager as O}from"@leafer-ui/core";export*from"@leafer-ui/core";import{PaintImage as D,Paint as I,ColorConvert as z,PaintGradient as F,Export as U,Group as Y,TextConvert as j,Effect as G,Leafer as N}from"@leafer-ui/draw";class X extends t{get allowBackgroundColor(){return!1}init(){const{config:t}=this;let i=t.view||t.canvas;i?("string"==typeof i?("#"!==i[0]&&(i="#"+i),this.viewSelect=e.miniapp.select(i)):i.fields?this.viewSelect=i:this.initView(i),this.viewSelect&&e.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:s,height:n,pixelRatio:o}=this.config,a={width:s||t.width,height:n||t.height,pixelRatio:o};this.resize(a),this.context&&(this.viewSelect&&(e.renderCanvas=this),this.context.roundRect&&(this.roundRect=function(t,e,i,s,n){this.context.roundRect(t,e,i,s,"number"==typeof n?[n]:n)}),i(this.context.__proto__))}__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)}updateClientBounds(t){this.viewSelect&&e.miniapp.getBounds(this.viewSelect).then((e=>{this.clientBounds=e,t&&t()}))}startAutoLayout(t,i){this.resizeListener=i,t&&(this.checkSize=this.checkSize.bind(this),e.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,e.miniapp.offWindowResize(this.checkSize)}unrealCanvas(){this.unreal=!0}emitResize(t){const e={};s.copyAttrs(e,this,n),this.resize(t),void 0!==this.width&&this.resizeListener(new o(t,e))}}const{mineType:q,fileType:H}=a;function V(t,i){e.origin={createCanvas:(t,e,s)=>{const n={type:"2d",width:t,height:e};return i.createOffscreenCanvas?i.createOffscreenCanvas(n):i.createOffScreenCanvas(n)},canvasToDataURL:(t,e,i)=>t.toDataURL(q(e),i),canvasToBolb:(t,e,i)=>t.toBuffer(e,{quality:i}),canvasSaveAs:(t,i,s)=>{let n=t.toDataURL(q(H(i)),s);return n=n.substring(n.indexOf("64,")+3),e.origin.download(n,i)},download:(t,s)=>new Promise(((n,o)=>{let a;s.includes("/")||(s=`${i.env.USER_DATA_PATH}/`+s,a=!0);const r=i.getFileSystemManager();r.writeFile({filePath:s,data:t,encoding:"base64",success(){a?e.miniapp.saveToAlbum(s).then((()=>{r.unlink({filePath:s}),n()})):n()},fail(t){o(t)}})})),loadImage:t=>new Promise(((i,s)=>{const n=e.canvas.view.createImage();n.onload=()=>{i(n)},n.onerror=t=>{s(t)},n.src=e.image.getRealURL(t)})),noRepeat:"repeat-x"},e.miniapp={select:t=>i.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((e=>{i.getSetting({success:s=>{s.authSetting["scope.writePhotosAlbum"]?i.saveImageToPhotosAlbum({filePath:t,success(){e(!0)}}):i.authorize({scope:"scope.writePhotosAlbum",success:()=>{i.saveImageToPhotosAlbum({filePath:t,success(){e(!0)}})},fail:()=>{}})}})})),onWindowResize(t){i.onWindowResize(t)},offWindowResize(t){i.offWindowResize(t)}},e.event={stopDefault(t){},stopNow(t){},stop(t){}},e.canvas=r.canvas(),e.conicGradientSupport=!!e.canvas.context.createConicGradient}Object.assign(r,{canvas:(t,e)=>new X(t,e),image:t=>new h(t)}),e.name="miniapp",e.requestRender=function(t){const{view:i}=e.renderCanvas||e.canvas;i.requestAnimationFrame?i.requestAnimationFrame(t):setTimeout(t,16)},c(e,"devicePixelRatio",{get:()=>Math.max(1,wx.getSystemInfoSync().pixelRatio)});class Q{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new l;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 l,this.target=t,e&&(this.config=s.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===u.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 f(f.DATA,{updatedList:this.updatedList})),this.__updatedList=new l,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[g.CHANGE,this.__onAttrChange,this],[[u.ADD,u.REMOVE],this.__onChildEvent,this],[f.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:Z,updateChange:$}=p,{pushAllChildBranch:J,pushAllParent:tt}=_;const{worldBounds:et}=w;class it{constructor(t){this.updatedBounds=new y,this.beforeBounds=new y,this.afterBounds=new y,t instanceof Array&&(t=new l(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,et)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,et),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:st,updateAllChange:nt}=p,ot=m.get("Layouter");class at{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new v,this.target=t,e&&(this.config=s.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(f.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=b.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:n,LAYOUT:o,AFTER:a}=x,r=this.getBlocks(s);r.forEach((t=>t.setBefore())),i.emitEvent(new x(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&&J(t,e),tt(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),tt(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||Z(s[t])}Z(i)}}))}(this.__levelList),function(t){t.list.forEach($)}(s),this.extraBlock&&r.push(this.extraBlock),r.forEach((t=>t.setAfter())),i.emitEvent(new x(o,r,this.times)),i.emitEvent(new x(a,r,this.times)),this.addBlocks(r),this.__levelList.reset(),this.__updatedList=null,b.end(e)}fullLayout(){const t=b.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:n}=x,o=this.getBlocks(new l(e));e.emitEvent(new x(i,o,this.times)),at.fullLayout(e),o.forEach((t=>{t.setAfter()})),e.emitEvent(new x(s,o,this.times)),e.emitEvent(new x(n,o,this.times)),this.addBlocks(o),b.end(t)}static fullLayout(t){st(t,!0),t.isBranch?_.updateBounds(t):p.updateBounds(t),nt(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new it([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new it(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],[f.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const rt=m.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:60},this.target=t,this.canvas=e,i&&(this.config=s.default(i,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.__requestRender()}requestLayout(){this.target.emit(x.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(d.CHILD_START,t),t.children.forEach((t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()})),t.emit(d.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(d.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new y,rt.log(e.innerName,"---\x3e");try{this.emitRender(d.START),this.renderOnce(t),this.emitRender(d.END,this.totalBounds),B.clearRecycled()}catch(t){this.rendering=!1,rt.error(t)}rt.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return rt.warn("rendering");if(this.times>3)return rt.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new y,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=b.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),n=new y(s);i.save(),s.spread(ht.clipSpread).ceil(),i.clearWorld(s,!0),i.clipWorld(s,!0),this.__render(s,n),i.restore(),b.end(e)}fullRender(){const t=b.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),b.end(t)}__render(t,e){const{canvas:i}=this,s=t.includes(this.target.__world),n=s?{includes:s}:{bounds:t,includes:s};this.needFill&&i.fillWorld(t,this.config.fill),m.showRepaint&&m.drawRepaint(i,t),this.target.__render(i,n),this.renderBounds=e=e||t,this.renderOptions=n,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),i.updateRender(e)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new y;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);const i=this.requestTime=Date.now();e.requestRender((()=>{this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-i))),this.requestTime=0,this.checkRender()}))}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new y(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 y(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||rt.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],[o.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.canvas=this.config=null)}}ht.clipSpread=10;const{hitRadiusPoint:ct}=S;class lt{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,n=i.ignoreHittable||!1,o=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new l(i.findList),i.findList||this.hitBranch(o);const{list:a}=this.findList,r=this.getBestMatchLeaf(a,i.bottomList,n),h=n?this.getPath(r):this.getHitablePath(r);return this.clear(),s?{path:h,target:r,throughPath:a.length?this.getThroughPath(a):h}:{path:h,target:r}}getBestMatchLeaf(t,e,i){if(t.length){let e;this.findList=new l;const{x:s,y:n}=this.point,o={x:s,y:n,radiusX:0,radiusY:0};for(let s=0,n=t.length;s<n;s++)if(e=t[s],(i||p.worldHittable(e))&&(this.hitChild(e,o),this.findList.length))return this.findList.list[0]}if(e)for(let t=0,i=e.length;t<i;t++)if(this.hitChild(e[t].target,this.point,e[t].proxy),this.findList.length)return this.findList.list[0];return t[0]}getPath(t){const e=new l;for(;t;)e.add(t),t=t.parent;return this.target&&e.add(this.target),e}getHitablePath(t){const e=this.getPath(t&&t.hittable?t:null);let i,s=new l;for(let t=e.list.length-1;t>-1&&(i=e.list[t],i.__.hittable)&&(s.addAt(i,0),i.__.hitChildren);t--);return s}getThroughPath(t){const e=new l,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,n,o;for(let t=0,a=i.length;t<a;t++){s=i[t],n=i[t+1];for(let t=0,i=s.length;t<i&&(o=s.list[t],!n||!n.has(o));t++)e.add(o)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s;const{point:n}=this;for(let o=t.length-1;o>-1;o--)i=t[o],!i.__.visible||e&&!i.__.mask||(s=!!i.__.hitRadius||ct(i.__world,n),i.isBranch?(s||i.__ignoreHitWorld)&&(this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,n)):s&&this.hitChild(i,n))}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:s}=t;if(s&&s.__hasMask&&!t.__.mask&&!s.children.some((t=>t.__.mask&&t.__hitWorld(e))))return;this.findList.add(i||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class dt{constructor(t,e){this.config={},e&&(this.config=s.default(e,this.config)),this.picker=new lt(this.target=t,this),this.finder=r.finder&&r.finder()}getByPoint(t,i,s){const{target:n,picker:o}=this;return e.backgrounder&&n&&n.updateLayout(),o.getByPoint(t,i,s)}getBy(t,e,i,s){return this.finder?this.finder.getBy(t,e,i,s):k.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}Object.assign(r,{watcher:(t,e)=>new Q(t,e),layouter:(t,e)=>new at(t,e),renderer:(t,e,i)=>new ht(t,e,i),selector:(t,e)=>new dt(t,e)}),e.layout=at.fullLayout;const ut={convertTouch(t,e){const i=ut.getTouch(t),s=P.getBase(t);return Object.assign(Object.assign({},s),{x:e.x,y:e.y,width:1,height:1,pointerType:"touch",multiTouch:t.touches.length>1,pressure:i.force||1})},getTouch:t=>t.touches[0]||t.changedTouches[0]};class ft extends M{__listenEvents(){super.__listenEvents(),this.config.eventer&&(this.config.eventer.receiveEvent=this.receive.bind(this))}receive(t){switch(t.type){case"touchstart":this.onTouchStart(t);break;case"touchmove":this.onTouchMove(t);break;case"touchend":this.onTouchEnd(t);break;case"touchcancel":this.onTouchCancel()}}getLocal(t,e){return void 0!==t.x?{x:t.x,y:t.y}:super.getLocal(t,e)}getTouches(t){return t}onTouchStart(t){this.multiTouchStart(t);const e=ut.getTouch(t);this.pointerDown(ut.convertTouch(t,this.getLocal(e,!0)))}onTouchMove(t){if(this.multiTouchMove(t),this.useMultiTouch)return;const e=ut.getTouch(t);this.pointerMove(ut.convertTouch(t,this.getLocal(e)))}onTouchEnd(t){this.multiTouchEnd();const e=ut.getTouch(t);this.pointerUp(ut.convertTouch(t,this.getLocal(e)))}onTouchCancel(){this.pointerCancel()}multiTouchStart(t){this.useMultiTouch=t.touches.length>1,this.touches=this.useMultiTouch?this.getTouches(t.touches):void 0,this.useMultiTouch&&this.pointerCancel()}multiTouchMove(t){if(this.useMultiTouch&&t.touches.length>1){const e=this.getTouches(t.touches),i=this.getKeepTouchList(this.touches,e);i.length>1&&(this.multiTouch(P.getBase(t),i),this.touches=e)}}multiTouchEnd(){this.touches=null,this.useMultiTouch=!1,this.transformEnd()}getKeepTouchList(t,e){let i;const s=[];return t.forEach((t=>{i=e.find((e=>e.identifier===t.identifier)),i&&s.push({from:this.getLocal(t),to:this.getLocal(i)})})),s}getLocalTouchs(t){return t.map((t=>this.getLocal(t)))}destroy(){super.destroy(),this.touches=null}}function gt(t,e){const i=t.__,{rows:s,decorationY:n}=i.__textDrawData;let o;i.__isPlacehold&&i.placeholderColor&&(e.fillStyle=i.placeholderColor);for(let t=0,i=s.length;t<i;t++)o=s[t],o.text?e.fillText(o.text,o.x,o.y):o.data&&o.data.forEach((t=>{e.fillText(t.char,t.x,o.y)}));if(n){const{decorationColor:t,decorationHeight:o}=i.__textDrawData;t&&(e.fillStyle=t),s.forEach((t=>n.forEach((i=>e.fillRect(t.x,t.y+i,t.width,o)))))}}function pt(t,e){t.__.__font?gt(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function _t(t,e,i){switch(e.__.strokeAlign){case"center":wt(t,1,e,i);break;case"inside":yt(t,"inside",e,i);break;case"outside":e.__.__fillAfterStroke?wt(t,2,e,i):yt(t,"outside",e,i)}}function wt(t,e,i,s){const n=i.__;s.setStroke(!n.__isStrokes&&t,n.strokeWidth*e,n),n.__isStrokes?xt(t,!0,i,s):vt(i,s)}function yt(t,e,i,s){const n=s.getSameCanvas(!0,!0);n.font=i.__.__font,wt(t,2,i,n),n.blendMode="outside"===e?"destination-out":"destination-in",gt(i,n),n.blendMode="normal",mt(s,n,i),n.recycle(i.__nowWorld)}function mt(t,i,s){s.__worldFlipped||e.fullImageShadow?t.copyWorldByReset(i,s.__nowWorld):t.copyWorldToInner(i,s.__nowWorld,s.__layout.renderBounds)}function vt(t,e){let i,s=t.__.__textDrawData;const{rows:n,decorationY:o}=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(o){const{decorationHeight:t}=s;n.forEach((i=>o.forEach((s=>e.strokeRect(i.x,i.y+s,i.width,t)))))}}function xt(t,e,i,s){let n;for(let o=0,a=t.length;o<a;o++)n=t[o],n.image&&D.checkImage(i,s,n,!1)||n.style&&(s.strokeStyle=n.style,n.blendMode?(s.saveBlendMode(n.blendMode),e?vt(i,s):s.stroke(),s.restoreBlendMode()):e?vt(i,s):s.stroke())}function bt(t,e,i){const s=e.__;if(s.__strokeWidth)if(s.__font)_t(t,e,i);else switch(s.strokeAlign){case"center":Bt(t,1,e,i);break;case"inside":!function(t,e,i){i.save(),i.clipUI(e),Bt(t,2,e,i),i.restore()}(t,e,i);break;case"outside":!function(t,e,i){const s=e.__;if(s.__fillAfterStroke)Bt(t,2,e,i);else{const{renderBounds:n}=e.__layout,o=i.getSameCanvas(!0,!0);e.__drawRenderPath(o),Bt(t,2,e,o),o.clipUI(s),o.clearWorld(n),mt(i,o,e),o.recycle(e.__nowWorld)}}(t,e,i)}}function Bt(t,e,i,s){const n=i.__;s.setStroke(!n.__isStrokes&&t,n.__strokeWidth*e,n),n.__isStrokes?xt(t,!1,i,s):s.stroke(),n.__useArrow&&I.strokeArrow(t,i,s)}const{getSpread:St,getOuterOf:kt,getByMove:Tt,getIntersectData:Rt}=S;let Et;const{stintSet:Lt}=s,{hasTransparent:At}=z;function Ct(t,e,i){if("object"!=typeof e||!1===e.visible||0===e.opacity)return;let s;const{boxBounds:n}=i.__layout;switch(e.type){case"image":s=D.image(i,t,e,n,!Et||!Et[e.url]);break;case"linear":s=F.linearGradient(e,n);break;case"radial":s=F.radialGradient(e,n);break;case"angular":s=F.conicGradient(e,n);break;case"solid":const{type:o,color:a,opacity:r}=e;s={type:o,style:z.string(a,r)};break;default:void 0!==e.r&&(s={type:"solid",style:z.string(e)})}return s&&("string"==typeof s.style&&At(s.style)&&(s.isTransparent=!0),e.blendMode&&(s.blendMode=e.blendMode)),s}const Wt={compute:function(t,e){const i=e.__,s=[];let n,o,a=i.__input[t];a instanceof Array||(a=[a]),Et=D.recycleImage(t,i);for(let i,n=0,o=a.length;n<o;n++)(i=Ct(t,a[n],e))&&s.push(i);i["_"+t]=s.length?s:void 0,s.length&&s.every((t=>t.isTransparent))&&(s.some((t=>t.image))&&(n=!0),o=!0),"fill"===t?(Lt(i,"__isAlphaPixelFill",n),Lt(i,"__isTransparentFill",o)):(Lt(i,"__isAlphaPixelStroke",n),Lt(i,"__isTransparentStroke",o))},fill:function(t,e,i){i.fillStyle=t,pt(e,i)},fills:function(t,e,i){let s;for(let n=0,o=t.length;n<o;n++){if(s=t[n],s.image){if(D.checkImage(e,i,s,!e.__.__font))continue;if(!s.style){!n&&s.image.isPlacehold&&e.drawImagePlaceholder(i,s.image);continue}}i.fillStyle=s.style,s.transform?(i.save(),i.transform(s.transform),s.blendMode&&(i.blendMode=s.blendMode),pt(e,i),i.restore()):s.blendMode?(i.saveBlendMode(s.blendMode),pt(e,i),i.restoreBlendMode()):pt(e,i)}},fillPathOrText:pt,fillText:gt,stroke:bt,strokes:function(t,e,i){bt(t,e,i)},strokeText:_t,drawTextStroke:vt,shape:function(t,e,i){const s=e.getSameCanvas(),n=t.__nowWorld;let o,a,r,h,{scaleX:c,scaleY:l}=n;if(c<0&&(c=-c),l<0&&(l=-l),e.bounds.includes(n))h=s,o=r=n;else{const{renderShapeSpread:s}=t.__layout,d=Rt(s?St(e.bounds,c===l?s*c:[s*l,s*c]):e.bounds,n);a=e.bounds.getFitMatrix(d);let{a:u,d:f}=a;if(a.a<1&&(h=e.getSameCanvas(),t.__renderShape(h,i),c*=u,l*=f),r=kt(n,a),o=Tt(r,-a.e,-a.f),i.matrix){const{matrix:t}=i;a.multiply(t),u*=t.scaleX,f*=t.scaleY}i=Object.assign(Object.assign({},i),{matrix:a.withScale(u,f)})}return t.__renderShape(s,i),{canvas:s,matrix:a,bounds:o,worldCanvas:h,shapeBounds:r,scaleX:c,scaleY:l}}};let Pt={};const{get:Mt,rotateOfOuter:Ot,translate:Dt,scaleOfOuter:It,scale:zt,rotate:Ft}=T;function Ut(t,e,i,s,n,o,a){const r=Mt();Dt(r,e.x+i,e.y+s),zt(r,n,o),a&&Ot(r,{x:e.x+e.width/2,y:e.y+e.height/2},a),t.transform=r}function Yt(t,e,i,s,n,o,a){const r=Mt();Dt(r,e.x+i,e.y+s),n&&zt(r,n,o),a&&Ft(r,a),t.transform=r}function jt(t,e,i,s,n,o,a,r,h,c){const l=Mt();if(h)if("center"===c)Ot(l,{x:i/2,y:s/2},h);else switch(Ft(l,h),h){case 90:Dt(l,s,0);break;case 180:Dt(l,i,s);break;case 270:Dt(l,0,i)}Pt.x=e.x+n,Pt.y=e.y+o,Dt(l,Pt.x,Pt.y),a&&It(l,Pt,a,r),t.transform=l}const{get:Gt,translate:Nt}=T,Xt=new y,qt={},Ht={};function Vt(t,e,i,s){const{changeful:n,sync:o}=i;n&&(t.changeful=n),o&&(t.sync=o),t.data=Qt(i,s,e)}function Qt(t,e,i){t.padding&&(e=Xt.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");let{width:s,height:n}=i;const{opacity:o,mode:a,align:r,offset:h,scale:c,size:l,rotation:d,repeat:u,filters:f}=t,g=e.width===s&&e.height===n,p={mode:a},_="center"!==r&&(d||0)%180==90;let w,y;switch(S.set(Ht,0,0,_?n:s,_?s:n),a&&"cover"!==a&&"fit"!==a?((c||l)&&(R.getScaleData(c,l,i,qt),w=qt.scaleX,y=qt.scaleY),r&&(w&&S.scale(Ht,w,y,!0),E.toPoint(r,Ht,e,Ht,!0,!0))):g&&!d||(w=y=S.getFitScale(e,Ht,"fit"!==a),S.put(e,i,r,w,!1,Ht),S.scale(Ht,w,y,!0)),h&&L.move(Ht,h),a){case"stretch":g||(s=e.width,n=e.height);break;case"normal":case"clip":(Ht.x||Ht.y||w||d)&&Yt(p,e,Ht.x,Ht.y,w,y,d);break;case"repeat":(!g||w||d)&&jt(p,e,s,n,Ht.x,Ht.y,w,y,d,r),u||(p.repeat="repeat");break;default:w&&Ut(p,e,Ht.x,Ht.y,w,y,d)}return p.transform||(e.x||e.y)&&(p.transform=Gt(),Nt(p.transform,e.x,e.y)),w&&"stretch"!==a&&(p.scaleX=w,p.scaleY=y),p.width=s,p.height=n,o&&(p.opacity=o),f&&(p.filters=f),u&&(p.repeat="string"==typeof u?"x"===u?"repeat-x":"repeat-y":"repeat"),p}let Kt,Zt=new y;const{isSame:$t}=S;function Jt(t,e,i,s,n,o){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||Vt(n,s,i,o),!0}function te(t,e){se(t,A.LOAD,e)}function ee(t,e){se(t,A.LOADED,e)}function ie(t,e,i){e.error=i,t.forceUpdate("surface"),se(t,A.ERROR,e)}function se(t,e,i){t.hasEvent(e)&&t.emitEvent(new A(e,i))}function ne(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:oe,scale:ae,copy:re}=T,{ceil:he,abs:ce}=Math;function le(t,i,s){let{scaleX:n,scaleY:o}=B.patternLocked?t.__world:t.__nowWorld;const a=n+"-"+o+"-"+s;if(i.patternId===a||t.destroyed)return!1;{n=ce(n),o=ce(o);const{image:t,data:r}=i;let h,c,{width:l,height:d,scaleX:u,scaleY:f,transform:g,repeat:p}=r;u&&(c=oe(),re(c,g),ae(c,1/u,1/f),n*=u,o*=f),n*=s,o*=s,l*=n,d*=o;const _=l*d;if(!p&&_>e.image.maxCacheSize)return!1;let w=e.image.maxPatternSize;if(!t.isSVG){const e=t.width*t.height;w>e&&(w=e)}_>w&&(h=Math.sqrt(_/w)),h&&(n/=h,o/=h,l/=h,d/=h),u&&(n/=u,o/=f),(g||1!==n||1!==o)&&(c||(c=oe(),g&&re(c,g)),ae(c,1/n,1/o));const y=t.getCanvas(he(l)||1,he(d)||1,r.opacity,r.filters),m=t.getPattern(y,p||e.origin.noRepeat||"no-repeat",c,i);return i.style=m,i.patternId=a,!0}}function de(t,e,i,s){return new(i||(i=Promise))((function(n,o){function a(t){try{h(s.next(t))}catch(t){o(t)}}function r(t){try{h(s.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,r)}h((s=s.apply(t,e||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const{abs:ue}=Math;const fe={image:function(t,e,i,s,n){let o,a;const r=B.get(i);return Kt&&i===Kt.paint&&$t(s,Kt.boxBounds)?o=Kt.leafPaint:(o={type:i.type,image:r},r.hasAlphaPixel&&(o.isTransparent=!0),Kt=r.use>1?{leafPaint:o,paint:i,boxBounds:Zt.set(s)}:null),(n||r.loading)&&(a={image:r,attrName:e,attrValue:i}),r.ready?(Jt(t,e,i,r,o,s),n&&(te(t,a),ee(t,a))):r.error?n&&ie(t,a,r.error):(n&&(ne(t,!0),te(t,a)),o.loadId=r.load((()=>{ne(t,!1),t.destroyed||(Jt(t,e,i,r,o,s)&&(r.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),ee(t,a)),o.loadId=null}),(e=>{ne(t,!1),ie(t,a,e),o.loadId=null})),t.placeholderColor&&(t.placeholderDelay?setTimeout((()=>{r.ready||(r.isPlacehold=!0,t.forceUpdate("surface"))}),t.placeholderDelay):r.isPlacehold=!0)),o},checkImage:function(t,i,s,n){const{scaleX:a,scaleY:r}=B.patternLocked?t.__world:t.__nowWorld,{pixelRatio:h}=i,{data:c}=s;if(!c||s.patternId===a+"-"+r+"-"+h&&!U.running)return!1;if(n)if(c.repeat)n=!1;else if(!(s.changeful||o.isResizing(t)||U.running)){let{width:t,height:i}=c;t*=ue(a)*h,i*=ue(r)*h,c.scaleX&&(t*=c.scaleX,i*=c.scaleY),n=t*i>e.image.maxCacheSize}return n?(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,i,s,c),!0):(!s.style||s.sync||U.running?le(t,s,h):s.patternTask||(s.patternTask=B.patternTasker.add((()=>de(this,void 0,void 0,(function*(){s.patternTask=null,i.bounds.hit(t.__nowWorld)&&le(t,s,h),t.forceUpdate("surface")}))),300)),!1)},createPattern:le,recycleImage:function(t,e){const i=e["_"+t];if(i instanceof Array){let s,n,o,a,r;for(let h=0,c=i.length;h<c;h++)s=i[h],n=s.image,r=n&&n.url,r&&(o||(o={}),o[r]=!0,B.recycle(n),n.loading&&(a||(a=e.__input&&e.__input[t]||[],a instanceof Array||(a=[a])),n.unload(i[h].loadId,!a.some((t=>t.url===r)))));return o}return null},createData:Vt,getPatternData:Qt,fillOrFitMode:Ut,clipMode:Yt,repeatMode:jt},{toPoint:ge}=C,{hasTransparent:pe}=z,_e={},we={};function ye(t,e,i,s){if(i){let n,o,a,r;for(let t=0,h=i.length;t<h;t++)n=i[t],"string"==typeof n?(a=t/(h-1),o=z.string(n,s)):(a=n.offset,o=z.string(n.color,s)),e.addColorStop(a,o),!r&&pe(o)&&(r=!0);r&&(t.isTransparent=!0)}}const{getAngle:me,getDistance:ve}=L,{get:xe,rotateOfOuter:be,scaleOfOuter:Be}=T,{toPoint:Se}=C,ke={},Te={};function Re(t,e,i,s,n){let o;const{width:a,height:r}=t;if(a!==r||s){const t=me(e,i);o=xe(),n?(Be(o,e,a/r*(s||1),1),be(o,e,t+90)):(Be(o,e,1,a/r*(s||1)),be(o,e,t))}return o}const{getDistance:Ee}=L,{toPoint:Le}=C,Ae={},Ce={};const We={linearGradient:function(t,i){let{from:s,to:n,type:o,opacity:a}=t;ge(s||"top",i,_e),ge(n||"bottom",i,we);const r=e.canvas.createLinearGradient(_e.x,_e.y,we.x,we.y),h={type:o,style:r};return ye(h,r,t.stops,a),h},radialGradient:function(t,i){let{from:s,to:n,type:o,opacity:a,stretch:r}=t;Se(s||"center",i,ke),Se(n||"bottom",i,Te);const h=e.canvas.createRadialGradient(ke.x,ke.y,0,ke.x,ke.y,ve(ke,Te)),c={type:o,style:h};ye(c,h,t.stops,a);const l=Re(i,ke,Te,r,!0);return l&&(c.transform=l),c},conicGradient:function(t,i){let{from:s,to:n,type:o,opacity:a,stretch:r}=t;Le(s||"center",i,Ae),Le(n||"bottom",i,Ce);const h=e.conicGradientSupport?e.canvas.createConicGradient(0,Ae.x,Ae.y):e.canvas.createRadialGradient(Ae.x,Ae.y,0,Ae.x,Ae.y,Ee(Ae,Ce)),c={type:o,style:h};ye(c,h,t.stops,a);const l=Re(i,Ae,Ce,r||1,e.conicGradientRotate90);return l&&(c.transform=l),c},getTransform:Re},{copy:Pe,toOffsetOutBounds:Me}=S,Oe={},De={};function Ie(t,i,s,n){const{bounds:o,shapeBounds:a}=n;if(e.fullImageShadow){if(Pe(Oe,t.bounds),Oe.x+=i.x-a.x,Oe.y+=i.y-a.y,s){const{matrix:t}=n;Oe.x-=(o.x+(t?t.e:0)+o.width/2)*(s-1),Oe.y-=(o.y+(t?t.f:0)+o.height/2)*(s-1),Oe.width*=s,Oe.height*=s}t.copyWorld(n.canvas,t.bounds,Oe)}else s&&(Pe(Oe,i),Oe.x-=i.width/2*(s-1),Oe.y-=i.height/2*(s-1),Oe.width*=s,Oe.height*=s),t.copyWorld(n.canvas,a,s?Oe:i)}const{toOffsetOutBounds:ze}=S,Fe={};const Ue={shadow:function(t,e,i){let s,n;const{__nowWorld:o,__layout:a}=t,{shadow:r}=t.__,{worldCanvas:h,bounds:c,shapeBounds:l,scaleX:d,scaleY:u}=i,f=e.getSameCanvas(),g=r.length-1;Me(c,De),r.forEach(((r,p)=>{f.setWorldShadow(De.offsetX+r.x*d,De.offsetY+r.y*u,r.blur*d,z.string(r.color)),n=r.spread?1+2*r.spread/(a.boxBounds.width+2*(a.strokeBoxSpread||0)):0,Ie(f,De,n,i),s=c,r.box&&(f.restore(),f.save(),h&&(f.copyWorld(f,c,o,"copy"),s=o),h?f.copyWorld(h,o,o,"destination-out"):f.copyWorld(i.canvas,l,c,"destination-out")),t.__worldFlipped?e.copyWorldByReset(f,s,o,r.blendMode):e.copyWorldToInner(f,s,a.renderBounds,r.blendMode),g&&p<g&&f.clearWorld(s,!0)})),f.recycle(s)},innerShadow:function(t,e,i){let s,n;const{__nowWorld:o,__layout:a}=t,{innerShadow:r}=t.__,{worldCanvas:h,bounds:c,shapeBounds:l,scaleX:d,scaleY:u}=i,f=e.getSameCanvas(),g=r.length-1;ze(c,Fe),r.forEach(((r,p)=>{f.save(),f.setWorldShadow(Fe.offsetX+r.x*d,Fe.offsetY+r.y*u,r.blur*d),n=r.spread?1-2*r.spread/(a.boxBounds.width+2*(a.strokeBoxSpread||0)):0,Ie(f,Fe,n,i),f.restore(),h?(f.copyWorld(f,c,o,"copy"),f.copyWorld(h,o,o,"source-out"),s=o):(f.copyWorld(i.canvas,l,c,"source-out"),s=c),f.fillWorld(s,z.string(r.color),"source-in"),t.__worldFlipped?e.copyWorldByReset(f,s,o,r.blendMode):e.copyWorldToInner(f,s,a.renderBounds,r.blendMode),g&&p<g&&f.clearWorld(s,!0)})),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){}},{excludeRenderBounds:Ye}=w;function je(t,e,i,s,n,o){switch(e){case"grayscale":n.useGrayscaleAlpha(t.__nowWorld);case"alpha":!function(t,e,i,s){const n=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,n),s.recycle(n),Ne(t,e,i,1)}(t,i,s,n);break;case"opacity-path":Ne(t,i,s,o);break;case"path":i.restore()}}function Ge(t){return t.getSameCanvas(!1,!0)}function Ne(t,e,i,s){const n=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,n),i.recycle(n)}Y.prototype.__renderMask=function(t,e){let i,s,n,o,a,r;const{children:h}=this;for(let c=0,l=h.length;c<l;c++)i=h[c],r=i.__.mask,r&&(a&&(je(this,a,t,n,s,o),s=n=null),"path"===r||"clipping-path"===r?(i.opacity<1?(a="opacity-path",o=i.opacity,n||(n=Ge(t))):(a="path",t.save()),i.__clip(n||t,e)):(a="grayscale"===r?"grayscale":"alpha",s||(s=Ge(t)),n||(n=Ge(t)),i.__render(s,e)),"clipping"!==r&&"clipping-path"!==r)||Ye(i,e)||i.__render(n||t,e);je(this,a,t,n,s,o)};const Xe=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",qe=Xe+"_#~&*+\\=|≮≯≈≠=…",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"),Ke=Ve("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Ze=Ve(Xe),$e=Ve(qe),Je=Ve("- —/~|┆·");var ti;!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"}(ti||(ti={}));const{Letter:ei,Single:ii,Before:si,After:ni,Symbol:oi,Break:ai}=ti;function ri(t){return Qe[t]?ei:Je[t]?ai:Ke[t]?si:Ze[t]?ni:$e[t]?oi:He.test(t)?ii:ei}const hi={trimRight(t){const{words:e}=t;let i,s=0,n=e.length;for(let o=n-1;o>-1&&(i=e[o].data[0]," "===i.char);o--)s++,t.width-=i.width;s&&e.splice(n-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:li}=hi,{Letter:di,Single:ui,Before:fi,After:gi,Symbol:pi,Break:_i}=ti;let wi,yi,mi,vi,xi,bi,Bi,Si,ki,Ti,Ri,Ei,Li,Ai,Ci,Wi,Pi,Mi=[];function Oi(t,e){ki&&!Si&&(Si=ki),wi.data.push({char:t,width:e}),mi+=e}function Di(){vi+=mi,wi.width=mi,yi.words.push(wi),wi={data:[]},mi=0}function Ii(){Ai&&(Ci.paraNumber++,yi.paraStart=!0,Ai=!1),ki&&(yi.startCharSize=Si,yi.endCharSize=ki,Si=0),yi.width=vi,Wi.width?li(yi):Pi&&zi(),Mi.push(yi),yi={words:[]},vi=0}function zi(){vi>(Ci.maxWidth||0)&&(Ci.maxWidth=vi)}const{top:Fi,right:Ui,bottom:Yi,left:ji}=W;function Gi(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 Ni={getDrawData:function(t,i){"string"!=typeof t&&(t=String(t));let s=0,n=0,o=i.__getInput("width")||0,a=i.__getInput("height")||0;const{textDecoration:r,__font:h,__padding:c}=i;c&&(o?(s=c[ji],o-=c[Ui]+c[ji]):i.autoSizeAlign||(s=c[ji]),a?(n=c[Fi],a-=c[Fi]+c[Yi]):i.autoSizeAlign||(n=c[Fi]));const l={bounds:{x:s,y:n,width:o,height:a},rows:[],paraNumber:0,font:e.canvas.font=h};return function(t,i,s){Ci=t,Mi=t.rows,Wi=t.bounds,Pi=!Wi.width&&!s.autoSizeAlign;const{__letterSpacing:n,paraIndent:o,textCase:a}=s,{canvas:r}=e,{width:h,height:c}=Wi;if(h||c||n||"none"!==a){const t="none"!==s.textWrap,e="break"===s.textWrap;Ai=!0,Ri=null,Si=Bi=ki=mi=vi=0,wi={data:[]},yi={words:[]},n&&(i=[...i]);for(let s=0,c=i.length;s<c;s++)bi=i[s],"\n"===bi?(mi&&Di(),yi.paraEnd=!0,Ii(),Ai=!0):(Ti=ri(bi),Ti===di&&"none"!==a&&(bi=ci(bi,a,!mi)),Bi=r.measureText(bi).width,n&&(n<0&&(ki=Bi),Bi+=n),Ei=Ti===ui&&(Ri===ui||Ri===di)||Ri===ui&&Ti!==gi,Li=!(Ti!==fi&&Ti!==ui||Ri!==pi&&Ri!==gi),xi=Ai&&o?h-o:h,t&&h&&vi+mi+Bi>xi&&(e?(mi&&Di(),vi&&Ii()):(Li||(Li=Ti===di&&Ri==gi),Ei||Li||Ti===_i||Ti===fi||Ti===ui||mi+Bi>xi?(mi&&Di(),vi&&Ii()):vi&&Ii()))," "===bi&&!0!==Ai&&vi+mi===0||(Ti===_i?(" "===bi&&mi&&Di(),Oi(bi,Bi),Di()):Ei||Li?(mi&&Di(),Oi(bi,Bi)):Oi(bi,Bi)),Ri=Ti);mi&&Di(),vi&&Ii(),Mi.length>0&&(Mi[Mi.length-1].paraEnd=!0)}else i.split("\n").forEach((t=>{Ci.paraNumber++,vi=r.measureText(t).width,Mi.push({x:o||0,text:t,width:vi,paraStart:!0}),Pi&&zi()}))}(l,t,i),c&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":Gi(e,"x",t[ji]);break;case"right":Gi(e,"x",-t[Ui])}if(!n&&i.autoSizeAlign)switch(i.verticalAlign){case"top":Gi(e,"y",t[Fi]);break;case"bottom":Gi(e,"y",-t[Yi])}}(c,l,i,o,a),function(t,e){const{rows:i,bounds:s}=t,n=i.length,{__lineHeight:o,__baseLine:a,__letterSpacing:r,__clipText:h,textAlign:c,verticalAlign:l,paraSpacing:d,autoSizeAlign:u}=e;let{x:f,y:g,width:p,height:_}=s,w=o*n+(d?d*(t.paraNumber-1):0),y=a;if(h&&w>_)w=Math.max(_,o),n>1&&(t.overflow=n);else if(_||u)switch(l){case"middle":g+=(_-w)/2;break;case"bottom":g+=_-w}y+=g;let m,v,x,b=p||u?p:t.maxWidth;for(let a=0,l=n;a<l;a++){if(m=i[a],m.x=f,m.width<p||m.width>p&&!h)switch(c){case"center":m.x+=(b-m.width)/2;break;case"right":m.x+=b-m.width}m.paraStart&&d&&a>0&&(y+=d),m.y=y,y+=o,t.overflow>a&&y>w&&(m.isOverflow=!0,t.overflow=a+1),v=m.x,x=m.width,r<0&&(m.width<0?(x=-m.width+e.fontSize+r,v-=x,x+=e.fontSize):x-=r),v<s.x&&(s.x=v),x>s.width&&(s.width=x),h&&p&&p<x&&(m.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=g,s.height=w}(l,i),function(t,e,i){const{rows:s}=t,{textAlign:n,paraIndent:o,letterSpacing:a}=e;let r,h,c,l,d,u;s.forEach((t=>{t.words&&(c=o&&t.paraStart?o:0,u=t.words.length,h=i&&("justify"===n||"both"===n)&&u>1?(i-t.width-c)/(u-1):0,l=a||t.isOverflow?0:h>.01?1:2,t.isOverflow&&!a&&(t.textMode=!0),2===l?(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===l?(d={char:"",x:r},r=function(t,e,i){return t.forEach((t=>{i.char+=t.char,e+=t.width})),e}(e.data,r,d),(t.isOverflow||" "!==d.char)&&t.data.push(d)):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),!h||t.paraEnd&&"both"!==n||i===u-1||(r+=h,t.width+=h)}))),t.words=null)}))}(l,i,o),l.overflow&&function(t,i,s,n){if(!n)return;const{rows:o,overflow:a}=t;let{textOverflow:r}=i;if(o.splice(a),r&&"show"!==r){let t,h;"hide"===r?r="":"ellipsis"===r&&(r="...");const c=r?e.canvas.measureText(r).width:0,l=s+n-c;("none"===i.textWrap?o:[o[a-1]]).forEach((e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let s=i;s>-1&&(t=e.data[s],h=t.x+t.width,!(s===i&&h<l));s--){if(h<l&&" "!==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:h}),e.textMode&&function(t){t.text="",t.data.forEach((e=>{t.text+=e.char})),t.data=null}(e)}}))}}(l,i,s,o),"none"!==r&&function(t,e){let i;const{fontSize:s,textDecoration:n}=e;switch(t.decorationHeight=s/11,"object"==typeof n?(i=n.type,n.color&&(t.decorationColor=z.string(n.color))):i=n,i){case"under":t.decorationY=[.15*s];break;case"delete":t.decorationY=[.35*-s];break;case"under-delete":t.decorationY=[.15*s,.35*-s]}}(l,i),l}};const Xi={string:function(t,e){const i="number"==typeof e&&1!==e;if("string"==typeof t){if(!i||!z.object)return t;t=z.object(t)}let s=void 0===t.a?1:t.a;i&&(s*=e);const n=t.r+","+t.g+","+t.b;return 1===s?"rgb("+n+")":"rgba("+n+","+s+")"}};Object.assign(j,Ni),Object.assign(z,Xi),Object.assign(I,Wt),Object.assign(D,fe),Object.assign(F,We),Object.assign(G,Ue),Object.assign(r,{interaction:(t,e,i,s)=>new ft(t,e,i,s),hitCanvas:(t,e)=>new X(t,e),hitCanvasManager:()=>new O}),N.prototype.receiveEvent=function(t){this.interaction&&this.interaction.receive(t)};try{wx&&V(0,wx)}catch(t){}export{ft as Interaction,at as Layouter,X as LeaferCanvas,lt as Picker,ht as Renderer,dt as Selector,Q as Watcher,V as useCanvas};
|
|
2
2
|
//# sourceMappingURL=miniapp.esm.min.js.map
|